@sheetxl/studio-vanilla 0.3.3 → 0.3.5

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 (201) hide show
  1. package/browser/cjs/{C-YXuaIn5H1e3gGL.cjs → -aNm3r-RpjcRRCbw.cjs} +2 -2
  2. package/browser/cjs/6e91IXsvk9_k3W5c.cjs +6 -0
  3. package/browser/cjs/{TJOJ_VEsTmCJ4d0P.cjs → BLHbDre9R0bvyb9G.cjs} +2 -2
  4. package/browser/cjs/BN0MiwKQ8NjKXgue.cjs +7 -0
  5. package/browser/cjs/BNtn_2pcq6Dd-2HL.cjs +11 -0
  6. package/browser/cjs/{-mcHZst9U0zNDZao.cjs → BW_fZwvTtMLqteuJ.cjs} +1 -1
  7. package/browser/cjs/{Dh5RBi3PW-5ty2QU.cjs → Bg9KIoDuqtkhIYfN.cjs} +1 -1
  8. package/browser/cjs/{D4a_UoEEluqny9gi.cjs → BiiW2FlRZHxGIWso.cjs} +1 -1
  9. package/browser/cjs/{pPJG7KbyLkcVi77H.cjs → Biyqj-Wu75uxLHv1.cjs} +2 -2
  10. package/browser/cjs/BwocMiKAPb8s__1Z.cjs +6 -0
  11. package/browser/cjs/{CSZ-Bfo-TZpVumqr.cjs → CdWBtYv7LuuDLPL2.cjs} +1 -1
  12. package/browser/cjs/CuY7mAREmYhHuYWx.cjs +6 -0
  13. package/browser/cjs/CvESC6HiL0-peppq.cjs +12 -0
  14. package/browser/cjs/{VXCGmehGJvuKNhXg.cjs → Cxt39d6l0pu9k1vT.cjs} +8 -8
  15. package/browser/cjs/{DbSTC90BuNxq2k-j.cjs → D7NgrO__M-IUmM8o.cjs} +1 -1
  16. package/browser/cjs/{DnkioRlJqXrbcW-8.cjs → DCWZ2ZkLp-Horeca.cjs} +1 -1
  17. package/browser/cjs/DDhq2nYMdw5b7wP6.cjs +301 -0
  18. package/browser/cjs/{Bhq8u8Q04XpLmF4K.cjs → DIawrhwQ7E_1l99b.cjs} +6 -6
  19. package/browser/cjs/{BoBKeal3_qovATWu.cjs → DKit140jXAUUSf-_.cjs} +2 -2
  20. package/browser/cjs/DKsZXMMHWKP9IZ4E.cjs +12 -0
  21. package/browser/cjs/DeAt9vyyaeB2vbxQ.cjs +6 -0
  22. package/browser/cjs/Dkl2t2DSaDxPbm2V.cjs +6 -0
  23. package/browser/cjs/Ya4f5p9go_UndgNy.cjs +6 -0
  24. package/browser/cjs/{BnYTCcol8RjTTC3U.cjs → hSI9QVPgIxqt3pXc.cjs} +1 -1
  25. package/browser/cjs/index.cjs +2 -2
  26. package/browser/cjs/qjPE6k7aYlu-R90s.cjs +6 -0
  27. package/browser/cjs/{WKvz7zs0yI8-TRzJ.cjs → yvA5FY7oe6FILMqB.cjs} +1 -1
  28. package/{cdn/assets/DAC77jdtNbZopLX5.js → browser/esm/BLsIMzjofsOnRFrU.mjs} +16 -16
  29. package/{cdn/assets/DQQK1YdQWQGsESk_.js → browser/esm/BTQ-TGJnw7w1Y0CX.mjs} +14 -14
  30. package/browser/esm/{BNixyL5UPlHciWwi.mjs → BdLAPrmXIfjGFhhA.mjs} +152 -152
  31. package/browser/esm/BsDYj6xix3mlXry2.mjs +46 -0
  32. package/browser/esm/Btk74VwCVJ1T5LQD.mjs +46 -0
  33. package/browser/esm/{DhFd9KX61TdmTNyk.mjs → C60KakDbde-A4anI.mjs} +1 -1
  34. package/browser/esm/{1Esqj-uAqAeHBGzU.mjs → CAm14rTtmPL5-rvQ.mjs} +193 -192
  35. package/browser/esm/{CZ9K3g_56s3hfJO0.mjs → CLTP12OHGQ2k4_Kt.mjs} +21 -20
  36. package/browser/esm/{BXkh5kfYj7Zx_PAe.mjs → CPWh2H15145LP-d5.mjs} +1 -1
  37. package/browser/esm/CYXzmWJtZn5OJVBF.mjs +24861 -0
  38. package/{cdn/assets/BQFdL0Ou_nLqI7lR.js → browser/esm/ChMaIhqaEhF3SLLt.mjs} +6 -6
  39. package/browser/esm/{nT3k8GnD4H3I293i.mjs → CntwHkPpskE88Ixu.mjs} +11 -10
  40. package/{cdn/assets/C1opHAkl00_vHPMO.js → browser/esm/CsVV_QnEl77BQM3V.mjs} +1 -1
  41. package/{cdn/assets/iHc25sW_jPEvAQNG.js → browser/esm/CvFAAktSd9TQK1h4.mjs} +1 -1
  42. package/browser/esm/{DwLRqrlPfv8xcbxB.mjs → D0-tgawYa4KXYT2c.mjs} +2 -2
  43. package/browser/esm/{B3iFtnvwZZ0izvkj.mjs → D244UwY3qPC_LNc5.mjs} +2 -2
  44. package/{cdn/assets/B1bRlKApOQZbRHvx.js → browser/esm/DCuLWmzd9eLWgI03.mjs} +1 -1
  45. package/{cdn/assets/Dwd9xRP6sCbvd7-2.js → browser/esm/DDD5zfwNNPKuc_zZ.mjs} +1 -1
  46. package/browser/esm/{BZD8sqVzxMPTV1eH.mjs → DFa_tXqv1VN1OZdv.mjs} +75 -74
  47. package/{cdn/assets/Cqq1J11IdNmbXlgF.js → browser/esm/DJxioSY-hxyM7dmk.mjs} +24 -23
  48. package/{cdn/assets/Dkcj5uYhkoaa5JJt.js → browser/esm/DdrICyX8Ead15N32.mjs} +7 -7
  49. package/{cdn/assets/vw_ELbpa8MGzVBfc.js → browser/esm/Di2tNceI3NodSsgU.mjs} +10 -10
  50. package/browser/esm/{B7RdrgkvZilWOBgD.mjs → Did46-x6ZVwk_-r-.mjs} +1 -1
  51. package/browser/esm/Q1yWEkJBu4cVEF33.mjs +1467 -0
  52. package/browser/esm/index.mjs +2 -2
  53. package/{cdn/assets/CtW_m0lUeW_X_FHB.js → browser/esm/mq5uPzTIc1x8unBP.mjs} +1 -1
  54. package/browser/esm/wziCLl5xvHu6Guu_.mjs +22 -0
  55. package/cdn/assets/B41q92oKD_VR31Dd.js +46 -0
  56. package/cdn/assets/{DJ3siDIdJVpw0GCs.js → BOl7blN8JotSzCHJ.js} +2 -2
  57. package/{browser/esm/CaLAEGMKeQ3INVEV.mjs → cdn/assets/Bs-psXrTRw1jFety.js} +14 -14
  58. package/cdn/assets/{3ijH6Pl-l2q9T5Ky.js → BzptX9H_YCM2l0DE.js} +11 -10
  59. package/cdn/assets/{DhFd9KX61TdmTNyk.js → C60KakDbde-A4anI.js} +1 -1
  60. package/{browser/esm/Bz98C5-blFN81GJ-.mjs → cdn/assets/C8omEbSXHWI_wNjp.js} +10 -10
  61. package/{browser/esm/C7cRxJLNfGjCT_Hk.mjs → cdn/assets/CEXK9SXjFf1dGHZe.js} +16 -16
  62. package/cdn/assets/{BXkh5kfYj7Zx_PAe.js → CPWh2H15145LP-d5.js} +1 -1
  63. package/cdn/assets/C_E1C68wCcRpC6XN.js +46 -0
  64. package/cdn/assets/{D5Ns-uBNTj4-Jo0p.js → ClFGbVy7cnhMW-dO.js} +2 -2
  65. package/cdn/assets/{C4Vp4GoCEGQgWaGc.js → CoCIP7n4THmzOggq.js} +75 -74
  66. package/{browser/esm/C1opHAkl00_vHPMO.mjs → cdn/assets/CsVV_QnEl77BQM3V.js} +1 -1
  67. package/{browser/esm/iHc25sW_jPEvAQNG.mjs → cdn/assets/CvFAAktSd9TQK1h4.js} +1 -1
  68. package/{browser/esm/CdJVpNbmXP_fHybW.mjs → cdn/assets/Cz33L9W3cdQckAL5.js} +24 -23
  69. package/{browser/esm/DTHujOSrUxuBuwud.mjs → cdn/assets/DBgbBl_3O65WhfWN.js} +6 -6
  70. package/{browser/esm/B1bRlKApOQZbRHvx.mjs → cdn/assets/DCuLWmzd9eLWgI03.js} +1 -1
  71. package/{browser/esm/Dwd9xRP6sCbvd7-2.mjs → cdn/assets/DDD5zfwNNPKuc_zZ.js} +1 -1
  72. package/cdn/assets/DLYF-18qErpwF9Q-.js +1467 -0
  73. package/cdn/assets/{Dk8MDG7PNGIWw80U.js → DXMyzCcyP7039z13.js} +238 -238
  74. package/{browser/esm/FXy016gXiiQkH7aF.mjs → cdn/assets/DdrICyX8Ead15N32.js} +7 -7
  75. package/cdn/assets/{B7RdrgkvZilWOBgD.js → Did46-x6ZVwk_-r-.js} +1 -1
  76. package/cdn/assets/{ukDxhSJqMPzLXoCP.js → Dj3GhNedlKE9TeTn.js} +193 -192
  77. package/cdn/assets/F-RqJeKWiW4i5344.js +24708 -0
  78. package/cdn/assets/{DirkLhQ9-HVY0eDv.js → NHbXgEQMftGzY01r.js} +21 -20
  79. package/cdn/assets/lM5it-aJgI7DLNH9.js +22 -0
  80. package/{browser/esm/CtW_m0lUeW_X_FHB.mjs → cdn/assets/mq5uPzTIc1x8unBP.js} +1 -1
  81. package/cdn/index.js +2 -2
  82. package/cdn/loader.js +1 -1
  83. package/package.json +3 -2
  84. package/browser/cjs/-q2o2lS8jxJdArvq.cjs +0 -6
  85. package/browser/cjs/-wP4OG5GpQTxGLJN.cjs +0 -6
  86. package/browser/cjs/2TmE8J3tbgenWyNa.cjs +0 -6
  87. package/browser/cjs/3ghCxtNVxZjrbziE.cjs +0 -6
  88. package/browser/cjs/6AlZR3dVayTg7C5E.cjs +0 -452
  89. package/browser/cjs/B0BcYYAX9Qq_i5Iv.cjs +0 -6
  90. package/browser/cjs/B237Hj6a3Klw9rQn.cjs +0 -12
  91. package/browser/cjs/B24aLncmXYgEQNjl.cjs +0 -6
  92. package/browser/cjs/B9C-V-MR_epPI-2J.cjs +0 -6
  93. package/browser/cjs/BASowCefqJFspuu-.cjs +0 -6
  94. package/browser/cjs/BeDnbSWoeqV6GajE.cjs +0 -6
  95. package/browser/cjs/BucBlzmuZS_nYU9N.cjs +0 -6
  96. package/browser/cjs/C662YNYNcFb-AwnS.cjs +0 -6
  97. package/browser/cjs/CGg3vZ0YENmM73uu.cjs +0 -6
  98. package/browser/cjs/CJ9WKDMLDxv2vmlL.cjs +0 -6
  99. package/browser/cjs/CcxjUuuq3eq1io9D.cjs +0 -6
  100. package/browser/cjs/Ch4kNO1QwQ4Dqczw.cjs +0 -124
  101. package/browser/cjs/CrXR8mOrQVdukohR.cjs +0 -6
  102. package/browser/cjs/CuLinKNAohDMFqJU.cjs +0 -6
  103. package/browser/cjs/D0Ruzl2vdZGdUhjE.cjs +0 -12
  104. package/browser/cjs/D4CfqUrC04nbs39G.cjs +0 -6
  105. package/browser/cjs/D6cHa8Tv5I8L_uAO.cjs +0 -6
  106. package/browser/cjs/D7MyL7xgt0wGGz3I.cjs +0 -13
  107. package/browser/cjs/D7U5Wmdc51Op-pty.cjs +0 -6
  108. package/browser/cjs/D9SYWsd_viMxXbL_.cjs +0 -6
  109. package/browser/cjs/DMIPzZRAbLsma6rR.cjs +0 -7
  110. package/browser/cjs/DPTxGnV0pA87nrhG.cjs +0 -32
  111. package/browser/cjs/DTtUhkXmo3x2L2GG.cjs +0 -6
  112. package/browser/cjs/DgBFcVOVhZuytQ4k.cjs +0 -6
  113. package/browser/cjs/DoCfDJUgwatpHG4J.cjs +0 -1501
  114. package/browser/cjs/Dwc5vGQ4nkaSmift.cjs +0 -6
  115. package/browser/cjs/GbU6d05bhcxQrAUD.cjs +0 -15
  116. package/browser/cjs/OW7aZPHGxXjRF38A.cjs +0 -6
  117. package/browser/cjs/WQBNSYPbQzvO23r-.cjs +0 -6
  118. package/browser/cjs/XF920uRM7LSmFp49.cjs +0 -6
  119. package/browser/cjs/XazDEHRGho7wJTUR.cjs +0 -6
  120. package/browser/cjs/Zjw2XvR7-Zfykt20.cjs +0 -6
  121. package/browser/cjs/eM5uLWq0QtvNN4O-.cjs +0 -6
  122. package/browser/cjs/gjPOOFOH_THG1O-L.cjs +0 -6
  123. package/browser/cjs/hhZA8Q_VAVRnX3Rz.cjs +0 -7
  124. package/browser/cjs/qjCnEqCfcXzLIady.cjs +0 -6
  125. package/browser/cjs/s238D5kFNyDNYzIV.cjs +0 -6
  126. package/browser/cjs/t-6Fa6b5-CXTHDjn.cjs +0 -6
  127. package/browser/cjs/zvHV2c0_QPS3v2Wt.cjs +0 -11
  128. package/browser/esm/B-v14ikVOXpmpHCI.mjs +0 -5560
  129. package/browser/esm/B1M7fpFXcO34FZ5C.mjs +0 -29
  130. package/browser/esm/B6nZCfPr7UmxzAi6.mjs +0 -48671
  131. package/browser/esm/B7k3pb4haBsw-Yvr.mjs +0 -10
  132. package/browser/esm/B8ajmWm1J-ZsmBzK.mjs +0 -10
  133. package/browser/esm/BGvKR9TNj2ORlcKm.mjs +0 -10
  134. package/browser/esm/Bc8y371ooCwvBkRs.mjs +0 -10
  135. package/browser/esm/BezHCUZawkIGzzUm.mjs +0 -422
  136. package/browser/esm/BnxMjyy6JPTUe9Lg.mjs +0 -10
  137. package/browser/esm/BskzQvqHyjuVccIH.mjs +0 -22
  138. package/browser/esm/BzS_V6RkpVpk_d1w.mjs +0 -472
  139. package/browser/esm/CM--Vw5PcrLIXc8O.mjs +0 -12
  140. package/browser/esm/CflOcniWVa_VR5Wy.mjs +0 -10
  141. package/browser/esm/Cn9w-KgbsxAKNj6s.mjs +0 -10
  142. package/browser/esm/D6KdwQgZEBMy0260.mjs +0 -10
  143. package/browser/esm/DAOw8vm-XsJ_n7BK.mjs +0 -10
  144. package/browser/esm/DIKvxkHBBvYo2rnC.mjs +0 -10
  145. package/browser/esm/DNVkA-vwqtIw6aKf.mjs +0 -1575
  146. package/browser/esm/DTS0EgQuwHdS5aQN.mjs +0 -10
  147. package/browser/esm/DaeiyDhcdRvg5nGs.mjs +0 -1466
  148. package/browser/esm/DeSyxK8Ibb-tIa67.mjs +0 -10
  149. package/browser/esm/DgPz063GFvbhOHHK.mjs +0 -10
  150. package/browser/esm/Di8gWiOWhfFzcOuw.mjs +0 -21
  151. package/browser/esm/Dlg7LT4wsJCPSTCT.mjs +0 -46
  152. package/browser/esm/DqDxWoCftkWurpDk.mjs +0 -10
  153. package/browser/esm/DupExqAEenu5ZS6G.mjs +0 -820
  154. package/browser/esm/Dy1zdTKMeT50nXcy.mjs +0 -10
  155. package/browser/esm/Dz_O3du2SrhYK47v.mjs +0 -10
  156. package/browser/esm/IbCi65rCiiLS_OGe.mjs +0 -46
  157. package/browser/esm/R2Li5a5IPMuoQEGD.mjs +0 -10
  158. package/browser/esm/SWzqhkO1HABv0bfG.mjs +0 -10
  159. package/browser/esm/VDflSVY_vwi7ZcHQ.mjs +0 -3922
  160. package/browser/esm/dAJOajC7rsn3_hWk.mjs +0 -10
  161. package/browser/esm/fvsQWBiDZg7zRYOa.mjs +0 -10
  162. package/browser/esm/o8Z04Tjc17JBUDsL.mjs +0 -10
  163. package/browser/esm/qbGHKDeXrxvghjMt.mjs +0 -24
  164. package/browser/esm/uk5NsqjbkRuKv1vU.mjs +0 -10
  165. package/cdn/assets/B2P82Dvadjo7-hRY.js +0 -1466
  166. package/cdn/assets/B7k3pb4haBsw-Yvr.js +0 -10
  167. package/cdn/assets/B8ajmWm1J-ZsmBzK.js +0 -10
  168. package/cdn/assets/BFDOApZozGNnJdxs.js +0 -46
  169. package/cdn/assets/BGvKR9TNj2ORlcKm.js +0 -10
  170. package/cdn/assets/BJgFwyqDjKdTH0xW.js +0 -422
  171. package/cdn/assets/BKxjmGpW0pe8KUzm.js +0 -472
  172. package/cdn/assets/Bc8y371ooCwvBkRs.js +0 -10
  173. package/cdn/assets/BnxMjyy6JPTUe9Lg.js +0 -10
  174. package/cdn/assets/CM--Vw5PcrLIXc8O.js +0 -12
  175. package/cdn/assets/COS-oUtP1lQi0Hd8.js +0 -22
  176. package/cdn/assets/CSxbcCsSh3AdRzkk.js +0 -3922
  177. package/cdn/assets/CflOcniWVa_VR5Wy.js +0 -10
  178. package/cdn/assets/Cn9w-KgbsxAKNj6s.js +0 -10
  179. package/cdn/assets/Cqyz2pkIcU2pAivO.js +0 -5560
  180. package/cdn/assets/CuYtiG4SP9OK6dJP.js +0 -1575
  181. package/cdn/assets/D6KdwQgZEBMy0260.js +0 -10
  182. package/cdn/assets/DAOw8vm-XsJ_n7BK.js +0 -10
  183. package/cdn/assets/DCwhACFXcpYD60H9.js +0 -820
  184. package/cdn/assets/DIKvxkHBBvYo2rnC.js +0 -10
  185. package/cdn/assets/DOLBqVto8cJdYLWp.js +0 -46
  186. package/cdn/assets/DTS0EgQuwHdS5aQN.js +0 -10
  187. package/cdn/assets/DeSyxK8Ibb-tIa67.js +0 -10
  188. package/cdn/assets/Dew12-owBXPNmL1S.js +0 -29
  189. package/cdn/assets/DgPz063GFvbhOHHK.js +0 -10
  190. package/cdn/assets/Di8gWiOWhfFzcOuw.js +0 -21
  191. package/cdn/assets/DqDxWoCftkWurpDk.js +0 -10
  192. package/cdn/assets/Dy1zdTKMeT50nXcy.js +0 -10
  193. package/cdn/assets/Dz_O3du2SrhYK47v.js +0 -10
  194. package/cdn/assets/G9bfOnISYlZUeW4U.js +0 -48518
  195. package/cdn/assets/R2Li5a5IPMuoQEGD.js +0 -10
  196. package/cdn/assets/SWzqhkO1HABv0bfG.js +0 -10
  197. package/cdn/assets/dAJOajC7rsn3_hWk.js +0 -10
  198. package/cdn/assets/fvsQWBiDZg7zRYOa.js +0 -10
  199. package/cdn/assets/o8Z04Tjc17JBUDsL.js +0 -10
  200. package/cdn/assets/qbGHKDeXrxvghjMt.js +0 -24
  201. package/cdn/assets/uk5NsqjbkRuKv1vU.js +0 -10
