@sheetxl/mcp 0.8.0-beta.25 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/assets/{CDiutOsLAzu4c0Ej.js → 1d-8AAcf1UmC2qIz.js} +1 -1
  2. package/assets/{V4pGXJr6fe-CPg7i.js → 30KXHiLfwl0cbsxL.js} +1 -1
  3. package/assets/{CCOaNx5_BfWCc9yz.js → 3o7I8loKRGynHrNq.js} +1 -1
  4. package/assets/{Brlza6Jd2oGGX9vB.js → 648qV0v861jvyZWm.js} +1 -1
  5. package/assets/{GfAXkT_vctdRX_9f.js → 7khlPnFFCrE8gnT_.js} +12 -12
  6. package/assets/{CX-KrjVgXM-7o--S.js → 8hUUTZ62hbxY0TOp.js} +2 -2
  7. package/assets/{DaB9iRVJj3TmKH92.js → B1Vm5y0E-TPSYFya.js} +3 -3
  8. package/assets/{B6e_DsVO4i91IYEO.js → B6ToyMcYe9lyaeDk.js} +3 -3
  9. package/assets/{DB2MrmDLZ-OzVRQu.js → B6pS096VwbWaj1Zz.js} +2 -2
  10. package/assets/{DwmlBb640xWfAMV2.js → B9V6AFTTnbPscv11.js} +2 -2
  11. package/assets/{DHCl7HWDbT3xqx8W.js → BESu-5sZSIJqkrWN.js} +2 -2
  12. package/assets/{BSJ_L1gNOejEih6N.js → BHhPtFpb3YfV6_44.js} +32 -32
  13. package/assets/{u8xtjHo43n-S_O6j.js → BMAAmO8LPIe4VJ77.js} +1 -1
  14. package/assets/{C9DvPNfuz_0hun6C.js → BMVu89mdcVSqJDDE.js} +1 -1
  15. package/assets/{DBgHcEP-FcgSHLvx.js → BRB5-fXJFU7Kq2wm.js} +314 -314
  16. package/assets/{CD2yoEhIT8DyXBou.js → BRI3D42tlMkZdYb2.js} +37 -37
  17. package/assets/{DgE30NwKzEjZI1W6.js → BVzogMoyaicBEKBk.js} +3 -3
  18. package/assets/{DXDhH3F4N4OOigqN.js → BWpLQNKC3n8bXJUk.js} +1 -1
  19. package/assets/{Cmf4eJow6AIuPH_w.js → Baa8cmJsilboM0DW.js} +1 -1
  20. package/assets/{irrAIfw6CnCOHmPE.js → BcDNXTGASDvptqc-.js} +1 -1
  21. package/assets/{Djl7cjJyCIS_Qvbd.js → Bme_PT3UqwTbGLWd.js} +1 -1
  22. package/assets/{DZTVTdrwu05fNZk_.js → BnxajOeIasx1G3OB.js} +1 -1
  23. package/assets/{cTLYCAhDs2fR2ITC.js → BousX61zAjBfjlsV.js} +1 -1
  24. package/assets/{DAnTpFc2vx3CmP8e.js → Bp73VL7f5DEt88Cn.js} +26 -26
  25. package/assets/{DLW76uSURiQM07DD.js → BppAvnmuJbbYBQUy.js} +1 -1
  26. package/assets/{DvkgborRc2vRq8E-.js → BtoBfR_4n1u37HmC.js} +1 -1
  27. package/assets/{H40qXR3Gazmnq4Mv.js → BuLAeGM4AvHCge4x.js} +1 -1
  28. package/assets/{45FAgD1JyG2a1Rti.js → Buxo11Ux7uxzoy_7.js} +2 -2
  29. package/assets/{u9le-qZ3tbYKK1kU.js → BwTF2TRqzXsf0H1I.js} +2 -2
  30. package/assets/{m9BgbF-NgPIYW4kc.js → BzCwrG3Zdv-Trzi_.js} +1 -1
  31. package/assets/{H_6CBe3t27jHlBHk.js → C00qhh0-m0B0JP9Y.js} +140 -140
  32. package/assets/{C6Vsz4e_ASJdx3LP.js → C5VvbPUAfrVKmXXs.js} +1 -1
  33. package/assets/{Cu4ok_jTnQif8QtX.js → C85xBYGjAzNmVNwL.js} +1 -1
  34. package/assets/{Duw8QQGcrPmesb-M.js → C880pTyOMof_fzPO.js} +1 -1
  35. package/assets/{70weNsvW2LMx5QcW.js → C88UXFOnR1Uc-nw2.js} +1 -1
  36. package/assets/{CYtkZMCX6dyEqjb9.js → C8G6iJz_vsgbNYq9.js} +4 -4
  37. package/assets/{DX94YgmfoL_ngS60.js → CAQgJMpje7ORQ5lt.js} +1 -1
  38. package/assets/CBSyNN4Fk5WsVStK.js +14 -0
  39. package/assets/{BktUuVP0Jew8_-ff.js → CCeqR45x9p-GG8Pi.js} +1 -1
  40. package/assets/{xSUMX6J9-MJIGgmG.js → CEDsCeYCSlY7wYe1.js} +2 -2
  41. package/assets/{CfWSdzSpbErVA_1h.js → CFWHwEc3dKMmNzUp.js} +338 -338
  42. package/assets/{CGS7apShLtnlmF8D.js → CK9LWUZdZ93t3GkS.js} +1 -1
  43. package/assets/{V_VVW06vjWkmlbdh.js → CL-BRusnISEAzebz.js} +527 -527
  44. package/assets/{C-FJab2sVwBbOTiA.js → CLvFlk5-KU2jnQ5r.js} +1 -1
  45. package/assets/{ClRgSo0axU3lAOwR.js → CUhCIQjymULgXquN.js} +1 -1
  46. package/assets/{Cb7FKT3S78r6IYHi.js → CboWvqCV0yix3-yP.js} +1 -1
  47. package/assets/{COZ-bhj463kGINFA.js → Ci4AUhBajQMJs1Ty.js} +1 -1
  48. package/assets/{eCD6fmcTsgv76IZm.js → CkQT1G_6bvMixZ8e.js} +4 -4
  49. package/assets/{DFd0JAiw5dkbnULM.js → CkqsYktaMF9p014y.js} +1 -1
  50. package/assets/{CSMsn9bKgR9kWG0m.js → CkuL4Ed6oRGAhIS9.js} +1 -1
  51. package/assets/{COXWiXy3DCfmXSm5.js → Cm41HVr6Xyz53jHz.js} +1 -1
  52. package/assets/{DQlLgxA592HvgKzh.js → CoY2sE2RG-Nd8TMR.js} +1 -1
  53. package/assets/{DZOzgVEOXfHTE3YC.js → CuRvGO_2tG0PUhCM.js} +1 -1
  54. package/assets/{ckvxz2tZRlY1UPpg.js → CvqpsTll6ngbdHgx.js} +9731 -9750
  55. package/assets/{BAowTO-7Utmg0UvM.js → Cvs9i2VUl7wXWZup.js} +3 -3
  56. package/assets/{CFrOPd_UcD7qclCq.js → Cy2uazuc6KpkbYg-.js} +1 -1
  57. package/assets/{cU78RT4WJKAp5mU_.js → CybNjXi6cOFKyGuH.js} +1 -1
  58. package/assets/{BHIi-cAKnh_sAifV.js → CzPMiqbNDm6TDPGJ.js} +1 -1
  59. package/assets/{D6qQAWN_5p3FAshK.js → CzYXLEVIoCfQ1AMM.js} +157 -157
  60. package/assets/{D7NjohknztgMLqhT.js → D-BWtxIGXTCMLoio.js} +2 -2
  61. package/assets/{C-Vt758qtn8QeCrw.js → D0Ly34TqieVSOIbh.js} +1 -1
  62. package/assets/{Abkx7KJ6_X5avkR4.js → D0M0EWP28g5rQaei.js} +3 -3
  63. package/assets/{D053O1kZ7JtMwiqh.js → D4NBYfzSZ3cU-3ao.js} +1 -1
  64. package/assets/{DG9KGapq8eHlcTC7.js → D4NcXlPRmR6NaoGS.js} +1 -1
  65. package/assets/{DRvzD5Tkcb2OU0G2.js → D4jXxO1LUEQ6erA9.js} +1 -1
  66. package/assets/{DfaQvLAaU7HHPnSe.js → DAx-VOBmi1xAMhhX.js} +29 -29
  67. package/assets/{BbfSzxx5EzAvn-_F.js → DBcXAdUaNGrlah12.js} +15 -15
  68. package/assets/{DQBqVPRLkZFb2P_x.js → DFdAxnoXGn_8ge3l.js} +2 -2
  69. package/assets/{BtNEVWQWEp_Ie1nT.js → DFjfZCMPfQfwC4cF.js} +581 -581
  70. package/assets/{Cplall3oc-_3AhCB.js → DG0Dzgf1kAxN3AIk.js} +1 -1
  71. package/assets/{CcTDxlAqw6HuYmmm.js → DGv-dTePYQ8_yif4.js} +66 -66
  72. package/assets/{HLtC2gb8SfNmJU5q.js → DIaD0BL0JLTaJTS3.js} +5 -5
  73. package/assets/{C2kYWrsx5mg4XOES.js → DIimDQiJDW-4lkZT.js} +1 -1
  74. package/assets/{BzU8BhgrkSoh-XJF.js → DK8DWNMTOmCg6zAI.js} +8 -8
  75. package/assets/{DlOCT6DI5bhPtQ8j.js → DKox8guOumZMOdq8.js} +29 -29
  76. package/assets/{BNvsIyBwweYnfUz3.js → DMHiZKWwm6puHV6p.js} +1 -1
  77. package/assets/{BzLwCwXsh7eXQpeK.js → DMyq3L2ibjMlHuDa.js} +1 -1
  78. package/assets/{UdhH9UX9jQ4IV11J.js → DOKXQpGyzXCoSLdJ.js} +1 -1
  79. package/assets/{D8wjcRGgRdU34Ata.js → DOXriXo-7WmTAKbN.js} +1 -1
  80. package/assets/{CJubVukzHBNJb_Wf.js → DRfsB4kS28fPXv6K.js} +105 -105
  81. package/assets/{DkS3EQvuEuPDvCws.js → DSmARJ0owmwmr2FA.js} +2 -2
  82. package/assets/{DYx_I-o0yjx056Dq.js → DUM6h3BEreCilg32.js} +1 -1
  83. package/assets/{DpGFb3hbAT5Murcv.js → DXp5V2__VY2opctz.js} +1 -1
  84. package/assets/{TqxFLhPz3zbgi95t.js → D_YBc6vHBL-ajwvB.js} +1 -1
  85. package/assets/{D5aWcMLJ2wyLm9Ws.js → Dc8BQsPlwN6i6OU7.js} +1 -1
  86. package/assets/{B_GZxEqqpKtEPbWC.js → DcnNIdrilJHfl_CQ.js} +1 -1
  87. package/assets/{B0FfnXdiZxExcdjB.js → DdIufax_qSuWVGQK.js} +2 -2
  88. package/assets/{DkT0-_t9Xgp4l-Mh.js → DeNqXaM_dHSswRuE.js} +1 -1
  89. package/assets/{O8YGVK4vtz39jQ84.js → DfVHW5vbnRNXHrCi.js} +1 -1
  90. package/assets/{D8cqT2lbcP5Yp1Or.js → Dfc9_XsqSeh48YeK.js} +11 -11
  91. package/assets/{DbHVXEt9qwlb8Gou.js → DiXodb_hLvUDIGb6.js} +29 -29
  92. package/assets/{CVWoX7wNwrZwm5XB.js → Dn531BWCDZ2noJix.js} +2 -2
  93. package/assets/{B940vbTfpMYACpDE.js → DnAuLAqQLmAf9Gls.js} +2 -2
  94. package/assets/{BV13tLgNXZ8MDaE_.js → Do8K2GlFXIiMX9TB.js} +1 -1
  95. package/assets/{DXVfJfT6ftWk5kYi.js → Dt8hWBnnqlpJOazW.js} +138 -138
  96. package/assets/{DUfrvQDZKh_22F91.js → DuBbSpdXZuAFvxpr.js} +1 -1
  97. package/assets/{ixHQtoul8ubEJfWS.js → DvAq2cPI7-lfSn0x.js} +1 -1
  98. package/assets/{CGdayif_qNMtoATI.js → DzCZGtlg3pJO91l9.js} +1 -1
  99. package/assets/{DcHvH_I64hbnNh9G.js → DzRBnJpz972o277m.js} +1 -1
  100. package/assets/{LQNEL4KjDxwZNwWq.js → EohzUi0uCnSF2q2D.js} +156 -156
  101. package/assets/{Bwk-CZuGiTRT2ox_.js → KSagTSkIvZSpUF1c.js} +4 -4
  102. package/assets/{BD3Bc7ZHxenj4S7Q.js → LOFAyr5OoT3oZGMV.js} +1 -1
  103. package/assets/{BBccc8pDH-6AJdoT.js → LbZNDu6C9XPMEXCN.js} +5 -5
  104. package/assets/{DJlQxf99HCszeCCD.js → NwtEz6ZaVT8p8wOh.js} +1 -1
  105. package/assets/{VkeNTI1TMsA1ZbGz.js → PD_i17-cebq3-_Gn.js} +3 -3
  106. package/assets/{Bb7ZxgjHwiKgARXs.js → Q-BvS_P_qM8EvP92.js} +1 -1
  107. package/assets/{BW8ReYzx-CEJ-lAG.js → YRKAYjRpPkjhxGSS.js} +1 -1
  108. package/assets/{kmiMiNIUc6rS8DG8.js → _-kNP8Q4FxBYPY4u.js} +4 -4
  109. package/assets/{Ci3R5B7bLke8NZRo.js → aEDyynzUuzMysLwT.js} +6 -6
  110. package/assets/{DunKnm-bQd0oHn9n.js → cTnKNFayqlXisspN.js} +2 -2
  111. package/assets/{DZBfVpnngvY9Ra3C.js → eEh1r_BS7Y0FXPqk.js} +1 -1
  112. package/assets/{BHeXL-Lo390ZSNV0.js → g4vz4gc43eat7Hd2.js} +1 -1
  113. package/assets/{CAI8p60cuWlgnlko.js → jUzhn1PeDLWXOuJO.js} +14 -14
  114. package/assets/{DbXqd8hGNQEyS-s0.js → kIzQWtiHNHvh8HLF.js} +1 -1
  115. package/assets/{BXxUz-sB48Z9nSFi.js → mIM-JksHd3Zl5INF.js} +1 -1
  116. package/assets/{s56uiNHMGbBV6xgZ.js → mirSoZ8QDsYUMjYu.js} +1 -1
  117. package/assets/{APcHum0Riw3QhLBQ.js → ooSNLnHLIYTBL5JD.js} +1 -1
  118. package/assets/{BFKj2ik7h-yM6oCR.js → tp75fiKc1r-jdPPN.js} +1 -1
  119. package/assets/{DcHo7BC8Ny3hWq0j.js → xltGcIbWkjqNtCty.js} +2 -2
  120. package/assets/{xMi-tFxI2s6e18L1.js → zbOvcGIPi-MDlJKE.js} +1 -1
  121. package/index.js +118 -118
  122. package/lib.js +1 -1
  123. package/licenses/dependencies.txt +35 -35
  124. package/package.json +17 -2
  125. package/screenshot-page/assets/{Da_VIghRFdNrmfZT.js → 37HIsN_8LEsOWyOO.js} +1 -1
  126. package/screenshot-page/assets/4I9gFq1IdumstDHq.js +2 -0
  127. package/screenshot-page/assets/6j6xGn4csAcfcFMQ.js +1 -0
  128. package/screenshot-page/assets/{hB5riGkPy0wXVIig.js → 7N8xCpYVBHFqfoAg.js} +1 -1
  129. package/screenshot-page/assets/{D8EmNst-H2v0eWcf.js → 97qOXULGlJqaTCIL.js} +1 -1
  130. package/screenshot-page/assets/B6dFVtErFelDd62E.js +2 -0
  131. package/screenshot-page/assets/{BCmGLxQEUabeee6Q.js → B6i6Xi9OafEvNRAm.js} +2 -2
  132. package/screenshot-page/assets/B7uNU6WWjJaco6ho.js +1 -0
  133. package/screenshot-page/assets/{DqOrgSpuJhQRhMoG.js → BGoGxqwlpgXt8CMd.js} +2 -2
  134. package/screenshot-page/assets/{0P0DnZolMnjPhiea.js → BXss42mPBQnnt0Rh.js} +1 -1
  135. package/screenshot-page/assets/{D53hpXNHxIgSWl80.js → BbhwsC3eMdzP2PeH.js} +1 -1
  136. package/screenshot-page/assets/Beaq1eo3pAjlfcba.js +1 -0
  137. package/screenshot-page/assets/Bf3eJLndwyxuVR-_.js +1 -0
  138. package/screenshot-page/assets/{CKdQfdZJGJFgnrr9.js → BqJRJVrx7XkIPgo7.js} +11 -11
  139. package/screenshot-page/assets/C-qNpEaGV5amWPml.js +13 -0
  140. package/screenshot-page/assets/{CCYEWK5QyGSnUAfh.js → CB-bJVu0a2zAElNH.js} +1 -1
  141. package/screenshot-page/assets/CGvyz3VVFiHbYHM0.js +3 -0
  142. package/screenshot-page/assets/{DTAKTGn53yF_B621.js → CKbXhNyUiI18JA_C.js} +1 -1
  143. package/screenshot-page/assets/{DkTX5ZjGNQ5SrwJa.js → CVEUOXnI1pTa-GKp.js} +1 -1
  144. package/screenshot-page/assets/C_RHXqyejSa8gd9x.js +1 -0
  145. package/screenshot-page/assets/{Bt7fKk5ZupUuo_xD.js → CbTBuiF_Jn72hoj1.js} +2 -2
  146. package/screenshot-page/assets/{C-2hBFk27roWkIrQ.js → CraI-__UdtaIvbNn.js} +1 -1
  147. package/screenshot-page/assets/{CMryHLEhCyKGuRSW.js → Cyu6g5rRtEGOHaQS.js} +4 -4
  148. package/screenshot-page/assets/{CL_hAngRQwm_KGdR.js → D1KqgZwk5MjDhk5i.js} +1 -1
  149. package/screenshot-page/assets/DGr8M07ioDfKXLHD.js +57 -0
  150. package/screenshot-page/assets/DMbhlzvflyxF5Clt.js +39 -0
  151. package/screenshot-page/assets/{D-jd_TJCN7AAn125.js → DQxI7bShZ7TKpL0V.js} +9 -9
  152. package/screenshot-page/assets/{BpJaTpbR_CQzXj9M.js → DSB_SKy2lKI_VGik.js} +1 -1
  153. package/screenshot-page/assets/DWkISZdhmV2PBk-k.js +1 -0
  154. package/screenshot-page/assets/{BVnzv_sY_58zEJyM.js → DfmEx82r_NbillHk.js} +1 -1
  155. package/screenshot-page/assets/{MqGbtsji4DVGCAMR.js → DsZcJUWTmqcp2aI-.js} +1 -1
  156. package/screenshot-page/assets/{jteb4n23QwBT9m_4.js → DszZ1A807YzTc0ek.js} +1 -1
  157. package/screenshot-page/assets/{DJebrQ5mu8uxpX3b.js → DwHci99xcnRTEcv5.js} +2 -2
  158. package/screenshot-page/assets/Ojp2B5i2-AJeD4mV.js +1 -0
  159. package/screenshot-page/assets/{CRtk9ixuBWxhPfPU.js → PRYQO22Y2LgMUg77.js} +1 -1
  160. package/screenshot-page/assets/{CZaKvnrRdlLj1_X8.js → RHcyaEfxJB7O3alo.js} +1 -1
  161. package/screenshot-page/assets/TA9YjsgX-_8fRRdZ.js +1 -0
  162. package/screenshot-page/assets/cUY9GpQPVTLSprfW.js +1 -0
  163. package/screenshot-page/assets/{Bne-AygyF1USkPAy.js → m48xmzGgNgwXSEgQ.js} +1 -1
  164. package/screenshot-page/assets/mVfCz3bXIjqEVPEo.js +1 -0
  165. package/screenshot-page/assets/{CFS0h-wE9YlZRk_1.js → putBhJCWgRos_Fmk.js} +1 -1
  166. package/screenshot-page/assets/{DbnmgPTSEii4OGkB.js → uyInkZWFnMwX-BSC.js} +1 -1
  167. package/screenshot-page/assets/{D98PlIA4qQ_6ciCu.js → xiJthTXsasYVOHWE.js} +2 -2
  168. package/screenshot-page/index.html +8 -8
  169. package/types/scripting.d.ts +1 -1
  170. package/assets/CehVpkp73IfWGN_b.js +0 -14
  171. package/screenshot-page/assets/3L7CY5dA_kT2UBjv.js +0 -1
  172. package/screenshot-page/assets/B6UwT0pG4sQeG7fA.js +0 -3
  173. package/screenshot-page/assets/BH2IWQ-8AfNbhYZJ.js +0 -39
  174. package/screenshot-page/assets/BkU12U7IqW7qjopk.js +0 -13
  175. package/screenshot-page/assets/Bs-IXwX9BKsCxwcJ.js +0 -2
  176. package/screenshot-page/assets/C7MXfx6zf_uTwcpu.js +0 -1
  177. package/screenshot-page/assets/CUQsrLir5jYpnRPM.js +0 -1
  178. package/screenshot-page/assets/CUgX7ETRCJsvqa2x.js +0 -1
  179. package/screenshot-page/assets/CfD1bn6b-NM38iZV.js +0 -1
  180. package/screenshot-page/assets/Ck5onwb1w_19WrtG.js +0 -1
  181. package/screenshot-page/assets/CvBPH5c-gnUG8Jen.js +0 -1
  182. package/screenshot-page/assets/DmIjTb4kKfUHxWaF.js +0 -57
  183. package/screenshot-page/assets/Dz_yLNMXKWGx1O6V.js +0 -2
  184. package/screenshot-page/assets/eR9_DaySoB72PvMo.js +0 -1
  185. package/screenshot-page/assets/hHvAGynpTvAb97GX.js +0 -1
  186. package/screenshot-page/assets/x1O923k1mN-CduO_.js +0 -1
