@qwen-code/qwen-code 0.18.3-preview.0 → 0.18.4-preview.0

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 (508) hide show
  1. package/README.md +64 -492
  2. package/bundled/loop/SKILL.md +53 -26
  3. package/bundled/loop/SKILL.test.ts +67 -0
  4. package/bundled/qc-helper/docs/configuration/settings.md +25 -18
  5. package/bundled/qc-helper/docs/extension/introduction.md +38 -0
  6. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  7. package/bundled/qc-helper/docs/features/channels/overview.md +4 -4
  8. package/bundled/qc-helper/docs/features/channels/qqbot.md +179 -0
  9. package/bundled/qc-helper/docs/features/commands.md +49 -0
  10. package/bundled/qc-helper/docs/features/followup-suggestions.md +10 -6
  11. package/bundled/qc-helper/docs/features/hooks.md +6 -3
  12. package/bundled/qc-helper/docs/features/status-line.md +4 -2
  13. package/bundled/qc-helper/docs/qwen-serve.md +9 -4
  14. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +11 -5
  15. package/bundled/qc-helper/docs/support/troubleshooting.md +5 -0
  16. package/chunks/{agent-X42UKL4M.js → agent-PPGQVSZN.js} +24 -23
  17. package/chunks/{agent-headless-7FQ7NX6G.js → agent-headless-5SGQIWGS.js} +24 -23
  18. package/chunks/{anthropicContentGenerator-KLBHYGH6.js → anthropicContentGenerator-OLOGBVLP.js} +4 -4
  19. package/chunks/{askUserQuestion-QPZXR3UO.js → askUserQuestion-ANRVSBIJ.js} +2 -2
  20. package/chunks/{ca-RK4QPLIX.js → ca-K6MD665I.js} +42 -2
  21. package/chunks/chunk-2ES3D3TW.js +1026 -0
  22. package/chunks/{chunk-O4PICXES.js → chunk-2MPVVENX.js} +14 -6
  23. package/chunks/{chunk-BJ5HQ23U.js → chunk-4HMWGHPP.js} +9 -10
  24. package/chunks/{chunk-SFRV6BGY.js → chunk-4TW2JM5Q.js} +3 -3
  25. package/chunks/{chunk-ZOFNJQNJ.js → chunk-7GX7XYZU.js} +3 -3
  26. package/chunks/{chunk-VIEIRAK3.js → chunk-7OCZ77KA.js} +4 -2
  27. package/chunks/{chunk-3U2ZIZDP.js → chunk-A6OKBLUA.js} +732 -617
  28. package/chunks/{chunk-RTTAC5VW.js → chunk-AQDPHFDZ.js} +1 -1
  29. package/chunks/{chunk-U62OHNQR.js → chunk-BR6DF3Y4.js} +6 -6
  30. package/chunks/{chunk-IDYDPBBN.js → chunk-DZCZZPCY.js} +3 -3
  31. package/chunks/{chunk-ZMIBJS45.js → chunk-E5SRTXRG.js} +1 -1
  32. package/chunks/{chunk-FIQECJTQ.js → chunk-F6FP3URI.js} +1 -1
  33. package/chunks/{chunk-IQHSD7K5.js → chunk-FPZF3BNV.js} +1 -1
  34. package/chunks/{chunk-NNIYWQIS.js → chunk-HU3RKEK2.js} +2 -1
  35. package/chunks/{chunk-HA2UEYZP.js → chunk-IKOWINH4.js} +7 -4
  36. package/chunks/{chunk-JHSQY3J5.js → chunk-IS4QOHTV.js} +6 -5
  37. package/chunks/{chunk-MN5RAXVB.js → chunk-IUEQOXOI.js} +18 -6
  38. package/chunks/{chunk-CPVI5J2L.js → chunk-JIJBNW4A.js} +1 -1
  39. package/chunks/{chunk-ZNUMXPNK.js → chunk-JJHY7NAD.js} +7 -3
  40. package/chunks/{chunk-YJDVHAGL.js → chunk-JN6FVOPP.js} +2 -2
  41. package/chunks/{chunk-P5CE42XM.js → chunk-JP3LQIMW.js} +1046 -293
  42. package/chunks/{chunk-VU6A2OBJ.js → chunk-JXQ23SNT.js} +217 -219
  43. package/chunks/{chunk-WPTCDQN6.js → chunk-M5VYHAHT.js} +2 -2
  44. package/chunks/{chunk-VFW7VM7A.js → chunk-MP436DDQ.js} +131009 -128408
  45. package/chunks/{chunk-LXYWINWF.js → chunk-N5QHMPZU.js} +1 -1
  46. package/chunks/{chunk-LYSND7KR.js → chunk-PTGKSUUJ.js} +2 -2
  47. package/chunks/{chunk-6X6PTTH3.js → chunk-VNMHFAZ3.js} +24 -12
  48. package/chunks/{chunk-LYRSMKLS.js → chunk-VWPDSQZY.js} +2 -2
  49. package/chunks/{chunk-B4ZF2KSI.js → chunk-WWU2KUSR.js} +2 -2
  50. package/chunks/{chunk-QP4R5FTG.js → chunk-Z7XXFPGP.js} +4 -3
  51. package/chunks/{chunk-TW522KN6.js → chunk-ZTQ26VBE.js} +13 -6
  52. package/chunks/{computer-use-WHPP33BI.js → computer-use-LPHSGISW.js} +24 -23
  53. package/chunks/contextCommand-SQPW6JX7.js +54 -0
  54. package/chunks/{cron-create-DQKRQMCP.js → cron-create-OKGQO6GX.js} +6 -6
  55. package/chunks/{cron-delete-DOFPHFTI.js → cron-delete-DTJP7L6O.js} +6 -6
  56. package/chunks/{cron-list-RCVOO3CB.js → cron-list-VKZUASFG.js} +24 -10
  57. package/chunks/{de-FGPM4KW5.js → de-K2F3T3TR.js} +41 -1
  58. package/chunks/{dist-2UCAYOX7.js → dist-BD27IA3L.js} +16 -5
  59. package/chunks/{dist-33LHH26D.js → dist-KIYB7DQW.js} +1 -1
  60. package/chunks/{dist-UH7CYT7F.js → dist-OLC6NBSB.js} +51 -10
  61. package/chunks/dist-QFFZWACU.js +2136 -0
  62. package/chunks/{dist-KF43SZZV.js → dist-QUSDBLAK.js} +1 -1
  63. package/chunks/{edit-V22UFE4F.js → edit-OPGWEYXB.js} +26 -27
  64. package/chunks/{en-VP6XPGEC.js → en-KGSAKBJP.js} +232 -0
  65. package/chunks/{enter-worktree-HYS5U3QO.js → enter-worktree-JLFLU22E.js} +24 -23
  66. package/chunks/{enterPlanMode-UR2KPB4Y.js → enterPlanMode-JFBUNYML.js} +47 -23
  67. package/chunks/{exit-worktree-JNIUZIZ3.js → exit-worktree-NU64ZZRI.js} +191 -41
  68. package/chunks/{exitPlanMode-NJY3Y6XQ.js → exitPlanMode-UR6YQE64.js} +81 -43
  69. package/chunks/{fr-ATYBVCLT.js → fr-2CAQEOK6.js} +41 -1
  70. package/chunks/{geminiContentGenerator-SDUMCYHD.js → geminiContentGenerator-KUVZXCGX.js} +4 -4
  71. package/chunks/{glob-Z6UYFZCH.js → glob-RNX6IBFD.js} +26 -24
  72. package/chunks/{grep-WHWDB2HD.js → grep-5GUNAZFX.js} +96 -43
  73. package/chunks/{ja-W2QEA2OI.js → ja-QWL7V6OJ.js} +41 -1
  74. package/chunks/{keychain-token-storage-QSTRHKKL.js → keychain-token-storage-ALKQXYJQ.js} +2 -2
  75. package/chunks/loop-wakeup-RX6YIUSG.js +167 -0
  76. package/chunks/{ls-TRD77UTS.js → ls-6PLNWHMU.js} +3 -3
  77. package/chunks/{lsp-2VFWQPZS.js → lsp-3HFQU4OF.js} +2 -2
  78. package/chunks/{monitor-F4V4YEE4.js → monitor-LYHRV6SR.js} +24 -23
  79. package/chunks/{notebook-edit-P45433KC.js → notebook-edit-B5FEP65B.js} +25 -26
  80. package/chunks/{openaiContentGenerator-DRXB5MSN.js → openaiContentGenerator-XYMMXZFG.js} +12 -11
  81. package/chunks/{pt-ZKEWJFBW.js → pt-2SPOLMAY.js} +41 -1
  82. package/chunks/{qwenContentGenerator-3XZMXLHX.js → qwenContentGenerator-QWPW3P7K.js} +26 -25
  83. package/chunks/{qwenOAuth2-KK433U33.js → qwenOAuth2-XWC5SU63.js} +4 -4
  84. package/chunks/{read-file-WQPROSSJ.js → read-file-ROEHCU4A.js} +9 -8
  85. package/chunks/{ripGrep-EAE7GW6T.js → ripGrep-YBPCCX22.js} +24 -23
  86. package/chunks/{ru-VEKTPJ74.js → ru-35IVJTEH.js} +41 -1
  87. package/chunks/{scheduler-WCMRRLYM.js → scheduler-NIQSNCLH.js} +24 -23
  88. package/chunks/{send-message-QZOC5GA2.js → send-message-IIT3SHA7.js} +2 -2
  89. package/chunks/{serve-BVDNMP5D.js → serve-GME2SMSV.js} +1249 -279
  90. package/chunks/{shell-W4LWEOQL.js → shell-E7NADQBV.js} +24 -23
  91. package/chunks/{skill-VTJI4OPM.js → skill-WVYNAGWW.js} +11 -10
  92. package/chunks/{src-E42UOH5I.js → src-4HJAM36V.js} +137 -59
  93. package/chunks/{syntheticOutput-WJSUK4SZ.js → syntheticOutput-H67FYXU7.js} +3 -3
  94. package/chunks/{task-create-GGSC27HO.js → task-create-OVXHSHAI.js} +7 -7
  95. package/chunks/{task-list-EDHHHSK4.js → task-list-QUUCQJ3U.js} +6 -6
  96. package/chunks/{task-stop-WR5PDVZY.js → task-stop-WA5DMTKK.js} +2 -2
  97. package/chunks/{task-update-UR7NUHBV.js → task-update-PC5427TI.js} +7 -7
  98. package/chunks/{team-create-OAGMFFDJ.js → team-create-BOSQOS35.js} +26 -25
  99. package/chunks/{team-delete-FC33URJK.js → team-delete-ZTEMYRJ3.js} +6 -6
  100. package/chunks/{todoWrite-GO2ME7ZV.js → todoWrite-J6L6ELD6.js} +4 -4
  101. package/chunks/{tool-search-XZPD5EPI.js → tool-search-PPLILX5J.js} +9 -8
  102. package/chunks/{web-fetch-NLLATYIL.js → web-fetch-6XLPPTP7.js} +5 -5
  103. package/chunks/{workflow-AIC3XOX5.js → workflow-CDROZNXC.js} +242 -39
  104. package/chunks/{write-file-6GIRRW43.js → write-file-QY4X7MMO.js} +26 -27
  105. package/chunks/{zh-TW-6YFNCKTA.js → zh-TW-BSG6BUWK.js} +232 -2
  106. package/chunks/{zh-OIXDDQHB.js → zh-X4KM6MTW.js} +233 -0
  107. package/cli.js +10735 -5708
  108. package/examples/agent/agents/diary.md +1 -1
  109. package/examples/mcp-server/qwen-extension.json +8 -1
  110. package/examples/starter/agents/diary.md +1 -1
  111. package/locales/ca.js +67 -2
  112. package/locales/de.js +68 -2
  113. package/locales/en.js +304 -0
  114. package/locales/fr.js +69 -2
  115. package/locales/ja.js +65 -2
  116. package/locales/pt.js +67 -2
  117. package/locales/ru.js +68 -2
  118. package/locales/zh-TW.js +288 -2
  119. package/locales/zh.js +288 -0
  120. package/package.json +4 -3
  121. package/web-shell/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  122. package/web-shell/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  123. package/web-shell/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  124. package/web-shell/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  125. package/web-shell/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  126. package/web-shell/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  127. package/web-shell/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  128. package/web-shell/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  129. package/web-shell/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  130. package/web-shell/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  131. package/web-shell/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  132. package/web-shell/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  133. package/web-shell/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  134. package/web-shell/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  135. package/web-shell/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  136. package/web-shell/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  137. package/web-shell/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  138. package/web-shell/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  139. package/web-shell/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  140. package/web-shell/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  141. package/web-shell/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  142. package/web-shell/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  143. package/web-shell/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  144. package/web-shell/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  145. package/web-shell/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  146. package/web-shell/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  147. package/web-shell/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  148. package/web-shell/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  149. package/web-shell/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  150. package/web-shell/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  151. package/web-shell/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  152. package/web-shell/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  153. package/web-shell/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  154. package/web-shell/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  155. package/web-shell/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  156. package/web-shell/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  157. package/web-shell/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  158. package/web-shell/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  159. package/web-shell/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  160. package/web-shell/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  161. package/web-shell/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  162. package/web-shell/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  163. package/web-shell/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  164. package/web-shell/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  165. package/web-shell/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  166. package/web-shell/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  167. package/web-shell/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  168. package/web-shell/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  169. package/web-shell/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  170. package/web-shell/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  171. package/web-shell/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  172. package/web-shell/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  173. package/web-shell/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  174. package/web-shell/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  175. package/web-shell/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  176. package/web-shell/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  177. package/web-shell/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  178. package/web-shell/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  179. package/web-shell/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  180. package/web-shell/assets/abap-DsBKuouk.js +1 -0
  181. package/web-shell/assets/actionscript-3-D_z4Izcz.js +1 -0
  182. package/web-shell/assets/ada-727ZlQH0.js +1 -0
  183. package/web-shell/assets/andromeeda-C3khCPGq.js +1 -0
  184. package/web-shell/assets/angular-html-LfdN0zeE.js +1 -0
  185. package/web-shell/assets/angular-ts-CKsD7JZE.js +1 -0
  186. package/web-shell/assets/apache-Dn00JSTd.js +1 -0
  187. package/web-shell/assets/apex-COJ4H7py.js +1 -0
  188. package/web-shell/assets/apl-BBq3IX1j.js +1 -0
  189. package/web-shell/assets/applescript-Bu5BbsvL.js +1 -0
  190. package/web-shell/assets/ara-7O62HKoU.js +1 -0
  191. package/web-shell/assets/arc-CRFN10gD.js +1 -0
  192. package/web-shell/assets/architectureDiagram-3BPJPVTR-IRlu1CpH.js +36 -0
  193. package/web-shell/assets/asciidoc-BPT9niGB.js +1 -0
  194. package/web-shell/assets/asm-Dhn9LcZ4.js +1 -0
  195. package/web-shell/assets/astro-CqkE3fuf.js +1 -0
  196. package/web-shell/assets/aurora-x-D-2ljcwZ.js +1 -0
  197. package/web-shell/assets/awk-eg146-Ew.js +1 -0
  198. package/web-shell/assets/ayu-dark-Cv9koXgw.js +1 -0
  199. package/web-shell/assets/ballerina-Du268qiB.js +1 -0
  200. package/web-shell/assets/bat-fje9CFhw.js +1 -0
  201. package/web-shell/assets/beancount-BwXTMy5W.js +1 -0
  202. package/web-shell/assets/berry-3xVqZejG.js +1 -0
  203. package/web-shell/assets/bibtex-xW4inM5L.js +1 -0
  204. package/web-shell/assets/bicep-DHo0CJ0O.js +1 -0
  205. package/web-shell/assets/blade-a8OxSdnT.js +1 -0
  206. package/web-shell/assets/blockDiagram-GPEHLZMM-htIZ6iw8.js +132 -0
  207. package/web-shell/assets/bsl-Dgyn0ogV.js +1 -0
  208. package/web-shell/assets/c-C3t2pwGQ.js +1 -0
  209. package/web-shell/assets/c4Diagram-AAUBKEIU-A2GoRq3O.js +10 -0
  210. package/web-shell/assets/cadence-DNquZEk8.js +1 -0
  211. package/web-shell/assets/cairo--RitsXJZ.js +1 -0
  212. package/web-shell/assets/catppuccin-frappe-CD_QflpE.js +1 -0
  213. package/web-shell/assets/catppuccin-latte-DRW-0cLl.js +1 -0
  214. package/web-shell/assets/catppuccin-macchiato-C-_shW-Y.js +1 -0
  215. package/web-shell/assets/catppuccin-mocha-LGGdnPYs.js +1 -0
  216. package/web-shell/assets/channel-WwImfsc7.js +1 -0
  217. package/web-shell/assets/chunk-2J33WTMH-CdP2AC6u.js +1 -0
  218. package/web-shell/assets/chunk-4BX2VUAB-DrA07nW2.js +1 -0
  219. package/web-shell/assets/chunk-55IACEB6-CFGnVU2f.js +1 -0
  220. package/web-shell/assets/chunk-727SXJPM-BTMkq3Tk.js +206 -0
  221. package/web-shell/assets/chunk-AQP2D5EJ-C9sYg04Z.js +231 -0
  222. package/web-shell/assets/chunk-FMBD7UC4-Cag-cj6I.js +15 -0
  223. package/web-shell/assets/chunk-ND2GUHAM-CDSTFoR7.js +1 -0
  224. package/web-shell/assets/chunk-QZHKN3VN-CN9Z6oOs.js +1 -0
  225. package/web-shell/assets/clarity-BHOwM8T6.js +1 -0
  226. package/web-shell/assets/classDiagram-4FO5ZUOK-CJKQYFeJ.js +1 -0
  227. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CJKQYFeJ.js +1 -0
  228. package/web-shell/assets/clojure-DxSadP1t.js +1 -0
  229. package/web-shell/assets/cmake-DbXoA79R.js +1 -0
  230. package/web-shell/assets/cobol-PTqiYgYu.js +1 -0
  231. package/web-shell/assets/codeowners-Bp6g37R7.js +1 -0
  232. package/web-shell/assets/codeql-sacFqUAJ.js +1 -0
  233. package/web-shell/assets/coffee-dyiR41kL.js +1 -0
  234. package/web-shell/assets/common-lisp-C7gG9l05.js +1 -0
  235. package/web-shell/assets/coq-Dsg_Bt_b.js +1 -0
  236. package/web-shell/assets/cose-bilkent-S5V4N54A-DuN9j8Du.js +1 -0
  237. package/web-shell/assets/cpp-BksuvNSY.js +1 -0
  238. package/web-shell/assets/crystal-DtDmRg-F.js +1 -0
  239. package/web-shell/assets/csharp-D9R-vmeu.js +1 -0
  240. package/web-shell/assets/css-BPhBrDlE.js +1 -0
  241. package/web-shell/assets/csv-B0qRVHPH.js +1 -0
  242. package/web-shell/assets/cue-DtFQj3wx.js +1 -0
  243. package/web-shell/assets/cypher-m2LEI-9-.js +1 -0
  244. package/web-shell/assets/cytoscape.esm-CUqq0XTU.js +331 -0
  245. package/web-shell/assets/d-BoXegm-a.js +1 -0
  246. package/web-shell/assets/dagre-BM42HDAG-ByCWe45f.js +4 -0
  247. package/web-shell/assets/dark-plus-C3mMm8J8.js +1 -0
  248. package/web-shell/assets/dart-B9wLZaAG.js +1 -0
  249. package/web-shell/assets/dax-ClGRhx96.js +1 -0
  250. package/web-shell/assets/defaultLocale-DX6XiGOO.js +1 -0
  251. package/web-shell/assets/desktop-DEIpsLCJ.js +1 -0
  252. package/web-shell/assets/diagram-2AECGRRQ-eWyU_pKZ.js +43 -0
  253. package/web-shell/assets/diagram-5GNKFQAL-0Bfu3Fq5.js +10 -0
  254. package/web-shell/assets/diagram-KO2AKTUF-B6KBKkQP.js +3 -0
  255. package/web-shell/assets/diagram-LMA3HP47-TToDmeA_.js +24 -0
  256. package/web-shell/assets/diagram-OG6HWLK6-CQCkC2Yx.js +24 -0
  257. package/web-shell/assets/diff-BgYniUM_.js +1 -0
  258. package/web-shell/assets/docker-COcR7UxN.js +1 -0
  259. package/web-shell/assets/dotenv-BjQB5zDj.js +1 -0
  260. package/web-shell/assets/dracula-BzJJZx-M.js +1 -0
  261. package/web-shell/assets/dracula-soft-BXkSAIEj.js +1 -0
  262. package/web-shell/assets/dream-maker-C-nORZOA.js +1 -0
  263. package/web-shell/assets/edge-D5gP-w-T.js +1 -0
  264. package/web-shell/assets/elixir-CLiX3zqd.js +1 -0
  265. package/web-shell/assets/elm-CmHSxxaM.js +1 -0
  266. package/web-shell/assets/emacs-lisp-BX77sIaO.js +1 -0
  267. package/web-shell/assets/erDiagram-TEJ5UH35-Cm9ls1iB.js +85 -0
  268. package/web-shell/assets/erb-BYTLMnw6.js +1 -0
  269. package/web-shell/assets/erlang-B-DoSBHF.js +1 -0
  270. package/web-shell/assets/everforest-dark-BgDCqdQA.js +1 -0
  271. package/web-shell/assets/everforest-light-C8M2exoo.js +1 -0
  272. package/web-shell/assets/fennel-bCA53EVm.js +1 -0
  273. package/web-shell/assets/fish-w-ucz2PV.js +1 -0
  274. package/web-shell/assets/flowDiagram-I6XJVG4X-Dyoz80Pv.js +162 -0
  275. package/web-shell/assets/fluent-Dayu4EKP.js +1 -0
  276. package/web-shell/assets/fortran-fixed-form-TqA4NnZg.js +1 -0
  277. package/web-shell/assets/fortran-free-form-DKXYxT9g.js +1 -0
  278. package/web-shell/assets/fsharp-XplgxFYe.js +1 -0
  279. package/web-shell/assets/ganttDiagram-6RSMTGT7-Cfut9yaU.js +292 -0
  280. package/web-shell/assets/gdresource-BHYsBjWJ.js +1 -0
  281. package/web-shell/assets/gdscript-DfxzS6Rs.js +1 -0
  282. package/web-shell/assets/gdshader-SKMF96pI.js +1 -0
  283. package/web-shell/assets/genie-ajMbGru0.js +1 -0
  284. package/web-shell/assets/gherkin--30QC5Em.js +1 -0
  285. package/web-shell/assets/git-commit-i4q6IMui.js +1 -0
  286. package/web-shell/assets/git-rebase-B-v9cOL2.js +1 -0
  287. package/web-shell/assets/gitGraphDiagram-PVQCEYII-BCuJdlfD.js +106 -0
  288. package/web-shell/assets/github-dark-DHJKELXO.js +1 -0
  289. package/web-shell/assets/github-dark-default-Cuk6v7N8.js +1 -0
  290. package/web-shell/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  291. package/web-shell/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  292. package/web-shell/assets/github-light-DAi9KRSo.js +1 -0
  293. package/web-shell/assets/github-light-default-D7oLnXFd.js +1 -0
  294. package/web-shell/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  295. package/web-shell/assets/gleam-B430Bg39.js +1 -0
  296. package/web-shell/assets/glimmer-js-D-cwc0-E.js +1 -0
  297. package/web-shell/assets/glimmer-ts-pgjy16dm.js +1 -0
  298. package/web-shell/assets/glsl-DBO2IWDn.js +1 -0
  299. package/web-shell/assets/gnuplot-CM8KxXT1.js +1 -0
  300. package/web-shell/assets/go-B1SYOhNW.js +1 -0
  301. package/web-shell/assets/graph-qsFoMdT2.js +1 -0
  302. package/web-shell/assets/graphql-cDcHW_If.js +1 -0
  303. package/web-shell/assets/groovy-DkBy-JyN.js +1 -0
  304. package/web-shell/assets/hack-D1yCygmZ.js +1 -0
  305. package/web-shell/assets/haml-B2EZWmdv.js +1 -0
  306. package/web-shell/assets/handlebars-BQGss363.js +1 -0
  307. package/web-shell/assets/haskell-BILxekzW.js +1 -0
  308. package/web-shell/assets/haxe-C5wWYbrZ.js +1 -0
  309. package/web-shell/assets/hcl-HzYwdGDm.js +1 -0
  310. package/web-shell/assets/hjson-T-Tgc4AT.js +1 -0
  311. package/web-shell/assets/hlsl-ifBTmRxC.js +1 -0
  312. package/web-shell/assets/houston-DnULxvSX.js +1 -0
  313. package/web-shell/assets/html-C2L_23MC.js +1 -0
  314. package/web-shell/assets/html-derivative-CSfWNPLT.js +1 -0
  315. package/web-shell/assets/http-FRrOvY1W.js +1 -0
  316. package/web-shell/assets/hxml-TIA70rKU.js +1 -0
  317. package/web-shell/assets/hy-BMj5Y0dO.js +1 -0
  318. package/web-shell/assets/imba-bv_oIlVt.js +1 -0
  319. package/web-shell/assets/index-BDZiTAkl.css +1 -0
  320. package/web-shell/assets/index-DaebdpHq.js +516 -0
  321. package/web-shell/assets/infoDiagram-5YYISTIA-CXKxF2VL.js +2 -0
  322. package/web-shell/assets/ini-BjABl1g7.js +1 -0
  323. package/web-shell/assets/init-Gi6I4Gst.js +1 -0
  324. package/web-shell/assets/ishikawaDiagram-YF4QCWOH-DE7HWSU8.js +70 -0
  325. package/web-shell/assets/java-xI-RfyKK.js +1 -0
  326. package/web-shell/assets/javascript-ySlJ1b_l.js +1 -0
  327. package/web-shell/assets/jinja-DGy0s7-h.js +1 -0
  328. package/web-shell/assets/jison-BqZprYcd.js +1 -0
  329. package/web-shell/assets/journeyDiagram-JHISSGLW-D__YUfds.js +139 -0
  330. package/web-shell/assets/json-BQoSv7ci.js +1 -0
  331. package/web-shell/assets/json5-w8dY5SsB.js +1 -0
  332. package/web-shell/assets/jsonc-TU54ms6u.js +1 -0
  333. package/web-shell/assets/jsonl-DREVFZK8.js +1 -0
  334. package/web-shell/assets/jsonnet-BfivnA6A.js +1 -0
  335. package/web-shell/assets/jssm-P4WzXJd0.js +1 -0
  336. package/web-shell/assets/jsx-BAng5TT0.js +1 -0
  337. package/web-shell/assets/julia-BBuGR-5E.js +1 -0
  338. package/web-shell/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  339. package/web-shell/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  340. package/web-shell/assets/kanagawa-wave-DWedfzmr.js +1 -0
  341. package/web-shell/assets/kanban-definition-UN3LZRKU-D82R169M.js +89 -0
  342. package/web-shell/assets/kotlin-B5lbUyaz.js +1 -0
  343. package/web-shell/assets/kusto-mebxcVVE.js +1 -0
  344. package/web-shell/assets/laserwave-DUszq2jm.js +1 -0
  345. package/web-shell/assets/latex-C-cWTeAZ.js +1 -0
  346. package/web-shell/assets/layout-CNYaLpI5.js +1 -0
  347. package/web-shell/assets/lean-XBlWyCtg.js +1 -0
  348. package/web-shell/assets/less-BfCpw3nA.js +1 -0
  349. package/web-shell/assets/light-plus-B7mTdjB0.js +1 -0
  350. package/web-shell/assets/linear-DpyMbKqT.js +1 -0
  351. package/web-shell/assets/liquid-D3W5UaiH.js +1 -0
  352. package/web-shell/assets/log-Cc5clBb7.js +1 -0
  353. package/web-shell/assets/logo-IuBKFhSY.js +1 -0
  354. package/web-shell/assets/lua-CvWAzNxB.js +1 -0
  355. package/web-shell/assets/luau-Du5NY7AG.js +1 -0
  356. package/web-shell/assets/make-Bvotw-X0.js +1 -0
  357. package/web-shell/assets/markdown-UIAJJxZW.js +1 -0
  358. package/web-shell/assets/marko-z0MBrx5-.js +1 -0
  359. package/web-shell/assets/material-theme-D5KoaKCx.js +1 -0
  360. package/web-shell/assets/material-theme-darker-BfHTSMKl.js +1 -0
  361. package/web-shell/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  362. package/web-shell/assets/material-theme-ocean-CyktbL80.js +1 -0
  363. package/web-shell/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  364. package/web-shell/assets/matlab-D9-PGadD.js +1 -0
  365. package/web-shell/assets/mdc-DB_EDNY_.js +1 -0
  366. package/web-shell/assets/mdx-sdHcTMYB.js +1 -0
  367. package/web-shell/assets/mermaid-Ci6OQyBP.js +1 -0
  368. package/web-shell/assets/mermaid.core-D1KEFDhn.js +309 -0
  369. package/web-shell/assets/min-dark-CafNBF8u.js +1 -0
  370. package/web-shell/assets/min-light-CTRr51gU.js +1 -0
  371. package/web-shell/assets/mindmap-definition-RKZ34NQL-BwVUFGFE.js +96 -0
  372. package/web-shell/assets/mipsasm-BC5c_5Pe.js +1 -0
  373. package/web-shell/assets/mojo-Tz6hzZYG.js +1 -0
  374. package/web-shell/assets/monokai-D4h5O-jR.js +1 -0
  375. package/web-shell/assets/move-DB_GagMm.js +1 -0
  376. package/web-shell/assets/narrat-DLbgOhZU.js +1 -0
  377. package/web-shell/assets/nextflow-B0XVJmRM.js +1 -0
  378. package/web-shell/assets/nginx-D_VnBJ67.js +1 -0
  379. package/web-shell/assets/night-owl-C39BiMTA.js +1 -0
  380. package/web-shell/assets/nim-ZlGxZxc3.js +1 -0
  381. package/web-shell/assets/nix-shcSOmrb.js +1 -0
  382. package/web-shell/assets/nord-Ddv68eIx.js +1 -0
  383. package/web-shell/assets/nushell-D4Tzg5kh.js +1 -0
  384. package/web-shell/assets/objective-c-Deuh7S70.js +1 -0
  385. package/web-shell/assets/objective-cpp-BUEGK8hf.js +1 -0
  386. package/web-shell/assets/ocaml-BNioltXt.js +1 -0
  387. package/web-shell/assets/one-dark-pro-GBQ2dnAY.js +1 -0
  388. package/web-shell/assets/one-light-PoHY5YXO.js +1 -0
  389. package/web-shell/assets/ordinal-Cboi1Yqb.js +1 -0
  390. package/web-shell/assets/pascal-JqZropPD.js +1 -0
  391. package/web-shell/assets/perl-CHQXSrWU.js +1 -0
  392. package/web-shell/assets/php-B5ebYQev.js +1 -0
  393. package/web-shell/assets/pieDiagram-4H26LBE5-BO_qoEGx.js +30 -0
  394. package/web-shell/assets/plastic-3e1v2bzS.js +1 -0
  395. package/web-shell/assets/plsql-LKU2TuZ1.js +1 -0
  396. package/web-shell/assets/po-BFLt1xDp.js +1 -0
  397. package/web-shell/assets/poimandres-CS3Unz2-.js +1 -0
  398. package/web-shell/assets/polar-DKykz6zU.js +1 -0
  399. package/web-shell/assets/postcss-B3ZDOciz.js +1 -0
  400. package/web-shell/assets/powerquery-CSHBycmS.js +1 -0
  401. package/web-shell/assets/powershell-BIEUsx6d.js +1 -0
  402. package/web-shell/assets/prisma-B48N-Iqd.js +1 -0
  403. package/web-shell/assets/prolog-BY-TUvya.js +1 -0
  404. package/web-shell/assets/proto-zocC4JxJ.js +1 -0
  405. package/web-shell/assets/pug-CM9l7STV.js +1 -0
  406. package/web-shell/assets/puppet-Cza_XSSt.js +1 -0
  407. package/web-shell/assets/purescript-Bg-kzb6g.js +1 -0
  408. package/web-shell/assets/python-DhUJRlN_.js +1 -0
  409. package/web-shell/assets/qml-D8XfuvdV.js +1 -0
  410. package/web-shell/assets/qmldir-C8lEn-DE.js +1 -0
  411. package/web-shell/assets/qss-DhMKtDLN.js +1 -0
  412. package/web-shell/assets/quadrantDiagram-W4KKPZXB-Cx0ZaWPo.js +7 -0
  413. package/web-shell/assets/r-CwjWoCRV.js +1 -0
  414. package/web-shell/assets/racket-CzouJOBO.js +1 -0
  415. package/web-shell/assets/raku-B1bQXN8T.js +1 -0
  416. package/web-shell/assets/razor-CNLDkMZG.js +1 -0
  417. package/web-shell/assets/red-bN70gL4F.js +1 -0
  418. package/web-shell/assets/reg-5LuOXUq_.js +1 -0
  419. package/web-shell/assets/regexp-DWJ3fJO_.js +1 -0
  420. package/web-shell/assets/rel-DJlmqQ1C.js +1 -0
  421. package/web-shell/assets/requirementDiagram-4Y6WPE33-BJPXejOA.js +84 -0
  422. package/web-shell/assets/riscv-QhoSD0DR.js +1 -0
  423. package/web-shell/assets/rose-pine-CmCqftbK.js +1 -0
  424. package/web-shell/assets/rose-pine-dawn-Ds-gbosJ.js +1 -0
  425. package/web-shell/assets/rose-pine-moon-CjDtw9vr.js +1 -0
  426. package/web-shell/assets/rst-4NLicBqY.js +1 -0
  427. package/web-shell/assets/ruby-DeZ3UC14.js +1 -0
  428. package/web-shell/assets/rust-Be6lgOlo.js +1 -0
  429. package/web-shell/assets/sankeyDiagram-5OEKKPKP-C1xeIL9i.js +40 -0
  430. package/web-shell/assets/sas-BmTFh92c.js +1 -0
  431. package/web-shell/assets/sass-BJ4Li9vH.js +1 -0
  432. package/web-shell/assets/scala-DQVVAn-B.js +1 -0
  433. package/web-shell/assets/scheme-BJGe-b2p.js +1 -0
  434. package/web-shell/assets/scss-C31hgJw-.js +1 -0
  435. package/web-shell/assets/sdbl-BLhTXw86.js +1 -0
  436. package/web-shell/assets/sequenceDiagram-3UESZ5HK-CSYKQUjf.js +162 -0
  437. package/web-shell/assets/shaderlab-B7qAK45m.js +1 -0
  438. package/web-shell/assets/shellscript-atvbtKCR.js +1 -0
  439. package/web-shell/assets/shellsession-C_rIy8kc.js +1 -0
  440. package/web-shell/assets/slack-dark-BthQWCQV.js +1 -0
  441. package/web-shell/assets/slack-ochin-DqwNpetd.js +1 -0
  442. package/web-shell/assets/smalltalk-DkLiglaE.js +1 -0
  443. package/web-shell/assets/snazzy-light-Bw305WKR.js +1 -0
  444. package/web-shell/assets/solarized-dark-DXbdFlpD.js +1 -0
  445. package/web-shell/assets/solarized-light-L9t79GZl.js +1 -0
  446. package/web-shell/assets/solidity-C1w2a3ep.js +1 -0
  447. package/web-shell/assets/soy-C-lX7w71.js +1 -0
  448. package/web-shell/assets/sparql-bYkjHRlG.js +1 -0
  449. package/web-shell/assets/splunk-Cf8iN4DR.js +1 -0
  450. package/web-shell/assets/sql-COK4E0Yg.js +1 -0
  451. package/web-shell/assets/ssh-config-BknIz3MU.js +1 -0
  452. package/web-shell/assets/stata-DorPZHa4.js +1 -0
  453. package/web-shell/assets/stateDiagram-AJRCARHV-d9hiHlAW.js +1 -0
  454. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DgReoybQ.js +1 -0
  455. package/web-shell/assets/stylus-BeQkCIfX.js +1 -0
  456. package/web-shell/assets/svelte-MSaWC3Je.js +1 -0
  457. package/web-shell/assets/swift-BSxZ-RaX.js +1 -0
  458. package/web-shell/assets/synthwave-84-CbfX1IO0.js +1 -0
  459. package/web-shell/assets/system-verilog-C7L56vO4.js +1 -0
  460. package/web-shell/assets/systemd-CUnW07Te.js +1 -0
  461. package/web-shell/assets/talonscript-C1XDQQGZ.js +1 -0
  462. package/web-shell/assets/tasl-CQjiPCtT.js +1 -0
  463. package/web-shell/assets/tcl-DQ1-QYvQ.js +1 -0
  464. package/web-shell/assets/templ-dwX3ZSMB.js +1 -0
  465. package/web-shell/assets/terraform-BbSNqyBO.js +1 -0
  466. package/web-shell/assets/tex-rYs2v40G.js +1 -0
  467. package/web-shell/assets/timeline-definition-PNZ67QCA-BhCBkq8k.js +120 -0
  468. package/web-shell/assets/tokyo-night-DBQeEorK.js +1 -0
  469. package/web-shell/assets/toml-CB2ApiWb.js +1 -0
  470. package/web-shell/assets/ts-tags-CipyTH0X.js +1 -0
  471. package/web-shell/assets/tsv-B_m7g4N7.js +1 -0
  472. package/web-shell/assets/tsx-B6W0miNI.js +1 -0
  473. package/web-shell/assets/turtle-BMR_PYu6.js +1 -0
  474. package/web-shell/assets/twig-NC5TFiHP.js +1 -0
  475. package/web-shell/assets/typescript-Dj6nwHGl.js +1 -0
  476. package/web-shell/assets/typespec-BpWG_bgh.js +1 -0
  477. package/web-shell/assets/typst-BVUVsWT6.js +1 -0
  478. package/web-shell/assets/v-CAQ2eGtk.js +1 -0
  479. package/web-shell/assets/vala-BFOHcciG.js +1 -0
  480. package/web-shell/assets/vb-CdO5JTpU.js +1 -0
  481. package/web-shell/assets/vennDiagram-CIIHVFJN-DPPFWp_y.js +34 -0
  482. package/web-shell/assets/verilog-CJaU5se_.js +1 -0
  483. package/web-shell/assets/vesper-BEBZ7ncR.js +1 -0
  484. package/web-shell/assets/vhdl-DYoNaHQp.js +1 -0
  485. package/web-shell/assets/viml-m4uW47V2.js +1 -0
  486. package/web-shell/assets/vitesse-black-Bkuqu6BP.js +1 -0
  487. package/web-shell/assets/vitesse-dark-D0r3Knsf.js +1 -0
  488. package/web-shell/assets/vitesse-light-CVO1_9PV.js +1 -0
  489. package/web-shell/assets/vue-BuYVFjOK.js +1 -0
  490. package/web-shell/assets/vue-html-xdeiXROB.js +1 -0
  491. package/web-shell/assets/vyper-nyqBNV6O.js +1 -0
  492. package/web-shell/assets/wardley-L42UT6IY-CcOUIgXY.js +173 -0
  493. package/web-shell/assets/wardleyDiagram-YWT4CUSO-p7oR5X7r.js +78 -0
  494. package/web-shell/assets/wasm-C6j12Q_x.js +1 -0
  495. package/web-shell/assets/wasm-CG6Dc4jp.js +1 -0
  496. package/web-shell/assets/wenyan-7A4Fjokl.js +1 -0
  497. package/web-shell/assets/wgsl-CB0Krxn9.js +1 -0
  498. package/web-shell/assets/wikitext-DCE3LsBG.js +1 -0
  499. package/web-shell/assets/wolfram-C3FkfJm5.js +1 -0
  500. package/web-shell/assets/xml-e3z08dGr.js +1 -0
  501. package/web-shell/assets/xsl-Dd0NUgwM.js +1 -0
  502. package/web-shell/assets/xychartDiagram-2RQKCTM6-Dfr7-SEy.js +7 -0
  503. package/web-shell/assets/yaml-CVw76BM1.js +1 -0
  504. package/web-shell/assets/zenscript-HnGAYVZD.js +1 -0
  505. package/web-shell/assets/zig-BVz_zdnA.js +1 -0
  506. package/web-shell/index.html +23 -0
  507. package/chunks/chunk-C64WAJOC.js +0 -117
  508. package/chunks/contextCommand-WP7BU7IY.js +0 -53
