@qwen-code/qwen-code 0.19.9 → 0.19.10

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 (310) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +7 -0
  2. package/bundled/qc-helper/docs/features/channels/dingtalk.md +3 -0
  3. package/bundled/qc-helper/docs/features/channels/overview.md +11 -3
  4. package/bundled/qc-helper/docs/features/code-review.md +88 -44
  5. package/bundled/qc-helper/docs/features/commands.md +6 -6
  6. package/bundled/qc-helper/docs/features/hooks.md +29 -0
  7. package/bundled/qc-helper/docs/features/sub-agents.md +21 -0
  8. package/bundled/qc-helper/docs/qwen-serve.md +46 -20
  9. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +1 -1
  10. package/bundled/review/DESIGN.md +219 -33
  11. package/bundled/review/SKILL.md +449 -153
  12. package/chunks/{MaxSizedBox-6HYJ3ZPJ.js → MaxSizedBox-67ODZ4SZ.js} +31 -31
  13. package/chunks/{StandaloneSessionPicker-WS4GXYOG.js → StandaloneSessionPicker-SIPBQT5Z.js} +51 -49
  14. package/chunks/{acpAgent-5FWSOZL5.js → acpAgent-VPZJXLFX.js} +528 -478
  15. package/chunks/{agent-HOLHB3RT.js → agent-Z7NWL6XL.js} +26 -26
  16. package/chunks/{agent-headless-SXL6H56A.js → agent-headless-73HZ6ROQ.js} +26 -26
  17. package/chunks/{anthropicContentGenerator-L73TO3DB.js → anthropicContentGenerator-56U3YCP2.js} +5 -5
  18. package/chunks/{artifact-tool-U7IRTLIV.js → artifact-tool-BWZZJ42H.js} +2 -2
  19. package/chunks/{askUserQuestion-2DLUUZZG.js → askUserQuestion-WU3S5A5T.js} +2 -2
  20. package/chunks/{bridge-BCJQ7BBB.js → bridge-XFKW6S7Q.js} +32 -32
  21. package/chunks/{ca-UJ6HC4H2.js → ca-C2JTT2N5.js} +4 -1
  22. package/chunks/channel-worker-group-K7QKH6IG.js +13 -0
  23. package/chunks/channel-worker-manager-5RWKSGEU.js +418 -0
  24. package/chunks/channel-worker-supervisor-PCDAZN4D.js +20 -0
  25. package/chunks/{chunk-LXNEJD34.js → chunk-2FO5GFKZ.js} +1 -1
  26. package/chunks/{chunk-B5ORX3FG.js → chunk-2UUAIFQO.js} +1 -1
  27. package/chunks/{chunk-L36P3NBD.js → chunk-2W3OOD4W.js} +2 -0
  28. package/chunks/{chunk-7R3CZA3Q.js → chunk-2Z5UX4KI.js} +1 -1
  29. package/chunks/chunk-3MX7D6QN.js +516 -0
  30. package/chunks/{chunk-E2IY465S.js → chunk-3XJFUTNM.js} +10 -10
  31. package/chunks/{chunk-JZETEN3Z.js → chunk-422XAKCK.js} +3 -3
  32. package/chunks/{chunk-N3EMS75V.js → chunk-4FMG7EDJ.js} +1268 -1233
  33. package/chunks/{chunk-HKMAENAO.js → chunk-4YWLED2A.js} +8 -6
  34. package/chunks/{chunk-SCGXUJBT.js → chunk-5EBKKSBX.js} +3 -3
  35. package/chunks/chunk-5HBA2Z7V.js +28 -0
  36. package/chunks/{chunk-XYQSMABS.js → chunk-5LROA5W4.js} +4 -4
  37. package/chunks/{chunk-ZJE7NSL3.js → chunk-5M6IDOMF.js} +34 -97
  38. package/chunks/{chunk-VA4KQY6V.js → chunk-65N2J6V2.js} +3 -3
  39. package/chunks/{chunk-4C5BQ2D2.js → chunk-6GETGQWP.js} +71 -12
  40. package/chunks/{chunk-PVZM22CK.js → chunk-6GKMJPOC.js} +5 -5
  41. package/chunks/{chunk-W2UIXQDL.js → chunk-6OATMEYN.js} +1 -1
  42. package/chunks/{chunk-GZRTYZ2R.js → chunk-6W6DI34P.js} +154 -1
  43. package/chunks/{chunk-EMDMPBJ4.js → chunk-7L4XBYVW.js} +3 -3
  44. package/chunks/{chunk-EAXLGSFP.js → chunk-7MJAZMXK.js} +8 -8
  45. package/chunks/{chunk-K434OPES.js → chunk-7NAWTFVY.js} +3 -3
  46. package/chunks/{chunk-J4TSQ5EQ.js → chunk-7NFB7LBQ.js} +8 -1
  47. package/chunks/{chunk-5SFOMFG4.js → chunk-7R4DPSRA.js} +36 -2
  48. package/chunks/{chunk-P67PFTUT.js → chunk-AAR5SGMD.js} +4 -4
  49. package/chunks/{chunk-RDJSGHZE.js → chunk-ALGGS7UH.js} +1 -38
  50. package/chunks/{chunk-GWHYEOV2.js → chunk-ARKANCNX.js} +2 -1
  51. package/chunks/{chunk-D2GFWEXB.js → chunk-B5I2IIWY.js} +6 -6
  52. package/chunks/{chunk-524RQP4Q.js → chunk-B7NUUEXC.js} +10 -4
  53. package/chunks/{chunk-CUMMSHH6.js → chunk-BBNVFRGD.js} +1 -1
  54. package/chunks/{chunk-5HOMWMCL.js → chunk-CEW4HDPK.js} +4166 -1338
  55. package/chunks/chunk-CJFNEBYB.js +91 -0
  56. package/chunks/{chunk-VWPVHAMO.js → chunk-CUUXANEQ.js} +5 -1
  57. package/chunks/{chunk-GWLSNBG4.js → chunk-DK33QJ3V.js} +30 -26
  58. package/chunks/{chunk-HPDUL5MF.js → chunk-DPFBNG72.js} +1 -1
  59. package/chunks/{chunk-KKNMOEZH.js → chunk-E2UVIFI2.js} +185 -398
  60. package/chunks/{chunk-MC23XKFE.js → chunk-E67NFMF4.js} +3 -3
  61. package/chunks/{chunk-OQ4DRIOA.js → chunk-EQY6POVO.js} +2 -2
  62. package/chunks/{chunk-XUOOWUZS.js → chunk-F7NXQH4Y.js} +1 -1
  63. package/chunks/{chunk-YLV3XXFB.js → chunk-FBU7WRZI.js} +17 -1
  64. package/chunks/{chunk-LK7KUE55.js → chunk-FSA7ERJ2.js} +1 -1
  65. package/chunks/{chunk-PDZ7MBDG.js → chunk-FXMC7SL2.js} +27 -6
  66. package/chunks/{chunk-SJHDYNHF.js → chunk-GDQQRV43.js} +3 -3
  67. package/chunks/{chunk-34MW4KTI.js → chunk-GGJII3FM.js} +2 -2
  68. package/chunks/{chunk-3BTRNWWD.js → chunk-GOXKNSDZ.js} +1 -64
  69. package/chunks/chunk-GYTKQYDB.js +23 -0
  70. package/chunks/{chunk-HVY356M2.js → chunk-H3FQOPPS.js} +3 -3
  71. package/chunks/{chunk-YVEDCAUE.js → chunk-HGT6JR3U.js} +19 -0
  72. package/chunks/{chunk-WQUQVGTF.js → chunk-HHEFI4RP.js} +183 -96
  73. package/chunks/chunk-IDS7MSUP.js +74 -0
  74. package/chunks/{chunk-6PESIEKJ.js → chunk-JSJFKYWT.js} +68 -6
  75. package/chunks/{chunk-CNEIYWSA.js → chunk-K4PZ5F5T.js} +5 -5
  76. package/chunks/{chunk-NVYTCB5Z.js → chunk-K7CRWKOE.js} +14534 -13980
  77. package/chunks/{chunk-ORBGV7NJ.js → chunk-KKRTYONM.js} +6 -4
  78. package/chunks/{chunk-IAVB3HM3.js → chunk-KSO42X3Z.js} +13 -0
  79. package/chunks/chunk-L37RC7MQ.js +493 -0
  80. package/chunks/{chunk-4QLQE5WJ.js → chunk-L5U3ELZX.js} +1 -1
  81. package/chunks/{chunk-3G7CIHVV.js → chunk-L62SEJWY.js} +4 -4
  82. package/chunks/{chunk-EGYZ275M.js → chunk-LNUXFLLJ.js} +4 -4
  83. package/chunks/{chunk-4ZVWQHEQ.js → chunk-LQIDP6K5.js} +1 -1
  84. package/chunks/{chunk-VTU57BWZ.js → chunk-LQU7EVFA.js} +1 -1
  85. package/chunks/{chunk-B4G2WOFA.js → chunk-LTNI523B.js} +2 -2
  86. package/chunks/{chunk-DC5Z3DU6.js → chunk-LXLTBIDP.js} +43 -6
  87. package/chunks/{chunk-KHUQZZJ6.js → chunk-MO7O5722.js} +370 -36
  88. package/chunks/chunk-MR3PXB6E.js +48 -0
  89. package/chunks/{chunk-5VXNZWGF.js → chunk-N6FXRR6P.js} +1 -1
  90. package/chunks/{chunk-WL4L7EZH.js → chunk-OA4JVLSA.js} +27 -1
  91. package/chunks/{chunk-TO6QE22P.js → chunk-OATTJGPJ.js} +26 -22
  92. package/chunks/{chunk-X6TJ3YZV.js → chunk-OFEVHGVU.js} +159 -57
  93. package/chunks/{chunk-X4NKFGFJ.js → chunk-OJAMDVF5.js} +0 -15
  94. package/chunks/{chunk-BZIFY5TF.js → chunk-OKAIGAYW.js} +3 -3
  95. package/chunks/{chunk-3VAGG5T5.js → chunk-P6LART6G.js} +116 -15
  96. package/chunks/{chunk-3SJSQXNS.js → chunk-PEJWA3QQ.js} +12 -8
  97. package/chunks/{chunk-BAPGSC7U.js → chunk-Q5GLXH5Q.js} +23 -9
  98. package/chunks/{chunk-MXL5UP4X.js → chunk-Q6TUALBE.js} +1 -1
  99. package/chunks/{chunk-QYMQSECS.js → chunk-QAW7PIHT.js} +2 -2
  100. package/chunks/{chunk-LUODI7WD.js → chunk-RCEEXIOO.js} +6 -4
  101. package/chunks/{chunk-YAUFFXDS.js → chunk-RDRVMDWV.js} +12 -11
  102. package/chunks/{chunk-CEA3E3JB.js → chunk-SPJQO2CE.js} +2 -2
  103. package/chunks/{chunk-U2NNEY4R.js → chunk-SPUYQB4T.js} +1 -1
  104. package/chunks/{chunk-34Z3U5RQ.js → chunk-SXU3KKNI.js} +514 -114
  105. package/chunks/{chunk-ECNYL4AA.js → chunk-TISZXPAX.js} +1 -1
  106. package/chunks/{chunk-JSG7ZSBC.js → chunk-TQBODCFD.js} +1 -1
  107. package/chunks/{chunk-AKIVHSJR.js → chunk-TTUO4DNG.js} +111 -93
  108. package/chunks/chunk-TV6K2FB4.js +224 -0
  109. package/chunks/{chunk-4GORAUCN.js → chunk-TXY2C3D2.js} +1 -1
  110. package/chunks/{chunk-5XUCZNSY.js → chunk-TYLOFD2U.js} +1 -1
  111. package/chunks/{chunk-CLFKOZEK.js → chunk-UFOKA4PR.js} +1 -1
  112. package/chunks/{channel-worker-supervisor-WSOAAYUO.js → chunk-URU5UEK6.js} +67 -35
  113. package/chunks/{chunk-D5SKC4YG.js → chunk-V7EQTZYR.js} +41 -13
  114. package/chunks/{chunk-L6P4KPHR.js → chunk-VBRRNQB7.js} +59 -39
  115. package/chunks/{chunk-BMGVRZN4.js → chunk-W34A5MJH.js} +1 -1
  116. package/chunks/{chunk-PODM4SZ4.js → chunk-WDW64OW3.js} +5 -5
  117. package/chunks/{chunk-W3JHSWRP.js → chunk-WDWJ4OQJ.js} +4 -4
  118. package/chunks/{chunk-Q4YQW46J.js → chunk-WIASPMLX.js} +31 -17
  119. package/chunks/{chunk-ZLXQN2QS.js → chunk-WIEO4CWB.js} +1 -1
  120. package/chunks/{chunk-A3XKDTSH.js → chunk-WLXYAKV7.js} +4 -4
  121. package/chunks/{chunk-Q6I5QHMH.js → chunk-WTSXKLG5.js} +1 -1
  122. package/chunks/{chunk-J3JA76CF.js → chunk-WX6SD4IQ.js} +1 -1
  123. package/chunks/{chunk-77XJ3SWN.js → chunk-X362TMXZ.js} +5 -5
  124. package/chunks/{chunk-CCDMCZPP.js → chunk-XLIRF7IK.js} +1 -1
  125. package/chunks/{chunk-AURZZYMD.js → chunk-XXJKGHZV.js} +4 -4
  126. package/chunks/{chunk-TDEXZKMT.js → chunk-Y66VOBRP.js} +2 -2
  127. package/chunks/{chunk-CC2ITGCF.js → chunk-YHN5SUIJ.js} +49 -6
  128. package/chunks/{chunk-3AHXV67U.js → chunk-YU56QGXX.js} +1 -1
  129. package/chunks/{chunk-5U27BZ72.js → chunk-YX4LLZ3D.js} +187 -75
  130. package/chunks/{chunk-ATAKVRIF.js → chunk-YYPXHMWO.js} +7 -7
  131. package/chunks/{chunk-XLA62MYB.js → chunk-ZKMGAFYV.js} +2 -2
  132. package/chunks/{chunk-UOZWKTQG.js → chunk-ZPAHLFZU.js} +2 -2
  133. package/chunks/{chunk-7PU4FYLG.js → chunk-ZQTZXVHP.js} +4 -4
  134. package/chunks/chunk-ZRKBI3DP.js +34 -0
  135. package/chunks/{computer-use-HM37RX6A.js → computer-use-IYTX45WA.js} +26 -26
  136. package/chunks/{config-utils-NV2SVGPB.js → config-utils-CFT33LTP.js} +3 -2
  137. package/chunks/{contextCommand-OF5SFGH2.js → contextCommand-272V77WU.js} +28 -28
  138. package/chunks/{create-sub-session-KPRT7ECJ.js → create-sub-session-CBJMQLYP.js} +26 -26
  139. package/chunks/{create-sub-session-INX7TXJI.js → create-sub-session-WNX2OQVX.js} +2 -2
  140. package/chunks/{cron-create-AMBKGZX6.js → cron-create-36TIFKRT.js} +4 -4
  141. package/chunks/{cron-delete-LRU4OJYG.js → cron-delete-OQD3WULU.js} +4 -4
  142. package/chunks/{cron-list-WVP2JXER.js → cron-list-4533T2FH.js} +4 -4
  143. package/chunks/{daemon-ARHTSTXP.js → daemon-RNGFPMAB.js} +575 -58
  144. package/chunks/{daemon-status-provider-B2UTZUJ2.js → daemon-status-provider-L4STG5VO.js} +36 -36
  145. package/chunks/{de-EBJN3OVN.js → de-2VCDRDGU.js} +4 -1
  146. package/chunks/{dist-VHV4EVHG.js → dist-3V3ZV6ML.js} +1 -1
  147. package/chunks/{dist-XKU3ABM5.js → dist-ERCPDVA6.js} +1 -1
  148. package/chunks/{dist-PNVLTKTL.js → dist-HNN7DR2L.js} +158 -4
  149. package/chunks/{dist-WKPOYU7O.js → dist-JZE7F6YR.js} +1 -1
  150. package/chunks/{dist-QYCAEZIT.js → dist-MOEC47TR.js} +5 -1
  151. package/chunks/{dist-R7LN5AZE.js → dist-PHEPJLXD.js} +2 -2
  152. package/chunks/{earlyInputCapture-3VTHRC4C.js → earlyInputCapture-EN4BRREQ.js} +27 -27
  153. package/chunks/{edit-VNI4NJ73.js → edit-OMAF2QDR.js} +27 -27
  154. package/chunks/{en-5A6LA7RK.js → en-NJCA3TAA.js} +5 -1
  155. package/chunks/{enter-worktree-IYYBKPZT.js → enter-worktree-BBZX52HG.js} +26 -26
  156. package/chunks/{enterPlanMode-GMC5FD5A.js → enterPlanMode-5NNFMBUY.js} +42 -27
  157. package/chunks/{environment-5HSSRMJ7.js → environment-7TEWMJYN.js} +30 -29
  158. package/chunks/{errors-HMFCJJ7P.js → errors-I4VKVX3F.js} +28 -28
  159. package/chunks/{exit-worktree-6BHCMP5G.js → exit-worktree-FUWRJI33.js} +26 -26
  160. package/chunks/{exitPlanMode-CJW7G74W.js → exitPlanMode-IHCJ5EEI.js} +26 -26
  161. package/chunks/{fast-path-FRDMDVHG.js → fast-path-ZA57TOH4.js} +3 -3
  162. package/chunks/{fast-path-settings-5QZE64HR.js → fast-path-settings-DAOVFADC.js} +6 -4
  163. package/chunks/{fr-YXRABLYZ.js → fr-5F3E7WKD.js} +4 -1
  164. package/chunks/{gemini-QYSEGHAX.js → gemini-UOAKVXBG.js} +139 -76
  165. package/chunks/{geminiContentGenerator-J7YNZDYP.js → geminiContentGenerator-G6UCE6MW.js} +4 -4
  166. package/chunks/{glob-BRCSGFOT.js → glob-4GJQ2UFF.js} +28 -27
  167. package/chunks/{grep-EE2DUOSY.js → grep-5QSYXF2E.js} +26 -26
  168. package/chunks/{handleAutoUpdate-5NWTLR67.js → handleAutoUpdate-ULHNWL6R.js} +30 -30
  169. package/chunks/{i18n-BASPENNQ.js → i18n-CYDUTF6F.js} +27 -27
  170. package/chunks/initializer-NRFKUGIO.js +73 -0
  171. package/chunks/{installationInfo-W6V4DT7W.js → installationInfo-WELKRHHE.js} +27 -27
  172. package/chunks/{ja-7VQOANVG.js → ja-66J6B53L.js} +5 -2
  173. package/chunks/{keychain-token-storage-VKUBNCP4.js → keychain-token-storage-AU22CQI6.js} +2 -2
  174. package/chunks/list-JVDXEG2E.js +76 -0
  175. package/chunks/loadedSettingsAdapter-WAM4VUTG.js +70 -0
  176. package/chunks/{loop-wakeup-WX7BLWWP.js → loop-wakeup-MVUKDVCP.js} +5 -5
  177. package/chunks/{ls-ZB2BDP6T.js → ls-RXNIAQDE.js} +4 -4
  178. package/chunks/{lsp-V5DN4YUJ.js → lsp-HB5LM5IL.js} +2 -2
  179. package/chunks/mcp-YHOZN3ZM.js +70 -0
  180. package/chunks/{monitor-X5Z3H4FY.js → monitor-R7XZPJHQ.js} +26 -26
  181. package/chunks/nonInteractiveCli-NSOB6D74.js +129 -0
  182. package/chunks/{notebook-edit-TRM2QIJK.js → notebook-edit-6RNKE2L2.js} +27 -27
  183. package/chunks/{openaiContentGenerator-AAYONPMF.js → openaiContentGenerator-XNS5S64I.js} +12 -12
  184. package/chunks/{pidfile-D4I4FTVA.js → pidfile-XE4RRR2P.js} +27 -27
  185. package/chunks/{pt-2C6YCSHL.js → pt-TFZO5Y6T.js} +4 -1
  186. package/chunks/{qwenContentGenerator-K3HZ2H76.js → qwenContentGenerator-APDPJ3VN.js} +28 -28
  187. package/chunks/{qwenOAuth2-PJQ27GSO.js → qwenOAuth2-LEYOU7RU.js} +5 -5
  188. package/chunks/{read-file-7SZSIZOL.js → read-file-XSUWXSR7.js} +8 -8
  189. package/chunks/{read-mcp-resource-SM5DA4RG.js → read-mcp-resource-6LRTZKXI.js} +2 -2
  190. package/chunks/{record-artifact-4XKZX3UW.js → record-artifact-PMDTY4OS.js} +2 -2
  191. package/chunks/{ripGrep-YNPFVCZP.js → ripGrep-APB3CDMU.js} +26 -26
  192. package/chunks/{ru-6BBHVZZV.js → ru-4L4LFHIT.js} +4 -1
  193. package/chunks/{run-qwen-serve-DMWV5N6L.js → run-qwen-serve-NWTGPERT.js} +1232 -371
  194. package/chunks/{runtime-57WWRVHN.js → runtime-EIO3NQKR.js} +42 -37
  195. package/chunks/{scheduler-YBLGWSIL.js → scheduler-JJDZBDRN.js} +26 -26
  196. package/chunks/{send-message-F36YD6KQ.js → send-message-SR4WSXP2.js} +3 -3
  197. package/chunks/{serve-R63NK3CV.js → serve-WTIPB3EI.js} +36 -34
  198. package/chunks/{server-Z22GCAXP.js → server-NJPHQHLH.js} +5238 -1328
  199. package/chunks/{session-HKAAI7BN.js → session-O4AO7FTS.js} +298 -98
  200. package/chunks/{settings-3EYN66GK.js → settings-HQNDK7TG.js} +34 -32
  201. package/chunks/{shell-6YXINTWJ.js → shell-UIXM6PWG.js} +26 -26
  202. package/chunks/{skill-OO57P4X6.js → skill-3XMB4ULV.js} +10 -10
  203. package/chunks/{spawnChannel-JD7G4VU6.js → spawnChannel-3R632QRM.js} +28 -28
  204. package/chunks/{src-G5UPLZSZ.js → src-USZKPUOC.js} +85 -27
  205. package/chunks/{standalone-update-OB7F4JPZ.js → standalone-update-L5XW3D7K.js} +28 -28
  206. package/chunks/{startInteractiveUI-73EGLIIH.js → startInteractiveUI-CPZOL2WB.js} +730 -397
  207. package/chunks/{syntheticOutput-34H7LGA7.js → syntheticOutput-YKFNUQZD.js} +3 -3
  208. package/chunks/{task-create-FRGOEIKY.js → task-create-NUFOHU53.js} +8 -7
  209. package/chunks/{task-list-OW766BXZ.js → task-list-Z2IKQY3S.js} +6 -5
  210. package/chunks/{task-stop-SIR5SNBN.js → task-stop-KQFIVQTJ.js} +2 -2
  211. package/chunks/{task-update-YRA532MT.js → task-update-HKADXSTD.js} +8 -7
  212. package/chunks/{team-create-PECAAPXK.js → team-create-XXPRF3IQ.js} +26 -26
  213. package/chunks/{team-delete-6OSECUZC.js → team-delete-SDNTGZLG.js} +6 -5
  214. package/chunks/{team-plan-approval-L6F434RY.js → team-plan-approval-EOTTKHDW.js} +26 -26
  215. package/chunks/{theme-manager-ZG4RY6GU.js → theme-manager-P6UITO2L.js} +27 -27
  216. package/chunks/{todoWrite-YDMFEV4G.js → todoWrite-YNXB27GB.js} +4 -4
  217. package/chunks/{tool-search-THVIWAPB.js → tool-search-DDNGK2LR.js} +9 -9
  218. package/chunks/{total-session-admission-JOKNRIIA.js → total-session-admission-PL5N7DNY.js} +33 -33
  219. package/chunks/tree-sitter-YJVE2ZUK.js +2980 -0
  220. package/chunks/{trustedFolders-EOGT3UVS.js → trustedFolders-C5LMF3UR.js} +29 -28
  221. package/chunks/types-ML3TRJQ5.js +16 -0
  222. package/chunks/{updateCheck-2KYEYVSB.js → updateCheck-QTVVISH7.js} +29 -29
  223. package/chunks/{validateNonInterActiveAuth-EN6ZQSR2.js → validateNonInterActiveAuth-RY4RKBQG.js} +75 -71
  224. package/chunks/{version-3UEA6ZIR.js → version-U45RYOSD.js} +1 -1
  225. package/chunks/{web-fetch-PAAEQKBW.js → web-fetch-ZSPR3PRR.js} +5 -5
  226. package/chunks/{workflow-QCCCMYP3.js → workflow-TCIAQYOA.js} +27 -27
  227. package/chunks/workspace-providers-status-I3G2HYLY.js +73 -0
  228. package/chunks/workspace-registration-store-IH5GLZ6Y.js +27 -0
  229. package/chunks/{workspace-registry-24QFLQYH.js → workspace-registry-QEKBELIX.js} +33 -33
  230. package/chunks/workspace-service-ORKHGLP3.js +86 -0
  231. package/chunks/workspace-skills-status-D7QCNDYY.js +72 -0
  232. package/chunks/{write-file-I3MUDRIE.js → write-file-JGRQR5VM.js} +27 -27
  233. package/chunks/{zh-RQE7I22T.js → zh-FSAH32JB.js} +6 -2
  234. package/chunks/{zh-TW-TBPQGHKH.js → zh-TW-D2YIE2LO.js} +6 -2
  235. package/cli.js +11 -11
  236. package/locales/ca.js +6 -0
  237. package/locales/de.js +6 -0
  238. package/locales/en.js +8 -0
  239. package/locales/fr.js +6 -0
  240. package/locales/ja.js +7 -1
  241. package/locales/pt.js +6 -0
  242. package/locales/ru.js +6 -0
  243. package/locales/zh-TW.js +9 -1
  244. package/locales/zh.js +9 -1
  245. package/package.json +3 -3
  246. package/web-shell/assets/{arc-C15hqnJe.js → arc-CUeDlxvE.js} +1 -1
  247. package/web-shell/assets/{architectureDiagram-3BPJPVTR-B-At37J_.js → architectureDiagram-3BPJPVTR-PiUszkQA.js} +1 -1
  248. package/web-shell/assets/{blockDiagram-GPEHLZMM-B51wjcU7.js → blockDiagram-GPEHLZMM-s2wYSO7e.js} +1 -1
  249. package/web-shell/assets/{c4Diagram-AAUBKEIU-xBK7BAwN.js → c4Diagram-AAUBKEIU-DyLxZoz9.js} +1 -1
  250. package/web-shell/assets/channel-DkuJJ0qd.js +1 -0
  251. package/web-shell/assets/{chunk-2J33WTMH-xKmLg7Yr.js → chunk-2J33WTMH-Dsdai7Tk.js} +1 -1
  252. package/web-shell/assets/{chunk-4BX2VUAB-BfkdKZCM.js → chunk-4BX2VUAB-DEosOjV7.js} +1 -1
  253. package/web-shell/assets/{chunk-55IACEB6-DT713sZf.js → chunk-55IACEB6-sNsRLTXf.js} +1 -1
  254. package/web-shell/assets/{chunk-727SXJPM-CYEeAamv.js → chunk-727SXJPM-DkRNZzmh.js} +1 -1
  255. package/web-shell/assets/{chunk-AQP2D5EJ-DBN-5CFd.js → chunk-AQP2D5EJ-BrsRNpzd.js} +1 -1
  256. package/web-shell/assets/{chunk-FMBD7UC4-CGZKk4PH.js → chunk-FMBD7UC4-CI039lpl.js} +1 -1
  257. package/web-shell/assets/{chunk-ND2GUHAM-qQbC2O-y.js → chunk-ND2GUHAM-M-pkeIfu.js} +1 -1
  258. package/web-shell/assets/{chunk-QZHKN3VN-B3zeXwsX.js → chunk-QZHKN3VN-C4ckGNbH.js} +1 -1
  259. package/web-shell/assets/classDiagram-4FO5ZUOK-CwqHc0TB.js +1 -0
  260. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CwqHc0TB.js +1 -0
  261. package/web-shell/assets/{cose-bilkent-S5V4N54A-BKsl1Wvy.js → cose-bilkent-S5V4N54A-BciKUAFq.js} +1 -1
  262. package/web-shell/assets/{dagre-BM42HDAG-CuuuLiBK.js → dagre-BM42HDAG-C1nTSgU6.js} +1 -1
  263. package/web-shell/assets/{diagram-2AECGRRQ-CG4_eKiV.js → diagram-2AECGRRQ-BDPNWr1m.js} +1 -1
  264. package/web-shell/assets/{diagram-5GNKFQAL-DSFTmZB1.js → diagram-5GNKFQAL-CNFhTszL.js} +1 -1
  265. package/web-shell/assets/{diagram-KO2AKTUF-BxwlEHn8.js → diagram-KO2AKTUF-CjPa4p5a.js} +1 -1
  266. package/web-shell/assets/{diagram-LMA3HP47-BUAg-jMG.js → diagram-LMA3HP47-ZzPykSyG.js} +1 -1
  267. package/web-shell/assets/{diagram-OG6HWLK6-BFM2jlO5.js → diagram-OG6HWLK6-0UVtZ9A4.js} +1 -1
  268. package/web-shell/assets/{erDiagram-TEJ5UH35-CerbFPa2.js → erDiagram-TEJ5UH35-CajDZCat.js} +1 -1
  269. package/web-shell/assets/{flowDiagram-I6XJVG4X-BNeZz5Zz.js → flowDiagram-I6XJVG4X-BRuFBIvL.js} +1 -1
  270. package/web-shell/assets/{ganttDiagram-6RSMTGT7-CTOogLaM.js → ganttDiagram-6RSMTGT7-BevGmJqG.js} +3 -3
  271. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-yxSFkXPj.js → gitGraphDiagram-PVQCEYII-DvPMpBMb.js} +1 -1
  272. package/web-shell/assets/index-Cnvv4VcI.css +5 -0
  273. package/web-shell/assets/index-D1Uyklxa.js +1088 -0
  274. package/web-shell/assets/index-DzHwQkQq.js +3 -0
  275. package/web-shell/assets/{infoDiagram-5YYISTIA-DYdAUevm.js → infoDiagram-5YYISTIA-Oixn7tA9.js} +1 -1
  276. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-CNuijZ90.js → ishikawaDiagram-YF4QCWOH-BgKpeg-j.js} +1 -1
  277. package/web-shell/assets/{journeyDiagram-JHISSGLW-BTyiuonf.js → journeyDiagram-JHISSGLW-74mwxIaA.js} +1 -1
  278. package/web-shell/assets/{kanban-definition-UN3LZRKU-DPJo0Uow.js → kanban-definition-UN3LZRKU-D4D6cEqA.js} +1 -1
  279. package/web-shell/assets/{linear-C8wKCbIC.js → linear-atZRE_L2.js} +1 -1
  280. package/web-shell/assets/{mermaid.core-BV5o7nW5.js → mermaid.core-KKudX-JC.js} +5 -5
  281. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BtLcBmSt.js → mindmap-definition-RKZ34NQL-CMCej9yG.js} +1 -1
  282. package/web-shell/assets/{pieDiagram-4H26LBE5-C22J7A9Q.js → pieDiagram-4H26LBE5-nhx40X7q.js} +1 -1
  283. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-DSL10wiL.js → quadrantDiagram-W4KKPZXB-CUmVcN3M.js} +1 -1
  284. package/web-shell/assets/{requirementDiagram-4Y6WPE33-feqh0UpX.js → requirementDiagram-4Y6WPE33-C_vyEwyy.js} +1 -1
  285. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-Z4OVaWaZ.js → sankeyDiagram-5OEKKPKP-DU6G4VWR.js} +1 -1
  286. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-DIluIcb1.js → sequenceDiagram-3UESZ5HK-DdeRR_KJ.js} +1 -1
  287. package/web-shell/assets/{stateDiagram-AJRCARHV-hlhnuoYH.js → stateDiagram-AJRCARHV-C6iCI8ps.js} +1 -1
  288. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-C0_6nR6C.js +1 -0
  289. package/web-shell/assets/{timeline-definition-PNZ67QCA-Dqf_CqgL.js → timeline-definition-PNZ67QCA-B_Ea8Cb7.js} +1 -1
  290. package/web-shell/assets/{vennDiagram-CIIHVFJN-DD2QhaTX.js → vennDiagram-CIIHVFJN-BPUVZEJA.js} +1 -1
  291. package/web-shell/assets/{wardley-L42UT6IY-B2uI85U_.js → wardley-L42UT6IY-BWEj0lKY.js} +1 -1
  292. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-U1aJX71g.js → wardleyDiagram-YWT4CUSO-BvDsdIQw.js} +1 -1
  293. package/web-shell/assets/{xychartDiagram-2RQKCTM6-C0ODHUee.js → xychartDiagram-2RQKCTM6-crz0QhF_.js} +1 -1
  294. package/web-shell/index.html +2 -2
  295. package/chunks/chunk-CU3L64TP.js +0 -93
  296. package/chunks/initializer-UTQ7FB7G.js +0 -71
  297. package/chunks/list-DEICDL65.js +0 -74
  298. package/chunks/loadedSettingsAdapter-NOWEGDYJ.js +0 -68
  299. package/chunks/mcp-L5JXEEIA.js +0 -68
  300. package/chunks/nonInteractiveCli-LS2K4X6A.js +0 -124
  301. package/chunks/types-JNKGKUJT.js +0 -12
  302. package/chunks/workspace-providers-status-4KMGETOJ.js +0 -71
  303. package/chunks/workspace-service-RVLBMSMZ.js +0 -80
  304. package/chunks/workspace-skills-status-DS4ZVFTO.js +0 -70
  305. package/web-shell/assets/channel-CLiQD50f.js +0 -1
  306. package/web-shell/assets/classDiagram-4FO5ZUOK-D3sYqow5.js +0 -1
  307. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-D3sYqow5.js +0 -1
  308. package/web-shell/assets/index-D5IWFVk1.css +0 -5
  309. package/web-shell/assets/index-KFJRDhX7.js +0 -783
  310. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-BhQMwgpl.js +0 -1