@@ -1,57 +0,0 @@
1
- import{i as e}from"./CQukCzhuewMuFOlO.js";import{$i as t,At as n,Er as r,Hi as i,L as a,M as o,Ni as s,O as c,Pr as l,Rn as u,Sr as d,Tt as f,Vt as p,W as m,Yr as h,Z as g,_i as _,da as v,jn as y,lr as ee,n as b,ni as x,oi as te,ra as S,rt as C,u as w,vn as ne,w as re,wn as ie,y as T}from"./CKdQfdZJGJFgnrr9.js";function E(e){console&&console.error&&console.error(`Error: ${e}`)}function D(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function ae(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function O(e){function t(){}t.prototype=e;let n=new t;function r(){return typeof n.bar}return r(),r(),e}var k=class{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}},A=class extends k{constructor(e){super([]),this.idx=1,Object.assign(this,B(e))}set definition(e){}get definition(){return this.referencedRule===void 0?[]:this.referencedRule.definition}accept(e){e.visit(this)}},j=class extends k{constructor(e){super(e.definition),this.orgText=``,Object.assign(this,B(e))}},M=class extends k{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,B(e))}},N=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},P=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},F=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},I=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},L=class extends k{constructor(e){super(e.definition),this.idx=1,Object.assign(this,B(e))}},R=class extends k{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,B(e))}},z=class{constructor(e){this.idx=1,Object.assign(this,B(e))}accept(e){e.visit(this)}};function oe(e){function t(e){return e.map(oe)}if(e instanceof A){let t={type:`NonTerminal`,name:e.nonTerminalName,idx:e.idx};return typeof e.label==`string`&&(t.label=e.label),t}if(e instanceof M)return{type:`Alternative`,definition:t(e.definition)};if(e instanceof N)return{type:`Option`,idx:e.idx,definition:t(e.definition)};if(e instanceof P)return{type:`RepetitionMandatory`,idx:e.idx,definition:t(e.definition)};if(e instanceof F)return{type:`RepetitionMandatoryWithSeparator`,idx:e.idx,separator:oe(new z({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof L)return{type:`RepetitionWithSeparator`,idx:e.idx,separator:oe(new z({terminalType:e.separator})),definition:t(e.definition)};if(e instanceof I)return{type:`Repetition`,idx:e.idx,definition:t(e.definition)};if(e instanceof R)return{type:`Alternation`,idx:e.idx,definition:t(e.definition)};if(e instanceof z){let t={type:`Terminal`,name:e.terminalType.name,label:(n=e.terminalType,typeof(r=n).LABEL==`string`&&r.LABEL!==``?n.LABEL:n.name),idx:e.idx};typeof e.label==`string`&&(t.terminalLabel=e.label);let i=e.terminalType.PATTERN;return e.terminalType.PATTERN&&(t.pattern=i instanceof RegExp?i.source:i),t}if(e instanceof j)return{type:`Rule`,name:e.name,orgText:e.orgText,definition:t(e.definition)};throw Error(`non exhaustive match`);var n,r}function B(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e!==void 0))}var se=class{visit(e){let t=e;switch(t.constructor){case A:return this.visitNonTerminal(t);case M:return this.visitAlternative(t);case N:return this.visitOption(t);case P:return this.visitRepetitionMandatory(t);case F:return this.visitRepetitionMandatoryWithSeparator(t);case L:return this.visitRepetitionWithSeparator(t);case I:return this.visitRepetition(t);case R:return this.visitAlternation(t);case z:return this.visitTerminal(t);case j:return this.visitRule(t);default:throw Error(`non exhaustive match`)}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}};function ce(e,t=[]){return e instanceof N||e instanceof I||e instanceof L||(e instanceof R?e.definition.some(e=>ce(e,t)):!(e instanceof A&&t.includes(e))&&e instanceof k&&(e instanceof A&&t.push(e),e.definition.every(e=>ce(e,t))))}function V(e){if(e instanceof A)return`SUBRULE`;if(e instanceof N)return`OPTION`;if(e instanceof R)return`OR`;if(e instanceof P)return`AT_LEAST_ONE`;if(e instanceof F)return`AT_LEAST_ONE_SEP`;if(e instanceof L)return`MANY_SEP`;if(e instanceof I)return`MANY`;if(e instanceof z)return`CONSUME`;throw Error(`non exhaustive match`)}var le=class{walk(e,t=[]){e.definition.forEach((n,r)=>{let i=e.definition.slice(r+1);if(n instanceof A)this.walkProdRef(n,i,t);else if(n instanceof z)this.walkTerminal(n,i,t);else if(n instanceof M)this.walkFlat(n,i,t);else if(n instanceof N)this.walkOption(n,i,t);else if(n instanceof P)this.walkAtLeastOne(n,i,t);else if(n instanceof F)this.walkAtLeastOneSep(n,i,t);else if(n instanceof L)this.walkManySep(n,i,t);else if(n instanceof I)this.walkMany(n,i,t);else{if(!(n instanceof R))throw Error(`non exhaustive match`);this.walkOr(n,i,t)}})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){let r=t.concat(n);this.walk(e,r)}walkOption(e,t,n){let r=t.concat(n);this.walk(e,r)}walkAtLeastOne(e,t,n){let r=[new N({definition:e.definition})].concat(t,n);this.walk(e,r)}walkAtLeastOneSep(e,t,n){let r=ue(e,t,n);this.walk(e,r)}walkMany(e,t,n){let r=[new N({definition:e.definition})].concat(t,n);this.walk(e,r)}walkManySep(e,t,n){let r=ue(e,t,n);this.walk(e,r)}walkOr(e,t,n){let r=t.concat(n);e.definition.forEach(e=>{let t=new M({definition:[e]});this.walk(t,r)})}};function ue(e,t,n){return[new N({definition:[new z({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function de(e){if(e instanceof A)return de(e.referencedRule);if(e instanceof z)return[e.terminalType];if(function(e){return e instanceof M||e instanceof N||e instanceof I||e instanceof P||e instanceof F||e instanceof L||e instanceof z||e instanceof j}(e))return function(e){let t=[],n=e.definition,r,i=0,a=n.length>i,o=!0;for(;a&&o;)r=n[i],o=ce(r),t=t.concat(de(r)),i+=1,a=n.length>i;return[...new Set(t)]}(e);if(function(e){return e instanceof R}(e))return function(e){let t=e.definition.map(e=>de(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var fe=`_~IN~_`,pe=class extends le{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){let r=(i=e.referencedRule,a=e.idx,i.name+a+fe+this.topProd.name);var i,a;let o=de(new M({definition:t.concat(n)}));this.follows[r]=o}};function H(e){return e.charCodeAt(0)}function me(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function U(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function W(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function he(){throw Error(`Internal Error - Should never get here!`)}function ge(e){return e.type===`Character`}var _e=[];for(let e=H(`0`);e<=H(`9`);e++)_e.push(e);var ve=[H(`_`)].concat(_e);for(let e=H(`a`);e<=H(`z`);e++)ve.push(e);for(let e=H(`A`);e<=H(`Z`);e++)ve.push(e);var ye=[H(` `),H(`\f`),H(`
2
- `),H(`\r`),H(` `),H(`\v`),H(` `),H(`\xA0`),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(` `),H(`\u2028`),H(`\u2029`),H(` `),H(` `),H(` `),H(``)],be=/[0-9a-fA-F]/,xe=/[0-9]/,Se=/[1-9]/,Ce=class{visitChildren(e){for(let t in e){let n=e[t];e.hasOwnProperty(t)&&(n.type===void 0?Array.isArray(n)&&n.forEach(e=>{this.visit(e)},this):this.visit(n))}}visit(e){switch(e.type){case`Pattern`:this.visitPattern(e);break;case`Flags`:this.visitFlags(e);break;case`Disjunction`:this.visitDisjunction(e);break;case`Alternative`:this.visitAlternative(e);break;case`StartAnchor`:this.visitStartAnchor(e);break;case`EndAnchor`:this.visitEndAnchor(e);break;case`WordBoundary`:this.visitWordBoundary(e);break;case`NonWordBoundary`:this.visitNonWordBoundary(e);break;case`Lookahead`:this.visitLookahead(e);break;case`NegativeLookahead`:this.visitNegativeLookahead(e);break;case`Lookbehind`:this.visitLookbehind(e);break;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);break;case`Character`:this.visitCharacter(e);break;case`Set`:this.visitSet(e);break;case`Group`:this.visitGroup(e);break;case`GroupBackReference`:this.visitGroupBackReference(e);break;case`Quantifier`:this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitLookbehind(e){}visitNegativeLookbehind(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}},we={},Te=new class{constructor(){this.idx=0,this.input=``,this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar(`/`);let t=this.disjunction();this.consumeChar(`/`);let n={type:`Flags`,loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case`g`:U(n,`global`);break;case`i`:U(n,`ignoreCase`);break;case`m`:U(n,`multiLine`);break;case`u`:U(n,`unicode`);break;case`y`:U(n,`sticky`)}if(this.idx!==this.input.length)throw Error(`Redundant input: `+this.input.substring(this.idx));return{type:`Pattern`,flags:n,value:t,loc:this.loc(0)}}disjunction(){let e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()===`|`;)this.consumeChar(`|`),e.push(this.alternative());return{type:`Disjunction`,value:e,loc:this.loc(t)}}alternative(){let e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:`Alternative`,value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){let e=this.idx;switch(this.popChar()){case`^`:return{type:`StartAnchor`,loc:this.loc(e)};case`$`:return{type:`EndAnchor`,loc:this.loc(e)};case`\\`:switch(this.popChar()){case`b`:return{type:`WordBoundary`,loc:this.loc(e)};case`B`:return{type:`NonWordBoundary`,loc:this.loc(e)}}throw Error(`Invalid Assertion Escape`);case`(`:let t;switch(this.consumeChar(`?`),this.popChar()){case`=`:t=`Lookahead`;break;case`!`:t=`NegativeLookahead`;break;case`<`:switch(this.popChar()){case`=`:t=`Lookbehind`;break;case`!`:t=`NegativeLookbehind`}}W(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return he()}quantifier(e=!1){let t,n=this.idx;switch(this.popChar()){case`*`:t={atLeast:0,atMost:1/0};break;case`+`:t={atLeast:1,atMost:1/0};break;case`?`:t={atLeast:0,atMost:1};break;case`{`:let n=this.integerIncludingZero();switch(this.popChar()){case`}`:t={atLeast:n,atMost:n};break;case`,`:let e;this.isDigit()?(e=this.integerIncludingZero(),t={atLeast:n,atMost:e}):t={atLeast:n,atMost:1/0},this.consumeChar(`}`)}if(!0===e&&t===void 0)return;W(t)}if(!0!==e||t!==void 0)return W(t)?(this.peekChar(0)===`?`?(this.consumeChar(`?`),t.greedy=!1):t.greedy=!0,t.type=`Quantifier`,t.loc=this.loc(n),t):void 0}atom(){let e,t=this.idx;switch(this.peekChar()){case`.`:e=this.dotAll();break;case`\\`:e=this.atomEscape();break;case`[`:e=this.characterClass();break;case`(`:e=this.group()}return e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),W(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):he()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[H(`
3
- `),H(`\r`),H(`\u2028`),H(`\u2029`)]}}atomEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:return this.decimalEscapeAtom();case`d`:case`D`:case`s`:case`S`:case`w`:case`W`:return this.characterClassEscape();case`f`:case`n`:case`r`:case`t`:case`v`:return this.controlEscapeAtom();case`c`:return this.controlLetterEscapeAtom();case`0`:return this.nulCharacterAtom();case`x`:return this.hexEscapeSequenceAtom();case`u`:return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:`GroupBackReference`,value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case`d`:e=_e;break;case`D`:e=_e,t=!0;break;case`s`:e=ye;break;case`S`:e=ye,t=!0;break;case`w`:e=ve;break;case`W`:e=ve,t=!0}return W(e)?{type:`Set`,value:e,complement:t}:he()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=H(`\f`);break;case`n`:e=H(`
4
- `);break;case`r`:e=H(`\r`);break;case`t`:e=H(` `);break;case`v`:e=H(`\v`)}return W(e)?{type:`Character`,value:e}:he()}controlLetterEscapeAtom(){this.consumeChar(`c`);let e=this.popChar();if(!1===/[a-zA-Z]/.test(e))throw Error(`Invalid `);return{type:`Character`,value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar(`0`),{type:`Character`,value:H(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:H(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
5
- `:case`\r`:case`\u2028`:case`\u2029`:case`\\`:case`]`:throw Error(`TBD`);default:return{type:`Character`,value:H(this.popChar())}}}characterClass(){let e=[],t=!1;for(this.consumeChar(`[`),this.peekChar(0)===`^`&&(this.consumeChar(`^`),t=!0);this.isClassAtom();){let t=this.classAtom();if(t.type,ge(t)&&this.isRangeDash()){this.consumeChar(`-`);let n=this.classAtom();if(n.type,ge(n)){if(n.value<t.value)throw Error(`Range out of order in character class`);e.push({from:t.value,to:n.value})}else me(t.value,e),e.push(H(`-`)),me(n.value,e)}else me(t.value,e)}return this.consumeChar(`]`),{type:`Set`,complement:t,value:e}}classAtom(){switch(this.peekChar()){case`]`:case`
6
- `:case`\r`:case`\u2028`:case`\u2029`:throw Error(`TBD`);case`\\`:return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar(`\\`),this.peekChar()){case`b`:return this.consumeChar(`b`),{type:`Character`,value:H(`\b`)};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()}}group(){let e=!0;this.consumeChar(`(`),this.peekChar(0)===`?`?(this.consumeChar(`?`),this.consumeChar(`:`),e=!1):this.groupIdx++;let t=this.disjunction();this.consumeChar(`)`);let n={type:`Group`,capturing:e,value:t};return e&&(n.idx=this.groupIdx),n}positiveInteger(){let e=this.popChar();if(!1===Se.test(e))throw Error(`Expecting a positive integer`);for(;xe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}integerIncludingZero(){let e=this.popChar();if(!1===xe.test(e))throw Error(`Expecting an integer`);for(;xe.test(this.peekChar(0));)e+=this.popChar();return parseInt(e,10)}patternCharacter(){let e=this.popChar();switch(e){case`
7
- `:case`\r`:case`\u2028`:case`\u2029`:case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:throw Error(`TBD`);default:return{type:`Character`,value:H(e)}}}isRegExpFlag(){switch(this.peekChar(0)){case`g`:case`i`:case`m`:case`u`:case`y`:return!0;default:return!1}}isRangeDash(){return this.peekChar()===`-`&&this.isClassAtom(1)}isDigit(){return xe.test(this.peekChar(0))}isClassAtom(e=0){switch(this.peekChar(e)){case`]`:case`
8
- `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case`.`:case`\\`:case`[`:case`(`:return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case`^`:case`$`:return!0;case`\\`:switch(this.peekChar(1)){case`b`:case`B`:return!0;default:return!1}case`(`:return this.peekChar(1)===`?`&&(this.peekChar(2)===`=`||this.peekChar(2)===`!`||this.peekChar(2)===`<`&&(this.peekChar(3)===`=`||this.peekChar(3)===`!`));default:return!1}}isQuantifier(){let e=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(e)}}isPatternCharacter(){switch(this.peekChar()){case`^`:case`$`:case`\\`:case`.`:case`*`:case`+`:case`?`:case`(`:case`)`:case`[`:case`|`:case`/`:case`
9
- `:case`\r`:case`\u2028`:case`\u2029`:return!1;default:return!0}}parseHexDigits(e){let t=``;for(let n=0;n<e;n++){let e=this.popChar();if(!1===be.test(e))throw Error(`Expecting a HexDecimal digits`);t+=e}return{type:`Character`,value:parseInt(t,16)}}peekChar(e=0){return this.input[this.idx+e]}popChar(){let e=this.peekChar(0);return this.consumeChar(void 0),e}consumeChar(e){if(e!==void 0&&this.input[this.idx]!==e)throw Error(`Expected: '`+e+`' but found: '`+this.input[this.idx]+`' at offset: `+this.idx);if(this.idx>=this.input.length)throw Error(`Unexpected end of input`);this.idx++}loc(e){return{begin:e,end:this.idx}}};function Ee(e){let t=e.toString();if(we.hasOwnProperty(t))return we[t];{let e=Te.pattern(t);return we[t]=e,e}}var De=`Complement Sets are not supported for first char optimization`,Oe=`Unable to use "first char" lexer optimizations:
10
- `;function ke(e,t=!1){try{let t=Ee(e);return Ae(t.value,{},t.flags.ignoreCase)}catch(n){if(n.message===De)t&&D(`${Oe}\tUnable to optimize: < ${e.toString()} >\n\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let n=``;t&&(n=`
11
- This will disable the lexer's first char optimizations.
12
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),E(`${Oe}\n\tFailed parsing: < ${e.toString()} >\n\tUsing the @chevrotain/regexp-to-ast library\n\tPlease open an issue at: https://github.com/chevrotain/chevrotain/issues`+n)}}return[]}function Ae(e,t,n){switch(e.type){case`Disjunction`:for(let r=0;r<e.value.length;r++)Ae(e.value[r],t,n);break;case`Alternative`:let r=e.value;for(let e=0;e<r.length;e++){let i=r[e];switch(i.type){case`EndAnchor`:case`GroupBackReference`:case`Lookahead`:case`NegativeLookahead`:case`Lookbehind`:case`NegativeLookbehind`:case`StartAnchor`:case`WordBoundary`:case`NonWordBoundary`:continue}let a=i;switch(a.type){case`Character`:je(a.value,t,n);break;case`Set`:if(!0===a.complement)throw Error(De);a.value.forEach(e=>{if(typeof e==`number`)je(e,t,n);else{let r=e;if(!0===n)for(let e=r.from;e<=r.to;e++)je(e,t,n);else{for(let e=r.from;e<=r.to&&e<256;e++)je(e,t,n);if(r.to>=256){let e=r.from>=256?r.from:256,n=r.to,i=K(e),a=K(n);for(let e=i;e<=a;e++)t[e]=e}}}});break;case`Group`:Ae(a.value,t,n);break;default:throw Error(`Non Exhaustive Match`)}let o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type===`Group`&&!1===Ne(a)||a.type!==`Group`&&!1===o)break}break;default:throw Error(`non exhaustive match!`)}return Object.values(t)}function je(e,t,n){let r=K(e);t[r]=r,!0===n&&function(e,t){let n=String.fromCharCode(e),r=n.toUpperCase();if(r!==n){let e=K(r.charCodeAt(0));t[e]=e}else{let e=n.toLowerCase();if(e!==n){let n=K(e.charCodeAt(0));t[n]=n}}}(e,t)}function Me(e,t){return e.value.find(e=>{if(typeof e==`number`)return t.includes(e);{let n=e;return t.find(e=>n.from<=e&&e<=n.to)!==void 0}})}function Ne(e){let t=e.quantifier;return!(!t||t.atLeast!==0)||!!e.value&&(Array.isArray(e.value)?e.value.every(Ne):Ne(e.value))}var Pe=class extends Ce{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(!0!==this.found){switch(e.type){case`Lookahead`:this.visitLookahead(e);return;case`NegativeLookahead`:this.visitNegativeLookahead(e);return;case`Lookbehind`:this.visitLookbehind(e);return;case`NegativeLookbehind`:this.visitNegativeLookbehind(e);return}super.visitChildren(e)}}visitCharacter(e){this.targetCharCodes.includes(e.value)&&(this.found=!0)}visitSet(e){e.complement?Me(e,this.targetCharCodes)===void 0&&(this.found=!0):Me(e,this.targetCharCodes)!==void 0&&(this.found=!0)}};function Fe(e,t){if(t instanceof RegExp){let n=Ee(t),r=new Pe(e);return r.visit(n),r.found}for(let n of t){let t=n.charCodeAt(0);if(e.includes(t))return!0}return!1}var G=`PATTERN`,Ie=`defaultMode`;function Le(e,t){let n=(t=Object.assign({safeMode:!1,positionTracking:`full`,lineTerminatorCharacters:[`\r`,`
13
- `],tracer:(e,t)=>t()},t)).tracer,r;n(`initCharCodeToOptimizedIndexMap`,()=>{(function(){if(Ye.length===0){Ye=Array(65536);for(let e=0;e<65536;e++)Ye[e]=e>255?255+~~(e/255):e}})()}),n(`Reject Lexer.NA`,()=>{r=e.filter(e=>e[G]!==J.NA)});let i,a,o,s,c,l,u,d,f,p,m,h=!1;n(`Transform Patterns`,()=>{h=!1,i=r.map(e=>{let t=e[G];if(t instanceof RegExp){let e=t.source;return e.length!==1||e===`^`||e===`$`||e===`.`||t.ignoreCase?e.length!==2||e[0]!==`\\`||[`d`,`D`,`s`,`S`,`t`,`r`,`n`,`t`,`0`,`c`,`b`,`B`,`f`,`v`,`w`,`W`].includes(e[1])?Ve(t):e[1]:e}if(typeof t==`function`)return h=!0,{exec:t};if(typeof t==`object`)return h=!0,t;if(typeof t==`string`){if(t.length===1)return t;{let e=t.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`);return Ve(new RegExp(e))}}throw Error(`non exhaustive match`)})}),n(`misc mapping`,()=>{a=r.map(e=>e.tokenTypeIdx),o=r.map(e=>{let t=e.GROUP;if(t!==J.SKIPPED){if(typeof t==`string`)return t;if(t===void 0)return!1;throw Error(`non exhaustive match`)}}),s=r.map(e=>{let t=e.LONGER_ALT;if(t)return Array.isArray(t)?t.map(e=>r.indexOf(e)):[r.indexOf(t)]}),c=r.map(e=>e.PUSH_MODE),l=r.map(e=>Object.hasOwn(e,`POP_MODE`))}),n(`Line Terminator Handling`,()=>{let e=qe(t.lineTerminatorCharacters);u=r.map(e=>!1),t.positionTracking!==`onlyOffset`&&(u=r.map(t=>Object.hasOwn(t,`LINE_BREAKS`)?!!t.LINE_BREAKS:!1===Ge(t,e)&&Fe(e,t.PATTERN)))}),n(`Misc Mapping #2`,()=>{d=r.map(He),f=i.map(Ue),p=r.reduce((e,t)=>{let n=t.GROUP;return typeof n==`string`&&n!==J.SKIPPED&&(e[n]=[]),e},{}),m=i.map((e,t)=>{let n=o[t]===void 0&&s[t]===void 0?function(e){if(!(e instanceof RegExp)||e.flags!==``)return;let t;try{t=Ee(e)}catch{return}if(t.value.value.length!==1||t.value.value[0].value.length!==1)return;let n,r=t.value.value[0].value[0];for(;r.type===`Group`;){if(r.capturing||r.quantifier!==void 0&&n!==void 0||r.value.value.length!==1||r.value.value[0].value.length!==1)return;n=r.quantifier??n,r=r.value.value[0].value[0]}if(r.type!==`Set`||r.complement||r.quantifier!==void 0&&n!==void 0||(n=r.quantifier??n,n?.atLeast!==1||n.atMost!==1/0||!n.greedy))return;let i=new Uint8Array(128);for(let e of r.value){let t=typeof e==`number`?e:e.from,n=typeof e==`number`?e:e.to;if(t<0||n>=i.length)return;i.fill(1,t,n+1)}return i}(r[t].PATTERN):void 0;return{pattern:i[t],asciiClass:n,longerAlt:s[t],canLineTerminator:u[t],matchType:n===void 0?!1===f[t]?d[t]?1:2:0:3,short:f[t],group:o[t],push:c[t],pop:l[t],tokenTypeIdx:a[t],tokenType:r[t]}})});let g=!0,_=[];return t.safeMode||n(`First Char Optimization`,()=>{_=r.reduce((e,n,r)=>{if(typeof n.PATTERN==`string`)Je(e,K(n.PATTERN.charCodeAt(0)),m[r]);else if(Array.isArray(n.START_CHARS_HINT)){let t;n.START_CHARS_HINT.forEach(n=>{let i=K(typeof n==`string`?n.charCodeAt(0):n);t!==i&&(t=i,Je(e,i,m[r]))})}else if(n.PATTERN instanceof RegExp){if(n.PATTERN.unicode)g=!1,t.ensureOptimizations&&E(`${Oe}\tUnable to analyze < ${n.PATTERN.toString()} > pattern.\n\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{let i=ke(n.PATTERN,t.ensureOptimizations);i.length===0&&(g=!1),i.forEach(t=>{Je(e,t,m[r])})}}else t.ensureOptimizations&&E(`${Oe}\tTokenType: <${n.name}> is using a custom token pattern without providing <start_chars_hint> parameter.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),g=!1;return e},[])}),{emptyGroups:p,patternIdxToConfig:m,charCodeToPatternIdxToConfig:_,hasCustom:h,canBeOptimized:g}}function Re(e,t){let n=[],r=function(e){let t=e.filter(e=>!Object.hasOwn(e,G));return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- missing static 'PATTERN' property`,type:q.MISSING_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(e);n=n.concat(r.errors);let i=function(e){let t=e.filter(e=>{let t=e[G];return!(t instanceof RegExp||typeof t==`function`||Object.hasOwn(t,`exec`)||typeof t==`string`)});return{errors:t.map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.`,type:q.INVALID_PATTERN,tokenTypes:[e]})),valid:e.filter(e=>!t.includes(e))}}(r.valid),a=i.valid;return n=n.concat(i.errors),n=n.concat(function(e){let t=[],n=e.filter(e=>e[G]instanceof RegExp);return t=t.concat(function(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitEndAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return ze.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
14
- Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
15
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.EOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){class t extends Ce{constructor(){super(...arguments),this.found=!1}visitStartAnchor(e){this.found=!0}}return e.filter(e=>{let n=e.PATTERN;try{let e=Ee(n),r=new t;return r.visit(e),r.found}catch{return Be.test(n.source)}}).map(e=>({message:`Unexpected RegExp Anchor Error:
16
- Token Type: ->`+e.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
17
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:q.SOI_ANCHOR_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){return e.filter(e=>{let t=e[G];return t instanceof RegExp&&(t.multiline||t.global)}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' may NOT contain global('g') or multiline('m')`,type:q.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[e]}))}(n)),t=t.concat(function(e){let t=[],n=e.map(n=>e.reduce((e,r)=>(n.PATTERN.source!==r.PATTERN.source||t.includes(r)||r.PATTERN===J.NA||(t.push(r),e.push(r)),e),[]));return n=n.filter(Boolean),n.filter(e=>e.length>1).map(e=>{let t=e.map(e=>e.name);return{message:`The same RegExp pattern ->${e[0].PATTERN}<-has been used in all of the following Token Types: ${t.join(`, `)} <-`,type:q.DUPLICATE_PATTERNS_FOUND,tokenTypes:e}})}(n)),t=t.concat(function(e){return e.filter(e=>e.PATTERN.test(``)).map(e=>({message:`Token Type: ->`+e.name+`<- static 'PATTERN' must not match an empty string`,type:q.EMPTY_MATCH_PATTERN,tokenTypes:[e]}))}(n)),t}(a)),n=n.concat(function(e){return e.filter(e=>{if(!Object.hasOwn(e,`GROUP`))return!1;let t=e.GROUP;return t!==J.SKIPPED&&t!==J.NA&&typeof t!=`string`}).map(e=>({message:`Token Type: ->`+e.name+`<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String`,type:q.INVALID_GROUP_TYPE_FOUND,tokenTypes:[e]}))}(a)),n=n.concat(function(e,t){return e.filter(e=>e.PUSH_MODE!==void 0&&!t.includes(e.PUSH_MODE)).map(e=>({message:`Token Type: ->${e.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${e.PUSH_MODE}<-which does not exist`,type:q.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[e]}))}(a,t)),n=n.concat(function(e){let t=[],n=e.reduce((e,t,n)=>{let r=t.PATTERN;return r===J.NA||(typeof r==`string`?e.push({str:r,idx:n,tokenType:t}):r instanceof RegExp&&(i=r,[`.`,`\\`,`[`,`]`,`|`,`^`,`$`,`(`,`)`,`?`,`*`,`+`,`{`].find(e=>i.source.indexOf(e)!==-1)===void 0)&&e.push({str:r.source,idx:n,tokenType:t})),e;var i},[]);return e.forEach((e,r)=>{n.forEach(({str:n,idx:i,tokenType:a})=>{if(r<i&&function(e,t){if(t instanceof RegExp){if(/(\(\?=)|(\(\?!)|(\(\?<=)|(\(\?<!)/.test(t.source))return!1;let n=t.exec(e);return n!==null&&n.index===0}if(typeof t==`function`)return t(e,0,[],{});if(Object.hasOwn(t,`exec`))return t.exec(e,0,[],{});if(typeof t==`string`)return t===e;throw Error(`non exhaustive match`)}(n,e.PATTERN)){let n=`Token: ->${a.name}<- can never be matched.\nBecause it appears AFTER the Token Type ->${e.name}<-in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;t.push({message:n,type:q.UNREACHABLE_PATTERN,tokenTypes:[e,a]})}})}),t}(a)),n}var ze=/[^\\][$]/,Be=/[^\\[][\^]|^\^/;function Ve(e){let t=e.ignoreCase?`iy`:`y`;return RegExp(`${e.source}`,t)}function He(e){let t=e.PATTERN;if(t instanceof RegExp)return!1;if(typeof t==`function`||Object.hasOwn(t,`exec`))return!0;if(typeof t==`string`)return!1;throw Error(`non exhaustive match`)}function Ue(e){return typeof e==`string`&&e.length===1&&e.charCodeAt(0)}var We={test:function(e){let t=e.length;for(let n=this.lastIndex;n<t;n++){let t=e.charCodeAt(n);if(t===10)return this.lastIndex=n+1,!0;if(t===13)return this.lastIndex=e.charCodeAt(n+1)===10?n+2:n+1,!0}return!1},lastIndex:0};function Ge(e,t){if(Object.hasOwn(e,`LINE_BREAKS`))return!1;if(e.PATTERN instanceof RegExp){try{Fe(t,e.PATTERN)}catch(e){return{issue:q.IDENTIFY_TERMINATOR,errMsg:e.message}}return!1}if(typeof e.PATTERN==`string`)return!1;if(He(e))return{issue:q.CUSTOM_LINE_BREAK};throw Error(`non exhaustive match`)}function Ke(e,t){if(t.issue===q.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.\n\tThe problem is in the <${e.name}> Token Type\n\t Root cause: ${t.errMsg}.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(t.issue===q.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.\n\tThe problem is in the <${e.name}> Token Type\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error(`non exhaustive match`)}function qe(e){return e.map(e=>typeof e==`string`?e.charCodeAt(0):e)}function Je(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}var Ye=[];function K(e){return e<256?e:Ye[e]}function Xe(e,t){let n=e.tokenTypeIdx;return n===t.tokenTypeIdx||!0===t.isParent&&!0===t.categoryMatchesMap[n]}function Ze(e,t){return e.tokenTypeIdx===t.tokenTypeIdx}var Qe=1,$e={};function et(e){let t=function(e){let t=[...e],n=e,r=!0;for(;r;){n=n.map(e=>e.CATEGORIES).flat().filter(Boolean);let e=n.filter(e=>!t.includes(e));t=t.concat(e),e.length===0?r=!1:n=e}return t}(e);(function(e){e.forEach(e=>{var t;nt(e)||($e[Qe]=e,e.tokenTypeIdx=Qe++),rt(e)&&!Array.isArray(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),rt(e)||(e.CATEGORIES=[]),t=e,Object.hasOwn(t??{},`categoryMatches`)||(e.categoryMatches=[]),function(e){return Object.hasOwn(e??{},`categoryMatchesMap`)}(e)||(e.categoryMatchesMap={})})})(t),function(e){e.forEach(e=>{tt([],e)})}(t),function(e){e.forEach(e=>{e.categoryMatches=[],Object.keys(e.categoryMatchesMap).forEach(t=>{e.categoryMatches.push($e[t].tokenTypeIdx)})})}(t),t.forEach(e=>{e.isParent=e.categoryMatches.length>0})}function tt(e,t){e.forEach(e=>{t.categoryMatchesMap[e.tokenTypeIdx]=!0}),t.CATEGORIES.forEach(n=>{let r=e.concat(t);r.includes(n)||tt(r,n)})}function nt(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}function rt(e){return Object.hasOwn(e??{},`CATEGORIES`)}function it(e){return Object.hasOwn(e??{},`tokenTypeIdx`)}var q,at={buildUnableToPopLexerModeMessage:e=>`Unable to pop Lexer Mode after encountering Token ->${e.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(e,t,n,r,i,a)=>`unexpected character: ->${e.charAt(t)}<- at offset: ${t}, skipped ${n} characters.`};(function(e){e[e.MISSING_PATTERN=0]=`MISSING_PATTERN`,e[e.INVALID_PATTERN=1]=`INVALID_PATTERN`,e[e.EOI_ANCHOR_FOUND=2]=`EOI_ANCHOR_FOUND`,e[e.UNSUPPORTED_FLAGS_FOUND=3]=`UNSUPPORTED_FLAGS_FOUND`,e[e.DUPLICATE_PATTERNS_FOUND=4]=`DUPLICATE_PATTERNS_FOUND`,e[e.INVALID_GROUP_TYPE_FOUND=5]=`INVALID_GROUP_TYPE_FOUND`,e[e.PUSH_MODE_DOES_NOT_EXIST=6]=`PUSH_MODE_DOES_NOT_EXIST`,e[e.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]=`MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE`,e[e.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]=`MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY`,e[e.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]=`MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST`,e[e.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]=`LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED`,e[e.SOI_ANCHOR_FOUND=11]=`SOI_ANCHOR_FOUND`,e[e.EMPTY_MATCH_PATTERN=12]=`EMPTY_MATCH_PATTERN`,e[e.NO_LINE_BREAKS_FLAGS=13]=`NO_LINE_BREAKS_FLAGS`,e[e.UNREACHABLE_PATTERN=14]=`UNREACHABLE_PATTERN`,e[e.IDENTIFY_TERMINATOR=15]=`IDENTIFY_TERMINATOR`,e[e.CUSTOM_LINE_BREAK=16]=`CUSTOM_LINE_BREAK`,e[e.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]=`MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE`})(q||={});var ot={deferDefinitionErrorsHandling:!1,positionTracking:`full`,lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
18
- `,`\r`],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:at,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(ot);var J=class{constructor(e,t=ot){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.cachedGroupKeys=[],this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(e,t)=>{if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ae(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()},typeof t==`boolean`)throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
19
- a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ot,t);let n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n==`number`&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT(`Lexer Constructor`,()=>{let n,r=!0;this.TRACE_INIT(`Lexer Config handling`,()=>{if(this.config.lineTerminatorsPattern===ot.lineTerminatorsPattern)this.config.lineTerminatorsPattern=We;else if(this.config.lineTerminatorCharacters===ot.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
20
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error(`"safeMode" and "ensureOptimizations" flags are mutually exclusive.`);this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),Array.isArray(e)?n={modes:{defaultMode:[...e]},defaultMode:Ie}:(r=!1,n=Object.assign({},e))}),!1===this.config.skipValidations&&(this.TRACE_INIT(`performRuntimeChecks`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(e){let t=[];return Object.hasOwn(e,`defaultMode`)||t.push({message:`A MultiMode Lexer cannot be initialized without a <defaultMode> property in its definition
21
- `,type:q.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),Object.hasOwn(e,`modes`)||t.push({message:`A MultiMode Lexer cannot be initialized without a <modes> property in its definition
22
- `,type:q.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),Object.hasOwn(e,`modes`)&&Object.hasOwn(e,`defaultMode`)&&!Object.hasOwn(e.modes,e.defaultMode)&&t.push({message:`A MultiMode Lexer cannot be initialized with a ${Ie}: <${e.defaultMode}>which does not exist\n`,type:q.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),Object.hasOwn(e,`modes`)&&Object.keys(e.modes).forEach(n=>{let r=e.modes[n];r.forEach((e,i)=>{e===void 0?t.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${n}> at index: <${i}>\n`,type:q.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):Object.hasOwn(e,`LONGER_ALT`)&&(Array.isArray(e.LONGER_ALT)?e.LONGER_ALT:[e.LONGER_ALT]).forEach(i=>{i===void 0||r.includes(i)||t.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${i.name}> on token <${e.name}> outside of mode <${n}>\n`,type:q.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),t}(n,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT(`performWarningRuntimeChecks`,()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(e,t,n){let r=[],i=!1,a=Object.values(e.modes||{}).flat().filter(Boolean).filter(e=>e[G]!==J.NA),o=qe(n);return t&&a.forEach(e=>{let t=Ge(e,o);if(!1!==t){let n={message:Ke(e,t),type:t.issue,tokenType:e};r.push(n)}else Object.hasOwn(e,`LINE_BREAKS`)?!0===e.LINE_BREAKS&&(i=!0):Fe(o,e.PATTERN)&&(i=!0)}),t&&!i&&r.push({message:`Warning: No LINE_BREAKS Found.
23
- This Lexer has been defined to track line and column information,
24
- But none of the Token Types can be identified as matching a line terminator.
25
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
26
- for details.`,type:q.NO_LINE_BREAKS_FLAGS}),r}(n,this.trackStartLines,this.config.lineTerminatorCharacters))})),n.modes=n.modes?n.modes:{},Object.entries(n.modes).forEach(([e,t])=>{n.modes[e]=t.filter(e=>e!==void 0)});let i=Object.keys(n.modes);if(Object.entries(n.modes).forEach(([e,n])=>{this.TRACE_INIT(`Mode: <${e}> processing`,()=>{if(this.modes.push(e),!1===this.config.skipValidations&&this.TRACE_INIT(`validatePatterns`,()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(Re(n,i))}),this.lexerDefinitionErrors.length===0){let r;et(n),this.TRACE_INIT(`analyzeTokenTypes`,()=>{r=Le(n,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[e]=r.patternIdxToConfig,this.charCodeToPatternIdxToConfig[e]=r.charCodeToPatternIdxToConfig,this.emptyGroups=Object.assign({},this.emptyGroups,r.emptyGroups),this.hasCustom=r.hasCustom||this.hasCustom,this.canModeBeOptimized[e]=r.canBeOptimized}})}),this.defaultMode=n.defaultMode,this.cachedGroupKeys=Object.keys(this.emptyGroups),this.lexerDefinitionErrors.length>0&&!this.config.deferDefinitionErrorsHandling){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
27
- `);throw Error(`Errors detected in definition of Lexer:
28
- `+e)}this.lexerDefinitionWarning.forEach(e=>{D(e.message)}),this.TRACE_INIT(`Choosing sub-methods implementations`,()=>{if(r&&(this.handleModes=()=>{}),!1===this.trackStartLines&&(this.computeNewColumn=e=>e),!1===this.trackEndLines&&(this.updateTokenEndLineColumnLocation=()=>{}),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else{if(!/onlyOffset/i.test(this.config.positionTracking))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT(`Failed Optimization Warnings`,()=>{let e=Object.entries(this.canModeBeOptimized).reduce((e,[t,n])=>(!1===n&&e.push(t),e),[]);if(t.ensureOptimizations&&e.length>0)throw Error(`Lexer Modes: < ${e.join(`, `)} > cannot be optimized.\n\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT(`clearRegExpParserCache`,()=>{we={}}),this.TRACE_INIT(`toFastProperties`,()=>{O(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
29
- `);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
30
- `+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,ee=0,b=this.hasCustom?0:Math.floor(e.length/10),x=Array(b),te=[],S=this.trackStartLines?1:void 0,C=this.trackStartLines?1:void 0,w={};for(let e=0;e<this.cachedGroupKeys.length;e++)w[this.cachedGroupKeys[e]]=[];let ne=this.trackStartLines,re=this.config.lineTerminatorsPattern,ie=0,T=[],E=[],D=[],ae=[];Object.freeze(ae);let O=!1,k=e=>{if(D.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);te.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{D.pop();let e=D.at(-1);T=this.patternIdxToConfig[e],E=this.charCodeToPatternIdxToConfig[e],ie=T.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=!(!E||!t)}};function A(e){D.push(e),E=this.charCodeToPatternIdxToConfig[e],T=this.patternIdxToConfig[e],ie=T.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;O=!(!E||!t)}let j;A.call(this,t);let M=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),b;if(O){let e=K(t),n=E[e];b=n===void 0?ae:n}else b=T;let N=b.length;for(n=0;n<N;n++){j=b[n];let r=j.pattern;switch(c=null,j.matchType){case 0:t===j.short&&(u=1,s=r);break;case 1:g=r.exec(_,y,x,w),g===null?s=null:(s=g[0],u=s.length,g.payload!==void 0&&(c=g.payload));break;case 3:{let e=j.asciiClass;if(e[t]!==1){r.lastIndex=0;break}let n=y+1;for(;e[_.charCodeAt(n)]===1;)n++;u=n-y,r.lastIndex=n;break}case 2:r.lastIndex=y,u=this.matchLength(r,e,y)}if(u!==-1){if(o=j.longerAlt,o!==void 0){s=e.substring(y,y+u);let t=o.length;for(i=0;i<t;i++){let t=T[o[i]],n=t.pattern;if(l=null,t.matchType===1?(g=n.exec(_,y,x,w),g===null?a=null:(a=g[0],g.payload!==void 0&&(l=g.payload))):(n.lastIndex=y,a=this.match(n,e,y)),a&&a.length>s.length){s=a,u=a.length,c=l,j=t;break}}}break}}if(u!==-1){if(d=j.group,d!==void 0&&(s=s===null?e.substring(y,y+u):s,f=j.tokenTypeIdx,p=this.createTokenInstance(s,y,f,j.tokenType,S,C,u),this.handlePayload(p,c),!1===d?ee=this.addToken(x,ee,p):w[d].push(p)),!0===ne&&!0===j.canLineTerminator){let t,n,r=0;re.lastIndex=0;do s=s===null?e.substring(y,y+u):s,t=re.test(s),!0===t&&(n=re.lastIndex-1,r++);while(!0===t);r===0?C=this.computeNewColumn(C,u):(S+=r,C=u-n,this.updateTokenEndLineColumnLocation(p,d,n,r,S,C,u))}else C=this.computeNewColumn(C,u);y+=u,this.handleModes(j,k,A,p)}else{let t=y,n=S,i=C,a=!1===M;for(;!1===a&&y<v;)for(y++,r=0;r<ie;r++){let t=T[r],n=t.pattern;switch(t.matchType){case 0:_.charCodeAt(y)===t.short&&(a=!0);break;case 1:a=n.exec(_,y,x,w)!==null;break;case 3:case 2:n.lastIndex=y,a=n.exec(e)!==null}if(!0===a)break}if(m=y-t,C=this.computeNewColumn(C,m),h=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(_,t,m,n,i,D.at(-1)),te.push({offset:t,line:n,column:i,length:m,message:h}),!1===M)break}}return this.hasCustom||(x.length=ee),{tokens:x,groups:w,errors:te}}handleModes(e,t,n,r){if(!0===e.pop){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&!0===s||(e.endLine=i+c,e.endColumn=a-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return!0===e.test(t)?e.lastIndex-n:-1}};function st(e){return ct(e)?e.LABEL:e.name}function ct(e){return typeof e.LABEL==`string`&&e.LABEL!==``}J.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,J.NA=/NOT_APPLICABLE/;var lt=`parent`,ut=`categories`,dt=`label`,ft=`group`,pt=`push_mode`,mt=`pop_mode`,ht=`longer_alt`,gt=`line_breaks`,_t=`start_chars_hint`;function Y(e){return function(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,lt))throw`The parent property is no longer supported.
31
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,ut)&&(n.CATEGORIES=e[ut]),et([n]),Object.hasOwn(e,dt)&&(n.LABEL=e[dt]),Object.hasOwn(e,ft)&&(n.GROUP=e[ft]),Object.hasOwn(e,mt)&&(n.POP_MODE=e[mt]),Object.hasOwn(e,pt)&&(n.PUSH_MODE=e[pt]),Object.hasOwn(e,ht)&&(n.LONGER_ALT=e[ht]),Object.hasOwn(e,gt)&&(n.LINE_BREAKS=e[gt]),Object.hasOwn(e,_t)&&(n.START_CHARS_HINT=e[_t]),n}(e)}var X=Y({name:`EOF`,pattern:J.NA});function vt(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}et([X]);var yt={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${ct(e)?`--\x3e ${st(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>`Redundant input, expecting EOF but found: `+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
32
- but found: '`+t[0].image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${e.reduce((e,t)=>e.concat(t),[]).map(e=>`[${e.map(e=>st(e)).join(`, `)}]`).map((e,t)=>` ${t+1}. ${e}`).join(`
33
- `)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
34
- but found: '`+t[0].image+`'`;return n?`Expecting: `+n+i:`Expecting: expecting at least one iteration which starts with one of these possible Token sequences::\n <${e.map(e=>`[${e.map(e=>st(e)).join(`,`)}]`).join(` ,`)}>`+i}};Object.freeze(yt);var bt={buildRuleNotFoundError:(e,t)=>`Invalid grammar, reference to a rule which is not defined: ->`+t.nonTerminalName+`<-
35
- inside top level rule: ->`+e.name+`<-`},xt={buildDuplicateFoundError(e,t){let n=e.name,r=t[0],i=r.idx,a=V(r),o=(s=r)instanceof z?s.terminalType.name:s instanceof A?s.nonTerminalName:``;var s;let c=`->${a}${i>0?i:``}<- ${o?`with argument: ->${o}<-`:``}\n appears more than once (${t.length} times) in the top level rule: ->${n}<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n `;return c=c.replace(/[ \t]+/g,` `),c=c.replace(/\s\s+/g,`
36
- `),c},buildNamespaceConflictError:e=>`Namespace conflict found in grammar.\nThe grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${e.name}>.\nTo resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(e){let t=e.prefixPath.map(e=>st(e)).join(`, `),n=e.alternation.idx===0?``:e.alternation.idx;return`Ambiguous alternatives: <${e.ambiguityIndices.join(` ,`)}> due to common lookahead prefix\nin <OR${n}> inside <${e.topLevelRule.name}> Rule,\n<${t}> may appears as a prefix path in all these alternatives.\nSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details.`},buildAlternationAmbiguityError(e){let t=e.alternation.idx===0?``:e.alternation.idx,n=e.prefixPath.length===0,r=`Ambiguous Alternatives Detected: <${e.ambiguityIndices.join(` ,`)}> in <OR${t}> inside <${e.topLevelRule.name}> Rule,\n`;return r+=n?`These alternatives are all empty (match no tokens), making them indistinguishable.
37
- Only the last alternative may be empty.
38
- `:`<${e.prefixPath.map(e=>st(e)).join(`, `)}> may appears as a prefix path in all these alternatives.\n`,r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
39
- For Further details.`,r},buildEmptyRepetitionError(e){let t=V(e.repetition);return e.repetition.idx!==0&&(t+=e.repetition.idx),`The repetition <${t}> within Rule <${e.topLevelRule.name}> can never consume any tokens.\nThis could lead to an infinite loop.`},buildTokenNameError:e=>`deprecated`,buildEmptyAlternationError:e=>`Ambiguous empty alternative: <${e.emptyChoiceIdx+1}> in <OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\nOnly the last alternative may be an empty alternative.`,buildTooManyAlternativesError:e=>`An Alternation cannot have more than 256 alternatives:\n<OR${e.alternation.idx}> inside <${e.topLevelRule.name}> Rule.\n has ${e.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(e){let t=e.topLevelRule.name;return`Left Recursion found in grammar.\nrule: <${t}> can be invoked from itself (directly or indirectly)\nwithout consuming any Tokens. The grammar path that causes this is: \n ${t} --\x3e ${e.leftRecursionPath.map(e=>e.name).concat([t]).join(` --> `)}\n To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:e=>`deprecated`,buildDuplicateRuleNameError(e){let t;return t=e.topLevelRule instanceof j?e.topLevelRule.name:e.topLevelRule,`Duplicate definition, rule: ->${t}<- is already defined in the grammar: ->${e.grammarName}<-`}},Z,St=class extends se{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){Object.values(this.nameToTopRule).forEach(e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){let t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{let t=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:t,type:Q.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}},Ct=class extends le{constructor(e,t){super(),this.topProd=e,this.path=t,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=[...this.path.ruleStack].reverse(),this.occurrenceStack=[...this.path.occurrenceStack].reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,n){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){let r=t.concat(n);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){this.ruleStack.length===0?(this.nextProductionName=``,this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}},wt=class extends Ct{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName=``,this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,n){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){let e=new M({definition:t.concat(n)});this.possibleTokTypes=de(e),this.found=!0}}},Tt=class extends le{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}},Et=class extends Tt{walkMany(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkMany(e,t,n)}},Dt=class extends Tt{walkManySep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkManySep(e,t,n)}},Ot=class extends Tt{walkAtLeastOne(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOne(e,t,n)}},kt=class extends Tt{walkAtLeastOneSep(e,t,n){if(e.idx===this.occurrence){let e=t.concat(n)[0];this.result.isEndOfRule=e===void 0,e instanceof z&&(this.result.token=e.terminalType,this.result.occurrence=e.idx)}else super.walkAtLeastOneSep(e,t,n)}};function At(e,t,n=[]){n=[...n];let r=[],i=0;function a(a){let o=At(a.concat(e.slice(i+1)),t,n);return r.concat(o)}for(;n.length<t&&i<e.length;){let t=e[i];if(t instanceof M||t instanceof A)return a(t.definition);if(t instanceof N)r=a(t.definition);else{if(t instanceof P)return a(t.definition.concat([new I({definition:t.definition})]));if(t instanceof F)return a([new M({definition:t.definition}),new I({definition:[new z({terminalType:t.separator})].concat(t.definition)})]);if(t instanceof L)r=a(t.definition.concat([new I({definition:[new z({terminalType:t.separator})].concat(t.definition)})]));else if(t instanceof I)r=a(t.definition.concat([new I({definition:t.definition})]));else{if(t instanceof R)return t.definition.forEach(e=>{e.definition.length!==0&&(r=a(e.definition))}),r;if(!(t instanceof z))throw Error(`non exhaustive match`);n.push(t.terminalType)}}i++}return r.push({partialPath:n,suffixDef:e.slice(i)}),r}function jt(e,t,n,r){let i=[...n];i.push(e.name);let a=[...r];return a.push(1),{idx:t,def:e.definition,ruleStack:i,occurrenceStack:a}}function Mt(e){if(e instanceof N||e===`Option`)return Z.OPTION;if(e instanceof I||e===`Repetition`)return Z.REPETITION;if(e instanceof P||e===`RepetitionMandatory`)return Z.REPETITION_MANDATORY;if(e instanceof F||e===`RepetitionMandatoryWithSeparator`)return Z.REPETITION_MANDATORY_WITH_SEPARATOR;if(e instanceof L||e===`RepetitionWithSeparator`)return Z.REPETITION_WITH_SEPARATOR;if(e instanceof R||e===`Alternation`)return Z.ALTERNATION;throw Error(`non exhaustive match`)}function Nt(e,t,n,r){let i=e.length,a=e.every(e=>e.every(e=>e.length===1));if(t)return function(t){let r=t.map(e=>e.GATE);for(let t=0;t<i;t++){let i=e[t],a=i.length,o=r[t];if(o===void 0||!1!==o.call(this))e:for(let e=0;e<a;e++){let r=i[e],a=r.length;for(let e=0;e<a;e++)if(!1===n(this.LA_FAST(e+1),r[e]))continue e;return t}}};if(a&&!r){let t=e.map(e=>e.flat()).reduce((e,t,n)=>(t.forEach(t=>{t.tokenTypeIdx in e||(e[t.tokenTypeIdx]=n),t.categoryMatches.forEach(t=>{Object.hasOwn(e,t)||(e[t]=n)})}),e),{});return function(){let e=this.LA_FAST(1);return t[e.tokenTypeIdx]}}return function(){for(let t=0;t<i;t++){let r=e[t],i=r.length;e:for(let e=0;e<i;e++){let i=r[e],a=i.length;for(let e=0;e<a;e++)if(!1===n(this.LA_FAST(e+1),i[e]))continue e;return t}}}}function Pt(e,t,n){let r=e.every(e=>e.length===1),i=e.length;if(r&&!n){let t=e.flat();if(t.length===1&&t[0].categoryMatches.length===0){let e=t[0].tokenTypeIdx;return function(){return this.LA_FAST(1).tokenTypeIdx===e}}{let e=t.reduce((e,t,n)=>(e[t.tokenTypeIdx]=!0,t.categoryMatches.forEach(t=>{e[t]=!0}),e),[]);return function(){let t=this.LA_FAST(1);return!0===e[t.tokenTypeIdx]}}}return function(){e:for(let n=0;n<i;n++){let r=e[n],i=r.length;for(let e=0;e<i;e++)if(!1===t(this.LA_FAST(e+1),r[e]))continue e;return!0}return!1}}(function(e){e[e.OPTION=0]=`OPTION`,e[e.REPETITION=1]=`REPETITION`,e[e.REPETITION_MANDATORY=2]=`REPETITION_MANDATORY`,e[e.REPETITION_MANDATORY_WITH_SEPARATOR=3]=`REPETITION_MANDATORY_WITH_SEPARATOR`,e[e.REPETITION_WITH_SEPARATOR=4]=`REPETITION_WITH_SEPARATOR`,e[e.ALTERNATION=5]=`ALTERNATION`})(Z||={});var Ft=class extends le{constructor(e,t,n){super(),this.topProd=e,this.targetOccurrence=t,this.targetProdType=n}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,t,n,r){return e.idx===this.targetOccurrence&&this.targetProdType===t&&(this.restDef=n.concat(r),!0)}walkOption(e,t,n){this.checkIsTarget(e,Z.OPTION,t,n)||super.walkOption(e,t,n)}walkAtLeastOne(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY,t,n)||super.walkOption(e,t,n)}walkAtLeastOneSep(e,t,n){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}walkMany(e,t,n){this.checkIsTarget(e,Z.REPETITION,t,n)||super.walkOption(e,t,n)}walkManySep(e,t,n){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR,t,n)||super.walkOption(e,t,n)}},It=class extends se{constructor(e,t,n){super(),this.targetOccurrence=e,this.targetProdType=t,this.targetRef=n,this.result=[]}checkIsTarget(e,t){e.idx!==this.targetOccurrence||this.targetProdType!==t||this.targetRef!==void 0&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Z.OPTION)}visitRepetition(e){this.checkIsTarget(e,Z.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Z.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Z.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Z.ALTERNATION)}};function Lt(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=[];return t}function Rt(e){let t=[``];for(let n=0;n<e.length;n++){let r=e[n],i=[];for(let e=0;e<t.length;e++){let n=t[e];i.push(n+`_`+r.tokenTypeIdx);for(let e=0;e<r.categoryMatches.length;e++){let t=`_`+r.categoryMatches[e];i.push(n+t)}}t=i}return t}function zt(e,t,n){for(let r=0;r<e.length;r++){if(r===n)continue;let i=e[r];for(let e=0;e<t.length;e++)if(!0===i[t[e]])return!1}return!0}function Bt(e,t){let n=e.map(e=>At([e],1)),r=Lt(n.length),i=n.map(e=>{let t={};return e.forEach(e=>{Rt(e.partialPath).forEach(e=>{t[e]=!0})}),t}),a=n;for(let e=1;e<=t;e++){let n=a;a=Lt(n.length);for(let o=0;o<n.length;o++){let s=n[o];for(let n=0;n<s.length;n++){let c=s[n].partialPath,l=s[n].suffixDef,u=Rt(c);if(zt(i,u,o)||l.length===0||c.length===t){let e=r[o];if(!1===Ut(e,c)){e.push(c);for(let e=0;e<u.length;e++){let t=u[e];i[o][t]=!0}}}else{let t=At(l,e+1,c);a[o]=a[o].concat(t),t.forEach(e=>{Rt(e.partialPath).forEach(e=>{i[o][e]=!0})})}}}}return r}function Vt(e,t,n,r){let i=new It(e,Z.ALTERNATION,r);return t.accept(i),Bt(i.result,n)}function Ht(e,t,n,r){let i=new It(e,n);t.accept(i);let a=i.result,o=new Ft(t,e,n).startWalking();return Bt([new M({definition:a}),new M({definition:o})],r)}function Ut(e,t){e:for(let n=0;n<e.length;n++){let r=e[n];if(r.length===t.length){for(let e=0;e<r.length;e++){let n=t[e],i=r[e];if((n===i||i.categoryMatchesMap[n.tokenTypeIdx]!==void 0)==0)continue e}return!0}}return!1}function Wt(e){return e.every(e=>e.every(e=>e.every(e=>e.categoryMatches.length===0)))}function Gt(e,t,n,r){let i=e.flatMap(e=>function(e,t){let n=new Jt;e.accept(n);let r=n.allProductions,i=Object.groupBy(r,Kt),a=Object.fromEntries(Object.entries(i).filter(([e,t])=>t.length>1));return Object.values(a).map(n=>{let r=n[0],i=t.buildDuplicateFoundError(e,n),a=V(r),o={message:i,type:Q.DUPLICATE_PRODUCTIONS,ruleName:e.name,dslName:a,occurrence:r.idx},s=qt(r);return s&&(o.parameter=s),o})}(e,n)),a=function(e,t,n){let r=[],i=t.map(e=>e.name);return e.forEach(e=>{let t=e.name;if(i.includes(t)){let i=n.buildNamespaceConflictError(e);r.push({message:i,type:Q.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:t})}}),r}(e,t,n),o=e.flatMap(e=>function(e,t){let n=new Zt;return e.accept(n),n.alternations.flatMap(n=>n.definition.length>255?[{message:t.buildTooManyAlternativesError({topLevelRule:e,alternation:n}),type:Q.TOO_MANY_ALTS,ruleName:e.name,occurrence:n.idx}]:[])}(e,n)),s=e.flatMap(t=>function(e,t,n,r){let i=[];if(t.reduce((t,n)=>n.name===e.name?t+1:t,0)>1){let t=r.buildDuplicateRuleNameError({topLevelRule:e,grammarName:n});i.push({message:t,type:Q.DUPLICATE_RULE_NAME,ruleName:e.name})}return i}(t,e,r,n));return i.concat(a,o,s)}function Kt(e){return`${V(e)}_#_${e.idx}_#_${qt(e)}`}function qt(e){return e instanceof z?e.terminalType.name:e instanceof A?e.nonTerminalName:``}var Jt=class extends se{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 Yt(e,t,n,r=[]){let i=[],a=Xt(t.definition);if(a.length===0)return[];{let t=e.name;a.includes(e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:r}),type:Q.LEFT_RECURSION,ruleName:t});let o=r.concat([e]),s=a.filter(e=>!o.includes(e)).flatMap(t=>{let i=[...r];return i.push(t),Yt(e,t,n,i)});return i.concat(s)}}function Xt(e){let t=[];if(e.length===0)return t;let n=e[0];if(n instanceof A)t.push(n.referencedRule);else if(n instanceof M||n instanceof N||n instanceof P||n instanceof F||n instanceof L||n instanceof I)t=t.concat(Xt(n.definition));else if(n instanceof R)t=n.definition.map(e=>Xt(e.definition)).flat();else if(!(n instanceof z))throw Error(`non exhaustive match`);let r=ce(n),i=e.length>1;if(r&&i){let n=e.slice(1);return t.concat(Xt(n))}return t}var Zt=class extends se{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}};function Qt(e,t){let n=new Zt;return e.accept(n),n.alternations.flatMap(n=>n.definition.slice(0,-1).flatMap((r,i)=>function(e,t,n,r){let i=`EXIT_NONE_TERMINAL`,a=[i],o=`EXIT_ALTERNATIVE`,s=!1,c=t.length,l=c-r-1,u=[],d=[];for(d.push({idx:-1,def:e,ruleStack:[],occurrenceStack:[]});d.length!==0;){let e=d.pop();if(e===o){s&&d.at(-1).idx<=l&&d.pop();continue}let r=e.def,f=e.idx,p=e.ruleStack,m=e.occurrenceStack;if(r.length===0)continue;let h=r[0];if(h===i){let e={idx:f,def:r.slice(1),ruleStack:p.slice(0,-1),occurrenceStack:m.slice(0,-1)};d.push(e)}else if(h instanceof z){if(f<c-1){let e=f+1;if(n(t[e],h.terminalType)){let t={idx:e,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(t)}}else{if(f!==c-1)throw Error(`non exhaustive match`);u.push({nextTokenType:h.terminalType,nextTokenOccurrence:h.idx,ruleStack:p,occurrenceStack:m}),s=!0}}else if(h instanceof A){let e=[...p];e.push(h.nonTerminalName);let t=[...m];t.push(h.idx);let n={idx:f,def:h.definition.concat(a,r.slice(1)),ruleStack:e,occurrenceStack:t};d.push(n)}else if(h instanceof N){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t={idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof P){let e=new I({definition:h.definition,idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof F){let e=new I({definition:[new z({terminalType:h.separator})].concat(h.definition),idx:h.idx}),t={idx:f,def:h.definition.concat([e],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t)}else if(h instanceof L){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new I({definition:[new z({terminalType:h.separator})].concat(h.definition),idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof I){let e={idx:f,def:r.slice(1),ruleStack:p,occurrenceStack:m};d.push(e),d.push(o);let t=new I({definition:h.definition,idx:h.idx}),n={idx:f,def:h.definition.concat([t],r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(n)}else if(h instanceof R)for(let e=h.definition.length-1;e>=0;e--){let t={idx:f,def:h.definition[e].definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m};d.push(t),d.push(o)}else if(h instanceof M)d.push({idx:f,def:h.definition.concat(r.slice(1)),ruleStack:p,occurrenceStack:m});else{if(!(h instanceof j))throw Error(`non exhaustive match`);d.push(jt(h,f,p,m))}}return u}([r],[],Xe,1).length===0?[{message:t.buildEmptyAlternationError({topLevelRule:e,alternation:n,emptyChoiceIdx:i}),type:Q.NONE_LAST_EMPTY_ALT,ruleName:e.name,occurrence:n.idx,alternative:i+1}]:[]))}function $t(e,t,n){let r=new Zt;e.accept(r);let i=r.alternations;return i=i.filter(e=>!0!==e.ignoreAmbiguities),i.flatMap(r=>{let i=r.idx,a=Vt(i,e,r.maxLookahead||t,r),o=function(e,t,n,r){let i=[];return e.reduce((n,r,a)=>(!0===t.definition[a].ignoreAmbiguities||r.forEach(r=>{let o=[a];e.forEach((e,n)=>{a!==n&&Ut(e,r)&&!0!==t.definition[n].ignoreAmbiguities&&o.push(n)}),o.length>1&&!Ut(i,r)&&(i.push(r),n.push({alts:o,path:r}))}),n),[]).map(e=>{let i=e.alts.map(e=>e+1);return{message:r.buildAlternationAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Q.AMBIGUOUS_ALTS,ruleName:n.name,occurrence:t.idx,alternatives:e.alts}})}(a,r,e,n),s=function(e,t,n,r){let i=e.reduce((e,t,n)=>{let r=t.map(e=>({idx:n,path:e}));return e.concat(r)},[]);return i.flatMap(e=>{if(!0===t.definition[e.idx].ignoreAmbiguities)return[];let a=e.idx,o=e.path;return i.filter(e=>{return!0!==t.definition[e.idx].ignoreAmbiguities&&e.idx<a&&(n=e.path,r=o,n.length<r.length&&n.every((e,t)=>{let n=r[t];return e===n||n.categoryMatchesMap[e.tokenTypeIdx]}));var n,r}).map(e=>{let i=[e.idx+1,a+1],o=t.idx===0?``:t.idx;return{message:r.buildAlternationPrefixAmbiguityError({topLevelRule:n,alternation:t,ambiguityIndices:i,prefixPath:e.path}),type:Q.AMBIGUOUS_PREFIX_ALTS,ruleName:n.name,occurrence:o,alternatives:i}})})}(a,r,e,n);return o.concat(s)})}var en=class extends se{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)}};function tn(e){let t=Object.assign({errMsgProvider:bt},e),n={};return e.rules.forEach(e=>{n[e.name]=e}),function(e,t){let n=new St(e,t);return n.resolveRefs(),n.errors}(n,t.errMsgProvider)}var nn=`MismatchedTokenException`,rn=`NoViableAltException`,an=`EarlyExitException`,on=`NotAllInputParsedException`,sn=[nn,rn,an,on];function cn(e){return sn.includes(e.name)}Object.freeze(sn);var ln=class extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},un=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=nn}},dn=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=rn}},fn=class extends ln{constructor(e,t){super(e,t),this.name=on}},pn=class extends ln{constructor(e,t,n){super(e,t),this.previousToken=n,this.name=an}},mn={},hn=class extends Error{constructor(e){super(e),this.name=`InRuleRecoveryException`}};function gn(e,t,n,r,i,a,o){var s,c;let l=r|i,u=(s=this.firstAfterRepMap)[c=this.currRuleShortName]??(s[c]=[]),d=u[l];if(d===void 0){let e=this.getCurrRuleFullName();d=new a(this.getGAstProductions()[e],i).startWalking(),u[l]=d}let f=d.token,p=d.occurrence,m=d.isEndOfRule;this.RULE_STACK_IDX===0&&m&&f===void 0&&(f=X,p=1),f!==void 0&&p!==void 0&&this.shouldInRepetitionRecoveryBeTried(f,p,o)&&this.tryInRepetitionRecovery(e,t,n,f)}var _n=1024,vn=1280,yn=1536,bn=class{constructor(e){this.maxLookahead=e?.maxLookahead??$.maxLookahead}validate(e){let t=this.validateNoLeftRecursion(e.rules);if(t.length===0){let n=this.validateEmptyOrAlternatives(e.rules),r=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),i=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...t,...n,...r,...i]}return t}validateNoLeftRecursion(e){return e.flatMap(e=>Yt(e,e,xt))}validateEmptyOrAlternatives(e){return e.flatMap(e=>Qt(e,xt))}validateAmbiguousAlternationAlternatives(e,t){return e.flatMap(e=>$t(e,t,xt))}validateSomeNonEmptyLookaheadPath(e,t){return function(e,t,n){let r=[];return e.forEach(e=>{let i=new en;e.accept(i),i.allProductions.forEach(i=>{let a=Mt(i),o=i.maxLookahead||t;if(Ht(i.idx,e,a,o)[0].flat().length===0){let t=n.buildEmptyRepetitionError({topLevelRule:e,repetition:i});r.push({message:t,type:Q.NO_NON_EMPTY_LOOKAHEAD,ruleName:e.name})}})}),r}(e,t,xt)}buildLookaheadForAlternation(e){return function(e,t,n,r,i,a){let o=Vt(e,t,n);return a(o,r,Wt(o)?Ze:Xe,i)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Nt)}buildLookaheadForOptional(e){return function(e,t,n,r,i,a){let o=Ht(e,t,i,n),s=Wt(o)?Ze:Xe;return a(o[0],s,r)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Mt(e.prodType),Pt)}},xn=new class extends se{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}};function Sn(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.endOffset=t.endOffset):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset)}function Cn(e,t){e.startOffset===-1?(e.startOffset=t.startOffset,e.startColumn=t.startColumn,e.startLine=t.startLine,e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine):e.endOffset<t.endOffset==1&&(e.endOffset=t.endOffset,e.endColumn=t.endColumn,e.endLine=t.endLine)}var wn;function Tn(e,t){Object.defineProperty(e,"name",{enumerable:!1,configurable:!0,writable:!1,value:t})}function En(e,t){let n=Object.keys(e),r=n.length;for(let i=0;i<r;i++){let r=e[n[i]],a=r.length;for(let e=0;e<a;e++){let n=r[e];n.tokenTypeIdx===void 0&&this[n.name](n.children,t)}}}function Dn(e,t){let n=function(){};return Tn(n,e+`BaseSemantics`),n.prototype={visit:function(e,t){if(Array.isArray(e)&&(e=e[0]),e!==void 0)return this[e.name](e.children,t)},validateVisitor:function(){let e=function(e,t){return function(e,t){return t.filter(t=>typeof e[t]==`function`==0).map(t=>({msg:`Missing visitor method: <${t}> on ${e.constructor.name} CST Visitor.`,type:wn.MISSING_METHOD,methodName:t})).filter(Boolean)}(e,t)}(this,t);if(e.length!==0){let t=e.map(e=>e.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:\n\t${t.join(`
40
-
41
- `).replace(/\n/g,`
42
- `)}`)}}},n.prototype.constructor=n,n._RULE_NAMES=t,n}(function(e){e[e.REDUNDANT_METHOD=0]=`REDUNDANT_METHOD`,e[e.MISSING_METHOD=1]=`MISSING_METHOD`})(wn||={});var On={description:`This Object indicates the Parser is during Recording Phase`};Object.freeze(On);var kn=!0,An=Y({name:`RECORDING_PHASE_TOKEN`,pattern:J.NA});et([An]);var jn=vt(An,`This IToken indicates the Parser is in Recording Phase
43
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(jn);var Mn={name:`This CSTNode indicates the Parser is in Recording Phase
44
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function Nn(e,t,n,r=!1){In(n);let i=this.recordingProdStack.at(-1),a=typeof t==`function`?t:t.DEF,o=new e({definition:[],idx:n});return r&&(o.separator=t.SEP),Object.hasOwn(t,`MAX_LOOKAHEAD`)&&(o.maxLookahead=t.MAX_LOOKAHEAD),this.recordingProdStack.push(o),a.call(this),i.definition.push(o),this.recordingProdStack.pop(),On}function Pn(e,t){In(t);let n=this.recordingProdStack.at(-1),r=!1===Array.isArray(e),i=!1===r?e:e.DEF,a=new R({definition:[],idx:t,ignoreAmbiguities:r&&!0===e.IGNORE_AMBIGUITIES});return Object.hasOwn(e,`MAX_LOOKAHEAD`)&&(a.maxLookahead=e.MAX_LOOKAHEAD),a.hasPredicates=i.some(e=>typeof e.GATE==`function`),n.definition.push(a),i.forEach(e=>{let t=new M({definition:[]});a.definition.push(t),Object.hasOwn(e,`IGNORE_AMBIGUITIES`)?t.ignoreAmbiguities=e.IGNORE_AMBIGUITIES:Object.hasOwn(e,`GATE`)&&(t.ignoreAmbiguities=!0),this.recordingProdStack.push(t),e.ALT.call(this),this.recordingProdStack.pop()}),On}function Fn(e){return e===0?``:`${e}`}function In(e){if(e<0||e>255){let t=Error(`Invalid DSL Method idx value: <${e}>\n\tIdx value must be a none negative value smaller than 256`);throw t.KNOWN_RECORDER_ERROR=!0,t}}var Ln=vt(X,``,-1,-1,-1,-1,-1,-1);Object.freeze(Ln);var Q,$=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yt,nodeLocationTracking:`none`,traceInitPerf:!1,skipValidations:!1}),Rn=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});(function(e){e[e.INVALID_RULE_NAME=0]=`INVALID_RULE_NAME`,e[e.DUPLICATE_RULE_NAME=1]=`DUPLICATE_RULE_NAME`,e[e.INVALID_RULE_OVERRIDE=2]=`INVALID_RULE_OVERRIDE`,e[e.DUPLICATE_PRODUCTIONS=3]=`DUPLICATE_PRODUCTIONS`,e[e.UNRESOLVED_SUBRULE_REF=4]=`UNRESOLVED_SUBRULE_REF`,e[e.LEFT_RECURSION=5]=`LEFT_RECURSION`,e[e.NONE_LAST_EMPTY_ALT=6]=`NONE_LAST_EMPTY_ALT`,e[e.AMBIGUOUS_ALTS=7]=`AMBIGUOUS_ALTS`,e[e.CONFLICT_TOKENS_RULES_NAMESPACE=8]=`CONFLICT_TOKENS_RULES_NAMESPACE`,e[e.INVALID_TOKEN_NAME=9]=`INVALID_TOKEN_NAME`,e[e.NO_NON_EMPTY_LOOKAHEAD=10]=`NO_NON_EMPTY_LOOKAHEAD`,e[e.AMBIGUOUS_PREFIX_ALTS=11]=`AMBIGUOUS_PREFIX_ALTS`,e[e.TOO_MANY_ALTS=12]=`TOO_MANY_ALTS`,e[e.CUSTOM_LOOKAHEAD_VALIDATION=13]=`CUSTOM_LOOKAHEAD_VALIDATION`})(Q||={});var zn,Bn=class e{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT(`performSelfAnalysis`,()=>{let t;this.selfAnalysisDone=!0;let n=this.className;this.TRACE_INIT(`toFastProps`,()=>{O(this)}),this.TRACE_INIT(`Grammar Recording`,()=>{try{this.enableRecording(),this.definedRulesNames.forEach(e=>{let t=this[e].originalGrammarAction,n;this.TRACE_INIT(`${e} Rule`,()=>{n=this.topLevelRuleRecord(e,t)}),this.gastProductionsCache[e]=n})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT(`Grammar Resolving`,()=>{r=tn({rules:Object.values(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT(`Grammar Validations`,()=>{if(r.length===0&&!1===this.skipValidations){let t=function(e){let t=e.errMsgProvider??xt;return Gt(e.rules,e.tokenTypes,t,e.grammarName)}({rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),errMsgProvider:xt,grammarName:n}),r=(e={lookaheadStrategy:this.lookaheadStrategy,rules:Object.values(this.gastProductionsCache),tokenTypes:Object.values(this.tokensMap),grammarName:n}).lookaheadStrategy.validate({rules:e.rules,tokenTypes:e.tokenTypes,grammarName:e.grammarName}).map(e=>Object.assign({type:Q.CUSTOM_LOOKAHEAD_VALIDATION},e));this.definitionErrors=this.definitionErrors.concat(t,r)}var e}),this.definitionErrors.length===0&&(this.recoveryEnabled&&this.TRACE_INIT(`computeAllProdsFollows`,()=>{let e=function(e){let t={};return e.forEach(e=>{let n=new pe(e).startWalking();Object.assign(t,n)}),t}(Object.values(this.gastProductionsCache));this.resyncFollows=e}),this.TRACE_INIT(`ComputeLookaheadFunctions`,()=>{var e,t;(t=(e=this.lookaheadStrategy).initialize)==null||t.call(e,{rules:Object.values(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache))})),!e.DEFER_DEFINITION_ERRORS_HANDLING&&this.definitionErrors.length!==0)throw t=this.definitionErrors.map(e=>e.message),Error(`Parser Definition Errors detected:\n ${t.join(`
45
- -------------------------------
46
- `)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;let n=this;if(n.initErrorHandler(t),n.initLexerAdapter(),n.initLooksAhead(t),n.initRecognizerEngine(e,t),n.initRecoverable(t),n.initTreeBuilder(t),n.initGastRecorder(t),n.initPerformanceTracer(t),Object.hasOwn(t,`ignoredIssues`))throw Error(`The <ignoredIssues> IParserConfig property has been deprecated.
47
- Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
48
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
49
- For further details.`);this.skipValidations=Object.hasOwn(t,`skipValidations`)?t.skipValidations:$.skipValidations}};Bn.DEFER_DEFINITION_ERRORS_HANDLING=!1,zn=Bn,[class{initRecoverable(e){this.firstAfterRepMap=[],this.resyncFollows={},this.recoveryEnabled=Object.hasOwn(e,`recoveryEnabled`)?e.recoveryEnabled:$.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=gn)}getTokenToInsert(e){let t=vt(e,``,-1,-1,-1,-1,-1,-1);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,n,r){let i=this.findReSyncTokenType(),a=this.exportLexerState(),o=[],s=!1,c=this.LA_FAST(1),l=this.LA_FAST(1),u=()=>{let e=this.LA(0),t=new un(this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:e,ruleName:this.getCurrRuleFullName()}),c,this.LA(0));t.resyncedTokens=o.slice(0,-1),this.SAVE_ERROR(t)};for(;!s;){if(this.tokenMatcher(l,r))return void u();if(n.call(this))return u(),void e.apply(this,t);this.tokenMatcher(l,i)?s=!0:(l=this.SKIP_TOKEN(),this.addToResyncTokens(l,o))}this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,n){return!1!==n&&!this.tokenMatcher(this.LA_FAST(1),e)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t))}getNextPossibleTokenTypes(e){let t=e.ruleStack[0],n=this.getGAstProductions()[t];return new wt(n,e).startWalking()}getFollowsForInRuleRecovery(e,t){let n=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){let e=this.SKIP_TOKEN();return this.consumeToken(),e}throw new hn(`sad sad panda`)}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||t.length===0)return!1;let n=this.LA_FAST(1);return t.find(e=>this.tokenMatcher(n,e))!==void 0}canRecoverWithSingleTokenDeletion(e){return!!this.canTokenTypeBeDeletedInRecovery(e)&&this.tokenMatcher(this.LA(2),e)}isInCurrentRuleReSyncSet(e){let t=this.getCurrFollowKey();return this.getFollowSetFromFollowKey(t).includes(e)}findReSyncTokenType(){let e=this.flattenFollowSet(),t=this.LA_FAST(1),n=2;for(;;){let r=e.find(e=>Xe(t,e));if(r!==void 0)return r;t=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK_IDX===0)return mn;let e=this.currRuleShortName,t=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){let e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK,n=this.RULE_STACK_IDX+1,r=Array(n);for(let i=0;i<n;i++)r[i]=i===0?mn:{ruleName:this.shortRuleNameToFullName(e[i]),idxInCallingRule:t[i],inRule:this.shortRuleNameToFullName(e[i-1])};return r}flattenFollowSet(){return this.buildFullFollowKeyStack().map(e=>this.getFollowSetFromFollowKey(e)).flat()}getFollowSetFromFollowKey(e){if(e===mn)return[X];let t=e.ruleName+e.idxInCallingRule+fe+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,X)||t.push(e),t}reSyncTo(e){let t=[],n=this.LA_FAST(1);for(;!1===this.tokenMatcher(n,e);)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,t);return t.slice(0,-1)}attemptInRepetitionRecovery(e,t,n,r,i,a,o){}getCurrentGrammarPath(e,t){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1),lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){let e=this.RULE_STACK_IDX+1,t=Array(e);for(let n=0;n<e;n++)t[n]=this.shortRuleNameToFullName(this.RULE_STACK[n]);return t}},class{initLooksAhead(e){this.dynamicTokensEnabled=Object.hasOwn(e,`dynamicTokensEnabled`)?e.dynamicTokensEnabled:$.dynamicTokensEnabled,this.maxLookahead=Object.hasOwn(e,`maxLookahead`)?e.maxLookahead:$.maxLookahead,this.lookaheadStrategy=Object.hasOwn(e,`lookaheadStrategy`)?e.lookaheadStrategy:new bn({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=[],this.currRuleLookaheadFuncs=[]}preComputeLookaheadFunctions(e){e.forEach(e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{let{alternation:t,repetition:n,option:r,repetitionMandatory:i,repetitionMandatoryWithSeparator:a,repetitionWithSeparator:o}=function(e){xn.reset(),e.accept(xn);let t=xn.dslMethods;return xn.reset(),t}(e);t.forEach(t=>{let n=t.idx===0?``:t.idx;this.TRACE_INIT(`${V(t)}${n}`,()=>{let n=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:t.idx,rule:e,maxLookahead:t.maxLookahead||this.maxLookahead,hasPredicates:t.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled});this.setLaFuncCache(this.fullRuleNameToShort[e.name],256|t.idx,n)})}),n.forEach(t=>{this.computeLookaheadFunc(e,t.idx,768,`Repetition`,t.maxLookahead,V(t))}),r.forEach(t=>{this.computeLookaheadFunc(e,t.idx,512,`Option`,t.maxLookahead,V(t))}),i.forEach(t=>{this.computeLookaheadFunc(e,t.idx,_n,`RepetitionMandatory`,t.maxLookahead,V(t))}),a.forEach(t=>{this.computeLookaheadFunc(e,t.idx,yn,`RepetitionMandatoryWithSeparator`,t.maxLookahead,V(t))}),o.forEach(t=>{this.computeLookaheadFunc(e,t.idx,vn,`RepetitionWithSeparator`,t.maxLookahead,V(t))})})})}computeLookaheadFunc(e,t,n,r,i,a){this.TRACE_INIT(`${a}${t===0?``:t}`,()=>{let a=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r});this.setLaFuncCache(this.fullRuleNameToShort[e.name],n|t,a)})}setLaFuncCache(e,t,n){let r=this.lookAheadFuncsCache[e];r===void 0&&(r=[],this.lookAheadFuncsCache[e]=r),r[t]=n}},class{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=Object.hasOwn(e,`nodeLocationTracking`)?e.nodeLocationTracking:$.nodeLocationTracking,this.outputCst){if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Cn,this.setNodeLocationFromNode=Cn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=Sn,this.setNodeLocationFromNode=Sn,this.cstPostRule=()=>{},this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${e.nodeLocationTracking}"`);this.setNodeLocationFromToken=()=>{},this.setNodeLocationFromNode=()=>{},this.cstPostRule=()=>{},this.setInitialNodeLocation=()=>{}}}else this.cstInvocationStateUpdate=()=>{},this.cstFinallyStateUpdate=()=>{},this.cstPostTerminal=()=>{},this.cstPostNonTerminal=()=>{},this.cstPostRule=()=>{}}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:-1,endOffset:-1}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA_FAST(1).startOffset,endOffset:-1}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:-1,startLine:-1,startColumn:-1,endOffset:-1,endLine:-1,endColumn:-1}}setInitialNodeLocationFullRegular(e){let t=this.LA_FAST(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:-1,endLine:-1,endColumn:-1}}cstInvocationStateUpdate(e){let t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset==1?(n.endOffset=t.endOffset,n.endLine=t.endLine,n.endColumn=t.endColumn):(n.startOffset=-1,n.startLine=-1,n.startColumn=-1)}cstPostRuleOnlyOffset(e){let t=this.LA(0),n=e.location;n.startOffset!==-1&&n.startOffset<=t.startOffset==1?n.endOffset=t.endOffset:n.startOffset=-1}cstPostTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];var r,i=t,a=e;(r=n).children[a]===void 0?r.children[a]=[i]:r.children[a].push(i),this.setNodeLocationFromToken(n.location,t)}cstPostNonTerminal(e,t){let n=this.CST_STACK[this.CST_STACK.length-1];(function(e,t,n){e.children[t]===void 0?e.children[t]=[n]:e.children[t].push(n)})(n,t,e),this.setNodeLocationFromNode(n.location,e.location)}get currCSTNode(){return this.CST_STACK[this.CST_STACK.length-1]}getBaseCstVisitorConstructor(){if(this.baseCstVisitorConstructor===void 0){let e=Dn(this.className,Object.keys(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(this.baseCstVisitorWithDefaultsConstructor===void 0){let e=function(e,t,n){let r=function(){};Tn(r,e+`BaseSemanticsWithDefaults`);let i=Object.create(n.prototype);return t.forEach(e=>{i[e]=En}),(r.prototype=i).constructor=r,r}(this.className,Object.keys(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getPreviousExplicitRuleShortName(){return this.RULE_STACK[this.RULE_STACK_IDX-1]}getLastExplicitRuleOccurrenceIndex(){return this.RULE_OCCURRENCE_STACK[this.RULE_OCCURRENCE_STACK_IDX]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(!0!==this.selfAnalysisDone)throw Error(`Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.`);this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVectorLength-2?(this.consumeToken(),this.LA_FAST(1)):Ln}LA_FAST(e){let t=this.currIdx+e;return this.tokVector[t]}LA(e){let t=this.currIdx+e;return t<0||this.tokVectorLength<=t?Ln:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVectorLength-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull=[],this.fullRuleNameToShort={},this.ruleShortNameIdx=0,this.tokenMatcher=Ze,this.subruleIdx=0,this.currRuleShortName=-1,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK=[],this.RULE_OCCURRENCE_STACK_IDX=-1,this.gastProductionsCache={},Object.hasOwn(t,`serializedGrammar`))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
50
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
51
- For Further details.`);if(Array.isArray(e)){if(e.length===0)throw Error(`A Token Vocabulary cannot be empty.
52
- Note that the first argument for the parser constructor
53
- is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset==`number`)throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
54
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
55
- For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(it)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else{if(typeof e!=`object`||!e)throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap=Object.assign({},e)}this.tokensMap.EOF=X;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Ze:Xe,et(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:Rn.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:Rn.recoveryValueFunc,a=this.ruleShortNameIdx++,o;return this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a,o=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(cn(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof e!=`function`){r=e.DEF;let t=e.GATE;if(t!==void 0){let e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){let n=_n|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,_n,e,Ot)}atLeastOneSepFirstInternal(e,t){let n=yn|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0!==this.currRuleLookaheadFuncs[n].call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,kt],t,yn,e,kt)}}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let a=!0;for(;!0===i.call(this)&&!0===a;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Et,a)}manySepFirstInternal(e,t){let n=vn|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0===this.currRuleLookaheadFuncs[n].call(this)){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Dt],t,vn,e,Dt)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,yn,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw cn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new un(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||n.name!==`MismatchedTokenException`||this.isBackTracking())throw n;{let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),X)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Ln)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new fn(t,e))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}},class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Rn){if(this.definedRulesNames.includes(e)){let t={message:xt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Q.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Rn){let r=function(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Q.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(cn(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(oe)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:$.errorMessageProvider}SAVE_ERROR(e){if(cn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=Ht(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new pn(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=Vt(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));let a=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new dn(o,this.LA(1),a))}},class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Ln}topLevelRuleRecord(e,t){try{let n=new j({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message+=`
56
- This error was thrown during the "grammar recording phase" For more info see:
57
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,N,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,F,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,I,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,L,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new A({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new z({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ae(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??T,r=e?.maxColumn??Kn,i=e?.maxRow??qn,a=Gn.get(n);a||(a=new Map,Gn.set(n,a));let o=`${r}:${i}`,s=a.get(o);return s||(s=new t({locale:n,maxColumn:r,maxRow:i}),a.set(o,s)),s}constructor(e){let t=e?.maxColumn??Kn,n=e?.maxRow??qn,r=e?.locale??T;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:o,separatorRow:s,separatorDecimal:c}=r.separators;if(o===s)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${o}')`);let l=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),u=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),d=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),f=Y({name:`TableReference`,pattern:{exec:a},line_breaks:!1,start_chars_hint:Wn}),p=Y({name:`BracketedString`,pattern:{exec:ne},line_breaks:!1,start_chars_hint:[91],longer_alt:[f,u]}),m=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),h=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),g=Y({name:`LiteralError`,pattern:new RegExp(m(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(h).join(`|`))}),_=Y({name:`RefError`,pattern:new RegExp(m(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(h).join(`|`))}),v=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),y=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),ee=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,x=Y({name:`NamedToken`,pattern:{exec:(e,t)=>{b.lastIndex=t;let n=b.exec(e);if(!n)return null;let r=n[0],i=r.indexOf(`.:`);return i===-1?r.endsWith(`:`)&&(r=r.slice(0,-1)):r=r.substring(0,i),[r]}},line_breaks:!1,start_chars_hint:Wn}),te=Y({name:`Cell`,pattern:{exec:Xn(t,n)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:x}),S=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:x}),C=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),w=c===`.`?`\\.`:c,re=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${w}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${w}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),ie=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),E=Y({name:`DigitToken`,pattern:/[0-9]+/}),D=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!D.some(e=>e.toLowerCase()===t.toLowerCase())&&D.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let ae=Y({name:`BooleanToken`,pattern:new RegExp(D.join(`|`),`i`)}),O=Y({name:`ArgSeparator`,pattern:Zn(i)}),k=Y({name:`ColSeparator`,pattern:Zn(o)}),A=Y({name:`RowSeparator`,pattern:Zn(s)}),j=Y({name:`RangeOp`,pattern:/:/}),M=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),N=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),P=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),F=Y({name:`OpenParen`,pattern:/\(/}),I=Y({name:`CloseParen`,pattern:/\)/}),L=Y({name:`OpenCurlyParen`,pattern:/{/}),R=Y({name:`CloseCurlyParen`,pattern:/}/}),z=Y({name:`QuoteS`,pattern:/'/}),oe=Y({name:`MulOp`,pattern:/\*(?!\*)/}),B=Y({name:`PlusOp`,pattern:/\+/}),se=Y({name:`DivOp`,pattern:/\//}),ce=Y({name:`MinOp`,pattern:/-/}),V=Y({name:`ImplicitIntersectOp`,pattern:/@/}),le=Y({name:`ConcatOp`,pattern:/&/}),ue=Y({name:`ExOp`,pattern:/\^/}),de=Y({name:`PercentOp`,pattern:/%/}),fe=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[g,_]}),pe=Y({name:`GtOp`,pattern:/>/}),H=Y({name:`EqOp`,pattern:/=/}),me=Y({name:`LtOp`,pattern:/</}),U=[l,u,y,v,ee,d,f,p,g,_,O,...o===i?[]:[k],A,M,N,P,j,te,ae,S,C,re,ie,E,fe,V,x,F,I,L,R,z,oe,B,se,ce,le,ue,de,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),pe,H,me];this._lexer=new J(U,{ensureOptimizations:!0});let W={};U.forEach(e=>{W[e.name]=e}),o===i&&(W.ColSeparator=O),this._vocabulary=W}tokenize(t,n=!0){let r=this._lexer.tokenize(t);if(n&&r.errors.length>0){let n=r.errors[0],i=n.line,a=n.column,o=t.substr(n.offset,n.length||1),s=o?`Unexpected character '${o}'`:n.message;throw new e.Parse(s,{line:i,column:a,offset:n.offset,length:n.length})}return r}getVocabulary(){return this._vocabulary}getLocale(){return this._locale}getMaxColumn(){return this._maxColumn}getMaxRow(){return this._maxRow}getSeparators(){return this._locale.separators}},Un=(()=>{let e=[];for(let t=65;t<=90;t++)e.push(t);for(let t=97;t<=122;t++)e.push(t);for(let t=48;t<=57;t++)e.push(t);return e})().filter(e=>e<48||e>57),Wn=(()=>{let e=[...Un,95,92];for(let t=127;t<=65535;t++)e.push(t);return e})(),Gn=new WeakMap,Kn=16384,qn=1048576;function Jn(e,t,n){let r=0;for(let i=t;i<n;i++){let t=e.charCodeAt(i);r=26*r+(t>=97?t-96:t-64)}return r}function Yn(e){return(t,n)=>{let r=n;t.charCodeAt(r)===36&&r++;let i=r;for(;r<t.length&&r-i<3;){let e=t.charCodeAt(r);if(!(e>=65&&e<=90||e>=97&&e<=122))break;r++}if(r-i===0||Jn(t,i,r)>e)return null;if(r<t.length){let e=t.charCodeAt(r);if(e>=48&&e<=57)return null}return[t.substring(n,r)]}}function Xn(e,t){return(n,r)=>{let i=r;n.charCodeAt(i)===36&&i++;let a=i;for(;i<n.length&&i-a<3;){let e=n.charCodeAt(i);if(!(e>=65&&e<=90||e>=97&&e<=122))break;i++}if(i-a===0||Jn(n,a,i)>e)return null;i<n.length&&n.charCodeAt(i)===36&&i++;let o=i;for(;i<n.length;){let e=n.charCodeAt(i);if(!(e>=48&&e<=57))break;i++}if(i===o)return null;let s=parseInt(n.substring(o,i),10);return s<1||s>t?null:[n.substring(r,i)]}}function Zn(e){return new RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}var Qn=class{constructor(e=T){let t=function(e){let t=[...m];if(e)for(let n of Object.values(e)){let e=n?.trim();e&&!t.some(t=>t.toLowerCase()===e.toLowerCase())&&t.push(e)}return t.sort((e,t)=>t.length-e.length),t.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)}(e.specifiers),n=Y({name:`WhiteSpace`,pattern:/\s+/,group:J.SKIPPED}),r=Y({name:`TableSpecifier`,pattern:RegExp(`\\[#(?:${t})\\]`,`i`)}),i=[n,r,Y({name:`BracketedColumn`,pattern:/\[(?:'['#[\]]|'(?!['#[\]])|[^'[\]])*\]/,longer_alt:[r]}),Y({name:`BareSpecifier`,pattern:RegExp(`#(?:${t})`,`i`)}),Y({name:`ColumnSep`,pattern:/:/}),Y({name:`ListSep`,pattern:new RegExp(e.separators.separatorFunction.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))})];this._lexer=new J(i,{ensureOptimizations:!0});let a={};i.forEach(e=>{a[e.name]=e}),this._vocabulary=a}getVocabulary(){return this._vocabulary}tokenize(e){return this._lexer.tokenize(e)}},$n=class extends Vn{constructor(e=T){let t=new Qn(e),n=t.getVocabulary();super(n,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:r,BracketedColumn:i,BareSpecifier:a,ColumnSep:s,ListSep:l}=n,u=this;u.RULE(`ruleContent`,()=>{let e=[],t=u.SUBRULE(u.ruleItem);return u.ACTION(()=>{t&&e.push(t)}),u.MANY(()=>{u.CONSUME(l),u.OPTION(()=>{let t=u.SUBRULE2(u.ruleItem);u.ACTION(()=>{t&&e.push(t)})})}),e}),u.RULE(`ruleItem`,()=>u.OR([{ALT:()=>u.SUBRULE(u.ruleSpecifier)},{ALT:()=>u.SUBRULE(u.ruleColumnOrRange)}])),u.RULE(`ruleSpecifier`,()=>u.OR([{ALT:()=>{let t=u.CONSUME(r);return u.ACTION(()=>{let n=c(t.image,e);return n.image=t.image,n})}},{ALT:()=>{let t=u.CONSUME(a);return u.ACTION(()=>{let n=c(t.image,e);return n.image=t.image,n})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(i),t,n;return u.OPTION(()=>{t=u.CONSUME(s),n=u.CONSUME2(i)}),u.ACTION(()=>{let r=o(e.image);if(r.image=e.image,!n)return r;let i=o(n.image);i.image=n.image;let a=C(`:`,r,i,!0);return a.image=t?.image??`:`,a})}),u.performSelfAnalysis()}_parseInner(e){let t=this._lexer.tokenize(e);return t.errors.length>0||t.tokens.length===0?[]:(this.input=t.tokens,this.reset(),this.ruleContent()??[])}_parseContent(e){if(!e)return[];let t=e.trim();if(!t)return[];let n=t[0];if(n===`@`){let e=t.slice(1).trim();if(!e){let e=g(`@`,null,!0);return e.image=`@`,[e]}if(e.charAt(0)===`[`){let t=this._parseInner(e);if(t.length===1&&t[0].type===`infix`){let e=g(`@`,t[0],!0);return e.image=`@`,[e]}}let n=o(e);n.image=e;let r=g(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=o(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,r){this.reset();let i=()=>({root:n(``,[]),errors:[]});if(!r)return i();let a=0;if(r.charAt(0)===`[`){let e=r.indexOf(`]`);e!==-1&&r.charAt(e+1)===`!`&&(a=e+2)}let o=r.indexOf(`[`,a);if(o===-1)return i();let s=r.slice(0,o),c=r.slice(o+1,-1),l=this._parseContent(c);return{root:n(s,l),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===v.Cell){let t=e.value;return t.rowIndex===-(2**53-1)?`col`:t.colIndex===-(2**53-1)?`row`:null}return Number.isInteger(e.value)?`row`:null},rr=(e,t)=>{let n=parseInt(e.charCodeAt(0)===36?e.substring(1):e,10);return n>=1&&n<=t},ir=`A formula must not be empty`,ar=(e,t)=>`A formula must not be longer than ${t} characters (this one is ${e})`;function or(e,t){let n=e?.[0]?.image;if(!n){let e=t?.image;return e?`Expected a value after '${e}'`:`Expected a value`}return`Unexpected '${n}'`}var sr={...yt,buildNoViableAltMessage:e=>or(e.actual,e.previous),buildEarlyExitMessage:e=>or(e.actual,e.previous),buildNotAllInputParsedMessage:e=>{let t=e.firstRedundant?.image;return t?`Unexpected '${t}'`:yt.buildNotAllInputParsedMessage(e)},buildMismatchTokenMessage:e=>{let t=e.actual?.image;return e.expected===X&&t?`Unexpected '${t}'`:yt.buildMismatchTokenMessage(e)}},cr=class extends Vn{constructor(e){let n=e?.lexer??Hn.shared(e?.lexerOptions),a=n.getVocabulary();super(a,{skipValidations:!0,recoveryEnabled:!0,...e,nodeLocationTracking:`full`,errorMessageProvider:sr,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:e,MinOp:t,MulOp:n,DivOp:i,ExOp:a,ConcatOp:o,GtOp:s,EqOp:c,LtOp:u,NeqOp:d,GteOp:f,LteOp:p}=this._vocab,m=[];return m.push({node:this.SUBRULE(this._rulePostfixOp)}),this.MANY(()=>{let r=this.OR(this._c1||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(i).image},{ALT:()=>this.CONSUME(a).image},{ALT:()=>this.CONSUME(o).image},{ALT:()=>this.CONSUME(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image},{ALT:()=>this.CONSUME(p).image}]),h={value:r,index:this.getLexerPosition(),isRange:l.includes(r)},g=this.SUBRULE2(this._rulePostfixOp);m.push({op:h,node:g})}),this.ACTION(()=>{let e=m.length-1,t=r.length;for(let n=0;e>0&&n<t;n++){let t=r[n],i=1;for(;i<m.length;){let n=m[i].op;if(t.includes(n.value)){let t=m[i-1].node,r=m[i].node,a=C(n.value,t,r,n.isRange);a=this._tag(a,n.index),m[i-1].node=a,m.splice(i,1),e--}else i++}}}),m[0].node}),this._rulePlusMinusOp=this.RULE(`rulePlusMinusOp`,()=>{let{PlusOp:e,MinOp:t}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)}])}),this._rulePostfixOp=this.RULE(`rulePostfixOp`,()=>{let{PercentOp:e}=this._vocab,t=this.SUBRULE(this._rulePrefixOp),n=[];return this.MANY(()=>{let t=this.CONSUME(e).image;this.ACTION(()=>{n.push([t,this.getLexerPosition()])})}),this.ACTION(()=>{let e=n.length;if(e!==0)for(let r=0;r<e;r++){let e=n[r],i=e[0],a=e[1],o=l.includes(i);t=s(i,t,o),t=this._tag(t,a)}}),t}),this._rulePrefixOp=this.RULE(`rulePrefixOp`,()=>{let{PlusOp:e,MinOp:t,ImplicitIntersectOp:n}=this._vocab,r=[];this.MANY(()=>{let i=this.OR([{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image}]);this.ACTION(()=>{r.push([i,this.getLexerPosition()])})});let i=this.SUBRULE(this._ruleRangeOp);return this.ACTION(()=>{let e=r.length;if(e!==0)for(let t=e-1;t>=0;t--){let e=r[t],n=e[0],a=e[1],o=l.includes(n);i=g(n,i,o),i=this._tag(i,a)}}),i}),this._ruleRangeOp=this.RULE(`ruleRangeOp`,()=>{let{RangeOp:e,RangeTrimFullOp:t,RangeTrimLeadingOp:n,RangeTrimTrailingOp:r,ArrayAnchorOp:i}=this._vocab,a=[];return a.push({node:this.SUBRULE(this._ruleCallOp)}),this.MANY2(()=>{this.CONSUME(i),a.push({anchor:this.getLexerPosition()})}),this.MANY(()=>{let o={value:this.OR(this._c2||=[{ALT:()=>this.CONSUME(e).image},{ALT:()=>this.CONSUME(t).image},{ALT:()=>this.CONSUME(n).image},{ALT:()=>this.CONSUME(r).image}]),index:this.getLexerPosition()},s=this.SUBRULE2(this._ruleCallOp);a.push({op:o,node:s}),this.MANY3(()=>{this.CONSUME2(i),a.push({anchor:this.getLexerPosition()})})}),this.ACTION(()=>{for(let e=1;e+1<a.length;e++){let t=a[e],n=a[e+1];if(t.op?.value!==`:`||n.op?.value!==`:`)continue;let r=nr(t.node);r&&nr(n.node)===r&&nr(a[e-1].node)!==r&&(t.node=this._tag(C(`:`,t.node,n.node,!0),n.op.index),a.splice(e+1,1))}for(let e=1;e<a.length;e++){let t=a[e];if(t.anchor!==void 0){a[0].node=this._tag(s(`#`,a[0].node,!0),t.anchor);continue}let n=t.op,r=C(n.value,a[0].node,t.node,!0);r=this._tag(r,n.index),a[0].node=r}}),a[0].node}),this._ruleCallOp=this.RULE(`ruleCallOp`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab,n=this.SUBRULE(this._ruleFormula);return this.MANY({GATE:()=>{let t=this.LA(0),n=this.LA(1);return!(!t||!n||n.tokenType!==e)&&n.startOffset===t.endOffset+1},DEF:()=>{this.CONSUME(e);let r=this.getLexerPosition(),i=this.SUBRULE(this._ruleFunctionArguments),a=n,o=this.ACTION(()=>this._tag(h(a,i),r)),s=this.OPTION(()=>this.CONSUME(t));this.ACTION(()=>{s||this._reportError(o,`Missing closing parenthesis ')'`,r),this._tagClose(o,this.getLexerPosition()),n=o})}}),n}),this._ruleIntersectOp=this.RULE(`ruleIntersectOp`,()=>{let e=[this.SUBRULE(this._ruleInfixOp)];return this.MANY(()=>{this.OPTION({GATE:()=>{let e=this.LA(0);return this.LA(1).startOffset>e.endOffset+1},DEF:()=>{e.push(this.SUBRULE3(this._ruleInfixOp))}})}),this.ACTION(()=>{for(;e.length>1;){let t=e.length-1;for(let n=0;n<t;n++){let r=e[n],i=e[n+1],a=C(` `,r,i,!0),o=this._tokenMap.get(r);o&&delete o.tokenIndexClose;let s=this._tokenMap.get(i),c=s?.tokenIndex;if(c!==void 0){let e=this.input[c],t=this.input[c-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(a.wsBefore=n)}s&&delete s.tokenIndex,n+1<t&&s&&delete s.tokenIndexClose,e.splice(n,2,a),n--,t--}}}),e[0]}),this._ruleFormula=this.RULE(`ruleFormula`,()=>this.OR9([{ALT:()=>this.SUBRULE(this._ruleLiteral)},{ALT:()=>this.SUBRULE(this._ruleReference)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>this.SUBRULE(this._ruleParen)},{ALT:()=>this.SUBRULE(this._ruleTableReference)},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleLiteralArray)}])),this._ruleGroup=this.RULE(`ruleGroup`,()=>{let{ArgSeparator:e}=this._vocab,t=[];return this.MANY(()=>{this.CONSUME(e);let n=this.SUBRULE2(this._ruleIntersectOp);this.ACTION(()=>{t.push(n)})}),t}),this._ruleParen=this.RULE(`ruleParen`,()=>{let{OpenParen:e,CloseParen:t}=this._vocab;return this._processParen(v.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=d();this.CONSUME(e);let a=this.getLexerPosition(),o=this.ACTION(()=>this._tag(b(i),a)),s=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(s)}),this.MANY(()=>{let e=!1;this.OR([{ALT:()=>{this.CONSUME(n),e=!0}},{ALT:()=>this.CONSUME(r)}]);let t=this.SUBRULE2(this._ruleLiteralForArray);this.ACTION(()=>{e||(i=d(),o.value.push(i)),i.value.push(t)})});let c=this.OPTION(()=>this.CONSUME(t));return o=this.ACTION(()=>(c||this._reportError(o,`Missing closing parenthesis '}'`,a),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:n,LiteralError:r,RefError:a}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(u(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?y(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(p(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(t(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(_(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(a);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:n,LiteralError:r,RefError:a}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(u(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(p(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(t(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(_(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(a);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleFunction=this.RULE(`ruleFunction`,()=>{let{FunctionToken:e,OpenParen:t,CloseParen:n}=this._vocab,r=this.CONSUME(e).image,i=this.getLexerPosition();this.CONSUME(t);let a=this.SUBRULE(this._ruleFunctionArguments),o=this.ACTION(()=>this._tag(w(r,a),i)),s=this.OPTION(()=>this.CONSUME(n));return o=this.ACTION(()=>(s||this._reportError(o,`Missing closing parenthesis ')'`,i),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:e,CloseParen:t}=this._vocab,n=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==t,DEF:()=>{let t;this.OPTION2(()=>{t=this.SUBRULE(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(ee(),this.getLexerPosition())),n.push(t),this.MANY(()=>{let t;this.CONSUME(e),this.OPTION3(()=>{t=this.SUBRULE2(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(ee(),this.getLexerPosition())),n.push(t)})}}),n}),this._ruleBracketedString=this.RULE(`ruleBracketedString`,()=>{let{BracketedString:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleTableReference=this.RULE(`ruleTableReference`,()=>{let{TableReference:e}=this._vocab,t=this.CONSUME(e),n=this.getLexerPosition();return this.ACTION(()=>{let e=this._srParser.parse(this.rowIndex,this.colIndex,t.image);for(let t of e.errors)this._astErrors.push(t);return this._tag(e.root,n)})}),this._ruleReference=this.RULE(`ruleReference`,()=>{let{Sheet:e,SheetQuoted:t,DivOp:n,MulOp:r,PlusOp:a,MinOp:o,ArgSeparator:s,Cell:c,NamedToken:l,SingleQuotedString:u,Column:d,AbsRow:p,DigitToken:m,RefError:h}=this._vocab,g,_;this.OPTION2({GATE:()=>{for(let i=1;i<6;i++){let c=this.LA(i);if(c.tokenType===e||c.tokenType===t)return!0;if(c.image===``||c.image===`)`||c.tokenType===n||c.tokenType===r||c.tokenType===a||c.tokenType===o||c.tokenType===s)break}return!1},DEF:()=>{_=this.getLexerPosition()+1,g=this.SUBRULE(this._rulePrefixSheetName)}});let y=this.OR([{ALT:()=>{let e=this.CONSUME(c),t=this.getLexerPosition();return this.ACTION(()=>this._tag(re(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(l)},{ALT:()=>this.CONSUME(u)}]);return this.ACTION(()=>this._tag(ie(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(d);return this.ACTION(()=>this._tag(f(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(p);return this.ACTION(()=>this._tag(x(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(m);return this.ACTION(()=>this._tag(x(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(g&&y){if(g.name===``)return void this._reportError(y,`'${g.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=y;if(y.type===v.Postfix&&y.inputs?.[0]&&(e=y.inputs[0]),e.type===v.Cell||e.type===v.Named||e.type===v.Row||e.type===v.TableColumn||e.type===v.Error){e.value.scope=g.name,e.value.scopeImage=g.image;let t=this._tokenMap.get(e);t&&_!==void 0&&(t.tokenIndex=_)}}}),y}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:v.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=n,this._locale=n.getLocale(),this._vocab=a,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(t,n,r){let i=this._lexer.tokenize(r),a;if(!i)return{root:{type:v.Unparsed,value:r},errors:[]};let o=i.tokens;if(o.length===0)throw new e.Parse(ir);return this.input=o,this._inputText=r,this._inputTextLength=r.length,this.rowIndex=t,this.colIndex=n,this._astErrors=[],this._tokenMap=new Map,this.reset(),a=this._ruleRoot(),a&&this._bindAllWhitespace(a),a=te(a,(e,n)=>{let r=e.type,i=n?.isReference?n.value:void 0,a=typeof i==`string`&&er.has(i),o=typeof i==`string`&&tr.has(i),s=a?n.inputs:void 0,c=s?s[0]===e?s[1]:s[0]:void 0,l=this._lexer.getMaxRow();if(a&&r!==v.Cell&&Number.isInteger(e.value)){let n=x(e.image,t);return S(n,e),nr(c)===`row`?rr(e.image,l)||this._reportError(n,`'${e.image}' is not a valid row — rows run from 1 to ${l}`):this._reportError(n,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),n}if(o&&r===v.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${i}' needs a cell or range on both sides`),e;if(r===v.Cell){let t=e.value,n=t.colIndex===-(2**53-1),r=t.rowIndex===-(2**53-1);if((n||r)&&nr(c)===(n?`row`:`col`))return n&&!rr(e.image,l)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${l}`),e;if(n||r||t.colIndex>=16384){let a=ie(e.image);S(a,e);let s=t.scope;return s&&(a.value.scope=s,a.value.scopeImage=t.scopeImage),n?this._reportError(a,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):r&&e.image.includes(`$`)?this._reportError(a,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):o&&this._reportError(a,`'${e.image}' is a name — '${i}' needs a cell or range on both sides`),a}}return e}),{root:a,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===v.Array&&Array.isArray(e.value)){for(let t of e.value)if(t&&Array.isArray(t.value))for(let e of t.value)e&&this._bindAllWhitespace(e)}}}};export{ir as i,ar as n,cr as r,Hn as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./CCYEWK5QyGSnUAfh.js","./DqOrgSpuJhQRhMoG.js","./HclGiUj8dZXDFmoM.js","./D4RZZdlItfrgQHcE.js","./3Ls_kOvlQseMV8Q0.js","./BQTLEc84Eql61S2m.js","./COL9dj40ytErlGak.js","./nHThFXCAZFOM_npq.js","./CQukCzhuewMuFOlO.js","./CKdQfdZJGJFgnrr9.js","./BQnELVV0uR4T4ItQ.js","./CnXLpFE_vFrJ5Jbf.js","./Np3jWxG724t5hLHZ.js","./Cenh1POxiGMxIQlv.js","./-i_fTASJeu9NdNH_.js","./CFS0h-wE9YlZRk_1.js","./9w0ECZmzGUyk3F_O.js","./KoxRo2J_cwB_yOd5.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./HclGiUj8dZXDFmoM.js";import{B as t}from"./D4RZZdlItfrgQHcE.js";import{n}from"./D98PlIA4qQ_6ciCu.js";import{r}from"./9w0ECZmzGUyk3F_O.js";var i=r({MAX_WORKBOOK_NAME_SIZE:()=>96,isReservedFileNameChar:()=>s,isValidFileName:()=>c}),a=/^(con|prn|aux|nul|com\d|lpt\d)$/i,o=/[<>:"/\\|?*\u0000-\u001F]/,s=e=>o.test(e),c=e=>!(!e||e.length>255)&&!o.test(e)&&!a.test(e)&&e!==`.`&&e!==`..`,l=t(`io:sxlReader`,()=>e(()=>import(`./CCYEWK5QyGSnUAfh.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]),import.meta.url)),u=t(`io:sxlWriter`,()=>e(()=>import(`./-i_fTASJeu9NdNH_.js`),__vite__mapDeps([14,13]),import.meta.url)),d=async(e,t)=>(await l.load()).readSXL(e,t),f=e=>async(t,n)=>(await u.load()).writeSXL(t,{...n,compress:n?.compress??e.compress,whiteSpace:n?.whiteSpace??e.whiteSpace}),p={key:`SheetXL`,description:`SheetXL Workbook`,mimeType:`application/vnd.sheetxl.sheet`,exts:[`sxl`],handler:d},m={key:`JSON`,description:`SheetXL Workbook (JSON)`,mimeType:`application/json`,exts:[`json`],handler:d},h={key:`SheetXL`,mimeType:`application/vnd.sheetxl.sheet`,description:`SheetXL Workbook`,exts:[`sxl`],handler:f({compress:!0,whiteSpace:0})},g={key:`JSON`,mimeType:`application/json`,description:`SheetXL Workbook (JSON)`,exts:[`json`],advanced:!0,handler:f({compress:!1,whiteSpace:2})},_={name:`SXLPlugin`,version:`0.8.0-beta.25`,description:`Import and export SXL format`,author:`SheetXL`,async register(e){await e.registerReadFormat(p),await e.registerReadFormat(m),await e.registerWriteFormat(h),await e.registerWriteFormat(g)}},v=t(`io:csvReader`,()=>e(()=>import(`./CFS0h-wE9YlZRk_1.js`),__vite__mapDeps([15,2,8,1,3,4,5,6,7,9,10,11,12,16]),import.meta.url)),y=t(`io:csvWriter`,()=>e(()=>import(`./KoxRo2J_cwB_yOd5.js`),__vite__mapDeps([17,2,16]),import.meta.url)),b={key:`CSV`,description:`Comma Separated Values`,mimeType:`text/csv`,exts:[`csv`],handler:async(e,t)=>(await v.load()).readCSV(e,t)},x={key:`CSV`,mimeType:`text/csv`,description:`Comma Separated Values`,exts:[`csv`],handler:async(e,t)=>(await y.load()).writeCSV(e,t)},S={name:`CSVPlugin`,version:`0.8.0-beta.25`,description:`Import and export CSV format`,author:`SheetXL`,async register(e){await e.registerReadFormat(b),await e.registerWriteFormat(x)}},C={name:`@sheetxl/io`,version:`0.8.0-beta.25`,description:`Built-in I/O formats for SheetXL`,author:`SheetXL`,async register(e){await _.register(e),await S.register(e),await n.register(e)}};export{S as CSVPlugin,C as IOPlugin,i as IOUtils,_ as SXLPlugin};
@@ -1 +0,0 @@
1
- export{t as PictureEditor}from"./hB5riGkPy0wXVIig.js";
@@ -1 +0,0 @@
1
- export{r as t}from"./BpJaTpbR_CQzXj9M.js";
@@ -1 +0,0 @@
1
- import{I as e}from"./D4RZZdlItfrgQHcE.js";import{G as t,I as n,Pt as r,Q as i,Tt as a,b as o,vt as s}from"./COL9dj40ytErlGak.js";import{c,i as l}from"./CQukCzhuewMuFOlO.js";import{Pn as u,T as d,f,oa as p,ut as m}from"./CKdQfdZJGJFgnrr9.js";import{$n as h,An as g,At as ee,Bt as te,D as _,Er as ne,Fn as v,Ft as re,Hr as ie,Nr as ae,Pr as oe,Pt as y,Q as b,Qn as x,R as se,S as ce,Un as le,Vr as S,Xn as C,Zt as w,_ as ue,_r as de,ar as T,at as E,b as D,c as fe,en as pe,ft as O,ht as me,j as k,k as he,mn as ge,on as A,or as _e,q as j,qt as M,rt as N,tn as P,wn as F,wr as I,zr as L}from"./BH2IWQ-8AfNbhYZJ.js";import{a as ve,c as ye,o as be,s as R,t as xe}from"./DkTX5ZjGNQ5SrwJa.js";import"./B6UwT0pG4sQeG7fA.js";var Se=class{constructor(e){this.list=e}get length(){return this.list.length}item(e){return this.list[e]}forEach(e,t){let n=this.list,r=n.length;for(let t=0;t<r;t++)e(n[t],t,this)}entries(){return this.list.entries()}keys(){return this.list.keys()}values(){return this.list.values()}[Symbol.iterator](){return this.list.values()}},Ce=e=>!0===e||e===`1`||e===`on`||e===`true`||!1!==e&&e!==`0`&&e!==`off`&&e!==`false`&&null,we=e=>{let t=parseInt(e);return isNaN(t)?null:t},Te=e=>{let t=parseFloat(e);return isNaN(t)?null:t},Ee=new Map,z=class{constructor(t,n,r,i,a,o=null,s=e.EmptyObject){this._fileLocation=``;let c=(e,t,n)=>s?.getRef?.(e,t,n,s?.parsedRefs),l=e=>s?.getRefs?.(e,s?.parsedRefs);this._parent=t,this.sharedShared=n,this.currentPath=r,this.elemRoot=i,this.jsonRoot=a,t?(this._fileLocation=t._fileLocation,this._getRef=t._getRef,this._getRefs=t._getRefs,this._serializeElement=t._serializeElement,this._readEmbeddedPart=t._readEmbeddedPart):(o&&(this._fileLocation=o),s?.getRef&&(this._getRef=c),s?.getRefs&&(this._getRefs=l),this._onWarning=s?.onWarning,this._addPerson=s?.addPerson,this._serializeElement=s?.serializeElement,this._readEmbeddedPart=s?.readEmbeddedPart)}getRef(e,t=!1){return this._getRef?.(e,this._fileLocation,t)??null}readEmbeddedPart(e){return this._readEmbeddedPart?.(e,this._fileLocation)??null}getRelationships(){return this._getRefs?.(this._fileLocation)??Ee}getPath(){return this.currentPath}getFileLocation(){return this._fileLocation}getElemRoot(){return this.elemRoot}getJsonRoot(){return this.jsonRoot}warn(e,t){this._raiseWarning(e,this.getFileLocation(),t?.onceKey)}_raiseWarning(e,t,n){this._onWarning?this._onWarning(e,t,n):this._parent?this._parent._raiseWarning(e,t,n):console.warn(e)}serializeElement(e){return this._serializeElement?.(e)??null}addPerson(e){return typeof e==`string`&&(e={displayName:e}),this._addPerson?this._addPerson(e):this._parent?this._parent?._addPerson?.(e)??null:null}getVisitorParamsState(){return this.sharedShared.getVisitorParamsState()}evaluate(e,t){if(!e)return t;let n=[t],r=e.split(`/`),i=r.length;for(let e=0;e<i;e++){let t=r[e];if(t===``||t===`.`)continue;let a=[],o=(t===`*`||t===`**`)&&e!==i-1;for(let i of n)if(i){if(o){let t=r[e+1];t&&t!==``&&t!==`.`&&(this._findDescendants(i,t,a),e++)}else if(t===`*`||t===`**`){if(!i.childNodes)continue;let e=i.childNodes,t=e.length;for(let n=0;n<t;n++){let t=e[n];t.nodeType===1&&a.push(t)}}else{if(!i.childNodes)continue;let e=i.childNodes,n=e.length;for(let r=0;r<n;r++){let n=e[r];if(n.nodeType!==1)continue;let i=n;this._matchesElementName(i,t)&&a.push(i)}}}if(n=a,n.length===0)return null}return n.length===1?n[0]:n.length===0?null:new Se(n)}_matchesElementName(e,t){return t.includes(`:`)?(e.tagName||e.nodeName)===t:e.localName===t}_findDescendants(e,t,n){if(!e||!e.childNodes)return;let r=e.childNodes,i=r.length;for(let e=0;e<i;e++){let i=r[e];if(i.nodeType!==1)continue;let a=i;this._matchesElementName(a,t)&&n.push(a),this._findDescendants(a,t,n)}}getFromPath(t,n){return e.getFromPath(t,n)}setToPath(t,n,r){return e.setToPath(t,n,r)}getValAttrAsString(e,t){let n=this.evaluate(e,t);return n&&n.hasAttribute(`val`)?n.getAttribute(`val`)??null:null}getValAttrAsBoolean(e,t,n=!1){let r=this.evaluate(e,t);if(!r)return null;let i=r.hasAttribute(`val`)?r.getAttribute(`val`):void 0;return i==null?n:i===`1`||i===`on`||i===`true`||i!==`0`&&i!==`off`&&i!==`false`&&n}getValAttrAsInteger(e,t){let n=this.evaluate(e,t);return n&&n.hasAttribute(`val`)?parseInt(n.getAttribute(`val`))??null:null}getValAttrAsFloat(e,t){let n=this.evaluate(e,t);return n&&n.hasAttribute(`val`)?parseFloat(n.getAttribute(`val`))??null:null}get BOOLEAN_COPY(){return Ce}get INT_COPY(){return we}get FLOAT_COPY(){return Te}copyFromAttribute(e,t,n,r=t,i=null){if(!e||!n||!e.hasAttribute(t))return;let a=e.getAttribute(t);if(i){if(Array.isArray(i)){let e=i.length;for(let t=0;t<e;t++)if(a==null||(a=i[t](a),a==null))return}else if(a==null||(a=i(a),a==null))return}this.setToPath(n,r,a)}},B=(e,t)=>{let n=[],r=e.childNodes,i=r.length;for(let e=0;e<i;e++){let i=r.item(e);i.nodeType===1&&i.localName===t&&n.push(i)}return n},De=[[`fillRef`,`fill`],[`lnRef`,`stroke`],[`effectRef`,`effect`]],V=(e,t)=>{let n=new O,r={};for(let[i,a]of De){let o=e.evaluate(i,t);if(!o)continue;let s={index:parseInt(o.getAttribute(`idx`)??`0`,10)||0},c=n.processAdjColor(e,o);c&&(s.color=c),r[a]=s}let i=e.evaluate(`fontRef`,t);if(i){let t={index:i.getAttribute(`idx`)??`none`},a=n.processAdjColor(e,i);a&&(t.color=a),r.font=t}return r},H=class{visit(e,t,n){if(!t)return;let r=e.evaluate(`*/cNvPr`,t);return r.item&&(r=r.item(0)),r&&(e.copyFromAttribute(r,`name`,n),e.copyFromAttribute(r,`descr`,n,`description`),e.copyFromAttribute(r,`hidden`,n,`hidden`,e.BOOLEAN_COPY),this.readNonVisualDetails(e,r,n),e.copyFromAttribute(r,`id`,n)),n}readNonVisualDetails(e,t,n){t.hasAttribute(`title`)&&(n.title=t.getAttribute(`title`));let r=e.evaluate(`hlinkClick`,t);r&&(n.hyperlink=j(e,r));let i=e.evaluate(`hlinkHover`,t);i&&(n.hoverHyperlink=j(e,i));let a=e.evaluate(`extLst`,t),o=a?e.serializeElement(a):null;o&&(n.extLst={...n.extLst,nonVisual:o})}setContent(e,t){let n=e;n.name!==void 0&&(t.name=n.name,delete n.name),n.description!==void 0&&(t.description=n.description,delete n.description);for(let e of[`title`,`hyperlink`,`hoverHyperlink`,`extLst`])n[e]!==void 0&&(t.json&&(t.json[e]=n[e]),delete n[e]);e.content=t}isGroupContent(e){return Array.isArray(e?.members)}readMemberHeader(e,t,n){let r={},i={anchor:void 0,content:{type:n,json:r}},a=e.evaluate(`*/cNvPr`,t);if(a?.item&&(a=a.item(0)),a){let n=a.getAttribute(`name`);n!==null&&(i.content.name=n);let o=a.getAttribute(`descr`);o&&(i.content.description=o),e.copyFromAttribute(a,`hidden`,i,`hidden`,e.BOOLEAN_COPY),this.readNonVisualDetails(e,a,r);let s=this.readSourceId(e,t);s!==void 0&&(r.sourceId=s)}return{movable:i,content:r}}readStyleRefs(e,n,r){let i=e.evaluate(`style`,n);if(!i)return void(r.style=null);let a=V(e,i),o=t.withoutDefaultStyleRefs({...r,style:a});o&&(r.style=o)}readLocks(e){let t=e?.attributes;if(!t||t.length===0)return;let n={};for(let e=0;e<t.length;e++){let r=t.item(e);r.name.startsWith(`xmlns`)||(n[r.localName??r.name]=A(r.value))}return Object.keys(n).length>0?n:void 0}readSourceId(e,t){let n=e.evaluate(`*/cNvPr`,t);n?.item&&(n=n.item(0));let r=n?.getAttribute?.(`id`),i=r?parseInt(r,10):void 0;return i===void 0||isNaN(i)?void 0:i}},Oe=[[`spDef`,`shape`],[`lnDef`,`line`],[`txDef`,`text`]],U=(e,t)=>{let n=t.getAttribute(`dxfId`);if(n===null)return;let r=parseInt(n);return e.getVisitorParamsState().get(`dxfs`)?.get(r)||(e.warn(`A color filter or sort names a format that does not exist (dxfId '${n}').`),{})},W=e=>e===`1`||e===`true`,G=class{visit(e,t,n){}processDataBarColor(e,t,n,r,i=`auto`){if(!t)return;let a=_(e=>t.getAttribute(e),i);return a&&(n[r]=a),n}processFonts(e,t,n){if(!t)return;let r=t.childNodes,i=0,a=r.length;for(let t=0;t<a;t++){let a=r.item(t);if(a.nodeType===1&&a.localName===`font`){let t={};this.processFont(e,a,t),n[i++]=t}}return n}processFont(e,t,r){e.getValAttrAsBoolean(`b`,t,!0)&&(r.weight=700),e.getValAttrAsBoolean(`i`,t,!0)&&(r.style=n.Style.Italic),e.getValAttrAsBoolean(`strike`,t,!0)&&(r.strike=k(!0));let i=e.evaluate(`u`,t);if(i){let e=i.getAttribute(`val`);r.underline=S(e)}let a=E(e.evaluate(`vertAlign`,t)?.getAttribute(`val`));a!==void 0&&(r.baseline=a),oe(e,t,r,`sz`,`size`);let o=e.evaluate(`color`,t);this.processDataBarColor(e,o,r,`color`),r.color||=`auto`,I(e,t,r,`name`,`family`),I(e,t,r,`rFont`,`family`);let s=e.evaluate(`family`,t);if(s){let e=s.getAttribute(`val`);if(e)switch(e){case`1`:r.fallbacks=[`serif`];break;case`2`:r.fallbacks=[`sans-serif`];break;case`3`:r.fallbacks=[`monospace`];break;case`4`:r.fallbacks=[`cursive`];break;case`5`:r.fallbacks=[`fantasy`]}}v(r,e.evaluate(`scheme`,t)?.getAttribute(`val`)),L(e,t,r,`shadow`,`shadow`,!0),L(e,t,r,`outline`,`outline`,!0);for(let n of[`condense`,`extend`]){let i=b(n,!!e.getValAttrAsBoolean(n,t,!0));i!==void 0&&(r.letterSpacing=i)}return P(e,t,r,`charset`,`charset`),r}processFills(e,t,n){if(!t)return;let r=t.childNodes,i=0,a=r.length;for(let t=0;t<a;t++){let a=r.item(t);a.nodeType===1&&a.localName===`fill`&&this.processFill(e,a,n,i++)}return n}processFill(e,t,n,r){let a={type:i.Type.None},o=t.childNodes,s=!1,c=o.length;for(let t=0;!s&&t<c;t++){let n=o.item(t);n.nodeType===1&&(n.localName===`gradientFill`?(this.processGradientFill(e,n,a),s=!0):n.localName===`patternFill`&&(this.processPatternFill(e,n,a),s=!0))}return n[r]=a,n}processGradientFill(e,t,n){if(!t)return;n.type=i.Type.Gradient;let r=[];n.stops=r;let a=t.getAttribute(`type`);a&&(n.gradientType=a);let o=t.hasAttribute(`degree`)?parseFloat(t.getAttribute(`degree`)):0;(o+90)%360!=0&&(n.angle=(o+90)%360),(t.hasAttribute(`left`)||t.hasAttribute(`top`)||t.hasAttribute(`right`)||t.hasAttribute(`bottom`))&&(n.focus={left:K(t.getAttribute(`left`)),top:K(t.getAttribute(`top`)),right:K(t.getAttribute(`right`)),bottom:K(t.getAttribute(`bottom`))});let s=t.childNodes,c=s.length;for(let t=0;t<c;t++){let n=s.item(t);if(n.nodeType===1&&n.localName===`stop`){let t={};r.push(t),t.offset=parseFloat(n.getAttribute(`position`)??``);let i=e.evaluate(`color`,n);this.processDataBarColor(e,i,t,`color`)}}return n}processPatternFill(e,t,n){if(!t)return;let r=e.getVisitorParamsState().get(`processingDXFs`),a=t.getAttribute(`patternType`)||(r?i.BuiltInSheetPattern.Solid:i.BuiltInSheetPattern.None);if(a===i.BuiltInSheetPattern.None)return{none:!0};n.type=i.Type.Pattern,a&&(n.patternType=a);let o=`foreground`,s=`background`,c=n.patternType===i.BuiltInSheetPattern.Solid&&r;if(c){let e=o;o=s,s=e}let l=e.evaluate(`fgColor`,t);this.processDataBarColor(e,l,n,o,`dk1`);let u=e.evaluate(`bgColor`,t);return this.processDataBarColor(e,u,n,s,`lt1`),c&&(n.foreground||=`lt1`,n.background||=`dk1`),n}processBorders(e,t,n,r){if(!t)return;let i=t.childNodes,a=0,o=i.length;for(let t=0;t<o;t++){let o=i.item(t);o.nodeType===1&&o.localName===`border`&&this.processBorder(e,o,n,a++,r)}return n}processBorder(e,t,n,i,a){if(!t)return;let o={};this.processBorderStroke(e,t,o,r.Edge.Left),this.processBorderStroke(e,t,o,r.Edge.Right),a?(o.right||o.left)&&(o.vertical=o.right?{...o.right}:{...o.left}):this.processBorderStroke(e,t,o,r.Edge.Vertical),this.processBorderStroke(e,t,o,r.Edge.Top),this.processBorderStroke(e,t,o,r.Edge.Bottom),a?(o.bottom||o.top)&&(o.horizontal=o.bottom?{...o.bottom}:{...o.top}):this.processBorderStroke(e,t,o,r.Edge.Horizontal);let s=this.processBorderStroke(e,t,{},`diagonal`);return s&&(W(t.getAttribute(`diagonalUp`))&&(o.diagonalUp={...s}),W(t.getAttribute(`diagonalDown`))&&(o.diagonalDown={...s})),n[i]=o,n}processBorderStroke(e,t,n,i){if(!t)return;let a=e.evaluate(i,t);if(!a)return;let o={};a.hasAttribute(`style`)?o.style=a.getAttribute(`style`):e.getVisitorParamsState().get(`processingDXFs`)&&(o.style=r.StrokeStyle.None);let s=e.evaluate(`color`,a);return s&&this.processDataBarColor(e,s,o,`color`),Object.keys(o).length>0?n[i]=o:null}},K=e=>{if(!e)return 0;let t=parseFloat(e);return isNaN(t)?0:t},q=(e,t)=>{if(!e||e.nodeType!==1)return null;let n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType===1&&r.localName===t)return r}return null},ke=new Set(Object.values(d.ElementType).filter(e=>e!==d.ElementType.WholeTable&&e!==d.ElementType.HeaderRow)),Ae={auto:`auto`,autoNoTable:`automaticExceptTables`,manual:`manual`},J=[`tableId`,`columnId`,`cacheName`,`cachePath`,`sourceName`,`sortOrder`,`customListSort`,`crossFilter`,`pivotTables`,`pivotCacheId`,`pivotBody`,`tabular`,`pivotData`,`showMissing`],je=new Set([`name`,`xr10:uid`,`cache`,`caption`]),Y=(e,t)=>{let n=e.content,r=n?.json;if(r){if(n.type===`shape`||n.type===`picture`){let{rotation:n,flipH:i,flipV:a,bounds:o}=r;delete r.rotation,delete r.flipH,delete r.flipV,delete r.bounds,n!==void 0&&n!==0&&(e.rotation=n),i&&(e.flipH=!0),a&&(e.flipV=!0),t&&o&&(e.anchor={tl:{x:o.x,y:o.y},br:{x:o.width,y:o.height}})}if(n.type===`group`)for(let e of r.members??[])Y(e,!0)}},X=class extends H{visit(e,t,n){if(t)return this.visitShape(e,t,n,`sp`,`nvSpPr/cNvSpPr/spLocks`)}visitShape(e,t,n,r,i){let a=h[r];if(this.isGroupContent(n)){if(e.getPath().includes(`Fallback`))return{};let{movable:s,content:c}=this.readMemberHeader(e,t,`shape`);a!==o.Type.Shape&&(c.type=a),this.readShapeDetails(e,t,r,i,c),this.readStyleRefs(e,t,c);let l=e.evaluate(i,t);l?.hasAttribute?.(`noChangeAspect`)&&(s.lockAspect=l.getAttribute(`noChangeAspect`)===`1`);let u=this.readTwinOf(e,t);return u!==void 0&&Object.assign(c,{twinOf:u}),n.members.push(s),c}if(e.getPath().includes(`Fallback`)&&n.content){let r=n.content.json;if(n.content.type===`shape`&&r&&(r.type??o.Type.Shape)===a){let n=e.evaluate(`txBody`,t),i=n?new x().readTextBody(e,n):null;i&&me(i)!==``&&(r.text=i)}return{}}n=super.visit(e,t,n);let s=e.evaluate(i,t);s?.hasAttribute?.(`noChangeAspect`)&&(n.lockAspect=s.getAttribute(`noChangeAspect`)===`1`);let c=a===o.Type.Shape?{}:{type:a},l=this.readSourceId(e,t);l!==void 0&&(c.sourceId=l),this.readShapeDetails(e,t,r,i,c),this.readStyleRefs(e,t,c);let u=this.readTwinOf(e,t);return u!==void 0&&Object.assign(c,{twinOf:u}),this.setContent(n,{type:`shape`,json:c}),c}readTwinOf(e,t){let n=e.evaluate(`*/cNvPr/extLst/ext/compatExt`,t);n?.item&&(n=n.item(0));let r=/^_x0000_s(\d+)$/.exec(n?.getAttribute?.(`spid`)??``);return r?parseInt(r[1],10):void 0}readShapeDetails(e,t,n,r,i){let a=t.getAttribute(`macro`);a&&(i.macro=a);let o=t.getAttribute(`textlink`);o&&(i.textLink=o),t.hasAttribute(`fLocksText`)&&(i.locksText=A(t.getAttribute(`fLocksText`))),t.hasAttribute(`fPublished`)&&(i.published=A(t.getAttribute(`fPublished`)));let s=r.slice(0,r.lastIndexOf(`/`)),c=e.evaluate(s,t);c?.getAttribute?.(`txBox`)===`1`&&(i.textBox=!0);let l=this.readLocks(e.evaluate(r,t));if(l&&(i.locks=l),n===`cxnSp`&&c){let t=t=>{let n=e.evaluate(t,c);if(n?.getAttribute)return{id:parseInt(n.getAttribute(`id`)??`0`,10)||0,index:parseInt(n.getAttribute(`idx`)??`0`,10)||0}},n=t(`stCxn`),r=t(`endCxn`);(n||r)&&(i.connectorEnds={},n&&(i.connectorEnds.start=n),r&&(i.connectorEnds.end=r))}}},Me=/^<a:extLst(?:\s+xmlns:a="[^"]*")?><a:ext uri="\{28A0092B-C50C-407E-A947-70E740481C1C\}"><a14:useLocalDpi(?:\s+xmlns:a14="[^"]*")?\s+val="0"\s*\/><\/a:ext><\/a:extLst>$/,Z=(e,t,n,r)=>{let i=e.evaluate(n,t),a=e.evaluate(r,t);return i||a?{x:w(i?.getAttribute(`x`)??null)??0,y:w(i?.getAttribute(`y`)??null)??0,width:w(a?.getAttribute(`cx`)??null)??0,height:w(a?.getAttribute(`cy`)??null)??0}:null},Ne={Checkbox:`checkbox`},Q=e=>{let t=e.getAttribute(`val`);return t!==`0`&&t!==`false`},Pe={1:`serif`,2:`sans-serif`,3:`monospace`,4:`cursive`,5:`fantasy`};function Fe(e){let t={},r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1)switch(i.localName){case`b`:t.weight=Q(i)?700:400;break;case`i`:t.style=Q(i)?n.Style.Italic:n.Style.Normal;break;case`strike`:t.strike=k(Q(i));break;case`outline`:t.outline=Q(i);break;case`shadow`:t.shadow=Q(i);break;case`condense`:case`extend`:{let e=b(i.localName,Q(i));e!==void 0&&(t.letterSpacing=e);break}case`u`:t.underline=S(i.getAttribute(`val`));break;case`vertAlign`:{let e=E(i.getAttribute(`val`));e!==void 0&&(t.baseline=e);break}case`sz`:{let e=parseFloat(i.getAttribute(`val`)??``);isNaN(e)||(t.size=e);break}case`rFont`:{let e=i.getAttribute(`val`);e&&(t.family=e);break}case`family`:{let e=Pe[i.getAttribute(`val`)??``];e&&(t.fallbacks=[e]);break}case`charset`:{let e=parseInt(i.getAttribute(`val`)??``,10);isNaN(e)||(t.charset=e);break}case`scheme`:v(t,i.getAttribute(`val`));break;case`color`:{let e=i.getAttribute(`rgb`);if(e&&!i.hasAttribute(`theme`)){t.color=`#`+(e.length===8?e.substring(2):e).toUpperCase();break}let n=_(e=>i.getAttribute(e));n&&(t.color=n);break}}}return Object.keys(t).length>0?t:null}var $={RelsVisitor:class{visit(e,t,n){if(!t)return;let r=t.childNodes,i=r.length;for(let t=0;t<i;t++){let i=r.item(t);i.nodeType===1&&i.localName===`Relationship`&&this.processRelationship(e,i,n)}return n}processRelationship(e,t,n){let r={};e.copyFromAttribute(t,`Target`,r,`target`),e.copyFromAttribute(t,`Type`,r,`type`),e.copyFromAttribute(t,`TargetMode`,r,`targetMode`),n[t.getAttribute(`Id`)]=r}},CorePropertiesVisitor:class{visit(e,t,n){let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType!==1)continue;let a=this.processProperty(e,n);a&&r.push(a)}return r.length>0&&(n.properties=r),r}processProperty(e,t){if(t)return t.getAttribute(`xsi:type`),{key:t.localName,value:t.textContent||``}}},AppPropertiesVisitor:class{visit(e,t,n){let r=t.childNodes,i=r.length;for(let e=0;e<i;e++)if(r.item(e).localName===`property`)return this.visitCustom(t,n);let a=[];for(let t=0;t<i;t++){let n=r.item(t);if(n.nodeType!==1)continue;let i=this.processProperty(e,n);i&&a.push(i)}return a.length>0&&(n.properties=a),a}visitCustom(e,t){let n=[],r=e.childNodes,i=r.length;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType!==1||t.localName!==`property`)continue;let i=t.getAttribute(`name`);if(!i)continue;let a=null;for(let e=0;e<t.childNodes.length&&!a;e++){let n=t.childNodes.item(e);n.nodeType===1&&(a=n)}let o={key:i,kind:a?.localName??null,value:a?.textContent??``},s=t.getAttribute(`linkTarget`);s&&(o.linkTarget=s),n.push(o)}return n.length>0&&(t.custom=n),n}processProperty(e,t){if(t)return{key:t.localName,value:t.textContent||``}}},ShapePropertiesVisitor:y,TextPropertiesVisitor:_e,ShapeTextVisitor:x,ThemeVisitor:class{visit(e,t,n){n.name=t.getAttribute(`name`),n.objectDefaults={};let r=B(t,`custClrLst`)[0];if(r){let t=new O,i=[];for(let n of B(r,`custClr`)){let r=t.processAdjColor(e,n);if(!r)continue;let a={color:r},o=n.getAttribute(`name`);o&&(a.name=o),i.push(a)}i.length&&(n.customColors=i)}for(let e of B(t,`extLst`))for(let t of B(e,`ext`)){if(t.getAttribute(`uri`)!==`{05A4C25C-085E-4340-85A3-A5531E510DB2}`)continue;let e=B(t,`themeFamily`)[0],r=e?.getAttribute(`id`);if(!r)continue;let i={name:e.getAttribute(`name`)??``,id:r},a=e.getAttribute(`vid`);a&&(i.vid=a),n.family=i}return n}},ClrSchemeVisitor:class extends O{visit(e,t,n){let r={};r.name=t.getAttribute(`name`);let i=t.childNodes,a=i.length;for(let n=0;n<a;n++){let a=i.item(n);if(a.nodeType===1){let n=a.localName,i=e.evaluate(n,t);r[n]=this.processAdjColor(e,i)}}return Object.keys(r).length>0&&(n.colors=r),r}},FontSchemeVisitor:class{visit(e,t,n){let r={};r.name=t.getAttribute(`name`);let i=this.processFontCollection(e,e.evaluate(`majorFont`,t));i&&(r.major=i);let a=this.processFontCollection(e,e.evaluate(`minorFont`,t));return a&&(r.minor=a),n.fonts=r,r}processFontCollection(e,t){if(!t)return;let n={},r=e.evaluate(`latin`,t),i=r?.getAttribute(`typeface`);i&&(n.latin=i);let a=r?.getAttribute(`panose`);a&&(n.panose=a);let o=e.evaluate(`ea`,t)?.getAttribute(`typeface`);o&&(n.eastAsian=o);let s=e.evaluate(`cs`,t)?.getAttribute(`typeface`),c;s&&(n.complexScript=s);let l=t.childNodes,u=l.length;for(let e=0;e<u;e++){let t=l.item(e);if(t.nodeType!==1||t.localName!==`font`)continue;let n=t.getAttribute(`script`);n&&((c??={})[n]=t.getAttribute(`typeface`)??``)}return c&&(n.scripts=c),n}},ObjectDefaultsVisitor:class{visit(e,t,n){let r={};for(let[n,i]of Oe){let a=e.evaluate(n,t);a&&(r[i]=this.processDefault(e,a))}return n.objectDefaults=r,{}}processDefault(e,t){let n={},r=e.evaluate(`spPr`,t);r&&new y().visit(e,r,n);let i=new x().readTextBody(e,t);(i.body||i.listStyle)&&(n.text=i);let a=e.evaluate(`style`,t);return a&&(n.style=V(e,a)),n}},FmtSchemeVisitor:class extends O{visit(e,t,n){let r=this.parseFillList(e,t,`fillStyleLst`),i=this.parseLnList(e,t,`lnStyleLst`),a=this.parseEffectStyleList(e,t,`effectStyleLst`),o=this.parseFillList(e,t,`bgFillStyleLst`);if(r&&(n.fillStyleLst=r),i&&(n.lnStyleLst=i),a&&(n.effectStyleLst=a),o&&(n.bgFillStyleLst=o),r&&i&&a&&o)return;let s=e.serializeElement(t);s&&(n.formatSchemeXml=s)}parseFillList(e,t,n){let r=e.evaluate(n,t);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);if(n.nodeType!==1)continue;let r=this.parseFillListItem(e,n);if(r===void 0)return;i.push(r)}return i}parseFillListItem(e,t){switch(t.localName){case`noFill`:return{type:i.Type.None};case`solidFill`:{let n=this.processAdjColor(e,t);return n?{type:i.Type.Solid,color:n}:void 0}case`gradFill`:return this.processGradFill(e,t);case`pattFill`:return this.processPatternFill(e,t);default:return}}parseLnList(e,t,n){let r=e.evaluate(n,t);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);n.nodeType===1&&i.push(this.parseLn(e,n))}return i}parseEffectStyleList(e,t,n){let r=e.evaluate(n,t);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);if(n.nodeType!==1)continue;if(e.evaluate(`scene3d`,n)||e.evaluate(`sp3d`,n))return;let r=this.getEffects(e,n);if(r===void 0)return;i.push(r??[])}return i}},AutoFilterVisitor:class{visit(e,t,n){if(!t)return;let r={},i=[];return this.processFilterColumns(e,t,i,n),i.length>0&&(r.conditions=i),Object.keys(r).length>0&&(n.filter=r),n}processColorFilter(e,t){let n={},r={operator:u.BuiltInOperatorNames.Color,param:n};e.copyFromAttribute(t,`cellColor`,n,`cellColor`,e.BOOLEAN_COPY);let i=U(e,t);return i&&(n.style=i),r}processCustomFilter(e,t){return pe({operator:t.getAttribute(`operator`),val:t.getAttribute(`val`)},t=>e.warn(t))}processCustomFilters(e,t){let n=t.getAttribute(`and`),r=n===`and`||n===`1`;t.getAttribute(`val`);let i=[],a={operator:r?u.BuiltInOperatorNames.And:u.BuiltInOperatorNames.Or,param:i},o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let n=o.item(t);if(n.nodeType!==1)continue;let r=null;n.localName===`customFilter`&&(r=this.processCustomFilter(e,n)),r&&i.push(r)}return i.length===1?i[0]:ae(a)}processDynamicFilter(e,t){return ge(t.getAttribute(`type`),t.getAttribute(`val`),t.getAttribute(`maxVal`))}processDateGroupItem(e,t){let n={};return e.copyFromAttribute(t,`dateTimeGrouping`,n,`group`),e.copyFromAttribute(t,`day`,n,`day`,e.INT_COPY),e.copyFromAttribute(t,`hour`,n,`hour`,e.INT_COPY),e.copyFromAttribute(t,`minute`,n,`minute`,e.INT_COPY),e.copyFromAttribute(t,`month`,n,`month`,e.INT_COPY),e.copyFromAttribute(t,`second`,n,`second`,e.INT_COPY),e.copyFromAttribute(t,`year`,n,`year`,e.INT_COPY),n}processFilterItem(e,t){if(t.hasAttribute(`val`))return t.getAttribute(`val`)}processFilters(e,t){let n={},r={operator:u.BuiltInOperatorNames.InSet,param:n};r.selector=u.BuiltInSelectorNames.Display,e.copyFromAttribute(t,`blank`,n,`blank`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`calendarType`,n,`calendarType`);let i=[],a=[],o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let n=o.item(t);if(n.nodeType===1){if(n.localName===`dateGroupItem`){let t=this.processDateGroupItem(e,n);t&&i.push(t)}else if(n.localName===`filter`){let t=this.processFilterItem(e,n);t!==void 0&&a.push(t)}}}return i.length>0&&(n.dateGroups=i),a.length>0&&(n.items=a),r}processIcon(e,t){let n={},r={operator:u.BuiltInOperatorNames.Icon,param:n};return e.copyFromAttribute(t,`iconId`,n,`iconId`,e.INT_COPY),e.copyFromAttribute(t,`iconSet`,n),r}processTop10(e,t){let n={},r={operator:u.BuiltInOperatorNames.TopN,param:n};return e.copyFromAttribute(t,`filterVal`,n,`filterVal`,e.FLOAT_COPY),e.copyFromAttribute(t,`percent`,n,`percent`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`top`,n,`top`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`val`,n,`limit`,e.FLOAT_COPY),r}processFilterColumnExt(e,t){let n=t.childNodes;for(let t=0;t<n.length;t++){let r=n.item(t);if(r.nodeType!==1||r.localName!==`ext`||g(r.getAttribute(`uri`))!==g(`{1AD28BCE-077C-4C59-8B6E-1921CE8616D4}`))continue;let i=r.childNodes;for(let t=0;t<i.length;t++){let n=i.item(t);if(n.nodeType!==1||n.localName!==`filterColumn`)continue;let r=n.childNodes;for(let t=0;t<r.length;t++){let n=r.item(t);if(n.nodeType===1&&n.localName===`filters`)return this.processFilters(e,n)}}}}processFilterCriteria(e,t){if(!t)return;let n=t.childNodes,r,i=n.length;for(let t=0;t<i;t++){let i=n.item(t);i.nodeType===1&&(i.localName===`colorFilter`?r=this.processColorFilter(e,i):i.localName===`customFilters`?r=this.processCustomFilters(e,i):i.localName===`dynamicFilter`?r=this.processDynamicFilter(e,i):i.localName===`filters`?r=this.processFilters(e,i):i.localName===`iconFilter`?r=this.processIcon(e,i):i.localName===`top10`?r=this.processTop10(e,i):i.localName===`extLst`&&(r=this.processFilterColumnExt(e,i)??r))}return r}processFilterColumn(e,t,n){if(!t)return null;if(!t.hasAttribute(`colId`))return;let r=parseInt(t.getAttribute(`colId`)),i=!1;if(t.hasAttribute(`hiddenButton`)&&(i=A(t.getAttribute(`hiddenButton`))),i&&n){let e=n.hiddenButtons;e||(e=[],n.hiddenButtons=e),e.push(r)}let a=!1;if(t.hasAttribute(`showButton`)&&(a=A(t.getAttribute(`showButton`))),a&&n){let e=n.showButtons;!0!==e&&(e||(e=[],n.showButtons=e),e[r]=!0)}let o=this.processFilterCriteria(e,t);return o?(o.index=r,o):null}processFilterColumns(e,t,n,r){if(!t)return;let i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let a=i.item(t);if(a.nodeType===1&&a.localName===`filterColumn`){let t=this.processFilterColumn(e,a,r);t&&n.push(t)}}return n}},SortStateVisitor:class{visit(e,t,n){if(!t)return;let r=t.getAttribute(`ref`),i={};t.hasAttribute(`caseSensitive`)&&(i.collatorOptions=A(t.getAttribute(`caseSensitive`))?f.CaseSensitiveOptions:f.CaseInsensitiveOptions);let a=t.getAttribute(`sortMethod`);a!=null&&a!==`none`&&(a===`stroke`?i.collatorOptions={...i.collatorOptions,collation:`stroke`}:a===`pinYin`&&(i.collatorOptions={...i.collatorOptions,collation:`pinyin`}));let o={};t.hasAttribute(`columnSort`)&&A(t.getAttribute(`columnSort`))&&(o.axis=c.Axis.Column);let s=p.fastStringToRange(r),l=[],u=[];this.processSortConditions(e,t,l,s,i,u),l.length>0&&(o.sorts=l);let d=e.getVisitorParamsState().get(`ref`);if(d&&r){let e=p.fastStringToRange(d);o.extent={range:ee(e,s),sorts:u.map(t=>ue(e,s,t))}}return Object.keys(l).length>0&&(n.sort=o),o}processSortCondition(e,t,n,r,i){if(!t)return null;let a={};if(!t.hasAttribute(`ref`))return void e.warn(`A sort condition has no ref; it was dropped.`,{onceKey:`xlsx.sheet.sort.noRef`});if(t.hasAttribute(`ref`)){let e=t.getAttribute(`ref`),r=p.fastStringToRange(e);a.index=n?r.colStart-n.colStart:r.colStart,i?.push(r)}let o={...r};a.criteria=o,o.reverse=!1,t.hasAttribute(`descending`)&&(o.reverse=A(t.getAttribute(`descending`)));let s=ce(t.getAttribute(`sortBy`));s&&(o.sortOn=s);let c=U(e,t);return c&&(o.style=c),e.copyFromAttribute(t,`iconSet`,o),e.copyFromAttribute(t,`customList`,o),a}processSortConditions(e,t,n,r,i,a){if(!t)return;let o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let s=o.item(t);if(s.nodeType===1&&s.localName===`sortCondition`){let t=this.processSortCondition(e,s,r,i,a);t&&n.push(t)}}}},SheetStyleVisitor:class extends G{visit(e,t,n){this.processNumFmts(e,e.evaluate(`numFmts`,t),null),e.getVisitorParamsState().set(`colorsToProcess`,new Set);let a={fills:{},fonts:{},borders:{}},o=e.evaluate(`fonts`,t);this.processFonts(e,o,a.fonts);let s=a.fonts[this.normalFontId(e,t)],c={declared:[`1`,`true`].includes(o?.getAttribute(`x14ac:knownFonts`)??``),normalIsThemeFont:fe(s?.family),faces:T(Object.values(a.fonts).map(e=>({...e,family:N(e?.family,e?.fallbacks,null,!1).name})))};e.getVisitorParamsState().set(le,c),s&&e.getVisitorParamsState().set(`defaultFont`,s),this.processFills(e,e.evaluate(`fills`,t),a.fills),this.processBorders(e,e.evaluate(`borders`,t),a.borders,!0),a.fills[0]={type:i.Type.None},a.fills[1]={type:i.Type.Pattern,patternType:i.BuiltInSheetPattern.Gray125},a.borders[0]={bottom:{style:r.StrokeStyle.None},left:{style:r.StrokeStyle.None},right:{style:r.StrokeStyle.None},top:{style:r.StrokeStyle.None}};let l=[];this.processXFs(e,e.evaluate(`cellStyleXfs`,t),l,a,null,!1);let u=new Map;if(l.length>0){let r=[];this.processCellStyles(e,e.evaluate(`cellStyles`,t),r,l,u),n.named=r}let d=[];this.processXFs(e,e.evaluate(`cellXfs`,t),d,a,u),Object.keys(d).length>0&&(n.direct=d);let f=this.collectHiddenXfs(e.evaluate(`cellXfs`,t));f.size>0&&e.getVisitorParamsState().set(`hiddenXfs`,f);let p=this.collectPivotButtonXfs(e.evaluate(`cellXfs`,t));p.size>0&&e.getVisitorParamsState().set(`pivotButtonXfs`,p);let m=this.collectXfComplements(e.evaluate(`cellXfs`,t));m.size>0&&e.getVisitorParamsState().set(`xfComplements`,m);let h=[];return this.processDXFs(e,e.evaluate(`dxfs`,t),h),this.processTableStyles(e,e.evaluate(`tableStyles`,t),n,h),this.processSlicerStyles(e,e.evaluate(`extLst`,t),n),this.processIndexColors(e,e.evaluate(`colors/indexedColors`,t),n),this.processMruColors(e,e.evaluate(`colors/mruColors`,t),n),n}normalFontId(e,t){let n=e.evaluate(`cellStyles`,t)?.childNodes,r=0;for(let e=0;e<(n?.length??0);e++){let t=n.item(e);if(t.nodeType===1&&t.getAttribute(`builtinId`)===`0`){r=parseInt(t.getAttribute(`xfId`)??`0`,10)||0;break}}let i=e.evaluate(`cellStyleXfs`,t)?.childNodes,a=0;for(let e=0;e<(i?.length??0);e++){let t=i.item(e);if(t.nodeType===1&&a++===r)return parseInt(t.getAttribute(`fontId`)??`0`,10)||0}return 0}processIndexColors(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`rgbColor`){let t={color:null};this.processDataBarColor(e,n,t,`color`),t.color&&r.push(t.color)}}n.indexedColors=r}processMruColors(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`color`){let t={color:null};this.processDataBarColor(e,n,t,`color`),t.color&&r.push(t.color)}}r.length>0&&(n.mruColors=r)}processNumFmts(e,t,n){if(!t)return;let r=new Map;if(e.getVisitorParamsState().set(`numFmts`,r),!t)return;let i=t.childNodes,a=i.length;for(let e=0;e<a;e++){let t=i.item(e);if(t.nodeType===1&&t.localName===`numFmt`){let e=t.getAttribute(`numFmtId`),n=t.getAttribute(`formatCode`);if(e&&n){let t=n;r.set(parseInt(e),t)}}}}processXFs(e,t,n,r,i=null,a=!0){if(!t)return;let o=t.childNodes,s=o.length;for(let t=0;t<s;t++){let s=o.item(t);if(s.nodeType===1&&s.localName===`xf`){let t={};this.processXF(e,s,t,r,i,a),n.push(t)}}}processXF(e,t,n,r,i,o){if(!t)return;let s=t.getAttribute(`xfId`);if(s&&i){let e=i.get(parseInt(s));e&&e!==a.BuiltInName.Normal&&(n.named=e)}let c=e=>!(!o&&t.hasAttribute(e))||A(t.getAttribute(e)),l=e=>!o||t.hasAttribute(e)&&A(t.getAttribute(e)),u=o?`0`:void 0;if(c(`applyFont`)){let e=t.getAttribute(`fontId`)??u;if(e!==void 0&&(e!==`0`||l(`applyFont`))){let t=r.fonts[e];t!==void 0&&(n.font=t)}}if(c(`applyFill`)){let e=t.getAttribute(`fillId`)??u;if(e!==void 0&&(e!==`0`||l(`applyFill`))){let t=r.fills[e];t!==void 0&&Object.keys(t).length>0&&(n.fill=t)}}if(c(`applyBorder`)){let e=t.getAttribute(`borderId`)??u;if(e!==void 0&&(e!==`0`||l(`applyBorder`))){let t=r.borders[e];t!==void 0&&(n.borders=t)}}if(c(`applyNumberFormat`)){let r=t.getAttribute(`numFmtId`)??u;if(r!==void 0&&(r!==`0`||l(`applyNumberFormat`))){let t=parseInt(r),i,a=e.getVisitorParamsState();if(a){let e=a.get(`numFmts`);e&&(i=e.get(t)),n.numberFormat=i??t}else e.warn(`Number formats were unavailable; a cell format was not read.`,{onceKey:`xlsx.style.numberFormat.state`})}}if(c(`applyAlignment`)){let r=e.evaluate(`alignment`,t);(r||l(`applyAlignment`))&&this.processAlignment(e,r,n)}if(c(`applyProtection`)){let r=e.evaluate(`protection`,t);(r||l(`applyProtection`))&&this.processProtection(e,r,n)}let d=A(t.getAttribute(`quotePrefix`)??``);d&&(n.quotePrefix=d)}processAlignment(e,t,n){let r={};if(r.horizontal=t?.hasAttribute(`horizontal`)?t.getAttribute(`horizontal`):s.HorizontalAlignment.General,r.vertical=t?.hasAttribute(`vertical`)?t.getAttribute(`vertical`):s.VerticalAlignment.Bottom,r.indent=t?.hasAttribute(`indent`)?parseInt(t.getAttribute(`indent`)):0,r.relativeIndent=t?.hasAttribute(`relativeIndent`)?parseInt(t.getAttribute(`relativeIndent`)):0,r.overflow=A(t?.getAttribute(`wrapText`)??``)?s.Overflow.Wrap:s.Overflow.Visible,A(t?.getAttribute(`shrinkToFit`)??``)&&(r.overflow=s.Overflow.Shrink),t?.hasAttribute(`textRotation`)){let e=parseFloat(t.getAttribute(`textRotation`));e>0&&e<=90?e=360-e:e>90&&e<=180?e-=90:e===255&&(e=0,r.stacked=!0),r.rotation=e}else r.rotation=0;t?.hasAttribute(`justifyLastLine`)&&(r.justifyLastLine=A(t.getAttribute(`justifyLastLine`)));let i=t?.getAttribute(`readingOrder`);return i&&(i===`0`?r.readingDirection=s.ReadingDirection.Auto:i===`1`?r.readingDirection=s.ReadingDirection.LeftToRight:i===`2`?r.readingDirection=s.ReadingDirection.RightToLeft:e.warn(`Invalid readingOrder '${i}'; the direction was left automatic.`,{onceKey:`xlsx.style.readingOrder`})),Object.keys(r).length>0&&(n.alignment=r),n}collectHiddenXfs(e){let t=new Set;if(!e)return t;let n=e.childNodes,r=0;for(let e=0;e<n.length;e++){let i=n.item(e);if(i.nodeType!==1||i.localName!==`xf`)continue;let a=i.childNodes;for(let e=0;e<a.length;e++){let n=a.item(e);n.nodeType===1&&n.localName===`protection`&&A(n.getAttribute(`hidden`)??``)&&t.add(r)}r++}return t}collectPivotButtonXfs(e){let t=new Set;if(!e)return t;let n=e.childNodes,r=0;for(let e=0;e<n.length;e++){let i=n.item(e);i.nodeType===1&&i.localName===`xf`&&(A(i.getAttribute(`pivotButton`)??``)&&t.add(r),r++)}return t}collectXfComplements(e){let t=new Map;if(!e)return t;let n=e.childNodes,r=0;for(let e=0;e<n.length;e++){let i=n.item(e);if(i.nodeType!==1||i.localName!==`xf`)continue;let a=q(i,`extLst`);if(a){let e=a.childNodes;for(let n=0;n<e.length;n++){let i=q(e.item(n),`xfComplement`),a=parseInt(i?.getAttribute(`i`)??``,10);isNaN(a)||t.set(r,a)}}r++}return t}processProtection(e,t,n){if(!t)return;let r=t.getAttribute(`locked`);return n.protection={alwaysUnlocked:!!r&&!A(r)},n}processDXF(e,t,n){if(!t)return;let r=t.childNodes,i=r.length;for(let t=0;t<i;t++){let i=r.item(t);if(i.nodeType===1&&i.localName===`font`){let t={};this.processFont(e,i,t),n.font=t}else if(i.nodeType===1&&i.localName===`fill`){let t=[];this.processFill(e,i,t,0),t.length>0&&t[0]&&(n.fill=t[0])}else if(i.nodeType===1&&i.localName===`border`){let t=[];this.processBorder(e,i,t,0,!1),t.length>0&&t[0]&&(n.borders=t[0])}else if(i.nodeType===1&&i.localName===`numFmt`){let e=i.getAttribute(`formatCode`);if(e)n.numberFormat=e;else{let e=i.getAttribute(`numFmtId`);e&&(n.numberFormat=Number(e))}}else i.nodeType===1&&i.localName===`alignment`&&this.processAlignment(e,i,n)}}processDXFs(e,t,n){if(!t)return;e.getVisitorParamsState().set(`processingDXFs`,!0);let r=new Map;e.getVisitorParamsState().set(`dxfs`,r);let i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let a=i.item(t);if(a.nodeType===1&&a.localName===`dxf`){let t={};this.processDXF(e,a,t);let i=n.length;r.set(i,t),n.push(t)}}e.getVisitorParamsState().delete(`processingDXFs`)}processSlicerStyles(e,t,n){if(!t)return;let r=null,i=null,a=t.childNodes;for(let e=0;e<a.length;e++){let t=a.item(e);if(t.nodeType!==1||t.localName!==`ext`)continue;let n=t.childNodes;for(let e=0;e<n.length;e++){let t=n.item(e);t.nodeType===1&&(t.localName===`dxfs`?r=t:t.localName===`slicerStyles`&&(i=t))}}if(!i)return;let o=[];if(r){e.getVisitorParamsState().set(`processingDXFs`,!0);let t=r.childNodes;for(let n=0;n<t.length;n++){let r=t.item(n);if(r.nodeType!==1||r.localName!==`dxf`)continue;let i={};this.processDXF(e,r,i),o.push(i)}e.getVisitorParamsState().delete(`processingDXFs`)}let s={},c=i.getAttribute(`defaultSlicerStyle`);c&&c!==`SlicerStyleLight1`&&(s.defaultSlicerStyle=c);let l=n.tables?.styles,u=i.childNodes;for(let t=0;t<u.length;t++){let n=u.item(t);if(n.nodeType!==1||n.localName!==`slicerStyle`)continue;let r=n.getAttribute(`name`);if(!r)continue;let i={},a=l?.[r];a&&!1===a.table&&!a.pivot&&(a.wholeTable&&(i.wholeTable=a.wholeTable),a.headerRow&&(i.headerRow=a.headerRow),delete l[r]);let c=e.evaluate(`slicerStyleElements`,n)?.childNodes,d=c?.length??0;for(let t=0;t<d;t++){let n=c.item(t);if(n.nodeType!==1||n.localName!==`slicerStyleElement`)continue;let r=n.getAttribute(`type`);if(!r||!ke.has(r))continue;let a=n.getAttribute(`dxfId`),s=a==null?void 0:o[parseInt(a)];s?i[r]=s:e.warn(`A slicer style names a format that does not exist (dxfId '${a}').`,{onceKey:`xlsx.style.slicerStyle.dxf`})}(s.styles??={})[r]=i}l&&Object.keys(l).length===0&&(delete n.tables.styles,Object.keys(n.tables).length===0&&delete n.tables),Object.keys(s).length>0&&(n.slicers=s)}processTableStyle(e,t,n,r,i=!1){let a=t.getAttribute(`name`),o={name:a};t.hasAttribute(`table`)&&(o.table=A(t.getAttribute(`table`))),o.pivot=!t.hasAttribute(`pivot`)||A(t.getAttribute(`pivot`)),i&&!o.pivot&&r.unshift(null);let s=t.childNodes,c=s.length;for(let t=0;t<c;t++){let n=s.item(t);if(n.nodeType===1&&n.localName===`tableStyleElement`){let t=n.getAttribute(`type`),i=n.getAttribute(`dxfId`),a=i==null?void 0:r?.[i];a||=(e.warn(`A table style names a format that does not exist (dxfId '${i}').`,{onceKey:`xlsx.style.tableStyle.dxf`}),{}),o[t]=a;let s=null;n.hasAttribute(`size`)&&(s=parseInt(n.getAttribute(`size`))),s&&!isNaN(s)&&(a.size=s)}}delete o.name,n[a]=o}processTableStyles(e,t,n,r,i){if(!t)return;let a={},o=t.getAttribute(`defaultTableStyle`);o&&(a.defaultTableStyle=o);let s=t.getAttribute(`defaultPivotStyle`);s&&(a.defaultPivotStyle=s);let c=t.childNodes,l={},u=c.length;for(let t=0;t<u;t++){let n=c.item(t);n.nodeType===1&&n.localName===`tableStyle`&&this.processTableStyle(e,n,l,r,i)}return Object.keys(l).length>0&&(a.styles=l),Object.keys(a).length>0&&(n.tables=a),n}processCellStyles(e,t,n,r,i){if(!t)return;let o=t.childNodes,s=o.length;for(let e=0;e<s;e++){let t=o.item(e);if(t.nodeType===1&&t.localName===`cellStyle`){let e=parseInt(t.getAttribute(`xfId`)??``),o=t.getAttribute(`name`),s=t.getAttribute(`builtinId`),c=o;if(s!==null){let e=a.builtInNameFromId(parseInt(s));e!==void 0&&(c=e)}if(i.set(e,c),!r[e])continue;let l={name:c,style:r[e]};t.getAttribute(`hidden`)&&(l.hidden=A(t.getAttribute(`hidden`))),t.getAttribute(`iLevel`)&&(l.iLevel=parseInt(t.getAttribute(`iLevel`))),s!==null&&A(t.getAttribute(`customBuiltin`)??`0`)&&(l.customized=!0),n.push(l)}}}afterVisit(e,t,n){}},WorkbookVisitor:class extends G{visit(e,t,n){return this.processSheetRefs(e,e.evaluate(`sheets`,t),n),this.processExternalReferences(e,e.evaluate(`externalReferences`,t),n),this.processBookViews(e,e.evaluate(`bookViews`,t),n),this.processDefinedNames(e,e.evaluate(`definedNames`,t),n),this.processCalcPr(e,e.evaluate(`calcPr`,t),n),this.processPivotCaches(e,e.evaluate(`pivotCaches`,t),n),this.processWorkbookProtection(e,e.evaluate(`workbookProtection`,t),n),this.processWorkbookPr(e,e.evaluate(`workbookPr`,t),n),n}processPassword(e,t,n,r=`workbook`,i=`password`){if(!t)return;let a={};e.copyFromAttribute(t,`${r}AlgorithmName`,a,`algorithm`),e.copyFromAttribute(t,`${r}HashValue`,a,`hash`),e.copyFromAttribute(t,`${r}SaltValue`,a,`salt`),e.copyFromAttribute(t,`${r}SpinCount`,a,`spinCount`,e.INT_COPY),e.copyFromAttribute(t,`${r}Password`,a,`legacyHash`),Object.keys(a).length>0&&(n[i]=a)}processWorkbookProtection(e,t,n){if(!t)return;let r={};this.processPassword(e,t,r,`workbook`,`password`),this.processPassword(e,t,r,`revisions`,`revisionsPassword`);for(let e of se)r[e.key]=re(e,t.getAttribute(e.attribute));return n.protection=r,n}processCalcPr(e,t,n){if(!t)return;let r={};e.copyFromAttribute(t,`calcMode`,r,`calcMode`,e=>Ae[e]??null),e.copyFromAttribute(t,`fullCalcOnLoad`,r,`fullCalcOnLoad`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`calcOnSave`,r,`calcOnSave`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`calcCompleted`,r,`calcCompleted`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`fullPrecision`,r,`fullPrecision`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`forceFullCalc`,r,`forceFullCalc`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`concurrentCalc`,r,`concurrentCalc`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`concurrentManualCount`,r,`concurrentManualCount`,e.INT_COPY),e.copyFromAttribute(t,`refMode`,r,`refMode`),e.copyFromAttribute(t,`iterate`,r,`iterate`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`iterateCount`,r,`maxIteration`,e.INT_COPY),e.copyFromAttribute(t,`iterateDelta`,r,`maxIterateChange`,e.FLOAT_COPY);let i=t.getAttribute(`calcId`);i!==null&&e.getVisitorParamsState().set(`calcId`,i),n.calc=r}processSheetRefs(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);n.nodeType===1&&n.localName===`sheet`&&this.processSheetRef(e,n,r)}n.sheets=r}processSheetRef(e,t,n){let r={};e.copyFromAttribute(t,`name`,r,`name`),e.copyFromAttribute(t,`state`,r,`visibility`),e.copyFromAttribute(t,`sheetId`,r,`sheetId`,e.INT_COPY);let i=t.getAttribute(`r:id`),a=i?ie(e.getRelationships().get(i)?.type):null;if(a){let t=e.readEmbeddedPart(i);if(t?.xml){let e={part:t},i=te(t.xml),o=i?_(e=>i.get(e)):void 0;o&&(e.tabColor=o),r.kind=a,r.sheet=e,n.push(r);return}e.warn(`The ${a} sheet '${r.name}' could not be read and was loaded as an empty worksheet.`),n.push(r);return}let o=i?e.getRef(i):null;o&&(r.sheet=o),n.push(r)}processExternalReferences(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`externalReference`){let t=n.getAttribute(`r:id`),i=t?e.getRef(t):null;r.push(i??null)}}r.length>0&&(n.externalBooks=r)}processPivotCaches(e,t,n){if(!t)return;let r=[],i=e.evaluate(`workbookPr`,t.parentNode)?.getAttribute?.(`date1904`),a=i===`1`||i===`true`,o=C(e.getVisitorParamsState().get(`numFmts`),void 0),s=t.childNodes,c=s.length;for(let t=0;t<c;t++){let n=s.item(t);if(n.nodeType!==1||n.localName!==`pivotCache`)continue;let i=parseInt(n.getAttribute(`cacheId`)??``,10),c=n.getAttribute(`r:id`);if(isNaN(i)||!c)continue;let l=e.readEmbeddedPart(c);if(!l)continue;let u=R(l,a,e=>o.numberFormat(e)),d=!u&&l.xml?ne(l.xml,o):void 0,f=!u&&l.xml?be(l.xml):void 0;r.push({cacheId:i,part:l,...d?{partFormats:d}:{},...f?{source:f}:{},...u})}r.length>0&&(n.pivotCaches=r)}processBookViews(e,t,n){if(!t)return;let r=t.childNodes,i=0,a=r.length;for(let t=0;i<1&&t<a;t++){let a=r.item(t);a.nodeType===1&&a.localName===`workbookView`&&(this.processWorkbookView(e,a,n),i++)}}processWorkbookView(e,t,n){if(!t)return;let r={},i=[`xWindow`,`yWindow`,`windowWidth`,`windowHeight`].map(e=>parseInt(t.getAttribute(e)??``,10));if(i.some(e=>Number.isFinite(e))){let[e,t,n,a]=i.map(e=>Number.isFinite(e)?e:0);r.windowBounds={left:e,top:t,width:n,height:a}}e.copyFromAttribute(t,`activeTab`,r,`activeSheetId`,[e.INT_COPY,e=>e]),t.hasAttribute(`activeTab`)||(r.activeSheetId=0),e.copyFromAttribute(t,`showHorizontalScroll`,r,`showHorizontalScrollbar`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`showVerticalScroll`,r,`showVerticalScrollbar`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`showSheetTabs`,r,`showTabs`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`tabRatio`,r,`tabRatio`,[e.FLOAT_COPY,e=>e]),e.copyFromAttribute(t,`firstSheet`,r,`firstTab`,[e.INT_COPY,e=>e]),e.copyFromAttribute(t,`minimized`,r,`minimized`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`autoFilterDateGrouping`,r,`autoFilterDateGrouping`,e.BOOLEAN_COPY);let a=t.getAttribute(`visibility`);a!==`hidden`&&a!==`veryHidden`||(r.visibility=a),Object.keys(r).length>0&&(n.view=r)}processDefineName(e,t,n,r){if(!t)return;let i={},a=t.firstChild;if(a&&a.nodeType===3&&(i.ref=a.textContent),e.copyFromAttribute(t,`name`,i),e.copyFromAttribute(t,`comment`,i),e.copyFromAttribute(t,`hidden`,i,`hidden`,e.BOOLEAN_COPY),t.hasAttribute(`localSheetId`)){let n=t.getAttribute(`localSheetId`);if(!r[n]?.name)return void e.warn(`Defined name '${t.getAttribute(`name`)}' references a sheet with localSheetId '${n}' which does not exist.`);i.scope=r[n].name}let o={};for(let n of ve)e.copyFromAttribute(t,n,o);for(let e of ye){let n=t.getAttribute(e);n!==`1`&&n!==`true`||(o[e]=!0)}e.copyFromAttribute(t,`functionGroupId`,o,`functionGroupId`,e.INT_COPY),Object.keys(o).length>0&&(i.fileAttributes=o),Object.keys(i).length>0&&n.push(i)}processDefinedNames(e,t,n){if(!t)return;let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let a=i.item(t);a.nodeType===1&&a.localName===`definedName`&&this.processDefineName(e,a,r,n.sheets)}r.length>0&&(n.names=r)}processWorkbookPr(e,t,n){if(!t)return;e.copyFromAttribute(t,`date1904`,n,`date1904`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`codeName`,n,`codeName`),e.copyFromAttribute(t,`updateLinks`,n,`updateLinks`);let r=t.getAttribute(`hidePivotFieldList`);r!==`1`&&r!==`true`||(n.hiddenPivotFieldList=!0)}afterVisit(e,t,n){}},TableVisitor:class{visit(e,t,n){let r={};return e.copyFromAttribute(t,`ref`,n,`r`),e.getVisitorParamsState().set(`ref`,n.r),n.v=r,e.copyFromAttribute(t,`name`,r),e.copyFromAttribute(t,`displayName`,r,`name`),e.copyFromAttribute(t,`headerRowCount`,r,`headerRowCount`,e.INT_COPY),e.copyFromAttribute(t,`totalsRowCount`,r,`totalsRowCount`,e.INT_COPY),this.processTableColumns(e,t,r),this.processTableStyleInfo(e,t,r),e.copyFromAttribute(t,`id`,r),e.copyFromAttribute(t,`comment`,r,`description`),e.copyFromAttribute(t,`connectionId`,r,`connectionId`,e.INT_COPY),e.copyFromAttribute(t,`tableType`,r),e.copyFromAttribute(t,`published`,r,`published`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`insertRow`,r,`insertRow`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`insertRowShift`,r,`insertRowShift`,e.BOOLEAN_COPY),r.totalsRowShown=t.getAttribute(`totalsRowShown`)!==`0`,r}afterVisit(e,t,n){let r=n.v;if(e.evaluate(`autoFilter`,t)){if(Array.isArray(r.hiddenButtons)){let e=r.hiddenButtons.length;e===0?r.hiddenButtons=!1:e===r.columns?.length&&(r.hiddenButtons=!0)}}else r.hiddenButtons=!0,r.showButtons=!1;return r}processTableStyleInfo(e,t,n){if(!t)return;let r=t.childNodes,i={},a=r.length;for(let t=0;t<a;t++){let n=r.item(t);n.nodeType===1&&n.localName===`tableStyleInfo`&&(e.copyFromAttribute(n,`name`,i),e.copyFromAttribute(n,`showColumnStripes`,i,`showColumnStripes`,e.BOOLEAN_COPY),e.copyFromAttribute(n,`showFirstColumn`,i,`showFirstColumn`,e.BOOLEAN_COPY),e.copyFromAttribute(n,`showLastColumn`,i,`showLastColumn`,e.BOOLEAN_COPY),e.copyFromAttribute(n,`showRowStripes`,i,`showRowStripes`,e.BOOLEAN_COPY))}Object.keys(i).length>0&&(n.style=i)}processTableColumn(e,t,n){if(!t)return null;let r=t.childNodes,i=r.length;for(let t=0;t<i;t++){let i=r.item(t);if(i.nodeType===1&&i.localName===`tableColumn`){let t={};e.copyFromAttribute(i,`name`,t),e.copyFromAttribute(i,`id`,t),e.copyFromAttribute(i,`uniqueName`,t),e.copyFromAttribute(i,`queryTableFieldId`,t),e.copyFromAttribute(i,`totalsRowLabel`,t);let r=i.getAttribute(`totalsRowFunction`);if(r!==null){if(r===`custom`){let n=e.evaluate(`totalsRowFormula`,i);n&&(t.totalsRowFormula=n.textContent)}else t.totalsRowFormula=r}e.copyFromAttribute(i,`totalsRowLabel`,t);let a=e.evaluate(`calculatedColumnFormula`,i);a?.textContent&&(t.calculatedColumnFormula=a.textContent),n.push(t)}}return n}processTableColumns(e,t,n){let r=t.childNodes,i=[],a=r.length;for(let t=0;t<a;t++){let n=r.item(t);n.nodeType===1&&n.localName===`tableColumns`&&this.processTableColumn(e,n,i)}i.length>0&&(n.columns=i)}},TableX14Visitor:class{visit(e,t,n){let r=e.getVisitorParamsState().get(`ref`);if(r){let n=e.getVisitorParamsState().get(`descriptions`);n&&(n.add(r,t.getAttribute(`altText`)),n.add(r,t.getAttribute(`altTextSummary`)))}return e.copyFromAttribute(t,`altText`,n),e.copyFromAttribute(t,`altTextSummary`,n),n}},ExternalLinkVisitor:class{visit(e,t,n){let r=t.childNodes,i=r.length,a=null;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType===1){t.localName===`externalBook`&&(a=t);break}}if(!a)return n;t.getAttribute(`mc:Ignorable`)&&(n.mceIgnorable=!0);let o=a.getAttribute(`r:id`);o&&(n.__bookRelId=o);let s=this._findAbsoluteUrlRelId(a);return s&&(n.__absoluteUrlRelId=s),n.sheetNames=[],this.processSheetNames(e,a,n),this.processDefinedNames(e,a,n),this.processSheetDataSet(e,a,n),n}processSheetNames(e,t,n){let r=this._findChild(t,`sheetNames`);if(!r)return;let i=r.childNodes,a=i.length;for(let e=0;e<a;e++){let t=i.item(e);t.nodeType===1&&t.localName===`sheetName`&&n.sheetNames.push(t.getAttribute(`val`)??``)}}processDefinedNames(e,t,n){let r=this._findChild(t,`definedNames`);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let e=0;e<o;e++){let t=a.item(e);if(t.nodeType!==1||t.localName!==`definedName`)continue;let n=t.getAttribute(`name`);if(!n)continue;let r={name:n,refersTo:t.getAttribute(`refersTo`)??``},o=t.getAttribute(`sheetId`);o!==null&&(r.sheetIndex=parseInt(o,10)),i.push(r)}i.length>0&&(n.definedNames=i)}processSheetDataSet(e,t,n){let r=this._findChild(t,`sheetDataSet`);if(!r)return;let i=[],a=r.childNodes,o=a.length;for(let t=0;t<o;t++){let n=a.item(t);if(n.nodeType!==1||n.localName!==`sheetData`)continue;let r=n.getAttribute(`sheetId`);if(r===null)continue;let o=this.processSheetData(e,n);o.sheetIndex=parseInt(r,10),n.getAttribute(`refreshError`)===`1`&&(o.refreshError=!0),i.push(o)}i.length>0&&(n.sheetDataSet=i)}processSheetData(e,t){let n=new m.Builder,r=t.childNodes,i=r.length;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType!==1||t.localName!==`row`)continue;let i=t.childNodes,a=i.length;for(let e=0;e<a;e++){let t=i.item(e);if(t.nodeType!==1||t.localName!==`cell`)continue;let r=t.getAttribute(`r`);if(!r)continue;let a=p.fastStringToCell(r);if(a?.rowIndex===void 0||a?.colIndex===void 0)continue;let o=this._readCellValue(t);o!==void 0&&n.pushAt(a.rowIndex,a.colIndex,o)}}return{sheetIndex:-1,data:n.build()?.tuples??[]}}_readCellValue(e){let t=this._findChild(e,`v`)?.textContent?.trim();if(t!==void 0&&t!==``)switch(e.getAttribute(`t`)){case null:case`n`:return parseFloat(t);case`b`:return t===`1`||t===`true`;case`str`:default:return t;case`e`:{let e=l.getBuiltInByLabel(t);return e?{t:`e`,v:e.getCode()}:t}}}_findChild(e,t){let n=e.childNodes,r=n.length;for(let e=0;e<r;e++){let r=n.item(e);if(r.nodeType===1&&r.localName===t)return r}return null}_findAbsoluteUrlRelId(e){let t=this._findChild(e,`alternateUrls`);return t?this._findChild(t,`absoluteUrl`)?.getAttribute(`r:id`)??null:null}},SlicerCacheDefinitionVisitor:class{visit(e,t,n){e.copyFromAttribute(t,`name`,n,`cacheName`),e.copyFromAttribute(t,`sourceName`,n);let r=e.evaluate(`*/tableSlicerCache`,t);return r?(e.copyFromAttribute(r,`tableId`,n),e.copyFromAttribute(r,`column`,n,`columnId`),e.copyFromAttribute(r,`sortOrder`,n),e.copyFromAttribute(r,`customListSort`,n,`customListSort`,e.BOOLEAN_COPY),e.copyFromAttribute(r,`crossFilter`,n),n):(this.processPivot(e,t,n),n)}processPivot(e,t,n){let r=[],i=``,a=t.childNodes;for(let t=0;t<a.length;t++){let o=a.item(t);if(o.nodeType!==1)continue;if(o.localName===`pivotTables`){let e=o.childNodes;for(let t=0;t<e.length;t++){let n=e.item(t);n.nodeType===1&&n.localName===`pivotTable`&&r.push({tabId:n.getAttribute(`tabId`)??``,name:n.getAttribute(`name`)??``})}continue}let s=o.getAttribute(`pivotCacheId`);if(s&&(n.pivotCacheId=s),o.localName===`state`||o.localName===`timelinePivotFilter`){n.tabular=!0,n.pivotData=(n.pivotData??``)+(e.serializeElement(o)??``);continue}if(o.localName===`data`){let t=null,r=o.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType!==1)continue;let a=i.getAttribute(`pivotCacheId`);a&&(n.pivotCacheId=a),i.localName===`tabular`&&(t=i)}if(t){n.tabular=!0,e.copyFromAttribute(t,`sortOrder`,n),e.copyFromAttribute(t,`customListSort`,n,`customListSort`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`crossFilter`,n),e.copyFromAttribute(t,`showMissing`,n,`showMissing`,e.BOOLEAN_COPY),n.pivotData=e.serializeElement(o)??void 0;continue}}let c=e.serializeElement(o);if(c===null)return;i+=c}n.pivotTables=r,n.pivotBody=i}},SlicersVisitor:class{visit(e,t,n){let r=n.slicers;r||(r={},n.slicers=r);let i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);n.nodeType===1&&n.localName===`slicer`&&this.processSlicer(e,n,r)}return r}processSlicer(e,t,n){if(!t)return;let r={};n[t.getAttribute(`name`)]=r,e.copyFromAttribute(t,`xr10:uid`,r,`uid`);let i=t.getAttribute(`cache`),a=e.getVisitorParamsState().get(`slicerCaches`),o=i?a?.get(i):void 0;if(o)for(let e=0;e<J.length;e++){let t=J[e];o[t]!==void 0&&(r[t]=o[t])}e.copyFromAttribute(t,`caption`,r),e.copyFromAttribute(t,`startItem`,r,`startItem`,e.INT_COPY),e.copyFromAttribute(t,`columnCount`,r,`columnCount`,e.INT_COPY),e.copyFromAttribute(t,`showCaption`,r,`showCaption`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`level`,r,`level`,e.INT_COPY),e.copyFromAttribute(t,`style`,r),e.copyFromAttribute(t,`lockedPosition`,r,`lockedPosition`,e.BOOLEAN_COPY),e.copyFromAttribute(t,`rowHeight`,r,`rowHeight`,e.INT_COPY)}},TimelinesVisitor:class{visit(e,t,n){let r=n.slicers;r||(r={},n.slicers=r);let i=t.childNodes;for(let t=0;t<i.length;t++){let n=i.item(t);n.nodeType===1&&n.localName===`timeline`&&this.processTimeline(e,n,r)}return r}processTimeline(e,t,n){let r={};n[t.getAttribute(`name`)]=r,e.copyFromAttribute(t,`xr10:uid`,r,`uid`);let i=t.getAttribute(`cache`),a=e.getVisitorParamsState().get(`slicerCaches`),o=i?a?.get(i):void 0;if(o)for(let e=0;e<J.length;e++){let t=J[e];o[t]!==void 0&&(r[t]=o[t])}e.copyFromAttribute(t,`caption`,r);let s={};for(let e=0;e<t.attributes.length;e++){let n=t.attributes.item(e);je.has(n.name)||n.name.startsWith(`xmlns`)||(s[n.name]=n.value)}r.timelineAttributes=s;let c=``,l=t.childNodes;for(let t=0;t<l.length;t++){let n=l.item(t);n.nodeType===1&&(c+=e.serializeElement(n)??``)}r.timelineBody=c}},FormControlPrVisitor:class{visit(e,t,n){let r={},i=t.attributes;for(let e=0;e<i.length;e++){let t=i.item(e),n=t.name;n===`xmlns`||n.startsWith(`xmlns:`)||(r[n]=t.value)}let a=[],o,s=t.childNodes;for(let t=0;t<s.length;t++){let n=s.item(t);if(n.nodeType===1){if(n.localName===`itemLst`){let e=n.childNodes;for(let t=0;t<e.length;t++){let n=e.item(t);n.nodeType===1&&n.localName===`item`&&a.push(n.getAttribute(`val`)??``)}}else n.localName===`extLst`&&(o=e.serializeElement(n)??void 0)}}let c=he(r,a,o);return n.formControl=c,c}},DrawingVisitor:class{visit(e,t,n){return n}afterVisit(e,t,n){for(let e of n?.movables??[])Y(e,!1)}},DrawingAnchorVisitor:class{visit(e,t,n){if(!t)return;let r={};e.copyFromAttribute(t,`editAs`,r,`anchorType`),r.anchor={},t.localName===`absoluteAnchor`?(r.anchorType=`absolute`,this.processAbsoluteCoord(e,e.evaluate(`pos`,t),r.anchor,`from`,`x`,`y`),this.processAbsoluteCoord(e,e.evaluate(`ext`,t),r.anchor,`to`,`cx`,`cy`)):t.localName===`oneCellAnchor`?(this.processOffsetCoord(e,e.evaluate(`from`,t),r.anchor,`from`),this.processAbsoluteCoord(e,e.evaluate(`ext`,t),r.anchor,`to`,`cx`,`cy`)):(this.processOffsetCoord(e,e.evaluate(`from`,t),r.anchor,`from`),this.processOffsetCoord(e,e.evaluate(`to`,t),r.anchor,`to`));let i=e.evaluate(`clientData`,t),a=e=>{let t=i?.getAttribute(e);return t===`0`||t===`false`};return a(`fPrintsWithSheet`)&&(r.noPrint=!0),a(`fLocksWithSheet`)&&(r.unlocked=!0),n.movables||=[],n.movables.push(r),r}processAbsoluteCoord(e,t,n,r,i,a){if(!t)return;let o={x:0,y:0};return o.x=w(t.getAttribute(i)),o.y=w(t.getAttribute(a)),r===`from`?n.tl=o:n.br=o,n}processOffsetCoord(e,t,n,r){if(!t)return;let i={c:0,r:0,x:0,y:0};return e.evaluate(`col`,t)&&(i.c=parseInt(e.evaluate(`col`,t).textContent)),e.evaluate(`row`,t)&&(i.r=parseInt(e.evaluate(`row`,t).textContent)),e.evaluate(`colOff`,t)&&(i.x=w(e.evaluate(`colOff`,t).textContent)),e.evaluate(`rowOff`,t)&&(i.y=w(e.evaluate(`rowOff`,t).textContent)),r===`from`?n.tl=i:n.br=i,n}},DrawingGraphicFrameVisitor:class extends H{visit(e,t,n){if(!t)return;if(this.isGroupContent(n)){if(e.getPath().includes(`Fallback`))return{};let{movable:r}=this.readMemberHeader(e,t,`graphicFrame`),i=e.evaluate(`xfrm`,t);if(i){M(i,r);let t=e.evaluate(`off`,i),n=e.evaluate(`ext`,i);r.anchor={tl:{x:w(t?.getAttribute(`x`)??null)??0,y:w(t?.getAttribute(`y`)??null)??0},br:{x:w(n?.getAttribute(`cx`)??null)??0,y:w(n?.getAttribute(`cy`)??null)??0}}}let a=this.readGraphic(e,t),o=a.type===`chart`?{...r.content.json,...a.json}:a.json;return r.content={...r.content,type:a.type,json:o},n.members.push(r),a.json}n=super.visit(e,t,n);let r=e.evaluate(`nvGraphicFramePr/cNvGraphicFramePr`,t);if(r){let t=e.evaluate(`graphicFrameLocks`,r);t&&t.hasAttribute(`noChangeAspect`)&&(n.lockAspect=t.getAttribute(`noChangeAspect`)===`1`)}let i=this.readGraphic(e,t);return this.setContent(n,i),i}readGraphic(e,t){let n=e.evaluate(`graphic/graphicData`,t),r={type:`graphicFrame`,json:{}};if(!n)return r;let i=n.childNodes,a=i.length;for(let n=0;n<a;n++){let a=i.item(n);if(a.nodeType===1)try{let n=a.localName;n===`chart`?n=`chart`:n!==`slicer`&&n!==`timeslicer`||(n=`slicer`),r.type=n;let i=a.getAttribute(`r:id`);if(n===`chart`&&i){let n=this.readSourceId(e,t),a=e.readEmbeddedPart(i)??void 0,o;try{let t=a?.xml?xe(a.xml):null;o=t?.model,t?.lossy&&e.warn(`A chart states something its model does not; it is saved as it was until it is changed.`,{onceKey:`xlsx.chart.lossy`})}catch(t){e.warn(`A chart could not be read into the chart model; it is kept as its markup: ${t?.message??t}`,{onceKey:`xlsx.chart.model`})}r.json={sourceId:n,part:a,model:o}}else if(n===`slicer`){let n=this.readSourceId(e,t);n!==void 0&&(r.json={sourceId:n})}else i&&(r.json=e.getRef(i))}catch(t){e.warn(`Unable to read a graphic frame: ${t?.message??t}`,{onceKey:`xlsx.drawing.graphicFrame`})}}return r}},DrawingSpVisitor:X,DrawingPicVisitor:class extends H{visit(e,t,n){if(!t)return;if(this.isGroupContent(n)){if(e.getPath().includes(`Fallback`))return{};let{movable:r,content:i}=this.readMemberHeader(e,t,`picture`),a=this.readImage(e,t);return a?(this.readPictureDetails(e,t,a,r,i),n.members.push(r),i):{}}let r=super.visit(e,t,n),i=this.readImage(e,t);if(i===null)return;let a={},o=this.readSourceId(e,t);return o!==void 0&&(a.sourceId=o),this.readPictureDetails(e,t,i,r,a),this.setContent(r,{type:`picture`,json:a}),a}readPictureDetails(e,t,n,r,i){n?.resId!==void 0&&(i.resId=n.resId),n?.image&&(i.image=n.image);let a=t.getAttribute(`macro`);a&&(i.macro=a),t.hasAttribute(`fPublished`)&&(i.published=A(t.getAttribute(`fPublished`)));let o=e.evaluate(`nvPicPr/cNvPicPr`,t);if(o?.getAttribute){o.getAttribute(`preferRelativeResize`)===`0`&&(i.noRelativeResize=!0);let t=this.readLocks(e.evaluate(`picLocks`,o));t&&(i.locks=t),r.lockAspect=t?.noChangeAspect??!1}}readImage(e,t){let n=e.evaluate(`blipFill`,t),r=n?e.evaluate(`blip`,n):null;if(!r)return;if(!(r.getAttribute(`r:embed`)??r.getAttribute(`embed`)??r.getAttribute(`r:link`)??r.getAttribute(`link`)))return e.warn(`A picture names no image; it was not imported.`,{onceKey:`xlsx.drawing.picture.noRel`}),null;let{type:i,resId:a,...o}=new O().processImageFill(e,n);return!o.tile&&o.stretch&&Object.keys(o.stretch).length===0&&delete o.stretch,o.extLst&&Me.test(o.extLst)&&delete o.extLst,{resId:a,image:Object.keys(o).length>0?o:void 0}}},DrawingGrpSpVisitor:class extends H{constructor(...e){super(...e),this._fills=new O}visit(e,t,n){if(!t)return;let r=this.isGroupContent(n),i,a;if(r){if(e.getPath().includes(`Fallback`))return{};let r=this.readMemberHeader(e,t,`group`);i=r.movable,a=r.content,n.members.push(i)}else{if(e.getPath().includes(`Fallback`)&&n.content)return{};i=super.visit(e,t,n),a={};let r=this.readSourceId(e,t);r!==void 0&&(a.sourceId=r),this.setContent(i,{type:`group`,json:a})}a.members=[];let o=e.evaluate(`nvGrpSpPr/cNvGrpSpPr/grpSpLocks`,t);o?.hasAttribute?.(`noChangeAspect`)&&(i.lockAspect=o.getAttribute(`noChangeAspect`)===`1`);let s=this.readLocks(o);s&&(a.locks=s);let c=e.evaluate(`grpSpPr`,t);if(c){let t=e.evaluate(`xfrm`,c);if(t){M(t,i),t.getAttribute(`flipH`)===`1`&&(i.flipH=!0),t.getAttribute(`flipV`)===`1`&&(i.flipV=!0);let n=Z(e,t,`off`,`ext`),o=Z(e,t,`chOff`,`chExt`)??n;o&&(a.childBounds=o),r&&n&&(i.anchor={tl:{x:n.x,y:n.y},br:{x:n.width,y:n.height}})}let n=this._fills.getFill(e,c);n&&Object.keys(n).length>0&&(a.fill=n);let o=this._fills.getEffects(e,c);o&&(a.effects=o);let s=e.evaluate(`scene3d`,c),l=s?e.serializeElement(s):null;l&&(a.scene3d=l);let u=e.evaluate(`extLst`,c),d=u?e.serializeElement(u):null;d&&(a.extLst={...a.extLst,properties:d})}return a}},DrawingCxnSpVisitor:class extends X{visit(e,t,n){if(t)return this.visitShape(e,t,n,`cxnSp`,`nvCxnSpPr/cNvCxnSpPr/cxnSpLocks`)}},MetadataVisitor:class{visit(e,t,n){let r=[],i=new Map,a={cells:[],values:[]},o=t.childNodes;for(let e=0;e<o.length;e++){let t=o.item(e);if(t.nodeType===1)switch(t.localName){case`metadataTypes`:this._parseMetadataTypes(t,r,i);break;case`futureMetadata`:this._attachFutureMetadata(t,i);break;case`cellMetadata`:this._resolveBlocks(t,r,a.cells);break;case`valueMetadata`:this._resolveBlocks(t,r,a.values)}}return n.metadata=a,a}_parseMetadataTypes(e,t,n){let r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1&&i.localName===`metadataType`){let e=this._parseMetadataType(i);t.push(e),n.set(e.name,e)}}}_parseMetadataType(e){let t={name:e.getAttribute(`name`)??``,_blocks:[]},n=e.getAttribute(`minSupportedVersion`);n!=null&&(t.minSupportedVersion=Number(n));for(let n of[`copy`,`pasteAll`,`pasteValues`,`merge`,`splitFirst`,`splitAll`,`rowColShift`,`clearFormats`,`clearComments`,`assign`,`coerce`,`cellMeta`,`adjust`,`trans`,`delete`,`edit`])e.getAttribute(n)===`1`&&(t[n]=!0);return t}_attachFutureMetadata(e,t){let n=e.getAttribute(`name`)??``,r=t.get(n);if(!r)return;let i=e.childNodes;for(let e=0;e<i.length;e++){let t=i.item(e);t.nodeType===1&&t.localName===`bk`&&r._blocks.push(this._parseFutureBlock(t))}}_parseFutureBlock(e){let t={},n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType!==1||r.localName!==`extLst`)continue;let i=r.childNodes;for(let e=0;e<i.length;e++){let n=i.item(e);if(n.nodeType!==1||n.localName!==`ext`)continue;let r=n.childNodes;for(let e=0;e<r.length;e++){let n=r.item(e);n.nodeType===1&&(n.localName===`dynamicArrayProperties`?(t.fDynamic=n.getAttribute(`fDynamic`)===`1`,t.fCollapsed=n.getAttribute(`fCollapsed`)===`1`):n.localName===`rvb`&&(t.richValueIndex=Number(n.getAttribute(`i`)??`0`)))}}}return t}_resolveBlocks(e,t,n){let r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);i.nodeType===1&&i.localName===`bk`&&n.push(this._resolveBlock(i,t))}}_resolveBlock(e,t){let n=new Map,r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType!==1||i.localName!==`rc`)continue;let a=Number(i.getAttribute(`t`)),o=Number(i.getAttribute(`v`)),s=t[a-1];if(!s)continue;let{_blocks:c,...l}=s,u={...l};for(let e of Object.keys(u))u[e]===void 0&&delete u[e];let d=c[o];d&&(d.fDynamic!==void 0&&(u.fDynamic=d.fDynamic,u.fCollapsed=d.fCollapsed??!1),d.richValueIndex!==void 0&&(u.richValueIndex=d.richValueIndex)),n.set(s.name,u)}return n}},FeaturePropertyBagVisitor:class{visit(e,t,n){let r=[],i=t.childNodes;for(let e=0;e<i.length;e++){let t=i.item(e);t.nodeType===1&&t.localName===`bag`&&r.push(this._readBag(t))}let a=[],o=r.find(e=>e.type===`XFComplements`)?.arrays.get(`MappedFeaturePropertyBags`)??[];for(let t=0;t<o.length;t++){let n=r[o[t]]?.ids.get(`XFControls`),i=n===void 0?void 0:r[n]?.ids.get(`CellControl`),s=i===void 0?void 0:r[i]?.type,c=s?Ne[s]:void 0;c||e.warn(`A cell format's feature '${s??`unknown`}' is not read; its cells keep their values.`),a.push(c?{type:c}:null)}let s={controls:a};return n.featurePropertyBag=s,s}_readBag(e){let t={type:e.getAttribute(`type`)??``,ids:new Map,arrays:new Map},n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType!==1)continue;let i=r.getAttribute(`k`)??``;if(r.localName===`bagId`){let e=parseInt(r.textContent??``,10);isNaN(e)||t.ids.set(i,e)}else if(r.localName===`a`){let e=[],n=r.childNodes;for(let t=0;t<n.length;t++){let r=n.item(t);if(r.nodeType!==1||r.localName!==`bagId`)continue;let i=parseInt(r.textContent??``,10);isNaN(i)||e.push(i)}t.arrays.set(i,e)}}return t}},CommentsVisitor:class{visit(e,t,n){if(!t)return;let r=[];this.processAuthors(e,e.evaluate(`authors`,t),r),r.length>0&&(n.authors=r);let i=[];return n.comments=i,i}processAuthors(e,t,n){if(!t)return;let r=t.childNodes,i=r.length;for(let e=0;e<i;e++){let t=r.item(e);if(t.nodeType===1&&t.localName===`author`){let e=t.firstChild;e&&e.nodeType===3&&n.push(e.textContent)}}}},CommentVisitor:class{visit(e,t,n){if(!t)return;let r=t.getAttribute(`ref`);if(!r)return;let i={content:``};if(t.hasAttribute(`authorId`)){let e=parseInt(t.getAttribute(`authorId`),10);isNaN(e)||(i.authorId=e)}return i.content=function(e){if(!e)return``;let t=[],n=!0,r=e.childNodes;for(let e=0;e<r.length;e++){let i=r.item(e);if(i.nodeType===1){if(i.localName===`t`)t.push({text:i.textContent??``});else if(i.localName===`r`){let e={text:``},r=i.childNodes;for(let t=0;t<r.length;t++){let n=r.item(t);if(n.nodeType===1){if(n.localName===`t`)e.text+=n.textContent??``;else if(n.localName===`rPr`){let t=Fe(n);t&&(e.font=t)}}}e.font&&(n=!1),t.push(e)}}}return t.length===0?e.textContent??``:n?t.map(e=>e.text).join(``):{runs:t}}(e.evaluate(`text`,t)),n.push({r,v:i}),i}},ThreadedCommentsVisitor:class{visit(e,t,n){if(!t)return;let r=[];return n.comments=r,r}},ThreadedCommentVisitor:class{visit(e,t,n){if(!t)return;let r={};e.copyFromAttribute(t,`id`,r,`id`,D);let i=t.getAttribute(`ref`);e.copyFromAttribute(t,`personId`,r,`personId`,D),e.copyFromAttribute(t,`parentId`,r,`parentId`,D);let a=t.getAttribute(`dT`);a&&(r.dt=function(e){let t=/^(.*T\d{2}:\d{2}:\d{2})(?:\.(\d+))?(Z|[+-]\d{2}:?\d{2})?$/i.exec(e.trim());if(!t)return e;let[,n,r,i]=t;return`${n}${r?`.${(r+`00`).substring(0,3)}`:``}${i??`Z`}`}(a)),t.hasAttribute(`done`)&&(r.done=A(t.getAttribute(`done`)));let o=function(e){let t,n=e.childNodes;for(let e=0;e<n.length;e++){let r=n.item(e);if(r.nodeType!==1||r.localName!==`mentions`)continue;let i=r.childNodes;for(let e=0;e<i.length;e++){let n=i.item(e);if(n.nodeType!==1||n.localName!==`mention`)continue;let r=n.getAttribute(`mentionId`),a=n.getAttribute(`mentionpersonId`);if(!r||!a)continue;let o={id:D(r),personId:D(a)},s=parseInt(n.getAttribute(`startIndex`)??``,10);isNaN(s)||(o.startIndex=s);let c=parseInt(n.getAttribute(`length`)??``,10);isNaN(c)||(o.length=c),(t??=[]).push(o)}}return t}(t);return o&&(r.mentions=o),n.push({r:i,v:r}),r}},PersonListVisitor:class{visit(e,t,n){let r=[],i=t.childNodes,a=i.length;for(let t=0;t<a;t++){let n=i.item(t);if(n.nodeType===1&&n.localName===`person`){let t={};e.copyFromAttribute(n,`id`,t,`id`,D),e.copyFromAttribute(n,`displayName`,t),e.copyFromAttribute(n,`userId`,t,`userId`,D),e.copyFromAttribute(n,`providerId`,t),r.push(t)}}return r.length>0&&(n.persons=r),r}}},Ie=class{constructor(e,t){this.path=e,this.visitor=t}},Le=class{constructor(){this.visitorsByXmlTagName=new Map,this.scopedVisitorsByXmlTagName=new Map,this.visitorParamsState=null,this.registerVisitor(`Relationships`,new $.RelsVisitor),this.registerVisitor(`cp:coreProperties`,new $.CorePropertiesVisitor),this.registerVisitor(`Properties`,new $.AppPropertiesVisitor),this.registerVisitor(`spPr`,new $.ShapePropertiesVisitor),this.registerVisitor(`txBody`,new $.ShapeTextVisitor),this.registerVisitor(`txPr`,new $.TextPropertiesVisitor),this.registerVisitor(`a:theme`,new $.ThemeVisitor),this.registerVisitor(`a:theme`,new $.ClrSchemeVisitor,`themeElements/clrScheme`),this.registerVisitor(`a:theme`,new $.FontSchemeVisitor,`themeElements/fontScheme`),this.registerVisitor(`a:theme`,new $.FmtSchemeVisitor,`themeElements/fmtScheme`),this.registerVisitor(`a:theme`,new $.ObjectDefaultsVisitor,`objectDefaults`),this.registerVisitor(`autoFilter`,new $.AutoFilterVisitor),this.registerVisitor(`sortState`,new $.SortStateVisitor),this.registerVisitor(`s:workbook`,new $.WorkbookVisitor),this.registerVisitor(`styleSheet`,new $.SheetStyleVisitor),this.registerVisitor(`x14:table`,new $.TableX14Visitor),this.registerVisitor(`table`,new $.TableVisitor),this.registerVisitor(`externalLink`,new $.ExternalLinkVisitor),this.registerVisitor(`wsDr`,new $.DrawingVisitor),this.registerVisitor(`twoCellAnchor`,new $.DrawingAnchorVisitor),this.registerVisitor(`oneCellAnchor`,new $.DrawingAnchorVisitor),this.registerVisitor(`absoluteAnchor`,new $.DrawingAnchorVisitor),this.registerVisitor(`graphicFrame`,new $.DrawingGraphicFrameVisitor),this.registerVisitor(`sp`,new $.DrawingSpVisitor),this.registerVisitor(`grpSp`,new $.DrawingGrpSpVisitor),this.registerVisitor(`cxnSp`,new $.DrawingCxnSpVisitor),this.registerVisitor(`pic`,new $.DrawingPicVisitor),this.registerVisitor(`metadata`,new $.MetadataVisitor),this.registerVisitor(`FeaturePropertyBags`,new $.FeaturePropertyBagVisitor),this.registerVisitor(`comments`,new $.CommentsVisitor),this.registerVisitor(`comment`,new $.CommentVisitor),this.registerVisitor(`ThreadedComments`,new $.ThreadedCommentsVisitor),this.registerVisitor(`threadedComment`,new $.ThreadedCommentVisitor),this.registerVisitor(`threadedComment`,new $.TextPropertiesVisitor(`content`),`text`),this.registerVisitor(`personList`,new $.PersonListVisitor),this.registerVisitor(`slicerCacheDefinition`,new $.SlicerCacheDefinitionVisitor),this.registerVisitor(`slicers`,new $.SlicersVisitor),this.registerVisitor(`timelineCacheDefinition`,new $.SlicerCacheDefinitionVisitor),this.registerVisitor(`timelines`,new $.TimelinesVisitor),this.registerVisitor(`formControlPr`,new $.FormControlPrVisitor)}registerVisitor(e,t,n=null){e.indexOf(`:`)===-1&&(e=`*:`+e);let r=e.split(`:`),i=r.length>1?r[1]:r[0];if(!n)return this.visitorsByXmlTagName.set(i,t),void this.visitorsByXmlTagName.set(e,t);let a=this.scopedVisitorsByXmlTagName.get(i);a||(a=[],this.scopedVisitorsByXmlTagName.set(i,a),this.scopedVisitorsByXmlTagName.set(e,a)),a.push(new Ie(n,t))}parseDxf(t,n=``,r=e.EmptyObject){this.visitorParamsState||=new Map;let i=this.visitorParamsState,a=i.get(`processingDXFs`);i.set(`processingDXFs`,!0);try{let e=new z(null,this,`/dxf`,t,{},n,r),i={};return new $.SheetStyleVisitor().processDXF(e,t,i),i}finally{a===void 0?i.delete(`processingDXFs`):i.set(`processingDXFs`,a)}}getVisitorParamsState(){return this.visitorParamsState}transform(t,n,r=e.EmptyObject){let i=t.documentElement;this.visitorParamsState&&!r?.paramMap||(this.visitorParamsState=r?.paramMap??new Map);let a={},o=this.visitorsByXmlTagName.get(i.nodeName);if(o||=this.visitorsByXmlTagName.get(i.localName),!o)throw Error(`A visitor for the root element: '${i.nodeName}' or '${i.localName}' must be registered.`);let s=`/`+i.localName,c=new z(null,this,s,i,a,n,r),l=[];this._doWalk(o,c,l,i,a,n,r);let u=l.length;for(let e=0;e<u;e++){let t=l[e];try{t.visitor?.afterVisit?.(t.context,t.elemParent,t.jsonParent)}catch(e){t.context.warn(`Unable to finish reading '${t.context.getPath()}': ${e?.message??e}`,{onceKey:`xlsx.transform.afterVisit`})}}return a}_walkScoped(e,t,n,r,i,a,o){let s=this.scopedVisitorsByXmlTagName.get(e),c=s?s.length:0;for(let l=0;l<c;l++){let c=s[l],u=null;try{u=t.evaluate(c.path,r)}catch{t.warn(`Invalid path '${c.path}' for '${e}'.`,{onceKey:`xlsx.transform.invalidPath`})}if(!u)continue;let d=e=>{let s=e.localName,l=e.parentNode;for(;l&&l!==r;)s=l.localName+`/`+s,l=l.parentNode;let u=t.getPath()+`/`+s;if(c.visitor){let r=new z(t,this,u,t.getElemRoot(),t.getJsonRoot(),a,o);this._doWalk(c.visitor,r,n,e,i,a,o)}};if(u.length>0){let e=u,t=e.length;for(let n=0;n<t;n++)d(e.item(n))}else d(u)}}_doWalk(e,t,n,r,i,a,o){let s=null;e&&(n.push({visitor:e,context:t,elemParent:r,jsonParent:i}),s=e.visit(t,r,i)),s||=i;let c=r.localName;this._walkScoped(c,t,n,r,s,a,o);let l=this.visitorsByXmlTagName,u=t.getElemRoot(),d=t.getJsonRoot(),f=r.childNodes,p=f.length;for(let e=0;e<p;e++){let r=f.item(e);if(r.nodeType!==1)continue;let c=r,p=c.nodeName,m=l.get(p);m||=(p=c.localName,l.get(p));let h=t.getPath()+`/`+p,g=new z(t,this,h,u,d,a,o);this._doWalk(m,g,n,c,s??i,a,o)}return s}};export{Le as DOMTransformer,z as ExecutionContext,de as NumberUtils,F as VisitorUtils};