@@ -0,0 +1,2136 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ ChannelBase,
5
+ SessionRouter,
6
+ getGlobalQwenDir
7
+ } from "./chunk-JXQ23SNT.js";
8
+ import "./chunk-UFC57OYT.js";
9
+ import "./chunk-K5PGHDBN.js";
10
+ import {
11
+ wrapper_default
12
+ } from "./chunk-H6BD2ELD.js";
13
+ import "./chunk-5IFG2VC4.js";
14
+ import {
15
+ init_esbuild_shims
16
+ } from "./chunk-A4BMJM77.js";
17
+ import {
18
+ __commonJS,
19
+ __name,
20
+ __toESM
21
+ } from "./chunk-J2S4EL5Y.js";
22
+
23
+ // node_modules/qrcode-terminal/vendor/QRCode/QRMode.js
24
+ var require_QRMode = __commonJS({
25
+ "node_modules/qrcode-terminal/vendor/QRCode/QRMode.js"(exports, module) {
26
+ init_esbuild_shims();
27
+ module.exports = {
28
+ MODE_NUMBER: 1 << 0,
29
+ MODE_ALPHA_NUM: 1 << 1,
30
+ MODE_8BIT_BYTE: 1 << 2,
31
+ MODE_KANJI: 1 << 3
32
+ };
33
+ }
34
+ });
35
+
36
+ // node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js
37
+ var require_QR8bitByte = __commonJS({
38
+ "node_modules/qrcode-terminal/vendor/QRCode/QR8bitByte.js"(exports, module) {
39
+ init_esbuild_shims();
40
+ var QRMode = require_QRMode();
41
+ function QR8bitByte(data) {
42
+ this.mode = QRMode.MODE_8BIT_BYTE;
43
+ this.data = data;
44
+ }
45
+ __name(QR8bitByte, "QR8bitByte");
46
+ QR8bitByte.prototype = {
47
+ getLength: /* @__PURE__ */ __name(function() {
48
+ return this.data.length;
49
+ }, "getLength"),
50
+ write: /* @__PURE__ */ __name(function(buffer) {
51
+ for (var i = 0; i < this.data.length; i++) {
52
+ buffer.put(this.data.charCodeAt(i), 8);
53
+ }
54
+ }, "write")
55
+ };
56
+ module.exports = QR8bitByte;
57
+ }
58
+ });
59
+
60
+ // node_modules/qrcode-terminal/vendor/QRCode/QRMath.js
61
+ var require_QRMath = __commonJS({
62
+ "node_modules/qrcode-terminal/vendor/QRCode/QRMath.js"(exports, module) {
63
+ init_esbuild_shims();
64
+ var QRMath = {
65
+ glog: /* @__PURE__ */ __name(function(n) {
66
+ if (n < 1) {
67
+ throw new Error("glog(" + n + ")");
68
+ }
69
+ return QRMath.LOG_TABLE[n];
70
+ }, "glog"),
71
+ gexp: /* @__PURE__ */ __name(function(n) {
72
+ while (n < 0) {
73
+ n += 255;
74
+ }
75
+ while (n >= 256) {
76
+ n -= 255;
77
+ }
78
+ return QRMath.EXP_TABLE[n];
79
+ }, "gexp"),
80
+ EXP_TABLE: new Array(256),
81
+ LOG_TABLE: new Array(256)
82
+ };
83
+ for (i = 0; i < 8; i++) {
84
+ QRMath.EXP_TABLE[i] = 1 << i;
85
+ }
86
+ var i;
87
+ for (i = 8; i < 256; i++) {
88
+ QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
89
+ }
90
+ var i;
91
+ for (i = 0; i < 255; i++) {
92
+ QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
93
+ }
94
+ var i;
95
+ module.exports = QRMath;
96
+ }
97
+ });
98
+
99
+ // node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js
100
+ var require_QRPolynomial = __commonJS({
101
+ "node_modules/qrcode-terminal/vendor/QRCode/QRPolynomial.js"(exports, module) {
102
+ init_esbuild_shims();
103
+ var QRMath = require_QRMath();
104
+ function QRPolynomial(num, shift) {
105
+ if (num.length === void 0) {
106
+ throw new Error(num.length + "/" + shift);
107
+ }
108
+ var offset = 0;
109
+ while (offset < num.length && num[offset] === 0) {
110
+ offset++;
111
+ }
112
+ this.num = new Array(num.length - offset + shift);
113
+ for (var i = 0; i < num.length - offset; i++) {
114
+ this.num[i] = num[i + offset];
115
+ }
116
+ }
117
+ __name(QRPolynomial, "QRPolynomial");
118
+ QRPolynomial.prototype = {
119
+ get: /* @__PURE__ */ __name(function(index) {
120
+ return this.num[index];
121
+ }, "get"),
122
+ getLength: /* @__PURE__ */ __name(function() {
123
+ return this.num.length;
124
+ }, "getLength"),
125
+ multiply: /* @__PURE__ */ __name(function(e) {
126
+ var num = new Array(this.getLength() + e.getLength() - 1);
127
+ for (var i = 0; i < this.getLength(); i++) {
128
+ for (var j = 0; j < e.getLength(); j++) {
129
+ num[i + j] ^= QRMath.gexp(QRMath.glog(this.get(i)) + QRMath.glog(e.get(j)));
130
+ }
131
+ }
132
+ return new QRPolynomial(num, 0);
133
+ }, "multiply"),
134
+ mod: /* @__PURE__ */ __name(function(e) {
135
+ if (this.getLength() - e.getLength() < 0) {
136
+ return this;
137
+ }
138
+ var ratio = QRMath.glog(this.get(0)) - QRMath.glog(e.get(0));
139
+ var num = new Array(this.getLength());
140
+ for (var i = 0; i < this.getLength(); i++) {
141
+ num[i] = this.get(i);
142
+ }
143
+ for (var x = 0; x < e.getLength(); x++) {
144
+ num[x] ^= QRMath.gexp(QRMath.glog(e.get(x)) + ratio);
145
+ }
146
+ return new QRPolynomial(num, 0).mod(e);
147
+ }, "mod")
148
+ };
149
+ module.exports = QRPolynomial;
150
+ }
151
+ });
152
+
153
+ // node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js
154
+ var require_QRMaskPattern = __commonJS({
155
+ "node_modules/qrcode-terminal/vendor/QRCode/QRMaskPattern.js"(exports, module) {
156
+ init_esbuild_shims();
157
+ module.exports = {
158
+ PATTERN000: 0,
159
+ PATTERN001: 1,
160
+ PATTERN010: 2,
161
+ PATTERN011: 3,
162
+ PATTERN100: 4,
163
+ PATTERN101: 5,
164
+ PATTERN110: 6,
165
+ PATTERN111: 7
166
+ };
167
+ }
168
+ });
169
+
170
+ // node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js
171
+ var require_QRUtil = __commonJS({
172
+ "node_modules/qrcode-terminal/vendor/QRCode/QRUtil.js"(exports, module) {
173
+ init_esbuild_shims();
174
+ var QRMode = require_QRMode();
175
+ var QRPolynomial = require_QRPolynomial();
176
+ var QRMath = require_QRMath();
177
+ var QRMaskPattern = require_QRMaskPattern();
178
+ var QRUtil = {
179
+ PATTERN_POSITION_TABLE: [
180
+ [],
181
+ [6, 18],
182
+ [6, 22],
183
+ [6, 26],
184
+ [6, 30],
185
+ [6, 34],
186
+ [6, 22, 38],
187
+ [6, 24, 42],
188
+ [6, 26, 46],
189
+ [6, 28, 50],
190
+ [6, 30, 54],
191
+ [6, 32, 58],
192
+ [6, 34, 62],
193
+ [6, 26, 46, 66],
194
+ [6, 26, 48, 70],
195
+ [6, 26, 50, 74],
196
+ [6, 30, 54, 78],
197
+ [6, 30, 56, 82],
198
+ [6, 30, 58, 86],
199
+ [6, 34, 62, 90],
200
+ [6, 28, 50, 72, 94],
201
+ [6, 26, 50, 74, 98],
202
+ [6, 30, 54, 78, 102],
203
+ [6, 28, 54, 80, 106],
204
+ [6, 32, 58, 84, 110],
205
+ [6, 30, 58, 86, 114],
206
+ [6, 34, 62, 90, 118],
207
+ [6, 26, 50, 74, 98, 122],
208
+ [6, 30, 54, 78, 102, 126],
209
+ [6, 26, 52, 78, 104, 130],
210
+ [6, 30, 56, 82, 108, 134],
211
+ [6, 34, 60, 86, 112, 138],
212
+ [6, 30, 58, 86, 114, 142],
213
+ [6, 34, 62, 90, 118, 146],
214
+ [6, 30, 54, 78, 102, 126, 150],
215
+ [6, 24, 50, 76, 102, 128, 154],
216
+ [6, 28, 54, 80, 106, 132, 158],
217
+ [6, 32, 58, 84, 110, 136, 162],
218
+ [6, 26, 54, 82, 110, 138, 166],
219
+ [6, 30, 58, 86, 114, 142, 170]
220
+ ],
221
+ G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
222
+ G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
223
+ G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
224
+ getBCHTypeInfo: /* @__PURE__ */ __name(function(data) {
225
+ var d3 = data << 10;
226
+ while (QRUtil.getBCHDigit(d3) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
227
+ d3 ^= QRUtil.G15 << QRUtil.getBCHDigit(d3) - QRUtil.getBCHDigit(QRUtil.G15);
228
+ }
229
+ return (data << 10 | d3) ^ QRUtil.G15_MASK;
230
+ }, "getBCHTypeInfo"),
231
+ getBCHTypeNumber: /* @__PURE__ */ __name(function(data) {
232
+ var d3 = data << 12;
233
+ while (QRUtil.getBCHDigit(d3) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
234
+ d3 ^= QRUtil.G18 << QRUtil.getBCHDigit(d3) - QRUtil.getBCHDigit(QRUtil.G18);
235
+ }
236
+ return data << 12 | d3;
237
+ }, "getBCHTypeNumber"),
238
+ getBCHDigit: /* @__PURE__ */ __name(function(data) {
239
+ var digit = 0;
240
+ while (data !== 0) {
241
+ digit++;
242
+ data >>>= 1;
243
+ }
244
+ return digit;
245
+ }, "getBCHDigit"),
246
+ getPatternPosition: /* @__PURE__ */ __name(function(typeNumber) {
247
+ return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
248
+ }, "getPatternPosition"),
249
+ getMask: /* @__PURE__ */ __name(function(maskPattern, i, j) {
250
+ switch (maskPattern) {
251
+ case QRMaskPattern.PATTERN000:
252
+ return (i + j) % 2 === 0;
253
+ case QRMaskPattern.PATTERN001:
254
+ return i % 2 === 0;
255
+ case QRMaskPattern.PATTERN010:
256
+ return j % 3 === 0;
257
+ case QRMaskPattern.PATTERN011:
258
+ return (i + j) % 3 === 0;
259
+ case QRMaskPattern.PATTERN100:
260
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
261
+ case QRMaskPattern.PATTERN101:
262
+ return i * j % 2 + i * j % 3 === 0;
263
+ case QRMaskPattern.PATTERN110:
264
+ return (i * j % 2 + i * j % 3) % 2 === 0;
265
+ case QRMaskPattern.PATTERN111:
266
+ return (i * j % 3 + (i + j) % 2) % 2 === 0;
267
+ default:
268
+ throw new Error("bad maskPattern:" + maskPattern);
269
+ }
270
+ }, "getMask"),
271
+ getErrorCorrectPolynomial: /* @__PURE__ */ __name(function(errorCorrectLength) {
272
+ var a = new QRPolynomial([1], 0);
273
+ for (var i = 0; i < errorCorrectLength; i++) {
274
+ a = a.multiply(new QRPolynomial([1, QRMath.gexp(i)], 0));
275
+ }
276
+ return a;
277
+ }, "getErrorCorrectPolynomial"),
278
+ getLengthInBits: /* @__PURE__ */ __name(function(mode, type) {
279
+ if (1 <= type && type < 10) {
280
+ switch (mode) {
281
+ case QRMode.MODE_NUMBER:
282
+ return 10;
283
+ case QRMode.MODE_ALPHA_NUM:
284
+ return 9;
285
+ case QRMode.MODE_8BIT_BYTE:
286
+ return 8;
287
+ case QRMode.MODE_KANJI:
288
+ return 8;
289
+ default:
290
+ throw new Error("mode:" + mode);
291
+ }
292
+ } else if (type < 27) {
293
+ switch (mode) {
294
+ case QRMode.MODE_NUMBER:
295
+ return 12;
296
+ case QRMode.MODE_ALPHA_NUM:
297
+ return 11;
298
+ case QRMode.MODE_8BIT_BYTE:
299
+ return 16;
300
+ case QRMode.MODE_KANJI:
301
+ return 10;
302
+ default:
303
+ throw new Error("mode:" + mode);
304
+ }
305
+ } else if (type < 41) {
306
+ switch (mode) {
307
+ case QRMode.MODE_NUMBER:
308
+ return 14;
309
+ case QRMode.MODE_ALPHA_NUM:
310
+ return 13;
311
+ case QRMode.MODE_8BIT_BYTE:
312
+ return 16;
313
+ case QRMode.MODE_KANJI:
314
+ return 12;
315
+ default:
316
+ throw new Error("mode:" + mode);
317
+ }
318
+ } else {
319
+ throw new Error("type:" + type);
320
+ }
321
+ }, "getLengthInBits"),
322
+ getLostPoint: /* @__PURE__ */ __name(function(qrCode) {
323
+ var moduleCount = qrCode.getModuleCount();
324
+ var lostPoint = 0;
325
+ var row = 0;
326
+ var col = 0;
327
+ for (row = 0; row < moduleCount; row++) {
328
+ for (col = 0; col < moduleCount; col++) {
329
+ var sameCount = 0;
330
+ var dark = qrCode.isDark(row, col);
331
+ for (var r = -1; r <= 1; r++) {
332
+ if (row + r < 0 || moduleCount <= row + r) {
333
+ continue;
334
+ }
335
+ for (var c = -1; c <= 1; c++) {
336
+ if (col + c < 0 || moduleCount <= col + c) {
337
+ continue;
338
+ }
339
+ if (r === 0 && c === 0) {
340
+ continue;
341
+ }
342
+ if (dark === qrCode.isDark(row + r, col + c)) {
343
+ sameCount++;
344
+ }
345
+ }
346
+ }
347
+ if (sameCount > 5) {
348
+ lostPoint += 3 + sameCount - 5;
349
+ }
350
+ }
351
+ }
352
+ for (row = 0; row < moduleCount - 1; row++) {
353
+ for (col = 0; col < moduleCount - 1; col++) {
354
+ var count = 0;
355
+ if (qrCode.isDark(row, col)) count++;
356
+ if (qrCode.isDark(row + 1, col)) count++;
357
+ if (qrCode.isDark(row, col + 1)) count++;
358
+ if (qrCode.isDark(row + 1, col + 1)) count++;
359
+ if (count === 0 || count === 4) {
360
+ lostPoint += 3;
361
+ }
362
+ }
363
+ }
364
+ for (row = 0; row < moduleCount; row++) {
365
+ for (col = 0; col < moduleCount - 6; col++) {
366
+ if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
367
+ lostPoint += 40;
368
+ }
369
+ }
370
+ }
371
+ for (col = 0; col < moduleCount; col++) {
372
+ for (row = 0; row < moduleCount - 6; row++) {
373
+ if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
374
+ lostPoint += 40;
375
+ }
376
+ }
377
+ }
378
+ var darkCount = 0;
379
+ for (col = 0; col < moduleCount; col++) {
380
+ for (row = 0; row < moduleCount; row++) {
381
+ if (qrCode.isDark(row, col)) {
382
+ darkCount++;
383
+ }
384
+ }
385
+ }
386
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
387
+ lostPoint += ratio * 10;
388
+ return lostPoint;
389
+ }, "getLostPoint")
390
+ };
391
+ module.exports = QRUtil;
392
+ }
393
+ });
394
+
395
+ // node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js
396
+ var require_QRErrorCorrectLevel = __commonJS({
397
+ "node_modules/qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js"(exports, module) {
398
+ init_esbuild_shims();
399
+ module.exports = {
400
+ L: 1,
401
+ M: 0,
402
+ Q: 3,
403
+ H: 2
404
+ };
405
+ }
406
+ });
407
+
408
+ // node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js
409
+ var require_QRRSBlock = __commonJS({
410
+ "node_modules/qrcode-terminal/vendor/QRCode/QRRSBlock.js"(exports, module) {
411
+ init_esbuild_shims();
412
+ var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
413
+ function QRRSBlock(totalCount, dataCount) {
414
+ this.totalCount = totalCount;
415
+ this.dataCount = dataCount;
416
+ }
417
+ __name(QRRSBlock, "QRRSBlock");
418
+ QRRSBlock.RS_BLOCK_TABLE = [
419
+ // L
420
+ // M
421
+ // Q
422
+ // H
423
+ // 1
424
+ [1, 26, 19],
425
+ [1, 26, 16],
426
+ [1, 26, 13],
427
+ [1, 26, 9],
428
+ // 2
429
+ [1, 44, 34],
430
+ [1, 44, 28],
431
+ [1, 44, 22],
432
+ [1, 44, 16],
433
+ // 3
434
+ [1, 70, 55],
435
+ [1, 70, 44],
436
+ [2, 35, 17],
437
+ [2, 35, 13],
438
+ // 4
439
+ [1, 100, 80],
440
+ [2, 50, 32],
441
+ [2, 50, 24],
442
+ [4, 25, 9],
443
+ // 5
444
+ [1, 134, 108],
445
+ [2, 67, 43],
446
+ [2, 33, 15, 2, 34, 16],
447
+ [2, 33, 11, 2, 34, 12],
448
+ // 6
449
+ [2, 86, 68],
450
+ [4, 43, 27],
451
+ [4, 43, 19],
452
+ [4, 43, 15],
453
+ // 7
454
+ [2, 98, 78],
455
+ [4, 49, 31],
456
+ [2, 32, 14, 4, 33, 15],
457
+ [4, 39, 13, 1, 40, 14],
458
+ // 8
459
+ [2, 121, 97],
460
+ [2, 60, 38, 2, 61, 39],
461
+ [4, 40, 18, 2, 41, 19],
462
+ [4, 40, 14, 2, 41, 15],
463
+ // 9
464
+ [2, 146, 116],
465
+ [3, 58, 36, 2, 59, 37],
466
+ [4, 36, 16, 4, 37, 17],
467
+ [4, 36, 12, 4, 37, 13],
468
+ // 10
469
+ [2, 86, 68, 2, 87, 69],
470
+ [4, 69, 43, 1, 70, 44],
471
+ [6, 43, 19, 2, 44, 20],
472
+ [6, 43, 15, 2, 44, 16],
473
+ // 11
474
+ [4, 101, 81],
475
+ [1, 80, 50, 4, 81, 51],
476
+ [4, 50, 22, 4, 51, 23],
477
+ [3, 36, 12, 8, 37, 13],
478
+ // 12
479
+ [2, 116, 92, 2, 117, 93],
480
+ [6, 58, 36, 2, 59, 37],
481
+ [4, 46, 20, 6, 47, 21],
482
+ [7, 42, 14, 4, 43, 15],
483
+ // 13
484
+ [4, 133, 107],
485
+ [8, 59, 37, 1, 60, 38],
486
+ [8, 44, 20, 4, 45, 21],
487
+ [12, 33, 11, 4, 34, 12],
488
+ // 14
489
+ [3, 145, 115, 1, 146, 116],
490
+ [4, 64, 40, 5, 65, 41],
491
+ [11, 36, 16, 5, 37, 17],
492
+ [11, 36, 12, 5, 37, 13],
493
+ // 15
494
+ [5, 109, 87, 1, 110, 88],
495
+ [5, 65, 41, 5, 66, 42],
496
+ [5, 54, 24, 7, 55, 25],
497
+ [11, 36, 12],
498
+ // 16
499
+ [5, 122, 98, 1, 123, 99],
500
+ [7, 73, 45, 3, 74, 46],
501
+ [15, 43, 19, 2, 44, 20],
502
+ [3, 45, 15, 13, 46, 16],
503
+ // 17
504
+ [1, 135, 107, 5, 136, 108],
505
+ [10, 74, 46, 1, 75, 47],
506
+ [1, 50, 22, 15, 51, 23],
507
+ [2, 42, 14, 17, 43, 15],
508
+ // 18
509
+ [5, 150, 120, 1, 151, 121],
510
+ [9, 69, 43, 4, 70, 44],
511
+ [17, 50, 22, 1, 51, 23],
512
+ [2, 42, 14, 19, 43, 15],
513
+ // 19
514
+ [3, 141, 113, 4, 142, 114],
515
+ [3, 70, 44, 11, 71, 45],
516
+ [17, 47, 21, 4, 48, 22],
517
+ [9, 39, 13, 16, 40, 14],
518
+ // 20
519
+ [3, 135, 107, 5, 136, 108],
520
+ [3, 67, 41, 13, 68, 42],
521
+ [15, 54, 24, 5, 55, 25],
522
+ [15, 43, 15, 10, 44, 16],
523
+ // 21
524
+ [4, 144, 116, 4, 145, 117],
525
+ [17, 68, 42],
526
+ [17, 50, 22, 6, 51, 23],
527
+ [19, 46, 16, 6, 47, 17],
528
+ // 22
529
+ [2, 139, 111, 7, 140, 112],
530
+ [17, 74, 46],
531
+ [7, 54, 24, 16, 55, 25],
532
+ [34, 37, 13],
533
+ // 23
534
+ [4, 151, 121, 5, 152, 122],
535
+ [4, 75, 47, 14, 76, 48],
536
+ [11, 54, 24, 14, 55, 25],
537
+ [16, 45, 15, 14, 46, 16],
538
+ // 24
539
+ [6, 147, 117, 4, 148, 118],
540
+ [6, 73, 45, 14, 74, 46],
541
+ [11, 54, 24, 16, 55, 25],
542
+ [30, 46, 16, 2, 47, 17],
543
+ // 25
544
+ [8, 132, 106, 4, 133, 107],
545
+ [8, 75, 47, 13, 76, 48],
546
+ [7, 54, 24, 22, 55, 25],
547
+ [22, 45, 15, 13, 46, 16],
548
+ // 26
549
+ [10, 142, 114, 2, 143, 115],
550
+ [19, 74, 46, 4, 75, 47],
551
+ [28, 50, 22, 6, 51, 23],
552
+ [33, 46, 16, 4, 47, 17],
553
+ // 27
554
+ [8, 152, 122, 4, 153, 123],
555
+ [22, 73, 45, 3, 74, 46],
556
+ [8, 53, 23, 26, 54, 24],
557
+ [12, 45, 15, 28, 46, 16],
558
+ // 28
559
+ [3, 147, 117, 10, 148, 118],
560
+ [3, 73, 45, 23, 74, 46],
561
+ [4, 54, 24, 31, 55, 25],
562
+ [11, 45, 15, 31, 46, 16],
563
+ // 29
564
+ [7, 146, 116, 7, 147, 117],
565
+ [21, 73, 45, 7, 74, 46],
566
+ [1, 53, 23, 37, 54, 24],
567
+ [19, 45, 15, 26, 46, 16],
568
+ // 30
569
+ [5, 145, 115, 10, 146, 116],
570
+ [19, 75, 47, 10, 76, 48],
571
+ [15, 54, 24, 25, 55, 25],
572
+ [23, 45, 15, 25, 46, 16],
573
+ // 31
574
+ [13, 145, 115, 3, 146, 116],
575
+ [2, 74, 46, 29, 75, 47],
576
+ [42, 54, 24, 1, 55, 25],
577
+ [23, 45, 15, 28, 46, 16],
578
+ // 32
579
+ [17, 145, 115],
580
+ [10, 74, 46, 23, 75, 47],
581
+ [10, 54, 24, 35, 55, 25],
582
+ [19, 45, 15, 35, 46, 16],
583
+ // 33
584
+ [17, 145, 115, 1, 146, 116],
585
+ [14, 74, 46, 21, 75, 47],
586
+ [29, 54, 24, 19, 55, 25],
587
+ [11, 45, 15, 46, 46, 16],
588
+ // 34
589
+ [13, 145, 115, 6, 146, 116],
590
+ [14, 74, 46, 23, 75, 47],
591
+ [44, 54, 24, 7, 55, 25],
592
+ [59, 46, 16, 1, 47, 17],
593
+ // 35
594
+ [12, 151, 121, 7, 152, 122],
595
+ [12, 75, 47, 26, 76, 48],
596
+ [39, 54, 24, 14, 55, 25],
597
+ [22, 45, 15, 41, 46, 16],
598
+ // 36
599
+ [6, 151, 121, 14, 152, 122],
600
+ [6, 75, 47, 34, 76, 48],
601
+ [46, 54, 24, 10, 55, 25],
602
+ [2, 45, 15, 64, 46, 16],
603
+ // 37
604
+ [17, 152, 122, 4, 153, 123],
605
+ [29, 74, 46, 14, 75, 47],
606
+ [49, 54, 24, 10, 55, 25],
607
+ [24, 45, 15, 46, 46, 16],
608
+ // 38
609
+ [4, 152, 122, 18, 153, 123],
610
+ [13, 74, 46, 32, 75, 47],
611
+ [48, 54, 24, 14, 55, 25],
612
+ [42, 45, 15, 32, 46, 16],
613
+ // 39
614
+ [20, 147, 117, 4, 148, 118],
615
+ [40, 75, 47, 7, 76, 48],
616
+ [43, 54, 24, 22, 55, 25],
617
+ [10, 45, 15, 67, 46, 16],
618
+ // 40
619
+ [19, 148, 118, 6, 149, 119],
620
+ [18, 75, 47, 31, 76, 48],
621
+ [34, 54, 24, 34, 55, 25],
622
+ [20, 45, 15, 61, 46, 16]
623
+ ];
624
+ QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
625
+ var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
626
+ if (rsBlock === void 0) {
627
+ throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
628
+ }
629
+ var length = rsBlock.length / 3;
630
+ var list = [];
631
+ for (var i = 0; i < length; i++) {
632
+ var count = rsBlock[i * 3 + 0];
633
+ var totalCount = rsBlock[i * 3 + 1];
634
+ var dataCount = rsBlock[i * 3 + 2];
635
+ for (var j = 0; j < count; j++) {
636
+ list.push(new QRRSBlock(totalCount, dataCount));
637
+ }
638
+ }
639
+ return list;
640
+ };
641
+ QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
642
+ switch (errorCorrectLevel) {
643
+ case QRErrorCorrectLevel.L:
644
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
645
+ case QRErrorCorrectLevel.M:
646
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
647
+ case QRErrorCorrectLevel.Q:
648
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
649
+ case QRErrorCorrectLevel.H:
650
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
651
+ default:
652
+ return void 0;
653
+ }
654
+ };
655
+ module.exports = QRRSBlock;
656
+ }
657
+ });
658
+
659
+ // node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js
660
+ var require_QRBitBuffer = __commonJS({
661
+ "node_modules/qrcode-terminal/vendor/QRCode/QRBitBuffer.js"(exports, module) {
662
+ init_esbuild_shims();
663
+ function QRBitBuffer() {
664
+ this.buffer = [];
665
+ this.length = 0;
666
+ }
667
+ __name(QRBitBuffer, "QRBitBuffer");
668
+ QRBitBuffer.prototype = {
669
+ get: /* @__PURE__ */ __name(function(index) {
670
+ var bufIndex = Math.floor(index / 8);
671
+ return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
672
+ }, "get"),
673
+ put: /* @__PURE__ */ __name(function(num, length) {
674
+ for (var i = 0; i < length; i++) {
675
+ this.putBit((num >>> length - i - 1 & 1) == 1);
676
+ }
677
+ }, "put"),
678
+ getLengthInBits: /* @__PURE__ */ __name(function() {
679
+ return this.length;
680
+ }, "getLengthInBits"),
681
+ putBit: /* @__PURE__ */ __name(function(bit) {
682
+ var bufIndex = Math.floor(this.length / 8);
683
+ if (this.buffer.length <= bufIndex) {
684
+ this.buffer.push(0);
685
+ }
686
+ if (bit) {
687
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
688
+ }
689
+ this.length++;
690
+ }, "putBit")
691
+ };
692
+ module.exports = QRBitBuffer;
693
+ }
694
+ });
695
+
696
+ // node_modules/qrcode-terminal/vendor/QRCode/index.js
697
+ var require_QRCode = __commonJS({
698
+ "node_modules/qrcode-terminal/vendor/QRCode/index.js"(exports, module) {
699
+ init_esbuild_shims();
700
+ var QR8bitByte = require_QR8bitByte();
701
+ var QRUtil = require_QRUtil();
702
+ var QRPolynomial = require_QRPolynomial();
703
+ var QRRSBlock = require_QRRSBlock();
704
+ var QRBitBuffer = require_QRBitBuffer();
705
+ function QRCode(typeNumber, errorCorrectLevel) {
706
+ this.typeNumber = typeNumber;
707
+ this.errorCorrectLevel = errorCorrectLevel;
708
+ this.modules = null;
709
+ this.moduleCount = 0;
710
+ this.dataCache = null;
711
+ this.dataList = [];
712
+ }
713
+ __name(QRCode, "QRCode");
714
+ QRCode.prototype = {
715
+ addData: /* @__PURE__ */ __name(function(data) {
716
+ var newData = new QR8bitByte(data);
717
+ this.dataList.push(newData);
718
+ this.dataCache = null;
719
+ }, "addData"),
720
+ isDark: /* @__PURE__ */ __name(function(row, col) {
721
+ if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
722
+ throw new Error(row + "," + col);
723
+ }
724
+ return this.modules[row][col];
725
+ }, "isDark"),
726
+ getModuleCount: /* @__PURE__ */ __name(function() {
727
+ return this.moduleCount;
728
+ }, "getModuleCount"),
729
+ make: /* @__PURE__ */ __name(function() {
730
+ if (this.typeNumber < 1) {
731
+ var typeNumber = 1;
732
+ for (typeNumber = 1; typeNumber < 40; typeNumber++) {
733
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
734
+ var buffer = new QRBitBuffer();
735
+ var totalDataCount = 0;
736
+ for (var i = 0; i < rsBlocks.length; i++) {
737
+ totalDataCount += rsBlocks[i].dataCount;
738
+ }
739
+ for (var x = 0; x < this.dataList.length; x++) {
740
+ var data = this.dataList[x];
741
+ buffer.put(data.mode, 4);
742
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
743
+ data.write(buffer);
744
+ }
745
+ if (buffer.getLengthInBits() <= totalDataCount * 8)
746
+ break;
747
+ }
748
+ this.typeNumber = typeNumber;
749
+ }
750
+ this.makeImpl(false, this.getBestMaskPattern());
751
+ }, "make"),
752
+ makeImpl: /* @__PURE__ */ __name(function(test, maskPattern) {
753
+ this.moduleCount = this.typeNumber * 4 + 17;
754
+ this.modules = new Array(this.moduleCount);
755
+ for (var row = 0; row < this.moduleCount; row++) {
756
+ this.modules[row] = new Array(this.moduleCount);
757
+ for (var col = 0; col < this.moduleCount; col++) {
758
+ this.modules[row][col] = null;
759
+ }
760
+ }
761
+ this.setupPositionProbePattern(0, 0);
762
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
763
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
764
+ this.setupPositionAdjustPattern();
765
+ this.setupTimingPattern();
766
+ this.setupTypeInfo(test, maskPattern);
767
+ if (this.typeNumber >= 7) {
768
+ this.setupTypeNumber(test);
769
+ }
770
+ if (this.dataCache === null) {
771
+ this.dataCache = QRCode.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
772
+ }
773
+ this.mapData(this.dataCache, maskPattern);
774
+ }, "makeImpl"),
775
+ setupPositionProbePattern: /* @__PURE__ */ __name(function(row, col) {
776
+ for (var r = -1; r <= 7; r++) {
777
+ if (row + r <= -1 || this.moduleCount <= row + r) continue;
778
+ for (var c = -1; c <= 7; c++) {
779
+ if (col + c <= -1 || this.moduleCount <= col + c) continue;
780
+ if (0 <= r && r <= 6 && (c === 0 || c === 6) || 0 <= c && c <= 6 && (r === 0 || r === 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
781
+ this.modules[row + r][col + c] = true;
782
+ } else {
783
+ this.modules[row + r][col + c] = false;
784
+ }
785
+ }
786
+ }
787
+ }, "setupPositionProbePattern"),
788
+ getBestMaskPattern: /* @__PURE__ */ __name(function() {
789
+ var minLostPoint = 0;
790
+ var pattern = 0;
791
+ for (var i = 0; i < 8; i++) {
792
+ this.makeImpl(true, i);
793
+ var lostPoint = QRUtil.getLostPoint(this);
794
+ if (i === 0 || minLostPoint > lostPoint) {
795
+ minLostPoint = lostPoint;
796
+ pattern = i;
797
+ }
798
+ }
799
+ return pattern;
800
+ }, "getBestMaskPattern"),
801
+ createMovieClip: /* @__PURE__ */ __name(function(target_mc, instance_name, depth) {
802
+ var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
803
+ var cs = 1;
804
+ this.make();
805
+ for (var row = 0; row < this.modules.length; row++) {
806
+ var y2 = row * cs;
807
+ for (var col = 0; col < this.modules[row].length; col++) {
808
+ var x = col * cs;
809
+ var dark = this.modules[row][col];
810
+ if (dark) {
811
+ qr_mc.beginFill(0, 100);
812
+ qr_mc.moveTo(x, y2);
813
+ qr_mc.lineTo(x + cs, y2);
814
+ qr_mc.lineTo(x + cs, y2 + cs);
815
+ qr_mc.lineTo(x, y2 + cs);
816
+ qr_mc.endFill();
817
+ }
818
+ }
819
+ }
820
+ return qr_mc;
821
+ }, "createMovieClip"),
822
+ setupTimingPattern: /* @__PURE__ */ __name(function() {
823
+ for (var r = 8; r < this.moduleCount - 8; r++) {
824
+ if (this.modules[r][6] !== null) {
825
+ continue;
826
+ }
827
+ this.modules[r][6] = r % 2 === 0;
828
+ }
829
+ for (var c = 8; c < this.moduleCount - 8; c++) {
830
+ if (this.modules[6][c] !== null) {
831
+ continue;
832
+ }
833
+ this.modules[6][c] = c % 2 === 0;
834
+ }
835
+ }, "setupTimingPattern"),
836
+ setupPositionAdjustPattern: /* @__PURE__ */ __name(function() {
837
+ var pos = QRUtil.getPatternPosition(this.typeNumber);
838
+ for (var i = 0; i < pos.length; i++) {
839
+ for (var j = 0; j < pos.length; j++) {
840
+ var row = pos[i];
841
+ var col = pos[j];
842
+ if (this.modules[row][col] !== null) {
843
+ continue;
844
+ }
845
+ for (var r = -2; r <= 2; r++) {
846
+ for (var c = -2; c <= 2; c++) {
847
+ if (Math.abs(r) === 2 || Math.abs(c) === 2 || r === 0 && c === 0) {
848
+ this.modules[row + r][col + c] = true;
849
+ } else {
850
+ this.modules[row + r][col + c] = false;
851
+ }
852
+ }
853
+ }
854
+ }
855
+ }
856
+ }, "setupPositionAdjustPattern"),
857
+ setupTypeNumber: /* @__PURE__ */ __name(function(test) {
858
+ var bits = QRUtil.getBCHTypeNumber(this.typeNumber);
859
+ var mod;
860
+ for (var i = 0; i < 18; i++) {
861
+ mod = !test && (bits >> i & 1) === 1;
862
+ this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
863
+ }
864
+ for (var x = 0; x < 18; x++) {
865
+ mod = !test && (bits >> x & 1) === 1;
866
+ this.modules[x % 3 + this.moduleCount - 8 - 3][Math.floor(x / 3)] = mod;
867
+ }
868
+ }, "setupTypeNumber"),
869
+ setupTypeInfo: /* @__PURE__ */ __name(function(test, maskPattern) {
870
+ var data = this.errorCorrectLevel << 3 | maskPattern;
871
+ var bits = QRUtil.getBCHTypeInfo(data);
872
+ var mod;
873
+ for (var v = 0; v < 15; v++) {
874
+ mod = !test && (bits >> v & 1) === 1;
875
+ if (v < 6) {
876
+ this.modules[v][8] = mod;
877
+ } else if (v < 8) {
878
+ this.modules[v + 1][8] = mod;
879
+ } else {
880
+ this.modules[this.moduleCount - 15 + v][8] = mod;
881
+ }
882
+ }
883
+ for (var h2 = 0; h2 < 15; h2++) {
884
+ mod = !test && (bits >> h2 & 1) === 1;
885
+ if (h2 < 8) {
886
+ this.modules[8][this.moduleCount - h2 - 1] = mod;
887
+ } else if (h2 < 9) {
888
+ this.modules[8][15 - h2 - 1 + 1] = mod;
889
+ } else {
890
+ this.modules[8][15 - h2 - 1] = mod;
891
+ }
892
+ }
893
+ this.modules[this.moduleCount - 8][8] = !test;
894
+ }, "setupTypeInfo"),
895
+ mapData: /* @__PURE__ */ __name(function(data, maskPattern) {
896
+ var inc = -1;
897
+ var row = this.moduleCount - 1;
898
+ var bitIndex = 7;
899
+ var byteIndex = 0;
900
+ for (var col = this.moduleCount - 1; col > 0; col -= 2) {
901
+ if (col === 6) col--;
902
+ while (true) {
903
+ for (var c = 0; c < 2; c++) {
904
+ if (this.modules[row][col - c] === null) {
905
+ var dark = false;
906
+ if (byteIndex < data.length) {
907
+ dark = (data[byteIndex] >>> bitIndex & 1) === 1;
908
+ }
909
+ var mask = QRUtil.getMask(maskPattern, row, col - c);
910
+ if (mask) {
911
+ dark = !dark;
912
+ }
913
+ this.modules[row][col - c] = dark;
914
+ bitIndex--;
915
+ if (bitIndex === -1) {
916
+ byteIndex++;
917
+ bitIndex = 7;
918
+ }
919
+ }
920
+ }
921
+ row += inc;
922
+ if (row < 0 || this.moduleCount <= row) {
923
+ row -= inc;
924
+ inc = -inc;
925
+ break;
926
+ }
927
+ }
928
+ }
929
+ }, "mapData")
930
+ };
931
+ QRCode.PAD0 = 236;
932
+ QRCode.PAD1 = 17;
933
+ QRCode.createData = function(typeNumber, errorCorrectLevel, dataList) {
934
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
935
+ var buffer = new QRBitBuffer();
936
+ for (var i = 0; i < dataList.length; i++) {
937
+ var data = dataList[i];
938
+ buffer.put(data.mode, 4);
939
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.mode, typeNumber));
940
+ data.write(buffer);
941
+ }
942
+ var totalDataCount = 0;
943
+ for (var x = 0; x < rsBlocks.length; x++) {
944
+ totalDataCount += rsBlocks[x].dataCount;
945
+ }
946
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
947
+ throw new Error("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")");
948
+ }
949
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
950
+ buffer.put(0, 4);
951
+ }
952
+ while (buffer.getLengthInBits() % 8 !== 0) {
953
+ buffer.putBit(false);
954
+ }
955
+ while (true) {
956
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
957
+ break;
958
+ }
959
+ buffer.put(QRCode.PAD0, 8);
960
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
961
+ break;
962
+ }
963
+ buffer.put(QRCode.PAD1, 8);
964
+ }
965
+ return QRCode.createBytes(buffer, rsBlocks);
966
+ };
967
+ QRCode.createBytes = function(buffer, rsBlocks) {
968
+ var offset = 0;
969
+ var maxDcCount = 0;
970
+ var maxEcCount = 0;
971
+ var dcdata = new Array(rsBlocks.length);
972
+ var ecdata = new Array(rsBlocks.length);
973
+ for (var r = 0; r < rsBlocks.length; r++) {
974
+ var dcCount = rsBlocks[r].dataCount;
975
+ var ecCount = rsBlocks[r].totalCount - dcCount;
976
+ maxDcCount = Math.max(maxDcCount, dcCount);
977
+ maxEcCount = Math.max(maxEcCount, ecCount);
978
+ dcdata[r] = new Array(dcCount);
979
+ for (var i = 0; i < dcdata[r].length; i++) {
980
+ dcdata[r][i] = 255 & buffer.buffer[i + offset];
981
+ }
982
+ offset += dcCount;
983
+ var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
984
+ var rawPoly = new QRPolynomial(dcdata[r], rsPoly.getLength() - 1);
985
+ var modPoly = rawPoly.mod(rsPoly);
986
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
987
+ for (var x = 0; x < ecdata[r].length; x++) {
988
+ var modIndex = x + modPoly.getLength() - ecdata[r].length;
989
+ ecdata[r][x] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
990
+ }
991
+ }
992
+ var totalCodeCount = 0;
993
+ for (var y2 = 0; y2 < rsBlocks.length; y2++) {
994
+ totalCodeCount += rsBlocks[y2].totalCount;
995
+ }
996
+ var data = new Array(totalCodeCount);
997
+ var index = 0;
998
+ for (var z = 0; z < maxDcCount; z++) {
999
+ for (var s = 0; s < rsBlocks.length; s++) {
1000
+ if (z < dcdata[s].length) {
1001
+ data[index++] = dcdata[s][z];
1002
+ }
1003
+ }
1004
+ }
1005
+ for (var xx = 0; xx < maxEcCount; xx++) {
1006
+ for (var t = 0; t < rsBlocks.length; t++) {
1007
+ if (xx < ecdata[t].length) {
1008
+ data[index++] = ecdata[t][xx];
1009
+ }
1010
+ }
1011
+ }
1012
+ return data;
1013
+ };
1014
+ module.exports = QRCode;
1015
+ }
1016
+ });
1017
+
1018
+ // node_modules/qrcode-terminal/lib/main.js
1019
+ var require_main = __commonJS({
1020
+ "node_modules/qrcode-terminal/lib/main.js"(exports, module) {
1021
+ init_esbuild_shims();
1022
+ var QRCode = require_QRCode();
1023
+ var QRErrorCorrectLevel = require_QRErrorCorrectLevel();
1024
+ var black = "\x1B[40m \x1B[0m";
1025
+ var white = "\x1B[47m \x1B[0m";
1026
+ var toCell = /* @__PURE__ */ __name(function(isBlack) {
1027
+ return isBlack ? black : white;
1028
+ }, "toCell");
1029
+ var repeat = /* @__PURE__ */ __name(function(color) {
1030
+ return {
1031
+ times: /* @__PURE__ */ __name(function(count) {
1032
+ return new Array(count).join(color);
1033
+ }, "times")
1034
+ };
1035
+ }, "repeat");
1036
+ var fill = /* @__PURE__ */ __name(function(length, value) {
1037
+ var arr = new Array(length);
1038
+ for (var i = 0; i < length; i++) {
1039
+ arr[i] = value;
1040
+ }
1041
+ return arr;
1042
+ }, "fill");
1043
+ module.exports = {
1044
+ error: QRErrorCorrectLevel.L,
1045
+ generate: /* @__PURE__ */ __name(function(input, opts, cb) {
1046
+ if (typeof opts === "function") {
1047
+ cb = opts;
1048
+ opts = {};
1049
+ }
1050
+ var qrcode = new QRCode(-1, this.error);
1051
+ qrcode.addData(input);
1052
+ qrcode.make();
1053
+ var output = "";
1054
+ if (opts && opts.small) {
1055
+ var BLACK = true, WHITE = false;
1056
+ var moduleCount = qrcode.getModuleCount();
1057
+ var moduleData = qrcode.modules.slice();
1058
+ var oddRow = moduleCount % 2 === 1;
1059
+ if (oddRow) {
1060
+ moduleData.push(fill(moduleCount, WHITE));
1061
+ }
1062
+ var platte = {
1063
+ WHITE_ALL: "\u2588",
1064
+ WHITE_BLACK: "\u2580",
1065
+ BLACK_WHITE: "\u2584",
1066
+ BLACK_ALL: " "
1067
+ };
1068
+ var borderTop = repeat(platte.BLACK_WHITE).times(moduleCount + 3);
1069
+ var borderBottom = repeat(platte.WHITE_BLACK).times(moduleCount + 3);
1070
+ output += borderTop + "\n";
1071
+ for (var row = 0; row < moduleCount; row += 2) {
1072
+ output += platte.WHITE_ALL;
1073
+ for (var col = 0; col < moduleCount; col++) {
1074
+ if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === WHITE) {
1075
+ output += platte.WHITE_ALL;
1076
+ } else if (moduleData[row][col] === WHITE && moduleData[row + 1][col] === BLACK) {
1077
+ output += platte.WHITE_BLACK;
1078
+ } else if (moduleData[row][col] === BLACK && moduleData[row + 1][col] === WHITE) {
1079
+ output += platte.BLACK_WHITE;
1080
+ } else {
1081
+ output += platte.BLACK_ALL;
1082
+ }
1083
+ }
1084
+ output += platte.WHITE_ALL + "\n";
1085
+ }
1086
+ if (!oddRow) {
1087
+ output += borderBottom;
1088
+ }
1089
+ } else {
1090
+ var border = repeat(white).times(qrcode.getModuleCount() + 3);
1091
+ output += border + "\n";
1092
+ qrcode.modules.forEach(function(row2) {
1093
+ output += white;
1094
+ output += row2.map(toCell).join("");
1095
+ output += white + "\n";
1096
+ });
1097
+ output += border;
1098
+ }
1099
+ if (cb) cb(output);
1100
+ else console.log(output);
1101
+ }, "generate"),
1102
+ setErrorLevel: /* @__PURE__ */ __name(function(error) {
1103
+ this.error = QRErrorCorrectLevel[error] || this.error;
1104
+ }, "setErrorLevel")
1105
+ };
1106
+ }
1107
+ });
1108
+
1109
+ // packages/channels/qqbot/dist/index.js
1110
+ init_esbuild_shims();
1111
+
1112
+ // packages/channels/qqbot/dist/QQChannel.js
1113
+ init_esbuild_shims();
1114
+ import { readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2 } from "node:fs";
1115
+ import { join as join2 } from "node:path";
1116
+
1117
+ // packages/channels/qqbot/dist/types.js
1118
+ init_esbuild_shims();
1119
+ var OpCode = {
1120
+ DISPATCH: 0,
1121
+ HEARTBEAT: 1,
1122
+ IDENTIFY: 2,
1123
+ RESUME: 6,
1124
+ RECONNECT: 7,
1125
+ INVALID_SESSION: 9,
1126
+ HELLO: 10,
1127
+ HEARTBEAT_ACK: 11
1128
+ };
1129
+ var Intent = {
1130
+ C2C_MESSAGE: 1 << 12,
1131
+ // C2C 消息
1132
+ GROUP_AT_MESSAGE: 1 << 25
1133
+ // 群聊 @ 消息事件
1134
+ };
1135
+
1136
+ // packages/channels/qqbot/dist/accounts.js
1137
+ init_esbuild_shims();
1138
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
1139
+ import { join } from "node:path";
1140
+ function getCredsFilePath(safeName) {
1141
+ return join(getGlobalQwenDir(), "channels", `${safeName}-credentials.json`);
1142
+ }
1143
+ __name(getCredsFilePath, "getCredsFilePath");
1144
+ function loadCredentials(credsFile) {
1145
+ if (!existsSync(credsFile))
1146
+ return null;
1147
+ try {
1148
+ const saved = JSON.parse(readFileSync(credsFile, "utf-8"));
1149
+ if (saved.appId && saved.appSecret) {
1150
+ return { appId: saved.appId, appSecret: saved.appSecret };
1151
+ }
1152
+ return null;
1153
+ } catch {
1154
+ return null;
1155
+ }
1156
+ }
1157
+ __name(loadCredentials, "loadCredentials");
1158
+ function saveCredentials(credsFile, appId, appSecret) {
1159
+ const dir = join(getGlobalQwenDir(), "channels");
1160
+ mkdirSync(dir, { recursive: true });
1161
+ writeFileSync(credsFile, JSON.stringify({ appId, appSecret }), {
1162
+ mode: 384
1163
+ });
1164
+ }
1165
+ __name(saveCredentials, "saveCredentials");
1166
+
1167
+ // packages/channels/qqbot/dist/login.js
1168
+ init_esbuild_shims();
1169
+
1170
+ // node_modules/@tencent-connect/qqbot-connector/dist/esm/index.js
1171
+ init_esbuild_shims();
1172
+
1173
+ // node_modules/@tencent-connect/qqbot-connector/dist/esm/qr-connect.js
1174
+ init_esbuild_shims();
1175
+ var import_qrcode_terminal = __toESM(require_main(), 1);
1176
+
1177
+ // node_modules/@tencent-connect/qqbot-connector/dist/esm/qqbot-session.js
1178
+ init_esbuild_shims();
1179
+ import m from "node:crypto";
1180
+ import _ from "node:https";
1181
+ var E = { production: "q.qq.com", test: "test.q.qq.com" };
1182
+ function u(t = "production") {
1183
+ return E[t];
1184
+ }
1185
+ __name(u, "u");
1186
+ function l() {
1187
+ return m.randomBytes(32).toString("base64");
1188
+ }
1189
+ __name(l, "l");
1190
+ var d;
1191
+ (function(t) {
1192
+ t[t.NONE = 0] = "NONE", t[t.PENDING = 1] = "PENDING", t[t.COMPLETED = 2] = "COMPLETED", t[t.EXPIRED = 3] = "EXPIRED";
1193
+ })(d || (d = {}));
1194
+ function b(t, r) {
1195
+ const a = Buffer.from(r, "base64"), n = Buffer.from(t, "base64"), e = n.subarray(0, 12), i = n.subarray(n.length - 16), s = n.subarray(12, n.length - 16), o = m.createDecipheriv("aes-256-gcm", a, e);
1196
+ return o.setAuthTag(i), Buffer.concat([o.update(s), o.final()]).toString("utf8");
1197
+ }
1198
+ __name(b, "b");
1199
+ function h(t, r, a) {
1200
+ return new Promise((n, e) => {
1201
+ const i = JSON.stringify(r), s = new URL(t), o = _.request({ hostname: s.hostname, path: s.pathname + s.search, method: "POST", timeout: a, headers: { "Content-Type": "application/json", Accept: "application/json", "Content-Length": Buffer.byteLength(i) } }, (c) => {
1202
+ if (c.statusCode !== 200) {
1203
+ c.resume(), e(new Error(`HTTP ${c.statusCode} from ${t}`));
1204
+ return;
1205
+ }
1206
+ let f = "";
1207
+ c.on("data", (p2) => {
1208
+ f += p2;
1209
+ }), c.on("end", () => {
1210
+ try {
1211
+ n(JSON.parse(f));
1212
+ } catch (p2) {
1213
+ e(p2);
1214
+ }
1215
+ });
1216
+ });
1217
+ o.on("error", e), o.on("timeout", () => {
1218
+ o.destroy(), e(new Error(`timeout fetching ${t}`));
1219
+ }), o.end(i);
1220
+ });
1221
+ }
1222
+ __name(h, "h");
1223
+ async function y(t = "production", r = 1e4) {
1224
+ const a = `https://${u(t)}/lite/create_bind_task`, n = l(), e = await h(a, { key: n }, r);
1225
+ if (e.retcode !== 0) throw new Error(e.msg ?? "create_bind_task failed");
1226
+ if (!e.data?.task_id) throw new Error("create_bind_task: missing task_id");
1227
+ return { taskId: e.data.task_id, key: n };
1228
+ }
1229
+ __name(y, "y");
1230
+ async function g(t, r = "production", a = 1e4) {
1231
+ const n = `https://${u(r)}/lite/poll_bind_result`, e = await h(n, { task_id: t }, a);
1232
+ if (e.retcode !== 0) throw new Error(e.msg ?? "poll_bind_result failed");
1233
+ return { status: e.data?.status ?? d.NONE, botAppId: String(e.data?.bot_appid ?? ""), botEncryptSecret: e.data?.bot_encrypt_secret ?? "" };
1234
+ }
1235
+ __name(g, "g");
1236
+ function w(t, r = "") {
1237
+ return `https://${u("production")}/qqbot/openclaw/connect.html?task_id=${encodeURIComponent(t)}&source=${encodeURIComponent(r)}&_wv=2`;
1238
+ }
1239
+ __name(w, "w");
1240
+
1241
+ // node_modules/@tencent-connect/qqbot-connector/dist/esm/qr-connect.js
1242
+ var l2 = 2e3;
1243
+ function F(o) {
1244
+ return new Promise((r) => {
1245
+ import_qrcode_terminal.default.generate(o, { small: true }, (t) => {
1246
+ r(t);
1247
+ });
1248
+ });
1249
+ }
1250
+ __name(F, "F");
1251
+ function E2(o, r) {
1252
+ return new Promise((t, n) => {
1253
+ if (r?.aborted) {
1254
+ n(new DOMException("Aborted", "AbortError"));
1255
+ return;
1256
+ }
1257
+ const e = setTimeout(t, o);
1258
+ r?.addEventListener("abort", () => {
1259
+ clearTimeout(e), n(new DOMException("Aborted", "AbortError"));
1260
+ }, { once: true });
1261
+ });
1262
+ }
1263
+ __name(E2, "E");
1264
+ async function m2(o, r, t) {
1265
+ for (; !t?.aborted; ) {
1266
+ let n;
1267
+ try {
1268
+ n = await g(o);
1269
+ } catch {
1270
+ await E2(l2, t);
1271
+ continue;
1272
+ }
1273
+ if (n.status === d.COMPLETED) {
1274
+ const e = b(n.botEncryptSecret, r);
1275
+ return { outcome: "scanned", appId: n.botAppId, appSecret: e };
1276
+ }
1277
+ if (n.status === d.EXPIRED) return { outcome: "expired" };
1278
+ await E2(l2, t);
1279
+ }
1280
+ throw new DOMException("Aborted", "AbortError");
1281
+ }
1282
+ __name(m2, "m");
1283
+ function p(o, r) {
1284
+ const t = new AbortController(), n = r?.signal ? AbortSignal.any([t.signal, r.signal]) : t.signal;
1285
+ return (async () => {
1286
+ const e = r?.displayQrCodeToConsole ?? true;
1287
+ for (; ; ) {
1288
+ if (n.aborted) throw new DOMException("Aborted", "AbortError");
1289
+ let a;
1290
+ try {
1291
+ a = await y();
1292
+ } catch (u2) {
1293
+ throw new Error(`\u83B7\u53D6\u7ED1\u5B9A\u4EFB\u52A1\u5931\u8D25: ${u2 instanceof Error ? u2.message : String(u2)}`, { cause: u2 });
1294
+ }
1295
+ const s = w(a.taskId, r?.source);
1296
+ if (e) {
1297
+ const u2 = await F(s);
1298
+ console.log(u2), console.log(`\u8BF7\u4F7F\u7528\u624B\u673A QQ \u626B\u63CF\u4E0A\u65B9\u4E8C\u7EF4\u7801\uFF0C\u5B8C\u6210\u673A\u5668\u4EBA\u7ED1\u5B9A\u3002
1299
+ `);
1300
+ }
1301
+ o.onQrDisplayed?.(s);
1302
+ const c = await m2(a.taskId, a.key, n);
1303
+ if (c.outcome === "scanned") {
1304
+ o.onSuccess([{ appId: c.appId, appSecret: c.appSecret }]);
1305
+ return;
1306
+ }
1307
+ o.onQrExpired?.(), e && console.log(`\u4E8C\u7EF4\u7801\u5DF2\u8FC7\u671F\uFF0C\u6B63\u5728\u5237\u65B0\u2026
1308
+ `);
1309
+ }
1310
+ })().catch((e) => {
1311
+ if (e instanceof DOMException && e.name === "AbortError") {
1312
+ o.onFailure(new Error("\u5DF2\u53D6\u6D88"));
1313
+ return;
1314
+ }
1315
+ o.onFailure(e instanceof Error ? e : new Error(String(e)));
1316
+ }), () => t.abort();
1317
+ }
1318
+ __name(p, "p");
1319
+ function C(o) {
1320
+ return new Promise((r, t) => {
1321
+ p({ onSuccess: r, onFailure: t }, { ...o, displayQrCodeToConsole: true });
1322
+ });
1323
+ }
1324
+ __name(C, "C");
1325
+
1326
+ // packages/channels/qqbot/dist/login.js
1327
+ async function qrCodeLogin() {
1328
+ const results = await C();
1329
+ const creds = results[0];
1330
+ if (!creds?.appId || !creds?.appSecret) {
1331
+ throw new Error("QR login failed: no credentials returned");
1332
+ }
1333
+ return { appId: creds.appId, appSecret: creds.appSecret };
1334
+ }
1335
+ __name(qrCodeLogin, "qrCodeLogin");
1336
+
1337
+ // packages/channels/qqbot/dist/api.js
1338
+ init_esbuild_shims();
1339
+ var TOKEN_URL = "https://bots.qq.com/app/getAppAccessToken";
1340
+ var API_HOST = "https://api.sgroup.qq.com";
1341
+ var SANDBOX_HOST = "https://sandbox.api.sgroup.qq.com";
1342
+ var FETCH_TIMEOUT = 15e3;
1343
+ async function fetchAccessToken(appId, appSecret) {
1344
+ const resp = await fetch(TOKEN_URL, {
1345
+ method: "POST",
1346
+ headers: { "Content-Type": "application/json" },
1347
+ body: JSON.stringify({ appId, clientSecret: appSecret }),
1348
+ signal: AbortSignal.timeout(FETCH_TIMEOUT)
1349
+ });
1350
+ if (!resp.ok) {
1351
+ const body = await resp.text().catch(() => "");
1352
+ throw new Error(`QQ Bot token request failed (HTTP ${resp.status}): ${body}`);
1353
+ }
1354
+ const data = await resp.json();
1355
+ if (!data.access_token) {
1356
+ throw new Error("QQ Bot token response missing access_token");
1357
+ }
1358
+ return {
1359
+ accessToken: data.access_token,
1360
+ expiresIn: data.expires_in ?? 7200
1361
+ };
1362
+ }
1363
+ __name(fetchAccessToken, "fetchAccessToken");
1364
+ async function fetchGatewayUrl(accessToken, sandbox) {
1365
+ const gw = sandbox ? `${SANDBOX_HOST}/gateway` : `${API_HOST}/gateway`;
1366
+ const resp = await fetch(gw, {
1367
+ headers: { Authorization: `QQBot ${accessToken}` },
1368
+ signal: AbortSignal.timeout(FETCH_TIMEOUT)
1369
+ });
1370
+ if (!resp.ok) {
1371
+ throw new Error(`QQ Bot gateway request failed (HTTP ${resp.status})`);
1372
+ }
1373
+ const data = await resp.json();
1374
+ if (!data["url"]) {
1375
+ throw new Error("QQ Bot gateway response missing WebSocket URL");
1376
+ }
1377
+ return data["url"];
1378
+ }
1379
+ __name(fetchGatewayUrl, "fetchGatewayUrl");
1380
+ function getApiBase(sandbox) {
1381
+ return sandbox ? SANDBOX_HOST : API_HOST;
1382
+ }
1383
+ __name(getApiBase, "getApiBase");
1384
+ async function sendQQMessage(base, path, accessToken, body) {
1385
+ return fetch(`${base}${path}`, {
1386
+ method: "POST",
1387
+ headers: {
1388
+ "Content-Type": "application/json",
1389
+ Authorization: `QQBot ${accessToken}`
1390
+ },
1391
+ body: JSON.stringify(body),
1392
+ signal: AbortSignal.timeout(FETCH_TIMEOUT)
1393
+ });
1394
+ }
1395
+ __name(sendQQMessage, "sendQQMessage");
1396
+
1397
+ // packages/channels/qqbot/dist/QQChannel.js
1398
+ function isValidChatId(id) {
1399
+ return /^[A-Za-z0-9_-]+$/.test(id) && id.length <= 128;
1400
+ }
1401
+ __name(isValidChatId, "isValidChatId");
1402
+ function hasLinkSyntax(text) {
1403
+ const open = text.indexOf("[");
1404
+ if (open === -1)
1405
+ return false;
1406
+ const mid = text.indexOf("](", open + 1);
1407
+ if (mid === -1)
1408
+ return false;
1409
+ return text.indexOf(")", mid + 2) !== -1;
1410
+ }
1411
+ __name(hasLinkSyntax, "hasLinkSyntax");
1412
+ function hasMarkdownSyntax(text) {
1413
+ return /^#{1,6}\s/m.test(text) || text.includes("```") || /\*\*|__|~~/.test(text) || /`[^`]+`/.test(text) || hasLinkSyntax(text) || /^[-*+]\s/m.test(text) || /^\d+\.\s/m.test(text);
1414
+ }
1415
+ __name(hasMarkdownSyntax, "hasMarkdownSyntax");
1416
+ function splitText(text) {
1417
+ const MAX = 2e3;
1418
+ if (text.length <= MAX)
1419
+ return [text];
1420
+ const chunks = [];
1421
+ for (let i = 0; i < text.length; i += MAX) {
1422
+ chunks.push(text.slice(i, i + MAX));
1423
+ }
1424
+ return chunks;
1425
+ }
1426
+ __name(splitText, "splitText");
1427
+ var QQChannel = class extends ChannelBase {
1428
+ static {
1429
+ __name(this, "QQChannel");
1430
+ }
1431
+ ws = null;
1432
+ accessToken = "";
1433
+ tokenExpiresAt = 0;
1434
+ tokenRefreshTimer = null;
1435
+ heartbeatTimer = null;
1436
+ heartbeatInterval = 45e3;
1437
+ seq = 0;
1438
+ reconnectAttempts = 0;
1439
+ maxReconnectAttempts = 20;
1440
+ /** QQ Bot session_id from READY, used for RESUME on reconnect. */
1441
+ sessionId = "";
1442
+ /** Whether this connection attempt should try RESUME first. */
1443
+ tryResume = false;
1444
+ qqConfig;
1445
+ /** Set when server sends RECONNECT opcode — close handler uses this to force reconnect. */
1446
+ serverRequestedReconnect = false;
1447
+ /** Pending connect promise reject — called when WebSocket closes before READY. */
1448
+ connectReject = null;
1449
+ /** Set to true when channel is disconnected — prevents orphaned connections. */
1450
+ disposed = false;
1451
+ /** Deduplicate inbound messages on reconnect replay (messageId → timestamp). */
1452
+ seenMessages = /* @__PURE__ */ new Map();
1453
+ /** Cleanup timer for seenMessages TTL eviction. */
1454
+ seenCleanupTimer = null;
1455
+ /** Timestamp of last received HEARTBEAT_ACK, for zombie-connection detection. */
1456
+ lastHeartbeatAck = 0;
1457
+ /** Debounce timer for saveQQState to avoid blocking event loop. */
1458
+ saveTimer = null;
1459
+ /** Timer for reconnectWithRetry fallback (unref'd so it doesn't block exit). */
1460
+ reconnectTimer = null;
1461
+ /** Guard against parallel reconnectWithRetry chains from stale close events. */
1462
+ isReconnecting = false;
1463
+ /** Track whether a chatId is a group or C2C for correct API routing. */
1464
+ chatTypeMap = /* @__PURE__ */ new Map();
1465
+ /** Track the latest user messageId per chatId for proper reply (msg_id). */
1466
+ replyMsgId = /* @__PURE__ */ new Map();
1467
+ /** msg_seq counter per user messageId, for multi-block streaming. */
1468
+ msgSeqMap = /* @__PURE__ */ new Map();
1469
+ /** Path to persisted QQ routing state: chatTypeMap, replyMsgId, msgSeqMap. */
1470
+ qqStatePath;
1471
+ /**
1472
+ * Path to the SessionRouter persistence file we back up before shutdown.
1473
+ * start.ts passes a shared router; standalone QQChannel instances use a
1474
+ * per-channel router file.
1475
+ */
1476
+ globalSessionsPath;
1477
+ /** Backup of sessions.json so conversations survive daemon restarts. */
1478
+ sessionsBackupPath;
1479
+ constructor(name, config, bridge, options) {
1480
+ const safeName = name.replace(/[^A-Za-z0-9_-]/g, "_");
1481
+ const stateDir = join2(getGlobalQwenDir(), "channels");
1482
+ mkdirSync2(stateDir, { recursive: true });
1483
+ const sessionsPath = join2(stateDir, `${safeName}-sessions.json`);
1484
+ const hasExternalRouter = Boolean(options?.router);
1485
+ const router = options?.router ?? new SessionRouter(bridge, config.cwd, config.sessionScope, sessionsPath);
1486
+ super(name, config, bridge, { ...options, router });
1487
+ this.qqConfig = config;
1488
+ this.qqStatePath = join2(stateDir, `${safeName}-state.json`);
1489
+ this.globalSessionsPath = hasExternalRouter ? join2(stateDir, "sessions.json") : sessionsPath;
1490
+ this.sessionsBackupPath = join2(stateDir, `${safeName}-sessions-backup.json`);
1491
+ }
1492
+ // ── ChannelBase interface ──────────────────────────────────────
1493
+ async connect() {
1494
+ this.disposed = false;
1495
+ if (!this.config.instructions) {
1496
+ this.config.instructions = [
1497
+ "## QQ Bot Channel",
1498
+ "",
1499
+ "\u4F60\u662F\u901A\u8FC7 QQ Bot \u4E0E\u7528\u6237\u5BF9\u8BDD\u7684 AI \u52A9\u624B\u3002",
1500
+ "\u56DE\u590D\u63A7\u5236\u5728 2000 \u5B57\u7B26\u4EE5\u5185\uFF08\u8D85\u957F\u4F1A\u81EA\u52A8\u5206\u5757\uFF09\uFF0C\u652F\u6301 Markdown \u683C\u5F0F\u3002"
1501
+ ].join("\n");
1502
+ }
1503
+ for (let attempt = 0; attempt < 3; attempt++) {
1504
+ try {
1505
+ await this.fetchToken();
1506
+ await this.connectGateway();
1507
+ return;
1508
+ } catch (e) {
1509
+ if (attempt < 2) {
1510
+ const msg = e instanceof Error ? e.message : String(e);
1511
+ process.stderr.write(`[QQ:${this.name}] Connect attempt ${attempt + 1} failed: ${msg}, retrying...
1512
+ `);
1513
+ await this.sleep(2e3);
1514
+ } else {
1515
+ throw e;
1516
+ }
1517
+ }
1518
+ }
1519
+ }
1520
+ async sendMessage(chatId, text) {
1521
+ const route = await this.resolveRoute(chatId);
1522
+ if (!route)
1523
+ return;
1524
+ const msgId = this.replyMsgId.get(chatId);
1525
+ const useMarkdown = hasMarkdownSyntax(text);
1526
+ for (const chunk of splitText(text)) {
1527
+ try {
1528
+ const body = useMarkdown ? { msg_type: 2, markdown: { content: chunk } } : { content: chunk, msg_type: 0 };
1529
+ const nextSeq = msgId ? (this.msgSeqMap.get(msgId) ?? 0) + 1 : 0;
1530
+ if (msgId) {
1531
+ body["msg_id"] = msgId;
1532
+ body["msg_seq"] = nextSeq;
1533
+ }
1534
+ let resp = await sendQQMessage(route.base, route.path, this.accessToken, body);
1535
+ if (!resp.ok && useMarkdown) {
1536
+ const errBody = await resp.text().catch(() => "");
1537
+ process.stderr.write(`[QQ:${this.name}] Markdown rejected (HTTP ${resp.status}: ${errBody.slice(0, 100)}), retrying as plain text
1538
+ `);
1539
+ const plainBody = {
1540
+ content: chunk,
1541
+ msg_type: 0
1542
+ };
1543
+ if (msgId) {
1544
+ plainBody["msg_id"] = msgId;
1545
+ plainBody["msg_seq"] = nextSeq;
1546
+ }
1547
+ resp = await sendQQMessage(route.base, route.path, this.accessToken, plainBody);
1548
+ }
1549
+ if (!resp.ok) {
1550
+ const errBody = await resp.text().catch(() => "");
1551
+ process.stderr.write(`[QQ:${this.name}] Send HTTP ${resp.status} (msg_seq=${body["msg_seq"] ?? "-"}): ${errBody.slice(0, 200)}
1552
+ `);
1553
+ break;
1554
+ }
1555
+ if (msgId)
1556
+ this.msgSeqMap.set(msgId, nextSeq);
1557
+ } catch (e) {
1558
+ process.stderr.write(`[QQ:${this.name}] Send error: ${e}
1559
+ `);
1560
+ break;
1561
+ }
1562
+ }
1563
+ if (msgId)
1564
+ this.saveQQState();
1565
+ }
1566
+ /**
1567
+ * Resolve API routing: handles disposed check, token refresh, chatId validation,
1568
+ * sandbox detection, and C2C/group path selection. Returns null if any guard fails.
1569
+ */
1570
+ async resolveRoute(chatId) {
1571
+ if (this.disposed)
1572
+ return null;
1573
+ if (Date.now() >= this.tokenExpiresAt) {
1574
+ try {
1575
+ await this.fetchToken();
1576
+ } catch {
1577
+ return null;
1578
+ }
1579
+ }
1580
+ if (!this.accessToken || !isValidChatId(chatId))
1581
+ return null;
1582
+ const base = getApiBase(Boolean(this.qqConfig.sandbox));
1583
+ const path = this.chatTypeMap.get(chatId) === "group" ? `/v2/groups/${chatId}/messages` : `/v2/users/${chatId}/messages`;
1584
+ return { base, path };
1585
+ }
1586
+ disconnect() {
1587
+ this.disposed = true;
1588
+ this.stopHeartbeat();
1589
+ this.stopTokenRefresh();
1590
+ if (this.seenCleanupTimer) {
1591
+ clearInterval(this.seenCleanupTimer);
1592
+ this.seenCleanupTimer = null;
1593
+ }
1594
+ if (this.reconnectTimer) {
1595
+ clearTimeout(this.reconnectTimer);
1596
+ this.reconnectTimer = null;
1597
+ }
1598
+ this.flushQQState();
1599
+ this.backupGlobalSessions();
1600
+ if (this.ws) {
1601
+ this.ws.close(1e3);
1602
+ this.ws = null;
1603
+ }
1604
+ if (this.connectReject) {
1605
+ this.connectReject(new Error("Channel disconnected"));
1606
+ this.connectReject = null;
1607
+ }
1608
+ this.chatTypeMap.clear();
1609
+ this.replyMsgId.clear();
1610
+ this.msgSeqMap.clear();
1611
+ }
1612
+ /**
1613
+ * QQ Bot API V2 does not provide a typing indicator endpoint.
1614
+ * ChannelBase calls these hooks to signal prompt start/end;
1615
+ * they are intentionally no-ops for this channel.
1616
+ */
1617
+ onPromptStart(_chatId, _sessionId, _messageId) {
1618
+ }
1619
+ onPromptEnd(_chatId, _sessionId, _messageId) {
1620
+ }
1621
+ // ── State Persistence (cross-server context continuation) ──────
1622
+ /** Debounced state persistence to avoid blocking event loop. */
1623
+ saveQQState() {
1624
+ if (this.saveTimer)
1625
+ clearTimeout(this.saveTimer);
1626
+ this.saveTimer = setTimeout(() => {
1627
+ try {
1628
+ writeFileSync2(this.qqStatePath, JSON.stringify({
1629
+ chatTypeMap: Array.from(this.chatTypeMap.entries()),
1630
+ replyMsgId: Array.from(this.replyMsgId.entries()),
1631
+ msgSeqMap: Array.from(this.msgSeqMap.entries())
1632
+ }), { mode: 384 });
1633
+ } catch {
1634
+ }
1635
+ }, 500);
1636
+ }
1637
+ /** Flush pending state writes immediately (called on disconnect). */
1638
+ flushQQState() {
1639
+ if (this.saveTimer) {
1640
+ clearTimeout(this.saveTimer);
1641
+ this.saveTimer = null;
1642
+ }
1643
+ try {
1644
+ writeFileSync2(this.qqStatePath, JSON.stringify({
1645
+ chatTypeMap: Array.from(this.chatTypeMap.entries()),
1646
+ replyMsgId: Array.from(this.replyMsgId.entries()),
1647
+ msgSeqMap: Array.from(this.msgSeqMap.entries())
1648
+ }));
1649
+ } catch {
1650
+ }
1651
+ }
1652
+ /**
1653
+ * Restore QQ routing state from disk.
1654
+ * Trusts persisted JSON — if the file is corrupt, new Map() may create
1655
+ * entries with undefined values, causing get()===undefined to fall through
1656
+ * to default routing (C2C). This is acceptable for a rare edge case.
1657
+ */
1658
+ restoreQQState() {
1659
+ try {
1660
+ if (!existsSync2(this.qqStatePath))
1661
+ return false;
1662
+ const raw = JSON.parse(readFileSync2(this.qqStatePath, "utf-8"));
1663
+ if (raw.chatTypeMap)
1664
+ this.chatTypeMap = new Map(raw.chatTypeMap);
1665
+ if (raw.replyMsgId)
1666
+ this.replyMsgId = new Map(raw.replyMsgId);
1667
+ if (raw.msgSeqMap)
1668
+ this.msgSeqMap = new Map(raw.msgSeqMap);
1669
+ return true;
1670
+ } catch (e) {
1671
+ process.stderr.write(`[QQ:${this.name}] Failed to restore QQ state: ${e instanceof Error ? e.message : String(e)}
1672
+ `);
1673
+ return false;
1674
+ }
1675
+ }
1676
+ /**
1677
+ * Backup the global sessions.json before start.ts deletes it on shutdown.
1678
+ * Restored on next connect so conversations survive daemon restarts.
1679
+ */
1680
+ backupGlobalSessions() {
1681
+ try {
1682
+ if (existsSync2(this.globalSessionsPath)) {
1683
+ const data = readFileSync2(this.globalSessionsPath, "utf-8");
1684
+ if (data.trim())
1685
+ writeFileSync2(this.sessionsBackupPath, data, { mode: 384 });
1686
+ }
1687
+ } catch {
1688
+ }
1689
+ }
1690
+ restoreGlobalSessions() {
1691
+ try {
1692
+ if (!existsSync2(this.globalSessionsPath) && existsSync2(this.sessionsBackupPath)) {
1693
+ writeFileSync2(this.globalSessionsPath, readFileSync2(this.sessionsBackupPath, "utf-8"), { mode: 384 });
1694
+ }
1695
+ } catch {
1696
+ }
1697
+ }
1698
+ /**
1699
+ * Workaround for SessionRouter.restoreSessions() storing undefined sessionIds
1700
+ * when ACP bridge.loadSession() fails to return a session_id.
1701
+ *
1702
+ * **Fragile**: accesses SessionRouter's private `toSession`/`toTarget`/`toCwd`
1703
+ * maps via type coercion. If SessionRouter internals change, this breaks
1704
+ * silently. The only signal will be cross-server conversations failing to
1705
+ * restore after daemon restart — no crash, no log.
1706
+ *
1707
+ * If upstream SessionRouter adds a public fix for this, remove this method.
1708
+ */
1709
+ fixRestoredSessions() {
1710
+ try {
1711
+ if (!existsSync2(this.globalSessionsPath))
1712
+ return;
1713
+ const raw = JSON.parse(readFileSync2(this.globalSessionsPath, "utf-8"));
1714
+ const r = this.router;
1715
+ const tm = r["toSession"];
1716
+ const tt = r["toTarget"];
1717
+ const tc = r["toCwd"];
1718
+ if (!tm || !tt)
1719
+ return;
1720
+ for (const [key, sid] of tm) {
1721
+ if (sid)
1722
+ continue;
1723
+ const entry = raw[key];
1724
+ if (!entry?.sessionId)
1725
+ continue;
1726
+ const correctId = entry.sessionId;
1727
+ const target = entry.target;
1728
+ tm.set(key, correctId);
1729
+ tt.delete(void 0);
1730
+ tt.set(correctId, target);
1731
+ if (tc) {
1732
+ tc.delete(void 0);
1733
+ tc.set(correctId, entry.cwd || "");
1734
+ }
1735
+ }
1736
+ } catch {
1737
+ }
1738
+ }
1739
+ // ── Token ──────────────────────────────────────────────────────
1740
+ async fetchToken() {
1741
+ const safeName = this.name.replace(/[^A-Za-z0-9_-]/g, "_");
1742
+ const credsFile = getCredsFilePath(safeName);
1743
+ let appID = this.qqConfig.appID;
1744
+ let appSecret = this.qqConfig.appSecret;
1745
+ if (!appID || !appSecret) {
1746
+ const saved = loadCredentials(credsFile);
1747
+ if (saved) {
1748
+ appID = saved.appId;
1749
+ appSecret = saved.appSecret;
1750
+ this.qqConfig.appID = appID;
1751
+ this.qqConfig.appSecret = appSecret;
1752
+ }
1753
+ }
1754
+ if (!appID || !appSecret) {
1755
+ process.stderr.write(`[QQ:${this.name}] No credentials, scan QR code with QQ...
1756
+ `);
1757
+ const creds = await qrCodeLogin();
1758
+ appID = creds.appId;
1759
+ appSecret = creds.appSecret;
1760
+ this.qqConfig.appID = appID;
1761
+ this.qqConfig.appSecret = appSecret;
1762
+ saveCredentials(credsFile, appID, appSecret);
1763
+ }
1764
+ const token = await fetchAccessToken(appID, appSecret);
1765
+ this.accessToken = token.accessToken;
1766
+ this.tokenExpiresAt = Date.now() + token.expiresIn * 1e3;
1767
+ this.scheduleTokenRefresh();
1768
+ }
1769
+ scheduleTokenRefresh() {
1770
+ if (this.disposed)
1771
+ return;
1772
+ this.stopTokenRefresh();
1773
+ const ttl = Math.max(0, this.tokenExpiresAt - Date.now());
1774
+ const delay = Math.max(Math.min(ttl * 0.8, ttl - 6e4), 6e4);
1775
+ if (delay > 0) {
1776
+ this.tokenRefreshTimer = setTimeout(() => {
1777
+ this.fetchToken().catch((e) => {
1778
+ if (this.disposed)
1779
+ return;
1780
+ process.stderr.write(`[QQ:${this.name}] Token refresh failed: ${e}, retrying in 60s
1781
+ `);
1782
+ this.scheduleTokenRefreshRetry();
1783
+ });
1784
+ }, delay);
1785
+ }
1786
+ }
1787
+ scheduleTokenRefreshRetry() {
1788
+ if (this.disposed)
1789
+ return;
1790
+ this.stopTokenRefresh();
1791
+ this.tokenRefreshTimer = setTimeout(() => {
1792
+ this.fetchToken().catch((e) => {
1793
+ if (this.disposed)
1794
+ return;
1795
+ process.stderr.write(`[QQ:${this.name}] Token refresh failed: ${e}, retrying in 60s
1796
+ `);
1797
+ this.scheduleTokenRefreshRetry();
1798
+ });
1799
+ }, 6e4);
1800
+ }
1801
+ stopTokenRefresh() {
1802
+ if (this.tokenRefreshTimer) {
1803
+ clearTimeout(this.tokenRefreshTimer);
1804
+ this.tokenRefreshTimer = null;
1805
+ }
1806
+ }
1807
+ // ── WebSocket Gateway ──────────────────────────────────────────
1808
+ async connectGateway() {
1809
+ if (this.disposed)
1810
+ throw new Error("Channel disposed");
1811
+ const url = await fetchGatewayUrl(this.accessToken, Boolean(this.qqConfig.sandbox));
1812
+ return new Promise((resolve, reject) => {
1813
+ this.connectReject = reject;
1814
+ this.dialGateway(url, resolve, reject);
1815
+ });
1816
+ }
1817
+ dialGateway(url, resolve, reject) {
1818
+ this.ws = new wrapper_default(url);
1819
+ const dialed = this.ws;
1820
+ this.ws.on("open", () => {
1821
+ process.stderr.write(`[QQ:${this.name}] WebSocket connected
1822
+ `);
1823
+ });
1824
+ this.ws.on("message", (data) => {
1825
+ try {
1826
+ const msg = JSON.parse(data.toString());
1827
+ this.handleGatewayMessage(msg, resolve);
1828
+ } catch (e) {
1829
+ process.stderr.write(`[QQ:${this.name}] Malformed gateway message: ${e instanceof Error ? e.message : String(e)}
1830
+ `);
1831
+ }
1832
+ });
1833
+ this.ws.on("close", (code) => {
1834
+ if (this.ws !== dialed)
1835
+ return;
1836
+ process.stderr.write(`[QQ:${this.name}] WebSocket closed (code=${code})
1837
+ `);
1838
+ this.stopHeartbeat();
1839
+ this.ws = null;
1840
+ const shouldReconnect = this.serverRequestedReconnect || code !== 1e3 && this.reconnectAttempts < this.maxReconnectAttempts;
1841
+ this.serverRequestedReconnect = false;
1842
+ if (shouldReconnect && this.connectReject) {
1843
+ this.connectReject(new Error(`WebSocket closed before READY (code=${code})`));
1844
+ this.connectReject = null;
1845
+ } else if (shouldReconnect) {
1846
+ this.reconnectAttempts++;
1847
+ const delay = Math.min(1e3 * 2 ** this.reconnectAttempts, 3e4);
1848
+ process.stderr.write(`[QQ:${this.name}] Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts}/${this.maxReconnectAttempts})
1849
+ `);
1850
+ if (!this.isReconnecting) {
1851
+ this.reconnectTimer = setTimeout(() => this.reconnectWithRetry(), delay);
1852
+ this.reconnectTimer.unref();
1853
+ }
1854
+ } else if (this.reconnectAttempts >= this.maxReconnectAttempts) {
1855
+ process.stderr.write(`[QQ:${this.name}] FATAL: reconnect exhausted after ${this.maxReconnectAttempts} attempts. Bot is offline until daemon restart.
1856
+ `);
1857
+ if (this.connectReject) {
1858
+ this.connectReject(new Error(`WebSocket closed (max reconnect attempts, code=${code})`));
1859
+ this.connectReject = null;
1860
+ }
1861
+ } else {
1862
+ if (this.connectReject) {
1863
+ this.connectReject(new Error(`WebSocket closed before READY (code=${code})`));
1864
+ this.connectReject = null;
1865
+ }
1866
+ }
1867
+ });
1868
+ this.ws.on("error", (e) => {
1869
+ process.stderr.write(`[QQ:${this.name}] WebSocket error: ${e.message}
1870
+ `);
1871
+ if (!this.ws || this.ws.readyState !== wrapper_default.OPEN) {
1872
+ reject(e);
1873
+ }
1874
+ });
1875
+ }
1876
+ handleGatewayMessage(msg, onReady) {
1877
+ const op = msg["op"];
1878
+ switch (op) {
1879
+ case OpCode.HELLO: {
1880
+ this.heartbeatInterval = Math.max(msg["d"]?.["heartbeat_interval"] || 45e3, 5e3);
1881
+ this.sendIdentify();
1882
+ break;
1883
+ }
1884
+ case OpCode.DISPATCH: {
1885
+ const t = msg["t"];
1886
+ const s = msg["s"];
1887
+ if (s !== void 0)
1888
+ this.seq = s;
1889
+ if (t === "READY") {
1890
+ this.reconnectAttempts = 0;
1891
+ this.isReconnecting = false;
1892
+ this.sessionId = msg["d"]?.["session_id"] || "";
1893
+ this.tryResume = true;
1894
+ this.connectReject = null;
1895
+ this.startHeartbeat();
1896
+ this.restoreGlobalSessions();
1897
+ this.restoreQQState();
1898
+ this.router.restoreSessions().then(() => {
1899
+ this.fixRestoredSessions();
1900
+ const all = this.router.getAll?.();
1901
+ const sessions = all?.map((e) => `${e.target?.chatId}:${e.sessionId}`).join(", ") || "none";
1902
+ process.stderr.write(`[QQ:${this.name}] Ready (sessions: ${sessions})
1903
+ `);
1904
+ onReady();
1905
+ }).catch(() => onReady());
1906
+ } else if (t === "C2C_MESSAGE_CREATE") {
1907
+ this.handleC2C(msg["d"]);
1908
+ } else if (t === "GROUP_AT_MESSAGE_CREATE") {
1909
+ this.handleGroup(msg["d"]);
1910
+ } else if (t === "RESUMED") {
1911
+ this.reconnectAttempts = 0;
1912
+ this.isReconnecting = false;
1913
+ this.connectReject = null;
1914
+ this.startHeartbeat();
1915
+ onReady();
1916
+ }
1917
+ break;
1918
+ }
1919
+ case OpCode.HEARTBEAT_ACK:
1920
+ this.lastHeartbeatAck = Date.now();
1921
+ break;
1922
+ case OpCode.RECONNECT:
1923
+ this.serverRequestedReconnect = true;
1924
+ this.ws?.close(4e3);
1925
+ break;
1926
+ case OpCode.INVALID_SESSION:
1927
+ process.stderr.write(`[QQ:${this.name}] Server sent INVALID_SESSION, falling back to IDENTIFY
1928
+ `);
1929
+ this.tryResume = false;
1930
+ this.sendIdentify();
1931
+ break;
1932
+ default:
1933
+ break;
1934
+ }
1935
+ }
1936
+ sendIdentify() {
1937
+ if (!this.ws)
1938
+ return;
1939
+ if (this.tryResume && this.sessionId) {
1940
+ process.stderr.write(`[QQ:${this.name}] Sending RESUME (session: ${this.sessionId})
1941
+ `);
1942
+ this.ws.send(JSON.stringify({
1943
+ op: OpCode.RESUME,
1944
+ d: {
1945
+ token: `QQBot ${this.accessToken}`,
1946
+ session_id: this.sessionId,
1947
+ seq: this.seq
1948
+ }
1949
+ }));
1950
+ return;
1951
+ }
1952
+ this.ws.send(JSON.stringify({
1953
+ op: OpCode.IDENTIFY,
1954
+ d: {
1955
+ token: `QQBot ${this.accessToken}`,
1956
+ intents: Intent.C2C_MESSAGE | Intent.GROUP_AT_MESSAGE,
1957
+ shard: [0, 1],
1958
+ properties: {}
1959
+ }
1960
+ }));
1961
+ }
1962
+ /**
1963
+ * Reconnect loop with retry on gateway fetch failures.
1964
+ * Refreshes token before each attempt, and retries GW HTTP failures
1965
+ * with exponential backoff. Keeps retrying until success.
1966
+ */
1967
+ async reconnectWithRetry() {
1968
+ if (this.disposed)
1969
+ return;
1970
+ if (this.isReconnecting)
1971
+ return;
1972
+ this.isReconnecting = true;
1973
+ if (this.reconnectAttempts >= this.maxReconnectAttempts) {
1974
+ process.stderr.write(`[QQ:${this.name}] RC: reconnect attempts exhausted, giving up
1975
+ `);
1976
+ this.isReconnecting = false;
1977
+ return;
1978
+ }
1979
+ const maxGwRetries = 5;
1980
+ let gatewayAttempted = false;
1981
+ for (let attempt = 0; attempt < maxGwRetries; attempt++) {
1982
+ try {
1983
+ try {
1984
+ await this.fetchToken();
1985
+ } catch {
1986
+ process.stderr.write(`[QQ:${this.name}] RC: token refresh failed, retrying...
1987
+ `);
1988
+ await this.sleep(2e3);
1989
+ continue;
1990
+ }
1991
+ gatewayAttempted = true;
1992
+ await this.connectGateway();
1993
+ return;
1994
+ } catch (e) {
1995
+ const msg = e instanceof Error ? e.message : String(e);
1996
+ const backoff = Math.min(1e3 * 2 ** (attempt + 1), 3e4);
1997
+ process.stderr.write(`[QQ:${this.name}] RC: ${msg} (retry in ${backoff}ms, attempt ${attempt + 1}/${maxGwRetries})
1998
+ `);
1999
+ if (attempt < maxGwRetries - 1)
2000
+ await this.sleep(backoff);
2001
+ }
2002
+ }
2003
+ process.stderr.write(`[QQ:${this.name}] RC: exhausted ${maxGwRetries} reconnect retries, will retry in 60s
2004
+ `);
2005
+ if (gatewayAttempted)
2006
+ this.reconnectAttempts++;
2007
+ this.tryResume = false;
2008
+ this.isReconnecting = false;
2009
+ this.reconnectTimer = setTimeout(() => this.reconnectWithRetry(), 6e4);
2010
+ this.reconnectTimer.unref();
2011
+ }
2012
+ sleep(ms) {
2013
+ return new Promise((r) => setTimeout(r, ms));
2014
+ }
2015
+ startHeartbeat() {
2016
+ this.stopHeartbeat();
2017
+ this.lastHeartbeatAck = Date.now();
2018
+ this.heartbeatTimer = setInterval(() => {
2019
+ if (this.ws?.readyState !== wrapper_default.OPEN)
2020
+ return;
2021
+ const elapsed = Date.now() - this.lastHeartbeatAck;
2022
+ if (elapsed > this.heartbeatInterval * 2) {
2023
+ process.stderr.write(`[QQ:${this.name}] Heartbeat ACK timeout (${elapsed}ms), forcing reconnect
2024
+ `);
2025
+ this.ws?.close(4001);
2026
+ return;
2027
+ }
2028
+ this.ws.send(JSON.stringify({ op: OpCode.HEARTBEAT, d: this.seq }));
2029
+ }, this.heartbeatInterval);
2030
+ }
2031
+ stopHeartbeat() {
2032
+ if (this.heartbeatTimer) {
2033
+ clearInterval(this.heartbeatTimer);
2034
+ this.heartbeatTimer = null;
2035
+ }
2036
+ }
2037
+ // ── Message Handlers ───────────────────────────────────────────
2038
+ /** Check if a message ID was already processed (reconnect replay dedup). */
2039
+ isDuplicate(eventId) {
2040
+ if (this.seenMessages.has(eventId))
2041
+ return true;
2042
+ const now = Date.now();
2043
+ this.seenMessages.set(eventId, now);
2044
+ if (!this.seenCleanupTimer) {
2045
+ this.seenCleanupTimer = setInterval(() => {
2046
+ const cutoff = Date.now() - 3e5;
2047
+ for (const [id, ts] of this.seenMessages) {
2048
+ if (ts < cutoff)
2049
+ this.seenMessages.delete(id);
2050
+ }
2051
+ if (this.seenMessages.size === 0) {
2052
+ clearInterval(this.seenCleanupTimer);
2053
+ this.seenCleanupTimer = null;
2054
+ }
2055
+ }, 6e4);
2056
+ }
2057
+ return false;
2058
+ }
2059
+ handleC2C(event) {
2060
+ if (this.isDuplicate(event.id))
2061
+ return;
2062
+ if (!event.content?.trim())
2063
+ return;
2064
+ const chatId = event.author.user_openid || event.author.id;
2065
+ this.chatTypeMap.set(chatId, "c2c");
2066
+ this.replyMsgId.set(chatId, event.id);
2067
+ this.saveQQState();
2068
+ this.handleInbound({
2069
+ channelName: this.name,
2070
+ senderId: chatId,
2071
+ senderName: event.author.username || event.author.id || "QQ User",
2072
+ chatId,
2073
+ text: event.content,
2074
+ messageId: event.id,
2075
+ isGroup: false,
2076
+ isMentioned: true,
2077
+ isReplyToBot: false
2078
+ }).catch((e) => process.stderr.write(`[QQ:${this.name}] C2C handler error: ${e}
2079
+ `));
2080
+ }
2081
+ handleGroup(event) {
2082
+ if (this.isDuplicate(event.id))
2083
+ return;
2084
+ if (!event.group_openid) {
2085
+ process.stderr.write(`[QQ:${this.name}] Group message dropped: missing group_openid
2086
+ `);
2087
+ return;
2088
+ }
2089
+ const chatId = event.group_openid;
2090
+ this.chatTypeMap.set(chatId, "group");
2091
+ this.replyMsgId.set(chatId, event.id);
2092
+ this.saveQQState();
2093
+ const senderName = event.author.username || event.author.id || "QQ User";
2094
+ const cleanText = (event.content || "").replace(/<@[^>]{1,64}>/g, "").trim();
2095
+ if (!cleanText)
2096
+ return;
2097
+ const isSlash = cleanText.startsWith("/");
2098
+ if (isSlash) {
2099
+ process.stderr.write(`[QQ:${this.name}] Slash cmd from ${senderName} (${chatId}): ${cleanText}
2100
+ `);
2101
+ }
2102
+ const text = isSlash ? cleanText : `[${senderName}]: ${cleanText}`;
2103
+ this.handleInbound({
2104
+ channelName: this.name,
2105
+ senderId: event.author.user_openid || event.author.id,
2106
+ senderName,
2107
+ chatId,
2108
+ text,
2109
+ messageId: event.id,
2110
+ isGroup: true,
2111
+ isMentioned: true,
2112
+ // QQ Bot only receives group messages when explicitly @mentioned, so
2113
+ // every group message is semantically a reply to the bot.
2114
+ isReplyToBot: true
2115
+ }).catch((e) => process.stderr.write(`[QQ:${this.name}] Group handler error: ${e}
2116
+ `));
2117
+ }
2118
+ };
2119
+
2120
+ // packages/channels/qqbot/dist/index.js
2121
+ var plugin = {
2122
+ channelType: "qq",
2123
+ displayName: "QQ",
2124
+ // Both appID and appSecret are optional at config level because
2125
+ // fetchToken() resolves them via a fallback chain:
2126
+ // config values → persisted credentials file → QR code login
2127
+ // If we required them here, parseChannelConfig() would reject the config
2128
+ // before QQChannel is ever constructed — QR-only login would be unreachable
2129
+ // through the built-in channel path.
2130
+ requiredConfigFields: [],
2131
+ createChannel: /* @__PURE__ */ __name((name, config, bridge, options) => new QQChannel(name, config, bridge, options), "createChannel")
2132
+ };
2133
+ export {
2134
+ QQChannel,
2135
+ plugin
2136
+ };