shioricode 0.5.0 → 0.5.1

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 (845) hide show
  1. package/README.md +34 -0
  2. package/dist/BunHttpServer-Bfvwsc6z.mjs +370 -0
  3. package/dist/NodeHttpServer-CSNPDIKf.mjs +4133 -0
  4. package/dist/bin.cjs +21687 -18224
  5. package/dist/bin.mjs +21601 -18138
  6. package/dist/client/assets/ArtifactPanel-1Tg5ZLm5.js +2 -0
  7. package/dist/client/assets/ChatMarkdown-BvwoXC6z.js +3 -0
  8. package/dist/client/assets/DiffPanel-D-xp36wD.js +64 -0
  9. package/dist/client/assets/DiffPanelShell-DdBr4p9c.js +2 -0
  10. package/dist/client/assets/DiffWorkerPoolProvider--93ReMXi.js +2 -0
  11. package/dist/client/assets/DockedSidebarResizeHandle-C2HyIoOR.js +2 -0
  12. package/dist/client/assets/NoActiveThreadState-B_C5Y_aO.js +2 -0
  13. package/dist/client/assets/ProviderModelPicker-BWTkQW8f.js +2 -0
  14. package/dist/client/assets/SettingsPanels-DGYlfoWv.js +4 -0
  15. package/dist/client/assets/_chat-BhqvWJHj.js +2 -0
  16. package/dist/client/assets/_chat._threadId-Blwb3CRP.js +289 -0
  17. package/dist/client/assets/_chat.index-oZTnMcB3.js +2 -0
  18. package/dist/client/assets/assistantPersonalityOptions-35I7ygr6.js +2 -0
  19. package/dist/client/assets/automations-ChGelqHO.js +2 -0
  20. package/dist/client/assets/badge-BkzSFcY-.js +2 -0
  21. package/dist/client/assets/clientSettings--1UP2ayD.js +2 -0
  22. package/dist/client/assets/collapsible-CqRg_DyH.js +2 -0
  23. package/dist/client/assets/dialog-C7Ppq2qI.js +2 -0
  24. package/dist/client/assets/dist-C5QFNSAb.js +1 -0
  25. package/dist/client/assets/dotm-3x3-1-DNt3xDWl.js +2 -0
  26. package/dist/client/assets/dotm-3x3-10-BEPO2XGt.js +2 -0
  27. package/dist/client/assets/dotm-3x3-11-C0tdJ290.js +2 -0
  28. package/dist/client/assets/dotm-3x3-12-jdh3FFNy.js +2 -0
  29. package/dist/client/assets/dotm-3x3-13-B4fjfa7T.js +2 -0
  30. package/dist/client/assets/dotm-3x3-14-Cg2LIaCb.js +2 -0
  31. package/dist/client/assets/dotm-3x3-15-YweecAOr.js +2 -0
  32. package/dist/client/assets/dotm-3x3-16--VH62Fxh.js +2 -0
  33. package/dist/client/assets/dotm-3x3-18-D7yaQ_9P.js +2 -0
  34. package/dist/client/assets/dotm-3x3-19-TZFiTkAa.js +2 -0
  35. package/dist/client/assets/dotm-3x3-2-CQTu6XaT.js +2 -0
  36. package/dist/client/assets/dotm-3x3-20-CtUZV5ao.js +2 -0
  37. package/dist/client/assets/dotm-3x3-21-BbVSO3wy.js +2 -0
  38. package/dist/client/assets/dotm-3x3-3-ChFPfySu.js +2 -0
  39. package/dist/client/assets/dotm-3x3-4-BeZLHcTf.js +2 -0
  40. package/dist/client/assets/dotm-3x3-5-C00uzVRR.js +2 -0
  41. package/dist/client/assets/dotm-3x3-6-VpzpA2u6.js +2 -0
  42. package/dist/client/assets/dotm-3x3-7-B6Y8f5ze.js +2 -0
  43. package/dist/client/assets/dotm-3x3-8-pu30VS8f.js +2 -0
  44. package/dist/client/assets/dotm-3x3-9-DmEYSrRj.js +2 -0
  45. package/dist/client/assets/dotm-circular-1-C2SE8kJ7.js +2 -0
  46. package/dist/client/assets/dotm-circular-10-BsnMrWY4.js +2 -0
  47. package/dist/client/assets/dotm-circular-11-_CxMWmqu.js +2 -0
  48. package/dist/client/assets/dotm-circular-12-BcGZtddU.js +2 -0
  49. package/dist/client/assets/dotm-circular-13-BHiAa7HM.js +2 -0
  50. package/dist/client/assets/dotm-circular-14-CrzVNoad.js +2 -0
  51. package/dist/client/assets/dotm-circular-15-f6X-pfsm.js +2 -0
  52. package/dist/client/assets/dotm-circular-16-CLtKoM73.js +2 -0
  53. package/dist/client/assets/dotm-circular-17-D7vHiJsH.js +2 -0
  54. package/dist/client/assets/dotm-circular-18-CYEFDs4o.js +2 -0
  55. package/dist/client/assets/dotm-circular-19-DkNDRAJ1.js +2 -0
  56. package/dist/client/assets/dotm-circular-2-ClO8F6Fo.js +2 -0
  57. package/dist/client/assets/dotm-circular-20-De-aaHRx.js +2 -0
  58. package/dist/client/assets/dotm-circular-3-CuNVZVTq.js +2 -0
  59. package/dist/client/assets/dotm-circular-4-0oUKiWae.js +2 -0
  60. package/dist/client/assets/dotm-circular-5-BhQb9loH.js +2 -0
  61. package/dist/client/assets/dotm-circular-6-D9pqQg7b.js +2 -0
  62. package/dist/client/assets/dotm-circular-7-DMKST3bM.js +2 -0
  63. package/dist/client/assets/dotm-circular-8-DUzIx6F6.js +2 -0
  64. package/dist/client/assets/dotm-circular-9-Rpy71Png.js +2 -0
  65. package/dist/client/assets/dotm-hex-1-DST25vDE.js +2 -0
  66. package/dist/client/assets/dotm-hex-10-B5_MRSUa.js +2 -0
  67. package/dist/client/assets/dotm-hex-2-DEt8Ehj3.js +2 -0
  68. package/dist/client/assets/dotm-hex-3-DI4OeJzc.js +2 -0
  69. package/dist/client/assets/dotm-hex-4-B8bTBg8v.js +2 -0
  70. package/dist/client/assets/dotm-hex-5-BHMk4AiZ.js +2 -0
  71. package/dist/client/assets/dotm-hex-5-aosBXIlg.js +1 -0
  72. package/dist/client/assets/dotm-hex-6-DLJqVcZZ.js +2 -0
  73. package/dist/client/assets/dotm-hex-7-Cc5Agkc9.js +2 -0
  74. package/dist/client/assets/dotm-hex-8-C3B8LVfK.js +2 -0
  75. package/dist/client/assets/dotm-hex-9-Aaz__Vdu.js +2 -0
  76. package/dist/client/assets/dotm-square-1-BMp3XqYM.js +2 -0
  77. package/dist/client/assets/dotm-square-10-Bg1CbdiH.js +2 -0
  78. package/dist/client/assets/dotm-square-11-CCeLfhIK.js +2 -0
  79. package/dist/client/assets/dotm-square-12-CvjGJjY5.js +2 -0
  80. package/dist/client/assets/dotm-square-13-BmX9qeu4.js +2 -0
  81. package/dist/client/assets/dotm-square-14-D9poakSs.js +2 -0
  82. package/dist/client/assets/dotm-square-15-0UH3gGNN.js +2 -0
  83. package/dist/client/assets/dotm-square-16-COHmgy2B.js +2 -0
  84. package/dist/client/assets/dotm-square-17-DS-W77Qc.js +2 -0
  85. package/dist/client/assets/dotm-square-18-Ccsu8b1k.js +2 -0
  86. package/dist/client/assets/dotm-square-19-5ebT2r-P.js +2 -0
  87. package/dist/client/assets/dotm-square-2-DSK3cRn0.js +2 -0
  88. package/dist/client/assets/dotm-square-20-DxzWv9kf.js +2 -0
  89. package/dist/client/assets/dotm-square-3-DCPucSJQ.js +2 -0
  90. package/dist/client/assets/dotm-square-4-DnG5LB-X.js +2 -0
  91. package/dist/client/assets/dotm-square-5-BnTOAzyJ.js +2 -0
  92. package/dist/client/assets/dotm-square-6-BxyO-d55.js +2 -0
  93. package/dist/client/assets/dotm-square-7-DrWd3L89.js +2 -0
  94. package/dist/client/assets/dotm-square-8-K5O9wfjk.js +2 -0
  95. package/dist/client/assets/dotm-square-9-DWJ5Fs8s.js +2 -0
  96. package/dist/client/assets/dotm-triangle-1-Coa2lfMO.js +2 -0
  97. package/dist/client/assets/dotm-triangle-10-CUNmY4JS.js +2 -0
  98. package/dist/client/assets/dotm-triangle-11-DQTbFuzy.js +2 -0
  99. package/dist/client/assets/dotm-triangle-12-BJpD2MFM.js +2 -0
  100. package/dist/client/assets/dotm-triangle-13-CqTvPNii.js +2 -0
  101. package/dist/client/assets/dotm-triangle-14-BDWQhjlG.js +2 -0
  102. package/dist/client/assets/dotm-triangle-15-CpW9VBme.js +2 -0
  103. package/dist/client/assets/dotm-triangle-16-BQMSRn_2.js +2 -0
  104. package/dist/client/assets/dotm-triangle-17-BEEIpZjH.js +2 -0
  105. package/dist/client/assets/dotm-triangle-18-CubguOUs.js +2 -0
  106. package/dist/client/assets/dotm-triangle-19-Dm7kh547.js +2 -0
  107. package/dist/client/assets/dotm-triangle-2-DMj8JSuG.js +2 -0
  108. package/dist/client/assets/dotm-triangle-20-CWNNUSCs.js +2 -0
  109. package/dist/client/assets/dotm-triangle-3-D2v5fOgr.js +2 -0
  110. package/dist/client/assets/dotm-triangle-4-L03yKxeH.js +2 -0
  111. package/dist/client/assets/dotm-triangle-5-CDDVgRZE.js +2 -0
  112. package/dist/client/assets/dotm-triangle-6-B5JpN3QH.js +2 -0
  113. package/dist/client/assets/dotm-triangle-7-DP-4GFg5.js +2 -0
  114. package/dist/client/assets/dotm-triangle-8-CuIdXTEw.js +2 -0
  115. package/dist/client/assets/dotm-triangle-9-CZVroDYN.js +2 -0
  116. package/dist/client/assets/dotmatrix-core-71nPaRVi.css +1 -0
  117. package/dist/client/assets/dotmatrix-core-CnY83Cc6.js +2 -0
  118. package/dist/client/assets/empty-CwEqZDMX.js +2 -0
  119. package/dist/client/assets/gitReactQuery-BBOGuHot.js +2 -0
  120. package/dist/client/assets/index-BgrJjdw5.css +2 -0
  121. package/dist/client/assets/index-DvBh1mNh.js +6 -0
  122. package/dist/client/assets/input-emuaAuIe.js +2 -0
  123. package/dist/client/assets/pull-requests-xKFO2G81.js +46 -0
  124. package/dist/client/assets/queuedTurnsStore-I4LoXHLF.js +2 -0
  125. package/dist/client/assets/scroll-area-kK2XF1gm.js +2 -0
  126. package/dist/client/assets/separator-CSqq2xHm.js +2 -0
  127. package/dist/client/assets/settings-C9R1j3GG.js +2 -0
  128. package/dist/client/assets/settings.appearance-Cac_fbGk.js +2 -0
  129. package/dist/client/assets/settings.archived-KRU4XARw.js +2 -0
  130. package/dist/client/assets/settings.computer-use-BL801Zu5.js +2 -0
  131. package/dist/client/assets/settings.credits-Brx-cGXe.js +30 -0
  132. package/dist/client/assets/settings.general-BXcV60tY.js +2 -0
  133. package/dist/client/assets/settings.mcp-DEMm4v5q.js +2 -0
  134. package/dist/client/assets/settings.mobile-DF1raoba.js +2 -0
  135. package/dist/client/assets/settings.plugins-CewrpoKP.js +2 -0
  136. package/dist/client/assets/settings.remote-BufK_lG_.js +2 -0
  137. package/dist/client/assets/settings.skills-Cz9xy1ba.js +2 -0
  138. package/dist/client/assets/settings.theme-builder-BU_DRAvo.js +2 -0
  139. package/dist/client/assets/skillsMcpShared-DxxY1mEt.js +2 -0
  140. package/dist/client/assets/store-BQMb1nBV.js +12 -0
  141. package/dist/client/assets/terminalStateStore-C38k-Eaw.js +2 -0
  142. package/dist/client/assets/textarea-DXuuOfmM.js +2 -0
  143. package/dist/client/assets/toggle-group-CvAnsecf.js +2 -0
  144. package/dist/client/assets/toggle-nUm5N7vp.js +2 -0
  145. package/dist/client/assets/uiStateStore-Di3ieZaJ.js +2 -0
  146. package/dist/client/assets/useHandleNewThread-WYMZPumx.js +2 -0
  147. package/dist/client/assets/useSettings-DOuHg9jg.js +2 -0
  148. package/dist/client/assets/useTheme-Dhz9U3on.js +2 -0
  149. package/dist/client/assets/utils-B-Di8CjF.js +2 -0
  150. package/dist/client/assets/vendor--lexical-clipboard-WreJbm08.js +12 -0
  151. package/dist/client/assets/vendor--lexical-dragon-BWkDBdfg.js +3 -0
  152. package/dist/client/assets/vendor--lexical-history-BmCIf2Hc.js +2 -0
  153. package/dist/client/assets/vendor--lexical-plain-text-Dk9Pmo4j.js +2 -0
  154. package/dist/client/assets/vendor--lexical-react-B6TeCrpE.js +2 -0
  155. package/dist/client/assets/vendor--pierre-theme-Px6arbTM.js +2 -0
  156. package/dist/client/assets/vendor--shikijs-core-BvuCEFk2.js +13 -0
  157. package/dist/client/assets/vendor--shikijs-engine-javascript-9nIWxzwA.js +142 -0
  158. package/dist/client/assets/vendor--shikijs-engine-oniguruma-CHLjiLaC.js +2 -0
  159. package/dist/client/assets/vendor--shikijs-langs-abap-DcmCbGmK.js +2 -0
  160. package/dist/client/assets/vendor--shikijs-langs-actionscript-3-ZvaN1Eje.js +2 -0
  161. package/dist/client/assets/vendor--shikijs-langs-ada-BxnlQB9p.js +2 -0
  162. package/dist/client/assets/vendor--shikijs-langs-angular-expression-Dprae7Dp.js +2 -0
  163. package/dist/client/assets/vendor--shikijs-langs-angular-html-C6F9WLxK.js +2 -0
  164. package/dist/client/assets/vendor--shikijs-langs-angular-inline-style-CqklzDIJ.js +2 -0
  165. package/dist/client/assets/vendor--shikijs-langs-angular-inline-template-B7jAOWOF.js +2 -0
  166. package/dist/client/assets/vendor--shikijs-langs-angular-ts-C4rQFmjQ.js +2 -0
  167. package/dist/client/assets/vendor--shikijs-langs-apache-DjX2KG_v.js +2 -0
  168. package/dist/client/assets/vendor--shikijs-langs-apex-B0SOJKMe.js +2 -0
  169. package/dist/client/assets/vendor--shikijs-langs-apl-DxLKB1Oy.js +2 -0
  170. package/dist/client/assets/vendor--shikijs-langs-applescript-CdyH1W6p.js +2 -0
  171. package/dist/client/assets/vendor--shikijs-langs-ara-N7qeniUJ.js +2 -0
  172. package/dist/client/assets/vendor--shikijs-langs-asciidoc-DxhxCzfV.js +2 -0
  173. package/dist/client/assets/vendor--shikijs-langs-asm--PKz-Xrb.js +2 -0
  174. package/dist/client/assets/vendor--shikijs-langs-astro-BqICgctf.js +2 -0
  175. package/dist/client/assets/vendor--shikijs-langs-awk-BoyJTXS1.js +2 -0
  176. package/dist/client/assets/vendor--shikijs-langs-ballerina-B1t_jgix.js +2 -0
  177. package/dist/client/assets/vendor--shikijs-langs-bat-DnAb-WeH.js +2 -0
  178. package/dist/client/assets/vendor--shikijs-langs-beancount-1pEG2fPv.js +2 -0
  179. package/dist/client/assets/vendor--shikijs-langs-berry-87paaHOF.js +2 -0
  180. package/dist/client/assets/vendor--shikijs-langs-bibtex-gY4ycEJI.js +2 -0
  181. package/dist/client/assets/vendor--shikijs-langs-bicep-CXMK_JMH.js +2 -0
  182. package/dist/client/assets/vendor--shikijs-langs-bird2-DvRa8xSN.js +2 -0
  183. package/dist/client/assets/vendor--shikijs-langs-blade-CdhrtWLa.js +2 -0
  184. package/dist/client/assets/vendor--shikijs-langs-bsl-BEQAR6p1.js +2 -0
  185. package/dist/client/assets/vendor--shikijs-langs-c-B84hOGb3.js +2 -0
  186. package/dist/client/assets/vendor--shikijs-langs-c3-DdY0UkIF.js +2 -0
  187. package/dist/client/assets/vendor--shikijs-langs-cadence-engRbeCX.js +2 -0
  188. package/dist/client/assets/vendor--shikijs-langs-cairo-1R2FdBtr.js +2 -0
  189. package/dist/client/assets/vendor--shikijs-langs-clarity-BbPJ1xZ9.js +2 -0
  190. package/dist/client/assets/vendor--shikijs-langs-clojure-DHXrm59n.js +2 -0
  191. package/dist/client/assets/vendor--shikijs-langs-cmake-DIASScPf.js +2 -0
  192. package/dist/client/assets/vendor--shikijs-langs-cobol-ClcwQx6v.js +2 -0
  193. package/dist/client/assets/vendor--shikijs-langs-codeowners-BeG0Tpsy.js +2 -0
  194. package/dist/client/assets/vendor--shikijs-langs-codeql-BWwJtpCu.js +2 -0
  195. package/dist/client/assets/vendor--shikijs-langs-coffee-NS15w6Hp.js +2 -0
  196. package/dist/client/assets/vendor--shikijs-langs-common-lisp-DI9GHZ4B.js +2 -0
  197. package/dist/client/assets/vendor--shikijs-langs-coq-CkCNwQHm.js +2 -0
  198. package/dist/client/assets/vendor--shikijs-langs-cpp-Dsk_2ajx.js +2 -0
  199. package/dist/client/assets/vendor--shikijs-langs-crystal-DSY_Cqb7.js +2 -0
  200. package/dist/client/assets/vendor--shikijs-langs-csharp-DPjYAai_.js +2 -0
  201. package/dist/client/assets/vendor--shikijs-langs-csv-Dcu9OHM-.js +2 -0
  202. package/dist/client/assets/vendor--shikijs-langs-cue-DdAsIUq_.js +2 -0
  203. package/dist/client/assets/vendor--shikijs-langs-cypher-CvNgnifp.js +2 -0
  204. package/dist/client/assets/vendor--shikijs-langs-d-DD9QeIRO.js +2 -0
  205. package/dist/client/assets/vendor--shikijs-langs-dart-g77er-Fm.js +2 -0
  206. package/dist/client/assets/vendor--shikijs-langs-dax-BK56aEeP.js +2 -0
  207. package/dist/client/assets/vendor--shikijs-langs-desktop-Cw_ggTPp.js +2 -0
  208. package/dist/client/assets/vendor--shikijs-langs-diff-CwUc-cbM.js +2 -0
  209. package/dist/client/assets/vendor--shikijs-langs-docker-CXFl1ZKG.js +2 -0
  210. package/dist/client/assets/vendor--shikijs-langs-dotenv-BF3dNPuI.js +2 -0
  211. package/dist/client/assets/vendor--shikijs-langs-dream-maker-B_8j7CZ4.js +2 -0
  212. package/dist/client/assets/vendor--shikijs-langs-edge-D3mgVWhq.js +2 -0
  213. package/dist/client/assets/vendor--shikijs-langs-elixir-CzfhRRPs.js +2 -0
  214. package/dist/client/assets/vendor--shikijs-langs-elm-BnGKxU73.js +2 -0
  215. package/dist/client/assets/vendor--shikijs-langs-emacs-lisp-C8lQ5Cys.js +2 -0
  216. package/dist/client/assets/vendor--shikijs-langs-erb-30nzblxd.js +2 -0
  217. package/dist/client/assets/vendor--shikijs-langs-erlang-DmQD-VTE.js +2 -0
  218. package/dist/client/assets/vendor--shikijs-langs-es-tag-css-Clxvdb5O.js +2 -0
  219. package/dist/client/assets/vendor--shikijs-langs-es-tag-glsl-D518Klt8.js +2 -0
  220. package/dist/client/assets/vendor--shikijs-langs-es-tag-html-Bv2aw2HG.js +2 -0
  221. package/dist/client/assets/vendor--shikijs-langs-es-tag-sql-TsG4Kqo4.js +2 -0
  222. package/dist/client/assets/vendor--shikijs-langs-es-tag-xml-BKjnSMVs.js +2 -0
  223. package/dist/client/assets/vendor--shikijs-langs-fennel-Duq5z7sy.js +2 -0
  224. package/dist/client/assets/vendor--shikijs-langs-fish-B-zVLEYF.js +2 -0
  225. package/dist/client/assets/vendor--shikijs-langs-fluent-B5jf2huh.js +2 -0
  226. package/dist/client/assets/vendor--shikijs-langs-fortran-fixed-form-BniplwZY.js +2 -0
  227. package/dist/client/assets/vendor--shikijs-langs-fsharp-B9pQ72f8.js +2 -0
  228. package/dist/client/assets/vendor--shikijs-langs-gdresource-BL4VCefv.js +2 -0
  229. package/dist/client/assets/vendor--shikijs-langs-genie-hb-fhi7_.js +2 -0
  230. package/dist/client/assets/vendor--shikijs-langs-gherkin-q5d2sJfS.js +2 -0
  231. package/dist/client/assets/vendor--shikijs-langs-git-commit-DxbxMXzG.js +2 -0
  232. package/dist/client/assets/vendor--shikijs-langs-git-rebase-CZv991wX.js +2 -0
  233. package/dist/client/assets/vendor--shikijs-langs-gleam-DT_WN53n.js +2 -0
  234. package/dist/client/assets/vendor--shikijs-langs-glimmer-js-Co0Vra8I.js +2 -0
  235. package/dist/client/assets/vendor--shikijs-langs-glimmer-ts-C1gNpwN4.js +2 -0
  236. package/dist/client/assets/vendor--shikijs-langs-gn-BpGe7M-N.js +2 -0
  237. package/dist/client/assets/vendor--shikijs-langs-gnuplot-B51_TE9r.js +2 -0
  238. package/dist/client/assets/vendor--shikijs-langs-go-DpVCD9Rm.js +2 -0
  239. package/dist/client/assets/vendor--shikijs-langs-groovy-CEsci4X4.js +2 -0
  240. package/dist/client/assets/vendor--shikijs-langs-hack-4gKQiLIN.js +2 -0
  241. package/dist/client/assets/vendor--shikijs-langs-handlebars-BK9RBeK5.js +2 -0
  242. package/dist/client/assets/vendor--shikijs-langs-haskell-B7R0Sc46.js +2 -0
  243. package/dist/client/assets/vendor--shikijs-langs-haxe-Cw7nxwNZ.js +2 -0
  244. package/dist/client/assets/vendor--shikijs-langs-hcl-9TjRcJDH.js +2 -0
  245. package/dist/client/assets/vendor--shikijs-langs-hjson-DLy9Vr8T.js +2 -0
  246. package/dist/client/assets/vendor--shikijs-langs-hlsl-BNX0W3Ib.js +2 -0
  247. package/dist/client/assets/vendor--shikijs-langs-http-DLEq8L0H.js +2 -0
  248. package/dist/client/assets/vendor--shikijs-langs-hurl-BQP57wtq.js +2 -0
  249. package/dist/client/assets/vendor--shikijs-langs-hxml-CRBUtkcU.js +2 -0
  250. package/dist/client/assets/vendor--shikijs-langs-hy-DIOTTcV0.js +2 -0
  251. package/dist/client/assets/vendor--shikijs-langs-imba-CNfQ52HL.js +2 -0
  252. package/dist/client/assets/vendor--shikijs-langs-ini-BSfza1Xx.js +2 -0
  253. package/dist/client/assets/vendor--shikijs-langs-jinja-Uo-X_YtF.js +2 -0
  254. package/dist/client/assets/vendor--shikijs-langs-jison-CJ9CPTG4.js +2 -0
  255. package/dist/client/assets/vendor--shikijs-langs-json5-Bc08xGQv.js +2 -0
  256. package/dist/client/assets/vendor--shikijs-langs-jsonc-BcyOaQJF.js +2 -0
  257. package/dist/client/assets/vendor--shikijs-langs-jsonl-B2usOWtF.js +2 -0
  258. package/dist/client/assets/vendor--shikijs-langs-jsonnet-CaUzUtyK.js +2 -0
  259. package/dist/client/assets/vendor--shikijs-langs-jssm-DN9FM-mQ.js +2 -0
  260. package/dist/client/assets/vendor--shikijs-langs-julia-B6pYszi2.js +2 -0
  261. package/dist/client/assets/vendor--shikijs-langs-just-2JwvQzCJ.js +2 -0
  262. package/dist/client/assets/vendor--shikijs-langs-kdl-BNCf1fUs.js +2 -0
  263. package/dist/client/assets/vendor--shikijs-langs-kotlin-Cit00xyO.js +2 -0
  264. package/dist/client/assets/vendor--shikijs-langs-kusto-DuhrCHoo.js +2 -0
  265. package/dist/client/assets/vendor--shikijs-langs-latex-DcJyxYUc.js +2 -0
  266. package/dist/client/assets/vendor--shikijs-langs-lean--NrjGoXR.js +2 -0
  267. package/dist/client/assets/vendor--shikijs-langs-less-Brj1eAno.js +2 -0
  268. package/dist/client/assets/vendor--shikijs-langs-liquid-BolSDsn0.js +2 -0
  269. package/dist/client/assets/vendor--shikijs-langs-llvm-TsGF-VFU.js +2 -0
  270. package/dist/client/assets/vendor--shikijs-langs-log-CHQ3qbpC.js +2 -0
  271. package/dist/client/assets/vendor--shikijs-langs-logo-BI2ph7cn.js +2 -0
  272. package/dist/client/assets/vendor--shikijs-langs-luau-B3F47Y-D.js +2 -0
  273. package/dist/client/assets/vendor--shikijs-langs-make-BW4SZZOv.js +2 -0
  274. package/dist/client/assets/vendor--shikijs-langs-markdown-nix-1e37lYOS.js +2 -0
  275. package/dist/client/assets/vendor--shikijs-langs-markdown-vue-zRfmoy2v.js +2 -0
  276. package/dist/client/assets/vendor--shikijs-langs-marko-DgdnBlTD.js +2 -0
  277. package/dist/client/assets/vendor--shikijs-langs-matlab-RIhykqW8.js +2 -0
  278. package/dist/client/assets/vendor--shikijs-langs-mdc-CT9kpZzP.js +2 -0
  279. package/dist/client/assets/vendor--shikijs-langs-mdx-B-9u_aNs.js +2 -0
  280. package/dist/client/assets/vendor--shikijs-langs-mermaid-D1WFFBbN.js +2 -0
  281. package/dist/client/assets/vendor--shikijs-langs-mipsasm-BFzuWDRo.js +2 -0
  282. package/dist/client/assets/vendor--shikijs-langs-mojo-BiMshWPo.js +2 -0
  283. package/dist/client/assets/vendor--shikijs-langs-moonbit-GCYiMXbo.js +2 -0
  284. package/dist/client/assets/vendor--shikijs-langs-move-hL67V-g-.js +2 -0
  285. package/dist/client/assets/vendor--shikijs-langs-narrat-DKIzQf9n.js +2 -0
  286. package/dist/client/assets/vendor--shikijs-langs-nextflow-yQisqiWM.js +2 -0
  287. package/dist/client/assets/vendor--shikijs-langs-nginx-C-MschKO.js +2 -0
  288. package/dist/client/assets/vendor--shikijs-langs-nim-BK5y7eK8.js +2 -0
  289. package/dist/client/assets/vendor--shikijs-langs-nix-DpTLstXt.js +2 -0
  290. package/dist/client/assets/vendor--shikijs-langs-nushell-BhAGI5Hf.js +2 -0
  291. package/dist/client/assets/vendor--shikijs-langs-objective-c-CR25pWPI.js +2 -0
  292. package/dist/client/assets/vendor--shikijs-langs-objective-cpp-BSWp9ibZ.js +2 -0
  293. package/dist/client/assets/vendor--shikijs-langs-ocaml-C4O6Rc2J.js +2 -0
  294. package/dist/client/assets/vendor--shikijs-langs-odin-76dqxdA8.js +2 -0
  295. package/dist/client/assets/vendor--shikijs-langs-openscad-BU0mCPRi.js +2 -0
  296. package/dist/client/assets/vendor--shikijs-langs-pascal-B-d7BmeZ.js +2 -0
  297. package/dist/client/assets/vendor--shikijs-langs-php-BhoNqx4_.js +2 -0
  298. package/dist/client/assets/vendor--shikijs-langs-pkl-oOoND5HD.js +2 -0
  299. package/dist/client/assets/vendor--shikijs-langs-plsql-AxOCqqS5.js +2 -0
  300. package/dist/client/assets/vendor--shikijs-langs-po-BwnTwIg-.js +2 -0
  301. package/dist/client/assets/vendor--shikijs-langs-polar-DLALCWIL.js +2 -0
  302. package/dist/client/assets/vendor--shikijs-langs-powerquery-Dx2OIuJ-.js +2 -0
  303. package/dist/client/assets/vendor--shikijs-langs-powershell-D8lFG1SQ.js +2 -0
  304. package/dist/client/assets/vendor--shikijs-langs-prisma-DGRuUehv.js +2 -0
  305. package/dist/client/assets/vendor--shikijs-langs-prolog-BM8w4oH9.js +2 -0
  306. package/dist/client/assets/vendor--shikijs-langs-proto-CU4wTAg2.js +2 -0
  307. package/dist/client/assets/vendor--shikijs-langs-pug-BobDkxQt.js +2 -0
  308. package/dist/client/assets/vendor--shikijs-langs-puppet-BtytIIdU.js +2 -0
  309. package/dist/client/assets/vendor--shikijs-langs-purescript-CMQO87R1.js +2 -0
  310. package/dist/client/assets/vendor--shikijs-langs-qml-flzbuy_B.js +2 -0
  311. package/dist/client/assets/vendor--shikijs-langs-qmldir--hWbLfBm.js +2 -0
  312. package/dist/client/assets/vendor--shikijs-langs-qss-gVK-i6VT.js +2 -0
  313. package/dist/client/assets/vendor--shikijs-langs-racket-CYsJlK0D.js +2 -0
  314. package/dist/client/assets/vendor--shikijs-langs-raku-CIvCNwUx.js +2 -0
  315. package/dist/client/assets/vendor--shikijs-langs-razor-CPyN7Eol.js +2 -0
  316. package/dist/client/assets/vendor--shikijs-langs-reg-B8kYDtZf.js +2 -0
  317. package/dist/client/assets/vendor--shikijs-langs-rel-CiHTZwO5.js +2 -0
  318. package/dist/client/assets/vendor--shikijs-langs-riscv-DHozEfLK.js +2 -0
  319. package/dist/client/assets/vendor--shikijs-langs-ron-t5DMYF2X.js +2 -0
  320. package/dist/client/assets/vendor--shikijs-langs-rosmsg-C1g3u2M7.js +2 -0
  321. package/dist/client/assets/vendor--shikijs-langs-rst-BRqxdg93.js +2 -0
  322. package/dist/client/assets/vendor--shikijs-langs-rust-ByaVAE1I.js +2 -0
  323. package/dist/client/assets/vendor--shikijs-langs-sas-BZiNrVCS.js +2 -0
  324. package/dist/client/assets/vendor--shikijs-langs-sass-C4a6Xqej.js +2 -0
  325. package/dist/client/assets/vendor--shikijs-langs-scala-CZimREdo.js +2 -0
  326. package/dist/client/assets/vendor--shikijs-langs-scheme-DwKnDgZ7.js +2 -0
  327. package/dist/client/assets/vendor--shikijs-langs-shaderlab-BNfPkJiH.js +2 -0
  328. package/dist/client/assets/vendor--shikijs-langs-shellsession-U-GfB0fl.js +2 -0
  329. package/dist/client/assets/vendor--shikijs-langs-smalltalk-DxyGOhae.js +2 -0
  330. package/dist/client/assets/vendor--shikijs-langs-solidity-fRv_Eweb.js +2 -0
  331. package/dist/client/assets/vendor--shikijs-langs-soy-DHqfKVC3.js +2 -0
  332. package/dist/client/assets/vendor--shikijs-langs-sparql-jsFBb2QI.js +2 -0
  333. package/dist/client/assets/vendor--shikijs-langs-splunk--Cp0P2vO.js +2 -0
  334. package/dist/client/assets/vendor--shikijs-langs-ssh-config-B863wQOJ.js +2 -0
  335. package/dist/client/assets/vendor--shikijs-langs-stata-BExUf06x.js +2 -0
  336. package/dist/client/assets/vendor--shikijs-langs-stylus-CYmGkv2A.js +2 -0
  337. package/dist/client/assets/vendor--shikijs-langs-surrealql-CdfW_9zD.js +2 -0
  338. package/dist/client/assets/vendor--shikijs-langs-svelte-B8mwaR7i.js +2 -0
  339. package/dist/client/assets/vendor--shikijs-langs-swift-BSC65jxu.js +2 -0
  340. package/dist/client/assets/vendor--shikijs-langs-system-verilog-64uFtNK_.js +2 -0
  341. package/dist/client/assets/vendor--shikijs-langs-systemd-DgjacZbI.js +2 -0
  342. package/dist/client/assets/vendor--shikijs-langs-talonscript-By6u-shi.js +2 -0
  343. package/dist/client/assets/vendor--shikijs-langs-tasl-C_wKwViL.js +2 -0
  344. package/dist/client/assets/vendor--shikijs-langs-tcl-Cam-eKgc.js +2 -0
  345. package/dist/client/assets/vendor--shikijs-langs-templ-CpE9Egbs.js +2 -0
  346. package/dist/client/assets/vendor--shikijs-langs-terraform-DBAwK290.js +2 -0
  347. package/dist/client/assets/vendor--shikijs-langs-toml-mWKqsjoL.js +2 -0
  348. package/dist/client/assets/vendor--shikijs-langs-ts-tags-kvFyldjK.js +2 -0
  349. package/dist/client/assets/vendor--shikijs-langs-tsv-gXntOUK3.js +2 -0
  350. package/dist/client/assets/vendor--shikijs-langs-twig-BLvpHZjM.js +2 -0
  351. package/dist/client/assets/vendor--shikijs-langs-typespec-BZxEfIGT.js +2 -0
  352. package/dist/client/assets/vendor--shikijs-langs-typst-BnWmVy2d.js +2 -0
  353. package/dist/client/assets/vendor--shikijs-langs-v-Bw8Y_5kN.js +2 -0
  354. package/dist/client/assets/vendor--shikijs-langs-vala-DHCCZHej.js +2 -0
  355. package/dist/client/assets/vendor--shikijs-langs-vb-B_-vRNpM.js +2 -0
  356. package/dist/client/assets/vendor--shikijs-langs-verilog-BnaVi7hU.js +2 -0
  357. package/dist/client/assets/vendor--shikijs-langs-vhdl-DlPso0IQ.js +2 -0
  358. package/dist/client/assets/vendor--shikijs-langs-viml-B6kEclaH.js +2 -0
  359. package/dist/client/assets/vendor--shikijs-langs-vue-Dtz6EGmH.js +2 -0
  360. package/dist/client/assets/vendor--shikijs-langs-vue-html-CmkloXDU.js +2 -0
  361. package/dist/client/assets/vendor--shikijs-langs-vue-vine-Blr8oEhH.js +2 -0
  362. package/dist/client/assets/vendor--shikijs-langs-vyper-DemEdTg5.js +2 -0
  363. package/dist/client/assets/vendor--shikijs-langs-wasm-DnHAa75f.js +2 -0
  364. package/dist/client/assets/vendor--shikijs-langs-wenyan-8vzCY0x3.js +2 -0
  365. package/dist/client/assets/vendor--shikijs-langs-wgsl-BZaATzM9.js +2 -0
  366. package/dist/client/assets/vendor--shikijs-langs-wikitext-CCcw801U.js +2 -0
  367. package/dist/client/assets/vendor--shikijs-langs-wit-BcpT3wK7.js +2 -0
  368. package/dist/client/assets/vendor--shikijs-langs-wolfram-B3xGRZA7.js +2 -0
  369. package/dist/client/assets/vendor--shikijs-langs-xsl-T2oJ1VbC.js +2 -0
  370. package/dist/client/assets/vendor--shikijs-langs-zenscript-DkZTGffr.js +2 -0
  371. package/dist/client/assets/vendor--shikijs-langs-zig-Br6uK_ah.js +2 -0
  372. package/dist/client/assets/vendor--shikijs-themes-andromeeda-B-c6mSfY.js +2 -0
  373. package/dist/client/assets/vendor--shikijs-themes-aurora-x-YJPUjQ8z.js +2 -0
  374. package/dist/client/assets/vendor--shikijs-themes-ayu-dark-B5HBM2pY.js +2 -0
  375. package/dist/client/assets/vendor--shikijs-themes-ayu-light-Vhe-tFC6.js +2 -0
  376. package/dist/client/assets/vendor--shikijs-themes-ayu-mirage-Cw56ZP9G.js +2 -0
  377. package/dist/client/assets/vendor--shikijs-themes-catppuccin-frappe-BkwJ1o_i.js +2 -0
  378. package/dist/client/assets/vendor--shikijs-themes-catppuccin-latte-BvTeiqdy.js +2 -0
  379. package/dist/client/assets/vendor--shikijs-themes-catppuccin-macchiato-CsGVBdWW.js +2 -0
  380. package/dist/client/assets/vendor--shikijs-themes-catppuccin-mocha-BBgq3Ffg.js +2 -0
  381. package/dist/client/assets/vendor--shikijs-themes-dark-plus-Cuyj7uR8.js +2 -0
  382. package/dist/client/assets/vendor--shikijs-themes-dracula-41hkrd50.js +2 -0
  383. package/dist/client/assets/vendor--shikijs-themes-dracula-soft-BfVG0jpE.js +2 -0
  384. package/dist/client/assets/vendor--shikijs-themes-everforest-dark-BWuvbIAP.js +2 -0
  385. package/dist/client/assets/vendor--shikijs-themes-everforest-light-DUZxDXGC.js +2 -0
  386. package/dist/client/assets/vendor--shikijs-themes-github-dark-DAJ3HLga.js +2 -0
  387. package/dist/client/assets/vendor--shikijs-themes-github-dark-default-B3-xw3fX.js +2 -0
  388. package/dist/client/assets/vendor--shikijs-themes-github-dark-dimmed-BG9m8GbM.js +2 -0
  389. package/dist/client/assets/vendor--shikijs-themes-github-dark-high-contrast-Bo9r6hZr.js +2 -0
  390. package/dist/client/assets/vendor--shikijs-themes-github-light-BnN1FFfM.js +2 -0
  391. package/dist/client/assets/vendor--shikijs-themes-github-light-default-CzW_9lG4.js +2 -0
  392. package/dist/client/assets/vendor--shikijs-themes-github-light-high-contrast-iTl7yrZj.js +2 -0
  393. package/dist/client/assets/vendor--shikijs-themes-gruvbox-dark-hard-qeLwdEjA.js +2 -0
  394. package/dist/client/assets/vendor--shikijs-themes-gruvbox-dark-medium-B74n19aL.js +2 -0
  395. package/dist/client/assets/vendor--shikijs-themes-gruvbox-dark-soft-B8NFTx3O.js +2 -0
  396. package/dist/client/assets/vendor--shikijs-themes-gruvbox-light-hard-CnfgSb0d.js +2 -0
  397. package/dist/client/assets/vendor--shikijs-themes-gruvbox-light-medium-BOm4-i1Q.js +2 -0
  398. package/dist/client/assets/vendor--shikijs-themes-gruvbox-light-soft-oOGe5GCc.js +2 -0
  399. package/dist/client/assets/vendor--shikijs-themes-horizon-ChFb-N-I.js +2 -0
  400. package/dist/client/assets/vendor--shikijs-themes-horizon-bright-2DrxdAAC.js +2 -0
  401. package/dist/client/assets/vendor--shikijs-themes-houston-BoXkOxJ4.js +2 -0
  402. package/dist/client/assets/vendor--shikijs-themes-kanagawa-dragon-DO9NO4Bu.js +2 -0
  403. package/dist/client/assets/vendor--shikijs-themes-kanagawa-lotus-C-KkmG1-.js +2 -0
  404. package/dist/client/assets/vendor--shikijs-themes-kanagawa-wave-Dd7wWLhx.js +2 -0
  405. package/dist/client/assets/vendor--shikijs-themes-laserwave-C6j3dmsE.js +2 -0
  406. package/dist/client/assets/vendor--shikijs-themes-light-plus-p_dpmCBw.js +2 -0
  407. package/dist/client/assets/vendor--shikijs-themes-material-theme-DxDhU6PB.js +2 -0
  408. package/dist/client/assets/vendor--shikijs-themes-material-theme-darker-DghDOrX_.js +2 -0
  409. package/dist/client/assets/vendor--shikijs-themes-material-theme-lighter-B8lK9I4D.js +2 -0
  410. package/dist/client/assets/vendor--shikijs-themes-material-theme-ocean-B6Yj_C_U.js +2 -0
  411. package/dist/client/assets/vendor--shikijs-themes-material-theme-palenight-CWVefu5Y.js +2 -0
  412. package/dist/client/assets/vendor--shikijs-themes-min-dark-A3Fh8l1q.js +2 -0
  413. package/dist/client/assets/vendor--shikijs-themes-min-light-CElND9HJ.js +2 -0
  414. package/dist/client/assets/vendor--shikijs-themes-monokai-CFJYL84Y.js +2 -0
  415. package/dist/client/assets/vendor--shikijs-themes-night-owl-D5Jim-kU.js +2 -0
  416. package/dist/client/assets/vendor--shikijs-themes-night-owl-light-BtL8Tsoy.js +2 -0
  417. package/dist/client/assets/vendor--shikijs-themes-nord-BuWJGjqO.js +2 -0
  418. package/dist/client/assets/vendor--shikijs-themes-one-dark-pro-Qsb1XdMv.js +2 -0
  419. package/dist/client/assets/vendor--shikijs-themes-one-light-Cn7QfkXU.js +2 -0
  420. package/dist/client/assets/vendor--shikijs-themes-plastic-CLaYk0hw.js +2 -0
  421. package/dist/client/assets/vendor--shikijs-themes-poimandres-DaOe_6tx.js +2 -0
  422. package/dist/client/assets/vendor--shikijs-themes-red-CRFW6xJ8.js +2 -0
  423. package/dist/client/assets/vendor--shikijs-themes-rose-pine-dawn-BLdq3-mG.js +2 -0
  424. package/dist/client/assets/vendor--shikijs-themes-rose-pine-ePuQCUnX.js +2 -0
  425. package/dist/client/assets/vendor--shikijs-themes-rose-pine-moon-B89t1tQH.js +2 -0
  426. package/dist/client/assets/vendor--shikijs-themes-slack-dark-bux3HTif.js +2 -0
  427. package/dist/client/assets/vendor--shikijs-themes-slack-ochin-uyL-MKTn.js +2 -0
  428. package/dist/client/assets/vendor--shikijs-themes-snazzy-light-C8tCBvDQ.js +2 -0
  429. package/dist/client/assets/vendor--shikijs-themes-solarized-dark-DQSHUedi.js +2 -0
  430. package/dist/client/assets/vendor--shikijs-themes-solarized-light-CPmhbNnx.js +2 -0
  431. package/dist/client/assets/vendor--shikijs-themes-synthwave-84-Bqs5NQzq.js +2 -0
  432. package/dist/client/assets/vendor--shikijs-themes-tokyo-night-5XH44-rr.js +2 -0
  433. package/dist/client/assets/vendor--shikijs-themes-vesper-DCLCHfED.js +2 -0
  434. package/dist/client/assets/vendor--shikijs-themes-vitesse-black-CgMYzcNB.js +2 -0
  435. package/dist/client/assets/vendor--shikijs-themes-vitesse-dark-BVvaedJ3.js +2 -0
  436. package/dist/client/assets/vendor--shikijs-themes-vitesse-light-DuGEe3es.js +2 -0
  437. package/dist/client/assets/vendor--shikijs-transformers-llbiZRed.js +2 -0
  438. package/dist/client/assets/vendor--ungap-structured-clone-gq95-Rac.js +2 -0
  439. package/dist/client/assets/vendor--xterm-addon-fit-DakFApj0.js +2 -0
  440. package/dist/client/assets/vendor-bail-DhrDEj3K.js +2 -0
  441. package/dist/client/assets/vendor-decode-named-character-reference-BSa-H5E1.js +2 -0
  442. package/dist/client/assets/vendor-devlop-CczaZgST.js +2 -0
  443. package/dist/client/assets/vendor-diff-BC6ceXD2.js +14 -0
  444. package/dist/client/assets/vendor-diffs-TCBcYN7E.js +1777 -0
  445. package/dist/client/assets/vendor-entities-DUknvTjV.js +2 -0
  446. package/dist/client/assets/vendor-escape-string-regexp-p5L46G1N.js +2 -0
  447. package/dist/client/assets/vendor-estree-util-is-identifier-name-DorDRIRc.js +2 -0
  448. package/dist/client/assets/vendor-extend-BW3CRMi7.js +2 -0
  449. package/dist/client/assets/vendor-hast-util-from-dom-au1lVC4c.js +2 -0
  450. package/dist/client/assets/vendor-hast-util-from-html-isomorphic-K8KOY4Zz.js +2 -0
  451. package/dist/client/assets/vendor-hast-util-from-parse5-DmgJK_2_.js +3 -0
  452. package/dist/client/assets/vendor-hast-util-is-element-D35XnMcP.js +2 -0
  453. package/dist/client/assets/vendor-hast-util-raw-DrJxi__t.js +2 -0
  454. package/dist/client/assets/vendor-hast-util-to-jsx-runtime-Cj_7lYX5.js +3 -0
  455. package/dist/client/assets/vendor-hast-util-to-text-dhtewVzz.js +4 -0
  456. package/dist/client/assets/vendor-html-url-attributes-D4rN65P3.js +2 -0
  457. package/dist/client/assets/vendor-is-plain-obj-BHbCDlbd.js +2 -0
  458. package/dist/client/assets/vendor-katex-C_40Fys8.js +258 -0
  459. package/dist/client/assets/vendor-longest-streak-CMXHzExg.js +2 -0
  460. package/dist/client/assets/vendor-markdown-DHoMS86o.js +33 -0
  461. package/dist/client/assets/vendor-motion-dom-B1NO2AyA.js +2 -0
  462. package/dist/client/assets/vendor-qrcode-generator-BI2MWdJH.js +4 -0
  463. package/dist/client/assets/vendor-react-icons-DMjx4moa.js +2 -0
  464. package/dist/client/assets/vendor-rehype-katex-Cslyo582.js +2 -0
  465. package/dist/client/assets/vendor-rehype-raw-CztSeCAV.js +2 -0
  466. package/dist/client/assets/vendor-remark-math-MaPo0twq.js +2 -0
  467. package/dist/client/assets/vendor-shiki-CSULnrRc.js +2 -0
  468. package/dist/client/assets/vendor-tanstack-CM5SpFmF.js +5 -0
  469. package/dist/client/assets/vendor-ui-DmvKhMzf.js +25 -0
  470. package/dist/client/index.html +30 -28
  471. package/package.json +2 -2
  472. package/dist/BunHttpServer-B_KPsEV1.mjs +0 -370
  473. package/dist/NodeHttpServer-DdGTnpiS.mjs +0 -4133
  474. package/dist/client/assets/ArtifactPanel-BSCph4Mf.js +0 -2
  475. package/dist/client/assets/ChatMarkdown-D-ZCYVVA.js +0 -3
  476. package/dist/client/assets/DiffPanel-CzDdUb8m.js +0 -64
  477. package/dist/client/assets/DiffPanelShell-Jyeb1irB.js +0 -2
  478. package/dist/client/assets/DiffWorkerPoolProvider-Df_KelZ4.js +0 -2
  479. package/dist/client/assets/DockedSidebarResizeHandle-DkVhNVa1.js +0 -2
  480. package/dist/client/assets/NoActiveThreadState-CafEeJ3D.js +0 -2
  481. package/dist/client/assets/ProviderModelPicker-DBL7REnB.js +0 -2
  482. package/dist/client/assets/SettingsPanels-DToV4poM.js +0 -4
  483. package/dist/client/assets/_chat-DIsZX_5q.js +0 -2
  484. package/dist/client/assets/_chat._threadId-DciDVFNC.js +0 -289
  485. package/dist/client/assets/_chat.index-Bu5_KLvf.js +0 -2
  486. package/dist/client/assets/assistantPersonalityOptions-BnBdEssM.js +0 -2
  487. package/dist/client/assets/automations-B8oI1RDH.js +0 -2
  488. package/dist/client/assets/badge-DQNpCiTY.js +0 -2
  489. package/dist/client/assets/clientSettings-BoLlsjmq.js +0 -2
  490. package/dist/client/assets/collapsible-BFxx3cmC.js +0 -2
  491. package/dist/client/assets/dialog-xuDGeb4n.js +0 -2
  492. package/dist/client/assets/dist-DNQcGyCm.js +0 -1
  493. package/dist/client/assets/empty-C0odYOnP.js +0 -2
  494. package/dist/client/assets/gitReactQuery-CQYez3In.js +0 -2
  495. package/dist/client/assets/index-Cr2B1Z-_.css +0 -2
  496. package/dist/client/assets/index-ndFBrjHh.js +0 -6
  497. package/dist/client/assets/input-C7biIuoM.js +0 -2
  498. package/dist/client/assets/pull-requests-YReb4Mu9.js +0 -46
  499. package/dist/client/assets/queuedTurnsStore-BWvSKxB2.js +0 -2
  500. package/dist/client/assets/scroll-area-b0VYEw63.js +0 -2
  501. package/dist/client/assets/separator-BSFlxFW1.js +0 -2
  502. package/dist/client/assets/settings-BBptnNYJ.js +0 -2
  503. package/dist/client/assets/settings.appearance-BkWweygw.js +0 -2
  504. package/dist/client/assets/settings.archived-DJC1il-F.js +0 -2
  505. package/dist/client/assets/settings.computer-use-BK97T3f-.js +0 -2
  506. package/dist/client/assets/settings.credits-C2nerPpd.js +0 -30
  507. package/dist/client/assets/settings.general-Djd4g0t8.js +0 -2
  508. package/dist/client/assets/settings.mcp-b1gcVG3u.js +0 -2
  509. package/dist/client/assets/settings.mobile-Cl_q074X.js +0 -2
  510. package/dist/client/assets/settings.plugins-Bz_Jt-h5.js +0 -2
  511. package/dist/client/assets/settings.remote-COKGS805.js +0 -2
  512. package/dist/client/assets/settings.skills-DbcoPmK9.js +0 -2
  513. package/dist/client/assets/settings.theme-builder-D3sYNxrp.js +0 -2
  514. package/dist/client/assets/skillsMcpShared-DzSsN5fy.js +0 -2
  515. package/dist/client/assets/store-BzqS7zm8.js +0 -12
  516. package/dist/client/assets/terminalStateStore-BhU1c2Sw.js +0 -2
  517. package/dist/client/assets/textarea-Bc_w4o11.js +0 -2
  518. package/dist/client/assets/toggle-Cjd1rTpW.js +0 -2
  519. package/dist/client/assets/toggle-group-CbQjlXXY.js +0 -2
  520. package/dist/client/assets/uiStateStore-CGeY60Rr.js +0 -2
  521. package/dist/client/assets/useHandleNewThread-CxLIGmcC.js +0 -2
  522. package/dist/client/assets/useSettings-CfiGcPkS.js +0 -2
  523. package/dist/client/assets/useTheme-CVq6D9IF.js +0 -2
  524. package/dist/client/assets/utils-BnXGGW32.js +0 -2
  525. package/dist/client/assets/vendor--lexical-clipboard-DCk1K_zj.js +0 -12
  526. package/dist/client/assets/vendor--lexical-dragon-M1lgHzh4.js +0 -3
  527. package/dist/client/assets/vendor--lexical-history-CPhYRzwL.js +0 -2
  528. package/dist/client/assets/vendor--lexical-plain-text-DQrkEZNZ.js +0 -2
  529. package/dist/client/assets/vendor--lexical-react-Dg6NVZQt.js +0 -2
  530. package/dist/client/assets/vendor--pierre-theme-BqjYxgTW.js +0 -2
  531. package/dist/client/assets/vendor--shikijs-core-BAnPeRVm.js +0 -13
  532. package/dist/client/assets/vendor--shikijs-engine-javascript-DmYKhP_-.js +0 -142
  533. package/dist/client/assets/vendor--shikijs-engine-oniguruma-BDZnigcB.js +0 -2
  534. package/dist/client/assets/vendor--shikijs-langs-abap-M23ryfn9.js +0 -2
  535. package/dist/client/assets/vendor--shikijs-langs-actionscript-3-BD5kvI6v.js +0 -2
  536. package/dist/client/assets/vendor--shikijs-langs-ada-qu3EGCeA.js +0 -2
  537. package/dist/client/assets/vendor--shikijs-langs-angular-expression-Bb0NlclD.js +0 -2
  538. package/dist/client/assets/vendor--shikijs-langs-angular-html-BVz5jIRE.js +0 -2
  539. package/dist/client/assets/vendor--shikijs-langs-angular-inline-style-CXXjnGFM.js +0 -2
  540. package/dist/client/assets/vendor--shikijs-langs-angular-inline-template-PI88mjwZ.js +0 -2
  541. package/dist/client/assets/vendor--shikijs-langs-angular-ts-BOh6qyRZ.js +0 -2
  542. package/dist/client/assets/vendor--shikijs-langs-apache-BAfhHC-h.js +0 -2
  543. package/dist/client/assets/vendor--shikijs-langs-apex-C4LBVt3N.js +0 -2
  544. package/dist/client/assets/vendor--shikijs-langs-apl-BBkFvwAF.js +0 -2
  545. package/dist/client/assets/vendor--shikijs-langs-applescript-DgpjVdNA.js +0 -2
  546. package/dist/client/assets/vendor--shikijs-langs-ara-Cv65SFCF.js +0 -2
  547. package/dist/client/assets/vendor--shikijs-langs-asciidoc-Dvf_KF_t.js +0 -2
  548. package/dist/client/assets/vendor--shikijs-langs-asm-C-dKflhp.js +0 -2
  549. package/dist/client/assets/vendor--shikijs-langs-astro-Bn_nWK70.js +0 -2
  550. package/dist/client/assets/vendor--shikijs-langs-awk-CViFEtMx.js +0 -2
  551. package/dist/client/assets/vendor--shikijs-langs-ballerina-BMeV1Fw-.js +0 -2
  552. package/dist/client/assets/vendor--shikijs-langs-bat-DFg3dfFC.js +0 -2
  553. package/dist/client/assets/vendor--shikijs-langs-beancount-DSCGKbCl.js +0 -2
  554. package/dist/client/assets/vendor--shikijs-langs-berry-BCZG-tTT.js +0 -2
  555. package/dist/client/assets/vendor--shikijs-langs-bibtex-YiSZ96C1.js +0 -2
  556. package/dist/client/assets/vendor--shikijs-langs-bicep-BVYis31i.js +0 -2
  557. package/dist/client/assets/vendor--shikijs-langs-bird2-DfBptrdS.js +0 -2
  558. package/dist/client/assets/vendor--shikijs-langs-blade-3gbFo0pY.js +0 -2
  559. package/dist/client/assets/vendor--shikijs-langs-bsl-BPBVye1_.js +0 -2
  560. package/dist/client/assets/vendor--shikijs-langs-c-B3kctpau.js +0 -2
  561. package/dist/client/assets/vendor--shikijs-langs-c3-CauC6i11.js +0 -2
  562. package/dist/client/assets/vendor--shikijs-langs-cadence-B0XPUJ81.js +0 -2
  563. package/dist/client/assets/vendor--shikijs-langs-cairo-lEm-3fXi.js +0 -2
  564. package/dist/client/assets/vendor--shikijs-langs-clarity-Drfe_5R5.js +0 -2
  565. package/dist/client/assets/vendor--shikijs-langs-clojure-D0ATT0p6.js +0 -2
  566. package/dist/client/assets/vendor--shikijs-langs-cmake-ChmqiQAL.js +0 -2
  567. package/dist/client/assets/vendor--shikijs-langs-cobol-Bldlgrni.js +0 -2
  568. package/dist/client/assets/vendor--shikijs-langs-codeowners-CAlq8EM3.js +0 -2
  569. package/dist/client/assets/vendor--shikijs-langs-codeql-TN6fTWXc.js +0 -2
  570. package/dist/client/assets/vendor--shikijs-langs-coffee-Baw2cmIc.js +0 -2
  571. package/dist/client/assets/vendor--shikijs-langs-common-lisp-CCQA_bKA.js +0 -2
  572. package/dist/client/assets/vendor--shikijs-langs-coq-EHVulUZc.js +0 -2
  573. package/dist/client/assets/vendor--shikijs-langs-cpp-R4Fc4fG4.js +0 -2
  574. package/dist/client/assets/vendor--shikijs-langs-crystal-D3Bl3uNi.js +0 -2
  575. package/dist/client/assets/vendor--shikijs-langs-csharp-BbA_ksBP.js +0 -2
  576. package/dist/client/assets/vendor--shikijs-langs-csv-CEgnh3_m.js +0 -2
  577. package/dist/client/assets/vendor--shikijs-langs-cue-OUj7ciok.js +0 -2
  578. package/dist/client/assets/vendor--shikijs-langs-cypher-2QonYoVe.js +0 -2
  579. package/dist/client/assets/vendor--shikijs-langs-d-DTqYmm1f.js +0 -2
  580. package/dist/client/assets/vendor--shikijs-langs-dart-ZsDlLgOr.js +0 -2
  581. package/dist/client/assets/vendor--shikijs-langs-dax-FBhyY7Ce.js +0 -2
  582. package/dist/client/assets/vendor--shikijs-langs-desktop-CfKkeSq5.js +0 -2
  583. package/dist/client/assets/vendor--shikijs-langs-diff-D7JELD0_.js +0 -2
  584. package/dist/client/assets/vendor--shikijs-langs-docker-Bm53hIPh.js +0 -2
  585. package/dist/client/assets/vendor--shikijs-langs-dotenv-pW_eoP5x.js +0 -2
  586. package/dist/client/assets/vendor--shikijs-langs-dream-maker-RyNI5DJS.js +0 -2
  587. package/dist/client/assets/vendor--shikijs-langs-edge-BHOOVwds.js +0 -2
  588. package/dist/client/assets/vendor--shikijs-langs-elixir-CtGbQgM4.js +0 -2
  589. package/dist/client/assets/vendor--shikijs-langs-elm-DbMOFydP.js +0 -2
  590. package/dist/client/assets/vendor--shikijs-langs-emacs-lisp-CFHoVk9V.js +0 -2
  591. package/dist/client/assets/vendor--shikijs-langs-erb-3Q2SxhLM.js +0 -2
  592. package/dist/client/assets/vendor--shikijs-langs-erlang-CjgFXHIB.js +0 -2
  593. package/dist/client/assets/vendor--shikijs-langs-es-tag-css-BgIhdHvt.js +0 -2
  594. package/dist/client/assets/vendor--shikijs-langs-es-tag-glsl-DSCx8ySb.js +0 -2
  595. package/dist/client/assets/vendor--shikijs-langs-es-tag-html-DdF18EVz.js +0 -2
  596. package/dist/client/assets/vendor--shikijs-langs-es-tag-sql-B3ArDlnC.js +0 -2
  597. package/dist/client/assets/vendor--shikijs-langs-es-tag-xml-CJ28ww2b.js +0 -2
  598. package/dist/client/assets/vendor--shikijs-langs-fennel-9hmtT2ll.js +0 -2
  599. package/dist/client/assets/vendor--shikijs-langs-fish-DxXZiQJM.js +0 -2
  600. package/dist/client/assets/vendor--shikijs-langs-fluent-DY3si0WH.js +0 -2
  601. package/dist/client/assets/vendor--shikijs-langs-fortran-fixed-form-ES8pePfx.js +0 -2
  602. package/dist/client/assets/vendor--shikijs-langs-fsharp-UjhxyjSp.js +0 -2
  603. package/dist/client/assets/vendor--shikijs-langs-gdresource-D3ywXdtE.js +0 -2
  604. package/dist/client/assets/vendor--shikijs-langs-genie-SGQyPX98.js +0 -2
  605. package/dist/client/assets/vendor--shikijs-langs-gherkin-CZee9jD6.js +0 -2
  606. package/dist/client/assets/vendor--shikijs-langs-git-commit-D2Yl0yDL.js +0 -2
  607. package/dist/client/assets/vendor--shikijs-langs-git-rebase-DvdvBUG7.js +0 -2
  608. package/dist/client/assets/vendor--shikijs-langs-gleam-DHaiFvSa.js +0 -2
  609. package/dist/client/assets/vendor--shikijs-langs-glimmer-js-CNgh52fG.js +0 -2
  610. package/dist/client/assets/vendor--shikijs-langs-glimmer-ts-B7WERoCC.js +0 -2
  611. package/dist/client/assets/vendor--shikijs-langs-gn-vBoxHsTs.js +0 -2
  612. package/dist/client/assets/vendor--shikijs-langs-gnuplot-BBDGBlwU.js +0 -2
  613. package/dist/client/assets/vendor--shikijs-langs-go-D4qJ1Ial.js +0 -2
  614. package/dist/client/assets/vendor--shikijs-langs-groovy-B0HIA74w.js +0 -2
  615. package/dist/client/assets/vendor--shikijs-langs-hack-DNin4P05.js +0 -2
  616. package/dist/client/assets/vendor--shikijs-langs-handlebars-CwjKFd5F.js +0 -2
  617. package/dist/client/assets/vendor--shikijs-langs-haskell-CA0FrtN5.js +0 -2
  618. package/dist/client/assets/vendor--shikijs-langs-haxe-CwOM3tuS.js +0 -2
  619. package/dist/client/assets/vendor--shikijs-langs-hcl-B5yTsKjI.js +0 -2
  620. package/dist/client/assets/vendor--shikijs-langs-hjson-C1eNMzAY.js +0 -2
  621. package/dist/client/assets/vendor--shikijs-langs-hlsl-DCKyy7p_.js +0 -2
  622. package/dist/client/assets/vendor--shikijs-langs-http-DKaJERg1.js +0 -2
  623. package/dist/client/assets/vendor--shikijs-langs-hurl-DLzh2jLx.js +0 -2
  624. package/dist/client/assets/vendor--shikijs-langs-hxml-C57NdJsz.js +0 -2
  625. package/dist/client/assets/vendor--shikijs-langs-hy-CnKdf-kZ.js +0 -2
  626. package/dist/client/assets/vendor--shikijs-langs-imba-bZIHewME.js +0 -2
  627. package/dist/client/assets/vendor--shikijs-langs-ini-CXndjnC2.js +0 -2
  628. package/dist/client/assets/vendor--shikijs-langs-jinja-BpdgZ3bZ.js +0 -2
  629. package/dist/client/assets/vendor--shikijs-langs-jison-DjPWX2oY.js +0 -2
  630. package/dist/client/assets/vendor--shikijs-langs-json5-BeBM_l39.js +0 -2
  631. package/dist/client/assets/vendor--shikijs-langs-jsonc-DlImpako.js +0 -2
  632. package/dist/client/assets/vendor--shikijs-langs-jsonl-TgC-pjtk.js +0 -2
  633. package/dist/client/assets/vendor--shikijs-langs-jsonnet-CeADe9O8.js +0 -2
  634. package/dist/client/assets/vendor--shikijs-langs-jssm-AqRfwZ5V.js +0 -2
  635. package/dist/client/assets/vendor--shikijs-langs-julia-CrRQEyQB.js +0 -2
  636. package/dist/client/assets/vendor--shikijs-langs-just-DfatXtxY.js +0 -2
  637. package/dist/client/assets/vendor--shikijs-langs-kdl-D4X_DrdX.js +0 -2
  638. package/dist/client/assets/vendor--shikijs-langs-kotlin-YwHESrIc.js +0 -2
  639. package/dist/client/assets/vendor--shikijs-langs-kusto-BBIMTH5f.js +0 -2
  640. package/dist/client/assets/vendor--shikijs-langs-latex-DmES95lZ.js +0 -2
  641. package/dist/client/assets/vendor--shikijs-langs-lean-BEujkO91.js +0 -2
  642. package/dist/client/assets/vendor--shikijs-langs-less-B1zMmXgJ.js +0 -2
  643. package/dist/client/assets/vendor--shikijs-langs-liquid-DyrPgnB-.js +0 -2
  644. package/dist/client/assets/vendor--shikijs-langs-llvm-DJORPudy.js +0 -2
  645. package/dist/client/assets/vendor--shikijs-langs-log-BviG1WpR.js +0 -2
  646. package/dist/client/assets/vendor--shikijs-langs-logo-DR3vtyBT.js +0 -2
  647. package/dist/client/assets/vendor--shikijs-langs-luau-CzDq6A3l.js +0 -2
  648. package/dist/client/assets/vendor--shikijs-langs-make-Dzzm7x7s.js +0 -2
  649. package/dist/client/assets/vendor--shikijs-langs-markdown-nix-DAzfFICR.js +0 -2
  650. package/dist/client/assets/vendor--shikijs-langs-markdown-vue-DUuZn2lF.js +0 -2
  651. package/dist/client/assets/vendor--shikijs-langs-marko-BPbTvBwT.js +0 -2
  652. package/dist/client/assets/vendor--shikijs-langs-matlab-CpHEr3YY.js +0 -2
  653. package/dist/client/assets/vendor--shikijs-langs-mdc-Bo7QSvVQ.js +0 -2
  654. package/dist/client/assets/vendor--shikijs-langs-mdx-DkEqNKn8.js +0 -2
  655. package/dist/client/assets/vendor--shikijs-langs-mermaid-DuKkNTZp.js +0 -2
  656. package/dist/client/assets/vendor--shikijs-langs-mipsasm-EyGuVDFn.js +0 -2
  657. package/dist/client/assets/vendor--shikijs-langs-mojo-D0Ygvv43.js +0 -2
  658. package/dist/client/assets/vendor--shikijs-langs-moonbit-Dwo62KeG.js +0 -2
  659. package/dist/client/assets/vendor--shikijs-langs-move-eyT6_cPt.js +0 -2
  660. package/dist/client/assets/vendor--shikijs-langs-narrat-BfCL2Ft2.js +0 -2
  661. package/dist/client/assets/vendor--shikijs-langs-nextflow-BOI1RN3M.js +0 -2
  662. package/dist/client/assets/vendor--shikijs-langs-nginx-hWU8SWXM.js +0 -2
  663. package/dist/client/assets/vendor--shikijs-langs-nim-B65diT4I.js +0 -2
  664. package/dist/client/assets/vendor--shikijs-langs-nix-C4lyWPql.js +0 -2
  665. package/dist/client/assets/vendor--shikijs-langs-nushell-BYVWTqXd.js +0 -2
  666. package/dist/client/assets/vendor--shikijs-langs-objective-c-CpMTS_Js.js +0 -2
  667. package/dist/client/assets/vendor--shikijs-langs-objective-cpp-S-T4sy0p.js +0 -2
  668. package/dist/client/assets/vendor--shikijs-langs-ocaml-Cl4IrLz7.js +0 -2
  669. package/dist/client/assets/vendor--shikijs-langs-odin-KOB8Q8Bm.js +0 -2
  670. package/dist/client/assets/vendor--shikijs-langs-openscad-6THVqo2-.js +0 -2
  671. package/dist/client/assets/vendor--shikijs-langs-pascal-D66KHu7t.js +0 -2
  672. package/dist/client/assets/vendor--shikijs-langs-php-CAOA9sQN.js +0 -2
  673. package/dist/client/assets/vendor--shikijs-langs-pkl-DIwBBFru.js +0 -2
  674. package/dist/client/assets/vendor--shikijs-langs-plsql-B7IrBQsf.js +0 -2
  675. package/dist/client/assets/vendor--shikijs-langs-po-DvVZ7MBw.js +0 -2
  676. package/dist/client/assets/vendor--shikijs-langs-polar-BnAd8wmi.js +0 -2
  677. package/dist/client/assets/vendor--shikijs-langs-powerquery-DGQhLIHU.js +0 -2
  678. package/dist/client/assets/vendor--shikijs-langs-powershell-QosasV6_.js +0 -2
  679. package/dist/client/assets/vendor--shikijs-langs-prisma-DV29a_aw.js +0 -2
  680. package/dist/client/assets/vendor--shikijs-langs-prolog-BKnN9LYA.js +0 -2
  681. package/dist/client/assets/vendor--shikijs-langs-proto-ZBEpRTcl.js +0 -2
  682. package/dist/client/assets/vendor--shikijs-langs-pug-BilcrfxA.js +0 -2
  683. package/dist/client/assets/vendor--shikijs-langs-puppet-B6quVxC3.js +0 -2
  684. package/dist/client/assets/vendor--shikijs-langs-purescript-DcPQMOAb.js +0 -2
  685. package/dist/client/assets/vendor--shikijs-langs-qml-Cb64CV_x.js +0 -2
  686. package/dist/client/assets/vendor--shikijs-langs-qmldir-D5VB_y3D.js +0 -2
  687. package/dist/client/assets/vendor--shikijs-langs-qss-6hcG9MFc.js +0 -2
  688. package/dist/client/assets/vendor--shikijs-langs-racket-CLJfYkrI.js +0 -2
  689. package/dist/client/assets/vendor--shikijs-langs-raku-caAPUlYX.js +0 -2
  690. package/dist/client/assets/vendor--shikijs-langs-razor-MSYjwJ4S.js +0 -2
  691. package/dist/client/assets/vendor--shikijs-langs-reg-B0lcwnkt.js +0 -2
  692. package/dist/client/assets/vendor--shikijs-langs-rel-Rkp2NdPG.js +0 -2
  693. package/dist/client/assets/vendor--shikijs-langs-riscv-BWcllNO8.js +0 -2
  694. package/dist/client/assets/vendor--shikijs-langs-ron-B4Qgm4dc.js +0 -2
  695. package/dist/client/assets/vendor--shikijs-langs-rosmsg-D_8pSj_m.js +0 -2
  696. package/dist/client/assets/vendor--shikijs-langs-rst-BcK5xkVC.js +0 -2
  697. package/dist/client/assets/vendor--shikijs-langs-rust-BWbyTSk0.js +0 -2
  698. package/dist/client/assets/vendor--shikijs-langs-sas-DouC4v3l.js +0 -2
  699. package/dist/client/assets/vendor--shikijs-langs-sass-CXs-zyRy.js +0 -2
  700. package/dist/client/assets/vendor--shikijs-langs-scala-8XUZ7UFo.js +0 -2
  701. package/dist/client/assets/vendor--shikijs-langs-scheme-BQ_dJ_qx.js +0 -2
  702. package/dist/client/assets/vendor--shikijs-langs-shaderlab-ApVOP38O.js +0 -2
  703. package/dist/client/assets/vendor--shikijs-langs-shellsession-BErVmRSk.js +0 -2
  704. package/dist/client/assets/vendor--shikijs-langs-smalltalk-CUfozAOL.js +0 -2
  705. package/dist/client/assets/vendor--shikijs-langs-solidity-BeCW_eh2.js +0 -2
  706. package/dist/client/assets/vendor--shikijs-langs-soy-BHVaT22t.js +0 -2
  707. package/dist/client/assets/vendor--shikijs-langs-sparql-DeQ4D9kB.js +0 -2
  708. package/dist/client/assets/vendor--shikijs-langs-splunk-B6oR3fdW.js +0 -2
  709. package/dist/client/assets/vendor--shikijs-langs-ssh-config-CvLm3efS.js +0 -2
  710. package/dist/client/assets/vendor--shikijs-langs-stata-iXWNDDoP.js +0 -2
  711. package/dist/client/assets/vendor--shikijs-langs-stylus-01aTRig6.js +0 -2
  712. package/dist/client/assets/vendor--shikijs-langs-surrealql-QCVqJ0b3.js +0 -2
  713. package/dist/client/assets/vendor--shikijs-langs-svelte-ByGgQUG3.js +0 -2
  714. package/dist/client/assets/vendor--shikijs-langs-swift-D2qviZjn.js +0 -2
  715. package/dist/client/assets/vendor--shikijs-langs-system-verilog-BQhPNpV1.js +0 -2
  716. package/dist/client/assets/vendor--shikijs-langs-systemd-B2zxbhys.js +0 -2
  717. package/dist/client/assets/vendor--shikijs-langs-talonscript-BFQKTLbf.js +0 -2
  718. package/dist/client/assets/vendor--shikijs-langs-tasl-CjL1p0_1.js +0 -2
  719. package/dist/client/assets/vendor--shikijs-langs-tcl-XWXINywr.js +0 -2
  720. package/dist/client/assets/vendor--shikijs-langs-templ-l5SBpIN3.js +0 -2
  721. package/dist/client/assets/vendor--shikijs-langs-terraform-DN1KWXQI.js +0 -2
  722. package/dist/client/assets/vendor--shikijs-langs-toml-CCNYIT6f.js +0 -2
  723. package/dist/client/assets/vendor--shikijs-langs-ts-tags-BIdvBx1T.js +0 -2
  724. package/dist/client/assets/vendor--shikijs-langs-tsv-D2RzOSAs.js +0 -2
  725. package/dist/client/assets/vendor--shikijs-langs-twig-CAzOlZrI.js +0 -2
  726. package/dist/client/assets/vendor--shikijs-langs-typespec-BuhkHXIa.js +0 -2
  727. package/dist/client/assets/vendor--shikijs-langs-typst-EuHWMe1I.js +0 -2
  728. package/dist/client/assets/vendor--shikijs-langs-v-QImb2O5R.js +0 -2
  729. package/dist/client/assets/vendor--shikijs-langs-vala-ZbOWvTdB.js +0 -2
  730. package/dist/client/assets/vendor--shikijs-langs-vb-963yiWmh.js +0 -2
  731. package/dist/client/assets/vendor--shikijs-langs-verilog-B2jw8mKy.js +0 -2
  732. package/dist/client/assets/vendor--shikijs-langs-vhdl-BrJK1VDe.js +0 -2
  733. package/dist/client/assets/vendor--shikijs-langs-viml-C8TSeNgT.js +0 -2
  734. package/dist/client/assets/vendor--shikijs-langs-vue-DbIFMi28.js +0 -2
  735. package/dist/client/assets/vendor--shikijs-langs-vue-html-BXcyghbH.js +0 -2
  736. package/dist/client/assets/vendor--shikijs-langs-vue-vine-BXiOV7FZ.js +0 -2
  737. package/dist/client/assets/vendor--shikijs-langs-vyper-BEG-tdoQ.js +0 -2
  738. package/dist/client/assets/vendor--shikijs-langs-wasm-C9auNtLR.js +0 -2
  739. package/dist/client/assets/vendor--shikijs-langs-wenyan-CVNKYyqq.js +0 -2
  740. package/dist/client/assets/vendor--shikijs-langs-wgsl-CPv2JETM.js +0 -2
  741. package/dist/client/assets/vendor--shikijs-langs-wikitext-Dj5USDAt.js +0 -2
  742. package/dist/client/assets/vendor--shikijs-langs-wit-BgVKv1BB.js +0 -2
  743. package/dist/client/assets/vendor--shikijs-langs-wolfram-CzDsO-cu.js +0 -2
  744. package/dist/client/assets/vendor--shikijs-langs-xsl-wm8OVNsA.js +0 -2
  745. package/dist/client/assets/vendor--shikijs-langs-zenscript-Bhc_9F_A.js +0 -2
  746. package/dist/client/assets/vendor--shikijs-langs-zig-Dp6yHgul.js +0 -2
  747. package/dist/client/assets/vendor--shikijs-themes-andromeeda-B39Cct_V.js +0 -2
  748. package/dist/client/assets/vendor--shikijs-themes-aurora-x-tYBwgIas.js +0 -2
  749. package/dist/client/assets/vendor--shikijs-themes-ayu-dark-Bl5_65r5.js +0 -2
  750. package/dist/client/assets/vendor--shikijs-themes-ayu-light-CWlkmCUt.js +0 -2
  751. package/dist/client/assets/vendor--shikijs-themes-ayu-mirage-BLlWY2r-.js +0 -2
  752. package/dist/client/assets/vendor--shikijs-themes-catppuccin-frappe-BgV9gMz6.js +0 -2
  753. package/dist/client/assets/vendor--shikijs-themes-catppuccin-latte-2thKPRi4.js +0 -2
  754. package/dist/client/assets/vendor--shikijs-themes-catppuccin-macchiato-DgXBiWe_.js +0 -2
  755. package/dist/client/assets/vendor--shikijs-themes-catppuccin-mocha-DZP-iRXh.js +0 -2
  756. package/dist/client/assets/vendor--shikijs-themes-dark-plus-BtsdPNnC.js +0 -2
  757. package/dist/client/assets/vendor--shikijs-themes-dracula-soft-C6jQtqBj.js +0 -2
  758. package/dist/client/assets/vendor--shikijs-themes-dracula-xd4eCttF.js +0 -2
  759. package/dist/client/assets/vendor--shikijs-themes-everforest-dark-CGqzgmus.js +0 -2
  760. package/dist/client/assets/vendor--shikijs-themes-everforest-light-IrtgcSp6.js +0 -2
  761. package/dist/client/assets/vendor--shikijs-themes-github-dark-B_EVv_qp.js +0 -2
  762. package/dist/client/assets/vendor--shikijs-themes-github-dark-default-CqTiwZQ3.js +0 -2
  763. package/dist/client/assets/vendor--shikijs-themes-github-dark-dimmed-eJmmb2XY.js +0 -2
  764. package/dist/client/assets/vendor--shikijs-themes-github-dark-high-contrast-DJvMMBP5.js +0 -2
  765. package/dist/client/assets/vendor--shikijs-themes-github-light-4hvO5uJm.js +0 -2
  766. package/dist/client/assets/vendor--shikijs-themes-github-light-default-CBrNN1u4.js +0 -2
  767. package/dist/client/assets/vendor--shikijs-themes-github-light-high-contrast-c_bCxsPW.js +0 -2
  768. package/dist/client/assets/vendor--shikijs-themes-gruvbox-dark-hard-DelJt3Tq.js +0 -2
  769. package/dist/client/assets/vendor--shikijs-themes-gruvbox-dark-medium-oVEQkq8o.js +0 -2
  770. package/dist/client/assets/vendor--shikijs-themes-gruvbox-dark-soft-DRe-W3U7.js +0 -2
  771. package/dist/client/assets/vendor--shikijs-themes-gruvbox-light-hard-D6BXuRGs.js +0 -2
  772. package/dist/client/assets/vendor--shikijs-themes-gruvbox-light-medium-ca45Xt_L.js +0 -2
  773. package/dist/client/assets/vendor--shikijs-themes-gruvbox-light-soft-CpXm-FGd.js +0 -2
  774. package/dist/client/assets/vendor--shikijs-themes-horizon-bright-Or6QNCPB.js +0 -2
  775. package/dist/client/assets/vendor--shikijs-themes-horizon-nPlGoZbS.js +0 -2
  776. package/dist/client/assets/vendor--shikijs-themes-houston-KdRpxxrq.js +0 -2
  777. package/dist/client/assets/vendor--shikijs-themes-kanagawa-dragon-_EB90QZV.js +0 -2
  778. package/dist/client/assets/vendor--shikijs-themes-kanagawa-lotus-xVRS22aC.js +0 -2
  779. package/dist/client/assets/vendor--shikijs-themes-kanagawa-wave-ldKb7Lt2.js +0 -2
  780. package/dist/client/assets/vendor--shikijs-themes-laserwave-Bt57ZEQ1.js +0 -2
  781. package/dist/client/assets/vendor--shikijs-themes-light-plus-sAZL5xfv.js +0 -2
  782. package/dist/client/assets/vendor--shikijs-themes-material-theme-Dt6ngFPz.js +0 -2
  783. package/dist/client/assets/vendor--shikijs-themes-material-theme-darker-CCQckQh4.js +0 -2
  784. package/dist/client/assets/vendor--shikijs-themes-material-theme-lighter-Dood4HQY.js +0 -2
  785. package/dist/client/assets/vendor--shikijs-themes-material-theme-ocean-BvJks6C_.js +0 -2
  786. package/dist/client/assets/vendor--shikijs-themes-material-theme-palenight-CzUtRxKt.js +0 -2
  787. package/dist/client/assets/vendor--shikijs-themes-min-dark-De9MHvAK.js +0 -2
  788. package/dist/client/assets/vendor--shikijs-themes-min-light-CeOpF5bK.js +0 -2
  789. package/dist/client/assets/vendor--shikijs-themes-monokai-HYI9nkM5.js +0 -2
  790. package/dist/client/assets/vendor--shikijs-themes-night-owl-0zoYfhxX.js +0 -2
  791. package/dist/client/assets/vendor--shikijs-themes-night-owl-light-DqU4eQSx.js +0 -2
  792. package/dist/client/assets/vendor--shikijs-themes-nord-NeXJGOqb.js +0 -2
  793. package/dist/client/assets/vendor--shikijs-themes-one-dark-pro-CEkf50X_.js +0 -2
  794. package/dist/client/assets/vendor--shikijs-themes-one-light-C5SeL1pj.js +0 -2
  795. package/dist/client/assets/vendor--shikijs-themes-plastic-BJXzEa6N.js +0 -2
  796. package/dist/client/assets/vendor--shikijs-themes-poimandres-B8wUpJ6-.js +0 -2
  797. package/dist/client/assets/vendor--shikijs-themes-red-DfmVRHmT.js +0 -2
  798. package/dist/client/assets/vendor--shikijs-themes-rose-pine-W7PApUhA.js +0 -2
  799. package/dist/client/assets/vendor--shikijs-themes-rose-pine-dawn-CO9NROH7.js +0 -2
  800. package/dist/client/assets/vendor--shikijs-themes-rose-pine-moon-CzBfEEsz.js +0 -2
  801. package/dist/client/assets/vendor--shikijs-themes-slack-dark-Cp7DV95Y.js +0 -2
  802. package/dist/client/assets/vendor--shikijs-themes-slack-ochin-B9L1eHX2.js +0 -2
  803. package/dist/client/assets/vendor--shikijs-themes-snazzy-light-CJ6h0FEK.js +0 -2
  804. package/dist/client/assets/vendor--shikijs-themes-solarized-dark-BaTg99uq.js +0 -2
  805. package/dist/client/assets/vendor--shikijs-themes-solarized-light-DEYuXd25.js +0 -2
  806. package/dist/client/assets/vendor--shikijs-themes-synthwave-84-D3yVdrOJ.js +0 -2
  807. package/dist/client/assets/vendor--shikijs-themes-tokyo-night-CwyyylqG.js +0 -2
  808. package/dist/client/assets/vendor--shikijs-themes-vesper-CnfqnxS1.js +0 -2
  809. package/dist/client/assets/vendor--shikijs-themes-vitesse-black-DdH7Qydw.js +0 -2
  810. package/dist/client/assets/vendor--shikijs-themes-vitesse-dark-BVKIyd9G.js +0 -2
  811. package/dist/client/assets/vendor--shikijs-themes-vitesse-light-CH7k5Zx0.js +0 -2
  812. package/dist/client/assets/vendor--shikijs-transformers-BGbD80GE.js +0 -2
  813. package/dist/client/assets/vendor--ungap-structured-clone-Cizgq48a.js +0 -2
  814. package/dist/client/assets/vendor--xterm-addon-fit-2SkXNpWc.js +0 -2
  815. package/dist/client/assets/vendor-bail-DslLbDNc.js +0 -2
  816. package/dist/client/assets/vendor-decode-named-character-reference-D4JeqJXO.js +0 -2
  817. package/dist/client/assets/vendor-devlop-B6gNJmK1.js +0 -2
  818. package/dist/client/assets/vendor-diff-JjX2GAnZ.js +0 -14
  819. package/dist/client/assets/vendor-diffs-CBk6gACd.js +0 -1777
  820. package/dist/client/assets/vendor-entities-BPEYRqUt.js +0 -2
  821. package/dist/client/assets/vendor-escape-string-regexp-CIAWGUO4.js +0 -2
  822. package/dist/client/assets/vendor-estree-util-is-identifier-name-DNVaWizQ.js +0 -2
  823. package/dist/client/assets/vendor-extend-BluXZM4M.js +0 -2
  824. package/dist/client/assets/vendor-hast-util-from-dom-D6Kxj_46.js +0 -2
  825. package/dist/client/assets/vendor-hast-util-from-html-isomorphic-CXMxlE2r.js +0 -2
  826. package/dist/client/assets/vendor-hast-util-from-parse5-CcT-aLaC.js +0 -3
  827. package/dist/client/assets/vendor-hast-util-is-element-CqD06dHC.js +0 -2
  828. package/dist/client/assets/vendor-hast-util-raw-ryote2N_.js +0 -2
  829. package/dist/client/assets/vendor-hast-util-to-jsx-runtime-Dkh1YHjw.js +0 -3
  830. package/dist/client/assets/vendor-hast-util-to-text-B8A4M-9u.js +0 -4
  831. package/dist/client/assets/vendor-html-url-attributes-CbutxRIG.js +0 -2
  832. package/dist/client/assets/vendor-is-plain-obj-1mGkbioL.js +0 -2
  833. package/dist/client/assets/vendor-katex-VTL7DqQH.js +0 -258
  834. package/dist/client/assets/vendor-longest-streak-BaNpuKju.js +0 -2
  835. package/dist/client/assets/vendor-markdown-0FVMTLPP.js +0 -33
  836. package/dist/client/assets/vendor-motion-dom-ChuUZHv5.js +0 -2
  837. package/dist/client/assets/vendor-qrcode-generator-CJtPPqPY.js +0 -4
  838. package/dist/client/assets/vendor-react-icons-DzNJMww6.js +0 -2
  839. package/dist/client/assets/vendor-rehype-katex-C9b0nLo5.js +0 -2
  840. package/dist/client/assets/vendor-rehype-raw-YN9Ua-2h.js +0 -2
  841. package/dist/client/assets/vendor-remark-math-lcIzMrmT.js +0 -2
  842. package/dist/client/assets/vendor-shiki-BWANXXDP.js +0 -2
  843. package/dist/client/assets/vendor-tanstack-DxB_J8A7.js +0 -5
  844. package/dist/client/assets/vendor-ui-CJZCHXkp.js +0 -25
  845. package/dist/client/assets/vendor-unicode-animations-xZRLz3EO.js +0 -2