@@ -0,0 +1,2980 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ __qwen_dirname,
5
+ init_esbuild_shims
6
+ } from "./chunk-5O2XNYP6.js";
7
+ import {
8
+ __commonJS,
9
+ __name,
10
+ __require
11
+ } from "./chunk-J2S4EL5Y.js";
12
+
13
+ // node_modules/web-tree-sitter/tree-sitter.js
14
+ var require_tree_sitter = __commonJS({
15
+ "node_modules/web-tree-sitter/tree-sitter.js"(exports, module) {
16
+ init_esbuild_shims();
17
+ var Module = typeof Module != "undefined" ? Module : {};
18
+ var ENVIRONMENT_IS_WEB = typeof window == "object";
19
+ var ENVIRONMENT_IS_WORKER = typeof importScripts == "function";
20
+ var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string";
21
+ if (ENVIRONMENT_IS_NODE) {
22
+ }
23
+ var TreeSitter = function() {
24
+ var initPromise;
25
+ var document = typeof window == "object" ? {
26
+ currentScript: window.document.currentScript
27
+ } : null;
28
+ class Parser {
29
+ static {
30
+ __name(this, "Parser");
31
+ }
32
+ constructor() {
33
+ this.initialize();
34
+ }
35
+ initialize() {
36
+ throw new Error("cannot construct a Parser before calling `init()`");
37
+ }
38
+ static init(moduleOptions) {
39
+ if (initPromise) return initPromise;
40
+ Module = Object.assign({}, Module, moduleOptions);
41
+ return initPromise = new Promise((resolveInitPromise) => {
42
+ var moduleOverrides = Object.assign({}, Module);
43
+ var arguments_ = [];
44
+ var thisProgram = "./this.program";
45
+ var quit_ = /* @__PURE__ */ __name((status, toThrow) => {
46
+ throw toThrow;
47
+ }, "quit_");
48
+ var scriptDirectory = "";
49
+ function locateFile(path) {
50
+ if (Module["locateFile"]) {
51
+ return Module["locateFile"](path, scriptDirectory);
52
+ }
53
+ return scriptDirectory + path;
54
+ }
55
+ __name(locateFile, "locateFile");
56
+ var readAsync, readBinary;
57
+ if (ENVIRONMENT_IS_NODE) {
58
+ var fs = __require("fs");
59
+ var nodePath = __require("path");
60
+ scriptDirectory = __qwen_dirname + "/";
61
+ readBinary = /* @__PURE__ */ __name((filename) => {
62
+ filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
63
+ var ret = fs.readFileSync(filename);
64
+ return ret;
65
+ }, "readBinary");
66
+ readAsync = /* @__PURE__ */ __name((filename, binary2 = true) => {
67
+ filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);
68
+ return new Promise((resolve, reject) => {
69
+ fs.readFile(filename, binary2 ? void 0 : "utf8", (err2, data) => {
70
+ if (err2) reject(err2);
71
+ else resolve(binary2 ? data.buffer : data);
72
+ });
73
+ });
74
+ }, "readAsync");
75
+ if (!Module["thisProgram"] && process.argv.length > 1) {
76
+ thisProgram = process.argv[1].replace(/\\/g, "/");
77
+ }
78
+ arguments_ = process.argv.slice(2);
79
+ if (typeof module != "undefined") {
80
+ module["exports"] = Module;
81
+ }
82
+ quit_ = /* @__PURE__ */ __name((status, toThrow) => {
83
+ process.exitCode = status;
84
+ throw toThrow;
85
+ }, "quit_");
86
+ } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
87
+ if (ENVIRONMENT_IS_WORKER) {
88
+ scriptDirectory = self.location.href;
89
+ } else if (typeof document != "undefined" && document.currentScript) {
90
+ scriptDirectory = document.currentScript.src;
91
+ }
92
+ if (scriptDirectory.startsWith("blob:")) {
93
+ scriptDirectory = "";
94
+ } else {
95
+ scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
96
+ }
97
+ {
98
+ if (ENVIRONMENT_IS_WORKER) {
99
+ readBinary = /* @__PURE__ */ __name((url) => {
100
+ var xhr = new XMLHttpRequest();
101
+ xhr.open("GET", url, false);
102
+ xhr.responseType = "arraybuffer";
103
+ xhr.send(null);
104
+ return new Uint8Array(
105
+ /** @type{!ArrayBuffer} */
106
+ xhr.response
107
+ );
108
+ }, "readBinary");
109
+ }
110
+ readAsync = /* @__PURE__ */ __name((url) => {
111
+ if (isFileURI(url)) {
112
+ return new Promise((reject, resolve) => {
113
+ var xhr = new XMLHttpRequest();
114
+ xhr.open("GET", url, true);
115
+ xhr.responseType = "arraybuffer";
116
+ xhr.onload = () => {
117
+ if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
118
+ resolve(xhr.response);
119
+ }
120
+ reject(xhr.status);
121
+ };
122
+ xhr.onerror = reject;
123
+ xhr.send(null);
124
+ });
125
+ }
126
+ return fetch(url, {
127
+ credentials: "same-origin"
128
+ }).then((response) => {
129
+ if (response.ok) {
130
+ return response.arrayBuffer();
131
+ }
132
+ return Promise.reject(new Error(response.status + " : " + response.url));
133
+ });
134
+ }, "readAsync");
135
+ }
136
+ } else {
137
+ }
138
+ var out = Module["print"] || console.log.bind(console);
139
+ var err = Module["printErr"] || console.error.bind(console);
140
+ Object.assign(Module, moduleOverrides);
141
+ moduleOverrides = null;
142
+ if (Module["arguments"]) arguments_ = Module["arguments"];
143
+ if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
144
+ if (Module["quit"]) quit_ = Module["quit"];
145
+ var dynamicLibraries = Module["dynamicLibraries"] || [];
146
+ var wasmBinary;
147
+ if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
148
+ var wasmMemory;
149
+ var ABORT = false;
150
+ var EXITSTATUS;
151
+ var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
152
+ var HEAP_DATA_VIEW;
153
+ function updateMemoryViews() {
154
+ var b = wasmMemory.buffer;
155
+ Module["HEAP_DATA_VIEW"] = HEAP_DATA_VIEW = new DataView(b);
156
+ Module["HEAP8"] = HEAP8 = new Int8Array(b);
157
+ Module["HEAP16"] = HEAP16 = new Int16Array(b);
158
+ Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
159
+ Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
160
+ Module["HEAP32"] = HEAP32 = new Int32Array(b);
161
+ Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
162
+ Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
163
+ Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
164
+ }
165
+ __name(updateMemoryViews, "updateMemoryViews");
166
+ if (Module["wasmMemory"]) {
167
+ wasmMemory = Module["wasmMemory"];
168
+ } else {
169
+ var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 33554432;
170
+ wasmMemory = new WebAssembly.Memory({
171
+ "initial": INITIAL_MEMORY / 65536,
172
+ // In theory we should not need to emit the maximum if we want "unlimited"
173
+ // or 4GB of memory, but VMs error on that atm, see
174
+ // https://github.com/emscripten-core/emscripten/issues/14130
175
+ // And in the pthreads case we definitely need to emit a maximum. So
176
+ // always emit one.
177
+ "maximum": 2147483648 / 65536
178
+ });
179
+ }
180
+ updateMemoryViews();
181
+ var __ATPRERUN__ = [];
182
+ var __ATINIT__ = [];
183
+ var __ATMAIN__ = [];
184
+ var __ATPOSTRUN__ = [];
185
+ var __RELOC_FUNCS__ = [];
186
+ var runtimeInitialized = false;
187
+ function preRun() {
188
+ if (Module["preRun"]) {
189
+ if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
190
+ while (Module["preRun"].length) {
191
+ addOnPreRun(Module["preRun"].shift());
192
+ }
193
+ }
194
+ callRuntimeCallbacks(__ATPRERUN__);
195
+ }
196
+ __name(preRun, "preRun");
197
+ function initRuntime() {
198
+ runtimeInitialized = true;
199
+ callRuntimeCallbacks(__RELOC_FUNCS__);
200
+ callRuntimeCallbacks(__ATINIT__);
201
+ }
202
+ __name(initRuntime, "initRuntime");
203
+ function preMain() {
204
+ callRuntimeCallbacks(__ATMAIN__);
205
+ }
206
+ __name(preMain, "preMain");
207
+ function postRun() {
208
+ if (Module["postRun"]) {
209
+ if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
210
+ while (Module["postRun"].length) {
211
+ addOnPostRun(Module["postRun"].shift());
212
+ }
213
+ }
214
+ callRuntimeCallbacks(__ATPOSTRUN__);
215
+ }
216
+ __name(postRun, "postRun");
217
+ function addOnPreRun(cb) {
218
+ __ATPRERUN__.unshift(cb);
219
+ }
220
+ __name(addOnPreRun, "addOnPreRun");
221
+ function addOnInit(cb) {
222
+ __ATINIT__.unshift(cb);
223
+ }
224
+ __name(addOnInit, "addOnInit");
225
+ function addOnPostRun(cb) {
226
+ __ATPOSTRUN__.unshift(cb);
227
+ }
228
+ __name(addOnPostRun, "addOnPostRun");
229
+ var runDependencies = 0;
230
+ var runDependencyWatcher = null;
231
+ var dependenciesFulfilled = null;
232
+ function getUniqueRunDependency(id) {
233
+ return id;
234
+ }
235
+ __name(getUniqueRunDependency, "getUniqueRunDependency");
236
+ function addRunDependency(id) {
237
+ runDependencies++;
238
+ Module["monitorRunDependencies"]?.(runDependencies);
239
+ }
240
+ __name(addRunDependency, "addRunDependency");
241
+ function removeRunDependency(id) {
242
+ runDependencies--;
243
+ Module["monitorRunDependencies"]?.(runDependencies);
244
+ if (runDependencies == 0) {
245
+ if (runDependencyWatcher !== null) {
246
+ clearInterval(runDependencyWatcher);
247
+ runDependencyWatcher = null;
248
+ }
249
+ if (dependenciesFulfilled) {
250
+ var callback = dependenciesFulfilled;
251
+ dependenciesFulfilled = null;
252
+ callback();
253
+ }
254
+ }
255
+ }
256
+ __name(removeRunDependency, "removeRunDependency");
257
+ function abort(what) {
258
+ Module["onAbort"]?.(what);
259
+ what = "Aborted(" + what + ")";
260
+ err(what);
261
+ ABORT = true;
262
+ EXITSTATUS = 1;
263
+ what += ". Build with -sASSERTIONS for more info.";
264
+ var e = new WebAssembly.RuntimeError(what);
265
+ throw e;
266
+ }
267
+ __name(abort, "abort");
268
+ var dataURIPrefix = "data:application/octet-stream;base64,";
269
+ var isDataURI = /* @__PURE__ */ __name((filename) => filename.startsWith(dataURIPrefix), "isDataURI");
270
+ var isFileURI = /* @__PURE__ */ __name((filename) => filename.startsWith("file://"), "isFileURI");
271
+ function findWasmBinary() {
272
+ var f = "tree-sitter.wasm";
273
+ if (!isDataURI(f)) {
274
+ return locateFile(f);
275
+ }
276
+ return f;
277
+ }
278
+ __name(findWasmBinary, "findWasmBinary");
279
+ var wasmBinaryFile;
280
+ function getBinarySync(file) {
281
+ if (file == wasmBinaryFile && wasmBinary) {
282
+ return new Uint8Array(wasmBinary);
283
+ }
284
+ if (readBinary) {
285
+ return readBinary(file);
286
+ }
287
+ throw "both async and sync fetching of the wasm failed";
288
+ }
289
+ __name(getBinarySync, "getBinarySync");
290
+ function getBinaryPromise(binaryFile) {
291
+ if (!wasmBinary) {
292
+ return readAsync(binaryFile).then(
293
+ (response) => new Uint8Array(
294
+ /** @type{!ArrayBuffer} */
295
+ response
296
+ ),
297
+ // Fall back to getBinarySync if readAsync fails
298
+ () => getBinarySync(binaryFile)
299
+ );
300
+ }
301
+ return Promise.resolve().then(() => getBinarySync(binaryFile));
302
+ }
303
+ __name(getBinaryPromise, "getBinaryPromise");
304
+ function instantiateArrayBuffer(binaryFile, imports, receiver) {
305
+ return getBinaryPromise(binaryFile).then((binary2) => WebAssembly.instantiate(binary2, imports)).then(receiver, (reason) => {
306
+ err(`failed to asynchronously prepare wasm: ${reason}`);
307
+ abort(reason);
308
+ });
309
+ }
310
+ __name(instantiateArrayBuffer, "instantiateArrayBuffer");
311
+ function instantiateAsync(binary2, binaryFile, imports, callback) {
312
+ if (!binary2 && typeof WebAssembly.instantiateStreaming == "function" && !isDataURI(binaryFile) && // Don't use streaming for file:// delivered objects in a webview, fetch them synchronously.
313
+ !isFileURI(binaryFile) && // Avoid instantiateStreaming() on Node.js environment for now, as while
314
+ // Node.js v18.1.0 implements it, it does not have a full fetch()
315
+ // implementation yet.
316
+ // Reference:
317
+ // https://github.com/emscripten-core/emscripten/pull/16917
318
+ !ENVIRONMENT_IS_NODE && typeof fetch == "function") {
319
+ return fetch(binaryFile, {
320
+ credentials: "same-origin"
321
+ }).then((response) => {
322
+ var result = WebAssembly.instantiateStreaming(response, imports);
323
+ return result.then(callback, function(reason) {
324
+ err(`wasm streaming compile failed: ${reason}`);
325
+ err("falling back to ArrayBuffer instantiation");
326
+ return instantiateArrayBuffer(binaryFile, imports, callback);
327
+ });
328
+ });
329
+ }
330
+ return instantiateArrayBuffer(binaryFile, imports, callback);
331
+ }
332
+ __name(instantiateAsync, "instantiateAsync");
333
+ function getWasmImports() {
334
+ return {
335
+ "env": wasmImports,
336
+ "wasi_snapshot_preview1": wasmImports,
337
+ "GOT.mem": new Proxy(wasmImports, GOTHandler),
338
+ "GOT.func": new Proxy(wasmImports, GOTHandler)
339
+ };
340
+ }
341
+ __name(getWasmImports, "getWasmImports");
342
+ function createWasm() {
343
+ var info2 = getWasmImports();
344
+ function receiveInstance(instance2, module2) {
345
+ wasmExports = instance2.exports;
346
+ wasmExports = relocateExports(wasmExports, 1024);
347
+ var metadata2 = getDylinkMetadata(module2);
348
+ if (metadata2.neededDynlibs) {
349
+ dynamicLibraries = metadata2.neededDynlibs.concat(dynamicLibraries);
350
+ }
351
+ mergeLibSymbols(wasmExports, "main");
352
+ LDSO.init();
353
+ loadDylibs();
354
+ addOnInit(wasmExports["__wasm_call_ctors"]);
355
+ __RELOC_FUNCS__.push(wasmExports["__wasm_apply_data_relocs"]);
356
+ removeRunDependency("wasm-instantiate");
357
+ return wasmExports;
358
+ }
359
+ __name(receiveInstance, "receiveInstance");
360
+ addRunDependency("wasm-instantiate");
361
+ function receiveInstantiationResult(result) {
362
+ receiveInstance(result["instance"], result["module"]);
363
+ }
364
+ __name(receiveInstantiationResult, "receiveInstantiationResult");
365
+ if (Module["instantiateWasm"]) {
366
+ try {
367
+ return Module["instantiateWasm"](info2, receiveInstance);
368
+ } catch (e) {
369
+ err(`Module.instantiateWasm callback failed with error: ${e}`);
370
+ return false;
371
+ }
372
+ }
373
+ if (!wasmBinaryFile) wasmBinaryFile = findWasmBinary();
374
+ instantiateAsync(wasmBinary, wasmBinaryFile, info2, receiveInstantiationResult);
375
+ return {};
376
+ }
377
+ __name(createWasm, "createWasm");
378
+ var ASM_CONSTS = {};
379
+ function ExitStatus(status) {
380
+ this.name = "ExitStatus";
381
+ this.message = `Program terminated with exit(${status})`;
382
+ this.status = status;
383
+ }
384
+ __name(ExitStatus, "ExitStatus");
385
+ var GOT = {};
386
+ var currentModuleWeakSymbols = /* @__PURE__ */ new Set([]);
387
+ var GOTHandler = {
388
+ get(obj, symName) {
389
+ var rtn = GOT[symName];
390
+ if (!rtn) {
391
+ rtn = GOT[symName] = new WebAssembly.Global({
392
+ "value": "i32",
393
+ "mutable": true
394
+ });
395
+ }
396
+ if (!currentModuleWeakSymbols.has(symName)) {
397
+ rtn.required = true;
398
+ }
399
+ return rtn;
400
+ }
401
+ };
402
+ var LE_HEAP_LOAD_F32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat32(byteOffset, true), "LE_HEAP_LOAD_F32");
403
+ var LE_HEAP_LOAD_F64 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getFloat64(byteOffset, true), "LE_HEAP_LOAD_F64");
404
+ var LE_HEAP_LOAD_I16 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt16(byteOffset, true), "LE_HEAP_LOAD_I16");
405
+ var LE_HEAP_LOAD_I32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getInt32(byteOffset, true), "LE_HEAP_LOAD_I32");
406
+ var LE_HEAP_LOAD_U32 = /* @__PURE__ */ __name((byteOffset) => HEAP_DATA_VIEW.getUint32(byteOffset, true), "LE_HEAP_LOAD_U32");
407
+ var LE_HEAP_STORE_F32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat32(byteOffset, value, true), "LE_HEAP_STORE_F32");
408
+ var LE_HEAP_STORE_F64 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setFloat64(byteOffset, value, true), "LE_HEAP_STORE_F64");
409
+ var LE_HEAP_STORE_I16 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt16(byteOffset, value, true), "LE_HEAP_STORE_I16");
410
+ var LE_HEAP_STORE_I32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setInt32(byteOffset, value, true), "LE_HEAP_STORE_I32");
411
+ var LE_HEAP_STORE_U32 = /* @__PURE__ */ __name((byteOffset, value) => HEAP_DATA_VIEW.setUint32(byteOffset, value, true), "LE_HEAP_STORE_U32");
412
+ var callRuntimeCallbacks = /* @__PURE__ */ __name((callbacks) => {
413
+ while (callbacks.length > 0) {
414
+ callbacks.shift()(Module);
415
+ }
416
+ }, "callRuntimeCallbacks");
417
+ var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder() : void 0;
418
+ var UTF8ArrayToString = /* @__PURE__ */ __name((heapOrArray, idx, maxBytesToRead) => {
419
+ var endIdx = idx + maxBytesToRead;
420
+ var endPtr = idx;
421
+ while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
422
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
423
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
424
+ }
425
+ var str = "";
426
+ while (idx < endPtr) {
427
+ var u0 = heapOrArray[idx++];
428
+ if (!(u0 & 128)) {
429
+ str += String.fromCharCode(u0);
430
+ continue;
431
+ }
432
+ var u1 = heapOrArray[idx++] & 63;
433
+ if ((u0 & 224) == 192) {
434
+ str += String.fromCharCode((u0 & 31) << 6 | u1);
435
+ continue;
436
+ }
437
+ var u2 = heapOrArray[idx++] & 63;
438
+ if ((u0 & 240) == 224) {
439
+ u0 = (u0 & 15) << 12 | u1 << 6 | u2;
440
+ } else {
441
+ u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
442
+ }
443
+ if (u0 < 65536) {
444
+ str += String.fromCharCode(u0);
445
+ } else {
446
+ var ch = u0 - 65536;
447
+ str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
448
+ }
449
+ }
450
+ return str;
451
+ }, "UTF8ArrayToString");
452
+ var getDylinkMetadata = /* @__PURE__ */ __name((binary2) => {
453
+ var offset = 0;
454
+ var end = 0;
455
+ function getU8() {
456
+ return binary2[offset++];
457
+ }
458
+ __name(getU8, "getU8");
459
+ function getLEB() {
460
+ var ret = 0;
461
+ var mul = 1;
462
+ while (1) {
463
+ var byte = binary2[offset++];
464
+ ret += (byte & 127) * mul;
465
+ mul *= 128;
466
+ if (!(byte & 128)) break;
467
+ }
468
+ return ret;
469
+ }
470
+ __name(getLEB, "getLEB");
471
+ function getString() {
472
+ var len = getLEB();
473
+ offset += len;
474
+ return UTF8ArrayToString(binary2, offset - len, len);
475
+ }
476
+ __name(getString, "getString");
477
+ function failIf(condition, message) {
478
+ if (condition) throw new Error(message);
479
+ }
480
+ __name(failIf, "failIf");
481
+ var name2 = "dylink.0";
482
+ if (binary2 instanceof WebAssembly.Module) {
483
+ var dylinkSection = WebAssembly.Module.customSections(binary2, name2);
484
+ if (dylinkSection.length === 0) {
485
+ name2 = "dylink";
486
+ dylinkSection = WebAssembly.Module.customSections(binary2, name2);
487
+ }
488
+ failIf(dylinkSection.length === 0, "need dylink section");
489
+ binary2 = new Uint8Array(dylinkSection[0]);
490
+ end = binary2.length;
491
+ } else {
492
+ var int32View = new Uint32Array(new Uint8Array(binary2.subarray(0, 24)).buffer);
493
+ var magicNumberFound = int32View[0] == 1836278016 || int32View[0] == 6386541;
494
+ failIf(!magicNumberFound, "need to see wasm magic number");
495
+ failIf(binary2[8] !== 0, "need the dylink section to be first");
496
+ offset = 9;
497
+ var section_size = getLEB();
498
+ end = offset + section_size;
499
+ name2 = getString();
500
+ }
501
+ var customSection = {
502
+ neededDynlibs: [],
503
+ tlsExports: /* @__PURE__ */ new Set(),
504
+ weakImports: /* @__PURE__ */ new Set()
505
+ };
506
+ if (name2 == "dylink") {
507
+ customSection.memorySize = getLEB();
508
+ customSection.memoryAlign = getLEB();
509
+ customSection.tableSize = getLEB();
510
+ customSection.tableAlign = getLEB();
511
+ var neededDynlibsCount = getLEB();
512
+ for (var i2 = 0; i2 < neededDynlibsCount; ++i2) {
513
+ var libname = getString();
514
+ customSection.neededDynlibs.push(libname);
515
+ }
516
+ } else {
517
+ failIf(name2 !== "dylink.0");
518
+ var WASM_DYLINK_MEM_INFO = 1;
519
+ var WASM_DYLINK_NEEDED = 2;
520
+ var WASM_DYLINK_EXPORT_INFO = 3;
521
+ var WASM_DYLINK_IMPORT_INFO = 4;
522
+ var WASM_SYMBOL_TLS = 256;
523
+ var WASM_SYMBOL_BINDING_MASK = 3;
524
+ var WASM_SYMBOL_BINDING_WEAK = 1;
525
+ while (offset < end) {
526
+ var subsectionType = getU8();
527
+ var subsectionSize = getLEB();
528
+ if (subsectionType === WASM_DYLINK_MEM_INFO) {
529
+ customSection.memorySize = getLEB();
530
+ customSection.memoryAlign = getLEB();
531
+ customSection.tableSize = getLEB();
532
+ customSection.tableAlign = getLEB();
533
+ } else if (subsectionType === WASM_DYLINK_NEEDED) {
534
+ var neededDynlibsCount = getLEB();
535
+ for (var i2 = 0; i2 < neededDynlibsCount; ++i2) {
536
+ libname = getString();
537
+ customSection.neededDynlibs.push(libname);
538
+ }
539
+ } else if (subsectionType === WASM_DYLINK_EXPORT_INFO) {
540
+ var count = getLEB();
541
+ while (count--) {
542
+ var symname = getString();
543
+ var flags2 = getLEB();
544
+ if (flags2 & WASM_SYMBOL_TLS) {
545
+ customSection.tlsExports.add(symname);
546
+ }
547
+ }
548
+ } else if (subsectionType === WASM_DYLINK_IMPORT_INFO) {
549
+ var count = getLEB();
550
+ while (count--) {
551
+ var modname = getString();
552
+ var symname = getString();
553
+ var flags2 = getLEB();
554
+ if ((flags2 & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {
555
+ customSection.weakImports.add(symname);
556
+ }
557
+ }
558
+ } else {
559
+ offset += subsectionSize;
560
+ }
561
+ }
562
+ }
563
+ return customSection;
564
+ }, "getDylinkMetadata");
565
+ function getValue(ptr, type = "i8") {
566
+ if (type.endsWith("*")) type = "*";
567
+ switch (type) {
568
+ case "i1":
569
+ return HEAP8[ptr];
570
+ case "i8":
571
+ return HEAP8[ptr];
572
+ case "i16":
573
+ return LE_HEAP_LOAD_I16((ptr >> 1) * 2);
574
+ case "i32":
575
+ return LE_HEAP_LOAD_I32((ptr >> 2) * 4);
576
+ case "i64":
577
+ abort("to do getValue(i64) use WASM_BIGINT");
578
+ case "float":
579
+ return LE_HEAP_LOAD_F32((ptr >> 2) * 4);
580
+ case "double":
581
+ return LE_HEAP_LOAD_F64((ptr >> 3) * 8);
582
+ case "*":
583
+ return LE_HEAP_LOAD_U32((ptr >> 2) * 4);
584
+ default:
585
+ abort(`invalid type for getValue: ${type}`);
586
+ }
587
+ }
588
+ __name(getValue, "getValue");
589
+ var newDSO = /* @__PURE__ */ __name((name2, handle2, syms) => {
590
+ var dso = {
591
+ refcount: Infinity,
592
+ name: name2,
593
+ exports: syms,
594
+ global: true
595
+ };
596
+ LDSO.loadedLibsByName[name2] = dso;
597
+ if (handle2 != void 0) {
598
+ LDSO.loadedLibsByHandle[handle2] = dso;
599
+ }
600
+ return dso;
601
+ }, "newDSO");
602
+ var LDSO = {
603
+ loadedLibsByName: {},
604
+ loadedLibsByHandle: {},
605
+ init() {
606
+ newDSO("__main__", 0, wasmImports);
607
+ }
608
+ };
609
+ var ___heap_base = 78112;
610
+ var zeroMemory = /* @__PURE__ */ __name((address, size) => {
611
+ HEAPU8.fill(0, address, address + size);
612
+ return address;
613
+ }, "zeroMemory");
614
+ var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
615
+ var getMemory = /* @__PURE__ */ __name((size) => {
616
+ if (runtimeInitialized) {
617
+ return zeroMemory(_malloc(size), size);
618
+ }
619
+ var ret = ___heap_base;
620
+ var end = ret + alignMemory(size, 16);
621
+ ___heap_base = end;
622
+ GOT["__heap_base"].value = end;
623
+ return ret;
624
+ }, "getMemory");
625
+ var isInternalSym = /* @__PURE__ */ __name((symName) => ["__cpp_exception", "__c_longjmp", "__wasm_apply_data_relocs", "__dso_handle", "__tls_size", "__tls_align", "__set_stack_limits", "_emscripten_tls_init", "__wasm_init_tls", "__wasm_call_ctors", "__start_em_asm", "__stop_em_asm", "__start_em_js", "__stop_em_js"].includes(symName) || symName.startsWith("__em_js__"), "isInternalSym");
626
+ var uleb128Encode = /* @__PURE__ */ __name((n, target) => {
627
+ if (n < 128) {
628
+ target.push(n);
629
+ } else {
630
+ target.push(n % 128 | 128, n >> 7);
631
+ }
632
+ }, "uleb128Encode");
633
+ var sigToWasmTypes = /* @__PURE__ */ __name((sig) => {
634
+ var typeNames = {
635
+ "i": "i32",
636
+ "j": "i64",
637
+ "f": "f32",
638
+ "d": "f64",
639
+ "e": "externref",
640
+ "p": "i32"
641
+ };
642
+ var type = {
643
+ parameters: [],
644
+ results: sig[0] == "v" ? [] : [typeNames[sig[0]]]
645
+ };
646
+ for (var i2 = 1; i2 < sig.length; ++i2) {
647
+ type.parameters.push(typeNames[sig[i2]]);
648
+ }
649
+ return type;
650
+ }, "sigToWasmTypes");
651
+ var generateFuncType = /* @__PURE__ */ __name((sig, target) => {
652
+ var sigRet = sig.slice(0, 1);
653
+ var sigParam = sig.slice(1);
654
+ var typeCodes = {
655
+ "i": 127,
656
+ // i32
657
+ "p": 127,
658
+ // i32
659
+ "j": 126,
660
+ // i64
661
+ "f": 125,
662
+ // f32
663
+ "d": 124,
664
+ // f64
665
+ "e": 111
666
+ };
667
+ target.push(96);
668
+ uleb128Encode(sigParam.length, target);
669
+ for (var i2 = 0; i2 < sigParam.length; ++i2) {
670
+ target.push(typeCodes[sigParam[i2]]);
671
+ }
672
+ if (sigRet == "v") {
673
+ target.push(0);
674
+ } else {
675
+ target.push(1, typeCodes[sigRet]);
676
+ }
677
+ }, "generateFuncType");
678
+ var convertJsFunctionToWasm = /* @__PURE__ */ __name((func2, sig) => {
679
+ if (typeof WebAssembly.Function == "function") {
680
+ return new WebAssembly.Function(sigToWasmTypes(sig), func2);
681
+ }
682
+ var typeSectionBody = [1];
683
+ generateFuncType(sig, typeSectionBody);
684
+ var bytes = [
685
+ 0,
686
+ 97,
687
+ 115,
688
+ 109,
689
+ // magic ("\0asm")
690
+ 1,
691
+ 0,
692
+ 0,
693
+ 0,
694
+ // version: 1
695
+ 1
696
+ ];
697
+ uleb128Encode(typeSectionBody.length, bytes);
698
+ bytes.push(...typeSectionBody);
699
+ bytes.push(
700
+ 2,
701
+ 7,
702
+ // import section
703
+ // (import "e" "f" (func 0 (type 0)))
704
+ 1,
705
+ 1,
706
+ 101,
707
+ 1,
708
+ 102,
709
+ 0,
710
+ 0,
711
+ 7,
712
+ 5,
713
+ // export section
714
+ // (export "f" (func 0 (type 0)))
715
+ 1,
716
+ 1,
717
+ 102,
718
+ 0,
719
+ 0
720
+ );
721
+ var module2 = new WebAssembly.Module(new Uint8Array(bytes));
722
+ var instance2 = new WebAssembly.Instance(module2, {
723
+ "e": {
724
+ "f": func2
725
+ }
726
+ });
727
+ var wrappedFunc = instance2.exports["f"];
728
+ return wrappedFunc;
729
+ }, "convertJsFunctionToWasm");
730
+ var wasmTableMirror = [];
731
+ var wasmTable = new WebAssembly.Table({
732
+ "initial": 28,
733
+ "element": "anyfunc"
734
+ });
735
+ var getWasmTableEntry = /* @__PURE__ */ __name((funcPtr) => {
736
+ var func2 = wasmTableMirror[funcPtr];
737
+ if (!func2) {
738
+ if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
739
+ wasmTableMirror[funcPtr] = func2 = wasmTable.get(funcPtr);
740
+ }
741
+ return func2;
742
+ }, "getWasmTableEntry");
743
+ var updateTableMap = /* @__PURE__ */ __name((offset, count) => {
744
+ if (functionsInTableMap) {
745
+ for (var i2 = offset; i2 < offset + count; i2++) {
746
+ var item = getWasmTableEntry(i2);
747
+ if (item) {
748
+ functionsInTableMap.set(item, i2);
749
+ }
750
+ }
751
+ }
752
+ }, "updateTableMap");
753
+ var functionsInTableMap;
754
+ var getFunctionAddress = /* @__PURE__ */ __name((func2) => {
755
+ if (!functionsInTableMap) {
756
+ functionsInTableMap = /* @__PURE__ */ new WeakMap();
757
+ updateTableMap(0, wasmTable.length);
758
+ }
759
+ return functionsInTableMap.get(func2) || 0;
760
+ }, "getFunctionAddress");
761
+ var freeTableIndexes = [];
762
+ var getEmptyTableSlot = /* @__PURE__ */ __name(() => {
763
+ if (freeTableIndexes.length) {
764
+ return freeTableIndexes.pop();
765
+ }
766
+ try {
767
+ wasmTable.grow(1);
768
+ } catch (err2) {
769
+ if (!(err2 instanceof RangeError)) {
770
+ throw err2;
771
+ }
772
+ throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
773
+ }
774
+ return wasmTable.length - 1;
775
+ }, "getEmptyTableSlot");
776
+ var setWasmTableEntry = /* @__PURE__ */ __name((idx, func2) => {
777
+ wasmTable.set(idx, func2);
778
+ wasmTableMirror[idx] = wasmTable.get(idx);
779
+ }, "setWasmTableEntry");
780
+ var addFunction = /* @__PURE__ */ __name((func2, sig) => {
781
+ var rtn = getFunctionAddress(func2);
782
+ if (rtn) {
783
+ return rtn;
784
+ }
785
+ var ret = getEmptyTableSlot();
786
+ try {
787
+ setWasmTableEntry(ret, func2);
788
+ } catch (err2) {
789
+ if (!(err2 instanceof TypeError)) {
790
+ throw err2;
791
+ }
792
+ var wrapped = convertJsFunctionToWasm(func2, sig);
793
+ setWasmTableEntry(ret, wrapped);
794
+ }
795
+ functionsInTableMap.set(func2, ret);
796
+ return ret;
797
+ }, "addFunction");
798
+ var updateGOT = /* @__PURE__ */ __name((exports2, replace) => {
799
+ for (var symName in exports2) {
800
+ if (isInternalSym(symName)) {
801
+ continue;
802
+ }
803
+ var value = exports2[symName];
804
+ if (symName.startsWith("orig$")) {
805
+ symName = symName.split("$")[1];
806
+ replace = true;
807
+ }
808
+ GOT[symName] ||= new WebAssembly.Global({
809
+ "value": "i32",
810
+ "mutable": true
811
+ });
812
+ if (replace || GOT[symName].value == 0) {
813
+ if (typeof value == "function") {
814
+ GOT[symName].value = addFunction(value);
815
+ } else if (typeof value == "number") {
816
+ GOT[symName].value = value;
817
+ } else {
818
+ err(`unhandled export type for '${symName}': ${typeof value}`);
819
+ }
820
+ }
821
+ }
822
+ }, "updateGOT");
823
+ var relocateExports = /* @__PURE__ */ __name((exports2, memoryBase2, replace) => {
824
+ var relocated = {};
825
+ for (var e in exports2) {
826
+ var value = exports2[e];
827
+ if (typeof value == "object") {
828
+ value = value.value;
829
+ }
830
+ if (typeof value == "number") {
831
+ value += memoryBase2;
832
+ }
833
+ relocated[e] = value;
834
+ }
835
+ updateGOT(relocated, replace);
836
+ return relocated;
837
+ }, "relocateExports");
838
+ var isSymbolDefined = /* @__PURE__ */ __name((symName) => {
839
+ var existing = wasmImports[symName];
840
+ if (!existing || existing.stub) {
841
+ return false;
842
+ }
843
+ return true;
844
+ }, "isSymbolDefined");
845
+ var dynCallLegacy = /* @__PURE__ */ __name((sig, ptr, args2) => {
846
+ sig = sig.replace(/p/g, "i");
847
+ var f = Module["dynCall_" + sig];
848
+ return f(ptr, ...args2);
849
+ }, "dynCallLegacy");
850
+ var dynCall = /* @__PURE__ */ __name((sig, ptr, args2 = []) => {
851
+ if (sig.includes("j")) {
852
+ return dynCallLegacy(sig, ptr, args2);
853
+ }
854
+ var rtn = getWasmTableEntry(ptr)(...args2);
855
+ return rtn;
856
+ }, "dynCall");
857
+ var stackSave = /* @__PURE__ */ __name(() => _emscripten_stack_get_current(), "stackSave");
858
+ var stackRestore = /* @__PURE__ */ __name((val) => __emscripten_stack_restore(val), "stackRestore");
859
+ var createInvokeFunction = /* @__PURE__ */ __name((sig) => (ptr, ...args2) => {
860
+ var sp = stackSave();
861
+ try {
862
+ return dynCall(sig, ptr, args2);
863
+ } catch (e) {
864
+ stackRestore(sp);
865
+ if (e !== e + 0) throw e;
866
+ _setThrew(1, 0);
867
+ }
868
+ }, "createInvokeFunction");
869
+ var resolveGlobalSymbol = /* @__PURE__ */ __name((symName, direct = false) => {
870
+ var sym;
871
+ if (direct && "orig$" + symName in wasmImports) {
872
+ symName = "orig$" + symName;
873
+ }
874
+ if (isSymbolDefined(symName)) {
875
+ sym = wasmImports[symName];
876
+ } else if (symName.startsWith("invoke_")) {
877
+ sym = wasmImports[symName] = createInvokeFunction(symName.split("_")[1]);
878
+ }
879
+ return {
880
+ sym,
881
+ name: symName
882
+ };
883
+ }, "resolveGlobalSymbol");
884
+ var UTF8ToString = /* @__PURE__ */ __name((ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "", "UTF8ToString");
885
+ var loadWebAssemblyModule = /* @__PURE__ */ __name((binary, flags, libName, localScope, handle) => {
886
+ var metadata = getDylinkMetadata(binary);
887
+ currentModuleWeakSymbols = metadata.weakImports;
888
+ function loadModule() {
889
+ var firstLoad = !handle || !HEAP8[handle + 8];
890
+ if (firstLoad) {
891
+ var memAlign = Math.pow(2, metadata.memoryAlign);
892
+ var memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0;
893
+ var tableBase = metadata.tableSize ? wasmTable.length : 0;
894
+ if (handle) {
895
+ HEAP8[handle + 8] = 1;
896
+ LE_HEAP_STORE_U32((handle + 12 >> 2) * 4, memoryBase);
897
+ LE_HEAP_STORE_I32((handle + 16 >> 2) * 4, metadata.memorySize);
898
+ LE_HEAP_STORE_U32((handle + 20 >> 2) * 4, tableBase);
899
+ LE_HEAP_STORE_I32((handle + 24 >> 2) * 4, metadata.tableSize);
900
+ }
901
+ } else {
902
+ memoryBase = LE_HEAP_LOAD_U32((handle + 12 >> 2) * 4);
903
+ tableBase = LE_HEAP_LOAD_U32((handle + 20 >> 2) * 4);
904
+ }
905
+ var tableGrowthNeeded = tableBase + metadata.tableSize - wasmTable.length;
906
+ if (tableGrowthNeeded > 0) {
907
+ wasmTable.grow(tableGrowthNeeded);
908
+ }
909
+ var moduleExports;
910
+ function resolveSymbol(sym) {
911
+ var resolved = resolveGlobalSymbol(sym).sym;
912
+ if (!resolved && localScope) {
913
+ resolved = localScope[sym];
914
+ }
915
+ if (!resolved) {
916
+ resolved = moduleExports[sym];
917
+ }
918
+ return resolved;
919
+ }
920
+ __name(resolveSymbol, "resolveSymbol");
921
+ var proxyHandler = {
922
+ get(stubs, prop) {
923
+ switch (prop) {
924
+ case "__memory_base":
925
+ return memoryBase;
926
+ case "__table_base":
927
+ return tableBase;
928
+ }
929
+ if (prop in wasmImports && !wasmImports[prop].stub) {
930
+ return wasmImports[prop];
931
+ }
932
+ if (!(prop in stubs)) {
933
+ var resolved;
934
+ stubs[prop] = (...args2) => {
935
+ resolved ||= resolveSymbol(prop);
936
+ return resolved(...args2);
937
+ };
938
+ }
939
+ return stubs[prop];
940
+ }
941
+ };
942
+ var proxy = new Proxy({}, proxyHandler);
943
+ var info = {
944
+ "GOT.mem": new Proxy({}, GOTHandler),
945
+ "GOT.func": new Proxy({}, GOTHandler),
946
+ "env": proxy,
947
+ "wasi_snapshot_preview1": proxy
948
+ };
949
+ function postInstantiation(module, instance) {
950
+ updateTableMap(tableBase, metadata.tableSize);
951
+ moduleExports = relocateExports(instance.exports, memoryBase);
952
+ if (!flags.allowUndefined) {
953
+ reportUndefinedSymbols();
954
+ }
955
+ function addEmAsm(addr, body) {
956
+ var args = [];
957
+ var arity = 0;
958
+ for (; arity < 16; arity++) {
959
+ if (body.indexOf("$" + arity) != -1) {
960
+ args.push("$" + arity);
961
+ } else {
962
+ break;
963
+ }
964
+ }
965
+ args = args.join(",");
966
+ var func = `(${args}) => { ${body} };`;
967
+ ASM_CONSTS[start] = eval(func);
968
+ }
969
+ __name(addEmAsm, "addEmAsm");
970
+ if ("__start_em_asm" in moduleExports) {
971
+ var start = moduleExports["__start_em_asm"];
972
+ var stop = moduleExports["__stop_em_asm"];
973
+ while (start < stop) {
974
+ var jsString = UTF8ToString(start);
975
+ addEmAsm(start, jsString);
976
+ start = HEAPU8.indexOf(0, start) + 1;
977
+ }
978
+ }
979
+ function addEmJs(name, cSig, body) {
980
+ var jsArgs = [];
981
+ cSig = cSig.slice(1, -1);
982
+ if (cSig != "void") {
983
+ cSig = cSig.split(",");
984
+ for (var i in cSig) {
985
+ var jsArg = cSig[i].split(" ").pop();
986
+ jsArgs.push(jsArg.replace("*", ""));
987
+ }
988
+ }
989
+ var func = `(${jsArgs}) => ${body};`;
990
+ moduleExports[name] = eval(func);
991
+ }
992
+ __name(addEmJs, "addEmJs");
993
+ for (var name in moduleExports) {
994
+ if (name.startsWith("__em_js__")) {
995
+ var start = moduleExports[name];
996
+ var jsString = UTF8ToString(start);
997
+ var parts = jsString.split("<::>");
998
+ addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]);
999
+ delete moduleExports[name];
1000
+ }
1001
+ }
1002
+ var applyRelocs = moduleExports["__wasm_apply_data_relocs"];
1003
+ if (applyRelocs) {
1004
+ if (runtimeInitialized) {
1005
+ applyRelocs();
1006
+ } else {
1007
+ __RELOC_FUNCS__.push(applyRelocs);
1008
+ }
1009
+ }
1010
+ var init = moduleExports["__wasm_call_ctors"];
1011
+ if (init) {
1012
+ if (runtimeInitialized) {
1013
+ init();
1014
+ } else {
1015
+ __ATINIT__.push(init);
1016
+ }
1017
+ }
1018
+ return moduleExports;
1019
+ }
1020
+ __name(postInstantiation, "postInstantiation");
1021
+ if (flags.loadAsync) {
1022
+ if (binary instanceof WebAssembly.Module) {
1023
+ var instance = new WebAssembly.Instance(binary, info);
1024
+ return Promise.resolve(postInstantiation(binary, instance));
1025
+ }
1026
+ return WebAssembly.instantiate(binary, info).then((result) => postInstantiation(result.module, result.instance));
1027
+ }
1028
+ var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary);
1029
+ var instance = new WebAssembly.Instance(module, info);
1030
+ return postInstantiation(module, instance);
1031
+ }
1032
+ __name(loadModule, "loadModule");
1033
+ if (flags.loadAsync) {
1034
+ return metadata.neededDynlibs.reduce((chain, dynNeeded) => chain.then(() => loadDynamicLibrary(dynNeeded, flags, localScope)), Promise.resolve()).then(loadModule);
1035
+ }
1036
+ metadata.neededDynlibs.forEach((needed) => loadDynamicLibrary(needed, flags, localScope));
1037
+ return loadModule();
1038
+ }, "loadWebAssemblyModule");
1039
+ var mergeLibSymbols = /* @__PURE__ */ __name((exports2, libName2) => {
1040
+ for (var [sym, exp] of Object.entries(exports2)) {
1041
+ const setImport = /* @__PURE__ */ __name((target) => {
1042
+ if (!isSymbolDefined(target)) {
1043
+ wasmImports[target] = exp;
1044
+ }
1045
+ }, "setImport");
1046
+ setImport(sym);
1047
+ const main_alias = "__main_argc_argv";
1048
+ if (sym == "main") {
1049
+ setImport(main_alias);
1050
+ }
1051
+ if (sym == main_alias) {
1052
+ setImport("main");
1053
+ }
1054
+ if (sym.startsWith("dynCall_") && !Module.hasOwnProperty(sym)) {
1055
+ Module[sym] = exp;
1056
+ }
1057
+ }
1058
+ }, "mergeLibSymbols");
1059
+ var asyncLoad = /* @__PURE__ */ __name((url, onload, onerror, noRunDep) => {
1060
+ var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : "";
1061
+ readAsync(url).then((arrayBuffer) => {
1062
+ onload(new Uint8Array(arrayBuffer));
1063
+ if (dep) removeRunDependency(dep);
1064
+ }, (err2) => {
1065
+ if (onerror) {
1066
+ onerror();
1067
+ } else {
1068
+ throw `Loading data file "${url}" failed.`;
1069
+ }
1070
+ });
1071
+ if (dep) addRunDependency(dep);
1072
+ }, "asyncLoad");
1073
+ function loadDynamicLibrary(libName2, flags2 = {
1074
+ global: true,
1075
+ nodelete: true
1076
+ }, localScope2, handle2) {
1077
+ var dso = LDSO.loadedLibsByName[libName2];
1078
+ if (dso) {
1079
+ if (!flags2.global) {
1080
+ if (localScope2) {
1081
+ Object.assign(localScope2, dso.exports);
1082
+ }
1083
+ } else if (!dso.global) {
1084
+ dso.global = true;
1085
+ mergeLibSymbols(dso.exports, libName2);
1086
+ }
1087
+ if (flags2.nodelete && dso.refcount !== Infinity) {
1088
+ dso.refcount = Infinity;
1089
+ }
1090
+ dso.refcount++;
1091
+ if (handle2) {
1092
+ LDSO.loadedLibsByHandle[handle2] = dso;
1093
+ }
1094
+ return flags2.loadAsync ? Promise.resolve(true) : true;
1095
+ }
1096
+ dso = newDSO(libName2, handle2, "loading");
1097
+ dso.refcount = flags2.nodelete ? Infinity : 1;
1098
+ dso.global = flags2.global;
1099
+ function loadLibData() {
1100
+ if (handle2) {
1101
+ var data = LE_HEAP_LOAD_U32((handle2 + 28 >> 2) * 4);
1102
+ var dataSize = LE_HEAP_LOAD_U32((handle2 + 32 >> 2) * 4);
1103
+ if (data && dataSize) {
1104
+ var libData = HEAP8.slice(data, data + dataSize);
1105
+ return flags2.loadAsync ? Promise.resolve(libData) : libData;
1106
+ }
1107
+ }
1108
+ var libFile = locateFile(libName2);
1109
+ if (flags2.loadAsync) {
1110
+ return new Promise(function(resolve, reject) {
1111
+ asyncLoad(libFile, resolve, reject);
1112
+ });
1113
+ }
1114
+ if (!readBinary) {
1115
+ throw new Error(`${libFile}: file not found, and synchronous loading of external files is not available`);
1116
+ }
1117
+ return readBinary(libFile);
1118
+ }
1119
+ __name(loadLibData, "loadLibData");
1120
+ function getExports() {
1121
+ if (flags2.loadAsync) {
1122
+ return loadLibData().then((libData) => loadWebAssemblyModule(libData, flags2, libName2, localScope2, handle2));
1123
+ }
1124
+ return loadWebAssemblyModule(loadLibData(), flags2, libName2, localScope2, handle2);
1125
+ }
1126
+ __name(getExports, "getExports");
1127
+ function moduleLoaded(exports2) {
1128
+ if (dso.global) {
1129
+ mergeLibSymbols(exports2, libName2);
1130
+ } else if (localScope2) {
1131
+ Object.assign(localScope2, exports2);
1132
+ }
1133
+ dso.exports = exports2;
1134
+ }
1135
+ __name(moduleLoaded, "moduleLoaded");
1136
+ if (flags2.loadAsync) {
1137
+ return getExports().then((exports2) => {
1138
+ moduleLoaded(exports2);
1139
+ return true;
1140
+ });
1141
+ }
1142
+ moduleLoaded(getExports());
1143
+ return true;
1144
+ }
1145
+ __name(loadDynamicLibrary, "loadDynamicLibrary");
1146
+ var reportUndefinedSymbols = /* @__PURE__ */ __name(() => {
1147
+ for (var [symName, entry] of Object.entries(GOT)) {
1148
+ if (entry.value == 0) {
1149
+ var value = resolveGlobalSymbol(symName, true).sym;
1150
+ if (!value && !entry.required) {
1151
+ continue;
1152
+ }
1153
+ if (typeof value == "function") {
1154
+ entry.value = addFunction(value, value.sig);
1155
+ } else if (typeof value == "number") {
1156
+ entry.value = value;
1157
+ } else {
1158
+ throw new Error(`bad export type for '${symName}': ${typeof value}`);
1159
+ }
1160
+ }
1161
+ }
1162
+ }, "reportUndefinedSymbols");
1163
+ var loadDylibs = /* @__PURE__ */ __name(() => {
1164
+ if (!dynamicLibraries.length) {
1165
+ reportUndefinedSymbols();
1166
+ return;
1167
+ }
1168
+ addRunDependency("loadDylibs");
1169
+ dynamicLibraries.reduce((chain, lib) => chain.then(() => loadDynamicLibrary(lib, {
1170
+ loadAsync: true,
1171
+ global: true,
1172
+ nodelete: true,
1173
+ allowUndefined: true
1174
+ })), Promise.resolve()).then(() => {
1175
+ reportUndefinedSymbols();
1176
+ removeRunDependency("loadDylibs");
1177
+ });
1178
+ }, "loadDylibs");
1179
+ var noExitRuntime = Module["noExitRuntime"] || true;
1180
+ function setValue(ptr, value, type = "i8") {
1181
+ if (type.endsWith("*")) type = "*";
1182
+ switch (type) {
1183
+ case "i1":
1184
+ HEAP8[ptr] = value;
1185
+ break;
1186
+ case "i8":
1187
+ HEAP8[ptr] = value;
1188
+ break;
1189
+ case "i16":
1190
+ LE_HEAP_STORE_I16((ptr >> 1) * 2, value);
1191
+ break;
1192
+ case "i32":
1193
+ LE_HEAP_STORE_I32((ptr >> 2) * 4, value);
1194
+ break;
1195
+ case "i64":
1196
+ abort("to do setValue(i64) use WASM_BIGINT");
1197
+ case "float":
1198
+ LE_HEAP_STORE_F32((ptr >> 2) * 4, value);
1199
+ break;
1200
+ case "double":
1201
+ LE_HEAP_STORE_F64((ptr >> 3) * 8, value);
1202
+ break;
1203
+ case "*":
1204
+ LE_HEAP_STORE_U32((ptr >> 2) * 4, value);
1205
+ break;
1206
+ default:
1207
+ abort(`invalid type for setValue: ${type}`);
1208
+ }
1209
+ }
1210
+ __name(setValue, "setValue");
1211
+ var ___memory_base = new WebAssembly.Global({
1212
+ "value": "i32",
1213
+ "mutable": false
1214
+ }, 1024);
1215
+ var ___stack_pointer = new WebAssembly.Global({
1216
+ "value": "i32",
1217
+ "mutable": true
1218
+ }, 78112);
1219
+ var ___table_base = new WebAssembly.Global({
1220
+ "value": "i32",
1221
+ "mutable": false
1222
+ }, 1);
1223
+ var __abort_js = /* @__PURE__ */ __name(() => {
1224
+ abort("");
1225
+ }, "__abort_js");
1226
+ __abort_js.sig = "v";
1227
+ var nowIsMonotonic = 1;
1228
+ var __emscripten_get_now_is_monotonic = /* @__PURE__ */ __name(() => nowIsMonotonic, "__emscripten_get_now_is_monotonic");
1229
+ __emscripten_get_now_is_monotonic.sig = "i";
1230
+ var __emscripten_memcpy_js = /* @__PURE__ */ __name((dest, src, num) => HEAPU8.copyWithin(dest, src, src + num), "__emscripten_memcpy_js");
1231
+ __emscripten_memcpy_js.sig = "vppp";
1232
+ var _emscripten_date_now = /* @__PURE__ */ __name(() => Date.now(), "_emscripten_date_now");
1233
+ _emscripten_date_now.sig = "d";
1234
+ var _emscripten_get_now;
1235
+ _emscripten_get_now = /* @__PURE__ */ __name(() => performance.now(), "_emscripten_get_now");
1236
+ _emscripten_get_now.sig = "d";
1237
+ var getHeapMax = /* @__PURE__ */ __name(() => (
1238
+ // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
1239
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
1240
+ // for any code that deals with heap sizes, which would require special
1241
+ // casing all heap size related code to treat 0 specially.
1242
+ 2147483648
1243
+ ), "getHeapMax");
1244
+ var growMemory = /* @__PURE__ */ __name((size) => {
1245
+ var b = wasmMemory.buffer;
1246
+ var pages = (size - b.byteLength + 65535) / 65536;
1247
+ try {
1248
+ wasmMemory.grow(pages);
1249
+ updateMemoryViews();
1250
+ return 1;
1251
+ } catch (e) {
1252
+ }
1253
+ }, "growMemory");
1254
+ var _emscripten_resize_heap = /* @__PURE__ */ __name((requestedSize) => {
1255
+ var oldSize = HEAPU8.length;
1256
+ requestedSize >>>= 0;
1257
+ var maxHeapSize = getHeapMax();
1258
+ if (requestedSize > maxHeapSize) {
1259
+ return false;
1260
+ }
1261
+ var alignUp = /* @__PURE__ */ __name((x, multiple) => x + (multiple - x % multiple) % multiple, "alignUp");
1262
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
1263
+ var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
1264
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
1265
+ var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536));
1266
+ var replacement = growMemory(newSize);
1267
+ if (replacement) {
1268
+ return true;
1269
+ }
1270
+ }
1271
+ return false;
1272
+ }, "_emscripten_resize_heap");
1273
+ _emscripten_resize_heap.sig = "ip";
1274
+ var _fd_close = /* @__PURE__ */ __name((fd) => 52, "_fd_close");
1275
+ _fd_close.sig = "ii";
1276
+ var convertI32PairToI53Checked = /* @__PURE__ */ __name((lo, hi) => hi + 2097152 >>> 0 < 4194305 - !!lo ? (lo >>> 0) + hi * 4294967296 : NaN, "convertI32PairToI53Checked");
1277
+ function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
1278
+ var offset = convertI32PairToI53Checked(offset_low, offset_high);
1279
+ return 70;
1280
+ }
1281
+ __name(_fd_seek, "_fd_seek");
1282
+ _fd_seek.sig = "iiiiip";
1283
+ var printCharBuffers = [null, [], []];
1284
+ var printChar = /* @__PURE__ */ __name((stream, curr) => {
1285
+ var buffer = printCharBuffers[stream];
1286
+ if (curr === 0 || curr === 10) {
1287
+ (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0));
1288
+ buffer.length = 0;
1289
+ } else {
1290
+ buffer.push(curr);
1291
+ }
1292
+ }, "printChar");
1293
+ var _fd_write = /* @__PURE__ */ __name((fd, iov, iovcnt, pnum) => {
1294
+ var num = 0;
1295
+ for (var i2 = 0; i2 < iovcnt; i2++) {
1296
+ var ptr = LE_HEAP_LOAD_U32((iov >> 2) * 4);
1297
+ var len = LE_HEAP_LOAD_U32((iov + 4 >> 2) * 4);
1298
+ iov += 8;
1299
+ for (var j = 0; j < len; j++) {
1300
+ printChar(fd, HEAPU8[ptr + j]);
1301
+ }
1302
+ num += len;
1303
+ }
1304
+ LE_HEAP_STORE_U32((pnum >> 2) * 4, num);
1305
+ return 0;
1306
+ }, "_fd_write");
1307
+ _fd_write.sig = "iippp";
1308
+ function _tree_sitter_log_callback(isLexMessage, messageAddress) {
1309
+ if (currentLogCallback) {
1310
+ const message = UTF8ToString(messageAddress);
1311
+ currentLogCallback(message, isLexMessage !== 0);
1312
+ }
1313
+ }
1314
+ __name(_tree_sitter_log_callback, "_tree_sitter_log_callback");
1315
+ function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
1316
+ const INPUT_BUFFER_SIZE = 10 * 1024;
1317
+ const string = currentParseCallback(index, {
1318
+ row,
1319
+ column
1320
+ });
1321
+ if (typeof string === "string") {
1322
+ setValue(lengthAddress, string.length, "i32");
1323
+ stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
1324
+ } else {
1325
+ setValue(lengthAddress, 0, "i32");
1326
+ }
1327
+ }
1328
+ __name(_tree_sitter_parse_callback, "_tree_sitter_parse_callback");
1329
+ var runtimeKeepaliveCounter = 0;
1330
+ var keepRuntimeAlive = /* @__PURE__ */ __name(() => noExitRuntime || runtimeKeepaliveCounter > 0, "keepRuntimeAlive");
1331
+ var _proc_exit = /* @__PURE__ */ __name((code) => {
1332
+ EXITSTATUS = code;
1333
+ if (!keepRuntimeAlive()) {
1334
+ Module["onExit"]?.(code);
1335
+ ABORT = true;
1336
+ }
1337
+ quit_(code, new ExitStatus(code));
1338
+ }, "_proc_exit");
1339
+ _proc_exit.sig = "vi";
1340
+ var exitJS = /* @__PURE__ */ __name((status, implicit) => {
1341
+ EXITSTATUS = status;
1342
+ _proc_exit(status);
1343
+ }, "exitJS");
1344
+ var handleException = /* @__PURE__ */ __name((e) => {
1345
+ if (e instanceof ExitStatus || e == "unwind") {
1346
+ return EXITSTATUS;
1347
+ }
1348
+ quit_(1, e);
1349
+ }, "handleException");
1350
+ var lengthBytesUTF8 = /* @__PURE__ */ __name((str) => {
1351
+ var len = 0;
1352
+ for (var i2 = 0; i2 < str.length; ++i2) {
1353
+ var c = str.charCodeAt(i2);
1354
+ if (c <= 127) {
1355
+ len++;
1356
+ } else if (c <= 2047) {
1357
+ len += 2;
1358
+ } else if (c >= 55296 && c <= 57343) {
1359
+ len += 4;
1360
+ ++i2;
1361
+ } else {
1362
+ len += 3;
1363
+ }
1364
+ }
1365
+ return len;
1366
+ }, "lengthBytesUTF8");
1367
+ var stringToUTF8Array = /* @__PURE__ */ __name((str, heap, outIdx, maxBytesToWrite) => {
1368
+ if (!(maxBytesToWrite > 0)) return 0;
1369
+ var startIdx = outIdx;
1370
+ var endIdx = outIdx + maxBytesToWrite - 1;
1371
+ for (var i2 = 0; i2 < str.length; ++i2) {
1372
+ var u = str.charCodeAt(i2);
1373
+ if (u >= 55296 && u <= 57343) {
1374
+ var u1 = str.charCodeAt(++i2);
1375
+ u = 65536 + ((u & 1023) << 10) | u1 & 1023;
1376
+ }
1377
+ if (u <= 127) {
1378
+ if (outIdx >= endIdx) break;
1379
+ heap[outIdx++] = u;
1380
+ } else if (u <= 2047) {
1381
+ if (outIdx + 1 >= endIdx) break;
1382
+ heap[outIdx++] = 192 | u >> 6;
1383
+ heap[outIdx++] = 128 | u & 63;
1384
+ } else if (u <= 65535) {
1385
+ if (outIdx + 2 >= endIdx) break;
1386
+ heap[outIdx++] = 224 | u >> 12;
1387
+ heap[outIdx++] = 128 | u >> 6 & 63;
1388
+ heap[outIdx++] = 128 | u & 63;
1389
+ } else {
1390
+ if (outIdx + 3 >= endIdx) break;
1391
+ heap[outIdx++] = 240 | u >> 18;
1392
+ heap[outIdx++] = 128 | u >> 12 & 63;
1393
+ heap[outIdx++] = 128 | u >> 6 & 63;
1394
+ heap[outIdx++] = 128 | u & 63;
1395
+ }
1396
+ }
1397
+ heap[outIdx] = 0;
1398
+ return outIdx - startIdx;
1399
+ }, "stringToUTF8Array");
1400
+ var stringToUTF8 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite), "stringToUTF8");
1401
+ var stackAlloc = /* @__PURE__ */ __name((sz) => __emscripten_stack_alloc(sz), "stackAlloc");
1402
+ var stringToUTF8OnStack = /* @__PURE__ */ __name((str) => {
1403
+ var size = lengthBytesUTF8(str) + 1;
1404
+ var ret = stackAlloc(size);
1405
+ stringToUTF8(str, ret, size);
1406
+ return ret;
1407
+ }, "stringToUTF8OnStack");
1408
+ var stringToUTF16 = /* @__PURE__ */ __name((str, outPtr, maxBytesToWrite) => {
1409
+ maxBytesToWrite ??= 2147483647;
1410
+ if (maxBytesToWrite < 2) return 0;
1411
+ maxBytesToWrite -= 2;
1412
+ var startPtr = outPtr;
1413
+ var numCharsToWrite = maxBytesToWrite < str.length * 2 ? maxBytesToWrite / 2 : str.length;
1414
+ for (var i2 = 0; i2 < numCharsToWrite; ++i2) {
1415
+ var codeUnit = str.charCodeAt(i2);
1416
+ LE_HEAP_STORE_I16((outPtr >> 1) * 2, codeUnit);
1417
+ outPtr += 2;
1418
+ }
1419
+ LE_HEAP_STORE_I16((outPtr >> 1) * 2, 0);
1420
+ return outPtr - startPtr;
1421
+ }, "stringToUTF16");
1422
+ var AsciiToString = /* @__PURE__ */ __name((ptr) => {
1423
+ var str = "";
1424
+ while (1) {
1425
+ var ch = HEAPU8[ptr++];
1426
+ if (!ch) return str;
1427
+ str += String.fromCharCode(ch);
1428
+ }
1429
+ }, "AsciiToString");
1430
+ var wasmImports = {
1431
+ /** @export */
1432
+ __heap_base: ___heap_base,
1433
+ /** @export */
1434
+ __indirect_function_table: wasmTable,
1435
+ /** @export */
1436
+ __memory_base: ___memory_base,
1437
+ /** @export */
1438
+ __stack_pointer: ___stack_pointer,
1439
+ /** @export */
1440
+ __table_base: ___table_base,
1441
+ /** @export */
1442
+ _abort_js: __abort_js,
1443
+ /** @export */
1444
+ _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic,
1445
+ /** @export */
1446
+ _emscripten_memcpy_js: __emscripten_memcpy_js,
1447
+ /** @export */
1448
+ emscripten_get_now: _emscripten_get_now,
1449
+ /** @export */
1450
+ emscripten_resize_heap: _emscripten_resize_heap,
1451
+ /** @export */
1452
+ fd_close: _fd_close,
1453
+ /** @export */
1454
+ fd_seek: _fd_seek,
1455
+ /** @export */
1456
+ fd_write: _fd_write,
1457
+ /** @export */
1458
+ memory: wasmMemory,
1459
+ /** @export */
1460
+ tree_sitter_log_callback: _tree_sitter_log_callback,
1461
+ /** @export */
1462
+ tree_sitter_parse_callback: _tree_sitter_parse_callback
1463
+ };
1464
+ var wasmExports = createWasm();
1465
+ var ___wasm_call_ctors = /* @__PURE__ */ __name(() => (___wasm_call_ctors = wasmExports["__wasm_call_ctors"])(), "___wasm_call_ctors");
1466
+ var ___wasm_apply_data_relocs = /* @__PURE__ */ __name(() => (___wasm_apply_data_relocs = wasmExports["__wasm_apply_data_relocs"])(), "___wasm_apply_data_relocs");
1467
+ var _malloc = Module["_malloc"] = (a0) => (_malloc = Module["_malloc"] = wasmExports["malloc"])(a0);
1468
+ var _calloc = Module["_calloc"] = (a0, a1) => (_calloc = Module["_calloc"] = wasmExports["calloc"])(a0, a1);
1469
+ var _realloc = Module["_realloc"] = (a0, a1) => (_realloc = Module["_realloc"] = wasmExports["realloc"])(a0, a1);
1470
+ var _free = Module["_free"] = (a0) => (_free = Module["_free"] = wasmExports["free"])(a0);
1471
+ var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = (a0) => (_ts_language_symbol_count = Module["_ts_language_symbol_count"] = wasmExports["ts_language_symbol_count"])(a0);
1472
+ var _ts_language_state_count = Module["_ts_language_state_count"] = (a0) => (_ts_language_state_count = Module["_ts_language_state_count"] = wasmExports["ts_language_state_count"])(a0);
1473
+ var _ts_language_version = Module["_ts_language_version"] = (a0) => (_ts_language_version = Module["_ts_language_version"] = wasmExports["ts_language_version"])(a0);
1474
+ var _ts_language_field_count = Module["_ts_language_field_count"] = (a0) => (_ts_language_field_count = Module["_ts_language_field_count"] = wasmExports["ts_language_field_count"])(a0);
1475
+ var _ts_language_next_state = Module["_ts_language_next_state"] = (a0, a1, a2) => (_ts_language_next_state = Module["_ts_language_next_state"] = wasmExports["ts_language_next_state"])(a0, a1, a2);
1476
+ var _ts_language_symbol_name = Module["_ts_language_symbol_name"] = (a0, a1) => (_ts_language_symbol_name = Module["_ts_language_symbol_name"] = wasmExports["ts_language_symbol_name"])(a0, a1);
1477
+ var _ts_language_symbol_for_name = Module["_ts_language_symbol_for_name"] = (a0, a1, a2, a3) => (_ts_language_symbol_for_name = Module["_ts_language_symbol_for_name"] = wasmExports["ts_language_symbol_for_name"])(a0, a1, a2, a3);
1478
+ var _strncmp = Module["_strncmp"] = (a0, a1, a2) => (_strncmp = Module["_strncmp"] = wasmExports["strncmp"])(a0, a1, a2);
1479
+ var _ts_language_symbol_type = Module["_ts_language_symbol_type"] = (a0, a1) => (_ts_language_symbol_type = Module["_ts_language_symbol_type"] = wasmExports["ts_language_symbol_type"])(a0, a1);
1480
+ var _ts_language_field_name_for_id = Module["_ts_language_field_name_for_id"] = (a0, a1) => (_ts_language_field_name_for_id = Module["_ts_language_field_name_for_id"] = wasmExports["ts_language_field_name_for_id"])(a0, a1);
1481
+ var _ts_lookahead_iterator_new = Module["_ts_lookahead_iterator_new"] = (a0, a1) => (_ts_lookahead_iterator_new = Module["_ts_lookahead_iterator_new"] = wasmExports["ts_lookahead_iterator_new"])(a0, a1);
1482
+ var _ts_lookahead_iterator_delete = Module["_ts_lookahead_iterator_delete"] = (a0) => (_ts_lookahead_iterator_delete = Module["_ts_lookahead_iterator_delete"] = wasmExports["ts_lookahead_iterator_delete"])(a0);
1483
+ var _ts_lookahead_iterator_reset_state = Module["_ts_lookahead_iterator_reset_state"] = (a0, a1) => (_ts_lookahead_iterator_reset_state = Module["_ts_lookahead_iterator_reset_state"] = wasmExports["ts_lookahead_iterator_reset_state"])(a0, a1);
1484
+ var _ts_lookahead_iterator_reset = Module["_ts_lookahead_iterator_reset"] = (a0, a1, a2) => (_ts_lookahead_iterator_reset = Module["_ts_lookahead_iterator_reset"] = wasmExports["ts_lookahead_iterator_reset"])(a0, a1, a2);
1485
+ var _ts_lookahead_iterator_next = Module["_ts_lookahead_iterator_next"] = (a0) => (_ts_lookahead_iterator_next = Module["_ts_lookahead_iterator_next"] = wasmExports["ts_lookahead_iterator_next"])(a0);
1486
+ var _ts_lookahead_iterator_current_symbol = Module["_ts_lookahead_iterator_current_symbol"] = (a0) => (_ts_lookahead_iterator_current_symbol = Module["_ts_lookahead_iterator_current_symbol"] = wasmExports["ts_lookahead_iterator_current_symbol"])(a0);
1487
+ var _memset = Module["_memset"] = (a0, a1, a2) => (_memset = Module["_memset"] = wasmExports["memset"])(a0, a1, a2);
1488
+ var _memcpy = Module["_memcpy"] = (a0, a1, a2) => (_memcpy = Module["_memcpy"] = wasmExports["memcpy"])(a0, a1, a2);
1489
+ var _ts_parser_delete = Module["_ts_parser_delete"] = (a0) => (_ts_parser_delete = Module["_ts_parser_delete"] = wasmExports["ts_parser_delete"])(a0);
1490
+ var _ts_parser_reset = Module["_ts_parser_reset"] = (a0) => (_ts_parser_reset = Module["_ts_parser_reset"] = wasmExports["ts_parser_reset"])(a0);
1491
+ var _ts_parser_set_language = Module["_ts_parser_set_language"] = (a0, a1) => (_ts_parser_set_language = Module["_ts_parser_set_language"] = wasmExports["ts_parser_set_language"])(a0, a1);
1492
+ var _ts_parser_timeout_micros = Module["_ts_parser_timeout_micros"] = (a0) => (_ts_parser_timeout_micros = Module["_ts_parser_timeout_micros"] = wasmExports["ts_parser_timeout_micros"])(a0);
1493
+ var _ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = (a0, a1, a2) => (_ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = wasmExports["ts_parser_set_timeout_micros"])(a0, a1, a2);
1494
+ var _ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = (a0, a1, a2) => (_ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = wasmExports["ts_parser_set_included_ranges"])(a0, a1, a2);
1495
+ var _memmove = Module["_memmove"] = (a0, a1, a2) => (_memmove = Module["_memmove"] = wasmExports["memmove"])(a0, a1, a2);
1496
+ var _memcmp = Module["_memcmp"] = (a0, a1, a2) => (_memcmp = Module["_memcmp"] = wasmExports["memcmp"])(a0, a1, a2);
1497
+ var _ts_query_new = Module["_ts_query_new"] = (a0, a1, a2, a3, a4) => (_ts_query_new = Module["_ts_query_new"] = wasmExports["ts_query_new"])(a0, a1, a2, a3, a4);
1498
+ var _ts_query_delete = Module["_ts_query_delete"] = (a0) => (_ts_query_delete = Module["_ts_query_delete"] = wasmExports["ts_query_delete"])(a0);
1499
+ var _iswspace = Module["_iswspace"] = (a0) => (_iswspace = Module["_iswspace"] = wasmExports["iswspace"])(a0);
1500
+ var _iswalnum = Module["_iswalnum"] = (a0) => (_iswalnum = Module["_iswalnum"] = wasmExports["iswalnum"])(a0);
1501
+ var _ts_query_pattern_count = Module["_ts_query_pattern_count"] = (a0) => (_ts_query_pattern_count = Module["_ts_query_pattern_count"] = wasmExports["ts_query_pattern_count"])(a0);
1502
+ var _ts_query_capture_count = Module["_ts_query_capture_count"] = (a0) => (_ts_query_capture_count = Module["_ts_query_capture_count"] = wasmExports["ts_query_capture_count"])(a0);
1503
+ var _ts_query_string_count = Module["_ts_query_string_count"] = (a0) => (_ts_query_string_count = Module["_ts_query_string_count"] = wasmExports["ts_query_string_count"])(a0);
1504
+ var _ts_query_capture_name_for_id = Module["_ts_query_capture_name_for_id"] = (a0, a1, a2) => (_ts_query_capture_name_for_id = Module["_ts_query_capture_name_for_id"] = wasmExports["ts_query_capture_name_for_id"])(a0, a1, a2);
1505
+ var _ts_query_string_value_for_id = Module["_ts_query_string_value_for_id"] = (a0, a1, a2) => (_ts_query_string_value_for_id = Module["_ts_query_string_value_for_id"] = wasmExports["ts_query_string_value_for_id"])(a0, a1, a2);
1506
+ var _ts_query_predicates_for_pattern = Module["_ts_query_predicates_for_pattern"] = (a0, a1, a2) => (_ts_query_predicates_for_pattern = Module["_ts_query_predicates_for_pattern"] = wasmExports["ts_query_predicates_for_pattern"])(a0, a1, a2);
1507
+ var _ts_query_disable_capture = Module["_ts_query_disable_capture"] = (a0, a1, a2) => (_ts_query_disable_capture = Module["_ts_query_disable_capture"] = wasmExports["ts_query_disable_capture"])(a0, a1, a2);
1508
+ var _ts_tree_copy = Module["_ts_tree_copy"] = (a0) => (_ts_tree_copy = Module["_ts_tree_copy"] = wasmExports["ts_tree_copy"])(a0);
1509
+ var _ts_tree_delete = Module["_ts_tree_delete"] = (a0) => (_ts_tree_delete = Module["_ts_tree_delete"] = wasmExports["ts_tree_delete"])(a0);
1510
+ var _ts_init = Module["_ts_init"] = () => (_ts_init = Module["_ts_init"] = wasmExports["ts_init"])();
1511
+ var _ts_parser_new_wasm = Module["_ts_parser_new_wasm"] = () => (_ts_parser_new_wasm = Module["_ts_parser_new_wasm"] = wasmExports["ts_parser_new_wasm"])();
1512
+ var _ts_parser_enable_logger_wasm = Module["_ts_parser_enable_logger_wasm"] = (a0, a1) => (_ts_parser_enable_logger_wasm = Module["_ts_parser_enable_logger_wasm"] = wasmExports["ts_parser_enable_logger_wasm"])(a0, a1);
1513
+ var _ts_parser_parse_wasm = Module["_ts_parser_parse_wasm"] = (a0, a1, a2, a3, a4) => (_ts_parser_parse_wasm = Module["_ts_parser_parse_wasm"] = wasmExports["ts_parser_parse_wasm"])(a0, a1, a2, a3, a4);
1514
+ var _ts_parser_included_ranges_wasm = Module["_ts_parser_included_ranges_wasm"] = (a0) => (_ts_parser_included_ranges_wasm = Module["_ts_parser_included_ranges_wasm"] = wasmExports["ts_parser_included_ranges_wasm"])(a0);
1515
+ var _ts_language_type_is_named_wasm = Module["_ts_language_type_is_named_wasm"] = (a0, a1) => (_ts_language_type_is_named_wasm = Module["_ts_language_type_is_named_wasm"] = wasmExports["ts_language_type_is_named_wasm"])(a0, a1);
1516
+ var _ts_language_type_is_visible_wasm = Module["_ts_language_type_is_visible_wasm"] = (a0, a1) => (_ts_language_type_is_visible_wasm = Module["_ts_language_type_is_visible_wasm"] = wasmExports["ts_language_type_is_visible_wasm"])(a0, a1);
1517
+ var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = (a0) => (_ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = wasmExports["ts_tree_root_node_wasm"])(a0);
1518
+ var _ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = (a0) => (_ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = wasmExports["ts_tree_root_node_with_offset_wasm"])(a0);
1519
+ var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = (a0) => (_ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = wasmExports["ts_tree_edit_wasm"])(a0);
1520
+ var _ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = (a0) => (_ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = wasmExports["ts_tree_included_ranges_wasm"])(a0);
1521
+ var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = (a0, a1) => (_ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = wasmExports["ts_tree_get_changed_ranges_wasm"])(a0, a1);
1522
+ var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = (a0) => (_ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = wasmExports["ts_tree_cursor_new_wasm"])(a0);
1523
+ var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = (a0) => (_ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = wasmExports["ts_tree_cursor_delete_wasm"])(a0);
1524
+ var _ts_tree_cursor_reset_wasm = Module["_ts_tree_cursor_reset_wasm"] = (a0) => (_ts_tree_cursor_reset_wasm = Module["_ts_tree_cursor_reset_wasm"] = wasmExports["ts_tree_cursor_reset_wasm"])(a0);
1525
+ var _ts_tree_cursor_reset_to_wasm = Module["_ts_tree_cursor_reset_to_wasm"] = (a0, a1) => (_ts_tree_cursor_reset_to_wasm = Module["_ts_tree_cursor_reset_to_wasm"] = wasmExports["ts_tree_cursor_reset_to_wasm"])(a0, a1);
1526
+ var _ts_tree_cursor_goto_first_child_wasm = Module["_ts_tree_cursor_goto_first_child_wasm"] = (a0) => (_ts_tree_cursor_goto_first_child_wasm = Module["_ts_tree_cursor_goto_first_child_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_wasm"])(a0);
1527
+ var _ts_tree_cursor_goto_last_child_wasm = Module["_ts_tree_cursor_goto_last_child_wasm"] = (a0) => (_ts_tree_cursor_goto_last_child_wasm = Module["_ts_tree_cursor_goto_last_child_wasm"] = wasmExports["ts_tree_cursor_goto_last_child_wasm"])(a0);
1528
+ var _ts_tree_cursor_goto_first_child_for_index_wasm = Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = (a0) => (_ts_tree_cursor_goto_first_child_for_index_wasm = Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_for_index_wasm"])(a0);
1529
+ var _ts_tree_cursor_goto_first_child_for_position_wasm = Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = (a0) => (_ts_tree_cursor_goto_first_child_for_position_wasm = Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = wasmExports["ts_tree_cursor_goto_first_child_for_position_wasm"])(a0);
1530
+ var _ts_tree_cursor_goto_next_sibling_wasm = Module["_ts_tree_cursor_goto_next_sibling_wasm"] = (a0) => (_ts_tree_cursor_goto_next_sibling_wasm = Module["_ts_tree_cursor_goto_next_sibling_wasm"] = wasmExports["ts_tree_cursor_goto_next_sibling_wasm"])(a0);
1531
+ var _ts_tree_cursor_goto_previous_sibling_wasm = Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = (a0) => (_ts_tree_cursor_goto_previous_sibling_wasm = Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = wasmExports["ts_tree_cursor_goto_previous_sibling_wasm"])(a0);
1532
+ var _ts_tree_cursor_goto_descendant_wasm = Module["_ts_tree_cursor_goto_descendant_wasm"] = (a0, a1) => (_ts_tree_cursor_goto_descendant_wasm = Module["_ts_tree_cursor_goto_descendant_wasm"] = wasmExports["ts_tree_cursor_goto_descendant_wasm"])(a0, a1);
1533
+ var _ts_tree_cursor_goto_parent_wasm = Module["_ts_tree_cursor_goto_parent_wasm"] = (a0) => (_ts_tree_cursor_goto_parent_wasm = Module["_ts_tree_cursor_goto_parent_wasm"] = wasmExports["ts_tree_cursor_goto_parent_wasm"])(a0);
1534
+ var _ts_tree_cursor_current_node_type_id_wasm = Module["_ts_tree_cursor_current_node_type_id_wasm"] = (a0) => (_ts_tree_cursor_current_node_type_id_wasm = Module["_ts_tree_cursor_current_node_type_id_wasm"] = wasmExports["ts_tree_cursor_current_node_type_id_wasm"])(a0);
1535
+ var _ts_tree_cursor_current_node_state_id_wasm = Module["_ts_tree_cursor_current_node_state_id_wasm"] = (a0) => (_ts_tree_cursor_current_node_state_id_wasm = Module["_ts_tree_cursor_current_node_state_id_wasm"] = wasmExports["ts_tree_cursor_current_node_state_id_wasm"])(a0);
1536
+ var _ts_tree_cursor_current_node_is_named_wasm = Module["_ts_tree_cursor_current_node_is_named_wasm"] = (a0) => (_ts_tree_cursor_current_node_is_named_wasm = Module["_ts_tree_cursor_current_node_is_named_wasm"] = wasmExports["ts_tree_cursor_current_node_is_named_wasm"])(a0);
1537
+ var _ts_tree_cursor_current_node_is_missing_wasm = Module["_ts_tree_cursor_current_node_is_missing_wasm"] = (a0) => (_ts_tree_cursor_current_node_is_missing_wasm = Module["_ts_tree_cursor_current_node_is_missing_wasm"] = wasmExports["ts_tree_cursor_current_node_is_missing_wasm"])(a0);
1538
+ var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = (a0) => (_ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = wasmExports["ts_tree_cursor_current_node_id_wasm"])(a0);
1539
+ var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = (a0) => (_ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = wasmExports["ts_tree_cursor_start_position_wasm"])(a0);
1540
+ var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = (a0) => (_ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = wasmExports["ts_tree_cursor_end_position_wasm"])(a0);
1541
+ var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = (a0) => (_ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = wasmExports["ts_tree_cursor_start_index_wasm"])(a0);
1542
+ var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = (a0) => (_ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = wasmExports["ts_tree_cursor_end_index_wasm"])(a0);
1543
+ var _ts_tree_cursor_current_field_id_wasm = Module["_ts_tree_cursor_current_field_id_wasm"] = (a0) => (_ts_tree_cursor_current_field_id_wasm = Module["_ts_tree_cursor_current_field_id_wasm"] = wasmExports["ts_tree_cursor_current_field_id_wasm"])(a0);
1544
+ var _ts_tree_cursor_current_depth_wasm = Module["_ts_tree_cursor_current_depth_wasm"] = (a0) => (_ts_tree_cursor_current_depth_wasm = Module["_ts_tree_cursor_current_depth_wasm"] = wasmExports["ts_tree_cursor_current_depth_wasm"])(a0);
1545
+ var _ts_tree_cursor_current_descendant_index_wasm = Module["_ts_tree_cursor_current_descendant_index_wasm"] = (a0) => (_ts_tree_cursor_current_descendant_index_wasm = Module["_ts_tree_cursor_current_descendant_index_wasm"] = wasmExports["ts_tree_cursor_current_descendant_index_wasm"])(a0);
1546
+ var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = (a0) => (_ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = wasmExports["ts_tree_cursor_current_node_wasm"])(a0);
1547
+ var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = (a0) => (_ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = wasmExports["ts_node_symbol_wasm"])(a0);
1548
+ var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = (a0, a1) => (_ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = wasmExports["ts_node_field_name_for_child_wasm"])(a0, a1);
1549
+ var _ts_node_children_by_field_id_wasm = Module["_ts_node_children_by_field_id_wasm"] = (a0, a1) => (_ts_node_children_by_field_id_wasm = Module["_ts_node_children_by_field_id_wasm"] = wasmExports["ts_node_children_by_field_id_wasm"])(a0, a1);
1550
+ var _ts_node_first_child_for_byte_wasm = Module["_ts_node_first_child_for_byte_wasm"] = (a0) => (_ts_node_first_child_for_byte_wasm = Module["_ts_node_first_child_for_byte_wasm"] = wasmExports["ts_node_first_child_for_byte_wasm"])(a0);
1551
+ var _ts_node_first_named_child_for_byte_wasm = Module["_ts_node_first_named_child_for_byte_wasm"] = (a0) => (_ts_node_first_named_child_for_byte_wasm = Module["_ts_node_first_named_child_for_byte_wasm"] = wasmExports["ts_node_first_named_child_for_byte_wasm"])(a0);
1552
+ var _ts_node_grammar_symbol_wasm = Module["_ts_node_grammar_symbol_wasm"] = (a0) => (_ts_node_grammar_symbol_wasm = Module["_ts_node_grammar_symbol_wasm"] = wasmExports["ts_node_grammar_symbol_wasm"])(a0);
1553
+ var _ts_node_child_count_wasm = Module["_ts_node_child_count_wasm"] = (a0) => (_ts_node_child_count_wasm = Module["_ts_node_child_count_wasm"] = wasmExports["ts_node_child_count_wasm"])(a0);
1554
+ var _ts_node_named_child_count_wasm = Module["_ts_node_named_child_count_wasm"] = (a0) => (_ts_node_named_child_count_wasm = Module["_ts_node_named_child_count_wasm"] = wasmExports["ts_node_named_child_count_wasm"])(a0);
1555
+ var _ts_node_child_wasm = Module["_ts_node_child_wasm"] = (a0, a1) => (_ts_node_child_wasm = Module["_ts_node_child_wasm"] = wasmExports["ts_node_child_wasm"])(a0, a1);
1556
+ var _ts_node_named_child_wasm = Module["_ts_node_named_child_wasm"] = (a0, a1) => (_ts_node_named_child_wasm = Module["_ts_node_named_child_wasm"] = wasmExports["ts_node_named_child_wasm"])(a0, a1);
1557
+ var _ts_node_child_by_field_id_wasm = Module["_ts_node_child_by_field_id_wasm"] = (a0, a1) => (_ts_node_child_by_field_id_wasm = Module["_ts_node_child_by_field_id_wasm"] = wasmExports["ts_node_child_by_field_id_wasm"])(a0, a1);
1558
+ var _ts_node_next_sibling_wasm = Module["_ts_node_next_sibling_wasm"] = (a0) => (_ts_node_next_sibling_wasm = Module["_ts_node_next_sibling_wasm"] = wasmExports["ts_node_next_sibling_wasm"])(a0);
1559
+ var _ts_node_prev_sibling_wasm = Module["_ts_node_prev_sibling_wasm"] = (a0) => (_ts_node_prev_sibling_wasm = Module["_ts_node_prev_sibling_wasm"] = wasmExports["ts_node_prev_sibling_wasm"])(a0);
1560
+ var _ts_node_next_named_sibling_wasm = Module["_ts_node_next_named_sibling_wasm"] = (a0) => (_ts_node_next_named_sibling_wasm = Module["_ts_node_next_named_sibling_wasm"] = wasmExports["ts_node_next_named_sibling_wasm"])(a0);
1561
+ var _ts_node_prev_named_sibling_wasm = Module["_ts_node_prev_named_sibling_wasm"] = (a0) => (_ts_node_prev_named_sibling_wasm = Module["_ts_node_prev_named_sibling_wasm"] = wasmExports["ts_node_prev_named_sibling_wasm"])(a0);
1562
+ var _ts_node_descendant_count_wasm = Module["_ts_node_descendant_count_wasm"] = (a0) => (_ts_node_descendant_count_wasm = Module["_ts_node_descendant_count_wasm"] = wasmExports["ts_node_descendant_count_wasm"])(a0);
1563
+ var _ts_node_parent_wasm = Module["_ts_node_parent_wasm"] = (a0) => (_ts_node_parent_wasm = Module["_ts_node_parent_wasm"] = wasmExports["ts_node_parent_wasm"])(a0);
1564
+ var _ts_node_descendant_for_index_wasm = Module["_ts_node_descendant_for_index_wasm"] = (a0) => (_ts_node_descendant_for_index_wasm = Module["_ts_node_descendant_for_index_wasm"] = wasmExports["ts_node_descendant_for_index_wasm"])(a0);
1565
+ var _ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = (a0) => (_ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = wasmExports["ts_node_named_descendant_for_index_wasm"])(a0);
1566
+ var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = (a0) => (_ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = wasmExports["ts_node_descendant_for_position_wasm"])(a0);
1567
+ var _ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = (a0) => (_ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = wasmExports["ts_node_named_descendant_for_position_wasm"])(a0);
1568
+ var _ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = (a0) => (_ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = wasmExports["ts_node_start_point_wasm"])(a0);
1569
+ var _ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = (a0) => (_ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = wasmExports["ts_node_end_point_wasm"])(a0);
1570
+ var _ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = (a0) => (_ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = wasmExports["ts_node_start_index_wasm"])(a0);
1571
+ var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = (a0) => (_ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = wasmExports["ts_node_end_index_wasm"])(a0);
1572
+ var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = (a0) => (_ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = wasmExports["ts_node_to_string_wasm"])(a0);
1573
+ var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = (a0) => (_ts_node_children_wasm = Module["_ts_node_children_wasm"] = wasmExports["ts_node_children_wasm"])(a0);
1574
+ var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = (a0) => (_ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = wasmExports["ts_node_named_children_wasm"])(a0);
1575
+ var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = (a0, a1, a2, a3, a4, a5, a6) => (_ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = wasmExports["ts_node_descendants_of_type_wasm"])(a0, a1, a2, a3, a4, a5, a6);
1576
+ var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = (a0) => (_ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = wasmExports["ts_node_is_named_wasm"])(a0);
1577
+ var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = (a0) => (_ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = wasmExports["ts_node_has_changes_wasm"])(a0);
1578
+ var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = (a0) => (_ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = wasmExports["ts_node_has_error_wasm"])(a0);
1579
+ var _ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = (a0) => (_ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = wasmExports["ts_node_is_error_wasm"])(a0);
1580
+ var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = (a0) => (_ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = wasmExports["ts_node_is_missing_wasm"])(a0);
1581
+ var _ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = (a0) => (_ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = wasmExports["ts_node_is_extra_wasm"])(a0);
1582
+ var _ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = (a0) => (_ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = wasmExports["ts_node_parse_state_wasm"])(a0);
1583
+ var _ts_node_next_parse_state_wasm = Module["_ts_node_next_parse_state_wasm"] = (a0) => (_ts_node_next_parse_state_wasm = Module["_ts_node_next_parse_state_wasm"] = wasmExports["ts_node_next_parse_state_wasm"])(a0);
1584
+ var _ts_query_matches_wasm = Module["_ts_query_matches_wasm"] = (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) => (_ts_query_matches_wasm = Module["_ts_query_matches_wasm"] = wasmExports["ts_query_matches_wasm"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
1585
+ var _ts_query_captures_wasm = Module["_ts_query_captures_wasm"] = (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) => (_ts_query_captures_wasm = Module["_ts_query_captures_wasm"] = wasmExports["ts_query_captures_wasm"])(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
1586
+ var _iswalpha = Module["_iswalpha"] = (a0) => (_iswalpha = Module["_iswalpha"] = wasmExports["iswalpha"])(a0);
1587
+ var _iswblank = Module["_iswblank"] = (a0) => (_iswblank = Module["_iswblank"] = wasmExports["iswblank"])(a0);
1588
+ var _iswdigit = Module["_iswdigit"] = (a0) => (_iswdigit = Module["_iswdigit"] = wasmExports["iswdigit"])(a0);
1589
+ var _iswlower = Module["_iswlower"] = (a0) => (_iswlower = Module["_iswlower"] = wasmExports["iswlower"])(a0);
1590
+ var _iswupper = Module["_iswupper"] = (a0) => (_iswupper = Module["_iswupper"] = wasmExports["iswupper"])(a0);
1591
+ var _iswxdigit = Module["_iswxdigit"] = (a0) => (_iswxdigit = Module["_iswxdigit"] = wasmExports["iswxdigit"])(a0);
1592
+ var _memchr = Module["_memchr"] = (a0, a1, a2) => (_memchr = Module["_memchr"] = wasmExports["memchr"])(a0, a1, a2);
1593
+ var _strlen = Module["_strlen"] = (a0) => (_strlen = Module["_strlen"] = wasmExports["strlen"])(a0);
1594
+ var _strcmp = Module["_strcmp"] = (a0, a1) => (_strcmp = Module["_strcmp"] = wasmExports["strcmp"])(a0, a1);
1595
+ var _strncat = Module["_strncat"] = (a0, a1, a2) => (_strncat = Module["_strncat"] = wasmExports["strncat"])(a0, a1, a2);
1596
+ var _strncpy = Module["_strncpy"] = (a0, a1, a2) => (_strncpy = Module["_strncpy"] = wasmExports["strncpy"])(a0, a1, a2);
1597
+ var _towlower = Module["_towlower"] = (a0) => (_towlower = Module["_towlower"] = wasmExports["towlower"])(a0);
1598
+ var _towupper = Module["_towupper"] = (a0) => (_towupper = Module["_towupper"] = wasmExports["towupper"])(a0);
1599
+ var _setThrew = /* @__PURE__ */ __name((a0, a1) => (_setThrew = wasmExports["setThrew"])(a0, a1), "_setThrew");
1600
+ var __emscripten_stack_restore = /* @__PURE__ */ __name((a0) => (__emscripten_stack_restore = wasmExports["_emscripten_stack_restore"])(a0), "__emscripten_stack_restore");
1601
+ var __emscripten_stack_alloc = /* @__PURE__ */ __name((a0) => (__emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"])(a0), "__emscripten_stack_alloc");
1602
+ var _emscripten_stack_get_current = /* @__PURE__ */ __name(() => (_emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"])(), "_emscripten_stack_get_current");
1603
+ var dynCall_jiji = Module["dynCall_jiji"] = (a0, a1, a2, a3, a4) => (dynCall_jiji = Module["dynCall_jiji"] = wasmExports["dynCall_jiji"])(a0, a1, a2, a3, a4);
1604
+ var _orig$ts_parser_timeout_micros = Module["_orig$ts_parser_timeout_micros"] = (a0) => (_orig$ts_parser_timeout_micros = Module["_orig$ts_parser_timeout_micros"] = wasmExports["orig$ts_parser_timeout_micros"])(a0);
1605
+ var _orig$ts_parser_set_timeout_micros = Module["_orig$ts_parser_set_timeout_micros"] = (a0, a1) => (_orig$ts_parser_set_timeout_micros = Module["_orig$ts_parser_set_timeout_micros"] = wasmExports["orig$ts_parser_set_timeout_micros"])(a0, a1);
1606
+ Module["AsciiToString"] = AsciiToString;
1607
+ Module["stringToUTF16"] = stringToUTF16;
1608
+ var calledRun;
1609
+ dependenciesFulfilled = /* @__PURE__ */ __name(function runCaller() {
1610
+ if (!calledRun) run();
1611
+ if (!calledRun) dependenciesFulfilled = runCaller;
1612
+ }, "runCaller");
1613
+ function callMain(args2 = []) {
1614
+ var entryFunction = resolveGlobalSymbol("main").sym;
1615
+ if (!entryFunction) return;
1616
+ args2.unshift(thisProgram);
1617
+ var argc = args2.length;
1618
+ var argv = stackAlloc((argc + 1) * 4);
1619
+ var argv_ptr = argv;
1620
+ args2.forEach((arg) => {
1621
+ LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, stringToUTF8OnStack(arg));
1622
+ argv_ptr += 4;
1623
+ });
1624
+ LE_HEAP_STORE_U32((argv_ptr >> 2) * 4, 0);
1625
+ try {
1626
+ var ret = entryFunction(argc, argv);
1627
+ exitJS(
1628
+ ret,
1629
+ /* implicit = */
1630
+ true
1631
+ );
1632
+ return ret;
1633
+ } catch (e) {
1634
+ return handleException(e);
1635
+ }
1636
+ }
1637
+ __name(callMain, "callMain");
1638
+ function run(args2 = arguments_) {
1639
+ if (runDependencies > 0) {
1640
+ return;
1641
+ }
1642
+ preRun();
1643
+ if (runDependencies > 0) {
1644
+ return;
1645
+ }
1646
+ function doRun() {
1647
+ if (calledRun) return;
1648
+ calledRun = true;
1649
+ Module["calledRun"] = true;
1650
+ if (ABORT) return;
1651
+ initRuntime();
1652
+ preMain();
1653
+ Module["onRuntimeInitialized"]?.();
1654
+ if (shouldRunNow) callMain(args2);
1655
+ postRun();
1656
+ }
1657
+ __name(doRun, "doRun");
1658
+ if (Module["setStatus"]) {
1659
+ Module["setStatus"]("Running...");
1660
+ setTimeout(function() {
1661
+ setTimeout(function() {
1662
+ Module["setStatus"]("");
1663
+ }, 1);
1664
+ doRun();
1665
+ }, 1);
1666
+ } else {
1667
+ doRun();
1668
+ }
1669
+ }
1670
+ __name(run, "run");
1671
+ if (Module["preInit"]) {
1672
+ if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
1673
+ while (Module["preInit"].length > 0) {
1674
+ Module["preInit"].pop()();
1675
+ }
1676
+ }
1677
+ var shouldRunNow = true;
1678
+ if (Module["noInitialRun"]) shouldRunNow = false;
1679
+ run();
1680
+ const C = Module;
1681
+ const INTERNAL = {};
1682
+ const SIZE_OF_INT = 4;
1683
+ const SIZE_OF_CURSOR = 4 * SIZE_OF_INT;
1684
+ const SIZE_OF_NODE = 5 * SIZE_OF_INT;
1685
+ const SIZE_OF_POINT = 2 * SIZE_OF_INT;
1686
+ const SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT;
1687
+ const ZERO_POINT = {
1688
+ row: 0,
1689
+ column: 0
1690
+ };
1691
+ const QUERY_WORD_REGEX = /[\w-.]*/g;
1692
+ const PREDICATE_STEP_TYPE_CAPTURE = 1;
1693
+ const PREDICATE_STEP_TYPE_STRING = 2;
1694
+ const LANGUAGE_FUNCTION_REGEX = /^_?tree_sitter_\w+/;
1695
+ let VERSION;
1696
+ let MIN_COMPATIBLE_VERSION;
1697
+ let TRANSFER_BUFFER;
1698
+ let currentParseCallback;
1699
+ let currentLogCallback;
1700
+ class ParserImpl {
1701
+ static {
1702
+ __name(this, "ParserImpl");
1703
+ }
1704
+ static init() {
1705
+ TRANSFER_BUFFER = C._ts_init();
1706
+ VERSION = getValue(TRANSFER_BUFFER, "i32");
1707
+ MIN_COMPATIBLE_VERSION = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1708
+ }
1709
+ initialize() {
1710
+ C._ts_parser_new_wasm();
1711
+ this[0] = getValue(TRANSFER_BUFFER, "i32");
1712
+ this[1] = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1713
+ }
1714
+ delete() {
1715
+ C._ts_parser_delete(this[0]);
1716
+ C._free(this[1]);
1717
+ this[0] = 0;
1718
+ this[1] = 0;
1719
+ }
1720
+ setLanguage(language) {
1721
+ let address;
1722
+ if (!language) {
1723
+ address = 0;
1724
+ language = null;
1725
+ } else if (language.constructor === Language) {
1726
+ address = language[0];
1727
+ const version = C._ts_language_version(address);
1728
+ if (version < MIN_COMPATIBLE_VERSION || VERSION < version) {
1729
+ throw new Error(`Incompatible language version ${version}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`);
1730
+ }
1731
+ } else {
1732
+ throw new Error("Argument must be a Language");
1733
+ }
1734
+ this.language = language;
1735
+ C._ts_parser_set_language(this[0], address);
1736
+ return this;
1737
+ }
1738
+ getLanguage() {
1739
+ return this.language;
1740
+ }
1741
+ parse(callback, oldTree, options) {
1742
+ if (typeof callback === "string") {
1743
+ currentParseCallback = /* @__PURE__ */ __name((index, _) => callback.slice(index), "currentParseCallback");
1744
+ } else if (typeof callback === "function") {
1745
+ currentParseCallback = callback;
1746
+ } else {
1747
+ throw new Error("Argument must be a string or a function");
1748
+ }
1749
+ if (this.logCallback) {
1750
+ currentLogCallback = this.logCallback;
1751
+ C._ts_parser_enable_logger_wasm(this[0], 1);
1752
+ } else {
1753
+ currentLogCallback = null;
1754
+ C._ts_parser_enable_logger_wasm(this[0], 0);
1755
+ }
1756
+ let rangeCount = 0;
1757
+ let rangeAddress = 0;
1758
+ if (options?.includedRanges) {
1759
+ rangeCount = options.includedRanges.length;
1760
+ rangeAddress = C._calloc(rangeCount, SIZE_OF_RANGE);
1761
+ let address = rangeAddress;
1762
+ for (let i2 = 0; i2 < rangeCount; i2++) {
1763
+ marshalRange(address, options.includedRanges[i2]);
1764
+ address += SIZE_OF_RANGE;
1765
+ }
1766
+ }
1767
+ const treeAddress = C._ts_parser_parse_wasm(this[0], this[1], oldTree ? oldTree[0] : 0, rangeAddress, rangeCount);
1768
+ if (!treeAddress) {
1769
+ currentParseCallback = null;
1770
+ currentLogCallback = null;
1771
+ throw new Error("Parsing failed");
1772
+ }
1773
+ const result = new Tree(INTERNAL, treeAddress, this.language, currentParseCallback);
1774
+ currentParseCallback = null;
1775
+ currentLogCallback = null;
1776
+ return result;
1777
+ }
1778
+ reset() {
1779
+ C._ts_parser_reset(this[0]);
1780
+ }
1781
+ getIncludedRanges() {
1782
+ C._ts_parser_included_ranges_wasm(this[0]);
1783
+ const count = getValue(TRANSFER_BUFFER, "i32");
1784
+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1785
+ const result = new Array(count);
1786
+ if (count > 0) {
1787
+ let address = buffer;
1788
+ for (let i2 = 0; i2 < count; i2++) {
1789
+ result[i2] = unmarshalRange(address);
1790
+ address += SIZE_OF_RANGE;
1791
+ }
1792
+ C._free(buffer);
1793
+ }
1794
+ return result;
1795
+ }
1796
+ getTimeoutMicros() {
1797
+ return C._ts_parser_timeout_micros(this[0]);
1798
+ }
1799
+ setTimeoutMicros(timeout) {
1800
+ C._ts_parser_set_timeout_micros(this[0], timeout);
1801
+ }
1802
+ setLogger(callback) {
1803
+ if (!callback) {
1804
+ callback = null;
1805
+ } else if (typeof callback !== "function") {
1806
+ throw new Error("Logger callback must be a function");
1807
+ }
1808
+ this.logCallback = callback;
1809
+ return this;
1810
+ }
1811
+ getLogger() {
1812
+ return this.logCallback;
1813
+ }
1814
+ }
1815
+ class Tree {
1816
+ static {
1817
+ __name(this, "Tree");
1818
+ }
1819
+ constructor(internal, address, language, textCallback) {
1820
+ assertInternal(internal);
1821
+ this[0] = address;
1822
+ this.language = language;
1823
+ this.textCallback = textCallback;
1824
+ }
1825
+ copy() {
1826
+ const address = C._ts_tree_copy(this[0]);
1827
+ return new Tree(INTERNAL, address, this.language, this.textCallback);
1828
+ }
1829
+ delete() {
1830
+ C._ts_tree_delete(this[0]);
1831
+ this[0] = 0;
1832
+ }
1833
+ edit(edit) {
1834
+ marshalEdit(edit);
1835
+ C._ts_tree_edit_wasm(this[0]);
1836
+ }
1837
+ get rootNode() {
1838
+ C._ts_tree_root_node_wasm(this[0]);
1839
+ return unmarshalNode(this);
1840
+ }
1841
+ rootNodeWithOffset(offsetBytes, offsetExtent) {
1842
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
1843
+ setValue(address, offsetBytes, "i32");
1844
+ marshalPoint(address + SIZE_OF_INT, offsetExtent);
1845
+ C._ts_tree_root_node_with_offset_wasm(this[0]);
1846
+ return unmarshalNode(this);
1847
+ }
1848
+ getLanguage() {
1849
+ return this.language;
1850
+ }
1851
+ walk() {
1852
+ return this.rootNode.walk();
1853
+ }
1854
+ getChangedRanges(other) {
1855
+ if (other.constructor !== Tree) {
1856
+ throw new TypeError("Argument must be a Tree");
1857
+ }
1858
+ C._ts_tree_get_changed_ranges_wasm(this[0], other[0]);
1859
+ const count = getValue(TRANSFER_BUFFER, "i32");
1860
+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1861
+ const result = new Array(count);
1862
+ if (count > 0) {
1863
+ let address = buffer;
1864
+ for (let i2 = 0; i2 < count; i2++) {
1865
+ result[i2] = unmarshalRange(address);
1866
+ address += SIZE_OF_RANGE;
1867
+ }
1868
+ C._free(buffer);
1869
+ }
1870
+ return result;
1871
+ }
1872
+ getIncludedRanges() {
1873
+ C._ts_tree_included_ranges_wasm(this[0]);
1874
+ const count = getValue(TRANSFER_BUFFER, "i32");
1875
+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1876
+ const result = new Array(count);
1877
+ if (count > 0) {
1878
+ let address = buffer;
1879
+ for (let i2 = 0; i2 < count; i2++) {
1880
+ result[i2] = unmarshalRange(address);
1881
+ address += SIZE_OF_RANGE;
1882
+ }
1883
+ C._free(buffer);
1884
+ }
1885
+ return result;
1886
+ }
1887
+ }
1888
+ class Node {
1889
+ static {
1890
+ __name(this, "Node");
1891
+ }
1892
+ constructor(internal, tree) {
1893
+ assertInternal(internal);
1894
+ this.tree = tree;
1895
+ }
1896
+ get typeId() {
1897
+ marshalNode(this);
1898
+ return C._ts_node_symbol_wasm(this.tree[0]);
1899
+ }
1900
+ get grammarId() {
1901
+ marshalNode(this);
1902
+ return C._ts_node_grammar_symbol_wasm(this.tree[0]);
1903
+ }
1904
+ get type() {
1905
+ return this.tree.language.types[this.typeId] || "ERROR";
1906
+ }
1907
+ get grammarType() {
1908
+ return this.tree.language.types[this.grammarId] || "ERROR";
1909
+ }
1910
+ get endPosition() {
1911
+ marshalNode(this);
1912
+ C._ts_node_end_point_wasm(this.tree[0]);
1913
+ return unmarshalPoint(TRANSFER_BUFFER);
1914
+ }
1915
+ get endIndex() {
1916
+ marshalNode(this);
1917
+ return C._ts_node_end_index_wasm(this.tree[0]);
1918
+ }
1919
+ get text() {
1920
+ return getText(this.tree, this.startIndex, this.endIndex);
1921
+ }
1922
+ get parseState() {
1923
+ marshalNode(this);
1924
+ return C._ts_node_parse_state_wasm(this.tree[0]);
1925
+ }
1926
+ get nextParseState() {
1927
+ marshalNode(this);
1928
+ return C._ts_node_next_parse_state_wasm(this.tree[0]);
1929
+ }
1930
+ get isNamed() {
1931
+ marshalNode(this);
1932
+ return C._ts_node_is_named_wasm(this.tree[0]) === 1;
1933
+ }
1934
+ get hasError() {
1935
+ marshalNode(this);
1936
+ return C._ts_node_has_error_wasm(this.tree[0]) === 1;
1937
+ }
1938
+ get hasChanges() {
1939
+ marshalNode(this);
1940
+ return C._ts_node_has_changes_wasm(this.tree[0]) === 1;
1941
+ }
1942
+ get isError() {
1943
+ marshalNode(this);
1944
+ return C._ts_node_is_error_wasm(this.tree[0]) === 1;
1945
+ }
1946
+ get isMissing() {
1947
+ marshalNode(this);
1948
+ return C._ts_node_is_missing_wasm(this.tree[0]) === 1;
1949
+ }
1950
+ get isExtra() {
1951
+ marshalNode(this);
1952
+ return C._ts_node_is_extra_wasm(this.tree[0]) === 1;
1953
+ }
1954
+ equals(other) {
1955
+ return this.id === other.id;
1956
+ }
1957
+ child(index) {
1958
+ marshalNode(this);
1959
+ C._ts_node_child_wasm(this.tree[0], index);
1960
+ return unmarshalNode(this.tree);
1961
+ }
1962
+ namedChild(index) {
1963
+ marshalNode(this);
1964
+ C._ts_node_named_child_wasm(this.tree[0], index);
1965
+ return unmarshalNode(this.tree);
1966
+ }
1967
+ childForFieldId(fieldId) {
1968
+ marshalNode(this);
1969
+ C._ts_node_child_by_field_id_wasm(this.tree[0], fieldId);
1970
+ return unmarshalNode(this.tree);
1971
+ }
1972
+ childForFieldName(fieldName) {
1973
+ const fieldId = this.tree.language.fields.indexOf(fieldName);
1974
+ if (fieldId !== -1) return this.childForFieldId(fieldId);
1975
+ return null;
1976
+ }
1977
+ fieldNameForChild(index) {
1978
+ marshalNode(this);
1979
+ const address = C._ts_node_field_name_for_child_wasm(this.tree[0], index);
1980
+ if (!address) {
1981
+ return null;
1982
+ }
1983
+ const result = AsciiToString(address);
1984
+ return result;
1985
+ }
1986
+ childrenForFieldName(fieldName) {
1987
+ const fieldId = this.tree.language.fields.indexOf(fieldName);
1988
+ if (fieldId !== -1 && fieldId !== 0) return this.childrenForFieldId(fieldId);
1989
+ return [];
1990
+ }
1991
+ childrenForFieldId(fieldId) {
1992
+ marshalNode(this);
1993
+ C._ts_node_children_by_field_id_wasm(this.tree[0], fieldId);
1994
+ const count = getValue(TRANSFER_BUFFER, "i32");
1995
+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1996
+ const result = new Array(count);
1997
+ if (count > 0) {
1998
+ let address = buffer;
1999
+ for (let i2 = 0; i2 < count; i2++) {
2000
+ result[i2] = unmarshalNode(this.tree, address);
2001
+ address += SIZE_OF_NODE;
2002
+ }
2003
+ C._free(buffer);
2004
+ }
2005
+ return result;
2006
+ }
2007
+ firstChildForIndex(index) {
2008
+ marshalNode(this);
2009
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
2010
+ setValue(address, index, "i32");
2011
+ C._ts_node_first_child_for_byte_wasm(this.tree[0]);
2012
+ return unmarshalNode(this.tree);
2013
+ }
2014
+ firstNamedChildForIndex(index) {
2015
+ marshalNode(this);
2016
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
2017
+ setValue(address, index, "i32");
2018
+ C._ts_node_first_named_child_for_byte_wasm(this.tree[0]);
2019
+ return unmarshalNode(this.tree);
2020
+ }
2021
+ get childCount() {
2022
+ marshalNode(this);
2023
+ return C._ts_node_child_count_wasm(this.tree[0]);
2024
+ }
2025
+ get namedChildCount() {
2026
+ marshalNode(this);
2027
+ return C._ts_node_named_child_count_wasm(this.tree[0]);
2028
+ }
2029
+ get firstChild() {
2030
+ return this.child(0);
2031
+ }
2032
+ get firstNamedChild() {
2033
+ return this.namedChild(0);
2034
+ }
2035
+ get lastChild() {
2036
+ return this.child(this.childCount - 1);
2037
+ }
2038
+ get lastNamedChild() {
2039
+ return this.namedChild(this.namedChildCount - 1);
2040
+ }
2041
+ get children() {
2042
+ if (!this._children) {
2043
+ marshalNode(this);
2044
+ C._ts_node_children_wasm(this.tree[0]);
2045
+ const count = getValue(TRANSFER_BUFFER, "i32");
2046
+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
2047
+ this._children = new Array(count);
2048
+ if (count > 0) {
2049
+ let address = buffer;
2050
+ for (let i2 = 0; i2 < count; i2++) {
2051
+ this._children[i2] = unmarshalNode(this.tree, address);
2052
+ address += SIZE_OF_NODE;
2053
+ }
2054
+ C._free(buffer);
2055
+ }
2056
+ }
2057
+ return this._children;
2058
+ }
2059
+ get namedChildren() {
2060
+ if (!this._namedChildren) {
2061
+ marshalNode(this);
2062
+ C._ts_node_named_children_wasm(this.tree[0]);
2063
+ const count = getValue(TRANSFER_BUFFER, "i32");
2064
+ const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
2065
+ this._namedChildren = new Array(count);
2066
+ if (count > 0) {
2067
+ let address = buffer;
2068
+ for (let i2 = 0; i2 < count; i2++) {
2069
+ this._namedChildren[i2] = unmarshalNode(this.tree, address);
2070
+ address += SIZE_OF_NODE;
2071
+ }
2072
+ C._free(buffer);
2073
+ }
2074
+ }
2075
+ return this._namedChildren;
2076
+ }
2077
+ descendantsOfType(types, startPosition, endPosition) {
2078
+ if (!Array.isArray(types)) types = [types];
2079
+ if (!startPosition) startPosition = ZERO_POINT;
2080
+ if (!endPosition) endPosition = ZERO_POINT;
2081
+ const symbols = [];
2082
+ const typesBySymbol = this.tree.language.types;
2083
+ for (let i2 = 0, n = typesBySymbol.length; i2 < n; i2++) {
2084
+ if (types.includes(typesBySymbol[i2])) {
2085
+ symbols.push(i2);
2086
+ }
2087
+ }
2088
+ const symbolsAddress = C._malloc(SIZE_OF_INT * symbols.length);
2089
+ for (let i2 = 0, n = symbols.length; i2 < n; i2++) {
2090
+ setValue(symbolsAddress + i2 * SIZE_OF_INT, symbols[i2], "i32");
2091
+ }
2092
+ marshalNode(this);
2093
+ C._ts_node_descendants_of_type_wasm(this.tree[0], symbolsAddress, symbols.length, startPosition.row, startPosition.column, endPosition.row, endPosition.column);
2094
+ const descendantCount = getValue(TRANSFER_BUFFER, "i32");
2095
+ const descendantAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
2096
+ const result = new Array(descendantCount);
2097
+ if (descendantCount > 0) {
2098
+ let address = descendantAddress;
2099
+ for (let i2 = 0; i2 < descendantCount; i2++) {
2100
+ result[i2] = unmarshalNode(this.tree, address);
2101
+ address += SIZE_OF_NODE;
2102
+ }
2103
+ }
2104
+ C._free(descendantAddress);
2105
+ C._free(symbolsAddress);
2106
+ return result;
2107
+ }
2108
+ get nextSibling() {
2109
+ marshalNode(this);
2110
+ C._ts_node_next_sibling_wasm(this.tree[0]);
2111
+ return unmarshalNode(this.tree);
2112
+ }
2113
+ get previousSibling() {
2114
+ marshalNode(this);
2115
+ C._ts_node_prev_sibling_wasm(this.tree[0]);
2116
+ return unmarshalNode(this.tree);
2117
+ }
2118
+ get nextNamedSibling() {
2119
+ marshalNode(this);
2120
+ C._ts_node_next_named_sibling_wasm(this.tree[0]);
2121
+ return unmarshalNode(this.tree);
2122
+ }
2123
+ get previousNamedSibling() {
2124
+ marshalNode(this);
2125
+ C._ts_node_prev_named_sibling_wasm(this.tree[0]);
2126
+ return unmarshalNode(this.tree);
2127
+ }
2128
+ get descendantCount() {
2129
+ marshalNode(this);
2130
+ return C._ts_node_descendant_count_wasm(this.tree[0]);
2131
+ }
2132
+ get parent() {
2133
+ marshalNode(this);
2134
+ C._ts_node_parent_wasm(this.tree[0]);
2135
+ return unmarshalNode(this.tree);
2136
+ }
2137
+ descendantForIndex(start2, end = start2) {
2138
+ if (typeof start2 !== "number" || typeof end !== "number") {
2139
+ throw new Error("Arguments must be numbers");
2140
+ }
2141
+ marshalNode(this);
2142
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
2143
+ setValue(address, start2, "i32");
2144
+ setValue(address + SIZE_OF_INT, end, "i32");
2145
+ C._ts_node_descendant_for_index_wasm(this.tree[0]);
2146
+ return unmarshalNode(this.tree);
2147
+ }
2148
+ namedDescendantForIndex(start2, end = start2) {
2149
+ if (typeof start2 !== "number" || typeof end !== "number") {
2150
+ throw new Error("Arguments must be numbers");
2151
+ }
2152
+ marshalNode(this);
2153
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
2154
+ setValue(address, start2, "i32");
2155
+ setValue(address + SIZE_OF_INT, end, "i32");
2156
+ C._ts_node_named_descendant_for_index_wasm(this.tree[0]);
2157
+ return unmarshalNode(this.tree);
2158
+ }
2159
+ descendantForPosition(start2, end = start2) {
2160
+ if (!isPoint(start2) || !isPoint(end)) {
2161
+ throw new Error("Arguments must be {row, column} objects");
2162
+ }
2163
+ marshalNode(this);
2164
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
2165
+ marshalPoint(address, start2);
2166
+ marshalPoint(address + SIZE_OF_POINT, end);
2167
+ C._ts_node_descendant_for_position_wasm(this.tree[0]);
2168
+ return unmarshalNode(this.tree);
2169
+ }
2170
+ namedDescendantForPosition(start2, end = start2) {
2171
+ if (!isPoint(start2) || !isPoint(end)) {
2172
+ throw new Error("Arguments must be {row, column} objects");
2173
+ }
2174
+ marshalNode(this);
2175
+ const address = TRANSFER_BUFFER + SIZE_OF_NODE;
2176
+ marshalPoint(address, start2);
2177
+ marshalPoint(address + SIZE_OF_POINT, end);
2178
+ C._ts_node_named_descendant_for_position_wasm(this.tree[0]);
2179
+ return unmarshalNode(this.tree);
2180
+ }
2181
+ walk() {
2182
+ marshalNode(this);
2183
+ C._ts_tree_cursor_new_wasm(this.tree[0]);
2184
+ return new TreeCursor(INTERNAL, this.tree);
2185
+ }
2186
+ toString() {
2187
+ marshalNode(this);
2188
+ const address = C._ts_node_to_string_wasm(this.tree[0]);
2189
+ const result = AsciiToString(address);
2190
+ C._free(address);
2191
+ return result;
2192
+ }
2193
+ }
2194
+ class TreeCursor {
2195
+ static {
2196
+ __name(this, "TreeCursor");
2197
+ }
2198
+ constructor(internal, tree) {
2199
+ assertInternal(internal);
2200
+ this.tree = tree;
2201
+ unmarshalTreeCursor(this);
2202
+ }
2203
+ delete() {
2204
+ marshalTreeCursor(this);
2205
+ C._ts_tree_cursor_delete_wasm(this.tree[0]);
2206
+ this[0] = this[1] = this[2] = 0;
2207
+ }
2208
+ reset(node) {
2209
+ marshalNode(node);
2210
+ marshalTreeCursor(this, TRANSFER_BUFFER + SIZE_OF_NODE);
2211
+ C._ts_tree_cursor_reset_wasm(this.tree[0]);
2212
+ unmarshalTreeCursor(this);
2213
+ }
2214
+ resetTo(cursor) {
2215
+ marshalTreeCursor(this, TRANSFER_BUFFER);
2216
+ marshalTreeCursor(cursor, TRANSFER_BUFFER + SIZE_OF_CURSOR);
2217
+ C._ts_tree_cursor_reset_to_wasm(this.tree[0], cursor.tree[0]);
2218
+ unmarshalTreeCursor(this);
2219
+ }
2220
+ get nodeType() {
2221
+ return this.tree.language.types[this.nodeTypeId] || "ERROR";
2222
+ }
2223
+ get nodeTypeId() {
2224
+ marshalTreeCursor(this);
2225
+ return C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0]);
2226
+ }
2227
+ get nodeStateId() {
2228
+ marshalTreeCursor(this);
2229
+ return C._ts_tree_cursor_current_node_state_id_wasm(this.tree[0]);
2230
+ }
2231
+ get nodeId() {
2232
+ marshalTreeCursor(this);
2233
+ return C._ts_tree_cursor_current_node_id_wasm(this.tree[0]);
2234
+ }
2235
+ get nodeIsNamed() {
2236
+ marshalTreeCursor(this);
2237
+ return C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0]) === 1;
2238
+ }
2239
+ get nodeIsMissing() {
2240
+ marshalTreeCursor(this);
2241
+ return C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0]) === 1;
2242
+ }
2243
+ get nodeText() {
2244
+ marshalTreeCursor(this);
2245
+ const startIndex = C._ts_tree_cursor_start_index_wasm(this.tree[0]);
2246
+ const endIndex = C._ts_tree_cursor_end_index_wasm(this.tree[0]);
2247
+ return getText(this.tree, startIndex, endIndex);
2248
+ }
2249
+ get startPosition() {
2250
+ marshalTreeCursor(this);
2251
+ C._ts_tree_cursor_start_position_wasm(this.tree[0]);
2252
+ return unmarshalPoint(TRANSFER_BUFFER);
2253
+ }
2254
+ get endPosition() {
2255
+ marshalTreeCursor(this);
2256
+ C._ts_tree_cursor_end_position_wasm(this.tree[0]);
2257
+ return unmarshalPoint(TRANSFER_BUFFER);
2258
+ }
2259
+ get startIndex() {
2260
+ marshalTreeCursor(this);
2261
+ return C._ts_tree_cursor_start_index_wasm(this.tree[0]);
2262
+ }
2263
+ get endIndex() {
2264
+ marshalTreeCursor(this);
2265
+ return C._ts_tree_cursor_end_index_wasm(this.tree[0]);
2266
+ }
2267
+ get currentNode() {
2268
+ marshalTreeCursor(this);
2269
+ C._ts_tree_cursor_current_node_wasm(this.tree[0]);
2270
+ return unmarshalNode(this.tree);
2271
+ }
2272
+ get currentFieldId() {
2273
+ marshalTreeCursor(this);
2274
+ return C._ts_tree_cursor_current_field_id_wasm(this.tree[0]);
2275
+ }
2276
+ get currentFieldName() {
2277
+ return this.tree.language.fields[this.currentFieldId];
2278
+ }
2279
+ get currentDepth() {
2280
+ marshalTreeCursor(this);
2281
+ return C._ts_tree_cursor_current_depth_wasm(this.tree[0]);
2282
+ }
2283
+ get currentDescendantIndex() {
2284
+ marshalTreeCursor(this);
2285
+ return C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0]);
2286
+ }
2287
+ gotoFirstChild() {
2288
+ marshalTreeCursor(this);
2289
+ const result = C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);
2290
+ unmarshalTreeCursor(this);
2291
+ return result === 1;
2292
+ }
2293
+ gotoLastChild() {
2294
+ marshalTreeCursor(this);
2295
+ const result = C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);
2296
+ unmarshalTreeCursor(this);
2297
+ return result === 1;
2298
+ }
2299
+ gotoFirstChildForIndex(goalIndex) {
2300
+ marshalTreeCursor(this);
2301
+ setValue(TRANSFER_BUFFER + SIZE_OF_CURSOR, goalIndex, "i32");
2302
+ const result = C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);
2303
+ unmarshalTreeCursor(this);
2304
+ return result === 1;
2305
+ }
2306
+ gotoFirstChildForPosition(goalPosition) {
2307
+ marshalTreeCursor(this);
2308
+ marshalPoint(TRANSFER_BUFFER + SIZE_OF_CURSOR, goalPosition);
2309
+ const result = C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);
2310
+ unmarshalTreeCursor(this);
2311
+ return result === 1;
2312
+ }
2313
+ gotoNextSibling() {
2314
+ marshalTreeCursor(this);
2315
+ const result = C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);
2316
+ unmarshalTreeCursor(this);
2317
+ return result === 1;
2318
+ }
2319
+ gotoPreviousSibling() {
2320
+ marshalTreeCursor(this);
2321
+ const result = C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);
2322
+ unmarshalTreeCursor(this);
2323
+ return result === 1;
2324
+ }
2325
+ gotoDescendant(goalDescendantindex) {
2326
+ marshalTreeCursor(this);
2327
+ C._ts_tree_cursor_goto_descendant_wasm(this.tree[0], goalDescendantindex);
2328
+ unmarshalTreeCursor(this);
2329
+ }
2330
+ gotoParent() {
2331
+ marshalTreeCursor(this);
2332
+ const result = C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);
2333
+ unmarshalTreeCursor(this);
2334
+ return result === 1;
2335
+ }
2336
+ }
2337
+ class Language {
2338
+ static {
2339
+ __name(this, "Language");
2340
+ }
2341
+ constructor(internal, address) {
2342
+ assertInternal(internal);
2343
+ this[0] = address;
2344
+ this.types = new Array(C._ts_language_symbol_count(this[0]));
2345
+ for (let i2 = 0, n = this.types.length; i2 < n; i2++) {
2346
+ if (C._ts_language_symbol_type(this[0], i2) < 2) {
2347
+ this.types[i2] = UTF8ToString(C._ts_language_symbol_name(this[0], i2));
2348
+ }
2349
+ }
2350
+ this.fields = new Array(C._ts_language_field_count(this[0]) + 1);
2351
+ for (let i2 = 0, n = this.fields.length; i2 < n; i2++) {
2352
+ const fieldName = C._ts_language_field_name_for_id(this[0], i2);
2353
+ if (fieldName !== 0) {
2354
+ this.fields[i2] = UTF8ToString(fieldName);
2355
+ } else {
2356
+ this.fields[i2] = null;
2357
+ }
2358
+ }
2359
+ }
2360
+ get version() {
2361
+ return C._ts_language_version(this[0]);
2362
+ }
2363
+ get fieldCount() {
2364
+ return this.fields.length - 1;
2365
+ }
2366
+ get stateCount() {
2367
+ return C._ts_language_state_count(this[0]);
2368
+ }
2369
+ fieldIdForName(fieldName) {
2370
+ const result = this.fields.indexOf(fieldName);
2371
+ if (result !== -1) {
2372
+ return result;
2373
+ } else {
2374
+ return null;
2375
+ }
2376
+ }
2377
+ fieldNameForId(fieldId) {
2378
+ return this.fields[fieldId] || null;
2379
+ }
2380
+ idForNodeType(type, named) {
2381
+ const typeLength = lengthBytesUTF8(type);
2382
+ const typeAddress = C._malloc(typeLength + 1);
2383
+ stringToUTF8(type, typeAddress, typeLength + 1);
2384
+ const result = C._ts_language_symbol_for_name(this[0], typeAddress, typeLength, named);
2385
+ C._free(typeAddress);
2386
+ return result || null;
2387
+ }
2388
+ get nodeTypeCount() {
2389
+ return C._ts_language_symbol_count(this[0]);
2390
+ }
2391
+ nodeTypeForId(typeId) {
2392
+ const name2 = C._ts_language_symbol_name(this[0], typeId);
2393
+ return name2 ? UTF8ToString(name2) : null;
2394
+ }
2395
+ nodeTypeIsNamed(typeId) {
2396
+ return C._ts_language_type_is_named_wasm(this[0], typeId) ? true : false;
2397
+ }
2398
+ nodeTypeIsVisible(typeId) {
2399
+ return C._ts_language_type_is_visible_wasm(this[0], typeId) ? true : false;
2400
+ }
2401
+ nextState(stateId, typeId) {
2402
+ return C._ts_language_next_state(this[0], stateId, typeId);
2403
+ }
2404
+ lookaheadIterator(stateId) {
2405
+ const address = C._ts_lookahead_iterator_new(this[0], stateId);
2406
+ if (address) return new LookaheadIterable(INTERNAL, address, this);
2407
+ return null;
2408
+ }
2409
+ query(source) {
2410
+ const sourceLength = lengthBytesUTF8(source);
2411
+ const sourceAddress = C._malloc(sourceLength + 1);
2412
+ stringToUTF8(source, sourceAddress, sourceLength + 1);
2413
+ const address = C._ts_query_new(this[0], sourceAddress, sourceLength, TRANSFER_BUFFER, TRANSFER_BUFFER + SIZE_OF_INT);
2414
+ if (!address) {
2415
+ const errorId = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
2416
+ const errorByte = getValue(TRANSFER_BUFFER, "i32");
2417
+ const errorIndex = UTF8ToString(sourceAddress, errorByte).length;
2418
+ const suffix = source.substr(errorIndex, 100).split("\n")[0];
2419
+ let word = suffix.match(QUERY_WORD_REGEX)[0];
2420
+ let error;
2421
+ switch (errorId) {
2422
+ case 2:
2423
+ error = new RangeError(`Bad node name '${word}'`);
2424
+ break;
2425
+ case 3:
2426
+ error = new RangeError(`Bad field name '${word}'`);
2427
+ break;
2428
+ case 4:
2429
+ error = new RangeError(`Bad capture name @${word}`);
2430
+ break;
2431
+ case 5:
2432
+ error = new TypeError(`Bad pattern structure at offset ${errorIndex}: '${suffix}'...`);
2433
+ word = "";
2434
+ break;
2435
+ default:
2436
+ error = new SyntaxError(`Bad syntax at offset ${errorIndex}: '${suffix}'...`);
2437
+ word = "";
2438
+ break;
2439
+ }
2440
+ error.index = errorIndex;
2441
+ error.length = word.length;
2442
+ C._free(sourceAddress);
2443
+ throw error;
2444
+ }
2445
+ const stringCount = C._ts_query_string_count(address);
2446
+ const captureCount = C._ts_query_capture_count(address);
2447
+ const patternCount = C._ts_query_pattern_count(address);
2448
+ const captureNames = new Array(captureCount);
2449
+ const stringValues = new Array(stringCount);
2450
+ for (let i2 = 0; i2 < captureCount; i2++) {
2451
+ const nameAddress = C._ts_query_capture_name_for_id(address, i2, TRANSFER_BUFFER);
2452
+ const nameLength = getValue(TRANSFER_BUFFER, "i32");
2453
+ captureNames[i2] = UTF8ToString(nameAddress, nameLength);
2454
+ }
2455
+ for (let i2 = 0; i2 < stringCount; i2++) {
2456
+ const valueAddress = C._ts_query_string_value_for_id(address, i2, TRANSFER_BUFFER);
2457
+ const nameLength = getValue(TRANSFER_BUFFER, "i32");
2458
+ stringValues[i2] = UTF8ToString(valueAddress, nameLength);
2459
+ }
2460
+ const setProperties = new Array(patternCount);
2461
+ const assertedProperties = new Array(patternCount);
2462
+ const refutedProperties = new Array(patternCount);
2463
+ const predicates = new Array(patternCount);
2464
+ const textPredicates = new Array(patternCount);
2465
+ for (let i2 = 0; i2 < patternCount; i2++) {
2466
+ const predicatesAddress = C._ts_query_predicates_for_pattern(address, i2, TRANSFER_BUFFER);
2467
+ const stepCount = getValue(TRANSFER_BUFFER, "i32");
2468
+ predicates[i2] = [];
2469
+ textPredicates[i2] = [];
2470
+ const steps = [];
2471
+ let stepAddress = predicatesAddress;
2472
+ for (let j = 0; j < stepCount; j++) {
2473
+ const stepType = getValue(stepAddress, "i32");
2474
+ stepAddress += SIZE_OF_INT;
2475
+ const stepValueId = getValue(stepAddress, "i32");
2476
+ stepAddress += SIZE_OF_INT;
2477
+ if (stepType === PREDICATE_STEP_TYPE_CAPTURE) {
2478
+ steps.push({
2479
+ type: "capture",
2480
+ name: captureNames[stepValueId]
2481
+ });
2482
+ } else if (stepType === PREDICATE_STEP_TYPE_STRING) {
2483
+ steps.push({
2484
+ type: "string",
2485
+ value: stringValues[stepValueId]
2486
+ });
2487
+ } else if (steps.length > 0) {
2488
+ if (steps[0].type !== "string") {
2489
+ throw new Error("Predicates must begin with a literal value");
2490
+ }
2491
+ const operator = steps[0].value;
2492
+ let isPositive = true;
2493
+ let matchAll = true;
2494
+ let captureName;
2495
+ switch (operator) {
2496
+ case "any-not-eq?":
2497
+ case "not-eq?":
2498
+ isPositive = false;
2499
+ case "any-eq?":
2500
+ case "eq?":
2501
+ if (steps.length !== 3) {
2502
+ throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 2, got ${steps.length - 1}`);
2503
+ }
2504
+ if (steps[1].type !== "capture") {
2505
+ throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}"`);
2506
+ }
2507
+ matchAll = !operator.startsWith("any-");
2508
+ if (steps[2].type === "capture") {
2509
+ const captureName1 = steps[1].name;
2510
+ const captureName2 = steps[2].name;
2511
+ textPredicates[i2].push((captures) => {
2512
+ const nodes1 = [];
2513
+ const nodes2 = [];
2514
+ for (const c of captures) {
2515
+ if (c.name === captureName1) nodes1.push(c.node);
2516
+ if (c.name === captureName2) nodes2.push(c.node);
2517
+ }
2518
+ const compare = /* @__PURE__ */ __name((n1, n2, positive) => positive ? n1.text === n2.text : n1.text !== n2.text, "compare");
2519
+ return matchAll ? nodes1.every((n1) => nodes2.some((n2) => compare(n1, n2, isPositive))) : nodes1.some((n1) => nodes2.some((n2) => compare(n1, n2, isPositive)));
2520
+ });
2521
+ } else {
2522
+ captureName = steps[1].name;
2523
+ const stringValue = steps[2].value;
2524
+ const matches = /* @__PURE__ */ __name((n) => n.text === stringValue, "matches");
2525
+ const doesNotMatch = /* @__PURE__ */ __name((n) => n.text !== stringValue, "doesNotMatch");
2526
+ textPredicates[i2].push((captures) => {
2527
+ const nodes = [];
2528
+ for (const c of captures) {
2529
+ if (c.name === captureName) nodes.push(c.node);
2530
+ }
2531
+ const test = isPositive ? matches : doesNotMatch;
2532
+ return matchAll ? nodes.every(test) : nodes.some(test);
2533
+ });
2534
+ }
2535
+ break;
2536
+ case "any-not-match?":
2537
+ case "not-match?":
2538
+ isPositive = false;
2539
+ case "any-match?":
2540
+ case "match?":
2541
+ if (steps.length !== 3) {
2542
+ throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 2, got ${steps.length - 1}.`);
2543
+ }
2544
+ if (steps[1].type !== "capture") {
2545
+ throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}".`);
2546
+ }
2547
+ if (steps[2].type !== "string") {
2548
+ throw new Error(`Second argument of \`#${operator}\` predicate must be a string. Got @${steps[2].value}.`);
2549
+ }
2550
+ captureName = steps[1].name;
2551
+ const regex = new RegExp(steps[2].value);
2552
+ matchAll = !operator.startsWith("any-");
2553
+ textPredicates[i2].push((captures) => {
2554
+ const nodes = [];
2555
+ for (const c of captures) {
2556
+ if (c.name === captureName) nodes.push(c.node.text);
2557
+ }
2558
+ const test = /* @__PURE__ */ __name((text, positive) => positive ? regex.test(text) : !regex.test(text), "test");
2559
+ if (nodes.length === 0) return !isPositive;
2560
+ return matchAll ? nodes.every((text) => test(text, isPositive)) : nodes.some((text) => test(text, isPositive));
2561
+ });
2562
+ break;
2563
+ case "set!":
2564
+ if (steps.length < 2 || steps.length > 3) {
2565
+ throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
2566
+ }
2567
+ if (steps.some((s) => s.type !== "string")) {
2568
+ throw new Error(`Arguments to \`#set!\` predicate must be a strings.".`);
2569
+ }
2570
+ if (!setProperties[i2]) setProperties[i2] = {};
2571
+ setProperties[i2][steps[1].value] = steps[2] ? steps[2].value : null;
2572
+ break;
2573
+ case "is?":
2574
+ case "is-not?":
2575
+ if (steps.length < 2 || steps.length > 3) {
2576
+ throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected 1 or 2. Got ${steps.length - 1}.`);
2577
+ }
2578
+ if (steps.some((s) => s.type !== "string")) {
2579
+ throw new Error(`Arguments to \`#${operator}\` predicate must be a strings.".`);
2580
+ }
2581
+ const properties = operator === "is?" ? assertedProperties : refutedProperties;
2582
+ if (!properties[i2]) properties[i2] = {};
2583
+ properties[i2][steps[1].value] = steps[2] ? steps[2].value : null;
2584
+ break;
2585
+ case "not-any-of?":
2586
+ isPositive = false;
2587
+ case "any-of?":
2588
+ if (steps.length < 2) {
2589
+ throw new Error(`Wrong number of arguments to \`#${operator}\` predicate. Expected at least 1. Got ${steps.length - 1}.`);
2590
+ }
2591
+ if (steps[1].type !== "capture") {
2592
+ throw new Error(`First argument of \`#${operator}\` predicate must be a capture. Got "${steps[1].value}".`);
2593
+ }
2594
+ for (let i3 = 2; i3 < steps.length; i3++) {
2595
+ if (steps[i3].type !== "string") {
2596
+ throw new Error(`Arguments to \`#${operator}\` predicate must be a strings.".`);
2597
+ }
2598
+ }
2599
+ captureName = steps[1].name;
2600
+ const values = steps.slice(2).map((s) => s.value);
2601
+ textPredicates[i2].push((captures) => {
2602
+ const nodes = [];
2603
+ for (const c of captures) {
2604
+ if (c.name === captureName) nodes.push(c.node.text);
2605
+ }
2606
+ if (nodes.length === 0) return !isPositive;
2607
+ return nodes.every((text) => values.includes(text)) === isPositive;
2608
+ });
2609
+ break;
2610
+ default:
2611
+ predicates[i2].push({
2612
+ operator,
2613
+ operands: steps.slice(1)
2614
+ });
2615
+ }
2616
+ steps.length = 0;
2617
+ }
2618
+ }
2619
+ Object.freeze(setProperties[i2]);
2620
+ Object.freeze(assertedProperties[i2]);
2621
+ Object.freeze(refutedProperties[i2]);
2622
+ }
2623
+ C._free(sourceAddress);
2624
+ return new Query(INTERNAL, address, captureNames, textPredicates, predicates, Object.freeze(setProperties), Object.freeze(assertedProperties), Object.freeze(refutedProperties));
2625
+ }
2626
+ static load(input) {
2627
+ let bytes;
2628
+ if (input instanceof Uint8Array) {
2629
+ bytes = Promise.resolve(input);
2630
+ } else {
2631
+ const url = input;
2632
+ if (typeof process !== "undefined" && process.versions && process.versions.node) {
2633
+ const fs2 = __require("fs");
2634
+ bytes = Promise.resolve(fs2.readFileSync(url));
2635
+ } else {
2636
+ bytes = fetch(url).then((response) => response.arrayBuffer().then((buffer) => {
2637
+ if (response.ok) {
2638
+ return new Uint8Array(buffer);
2639
+ } else {
2640
+ const body2 = new TextDecoder("utf-8").decode(buffer);
2641
+ throw new Error(`Language.load failed with status ${response.status}.
2642
+
2643
+ ${body2}`);
2644
+ }
2645
+ }));
2646
+ }
2647
+ }
2648
+ return bytes.then((bytes2) => loadWebAssemblyModule(bytes2, {
2649
+ loadAsync: true
2650
+ })).then((mod) => {
2651
+ const symbolNames = Object.keys(mod);
2652
+ const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
2653
+ if (!functionName) {
2654
+ console.log(`Couldn't find language function in WASM file. Symbols:
2655
+ ${JSON.stringify(symbolNames, null, 2)}`);
2656
+ }
2657
+ const languageAddress = mod[functionName]();
2658
+ return new Language(INTERNAL, languageAddress);
2659
+ });
2660
+ }
2661
+ }
2662
+ class LookaheadIterable {
2663
+ static {
2664
+ __name(this, "LookaheadIterable");
2665
+ }
2666
+ constructor(internal, address, language) {
2667
+ assertInternal(internal);
2668
+ this[0] = address;
2669
+ this.language = language;
2670
+ }
2671
+ get currentTypeId() {
2672
+ return C._ts_lookahead_iterator_current_symbol(this[0]);
2673
+ }
2674
+ get currentType() {
2675
+ return this.language.types[this.currentTypeId] || "ERROR";
2676
+ }
2677
+ delete() {
2678
+ C._ts_lookahead_iterator_delete(this[0]);
2679
+ this[0] = 0;
2680
+ }
2681
+ resetState(stateId) {
2682
+ return C._ts_lookahead_iterator_reset_state(this[0], stateId);
2683
+ }
2684
+ reset(language, stateId) {
2685
+ if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
2686
+ this.language = language;
2687
+ return true;
2688
+ }
2689
+ return false;
2690
+ }
2691
+ [Symbol.iterator]() {
2692
+ const self2 = this;
2693
+ return {
2694
+ next() {
2695
+ if (C._ts_lookahead_iterator_next(self2[0])) {
2696
+ return {
2697
+ done: false,
2698
+ value: self2.currentType
2699
+ };
2700
+ }
2701
+ return {
2702
+ done: true,
2703
+ value: ""
2704
+ };
2705
+ }
2706
+ };
2707
+ }
2708
+ }
2709
+ class Query {
2710
+ static {
2711
+ __name(this, "Query");
2712
+ }
2713
+ constructor(internal, address, captureNames, textPredicates, predicates, setProperties, assertedProperties, refutedProperties) {
2714
+ assertInternal(internal);
2715
+ this[0] = address;
2716
+ this.captureNames = captureNames;
2717
+ this.textPredicates = textPredicates;
2718
+ this.predicates = predicates;
2719
+ this.setProperties = setProperties;
2720
+ this.assertedProperties = assertedProperties;
2721
+ this.refutedProperties = refutedProperties;
2722
+ this.exceededMatchLimit = false;
2723
+ }
2724
+ delete() {
2725
+ C._ts_query_delete(this[0]);
2726
+ this[0] = 0;
2727
+ }
2728
+ matches(node, { startPosition = ZERO_POINT, endPosition = ZERO_POINT, startIndex = 0, endIndex = 0, matchLimit = 4294967295, maxStartDepth = 4294967295, timeoutMicros = 0 } = {}) {
2729
+ if (typeof matchLimit !== "number") {
2730
+ throw new Error("Arguments must be numbers");
2731
+ }
2732
+ marshalNode(node);
2733
+ C._ts_query_matches_wasm(this[0], node.tree[0], startPosition.row, startPosition.column, endPosition.row, endPosition.column, startIndex, endIndex, matchLimit, maxStartDepth, timeoutMicros);
2734
+ const rawCount = getValue(TRANSFER_BUFFER, "i32");
2735
+ const startAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
2736
+ const didExceedMatchLimit = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
2737
+ const result = new Array(rawCount);
2738
+ this.exceededMatchLimit = Boolean(didExceedMatchLimit);
2739
+ let filteredCount = 0;
2740
+ let address = startAddress;
2741
+ for (let i2 = 0; i2 < rawCount; i2++) {
2742
+ const pattern = getValue(address, "i32");
2743
+ address += SIZE_OF_INT;
2744
+ const captureCount = getValue(address, "i32");
2745
+ address += SIZE_OF_INT;
2746
+ const captures = new Array(captureCount);
2747
+ address = unmarshalCaptures(this, node.tree, address, captures);
2748
+ if (this.textPredicates[pattern].every((p) => p(captures))) {
2749
+ result[filteredCount] = {
2750
+ pattern,
2751
+ captures
2752
+ };
2753
+ const setProperties = this.setProperties[pattern];
2754
+ if (setProperties) result[filteredCount].setProperties = setProperties;
2755
+ const assertedProperties = this.assertedProperties[pattern];
2756
+ if (assertedProperties) result[filteredCount].assertedProperties = assertedProperties;
2757
+ const refutedProperties = this.refutedProperties[pattern];
2758
+ if (refutedProperties) result[filteredCount].refutedProperties = refutedProperties;
2759
+ filteredCount++;
2760
+ }
2761
+ }
2762
+ result.length = filteredCount;
2763
+ C._free(startAddress);
2764
+ return result;
2765
+ }
2766
+ captures(node, { startPosition = ZERO_POINT, endPosition = ZERO_POINT, startIndex = 0, endIndex = 0, matchLimit = 4294967295, maxStartDepth = 4294967295, timeoutMicros = 0 } = {}) {
2767
+ if (typeof matchLimit !== "number") {
2768
+ throw new Error("Arguments must be numbers");
2769
+ }
2770
+ marshalNode(node);
2771
+ C._ts_query_captures_wasm(this[0], node.tree[0], startPosition.row, startPosition.column, endPosition.row, endPosition.column, startIndex, endIndex, matchLimit, maxStartDepth, timeoutMicros);
2772
+ const count = getValue(TRANSFER_BUFFER, "i32");
2773
+ const startAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
2774
+ const didExceedMatchLimit = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
2775
+ const result = [];
2776
+ this.exceededMatchLimit = Boolean(didExceedMatchLimit);
2777
+ const captures = [];
2778
+ let address = startAddress;
2779
+ for (let i2 = 0; i2 < count; i2++) {
2780
+ const pattern = getValue(address, "i32");
2781
+ address += SIZE_OF_INT;
2782
+ const captureCount = getValue(address, "i32");
2783
+ address += SIZE_OF_INT;
2784
+ const captureIndex = getValue(address, "i32");
2785
+ address += SIZE_OF_INT;
2786
+ captures.length = captureCount;
2787
+ address = unmarshalCaptures(this, node.tree, address, captures);
2788
+ if (this.textPredicates[pattern].every((p) => p(captures))) {
2789
+ const capture = captures[captureIndex];
2790
+ const setProperties = this.setProperties[pattern];
2791
+ if (setProperties) capture.setProperties = setProperties;
2792
+ const assertedProperties = this.assertedProperties[pattern];
2793
+ if (assertedProperties) capture.assertedProperties = assertedProperties;
2794
+ const refutedProperties = this.refutedProperties[pattern];
2795
+ if (refutedProperties) capture.refutedProperties = refutedProperties;
2796
+ result.push(capture);
2797
+ }
2798
+ }
2799
+ C._free(startAddress);
2800
+ return result;
2801
+ }
2802
+ predicatesForPattern(patternIndex) {
2803
+ return this.predicates[patternIndex];
2804
+ }
2805
+ disableCapture(captureName) {
2806
+ const captureNameLength = lengthBytesUTF8(captureName);
2807
+ const captureNameAddress = C._malloc(captureNameLength + 1);
2808
+ stringToUTF8(captureName, captureNameAddress, captureNameLength + 1);
2809
+ C._ts_query_disable_capture(this[0], captureNameAddress, captureNameLength);
2810
+ C._free(captureNameAddress);
2811
+ }
2812
+ didExceedMatchLimit() {
2813
+ return this.exceededMatchLimit;
2814
+ }
2815
+ }
2816
+ function getText(tree, startIndex, endIndex) {
2817
+ const length = endIndex - startIndex;
2818
+ let result = tree.textCallback(startIndex, null, endIndex);
2819
+ startIndex += result.length;
2820
+ while (startIndex < endIndex) {
2821
+ const string = tree.textCallback(startIndex, null, endIndex);
2822
+ if (string && string.length > 0) {
2823
+ startIndex += string.length;
2824
+ result += string;
2825
+ } else {
2826
+ break;
2827
+ }
2828
+ }
2829
+ if (startIndex > endIndex) {
2830
+ result = result.slice(0, length);
2831
+ }
2832
+ return result;
2833
+ }
2834
+ __name(getText, "getText");
2835
+ function unmarshalCaptures(query, tree, address, result) {
2836
+ for (let i2 = 0, n = result.length; i2 < n; i2++) {
2837
+ const captureIndex = getValue(address, "i32");
2838
+ address += SIZE_OF_INT;
2839
+ const node = unmarshalNode(tree, address);
2840
+ address += SIZE_OF_NODE;
2841
+ result[i2] = {
2842
+ name: query.captureNames[captureIndex],
2843
+ node
2844
+ };
2845
+ }
2846
+ return address;
2847
+ }
2848
+ __name(unmarshalCaptures, "unmarshalCaptures");
2849
+ function assertInternal(x) {
2850
+ if (x !== INTERNAL) throw new Error("Illegal constructor");
2851
+ }
2852
+ __name(assertInternal, "assertInternal");
2853
+ function isPoint(point) {
2854
+ return point && typeof point.row === "number" && typeof point.column === "number";
2855
+ }
2856
+ __name(isPoint, "isPoint");
2857
+ function marshalNode(node) {
2858
+ let address = TRANSFER_BUFFER;
2859
+ setValue(address, node.id, "i32");
2860
+ address += SIZE_OF_INT;
2861
+ setValue(address, node.startIndex, "i32");
2862
+ address += SIZE_OF_INT;
2863
+ setValue(address, node.startPosition.row, "i32");
2864
+ address += SIZE_OF_INT;
2865
+ setValue(address, node.startPosition.column, "i32");
2866
+ address += SIZE_OF_INT;
2867
+ setValue(address, node[0], "i32");
2868
+ }
2869
+ __name(marshalNode, "marshalNode");
2870
+ function unmarshalNode(tree, address = TRANSFER_BUFFER) {
2871
+ const id = getValue(address, "i32");
2872
+ address += SIZE_OF_INT;
2873
+ if (id === 0) return null;
2874
+ const index = getValue(address, "i32");
2875
+ address += SIZE_OF_INT;
2876
+ const row = getValue(address, "i32");
2877
+ address += SIZE_OF_INT;
2878
+ const column = getValue(address, "i32");
2879
+ address += SIZE_OF_INT;
2880
+ const other = getValue(address, "i32");
2881
+ const result = new Node(INTERNAL, tree);
2882
+ result.id = id;
2883
+ result.startIndex = index;
2884
+ result.startPosition = {
2885
+ row,
2886
+ column
2887
+ };
2888
+ result[0] = other;
2889
+ return result;
2890
+ }
2891
+ __name(unmarshalNode, "unmarshalNode");
2892
+ function marshalTreeCursor(cursor, address = TRANSFER_BUFFER) {
2893
+ setValue(address + 0 * SIZE_OF_INT, cursor[0], "i32");
2894
+ setValue(address + 1 * SIZE_OF_INT, cursor[1], "i32");
2895
+ setValue(address + 2 * SIZE_OF_INT, cursor[2], "i32");
2896
+ setValue(address + 3 * SIZE_OF_INT, cursor[3], "i32");
2897
+ }
2898
+ __name(marshalTreeCursor, "marshalTreeCursor");
2899
+ function unmarshalTreeCursor(cursor) {
2900
+ cursor[0] = getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, "i32");
2901
+ cursor[1] = getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, "i32");
2902
+ cursor[2] = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32");
2903
+ cursor[3] = getValue(TRANSFER_BUFFER + 3 * SIZE_OF_INT, "i32");
2904
+ }
2905
+ __name(unmarshalTreeCursor, "unmarshalTreeCursor");
2906
+ function marshalPoint(address, point) {
2907
+ setValue(address, point.row, "i32");
2908
+ setValue(address + SIZE_OF_INT, point.column, "i32");
2909
+ }
2910
+ __name(marshalPoint, "marshalPoint");
2911
+ function unmarshalPoint(address) {
2912
+ const result = {
2913
+ row: getValue(address, "i32") >>> 0,
2914
+ column: getValue(address + SIZE_OF_INT, "i32") >>> 0
2915
+ };
2916
+ return result;
2917
+ }
2918
+ __name(unmarshalPoint, "unmarshalPoint");
2919
+ function marshalRange(address, range) {
2920
+ marshalPoint(address, range.startPosition);
2921
+ address += SIZE_OF_POINT;
2922
+ marshalPoint(address, range.endPosition);
2923
+ address += SIZE_OF_POINT;
2924
+ setValue(address, range.startIndex, "i32");
2925
+ address += SIZE_OF_INT;
2926
+ setValue(address, range.endIndex, "i32");
2927
+ address += SIZE_OF_INT;
2928
+ }
2929
+ __name(marshalRange, "marshalRange");
2930
+ function unmarshalRange(address) {
2931
+ const result = {};
2932
+ result.startPosition = unmarshalPoint(address);
2933
+ address += SIZE_OF_POINT;
2934
+ result.endPosition = unmarshalPoint(address);
2935
+ address += SIZE_OF_POINT;
2936
+ result.startIndex = getValue(address, "i32") >>> 0;
2937
+ address += SIZE_OF_INT;
2938
+ result.endIndex = getValue(address, "i32") >>> 0;
2939
+ return result;
2940
+ }
2941
+ __name(unmarshalRange, "unmarshalRange");
2942
+ function marshalEdit(edit) {
2943
+ let address = TRANSFER_BUFFER;
2944
+ marshalPoint(address, edit.startPosition);
2945
+ address += SIZE_OF_POINT;
2946
+ marshalPoint(address, edit.oldEndPosition);
2947
+ address += SIZE_OF_POINT;
2948
+ marshalPoint(address, edit.newEndPosition);
2949
+ address += SIZE_OF_POINT;
2950
+ setValue(address, edit.startIndex, "i32");
2951
+ address += SIZE_OF_INT;
2952
+ setValue(address, edit.oldEndIndex, "i32");
2953
+ address += SIZE_OF_INT;
2954
+ setValue(address, edit.newEndIndex, "i32");
2955
+ address += SIZE_OF_INT;
2956
+ }
2957
+ __name(marshalEdit, "marshalEdit");
2958
+ for (const name2 of Object.getOwnPropertyNames(ParserImpl.prototype)) {
2959
+ Object.defineProperty(Parser.prototype, name2, {
2960
+ value: ParserImpl.prototype[name2],
2961
+ enumerable: false,
2962
+ writable: false
2963
+ });
2964
+ }
2965
+ Parser.Language = Language;
2966
+ Module.onRuntimeInitialized = () => {
2967
+ ParserImpl.init();
2968
+ resolveInitPromise();
2969
+ };
2970
+ });
2971
+ }
2972
+ }
2973
+ return Parser;
2974
+ }();
2975
+ if (typeof exports === "object") {
2976
+ module.exports = TreeSitter;
2977
+ }
2978
+ }
2979
+ });
2980
+ export default require_tree_sitter();