@@ -1,124 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.3.3
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./6AlZR3dVayTg7C5E.cjs");var Co=typeof global=="object"&&global&&global.Object===Object&&global,Us=typeof self=="object"&&self&&self.Object===Object&&self,wt=Co||Us||Function("return this")(),It=wt.Symbol,ko=Object.prototype,Fs=ko.hasOwnProperty,Ds=ko.toString,Ie=It?It.toStringTag:void 0,js=Object.prototype.toString,Vr=It?It.toStringTag:void 0;function Qt(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Vr&&Vr in Object(t)?function(n){var r=Fs.call(n,Ie),i=n[Ie];try{n[Ie]=void 0;var o=!0}catch{}var s=Ds.call(n);return o&&(r?n[Ie]=i:delete n[Ie]),s}(t):(e=t,js.call(e));var e}function Ot(t){return t!=null&&typeof t=="object"}function An(t){return typeof t=="symbol"||Ot(t)&&Qt(t)=="[object Symbol]"}function In(t,e){for(var n=-1,r=t==null?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}var B=Array.isArray,Hr=It?It.prototype:void 0,Yr=Hr?Hr.toString:void 0;function bo(t){if(typeof t=="string")return t;if(B(t))return In(t,bo)+"";if(An(t))return Yr?Yr.call(t):"";var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}var Bs=/\s/,$s=/^\s+/;function Rt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Ws=/^[-+]0x[0-9a-f]+$/i,Gs=/^0b[01]+$/i,Ks=/^0o[0-7]+$/i,zs=parseInt,Vs=1/0;function Rn(t){var e=function(r){return r?(r=function(i){if(typeof i=="number")return i;if(An(i))return NaN;if(Rt(i)){var o=typeof i.valueOf=="function"?i.valueOf():i;i=Rt(o)?o+"":o}if(typeof i!="string")return i===0?i:+i;var s;i=(s=i)&&s.slice(0,function(c){for(var u=c.length;u--&&Bs.test(c.charAt(u)););return u}(s)+1).replace($s,"");var a=Gs.test(i);return a||Ks.test(i)?zs(i.slice(2),a?2:8):Ws.test(i)?NaN:+i}(r))===Vs||r===-1/0?17976931348623157e292*(r<0?-1:1):r==r?r:0:r===0?r:0}(t),n=e%1;return e==e?n?e-n:e:0}function pe(t){return t}function Yt(t){if(!Rt(t))return!1;var e=Qt(t);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"}var Xr,Pn=wt["__core-js_shared__"],qr=(Xr=/[^.]+$/.exec(Pn&&Pn.keys&&Pn.keys.IE_PROTO||""))?"Symbol(src)_1."+Xr:"",Hs=Function.prototype.toString;function oe(t){if(t!=null){try{return Hs.call(t)}catch{}try{return t+""}catch{}}return""}var Ys=/^\[object .+?Constructor\]$/,Xs=Function.prototype,qs=Object.prototype,Zs=Xs.toString,Qs=qs.hasOwnProperty,Js=RegExp("^"+Zs.call(Qs).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function se(t,e){var n,r,i,o,s=(n=t,r=e,n?.[r]);return Rt(i=s)&&(o=i,!qr||!(qr in o))&&(Yt(i)?Js:Ys).test(oe(i))?s:void 0}var cr=se(wt,"WeakMap"),Zr=Object.create,ta=function(){function t(){}return function(e){if(!Rt(e))return{};if(Zr)return Zr(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();function Z(){}var Qr,wn,Mn,ea=Date.now,cn=function(){try{var t=se(Object,"defineProperty");return t({},"",{}),t}catch{}}(),na=cn?function(t,e){return cn(t,"toString",{configurable:!0,enumerable:!1,value:(n=e,function(){return n}),writable:!0});var n}:pe,ra=(Qr=na,wn=0,Mn=0,function(){var t=ea(),e=16-(t-Mn);if(Mn=t,e>0){if(++wn>=800)return arguments[0]}else wn=0;return Qr.apply(void 0,arguments)});function Po(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function wo(t,e,n,r){for(var i=t.length,o=n+-1;++o<i;)if(e(t[o],o,t))return o;return-1}function ia(t){return t!=t}function kr(t,e,n){return e==e?function(r,i,o){for(var s=o-1,a=r.length;++s<a;)if(r[s]===i)return s;return-1}(t,e,n):wo(t,ia,n)}function Mo(t,e){return!(t==null||!t.length)&&kr(t,e,0)>-1}var oa=/^(?:0|[1-9]\d*)$/;function Nn(t,e){var n=typeof t;return!!(e=e??9007199254740991)&&(n=="number"||n!="symbol"&&oa.test(t))&&t>-1&&t%1==0&&t<e}function br(t,e,n){e=="__proto__"&&cn?cn(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function $e(t,e){return t===e||t!=t&&e!=e}var sa=Object.prototype.hasOwnProperty;function yn(t,e,n){var r=t[e];sa.call(t,e)&&$e(r,n)&&(n!==void 0||e in t)||br(t,e,n)}function ur(t,e,n,r){var i=!n;n||(n={});for(var o=-1,s=e.length;++o<s;){var a=e[o],c=void 0;c===void 0&&(c=t[a]),i?br(n,a,c):yn(n,a,c)}return n}var Jr=Math.max;function Pr(t,e){return ra((n=t,i=pe,r=Jr((r=e)===void 0?n.length-1:r,0),function(){for(var o=arguments,s=-1,a=Jr(o.length-r,0),c=Array(a);++s<a;)c[s]=o[r+s];s=-1;for(var u=Array(r+1);++s<r;)u[s]=o[s];return u[r]=i(c),function(l,h,I){switch(I.length){case 0:return l.call(h);case 1:return l.call(h,I[0]);case 2:return l.call(h,I[0],I[1]);case 3:return l.call(h,I[0],I[1],I[2])}return l.apply(h,I)}(n,this,u)}),t+"");var n,r,i}function wr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=9007199254740991}function Mt(t){return t!=null&&wr(t.length)&&!Yt(t)}function Uo(t,e,n){if(!Rt(n))return!1;var r=typeof e;return!!(r=="number"?Mt(n)&&Nn(e,n.length):r=="string"&&e in n)&&$e(n[e],t)}var aa=Object.prototype;function We(t){var e=t&&t.constructor;return t===(typeof e=="function"&&e.prototype||aa)}function ti(t){return Ot(t)&&Qt(t)=="[object Arguments]"}var Fo=Object.prototype,ca=Fo.hasOwnProperty,ua=Fo.propertyIsEnumerable,vn=ti(function(){return arguments}())?ti:function(t){return Ot(t)&&ca.call(t,"callee")&&!ua.call(t,"callee")},Do=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ei=Do&&typeof module=="object"&&module&&!module.nodeType&&module,ni=ei&&ei.exports===Do?wt.Buffer:void 0,we=(ni?ni.isBuffer:void 0)||function(){return!1},z={};function On(t){return function(e){return t(e)}}z["[object Float32Array]"]=z["[object Float64Array]"]=z["[object Int8Array]"]=z["[object Int16Array]"]=z["[object Int32Array]"]=z["[object Uint8Array]"]=z["[object Uint8ClampedArray]"]=z["[object Uint16Array]"]=z["[object Uint32Array]"]=!0,z["[object Arguments]"]=z["[object Array]"]=z["[object ArrayBuffer]"]=z["[object Boolean]"]=z["[object DataView]"]=z["[object Date]"]=z["[object Error]"]=z["[object Function]"]=z["[object Map]"]=z["[object Number]"]=z["[object Object]"]=z["[object RegExp]"]=z["[object Set]"]=z["[object String]"]=z["[object WeakMap]"]=!1;var jo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xe=jo&&typeof module=="object"&&module&&!module.nodeType&&module,Un=xe&&xe.exports===jo&&Co.process,qt=function(){try{return xe&&xe.require&&xe.require("util").types||Un&&Un.binding&&Un.binding("util")}catch{}}(),ri=qt&&qt.isTypedArray,Mr=ri?On(ri):function(t){return Ot(t)&&wr(t.length)&&!!z[Qt(t)]},la=Object.prototype.hasOwnProperty;function Bo(t,e){var n=B(t),r=!n&&vn(t),i=!n&&!r&&we(t),o=!n&&!r&&!i&&Mr(t),s=n||r||i||o,a=s?function(l,h){for(var I=-1,v=Array(l);++I<l;)v[I]=h(I);return v}(t.length,String):[],c=a.length;for(var u in t)!e&&!la.call(t,u)||s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Nn(u,c))||a.push(u);return a}function $o(t,e){return function(n){return t(e(n))}}var ha=$o(Object.keys,Object),fa=Object.prototype.hasOwnProperty;function Wo(t){if(!We(t))return ha(t);var e=[];for(var n in Object(t))fa.call(t,n)&&n!="constructor"&&e.push(n);return e}function Nt(t){return Mt(t)?Bo(t):Wo(t)}var Fn,da=Object.prototype.hasOwnProperty,dt=(Fn=function(t,e){if(We(e)||Mt(e))ur(e,Nt(e),t);else for(var n in e)da.call(e,n)&&yn(t,n,e[n])},Pr(function(t,e){var n=-1,r=e.length,i=r>1?e[r-1]:void 0,o=r>2?e[2]:void 0;for(i=Fn.length>3&&typeof i=="function"?(r--,i):void 0,o&&Uo(e[0],e[1],o)&&(i=r<3?void 0:i,r=1),t=Object(t);++n<r;){var s=e[n];s&&Fn(t,s)}return t})),pa=Object.prototype.hasOwnProperty;function Go(t){return Mt(t)?Bo(t,!0):function(e){if(!Rt(e))return function(o){var s=[];if(o!=null)for(var a in Object(o))s.push(a);return s}(e);var n=We(e),r=[];for(var i in e)(i!="constructor"||!n&&pa.call(e,i))&&r.push(i);return r}(t)}var ma=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ea=/^\w*$/;function lr(t,e){if(B(t))return!1;var n=typeof t;return!(n!="number"&&n!="symbol"&&n!="boolean"&&t!=null&&!An(t))||Ea.test(t)||!ma.test(t)||e!=null&&t in Object(e)}var Re=se(Object,"create"),ga=Object.prototype.hasOwnProperty,Ta=Object.prototype.hasOwnProperty;function ne(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ke(t,e){for(var n=t.length;n--;)if($e(t[n][0],e))return n;return-1}ne.prototype.clear=function(){this.__data__=Re?Re(null):{},this.size=0},ne.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ne.prototype.get=function(t){var e=this.__data__;if(Re){var n=e[t];return n==="__lodash_hash_undefined__"?void 0:n}return ga.call(e,t)?e[t]:void 0},ne.prototype.has=function(t){var e=this.__data__;return Re?e[t]!==void 0:Ta.call(e,t)},ne.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Re&&e===void 0?"__lodash_hash_undefined__":e,this};var Aa=Array.prototype.splice;function Vt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Vt.prototype.clear=function(){this.__data__=[],this.size=0},Vt.prototype.delete=function(t){var e=this.__data__,n=Ke(e,t);return!(n<0||(n==e.length-1?e.pop():Aa.call(e,n,1),--this.size,0))},Vt.prototype.get=function(t){var e=this.__data__,n=Ke(e,t);return n<0?void 0:e[n][1]},Vt.prototype.has=function(t){return Ke(this.__data__,t)>-1},Vt.prototype.set=function(t,e){var n=this.__data__,r=Ke(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};var Me=se(wt,"Map");function ze(t,e){var n,r,i=t.__data__;return((r=typeof(n=e))=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null)?i[typeof e=="string"?"string":"hash"]:i.map}function Gt(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Ur(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(Ur.Cache||Gt),n}Gt.prototype.clear=function(){this.size=0,this.__data__={hash:new ne,map:new(Me||Vt),string:new ne}},Gt.prototype.delete=function(t){var e=ze(this,t).delete(t);return this.size-=e?1:0,e},Gt.prototype.get=function(t){return ze(this,t).get(t)},Gt.prototype.has=function(t){return ze(this,t).has(t)},Gt.prototype.set=function(t,e){var n=ze(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this},Ur.Cache=Gt;var Dn,jn,Ia=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ra=/\\(\\)?/g,Na=(Dn=Ur(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Ia,function(n,r,i,o){e.push(i?o.replace(Ra,"$1"):r||n)}),e},function(t){return jn.size===500&&jn.clear(),t}),jn=Dn.cache,Dn);function Sn(t,e){return B(t)?t:lr(t,e)?[t]:Na((n=t)==null?"":bo(n));var n}function Ue(t){if(typeof t=="string"||An(t))return t;var e=t+"";return e=="0"&&1/t==-1/0?"-0":e}function hr(t,e){for(var n=0,r=(e=Sn(e,t)).length;t!=null&&n<r;)t=t[Ue(e[n++])];return n&&n==r?t:void 0}function Fr(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}var ii=It?It.isConcatSpreadable:void 0;function ya(t){return B(t)||vn(t)||!!(ii&&t&&t[ii])}function Dr(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=ya),i||(i=[]);++o<s;){var a=t[o];n(a)?Fr(i,a):r||(i[i.length]=a)}return i}function yt(t){return t!=null&&t.length?Dr(t):[]}var Ko=$o(Object.getPrototypeOf,Object);function zo(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}function va(t,e,n,r){var i=-1,o=t==null?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function bt(t){var e=this.__data__=new Vt(t);this.size=e.size}bt.prototype.clear=function(){this.__data__=new Vt,this.size=0},bt.prototype.delete=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n},bt.prototype.get=function(t){return this.__data__.get(t)},bt.prototype.has=function(t){return this.__data__.has(t)},bt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof Vt){var r=n.__data__;if(!Me||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Gt(r)}return n.set(t,e),this.size=n.size,this};var Vo=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oi=Vo&&typeof module=="object"&&module&&!module.nodeType&&module,si=oi&&oi.exports===Vo?wt.Buffer:void 0,ai=si?si.allocUnsafe:void 0;function jr(t,e){for(var n=-1,r=t==null?0:t.length,i=0,o=[];++n<r;){var s=t[n];e(s,n,t)&&(o[i++]=s)}return o}function Ho(){return[]}var Oa=Object.prototype.propertyIsEnumerable,ci=Object.getOwnPropertySymbols,Br=ci?function(t){return t==null?[]:(t=Object(t),jr(ci(t),function(e){return Oa.call(t,e)}))}:Ho,Sa=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Fr(e,Br(t)),t=Ko(t);return e}:Ho;function Yo(t,e,n){var r=e(t);return B(t)?r:Fr(r,n(t))}function fr(t){return Yo(t,Nt,Br)}var dr=se(wt,"DataView"),pr=se(wt,"Promise"),fe=se(wt,"Set"),ui="[object Map]",li="[object Promise]",hi="[object Set]",fi="[object WeakMap]",di="[object DataView]",_a=oe(dr),La=oe(Me),xa=oe(pr),Ca=oe(fe),ka=oe(cr),At=Qt;(dr&&At(new dr(new ArrayBuffer(1)))!=di||Me&&At(new Me)!=ui||pr&&At(pr.resolve())!=li||fe&&At(new fe)!=hi||cr&&At(new cr)!=fi)&&(At=function(t){var e=Qt(t),n=e=="[object Object]"?t.constructor:void 0,r=n?oe(n):"";if(r)switch(r){case _a:return di;case La:return ui;case xa:return li;case Ca:return hi;case ka:return fi}return e});var ba=Object.prototype.hasOwnProperty,un=wt.Uint8Array,Pa=/\w*$/,pi=It?It.prototype:void 0,mi=pi?pi.valueOf:void 0,Ei=qt&&qt.isMap,wa=Ei?On(Ei):function(t){return Ot(t)&&At(t)=="[object Map]"},gi=qt&&qt.isSet,Ma=gi?On(gi):function(t){return Ot(t)&&At(t)=="[object Set]"},Xo="[object Arguments]",qo="[object Function]",Zo="[object Object]",G={};function Je(t,e,n,r,i,o){var s;if(s!==void 0)return s;if(!Rt(t))return t;var a,c,u,l=B(t);if(l)return c=(a=t).length,u=new a.constructor(c),c&&typeof a[0]=="string"&&ba.call(a,"index")&&(u.index=a.index,u.input=a.input),function(g,d){var A=-1,N=g.length;for(d||(d=Array(N));++A<N;)d[A]=g[A];return d}(t,s=u);var h,I,v,O=At(t),x=O==qo||O=="[object GeneratorFunction]";if(we(t))return I=(h=t).length,v=ai?ai(I):new h.constructor(I),h.copy(v),v;if(O==Zo||O==Xo||x&&!i)return s=x?{}:function(g){return typeof g.constructor!="function"||We(g)?{}:ta(Ko(g))}(t),function(g,d){return ur(g,Br(g),d)}(t,function(g,d){return g&&ur(d,Nt(d),g)}(s,t));if(!G[O])return i?t:{};s=function(g,d){var A,N,f,m,p,E,R,P,L,y=g.constructor;switch(d){case"[object ArrayBuffer]":return p=new(m=g).constructor(m.byteLength),new un(p).set(new un(m)),p;case"[object Boolean]":case"[object Date]":return new y(+g);case"[object DataView]":return f=(N=g).buffer,new N.constructor(f,N.byteOffset,N.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return R=(E=g).buffer,new E.constructor(R,E.byteOffset,E.length);case"[object Map]":case"[object Set]":return new y;case"[object Number]":case"[object String]":return new y(g);case"[object RegExp]":return(L=new(P=g).constructor(P.source,Pa.exec(P))).lastIndex=P.lastIndex,L;case"[object Symbol]":return A=g,mi?Object(mi.call(A)):{}}}(t,O),o||(o=new bt);var _=o.get(t);if(_)return _;o.set(t,s),Ma(t)?t.forEach(function(g){s.add(Je(g,e,n,g,t,o))}):wa(t)&&t.forEach(function(g,d){s.set(d,Je(g,e,n,d,t,o))});var T=l?void 0:fr(t);return Po(T||t,function(g,d){T&&(g=t[d=g]),yn(s,d,Je(g,e,n,d,t,o))}),s}function et(t){return Je(t,4)}function Fe(t){for(var e=-1,n=t==null?0:t.length,r=0,i=[];++e<n;){var o=t[e];o&&(i[r++]=o)}return i}function de(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Gt;++e<n;)this.add(t[e])}function Qo(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function $r(t,e){return t.has(e)}function Ti(t,e,n,r,i,o){var s=1&n,a=t.length,c=e.length;if(a!=c&&!(s&&c>a))return!1;var u=o.get(t),l=o.get(e);if(u&&l)return u==e&&l==t;var h=-1,I=!0,v=2&n?new de:void 0;for(o.set(t,e),o.set(e,t);++h<a;){var O=t[h],x=e[h];if(r)var _=s?r(x,O,h,e,t,o):r(O,x,h,t,e,o);if(_!==void 0){if(_)continue;I=!1;break}if(v){if(!Qo(e,function(T,g){if(!$r(v,g)&&(O===T||i(O,T,n,r,o)))return v.push(g)})){I=!1;break}}else if(O!==x&&!i(O,x,n,r,o)){I=!1;break}}return o.delete(t),o.delete(e),I}function Ua(t){var e=-1,n=Array(t.size);return t.forEach(function(r,i){n[++e]=[i,r]}),n}function Wr(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}G[Xo]=G["[object Array]"]=G["[object ArrayBuffer]"]=G["[object DataView]"]=G["[object Boolean]"]=G["[object Date]"]=G["[object Float32Array]"]=G["[object Float64Array]"]=G["[object Int8Array]"]=G["[object Int16Array]"]=G["[object Int32Array]"]=G["[object Map]"]=G["[object Number]"]=G[Zo]=G["[object RegExp]"]=G["[object Set]"]=G["[object String]"]=G["[object Symbol]"]=G["[object Uint8Array]"]=G["[object Uint8ClampedArray]"]=G["[object Uint16Array]"]=G["[object Uint32Array]"]=!0,G["[object Error]"]=G[qo]=G["[object WeakMap]"]=!1,de.prototype.add=de.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},de.prototype.has=function(t){return this.__data__.has(t)};var Ai=It?It.prototype:void 0,Bn=Ai?Ai.valueOf:void 0,Fa=Object.prototype.hasOwnProperty,Ii="[object Arguments]",Ri="[object Array]",Ve="[object Object]",Ni=Object.prototype.hasOwnProperty;function mr(t,e,n,r,i){return t===e||(t==null||e==null||!Ot(t)&&!Ot(e)?t!=t&&e!=e:function(o,s,a,c,u,l){var h=B(o),I=B(s),v=h?Ri:At(o),O=I?Ri:At(s),x=(v=v==Ii?Ve:v)==Ve,_=(O=O==Ii?Ve:O)==Ve,T=v==O;if(T&&we(o)){if(!we(s))return!1;h=!0,x=!1}if(T&&!x)return l||(l=new bt),h||Mr(o)?Ti(o,s,a,c,u,l):function(f,m,p,E,R,P,L){switch(p){case"[object DataView]":if(f.byteLength!=m.byteLength||f.byteOffset!=m.byteOffset)return!1;f=f.buffer,m=m.buffer;case"[object ArrayBuffer]":return!(f.byteLength!=m.byteLength||!P(new un(f),new un(m)));case"[object Boolean]":case"[object Date]":case"[object Number]":return $e(+f,+m);case"[object Error]":return f.name==m.name&&f.message==m.message;case"[object RegExp]":case"[object String]":return f==m+"";case"[object Map]":var y=Ua;case"[object Set]":var M=1&E;if(y||(y=Wr),f.size!=m.size&&!M)return!1;var C=L.get(f);if(C)return C==m;E|=2,L.set(f,m);var k=Ti(y(f),y(m),E,R,P,L);return L.delete(f),k;case"[object Symbol]":if(Bn)return Bn.call(f)==Bn.call(m)}return!1}(o,s,v,a,c,u,l);if(!(1&a)){var g=x&&Ni.call(o,"__wrapped__"),d=_&&Ni.call(s,"__wrapped__");if(g||d){var A=g?o.value():o,N=d?s.value():s;return l||(l=new bt),u(A,N,a,c,l)}}return!!T&&(l||(l=new bt),function(f,m,p,E,R,P){var L=1&p,y=fr(f),M=y.length;if(M!=fr(m).length&&!L)return!1;for(var C=M;C--;){var k=y[C];if(!(L?k in m:Fa.call(m,k)))return!1}var $=P.get(f),X=P.get(m);if($&&X)return $==m&&X==f;var W=!0;P.set(f,m),P.set(m,f);for(var rt=L;++C<M;){var mt=f[k=y[C]],Ct=m[k];if(E)var Ae=L?E(Ct,mt,k,m,f,P):E(mt,Ct,k,f,m,P);if(!(Ae===void 0?mt===Ct||R(mt,Ct,p,E,P):Ae)){W=!1;break}rt||(rt=k=="constructor")}if(W&&!rt){var nt=f.constructor,Jt=m.constructor;nt==Jt||!("constructor"in f)||!("constructor"in m)||typeof nt=="function"&&nt instanceof nt&&typeof Jt=="function"&&Jt instanceof Jt||(W=!1)}return P.delete(f),P.delete(m),W}(o,s,a,c,u,l))}(t,e,n,r,mr,i))}function yi(t){return t==t&&!Rt(t)}function vi(t,e){return function(n){return n!=null&&n[t]===e&&(e!==void 0||t in Object(n))}}function Da(t,e){return t!=null&&e in Object(t)}function Jo(t,e,n){for(var r=-1,i=(e=Sn(e,t)).length,o=!1;++r<i;){var s=Ue(e[r]);if(!(o=t!=null&&n(t,s)))break;t=t[s]}return o||++r!=i?o:!!(i=t==null?0:t.length)&&wr(i)&&Nn(s,i)&&(B(t)||vn(t))}function Pt(t){return typeof t=="function"?t:t==null?pe:typeof t=="object"?B(t)?(e=t[0],n=t[1],lr(e)&&yi(n)?vi(Ue(e),n):function(r){var i,o,s,a,c=(o=(i=r)==null?void 0:hr(i,e))===void 0?void 0:o;return c===void 0&&c===n?(a=e,(s=r)!=null&&Jo(s,a,Da)):mr(n,c,3)}):function(r){var i=function(o){for(var s=Nt(o),a=s.length;a--;){var c=s[a],u=o[c];s[a]=[c,u,yi(u)]}return s}(r);return i.length==1&&i[0][2]?vi(i[0][0],i[0][1]):function(o){return o===r||function(s,a,c){var u=c.length,l=u;if(s==null)return!l;for(s=Object(s);u--;){var h=c[u];if(h[2]?h[1]!==s[h[0]]:!(h[0]in s))return!1}for(;++u<l;){var I=(h=c[u])[0],v=s[I],O=h[1];if(h[2]){if(v===void 0&&!(I in s))return!1}else if(!mr(O,v,3,void 0,new bt))return!1}return!0}(o,0,i)}}(t):function(r){return lr(r)?(i=Ue(r),function(o){return o?.[i]}):function(o){return function(s){return hr(s,o)}}(r);var i}(t);var e,n}function ja(t,e,n,r){for(var i=-1,o=t==null?0:t.length;++i<o;){var s=t[i];e(r,s,n(s),t)}return r}var Oi,ae=(Oi=function(t,e){return t&&function(n,r,i){for(var o=-1,s=Object(n),a=i(n),c=a.length;c--;){var u=a[++o];if(r(s[u],u,s)===!1)break}return n}(t,e,Nt)},function(t,e){if(t==null)return t;if(!Mt(t))return Oi(t,e);for(var n=t.length,r=-1,i=Object(t);++r<n&&e(i[r],r,i)!==!1;);return t});function Ba(t,e,n,r){return ae(t,function(i,o,s){e(r,i,n(i),s)}),r}var ts=Object.prototype,$a=ts.hasOwnProperty,Er=Pr(function(t,e){t=Object(t);var n=-1,r=e.length,i=r>2?e[2]:void 0;for(i&&Uo(e[0],e[1],i)&&(r=1);++n<r;)for(var o=e[n],s=Go(o),a=-1,c=s.length;++a<c;){var u=s[a],l=t[u];(l===void 0||$e(l,ts[u])&&!$a.call(t,u))&&(t[u]=o[u])}return t});function Si(t){return Ot(t)&&Mt(t)}var ln=Pr(function(t,e){return Si(t)?function(n,r){var i=-1,o=Mo,s=!0,a=n.length,c=[],u=r.length;if(!a)return c;r.length>=200&&(o=$r,s=!1,r=new de(r));t:for(;++i<a;){var l=n[i],h=l;if(l=l!==0?l:0,s&&h==h){for(var I=u;I--;)if(r[I]===h)continue t;c.push(l)}else o(r,h,void 0)||c.push(l)}return c}(t,Dr(e,0,Si,!0)):[]});function me(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}function tt(t,e,n){var r=t==null?0:t.length;return r?zo(t,(e=e===void 0?1:Rn(e))<0?0:e,r):[]}function De(t,e,n){var r=t==null?0:t.length;return r?zo(t,0,(e=r-(e=e===void 0?1:Rn(e)))<0?0:e):[]}function U(t,e){var n;return(B(t)?Po:ae)(t,typeof(n=e)=="function"?n:pe)}function Wa(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}function Ga(t,e){var n=!0;return ae(t,function(r,i,o){return n=!!e(r,i,o)}),n}function vt(t,e,n){return(B(t)?Wa:Ga)(t,Pt(e))}function es(t,e){var n=[];return ae(t,function(r,i,o){e(r,i,o)&&n.push(r)}),n}function gt(t,e){return(B(t)?jr:es)(t,Pt(e))}var _i,Ka=Math.max,Ee=(_i=function(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:Rn(n);return i<0&&(i=Ka(r+i,0)),wo(t,Pt(e),i)},function(t,e,n){var r=Object(t);if(!Mt(t)){var i=Pt(e);t=Nt(t),e=function(s){return i(r[s],s,r)}}var o=_i(t,e,n);return o>-1?r[i?t[o]:o]:void 0});function St(t){return t&&t.length?t[0]:void 0}function za(t,e){var n=-1,r=Mt(t)?Array(t.length):[];return ae(t,function(i,o,s){r[++n]=e(i,o,s)}),r}function b(t,e){return(B(t)?In:za)(t,Pt(e))}function Tt(t,e){return Dr(b(t,e))}var Li,Va=Object.prototype.hasOwnProperty,Ha=(Li=function(t,e,n){Va.call(t,n)?t[n].push(e):br(t,n,[e])},function(t,e){return(B(t)?ja:Ba)(t,Li,Pt(e),{})}),Ya=Object.prototype.hasOwnProperty;function Xa(t,e){return t!=null&&Ya.call(t,e)}function w(t,e){return t!=null&&Jo(t,e,Xa)}function ut(t){return typeof t=="string"||!B(t)&&Ot(t)&&Qt(t)=="[object String]"}function Q(t){return t==null?[]:(e=t,In(Nt(t),function(n){return e[n]}));var e}var qa=Math.max;function at(t,e,n,r){t=Mt(t)?t:Q(t),n=n?Rn(n):0;var i=t.length;return n<0&&(n=qa(i+n,0)),ut(t)?n<=i&&t.indexOf(e,n)>-1:!!i&&kr(t,e,n)>-1}function xi(t,e,n){return t!=null&&t.length?kr(t,e,0):-1}var Za=Object.prototype.hasOwnProperty;function K(t){if(t==null)return!0;if(Mt(t)&&(B(t)||typeof t=="string"||typeof t.splice=="function"||we(t)||Mr(t)||vn(t)))return!t.length;var e=At(t);if(e=="[object Map]"||e=="[object Set]")return!t.size;if(We(t))return!Wo(t).length;for(var n in t)if(Za.call(t,n))return!1;return!0}var Ci=qt&&qt.isRegExp,Kt=Ci?On(Ci):function(t){return Ot(t)&&Qt(t)=="[object RegExp]"};function Ht(t){return t===void 0}function Qa(t,e,n,r){if(!Rt(t))return t;for(var i=-1,o=(e=Sn(e,t)).length,s=o-1,a=t;a!=null&&++i<o;){var c=Ue(e[i]),u=n;if(c==="__proto__"||c==="constructor"||c==="prototype")return t;if(i!=s){var l=a[c];(u=void 0)==null&&(u=Rt(l)?l:Nn(e[i+1])?[]:{})}yn(a,c,u),a=a[c]}return t}function _t(t,e){if(t==null)return{};var n=In(Yo(t,Go,Sa),function(r){return[r]});return e=Pt(e),function(r,i,o){for(var s=-1,a=i.length,c={};++s<a;){var u=i[s],l=hr(r,u);o(l,u)&&Qa(c,Sn(u,r),l)}return c}(t,n,function(r,i){return e(r,i[0])})}function Ja(t,e,n,r,i){return i(t,function(o,s,a){n=r?(r=!1,o):e(n,o,s,a)}),n}function ft(t,e,n){var r=B(t)?va:Ja,i=arguments.length<3;return r(t,Pt(e),n,i,ae)}function tn(t,e){return(B(t)?jr:es)(t,function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){var r=arguments;switch(r.length){case 0:return!n.call(this);case 1:return!n.call(this,r[0]);case 2:return!n.call(this,r[0],r[1]);case 3:return!n.call(this,r[0],r[1],r[2])}return!n.apply(this,r)}}(Pt(e)))}function tc(t,e){var n;return ae(t,function(r,i,o){return!(n=e(r,i,o))}),!!n}function ns(t,e,n){return(B(t)?Qo:tc)(t,Pt(e))}var ec=fe&&1/Wr(new fe([,-0]))[1]==1/0?function(t){return new fe(t)}:Z;function gr(t){return t&&t.length?function(e){var n=-1,r=Mo,i=e.length,o=!0,s=[],a=s;if(i>=200){var c=ec(e);if(c)return Wr(c);o=!1,r=$r,a=new de}else a=s;t:for(;++n<i;){var u=e[n],l=u;if(u=u!==0?u:0,o&&l==l){for(var h=a.length;h--;)if(a[h]===l)continue t;s.push(u)}else r(a,l,void 0)||(a!==s&&a.push(l),s.push(u))}return s}(t):[]}function Tr(t){console&&console.error&&console.error(`Error: ${t}`)}function rs(t){console&&console.warn&&console.warn(`Warning: ${t}`)}function is(t){const e=new Date().getTime(),n=t();return{time:new Date().getTime()-e,value:n}}function os(t){function e(){}e.prototype=t;const n=new e;function r(){return typeof n.bar}return r(),r(),t}function nc(t){return ut((e=t).LABEL)&&e.LABEL!==""?t.LABEL:t.name;var e}class Ut{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),U(this.definition,n=>{n.accept(e)})}}class pt extends Ut{constructor(e){super([]),this.idx=1,dt(this,_t(e,n=>n!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class ge extends Ut{constructor(e){super(e.definition),this.orgText="",dt(this,_t(e,n=>n!==void 0))}}class ht extends Ut{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,dt(this,_t(e,n=>n!==void 0))}}class lt extends Ut{constructor(e){super(e.definition),this.idx=1,dt(this,_t(e,n=>n!==void 0))}}class Ft extends Ut{constructor(e){super(e.definition),this.idx=1,dt(this,_t(e,n=>n!==void 0))}}class Dt extends Ut{constructor(e){super(e.definition),this.idx=1,dt(this,_t(e,n=>n!==void 0))}}class J extends Ut{constructor(e){super(e.definition),this.idx=1,dt(this,_t(e,n=>n!==void 0))}}class Lt extends Ut{constructor(e){super(e.definition),this.idx=1,dt(this,_t(e,n=>n!==void 0))}}class xt extends Ut{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,dt(this,_t(e,n=>n!==void 0))}}class V{constructor(e){this.idx=1,dt(this,_t(e,n=>n!==void 0))}accept(e){e.visit(this)}}function en(t){function e(n){return b(n,en)}if(t instanceof pt){const n={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return ut(t.label)&&(n.label=t.label),n}if(t instanceof ht)return{type:"Alternative",definition:e(t.definition)};if(t instanceof lt)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof Ft)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Dt)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:en(new V({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof Lt)return{type:"RepetitionWithSeparator",idx:t.idx,separator:en(new V({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof J)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof xt)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof V){const n={type:"Terminal",name:t.terminalType.name,label:nc(t.terminalType),idx:t.idx};ut(t.label)&&(n.terminalLabel=t.label);const r=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=Kt(r)?r.source:r),n}if(t instanceof ge)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}class Te{visit(e){const n=e;switch(n.constructor){case pt:return this.visitNonTerminal(n);case ht:return this.visitAlternative(n);case lt:return this.visitOption(n);case Ft:return this.visitRepetitionMandatory(n);case Dt:return this.visitRepetitionMandatoryWithSeparator(n);case Lt:return this.visitRepetitionWithSeparator(n);case J:return this.visitRepetition(n);case xt:return this.visitAlternation(n);case V:return this.visitTerminal(n);case ge:return this.visitRule(n);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function hn(t,e=[]){return t instanceof lt||t instanceof J||t instanceof Lt||(t instanceof xt?ns(t.definition,n=>hn(n,e)):!(t instanceof pt&&at(e,t))&&t instanceof Ut&&(t instanceof pt&&e.push(t),vt(t.definition,n=>hn(n,e))))}function kt(t){if(t instanceof pt)return"SUBRULE";if(t instanceof lt)return"OPTION";if(t instanceof xt)return"OR";if(t instanceof Ft)return"AT_LEAST_ONE";if(t instanceof Dt)return"AT_LEAST_ONE_SEP";if(t instanceof Lt)return"MANY_SEP";if(t instanceof J)return"MANY";if(t instanceof V)return"CONSUME";throw Error("non exhaustive match")}class _n{walk(e,n=[]){U(e.definition,(r,i)=>{const o=tt(e.definition,i+1);if(r instanceof pt)this.walkProdRef(r,o,n);else if(r instanceof V)this.walkTerminal(r,o,n);else if(r instanceof ht)this.walkFlat(r,o,n);else if(r instanceof lt)this.walkOption(r,o,n);else if(r instanceof Ft)this.walkAtLeastOne(r,o,n);else if(r instanceof Dt)this.walkAtLeastOneSep(r,o,n);else if(r instanceof Lt)this.walkManySep(r,o,n);else if(r instanceof J)this.walkMany(r,o,n);else{if(!(r instanceof xt))throw Error("non exhaustive match");this.walkOr(r,o,n)}})}walkTerminal(e,n,r){}walkProdRef(e,n,r){}walkFlat(e,n,r){const i=n.concat(r);this.walk(e,i)}walkOption(e,n,r){const i=n.concat(r);this.walk(e,i)}walkAtLeastOne(e,n,r){const i=[new lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkAtLeastOneSep(e,n,r){const i=ki(e,n,r);this.walk(e,i)}walkMany(e,n,r){const i=[new lt({definition:e.definition})].concat(n,r);this.walk(e,i)}walkManySep(e,n,r){const i=ki(e,n,r);this.walk(e,i)}walkOr(e,n,r){const i=n.concat(r);U(e.definition,o=>{const s=new ht({definition:[o]});this.walk(s,i)})}}function ki(t,e,n){return[new lt({definition:[new V({terminalType:t.separator})].concat(t.definition)})].concat(e,n)}function Ce(t){if(t instanceof pt)return Ce(t.referencedRule);if(t instanceof V)return[t.terminalType];if((e=t)instanceof ht||e instanceof lt||e instanceof J||e instanceof Ft||e instanceof Dt||e instanceof Lt||e instanceof V||e instanceof ge)return function(n){let r=[];const i=n.definition;let o,s=0,a=i.length>s,c=!0;for(;a&&c;)o=i[s],c=hn(o),r=r.concat(Ce(o)),s+=1,a=i.length>s;return gr(r)}(t);var e;if(function(n){return n instanceof xt}(t))return function(n){return gr(yt(b(n.definition,r=>Ce(r))))}(t);throw Error("non exhaustive match")}const ss="_~IN~_";class rc extends _n{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,n,r){}walkProdRef(e,n,r){const i=(o=e.referencedRule,s=e.idx,o.name+s+ss+this.topProd.name);var o,s;const a=n.concat(r),c=Ce(new ht({definition:a}));this.follows[i]=c}}function F(t){return t.charCodeAt(0)}function $n(t,e){Array.isArray(t)?t.forEach(function(n){e.push(n)}):e.push(t)}function Ne(t,e){if(t[e]===!0)throw"duplicate flag "+e;t[e],t[e]=!0}function ce(t){if(t===void 0)throw Error("Internal Error - Should never get here!");return!0}function bi(t){return t.type==="Character"}const fn=[];for(let t=F("0");t<=F("9");t++)fn.push(t);const dn=[F("_")].concat(fn);for(let t=F("a");t<=F("z");t++)dn.push(t);for(let t=F("A");t<=F("Z");t++)dn.push(t);const Pi=[F(" "),F("\f"),F(`
7
- `),F("\r"),F(" "),F("\v"),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F(" "),F("\u2028"),F("\u2029"),F(" "),F(" "),F(" "),F("\uFEFF")],ic=/[0-9a-fA-F]/,He=/[0-9]/,oc=/[1-9]/;class Ar{visitChildren(e){for(const n in e){const r=e[n];e.hasOwnProperty(n)&&(r.type!==void 0?this.visit(r):Array.isArray(r)&&r.forEach(i=>{this.visit(i)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e)}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let nn={};const sc=new class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx}pattern(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");const e=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Ne(n,"global");break;case"i":Ne(n,"ignoreCase");break;case"m":Ne(n,"multiLine");break;case"u":Ne(n,"unicode");break;case"y":Ne(n,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:e,loc:this.loc(0)}}disjunction(){const t=[],e=this.idx;for(t.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(e)}}alternative(){const t=[],e=this.idx;for(;this.isTerm();)t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(e)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":let e;switch(this.consumeChar("?"),this.popChar()){case"=":e="Lookahead";break;case"!":e="NegativeLookahead"}ce(e);const n=this.disjunction();return this.consumeChar(")"),{type:e,value:n,loc:this.loc(t)}}return function(){throw Error("Internal Error - Should never get here!")}()}quantifier(t=!1){let e;const n=this.idx;switch(this.popChar()){case"*":e={atLeast:0,atMost:1/0};break;case"+":e={atLeast:1,atMost:1/0};break;case"?":e={atLeast:0,atMost:1};break;case"{":const r=this.integerIncludingZero();switch(this.popChar()){case"}":e={atLeast:r,atMost:r};break;case",":let i;this.isDigit()?(i=this.integerIncludingZero(),e={atLeast:r,atMost:i}):e={atLeast:r,atMost:1/0},this.consumeChar("}")}if(t===!0&&e===void 0)return;ce(e)}if(t!==!0||e!==void 0)return ce(e)?(this.peekChar(0)==="?"?(this.consumeChar("?"),e.greedy=!1):e.greedy=!0,e.type="Quantifier",e.loc=this.loc(n),e):void 0}atom(){let t;const e=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group()}if(t===void 0&&this.isPatternCharacter()&&(t=this.patternCharacter()),ce(t))return t.loc=this.loc(e),this.isQuantifier()&&(t.quantifier=this.quantifier()),t}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[F(`
8
- `),F("\r"),F("\u2028"),F("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let t,e=!1;switch(this.popChar()){case"d":t=fn;break;case"D":t=fn,e=!0;break;case"s":t=Pi;break;case"S":t=Pi,e=!0;break;case"w":t=dn;break;case"W":t=dn,e=!0}if(ce(t))return{type:"Set",value:t,complement:e}}controlEscapeAtom(){let t;switch(this.popChar()){case"f":t=F("\f");break;case"n":t=F(`
9
- `);break;case"r":t=F("\r");break;case"t":t=F(" ");break;case"v":t=F("\v")}if(ce(t))return{type:"Character",value:t}}controlLetterEscapeAtom(){this.consumeChar("c");const t=this.popChar();if(/[a-zA-Z]/.test(t)===!1)throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:F("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){return{type:"Character",value:F(this.popChar())}}classPatternCharacterAtom(){switch(this.peekChar()){case`
10
- `:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:F(this.popChar())}}}characterClass(){const t=[];let e=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),e=!0);this.isClassAtom();){const n=this.classAtom();if(n.type,bi(n)&&this.isRangeDash()){this.consumeChar("-");const r=this.classAtom();if(r.type,bi(r)){if(r.value<n.value)throw Error("Range out of order in character class");t.push({from:n.value,to:r.value})}else $n(n.value,t),t.push(F("-")),$n(r.value,t)}else $n(n.value,t)}return this.consumeChar("]"),{type:"Set",complement:e,value:t}}classAtom(){switch(this.peekChar()){case"]":case`
11
- `:case"\r":case"\u2028":case"\u2029":throw Error("TBD");case"\\":return this.classEscape();default:return this.classPatternCharacterAtom()}}classEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"b":return this.consumeChar("b"),{type:"Character",value:F("\b")};case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}group(){let t=!0;this.consumeChar("("),this.peekChar(0)==="?"?(this.consumeChar("?"),this.consumeChar(":"),t=!1):this.groupIdx++;const e=this.disjunction();this.consumeChar(")");const n={type:"Group",capturing:t,value:e};return t&&(n.idx=this.groupIdx),n}positiveInteger(){let t=this.popChar();if(oc.test(t)===!1)throw Error("Expecting a positive integer");for(;He.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)}integerIncludingZero(){let t=this.popChar();if(He.test(t)===!1)throw Error("Expecting an integer");for(;He.test(this.peekChar(0));)t+=this.popChar();return parseInt(t,10)}patternCharacter(){const t=this.popChar();switch(t){case`
12
- `:case"\r":case"\u2028":case"\u2029":case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":throw Error("TBD");default:return{type:"Character",value:F(t)}}}isRegExpFlag(){switch(this.peekChar(0)){case"g":case"i":case"m":case"u":case"y":return!0;default:return!1}}isRangeDash(){return this.peekChar()==="-"&&this.isClassAtom(1)}isDigit(){return He.test(this.peekChar(0))}isClassAtom(t=0){switch(this.peekChar(t)){case"]":case`
13
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}isTerm(){return this.isAtom()||this.isAssertion()}isAtom(){if(this.isPatternCharacter())return!0;switch(this.peekChar(0)){case".":case"\\":case"[":case"(":return!0;default:return!1}}isAssertion(){switch(this.peekChar(0)){case"^":case"$":return!0;case"\\":switch(this.peekChar(1)){case"b":case"B":return!0;default:return!1}case"(":return this.peekChar(1)==="?"&&(this.peekChar(2)==="="||this.peekChar(2)==="!");default:return!1}}isQuantifier(){const t=this.saveState();try{return this.quantifier(!0)!==void 0}catch{return!1}finally{this.restoreState(t)}}isPatternCharacter(){switch(this.peekChar()){case"^":case"$":case"\\":case".":case"*":case"+":case"?":case"(":case")":case"[":case"|":case"/":case`
14
- `:case"\r":case"\u2028":case"\u2029":return!1;default:return!0}}parseHexDigits(t){let e="";for(let n=0;n<t;n++){const r=this.popChar();if(ic.test(r)===!1)throw Error("Expecting a HexDecimal digits");e+=r}return{type:"Character",value:parseInt(e,16)}}peekChar(t=0){return this.input[this.idx+t]}popChar(){const t=this.peekChar(0);return this.consumeChar(void 0),t}consumeChar(t){if(t!==void 0&&this.input[this.idx]!==t)throw Error("Expected: '"+t+"' but found: '"+this.input[this.idx]+"' at offset: "+this.idx);if(this.idx>=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(t){return{begin:t,end:this.idx}}};function pn(t){const e=t.toString();if(nn.hasOwnProperty(e))return nn[e];{const n=sc.pattern(e);return nn[e]=n,n}}const as="Complement Sets are not supported for first char optimization",mn=`Unable to use "first char" lexer optimizations:
15
- `;function ac(t,e=!1){try{const n=pn(t);return Ir(n.value,{},n.flags.ignoreCase)}catch(n){if(n.message===as)e&&rs(`${mn} Unable to optimize: < ${t.toString()} >
16
- Complement Sets cannot be automatically optimized.
17
- This will disable the lexer's first char optimizations.
18
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let r="";e&&(r=`
19
- This will disable the lexer's first char optimizations.
20
- See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),Tr(`${mn}
21
- Failed parsing: < ${t.toString()} >
22
- Using the @chevrotain/regexp-to-ast library
23
- Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+r)}}return[]}function Ir(t,e,n){switch(t.type){case"Disjunction":for(let i=0;i<t.value.length;i++)Ir(t.value[i],e,n);break;case"Alternative":const r=t.value;for(let i=0;i<r.length;i++){const o=r[i];switch(o.type){case"EndAnchor":case"GroupBackReference":case"Lookahead":case"NegativeLookahead":case"StartAnchor":case"WordBoundary":case"NonWordBoundary":continue}const s=o;switch(s.type){case"Character":Ye(s.value,e,n);break;case"Set":if(s.complement===!0)throw Error(as);U(s.value,c=>{if(typeof c=="number")Ye(c,e,n);else{const u=c;if(n===!0)for(let l=u.from;l<=u.to;l++)Ye(l,e,n);else{for(let l=u.from;l<=u.to&&l<Se;l++)Ye(l,e,n);if(u.to>=Se){const l=u.from>=Se?u.from:Se,h=u.to,I=Xt(l),v=Xt(h);for(let O=I;O<=v;O++)e[O]=O}}}});break;case"Group":Ir(s.value,e,n);break;default:throw Error("Non Exhaustive Match")}const a=s.quantifier!==void 0&&s.quantifier.atLeast===0;if(s.type==="Group"&&Rr(s)===!1||s.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return Q(e)}function Ye(t,e,n){const r=Xt(t);e[r]=r,n===!0&&function(i,o){const s=String.fromCharCode(i),a=s.toUpperCase();if(a!==s){const c=Xt(a.charCodeAt(0));o[c]=c}else{const c=s.toLowerCase();if(c!==s){const u=Xt(c.charCodeAt(0));o[u]=u}}}(t,e)}function wi(t,e){return Ee(t.value,n=>{if(typeof n=="number")return at(e,n);{const r=n;return Ee(e,i=>r.from<=i&&i<=r.to)!==void 0}})}function Rr(t){const e=t.quantifier;return!(!e||e.atLeast!==0)||!!t.value&&(B(t.value)?vt(t.value,Rr):Rr(t.value))}class cc extends Ar{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}super.visitChildren(e)}}visitCharacter(e){at(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?wi(e,this.targetCharCodes)===void 0&&(this.found=!0):wi(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function Nr(t,e){if(e instanceof RegExp){const n=pn(e),r=new cc(t);return r.visit(n),r.found}return Ee(e,n=>at(t,n.charCodeAt(0)))!==void 0}const ee="PATTERN",ye="defaultMode",Wn="modes";let Mi=typeof new RegExp("(?:)").sticky=="boolean";const uc=/[^\\][$]/,lc=/[^\\[][\^]|^\^/;function Ui(t){const e=t.ignoreCase?"i":"";return new RegExp(`^(?:${t.source})`,e)}function Fi(t){const e=t.ignoreCase?"iy":"y";return new RegExp(`${t.source}`,e)}function cs(t){const e=t.PATTERN;if(Kt(e))return!1;if(Yt(e)||w(e,"exec"))return!0;if(ut(e))return!1;throw Error("non exhaustive match")}function hc(t){return!(!ut(t)||t.length!==1)&&t.charCodeAt(0)}const fc={test:function(t){const e=t.length;for(let n=this.lastIndex;n<e;n++){const r=t.charCodeAt(n);if(r===10)return this.lastIndex=n+1,!0;if(r===13)return t.charCodeAt(n+1)===10?this.lastIndex=n+2:this.lastIndex=n+1,!0}return!1},lastIndex:0};function Di(t,e){if(w(t,"LINE_BREAKS"))return!1;if(Kt(t.PATTERN)){try{Nr(e,t.PATTERN)}catch(n){return{issue:H.IDENTIFY_TERMINATOR,errMsg:n.message}}return!1}if(ut(t.PATTERN))return!1;if(cs(t))return{issue:H.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function ji(t){return b(t,e=>ut(e)?e.charCodeAt(0):e)}function Gn(t,e,n){t[e]===void 0?t[e]=[n]:t[e].push(n)}const Se=256;let rn=[];function Xt(t){return t<Se?t:rn[t]}function ke(t,e){const n=t.tokenTypeIdx;return n===e.tokenTypeIdx||e.isParent===!0&&e.categoryMatchesMap[n]===!0}function En(t,e){return t.tokenTypeIdx===e.tokenTypeIdx}let Bi=1;const $i={};function Ge(t){const e=function(n){let r=et(n),i=n,o=!0;for(;o;){i=Fe(yt(b(i,a=>a.CATEGORIES)));const s=ln(i,r);r=r.concat(s),K(s)?o=!1:i=s}return r}(t);U(e,n=>{ls(n)||($i[Bi]=n,n.tokenTypeIdx=Bi++),Wi(n)&&!B(n.CATEGORIES)&&(n.CATEGORIES=[n.CATEGORIES]),Wi(n)||(n.CATEGORIES=[]),w(n,"categoryMatches")||(n.categoryMatches=[]),w(n,"categoryMatchesMap")||(n.categoryMatchesMap={})}),function(n){U(n,r=>{us([],r)})}(e),function(n){U(n,r=>{r.categoryMatches=[],U(r.categoryMatchesMap,(i,o)=>{r.categoryMatches.push($i[o].tokenTypeIdx)})})}(e),U(e,n=>{n.isParent=n.categoryMatches.length>0})}function us(t,e){U(t,n=>{e.categoryMatchesMap[n.tokenTypeIdx]=!0}),U(e.CATEGORIES,n=>{const r=t.concat(e);at(r,n)||us(r,n)})}function ls(t){return w(t,"tokenTypeIdx")}function Wi(t){return w(t,"CATEGORIES")}function dc(t){return w(t,"tokenTypeIdx")}var H,j;(j=H||(H={}))[j.MISSING_PATTERN=0]="MISSING_PATTERN",j[j.INVALID_PATTERN=1]="INVALID_PATTERN",j[j.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",j[j.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",j[j.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",j[j.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",j[j.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",j[j.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",j[j.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",j[j.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",j[j.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",j[j.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",j[j.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",j[j.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",j[j.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",j[j.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",j[j.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",j[j.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";const _e={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[`
24
- `,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:{buildUnableToPopLexerModeMessage:t=>`Unable to pop Lexer Mode after encountering Token ->${t.image}<- The Mode Stack is empty`,buildUnexpectedCharactersMessage:(t,e,n,r,i)=>`unexpected character: ->${t.charAt(e)}<- at offset: ${e}, skipped ${n} characters.`},traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(_e);class ot{constructor(e,n=_e){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(i,o)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const s=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${s}--> <${i}>`);const{time:a,value:c}=is(o),u=a>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&u(`${s}<-- <${i}> time: ${a}ms`),this.traceInitIndent--,c}return o()},typeof n=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object.
25
- a boolean 2nd argument is no longer supported`);this.config=dt({},_e,n);const r=this.config.traceInitPerf;r===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof r=="number"&&(this.traceInitMaxIdent=r,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let i,o=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===_e.lineTerminatorsPattern)this.config.lineTerminatorsPattern=fc;else if(this.config.lineTerminatorCharacters===_e.lineTerminatorCharacters)throw Error(`Error: Missing <lineTerminatorCharacters> property on the Lexer config.
26
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(n.safeMode&&n.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),B(e)?i={modes:{defaultMode:et(e)},defaultMode:ye}:(o=!1,i=et(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(a){const c=[];return w(a,ye)||c.push({message:"A MultiMode Lexer cannot be initialized without a <"+ye+`> property in its definition
27
- `,type:H.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),w(a,Wn)||c.push({message:`A MultiMode Lexer cannot be initialized without a <modes> property in its definition
28
- `,type:H.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),w(a,Wn)&&w(a,ye)&&!w(a.modes,a.defaultMode)&&c.push({message:`A MultiMode Lexer cannot be initialized with a ${ye}: <${a.defaultMode}>which does not exist
29
- `,type:H.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),w(a,Wn)&&U(a.modes,(u,l)=>{U(u,(h,I)=>{Ht(h)?c.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${l}> at index: <${I}>
30
- `,type:H.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED}):w(h,"LONGER_ALT")&&U(B(h.LONGER_ALT)?h.LONGER_ALT:[h.LONGER_ALT],v=>{Ht(v)||at(u,v)||c.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${v.name}> on token <${h.name}> outside of mode <${l}>
31
- `,type:H.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})})}),c}(i,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(function(a,c,u){const l=[];let h=!1;const I=tn(Fe(yt(Q(a.modes))),O=>O[ee]===ot.NA),v=ji(u);return c&&U(I,O=>{const x=Di(O,v);if(x!==!1){const _={message:function(T,g){if(g.issue===H.IDENTIFY_TERMINATOR)return`Warning: unable to identify line terminator usage in pattern.
32
- The problem is in the <${T.name}> Token Type
33
- Root cause: ${g.errMsg}.
34
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(g.issue===H.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the <line_breaks> option.
35
- The problem is in the <${T.name}> Token Type
36
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}(O,x),type:x.issue,tokenType:O};l.push(_)}else w(O,"LINE_BREAKS")?O.LINE_BREAKS===!0&&(h=!0):Nr(v,O.PATTERN)&&(h=!0)}),c&&!h&&l.push({message:`Warning: No LINE_BREAKS Found.
37
- This Lexer has been defined to track line and column information,
38
- But none of the Token Types can be identified as matching a line terminator.
39
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS
40
- for details.`,type:H.NO_LINE_BREAKS_FLAGS}),l}(i,this.trackStartLines,this.config.lineTerminatorCharacters))})),i.modes=i.modes?i.modes:{},U(i.modes,(a,c)=>{i.modes[c]=tn(a,u=>Ht(u))});const s=Nt(i.modes);if(U(i.modes,(a,c)=>{this.TRACE_INIT(`Mode: <${c}> processing`,()=>{if(this.modes.push(c),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(function(u,l){let h=[];const I=function(_){const T=gt(_,g=>!w(g,ee));return{errors:b(T,g=>({message:"Token Type: ->"+g.name+"<- missing static 'PATTERN' property",type:H.MISSING_PATTERN,tokenTypes:[g]})),valid:ln(_,T)}}(u);h=h.concat(I.errors);const v=function(_){const T=gt(_,g=>{const d=g[ee];return!(Kt(d)||Yt(d)||w(d,"exec")||ut(d))});return{errors:b(T,g=>({message:"Token Type: ->"+g.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:H.INVALID_PATTERN,tokenTypes:[g]})),valid:ln(_,T)}}(I.valid),O=v.valid;return h=h.concat(v.errors),h=h.concat(function(_){let T=[];const g=gt(_,d=>Kt(d[ee]));return T=T.concat(function(d){class A extends Ar{constructor(){super(...arguments),this.found=!1}visitEndAnchor(f){this.found=!0}}return b(gt(d,N=>{const f=N.PATTERN;try{const m=pn(f),p=new A;return p.visit(m),p.found}catch{return uc.test(f.source)}}),N=>({message:`Unexpected RegExp Anchor Error:
41
- Token Type: ->`+N.name+`<- static 'PATTERN' cannot contain end of input anchor '$'
42
- See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:H.EOI_ANCHOR_FOUND,tokenTypes:[N]}))}(g)),T=T.concat(function(d){class A extends Ar{constructor(){super(...arguments),this.found=!1}visitStartAnchor(f){this.found=!0}}return b(gt(d,N=>{const f=N.PATTERN;try{const m=pn(f),p=new A;return p.visit(m),p.found}catch{return lc.test(f.source)}}),N=>({message:`Unexpected RegExp Anchor Error:
43
- Token Type: ->`+N.name+`<- static 'PATTERN' cannot contain start of input anchor '^'
44
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:H.SOI_ANCHOR_FOUND,tokenTypes:[N]}))}(g)),T=T.concat(b(gt(g,d=>{const A=d[ee];return A instanceof RegExp&&(A.multiline||A.global)}),d=>({message:"Token Type: ->"+d.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:H.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[d]}))),T=T.concat(function(d){const A=[];let N=b(d,f=>ft(d,(m,p)=>(f.PATTERN.source!==p.PATTERN.source||at(A,p)||p.PATTERN===ot.NA||(A.push(p),m.push(p)),m),[]));return N=Fe(N),b(gt(N,f=>f.length>1),f=>{const m=b(f,p=>p.name);return{message:`The same RegExp pattern ->${St(f).PATTERN}<-has been used in all of the following Token Types: ${m.join(", ")} <-`,type:H.DUPLICATE_PATTERNS_FOUND,tokenTypes:f}})}(g)),T=T.concat(b(gt(g,d=>d.PATTERN.test("")),d=>({message:"Token Type: ->"+d.name+"<- static 'PATTERN' must not match an empty string",type:H.EMPTY_MATCH_PATTERN,tokenTypes:[d]}))),T}(O)),h=h.concat(b(gt(O,_=>{if(!w(_,"GROUP"))return!1;const T=_.GROUP;return T!==ot.SKIPPED&&T!==ot.NA&&!ut(T)}),_=>({message:"Token Type: ->"+_.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:H.INVALID_GROUP_TYPE_FOUND,tokenTypes:[_]}))),h=h.concat((x=l,b(gt(O,_=>_.PUSH_MODE!==void 0&&!at(x,_.PUSH_MODE)),_=>({message:`Token Type: ->${_.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${_.PUSH_MODE}<-which does not exist`,type:H.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[_]})))),h=h.concat(function(_){const T=[],g=ft(_,(d,A,N)=>{const f=A.PATTERN;return f===ot.NA||(ut(f)?d.push({str:f,idx:N,tokenType:A}):Kt(f)&&(m=f,Ee([".","\\","[","]","|","^","$","(",")","?","*","+","{"],p=>m.source.indexOf(p)!==-1)===void 0)&&d.push({str:f.source,idx:N,tokenType:A})),d;var m},[]);return U(_,(d,A)=>{U(g,({str:N,idx:f,tokenType:m})=>{if(A<f&&function(p,E){if(Kt(E)){const R=E.exec(p);return R!==null&&R.index===0}if(Yt(E))return E(p,0,[],{});if(w(E,"exec"))return E.exec(p,0,[],{});if(typeof E=="string")return E===p;throw Error("non exhaustive match")}(N,d.PATTERN)){const p=`Token: ->${m.name}<- can never be matched.
45
- Because it appears AFTER the Token Type ->${d.name}<-in the lexer's definition.
46
- See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;T.push({message:p,type:H.UNREACHABLE_PATTERN,tokenTypes:[d,m]})}})}),T}(O)),h;var x}(a,s))}),K(this.lexerDefinitionErrors)){let u;Ge(a),this.TRACE_INIT("analyzeTokenTypes",()=>{u=function(l,h){const I=(h=Er(h,{useSticky:Mi,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",`
47
- `],tracer:(L,y)=>y()})).tracer;let v;I("initCharCodeToOptimizedIndexMap",()=>{(function(){if(K(rn)){rn=new Array(65536);for(let L=0;L<65536;L++)rn[L]=L>255?255+~~(L/255):L}})()}),I("Reject Lexer.NA",()=>{v=tn(l,L=>L[ee]===ot.NA)});let O,x,_,T,g,d,A,N,f,m,p,E=!1;I("Transform Patterns",()=>{E=!1,O=b(v,L=>{const y=L[ee];if(Kt(y)){const M=y.source;return M.length!==1||M==="^"||M==="$"||M==="."||y.ignoreCase?M.length!==2||M[0]!=="\\"||at(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],M[1])?h.useSticky?Fi(y):Ui(y):M[1]:M}if(Yt(y))return E=!0,{exec:y};if(typeof y=="object")return E=!0,y;if(typeof y=="string"){if(y.length===1)return y;{const M=y.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),C=new RegExp(M);return h.useSticky?Fi(C):Ui(C)}}throw Error("non exhaustive match")})}),I("misc mapping",()=>{x=b(v,L=>L.tokenTypeIdx),_=b(v,L=>{const y=L.GROUP;if(y!==ot.SKIPPED){if(ut(y))return y;if(Ht(y))return!1;throw Error("non exhaustive match")}}),T=b(v,L=>{const y=L.LONGER_ALT;if(y)return B(y)?b(y,M=>xi(v,M)):[xi(v,y)]}),g=b(v,L=>L.PUSH_MODE),d=b(v,L=>w(L,"POP_MODE"))}),I("Line Terminator Handling",()=>{const L=ji(h.lineTerminatorCharacters);A=b(v,y=>!1),h.positionTracking!=="onlyOffset"&&(A=b(v,y=>w(y,"LINE_BREAKS")?!!y.LINE_BREAKS:Di(y,L)===!1&&Nr(L,y.PATTERN)))}),I("Misc Mapping #2",()=>{N=b(v,cs),f=b(O,hc),m=ft(v,(L,y)=>{const M=y.GROUP;return ut(M)&&M!==ot.SKIPPED&&(L[M]=[]),L},{}),p=b(O,(L,y)=>({pattern:O[y],longerAlt:T[y],canLineTerminator:A[y],isCustom:N[y],short:f[y],group:_[y],push:g[y],pop:d[y],tokenTypeIdx:x[y],tokenType:v[y]}))});let R=!0,P=[];return h.safeMode||I("First Char Optimization",()=>{P=ft(v,(L,y,M)=>{if(typeof y.PATTERN=="string"){const C=Xt(y.PATTERN.charCodeAt(0));Gn(L,C,p[M])}else if(B(y.START_CHARS_HINT)){let C;U(y.START_CHARS_HINT,k=>{const $=Xt(typeof k=="string"?k.charCodeAt(0):k);C!==$&&(C=$,Gn(L,$,p[M]))})}else if(Kt(y.PATTERN))if(y.PATTERN.unicode)R=!1,h.ensureOptimizations&&Tr(`${mn} Unable to analyze < ${y.PATTERN.toString()} > pattern.
48
- The regexp unicode flag is not currently supported by the regexp-to-ast library.
49
- This will disable the lexer's first char optimizations.
50
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const C=ac(y.PATTERN,h.ensureOptimizations);K(C)&&(R=!1),U(C,k=>{Gn(L,k,p[M])})}else h.ensureOptimizations&&Tr(`${mn} TokenType: <${y.name}> is using a custom token pattern without providing <start_chars_hint> parameter.
51
- This will disable the lexer's first char optimizations.
52
- For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),R=!1;return L},[])}),{emptyGroups:m,patternIdxToConfig:p,charCodeToPatternIdxToConfig:P,hasCustom:E,canBeOptimized:R}}(a,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:n.positionTracking,ensureOptimizations:n.ensureOptimizations,safeMode:n.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[c]=u.patternIdxToConfig,this.charCodeToPatternIdxToConfig[c]=u.charCodeToPatternIdxToConfig,this.emptyGroups=dt({},this.emptyGroups,u.emptyGroups),this.hasCustom=u.hasCustom||this.hasCustom,this.canModeBeOptimized[c]=u.canBeOptimized}})}),this.defaultMode=i.defaultMode,!K(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const a=b(this.lexerDefinitionErrors,c=>c.message).join(`-----------------------
53
- `);throw new Error(`Errors detected in definition of Lexer:
54
- `+a)}U(this.lexerDefinitionWarning,a=>{rs(a.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(Mi?(this.chopInput=pe,this.match=this.matchWithTest):(this.updateLastIndex=Z,this.match=this.matchWithExec),o&&(this.handleModes=Z),this.trackStartLines===!1&&(this.computeNewColumn=pe),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Z),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else{if(!/onlyOffset/i.test(this.config.positionTracking))throw Error(`Invalid <positionTracking> config option: "${this.config.positionTracking}"`);this.createTokenInstance=this.createOffsetOnlyToken}this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const a=ft(this.canModeBeOptimized,(c,u,l)=>(u===!1&&c.push(l),c),[]);if(n.ensureOptimizations&&!K(a))throw Error(`Lexer Modes: < ${a.join(", ")} > cannot be optimized.
55
- Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.
56
- Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{nn={}}),this.TRACE_INIT("toFastProperties",()=>{os(this)})})}tokenize(e,n=this.defaultMode){if(!K(this.lexerDefinitionErrors)){const r=b(this.lexerDefinitionErrors,i=>i.message).join(`-----------------------
57
- `);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer:
58
- `+r)}return this.tokenizeInternal(e,n)}tokenizeInternal(e,n){let r,i,o,s,a,c,u,l,h,I,v,O,x,_,T;const g=e,d=g.length;let A=0,N=0;const f=this.hasCustom?0:Math.floor(e.length/10),m=new Array(f),p=[];let E=this.trackStartLines?1:void 0,R=this.trackStartLines?1:void 0;const P=function(q){const it={};return U(Nt(q),jt=>{const ct=q[jt];if(!B(ct))throw Error("non exhaustive match");it[jt]=[]}),it}(this.emptyGroups),L=this.trackStartLines,y=this.config.lineTerminatorsPattern;let M=0,C=[],k=[];const $=[],X=[];let W;function rt(){return C}function mt(q){const it=Xt(q),jt=k[it];return jt===void 0?X:jt}Object.freeze(X);const Ct=q=>{if($.length===1&&q.tokenType.PUSH_MODE===void 0){const it=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(q);p.push({offset:q.startOffset,line:q.startLine,column:q.startColumn,length:q.image.length,message:it})}else{$.pop();const it=me($);C=this.patternIdxToConfig[it],k=this.charCodeToPatternIdxToConfig[it],M=C.length;const jt=this.canModeBeOptimized[it]&&this.config.safeMode===!1;W=k&&jt?mt:rt}};function Ae(q){$.push(q),k=this.charCodeToPatternIdxToConfig[q],C=this.patternIdxToConfig[q],M=C.length,M=C.length;const it=this.canModeBeOptimized[q]&&this.config.safeMode===!1;W=k&&it?mt:rt}let nt;Ae.call(this,n);const Jt=this.config.recoveryEnabled;for(;A<d;){c=null;const q=g.charCodeAt(A),it=W(q),jt=it.length;for(r=0;r<jt;r++){nt=it[r];const ct=nt.pattern;u=null;const Bt=nt.short;if(Bt!==!1?q===Bt&&(c=ct):nt.isCustom===!0?(T=ct.exec(g,A,m,P),T!==null?(c=T[0],T.payload!==void 0&&(u=T.payload)):c=null):(this.updateLastIndex(ct,A),c=this.match(ct,e,A)),c!==null){if(a=nt.longerAlt,a!==void 0){const $t=a.length;for(o=0;o<$t;o++){const Wt=C[a[o]],te=Wt.pattern;if(l=null,Wt.isCustom===!0?(T=te.exec(g,A,m,P),T!==null?(s=T[0],T.payload!==void 0&&(l=T.payload)):s=null):(this.updateLastIndex(te,A),s=this.match(te,e,A)),s&&s.length>c.length){c=s,u=l,nt=Wt;break}}}break}}if(c!==null){if(h=c.length,I=nt.group,I!==void 0&&(v=nt.tokenTypeIdx,O=this.createTokenInstance(c,A,v,nt.tokenType,E,R,h),this.handlePayload(O,u),I===!1?N=this.addToken(m,N,O):P[I].push(O)),e=this.chopInput(e,h),A+=h,R=this.computeNewColumn(R,h),L===!0&&nt.canLineTerminator===!0){let ct,Bt,$t=0;y.lastIndex=0;do ct=y.test(c),ct===!0&&(Bt=y.lastIndex-1,$t++);while(ct===!0);$t!==0&&(E+=$t,R=h-Bt,this.updateTokenEndLineColumnLocation(O,I,Bt,$t,E,R,h))}this.handleModes(nt,Ct,Ae,O)}else{const ct=A,Bt=E,$t=R;let Wt=Jt===!1;for(;Wt===!1&&A<d;)for(e=this.chopInput(e,1),A++,i=0;i<M;i++){const te=C[i],bn=te.pattern,zr=te.short;if(zr!==!1?g.charCodeAt(A)===zr&&(Wt=!0):te.isCustom===!0?Wt=bn.exec(g,A,m,P)!==null:(this.updateLastIndex(bn,A),Wt=bn.exec(e)!==null),Wt===!0)break}if(x=A-ct,R=this.computeNewColumn(R,x),_=this.config.errorMessageProvider.buildUnexpectedCharactersMessage(g,ct,x,Bt,$t),p.push({offset:ct,line:Bt,column:$t,length:x,message:_}),Jt===!1)break}}return this.hasCustom||(m.length=N),{tokens:m,groups:P,errors:p}}handleModes(e,n,r,i){if(e.pop===!0){const o=e.push;n(i),o!==void 0&&r.call(this,o)}else e.push!==void 0&&r.call(this,e.push)}chopInput(e,n){return e.substring(n)}updateLastIndex(e,n){e.lastIndex=n}updateTokenEndLineColumnLocation(e,n,r,i,o,s,a){let c,u;n!==void 0&&(c=r===a-1,u=c?-1:0,i===1&&c===!0||(e.endLine=o+u,e.endColumn=s-1-u))}computeNewColumn(e,n){return e+n}createOffsetOnlyToken(e,n,r,i){return{image:e,startOffset:n,tokenTypeIdx:r,tokenType:i}}createStartOnlyToken(e,n,r,i,o,s){return{image:e,startOffset:n,startLine:o,startColumn:s,tokenTypeIdx:r,tokenType:i}}createFullToken(e,n,r,i,o,s,a){return{image:e,startOffset:n,endOffset:n+a-1,startLine:o,endLine:o,startColumn:s,endColumn:s+a-1,tokenTypeIdx:r,tokenType:i}}addTokenUsingPush(e,n,r){return e.push(r),n}addTokenUsingMemberAccess(e,n,r){return e[n]=r,++n}handlePayloadNoCustom(e,n){}handlePayloadWithCustom(e,n){n!==null&&(e.payload=n)}matchWithTest(e,n,r){return e.test(n)===!0?n.substring(r,e.lastIndex):null}matchWithExec(e,n){const r=e.exec(n);return r!==null?r[0]:null}}function be(t){return hs(t)?t.LABEL:t.name}function hs(t){return ut(t.LABEL)&&t.LABEL!==""}ot.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",ot.NA=/NOT_APPLICABLE/;const Gi="categories",Ki="label",zi="group",Vi="push_mode",Hi="pop_mode",Yi="longer_alt",Xi="line_breaks",qi="start_chars_hint";function D(t){return function(e){const n=e.pattern,r={};if(r.name=e.name,Ht(n)||(r.PATTERN=n),w(e,"parent"))throw`The parent property is no longer supported.
59
- See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return w(e,Gi)&&(r.CATEGORIES=e[Gi]),Ge([r]),w(e,Ki)&&(r.LABEL=e[Ki]),w(e,zi)&&(r.GROUP=e[zi]),w(e,Hi)&&(r.POP_MODE=e[Hi]),w(e,Vi)&&(r.PUSH_MODE=e[Vi]),w(e,Yi)&&(r.LONGER_ALT=e[Yi]),w(e,Xi)&&(r.LINE_BREAKS=e[Xi]),w(e,qi)&&(r.START_CHARS_HINT=e[qi]),r}(t)}const re=D({name:"EOF",pattern:ot.NA});function Gr(t,e,n,r,i,o,s,a){return{image:e,startOffset:n,endOffset:r,startLine:i,endLine:o,startColumn:s,endColumn:a,tokenTypeIdx:t.tokenTypeIdx,tokenType:t}}Ge([re]);const fs={buildMismatchTokenMessage:({expected:t,actual:e,previous:n,ruleName:r})=>`Expecting ${hs(t)?`--> ${be(t)} <--`:`token of type --> ${t.name} <--`} but found --> '${e.image}' <--`,buildNotAllInputParsedMessage:({firstRedundant:t,ruleName:e})=>"Redundant input, expecting EOF but found: "+t.image,buildNoViableAltMessage({expectedPathsPerAlt:t,actual:e,previous:n,customUserDescription:r,ruleName:i}){const o="Expecting: ",s=`
60
- but found: '`+St(e).image+"'";if(r)return o+r+s;{const a=b(ft(t,(c,u)=>c.concat(u),[]),c=>`[${b(c,u=>be(u)).join(", ")}]`);return o+`one of these possible Token sequences:
61
- ${b(a,(c,u)=>` ${u+1}. ${c}`).join(`
62
- `)}`+s}},buildEarlyExitMessage({expectedIterationPaths:t,actual:e,customUserDescription:n,ruleName:r}){const i="Expecting: ",o=`
63
- but found: '`+St(e).image+"'";return n?i+n+o:i+`expecting at least one iteration which starts with one of these possible Token sequences::
64
- <${b(t,s=>`[${b(s,a=>be(a)).join(",")}]`).join(" ,")}>`+o}};Object.freeze(fs);const pc={buildRuleNotFoundError:(t,e)=>"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<-
65
- inside top level rule: ->`+t.name+"<-"},ie={buildDuplicateFoundError(t,e){const n=t.name,r=St(e),i=r.idx,o=kt(r),s=(a=r)instanceof V?a.terminalType.name:a instanceof pt?a.nonTerminalName:"";var a;let c=`->${o}${i>0?i:""}<- ${s?`with argument: ->${s}<-`:""}
66
- appears more than once (${e.length} times) in the top level rule: ->${n}<-.
67
- For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES
68
- `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,`
69
- `),c},buildNamespaceConflictError:t=>`Namespace conflict found in grammar.
70
- The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${t.name}>.
71
- To resolve this make sure each Terminal and Non-Terminal names are unique
72
- This is easy to accomplish by using the convention that Terminal names start with an uppercase letter
73
- and Non-Terminal names start with a lower case letter.`,buildAlternationPrefixAmbiguityError(t){const e=b(t.prefixPath,r=>be(r)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;return`Ambiguous alternatives: <${t.ambiguityIndices.join(" ,")}> due to common lookahead prefix
74
- in <OR${n}> inside <${t.topLevelRule.name}> Rule,
75
- <${e}> may appears as a prefix path in all these alternatives.
76
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX
77
- For Further details.`},buildAlternationAmbiguityError(t){const e=b(t.prefixPath,i=>be(i)).join(", "),n=t.alternation.idx===0?"":t.alternation.idx;let r=`Ambiguous Alternatives Detected: <${t.ambiguityIndices.join(" ,")}> in <OR${n}> inside <${t.topLevelRule.name}> Rule,
78
- <${e}> may appears as a prefix path in all these alternatives.
79
- `;return r+=`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES
80
- For Further details.`,r},buildEmptyRepetitionError(t){let e=kt(t.repetition);return t.repetition.idx!==0&&(e+=t.repetition.idx),`The repetition <${e}> within Rule <${t.topLevelRule.name}> can never consume any tokens.
81
- This could lead to an infinite loop.`},buildTokenNameError:t=>"deprecated",buildEmptyAlternationError:t=>`Ambiguous empty alternative: <${t.emptyChoiceIdx+1}> in <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
82
- Only the last alternative may be an empty alternative.`,buildTooManyAlternativesError:t=>`An Alternation cannot have more than 256 alternatives:
83
- <OR${t.alternation.idx}> inside <${t.topLevelRule.name}> Rule.
84
- has ${t.alternation.definition.length+1} alternatives.`,buildLeftRecursionError(t){const e=t.topLevelRule.name;return`Left Recursion found in grammar.
85
- rule: <${e}> can be invoked from itself (directly or indirectly)
86
- without consuming any Tokens. The grammar path that causes this is:
87
- ${e} --> ${b(t.leftRecursionPath,n=>n.name).concat([e]).join(" --> ")}
88
- To fix this refactor your grammar to remove the left recursion.
89
- see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError:t=>"deprecated",buildDuplicateRuleNameError(t){let e;return e=t.topLevelRule instanceof ge?t.topLevelRule.name:t.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${t.grammarName}<-`}};class mc extends Te{constructor(e,n){super(),this.nameToTopRule=e,this.errMsgProvider=n,this.errors=[]}resolveRefs(){U(Q(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const n=this.nameToTopRule[e.nonTerminalName];if(n)e.referencedRule=n;else{const r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:r,type:st.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Ec extends _n{constructor(e,n){super(),this.topProd=e,this.path=n,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=et(this.path.ruleStack).reverse(),this.occurrenceStack=et(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,n=[]){this.found||super.walk(e,n)}walkProdRef(e,n,r){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const i=n.concat(r);this.updateExpectedNext(),this.walk(e.referencedRule,i)}}updateExpectedNext(){K(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class gc extends Ec{constructor(e,n){super(e,n),this.path=n,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,n,r){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const i=n.concat(r),o=new ht({definition:i});this.possibleTokTypes=Ce(o),this.found=!0}}}class Ln extends _n{constructor(e,n){super(),this.topRule=e,this.occurrence=n,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class Tc extends Ln{walkMany(e,n,r){if(e.idx===this.occurrence){const i=St(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkMany(e,n,r)}}class Zi extends Ln{walkManySep(e,n,r){if(e.idx===this.occurrence){const i=St(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkManySep(e,n,r)}}class Ac extends Ln{walkAtLeastOne(e,n,r){if(e.idx===this.occurrence){const i=St(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOne(e,n,r)}}class Qi extends Ln{walkAtLeastOneSep(e,n,r){if(e.idx===this.occurrence){const i=St(n.concat(r));this.result.isEndOfRule=i===void 0,i instanceof V&&(this.result.token=i.terminalType,this.result.occurrence=i.idx)}else super.walkAtLeastOneSep(e,n,r)}}function yr(t,e,n=[]){n=et(n);let r=[],i=0;function o(s){const a=yr(s.concat(tt(t,i+1)),e,n);return r.concat(a)}for(;n.length<e&&i<t.length;){const s=t[i];if(s instanceof ht||s instanceof pt)return o(s.definition);if(s instanceof lt)r=o(s.definition);else{if(s instanceof Ft)return o(s.definition.concat([new J({definition:s.definition})]));if(s instanceof Dt)return o([new ht({definition:s.definition}),new J({definition:[new V({terminalType:s.separator})].concat(s.definition)})]);if(s instanceof Lt){const a=s.definition.concat([new J({definition:[new V({terminalType:s.separator})].concat(s.definition)})]);r=o(a)}else if(s instanceof J){const a=s.definition.concat([new J({definition:s.definition})]);r=o(a)}else{if(s instanceof xt)return U(s.definition,a=>{K(a.definition)===!1&&(r=o(a.definition))}),r;if(!(s instanceof V))throw Error("non exhaustive match");n.push(s.terminalType)}}i++}return r.push({partialPath:n,suffixDef:tt(t,i)}),r}function ds(t,e,n,r){const i="EXIT_NONE_TERMINAL",o=[i],s="EXIT_ALTERNATIVE";let a=!1;const c=e.length,u=c-r-1,l=[],h=[];for(h.push({idx:-1,def:t,ruleStack:[],occurrenceStack:[]});!K(h);){const I=h.pop();if(I===s){a&&me(h).idx<=u&&h.pop();continue}const v=I.def,O=I.idx,x=I.ruleStack,_=I.occurrenceStack;if(K(v))continue;const T=v[0];if(T===i){const g={idx:O,def:tt(v),ruleStack:De(x),occurrenceStack:De(_)};h.push(g)}else if(T instanceof V)if(O<c-1){const g=O+1;if(n(e[g],T.terminalType)){const d={idx:g,def:tt(v),ruleStack:x,occurrenceStack:_};h.push(d)}}else{if(O!==c-1)throw Error("non exhaustive match");l.push({nextTokenType:T.terminalType,nextTokenOccurrence:T.idx,ruleStack:x,occurrenceStack:_}),a=!0}else if(T instanceof pt){const g=et(x);g.push(T.nonTerminalName);const d=et(_);d.push(T.idx);const A={idx:O,def:T.definition.concat(o,tt(v)),ruleStack:g,occurrenceStack:d};h.push(A)}else if(T instanceof lt){const g={idx:O,def:tt(v),ruleStack:x,occurrenceStack:_};h.push(g),h.push(s);const d={idx:O,def:T.definition.concat(tt(v)),ruleStack:x,occurrenceStack:_};h.push(d)}else if(T instanceof Ft){const g=new J({definition:T.definition,idx:T.idx}),d={idx:O,def:T.definition.concat([g],tt(v)),ruleStack:x,occurrenceStack:_};h.push(d)}else if(T instanceof Dt){const g=new V({terminalType:T.separator}),d=new J({definition:[g].concat(T.definition),idx:T.idx}),A={idx:O,def:T.definition.concat([d],tt(v)),ruleStack:x,occurrenceStack:_};h.push(A)}else if(T instanceof Lt){const g={idx:O,def:tt(v),ruleStack:x,occurrenceStack:_};h.push(g),h.push(s);const d=new V({terminalType:T.separator}),A=new J({definition:[d].concat(T.definition),idx:T.idx}),N={idx:O,def:T.definition.concat([A],tt(v)),ruleStack:x,occurrenceStack:_};h.push(N)}else if(T instanceof J){const g={idx:O,def:tt(v),ruleStack:x,occurrenceStack:_};h.push(g),h.push(s);const d=new J({definition:T.definition,idx:T.idx}),A={idx:O,def:T.definition.concat([d],tt(v)),ruleStack:x,occurrenceStack:_};h.push(A)}else if(T instanceof xt)for(let g=T.definition.length-1;g>=0;g--){const d={idx:O,def:T.definition[g].definition.concat(tt(v)),ruleStack:x,occurrenceStack:_};h.push(d),h.push(s)}else if(T instanceof ht)h.push({idx:O,def:T.definition.concat(tt(v)),ruleStack:x,occurrenceStack:_});else{if(!(T instanceof ge))throw Error("non exhaustive match");h.push(Ic(T,O,x,_))}}return l}function Ic(t,e,n,r){const i=et(n);i.push(t.name);const o=et(r);return o.push(1),{idx:e,def:t.definition,ruleStack:i,occurrenceStack:o}}var Y,Et;function Ji(t){if(t instanceof lt||t==="Option")return Y.OPTION;if(t instanceof J||t==="Repetition")return Y.REPETITION;if(t instanceof Ft||t==="RepetitionMandatory")return Y.REPETITION_MANDATORY;if(t instanceof Dt||t==="RepetitionMandatoryWithSeparator")return Y.REPETITION_MANDATORY_WITH_SEPARATOR;if(t instanceof Lt||t==="RepetitionWithSeparator")return Y.REPETITION_WITH_SEPARATOR;if(t instanceof xt||t==="Alternation")return Y.ALTERNATION;throw Error("non exhaustive match")}function Rc(t,e,n,r){const i=t.length,o=vt(t,s=>vt(s,a=>a.length===1));if(e)return function(s){const a=b(s,c=>c.GATE);for(let c=0;c<i;c++){const u=t[c],l=u.length,h=a[c];if(h===void 0||h.call(this)!==!1)t:for(let I=0;I<l;I++){const v=u[I],O=v.length;for(let x=0;x<O;x++){const _=this.LA(x+1);if(n(_,v[x])===!1)continue t}return c}}};if(o&&!r){const s=ft(b(t,a=>yt(a)),(a,c,u)=>(U(c,l=>{w(a,l.tokenTypeIdx)||(a[l.tokenTypeIdx]=u),U(l.categoryMatches,h=>{w(a,h)||(a[h]=u)})}),a),{});return function(){const a=this.LA(1);return s[a.tokenTypeIdx]}}return function(){for(let s=0;s<i;s++){const a=t[s],c=a.length;t:for(let u=0;u<c;u++){const l=a[u],h=l.length;for(let I=0;I<h;I++){const v=this.LA(I+1);if(n(v,l[I])===!1)continue t}return s}}}}function Nc(t,e,n){const r=vt(t,o=>o.length===1),i=t.length;if(r&&!n){const o=yt(t);if(o.length===1&&K(o[0].categoryMatches)){const s=o[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===s}}{const s=ft(o,(a,c,u)=>(a[c.tokenTypeIdx]=!0,U(c.categoryMatches,l=>{a[l]=!0}),a),[]);return function(){const a=this.LA(1);return s[a.tokenTypeIdx]===!0}}}return function(){t:for(let o=0;o<i;o++){const s=t[o],a=s.length;for(let c=0;c<a;c++){const u=this.LA(c+1);if(e(u,s[c])===!1)continue t}return!0}return!1}}(Et=Y||(Y={}))[Et.OPTION=0]="OPTION",Et[Et.REPETITION=1]="REPETITION",Et[Et.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",Et[Et.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",Et[Et.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",Et[Et.ALTERNATION=5]="ALTERNATION";class yc extends _n{constructor(e,n,r){super(),this.topProd=e,this.targetOccurrence=n,this.targetProdType=r}startWalking(){return this.walk(this.topProd),this.restDef}checkIsTarget(e,n,r,i){return e.idx===this.targetOccurrence&&this.targetProdType===n&&(this.restDef=r.concat(i),!0)}walkOption(e,n,r){this.checkIsTarget(e,Y.OPTION,n,r)||super.walkOption(e,n,r)}walkAtLeastOne(e,n,r){this.checkIsTarget(e,Y.REPETITION_MANDATORY,n,r)||super.walkOption(e,n,r)}walkAtLeastOneSep(e,n,r){this.checkIsTarget(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}walkMany(e,n,r){this.checkIsTarget(e,Y.REPETITION,n,r)||super.walkOption(e,n,r)}walkManySep(e,n,r){this.checkIsTarget(e,Y.REPETITION_WITH_SEPARATOR,n,r)||super.walkOption(e,n,r)}}class ps extends Te{constructor(e,n,r){super(),this.targetOccurrence=e,this.targetProdType=n,this.targetRef=r,this.result=[]}checkIsTarget(e,n){e.idx!==this.targetOccurrence||this.targetProdType!==n||this.targetRef!==void 0&&e!==this.targetRef||(this.result=e.definition)}visitOption(e){this.checkIsTarget(e,Y.OPTION)}visitRepetition(e){this.checkIsTarget(e,Y.REPETITION)}visitRepetitionMandatory(e){this.checkIsTarget(e,Y.REPETITION_MANDATORY)}visitRepetitionMandatoryWithSeparator(e){this.checkIsTarget(e,Y.REPETITION_MANDATORY_WITH_SEPARATOR)}visitRepetitionWithSeparator(e){this.checkIsTarget(e,Y.REPETITION_WITH_SEPARATOR)}visitAlternation(e){this.checkIsTarget(e,Y.ALTERNATION)}}function to(t){const e=new Array(t);for(let n=0;n<t;n++)e[n]=[];return e}function Kn(t){let e=[""];for(let n=0;n<t.length;n++){const r=t[n],i=[];for(let o=0;o<e.length;o++){const s=e[o];i.push(s+"_"+r.tokenTypeIdx);for(let a=0;a<r.categoryMatches.length;a++){const c="_"+r.categoryMatches[a];i.push(s+c)}}e=i}return e}function vc(t,e,n){for(let r=0;r<t.length;r++){if(r===n)continue;const i=t[r];for(let o=0;o<e.length;o++)if(i[e[o]]===!0)return!1}return!0}function ms(t,e){const n=b(t,s=>yr([s],1)),r=to(n.length),i=b(n,s=>{const a={};return U(s,c=>{U(Kn(c.partialPath),u=>{a[u]=!0})}),a});let o=n;for(let s=1;s<=e;s++){const a=o;o=to(a.length);for(let c=0;c<a.length;c++){const u=a[c];for(let l=0;l<u.length;l++){const h=u[l].partialPath,I=u[l].suffixDef,v=Kn(h);if(vc(i,v,c)||K(I)||h.length===e){const O=r[c];if(Sr(O,h)===!1){O.push(h);for(let x=0;x<v.length;x++){const _=v[x];i[c][_]=!0}}}else{const O=yr(I,s+1,h);o[c]=o[c].concat(O),U(O,x=>{U(Kn(x.partialPath),_=>{i[c][_]=!0})})}}}}return r}function vr(t,e,n,r){const i=new ps(t,Y.ALTERNATION,r);return e.accept(i),ms(i.result,n)}function Or(t,e,n,r){const i=new ps(t,n);e.accept(i);const o=i.result,s=new yc(e,t,n).startWalking();return ms([new ht({definition:o}),new ht({definition:s})],r)}function Sr(t,e){t:for(let n=0;n<t.length;n++){const r=t[n];if(r.length===e.length){for(let i=0;i<r.length;i++){const o=e[i],s=r[i];if(o!==s&&s.categoryMatchesMap[o.tokenTypeIdx]===void 0)continue t}return!0}}return!1}function eo(t){return vt(t,e=>vt(e,n=>vt(n,r=>K(r.categoryMatches))))}function Oc(t){return`${kt(t)}_#_${t.idx}_#_${Es(t)}`}function Es(t){return t instanceof V?t.terminalType.name:t instanceof pt?t.nonTerminalName:""}class Sc extends Te{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function gs(t,e,n,r=[]){const i=[],o=on(e.definition);if(K(o))return[];{const s=t.name;at(o,t)&&i.push({message:n.buildLeftRecursionError({topLevelRule:t,leftRecursionPath:r}),type:st.LEFT_RECURSION,ruleName:s});const a=Tt(ln(o,r.concat([t])),c=>{const u=et(r);return u.push(c),gs(t,c,n,u)});return i.concat(a)}}function on(t){let e=[];if(K(t))return e;const n=St(t);if(n instanceof pt)e.push(n.referencedRule);else if(n instanceof ht||n instanceof lt||n instanceof Ft||n instanceof Dt||n instanceof Lt||n instanceof J)e=e.concat(on(n.definition));else if(n instanceof xt)e=yt(b(n.definition,o=>on(o.definition)));else if(!(n instanceof V))throw Error("non exhaustive match");const r=hn(n),i=t.length>1;if(r&&i){const o=tt(t);return e.concat(on(o))}return e}class _r extends Te{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}class _c extends Te{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}const Ts="MismatchedTokenException",As="NoViableAltException",Is="EarlyExitException",Rs="NotAllInputParsedException",Ns=[Ts,As,Is,Rs];function Xe(t){return at(Ns,t.name)}Object.freeze(Ns);class xn extends Error{constructor(e,n){super(e),this.token=n,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class no extends xn{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Ts}}class Lc extends xn{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=As}}class xc extends xn{constructor(e,n){super(e,n),this.name=Rs}}class Cc extends xn{constructor(e,n,r){super(e,n),this.previousToken=r,this.name=Is}}const zn={},ys="InRuleRecoveryException";class kc extends Error{constructor(e){super(e),this.name=ys}}function bc(t,e,n,r,i,o,s){const a=this.getKeyForAutomaticLookahead(r,i);let c=this.firstAfterRepMap[a];if(c===void 0){const I=this.getCurrRuleFullName();c=new o(this.getGAstProductions()[I],i).startWalking(),this.firstAfterRepMap[a]=c}let u=c.token,l=c.occurrence;const h=c.isEndOfRule;this.RULE_STACK.length===1&&h&&u===void 0&&(u=re,l=1),u!==void 0&&l!==void 0&&this.shouldInRepetitionRecoveryBeTried(u,l,s)&&this.tryInRepetitionRecovery(t,e,n,u)}const Vn=1024,Hn=1280,qe=1536;function Yn(t,e,n){return n|e|t}class Pc{constructor(e){var n;this.maxLookahead=(n=e?.maxLookahead)!==null&&n!==void 0?n:zt.maxLookahead}validate(e){const n=this.validateNoLeftRecursion(e.rules);if(K(n)){const r=this.validateEmptyOrAlternatives(e.rules),i=this.validateAmbiguousAlternationAlternatives(e.rules,this.maxLookahead),o=this.validateSomeNonEmptyLookaheadPath(e.rules,this.maxLookahead);return[...n,...r,...i,...o]}return n}validateNoLeftRecursion(e){return Tt(e,n=>gs(n,n,ie))}validateEmptyOrAlternatives(e){return Tt(e,n=>function(r,i){const o=new _r;return r.accept(o),Tt(o.alternations,s=>Tt(De(s.definition),(a,c)=>K(ds([a],[],ke,1))?[{message:i.buildEmptyAlternationError({topLevelRule:r,alternation:s,emptyChoiceIdx:c}),type:st.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:s.idx,alternative:c+1}]:[]))}(n,ie))}validateAmbiguousAlternationAlternatives(e,n){return Tt(e,r=>function(i,o,s){const a=new _r;i.accept(a);let c=a.alternations;return c=tn(c,u=>u.ignoreAmbiguities===!0),Tt(c,u=>{const l=u.idx,h=u.maxLookahead||o,I=vr(l,i,h,u),v=function(x,_,T,g){const d=[];return b(ft(x,(A,N,f)=>(_.definition[f].ignoreAmbiguities===!0||U(N,m=>{const p=[f];U(x,(E,R)=>{f!==R&&Sr(E,m)&&_.definition[R].ignoreAmbiguities!==!0&&p.push(R)}),p.length>1&&!Sr(d,m)&&(d.push(m),A.push({alts:p,path:m}))}),A),[]),A=>{const N=b(A.alts,f=>f+1);return{message:g.buildAlternationAmbiguityError({topLevelRule:T,alternation:_,ambiguityIndices:N,prefixPath:A.path}),type:st.AMBIGUOUS_ALTS,ruleName:T.name,occurrence:_.idx,alternatives:A.alts}})}(I,u,i,s),O=function(x,_,T,g){const d=ft(x,(A,N,f)=>{const m=b(N,p=>({idx:f,path:p}));return A.concat(m)},[]);return Fe(Tt(d,A=>{if(_.definition[A.idx].ignoreAmbiguities===!0)return[];const N=A.idx,f=A.path;return b(gt(d,m=>{return _.definition[m.idx].ignoreAmbiguities!==!0&&m.idx<N&&(p=m.path,E=f,p.length<E.length&&vt(p,(R,P)=>{const L=E[P];return R===L||L.categoryMatchesMap[R.tokenTypeIdx]}));var p,E}),m=>{const p=[m.idx+1,N+1],E=_.idx===0?"":_.idx;return{message:g.buildAlternationPrefixAmbiguityError({topLevelRule:T,alternation:_,ambiguityIndices:p,prefixPath:m.path}),type:st.AMBIGUOUS_PREFIX_ALTS,ruleName:T.name,occurrence:E,alternatives:p}})}))}(I,u,i,s);return v.concat(O)})}(r,n,ie))}validateSomeNonEmptyLookaheadPath(e,n){return function(r,i,o){const s=[];return U(r,a=>{const c=new _c;a.accept(c),U(c.allProductions,u=>{const l=Ji(u),h=u.maxLookahead||i;if(K(yt(Or(u.idx,a,l,h)[0]))){const I=o.buildEmptyRepetitionError({topLevelRule:a,repetition:u});s.push({message:I,type:st.NO_NON_EMPTY_LOOKAHEAD,ruleName:a.name})}})}),s}(e,n,ie)}buildLookaheadForAlternation(e){return function(n,r,i,o,s,a){const c=vr(n,r,i);return a(c,o,eo(c)?En:ke,s)}(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Rc)}buildLookaheadForOptional(e){return function(n,r,i,o,s,a){const c=Or(n,r,s,i),u=eo(c)?En:ke;return a(c[0],u,o)}(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,Ji(e.prodType),Nc)}}const Ze=new class extends Te{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(t){this.dslMethods.option.push(t)}visitRepetitionWithSeparator(t){this.dslMethods.repetitionWithSeparator.push(t)}visitRepetitionMandatory(t){this.dslMethods.repetitionMandatory.push(t)}visitRepetitionMandatoryWithSeparator(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)}visitRepetition(t){this.dslMethods.repetition.push(t)}visitAlternation(t){this.dslMethods.alternation.push(t)}};function ro(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.endOffset=e.endOffset):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset)}function io(t,e){isNaN(t.startOffset)===!0?(t.startOffset=e.startOffset,t.startColumn=e.startColumn,t.startLine=e.startLine,t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine):t.endOffset<e.endOffset&&(t.endOffset=e.endOffset,t.endColumn=e.endColumn,t.endLine=e.endLine)}function oo(t,e){Object.defineProperty(t,"name",{enumerable:!1,configurable:!0,writable:!1,value:e})}function wc(t,e){const n=Nt(t),r=n.length;for(let i=0;i<r;i++){const o=t[n[i]],s=o.length;for(let a=0;a<s;a++){const c=o[a];c.tokenTypeIdx===void 0&&this[c.name](c.children,e)}}}var Lr;(function(t){t[t.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",t[t.MISSING_METHOD=1]="MISSING_METHOD"})(Lr||(Lr={}));const Cn={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(Cn);const so=!0,ao=Math.pow(2,8)-1,vs=D({name:"RECORDING_PHASE_TOKEN",pattern:ot.NA});Ge([vs]);const Os=Gr(vs,`This IToken indicates the Parser is in Recording Phase
90
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Os);const Mc={name:`This CSTNode indicates the Parser is in Recording Phase
91
- See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};function ve(t,e,n,r=!1){gn(n);const i=me(this.recordingProdStack),o=Yt(e)?e:e.DEF,s=new t({definition:[],idx:n});return r&&(s.separator=e.SEP),w(e,"MAX_LOOKAHEAD")&&(s.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(s),o.call(this),i.definition.push(s),this.recordingProdStack.pop(),Cn}function Uc(t,e){gn(e);const n=me(this.recordingProdStack),r=B(t)===!1,i=r===!1?t:t.DEF,o=new xt({definition:[],idx:e,ignoreAmbiguities:r&&t.IGNORE_AMBIGUITIES===!0});w(t,"MAX_LOOKAHEAD")&&(o.maxLookahead=t.MAX_LOOKAHEAD);const s=ns(i,a=>Yt(a.GATE));return o.hasPredicates=s,n.definition.push(o),U(i,a=>{const c=new ht({definition:[]});o.definition.push(c),w(a,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=a.IGNORE_AMBIGUITIES:w(a,"GATE")&&(c.ignoreAmbiguities=!0),this.recordingProdStack.push(c),a.ALT.call(this),this.recordingProdStack.pop()}),Cn}function co(t){return t===0?"":`${t}`}function gn(t){if(t<0||t>ao){const e=new Error(`Invalid DSL Method idx value: <${t}>
92
- Idx value must be a none negative value smaller than ${ao+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}const sn=Gr(re,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(sn);const zt=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:fs,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),Qe=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var st,Xn;(function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",t[t.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=5]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",t[t.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",t[t.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",t[t.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",t[t.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",t[t.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",t[t.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",t[t.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(st||(st={}));class je{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const n=this.className;this.TRACE_INIT("toFastProps",()=>{os(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),U(this.definedRulesNames,i=>{const o=this[i].originalGrammarAction;let s;this.TRACE_INIT(`${i} Rule`,()=>{s=this.topLevelRuleRecord(i,o)}),this.gastProductionsCache[i]=s})}finally{this.disableRecording()}});let r=[];if(this.TRACE_INIT("Grammar Resolving",()=>{r=function(i){const o=Er(i,{errMsgProvider:pc}),s={};return U(i.rules,a=>{s[a.name]=a}),function(a,c){const u=new mc(a,c);return u.resolveRefs(),u.errors}(s,o.errMsgProvider)}({rules:Q(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(r)}),this.TRACE_INIT("Grammar Validations",()=>{if(K(r)&&this.skipValidations===!1){const s=(o={rules:Q(this.gastProductionsCache),tokenTypes:Q(this.tokensMap),errMsgProvider:ie,grammarName:n},function(c,u,l,h){const I=Tt(c,_=>function(T,g){const d=new Sc;T.accept(d);const A=d.allProductions;return b(Q(_t(Ha(A,Oc),N=>N.length>1)),N=>{const f=St(N),m=g.buildDuplicateFoundError(T,N),p=kt(f),E={message:m,type:st.DUPLICATE_PRODUCTIONS,ruleName:T.name,dslName:p,occurrence:f.idx},R=Es(f);return R&&(E.parameter=R),E})}(_,l)),v=function(_,T,g){const d=[],A=b(T,N=>N.name);return U(_,N=>{const f=N.name;if(at(A,f)){const m=g.buildNamespaceConflictError(N);d.push({message:m,type:st.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:f})}}),d}(c,u,l),O=Tt(c,_=>function(T,g){const d=new _r;return T.accept(d),Tt(d.alternations,A=>A.definition.length>255?[{message:g.buildTooManyAlternativesError({topLevelRule:T,alternation:A}),type:st.TOO_MANY_ALTS,ruleName:T.name,occurrence:A.idx}]:[])}(_,l)),x=Tt(c,_=>function(T,g,d,A){const N=[];if(ft(g,(f,m)=>m.name===T.name?f+1:f,0)>1){const f=A.buildDuplicateRuleNameError({topLevelRule:T,grammarName:d});N.push({message:f,type:st.DUPLICATE_RULE_NAME,ruleName:T.name})}return N}(_,c,h,l));return I.concat(v,O,x)}((o=Er(o,{errMsgProvider:ie})).rules,o.tokenTypes,o.errMsgProvider,o.grammarName)),a=b((i={lookaheadStrategy:this.lookaheadStrategy,rules:Q(this.gastProductionsCache),tokenTypes:Q(this.tokensMap),grammarName:n}).lookaheadStrategy.validate({rules:i.rules,tokenTypes:i.tokenTypes,grammarName:i.grammarName}),c=>Object.assign({type:st.CUSTOM_LOOKAHEAD_VALIDATION},c));this.definitionErrors=this.definitionErrors.concat(s,a)}var i,o}),K(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const i=function(o){const s={};return U(o,a=>{const c=new rc(a).startWalking();dt(s,c)}),s}(Q(this.gastProductionsCache));this.resyncFollows=i}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var i,o;(o=(i=this.lookaheadStrategy).initialize)===null||o===void 0||o.call(i,{rules:Q(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Q(this.gastProductionsCache))})),!je.DEFER_DEFINITION_ERRORS_HANDLING&&!K(this.definitionErrors))throw e=b(this.definitionErrors,i=>i.message),new Error(`Parser Definition Errors detected:
93
- ${e.join(`
94
- -------------------------------
95
- `)}`)})}constructor(e,n){this.definitionErrors=[],this.selfAnalysisDone=!1;const r=this;if(r.initErrorHandler(n),r.initLexerAdapter(),r.initLooksAhead(n),r.initRecognizerEngine(e,n),r.initRecoverable(n),r.initTreeBuilder(n),r.initContentAssist(),r.initGastRecorder(n),r.initPerformanceTracer(n),w(n,"ignoredIssues"))throw new Error(`The <ignoredIssues> IParserConfig property has been deprecated.
96
- Please use the <IGNORE_AMBIGUITIES> flag on the relevant DSL method instead.
97
- See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES
98
- For further details.`);this.skipValidations=w(n,"skipValidations")?n.skipValidations:zt.skipValidations}}je.DEFER_DEFINITION_ERRORS_HANDLING=!1,Xn=je,[class{initRecoverable(t){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=w(t,"recoveryEnabled")?t.recoveryEnabled:zt.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=bc)}getTokenToInsert(t){const e=Gr(t,"",NaN,NaN,NaN,NaN,NaN,NaN);return e.isInsertedInRecovery=!0,e}canTokenTypeBeInsertedInRecovery(t){return!0}canTokenTypeBeDeletedInRecovery(t){return!0}tryInRepetitionRecovery(t,e,n,r){const i=this.findReSyncTokenType(),o=this.exportLexerState(),s=[];let a=!1;const c=this.LA(1);let u=this.LA(1);const l=()=>{const h=this.LA(0),I=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:h,ruleName:this.getCurrRuleFullName()}),v=new no(I,c,this.LA(0));v.resyncedTokens=De(s),this.SAVE_ERROR(v)};for(;!a;){if(this.tokenMatcher(u,r))return void l();if(n.call(this))return l(),void t.apply(this,e);this.tokenMatcher(u,i)?a=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,s))}this.importLexerState(o)}shouldInRepetitionRecoveryBeTried(t,e,n){return n!==!1&&!this.tokenMatcher(this.LA(1),t)&&!this.isBackTracking()&&!this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,e))}getFollowsForInRuleRecovery(t,e){const n=this.getCurrentGrammarPath(t,e);return this.getNextPossibleTokenTypes(n)}tryInRuleRecovery(t,e){if(this.canRecoverWithSingleTokenInsertion(t,e))return this.getTokenToInsert(t);if(this.canRecoverWithSingleTokenDeletion(t)){const n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new kc("sad sad panda")}canPerformInRuleRecovery(t,e){return this.canRecoverWithSingleTokenInsertion(t,e)||this.canRecoverWithSingleTokenDeletion(t)}canRecoverWithSingleTokenInsertion(t,e){if(!this.canTokenTypeBeInsertedInRecovery(t)||K(e))return!1;const n=this.LA(1);return Ee(e,r=>this.tokenMatcher(n,r))!==void 0}canRecoverWithSingleTokenDeletion(t){return!!this.canTokenTypeBeDeletedInRecovery(t)&&this.tokenMatcher(this.LA(2),t)}isInCurrentRuleReSyncSet(t){const e=this.getCurrFollowKey();return at(this.getFollowSetFromFollowKey(e),t)}findReSyncTokenType(){const t=this.flattenFollowSet();let e=this.LA(1),n=2;for(;;){const r=Ee(t,i=>ke(e,i));if(r!==void 0)return r;e=this.LA(n),n++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return zn;const t=this.getLastExplicitRuleShortName(),e=this.getLastExplicitRuleOccurrenceIndex(),n=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(t),idxInCallingRule:e,inRule:this.shortRuleNameToFullName(n)}}buildFullFollowKeyStack(){const t=this.RULE_STACK,e=this.RULE_OCCURRENCE_STACK;return b(t,(n,r)=>r===0?zn:{ruleName:this.shortRuleNameToFullName(n),idxInCallingRule:e[r],inRule:this.shortRuleNameToFullName(t[r-1])})}flattenFollowSet(){return yt(b(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t)))}getFollowSetFromFollowKey(t){if(t===zn)return[re];const e=t.ruleName+t.idxInCallingRule+ss+t.inRule;return this.resyncFollows[e]}addToResyncTokens(t,e){return this.tokenMatcher(t,re)||e.push(t),e}reSyncTo(t){const e=[];let n=this.LA(1);for(;this.tokenMatcher(n,t)===!1;)n=this.SKIP_TOKEN(),this.addToResyncTokens(n,e);return De(e)}attemptInRepetitionRecovery(t,e,n,r,i,o,s){}getCurrentGrammarPath(t,e){return{ruleStack:this.getHumanReadableRuleStack(),occurrenceStack:et(this.RULE_OCCURRENCE_STACK),lastTok:t,lastTokOccurrence:e}}getHumanReadableRuleStack(){return b(this.RULE_STACK,t=>this.shortRuleNameToFullName(t))}},class{initLooksAhead(t){this.dynamicTokensEnabled=w(t,"dynamicTokensEnabled")?t.dynamicTokensEnabled:zt.dynamicTokensEnabled,this.maxLookahead=w(t,"maxLookahead")?t.maxLookahead:zt.maxLookahead,this.lookaheadStrategy=w(t,"lookaheadStrategy")?t.lookaheadStrategy:new Pc({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(t){U(t,e=>{this.TRACE_INIT(`${e.name} Rule Lookahead`,()=>{const{alternation:n,repetition:r,option:i,repetitionMandatory:o,repetitionMandatoryWithSeparator:s,repetitionWithSeparator:a}=function(c){Ze.reset(),c.accept(Ze);const u=Ze.dslMethods;return Ze.reset(),u}(e);U(n,c=>{const u=c.idx===0?"":c.idx;this.TRACE_INIT(`${kt(c)}${u}`,()=>{const l=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:e,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),h=Yn(this.fullRuleNameToShort[e.name],256,c.idx);this.setLaFuncCache(h,l)})}),U(r,c=>{this.computeLookaheadFunc(e,c.idx,768,"Repetition",c.maxLookahead,kt(c))}),U(i,c=>{this.computeLookaheadFunc(e,c.idx,512,"Option",c.maxLookahead,kt(c))}),U(o,c=>{this.computeLookaheadFunc(e,c.idx,Vn,"RepetitionMandatory",c.maxLookahead,kt(c))}),U(s,c=>{this.computeLookaheadFunc(e,c.idx,qe,"RepetitionMandatoryWithSeparator",c.maxLookahead,kt(c))}),U(a,c=>{this.computeLookaheadFunc(e,c.idx,Hn,"RepetitionWithSeparator",c.maxLookahead,kt(c))})})})}computeLookaheadFunc(t,e,n,r,i,o){this.TRACE_INIT(`${o}${e===0?"":e}`,()=>{const s=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:e,rule:t,maxLookahead:i||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),a=Yn(this.fullRuleNameToShort[t.name],n,e);this.setLaFuncCache(a,s)})}getKeyForAutomaticLookahead(t,e){return Yn(this.getLastExplicitRuleShortName(),t,e)}getLaFuncFromCache(t){return this.lookAheadFuncsCache.get(t)}setLaFuncCache(t,e){this.lookAheadFuncsCache.set(t,e)}},class{initTreeBuilder(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=w(t,"nodeLocationTracking")?t.nodeLocationTracking:zt.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=io,this.setNodeLocationFromNode=io,this.cstPostRule=Z,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Z,this.setNodeLocationFromNode=Z,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=ro,this.setNodeLocationFromNode=ro,this.cstPostRule=Z,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Z,this.setNodeLocationFromNode=Z,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error(`Invalid <nodeLocationTracking> config option: "${t.nodeLocationTracking}"`);this.setNodeLocationFromToken=Z,this.setNodeLocationFromNode=Z,this.cstPostRule=Z,this.setInitialNodeLocation=Z}else this.cstInvocationStateUpdate=Z,this.cstFinallyStateUpdate=Z,this.cstPostTerminal=Z,this.cstPostNonTerminal=Z,this.cstPostRule=Z}setInitialNodeLocationOnlyOffsetRecovery(t){t.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(t){t.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(t){t.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(t){const e=this.LA(1);t.location={startOffset:e.startOffset,startLine:e.startLine,startColumn:e.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(t){const e={name:t,children:Object.create(null)};this.setInitialNodeLocation(e),this.CST_STACK.push(e)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(t){const e=this.LA(0),n=t.location;n.startOffset<=e.startOffset==1?(n.endOffset=e.endOffset,n.endLine=e.endLine,n.endColumn=e.endColumn):(n.startOffset=NaN,n.startLine=NaN,n.startColumn=NaN)}cstPostRuleOnlyOffset(t){const e=this.LA(0),n=t.location;n.startOffset<=e.startOffset==1?n.endOffset=e.endOffset:n.startOffset=NaN}cstPostTerminal(t,e){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,o;i=e,o=t,(r=n).children[o]===void 0?r.children[o]=[i]:r.children[o].push(i),this.setNodeLocationFromToken(n.location,e)}cstPostNonTerminal(t,e){const n=this.CST_STACK[this.CST_STACK.length-1];var r,i,o;i=e,o=t,(r=n).children[i]===void 0?r.children[i]=[o]:r.children[i].push(o),this.setNodeLocationFromNode(n.location,t.location)}getBaseCstVisitorConstructor(){if(Ht(this.baseCstVisitorConstructor)){const t=function(e,n){const r=function(){};return oo(r,e+"BaseSemantics"),(r.prototype={visit:function(i,o){if(B(i)&&(i=i[0]),!Ht(i))return this[i.name](i.children,o)},validateVisitor:function(){const i=(o=this,Fe(b(gt(n,s=>Yt(o[s])===!1),s=>({msg:`Missing visitor method: <${s}> on ${o.constructor.name} CST Visitor.`,type:Lr.MISSING_METHOD,methodName:s}))));var o;if(!K(i)){const s=b(i,a=>a.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>:
99
- ${s.join(`
100
-
101
- `).replace(/\n/g,`
102
- `)}`)}}}).constructor=r,r._RULE_NAMES=n,r}(this.className,Nt(this.gastProductionsCache));return this.baseCstVisitorConstructor=t,t}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Ht(this.baseCstVisitorWithDefaultsConstructor)){const t=function(e,n,r){const i=function(){};oo(i,e+"BaseSemanticsWithDefaults");const o=Object.create(r.prototype);return U(n,s=>{o[s]=wc}),(i.prototype=o).constructor=i,i}(this.className,Nt(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=t,t}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const t=this.RULE_STACK;return t[t.length-1]}getPreviousExplicitRuleShortName(){const t=this.RULE_STACK;return t[t.length-2]}getLastExplicitRuleOccurrenceIndex(){const t=this.RULE_OCCURRENCE_STACK;return t[t.length-1]}},class{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(t){if(this.selfAnalysisDone!==!0)throw Error("Missing <performSelfAnalysis> invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=t,this.tokVectorLength=t.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):sn}LA(t){const e=this.currIdx+t;return e<0||this.tokVectorLength<=e?sn:this.tokVector[e]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(t){this.currIdx=t}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}},class{initRecognizerEngine(t,e){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=En,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},w(e,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a <serializedGrammar> property.
103
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0
104
- For Further details.`);if(B(t)){if(K(t))throw Error(`A Token Vocabulary cannot be empty.
105
- Note that the first argument for the parser constructor
106
- is no longer a Token vector (since v4.0).`);if(typeof t[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument.
107
- See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0
108
- For Further details.`)}if(B(t))this.tokensMap=ft(t,(r,i)=>(r[i.name]=i,r),{});else if(w(t,"modes")&&vt(yt(Q(t.modes)),dc)){const r=gr(yt(Q(t.modes)));this.tokensMap=ft(r,(i,o)=>(i[o.name]=o,i),{})}else{if(!Rt(t))throw new Error("<tokensDictionary> argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=et(t)}this.tokensMap.EOF=re;const n=vt(w(t,"modes")?yt(Q(t.modes)):Q(t),r=>K(r.categoryMatches));this.tokenMatcher=n?En:ke,Ge(Q(this.tokensMap))}defineRule(t,e,n){if(this.selfAnalysisDone)throw Error(`Grammar rule <${t}> may not be defined after the 'performSelfAnalysis' method has been called'
109
- Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=w(n,"resyncEnabled")?n.resyncEnabled:Qe.resyncEnabled,i=w(n,"recoveryValueFunc")?n.recoveryValueFunc:Qe.recoveryValueFunc,o=this.ruleShortNameIdx<<12;let s;return this.ruleShortNameIdx++,this.shortRuleNameToFull[o]=t,this.fullRuleNameToShort[t]=o,s=this.outputCst===!0?function(...a){try{this.ruleInvocationStateUpdate(o,t,this.subruleIdx),e.apply(this,a);const c=this.CST_STACK[this.CST_STACK.length-1];return this.cstPostRule(c),c}catch(c){return this.invokeRuleCatch(c,r,i)}finally{this.ruleFinallyStateUpdate()}}:function(...a){try{return this.ruleInvocationStateUpdate(o,t,this.subruleIdx),e.apply(this,a)}catch(c){return this.invokeRuleCatch(c,r,i)}finally{this.ruleFinallyStateUpdate()}},Object.assign(s,{ruleName:t,originalGrammarAction:e})}invokeRuleCatch(t,e,n){const r=this.RULE_STACK.length===1,i=e&&!this.isBackTracking()&&this.recoveryEnabled;if(Xe(t)){const o=t;if(i){const s=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(s)){if(o.resyncedTokens=this.reSyncTo(s),this.outputCst){const a=this.CST_STACK[this.CST_STACK.length-1];return a.recoveredNode=!0,a}return n(t)}if(this.outputCst){const a=this.CST_STACK[this.CST_STACK.length-1];a.recoveredNode=!0,o.partialCstResult=a}throw o}if(r)return this.moveToTerminatedState(),n(t);throw o}throw t}optionInternal(t,e){const n=this.getKeyForAutomaticLookahead(512,e);return this.optionInternalLogic(t,e,n)}optionInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof t!="function"){r=t.DEF;const o=t.GATE;if(o!==void 0){const s=i;i=()=>o.call(this)&&s.call(this)}}else r=t;if(i.call(this)===!0)return r.call(this)}atLeastOneInternal(t,e){const n=this.getKeyForAutomaticLookahead(Vn,t);return this.atLeastOneInternalLogic(t,e,n)}atLeastOneInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!="function"){r=e.DEF;const o=e.GATE;if(o!==void 0){const s=i;i=()=>o.call(this)&&s.call(this)}}else r=e;if(i.call(this)!==!0)throw this.raiseEarlyExitException(t,Y.REPETITION_MANDATORY,e.ERR_MSG);{let o=this.doSingleRepetition(r);for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r)}this.attemptInRepetitionRecovery(this.atLeastOneInternal,[t,e],i,Vn,t,Ac)}atLeastOneSepFirstInternal(t,e){const n=this.getKeyForAutomaticLookahead(qe,t);this.atLeastOneSepFirstInternalLogic(t,e,n)}atLeastOneSepFirstInternalLogic(t,e,n){const r=e.DEF,i=e.SEP;if(this.getLaFuncFromCache(n).call(this)!==!0)throw this.raiseEarlyExitException(t,Y.REPETITION_MANDATORY_WITH_SEPARATOR,e.ERR_MSG);{r.call(this);const o=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,i,o,r,Qi],o,qe,t,Qi)}}manyInternal(t,e){const n=this.getKeyForAutomaticLookahead(768,t);return this.manyInternalLogic(t,e,n)}manyInternalLogic(t,e,n){let r,i=this.getLaFuncFromCache(n);if(typeof e!="function"){r=e.DEF;const s=e.GATE;if(s!==void 0){const a=i;i=()=>s.call(this)&&a.call(this)}}else r=e;let o=!0;for(;i.call(this)===!0&&o===!0;)o=this.doSingleRepetition(r);this.attemptInRepetitionRecovery(this.manyInternal,[t,e],i,768,t,Tc,o)}manySepFirstInternal(t,e){const n=this.getKeyForAutomaticLookahead(Hn,t);this.manySepFirstInternalLogic(t,e,n)}manySepFirstInternalLogic(t,e,n){const r=e.DEF,i=e.SEP;if(this.getLaFuncFromCache(n).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),i);for(;this.tokenMatcher(this.LA(1),i)===!0;)this.CONSUME(i),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,i,o,r,Zi],o,Hn,t,Zi)}}repetitionSepSecondInternal(t,e,n,r,i){for(;n();)this.CONSUME(e),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,e,n,r,i],n,qe,t,i)}doSingleRepetition(t){const e=this.getLexerPosition();return t.call(this),this.getLexerPosition()>e}orInternal(t,e){const n=this.getKeyForAutomaticLookahead(256,e),r=B(t)?t:t.DEF,i=this.getLaFuncFromCache(n).call(this,r);if(i!==void 0)return r[i].ALT.call(this);this.raiseNoAltException(e,t.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const t=this.LA(1),e=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new xc(e,t))}}subruleInternal(t,e,n){let r;try{const i=n!==void 0?n.ARGS:void 0;return this.subruleIdx=e,r=t.apply(this,i),this.cstPostNonTerminal(r,n!==void 0&&n.LABEL!==void 0?n.LABEL:t.ruleName),r}catch(i){throw this.subruleInternalError(i,n,t.ruleName)}}subruleInternalError(t,e,n){throw Xe(t)&&t.partialCstResult!==void 0&&(this.cstPostNonTerminal(t.partialCstResult,e!==void 0&&e.LABEL!==void 0?e.LABEL:n),delete t.partialCstResult),t}consumeInternal(t,e,n){let r;try{const i=this.LA(1);this.tokenMatcher(i,t)===!0?(this.consumeToken(),r=i):this.consumeInternalError(t,i,n)}catch(i){r=this.consumeInternalRecovery(t,e,i)}return this.cstPostTerminal(n!==void 0&&n.LABEL!==void 0?n.LABEL:t.name,r),r}consumeInternalError(t,e,n){let r;const i=this.LA(0);throw r=n!==void 0&&n.ERR_MSG?n.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:e,previous:i,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new no(r,e,i))}consumeInternalRecovery(t,e,n){if(!this.recoveryEnabled||n.name!=="MismatchedTokenException"||this.isBackTracking())throw n;{const r=this.getFollowsForInRuleRecovery(t,e);try{return this.tryInRuleRecovery(t,r)}catch(i){throw i.name===ys?n:i}}}saveRecogState(){const t=this.errors,e=et(this.RULE_STACK);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:e,CST_STACK:this.CST_STACK}}reloadRecogState(t){this.errors=t.errors,this.importLexerState(t.lexerState),this.RULE_STACK=t.RULE_STACK}ruleInvocationStateUpdate(t,e,n){this.RULE_OCCURRENCE_STACK.push(n),this.RULE_STACK.push(t),this.cstInvocationStateUpdate(e)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const t=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[t]}shortRuleNameToFullName(t){return this.shortRuleNameToFull[t]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),re)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}},class{ACTION(t){return t.call(this)}consume(t,e,n){return this.consumeInternal(e,t,n)}subrule(t,e,n){return this.subruleInternal(e,t,n)}option(t,e){return this.optionInternal(e,t)}or(t,e){return this.orInternal(e,t)}many(t,e){return this.manyInternal(t,e)}atLeastOne(t,e){return this.atLeastOneInternal(t,e)}CONSUME(t,e){return this.consumeInternal(t,0,e)}CONSUME1(t,e){return this.consumeInternal(t,1,e)}CONSUME2(t,e){return this.consumeInternal(t,2,e)}CONSUME3(t,e){return this.consumeInternal(t,3,e)}CONSUME4(t,e){return this.consumeInternal(t,4,e)}CONSUME5(t,e){return this.consumeInternal(t,5,e)}CONSUME6(t,e){return this.consumeInternal(t,6,e)}CONSUME7(t,e){return this.consumeInternal(t,7,e)}CONSUME8(t,e){return this.consumeInternal(t,8,e)}CONSUME9(t,e){return this.consumeInternal(t,9,e)}SUBRULE(t,e){return this.subruleInternal(t,0,e)}SUBRULE1(t,e){return this.subruleInternal(t,1,e)}SUBRULE2(t,e){return this.subruleInternal(t,2,e)}SUBRULE3(t,e){return this.subruleInternal(t,3,e)}SUBRULE4(t,e){return this.subruleInternal(t,4,e)}SUBRULE5(t,e){return this.subruleInternal(t,5,e)}SUBRULE6(t,e){return this.subruleInternal(t,6,e)}SUBRULE7(t,e){return this.subruleInternal(t,7,e)}SUBRULE8(t,e){return this.subruleInternal(t,8,e)}SUBRULE9(t,e){return this.subruleInternal(t,9,e)}OPTION(t){return this.optionInternal(t,0)}OPTION1(t){return this.optionInternal(t,1)}OPTION2(t){return this.optionInternal(t,2)}OPTION3(t){return this.optionInternal(t,3)}OPTION4(t){return this.optionInternal(t,4)}OPTION5(t){return this.optionInternal(t,5)}OPTION6(t){return this.optionInternal(t,6)}OPTION7(t){return this.optionInternal(t,7)}OPTION8(t){return this.optionInternal(t,8)}OPTION9(t){return this.optionInternal(t,9)}OR(t){return this.orInternal(t,0)}OR1(t){return this.orInternal(t,1)}OR2(t){return this.orInternal(t,2)}OR3(t){return this.orInternal(t,3)}OR4(t){return this.orInternal(t,4)}OR5(t){return this.orInternal(t,5)}OR6(t){return this.orInternal(t,6)}OR7(t){return this.orInternal(t,7)}OR8(t){return this.orInternal(t,8)}OR9(t){return this.orInternal(t,9)}MANY(t){this.manyInternal(0,t)}MANY1(t){this.manyInternal(1,t)}MANY2(t){this.manyInternal(2,t)}MANY3(t){this.manyInternal(3,t)}MANY4(t){this.manyInternal(4,t)}MANY5(t){this.manyInternal(5,t)}MANY6(t){this.manyInternal(6,t)}MANY7(t){this.manyInternal(7,t)}MANY8(t){this.manyInternal(8,t)}MANY9(t){this.manyInternal(9,t)}MANY_SEP(t){this.manySepFirstInternal(0,t)}MANY_SEP1(t){this.manySepFirstInternal(1,t)}MANY_SEP2(t){this.manySepFirstInternal(2,t)}MANY_SEP3(t){this.manySepFirstInternal(3,t)}MANY_SEP4(t){this.manySepFirstInternal(4,t)}MANY_SEP5(t){this.manySepFirstInternal(5,t)}MANY_SEP6(t){this.manySepFirstInternal(6,t)}MANY_SEP7(t){this.manySepFirstInternal(7,t)}MANY_SEP8(t){this.manySepFirstInternal(8,t)}MANY_SEP9(t){this.manySepFirstInternal(9,t)}AT_LEAST_ONE(t){this.atLeastOneInternal(0,t)}AT_LEAST_ONE1(t){return this.atLeastOneInternal(1,t)}AT_LEAST_ONE2(t){this.atLeastOneInternal(2,t)}AT_LEAST_ONE3(t){this.atLeastOneInternal(3,t)}AT_LEAST_ONE4(t){this.atLeastOneInternal(4,t)}AT_LEAST_ONE5(t){this.atLeastOneInternal(5,t)}AT_LEAST_ONE6(t){this.atLeastOneInternal(6,t)}AT_LEAST_ONE7(t){this.atLeastOneInternal(7,t)}AT_LEAST_ONE8(t){this.atLeastOneInternal(8,t)}AT_LEAST_ONE9(t){this.atLeastOneInternal(9,t)}AT_LEAST_ONE_SEP(t){this.atLeastOneSepFirstInternal(0,t)}AT_LEAST_ONE_SEP1(t){this.atLeastOneSepFirstInternal(1,t)}AT_LEAST_ONE_SEP2(t){this.atLeastOneSepFirstInternal(2,t)}AT_LEAST_ONE_SEP3(t){this.atLeastOneSepFirstInternal(3,t)}AT_LEAST_ONE_SEP4(t){this.atLeastOneSepFirstInternal(4,t)}AT_LEAST_ONE_SEP5(t){this.atLeastOneSepFirstInternal(5,t)}AT_LEAST_ONE_SEP6(t){this.atLeastOneSepFirstInternal(6,t)}AT_LEAST_ONE_SEP7(t){this.atLeastOneSepFirstInternal(7,t)}AT_LEAST_ONE_SEP8(t){this.atLeastOneSepFirstInternal(8,t)}AT_LEAST_ONE_SEP9(t){this.atLeastOneSepFirstInternal(9,t)}RULE(t,e,n=Qe){if(at(this.definedRulesNames,t)){const i={message:ie.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:st.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(i)}this.definedRulesNames.push(t);const r=this.defineRule(t,e,n);return this[t]=r,r}OVERRIDE_RULE(t,e,n=Qe){const r=function(o,s,a){const c=[];let u;return at(s,o)||(u=`Invalid rule override, rule: ->${o}<- cannot be overridden in the grammar: ->${a}<-as it is not defined in any of the super grammars `,c.push({message:u,type:st.INVALID_RULE_OVERRIDE,ruleName:o})),c}(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const i=this.defineRule(t,e,n);return this[t]=i,i}BACKTRACK(t,e){return function(){this.isBackTrackingStack.push(1);const n=this.saveRecogState();try{return t.apply(this,e),!0}catch(r){if(Xe(r))return!1;throw r}finally{this.reloadRecogState(n),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return b(Q(this.gastProductionsCache),en)}},class{initErrorHandler(t){this._errors=[],this.errorMessageProvider=w(t,"errorMessageProvider")?t.errorMessageProvider:zt.errorMessageProvider}SAVE_ERROR(t){if(Xe(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:et(this.RULE_OCCURRENCE_STACK)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return et(this._errors)}set errors(t){this._errors=t}raiseEarlyExitException(t,e,n){const r=this.getCurrRuleFullName(),i=Or(t,this.getGAstProductions()[r],e,this.maxLookahead)[0],o=[];for(let a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));const s=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:o,previous:this.LA(0),customUserDescription:n,ruleName:r});throw this.SAVE_ERROR(new Cc(s,this.LA(1),this.LA(0)))}raiseNoAltException(t,e){const n=this.getCurrRuleFullName(),r=vr(t,this.getGAstProductions()[n],this.maxLookahead),i=[];for(let a=1;a<=this.maxLookahead;a++)i.push(this.LA(a));const o=this.LA(0),s=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:r,actual:i,previous:o,customUserDescription:e,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Lc(s,this.LA(1),o))}},class{initContentAssist(){}computeContentAssist(t,e){const n=this.gastProductionsCache[t];if(Ht(n))throw Error(`Rule ->${t}<- does not exist in this grammar.`);return ds([n],e,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(t){const e=St(t.ruleStack),n=this.getGAstProductions()[e];return new gc(n,t).startWalking()}},class{initGastRecorder(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let t=0;t<10;t++){const e=t>0?t:"";this[`CONSUME${e}`]=function(n,r){return this.consumeInternalRecord(n,t,r)},this[`SUBRULE${e}`]=function(n,r){return this.subruleInternalRecord(n,t,r)},this[`OPTION${e}`]=function(n){return this.optionInternalRecord(n,t)},this[`OR${e}`]=function(n){return this.orInternalRecord(n,t)},this[`MANY${e}`]=function(n){this.manyInternalRecord(t,n)},this[`MANY_SEP${e}`]=function(n){this.manySepFirstInternalRecord(t,n)},this[`AT_LEAST_ONE${e}`]=function(n){this.atLeastOneInternalRecord(t,n)},this[`AT_LEAST_ONE_SEP${e}`]=function(n){this.atLeastOneSepFirstInternalRecord(t,n)}}this.consume=function(t,e,n){return this.consumeInternalRecord(e,t,n)},this.subrule=function(t,e,n){return this.subruleInternalRecord(e,t,n)},this.option=function(t,e){return this.optionInternalRecord(e,t)},this.or=function(t,e){return this.orInternalRecord(e,t)},this.many=function(t,e){this.manyInternalRecord(t,e)},this.atLeastOne=function(t,e){this.atLeastOneInternalRecord(t,e)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const t=this;for(let e=0;e<10;e++){const n=e>0?e:"";delete t[`CONSUME${n}`],delete t[`SUBRULE${n}`],delete t[`OPTION${n}`],delete t[`OR${n}`],delete t[`MANY${n}`],delete t[`MANY_SEP${n}`],delete t[`AT_LEAST_ONE${n}`],delete t[`AT_LEAST_ONE_SEP${n}`]}delete t.consume,delete t.subrule,delete t.option,delete t.or,delete t.many,delete t.atLeastOne,delete t.ACTION,delete t.BACKTRACK,delete t.LA})}ACTION_RECORD(t){}BACKTRACK_RECORD(t,e){return()=>!0}LA_RECORD(t){return sn}topLevelRuleRecord(t,e){try{const n=new ge({definition:[],name:t});return n.name=t,this.recordingProdStack.push(n),e.call(this),this.recordingProdStack.pop(),n}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+`
110
- This error was thrown during the "grammar recording phase" For more info see:
111
- https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}}optionInternalRecord(t,e){return ve.call(this,lt,t,e)}atLeastOneInternalRecord(t,e){ve.call(this,Ft,e,t)}atLeastOneSepFirstInternalRecord(t,e){ve.call(this,Dt,e,t,so)}manyInternalRecord(t,e){ve.call(this,J,e,t)}manySepFirstInternalRecord(t,e){ve.call(this,Lt,e,t,so)}orInternalRecord(t,e){return Uc.call(this,t,e)}subruleInternalRecord(t,e,n){if(gn(e),!t||w(t,"ruleName")===!1){const s=new Error(`<SUBRULE${co(e)}> argument is invalid expecting a Parser method reference but got: <${JSON.stringify(t)}>
112
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw s.KNOWN_RECORDER_ERROR=!0,s}const r=me(this.recordingProdStack),i=t.ruleName,o=new pt({idx:e,nonTerminalName:i,label:n?.LABEL,referencedRule:void 0});return r.definition.push(o),this.outputCst?Mc:Cn}consumeInternalRecord(t,e,n){if(gn(e),!ls(t)){const o=new Error(`<CONSUME${co(e)}> argument is invalid expecting a TokenType reference but got: <${JSON.stringify(t)}>
113
- inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const r=me(this.recordingProdStack),i=new V({idx:e,terminalType:t,label:n?.LABEL});return r.definition.push(i),Os}},class{initPerformanceTracer(t){if(w(t,"traceInitPerf")){const e=t.traceInitPerf,n=typeof e=="number";this.traceInitMaxIdent=n?e:1/0,this.traceInitPerf=n?e>0:e}else this.traceInitMaxIdent=0,this.traceInitPerf=zt.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(t,e){if(this.traceInitPerf===!0){this.traceInitIndent++;const n=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent<this.traceInitMaxIdent&&console.log(`${n}--> <${t}>`);const{time:r,value:i}=is(e),o=r>10?console.warn:console.log;return this.traceInitIndent<this.traceInitMaxIdent&&o(`${n}<-- <${t}> time: ${r}ms`),this.traceInitIndent--,i}return e()}}].forEach(t=>{const e=t.prototype;Object.getOwnPropertyNames(e).forEach(n=>{if(n==="constructor")return;const r=Object.getOwnPropertyDescriptor(e,n);r&&(r.get||r.set)?Object.defineProperty(Xn.prototype,n,r):Xn.prototype[n]=t.prototype[n]})});class Fc extends je{constructor(e,n=zt){const r=et(n);r.outputCst=!1,super(e,r)}}const Dc=D({name:"WhiteSpace",pattern:/\s+/,group:ot.SKIPPED}),Ss=D({name:"String",pattern:/"(""|[^"])*"/}),jc=D({name:"SingleQuotedString",pattern:/'(''|[^'])*'/}),Bc=D({name:"SheetQuoted",pattern:/'((?![\\/[\]*?:]).)+?'!/}),$c=D({name:"FunctionToken",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\(/}),_s=D({name:"NamedTableReference",pattern:/[A-Za-z_]+[A-Za-z_0-9.]*\[/}),Wc=D({name:"BracketedString",pattern:/\[([^[\]]*)\]/,longer_alt:[_s,Ss]}),Ls=D({name:"LiteralError",pattern:/#PARSE!|#NULL!|#DIV\/0!|#VALUE!|#NUM!|#FIELD!|#N\/A|#GETTING_DATA|#SPILL!|#CONNECT!|#BLOCKED!|#UNKNOWN!|#FIELD!|#CALC!|#BUSY!|#PYTHON!|#TIMEOUT!/}),xs=D({name:"RefError",pattern:/#REF!|#NAME\?/}),Gc=D({name:"Sheet",pattern:/[A-Za-z_.\d\u007F-\uFFFF]+!/}),Kc=/^[a-zA-Z_][a-zA-Z0-9_.?]*:?/,kn=D({name:"Name",pattern:{exec:(t,e)=>{try{const n=Kc.exec(t.substring(e));if(n){const r=n[0];if(r.endsWith(":")){const i=r.length;return r[i-2]==="."?[r.substring(0,i-2)]:[r.substring(0,i-1)]}return[r]}}catch(n){console.warn("Error parsing name",n)}return null}},line_breaks:!1,start_chars_hint:(()=>{const t=[];for(let e=65;e<=90;e++)t.push(e);for(let e=97;e<=122;e++)t.push(e);for(let e=48;e<=57;e++)t.push(e);return t})()}),zc=D({name:"Cell",pattern:/[$]?[A-Za-z]{1,3}[$]?[1-9][0-9]*/,longer_alt:kn}),Vc=D({name:"Column",pattern:/[$]?[A-Za-z]{1,3}/,longer_alt:kn}),Hc=D({name:"AbsRow",pattern:/[$][0-9]+/,longer_alt:kn}),Yc=D({name:"NumberToken",pattern:/[0-9]+[.]?[0-9]*([eE][+-][0-9]+)?/}),Xc=D({name:"Boolean",pattern:/TRUE|FALSE/i}),qc=D({name:"Comma",pattern:/,/}),Zc=D({name:"RangeUnion",pattern:/:/}),Qc=D({name:"RangeTrimFull",pattern:/\.:\./}),Jc=D({name:"RangeTrimLeading",pattern:/\.:/}),tu=D({name:"RangeTrimTrailing",pattern:/:\./}),eu=D({name:"Semicolon",pattern:/;/}),nu=D({name:"OpenParen",pattern:/\(/}),ru=D({name:"CloseParen",pattern:/\)/}),iu=D({name:"OpenSquareParen",pattern:/\[/}),ou=D({name:"CloseSquareParen",pattern:/]/});D({name:"exclamationMark",pattern:/!/});const su=D({name:"OpenCurlyParen",pattern:/{/}),au=D({name:"CloseCurlyParen",pattern:/}/}),cu=D({name:"QuoteS",pattern:/'/}),uo=D({name:"MulOp",pattern:/\*/}),uu=D({name:"PlusOp",pattern:/\+/}),lu=D({name:"DivOp",pattern:/\//}),hu=D({name:"MinOp",pattern:/-/}),fu=D({name:"ImplicitIntersectOp",pattern:/@/}),du=D({name:"ConcatOp",pattern:/&/}),pu=D({name:"ExOp",pattern:/\^/}),mu=D({name:"PercentOp",pattern:/%/}),Cs=D({name:"TableSpecifier",pattern:/#(All|Data|Headers|Totals|This Row)/i}),Eu=D({name:"ArrayAnchorOp",pattern:/#/,longer_alt:[Cs,Ls,xs]}),gu=D({name:"GtOp",pattern:/>/}),Tu=D({name:"EqOp",pattern:/=/}),Au=D({name:"LtOp",pattern:/</}),ks=[Dc,Ss,Bc,jc,$c,_s,Wc,Ls,xs,Gc,zc,Xc,Vc,Hc,Cs,Eu,fu,kn,Yc,qc,Qc,Jc,tu,Zc,eu,nu,ru,iu,ou,su,au,cu,uo,uu,lu,hu,du,pu,uo,mu,D({name:"NeqOp",pattern:/<>/}),D({name:"GteOp",pattern:/>=/}),D({name:"LteOp",pattern:/<=/}),gu,Tu,Au],Iu=new ot(ks,{ensureOptimizations:!0}),Kr={};ks.forEach(t=>{Kr[t.name]=t});const Zt={boolean:3,string:2,number:1},Ru=(t,e)=>{let n=t+e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},Nu=(t,e)=>{let n=t-e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},bs=(t,e)=>{let n=t*e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},Ps=(t,e)=>{if(e===0)return 1/0;let n=t/e;return n=Math.abs(n)<99e-14?0:n,isFinite(n)?n:Number.NaN},yu=(t,e)=>{const n=t**e;return isFinite(n)?n:Number.NaN},vu=(t="",e="")=>(t===null&&(t=""),e===null&&(e=""),typeof t=="boolean"&&(t=t?"TRUE":"FALSE"),typeof e=="boolean"&&(e=e?"TRUE":"FALSE"),""+t+e),Ou=(t=null,e=null)=>typeof t==typeof e&&t===e,Su=(t=null,e=null)=>typeof t!=typeof e||t!==e,_u=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t>e:Zt[n]>Zt[r]},Lu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t>=e:Zt[n]>=Zt[r]},xu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t<e:Zt[n]<Zt[r]},Cu=(t=null,e=null)=>{const n=typeof t,r=typeof e;return n===r?t<=e:Zt[n]<=Zt[r]},ku={type:S.mt.Number,coerce:!0,includeBoolean:!0,includeMistyped:!0,mismatchFill:S.Rt.BuiltIn.NA},bu={type:S.mt.String,coerce:!0,includeMistyped:!0,mismatchFill:S.Rt.BuiltIn.NA},ws={type:null,coerce:!0,includeMistyped:!0,mismatchFill:S.Rt.BuiltIn.NA},he=(t,e,n,r)=>{if(e!==null&&e.colStart!==void 0&&(e=t.getValueAt(e.rowStart,e.colStart)),n!==null&&n.colStart!==void 0&&(n=t.getValueAt(n.rowStart,n.colStart)),typeof e=="number"&&typeof n=="number")return r(e,n);let i,o;return e?.isIRange?i=e:n?.isIRange&&(o=n),i||o?(i||(i=t.getRange(e)),i.broadcast(n,r,ku).fillEmpty(0)):(e=S.Cs(e,S.jr(e,!0),S.mt.Number,!0,!1),n=S.Cs(n,S.jr(n,!0),S.mt.Number,!0,!1),e instanceof S.Rt.Value?e:n instanceof S.Rt.Value?n:r(e,n))},ue=(t,e,n,r)=>{let i,o;return e!==null&&e.colStart!==void 0&&(e=t.getValueAt(e.rowStart,e.colStart)),n!==null&&n.colStart!==void 0&&(n=t.getValueAt(n.rowStart,n.colStart)),e?.isIRange?(i=e,o=n):n?.isIRange&&(i=n,o=e),i?i.broadcast(o,r,ws):r(e,n)},lo=(t,e)=>{e==null&&(e=0);let n,r=1;if(t==="+")return e;if(t!=="-")throw new S.Rt.Value(`Unrecognized prefix: ${t}`);return r=-r,e?.isIRange&&(n=e),n?n.broadcast(r,bs,ws):typeof(e=S.Cs(e,S.jr(e,!0),S.mt.Number))!="number"||isNaN(e)?S.Rt.BuiltIn.Value:e*r},Oe=(t,e,n,r)=>{if(!e||(e.isIReferenceRange&&(e=e.getCoords()),e.colStart===void 0)||(n.isIReferenceRange&&(n=n.getCoords()),n.colStart===void 0))return S.Rt.BuiltIn.Ref;const i=r(e,n);return i?t.getReference(i):S.Rt.BuiltIn.Null},Pu={"+":(t,e,n)=>he(t,e,n,Ru),"-":(t,e,n)=>he(t,e,n,Nu),"*":(t,e,n)=>he(t,e,n,bs),"/":(t,e,n)=>he(t,e,n,Ps),"^":(t,e,n)=>he(t,e,n,yu)," ":(t,e,n,r)=>Oe(t,e,n,S.me.intersectRanges),":":(t,e,n,r)=>Oe(t,e,n,S.me.unionRanges),".:.":(t,e,n,r)=>{const i=Oe(t,e,n,S.me.unionRanges);return t.getFunction("TRIMRANGE").execute(i,3,3)},".:":(t,e,n,r)=>{const i=Oe(t,e,n,S.me.unionRanges);return t.getFunction("TRIMRANGE").execute(i,1,1)},":.":(t,e,n,r)=>{const i=Oe(t,e,n,S.me.unionRanges);return t.getFunction("TRIMRANGE").execute(i,2,2)},"&":(t,e,n)=>((r,i,o,s)=>{if(i!==null&&i.colStart!==void 0&&(i=r.getValueAt(i.rowStart,i.colStart)),o!==null&&o.colStart!==void 0&&(o=r.getValueAt(o.rowStart,o.colStart)),typeof i=="string"&&typeof o=="string")return s(i,o);let a,c;return i?.isIRange?a=i:o?.isIRange&&(c=o),a||c?(a||(a=r.getRange(i)),a.broadcast(o,s,bu)):s(i=S.Cs(i,S.jr(i,!0),S.mt.String),o=S.Cs(o,S.jr(o,!0),S.mt.String))})(t,e,n,vu),"=":(t,e,n)=>ue(t,e,n,Ou),"<>":(t,e,n)=>ue(t,e,n,Su),">":(t,e,n)=>ue(t,e,n,_u),"<":(t,e,n)=>ue(t,e,n,xu),">=":(t,e,n)=>ue(t,e,n,Lu),"<=":(t,e,n)=>ue(t,e,n,Cu)},wu={"-":(t,e)=>lo("-",e),"+":(t,e)=>lo("+",e),"@":(t,e)=>{if(!e||!e.isIReferenceRange)return e;const n=e.getCoords(),r=e,i=t.getPosition(),o=r.getHeight(),s=r.getWidth();if(s>1&&o>1)return S.Rt.BuiltIn.Value;if(o>1){const a=i.rowIndex-n.rowStart;if(a>=0&&a<o)return r.getValueAt(a,0)}else{if(!(s>1))return r.getValueAt(0,0);{const a=i.colIndex-n.colStart;if(a>=0&&a<s)return r.getValueAt(0,a)}}return S.Rt.BuiltIn.Value}},Mu={"%":(t,e)=>he(t,e,100,Ps),"#":(t,e)=>t.getSpillAt(e.rowStart,e.colStart)||S.Rt.BuiltIn.Ref};function ho(t){const e=(t=t.toUpperCase()).length;let n=0;for(let r=0;r<e;r++){const i=t.charCodeAt(r);isNaN(i)||(n+=(i-64)*26**(e-r-1))}return n}function qn(t){return{type:"cell",value:Object.freeze({colIndex:t.colIndex,rowIndex:t.rowIndex,$colIndex:t.$colIndex||!1,$rowIndex:t.$rowIndex||!1}),inputs:null,isReference:!0}}function fo(t,e){const n=t.startsWith("$");n&&(t=t.substring(1));let r=parseInt(t)-1;return n||r===Number.MIN_SAFE_INTEGER||(r-=e.colIndex),{type:"cell",value:Object.freeze({colIndex:Number.MIN_SAFE_INTEGER,$colIndex:!1,rowIndex:r,$rowIndex:n}),inputs:null,isReference:!0}}function po(t,e){return{type:"function",value:t=t.toUpperCase(),inputs:e}}function Zn(t,e){return{type:"tableReference",value:t,inputs:e}}function Qn(t){return{type:"tableSpecifier",value:t,inputs:null,isReference:!0}}function xr(t,e,n,r=!1){const i={type:"infix",value:t,inputs:[e,n]};return r&&(i.isReference=!0),i}function Jn(t,e,n=!1){const r={type:"postfix",value:t,inputs:[e]};return n&&(r.isReference=!0),r}function Le(t,e,n=!1){const r={type:"prefix",value:t,inputs:[e]};return n&&(r.isReference=!0),r}function tr(t){return{type:"named",value:t,inputs:null,isReference:!0}}function mo(t){return{type:"number",value:Number(t),isLiteral:!0}}function er(t){let e=t;const n=t&&t.length>1&&t[0]==='"'&&t[t.length-1]==='"';return n&&(e=t.substring(1,t.length-1)),{type:n?"quotedString":"string",value:e,isLiteral:!0}}function Eo(t){return{type:"boolean",value:t==="TRUE"||t.toUpperCase()==="TRUE",isLiteral:!0}}function go(t){return{type:"error",value:S.Rt.getBuiltInByLabel(t.toUpperCase()),isLiteral:!0}}function Tn(t){return{type:"error",value:t?S.Rt.getBuiltInByLabel(t.toUpperCase()):S.Rt.BuiltIn.Ref,inputs:null,isReference:!0}}function Be(t,e){return function n(r,i){const o=r.inputs;let s;if(o){const u=o.length;for(let l=0;l<u;l++){const h=o[l],I=n(h,r);I!==h&&(s||(s=[...o]),s[l]=I)}}const a=s?{...r,inputs:s}:r,c=e(a,i);return c===void 0?a:c}(t,void 0)||this}function an(t,e){let n=0,r=Be(t,d=>{const A={...d};return A.evalIndex=n++,A});const i=new Array(n),o=new Set,s=new Map;let a;const c=new Map,u=[],l=[];r=Be(r,(d,A)=>{const N=d.type,f=d.evalIndex;if(i[f]=null,d.isReference){const m=d,p={node:d,index:c.size,op:null,value:null,inputs:null};if(c.set(m,p),N==="cell"){const E=m.value;return E.$colIndex&&(p.hasHorizontalAbs=!0),E.$rowIndex&&(p.hasVerticalAbs=!0),p.value=s.size,s.set(m,s.size),o.add(p),d.refIndex=l.length,void l.push(p.index)}if(N==="infix"||N==="prefix"||N==="postfix"||N==="spill"){const E=m.inputs,R=E.length,P=d.value;p.op=P;const L=new Array(R);p.inputs=L;for(let y=0;y<R;y++){const M=E[y],C=c.get(M);C&&(C.hasHorizontalAbs&&(p.hasHorizontalAbs=!0),C.hasVerticalAbs&&(p.hasVerticalAbs=!0)),L[y]=C?C.index:-1,o.delete(C)}if(o.add(p),Ms.includes(P)){const y=E[0],M=!!y&&y.type==="cell",C=E[1],k=!!C&&C.type==="cell";M&&k&&(l.splice(C.refIndex,1),C.refIndex=y.refIndex,d.refIndex=y.refIndex,l[y.refIndex]=p.index)}else P==="#"&&(d.refIndex=E[0].refIndex);return void u.push(d)}if(N==="error"||N==="named"){a||(a=new Map);const E=m.value;let R=a.get(E);return p.op=N,R===void 0&&(R=a.size,a.set(E,R)),p.value=R,o.add(p),d.refIndex=l.length,void l.push(p.index)}N==="tableReference"&&(p.op=N),N==="tableSpecifier"&&(p.op=N),N==="structuredArg"&&(p.op=N)}else if(A&&A.isReference){const m=d,p={node:d,index:c.size,op:"function",value:d.value,inputs:null};c.set(m,p)}if(d.isLiteral)if(N!=="array")i[f]=d.value;else{const m=d.value,p=m.length,E=new Array(p);for(let R=0;R<p;R++){const P=m[R].value,L=P.length,y=new Array(L);for(let M=0;M<L;M++){const C=P[M];let k=C.value;if(C.type==="prefix"){const $=C.value;k=C.inputs[0].value,$==="-"&&(k=-k)}y[M]=k}E[R]=y}i[f]=S.eD(E)}else{if(N!=="empty")return u.push(d),d;i[f]=void 0}});const h=new Array(s.size);s.forEach((d,A)=>{const N=A.value,f=N.colIndex,m=N.rowIndex,p=N.$colIndex,E=N.$rowIndex,R={colStart:f,rowStart:m,colEnd:f,rowEnd:m,$colStart:p,$rowStart:E,$colEnd:p,$rowEnd:E};f===Number.MIN_SAFE_INTEGER&&(R.colEnd=Number.MAX_SAFE_INTEGER),m===Number.MIN_SAFE_INTEGER&&(R.rowEnd=Number.MAX_SAFE_INTEGER),N.sheetName&&(R.sheetName=N.sheetName),h[d]=R});const I=h.length,v=new Array(I);for(let d=0;d<I;d++)v[d]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const O=new Array(c.size);let x;c.forEach(d=>{O[d.index]=d}),a&&(x=[],a.forEach((d,A)=>{x.push(A)}));const _=[];o.forEach(d=>{_.push(d.index)});const T=u.length;for(let d=0;d<T;d++){const A=u[d],N=A.type;if(N==="infix"){const f=A.value;A.fn=Pu[f]}else if(N==="prefix"){const f=A.value;A.fn=wu[f]}else if(N==="postfix"){const f=A.value;A.fn=Mu[f]}}const g=function(d){const A=[],N=(p,E)=>{const R={type:p.type,value:p.value};p.evalIndex!==void 0&&(R.evalIndex=p.evalIndex),p.refIndex!==void 0&&(R.refIndex=p.refIndex),E&&(R.ctx=E),A.push(R)},f=(p,E,R,P)=>{if(E==null||A.length>1&&p==="whitespace"&&A[A.length-1].type==="whitespace")return;const L={type:p,value:E};R&&(L.ctx=R),P!==void 0&&(L.evalIndex=P),A.push(L)};(function p(E,R,P){const L=E.evalIndex??P??0,y=E.type,M=(C,k,$)=>{if(!C)return;const X=C.length;for(let W=0;W<X;W++)p(C[W],k,$),W<X-1&&f("comma",",",k)};if(E.isLiteral){if(f("whitespace",E.wsBefore,R),y==="array"){f("type","{",R);const C=E.value,k=C.length;for(let $=0;$<k;$++){const X=C[$],W=X.value,rt=W.length;for(let mt=0;mt<rt;mt++){const Ct=W[mt];f("whitespace",Ct.wsBefore,R),p(Ct,R,L),f("whitespace",Ct.wsAfter,R),mt<rt-1&&f("comma",",",R)}$<k-1&&(f("whitespace",X.wsBefore,R),f("comma",";",R),f("whitespace",X.wsAfter,R))}E.error||f("type","}",R)}else y==="quotedString"&&(E={type:y,value:'"'+E.value+'"'}),N(E,R);f("whitespace",E.wsAfter,R)}else if(y==="infix")p(E.inputs[0],R,L),f("whitespace",E.wsBefore,R),N(E,R),f("whitespace",E.wsAfter,R),p(E.inputs[1],R,L);else if(y==="prefix")f("whitespace",E.wsBefore,R),N(E,R),f("whitespace",E.wsAfter,R),p(E.inputs[0],R,L);else if(y==="postfix")p(E.inputs[0],R,L),f("whitespace",E.wsBefore,R),N(E,R),f("whitespace",E.wsAfter,R);else{f("whitespace",E.wsBefore,R);const C=E.inputs;switch(y){case"function":N(E,R);const k={name:String(E.value),argIndex:-1};if(f("paren","(",k,E.evalIndex),C){const X=C.length;for(let W=0;W<X;W++){const rt={...k,argIndex:W};p(C[W],rt,L),W<X-1&&f("comma",",",rt)}}E.error||f("paren",")",k,E.evalIndex);break;case"cell":N(E,R);break;case"paren":f(y,"(",R,L),M(C,R,L),E.error||f(y,")",R,L);break;case"squareParen":f(y,"[",R,L),M(C,R,L),E.error||f(y,"]",R,L);break;case"tableReference":N(E,R);const $={name:String(E.value),argIndex:-1};if(f("paren","[",$),C){const X=C.length;for(let W=0;W<X;W++){const rt={...$,argIndex:W};p(C[W],rt,L),W<X-1&&f("comma",",",rt)}}E.error||f("paren","]",$);break;default:E.value!==void 0&&N(E,R),C&&C.forEach(X=>p(X,R,L))}f("whitespace",E.wsAfter,R)}})(d);const m=A.length;for(let p=0;p<m;p++){const E=A[p];if(E.type==="whitespace"&&E.evalIndex===void 0){const R=A[p+1];R&&R.evalIndex!==void 0&&(E.evalIndex=R.evalIndex)}}return A}(r);return{ast:r,evaluations:i,executions:u,precedentsAbsolute:v,precedentsExecute:O,precedentsNamed:x,precedentsRelative:h,precedentsRoot:_,references:l,tokens:g,error:e}}function To(t,e){let n,r=-1,i="";Number.isSafeInteger(t.previousToken?.startLine)?(r=t.previousToken.startLine,n=t.previousToken.endColumn+1):Number.isSafeInteger(t.token?.startLine)&&(r=t.token.startLine,n=t.token.startColumn),r!==-1?(i+=`
114
- `+e.split(`
115
- `)[r-1]+`
116
- `,i+=Array(n-1).fill(" ").join("")+`^
117
- `,i+=`Error at position ${r}:${n}
118
- `+t.message,t.errorLocation={line:r,column:n}):i=e+`
119
- `+t.message;const o=new S.Rt.Parse(i);return o.details=t,o}const nr=function(t,e){return e.wsBefore&&(t.wsBefore=e.wsBefore),e.wsAfter&&(t.wsAfter=e.wsAfter),e.image&&(t.image=e.image),t},Ao=Object.freeze([[":",".:.",".:",,":."],["^"],["*","/"],["+","-"],["&"],["<",">","=","<>","<=",">="]]),Ms=Object.freeze([":",".:.",".:",,":."]),Uu=Object.freeze([":"," ",".:.",".:",,":."]),Fu=Object.freeze(["@"]),Du=Object.freeze(["#"]),rr=Object.freeze(Uu.concat(Fu).concat(Du)),{String:Io,SheetQuoted:ju,SingleQuotedString:Bu,FunctionToken:$u,NamedTableReference:Wu,LiteralError:Ro,RefError:No,Cell:Gu,Sheet:Ku,Name:yo,NumberToken:vo,Boolean:Oo,Column:zu,AbsRow:Vu,ImplicitIntersectOp:ir,Comma:le,RangeUnion:Hu,RangeTrimFull:Yu,RangeTrimLeading:Xu,RangeTrimTrailing:qu,Semicolon:Zu,OpenParen:Qu,CloseParen:or,OpenSquareParen:So,CloseSquareParen:_o,OpenCurlyParen:Ju,CloseCurlyParen:tl,MulOp:el,PlusOp:sr,DivOp:nl,MinOp:ar,ConcatOp:rl,ExOp:il,PercentOp:ol,ArrayAnchorOp:Lo,TableSpecifier:sl,BracketedString:xo,NeqOp:al,GteOp:cl,LteOp:ul,GtOp:ll,EqOp:hl,LtOp:fl}=Kr;class dl extends Fc{constructor(){super(Kr,{nodeLocationTracking:"full",maxLookahead:1,skipValidations:!0,recoveryEnabled:!0}),this.position={colIndex:0,rowIndex:0},this.astErrors=[];const e=this,n=(r,i,o)=>{let s;e.CONSUME(i);const a=e.getLexerPosition();s=e.ACTION(()=>(s={type:r,value:null,inputs:null},this._ensureWhitespace(s,a,!0)));const c=[],u=e.SUBRULE(e.intersectOp);u&&c.push(u);const l=e.SUBRULE(e.group),h=e.OPTION(()=>this.CONSUME(o));return s=e.ACTION(()=>{if(l)for(let I=0;I<l.length;I++)c.push(l[I]);return s&&(h||this._reportError(s,"Missing closing parenthesis",a),s.inputs=c),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0)}),s};e.RULE("infixOp",()=>{const r=[],i=[e.SUBRULE(e.postfixOp)];return e.MANY(()=>{const o=e.OR(e.c1||(e.c1=[{ALT:()=>e.CONSUME(Hu).image},{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(ar).image},{ALT:()=>e.CONSUME(el).image},{ALT:()=>e.CONSUME(nl).image},{ALT:()=>e.CONSUME(il).image},{ALT:()=>e.CONSUME(rl).image},{ALT:()=>e.CONSUME(ll).image},{ALT:()=>e.CONSUME(hl).image},{ALT:()=>e.CONSUME(fl).image},{ALT:()=>e.CONSUME(al).image},{ALT:()=>e.CONSUME(cl).image},{ALT:()=>e.CONSUME(ul).image},{ALT:()=>e.CONSUME(Yu).image},{ALT:()=>e.CONSUME(Xu).image},{ALT:()=>e.CONSUME(qu).image}]));r.push([o,e.getLexerPosition(),rr.includes(o)]),i.push(e.SUBRULE2(e.postfixOp))}),e.ACTION(()=>{let o=r.length;const s=Ao.length;for(let a=0;o>0&&a<s;a++){const c=Ao[a];let u=r.length;for(let l=0;l<u;l++){const h=r[l],I=h[0];if(!c.includes(I))continue;let v=xr(I,i[l],i[l+1],h[2]);v=this._ensureWhitespace(v,h[1]),r.splice(l,1),i.splice(l,2,v),l--,u--,o--}}}),i[0]}),e.RULE("plusMinusOp",()=>e.OR([{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(ar).image}])),e.RULE("postfixOp",()=>{let r=e.SUBRULE(e.prefixOp);const i=[];return e.MANY(()=>{const o=e.OR([{ALT:()=>e.CONSUME(ol).image},{ALT:()=>e.CONSUME(Lo).image}]);e.ACTION(()=>{i.push([o,e.getLexerPosition()])})}),e.ACTION(()=>{const o=i.length;if(o!==0)for(let s=0;s<o;s++){const a=i[s],c=a[0],u=a[1],l=rr.includes(c);r=Jn(c,r,l),r=this._ensureWhitespace(r,u)}}),r}),e.RULE("prefixOp",()=>{const r=[];e.MANY(()=>{const o=e.OR([{ALT:()=>e.CONSUME(sr).image},{ALT:()=>e.CONSUME(ar).image},{ALT:()=>e.CONSUME(ir).image}]);e.ACTION(()=>{r.push([o,e.getLexerPosition()])})});let i=e.SUBRULE(e.formula);return e.ACTION(()=>{const o=r.length;if(o!==0)for(let s=o-1;s>=0;s--){const a=r[s],c=a[0],u=a[1],l=rr.includes(c);i=Le(c,i,l),i=this._ensureWhitespace(i,u)}}),i}),e.RULE("intersectOp",()=>{const r=[e.SUBRULE(e.infixOp)];return e.MANY(()=>{e.OPTION({GATE:()=>{const i=e.LA(0);return e.LA(1).startOffset>i.endOffset+1},DEF:()=>{r.push(e.SUBRULE3(e.infixOp))}})}),e.ACTION(()=>{for(;r.length>1;){let i=r.length-1;for(let o=0;o<i;o++){const s=r[o],a=r[o+1],c=xr(" ",s,a,!0);if(delete s.wsAfter,a.wsBefore){const u=a.wsBefore.slice(0,-1),l=u.length;delete a.wsBefore,l>0&&(c.wsBefore=u)}o+1<i&&delete a.wsAfter,r.splice(o,2,c),o--,i--}}}),r[0]}),e.RULE("formula",()=>e.OR9([{ALT:()=>e.SUBRULE(e.referenceWithoutInfix)},{ALT:()=>e.SUBRULE(e.function)},{ALT:()=>e.SUBRULE(e.paren)},{ALT:()=>e.SUBRULE(e.namedTableReference)},{ALT:()=>e.SUBRULE(e.bracketedString)},{ALT:()=>e.SUBRULE(e.squareParen)},{ALT:()=>e.SUBRULE(e.literal)},{ALT:()=>e.SUBRULE(e.literalArray)}])),e.RULE("group",()=>{const r=[];return e.MANY(()=>{e.CONSUME(le);const i=e.SUBRULE2(e.intersectOp);e.ACTION(()=>{r.push(i)})}),r}),e.RULE("paren",()=>n("paren",Qu,or)),e.RULE("literalArray",()=>{let r={type:"row",value:[],isLiteral:!0};e.CONSUME(Ju);const i=e.getLexerPosition();let o=e.ACTION(()=>this._ensureWhitespace({type:"array",value:[r],isLiteral:!0},i,!0));const s=e.SUBRULE(e.literalForArray);e.ACTION(()=>{r.value.push(s)}),e.MANY(()=>{const c=e.OR([{ALT:()=>e.CONSUME(le).image},{ALT:()=>e.CONSUME(Zu).image}]),u=e.SUBRULE2(e.literalForArray);e.ACTION(()=>{c===","||(r={type:"row",value:[],isLiteral:!0},o.value.push(r)),r.value.push(u)})});const a=e.OPTION(()=>this.CONSUME(tl));return o=e.ACTION(()=>(a||this._reportError(o,"Missing closing parenthesis '}'",i),this._ensureWhitespace(o,e.getLexerPosition(),!1,!0))),o}),e.RULE("literalForArray",()=>e.OR([{ALT:()=>{const r=e.OPTION(()=>e.SUBRULE(e.plusMinusOp)),i=e.CONSUME(vo),o=e.ACTION(()=>this._ensureWhitespace(mo(i.image),e.getLexerPosition()));return r?e.ACTION(()=>function(s,a){return{type:"prefix",value:s,inputs:[a]}}(r,o)):o}},{ALT:()=>{const r=e.CONSUME(Io);return e.ACTION(()=>this._ensureWhitespace(er(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Oo);return e.ACTION(()=>this._ensureWhitespace(Eo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Ro);return e.ACTION(()=>this._ensureWhitespace(go(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(No);return e.ACTION(()=>this._ensureWhitespace(Tn(r.image),e.getLexerPosition()))}}])),e.RULE("literal",()=>e.OR([{ALT:()=>{const r=e.CONSUME(vo);return e.ACTION(()=>this._ensureWhitespace(mo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Io);return e.ACTION(()=>this._ensureWhitespace(er(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Oo);return e.ACTION(()=>this._ensureWhitespace(Eo(r.image),e.getLexerPosition()))}},{ALT:()=>{const r=e.CONSUME(Ro);return e.ACTION(()=>this._ensureWhitespace(go(r.image),e.getLexerPosition()))}}])),e.RULE("function",()=>{const r=e.CONSUME($u).image.slice(0,-1),i=e.getLexerPosition(),o=e.SUBRULE(e.functionArguments);let s=e.ACTION(()=>this._ensureWhitespace(po(r,o),i,!0));const a=e.OPTION(()=>this.CONSUME(or));return s=e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ')'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s}),e.RULE("functionArguments",()=>{const r=[];return e.MANY2(()=>{let i;e.CONSUME2(le),i=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(i)}),e.OPTION(()=>{r.push(e.SUBRULE(e.intersectOp)),e.MANY(()=>{let i;e.CONSUME1(le),i=e.ACTION(()=>this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(i),e.OPTION3(()=>{r.pop(),r.push(e.SUBRULE2(e.intersectOp))})})}),r}),e.RULE("bracketedString",()=>{const r=e.CONSUME(xo),i=e.getLexerPosition();return e.ACTION(()=>{const o=r.image;let s=Zn("",[Qn(o.substring(1,o.length-1))]);return s=this._ensureWhitespace(s,i,!0,!1),s=this._ensureWhitespace(s,e.getLexerPosition(),!1,!0),s})}),e.RULE("squareParen",()=>{e.CONSUME(So);const r=e.getLexerPosition();let i=Zn("",[e.SUBRULE(e.structuredArgument)]);const o=e.OPTION(()=>this.CONSUME(_o));return e.ACTION(()=>{o||this._reportError(i,"Missing closing parenthesis ']'",r),i=this._ensureWhitespace(i,r,!0,!1),i=this._ensureWhitespace(i,e.getLexerPosition(),!1,!0)}),i}),e.RULE("namedTableReference",()=>{const r=e.CONSUME(Wu).image.slice(0,-1),i=e.getLexerPosition(),o=e.SUBRULE(e.structuredArguments);let s=e.ACTION(()=>this._ensureWhitespace(Zn(r,o),i,!0));const a=e.OPTION(()=>this.CONSUME(_o));return s=e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ']'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s}),e.RULE("structuredArguments",()=>{const r=[];return e.MANY2(()=>{e.CONSUME2(le),e.ACTION(()=>{r.push(this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0))})}),e.OPTION(()=>{const i=e.SUBRULE(e.structuredArgument);e.ACTION(()=>{i&&r.push(i)}),e.MANY(()=>{e.CONSUME1(le),e.OPTION3(()=>{let o=e.SUBRULE2(e.structuredArgument);e.ACTION(()=>{o||(o=this._ensureWhitespace({type:"empty",value:""},e.getLexerPosition(),!1,!0)),r.push(o)})})})}),r}),e.RULE("structuredArgument",()=>{const r=e.OPTION(()=>e.CONSUME(ir)),i=e.getLexerPosition(),o=e.OPTION2(()=>this.CONSUME(So));let s=e.OR([{ALT:()=>{const a=e.CONSUME(sl);return e.ACTION(()=>this._ensureWhitespace(Qn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(xo);return e.ACTION(()=>this._ensureWhitespace(Qn(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(yo);return e.ACTION(()=>this._ensureWhitespace(tr(a.image),e.getLexerPosition()))}},{ALT:()=>{const a=e.CONSUME(Bu);return e.ACTION(()=>this._ensureWhitespace(er(a.image),e.getLexerPosition()))}}]);if(o){const a=e.OPTION3(()=>this.CONSUME(or));e.ACTION(()=>(a||this._reportError(s,"Missing closing parenthesis ']'",i),this._ensureWhitespace(s,e.getLexerPosition(),!1,!0))),s={type:"structuredArg",value:null,inputs:[s]}}return e.ACTION(()=>{r&&(s=Le(r.image,s,!0),s=this._ensureWhitespace(s,e.getLexerPosition()))}),s}),e.RULE("referenceWithoutInfix",()=>e.OR([{ALT:()=>e.SUBRULE(e.reference)},{ALT:()=>{const r=e.SUBRULE(e.prefixSheetName),i=e.SUBRULE2(e.formula);return e.ACTION(()=>{if((o=i)&&o.isFormulaError)return i;var o;i.ref&&(i.ref.sheet=r)}),i}}])),e.RULE("reference",()=>{const r=e.OPTION4(()=>e.CONSUME(ir));let i=e.OR([{ALT:()=>{const o=e.CONSUME(Gu),s=e.getLexerPosition(),a=e.OPTION(()=>e.CONSUME(Lo));return e.ACTION(()=>{const c=this._ensureWhitespace(function(u,l){const h=u.match(/([$]?)([A-Za-z]{1,3})([$]?)([1-9][0-9]*)/);let I=ho(h[2])-1;const v=h[1].length===1;let O=+h[4]-1;const x=h[3].length===1;return v||I===Number.MIN_SAFE_INTEGER||(I-=l.colIndex),x||O===Number.MIN_SAFE_INTEGER||(O-=l.rowIndex),{type:"cell",value:Object.freeze({colIndex:I,rowIndex:O,$colIndex:v,$rowIndex:x}),inputs:null,isReference:!0}}(o.image,e.position),s);return a?this._ensureWhitespace(Jn("#",c,!0),s):c})}},{ALT:()=>{const o=e.CONSUME(yo);return e.ACTION(()=>this._ensureWhitespace(tr(o.image),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(zu);return e.ACTION(()=>this._ensureWhitespace(function(s,a){const c=s.startsWith("$");c&&(s=s.substring(1));let u=ho(s)-1;return c||u===Number.MIN_SAFE_INTEGER||(u-=a.colIndex),{type:"cell",value:Object.freeze({colIndex:u,rowIndex:Number.MIN_SAFE_INTEGER,$colIndex:c,$rowIndex:!1}),inputs:null,isReference:!0}}(o.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(Vu);return e.ACTION(()=>this._ensureWhitespace(fo(o.image,e.position),e.getLexerPosition()))}},{ALT:()=>{const o=e.CONSUME(No);return e.ACTION(()=>this._ensureWhitespace(Tn(o.image),e.getLexerPosition()))}}]);return e.ACTION(()=>{r&&(i=Le(r,i,!0),i=this._ensureWhitespace(i,e.getLexerPosition()))}),i}),e.RULE("prefixSheetName",()=>e.OR([{ALT:()=>e.CONSUME(Ku).image.slice(0,-1)},{ALT:()=>e.CONSUME(ju).image.slice(1,-2).replace(/''/g,"'")}])),e.performSelfAnalysis()}_reportError(e,n,r=void 0,i="SyntaxError"){r===void 0&&(r=this.getLexerPosition()),e.error=!0,this.astErrors.push({name:i,message:n,previousToken:this.input[r],ast:e})}_ensureWhitespace(e,n,r=!1,i=!1){if(!e)return console.warn("node is null"),e;const o=this.input,s=o[n];if(e.image||(e.image=s.image),!i){const a=s.startOffset,c=o[n-1],u=c?.endOffset??-1;u+1<a&&(e.wsBefore=" ".repeat(a-u-1))}if(!r){const a=s.endOffset,c=o[n+1],u=c?.startOffset??this.inputTextLength;a+1<u&&(e.wsAfter=" ".repeat(u-a-1))}return e}_createAST(e,n){const r=function(a){const c=Iu.tokenize(a);if(c.errors.length>0){const u=c.errors[0],l=u.line,h=u.column;let I=`
120
- `+a.split(`
121
- `)[l-1]+`
122
- `;throw I+=Array(h-1).fill(" ").join("")+`^
123
- `,u.message=I+`Error at position ${l}:${h}
124
- `+u.message,u.errorLocation={line:l,column:h},new S.Rt.Parse(u.message,{line:l,column:h,offset:u.offset,length:u.length})}return c}(n);let i;if(!r)return i={type:"text",value:n},i;const o=r.tokens;this.input=o,this.inputTextLength=n.length;const s=e.getPosition();return this.position=s,this.astErrors=[],this.reset(),i=this.intersectOp(),i=Be(i,(a,c)=>{let u=a.type;if(u==="function"&&a.value&&a.value.toUpperCase().startsWith("_XLFN.")){const l=a.value.substring(6);let h=a.image.substring(6),I=a;l==="ANCHORARRAY"?(I=Jn("#",a.inputs[0],!0),h="#"):l==="SINGLE"?(I=Le("@",a.inputs[0],!0),h="@"):I=po(l,a.inputs),nr(I,a),I.image=h,u=(a=I).type}if(c?.isReference){const l=c.value;if((l===":"||l===".:."||l===".:"||l===":.")&&Number.isInteger(a.value)){const h=c.inputs[0]===a?c.inputs[1]:c.inputs[0];if(h&&Number.isInteger(h.value)){const I=fo(a.image,s);return nr(I,a),I}}}else if(u==="cell"){const l=a.value;if(l.rowIndex===Number.MIN_SAFE_INTEGER||l.colIndex>=16384){const h=tr(a.image);return nr(h,a),h}}return a}),i}build(e,n){if(n.length===0)throw Error("Input must not be empty.");let r,i,o;try{r=this._createAST(e,n)}catch(c){o=c instanceof S.Rt.Parse?c:new S.Rt.Parse(c.message,c)}const s=this.errors;s.length>0&&(o=To(s[0],n));const a=this.astErrors;return a.length>0&&(o=To(a[0],n)),i=r?an(r,o):{ast:null,evaluations:S.re.EmptyArray,executions:S.re.EmptyArray,precedentsAbsolute:S.re.EmptyArray,precedentsExecute:S.re.EmptyArray,precedentsNamed:null,precedentsRelative:S.re.EmptyArray,precedentsRoot:S.re.EmptyArray,references:S.re.EmptyArray,tokens:S.re.EmptyArray,error:o},i}}class Pe{constructor(e,n){this._options=e,this._compiled=n}getTextAt(e,n,r=!1){return r?S.KF(this._compiled.tokens):S.XF(this._compiled.tokens,e,n)}getTokens(){return this._compiled.tokens}getError(){return this._compiled.error??null}isEquals(e){if(!(e&&e instanceof Pe))return!1;if(this===e)return!0;const n=this._compiled.tokens,r=e._compiled.tokens;return n.length===r.length&&S.KF(n)===S.KF(r)}getReferences(){const e=this._compiled,n=e.references,r=n.length;if(r===0)return S.re.EmptyArray;const i=e.precedentsExecute,o=e.precedentsRelative,s=new Array(r);for(let a=0;a<r;a++){const c=i[n[a]],u=c.inputs;if(u&&u.length===2){const l=o[i[u[0]].value],h=o[i[u[1]].value];s[a]={colStart:l.colStart,rowStart:l.rowStart,colEnd:h.colEnd,rowEnd:h.rowEnd,$colStart:l.$colStart,$rowStart:l.$rowStart,$colEnd:h.$colEnd,$rowEnd:h.$rowEnd,sheetName:l.sheetName}}else if(c.node.type==="cell"){const l=o[c.value];s[a]={...l}}else if(c.op==="named"){const l=e.precedentsNamed;s[a]=l[c.value]}else c.op==="error"&&(s[a]=c.node.value)}return s}setReferenceAt(e,n){const r=this._compiled,i=r.references;if(i.length===0)return S.re.EmptyArray;const o=r.precedentsExecute,s=i[e];if(s===void 0)throw new Error(`Invalid reference index: ${e}`);const a=o[s],c=a.node,u=c.inputs??S.re.EmptyArray;let l,h,I=!1;n&&(l={colIndex:n.colStart,rowIndex:n.rowStart,$colIndex:n.$colStart??!1,$rowIndex:n.$rowStart??!1},n.sheetName&&(l.sheetName=n.sheetName),I=!S.me.isSingleCell(n),I&&(h={colIndex:n.colEnd,rowIndex:n.rowEnd,$colIndex:n.$colEnd??!1,$rowIndex:n.$rowEnd??!1},n.colEnd===Number.MAX_SAFE_INTEGER&&(h.colIndex=Number.MIN_SAFE_INTEGER),n.rowEnd===Number.MAX_SAFE_INTEGER&&(h.rowIndex=Number.MIN_SAFE_INTEGER)));const v=u.length===2;let O=-1,x=-1;if(v)O=u[0].evalIndex,x=u[1].evalIndex;else{if(c.type!=="cell")throw a.op==="named"?new Error("Cannot setReference for a named reference"):new Error(`Invalidate reference index: ${e}`);O=c.evalIndex}const _=this._compiled.ast,T=Be(_,A=>{if(!A||!A.isReference)return;const N=A.type;if(!n&&Ms.includes(A.value)){const E=u[0],R=u[1];let P=E.evalIndex===O,L=R.evalIndex===x;if(P||L){const y=Tn();return y.image="#REF!",y}}if(N!=="cell"&&N!=="error")return;const f=A.evalIndex;let m,p=f===O;if(p||f===x){if(n)if(v===I){let E=p?l:h;m={...A},m.value=E,m.image=null}else m=I?xr(":",qn(l),qn(h),!0):qn(l);else m=Tn(),m.image="#REF!";return m}});if(T===_)return this;const g=an(T,this._compiled.error),d=this._options;return new Pe(d,g)}_resolveNamed(e,n,r,i){const o=this._options?.getNamed;if(!o)return S.Rt.BuiltIn.Name;let s=o?.(e,this._options.getSheetName?.())?.[0];return s?(s.isFormulaError||(s=S.UK(s,n,r,i)),s):S.Rt.BuiltIn.Name}getDirectPrecedentsAt(e,n,r=!1,i,o){const s=this._compiled,a=s.precedentsRoot,c=a.length;if(c===0)return S.re.EmptyArray;const u=s.precedentsRelative,l=s.precedentsAbsolute,h=u.length;for(let T=0;T<h;T++){const g=u[T];let d=l[T],A=S.UK(g,e,n,d);l[T]=A}let I=!1;const v=s.precedentsExecute,O=v.length,x=Cr;for(let T=0;T<O;T++){const g=v[T],d=g.op;if(!d){const p=l[g.value];x[g.index]=p;continue}if(d==="named"){I=!0,x[g.index]=this._resolveNamed(g.node.value,e,n);continue}if(d==="error"){x[g.index]=g.node.value;continue}if(d==="@"||d==="#"){x[g.index]=x[g.inputs[0]];continue}const A=g.inputs;if(!A)continue;let N=x[A[0]];if(N===void 0){x[g.index]=S.Rt.BuiltIn.Value;continue}if(N.isFormulaError){x[g.index]=N;continue}let f,m=x[A[1]];m!==void 0?m.isFormulaError?x[g.index]=m:(d===" "?f=S.me.intersectRanges(N,m):d!==":"&&d!==".:."&&d!==":."&&d!==".:"||(f=x[g.index]=S.me.unionRanges(N,m)),x[g.index]=f??S.Rt.BuiltIn.Null):x[g.index]=S.Rt.BuiltIn.Value}const _=new Array(c);for(let T=0;T<c;T++){const g=a[T],d=x[g];if(_[T]=d?.rowStart!==void 0?{...d}:d,i||o){const A=v[g];I&&A.op==="named"?(i&&(i[T]=d.$colStart||d.$colEnd),o&&(o[T]=d.$rowStart||d.$rowEnd)):(i&&(i[T]=A.hasVerticalAbs),o&&(o[T]=A.hasHorizontalAbs))}}return _}evaluate(e,n,r){const i=e.getPosition(),o=i?.rowIndex??0,s=i?.colIndex??0;let a=this._compiled;if(n!==void 0){let f;if(Be(a.ast,m=>{m.evalIndex===n&&(f=m)}),!f)throw new Error(`Invalid evalIndex: ${n}`);a=an(f,a.error)}if(a.error)return a.error;const c=a.evaluations,u=a.executions;let l,h;r||(r=this._resolvePrecedents(e));const I=a.precedentsExecute,v=a.precedentsRelative,O=a.precedentsAbsolute,x=I.length;for(let f=0;f<x;f++){const m=I[f],p=m.op;if(p){if(p==="named"){const E=m.node;let R=this._resolveNamed(m.node.value,o,s);R?.colStart!==void 0&&(R=e.getReference(R)),c[E.evalIndex]=R}else if(p==="error"){const E=m.node;c[E.evalIndex]=m.node.value}}else{const E=v[m.value];let R=O[f];const P=S.UK(E,o,s,R),L=m.node;c[L.evalIndex]=P}}const _=a.precedentsRoot,T=_.length;if(T!==r.length)return S.Rt.BuiltIn.Parse;for(let f=0;f<T;f++){const m=I[_[f]].node;let p=r[f];p.isIRange&&m.type==="cell"&&p.size>1&&(p=p.getValueAt(0,0)??null),c[m.evalIndex]=p}let g;const d=f=>{const m=f.inputs,p=m?m.length:0;let E;switch(f.type){case"infix":const R=f.value;let P=c[m[0].evalIndex],L=c[m[1].evalIndex];if(R==="+"&&typeof P=="number"&&typeof L=="number"){const k=P+L;return Math.abs(k)<99e-14?0:k}if(R==="-"&&typeof P=="number"&&typeof L=="number"){const k=P-L;return Math.abs(k)<99e-14?0:k}if(P&&P.isFormulaError)return P;if(L&&L.isFormulaError)return L;const y=f.fn;return E=y?y(e,P,L):S.Rt.BuiltIn.Value,E=S.dg(E,null),E;case"function":g||(g=new Array(p)),g.length!==p&&(g.length=p);for(let k=0;k<p;k++)g[k]=c[m[k].evalIndex];return E=this._callFunction(e,f,g),E&&typeof E.then=="function"?E.then(k=>{k=S.dg(k,e),E instanceof S.Rt.Known&&(h=E),c[f.evalIndex]=k}).catch(k=>{const $=k instanceof S.Rt.Known?k:new S.Rt.Value("Uncaught error",{cause:k});c[f.evalIndex]=$}):E instanceof S.Rt.Known&&(h=E),E;case"prefix":case"postfix":let M=c[m[0].evalIndex];if(M&&M.isFormulaError)return M;const C=f.fn;return E=C?C(e,M):S.Rt.BuiltIn.Value,E;case"paren":if(p===1)return c[m[0].evalIndex];{const k=new Array(p);for(let $=0;$<p;$++)k[$]=c[m[$].evalIndex];return k}case"named":return null;case"empty":return}};let A=u.length;for(let f=0;f<A;f++){const m=u[f];if(h)return h;if(l)l=l.then(()=>{const p=d(m);return c[m.evalIndex]=p,p});else{const p=d(m);c[m.evalIndex]=p,p&&typeof p.then=="function"&&(l=p)}}if(l)return l.then(()=>{const f=c[c.length-1];return this._finalizeReturnValue(e,f)});const N=c[c.length-1];return this._finalizeReturnValue(e,N)}_resolvePrecedents(e){const n=e.getPosition(),r=n?.rowIndex??0,i=n?.colIndex??0,o=this.getDirectPrecedentsAt(r,i),s=o.length;let a;if(s>0){a=new Array(s);for(let c=0;c<s;c++){const u=o[c];if(u instanceof S.Rt.Known)a[c]=u;else if(Array.isArray(u)){const l=new Array(u.length);for(let h=0;h<u.length;h++)l[h]=e.getReference(u[h]);a[c]=l}else a[c]=e.getReference(u)}}else a=S.re.EmptyArray;return a}wrapImplicit(e,n,r){const i=this._compiled.ast;if(!i||!i.isReference)return this;if(i.type==="cell")return this;if(i.value==="@")return this;if(!r)return this;const o=S.Rs(n)+S.Ys(e);if(r.has(o))return this;const s=an(Le("@",i,!0),this._compiled.error);return new Pe(this._options,s)}_callFunction(e,n,r){const i=n?.cacheFn??e.getFunction(n.value);if(!i)return new S.Rt.Parse;const o=i.isBuiltIn();let s;o?n.cacheFn=i:this._context=e;try{s=i.execute(...r)}catch(a){s=a instanceof S.Rt.Known?a:new S.Rt.Value(a.message,{cause:a})}return o||(this._context=null),s===void 0?new S.Rt.Parse:s}_finalizeReturnValue(e,n){if(n&&n.colStart!==void 0&&(n=e.getValueAt(n.rowStart,n.colStart)),Array.isArray(n))if(n.length===1&&Array.isArray(n[0])&&n[0].length===1)n=n[0][0],Array.isArray(n)&&(n=S.Rt.BuiltIn.Value);else try{n=e.getRange(n)}catch{n=S.Rt.BuiltIn.Value}return n?.isIRange?n.size===1?(n=n.getValueAt(0,0,pl),(n=S.dg(n,e))===null&&(n=0)):n=n.fillEmpty(0):(n=S.dg(n,e))===null&&(n=0),n}get[Symbol.toStringTag](){return"[FormulaBlock]"}toString(){const e=this._compiled;if(e.error)return e.error.toString();const n=this._context;if(n){const r=n.getPosition();return this.getTextAt(r.rowIndex,r.colIndex)}return S.KF(e.tokens)}}const Cr=new Array(20);for(let t=0;t<Cr.length;t++)Cr[t]={colStart:0,rowStart:0,colEnd:0,rowEnd:0,sheetName:null};const pl={type:null};exports.FormulaParser=class{constructor(t){this._options={getEntireCoords:S.V5,...t},this._astBuilder=new dl}parse(t,e){t.getPosition().sheetName;const n=this._astBuilder.build(t,e);return new Pe(this._options,n)}eval(t,e){return this.parse(t,e).evaluate(t)}};
@@ -1,6 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.3.3
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.default={ACOS:{s:"Returns the arccosine of a number, in radians in the range 0 to Pi. The arccosine is the angle whose cosine is Number",p:{number:{d:"is the cosine of the angle you want and must be from -1 to 1"}}},ACOSH:{s:"Returns the inverse hyperbolic cosine of a number",p:{number:{d:"is any real number equal to or greater than 1"}}},ACOT:{s:"Returns the arccotangent of a number, in radians in the range 0 to Pi.",p:{number:{d:"is the cotangent of the angle you want"}}},ACOTH:{s:"Returns the inverse hyperbolic cotangent of a number",p:{number:{d:"is the hyperbolic cotangent of the angle that you want"}}},ASIN:{s:"Returns the arcsine of a number in radians, in the range -Pi/2 to Pi/2",p:{number:{d:"is the sine of the angle you want and must be from -1 to 1"}}},ASINH:{s:"Returns the inverse hyperbolic sine of a number",p:{number:{d:"is any real number equal to or greater than 1"}}},ATAN:{s:"Returns the arctangent of a number in radians, in the range -Pi/2 to Pi/2",p:{number:{d:"is the tangent of the angle you want"}}},ATAN2:{s:"Returns the arctangent of the specified x- and y- coordinates, in radians between -Pi and Pi, excluding -Pi",p:{x:{d:"is the x-coordinate of the point"},y:{d:"is the y-coordinate of the point"}}},ATANH:{s:"Returns the inverse hyperbolic tangent of a number",p:{number:{d:"is any real number between -1 and 1 excluding -1 and 1"}}},COS:{s:"Returns the cosine of an angle",p:{number:{d:"is the angle in radians for which you want the cosine"}}},COSH:{s:"Returns the hyperbolic cosine of a number",p:{number:{d:"is any real number"}}},COT:{s:"Returns the cotangent of an angle",p:{number:{d:"is the angle in radians for which you want the cotangent"}}},COTH:{s:"Returns the hyperbolic cotangent of a number",p:{number:{d:"is the angle in radians for which you want the hyperbolic cotangent"}}},CSC:{s:"Returns the cosecant of an angle",p:{number:{d:"is the angle in radians for which you want the cosecant"}}},CSCH:{s:"Returns the hyperbolic cosecant of an angle",p:{number:{d:"is the angle in radians for which you want the hyperbolic cosecant"}}},SEC:{s:"Returns the secant of an angle",p:{number:{d:"is the angle in radians for which you want the secant"}}},SECH:{s:"Returns the hyperbolic secant of an angle",p:{number:{d:"is the angle in radians for which you want the hyperbolic secant"}}},SIN:{s:"Returns the sine of an angle",p:{number:{d:"is the angle in radians for which you want the sine. Degrees * PI()/180 = radians"}}},SINH:{s:"Returns the hyperbolic sine of a number",p:{number:{d:"is any real number"}}},TAN:{s:"Returns the tangent of an angle",p:{number:{d:"is the angle in radians for which you want the tangent. Degrees * PI()/180 = radians"}}},TANH:{s:"Returns the hyperbolic tangent of a number",p:{number:{d:"is any real number"}}}};
@@ -1,6 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.3.3
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("react"),o=require("./6AlZR3dVayTg7C5E.cjs"),B=["Ok","Cancel"],C=l.memo(v=>{const{initialValue:S,context:g,onOption:y,onValidateOption:p,onInputOption:x,onDone:u,options:f=B,defaultOption:i=f?.[0],cancelOption:c="Cancel",sx:j,...k}=v,[t,h]=l.useState(S),[F,O]=l.useState(!1),d=l.useCallback(async(e,n)=>!0,[]),m=o.Te(async e=>{x?.(t,e),y?.(e,e===c,e===i),u?.()},[t,x,u,y,c,i]),P=o.Te(async e=>{e.keyCode===o.Sn.Enter&&await d?.(t,null)!==!1&&m(i)},[t,m]),w=o.Te(e=>{h(e.target.value),d?.(e.target.value,null)},[p]),I=o.Te(async e=>{let n=await Promise.resolve(p?.(e));try{n!==!1&&(n=await Promise.resolve(d?.(t,e))??!0)}catch{}return n??!0},[p]),[T,b]=l.useState(o.uo.Styles.lookupStyle(t).formatType??o.uo.Type.Custom);l.useEffect(()=>{b(o.uo.Styles.lookupStyle(t).formatType??o.uo.Type.Custom)},[t]);const D=l.useMemo(()=>{const e=o.uo.Styles.lookupPrimary(),n=r=>a.jsx(o.MenuItem,{value:r,children:r},r),s=Object.keys(e).map(r=>n(e[r].formatType));return s.push(n(o.uo.Type.Custom)),s},[]),M=l.useCallback(e=>{const n=e.target.value;b(n);const s=o.uo.Styles.lookupDefault(n);s&&h(s)},[]),$=l.useMemo(()=>{const e=g();return e.createTemporaryCell({value:e.getValue()??12345,style:{numberFormat:t}})},[T,t,g]);return a.jsx(o.Tb,{title:"Number Format",options:f,onDone:u,onOption:e=>m(e),onValidateOption:I,defaultOption:i,cancelOption:c,autoFocusSel:".autoFocus",sx:{width:"580px",...j},...k,children:a.jsxs(o.Box,{sx:{paddingTop:e=>e.spacing(1),paddingBottom:e=>e.spacing(0),rowGap:e=>e.spacing(1),display:"flex",flexDirection:"column"},children:[a.jsxs(o.FormControl,{sx:{minWidth:135},size:"small",children:[a.jsx(o.InputLabel,{children:"Category"}),a.jsx(o.Select,{value:T,label:"Category",onChange:M,sx:{backgroundImage:`linear-gradient(${o.alpha("#fff",o.no(5))}, ${o.alpha("#fff",o.no(5))})`},children:D})]}),a.jsx(o.FormControl,{sx:{paddingTop:e=>e.spacing(1.5),minWidth:135,width:"100%"},size:"small",children:a.jsx(o.TextField,{label:"Code",onFocus:e=>{F||e.target?.select(),O(!0)},sx:{"& .MuiFormHelperText-root":{marginTop:e=>e.spacing(.5)}},InputLabelProps:{shrink:!0},InputProps:{inputProps:{className:"autoFocus",spellCheck:!1,autoComplete:"off",sx:{paddingTop:e=>e.spacing(1.25),paddingBottom:e=>e.spacing(.75),backgroundImage:`linear-gradient(${o.alpha("#fff",o.no(5))}, ${o.alpha("#fff",o.no(5))})`}}},value:t,onChange:w,onKeyDown:P,onContextMenu:e=>{e.stopPropagation()}})}),a.jsxs(o.Box,{children:[a.jsx(o.Typography,{variant:"caption",component:"div",sx:{paddingLeft:e=>e.spacing(2)},children:"Preview"}),a.jsx(o.Typography,{variant:"body2",component:"div",sx:{borderRadius:e=>`${e.shape.borderRadius}px`,padding:e=>e.spacing(1),border:e=>`1px solid ${e.palette.grey[400]}`},children:$.getNumberFormat().displayText||"(empty)"})]})]})})});exports.NumberFormatDialog=C,exports.default=C;
@@ -1,12 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.3.3
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./6AlZR3dVayTg7C5E.cjs");exports.fromBufferJSON=async(g,y)=>{let i=g;(function(s){if(s.byteLength<4)return!1;const u=new Uint8Array(s),c={gzip:[31,139],zip:[80,75,3,4],bz2:[66,90,104],br:[206,178,207,129]},r=Object.keys(c);for(let n=0;n<r.length;n++){const o=r[n],e=c[o];let a=!0;for(let t=0;t<e.length;t++)if(u[t]!==e[t]){a=!1;break}if(a)return o}return!1})(i)&&(i=await async function(s,u="gzip"){const c=new Blob([s]).stream(),r=new DecompressionStream(u),n=c.pipeThrough(r);return(await new Response(n).blob()).arrayBuffer()}(i));let b=new TextDecoder().decode(i);const w=JSON.parse(b),p={...y?.constructorOptions??{},json:w};return new j.vL(p)},exports.toBufferJSON=async(g,y)=>{const i=await g.toJSON(),b=y?.whiteSpace??0;let w;y?.beforeWrite?.(g,i),w=b===0?JSON.stringify(i):function(u,c=2){const r=[];function n(o){const e=c*o;return r[e]===void 0&&(r[e]=" ".repeat(e)),r[e]}return function o(e,a,t,N){if(e==null||typeof e!="object")return JSON.stringify(e);const h=n(a),m=n(a+1);if(Array.isArray(e)){const f=e.length;if(f===0)return"[]";if(t!==0)return JSON.stringify(e);let l=`[
7
- `;for(let O=0;O<f;O++)l+=m+o(e[O],a+1,t+1,!0),O<f-1&&(l+=`,
8
- `);return l+=`
9
- `+h+"]",l}const J=Object.keys(e),d=J.length;if(d===0)return"{}";if(!(t<2))return JSON.stringify(e);let S=`{
10
- `;N||(t=0);for(let f=0;f<d;f++){const l=J[f];S+=m+JSON.stringify(l)+": "+o(e[l],a+1,t,!1),f<d-1&&(S+=`,
11
- `)}return S+=`
12
- `+h+"}",S}(u,0,0,!1)}(i,b);let p=new TextEncoder().encode(w);const s=y?.compress??!0;return s&&(p=await async function(u,c="gzip"){const r=new ReadableStream({start(e){e.enqueue(u),e.close()}}),n=new CompressionStream(c),o=r.pipeThrough(n);return(await new Response(o).blob()).arrayBuffer()}(p,typeof s=="string"?s:void 0)),p};
@@ -1,6 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.3.3
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let e=null;exports.initialize=async function(){return e||(e=new Promise(async(s,r)=>{try{const i="0.20.2",a=`https://esm.sh/esbuild-wasm@${i}`,l=`https://esm.sh/esbuild-wasm@${i}/esbuild.wasm`,t=(await import(a)).default;await t.initialize({wasmURL:l,worker:!1}),s(t)}catch(i){console.error("Error initializing esbuild:",i),r(i)}}),e)};
@@ -1,6 +0,0 @@
1
- "use strict";/**
2
- * @license @sheetxl/studio-vanilla - SheetXL Studio - Vanilla entry point for integrating SheetXL UI. - v0.3.3
3
- *
4
- * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
- * License: The license can be found at https://www.sheetxl.com/license.
6
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.default={BESSELI:{s:"Returns the modified Bessel function In(x)",p:{x:{d:"is the value at which to evaluate the function"},n:{d:"is the order of the Bessel function"}}},BESSELJ:{s:"Returns the Bessel function Jn(x)",p:{x:{d:"is the value at which to evaluate the function"},n:{d:"is the order of the Bessel function"}}},BESSELK:{s:"Returns the modified Bessel function Kn(x)",p:{x:{d:"is the value at which to evaluate the function"},n:{d:"is the order of the function"}}},BESSELY:{s:"Returns the Bessel function Yn(x)",p:{x:{d:"is the value at which to evaluate the function"},n:{d:"is the order of the function"}}}};