@sheetxl/mcp 1.0.0 → 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 (178) hide show
  1. package/assets/{CNikOloX_losH8Nz.js → 1d-8AAcf1UmC2qIz.js} +1 -1
  2. package/assets/{C3c2PUtIo-aWbjw4.js → 30KXHiLfwl0cbsxL.js} +1 -1
  3. package/assets/{8mWHFnE0j-CaNsxr.js → 3o7I8loKRGynHrNq.js} +1 -1
  4. package/assets/{C1JeIUEWW-RL1Rnu.js → 648qV0v861jvyZWm.js} +1 -1
  5. package/assets/{P3Or6rEY-fHmQZbH.js → 7khlPnFFCrE8gnT_.js} +13 -13
  6. package/assets/{ByGn4tk2SE1MH_sZ.js → 8hUUTZ62hbxY0TOp.js} +2 -2
  7. package/assets/{CwzSgovxnBMrgLmJ.js → B1Vm5y0E-TPSYFya.js} +3 -3
  8. package/assets/{CEa6wNiDRZrans9S.js → B6ToyMcYe9lyaeDk.js} +3 -3
  9. package/assets/{qVBjd-c5B8neljc0.js → B6pS096VwbWaj1Zz.js} +2 -2
  10. package/assets/{BrHXHm2FNXsL53bo.js → B9V6AFTTnbPscv11.js} +2 -2
  11. package/assets/{CF1fqmS030ry2XQ0.js → BESu-5sZSIJqkrWN.js} +2 -2
  12. package/assets/{B5rrqMYFybo3oW9k.js → BHhPtFpb3YfV6_44.js} +21 -21
  13. package/assets/{CpoqmW4E7rFdkRpf.js → BMAAmO8LPIe4VJ77.js} +1 -1
  14. package/assets/{C1IE0F-y65XqEYRl.js → BMVu89mdcVSqJDDE.js} +1 -1
  15. package/assets/{Da0CtWhc7saaOdER.js → BRB5-fXJFU7Kq2wm.js} +352 -352
  16. package/assets/BRI3D42tlMkZdYb2.js +199 -0
  17. package/assets/{DOXj80NXiglJXsMZ.js → BVzogMoyaicBEKBk.js} +3 -3
  18. package/assets/{PvRzzufo1V8BuC-I.js → BWpLQNKC3n8bXJUk.js} +1 -1
  19. package/assets/{CS07BBUu6ZtXk4TZ.js → Baa8cmJsilboM0DW.js} +1 -1
  20. package/assets/{O3m_QwxIRXMPFTB8.js → BcDNXTGASDvptqc-.js} +1 -1
  21. package/assets/{knMcDWv3xN7yJBTT.js → Bme_PT3UqwTbGLWd.js} +1 -1
  22. package/assets/{pLM8Pxl1CscUdvMh.js → BnxajOeIasx1G3OB.js} +1 -1
  23. package/assets/{CFqF3aUKvOGFOK9O.js → BousX61zAjBfjlsV.js} +1 -1
  24. package/assets/{DF9WfdyjHuCpsEXh.js → Bp73VL7f5DEt88Cn.js} +35 -35
  25. package/assets/{DRy0AcTiSKQY3bih.js → BppAvnmuJbbYBQUy.js} +1 -1
  26. package/assets/{j4zqu8S2Be_yum7W.js → BtoBfR_4n1u37HmC.js} +1 -1
  27. package/assets/{BF0C-5gSMHWBXI_k.js → BuLAeGM4AvHCge4x.js} +1 -1
  28. package/assets/{DWr6GqsnMpLwSUno.js → Buxo11Ux7uxzoy_7.js} +2 -2
  29. package/assets/{pfa2CH5NQuzku6FP.js → BwTF2TRqzXsf0H1I.js} +2 -2
  30. package/assets/{CfBJzpZuy1o216iZ.js → BzCwrG3Zdv-Trzi_.js} +1 -1
  31. package/assets/{BgHOi7rAHLhztiz-.js → C00qhh0-m0B0JP9Y.js} +166 -166
  32. package/assets/{jNZ7exipVCGRPbzr.js → C5VvbPUAfrVKmXXs.js} +1 -1
  33. package/assets/{BVfjBXAMgo4u8Y72.js → C85xBYGjAzNmVNwL.js} +1 -1
  34. package/assets/{Dbi1_JHT_4u0nhwc.js → C880pTyOMof_fzPO.js} +1 -1
  35. package/assets/{BBF_CDIKB2NIXiHg.js → C88UXFOnR1Uc-nw2.js} +1 -1
  36. package/assets/{CRZMD-wS-944FnD_.js → C8G6iJz_vsgbNYq9.js} +4 -4
  37. package/assets/{CoSNTR-pg7BZAU7o.js → CAQgJMpje7ORQ5lt.js} +1 -1
  38. package/assets/CBSyNN4Fk5WsVStK.js +14 -0
  39. package/assets/{CY3Lmr-fgs6NqXRp.js → CCeqR45x9p-GG8Pi.js} +1 -1
  40. package/assets/{BqH4txhrgR2S-2ji.js → CEDsCeYCSlY7wYe1.js} +2 -2
  41. package/assets/{DvHZEP1wpb6549uf.js → CFWHwEc3dKMmNzUp.js} +406 -406
  42. package/assets/{8114GVvAL1oaiJLV.js → CK9LWUZdZ93t3GkS.js} +1 -1
  43. package/assets/{BPlrBhzIqyWK19E2.js → CL-BRusnISEAzebz.js} +606 -606
  44. package/assets/{Bfpf9b1s1bWyBXIw.js → CLvFlk5-KU2jnQ5r.js} +1 -1
  45. package/assets/{CX-LNahzNZRc78er.js → CUhCIQjymULgXquN.js} +1 -1
  46. package/assets/{BKGTzaNNBlRh7ua3.js → CboWvqCV0yix3-yP.js} +1 -1
  47. package/assets/{cl0C9YlF3Ds-lHps.js → Ci4AUhBajQMJs1Ty.js} +1 -1
  48. package/assets/{rlgXnCh6A88ozBRz.js → CkQT1G_6bvMixZ8e.js} +4 -4
  49. package/assets/{rzi2XAwlfy8BsGEa.js → CkqsYktaMF9p014y.js} +1 -1
  50. package/assets/{BuFb0lPxYlHccrD9.js → CkuL4Ed6oRGAhIS9.js} +1 -1
  51. package/assets/{Ban4yk1SYcz9Cs7n.js → Cm41HVr6Xyz53jHz.js} +1 -1
  52. package/assets/{BfB7Vq09p5uO-L88.js → CoY2sE2RG-Nd8TMR.js} +1 -1
  53. package/assets/{Cwe_kiigxAfceEK9.js → CuRvGO_2tG0PUhCM.js} +1 -1
  54. package/assets/{Dcw7GSCgw_dgsum7.js → CvqpsTll6ngbdHgx.js} +8672 -8642
  55. package/assets/{B3J6davzttys1e7l.js → Cvs9i2VUl7wXWZup.js} +3 -3
  56. package/assets/{DlARYdaCOVKiQzMH.js → Cy2uazuc6KpkbYg-.js} +1 -1
  57. package/assets/{2c1OYsVAy_w-ex-F.js → CybNjXi6cOFKyGuH.js} +1 -1
  58. package/assets/{BBZUslaSLC0vlZEb.js → CzPMiqbNDm6TDPGJ.js} +1 -1
  59. package/assets/{BBLuTiY3V4MpFphK.js → CzYXLEVIoCfQ1AMM.js} +193 -193
  60. package/assets/{BoE9cj92LVH2LLy0.js → D-BWtxIGXTCMLoio.js} +2 -2
  61. package/assets/{CRlLpD9cfhJ9Ov9L.js → D0Ly34TqieVSOIbh.js} +1 -1
  62. package/assets/{BloJ-e8xad1b_H7X.js → D0M0EWP28g5rQaei.js} +3 -3
  63. package/assets/{WC-THJfezYSFdiMF.js → D4NBYfzSZ3cU-3ao.js} +1 -1
  64. package/assets/{13QanvzRbNib7VHR.js → D4NcXlPRmR6NaoGS.js} +1 -1
  65. package/assets/{CDDtXZTG6nNFBQZP.js → D4jXxO1LUEQ6erA9.js} +1 -1
  66. package/assets/{CMd7aLIwOA7bxcZm.js → DAx-VOBmi1xAMhhX.js} +98 -98
  67. package/assets/{8hLtXHueDl7B_SEn.js → DBcXAdUaNGrlah12.js} +15 -15
  68. package/assets/{C8zzCf71C976X7SG.js → DFdAxnoXGn_8ge3l.js} +2 -2
  69. package/assets/{DZxHk5oKIVvu3iJR.js → DFjfZCMPfQfwC4cF.js} +580 -580
  70. package/assets/{YK80feN98r6GVZv5.js → DG0Dzgf1kAxN3AIk.js} +1 -1
  71. package/assets/{DQtnL5nOzSzVJhit.js → DGv-dTePYQ8_yif4.js} +42 -42
  72. package/assets/{gf6l-4XXMXtq8hpJ.js → DIaD0BL0JLTaJTS3.js} +5 -5
  73. package/assets/{CICMJpasl9o4FaZi.js → DIimDQiJDW-4lkZT.js} +1 -1
  74. package/assets/{CbkCnjWs7Fpj5iQY.js → DK8DWNMTOmCg6zAI.js} +8 -8
  75. package/assets/{q6advQx4x6PXvl0i.js → DKox8guOumZMOdq8.js} +37 -37
  76. package/assets/{DQ2vEDfVfsIGSmId.js → DMHiZKWwm6puHV6p.js} +1 -1
  77. package/assets/{CsPyLus3kh4QnahD.js → DMyq3L2ibjMlHuDa.js} +1 -1
  78. package/assets/{0WuReGsjIpidu0Cr.js → DOKXQpGyzXCoSLdJ.js} +1 -1
  79. package/assets/{ybnQoU8_KttlHjiy.js → DOXriXo-7WmTAKbN.js} +1 -1
  80. package/assets/{Sm1ouHLiXlCuQVKV.js → DRfsB4kS28fPXv6K.js} +96 -96
  81. package/assets/{BaZAIwIrqn1x69WH.js → DSmARJ0owmwmr2FA.js} +2 -2
  82. package/assets/{BlMUrEA8V2S2KH0D.js → DUM6h3BEreCilg32.js} +1 -1
  83. package/assets/{Bm-wDNSoT-3JD2bJ.js → DXp5V2__VY2opctz.js} +1 -1
  84. package/assets/{eExV3IoVMxYkv5GO.js → D_YBc6vHBL-ajwvB.js} +1 -1
  85. package/assets/{G489eYf-lt3D1riX.js → Dc8BQsPlwN6i6OU7.js} +1 -1
  86. package/assets/{BCdXK-2-AE6FAdRs.js → DcnNIdrilJHfl_CQ.js} +1 -1
  87. package/assets/{xGASRbzSVVKfEAh-.js → DdIufax_qSuWVGQK.js} +2 -2
  88. package/assets/{CCS6r_ru_-bq12nu.js → DeNqXaM_dHSswRuE.js} +1 -1
  89. package/assets/{BB39UJoWw8tjThqY.js → DfVHW5vbnRNXHrCi.js} +1 -1
  90. package/assets/{ov7L79VlksT4fw7T.js → Dfc9_XsqSeh48YeK.js} +11 -11
  91. package/assets/{CdbucPAmUkkc5pcM.js → DiXodb_hLvUDIGb6.js} +29 -29
  92. package/assets/{B-b7HyruDF2gdj3R.js → Dn531BWCDZ2noJix.js} +2 -2
  93. package/assets/{BfEmSaLbKgcjIIpn.js → DnAuLAqQLmAf9Gls.js} +2 -2
  94. package/assets/{BhxIJ8xdUxyMPJ_m.js → Do8K2GlFXIiMX9TB.js} +1 -1
  95. package/assets/{BTamKr78GfsihW1a.js → Dt8hWBnnqlpJOazW.js} +96 -96
  96. package/assets/{Dst0tyK__q2Q_AKk.js → DuBbSpdXZuAFvxpr.js} +1 -1
  97. package/assets/{DzYvbv5u7E2H7IoB.js → DvAq2cPI7-lfSn0x.js} +1 -1
  98. package/assets/{CI8Pu3ko8VzQYdRD.js → DzCZGtlg3pJO91l9.js} +1 -1
  99. package/assets/{B3lrS_GHkG6Mw5pN.js → DzRBnJpz972o277m.js} +1 -1
  100. package/assets/{g3TrQtFS0qJZeshT.js → EohzUi0uCnSF2q2D.js} +264 -264
  101. package/assets/{DXrX5tIZ1J5BhpFk.js → KSagTSkIvZSpUF1c.js} +4 -4
  102. package/assets/{DngX5ZuqqFGTp44B.js → LOFAyr5OoT3oZGMV.js} +1 -1
  103. package/assets/{DfuY8GdoSk8LxDFW.js → LbZNDu6C9XPMEXCN.js} +5 -5
  104. package/assets/{D31pY9r4JAFWw3E4.js → NwtEz6ZaVT8p8wOh.js} +1 -1
  105. package/assets/{hiKRbrdbpmJglbWC.js → PD_i17-cebq3-_Gn.js} +3 -3
  106. package/assets/{C2sDVxKGBNlTFg6y.js → Q-BvS_P_qM8EvP92.js} +1 -1
  107. package/assets/{C4C3Ot0xeo1O0wm5.js → YRKAYjRpPkjhxGSS.js} +1 -1
  108. package/assets/{C30apcFVvDHn2M4R.js → _-kNP8Q4FxBYPY4u.js} +4 -4
  109. package/assets/{BgN67gyTyx_xz2Ny.js → aEDyynzUuzMysLwT.js} +6 -6
  110. package/assets/{kThU6e6dkzEoaK6n.js → cTnKNFayqlXisspN.js} +2 -2
  111. package/assets/{DpwdC4SN_VYB9_ho.js → eEh1r_BS7Y0FXPqk.js} +1 -1
  112. package/assets/{CJoREr6-3iOl7iU_.js → g4vz4gc43eat7Hd2.js} +1 -1
  113. package/assets/{BR4Wpxs0eSlaoLOl.js → jUzhn1PeDLWXOuJO.js} +14 -14
  114. package/assets/{L42Y17f0HUEpfS6U.js → kIzQWtiHNHvh8HLF.js} +1 -1
  115. package/assets/{CJcyMzG19TOjqNHS.js → mIM-JksHd3Zl5INF.js} +1 -1
  116. package/assets/{BTB4fa2DU21pP7At.js → mirSoZ8QDsYUMjYu.js} +1 -1
  117. package/assets/{DOIpXsEXCaI-8VwJ.js → ooSNLnHLIYTBL5JD.js} +1 -1
  118. package/assets/{DRcmbp80jMRjxelW.js → tp75fiKc1r-jdPPN.js} +1 -1
  119. package/assets/{PAzPVx_0jajb_7cO.js → xltGcIbWkjqNtCty.js} +2 -2
  120. package/assets/{Cs1df4D35bBjqyvX.js → zbOvcGIPi-MDlJKE.js} +1 -1
  121. package/index.js +92 -92
  122. package/lib.js +1 -1
  123. package/licenses/dependencies.txt +66 -66
  124. package/package.json +17 -2
  125. package/screenshot-page/assets/{Da_VIghRFdNrmfZT.js → 37HIsN_8LEsOWyOO.js} +1 -1
  126. package/screenshot-page/assets/{DaqAdr-mtpVZMOS8.js → 4I9gFq1IdumstDHq.js} +2 -2
  127. package/screenshot-page/assets/{BrEXXxB9tAI5mmZP.js → 6j6xGn4csAcfcFMQ.js} +1 -1
  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/{d8BvDCByceUNvHp7.js → B6i6Xi9OafEvNRAm.js} +2 -2
  132. package/screenshot-page/assets/B7uNU6WWjJaco6ho.js +1 -0
  133. package/screenshot-page/assets/BGoGxqwlpgXt8CMd.js +4 -0
  134. package/screenshot-page/assets/{0P0DnZolMnjPhiea.js → BXss42mPBQnnt0Rh.js} +1 -1
  135. package/screenshot-page/assets/{CJAgr6wyQGYAd3ZV.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/{BwYQTcPRDDYIeAA5.js → BqJRJVrx7XkIPgo7.js} +6 -6
  139. package/screenshot-page/assets/{CX-ITg5RXdV2cefd.js → C-qNpEaGV5amWPml.js} +5 -5
  140. package/screenshot-page/assets/{BOF6KOmT8mH_NQnA.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/{DOsZiE9rOdS_Mm2Q.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/{Cg9eIWL8fPmeZFHG.js → Cyu6g5rRtEGOHaQS.js} +4 -4
  148. package/screenshot-page/assets/{CL_hAngRQwm_KGdR.js → D1KqgZwk5MjDhk5i.js} +1 -1
  149. package/screenshot-page/assets/{QVGvXAvlw1c8vZjy.js → DGr8M07ioDfKXLHD.js} +3 -3
  150. package/screenshot-page/assets/{BAzHRU12l2vyyXq-.js → DMbhlzvflyxF5Clt.js} +4 -4
  151. package/screenshot-page/assets/{BzI5CCx73aXausKb.js → DQxI7bShZ7TKpL0V.js} +8 -8
  152. package/screenshot-page/assets/{BpJaTpbR_CQzXj9M.js → DSB_SKy2lKI_VGik.js} +1 -1
  153. package/screenshot-page/assets/{jFfcyGJ9xruiOUyS.js → DWkISZdhmV2PBk-k.js} +1 -1
  154. package/screenshot-page/assets/{BhHceo22V3IBfap0.js → DfmEx82r_NbillHk.js} +1 -1
  155. package/screenshot-page/assets/{Cq1EzIAt4dHBkzfP.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/{CGNsyKbDXXz9qMa2.js → PRYQO22Y2LgMUg77.js} +1 -1
  160. package/screenshot-page/assets/{CZaKvnrRdlLj1_X8.js → RHcyaEfxJB7O3alo.js} +1 -1
  161. package/screenshot-page/assets/{-HdF7KAN8PKqrASL.js → TA9YjsgX-_8fRRdZ.js} +1 -1
  162. package/screenshot-page/assets/{ByyC3p23DsLAbUpr.js → cUY9GpQPVTLSprfW.js} +1 -1
  163. package/screenshot-page/assets/{Bne-AygyF1USkPAy.js → m48xmzGgNgwXSEgQ.js} +1 -1
  164. package/screenshot-page/assets/{DhnaoxNYwMobAVP6.js → mVfCz3bXIjqEVPEo.js} +1 -1
  165. package/screenshot-page/assets/{B-E9Dzx1wh9RA2yC.js → putBhJCWgRos_Fmk.js} +1 -1
  166. package/screenshot-page/assets/{BfkbiKKbYlPpRZqZ.js → uyInkZWFnMwX-BSC.js} +1 -1
  167. package/screenshot-page/assets/{CAKBmg6tXRtjEWgb.js → xiJthTXsasYVOHWE.js} +2 -2
  168. package/screenshot-page/index.html +8 -8
  169. package/assets/BOa1dD_9H3g65WbP.js +0 -14
  170. package/assets/DCWHNfq5qCxvALwe.js +0 -199
  171. package/screenshot-page/assets/B39YZkEvc1U8ZQ8H.js +0 -2
  172. package/screenshot-page/assets/B8Dy_WA9RlWuvMqF.js +0 -4
  173. package/screenshot-page/assets/CGZYePkVGI5DPBBY.js +0 -1
  174. package/screenshot-page/assets/CWA4xGjOeBuxJOzW.js +0 -3
  175. package/screenshot-page/assets/D2TibFqUBAPLcu_2.js +0 -1
  176. package/screenshot-page/assets/DEy3e1rY-XMdI309.js +0 -1
  177. package/screenshot-page/assets/eR9_DaySoB72PvMo.js +0 -1
  178. package/screenshot-page/assets/hHvAGynpTvAb97GX.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./CbXtAM7H-Jg_J0dk.js";import{i as t,t as n}from"./gU2zeJaXoNh7QI_e.js";import{n as r}from"./CQ-33-es3XJ56pR4.js";import{t as i}from"./Bdb0azxGoCh6NBDk.js";import{Z as a}from"./D4RZZdlItfrgQHcE.js";import{L as o,R as s,q as c}from"./DJebrQ5mu8uxpX3b.js";import{n as l,r as u,t as d}from"./BowRIybLgENunTOT.js";import{I as f}from"./COL9dj40ytErlGak.js";var p=e(t(),1),m=n(),h=()=>(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:14,height:14,"aria-hidden":!0,children:[(0,m.jsx)(`path`,{d:`M1.5 2.5h10l-4 5v5l-2 1v-6z`,fill:`none`,stroke:`currentColor`,strokeWidth:1.2,strokeLinejoin:`round`}),(0,m.jsx)(`path`,{d:`M10.5 10l4 4M14.5 10l-4 4`,stroke:`currentColor`,strokeWidth:1.2})]}),g=()=>(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:14,height:14,"aria-hidden":!0,children:[(0,m.jsx)(`path`,{d:`M1.5 3.5l1.5 1.5 2.5-3M1.5 10.5l1.5 1.5 2.5-3`,fill:`none`,stroke:`currentColor`,strokeWidth:1.2}),(0,m.jsx)(`path`,{d:`M8 4h7M8 11h7`,stroke:`currentColor`,strokeWidth:1.2})]}),_=e=>({borderLeft:e,borderRight:e,borderTop:e,borderBottom:e}),v=e=>{let t=e?.getTheme().getFontScheme().getMinorFont();return{fontFamily:f.toCSSFontFamily(t??``,[`sans-serif`]),fontSize:`11pt`}},y=(0,p.memo)((0,p.forwardRef)((e,t)=>{let{children:n,disabled:a,style:f,slicer:y,movable:b,zoom:x=1,isDragging:S,onHide:ee,onShow:te,onDragZone:C,onTap:ne,adornmentHost:w,flip:re,gesture:ie,...T}=e,E=s(),D=o(),O=(i()??y.getTable()?.getWorksheet()??null)?.getStyles()??null,[k,A]=(0,p.useReducer)(e=>e+1,0);r(y,{onAnyChange:A,onReferencesChange:A}),(0,p.useEffect)(()=>O?.addListeners({onAnyChange:A}),[O]);let[j,M]=(0,p.useState)([]);(0,p.useEffect)(()=>{let e=!0;if(!y.isDeleted())return y.getItems().then(t=>{e&&M(t)}).catch(()=>{e&&M([])}),()=>{e=!1}},[y,k]);let[N,P]=(0,p.useState)(!1),[F,I]=(0,p.useState)(null),L=(0,p.useRef)(null),R=(0,p.useRef)(null),z=(0,p.useRef)(null),[B,V]=(0,p.useState)(!1);(0,p.useLayoutEffect)(()=>{let e=z.current;if(!e)return;let t=()=>V(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[j,y.getRowHeight(),y.getColumnCount(),y.isShowCaption()]),(0,p.useLayoutEffect)(()=>{C?.(e=>{let t=e.target;return!t||!z.current?.contains(t)&&!t.closest?.(`button`)})},[C]);let H=(0,p.useRef)(!1),U=y.getColumnCount(),W=y.getRowHeight();(0,p.useLayoutEffect)(()=>{if(H.current||j.length===0||!z.current)return;H.current=!0;let e=y.toJSON()?.startItem??0;e>0&&(z.current.scrollTop=Math.floor(e/U)*(W+4))},[j,U,W]);let G=(0,p.useCallback)(e=>{y.selectItems(e).catch(e=>D.showError(e))},[y,D]),K=(0,p.useCallback)((e,t)=>{if(a)return;let n=j.map(e=>e.key),r=y.isFilterCleared()?[]:j.filter(e=>e.isSelected).map(e=>e.key),i=L.current;if(t.shiftKey&&i!==null&&n.includes(i)){let a=n.indexOf(i),o=n.indexOf(e.key),s=n.slice(Math.min(a,o),Math.max(a,o)+1);G(t.ctrlKey||t.metaKey?[...new Set([...r,...s])]:s)}else L.current=e.key,t.ctrlKey||t.metaKey||N?r.length===0?G([e.key]):r.includes(e.key)?G(r.filter(t=>t!==e.key)):G([...r,e.key]):G([e.key])},[y,j,N,a,G]),q=c(t,()=>({isSlicerEditor:()=>!0}),[]),J=u(y.getStyle(),O),Y=(0,p.useMemo)(()=>l(J?.wholeTable,O),[J,O,k]),X=(0,p.useMemo)(()=>l(J?.headerRow,O),[J,O,k]);if(y.isDeleted())return null;let Z=y.isFilterCleared(),Q=y.isShowCaption(),$={display:`flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,padding:0,margin:0,border:`1px solid transparent`,borderRadius:2,background:`none`,color:`inherit`,cursor:`pointer`};return(0,m.jsxs)(`div`,{className:`sxl-slicer-editor`,...T,ref:q,style:{width:`100%`,height:`100%`,zoom:x,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,position:`relative`,background:`var(--sxl-color-base-100, white)`,..._(`var(--sxl-color-neutral, grey) solid 1px`),...v(O),...Y,filter:a?`blur(1px)`:void 0,boxShadow:S?`1px 1px 2px var(--sxl-color-shadow, rgba(0,0,0,.15))`:void 0,...f},children:[Q?(0,m.jsxs)(`div`,{ref:R,className:`sxl-slicer-caption`,style:{display:`flex`,alignItems:`center`,gap:2,margin:`0 9px`,padding:`6px 0 4px 0`,flex:`none`,...X},children:[(0,m.jsx)(`span`,{style:{flex:`1 1 auto`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:y.getCaption()}),(0,m.jsx)(`button`,{type:`button`,className:`sxl-slicer-multi-select`,tabIndex:-1,title:E(`slicer.multiSelect`),"aria-label":E(`slicer.multiSelect`),"aria-pressed":N,style:{...$,borderColor:N?`var(--sxl-color-neutral, grey)`:`transparent`,backgroundColor:N?`var(--sxl-color-base-200, #eee)`:`transparent`},onClick:()=>P(e=>!e),children:(0,m.jsx)(g,{})}),(0,m.jsx)(`button`,{type:`button`,className:`sxl-slicer-clear`,tabIndex:-1,title:E(`slicer.clearFilter`),"aria-label":E(`slicer.clearFilter`),disabled:Z||a,style:{...$,opacity:Z?.4:1,cursor:Z?`default`:`pointer`},onClick:()=>{y.clearFilters().catch(e=>D.showError(e))},children:(0,m.jsx)(h,{})})]}):null,(0,m.jsx)(`div`,{ref:z,className:`sxl-slicer-items`,role:`listbox`,"aria-multiselectable":!0,"aria-label":y.getCaption(),style:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`,overflowX:`hidden`,overscrollBehavior:`contain`,"--scrollbar-width":`8px`,"--scrollbar-border-width":`1px`,display:`grid`,gridTemplateColumns:`repeat(${U}, minmax(0, 1fr))`,gridAutoRows:`${W}px`,alignContent:`start`,gap:4,margin:(Q?4:9)+`px 9px 9px 9px`,paddingRight:B?3:0},onPointerLeave:()=>I(null),children:j.map(e=>{let t=d(e.isSelected,e.hasData,F===e.key);return(0,m.jsx)(`div`,{className:`sxl-slicer-item`,role:`option`,"aria-selected":e.isSelected,"data-key":e.key,"data-has-data":e.hasData||void 0,title:e.name,style:{boxSizing:`border-box`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0 4px`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,userSelect:`none`,cursor:a?void 0:`pointer`,..._(`1px solid transparent`),...l(J?.[t],O)},onPointerEnter:()=>I(e.key),onPointerDown:e=>{e.button===0&&(e.stopPropagation(),e.preventDefault(),b&&!b.isSelected()&&b.select())},onClick:t=>K(e,t),children:(0,m.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:e.name})},e.key)})})]})}));y.displayName=`SlicerEditor`;var b={renderer:e=>(0,m.jsx)(y,{...e,slicer:e.movable.getContent()}),commands:(e,t)=>{let{sheet:n,movable:r}=t,i=r.getContent(),o=()=>({slicer:()=>i,styles:()=>n.getStyles()}),s=()=>{e.updateCommand(`formatSlicerStyle`,{callback:e=>{e&&i.setStyle(e)},state:i.getStyle(),context:o,disabledReasons:i.isReadOnly()?[a(`reason.sheetProtected`)]:[]})};return s(),i.addListeners({onAnyChange:s})}};export{b as SlicerKind};
1
+ import{n as e}from"./CbXtAM7H-Jg_J0dk.js";import{i as t,t as n}from"./gU2zeJaXoNh7QI_e.js";import{n as r}from"./CQ-33-es3XJ56pR4.js";import{t as i}from"./Bdb0azxGoCh6NBDk.js";import{Z as a}from"./D4RZZdlItfrgQHcE.js";import{L as o,R as s,q as c}from"./DwHci99xcnRTEcv5.js";import{n as l,r as u,t as d}from"./BowRIybLgENunTOT.js";import{I as f}from"./COL9dj40ytErlGak.js";var p=e(t(),1),m=n(),h=()=>(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:14,height:14,"aria-hidden":!0,children:[(0,m.jsx)(`path`,{d:`M1.5 2.5h10l-4 5v5l-2 1v-6z`,fill:`none`,stroke:`currentColor`,strokeWidth:1.2,strokeLinejoin:`round`}),(0,m.jsx)(`path`,{d:`M10.5 10l4 4M14.5 10l-4 4`,stroke:`currentColor`,strokeWidth:1.2})]}),g=()=>(0,m.jsxs)(`svg`,{viewBox:`0 0 16 16`,width:14,height:14,"aria-hidden":!0,children:[(0,m.jsx)(`path`,{d:`M1.5 3.5l1.5 1.5 2.5-3M1.5 10.5l1.5 1.5 2.5-3`,fill:`none`,stroke:`currentColor`,strokeWidth:1.2}),(0,m.jsx)(`path`,{d:`M8 4h7M8 11h7`,stroke:`currentColor`,strokeWidth:1.2})]}),_=e=>({borderLeft:e,borderRight:e,borderTop:e,borderBottom:e}),v=e=>{let t=e?.getTheme().getFontScheme().getMinorFont();return{fontFamily:f.toCSSFontFamily(t??``,[`sans-serif`]),fontSize:`11pt`}},y=(0,p.memo)((0,p.forwardRef)((e,t)=>{let{children:n,disabled:a,style:f,slicer:y,movable:b,zoom:x=1,isDragging:S,onHide:ee,onShow:te,onDragZone:C,onTap:ne,adornmentHost:w,flip:re,gesture:ie,...T}=e,E=s(),D=o(),O=(i()??y.getTable()?.getWorksheet()??null)?.getStyles()??null,[k,A]=(0,p.useReducer)(e=>e+1,0);r(y,{onAnyChange:A,onReferencesChange:A}),(0,p.useEffect)(()=>O?.addListeners({onAnyChange:A}),[O]);let[j,M]=(0,p.useState)([]);(0,p.useEffect)(()=>{let e=!0;if(!y.isDeleted())return y.getItems().then(t=>{e&&M(t)}).catch(()=>{e&&M([])}),()=>{e=!1}},[y,k]);let[N,P]=(0,p.useState)(!1),[F,I]=(0,p.useState)(null),L=(0,p.useRef)(null),R=(0,p.useRef)(null),z=(0,p.useRef)(null),[B,V]=(0,p.useState)(!1);(0,p.useLayoutEffect)(()=>{let e=z.current;if(!e)return;let t=()=>V(e.scrollHeight>e.clientHeight);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[j,y.getRowHeight(),y.getColumnCount(),y.isShowCaption()]),(0,p.useLayoutEffect)(()=>{C?.(e=>{let t=e.target;return!t||!z.current?.contains(t)&&!t.closest?.(`button`)})},[C]);let H=(0,p.useRef)(!1),U=y.getColumnCount(),W=y.getRowHeight();(0,p.useLayoutEffect)(()=>{if(H.current||j.length===0||!z.current)return;H.current=!0;let e=y.toJSON()?.startItem??0;e>0&&(z.current.scrollTop=Math.floor(e/U)*(W+4))},[j,U,W]);let G=(0,p.useCallback)(e=>{y.selectItems(e).catch(e=>D.showError(e))},[y,D]),K=(0,p.useCallback)((e,t)=>{if(a)return;let n=j.map(e=>e.key),r=y.isFilterCleared()?[]:j.filter(e=>e.isSelected).map(e=>e.key),i=L.current;if(t.shiftKey&&i!==null&&n.includes(i)){let a=n.indexOf(i),o=n.indexOf(e.key),s=n.slice(Math.min(a,o),Math.max(a,o)+1);G(t.ctrlKey||t.metaKey?[...new Set([...r,...s])]:s)}else L.current=e.key,t.ctrlKey||t.metaKey||N?r.length===0?G([e.key]):r.includes(e.key)?G(r.filter(t=>t!==e.key)):G([...r,e.key]):G([e.key])},[y,j,N,a,G]),q=c(t,()=>({isSlicerEditor:()=>!0}),[]),J=u(y.getStyle(),O),Y=(0,p.useMemo)(()=>l(J?.wholeTable,O),[J,O,k]),X=(0,p.useMemo)(()=>l(J?.headerRow,O),[J,O,k]);if(y.isDeleted())return null;let Z=y.isFilterCleared(),Q=y.isShowCaption(),$={display:`flex`,alignItems:`center`,justifyContent:`center`,width:22,height:22,padding:0,margin:0,border:`1px solid transparent`,borderRadius:2,background:`none`,color:`inherit`,cursor:`pointer`};return(0,m.jsxs)(`div`,{className:`sxl-slicer-editor`,...T,ref:q,style:{width:`100%`,height:`100%`,zoom:x,boxSizing:`border-box`,display:`flex`,flexDirection:`column`,overflow:`hidden`,position:`relative`,background:`var(--sxl-color-base-100, white)`,..._(`var(--sxl-color-neutral, grey) solid 1px`),...v(O),...Y,filter:a?`blur(1px)`:void 0,boxShadow:S?`1px 1px 2px var(--sxl-color-shadow, rgba(0,0,0,.15))`:void 0,...f},children:[Q?(0,m.jsxs)(`div`,{ref:R,className:`sxl-slicer-caption`,style:{display:`flex`,alignItems:`center`,gap:2,margin:`0 9px`,padding:`6px 0 4px 0`,flex:`none`,...X},children:[(0,m.jsx)(`span`,{style:{flex:`1 1 auto`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:y.getCaption()}),(0,m.jsx)(`button`,{type:`button`,className:`sxl-slicer-multi-select`,tabIndex:-1,title:E(`slicer.multiSelect`),"aria-label":E(`slicer.multiSelect`),"aria-pressed":N,style:{...$,borderColor:N?`var(--sxl-color-neutral, grey)`:`transparent`,backgroundColor:N?`var(--sxl-color-base-200, #eee)`:`transparent`},onClick:()=>P(e=>!e),children:(0,m.jsx)(g,{})}),(0,m.jsx)(`button`,{type:`button`,className:`sxl-slicer-clear`,tabIndex:-1,title:E(`slicer.clearFilter`),"aria-label":E(`slicer.clearFilter`),disabled:Z||a,style:{...$,opacity:Z?.4:1,cursor:Z?`default`:`pointer`},onClick:()=>{y.clearFilters().catch(e=>D.showError(e))},children:(0,m.jsx)(h,{})})]}):null,(0,m.jsx)(`div`,{ref:z,className:`sxl-slicer-items`,role:`listbox`,"aria-multiselectable":!0,"aria-label":y.getCaption(),style:{flex:`1 1 auto`,minHeight:0,overflowY:`auto`,overflowX:`hidden`,overscrollBehavior:`contain`,"--scrollbar-width":`8px`,"--scrollbar-border-width":`1px`,display:`grid`,gridTemplateColumns:`repeat(${U}, minmax(0, 1fr))`,gridAutoRows:`${W}px`,alignContent:`start`,gap:4,margin:(Q?4:9)+`px 9px 9px 9px`,paddingRight:B?3:0},onPointerLeave:()=>I(null),children:j.map(e=>{let t=d(e.isSelected,e.hasData,F===e.key);return(0,m.jsx)(`div`,{className:`sxl-slicer-item`,role:`option`,"aria-selected":e.isSelected,"data-key":e.key,"data-has-data":e.hasData||void 0,title:e.name,style:{boxSizing:`border-box`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0 4px`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,userSelect:`none`,cursor:a?void 0:`pointer`,..._(`1px solid transparent`),...l(J?.[t],O)},onPointerEnter:()=>I(e.key),onPointerDown:e=>{e.button===0&&(e.stopPropagation(),e.preventDefault(),b&&!b.isSelected()&&b.select())},onClick:t=>K(e,t),children:(0,m.jsx)(`span`,{style:{overflow:`hidden`,textOverflow:`ellipsis`},children:e.name})},e.key)})})]})}));y.displayName=`SlicerEditor`;var b={renderer:e=>(0,m.jsx)(y,{...e,slicer:e.movable.getContent()}),commands:(e,t)=>{let{sheet:n,movable:r}=t,i=r.getContent(),o=()=>({slicer:()=>i,styles:()=>n.getStyles()}),s=()=>{e.updateCommand(`formatSlicerStyle`,{callback:e=>{e&&i.setStyle(e)},state:i.getStyle(),context:o,disabledReasons:i.isReadOnly()?[a(`reason.sheetProtected`)]:[]})};return s(),i.addListeners({onAnyChange:s})}};export{b as SlicerKind};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./CQukCzhuewMuFOlO.js";import{Cr as t,Fa as n,Fr as r,Gi as i,Ii as a,Ln as o,Mt as s,Oi as c,Ot as l,Si as u,Ut as d,W as f,Wn as p,Xt as m,Yn as h,ar as g,ci as _,dr as v,ea as y,fi as b,gt as ee,k as x,kr as S,l as te,lt as C,m as w,mn as T,o as ne,qr as re,rn as E}from"./BwYQTcPRDDYIeAA5.js";function D(e){console&&console.error&&console.error(`Error: ${e}`)}function O(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function ie(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function ae(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 V=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 se(e,t=[]){return e instanceof N||e instanceof I||e instanceof L||(e instanceof R?e.definition.some(e=>se(e,t)):!(e instanceof A&&t.includes(e))&&e instanceof k&&(e instanceof A&&t.push(e),e.definition.every(e=>se(e,t))))}function H(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 ce=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=le(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=le(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 le(e,t,n){return[new N({definition:[new z({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function ue(e){if(e instanceof A)return ue(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=se(r),t=t.concat(ue(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=>ue(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var de=`_~IN~_`,fe=class extends ce{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+de+this.topProd.name);var i,a;let o=ue(new M({definition:t.concat(n)}));this.follows[r]=o}};function U(e){return e.charCodeAt(0)}function pe(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function W(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function G(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function me(){throw Error(`Internal Error - Should never get here!`)}function he(e){return e.type===`Character`}var ge=[];for(let e=U(`0`);e<=U(`9`);e++)ge.push(e);var _e=[U(`_`)].concat(ge);for(let e=U(`a`);e<=U(`z`);e++)_e.push(e);for(let e=U(`A`);e<=U(`Z`);e++)_e.push(e);var ve=[U(` `),U(`\f`),U(`
1
+ import{i as e}from"./CQukCzhuewMuFOlO.js";import{Cr as t,Fa as n,Fr as r,Gi as i,Ii as a,Jn as o,Ln as s,Mt as c,Oi as l,Ot as u,Si as d,Un as f,Ut as p,W as m,Xt as h,ar as g,ci as _,dr as v,ea as y,fi as b,gt as ee,k as x,kr as S,l as te,lt as C,m as w,nn as ne,o as re,pn as T,qr as E}from"./BqJRJVrx7XkIPgo7.js";function D(e){console&&console.error&&console.error(`Error: ${e}`)}function O(e){console&&console.warn&&console.warn(`Warning: ${e}`)}function ie(e){let t=new Date().getTime(),n=e();return{time:new Date().getTime()-t,value:n}}function ae(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 V=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 se(e,t=[]){return e instanceof N||e instanceof I||e instanceof L||(e instanceof R?e.definition.some(e=>se(e,t)):!(e instanceof A&&t.includes(e))&&e instanceof k&&(e instanceof A&&t.push(e),e.definition.every(e=>se(e,t))))}function H(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 ce=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=le(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=le(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 le(e,t,n){return[new N({definition:[new z({terminalType:e.separator})].concat(e.definition)})].concat(t,n)}function ue(e){if(e instanceof A)return ue(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=se(r),t=t.concat(ue(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=>ue(e));return[...new Set(t.flat())]}(e);throw Error(`non exhaustive match`)}var de=`_~IN~_`,fe=class extends ce{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+de+this.topProd.name);var i,a;let o=ue(new M({definition:t.concat(n)}));this.follows[r]=o}};function U(e){return e.charCodeAt(0)}function pe(e,t){Array.isArray(e)?e.forEach(function(e){t.push(e)}):t.push(e)}function W(e,t){if(!0===e[t])throw`duplicate flag `+t;e[t],e[t]=!0}function G(e){if(e===void 0)throw Error(`Internal Error - Should never get here!`);return!0}function me(){throw Error(`Internal Error - Should never get here!`)}function he(e){return e.type===`Character`}var ge=[];for(let e=U(`0`);e<=U(`9`);e++)ge.push(e);var _e=[U(`_`)].concat(ge);for(let e=U(`a`);e<=U(`z`);e++)_e.push(e);for(let e=U(`A`);e<=U(`Z`);e++)_e.push(e);var ve=[U(` `),U(`\f`),U(`
2
2
  `),U(`\r`),U(` `),U(`\v`),U(` `),U(`\xA0`),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(` `),U(`\u2028`),U(`\u2029`),U(` `),U(` `),U(` `),U(``)],ye=/[0-9a-fA-F]/,be=/[0-9]/,xe=/[1-9]/,Se=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){}},Ce={},we=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`:W(n,`global`);break;case`i`:W(n,`ignoreCase`);break;case`m`:W(n,`multiLine`);break;case`u`:W(n,`unicode`);break;case`y`:W(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`}}G(t);let n=this.disjunction();return this.consumeChar(`)`),{type:t,value:n,loc:this.loc(e)}}return me()}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;G(t)}if(!0!==e||t!==void 0)return G(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()),G(e)?(e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e):me()}dotAll(){return this.consumeChar(`.`),{type:`Set`,complement:!0,value:[U(`
3
3
  `),U(`\r`),U(`\u2028`),U(`\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=ge;break;case`D`:e=ge,t=!0;break;case`s`:e=ve;break;case`S`:e=ve,t=!0;break;case`w`:e=_e;break;case`W`:e=_e,t=!0}return G(e)?{type:`Set`,value:e,complement:t}:me()}controlEscapeAtom(){let e;switch(this.popChar()){case`f`:e=U(`\f`);break;case`n`:e=U(`
4
4
  `);break;case`r`:e=U(`\r`);break;case`t`:e=U(` `);break;case`v`:e=U(`\v`)}return G(e)?{type:`Character`,value:e}:me()}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:U(`\0`)}}hexEscapeSequenceAtom(){return this.consumeChar(`x`),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar(`u`),this.parseHexDigits(4)}identityEscapeAtom(){return{type:`Character`,value:U(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
@@ -27,7 +27,7 @@ a boolean 2nd argument is no longer supported`);this.config=Object.assign({},ot,
27
27
  `);throw Error(`Errors detected in definition of Lexer:
28
28
  `+e)}this.lexerDefinitionWarning.forEach(e=>{O(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`,()=>{Ce={}}),this.TRACE_INIT(`toFastProperties`,()=>{ae(this)})})}tokenize(e,t=this.defaultMode){if(this.lexerDefinitionErrors.length>0){let e=this.lexerDefinitionErrors.map(e=>e.message).join(`-----------------------
29
29
  `);throw Error(`Unable to Tokenize because Errors detected in definition of Lexer:
30
- `+e)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=e,v=_.length,y=0,b=0,ee=this.hasCustom?0:Math.floor(e.length/10),x=Array(ee),S=[],te=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 T=this.trackStartLines,ne=this.config.lineTerminatorsPattern,re=0,E=[],D=[],O=[],ie=[];Object.freeze(ie);let ae=!1,k=e=>{if(O.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);S.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{O.pop();let e=O.at(-1);E=this.patternIdxToConfig[e],D=this.charCodeToPatternIdxToConfig[e],re=E.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;ae=!(!D||!t)}};function A(e){O.push(e),D=this.charCodeToPatternIdxToConfig[e],E=this.patternIdxToConfig[e],re=E.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;ae=!(!D||!t)}let j;A.call(this,t);let M=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),ee;if(ae){let e=K(t),n=D[e];ee=n===void 0?ie:n}else ee=E;let N=ee.length;for(n=0;n<N;n++){j=ee[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=E[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,te,C,u),this.handlePayload(p,c),!1===d?b=this.addToken(x,b,p):w[d].push(p)),!0===T&&!0===j.canLineTerminator){let t,n,r=0;ne.lastIndex=0;do s=s===null?e.substring(y,y+u):s,t=ne.test(s),!0===t&&(n=ne.lastIndex-1,r++);while(!0===t);r===0?C=this.computeNewColumn(C,u):(te+=r,C=u-n,this.updateTokenEndLineColumnLocation(p,d,n,r,te,C,u))}else C=this.computeNewColumn(C,u);y+=u,this.handleModes(j,k,A,p)}else{let t=y,n=te,i=C,a=!1===M;for(;!1===a&&y<v;)for(y++,r=0;r<re;r++){let t=E[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,O.at(-1)),S.push({offset:t,line:n,column:i,length:m,message:h}),!1===M)break}}return this.hasCustom||(x.length=b),{tokens:x,groups:w,errors:S}}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.
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,b=0,ee=this.hasCustom?0:Math.floor(e.length/10),x=Array(ee),S=[],te=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,T=0,E=[],D=[],O=[],ie=[];Object.freeze(ie);let ae=!1,k=e=>{if(O.length===1&&e.tokenType.PUSH_MODE===void 0){let t=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(e);S.push({offset:e.startOffset,line:e.startLine,column:e.startColumn,length:e.image.length,message:t})}else{O.pop();let e=O.at(-1);E=this.patternIdxToConfig[e],D=this.charCodeToPatternIdxToConfig[e],T=E.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;ae=!(!D||!t)}};function A(e){O.push(e),D=this.charCodeToPatternIdxToConfig[e],E=this.patternIdxToConfig[e],T=E.length;let t=this.canModeBeOptimized[e]&&!1===this.config.safeMode;ae=!(!D||!t)}let j;A.call(this,t);let M=this.config.recoveryEnabled;for(;y<v;){s=null,u=-1;let t=_.charCodeAt(y),ee;if(ae){let e=K(t),n=D[e];ee=n===void 0?ie:n}else ee=E;let N=ee.length;for(n=0;n<N;n++){j=ee[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=E[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,te,C,u),this.handlePayload(p,c),!1===d?b=this.addToken(x,b,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):(te+=r,C=u-n,this.updateTokenEndLineColumnLocation(p,d,n,r,te,C,u))}else C=this.computeNewColumn(C,u);y+=u,this.handleModes(j,k,A,p)}else{let t=y,n=te,i=C,a=!1===M;for(;!1===a&&y<v;)for(y++,r=0;r<T;r++){let t=E[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,O.at(-1)),S.push({offset:t,line:n,column:i,length:m,message:h}),!1===M)break}}return this.hasCustom||(x.length=b),{tokens:x,groups:w,errors:S}}handleModes(e,t,n,r){if(!0===e.pop){let i=e.push;t(r),i!==void 0&&n.call(this,i)}else e.push!==void 0&&n.call(this,e.push)}updateTokenEndLineColumnLocation(e,t,n,r,i,a,o){let s,c;t!==void 0&&(s=n===o-1,c=s?-1:0,r===1&&!0===s||(e.endLine=i+c,e.endColumn=a-1-c))}computeNewColumn(e,t){return e+t}createOffsetOnlyToken(e,t,n,r){return{image:e,startOffset:t,tokenTypeIdx:n,tokenType:r}}createStartOnlyToken(e,t,n,r,i,a){return{image:e,startOffset:t,startLine:i,startColumn:a,tokenTypeIdx:n,tokenType:r}}createFullToken(e,t,n,r,i,a,o){return{image:e,startOffset:t,endOffset:t+o-1,startLine:i,endLine:i,startColumn:a,endColumn:a+o-1,tokenTypeIdx:n,tokenType:r}}addTokenUsingPush(e,t,n){return e.push(n),t}addTokenUsingMemberAccess(e,t,n){return e[t]=n,++t}handlePayloadNoCustom(e,t){}handlePayloadWithCustom(e,t){t!==null&&(e.payload=t)}match(e,t,n){return!0===e.test(t)?t.substring(n,e.lastIndex):null}matchLength(e,t,n){return!0===e.test(t)?e.lastIndex-n:-1}};function st(e){return ct(e)?e.LABEL:e.name}function ct(e){return typeof e.LABEL==`string`&&e.LABEL!==``}J.SKIPPED=`This marks a skipped Token pattern, this means each token identified by it will be consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.`,J.NA=/NOT_APPLICABLE/;var lt=`parent`,ut=`categories`,dt=`label`,ft=`group`,pt=`push_mode`,mt=`pop_mode`,ht=`longer_alt`,gt=`line_breaks`,_t=`start_chars_hint`;function Y(e){return function(e){let t=e.pattern,n={};if(n.name=e.name,t!==void 0&&(n.PATTERN=t),Object.hasOwn(e,lt))throw`The parent property is no longer supported.
31
31
  See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return Object.hasOwn(e,ut)&&(n.CATEGORIES=e[ut]),et([n]),Object.hasOwn(e,dt)&&(n.LABEL=e[dt]),Object.hasOwn(e,ft)&&(n.GROUP=e[ft]),Object.hasOwn(e,mt)&&(n.POP_MODE=e[mt]),Object.hasOwn(e,pt)&&(n.PUSH_MODE=e[pt]),Object.hasOwn(e,ht)&&(n.LONGER_ALT=e[ht]),Object.hasOwn(e,gt)&&(n.LINE_BREAKS=e[gt]),Object.hasOwn(e,_t)&&(n.START_CHARS_HINT=e[_t]),n}(e)}var X=Y({name:`EOF`,pattern:J.NA});function vt(e,t,n,r,i,a,o,s){return{image:t,startOffset:n,endOffset:r,startLine:i,endLine:a,startColumn:o,endColumn:s,tokenTypeIdx:e.tokenTypeIdx,tokenType:e}}et([X]);var yt={buildMismatchTokenMessage:({expected:e,actual:t,previous:n,ruleName:r})=>`Expecting ${ct(e)?`--\x3e ${st(e)} <--`:`token of type --\x3e ${e.name} <--`} but found --\x3e '${t.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:e,ruleName:t})=>`Redundant input, expecting EOF but found: `+e.image,buildNoViableAltMessage({expectedPathsPerAlt:e,actual:t,previous:n,customUserDescription:r,ruleName:i}){let a=`
32
32
  but found: '`+t[0].image+`'`;return r?`Expecting: `+r+a:`Expecting: one of these possible Token sequences:\n${e.reduce((e,t)=>e.concat(t),[]).map(e=>`[${e.map(e=>st(e)).join(`, `)}]`).map((e,t)=>` ${t+1}. ${e}`).join(`
33
33
  `)}`+a},buildEarlyExitMessage({expectedIterationPaths:e,actual:t,customUserDescription:n,ruleName:r}){let i=`
@@ -54,4 +54,4 @@ For Further details.`,r},buildEmptyRepetitionError(e){let t=H(e.repetition);retu
54
54
  See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
55
55
  For Further details.`)}if(Array.isArray(e))this.tokensMap=e.reduce((e,t)=>(e[t.name]=t,e),{});else if(Object.hasOwn(e,`modes`)&&Object.values(e.modes).flat().every(it)){let t=Object.values(e.modes).flat(),n=[...new Set(t)];this.tokensMap=n.reduce((e,t)=>(e[t.name]=t,e),{})}else{if(typeof e!=`object`||!e)throw Error(`<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition`);this.tokensMap=Object.assign({},e)}this.tokensMap.EOF=X;let n=(Object.hasOwn(e,`modes`)?Object.values(e.modes).flat():Object.values(e)).every(e=>e.categoryMatches?.length==0);this.tokenMatcher=n?Ze:Xe,et(Object.values(this.tokensMap))}defineRule(e,t,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called'\nMake sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);let r=Object.hasOwn(n,`resyncEnabled`)?n.resyncEnabled:Rn.resyncEnabled,i=Object.hasOwn(n,`recoveryValueFunc`)?n.recoveryValueFunc:Rn.recoveryValueFunc,a=this.ruleShortNameIdx++,o;return this.shortRuleNameToFull[a]=e,this.fullRuleNameToShort[e]=a,o=!0===this.outputCst?function(...n){try{this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n);let r=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(r),r}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...n){try{return this.ruleInvocationStateUpdate(a,e,this.subruleIdx),t.apply(this,n)}catch(e){return this.invokeRuleCatch(e,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(function(...t){this.onBeforeParse(e);try{return o.apply(this,t)}finally{this.onAfterParse(e)}},{ruleName:e,originalGrammarAction:t,coreRule:o})}invokeRuleCatch(e,t,n){let r=this.RULE_STACK_IDX===0,i=t&&!this.isBackTracking()&&this.recoveryEnabled;if(cn(e)){let t=e;if(i){let r=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(r)){if(t.resyncedTokens=this.reSyncTo(r),this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];return e.recoveredNode=!0,e}return n(e)}if(this.outputCst){let e=this.CST_STACK[this.CST_STACK.length-1];e.recoveredNode=!0,t.partialCstResult=e}throw t}if(r)return this.moveToTerminatedState(),n(e);throw t}throw e}optionInternal(e,t){let n=512|t;return this.optionInternalLogic(e,t,n)}optionInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof e!=`function`){r=e.DEF;let t=e.GATE;if(t!==void 0){let e=i;i=()=>t.call(this)&&e.call(this)}}else r=e;if(!0===i.call(this))return r.call(this)}atLeastOneInternal(e,t){let n=_n|e;return this.atLeastOneInternalLogic(e,t,n)}atLeastOneInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;if(!0!==i.call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY,t.ERR_MSG);{let e=this.doSingleRepetition(r);for(;!0===i.call(this)&&!0===e;)e=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],i,_n,e,Ot)}atLeastOneSepFirstInternal(e,t){let n=yn|e;this.atLeastOneSepFirstInternalLogic(e,t,n)}atLeastOneSepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0!==this.currRuleLookaheadFuncs[n].call(this))throw this.raiseEarlyExitException(e,Z.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG);{r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,kt],t,yn,e,kt)}}manyInternal(e,t){let n=768|e;return this.manyInternalLogic(e,t,n)}manyInternalLogic(e,t,n){let r,i=this.currRuleLookaheadFuncs[n];if(typeof t!=`function`){r=t.DEF;let e=t.GATE;if(e!==void 0){let t=i;i=()=>e.call(this)&&t.call(this)}}else r=t;let a=!0;for(;!0===i.call(this)&&!0===a;)a=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],i,768,e,Et,a)}manySepFirstInternal(e,t){let n=vn|e;this.manySepFirstInternalLogic(e,t,n)}manySepFirstInternalLogic(e,t,n){let r=t.DEF,i=t.SEP;if(!0===this.currRuleLookaheadFuncs[n].call(this)){r.call(this);let t=()=>this.tokenMatcher(this.LA_FAST(1),i);for(;!0===this.tokenMatcher(this.LA_FAST(1),i);)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,i,t,r,Dt],t,vn,e,Dt)}}repetitionSepSecondInternal(e,t,n,r,i){for(;n();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,n,r,i],n,yn,e,i)}doSingleRepetition(e){let t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){let n=256|t,r=Array.isArray(e)?e:e.DEF,i=this.currRuleLookaheadFuncs[n].call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){this.RULE_STACK_IDX--,this.RULE_OCCURRENCE_STACK_IDX--,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName]),this.cstFinallyStateUpdate()}subruleInternal(e,t,n){let r;try{let i=n===void 0?void 0:n.ARGS;return this.subruleIdx=t,r=e.coreRule.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:e.ruleName),r}catch(t){throw this.subruleInternalError(t,n,e.ruleName)}}subruleInternalError(e,t,n){throw cn(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:n),delete e.partialCstResult),e}consumeInternal(e,t,n){let r;try{let t=this.LA_FAST(1);!0===this.tokenMatcher(t,e)?(this.consumeToken(),r=t):this.consumeInternalError(e,t,n)}catch(n){r=this.consumeInternalRecovery(e,t,n)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:e.name,r),r}consumeInternalError(e,t,n){let r,i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new un(r,t,i))}consumeInternalRecovery(e,t,n){if(!this.recoveryEnabled||n.name!==`MismatchedTokenException`||this.isBackTracking())throw n;{let r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(e){throw e.name===`InRuleRecoveryException`?n:e}}}saveRecogState(){let e=this.errors,t=this.RULE_STACK.slice(0,this.RULE_STACK_IDX+1);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState);let t=e.RULE_STACK;for(let e=0;e<t.length;e++)this.RULE_STACK[e]=t[e];this.RULE_STACK_IDX=t.length-1,this.RULE_STACK_IDX>=0&&(this.currRuleShortName=this.RULE_STACK[this.RULE_STACK_IDX],this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[this.currRuleShortName])}ruleInvocationStateUpdate(e,t,n){this.RULE_OCCURRENCE_STACK[++this.RULE_OCCURRENCE_STACK_IDX]=n,this.RULE_STACK[++this.RULE_STACK_IDX]=e,this.currRuleShortName=e,this.currRuleLookaheadFuncs=this.lookAheadFuncsCache[e],this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){let e=this.currRuleShortName;return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),X)}reset(){this.resetLexerState(),this.subruleIdx=0,this.currRuleShortName=-1,this.currRuleLookaheadFuncs=[],this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK_IDX=-1,this.RULE_OCCURRENCE_STACK_IDX=-1,this.CST_STACK=[]}onBeforeParse(e){for(let e=0;e<this.maxLookahead+1;e++)this.tokVector.push(Ln)}onAfterParse(e){if(!1===this.isAtEndOfInput()){let e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new fn(t,e))}for(;this.tokVector.at(-1)===Ln;)this.tokVector.pop()}},class{ACTION(e){return e.call(this)}consume(e,t,n){return this.consumeInternal(t,e,n)}subrule(e,t,n){return this.subruleInternal(t,e,n)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,n=Rn){if(this.definedRulesNames.includes(e)){let t={message:xt.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Q.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(t)}this.definedRulesNames.push(e);let r=this.defineRule(e,t,n);return this[e]=r,r}OVERRIDE_RULE(e,t,n=Rn){let r=function(e,t,n){let r=[],i;return t.includes(e)||(i=`Invalid rule override, rule: ->${e}<- cannot be overridden in the grammar: ->${n}<-as it is not defined in any of the super grammars `,r.push({message:i,type:Q.INVALID_RULE_OVERRIDE,ruleName:e})),r}(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);let i=this.defineRule(e,t,n);return this[e]=i,i}BACKTRACK(e,t){let n=e.coreRule??e;return function(){this.isBackTrackingStack.push(1);let e=this.saveRecogState();try{return n.apply(this,t),!0}catch(e){if(cn(e))return!1;throw e}finally{this.reloadRecogState(e),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Object.values(this.gastProductionsCache).map(oe)}},class{initErrorHandler(e){this._errors=[],this.errorMessageProvider=Object.hasOwn(e,`errorMessageProvider`)?e.errorMessageProvider:$.errorMessageProvider}SAVE_ERROR(e){if(cn(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:this.RULE_OCCURRENCE_STACK.slice(0,this.RULE_OCCURRENCE_STACK_IDX+1)},this._errors.push(e),e;throw Error(`Trying to save an Error which is not a RecognitionException`)}get errors(){return[...this._errors]}set errors(e){this._errors=e}raiseEarlyExitException(e,t,n){let r=this.getCurrRuleFullName(),i=Ht(e,this.getGAstProductions()[r],t,this.maxLookahead)[0],a=[];for(let e=1;e<=this.maxLookahead;e++)a.push(this.LA(e));let o=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new pn(o,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){let n=this.getCurrRuleFullName(),r=Vt(e,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let e=1;e<=this.maxLookahead;e++)i.push(this.LA(e));let a=this.LA(0),o=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:a,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new dn(o,this.LA(1),a))}},class{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT(`Enable Recording`,()=>{for(let e=0;e<10;e++){let t=e>0?e:``;this[`CONSUME${t}`]=function(t,n){return this.consumeInternalRecord(t,e,n)},this[`SUBRULE${t}`]=function(t,n){return this.subruleInternalRecord(t,e,n)},this[`OPTION${t}`]=function(t){return this.optionInternalRecord(t,e)},this[`OR${t}`]=function(t){return this.orInternalRecord(t,e)},this[`MANY${t}`]=function(t){this.manyInternalRecord(e,t)},this[`MANY_SEP${t}`]=function(t){this.manySepFirstInternalRecord(e,t)},this[`AT_LEAST_ONE${t}`]=function(t){this.atLeastOneInternalRecord(e,t)},this[`AT_LEAST_ONE_SEP${t}`]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}}this.consume=function(e,t,n){return this.consumeInternalRecord(t,e,n)},this.subrule=function(e,t,n){return this.subruleInternalRecord(t,e,n)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT(`Deleting Recording methods`,()=>{let e=this;for(let t=0;t<10;t++){let n=t>0?t:``;delete e[`CONSUME${n}`],delete e[`SUBRULE${n}`],delete e[`OPTION${n}`],delete e[`OR${n}`],delete e[`MANY${n}`],delete e[`MANY_SEP${n}`],delete e[`AT_LEAST_ONE${n}`],delete e[`AT_LEAST_ONE_SEP${n}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return Ln}topLevelRuleRecord(e,t){try{let n=new j({definition:[],name:e});return n.name=e,this.recordingProdStack.push(n),t.call(this),this.recordingProdStack.pop(),n}catch(e){if(!0!==e.KNOWN_RECORDER_ERROR)try{e.message+=`
56
56
  This error was thrown during the "grammar recording phase" For more info see:
57
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,N,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,F,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,I,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,L,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new A({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new z({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ie(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??x,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??x;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:a,separatorRow:o,separatorDecimal:s}=r.separators;if(a===o)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${a}')`);let c=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),l=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),u=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),d=Y({name:`TableReference`,pattern:{exec:ee},line_breaks:!1,start_chars_hint:Wn}),f=Y({name:`BracketedString`,pattern:{exec:C},line_breaks:!1,start_chars_hint:[91],longer_alt:[d,l]}),p=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),m=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),h=Y({name:`LiteralError`,pattern:new RegExp(p(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(m).join(`|`))}),g=Y({name:`RefError`,pattern:new RegExp(p(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(m).join(`|`))}),_=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),v=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),y=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,S=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:S}),w=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:S}),T=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),ne=s===`.`?`\\.`:s,re=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${ne}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${ne}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),E=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),D=Y({name:`DigitToken`,pattern:/[0-9]+/}),O=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!O.some(e=>e.toLowerCase()===t.toLowerCase())&&O.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let ie=Y({name:`BooleanToken`,pattern:new RegExp(O.join(`|`),`i`)}),ae=Y({name:`ArgSeparator`,pattern:Zn(i)}),k=Y({name:`ColSeparator`,pattern:Zn(a)}),A=Y({name:`RowSeparator`,pattern:Zn(o)}),j=Y({name:`RangeOp`,pattern:/:/}),M=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),N=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),P=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),F=Y({name:`OpenParen`,pattern:/\(/}),I=Y({name:`CloseParen`,pattern:/\)/}),L=Y({name:`OpenCurlyParen`,pattern:/{/}),R=Y({name:`CloseCurlyParen`,pattern:/}/}),z=Y({name:`QuoteS`,pattern:/'/}),oe=Y({name:`MulOp`,pattern:/\*(?!\*)/}),B=Y({name:`PlusOp`,pattern:/\+/}),V=Y({name:`DivOp`,pattern:/\//}),se=Y({name:`MinOp`,pattern:/-/}),H=Y({name:`ImplicitIntersectOp`,pattern:/@/}),ce=Y({name:`ConcatOp`,pattern:/&/}),le=Y({name:`ExOp`,pattern:/\^/}),ue=Y({name:`PercentOp`,pattern:/%/}),de=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[h,g]}),fe=Y({name:`GtOp`,pattern:/>/}),U=Y({name:`EqOp`,pattern:/=/}),pe=Y({name:`LtOp`,pattern:/</}),W=[c,l,v,_,y,u,d,f,h,g,ae,...a===i?[]:[k],A,M,N,P,j,te,ie,w,T,re,E,D,de,H,S,F,I,L,R,z,oe,B,V,se,ce,le,ue,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),fe,U,pe];this._lexer=new J(W,{ensureOptimizations:!0});let G={};W.forEach(e=>{G[e.name]=e}),a===i&&(G.ColSeparator=ae),this._vocabulary=G}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=x){let t=function(e){let t=[...w];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=x){let t=new Qn(e),r=t.getVocabulary();super(r,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:i,BracketedColumn:a,BareSpecifier:s,ColumnSep:c,ListSep:l}=r,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(i);return u.ACTION(()=>{let r=n(t.image,e);return r.image=t.image,r})}},{ALT:()=>{let t=u.CONSUME(s);return u.ACTION(()=>{let r=n(t.image,e);return r.image=t.image,r})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(a),t,n;return u.OPTION(()=>{t=u.CONSUME(c),n=u.CONSUME2(a)}),u.ACTION(()=>{let r=p(e.image);if(r.image=e.image,!n)return r;let i=p(n.image);i.image=n.image;let a=o(`:`,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=m(`@`,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=m(`@`,t[0],!0);return e.image=`@`,[e]}}let n=p(e);n.image=e;let r=m(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=p(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,n){this.reset();let r=()=>({root:E(``,[]),errors:[]});if(!n)return r();let i=0;if(n.charAt(0)===`[`){let e=n.indexOf(`]`);e!==-1&&n.charAt(e+1)===`!`&&(i=e+2)}let a=n.indexOf(`[`,i);if(a===-1)return r();let o=n.slice(0,a),s=n.slice(a+1,-1),c=this._parseContent(s);return{root:E(o,c),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===T.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),c=n.getVocabulary();super(c,{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:s,GtOp:c,EqOp:l,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(s).image},{ALT:()=>this.CONSUME(c).image},{ALT:()=>this.CONSUME(l).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image},{ALT:()=>this.CONSUME(p).image}]),o={value:r,index:this.getLexerPosition(),isRange:v.includes(r)},h=this.SUBRULE2(this._rulePostfixOp);m.push({op:o,node:h})}),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=o(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=v.includes(i);t=h(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=v.includes(n);i=m(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(o(`:`,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(h(`#`,a[0].node,!0),t.anchor);continue}let n=t.op,r=o(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(f(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=o(` `,r,i,!0),s=this._tokenMap.get(r);s&&delete s.tokenIndexClose;let c=this._tokenMap.get(i),l=c?.tokenIndex;if(l!==void 0){let e=this.input[l],t=this.input[l-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(a.wsBefore=n)}c&&delete c.tokenIndex,n+1<t&&c&&delete c.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(T.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=re();this.CONSUME(e);let o=this.getLexerPosition(),s=this.ACTION(()=>this._tag(a(i),o)),c=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(c)}),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=re(),s.value.push(i)),i.value.push(t)})});let l=this.OPTION(()=>this.CONSUME(t));return s=this.ACTION(()=>(l||this._reportError(s,`Missing closing parenthesis '}'`,o),this._tagClose(s,this.getLexerPosition()))),s}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(y(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?ne(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(b(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(g(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(u(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(y(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(b(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(g(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(u(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);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(d(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(S(),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(S(),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:n,DivOp:r,MulOp:a,PlusOp:o,MinOp:c,ArgSeparator:u,Cell:d,NamedToken:f,SingleQuotedString:p,Column:m,AbsRow:h,DigitToken:g,RefError:_}=this._vocab,v,y;this.OPTION2({GATE:()=>{for(let t=1;t<6;t++){let i=this.LA(t);if(i.tokenType===e||i.tokenType===n)return!0;if(i.image===``||i.image===`)`||i.tokenType===r||i.tokenType===a||i.tokenType===o||i.tokenType===c||i.tokenType===u)break}return!1},DEF:()=>{y=this.getLexerPosition()+1,v=this.SUBRULE(this._rulePrefixSheetName)}});let b=this.OR([{ALT:()=>{let e=this.CONSUME(d),t=this.getLexerPosition();return this.ACTION(()=>this._tag(te(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(f)},{ALT:()=>this.CONSUME(p)}]);return this.ACTION(()=>this._tag(t(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(m);return this.ACTION(()=>this._tag(l(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(s(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(g);return this.ACTION(()=>this._tag(s(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(_);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(v&&b){if(v.name===``)return void this._reportError(b,`'${v.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=b;if(b.type===T.Postfix&&b.inputs?.[0]&&(e=b.inputs[0]),e.type===T.Cell||e.type===T.Named||e.type===T.Row||e.type===T.TableColumn||e.type===T.Error){e.value.scope=v.name,e.value.scopeImage=v.image;let t=this._tokenMap.get(e);t&&y!==void 0&&(t.tokenIndex=y)}}}),b}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:T.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=n,this._locale=n.getLocale(),this._vocab=c,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(n,r,i){let a=this._lexer.tokenize(i),o;if(!a)return{root:{type:T.Unparsed,value:i},errors:[]};let l=a.tokens;if(l.length===0)throw new e.Parse(ir);return this.input=l,this._inputText=i,this._inputTextLength=i.length,this.rowIndex=n,this.colIndex=r,this._astErrors=[],this._tokenMap=new Map,this.reset(),o=this._ruleRoot(),o&&this._bindAllWhitespace(o),o=c(o,(e,r)=>{let i=e.type,a=r?.isReference?r.value:void 0,o=typeof a==`string`&&er.has(a),c=typeof a==`string`&&tr.has(a),l=o?r.inputs:void 0,u=l?l[0]===e?l[1]:l[0]:void 0,d=this._lexer.getMaxRow();if(o&&i!==T.Cell&&Number.isInteger(e.value)){let t=s(e.image,n);return _(t,e),nr(u)===`row`?rr(e.image,d)||this._reportError(t,`'${e.image}' is not a valid row — rows run from 1 to ${d}`):this._reportError(t,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),t}if(c&&i===T.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${a}' needs a cell or range on both sides`),e;if(i===T.Cell){let n=e.value,r=n.colIndex===-(2**53-1),i=n.rowIndex===-(2**53-1);if((r||i)&&nr(u)===(r?`row`:`col`))return r&&!rr(e.image,d)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${d}`),e;if(r||i||n.colIndex>=16384){let o=t(e.image);_(o,e);let s=n.scope;return s&&(o.value.scope=s,o.value.scopeImage=n.scopeImage),r?this._reportError(o,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):i&&e.image.includes(`$`)?this._reportError(o,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):c&&this._reportError(o,`'${e.image}' is a name — '${a}' needs a cell or range on both sides`),o}}return e}),{root:o,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===T.Array&&Array.isArray(e.value)){for(let t of e.value)if(t&&Array.isArray(t.value))for(let e of t.value)e&&this._bindAllWhitespace(e)}}}};export{ir as i,ar as n,cr as r,Hn as t};
57
+ https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw e}throw e}}optionInternalRecord(e,t){return Nn.call(this,N,e,t)}atLeastOneInternalRecord(e,t){Nn.call(this,P,t,e)}atLeastOneSepFirstInternalRecord(e,t){Nn.call(this,F,t,e,kn)}manyInternalRecord(e,t){Nn.call(this,I,t,e)}manySepFirstInternalRecord(e,t){Nn.call(this,L,t,e,kn)}orInternalRecord(e,t){return Pn.call(this,e,t)}subruleInternalRecord(e,t,n){if(In(t),!e||!Object.hasOwn(e,`ruleName`)){let n=Error(`<SUBRULE${Fn(t)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=e.ruleName,a=new A({idx:t,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Mn:On}consumeInternalRecord(e,t,n){if(In(t),!nt(e)){let n=Error(`<CONSUME${Fn(t)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}>\n inside top level rule: <${this.recordingProdStack[0].name}>`);throw n.KNOWN_RECORDER_ERROR=!0,n}let r=this.recordingProdStack.at(-1),i=new z({idx:t,terminalType:e,label:n?.LABEL});return r.definition.push(i),jn}},class{initPerformanceTracer(e){if(Object.hasOwn(e,`traceInitPerf`)){let t=e.traceInitPerf,n=typeof t==`number`;this.traceInitMaxIdent=n?t:1/0,this.traceInitPerf=n?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=$.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(!0===this.traceInitPerf){this.traceInitIndent++;let n=Array(this.traceInitIndent+1).join(` `);this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--\x3e <${e}>`);let{time:r,value:i}=ie(t),a=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&a(`${n}<-- <${e}> time: ${r}ms`),this.traceInitIndent--,i}return t()}}].forEach(e=>{let t=e.prototype;Object.getOwnPropertyNames(t).forEach(n=>{if(n===`constructor`)return;let r=Object.getOwnPropertyDescriptor(t,n);r&&(r.get||r.set)?Object.defineProperty(zn.prototype,n,r):zn.prototype[n]=e.prototype[n]})});var Vn=class extends Bn{constructor(e,t=$){let n=Object.assign({},t);n.outputCst=!1,super(e,n)}},Hn=class t{static shared(e){let n=e?.locale??x,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??x;this._locale=r,this._maxColumn=t,this._maxRow=n;let{separatorFunction:i,separatorColumn:a,separatorRow:o,separatorDecimal:s}=r.separators;if(a===o)throw Error(`FormulaLexer: separatorColumn and separatorRow must differ (both '${a}')`);let c=Y({name:`WhiteSpace`,pattern:/[ \n\v\f\r\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,group:J.SKIPPED}),l=Y({name:`StringToken`,pattern:/"(""|[^"])*"/}),u=Y({name:`FunctionToken`,pattern:/[a-zA-Z_\u007F-\uFFFF]+[a-zA-Z0-9_.\u007F-\uFFFF]*(?=\()/}),d=Y({name:`TableReference`,pattern:{exec:ee},line_breaks:!1,start_chars_hint:Wn}),f=Y({name:`BracketedString`,pattern:{exec:C},line_breaks:!1,start_chars_hint:[91],longer_alt:[d,l]}),p=e=>(e??[]).map(e=>e?.trim()).filter(Boolean).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).map(e=>e+`|`).join(``),m=e=>e.replace(/[A-Za-z]/g,e=>`[${e.toUpperCase()}${e.toLowerCase()}]`),h=Y({name:`LiteralError`,pattern:new RegExp(p(r.errorLiterals)+[`#PARSE!`,`#NULL!`,`#DIV\\/0!`,`#VALUE!`,`#NUM!`,`#FIELD!`,`#N\\/A`,`#GETTING_DATA`,`#SPILL!`,`#CONNECT!`,`#BLOCKED!`,`#UNKNOWN!`,`#CALC!`,`#BUSY!`,`#PYTHON!`,`#TIMEOUT!`].map(m).join(`|`))}),g=Y({name:`RefError`,pattern:new RegExp(p(r.errorRefs)+[`#REF!`,`#NAME\\?`].map(m).join(`|`))}),_=Y({name:`SingleQuotedString`,pattern:/'(''|[^'])*'/}),v=Y({name:`SheetQuoted`,pattern:/'(?:''|[^'])*?'!/}),y=Y({name:`Sheet`,pattern:/[A-Za-z_.\d\u007F-\uFFFF]*!/}),b=/[a-zA-Z_\\\u007F-\uFFFF][a-zA-Z0-9_.?\\\u007F-\uFFFF]*:?/y,S=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:S}),w=Y({name:`Column`,pattern:{exec:Yn(t)},line_breaks:!1,start_chars_hint:[36,...Un],longer_alt:S}),ne=Y({name:`AbsRow`,pattern:/[$][0-9]+/}),re=s===`.`?`\\.`:s,T=Y({name:`NumberToken`,pattern:RegExp(`[0-9]+${re}(?!:)[0-9]*([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|${re}[0-9]+([eE][+-]?[0-9]+|\\*\\*[+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+`)}),E=Y({name:`ScientificDigit`,pattern:/[0-9]+\*\*[+-]?[0-9]+/}),D=Y({name:`DigitToken`,pattern:/[0-9]+/}),O=[`TRUE`,`FALSE`];for(let e of[r.booleanTrue,r.booleanFalse]){let t=e?.trim();t&&!O.some(e=>e.toLowerCase()===t.toLowerCase())&&O.push(t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`))}let ie=Y({name:`BooleanToken`,pattern:new RegExp(O.join(`|`),`i`)}),ae=Y({name:`ArgSeparator`,pattern:Zn(i)}),k=Y({name:`ColSeparator`,pattern:Zn(a)}),A=Y({name:`RowSeparator`,pattern:Zn(o)}),j=Y({name:`RangeOp`,pattern:/:/}),M=Y({name:`RangeTrimFullOp`,pattern:/\.:\./}),N=Y({name:`RangeTrimLeadingOp`,pattern:/\.:/}),P=Y({name:`RangeTrimTrailingOp`,pattern:/:\./}),F=Y({name:`OpenParen`,pattern:/\(/}),I=Y({name:`CloseParen`,pattern:/\)/}),L=Y({name:`OpenCurlyParen`,pattern:/{/}),R=Y({name:`CloseCurlyParen`,pattern:/}/}),z=Y({name:`QuoteS`,pattern:/'/}),oe=Y({name:`MulOp`,pattern:/\*(?!\*)/}),B=Y({name:`PlusOp`,pattern:/\+/}),V=Y({name:`DivOp`,pattern:/\//}),se=Y({name:`MinOp`,pattern:/-/}),H=Y({name:`ImplicitIntersectOp`,pattern:/@/}),ce=Y({name:`ConcatOp`,pattern:/&/}),le=Y({name:`ExOp`,pattern:/\^/}),ue=Y({name:`PercentOp`,pattern:/%/}),de=Y({name:`ArrayAnchorOp`,pattern:/#/,longer_alt:[h,g]}),fe=Y({name:`GtOp`,pattern:/>/}),U=Y({name:`EqOp`,pattern:/=/}),pe=Y({name:`LtOp`,pattern:/</}),W=[c,l,v,_,y,u,d,f,h,g,ae,...a===i?[]:[k],A,M,N,P,j,te,ie,w,ne,T,E,D,de,H,S,F,I,L,R,z,oe,B,V,se,ce,le,ue,Y({name:`NeqOp`,pattern:/<>/}),Y({name:`GteOp`,pattern:/>=/}),Y({name:`LteOp`,pattern:/<=/}),fe,U,pe];this._lexer=new J(W,{ensureOptimizations:!0});let G={};W.forEach(e=>{G[e.name]=e}),a===i&&(G.ColSeparator=ae),this._vocabulary=G}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=x){let t=function(e){let t=[...w];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=x){let t=new Qn(e),r=t.getVocabulary();super(r,{nodeLocationTracking:`none`,maxLookahead:2,skipValidations:!0,recoveryEnabled:!1}),this._lexer=t;let{TableSpecifier:i,BracketedColumn:a,BareSpecifier:o,ColumnSep:c,ListSep:l}=r,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(i);return u.ACTION(()=>{let r=n(t.image,e);return r.image=t.image,r})}},{ALT:()=>{let t=u.CONSUME(o);return u.ACTION(()=>{let r=n(t.image,e);return r.image=t.image,r})}}])),u.RULE(`ruleColumnOrRange`,()=>{let e=u.CONSUME(a),t,n;return u.OPTION(()=>{t=u.CONSUME(c),n=u.CONSUME2(a)}),u.ACTION(()=>{let r=f(e.image);if(r.image=e.image,!n)return r;let i=f(n.image);i.image=n.image;let a=s(`:`,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=h(`@`,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=h(`@`,t[0],!0);return e.image=`@`,[e]}}let n=f(e);n.image=e;let r=h(`@`,n,!0);return r.image=`@`,[r]}if(n!==`[`&&n!==`#`){let t=f(e);return t.image=e,[t]}return this._parseInner(t)}parse(e,t,n){this.reset();let r=()=>({root:ne(``,[]),errors:[]});if(!n)return r();let i=0;if(n.charAt(0)===`[`){let e=n.indexOf(`]`);e!==-1&&n.charAt(e+1)===`!`&&(i=e+2)}let a=n.indexOf(`[`,i);if(a===-1)return r();let o=n.slice(0,a),s=n.slice(a+1,-1),c=this._parseContent(s);return{root:ne(o,c),errors:this.errors.length>0?[...this.errors]:[]}}},er=new Set([`:`,`.:.`,`.:`,`:.`]),tr=new Set([`.:.`,`.:`,`:.`]),nr=e=>{if(!e)return null;if(e.type===T.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),l=n.getVocabulary();super(l,{skipValidations:!0,recoveryEnabled:!0,...e,nodeLocationTracking:`full`,errorMessageProvider:sr,maxLookahead:1}),this._ruleInfixOp=this.RULE(`ruleInfixOp`,()=>{let{PlusOp:e,MinOp:t,MulOp:n,DivOp:i,ExOp:a,ConcatOp:o,GtOp:c,EqOp:l,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(c).image},{ALT:()=>this.CONSUME(l).image},{ALT:()=>this.CONSUME(u).image},{ALT:()=>this.CONSUME(d).image},{ALT:()=>this.CONSUME(f).image},{ALT:()=>this.CONSUME(p).image}]),s={value:r,index:this.getLexerPosition(),isRange:v.includes(r)},h=this.SUBRULE2(this._rulePostfixOp);m.push({op:s,node:h})}),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=s(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],s=v.includes(i);t=o(i,t,s),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=v.includes(n);i=h(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(s(`:`,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(o(`#`,a[0].node,!0),t.anchor);continue}let n=t.op,r=s(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(m(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=s(` `,r,i,!0),o=this._tokenMap.get(r);o&&delete o.tokenIndexClose;let c=this._tokenMap.get(i),l=c?.tokenIndex;if(l!==void 0){let e=this.input[l],t=this.input[l-1]?.endOffset??-1,n=this._inputText.slice(t+1,e.startOffset).slice(0,-1);n.length>0&&(a.wsBefore=n)}c&&delete c.tokenIndex,n+1<t&&c&&delete c.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(T.Paren,e,t)}),this._ruleLiteralArray=this.RULE(`ruleLiteralArray`,()=>{let{OpenCurlyParen:e,CloseCurlyParen:t,ColSeparator:n,RowSeparator:r}=this._vocab,i=E();this.CONSUME(e);let o=this.getLexerPosition(),s=this.ACTION(()=>this._tag(a(i),o)),c=this.SUBRULE(this._ruleLiteralForArray);this.ACTION(()=>{i.value.push(c)}),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=E(),s.value.push(i)),i.value.push(t)})});let l=this.OPTION(()=>this.CONSUME(t));return s=this.ACTION(()=>(l||this._reportError(s,`Missing closing parenthesis '}'`,o),this._tagClose(s,this.getLexerPosition()))),s}),this._ruleLiteralForArray=this.RULE(`ruleLiteralForArray`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.OPTION(()=>this.SUBRULE(this._rulePlusMinusOp)),t=this.SUBRULE(this._ruleNumber),n=this.ACTION(()=>this._tag(y(t.image,this._locale),this.getLexerPosition()));return this.ACTION(()=>e?re(e.image,n):n)}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(b(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(g(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(d(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}])}),this._ruleLiteral=this.RULE(`ruleLiteral`,()=>{let{StringToken:e,BooleanToken:t,LiteralError:n,RefError:r}=this._vocab;return this.OR([{ALT:()=>{let e=this.SUBRULE(this._ruleNumber);return this.ACTION(()=>this._tag(y(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let t=this.CONSUME(e);return this.ACTION(()=>this._tag(b(t.image),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(t);return this.ACTION(()=>this._tag(g(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(n);return this.ACTION(()=>this._tag(d(e.image,this._locale),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(r);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(p(r,a),i)),s=this.OPTION(()=>this.CONSUME(n));return o=this.ACTION(()=>(s||this._reportError(o,`Missing closing parenthesis ')'`,i),this._tagClose(o,this.getLexerPosition()))),o}),this._ruleFunctionArguments=this.RULE(`ruleFunctionArguments`,()=>{let{ArgSeparator:e,CloseParen:t}=this._vocab,n=[];return this.OPTION({GATE:()=>this.LA(1).tokenType!==t,DEF:()=>{let t;this.OPTION2(()=>{t=this.SUBRULE(this._ruleIntersectOp)}),t=this.ACTION(()=>t??this._tagClose(S(),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(S(),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:n,DivOp:r,MulOp:a,PlusOp:o,MinOp:s,ArgSeparator:l,Cell:d,NamedToken:f,SingleQuotedString:p,Column:m,AbsRow:h,DigitToken:g,RefError:_}=this._vocab,v,y;this.OPTION2({GATE:()=>{for(let t=1;t<6;t++){let i=this.LA(t);if(i.tokenType===e||i.tokenType===n)return!0;if(i.image===``||i.image===`)`||i.tokenType===r||i.tokenType===a||i.tokenType===o||i.tokenType===s||i.tokenType===l)break}return!1},DEF:()=>{y=this.getLexerPosition()+1,v=this.SUBRULE(this._rulePrefixSheetName)}});let b=this.OR([{ALT:()=>{let e=this.CONSUME(d),t=this.getLexerPosition();return this.ACTION(()=>this._tag(te(e.image,this.rowIndex,this.colIndex),t))}},{ALT:()=>{let e=this.OR2([{ALT:()=>this.CONSUME(f)},{ALT:()=>this.CONSUME(p)}]);return this.ACTION(()=>this._tag(t(e.image),this.getLexerPosition()))}},{ALT:()=>this.SUBRULE(this._ruleBracketedString)},{ALT:()=>this.SUBRULE(this._ruleFunction)},{ALT:()=>{let e=this.CONSUME(m);return this.ACTION(()=>this._tag(u(e.image,this.colIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(h);return this.ACTION(()=>this._tag(c(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(g);return this.ACTION(()=>this._tag(c(e.image,this.rowIndex),this.getLexerPosition()))}},{ALT:()=>{let e=this.CONSUME(_);return this.ACTION(()=>this._tag(i(e.image,this._locale),this.getLexerPosition()))}}]);return this.ACTION(()=>{if(v&&b){if(v.name===``)return void this._reportError(b,`'${v.image}' is not a valid sheet reference — a '!' needs a sheet name before it`);let e=b;if(b.type===T.Postfix&&b.inputs?.[0]&&(e=b.inputs[0]),e.type===T.Cell||e.type===T.Named||e.type===T.Row||e.type===T.TableColumn||e.type===T.Error){e.value.scope=v.name,e.value.scopeImage=v.image;let t=this._tokenMap.get(e);t&&y!==void 0&&(t.tokenIndex=y)}}}),b}),this._rulePrefixSheetName=this.RULE(`rulePrefixSheetName`,()=>{let{SheetQuoted:e,BracketedString:t,NamedToken:n,Column:r,RangeOp:i,Sheet:a}=this._vocab;return this.OR([{ALT:()=>{let t=this.CONSUME(e).image;return{name:t.slice(1,-2).replace(/''/g,`'`),image:t}}},{ALT:()=>{let e=``;this.OPTION(()=>{e+=this.CONSUME(t).image}),this.OPTION2({GATE:()=>this.LA(2).tokenType===i,DEF:()=>{e+=this.OR2([{ALT:()=>this.CONSUME(n).image},{GATE:()=>this.LA(1).image.charCodeAt(0)!==36,ALT:()=>this.CONSUME(r).image}]),this.CONSUME(i),e+=`:`}});let o=this.CONSUME(a).image;return{name:e+o.slice(0,-1),image:e+o}}}])}),this._ruleNumber=this.RULE(`ruleNumber`,()=>{let{NumberToken:e,ScientificDigit:t,DigitToken:n}=this._vocab;return this.OR([{ALT:()=>this.CONSUME(e)},{ALT:()=>this.CONSUME(t)},{ALT:()=>this.CONSUME(n)}])}),this._ruleRoot=this.RULE(`ruleRoot`,()=>{let{ArgSeparator:e}=this._vocab,t=this.SUBRULE(this._ruleIntersectOp),n=[];return this.MANY(()=>{this.CONSUME(e),n.push(this.SUBRULE2(this._ruleIntersectOp))}),this.ACTION(()=>n.length===0?t:{type:T.List,value:`,`,inputs:[t,...n],isReference:!0})}),this._lexer=n,this._locale=n.getLocale(),this._vocab=l,this._srParser=e?.srParser??new $n(this._locale),this.performSelfAnalysis()}getLexer(){return this._lexer}parse(n,r,i){let a=this._lexer.tokenize(i),o;if(!a)return{root:{type:T.Unparsed,value:i},errors:[]};let s=a.tokens;if(s.length===0)throw new e.Parse(ir);return this.input=s,this._inputText=i,this._inputTextLength=i.length,this.rowIndex=n,this.colIndex=r,this._astErrors=[],this._tokenMap=new Map,this.reset(),o=this._ruleRoot(),o&&this._bindAllWhitespace(o),o=l(o,(e,r)=>{let i=e.type,a=r?.isReference?r.value:void 0,o=typeof a==`string`&&er.has(a),s=typeof a==`string`&&tr.has(a),l=o?r.inputs:void 0,u=l?l[0]===e?l[1]:l[0]:void 0,d=this._lexer.getMaxRow();if(o&&i!==T.Cell&&Number.isInteger(e.value)){let t=c(e.image,n);return _(t,e),nr(u)===`row`?rr(e.image,d)||this._reportError(t,`'${e.image}' is not a valid row — rows run from 1 to ${d}`):this._reportError(t,`'${e.image}' is not a valid reference — a whole row can only pair with another row (as in ${e.image}:${e.image})`),t}if(s&&i===T.Named)return this._reportError(e,`'${e.image??e.value?.nameId}' is a name — '${a}' needs a cell or range on both sides`),e;if(i===T.Cell){let n=e.value,r=n.colIndex===-(2**53-1),i=n.rowIndex===-(2**53-1);if((r||i)&&nr(u)===(r?`row`:`col`))return r&&!rr(e.image,d)&&this._reportError(e,`'${e.image}' is not a valid row — rows run from 1 to ${d}`),e;if(r||i||n.colIndex>=16384){let o=t(e.image);_(o,e);let c=n.scope;return c&&(o.value.scope=c,o.value.scopeImage=n.scopeImage),r?this._reportError(o,`'${e.image}' is not a valid reference — a row needs a column (use ${e.image}:${e.image} for the whole row)`):i&&e.image.includes(`$`)?this._reportError(o,`'${e.image}' is not a valid reference — a whole column can only pair with another column (as in ${e.image}:${e.image})`):s&&this._reportError(o,`'${e.image}' is a name — '${a}' needs a cell or range on both sides`),o}}return e}),{root:o,errors:[...this.errors,...this._astErrors]}}_processParen(e,t,n){let r;this.CONSUME(t);let i=this.getLexerPosition();r=this.ACTION(()=>(r={type:e,value:null,inputs:null},this._tag(r,i)));let a=[],o=this.SUBRULE(this._ruleIntersectOp);o&&a.push(o);let s=this.SUBRULE(this._ruleGroup),c=this.OPTION(()=>this.CONSUME(n));return r=this.ACTION(()=>{if(s)for(let e=0;e<s.length;e++)a.push(s[e]);return r&&(c||this._reportError(r,`Missing closing parenthesis`,i),r.inputs=a),this._tagClose(r,this.getLexerPosition())}),r}_reportError(e,t,n=void 0,r=`SyntaxError`){n===void 0&&(n=this.getLexerPosition()),e.error=!0,this._astErrors.push({name:r,message:t,previousToken:this.input[n],ast:e})}_tag(e,t){return e?(e.image??=this.input[t].image,this._tokenMap.set(e,{tokenIndex:t,tokenIndexClose:t}),e):(console.warn(`node is null`),e)}_tagClose(e,t){let n=this._tokenMap.get(e);return n?n.tokenIndexClose=t:this._tokenMap.set(e,{tokenIndexClose:t}),e}_bindNodeWhitespace(e){let t=this._tokenMap.get(e);if(!t)return;let n=this.input,r=this._inputText,i=t.tokenIndex;if(i!==void 0){let t=n[i],a=n[i-1]?.endOffset??-1;a+1<t.startOffset&&(e.wsBefore=r.slice(a+1,t.startOffset))}let a=t.tokenIndexClose;if(a!==void 0){let t=n[a],i=n[a+1]?.startOffset??this._inputTextLength;t.endOffset+1<i&&(e.wsAfter=r.slice(t.endOffset+1,i))}}_bindAllWhitespace(e){if(e){if(this._bindNodeWhitespace(e),e.inputs)for(let t of e.inputs)t&&this._bindAllWhitespace(t);if(e.type===T.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};