@@ -1,4133 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { $n as seconds, $t as fnUntraced, A as ServeError, An as provideMerge, At as orDie, B as fromRecordUnsafe, Bt as runIn, Cn as void_, Ct as toUint8Array, D as HttpServerError, Dn as fresh, E as ClientAbort, F as MaxBodySize, Fn as forkUnsafe, G as parseHeader, Gt as cached, H as layer$3, I as TypeId, In as provide$1, Jt as fail, K as toSetCookieHeaders, Kt as callback, L as inspect, M as raw, Mt as runForEachArray, N as RequestInit, Nn as addFinalizer, O as RequestParseError, On as mergeAll, P as layer$5, Pn as addFinalizerExit, Pt as unwrap, R as fromInput$1, Rt as makeUnsafe$1, St as toString, Tn as effect, U as layerWeak, Un as combine, V as merge, Vt as acquireRelease, W as isEmpty, Wn as die$1, Yt as failCause, Zn as makeUnsafe, Zt as flatMap, _ as decodeField, _t as layer$2, a as make$5, at as layer$4, bn as tryPromise, bt as fromReadable, cr as __require, d as TypeId$2, dn as runSync, f as MultipartError, fn as scope, g as toPersisted, gn as sync, h as makeConfig, hn as suspend, i as layerTestClient, in as matchCauseEffect, ir as flow, it as unwrap$1, j as causeResponse, jn as succeed$1, k as ResponseError, kn as provide, kt as map$1, l as toHandled, lr as __toESM, mn as succeed, n as Mime_default, nr as Class, o as HttpPlatform, or as pipe, p as TypeId$1, qt as die, r as HttpServer, rn as map, s as make$3, sr as __commonJSMin, tn as interruptible, tr as fromNullishOr, u as HttpServerRequest, un as runForkWith, v as make$4, vn as tapCause, w as fromWebSocket, wn as withFiber, xn as try_, xt as toArrayBuffer, yn as timeoutOrElse, z as fromInput } from "./bin.mjs";
4
- import { Duplex, Readable } from "node:stream";
5
- import * as Fs from "node:fs";
6
- import * as Http from "node:http";
7
- import * as NodeStreamP from "node:stream/promises";
8
- import { pipeline } from "node:stream/promises";
9
-
10
- //#region ../../node_modules/@effect/platform-node/dist/NodeHttpIncomingMessage.js
11
- /**
12
- * @since 1.0.0
13
- */
14
- /**
15
- * @since 1.0.0
16
- * @category Constructors
17
- */
18
- var NodeHttpIncomingMessage = class extends Class {
19
- /**
20
- * @since 1.0.0
21
- */
22
- [TypeId];
23
- source;
24
- onError;
25
- remoteAddressOverride;
26
- constructor(source, onError, remoteAddressOverride) {
27
- super();
28
- this[TypeId] = TypeId;
29
- this.source = source;
30
- this.onError = onError;
31
- this.remoteAddressOverride = remoteAddressOverride;
32
- }
33
- get headers() {
34
- return fromInput(this.source.headers);
35
- }
36
- get remoteAddress() {
37
- return this.remoteAddressOverride ?? fromNullishOr(this.source.socket.remoteAddress);
38
- }
39
- textEffect;
40
- get text() {
41
- if (this.textEffect) return this.textEffect;
42
- this.textEffect = runSync(cached(flatMap(MaxBodySize.asEffect(), (maxBodySize) => toString(() => this.source, {
43
- onError: this.onError,
44
- maxBytes: maxBodySize
45
- }))));
46
- return this.textEffect;
47
- }
48
- get textUnsafe() {
49
- return runSync(this.text);
50
- }
51
- get json() {
52
- return flatMap(this.text, (text) => try_({
53
- try: () => text === "" ? null : JSON.parse(text),
54
- catch: this.onError
55
- }));
56
- }
57
- get jsonUnsafe() {
58
- return runSync(this.json);
59
- }
60
- get urlParamsBody() {
61
- return flatMap(this.text, (_) => try_({
62
- try: () => fromInput$1(new URLSearchParams(_)),
63
- catch: this.onError
64
- }));
65
- }
66
- get stream() {
67
- return fromReadable({
68
- evaluate: () => this.source,
69
- onError: this.onError
70
- });
71
- }
72
- get arrayBuffer() {
73
- return withFiber((fiber) => toArrayBuffer(() => this.source, {
74
- onError: this.onError,
75
- maxBytes: fiber.getRef(MaxBodySize)
76
- }));
77
- }
78
- };
79
-
80
- //#endregion
81
- //#region ../../node_modules/@effect/platform-node/dist/NodeHttpPlatform.js
82
- /**
83
- * @since 1.0.0
84
- */
85
- /**
86
- * @since 1.0.0
87
- * @category Constructors
88
- */
89
- const make$2 = /* @__PURE__ */ make$3({
90
- fileResponse(path, status, statusText, headers, start, end, contentLength) {
91
- const stream = contentLength === 0 ? Readable.from([]) : Fs.createReadStream(path, {
92
- start,
93
- end: end === void 0 ? void 0 : end - 1
94
- });
95
- return raw(stream, {
96
- headers: {
97
- ...headers,
98
- "content-type": headers["content-type"] ?? Mime_default.getType(path) ?? "application/octet-stream",
99
- "content-length": contentLength.toString()
100
- },
101
- status,
102
- statusText
103
- });
104
- },
105
- fileWebResponse(file, status, statusText, headers, _options) {
106
- return raw(Readable.fromWeb(file.stream()), {
107
- headers: merge(headers, fromRecordUnsafe({
108
- "content-type": headers["content-type"] ?? Mime_default.getType(file.name) ?? "application/octet-stream",
109
- "content-length": file.size.toString()
110
- })),
111
- status,
112
- statusText
113
- });
114
- }
115
- });
116
- /**
117
- * @since 1.0.0
118
- * @category Layers
119
- */
120
- const layer$1 = /* @__PURE__ */ pipe(/* @__PURE__ */ effect(HttpPlatform)(make$2), /* @__PURE__ */ provide(layer$2), /* @__PURE__ */ provide(layer$3));
121
-
122
- //#endregion
123
- //#region ../../node_modules/multipasta/dist/esm/node.js
124
- var MultipastaStream = class extends Duplex {
125
- _parser;
126
- _canWrite = true;
127
- _writeCallback;
128
- constructor(config) {
129
- super({ readableObjectMode: true });
130
- let currentError;
131
- let currentFile;
132
- this._parser = make$4({
133
- ...config,
134
- onField: (info, value) => {
135
- if (currentError !== void 0) return;
136
- const field = {
137
- _tag: "Field",
138
- info,
139
- value
140
- };
141
- this.push(field);
142
- this.emit("field", field);
143
- },
144
- onFile: (info) => {
145
- if (currentError !== void 0) return (_) => {};
146
- const file = new FileStream(info, this);
147
- currentFile = file;
148
- this.push(file);
149
- this.emit("file", file);
150
- return (chunk) => {
151
- this._canWrite = file.push(chunk);
152
- if (chunk === null && !this._canWrite) {
153
- currentFile = void 0;
154
- this._resume();
155
- }
156
- };
157
- },
158
- onError: (error) => {
159
- this.emit("error", error);
160
- currentFile?.emit("error", error);
161
- currentError = error;
162
- },
163
- onDone: () => {
164
- this.push(null);
165
- }
166
- });
167
- }
168
- _resume() {
169
- this._canWrite = true;
170
- if (this._writeCallback !== void 0) {
171
- const callback = this._writeCallback;
172
- this._writeCallback = void 0;
173
- callback();
174
- }
175
- }
176
- _read(_size) {}
177
- _write(chunk, encoding, callback) {
178
- this._parser.write(chunk instanceof Uint8Array ? chunk : Buffer.from(chunk, encoding));
179
- if (this._canWrite) callback();
180
- else this._writeCallback = callback;
181
- }
182
- _final(callback) {
183
- this._parser.end();
184
- callback();
185
- }
186
- };
187
- const make$1 = (config) => new MultipastaStream(config);
188
- var FileStream = class extends Readable {
189
- info;
190
- _parent;
191
- _tag = "File";
192
- filename;
193
- constructor(info, _parent) {
194
- super();
195
- this.info = info;
196
- this._parent = _parent;
197
- this.filename = info.filename;
198
- }
199
- _read(_size) {
200
- if (this._parent._canWrite === false) this._parent._resume();
201
- }
202
- };
203
-
204
- //#endregion
205
- //#region ../../node_modules/@effect/platform-node/dist/NodeMultipart.js
206
- /**
207
- * @since 1.0.0
208
- */
209
- /**
210
- * @since 1.0.0
211
- * @category constructors
212
- */
213
- const stream = (source, headers) => makeConfig(headers).pipe(map((config) => fromReadable({
214
- evaluate() {
215
- const parser = make$1(config);
216
- source.pipe(parser);
217
- return parser;
218
- },
219
- onError: (error) => convertError(error)
220
- })), unwrap, map$1(convertPart));
221
- /**
222
- * @since 1.0.0
223
- * @category constructors
224
- */
225
- const persisted = (source, headers) => toPersisted(stream(source, headers), (path, file) => tryPromise({
226
- try: (signal) => NodeStreamP.pipeline(file.file, Fs.createWriteStream(path), { signal }),
227
- catch: (cause) => MultipartError.fromReason("InternalError", cause)
228
- }));
229
- const convertPart = (part) => part._tag === "Field" ? new FieldImpl(part.info, part.value) : new FileImpl(part);
230
- var PartBase = class extends Class {
231
- [TypeId$1];
232
- constructor() {
233
- super();
234
- this[TypeId$1] = TypeId$1;
235
- }
236
- };
237
- var FieldImpl = class extends PartBase {
238
- _tag = "Field";
239
- key;
240
- contentType;
241
- value;
242
- constructor(info, value) {
243
- super();
244
- this.key = info.name;
245
- this.contentType = info.contentType;
246
- this.value = decodeField(info, value);
247
- }
248
- toJSON() {
249
- return {
250
- _id: "@effect/platform/Multipart/Part",
251
- _tag: "Field",
252
- key: this.key,
253
- value: this.value,
254
- contentType: this.contentType
255
- };
256
- }
257
- };
258
- var FileImpl = class extends PartBase {
259
- _tag = "File";
260
- key;
261
- name;
262
- contentType;
263
- content;
264
- contentEffect;
265
- file;
266
- constructor(file) {
267
- super();
268
- this.file = file;
269
- this.key = file.info.name;
270
- this.name = file.filename ?? file.info.name;
271
- this.contentType = file.info.contentType;
272
- this.content = fromReadable({
273
- evaluate: () => file,
274
- onError: (cause) => MultipartError.fromReason("InternalError", cause)
275
- });
276
- this.contentEffect = toUint8Array(() => file, { onError: (cause) => MultipartError.fromReason("InternalError", cause) });
277
- }
278
- toJSON() {
279
- return {
280
- _id: "@effect/platform/Multipart/Part",
281
- _tag: "File",
282
- key: this.key,
283
- name: this.name,
284
- contentType: this.contentType
285
- };
286
- }
287
- };
288
- function convertError(cause) {
289
- switch (cause._tag) {
290
- case "ReachedLimit": switch (cause.limit) {
291
- case "MaxParts": return MultipartError.fromReason("TooManyParts", cause);
292
- case "MaxFieldSize": return MultipartError.fromReason("FieldTooLarge", cause);
293
- case "MaxPartSize": return MultipartError.fromReason("FileTooLarge", cause);
294
- case "MaxTotalSize": return MultipartError.fromReason("BodyTooLarge", cause);
295
- }
296
- default: return MultipartError.fromReason("Parse", cause);
297
- }
298
- }
299
-
300
- //#endregion
301
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/constants.js
302
- var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
303
- const BINARY_TYPES = [
304
- "nodebuffer",
305
- "arraybuffer",
306
- "fragments"
307
- ];
308
- const hasBlob = typeof Blob !== "undefined";
309
- if (hasBlob) BINARY_TYPES.push("blob");
310
- module.exports = {
311
- BINARY_TYPES,
312
- CLOSE_TIMEOUT: 3e4,
313
- EMPTY_BUFFER: Buffer.alloc(0),
314
- GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
315
- hasBlob,
316
- kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
317
- kListener: Symbol("kListener"),
318
- kStatusCode: Symbol("status-code"),
319
- kWebSocket: Symbol("websocket"),
320
- NOOP: () => {}
321
- };
322
- }));
323
-
324
- //#endregion
325
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/buffer-util.js
326
- var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
327
- const { EMPTY_BUFFER } = require_constants();
328
- const FastBuffer = Buffer[Symbol.species];
329
- /**
330
- * Merges an array of buffers into a new buffer.
331
- *
332
- * @param {Buffer[]} list The array of buffers to concat
333
- * @param {Number} totalLength The total length of buffers in the list
334
- * @return {Buffer} The resulting buffer
335
- * @public
336
- */
337
- function concat(list, totalLength) {
338
- if (list.length === 0) return EMPTY_BUFFER;
339
- if (list.length === 1) return list[0];
340
- const target = Buffer.allocUnsafe(totalLength);
341
- let offset = 0;
342
- for (let i = 0; i < list.length; i++) {
343
- const buf = list[i];
344
- target.set(buf, offset);
345
- offset += buf.length;
346
- }
347
- if (offset < totalLength) return new FastBuffer(target.buffer, target.byteOffset, offset);
348
- return target;
349
- }
350
- /**
351
- * Masks a buffer using the given mask.
352
- *
353
- * @param {Buffer} source The buffer to mask
354
- * @param {Buffer} mask The mask to use
355
- * @param {Buffer} output The buffer where to store the result
356
- * @param {Number} offset The offset at which to start writing
357
- * @param {Number} length The number of bytes to mask.
358
- * @public
359
- */
360
- function _mask(source, mask, output, offset, length) {
361
- for (let i = 0; i < length; i++) output[offset + i] = source[i] ^ mask[i & 3];
362
- }
363
- /**
364
- * Unmasks a buffer using the given mask.
365
- *
366
- * @param {Buffer} buffer The buffer to unmask
367
- * @param {Buffer} mask The mask to use
368
- * @public
369
- */
370
- function _unmask(buffer, mask) {
371
- for (let i = 0; i < buffer.length; i++) buffer[i] ^= mask[i & 3];
372
- }
373
- /**
374
- * Converts a buffer to an `ArrayBuffer`.
375
- *
376
- * @param {Buffer} buf The buffer to convert
377
- * @return {ArrayBuffer} Converted buffer
378
- * @public
379
- */
380
- function toArrayBuffer(buf) {
381
- if (buf.length === buf.buffer.byteLength) return buf.buffer;
382
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
383
- }
384
- /**
385
- * Converts `data` to a `Buffer`.
386
- *
387
- * @param {*} data The data to convert
388
- * @return {Buffer} The buffer
389
- * @throws {TypeError}
390
- * @public
391
- */
392
- function toBuffer(data) {
393
- toBuffer.readOnly = true;
394
- if (Buffer.isBuffer(data)) return data;
395
- let buf;
396
- if (data instanceof ArrayBuffer) buf = new FastBuffer(data);
397
- else if (ArrayBuffer.isView(data)) buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
398
- else {
399
- buf = Buffer.from(data);
400
- toBuffer.readOnly = false;
401
- }
402
- return buf;
403
- }
404
- module.exports = {
405
- concat,
406
- mask: _mask,
407
- toArrayBuffer,
408
- toBuffer,
409
- unmask: _unmask
410
- };
411
- /* istanbul ignore else */
412
- if (!process.env.WS_NO_BUFFER_UTIL) try {
413
- const bufferUtil = __require("bufferutil");
414
- module.exports.mask = function(source, mask, output, offset, length) {
415
- if (length < 48) _mask(source, mask, output, offset, length);
416
- else bufferUtil.mask(source, mask, output, offset, length);
417
- };
418
- module.exports.unmask = function(buffer, mask) {
419
- if (buffer.length < 32) _unmask(buffer, mask);
420
- else bufferUtil.unmask(buffer, mask);
421
- };
422
- } catch (e) {}
423
- }));
424
-
425
- //#endregion
426
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/limiter.js
427
- var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
428
- const kDone = Symbol("kDone");
429
- const kRun = Symbol("kRun");
430
- /**
431
- * A very simple job queue with adjustable concurrency. Adapted from
432
- * https://github.com/STRML/async-limiter
433
- */
434
- var Limiter = class {
435
- /**
436
- * Creates a new `Limiter`.
437
- *
438
- * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed
439
- * to run concurrently
440
- */
441
- constructor(concurrency) {
442
- this[kDone] = () => {
443
- this.pending--;
444
- this[kRun]();
445
- };
446
- this.concurrency = concurrency || Infinity;
447
- this.jobs = [];
448
- this.pending = 0;
449
- }
450
- /**
451
- * Adds a job to the queue.
452
- *
453
- * @param {Function} job The job to run
454
- * @public
455
- */
456
- add(job) {
457
- this.jobs.push(job);
458
- this[kRun]();
459
- }
460
- /**
461
- * Removes a job from the queue and runs it if possible.
462
- *
463
- * @private
464
- */
465
- [kRun]() {
466
- if (this.pending === this.concurrency) return;
467
- if (this.jobs.length) {
468
- const job = this.jobs.shift();
469
- this.pending++;
470
- job(this[kDone]);
471
- }
472
- }
473
- };
474
- module.exports = Limiter;
475
- }));
476
-
477
- //#endregion
478
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/permessage-deflate.js
479
- var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
480
- const zlib = __require("zlib");
481
- const bufferUtil = require_buffer_util();
482
- const Limiter = require_limiter();
483
- const { kStatusCode } = require_constants();
484
- const FastBuffer = Buffer[Symbol.species];
485
- const TRAILER = Buffer.from([
486
- 0,
487
- 0,
488
- 255,
489
- 255
490
- ]);
491
- const kPerMessageDeflate = Symbol("permessage-deflate");
492
- const kTotalLength = Symbol("total-length");
493
- const kCallback = Symbol("callback");
494
- const kBuffers = Symbol("buffers");
495
- const kError = Symbol("error");
496
- let zlibLimiter;
497
- /**
498
- * permessage-deflate implementation.
499
- */
500
- var PerMessageDeflate = class {
501
- /**
502
- * Creates a PerMessageDeflate instance.
503
- *
504
- * @param {Object} [options] Configuration options
505
- * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support
506
- * for, or request, a custom client window size
507
- * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/
508
- * acknowledge disabling of client context takeover
509
- * @param {Number} [options.concurrencyLimit=10] The number of concurrent
510
- * calls to zlib
511
- * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
512
- * use of a custom server window size
513
- * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
514
- * disabling of server context takeover
515
- * @param {Number} [options.threshold=1024] Size (in bytes) below which
516
- * messages should not be compressed if context takeover is disabled
517
- * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on
518
- * deflate
519
- * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
520
- * inflate
521
- * @param {Boolean} [isServer=false] Create the instance in either server or
522
- * client mode
523
- * @param {Number} [maxPayload=0] The maximum allowed message length
524
- */
525
- constructor(options, isServer, maxPayload) {
526
- this._maxPayload = maxPayload | 0;
527
- this._options = options || {};
528
- this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
529
- this._isServer = !!isServer;
530
- this._deflate = null;
531
- this._inflate = null;
532
- this.params = null;
533
- if (!zlibLimiter) zlibLimiter = new Limiter(this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10);
534
- }
535
- /**
536
- * @type {String}
537
- */
538
- static get extensionName() {
539
- return "permessage-deflate";
540
- }
541
- /**
542
- * Create an extension negotiation offer.
543
- *
544
- * @return {Object} Extension parameters
545
- * @public
546
- */
547
- offer() {
548
- const params = {};
549
- if (this._options.serverNoContextTakeover) params.server_no_context_takeover = true;
550
- if (this._options.clientNoContextTakeover) params.client_no_context_takeover = true;
551
- if (this._options.serverMaxWindowBits) params.server_max_window_bits = this._options.serverMaxWindowBits;
552
- if (this._options.clientMaxWindowBits) params.client_max_window_bits = this._options.clientMaxWindowBits;
553
- else if (this._options.clientMaxWindowBits == null) params.client_max_window_bits = true;
554
- return params;
555
- }
556
- /**
557
- * Accept an extension negotiation offer/response.
558
- *
559
- * @param {Array} configurations The extension negotiation offers/reponse
560
- * @return {Object} Accepted configuration
561
- * @public
562
- */
563
- accept(configurations) {
564
- configurations = this.normalizeParams(configurations);
565
- this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations);
566
- return this.params;
567
- }
568
- /**
569
- * Releases all resources used by the extension.
570
- *
571
- * @public
572
- */
573
- cleanup() {
574
- if (this._inflate) {
575
- this._inflate.close();
576
- this._inflate = null;
577
- }
578
- if (this._deflate) {
579
- const callback = this._deflate[kCallback];
580
- this._deflate.close();
581
- this._deflate = null;
582
- if (callback) callback(/* @__PURE__ */ new Error("The deflate stream was closed while data was being processed"));
583
- }
584
- }
585
- /**
586
- * Accept an extension negotiation offer.
587
- *
588
- * @param {Array} offers The extension negotiation offers
589
- * @return {Object} Accepted configuration
590
- * @private
591
- */
592
- acceptAsServer(offers) {
593
- const opts = this._options;
594
- const accepted = offers.find((params) => {
595
- if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) return false;
596
- return true;
597
- });
598
- if (!accepted) throw new Error("None of the extension offers can be accepted");
599
- if (opts.serverNoContextTakeover) accepted.server_no_context_takeover = true;
600
- if (opts.clientNoContextTakeover) accepted.client_no_context_takeover = true;
601
- if (typeof opts.serverMaxWindowBits === "number") accepted.server_max_window_bits = opts.serverMaxWindowBits;
602
- if (typeof opts.clientMaxWindowBits === "number") accepted.client_max_window_bits = opts.clientMaxWindowBits;
603
- else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) delete accepted.client_max_window_bits;
604
- return accepted;
605
- }
606
- /**
607
- * Accept the extension negotiation response.
608
- *
609
- * @param {Array} response The extension negotiation response
610
- * @return {Object} Accepted configuration
611
- * @private
612
- */
613
- acceptAsClient(response) {
614
- const params = response[0];
615
- if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) throw new Error("Unexpected parameter \"client_no_context_takeover\"");
616
- if (!params.client_max_window_bits) {
617
- if (typeof this._options.clientMaxWindowBits === "number") params.client_max_window_bits = this._options.clientMaxWindowBits;
618
- } else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) throw new Error("Unexpected or invalid parameter \"client_max_window_bits\"");
619
- return params;
620
- }
621
- /**
622
- * Normalize parameters.
623
- *
624
- * @param {Array} configurations The extension negotiation offers/reponse
625
- * @return {Array} The offers/response with normalized parameters
626
- * @private
627
- */
628
- normalizeParams(configurations) {
629
- configurations.forEach((params) => {
630
- Object.keys(params).forEach((key) => {
631
- let value = params[key];
632
- if (value.length > 1) throw new Error(`Parameter "${key}" must have only a single value`);
633
- value = value[0];
634
- if (key === "client_max_window_bits") {
635
- if (value !== true) {
636
- const num = +value;
637
- if (!Number.isInteger(num) || num < 8 || num > 15) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
638
- value = num;
639
- } else if (!this._isServer) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
640
- } else if (key === "server_max_window_bits") {
641
- const num = +value;
642
- if (!Number.isInteger(num) || num < 8 || num > 15) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
643
- value = num;
644
- } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
645
- if (value !== true) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
646
- } else throw new Error(`Unknown parameter "${key}"`);
647
- params[key] = value;
648
- });
649
- });
650
- return configurations;
651
- }
652
- /**
653
- * Decompress data. Concurrency limited.
654
- *
655
- * @param {Buffer} data Compressed data
656
- * @param {Boolean} fin Specifies whether or not this is the last fragment
657
- * @param {Function} callback Callback
658
- * @public
659
- */
660
- decompress(data, fin, callback) {
661
- zlibLimiter.add((done) => {
662
- this._decompress(data, fin, (err, result) => {
663
- done();
664
- callback(err, result);
665
- });
666
- });
667
- }
668
- /**
669
- * Compress data. Concurrency limited.
670
- *
671
- * @param {(Buffer|String)} data Data to compress
672
- * @param {Boolean} fin Specifies whether or not this is the last fragment
673
- * @param {Function} callback Callback
674
- * @public
675
- */
676
- compress(data, fin, callback) {
677
- zlibLimiter.add((done) => {
678
- this._compress(data, fin, (err, result) => {
679
- done();
680
- callback(err, result);
681
- });
682
- });
683
- }
684
- /**
685
- * Decompress data.
686
- *
687
- * @param {Buffer} data Compressed data
688
- * @param {Boolean} fin Specifies whether or not this is the last fragment
689
- * @param {Function} callback Callback
690
- * @private
691
- */
692
- _decompress(data, fin, callback) {
693
- const endpoint = this._isServer ? "client" : "server";
694
- if (!this._inflate) {
695
- const key = `${endpoint}_max_window_bits`;
696
- const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
697
- this._inflate = zlib.createInflateRaw({
698
- ...this._options.zlibInflateOptions,
699
- windowBits
700
- });
701
- this._inflate[kPerMessageDeflate] = this;
702
- this._inflate[kTotalLength] = 0;
703
- this._inflate[kBuffers] = [];
704
- this._inflate.on("error", inflateOnError);
705
- this._inflate.on("data", inflateOnData);
706
- }
707
- this._inflate[kCallback] = callback;
708
- this._inflate.write(data);
709
- if (fin) this._inflate.write(TRAILER);
710
- this._inflate.flush(() => {
711
- const err = this._inflate[kError];
712
- if (err) {
713
- this._inflate.close();
714
- this._inflate = null;
715
- callback(err);
716
- return;
717
- }
718
- const data = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
719
- if (this._inflate._readableState.endEmitted) {
720
- this._inflate.close();
721
- this._inflate = null;
722
- } else {
723
- this._inflate[kTotalLength] = 0;
724
- this._inflate[kBuffers] = [];
725
- if (fin && this.params[`${endpoint}_no_context_takeover`]) this._inflate.reset();
726
- }
727
- callback(null, data);
728
- });
729
- }
730
- /**
731
- * Compress data.
732
- *
733
- * @param {(Buffer|String)} data Data to compress
734
- * @param {Boolean} fin Specifies whether or not this is the last fragment
735
- * @param {Function} callback Callback
736
- * @private
737
- */
738
- _compress(data, fin, callback) {
739
- const endpoint = this._isServer ? "server" : "client";
740
- if (!this._deflate) {
741
- const key = `${endpoint}_max_window_bits`;
742
- const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
743
- this._deflate = zlib.createDeflateRaw({
744
- ...this._options.zlibDeflateOptions,
745
- windowBits
746
- });
747
- this._deflate[kTotalLength] = 0;
748
- this._deflate[kBuffers] = [];
749
- this._deflate.on("data", deflateOnData);
750
- }
751
- this._deflate[kCallback] = callback;
752
- this._deflate.write(data);
753
- this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
754
- if (!this._deflate) return;
755
- let data = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
756
- if (fin) data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);
757
- this._deflate[kCallback] = null;
758
- this._deflate[kTotalLength] = 0;
759
- this._deflate[kBuffers] = [];
760
- if (fin && this.params[`${endpoint}_no_context_takeover`]) this._deflate.reset();
761
- callback(null, data);
762
- });
763
- }
764
- };
765
- module.exports = PerMessageDeflate;
766
- /**
767
- * The listener of the `zlib.DeflateRaw` stream `'data'` event.
768
- *
769
- * @param {Buffer} chunk A chunk of data
770
- * @private
771
- */
772
- function deflateOnData(chunk) {
773
- this[kBuffers].push(chunk);
774
- this[kTotalLength] += chunk.length;
775
- }
776
- /**
777
- * The listener of the `zlib.InflateRaw` stream `'data'` event.
778
- *
779
- * @param {Buffer} chunk A chunk of data
780
- * @private
781
- */
782
- function inflateOnData(chunk) {
783
- this[kTotalLength] += chunk.length;
784
- if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
785
- this[kBuffers].push(chunk);
786
- return;
787
- }
788
- this[kError] = /* @__PURE__ */ new RangeError("Max payload size exceeded");
789
- this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
790
- this[kError][kStatusCode] = 1009;
791
- this.removeListener("data", inflateOnData);
792
- this.reset();
793
- }
794
- /**
795
- * The listener of the `zlib.InflateRaw` stream `'error'` event.
796
- *
797
- * @param {Error} err The emitted error
798
- * @private
799
- */
800
- function inflateOnError(err) {
801
- this[kPerMessageDeflate]._inflate = null;
802
- if (this[kError]) {
803
- this[kCallback](this[kError]);
804
- return;
805
- }
806
- err[kStatusCode] = 1007;
807
- this[kCallback](err);
808
- }
809
- }));
810
-
811
- //#endregion
812
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/validation.js
813
- var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
814
- const { isUtf8 } = __require("buffer");
815
- const { hasBlob } = require_constants();
816
- const tokenChars = [
817
- 0,
818
- 0,
819
- 0,
820
- 0,
821
- 0,
822
- 0,
823
- 0,
824
- 0,
825
- 0,
826
- 0,
827
- 0,
828
- 0,
829
- 0,
830
- 0,
831
- 0,
832
- 0,
833
- 0,
834
- 0,
835
- 0,
836
- 0,
837
- 0,
838
- 0,
839
- 0,
840
- 0,
841
- 0,
842
- 0,
843
- 0,
844
- 0,
845
- 0,
846
- 0,
847
- 0,
848
- 0,
849
- 0,
850
- 1,
851
- 0,
852
- 1,
853
- 1,
854
- 1,
855
- 1,
856
- 1,
857
- 0,
858
- 0,
859
- 1,
860
- 1,
861
- 0,
862
- 1,
863
- 1,
864
- 0,
865
- 1,
866
- 1,
867
- 1,
868
- 1,
869
- 1,
870
- 1,
871
- 1,
872
- 1,
873
- 1,
874
- 1,
875
- 0,
876
- 0,
877
- 0,
878
- 0,
879
- 0,
880
- 0,
881
- 0,
882
- 1,
883
- 1,
884
- 1,
885
- 1,
886
- 1,
887
- 1,
888
- 1,
889
- 1,
890
- 1,
891
- 1,
892
- 1,
893
- 1,
894
- 1,
895
- 1,
896
- 1,
897
- 1,
898
- 1,
899
- 1,
900
- 1,
901
- 1,
902
- 1,
903
- 1,
904
- 1,
905
- 1,
906
- 1,
907
- 1,
908
- 0,
909
- 0,
910
- 0,
911
- 1,
912
- 1,
913
- 1,
914
- 1,
915
- 1,
916
- 1,
917
- 1,
918
- 1,
919
- 1,
920
- 1,
921
- 1,
922
- 1,
923
- 1,
924
- 1,
925
- 1,
926
- 1,
927
- 1,
928
- 1,
929
- 1,
930
- 1,
931
- 1,
932
- 1,
933
- 1,
934
- 1,
935
- 1,
936
- 1,
937
- 1,
938
- 1,
939
- 1,
940
- 0,
941
- 1,
942
- 0,
943
- 1,
944
- 0
945
- ];
946
- /**
947
- * Checks if a status code is allowed in a close frame.
948
- *
949
- * @param {Number} code The status code
950
- * @return {Boolean} `true` if the status code is valid, else `false`
951
- * @public
952
- */
953
- function isValidStatusCode(code) {
954
- return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
955
- }
956
- /**
957
- * Checks if a given buffer contains only correct UTF-8.
958
- * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
959
- * Markus Kuhn.
960
- *
961
- * @param {Buffer} buf The buffer to check
962
- * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
963
- * @public
964
- */
965
- function _isValidUTF8(buf) {
966
- const len = buf.length;
967
- let i = 0;
968
- while (i < len) if ((buf[i] & 128) === 0) i++;
969
- else if ((buf[i] & 224) === 192) {
970
- if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) return false;
971
- i += 2;
972
- } else if ((buf[i] & 240) === 224) {
973
- if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || buf[i] === 237 && (buf[i + 1] & 224) === 160) return false;
974
- i += 3;
975
- } else if ((buf[i] & 248) === 240) {
976
- if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) return false;
977
- i += 4;
978
- } else return false;
979
- return true;
980
- }
981
- /**
982
- * Determines whether a value is a `Blob`.
983
- *
984
- * @param {*} value The value to be tested
985
- * @return {Boolean} `true` if `value` is a `Blob`, else `false`
986
- * @private
987
- */
988
- function isBlob(value) {
989
- return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
990
- }
991
- module.exports = {
992
- isBlob,
993
- isValidStatusCode,
994
- isValidUTF8: _isValidUTF8,
995
- tokenChars
996
- };
997
- if (isUtf8) module.exports.isValidUTF8 = function(buf) {
998
- return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
999
- };
1000
- else if (!process.env.WS_NO_UTF_8_VALIDATE) try {
1001
- const isValidUTF8 = __require("utf-8-validate");
1002
- module.exports.isValidUTF8 = function(buf) {
1003
- return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
1004
- };
1005
- } catch (e) {}
1006
- }));
1007
-
1008
- //#endregion
1009
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/receiver.js
1010
- var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1011
- const { Writable } = __require("stream");
1012
- const PerMessageDeflate = require_permessage_deflate();
1013
- const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = require_constants();
1014
- const { concat, toArrayBuffer, unmask } = require_buffer_util();
1015
- const { isValidStatusCode, isValidUTF8 } = require_validation();
1016
- const FastBuffer = Buffer[Symbol.species];
1017
- const GET_INFO = 0;
1018
- const GET_PAYLOAD_LENGTH_16 = 1;
1019
- const GET_PAYLOAD_LENGTH_64 = 2;
1020
- const GET_MASK = 3;
1021
- const GET_DATA = 4;
1022
- const INFLATING = 5;
1023
- const DEFER_EVENT = 6;
1024
- /**
1025
- * HyBi Receiver implementation.
1026
- *
1027
- * @extends Writable
1028
- */
1029
- var Receiver = class extends Writable {
1030
- /**
1031
- * Creates a Receiver instance.
1032
- *
1033
- * @param {Object} [options] Options object
1034
- * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
1035
- * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
1036
- * multiple times in the same tick
1037
- * @param {String} [options.binaryType=nodebuffer] The type for binary data
1038
- * @param {Object} [options.extensions] An object containing the negotiated
1039
- * extensions
1040
- * @param {Boolean} [options.isServer=false] Specifies whether to operate in
1041
- * client or server mode
1042
- * @param {Number} [options.maxPayload=0] The maximum allowed message length
1043
- * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
1044
- * not to skip UTF-8 validation for text and close messages
1045
- */
1046
- constructor(options = {}) {
1047
- super();
1048
- this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : true;
1049
- this._binaryType = options.binaryType || BINARY_TYPES[0];
1050
- this._extensions = options.extensions || {};
1051
- this._isServer = !!options.isServer;
1052
- this._maxPayload = options.maxPayload | 0;
1053
- this._skipUTF8Validation = !!options.skipUTF8Validation;
1054
- this[kWebSocket] = void 0;
1055
- this._bufferedBytes = 0;
1056
- this._buffers = [];
1057
- this._compressed = false;
1058
- this._payloadLength = 0;
1059
- this._mask = void 0;
1060
- this._fragmented = 0;
1061
- this._masked = false;
1062
- this._fin = false;
1063
- this._opcode = 0;
1064
- this._totalPayloadLength = 0;
1065
- this._messageLength = 0;
1066
- this._fragments = [];
1067
- this._errored = false;
1068
- this._loop = false;
1069
- this._state = GET_INFO;
1070
- }
1071
- /**
1072
- * Implements `Writable.prototype._write()`.
1073
- *
1074
- * @param {Buffer} chunk The chunk of data to write
1075
- * @param {String} encoding The character encoding of `chunk`
1076
- * @param {Function} cb Callback
1077
- * @private
1078
- */
1079
- _write(chunk, encoding, cb) {
1080
- if (this._opcode === 8 && this._state == GET_INFO) return cb();
1081
- this._bufferedBytes += chunk.length;
1082
- this._buffers.push(chunk);
1083
- this.startLoop(cb);
1084
- }
1085
- /**
1086
- * Consumes `n` bytes from the buffered data.
1087
- *
1088
- * @param {Number} n The number of bytes to consume
1089
- * @return {Buffer} The consumed bytes
1090
- * @private
1091
- */
1092
- consume(n) {
1093
- this._bufferedBytes -= n;
1094
- if (n === this._buffers[0].length) return this._buffers.shift();
1095
- if (n < this._buffers[0].length) {
1096
- const buf = this._buffers[0];
1097
- this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
1098
- return new FastBuffer(buf.buffer, buf.byteOffset, n);
1099
- }
1100
- const dst = Buffer.allocUnsafe(n);
1101
- do {
1102
- const buf = this._buffers[0];
1103
- const offset = dst.length - n;
1104
- if (n >= buf.length) dst.set(this._buffers.shift(), offset);
1105
- else {
1106
- dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
1107
- this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
1108
- }
1109
- n -= buf.length;
1110
- } while (n > 0);
1111
- return dst;
1112
- }
1113
- /**
1114
- * Starts the parsing loop.
1115
- *
1116
- * @param {Function} cb Callback
1117
- * @private
1118
- */
1119
- startLoop(cb) {
1120
- this._loop = true;
1121
- do
1122
- switch (this._state) {
1123
- case GET_INFO:
1124
- this.getInfo(cb);
1125
- break;
1126
- case GET_PAYLOAD_LENGTH_16:
1127
- this.getPayloadLength16(cb);
1128
- break;
1129
- case GET_PAYLOAD_LENGTH_64:
1130
- this.getPayloadLength64(cb);
1131
- break;
1132
- case GET_MASK:
1133
- this.getMask();
1134
- break;
1135
- case GET_DATA:
1136
- this.getData(cb);
1137
- break;
1138
- case INFLATING:
1139
- case DEFER_EVENT:
1140
- this._loop = false;
1141
- return;
1142
- }
1143
- while (this._loop);
1144
- if (!this._errored) cb();
1145
- }
1146
- /**
1147
- * Reads the first two bytes of a frame.
1148
- *
1149
- * @param {Function} cb Callback
1150
- * @private
1151
- */
1152
- getInfo(cb) {
1153
- if (this._bufferedBytes < 2) {
1154
- this._loop = false;
1155
- return;
1156
- }
1157
- const buf = this.consume(2);
1158
- if ((buf[0] & 48) !== 0) {
1159
- cb(this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
1160
- return;
1161
- }
1162
- const compressed = (buf[0] & 64) === 64;
1163
- if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
1164
- cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
1165
- return;
1166
- }
1167
- this._fin = (buf[0] & 128) === 128;
1168
- this._opcode = buf[0] & 15;
1169
- this._payloadLength = buf[1] & 127;
1170
- if (this._opcode === 0) {
1171
- if (compressed) {
1172
- cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
1173
- return;
1174
- }
1175
- if (!this._fragmented) {
1176
- cb(this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE"));
1177
- return;
1178
- }
1179
- this._opcode = this._fragmented;
1180
- } else if (this._opcode === 1 || this._opcode === 2) {
1181
- if (this._fragmented) {
1182
- cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
1183
- return;
1184
- }
1185
- this._compressed = compressed;
1186
- } else if (this._opcode > 7 && this._opcode < 11) {
1187
- if (!this._fin) {
1188
- cb(this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN"));
1189
- return;
1190
- }
1191
- if (compressed) {
1192
- cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
1193
- return;
1194
- }
1195
- if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
1196
- cb(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
1197
- return;
1198
- }
1199
- } else {
1200
- cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
1201
- return;
1202
- }
1203
- if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
1204
- this._masked = (buf[1] & 128) === 128;
1205
- if (this._isServer) {
1206
- if (!this._masked) {
1207
- cb(this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK"));
1208
- return;
1209
- }
1210
- } else if (this._masked) {
1211
- cb(this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK"));
1212
- return;
1213
- }
1214
- if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
1215
- else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
1216
- else this.haveLength(cb);
1217
- }
1218
- /**
1219
- * Gets extended payload length (7+16).
1220
- *
1221
- * @param {Function} cb Callback
1222
- * @private
1223
- */
1224
- getPayloadLength16(cb) {
1225
- if (this._bufferedBytes < 2) {
1226
- this._loop = false;
1227
- return;
1228
- }
1229
- this._payloadLength = this.consume(2).readUInt16BE(0);
1230
- this.haveLength(cb);
1231
- }
1232
- /**
1233
- * Gets extended payload length (7+64).
1234
- *
1235
- * @param {Function} cb Callback
1236
- * @private
1237
- */
1238
- getPayloadLength64(cb) {
1239
- if (this._bufferedBytes < 8) {
1240
- this._loop = false;
1241
- return;
1242
- }
1243
- const buf = this.consume(8);
1244
- const num = buf.readUInt32BE(0);
1245
- if (num > Math.pow(2, 21) - 1) {
1246
- cb(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
1247
- return;
1248
- }
1249
- this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
1250
- this.haveLength(cb);
1251
- }
1252
- /**
1253
- * Payload length has been read.
1254
- *
1255
- * @param {Function} cb Callback
1256
- * @private
1257
- */
1258
- haveLength(cb) {
1259
- if (this._payloadLength && this._opcode < 8) {
1260
- this._totalPayloadLength += this._payloadLength;
1261
- if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
1262
- cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
1263
- return;
1264
- }
1265
- }
1266
- if (this._masked) this._state = GET_MASK;
1267
- else this._state = GET_DATA;
1268
- }
1269
- /**
1270
- * Reads mask bytes.
1271
- *
1272
- * @private
1273
- */
1274
- getMask() {
1275
- if (this._bufferedBytes < 4) {
1276
- this._loop = false;
1277
- return;
1278
- }
1279
- this._mask = this.consume(4);
1280
- this._state = GET_DATA;
1281
- }
1282
- /**
1283
- * Reads data bytes.
1284
- *
1285
- * @param {Function} cb Callback
1286
- * @private
1287
- */
1288
- getData(cb) {
1289
- let data = EMPTY_BUFFER;
1290
- if (this._payloadLength) {
1291
- if (this._bufferedBytes < this._payloadLength) {
1292
- this._loop = false;
1293
- return;
1294
- }
1295
- data = this.consume(this._payloadLength);
1296
- if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) unmask(data, this._mask);
1297
- }
1298
- if (this._opcode > 7) {
1299
- this.controlMessage(data, cb);
1300
- return;
1301
- }
1302
- if (this._compressed) {
1303
- this._state = INFLATING;
1304
- this.decompress(data, cb);
1305
- return;
1306
- }
1307
- if (data.length) {
1308
- this._messageLength = this._totalPayloadLength;
1309
- this._fragments.push(data);
1310
- }
1311
- this.dataMessage(cb);
1312
- }
1313
- /**
1314
- * Decompresses data.
1315
- *
1316
- * @param {Buffer} data Compressed data
1317
- * @param {Function} cb Callback
1318
- * @private
1319
- */
1320
- decompress(data, cb) {
1321
- this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf) => {
1322
- if (err) return cb(err);
1323
- if (buf.length) {
1324
- this._messageLength += buf.length;
1325
- if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
1326
- cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
1327
- return;
1328
- }
1329
- this._fragments.push(buf);
1330
- }
1331
- this.dataMessage(cb);
1332
- if (this._state === GET_INFO) this.startLoop(cb);
1333
- });
1334
- }
1335
- /**
1336
- * Handles a data message.
1337
- *
1338
- * @param {Function} cb Callback
1339
- * @private
1340
- */
1341
- dataMessage(cb) {
1342
- if (!this._fin) {
1343
- this._state = GET_INFO;
1344
- return;
1345
- }
1346
- const messageLength = this._messageLength;
1347
- const fragments = this._fragments;
1348
- this._totalPayloadLength = 0;
1349
- this._messageLength = 0;
1350
- this._fragmented = 0;
1351
- this._fragments = [];
1352
- if (this._opcode === 2) {
1353
- let data;
1354
- if (this._binaryType === "nodebuffer") data = concat(fragments, messageLength);
1355
- else if (this._binaryType === "arraybuffer") data = toArrayBuffer(concat(fragments, messageLength));
1356
- else if (this._binaryType === "blob") data = new Blob(fragments);
1357
- else data = fragments;
1358
- if (this._allowSynchronousEvents) {
1359
- this.emit("message", data, true);
1360
- this._state = GET_INFO;
1361
- } else {
1362
- this._state = DEFER_EVENT;
1363
- setImmediate(() => {
1364
- this.emit("message", data, true);
1365
- this._state = GET_INFO;
1366
- this.startLoop(cb);
1367
- });
1368
- }
1369
- } else {
1370
- const buf = concat(fragments, messageLength);
1371
- if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1372
- cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
1373
- return;
1374
- }
1375
- if (this._state === INFLATING || this._allowSynchronousEvents) {
1376
- this.emit("message", buf, false);
1377
- this._state = GET_INFO;
1378
- } else {
1379
- this._state = DEFER_EVENT;
1380
- setImmediate(() => {
1381
- this.emit("message", buf, false);
1382
- this._state = GET_INFO;
1383
- this.startLoop(cb);
1384
- });
1385
- }
1386
- }
1387
- }
1388
- /**
1389
- * Handles a control message.
1390
- *
1391
- * @param {Buffer} data Data to handle
1392
- * @return {(Error|RangeError|undefined)} A possible error
1393
- * @private
1394
- */
1395
- controlMessage(data, cb) {
1396
- if (this._opcode === 8) {
1397
- if (data.length === 0) {
1398
- this._loop = false;
1399
- this.emit("conclude", 1005, EMPTY_BUFFER);
1400
- this.end();
1401
- } else {
1402
- const code = data.readUInt16BE(0);
1403
- if (!isValidStatusCode(code)) {
1404
- cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
1405
- return;
1406
- }
1407
- const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
1408
- if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1409
- cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
1410
- return;
1411
- }
1412
- this._loop = false;
1413
- this.emit("conclude", code, buf);
1414
- this.end();
1415
- }
1416
- this._state = GET_INFO;
1417
- return;
1418
- }
1419
- if (this._allowSynchronousEvents) {
1420
- this.emit(this._opcode === 9 ? "ping" : "pong", data);
1421
- this._state = GET_INFO;
1422
- } else {
1423
- this._state = DEFER_EVENT;
1424
- setImmediate(() => {
1425
- this.emit(this._opcode === 9 ? "ping" : "pong", data);
1426
- this._state = GET_INFO;
1427
- this.startLoop(cb);
1428
- });
1429
- }
1430
- }
1431
- /**
1432
- * Builds an error object.
1433
- *
1434
- * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
1435
- * @param {String} message The error message
1436
- * @param {Boolean} prefix Specifies whether or not to add a default prefix to
1437
- * `message`
1438
- * @param {Number} statusCode The status code
1439
- * @param {String} errorCode The exposed error code
1440
- * @return {(Error|RangeError)} The error
1441
- * @private
1442
- */
1443
- createError(ErrorCtor, message, prefix, statusCode, errorCode) {
1444
- this._loop = false;
1445
- this._errored = true;
1446
- const err = new ErrorCtor(prefix ? `Invalid WebSocket frame: ${message}` : message);
1447
- Error.captureStackTrace(err, this.createError);
1448
- err.code = errorCode;
1449
- err[kStatusCode] = statusCode;
1450
- return err;
1451
- }
1452
- };
1453
- module.exports = Receiver;
1454
- }));
1455
-
1456
- //#endregion
1457
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/sender.js
1458
- var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1459
- const { Duplex: Duplex$4 } = __require("stream");
1460
- const { randomFillSync } = __require("crypto");
1461
- const PerMessageDeflate = require_permessage_deflate();
1462
- const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
1463
- const { isBlob, isValidStatusCode } = require_validation();
1464
- const { mask: applyMask, toBuffer } = require_buffer_util();
1465
- const kByteLength = Symbol("kByteLength");
1466
- const maskBuffer = Buffer.alloc(4);
1467
- const RANDOM_POOL_SIZE = 8 * 1024;
1468
- let randomPool;
1469
- let randomPoolPointer = RANDOM_POOL_SIZE;
1470
- const DEFAULT = 0;
1471
- const DEFLATING = 1;
1472
- const GET_BLOB_DATA = 2;
1473
- /**
1474
- * HyBi Sender implementation.
1475
- */
1476
- var Sender = class Sender {
1477
- /**
1478
- * Creates a Sender instance.
1479
- *
1480
- * @param {Duplex} socket The connection socket
1481
- * @param {Object} [extensions] An object containing the negotiated extensions
1482
- * @param {Function} [generateMask] The function used to generate the masking
1483
- * key
1484
- */
1485
- constructor(socket, extensions, generateMask) {
1486
- this._extensions = extensions || {};
1487
- if (generateMask) {
1488
- this._generateMask = generateMask;
1489
- this._maskBuffer = Buffer.alloc(4);
1490
- }
1491
- this._socket = socket;
1492
- this._firstFragment = true;
1493
- this._compress = false;
1494
- this._bufferedBytes = 0;
1495
- this._queue = [];
1496
- this._state = DEFAULT;
1497
- this.onerror = NOOP;
1498
- this[kWebSocket] = void 0;
1499
- }
1500
- /**
1501
- * Frames a piece of data according to the HyBi WebSocket protocol.
1502
- *
1503
- * @param {(Buffer|String)} data The data to frame
1504
- * @param {Object} options Options object
1505
- * @param {Boolean} [options.fin=false] Specifies whether or not to set the
1506
- * FIN bit
1507
- * @param {Function} [options.generateMask] The function used to generate the
1508
- * masking key
1509
- * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1510
- * `data`
1511
- * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
1512
- * key
1513
- * @param {Number} options.opcode The opcode
1514
- * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
1515
- * modified
1516
- * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
1517
- * RSV1 bit
1518
- * @return {(Buffer|String)[]} The framed data
1519
- * @public
1520
- */
1521
- static frame(data, options) {
1522
- let mask;
1523
- let merge = false;
1524
- let offset = 2;
1525
- let skipMasking = false;
1526
- if (options.mask) {
1527
- mask = options.maskBuffer || maskBuffer;
1528
- if (options.generateMask) options.generateMask(mask);
1529
- else {
1530
- if (randomPoolPointer === RANDOM_POOL_SIZE) {
1531
- /* istanbul ignore else */
1532
- if (randomPool === void 0) randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
1533
- randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
1534
- randomPoolPointer = 0;
1535
- }
1536
- mask[0] = randomPool[randomPoolPointer++];
1537
- mask[1] = randomPool[randomPoolPointer++];
1538
- mask[2] = randomPool[randomPoolPointer++];
1539
- mask[3] = randomPool[randomPoolPointer++];
1540
- }
1541
- skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
1542
- offset = 6;
1543
- }
1544
- let dataLength;
1545
- if (typeof data === "string") if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
1546
- else {
1547
- data = Buffer.from(data);
1548
- dataLength = data.length;
1549
- }
1550
- else {
1551
- dataLength = data.length;
1552
- merge = options.mask && options.readOnly && !skipMasking;
1553
- }
1554
- let payloadLength = dataLength;
1555
- if (dataLength >= 65536) {
1556
- offset += 8;
1557
- payloadLength = 127;
1558
- } else if (dataLength > 125) {
1559
- offset += 2;
1560
- payloadLength = 126;
1561
- }
1562
- const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
1563
- target[0] = options.fin ? options.opcode | 128 : options.opcode;
1564
- if (options.rsv1) target[0] |= 64;
1565
- target[1] = payloadLength;
1566
- if (payloadLength === 126) target.writeUInt16BE(dataLength, 2);
1567
- else if (payloadLength === 127) {
1568
- target[2] = target[3] = 0;
1569
- target.writeUIntBE(dataLength, 4, 6);
1570
- }
1571
- if (!options.mask) return [target, data];
1572
- target[1] |= 128;
1573
- target[offset - 4] = mask[0];
1574
- target[offset - 3] = mask[1];
1575
- target[offset - 2] = mask[2];
1576
- target[offset - 1] = mask[3];
1577
- if (skipMasking) return [target, data];
1578
- if (merge) {
1579
- applyMask(data, mask, target, offset, dataLength);
1580
- return [target];
1581
- }
1582
- applyMask(data, mask, data, 0, dataLength);
1583
- return [target, data];
1584
- }
1585
- /**
1586
- * Sends a close message to the other peer.
1587
- *
1588
- * @param {Number} [code] The status code component of the body
1589
- * @param {(String|Buffer)} [data] The message component of the body
1590
- * @param {Boolean} [mask=false] Specifies whether or not to mask the message
1591
- * @param {Function} [cb] Callback
1592
- * @public
1593
- */
1594
- close(code, data, mask, cb) {
1595
- let buf;
1596
- if (code === void 0) buf = EMPTY_BUFFER;
1597
- else if (typeof code !== "number" || !isValidStatusCode(code)) throw new TypeError("First argument must be a valid error code number");
1598
- else if (data === void 0 || !data.length) {
1599
- buf = Buffer.allocUnsafe(2);
1600
- buf.writeUInt16BE(code, 0);
1601
- } else {
1602
- const length = Buffer.byteLength(data);
1603
- if (length > 123) throw new RangeError("The message must not be greater than 123 bytes");
1604
- buf = Buffer.allocUnsafe(2 + length);
1605
- buf.writeUInt16BE(code, 0);
1606
- if (typeof data === "string") buf.write(data, 2);
1607
- else buf.set(data, 2);
1608
- }
1609
- const options = {
1610
- [kByteLength]: buf.length,
1611
- fin: true,
1612
- generateMask: this._generateMask,
1613
- mask,
1614
- maskBuffer: this._maskBuffer,
1615
- opcode: 8,
1616
- readOnly: false,
1617
- rsv1: false
1618
- };
1619
- if (this._state !== DEFAULT) this.enqueue([
1620
- this.dispatch,
1621
- buf,
1622
- false,
1623
- options,
1624
- cb
1625
- ]);
1626
- else this.sendFrame(Sender.frame(buf, options), cb);
1627
- }
1628
- /**
1629
- * Sends a ping message to the other peer.
1630
- *
1631
- * @param {*} data The message to send
1632
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
1633
- * @param {Function} [cb] Callback
1634
- * @public
1635
- */
1636
- ping(data, mask, cb) {
1637
- let byteLength;
1638
- let readOnly;
1639
- if (typeof data === "string") {
1640
- byteLength = Buffer.byteLength(data);
1641
- readOnly = false;
1642
- } else if (isBlob(data)) {
1643
- byteLength = data.size;
1644
- readOnly = false;
1645
- } else {
1646
- data = toBuffer(data);
1647
- byteLength = data.length;
1648
- readOnly = toBuffer.readOnly;
1649
- }
1650
- if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
1651
- const options = {
1652
- [kByteLength]: byteLength,
1653
- fin: true,
1654
- generateMask: this._generateMask,
1655
- mask,
1656
- maskBuffer: this._maskBuffer,
1657
- opcode: 9,
1658
- readOnly,
1659
- rsv1: false
1660
- };
1661
- if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
1662
- this.getBlobData,
1663
- data,
1664
- false,
1665
- options,
1666
- cb
1667
- ]);
1668
- else this.getBlobData(data, false, options, cb);
1669
- else if (this._state !== DEFAULT) this.enqueue([
1670
- this.dispatch,
1671
- data,
1672
- false,
1673
- options,
1674
- cb
1675
- ]);
1676
- else this.sendFrame(Sender.frame(data, options), cb);
1677
- }
1678
- /**
1679
- * Sends a pong message to the other peer.
1680
- *
1681
- * @param {*} data The message to send
1682
- * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
1683
- * @param {Function} [cb] Callback
1684
- * @public
1685
- */
1686
- pong(data, mask, cb) {
1687
- let byteLength;
1688
- let readOnly;
1689
- if (typeof data === "string") {
1690
- byteLength = Buffer.byteLength(data);
1691
- readOnly = false;
1692
- } else if (isBlob(data)) {
1693
- byteLength = data.size;
1694
- readOnly = false;
1695
- } else {
1696
- data = toBuffer(data);
1697
- byteLength = data.length;
1698
- readOnly = toBuffer.readOnly;
1699
- }
1700
- if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
1701
- const options = {
1702
- [kByteLength]: byteLength,
1703
- fin: true,
1704
- generateMask: this._generateMask,
1705
- mask,
1706
- maskBuffer: this._maskBuffer,
1707
- opcode: 10,
1708
- readOnly,
1709
- rsv1: false
1710
- };
1711
- if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
1712
- this.getBlobData,
1713
- data,
1714
- false,
1715
- options,
1716
- cb
1717
- ]);
1718
- else this.getBlobData(data, false, options, cb);
1719
- else if (this._state !== DEFAULT) this.enqueue([
1720
- this.dispatch,
1721
- data,
1722
- false,
1723
- options,
1724
- cb
1725
- ]);
1726
- else this.sendFrame(Sender.frame(data, options), cb);
1727
- }
1728
- /**
1729
- * Sends a data message to the other peer.
1730
- *
1731
- * @param {*} data The message to send
1732
- * @param {Object} options Options object
1733
- * @param {Boolean} [options.binary=false] Specifies whether `data` is binary
1734
- * or text
1735
- * @param {Boolean} [options.compress=false] Specifies whether or not to
1736
- * compress `data`
1737
- * @param {Boolean} [options.fin=false] Specifies whether the fragment is the
1738
- * last one
1739
- * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1740
- * `data`
1741
- * @param {Function} [cb] Callback
1742
- * @public
1743
- */
1744
- send(data, options, cb) {
1745
- const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
1746
- let opcode = options.binary ? 2 : 1;
1747
- let rsv1 = options.compress;
1748
- let byteLength;
1749
- let readOnly;
1750
- if (typeof data === "string") {
1751
- byteLength = Buffer.byteLength(data);
1752
- readOnly = false;
1753
- } else if (isBlob(data)) {
1754
- byteLength = data.size;
1755
- readOnly = false;
1756
- } else {
1757
- data = toBuffer(data);
1758
- byteLength = data.length;
1759
- readOnly = toBuffer.readOnly;
1760
- }
1761
- if (this._firstFragment) {
1762
- this._firstFragment = false;
1763
- if (rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"]) rsv1 = byteLength >= perMessageDeflate._threshold;
1764
- this._compress = rsv1;
1765
- } else {
1766
- rsv1 = false;
1767
- opcode = 0;
1768
- }
1769
- if (options.fin) this._firstFragment = true;
1770
- const opts = {
1771
- [kByteLength]: byteLength,
1772
- fin: options.fin,
1773
- generateMask: this._generateMask,
1774
- mask: options.mask,
1775
- maskBuffer: this._maskBuffer,
1776
- opcode,
1777
- readOnly,
1778
- rsv1
1779
- };
1780
- if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
1781
- this.getBlobData,
1782
- data,
1783
- this._compress,
1784
- opts,
1785
- cb
1786
- ]);
1787
- else this.getBlobData(data, this._compress, opts, cb);
1788
- else if (this._state !== DEFAULT) this.enqueue([
1789
- this.dispatch,
1790
- data,
1791
- this._compress,
1792
- opts,
1793
- cb
1794
- ]);
1795
- else this.dispatch(data, this._compress, opts, cb);
1796
- }
1797
- /**
1798
- * Gets the contents of a blob as binary data.
1799
- *
1800
- * @param {Blob} blob The blob
1801
- * @param {Boolean} [compress=false] Specifies whether or not to compress
1802
- * the data
1803
- * @param {Object} options Options object
1804
- * @param {Boolean} [options.fin=false] Specifies whether or not to set the
1805
- * FIN bit
1806
- * @param {Function} [options.generateMask] The function used to generate the
1807
- * masking key
1808
- * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1809
- * `data`
1810
- * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
1811
- * key
1812
- * @param {Number} options.opcode The opcode
1813
- * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
1814
- * modified
1815
- * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
1816
- * RSV1 bit
1817
- * @param {Function} [cb] Callback
1818
- * @private
1819
- */
1820
- getBlobData(blob, compress, options, cb) {
1821
- this._bufferedBytes += options[kByteLength];
1822
- this._state = GET_BLOB_DATA;
1823
- blob.arrayBuffer().then((arrayBuffer) => {
1824
- if (this._socket.destroyed) {
1825
- const err = /* @__PURE__ */ new Error("The socket was closed while the blob was being read");
1826
- process.nextTick(callCallbacks, this, err, cb);
1827
- return;
1828
- }
1829
- this._bufferedBytes -= options[kByteLength];
1830
- const data = toBuffer(arrayBuffer);
1831
- if (!compress) {
1832
- this._state = DEFAULT;
1833
- this.sendFrame(Sender.frame(data, options), cb);
1834
- this.dequeue();
1835
- } else this.dispatch(data, compress, options, cb);
1836
- }).catch((err) => {
1837
- process.nextTick(onError, this, err, cb);
1838
- });
1839
- }
1840
- /**
1841
- * Dispatches a message.
1842
- *
1843
- * @param {(Buffer|String)} data The message to send
1844
- * @param {Boolean} [compress=false] Specifies whether or not to compress
1845
- * `data`
1846
- * @param {Object} options Options object
1847
- * @param {Boolean} [options.fin=false] Specifies whether or not to set the
1848
- * FIN bit
1849
- * @param {Function} [options.generateMask] The function used to generate the
1850
- * masking key
1851
- * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1852
- * `data`
1853
- * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
1854
- * key
1855
- * @param {Number} options.opcode The opcode
1856
- * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
1857
- * modified
1858
- * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
1859
- * RSV1 bit
1860
- * @param {Function} [cb] Callback
1861
- * @private
1862
- */
1863
- dispatch(data, compress, options, cb) {
1864
- if (!compress) {
1865
- this.sendFrame(Sender.frame(data, options), cb);
1866
- return;
1867
- }
1868
- const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
1869
- this._bufferedBytes += options[kByteLength];
1870
- this._state = DEFLATING;
1871
- perMessageDeflate.compress(data, options.fin, (_, buf) => {
1872
- if (this._socket.destroyed) {
1873
- callCallbacks(this, /* @__PURE__ */ new Error("The socket was closed while data was being compressed"), cb);
1874
- return;
1875
- }
1876
- this._bufferedBytes -= options[kByteLength];
1877
- this._state = DEFAULT;
1878
- options.readOnly = false;
1879
- this.sendFrame(Sender.frame(buf, options), cb);
1880
- this.dequeue();
1881
- });
1882
- }
1883
- /**
1884
- * Executes queued send operations.
1885
- *
1886
- * @private
1887
- */
1888
- dequeue() {
1889
- while (this._state === DEFAULT && this._queue.length) {
1890
- const params = this._queue.shift();
1891
- this._bufferedBytes -= params[3][kByteLength];
1892
- Reflect.apply(params[0], this, params.slice(1));
1893
- }
1894
- }
1895
- /**
1896
- * Enqueues a send operation.
1897
- *
1898
- * @param {Array} params Send operation parameters.
1899
- * @private
1900
- */
1901
- enqueue(params) {
1902
- this._bufferedBytes += params[3][kByteLength];
1903
- this._queue.push(params);
1904
- }
1905
- /**
1906
- * Sends a frame.
1907
- *
1908
- * @param {(Buffer | String)[]} list The frame to send
1909
- * @param {Function} [cb] Callback
1910
- * @private
1911
- */
1912
- sendFrame(list, cb) {
1913
- if (list.length === 2) {
1914
- this._socket.cork();
1915
- this._socket.write(list[0]);
1916
- this._socket.write(list[1], cb);
1917
- this._socket.uncork();
1918
- } else this._socket.write(list[0], cb);
1919
- }
1920
- };
1921
- module.exports = Sender;
1922
- /**
1923
- * Calls queued callbacks with an error.
1924
- *
1925
- * @param {Sender} sender The `Sender` instance
1926
- * @param {Error} err The error to call the callbacks with
1927
- * @param {Function} [cb] The first callback
1928
- * @private
1929
- */
1930
- function callCallbacks(sender, err, cb) {
1931
- if (typeof cb === "function") cb(err);
1932
- for (let i = 0; i < sender._queue.length; i++) {
1933
- const params = sender._queue[i];
1934
- const callback = params[params.length - 1];
1935
- if (typeof callback === "function") callback(err);
1936
- }
1937
- }
1938
- /**
1939
- * Handles a `Sender` error.
1940
- *
1941
- * @param {Sender} sender The `Sender` instance
1942
- * @param {Error} err The error
1943
- * @param {Function} [cb] The first pending callback
1944
- * @private
1945
- */
1946
- function onError(sender, err, cb) {
1947
- callCallbacks(sender, err, cb);
1948
- sender.onerror(err);
1949
- }
1950
- }));
1951
-
1952
- //#endregion
1953
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/event-target.js
1954
- var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1955
- const { kForOnEventAttribute, kListener } = require_constants();
1956
- const kCode = Symbol("kCode");
1957
- const kData = Symbol("kData");
1958
- const kError = Symbol("kError");
1959
- const kMessage = Symbol("kMessage");
1960
- const kReason = Symbol("kReason");
1961
- const kTarget = Symbol("kTarget");
1962
- const kType = Symbol("kType");
1963
- const kWasClean = Symbol("kWasClean");
1964
- /**
1965
- * Class representing an event.
1966
- */
1967
- var Event = class {
1968
- /**
1969
- * Create a new `Event`.
1970
- *
1971
- * @param {String} type The name of the event
1972
- * @throws {TypeError} If the `type` argument is not specified
1973
- */
1974
- constructor(type) {
1975
- this[kTarget] = null;
1976
- this[kType] = type;
1977
- }
1978
- /**
1979
- * @type {*}
1980
- */
1981
- get target() {
1982
- return this[kTarget];
1983
- }
1984
- /**
1985
- * @type {String}
1986
- */
1987
- get type() {
1988
- return this[kType];
1989
- }
1990
- };
1991
- Object.defineProperty(Event.prototype, "target", { enumerable: true });
1992
- Object.defineProperty(Event.prototype, "type", { enumerable: true });
1993
- /**
1994
- * Class representing a close event.
1995
- *
1996
- * @extends Event
1997
- */
1998
- var CloseEvent = class extends Event {
1999
- /**
2000
- * Create a new `CloseEvent`.
2001
- *
2002
- * @param {String} type The name of the event
2003
- * @param {Object} [options] A dictionary object that allows for setting
2004
- * attributes via object members of the same name
2005
- * @param {Number} [options.code=0] The status code explaining why the
2006
- * connection was closed
2007
- * @param {String} [options.reason=''] A human-readable string explaining why
2008
- * the connection was closed
2009
- * @param {Boolean} [options.wasClean=false] Indicates whether or not the
2010
- * connection was cleanly closed
2011
- */
2012
- constructor(type, options = {}) {
2013
- super(type);
2014
- this[kCode] = options.code === void 0 ? 0 : options.code;
2015
- this[kReason] = options.reason === void 0 ? "" : options.reason;
2016
- this[kWasClean] = options.wasClean === void 0 ? false : options.wasClean;
2017
- }
2018
- /**
2019
- * @type {Number}
2020
- */
2021
- get code() {
2022
- return this[kCode];
2023
- }
2024
- /**
2025
- * @type {String}
2026
- */
2027
- get reason() {
2028
- return this[kReason];
2029
- }
2030
- /**
2031
- * @type {Boolean}
2032
- */
2033
- get wasClean() {
2034
- return this[kWasClean];
2035
- }
2036
- };
2037
- Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
2038
- Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
2039
- Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
2040
- /**
2041
- * Class representing an error event.
2042
- *
2043
- * @extends Event
2044
- */
2045
- var ErrorEvent = class extends Event {
2046
- /**
2047
- * Create a new `ErrorEvent`.
2048
- *
2049
- * @param {String} type The name of the event
2050
- * @param {Object} [options] A dictionary object that allows for setting
2051
- * attributes via object members of the same name
2052
- * @param {*} [options.error=null] The error that generated this event
2053
- * @param {String} [options.message=''] The error message
2054
- */
2055
- constructor(type, options = {}) {
2056
- super(type);
2057
- this[kError] = options.error === void 0 ? null : options.error;
2058
- this[kMessage] = options.message === void 0 ? "" : options.message;
2059
- }
2060
- /**
2061
- * @type {*}
2062
- */
2063
- get error() {
2064
- return this[kError];
2065
- }
2066
- /**
2067
- * @type {String}
2068
- */
2069
- get message() {
2070
- return this[kMessage];
2071
- }
2072
- };
2073
- Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
2074
- Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
2075
- /**
2076
- * Class representing a message event.
2077
- *
2078
- * @extends Event
2079
- */
2080
- var MessageEvent = class extends Event {
2081
- /**
2082
- * Create a new `MessageEvent`.
2083
- *
2084
- * @param {String} type The name of the event
2085
- * @param {Object} [options] A dictionary object that allows for setting
2086
- * attributes via object members of the same name
2087
- * @param {*} [options.data=null] The message content
2088
- */
2089
- constructor(type, options = {}) {
2090
- super(type);
2091
- this[kData] = options.data === void 0 ? null : options.data;
2092
- }
2093
- /**
2094
- * @type {*}
2095
- */
2096
- get data() {
2097
- return this[kData];
2098
- }
2099
- };
2100
- Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
2101
- /**
2102
- * This provides methods for emulating the `EventTarget` interface. It's not
2103
- * meant to be used directly.
2104
- *
2105
- * @mixin
2106
- */
2107
- const EventTarget = {
2108
- addEventListener(type, handler, options = {}) {
2109
- for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
2110
- let wrapper;
2111
- if (type === "message") wrapper = function onMessage(data, isBinary) {
2112
- const event = new MessageEvent("message", { data: isBinary ? data : data.toString() });
2113
- event[kTarget] = this;
2114
- callListener(handler, this, event);
2115
- };
2116
- else if (type === "close") wrapper = function onClose(code, message) {
2117
- const event = new CloseEvent("close", {
2118
- code,
2119
- reason: message.toString(),
2120
- wasClean: this._closeFrameReceived && this._closeFrameSent
2121
- });
2122
- event[kTarget] = this;
2123
- callListener(handler, this, event);
2124
- };
2125
- else if (type === "error") wrapper = function onError(error) {
2126
- const event = new ErrorEvent("error", {
2127
- error,
2128
- message: error.message
2129
- });
2130
- event[kTarget] = this;
2131
- callListener(handler, this, event);
2132
- };
2133
- else if (type === "open") wrapper = function onOpen() {
2134
- const event = new Event("open");
2135
- event[kTarget] = this;
2136
- callListener(handler, this, event);
2137
- };
2138
- else return;
2139
- wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
2140
- wrapper[kListener] = handler;
2141
- if (options.once) this.once(type, wrapper);
2142
- else this.on(type, wrapper);
2143
- },
2144
- removeEventListener(type, handler) {
2145
- for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
2146
- this.removeListener(type, listener);
2147
- break;
2148
- }
2149
- }
2150
- };
2151
- module.exports = {
2152
- CloseEvent,
2153
- ErrorEvent,
2154
- Event,
2155
- EventTarget,
2156
- MessageEvent
2157
- };
2158
- /**
2159
- * Call an event listener
2160
- *
2161
- * @param {(Function|Object)} listener The listener to call
2162
- * @param {*} thisArg The value to use as `this`` when calling the listener
2163
- * @param {Event} event The event to pass to the listener
2164
- * @private
2165
- */
2166
- function callListener(listener, thisArg, event) {
2167
- if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
2168
- else listener.call(thisArg, event);
2169
- }
2170
- }));
2171
-
2172
- //#endregion
2173
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/extension.js
2174
- var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2175
- const { tokenChars } = require_validation();
2176
- /**
2177
- * Adds an offer to the map of extension offers or a parameter to the map of
2178
- * parameters.
2179
- *
2180
- * @param {Object} dest The map of extension offers or parameters
2181
- * @param {String} name The extension or parameter name
2182
- * @param {(Object|Boolean|String)} elem The extension parameters or the
2183
- * parameter value
2184
- * @private
2185
- */
2186
- function push(dest, name, elem) {
2187
- if (dest[name] === void 0) dest[name] = [elem];
2188
- else dest[name].push(elem);
2189
- }
2190
- /**
2191
- * Parses the `Sec-WebSocket-Extensions` header into an object.
2192
- *
2193
- * @param {String} header The field value of the header
2194
- * @return {Object} The parsed object
2195
- * @public
2196
- */
2197
- function parse(header) {
2198
- const offers = Object.create(null);
2199
- let params = Object.create(null);
2200
- let mustUnescape = false;
2201
- let isEscaping = false;
2202
- let inQuotes = false;
2203
- let extensionName;
2204
- let paramName;
2205
- let start = -1;
2206
- let code = -1;
2207
- let end = -1;
2208
- let i = 0;
2209
- for (; i < header.length; i++) {
2210
- code = header.charCodeAt(i);
2211
- if (extensionName === void 0) if (end === -1 && tokenChars[code] === 1) {
2212
- if (start === -1) start = i;
2213
- } else if (i !== 0 && (code === 32 || code === 9)) {
2214
- if (end === -1 && start !== -1) end = i;
2215
- } else if (code === 59 || code === 44) {
2216
- if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
2217
- if (end === -1) end = i;
2218
- const name = header.slice(start, end);
2219
- if (code === 44) {
2220
- push(offers, name, params);
2221
- params = Object.create(null);
2222
- } else extensionName = name;
2223
- start = end = -1;
2224
- } else throw new SyntaxError(`Unexpected character at index ${i}`);
2225
- else if (paramName === void 0) if (end === -1 && tokenChars[code] === 1) {
2226
- if (start === -1) start = i;
2227
- } else if (code === 32 || code === 9) {
2228
- if (end === -1 && start !== -1) end = i;
2229
- } else if (code === 59 || code === 44) {
2230
- if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
2231
- if (end === -1) end = i;
2232
- push(params, header.slice(start, end), true);
2233
- if (code === 44) {
2234
- push(offers, extensionName, params);
2235
- params = Object.create(null);
2236
- extensionName = void 0;
2237
- }
2238
- start = end = -1;
2239
- } else if (code === 61 && start !== -1 && end === -1) {
2240
- paramName = header.slice(start, i);
2241
- start = end = -1;
2242
- } else throw new SyntaxError(`Unexpected character at index ${i}`);
2243
- else if (isEscaping) {
2244
- if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
2245
- if (start === -1) start = i;
2246
- else if (!mustUnescape) mustUnescape = true;
2247
- isEscaping = false;
2248
- } else if (inQuotes) if (tokenChars[code] === 1) {
2249
- if (start === -1) start = i;
2250
- } else if (code === 34 && start !== -1) {
2251
- inQuotes = false;
2252
- end = i;
2253
- } else if (code === 92) isEscaping = true;
2254
- else throw new SyntaxError(`Unexpected character at index ${i}`);
2255
- else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
2256
- else if (end === -1 && tokenChars[code] === 1) {
2257
- if (start === -1) start = i;
2258
- } else if (start !== -1 && (code === 32 || code === 9)) {
2259
- if (end === -1) end = i;
2260
- } else if (code === 59 || code === 44) {
2261
- if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
2262
- if (end === -1) end = i;
2263
- let value = header.slice(start, end);
2264
- if (mustUnescape) {
2265
- value = value.replace(/\\/g, "");
2266
- mustUnescape = false;
2267
- }
2268
- push(params, paramName, value);
2269
- if (code === 44) {
2270
- push(offers, extensionName, params);
2271
- params = Object.create(null);
2272
- extensionName = void 0;
2273
- }
2274
- paramName = void 0;
2275
- start = end = -1;
2276
- } else throw new SyntaxError(`Unexpected character at index ${i}`);
2277
- }
2278
- if (start === -1 || inQuotes || code === 32 || code === 9) throw new SyntaxError("Unexpected end of input");
2279
- if (end === -1) end = i;
2280
- const token = header.slice(start, end);
2281
- if (extensionName === void 0) push(offers, token, params);
2282
- else {
2283
- if (paramName === void 0) push(params, token, true);
2284
- else if (mustUnescape) push(params, paramName, token.replace(/\\/g, ""));
2285
- else push(params, paramName, token);
2286
- push(offers, extensionName, params);
2287
- }
2288
- return offers;
2289
- }
2290
- /**
2291
- * Builds the `Sec-WebSocket-Extensions` header field value.
2292
- *
2293
- * @param {Object} extensions The map of extensions and parameters to format
2294
- * @return {String} A string representing the given object
2295
- * @public
2296
- */
2297
- function format(extensions) {
2298
- return Object.keys(extensions).map((extension) => {
2299
- let configurations = extensions[extension];
2300
- if (!Array.isArray(configurations)) configurations = [configurations];
2301
- return configurations.map((params) => {
2302
- return [extension].concat(Object.keys(params).map((k) => {
2303
- let values = params[k];
2304
- if (!Array.isArray(values)) values = [values];
2305
- return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
2306
- })).join("; ");
2307
- }).join(", ");
2308
- }).join(", ");
2309
- }
2310
- module.exports = {
2311
- format,
2312
- parse
2313
- };
2314
- }));
2315
-
2316
- //#endregion
2317
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/websocket.js
2318
- var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2319
- const EventEmitter$1 = __require("events");
2320
- const https = __require("https");
2321
- const http$2 = __require("http");
2322
- const net = __require("net");
2323
- const tls = __require("tls");
2324
- const { randomBytes, createHash: createHash$1 } = __require("crypto");
2325
- const { Duplex: Duplex$3, Readable: Readable$1 } = __require("stream");
2326
- const { URL } = __require("url");
2327
- const PerMessageDeflate = require_permessage_deflate();
2328
- const Receiver = require_receiver();
2329
- const Sender = require_sender();
2330
- const { isBlob } = require_validation();
2331
- const { BINARY_TYPES, CLOSE_TIMEOUT, EMPTY_BUFFER, GUID, kForOnEventAttribute, kListener, kStatusCode, kWebSocket, NOOP } = require_constants();
2332
- const { EventTarget: { addEventListener, removeEventListener } } = require_event_target();
2333
- const { format, parse } = require_extension();
2334
- const { toBuffer } = require_buffer_util();
2335
- const kAborted = Symbol("kAborted");
2336
- const protocolVersions = [8, 13];
2337
- const readyStates = [
2338
- "CONNECTING",
2339
- "OPEN",
2340
- "CLOSING",
2341
- "CLOSED"
2342
- ];
2343
- const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
2344
- /**
2345
- * Class representing a WebSocket.
2346
- *
2347
- * @extends EventEmitter
2348
- */
2349
- var WebSocket = class WebSocket extends EventEmitter$1 {
2350
- /**
2351
- * Create a new `WebSocket`.
2352
- *
2353
- * @param {(String|URL)} address The URL to which to connect
2354
- * @param {(String|String[])} [protocols] The subprotocols
2355
- * @param {Object} [options] Connection options
2356
- */
2357
- constructor(address, protocols, options) {
2358
- super();
2359
- this._binaryType = BINARY_TYPES[0];
2360
- this._closeCode = 1006;
2361
- this._closeFrameReceived = false;
2362
- this._closeFrameSent = false;
2363
- this._closeMessage = EMPTY_BUFFER;
2364
- this._closeTimer = null;
2365
- this._errorEmitted = false;
2366
- this._extensions = {};
2367
- this._paused = false;
2368
- this._protocol = "";
2369
- this._readyState = WebSocket.CONNECTING;
2370
- this._receiver = null;
2371
- this._sender = null;
2372
- this._socket = null;
2373
- if (address !== null) {
2374
- this._bufferedAmount = 0;
2375
- this._isServer = false;
2376
- this._redirects = 0;
2377
- if (protocols === void 0) protocols = [];
2378
- else if (!Array.isArray(protocols)) if (typeof protocols === "object" && protocols !== null) {
2379
- options = protocols;
2380
- protocols = [];
2381
- } else protocols = [protocols];
2382
- initAsClient(this, address, protocols, options);
2383
- } else {
2384
- this._autoPong = options.autoPong;
2385
- this._closeTimeout = options.closeTimeout;
2386
- this._isServer = true;
2387
- }
2388
- }
2389
- /**
2390
- * For historical reasons, the custom "nodebuffer" type is used by the default
2391
- * instead of "blob".
2392
- *
2393
- * @type {String}
2394
- */
2395
- get binaryType() {
2396
- return this._binaryType;
2397
- }
2398
- set binaryType(type) {
2399
- if (!BINARY_TYPES.includes(type)) return;
2400
- this._binaryType = type;
2401
- if (this._receiver) this._receiver._binaryType = type;
2402
- }
2403
- /**
2404
- * @type {Number}
2405
- */
2406
- get bufferedAmount() {
2407
- if (!this._socket) return this._bufferedAmount;
2408
- return this._socket._writableState.length + this._sender._bufferedBytes;
2409
- }
2410
- /**
2411
- * @type {String}
2412
- */
2413
- get extensions() {
2414
- return Object.keys(this._extensions).join();
2415
- }
2416
- /**
2417
- * @type {Boolean}
2418
- */
2419
- get isPaused() {
2420
- return this._paused;
2421
- }
2422
- /**
2423
- * @type {Function}
2424
- */
2425
- /* istanbul ignore next */
2426
- get onclose() {
2427
- return null;
2428
- }
2429
- /**
2430
- * @type {Function}
2431
- */
2432
- /* istanbul ignore next */
2433
- get onerror() {
2434
- return null;
2435
- }
2436
- /**
2437
- * @type {Function}
2438
- */
2439
- /* istanbul ignore next */
2440
- get onopen() {
2441
- return null;
2442
- }
2443
- /**
2444
- * @type {Function}
2445
- */
2446
- /* istanbul ignore next */
2447
- get onmessage() {
2448
- return null;
2449
- }
2450
- /**
2451
- * @type {String}
2452
- */
2453
- get protocol() {
2454
- return this._protocol;
2455
- }
2456
- /**
2457
- * @type {Number}
2458
- */
2459
- get readyState() {
2460
- return this._readyState;
2461
- }
2462
- /**
2463
- * @type {String}
2464
- */
2465
- get url() {
2466
- return this._url;
2467
- }
2468
- /**
2469
- * Set up the socket and the internal resources.
2470
- *
2471
- * @param {Duplex} socket The network socket between the server and client
2472
- * @param {Buffer} head The first packet of the upgraded stream
2473
- * @param {Object} options Options object
2474
- * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
2475
- * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
2476
- * multiple times in the same tick
2477
- * @param {Function} [options.generateMask] The function used to generate the
2478
- * masking key
2479
- * @param {Number} [options.maxPayload=0] The maximum allowed message size
2480
- * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
2481
- * not to skip UTF-8 validation for text and close messages
2482
- * @private
2483
- */
2484
- setSocket(socket, head, options) {
2485
- const receiver = new Receiver({
2486
- allowSynchronousEvents: options.allowSynchronousEvents,
2487
- binaryType: this.binaryType,
2488
- extensions: this._extensions,
2489
- isServer: this._isServer,
2490
- maxPayload: options.maxPayload,
2491
- skipUTF8Validation: options.skipUTF8Validation
2492
- });
2493
- const sender = new Sender(socket, this._extensions, options.generateMask);
2494
- this._receiver = receiver;
2495
- this._sender = sender;
2496
- this._socket = socket;
2497
- receiver[kWebSocket] = this;
2498
- sender[kWebSocket] = this;
2499
- socket[kWebSocket] = this;
2500
- receiver.on("conclude", receiverOnConclude);
2501
- receiver.on("drain", receiverOnDrain);
2502
- receiver.on("error", receiverOnError);
2503
- receiver.on("message", receiverOnMessage);
2504
- receiver.on("ping", receiverOnPing);
2505
- receiver.on("pong", receiverOnPong);
2506
- sender.onerror = senderOnError;
2507
- if (socket.setTimeout) socket.setTimeout(0);
2508
- if (socket.setNoDelay) socket.setNoDelay();
2509
- if (head.length > 0) socket.unshift(head);
2510
- socket.on("close", socketOnClose);
2511
- socket.on("data", socketOnData);
2512
- socket.on("end", socketOnEnd);
2513
- socket.on("error", socketOnError);
2514
- this._readyState = WebSocket.OPEN;
2515
- this.emit("open");
2516
- }
2517
- /**
2518
- * Emit the `'close'` event.
2519
- *
2520
- * @private
2521
- */
2522
- emitClose() {
2523
- if (!this._socket) {
2524
- this._readyState = WebSocket.CLOSED;
2525
- this.emit("close", this._closeCode, this._closeMessage);
2526
- return;
2527
- }
2528
- if (this._extensions[PerMessageDeflate.extensionName]) this._extensions[PerMessageDeflate.extensionName].cleanup();
2529
- this._receiver.removeAllListeners();
2530
- this._readyState = WebSocket.CLOSED;
2531
- this.emit("close", this._closeCode, this._closeMessage);
2532
- }
2533
- /**
2534
- * Start a closing handshake.
2535
- *
2536
- * +----------+ +-----------+ +----------+
2537
- * - - -|ws.close()|-->|close frame|-->|ws.close()|- - -
2538
- * | +----------+ +-----------+ +----------+ |
2539
- * +----------+ +-----------+ |
2540
- * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING
2541
- * +----------+ +-----------+ |
2542
- * | | | +---+ |
2543
- * +------------------------+-->|fin| - - - -
2544
- * | +---+ | +---+
2545
- * - - - - -|fin|<---------------------+
2546
- * +---+
2547
- *
2548
- * @param {Number} [code] Status code explaining why the connection is closing
2549
- * @param {(String|Buffer)} [data] The reason why the connection is
2550
- * closing
2551
- * @public
2552
- */
2553
- close(code, data) {
2554
- if (this.readyState === WebSocket.CLOSED) return;
2555
- if (this.readyState === WebSocket.CONNECTING) {
2556
- abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
2557
- return;
2558
- }
2559
- if (this.readyState === WebSocket.CLOSING) {
2560
- if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
2561
- return;
2562
- }
2563
- this._readyState = WebSocket.CLOSING;
2564
- this._sender.close(code, data, !this._isServer, (err) => {
2565
- if (err) return;
2566
- this._closeFrameSent = true;
2567
- if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
2568
- });
2569
- setCloseTimer(this);
2570
- }
2571
- /**
2572
- * Pause the socket.
2573
- *
2574
- * @public
2575
- */
2576
- pause() {
2577
- if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
2578
- this._paused = true;
2579
- this._socket.pause();
2580
- }
2581
- /**
2582
- * Send a ping.
2583
- *
2584
- * @param {*} [data] The data to send
2585
- * @param {Boolean} [mask] Indicates whether or not to mask `data`
2586
- * @param {Function} [cb] Callback which is executed when the ping is sent
2587
- * @public
2588
- */
2589
- ping(data, mask, cb) {
2590
- if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2591
- if (typeof data === "function") {
2592
- cb = data;
2593
- data = mask = void 0;
2594
- } else if (typeof mask === "function") {
2595
- cb = mask;
2596
- mask = void 0;
2597
- }
2598
- if (typeof data === "number") data = data.toString();
2599
- if (this.readyState !== WebSocket.OPEN) {
2600
- sendAfterClose(this, data, cb);
2601
- return;
2602
- }
2603
- if (mask === void 0) mask = !this._isServer;
2604
- this._sender.ping(data || EMPTY_BUFFER, mask, cb);
2605
- }
2606
- /**
2607
- * Send a pong.
2608
- *
2609
- * @param {*} [data] The data to send
2610
- * @param {Boolean} [mask] Indicates whether or not to mask `data`
2611
- * @param {Function} [cb] Callback which is executed when the pong is sent
2612
- * @public
2613
- */
2614
- pong(data, mask, cb) {
2615
- if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2616
- if (typeof data === "function") {
2617
- cb = data;
2618
- data = mask = void 0;
2619
- } else if (typeof mask === "function") {
2620
- cb = mask;
2621
- mask = void 0;
2622
- }
2623
- if (typeof data === "number") data = data.toString();
2624
- if (this.readyState !== WebSocket.OPEN) {
2625
- sendAfterClose(this, data, cb);
2626
- return;
2627
- }
2628
- if (mask === void 0) mask = !this._isServer;
2629
- this._sender.pong(data || EMPTY_BUFFER, mask, cb);
2630
- }
2631
- /**
2632
- * Resume the socket.
2633
- *
2634
- * @public
2635
- */
2636
- resume() {
2637
- if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
2638
- this._paused = false;
2639
- if (!this._receiver._writableState.needDrain) this._socket.resume();
2640
- }
2641
- /**
2642
- * Send a data message.
2643
- *
2644
- * @param {*} data The message to send
2645
- * @param {Object} [options] Options object
2646
- * @param {Boolean} [options.binary] Specifies whether `data` is binary or
2647
- * text
2648
- * @param {Boolean} [options.compress] Specifies whether or not to compress
2649
- * `data`
2650
- * @param {Boolean} [options.fin=true] Specifies whether the fragment is the
2651
- * last one
2652
- * @param {Boolean} [options.mask] Specifies whether or not to mask `data`
2653
- * @param {Function} [cb] Callback which is executed when data is written out
2654
- * @public
2655
- */
2656
- send(data, options, cb) {
2657
- if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2658
- if (typeof options === "function") {
2659
- cb = options;
2660
- options = {};
2661
- }
2662
- if (typeof data === "number") data = data.toString();
2663
- if (this.readyState !== WebSocket.OPEN) {
2664
- sendAfterClose(this, data, cb);
2665
- return;
2666
- }
2667
- const opts = {
2668
- binary: typeof data !== "string",
2669
- mask: !this._isServer,
2670
- compress: true,
2671
- fin: true,
2672
- ...options
2673
- };
2674
- if (!this._extensions[PerMessageDeflate.extensionName]) opts.compress = false;
2675
- this._sender.send(data || EMPTY_BUFFER, opts, cb);
2676
- }
2677
- /**
2678
- * Forcibly close the connection.
2679
- *
2680
- * @public
2681
- */
2682
- terminate() {
2683
- if (this.readyState === WebSocket.CLOSED) return;
2684
- if (this.readyState === WebSocket.CONNECTING) {
2685
- abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
2686
- return;
2687
- }
2688
- if (this._socket) {
2689
- this._readyState = WebSocket.CLOSING;
2690
- this._socket.destroy();
2691
- }
2692
- }
2693
- };
2694
- /**
2695
- * @constant {Number} CONNECTING
2696
- * @memberof WebSocket
2697
- */
2698
- Object.defineProperty(WebSocket, "CONNECTING", {
2699
- enumerable: true,
2700
- value: readyStates.indexOf("CONNECTING")
2701
- });
2702
- /**
2703
- * @constant {Number} CONNECTING
2704
- * @memberof WebSocket.prototype
2705
- */
2706
- Object.defineProperty(WebSocket.prototype, "CONNECTING", {
2707
- enumerable: true,
2708
- value: readyStates.indexOf("CONNECTING")
2709
- });
2710
- /**
2711
- * @constant {Number} OPEN
2712
- * @memberof WebSocket
2713
- */
2714
- Object.defineProperty(WebSocket, "OPEN", {
2715
- enumerable: true,
2716
- value: readyStates.indexOf("OPEN")
2717
- });
2718
- /**
2719
- * @constant {Number} OPEN
2720
- * @memberof WebSocket.prototype
2721
- */
2722
- Object.defineProperty(WebSocket.prototype, "OPEN", {
2723
- enumerable: true,
2724
- value: readyStates.indexOf("OPEN")
2725
- });
2726
- /**
2727
- * @constant {Number} CLOSING
2728
- * @memberof WebSocket
2729
- */
2730
- Object.defineProperty(WebSocket, "CLOSING", {
2731
- enumerable: true,
2732
- value: readyStates.indexOf("CLOSING")
2733
- });
2734
- /**
2735
- * @constant {Number} CLOSING
2736
- * @memberof WebSocket.prototype
2737
- */
2738
- Object.defineProperty(WebSocket.prototype, "CLOSING", {
2739
- enumerable: true,
2740
- value: readyStates.indexOf("CLOSING")
2741
- });
2742
- /**
2743
- * @constant {Number} CLOSED
2744
- * @memberof WebSocket
2745
- */
2746
- Object.defineProperty(WebSocket, "CLOSED", {
2747
- enumerable: true,
2748
- value: readyStates.indexOf("CLOSED")
2749
- });
2750
- /**
2751
- * @constant {Number} CLOSED
2752
- * @memberof WebSocket.prototype
2753
- */
2754
- Object.defineProperty(WebSocket.prototype, "CLOSED", {
2755
- enumerable: true,
2756
- value: readyStates.indexOf("CLOSED")
2757
- });
2758
- [
2759
- "binaryType",
2760
- "bufferedAmount",
2761
- "extensions",
2762
- "isPaused",
2763
- "protocol",
2764
- "readyState",
2765
- "url"
2766
- ].forEach((property) => {
2767
- Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
2768
- });
2769
- [
2770
- "open",
2771
- "error",
2772
- "close",
2773
- "message"
2774
- ].forEach((method) => {
2775
- Object.defineProperty(WebSocket.prototype, `on${method}`, {
2776
- enumerable: true,
2777
- get() {
2778
- for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) return listener[kListener];
2779
- return null;
2780
- },
2781
- set(handler) {
2782
- for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) {
2783
- this.removeListener(method, listener);
2784
- break;
2785
- }
2786
- if (typeof handler !== "function") return;
2787
- this.addEventListener(method, handler, { [kForOnEventAttribute]: true });
2788
- }
2789
- });
2790
- });
2791
- WebSocket.prototype.addEventListener = addEventListener;
2792
- WebSocket.prototype.removeEventListener = removeEventListener;
2793
- module.exports = WebSocket;
2794
- /**
2795
- * Initialize a WebSocket client.
2796
- *
2797
- * @param {WebSocket} websocket The client to initialize
2798
- * @param {(String|URL)} address The URL to which to connect
2799
- * @param {Array} protocols The subprotocols
2800
- * @param {Object} [options] Connection options
2801
- * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether any
2802
- * of the `'message'`, `'ping'`, and `'pong'` events can be emitted multiple
2803
- * times in the same tick
2804
- * @param {Boolean} [options.autoPong=true] Specifies whether or not to
2805
- * automatically send a pong in response to a ping
2806
- * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to wait
2807
- * for the closing handshake to finish after `websocket.close()` is called
2808
- * @param {Function} [options.finishRequest] A function which can be used to
2809
- * customize the headers of each http request before it is sent
2810
- * @param {Boolean} [options.followRedirects=false] Whether or not to follow
2811
- * redirects
2812
- * @param {Function} [options.generateMask] The function used to generate the
2813
- * masking key
2814
- * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
2815
- * handshake request
2816
- * @param {Number} [options.maxPayload=104857600] The maximum allowed message
2817
- * size
2818
- * @param {Number} [options.maxRedirects=10] The maximum number of redirects
2819
- * allowed
2820
- * @param {String} [options.origin] Value of the `Origin` or
2821
- * `Sec-WebSocket-Origin` header
2822
- * @param {(Boolean|Object)} [options.perMessageDeflate=true] Enable/disable
2823
- * permessage-deflate
2824
- * @param {Number} [options.protocolVersion=13] Value of the
2825
- * `Sec-WebSocket-Version` header
2826
- * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
2827
- * not to skip UTF-8 validation for text and close messages
2828
- * @private
2829
- */
2830
- function initAsClient(websocket, address, protocols, options) {
2831
- const opts = {
2832
- allowSynchronousEvents: true,
2833
- autoPong: true,
2834
- closeTimeout: CLOSE_TIMEOUT,
2835
- protocolVersion: protocolVersions[1],
2836
- maxPayload: 100 * 1024 * 1024,
2837
- skipUTF8Validation: false,
2838
- perMessageDeflate: true,
2839
- followRedirects: false,
2840
- maxRedirects: 10,
2841
- ...options,
2842
- socketPath: void 0,
2843
- hostname: void 0,
2844
- protocol: void 0,
2845
- timeout: void 0,
2846
- method: "GET",
2847
- host: void 0,
2848
- path: void 0,
2849
- port: void 0
2850
- };
2851
- websocket._autoPong = opts.autoPong;
2852
- websocket._closeTimeout = opts.closeTimeout;
2853
- if (!protocolVersions.includes(opts.protocolVersion)) throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);
2854
- let parsedUrl;
2855
- if (address instanceof URL) parsedUrl = address;
2856
- else try {
2857
- parsedUrl = new URL(address);
2858
- } catch (e) {
2859
- throw new SyntaxError(`Invalid URL: ${address}`);
2860
- }
2861
- if (parsedUrl.protocol === "http:") parsedUrl.protocol = "ws:";
2862
- else if (parsedUrl.protocol === "https:") parsedUrl.protocol = "wss:";
2863
- websocket._url = parsedUrl.href;
2864
- const isSecure = parsedUrl.protocol === "wss:";
2865
- const isIpcUrl = parsedUrl.protocol === "ws+unix:";
2866
- let invalidUrlMessage;
2867
- if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) invalidUrlMessage = "The URL's protocol must be one of \"ws:\", \"wss:\", \"http:\", \"https:\", or \"ws+unix:\"";
2868
- else if (isIpcUrl && !parsedUrl.pathname) invalidUrlMessage = "The URL's pathname is empty";
2869
- else if (parsedUrl.hash) invalidUrlMessage = "The URL contains a fragment identifier";
2870
- if (invalidUrlMessage) {
2871
- const err = new SyntaxError(invalidUrlMessage);
2872
- if (websocket._redirects === 0) throw err;
2873
- else {
2874
- emitErrorAndClose(websocket, err);
2875
- return;
2876
- }
2877
- }
2878
- const defaultPort = isSecure ? 443 : 80;
2879
- const key = randomBytes(16).toString("base64");
2880
- const request = isSecure ? https.request : http$2.request;
2881
- const protocolSet = /* @__PURE__ */ new Set();
2882
- let perMessageDeflate;
2883
- opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
2884
- opts.defaultPort = opts.defaultPort || defaultPort;
2885
- opts.port = parsedUrl.port || defaultPort;
2886
- opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
2887
- opts.headers = {
2888
- ...opts.headers,
2889
- "Sec-WebSocket-Version": opts.protocolVersion,
2890
- "Sec-WebSocket-Key": key,
2891
- Connection: "Upgrade",
2892
- Upgrade: "websocket"
2893
- };
2894
- opts.path = parsedUrl.pathname + parsedUrl.search;
2895
- opts.timeout = opts.handshakeTimeout;
2896
- if (opts.perMessageDeflate) {
2897
- perMessageDeflate = new PerMessageDeflate(opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, false, opts.maxPayload);
2898
- opts.headers["Sec-WebSocket-Extensions"] = format({ [PerMessageDeflate.extensionName]: perMessageDeflate.offer() });
2899
- }
2900
- if (protocols.length) {
2901
- for (const protocol of protocols) {
2902
- if (typeof protocol !== "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol)) throw new SyntaxError("An invalid or duplicated subprotocol was specified");
2903
- protocolSet.add(protocol);
2904
- }
2905
- opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
2906
- }
2907
- if (opts.origin) if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
2908
- else opts.headers.Origin = opts.origin;
2909
- if (parsedUrl.username || parsedUrl.password) opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
2910
- if (isIpcUrl) {
2911
- const parts = opts.path.split(":");
2912
- opts.socketPath = parts[0];
2913
- opts.path = parts[1];
2914
- }
2915
- let req;
2916
- if (opts.followRedirects) {
2917
- if (websocket._redirects === 0) {
2918
- websocket._originalIpc = isIpcUrl;
2919
- websocket._originalSecure = isSecure;
2920
- websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
2921
- const headers = options && options.headers;
2922
- options = {
2923
- ...options,
2924
- headers: {}
2925
- };
2926
- if (headers) for (const [key, value] of Object.entries(headers)) options.headers[key.toLowerCase()] = value;
2927
- } else if (websocket.listenerCount("redirect") === 0) {
2928
- const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
2929
- if (!isSameHost || websocket._originalSecure && !isSecure) {
2930
- delete opts.headers.authorization;
2931
- delete opts.headers.cookie;
2932
- if (!isSameHost) delete opts.headers.host;
2933
- opts.auth = void 0;
2934
- }
2935
- }
2936
- if (opts.auth && !options.headers.authorization) options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
2937
- req = websocket._req = request(opts);
2938
- if (websocket._redirects) websocket.emit("redirect", websocket.url, req);
2939
- } else req = websocket._req = request(opts);
2940
- if (opts.timeout) req.on("timeout", () => {
2941
- abortHandshake(websocket, req, "Opening handshake has timed out");
2942
- });
2943
- req.on("error", (err) => {
2944
- if (req === null || req[kAborted]) return;
2945
- req = websocket._req = null;
2946
- emitErrorAndClose(websocket, err);
2947
- });
2948
- req.on("response", (res) => {
2949
- const location = res.headers.location;
2950
- const statusCode = res.statusCode;
2951
- if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
2952
- if (++websocket._redirects > opts.maxRedirects) {
2953
- abortHandshake(websocket, req, "Maximum redirects exceeded");
2954
- return;
2955
- }
2956
- req.abort();
2957
- let addr;
2958
- try {
2959
- addr = new URL(location, address);
2960
- } catch (e) {
2961
- emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`));
2962
- return;
2963
- }
2964
- initAsClient(websocket, addr, protocols, options);
2965
- } else if (!websocket.emit("unexpected-response", req, res)) abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
2966
- });
2967
- req.on("upgrade", (res, socket, head) => {
2968
- websocket.emit("upgrade", res);
2969
- if (websocket.readyState !== WebSocket.CONNECTING) return;
2970
- req = websocket._req = null;
2971
- const upgrade = res.headers.upgrade;
2972
- if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
2973
- abortHandshake(websocket, socket, "Invalid Upgrade header");
2974
- return;
2975
- }
2976
- const digest = createHash$1("sha1").update(key + GUID).digest("base64");
2977
- if (res.headers["sec-websocket-accept"] !== digest) {
2978
- abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
2979
- return;
2980
- }
2981
- const serverProt = res.headers["sec-websocket-protocol"];
2982
- let protError;
2983
- if (serverProt !== void 0) {
2984
- if (!protocolSet.size) protError = "Server sent a subprotocol but none was requested";
2985
- else if (!protocolSet.has(serverProt)) protError = "Server sent an invalid subprotocol";
2986
- } else if (protocolSet.size) protError = "Server sent no subprotocol";
2987
- if (protError) {
2988
- abortHandshake(websocket, socket, protError);
2989
- return;
2990
- }
2991
- if (serverProt) websocket._protocol = serverProt;
2992
- const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
2993
- if (secWebSocketExtensions !== void 0) {
2994
- if (!perMessageDeflate) {
2995
- abortHandshake(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
2996
- return;
2997
- }
2998
- let extensions;
2999
- try {
3000
- extensions = parse(secWebSocketExtensions);
3001
- } catch (err) {
3002
- abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
3003
- return;
3004
- }
3005
- const extensionNames = Object.keys(extensions);
3006
- if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
3007
- abortHandshake(websocket, socket, "Server indicated an extension that was not requested");
3008
- return;
3009
- }
3010
- try {
3011
- perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
3012
- } catch (err) {
3013
- abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
3014
- return;
3015
- }
3016
- websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
3017
- }
3018
- websocket.setSocket(socket, head, {
3019
- allowSynchronousEvents: opts.allowSynchronousEvents,
3020
- generateMask: opts.generateMask,
3021
- maxPayload: opts.maxPayload,
3022
- skipUTF8Validation: opts.skipUTF8Validation
3023
- });
3024
- });
3025
- if (opts.finishRequest) opts.finishRequest(req, websocket);
3026
- else req.end();
3027
- }
3028
- /**
3029
- * Emit the `'error'` and `'close'` events.
3030
- *
3031
- * @param {WebSocket} websocket The WebSocket instance
3032
- * @param {Error} The error to emit
3033
- * @private
3034
- */
3035
- function emitErrorAndClose(websocket, err) {
3036
- websocket._readyState = WebSocket.CLOSING;
3037
- websocket._errorEmitted = true;
3038
- websocket.emit("error", err);
3039
- websocket.emitClose();
3040
- }
3041
- /**
3042
- * Create a `net.Socket` and initiate a connection.
3043
- *
3044
- * @param {Object} options Connection options
3045
- * @return {net.Socket} The newly created socket used to start the connection
3046
- * @private
3047
- */
3048
- function netConnect(options) {
3049
- options.path = options.socketPath;
3050
- return net.connect(options);
3051
- }
3052
- /**
3053
- * Create a `tls.TLSSocket` and initiate a connection.
3054
- *
3055
- * @param {Object} options Connection options
3056
- * @return {tls.TLSSocket} The newly created socket used to start the connection
3057
- * @private
3058
- */
3059
- function tlsConnect(options) {
3060
- options.path = void 0;
3061
- if (!options.servername && options.servername !== "") options.servername = net.isIP(options.host) ? "" : options.host;
3062
- return tls.connect(options);
3063
- }
3064
- /**
3065
- * Abort the handshake and emit an error.
3066
- *
3067
- * @param {WebSocket} websocket The WebSocket instance
3068
- * @param {(http.ClientRequest|net.Socket|tls.Socket)} stream The request to
3069
- * abort or the socket to destroy
3070
- * @param {String} message The error message
3071
- * @private
3072
- */
3073
- function abortHandshake(websocket, stream, message) {
3074
- websocket._readyState = WebSocket.CLOSING;
3075
- const err = new Error(message);
3076
- Error.captureStackTrace(err, abortHandshake);
3077
- if (stream.setHeader) {
3078
- stream[kAborted] = true;
3079
- stream.abort();
3080
- if (stream.socket && !stream.socket.destroyed) stream.socket.destroy();
3081
- process.nextTick(emitErrorAndClose, websocket, err);
3082
- } else {
3083
- stream.destroy(err);
3084
- stream.once("error", websocket.emit.bind(websocket, "error"));
3085
- stream.once("close", websocket.emitClose.bind(websocket));
3086
- }
3087
- }
3088
- /**
3089
- * Handle cases where the `ping()`, `pong()`, or `send()` methods are called
3090
- * when the `readyState` attribute is `CLOSING` or `CLOSED`.
3091
- *
3092
- * @param {WebSocket} websocket The WebSocket instance
3093
- * @param {*} [data] The data to send
3094
- * @param {Function} [cb] Callback
3095
- * @private
3096
- */
3097
- function sendAfterClose(websocket, data, cb) {
3098
- if (data) {
3099
- const length = isBlob(data) ? data.size : toBuffer(data).length;
3100
- if (websocket._socket) websocket._sender._bufferedBytes += length;
3101
- else websocket._bufferedAmount += length;
3102
- }
3103
- if (cb) {
3104
- const err = /* @__PURE__ */ new Error(`WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})`);
3105
- process.nextTick(cb, err);
3106
- }
3107
- }
3108
- /**
3109
- * The listener of the `Receiver` `'conclude'` event.
3110
- *
3111
- * @param {Number} code The status code
3112
- * @param {Buffer} reason The reason for closing
3113
- * @private
3114
- */
3115
- function receiverOnConclude(code, reason) {
3116
- const websocket = this[kWebSocket];
3117
- websocket._closeFrameReceived = true;
3118
- websocket._closeMessage = reason;
3119
- websocket._closeCode = code;
3120
- if (websocket._socket[kWebSocket] === void 0) return;
3121
- websocket._socket.removeListener("data", socketOnData);
3122
- process.nextTick(resume, websocket._socket);
3123
- if (code === 1005) websocket.close();
3124
- else websocket.close(code, reason);
3125
- }
3126
- /**
3127
- * The listener of the `Receiver` `'drain'` event.
3128
- *
3129
- * @private
3130
- */
3131
- function receiverOnDrain() {
3132
- const websocket = this[kWebSocket];
3133
- if (!websocket.isPaused) websocket._socket.resume();
3134
- }
3135
- /**
3136
- * The listener of the `Receiver` `'error'` event.
3137
- *
3138
- * @param {(RangeError|Error)} err The emitted error
3139
- * @private
3140
- */
3141
- function receiverOnError(err) {
3142
- const websocket = this[kWebSocket];
3143
- if (websocket._socket[kWebSocket] !== void 0) {
3144
- websocket._socket.removeListener("data", socketOnData);
3145
- process.nextTick(resume, websocket._socket);
3146
- websocket.close(err[kStatusCode]);
3147
- }
3148
- if (!websocket._errorEmitted) {
3149
- websocket._errorEmitted = true;
3150
- websocket.emit("error", err);
3151
- }
3152
- }
3153
- /**
3154
- * The listener of the `Receiver` `'finish'` event.
3155
- *
3156
- * @private
3157
- */
3158
- function receiverOnFinish() {
3159
- this[kWebSocket].emitClose();
3160
- }
3161
- /**
3162
- * The listener of the `Receiver` `'message'` event.
3163
- *
3164
- * @param {Buffer|ArrayBuffer|Buffer[])} data The message
3165
- * @param {Boolean} isBinary Specifies whether the message is binary or not
3166
- * @private
3167
- */
3168
- function receiverOnMessage(data, isBinary) {
3169
- this[kWebSocket].emit("message", data, isBinary);
3170
- }
3171
- /**
3172
- * The listener of the `Receiver` `'ping'` event.
3173
- *
3174
- * @param {Buffer} data The data included in the ping frame
3175
- * @private
3176
- */
3177
- function receiverOnPing(data) {
3178
- const websocket = this[kWebSocket];
3179
- if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
3180
- websocket.emit("ping", data);
3181
- }
3182
- /**
3183
- * The listener of the `Receiver` `'pong'` event.
3184
- *
3185
- * @param {Buffer} data The data included in the pong frame
3186
- * @private
3187
- */
3188
- function receiverOnPong(data) {
3189
- this[kWebSocket].emit("pong", data);
3190
- }
3191
- /**
3192
- * Resume a readable stream
3193
- *
3194
- * @param {Readable} stream The readable stream
3195
- * @private
3196
- */
3197
- function resume(stream) {
3198
- stream.resume();
3199
- }
3200
- /**
3201
- * The `Sender` error event handler.
3202
- *
3203
- * @param {Error} The error
3204
- * @private
3205
- */
3206
- function senderOnError(err) {
3207
- const websocket = this[kWebSocket];
3208
- if (websocket.readyState === WebSocket.CLOSED) return;
3209
- if (websocket.readyState === WebSocket.OPEN) {
3210
- websocket._readyState = WebSocket.CLOSING;
3211
- setCloseTimer(websocket);
3212
- }
3213
- this._socket.end();
3214
- if (!websocket._errorEmitted) {
3215
- websocket._errorEmitted = true;
3216
- websocket.emit("error", err);
3217
- }
3218
- }
3219
- /**
3220
- * Set a timer to destroy the underlying raw socket of a WebSocket.
3221
- *
3222
- * @param {WebSocket} websocket The WebSocket instance
3223
- * @private
3224
- */
3225
- function setCloseTimer(websocket) {
3226
- websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
3227
- }
3228
- /**
3229
- * The listener of the socket `'close'` event.
3230
- *
3231
- * @private
3232
- */
3233
- function socketOnClose() {
3234
- const websocket = this[kWebSocket];
3235
- this.removeListener("close", socketOnClose);
3236
- this.removeListener("data", socketOnData);
3237
- this.removeListener("end", socketOnEnd);
3238
- websocket._readyState = WebSocket.CLOSING;
3239
- if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
3240
- const chunk = this.read(this._readableState.length);
3241
- websocket._receiver.write(chunk);
3242
- }
3243
- websocket._receiver.end();
3244
- this[kWebSocket] = void 0;
3245
- clearTimeout(websocket._closeTimer);
3246
- if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) websocket.emitClose();
3247
- else {
3248
- websocket._receiver.on("error", receiverOnFinish);
3249
- websocket._receiver.on("finish", receiverOnFinish);
3250
- }
3251
- }
3252
- /**
3253
- * The listener of the socket `'data'` event.
3254
- *
3255
- * @param {Buffer} chunk A chunk of data
3256
- * @private
3257
- */
3258
- function socketOnData(chunk) {
3259
- if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
3260
- }
3261
- /**
3262
- * The listener of the socket `'end'` event.
3263
- *
3264
- * @private
3265
- */
3266
- function socketOnEnd() {
3267
- const websocket = this[kWebSocket];
3268
- websocket._readyState = WebSocket.CLOSING;
3269
- websocket._receiver.end();
3270
- this.end();
3271
- }
3272
- /**
3273
- * The listener of the socket `'error'` event.
3274
- *
3275
- * @private
3276
- */
3277
- function socketOnError() {
3278
- const websocket = this[kWebSocket];
3279
- this.removeListener("error", socketOnError);
3280
- this.on("error", NOOP);
3281
- if (websocket) {
3282
- websocket._readyState = WebSocket.CLOSING;
3283
- this.destroy();
3284
- }
3285
- }
3286
- }));
3287
-
3288
- //#endregion
3289
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/stream.js
3290
- var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3291
- require_websocket();
3292
- const { Duplex: Duplex$2 } = __require("stream");
3293
- /**
3294
- * Emits the `'close'` event on a stream.
3295
- *
3296
- * @param {Duplex} stream The stream.
3297
- * @private
3298
- */
3299
- function emitClose(stream) {
3300
- stream.emit("close");
3301
- }
3302
- /**
3303
- * The listener of the `'end'` event.
3304
- *
3305
- * @private
3306
- */
3307
- function duplexOnEnd() {
3308
- if (!this.destroyed && this._writableState.finished) this.destroy();
3309
- }
3310
- /**
3311
- * The listener of the `'error'` event.
3312
- *
3313
- * @param {Error} err The error
3314
- * @private
3315
- */
3316
- function duplexOnError(err) {
3317
- this.removeListener("error", duplexOnError);
3318
- this.destroy();
3319
- if (this.listenerCount("error") === 0) this.emit("error", err);
3320
- }
3321
- /**
3322
- * Wraps a `WebSocket` in a duplex stream.
3323
- *
3324
- * @param {WebSocket} ws The `WebSocket` to wrap
3325
- * @param {Object} [options] The options for the `Duplex` constructor
3326
- * @return {Duplex} The duplex stream
3327
- * @public
3328
- */
3329
- function createWebSocketStream(ws, options) {
3330
- let terminateOnDestroy = true;
3331
- const duplex = new Duplex$2({
3332
- ...options,
3333
- autoDestroy: false,
3334
- emitClose: false,
3335
- objectMode: false,
3336
- writableObjectMode: false
3337
- });
3338
- ws.on("message", function message(msg, isBinary) {
3339
- const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
3340
- if (!duplex.push(data)) ws.pause();
3341
- });
3342
- ws.once("error", function error(err) {
3343
- if (duplex.destroyed) return;
3344
- terminateOnDestroy = false;
3345
- duplex.destroy(err);
3346
- });
3347
- ws.once("close", function close() {
3348
- if (duplex.destroyed) return;
3349
- duplex.push(null);
3350
- });
3351
- duplex._destroy = function(err, callback) {
3352
- if (ws.readyState === ws.CLOSED) {
3353
- callback(err);
3354
- process.nextTick(emitClose, duplex);
3355
- return;
3356
- }
3357
- let called = false;
3358
- ws.once("error", function error(err) {
3359
- called = true;
3360
- callback(err);
3361
- });
3362
- ws.once("close", function close() {
3363
- if (!called) callback(err);
3364
- process.nextTick(emitClose, duplex);
3365
- });
3366
- if (terminateOnDestroy) ws.terminate();
3367
- };
3368
- duplex._final = function(callback) {
3369
- if (ws.readyState === ws.CONNECTING) {
3370
- ws.once("open", function open() {
3371
- duplex._final(callback);
3372
- });
3373
- return;
3374
- }
3375
- if (ws._socket === null) return;
3376
- if (ws._socket._writableState.finished) {
3377
- callback();
3378
- if (duplex._readableState.endEmitted) duplex.destroy();
3379
- } else {
3380
- ws._socket.once("finish", function finish() {
3381
- callback();
3382
- });
3383
- ws.close();
3384
- }
3385
- };
3386
- duplex._read = function() {
3387
- if (ws.isPaused) ws.resume();
3388
- };
3389
- duplex._write = function(chunk, encoding, callback) {
3390
- if (ws.readyState === ws.CONNECTING) {
3391
- ws.once("open", function open() {
3392
- duplex._write(chunk, encoding, callback);
3393
- });
3394
- return;
3395
- }
3396
- ws.send(chunk, callback);
3397
- };
3398
- duplex.on("end", duplexOnEnd);
3399
- duplex.on("error", duplexOnError);
3400
- return duplex;
3401
- }
3402
- module.exports = createWebSocketStream;
3403
- }));
3404
-
3405
- //#endregion
3406
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/subprotocol.js
3407
- var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3408
- const { tokenChars } = require_validation();
3409
- /**
3410
- * Parses the `Sec-WebSocket-Protocol` header into a set of subprotocol names.
3411
- *
3412
- * @param {String} header The field value of the header
3413
- * @return {Set} The subprotocol names
3414
- * @public
3415
- */
3416
- function parse(header) {
3417
- const protocols = /* @__PURE__ */ new Set();
3418
- let start = -1;
3419
- let end = -1;
3420
- let i = 0;
3421
- for (; i < header.length; i++) {
3422
- const code = header.charCodeAt(i);
3423
- if (end === -1 && tokenChars[code] === 1) {
3424
- if (start === -1) start = i;
3425
- } else if (i !== 0 && (code === 32 || code === 9)) {
3426
- if (end === -1 && start !== -1) end = i;
3427
- } else if (code === 44) {
3428
- if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
3429
- if (end === -1) end = i;
3430
- const protocol = header.slice(start, end);
3431
- if (protocols.has(protocol)) throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
3432
- protocols.add(protocol);
3433
- start = end = -1;
3434
- } else throw new SyntaxError(`Unexpected character at index ${i}`);
3435
- }
3436
- if (start === -1 || end !== -1) throw new SyntaxError("Unexpected end of input");
3437
- const protocol = header.slice(start, i);
3438
- if (protocols.has(protocol)) throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
3439
- protocols.add(protocol);
3440
- return protocols;
3441
- }
3442
- module.exports = { parse };
3443
- }));
3444
-
3445
- //#endregion
3446
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/lib/websocket-server.js
3447
- var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3448
- const EventEmitter = __require("events");
3449
- const http$1 = __require("http");
3450
- const { Duplex: Duplex$1 } = __require("stream");
3451
- const { createHash } = __require("crypto");
3452
- const extension = require_extension();
3453
- const PerMessageDeflate = require_permessage_deflate();
3454
- const subprotocol = require_subprotocol();
3455
- const WebSocket = require_websocket();
3456
- const { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
3457
- const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
3458
- const RUNNING = 0;
3459
- const CLOSING = 1;
3460
- const CLOSED = 2;
3461
- /**
3462
- * Class representing a WebSocket server.
3463
- *
3464
- * @extends EventEmitter
3465
- */
3466
- var WebSocketServer = class extends EventEmitter {
3467
- /**
3468
- * Create a `WebSocketServer` instance.
3469
- *
3470
- * @param {Object} options Configuration options
3471
- * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
3472
- * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
3473
- * multiple times in the same tick
3474
- * @param {Boolean} [options.autoPong=true] Specifies whether or not to
3475
- * automatically send a pong in response to a ping
3476
- * @param {Number} [options.backlog=511] The maximum length of the queue of
3477
- * pending connections
3478
- * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
3479
- * track clients
3480
- * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
3481
- * wait for the closing handshake to finish after `websocket.close()` is
3482
- * called
3483
- * @param {Function} [options.handleProtocols] A hook to handle protocols
3484
- * @param {String} [options.host] The hostname where to bind the server
3485
- * @param {Number} [options.maxPayload=104857600] The maximum allowed message
3486
- * size
3487
- * @param {Boolean} [options.noServer=false] Enable no server mode
3488
- * @param {String} [options.path] Accept only connections matching this path
3489
- * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
3490
- * permessage-deflate
3491
- * @param {Number} [options.port] The port where to bind the server
3492
- * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S
3493
- * server to use
3494
- * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
3495
- * not to skip UTF-8 validation for text and close messages
3496
- * @param {Function} [options.verifyClient] A hook to reject connections
3497
- * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`
3498
- * class to use. It must be the `WebSocket` class or class that extends it
3499
- * @param {Function} [callback] A listener for the `listening` event
3500
- */
3501
- constructor(options, callback) {
3502
- super();
3503
- options = {
3504
- allowSynchronousEvents: true,
3505
- autoPong: true,
3506
- maxPayload: 100 * 1024 * 1024,
3507
- skipUTF8Validation: false,
3508
- perMessageDeflate: false,
3509
- handleProtocols: null,
3510
- clientTracking: true,
3511
- closeTimeout: CLOSE_TIMEOUT,
3512
- verifyClient: null,
3513
- noServer: false,
3514
- backlog: null,
3515
- server: null,
3516
- host: null,
3517
- path: null,
3518
- port: null,
3519
- WebSocket,
3520
- ...options
3521
- };
3522
- if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) throw new TypeError("One and only one of the \"port\", \"server\", or \"noServer\" options must be specified");
3523
- if (options.port != null) {
3524
- this._server = http$1.createServer((req, res) => {
3525
- const body = http$1.STATUS_CODES[426];
3526
- res.writeHead(426, {
3527
- "Content-Length": body.length,
3528
- "Content-Type": "text/plain"
3529
- });
3530
- res.end(body);
3531
- });
3532
- this._server.listen(options.port, options.host, options.backlog, callback);
3533
- } else if (options.server) this._server = options.server;
3534
- if (this._server) {
3535
- const emitConnection = this.emit.bind(this, "connection");
3536
- this._removeListeners = addListeners(this._server, {
3537
- listening: this.emit.bind(this, "listening"),
3538
- error: this.emit.bind(this, "error"),
3539
- upgrade: (req, socket, head) => {
3540
- this.handleUpgrade(req, socket, head, emitConnection);
3541
- }
3542
- });
3543
- }
3544
- if (options.perMessageDeflate === true) options.perMessageDeflate = {};
3545
- if (options.clientTracking) {
3546
- this.clients = /* @__PURE__ */ new Set();
3547
- this._shouldEmitClose = false;
3548
- }
3549
- this.options = options;
3550
- this._state = RUNNING;
3551
- }
3552
- /**
3553
- * Returns the bound address, the address family name, and port of the server
3554
- * as reported by the operating system if listening on an IP socket.
3555
- * If the server is listening on a pipe or UNIX domain socket, the name is
3556
- * returned as a string.
3557
- *
3558
- * @return {(Object|String|null)} The address of the server
3559
- * @public
3560
- */
3561
- address() {
3562
- if (this.options.noServer) throw new Error("The server is operating in \"noServer\" mode");
3563
- if (!this._server) return null;
3564
- return this._server.address();
3565
- }
3566
- /**
3567
- * Stop the server from accepting new connections and emit the `'close'` event
3568
- * when all existing connections are closed.
3569
- *
3570
- * @param {Function} [cb] A one-time listener for the `'close'` event
3571
- * @public
3572
- */
3573
- close(cb) {
3574
- if (this._state === CLOSED) {
3575
- if (cb) this.once("close", () => {
3576
- cb(/* @__PURE__ */ new Error("The server is not running"));
3577
- });
3578
- process.nextTick(emitClose, this);
3579
- return;
3580
- }
3581
- if (cb) this.once("close", cb);
3582
- if (this._state === CLOSING) return;
3583
- this._state = CLOSING;
3584
- if (this.options.noServer || this.options.server) {
3585
- if (this._server) {
3586
- this._removeListeners();
3587
- this._removeListeners = this._server = null;
3588
- }
3589
- if (this.clients) if (!this.clients.size) process.nextTick(emitClose, this);
3590
- else this._shouldEmitClose = true;
3591
- else process.nextTick(emitClose, this);
3592
- } else {
3593
- const server = this._server;
3594
- this._removeListeners();
3595
- this._removeListeners = this._server = null;
3596
- server.close(() => {
3597
- emitClose(this);
3598
- });
3599
- }
3600
- }
3601
- /**
3602
- * See if a given request should be handled by this server instance.
3603
- *
3604
- * @param {http.IncomingMessage} req Request object to inspect
3605
- * @return {Boolean} `true` if the request is valid, else `false`
3606
- * @public
3607
- */
3608
- shouldHandle(req) {
3609
- if (this.options.path) {
3610
- const index = req.url.indexOf("?");
3611
- if ((index !== -1 ? req.url.slice(0, index) : req.url) !== this.options.path) return false;
3612
- }
3613
- return true;
3614
- }
3615
- /**
3616
- * Handle a HTTP Upgrade request.
3617
- *
3618
- * @param {http.IncomingMessage} req The request object
3619
- * @param {Duplex} socket The network socket between the server and client
3620
- * @param {Buffer} head The first packet of the upgraded stream
3621
- * @param {Function} cb Callback
3622
- * @public
3623
- */
3624
- handleUpgrade(req, socket, head, cb) {
3625
- socket.on("error", socketOnError);
3626
- const key = req.headers["sec-websocket-key"];
3627
- const upgrade = req.headers.upgrade;
3628
- const version = +req.headers["sec-websocket-version"];
3629
- if (req.method !== "GET") {
3630
- abortHandshakeOrEmitwsClientError(this, req, socket, 405, "Invalid HTTP method");
3631
- return;
3632
- }
3633
- if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
3634
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Upgrade header");
3635
- return;
3636
- }
3637
- if (key === void 0 || !keyRegex.test(key)) {
3638
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Key header");
3639
- return;
3640
- }
3641
- if (version !== 13 && version !== 8) {
3642
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Version header", { "Sec-WebSocket-Version": "13, 8" });
3643
- return;
3644
- }
3645
- if (!this.shouldHandle(req)) {
3646
- abortHandshake(socket, 400);
3647
- return;
3648
- }
3649
- const secWebSocketProtocol = req.headers["sec-websocket-protocol"];
3650
- let protocols = /* @__PURE__ */ new Set();
3651
- if (secWebSocketProtocol !== void 0) try {
3652
- protocols = subprotocol.parse(secWebSocketProtocol);
3653
- } catch (err) {
3654
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Sec-WebSocket-Protocol header");
3655
- return;
3656
- }
3657
- const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
3658
- const extensions = {};
3659
- if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
3660
- const perMessageDeflate = new PerMessageDeflate(this.options.perMessageDeflate, true, this.options.maxPayload);
3661
- try {
3662
- const offers = extension.parse(secWebSocketExtensions);
3663
- if (offers[PerMessageDeflate.extensionName]) {
3664
- perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
3665
- extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
3666
- }
3667
- } catch (err) {
3668
- abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
3669
- return;
3670
- }
3671
- }
3672
- if (this.options.verifyClient) {
3673
- const info = {
3674
- origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`],
3675
- secure: !!(req.socket.authorized || req.socket.encrypted),
3676
- req
3677
- };
3678
- if (this.options.verifyClient.length === 2) {
3679
- this.options.verifyClient(info, (verified, code, message, headers) => {
3680
- if (!verified) return abortHandshake(socket, code || 401, message, headers);
3681
- this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
3682
- });
3683
- return;
3684
- }
3685
- if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
3686
- }
3687
- this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
3688
- }
3689
- /**
3690
- * Upgrade the connection to WebSocket.
3691
- *
3692
- * @param {Object} extensions The accepted extensions
3693
- * @param {String} key The value of the `Sec-WebSocket-Key` header
3694
- * @param {Set} protocols The subprotocols
3695
- * @param {http.IncomingMessage} req The request object
3696
- * @param {Duplex} socket The network socket between the server and client
3697
- * @param {Buffer} head The first packet of the upgraded stream
3698
- * @param {Function} cb Callback
3699
- * @throws {Error} If called more than once with the same socket
3700
- * @private
3701
- */
3702
- completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
3703
- if (!socket.readable || !socket.writable) return socket.destroy();
3704
- if (socket[kWebSocket]) throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");
3705
- if (this._state > RUNNING) return abortHandshake(socket, 503);
3706
- const headers = [
3707
- "HTTP/1.1 101 Switching Protocols",
3708
- "Upgrade: websocket",
3709
- "Connection: Upgrade",
3710
- `Sec-WebSocket-Accept: ${createHash("sha1").update(key + GUID).digest("base64")}`
3711
- ];
3712
- const ws = new this.options.WebSocket(null, void 0, this.options);
3713
- if (protocols.size) {
3714
- const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
3715
- if (protocol) {
3716
- headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
3717
- ws._protocol = protocol;
3718
- }
3719
- }
3720
- if (extensions[PerMessageDeflate.extensionName]) {
3721
- const params = extensions[PerMessageDeflate.extensionName].params;
3722
- const value = extension.format({ [PerMessageDeflate.extensionName]: [params] });
3723
- headers.push(`Sec-WebSocket-Extensions: ${value}`);
3724
- ws._extensions = extensions;
3725
- }
3726
- this.emit("headers", headers, req);
3727
- socket.write(headers.concat("\r\n").join("\r\n"));
3728
- socket.removeListener("error", socketOnError);
3729
- ws.setSocket(socket, head, {
3730
- allowSynchronousEvents: this.options.allowSynchronousEvents,
3731
- maxPayload: this.options.maxPayload,
3732
- skipUTF8Validation: this.options.skipUTF8Validation
3733
- });
3734
- if (this.clients) {
3735
- this.clients.add(ws);
3736
- ws.on("close", () => {
3737
- this.clients.delete(ws);
3738
- if (this._shouldEmitClose && !this.clients.size) process.nextTick(emitClose, this);
3739
- });
3740
- }
3741
- cb(ws, req);
3742
- }
3743
- };
3744
- module.exports = WebSocketServer;
3745
- /**
3746
- * Add event listeners on an `EventEmitter` using a map of <event, listener>
3747
- * pairs.
3748
- *
3749
- * @param {EventEmitter} server The event emitter
3750
- * @param {Object.<String, Function>} map The listeners to add
3751
- * @return {Function} A function that will remove the added listeners when
3752
- * called
3753
- * @private
3754
- */
3755
- function addListeners(server, map) {
3756
- for (const event of Object.keys(map)) server.on(event, map[event]);
3757
- return function removeListeners() {
3758
- for (const event of Object.keys(map)) server.removeListener(event, map[event]);
3759
- };
3760
- }
3761
- /**
3762
- * Emit a `'close'` event on an `EventEmitter`.
3763
- *
3764
- * @param {EventEmitter} server The event emitter
3765
- * @private
3766
- */
3767
- function emitClose(server) {
3768
- server._state = CLOSED;
3769
- server.emit("close");
3770
- }
3771
- /**
3772
- * Handle socket errors.
3773
- *
3774
- * @private
3775
- */
3776
- function socketOnError() {
3777
- this.destroy();
3778
- }
3779
- /**
3780
- * Close the connection when preconditions are not fulfilled.
3781
- *
3782
- * @param {Duplex} socket The socket of the upgrade request
3783
- * @param {Number} code The HTTP response status code
3784
- * @param {String} [message] The HTTP response body
3785
- * @param {Object} [headers] Additional HTTP response headers
3786
- * @private
3787
- */
3788
- function abortHandshake(socket, code, message, headers) {
3789
- message = message || http$1.STATUS_CODES[code];
3790
- headers = {
3791
- Connection: "close",
3792
- "Content-Type": "text/html",
3793
- "Content-Length": Buffer.byteLength(message),
3794
- ...headers
3795
- };
3796
- socket.once("finish", socket.destroy);
3797
- socket.end(`HTTP/1.1 ${code} ${http$1.STATUS_CODES[code]}\r\n` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message);
3798
- }
3799
- /**
3800
- * Emit a `'wsClientError'` event on a `WebSocketServer` if there is at least
3801
- * one listener for it, otherwise call `abortHandshake()`.
3802
- *
3803
- * @param {WebSocketServer} server The WebSocket server
3804
- * @param {http.IncomingMessage} req The request object
3805
- * @param {Duplex} socket The socket of the upgrade request
3806
- * @param {Number} code The HTTP response status code
3807
- * @param {String} message The HTTP response body
3808
- * @param {Object} [headers] The HTTP response headers
3809
- * @private
3810
- */
3811
- function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
3812
- if (server.listenerCount("wsClientError")) {
3813
- const err = new Error(message);
3814
- Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
3815
- server.emit("wsClientError", err, socket, req);
3816
- } else abortHandshake(socket, code, message, headers);
3817
- }
3818
- }));
3819
-
3820
- //#endregion
3821
- //#region ../../node_modules/@effect/platform-node-shared/node_modules/ws/wrapper.mjs
3822
- var import_stream = /* @__PURE__ */ __toESM(require_stream(), 1);
3823
- var import_receiver = /* @__PURE__ */ __toESM(require_receiver(), 1);
3824
- var import_sender = /* @__PURE__ */ __toESM(require_sender(), 1);
3825
- var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
3826
- var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
3827
-
3828
- //#endregion
3829
- //#region ../../node_modules/@effect/platform-node/dist/NodeHttpServer.js
3830
- /**
3831
- * @since 1.0.0
3832
- */
3833
- /**
3834
- * @since 1.0.0
3835
- * @category constructors
3836
- */
3837
- const make = /* @__PURE__ */ fnUntraced(function* (evaluate, options) {
3838
- const scope$1 = yield* scope;
3839
- const server = evaluate();
3840
- const shutdown = yield* callback((resume) => {
3841
- if (!server.listening) return resume(void_);
3842
- server.close((error) => {
3843
- if (error) resume(die(error));
3844
- else resume(void_);
3845
- });
3846
- }).pipe(cached);
3847
- const preemptiveShutdown = options.disablePreemptiveShutdown ? void_ : timeoutOrElse(shutdown, {
3848
- duration: options.gracefulShutdownTimeout ?? seconds(20),
3849
- orElse: () => void_
3850
- });
3851
- yield* addFinalizer(scope$1, shutdown);
3852
- yield* callback((resume) => {
3853
- function onError(cause) {
3854
- resume(fail(new ServeError({ cause })));
3855
- }
3856
- server.on("error", onError);
3857
- server.listen(options, () => {
3858
- server.off("error", onError);
3859
- resume(void_);
3860
- });
3861
- });
3862
- const address = server.address();
3863
- const wss = yield* acquireRelease(sync(() => new import_websocket_server.default({ noServer: true })), (wss) => callback((resume) => {
3864
- wss.close(() => resume(void_));
3865
- })).pipe(provide$1(scope$1), cached);
3866
- return make$5({
3867
- address: typeof address === "string" ? {
3868
- _tag: "UnixAddress",
3869
- path: address
3870
- } : {
3871
- _tag: "TcpAddress",
3872
- hostname: address.address === "::" ? "0.0.0.0" : address.address,
3873
- port: address.port
3874
- },
3875
- serve: fnUntraced(function* (httpApp, middleware) {
3876
- const serveScope = yield* scope;
3877
- const scope$2 = forkUnsafe(serveScope, "parallel");
3878
- const handler = yield* makeHandler(httpApp, {
3879
- middleware,
3880
- scope: scope$2
3881
- });
3882
- const upgradeHandler = yield* makeUpgradeHandler(wss, httpApp, {
3883
- middleware,
3884
- scope: scope$2
3885
- });
3886
- yield* addFinalizerExit(serveScope, () => {
3887
- server.off("request", handler);
3888
- server.off("upgrade", upgradeHandler);
3889
- return preemptiveShutdown;
3890
- });
3891
- server.on("request", handler);
3892
- server.on("upgrade", upgradeHandler);
3893
- })
3894
- });
3895
- });
3896
- /**
3897
- * @since 1.0.0
3898
- * @category Handlers
3899
- */
3900
- const makeHandler = (httpEffect, options) => {
3901
- const handled = toHandled(httpEffect, handleResponse, options.middleware);
3902
- return withFiber((parent) => {
3903
- const services = parent.services;
3904
- return succeed(function handler(nodeRequest, nodeResponse) {
3905
- const map = new Map(services.mapUnsafe);
3906
- map.set(HttpServerRequest.key, new ServerRequestImpl(nodeRequest, nodeResponse));
3907
- const fiber = runIn(runForkWith(makeUnsafe(map))(handled), options.scope);
3908
- nodeResponse.on("close", () => {
3909
- if (!nodeResponse.writableEnded) fiber.interruptUnsafe(parent.id, ClientAbort.annotation);
3910
- });
3911
- });
3912
- });
3913
- };
3914
- /**
3915
- * @since 1.0.0
3916
- * @category Handlers
3917
- */
3918
- const makeUpgradeHandler = (lazyWss, httpEffect, options) => {
3919
- const handledApp = toHandled(httpEffect, handleResponse, options.middleware);
3920
- return withFiber((parent) => {
3921
- const services = parent.services;
3922
- return succeed(function handler(nodeRequest, socket, head) {
3923
- let nodeResponse_ = void 0;
3924
- const nodeResponse = () => {
3925
- if (nodeResponse_ === void 0) {
3926
- nodeResponse_ = new Http.ServerResponse(nodeRequest);
3927
- nodeResponse_.assignSocket(socket);
3928
- nodeResponse_.on("finish", () => {
3929
- socket.end();
3930
- });
3931
- }
3932
- return nodeResponse_;
3933
- };
3934
- const upgradeEffect = fromWebSocket(flatMap(lazyWss, (wss) => acquireRelease(callback((resume) => wss.handleUpgrade(nodeRequest, socket, head, (ws) => {
3935
- resume(succeed(ws));
3936
- })), (ws) => sync(() => ws.close()))));
3937
- const map = new Map(services.mapUnsafe);
3938
- map.set(HttpServerRequest.key, new ServerRequestImpl(nodeRequest, nodeResponse, upgradeEffect));
3939
- const fiber = runIn(runForkWith(makeUnsafe(map))(handledApp), options.scope);
3940
- socket.on("close", () => {
3941
- if (!socket.writableEnded) fiber.interruptUnsafe(parent.id, ClientAbort.annotation);
3942
- });
3943
- });
3944
- });
3945
- };
3946
- var ServerRequestImpl = class ServerRequestImpl extends NodeHttpIncomingMessage {
3947
- [TypeId$2];
3948
- response;
3949
- upgradeEffect;
3950
- url;
3951
- headersOverride;
3952
- constructor(source, response, upgradeEffect, url = source.url, headersOverride, remoteAddressOverride) {
3953
- super(source, (cause) => new HttpServerError({ reason: new RequestParseError({
3954
- request: this,
3955
- cause
3956
- }) }), remoteAddressOverride);
3957
- this[TypeId$2] = TypeId$2;
3958
- this.response = response;
3959
- this.upgradeEffect = upgradeEffect;
3960
- this.url = url;
3961
- this.headersOverride = headersOverride;
3962
- }
3963
- cachedCookies;
3964
- get cookies() {
3965
- if (this.cachedCookies) return this.cachedCookies;
3966
- return this.cachedCookies = parseHeader(this.headers.cookie ?? "");
3967
- }
3968
- get resolvedResponse() {
3969
- return typeof this.response === "function" ? this.response() : this.response;
3970
- }
3971
- modify(options) {
3972
- return new ServerRequestImpl(this.source, this.response, this.upgradeEffect, options.url ?? this.url, options.headers ?? this.headersOverride, "remoteAddress" in options ? options.remoteAddress : this.remoteAddressOverride);
3973
- }
3974
- get originalUrl() {
3975
- return this.source.url;
3976
- }
3977
- get method() {
3978
- return this.source.method.toUpperCase();
3979
- }
3980
- get headers() {
3981
- this.headersOverride ??= this.source.headers;
3982
- return this.headersOverride;
3983
- }
3984
- multipartEffect;
3985
- get multipart() {
3986
- if (this.multipartEffect) return this.multipartEffect;
3987
- this.multipartEffect = runSync(cached(persisted(this.source, this.source.headers)));
3988
- return this.multipartEffect;
3989
- }
3990
- get multipartStream() {
3991
- return stream(this.source, this.source.headers);
3992
- }
3993
- get upgrade() {
3994
- return this.upgradeEffect ?? fail(new HttpServerError({ reason: new RequestParseError({
3995
- request: this,
3996
- description: "not an upgradeable ServerRequest"
3997
- }) }));
3998
- }
3999
- toString() {
4000
- return `ServerRequest(${this.method} ${this.url})`;
4001
- }
4002
- toJSON() {
4003
- return inspect(this, {
4004
- _id: "HttpServerRequest",
4005
- method: this.method,
4006
- url: this.originalUrl
4007
- });
4008
- }
4009
- };
4010
- /**
4011
- * @since 1.0.0
4012
- * @category Layers
4013
- */
4014
- const layerServer = /* @__PURE__ */ flow(make, /* @__PURE__ */ effect(HttpServer));
4015
- /**
4016
- * @since 1.0.0
4017
- * @category Layers
4018
- */
4019
- const layerHttpServices = /* @__PURE__ */ mergeAll(layer$1, layerWeak, layer$4);
4020
- /**
4021
- * @since 1.0.0
4022
- * @category Layers
4023
- */
4024
- const layer = (evaluate, options) => mergeAll(layerServer(evaluate, options), layerHttpServices);
4025
- /**
4026
- * @since 1.0.0
4027
- * @category Layers
4028
- */
4029
- const layerConfig = (evaluate, options) => mergeAll(effect(HttpServer)(flatMap(unwrap$1(options).asEffect(), (options) => make(evaluate, options))), layerHttpServices);
4030
- /**
4031
- * @since 1.0.0
4032
- * @category Testing
4033
- */
4034
- const layerTest = /* @__PURE__ */ layerTestClient.pipe(/* @__PURE__ */ provide(/* @__PURE__ */ fresh(layer$5).pipe(/* @__PURE__ */ provide(/* @__PURE__ */ succeed$1(RequestInit)({ keepalive: false })))), /* @__PURE__ */ provideMerge(/* @__PURE__ */ layer(Http.createServer, { port: 0 })));
4035
- const handleResponse = (request, response) => {
4036
- const nodeResponse = request.resolvedResponse;
4037
- if (nodeResponse.writableEnded) return void_;
4038
- let headers = response.headers;
4039
- if (!isEmpty(response.cookies)) {
4040
- headers = { ...headers };
4041
- const toSet = toSetCookieHeaders(response.cookies);
4042
- if (headers["set-cookie"] !== void 0) toSet.push(headers["set-cookie"]);
4043
- headers["set-cookie"] = toSet;
4044
- }
4045
- if (request.method === "HEAD") {
4046
- nodeResponse.writeHead(response.status, headers);
4047
- return callback((resume) => {
4048
- nodeResponse.end(() => resume(void_));
4049
- });
4050
- }
4051
- const body = response.body;
4052
- switch (body._tag) {
4053
- case "Empty":
4054
- nodeResponse.writeHead(response.status, headers);
4055
- nodeResponse.end();
4056
- return void_;
4057
- case "Raw":
4058
- nodeResponse.writeHead(response.status, headers);
4059
- if (typeof body.body === "object" && body.body !== null && "pipe" in body.body && typeof body.body.pipe === "function") return tryPromise({
4060
- try: (signal) => pipeline(body.body, nodeResponse, {
4061
- signal,
4062
- end: true
4063
- }),
4064
- catch: (cause) => new HttpServerError({ reason: new ResponseError({
4065
- request,
4066
- response,
4067
- description: "Error writing raw response",
4068
- cause
4069
- }) })
4070
- }).pipe(interruptible, tapCause(handleCause(nodeResponse, response)));
4071
- return callback((resume) => {
4072
- nodeResponse.end(body.body, () => resume(void_));
4073
- });
4074
- case "Uint8Array":
4075
- nodeResponse.writeHead(response.status, headers);
4076
- if (body.body.length < 1024 * 1024) {
4077
- nodeResponse.end(body.body);
4078
- return void_;
4079
- }
4080
- return callback((resume) => {
4081
- nodeResponse.end(body.body, () => resume(void_));
4082
- });
4083
- case "FormData": return suspend(() => {
4084
- const r = new globalThis.Response(body.formData);
4085
- nodeResponse.writeHead(response.status, {
4086
- ...headers,
4087
- ...Object.fromEntries(r.headers)
4088
- });
4089
- return callback((resume, signal) => {
4090
- Readable.fromWeb(r.body, { signal }).pipe(nodeResponse).on("error", (cause) => {
4091
- resume(fail(new HttpServerError({ reason: new ResponseError({
4092
- request,
4093
- response,
4094
- description: "Error writing FormData response",
4095
- cause
4096
- }) })));
4097
- }).once("finish", () => {
4098
- resume(void_);
4099
- });
4100
- }).pipe(interruptible, tapCause(handleCause(nodeResponse, response)));
4101
- });
4102
- case "Stream": {
4103
- nodeResponse.writeHead(response.status, headers);
4104
- const drainLatch = makeUnsafe$1();
4105
- nodeResponse.on("drain", () => drainLatch.openUnsafe());
4106
- return body.stream.pipe(orDie, runForEachArray((array) => {
4107
- let needDrain = false;
4108
- for (let i = 0; i < array.length; i++) {
4109
- const written = nodeResponse.write(array[i]);
4110
- if (!written && !needDrain) {
4111
- needDrain = true;
4112
- drainLatch.closeUnsafe();
4113
- } else if (written && needDrain) needDrain = false;
4114
- }
4115
- if (!needDrain) return void_;
4116
- return drainLatch.await;
4117
- }), interruptible, matchCauseEffect({
4118
- onSuccess: () => sync(() => nodeResponse.end()),
4119
- onFailure: handleCause(nodeResponse, response)
4120
- }));
4121
- }
4122
- }
4123
- };
4124
- const handleCause = (nodeResponse, originalResponse) => (originalCause) => flatMap(causeResponse(originalCause), ([response, cause]) => {
4125
- const headersSent = nodeResponse.headersSent;
4126
- if (!headersSent) nodeResponse.writeHead(response.status);
4127
- if (!nodeResponse.writableEnded) nodeResponse.end();
4128
- return failCause(headersSent ? combine(originalCause, die$1(originalResponse)) : cause);
4129
- });
4130
-
4131
- //#endregion
4132
- export { layer, layerConfig, layerHttpServices, layerServer, layerTest, make, makeHandler, makeUpgradeHandler };
4133
- //# sourceMappingURL=NodeHttpServer-DdGTnpiS.mjs.map