@wabot-dev/framework 0.0.14 → 0.0.17

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 (370) hide show
  1. package/dist/src/ai/deepseek/DeepSeekChatBotAdapter.js +108 -0
  2. package/dist/src/channels/cmd/@cmd.js +1 -1
  3. package/dist/src/channels/cmd/CmdChannel.js +1 -1
  4. package/dist/src/channels/socket-io/@socket.js +24 -0
  5. package/dist/src/channels/socket-io/SocketChannel.js +78 -0
  6. package/dist/src/channels/socket-io/SocketChannelConfig.js +15 -0
  7. package/dist/src/channels/telegram/@telegram.js +1 -1
  8. package/dist/src/channels/telegram/TelegramChannel.js +1 -1
  9. package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
  10. package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
  11. package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
  12. package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +11 -3
  13. package/dist/src/channels/whatsapp/{whatsAppDevSocketContracts.js → WhatsAppDevSocketContracts.js} +1 -0
  14. package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +4 -1
  15. package/dist/src/channels/whatsapp/WhatsAppSender.js +23 -0
  16. package/dist/src/controller/socket.io/SocketIO.js +1 -1
  17. package/dist/src/index.d.ts +82 -9
  18. package/dist/src/index.js +9 -1
  19. package/dist/src/logger/Logger.js +1 -1
  20. package/dist/src/mindset/MindsetOperator.js +1 -1
  21. package/dist/src/server/runChannel.js +1 -1
  22. package/dist/src/server/runServer.js +4 -4
  23. package/package.json +2 -1
  24. package/dist/src/_virtual/XMLHttpRequest.js +0 -7
  25. package/dist/src/_virtual/_commonjsHelpers.js +0 -32
  26. package/dist/src/_virtual/base64id.js +0 -3
  27. package/dist/src/_virtual/binary.js +0 -3
  28. package/dist/src/_virtual/bom-handling.js +0 -3
  29. package/dist/src/_virtual/broadcast-operator.js +0 -3
  30. package/dist/src/_virtual/browser.js +0 -3
  31. package/dist/src/_virtual/browser2.js +0 -3
  32. package/dist/src/_virtual/browser3.js +0 -3
  33. package/dist/src/_virtual/browser4.js +0 -3
  34. package/dist/src/_virtual/browser5.js +0 -3
  35. package/dist/src/_virtual/buffer-util.js +0 -3
  36. package/dist/src/_virtual/buffer-util2.js +0 -3
  37. package/dist/src/_virtual/buffer-util3.js +0 -3
  38. package/dist/src/_virtual/charset.js +0 -3
  39. package/dist/src/_virtual/charset2.js +0 -3
  40. package/dist/src/_virtual/client.js +0 -3
  41. package/dist/src/_virtual/cluster-adapter.js +0 -3
  42. package/dist/src/_virtual/commons.js +0 -3
  43. package/dist/src/_virtual/dbcs-codec.js +0 -3
  44. package/dist/src/_virtual/decodePacket.js +0 -3
  45. package/dist/src/_virtual/encodePacket.js +0 -3
  46. package/dist/src/_virtual/encoding.js +0 -3
  47. package/dist/src/_virtual/encoding2.js +0 -3
  48. package/dist/src/_virtual/engine.io.js +0 -3
  49. package/dist/src/_virtual/in-memory-adapter.js +0 -3
  50. package/dist/src/_virtual/index.js +0 -7
  51. package/dist/src/_virtual/index10.js +0 -3
  52. package/dist/src/_virtual/index11.js +0 -3
  53. package/dist/src/_virtual/index12.js +0 -3
  54. package/dist/src/_virtual/index13.js +0 -3
  55. package/dist/src/_virtual/index14.js +0 -3
  56. package/dist/src/_virtual/index15.js +0 -3
  57. package/dist/src/_virtual/index16.js +0 -3
  58. package/dist/src/_virtual/index17.js +0 -3
  59. package/dist/src/_virtual/index18.js +0 -3
  60. package/dist/src/_virtual/index19.js +0 -3
  61. package/dist/src/_virtual/index2.js +0 -7
  62. package/dist/src/_virtual/index20.js +0 -3
  63. package/dist/src/_virtual/index21.js +0 -3
  64. package/dist/src/_virtual/index22.js +0 -3
  65. package/dist/src/_virtual/index23.js +0 -3
  66. package/dist/src/_virtual/index24.js +0 -3
  67. package/dist/src/_virtual/index25.js +0 -3
  68. package/dist/src/_virtual/index26.js +0 -3
  69. package/dist/src/_virtual/index27.js +0 -3
  70. package/dist/src/_virtual/index28.js +0 -3
  71. package/dist/src/_virtual/index29.js +0 -3
  72. package/dist/src/_virtual/index3.js +0 -7
  73. package/dist/src/_virtual/index30.js +0 -3
  74. package/dist/src/_virtual/index31.js +0 -3
  75. package/dist/src/_virtual/index32.js +0 -3
  76. package/dist/src/_virtual/index33.js +0 -3
  77. package/dist/src/_virtual/index4.js +0 -3
  78. package/dist/src/_virtual/index5.js +0 -3
  79. package/dist/src/_virtual/index6.js +0 -3
  80. package/dist/src/_virtual/index7.js +0 -3
  81. package/dist/src/_virtual/index8.js +0 -6
  82. package/dist/src/_virtual/index9.js +0 -3
  83. package/dist/src/_virtual/inherits.js +0 -3
  84. package/dist/src/_virtual/inherits_browser.js +0 -3
  85. package/dist/src/_virtual/is-binary.js +0 -3
  86. package/dist/src/_virtual/language.js +0 -3
  87. package/dist/src/_virtual/language2.js +0 -3
  88. package/dist/src/_virtual/mediaType.js +0 -3
  89. package/dist/src/_virtual/mediaType2.js +0 -3
  90. package/dist/src/_virtual/namespace.js +0 -3
  91. package/dist/src/_virtual/node.js +0 -3
  92. package/dist/src/_virtual/node2.js +0 -3
  93. package/dist/src/_virtual/node3.js +0 -3
  94. package/dist/src/_virtual/node4.js +0 -3
  95. package/dist/src/_virtual/node5.js +0 -3
  96. package/dist/src/_virtual/parent-namespace.js +0 -3
  97. package/dist/src/_virtual/polling-jsonp.js +0 -3
  98. package/dist/src/_virtual/polling.js +0 -3
  99. package/dist/src/_virtual/polling2.js +0 -3
  100. package/dist/src/_virtual/receiver.js +0 -3
  101. package/dist/src/_virtual/sbcs-codec.js +0 -3
  102. package/dist/src/_virtual/sender.js +0 -3
  103. package/dist/src/_virtual/server.js +0 -3
  104. package/dist/src/_virtual/socket-types.js +0 -3
  105. package/dist/src/_virtual/socket.js +0 -3
  106. package/dist/src/_virtual/socket2.js +0 -3
  107. package/dist/src/_virtual/stream.js +0 -3
  108. package/dist/src/_virtual/transport.js +0 -3
  109. package/dist/src/_virtual/typed-events.js +0 -3
  110. package/dist/src/_virtual/userver.js +0 -3
  111. package/dist/src/_virtual/utf16.js +0 -3
  112. package/dist/src/_virtual/utf32.js +0 -3
  113. package/dist/src/_virtual/utf7.js +0 -3
  114. package/dist/src/_virtual/uws.js +0 -3
  115. package/dist/src/_virtual/validation.js +0 -3
  116. package/dist/src/_virtual/validation2.js +0 -3
  117. package/dist/src/_virtual/validation3.js +0 -3
  118. package/dist/src/_virtual/websocket-server.js +0 -3
  119. package/dist/src/_virtual/websocket.js +0 -7
  120. package/dist/src/_virtual/websocket2.js +0 -3
  121. package/dist/src/_virtual/websocket3.js +0 -3
  122. package/dist/src/_virtual/webtransport.js +0 -3
  123. package/dist/src/_virtual/yeast.js +0 -3
  124. package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
  125. package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
  126. package/dist/src/node_modules/body-parser/index.js +0 -96
  127. package/dist/src/node_modules/body-parser/lib/read.js +0 -225
  128. package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
  129. package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
  130. package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
  131. package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
  132. package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
  133. package/dist/src/node_modules/bytes/index.js +0 -180
  134. package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
  135. package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
  136. package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
  137. package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
  138. package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
  139. package/dist/src/node_modules/call-bound/index.js +0 -31
  140. package/dist/src/node_modules/content-type/index.js +0 -235
  141. package/dist/src/node_modules/cookie/index.js +0 -345
  142. package/dist/src/node_modules/cors/lib/index.js +0 -249
  143. package/dist/src/node_modules/debug/src/browser.js +0 -286
  144. package/dist/src/node_modules/debug/src/common.js +0 -303
  145. package/dist/src/node_modules/debug/src/index.js +0 -23
  146. package/dist/src/node_modules/debug/src/node.js +0 -279
  147. package/dist/src/node_modules/depd/index.js +0 -550
  148. package/dist/src/node_modules/dunder-proto/get.js +0 -42
  149. package/dist/src/node_modules/ee-first/index.js +0 -104
  150. package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
  151. package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
  152. package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
  153. package/dist/src/node_modules/engine.io/build/server.js +0 -808
  154. package/dist/src/node_modules/engine.io/build/socket.js +0 -469
  155. package/dist/src/node_modules/engine.io/build/transport.js +0 -131
  156. package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
  157. package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
  158. package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
  159. package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
  160. package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
  161. package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
  162. package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
  163. package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
  164. package/dist/src/node_modules/engine.io/build/userver.js +0 -292
  165. package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
  166. package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
  167. package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
  168. package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
  169. package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
  170. package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
  171. package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
  172. package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
  173. package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
  174. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
  175. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
  176. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
  177. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
  178. package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
  179. package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
  180. package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
  181. package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
  182. package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
  183. package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
  184. package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
  185. package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
  186. package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
  187. package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
  188. package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
  189. package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
  190. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
  191. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
  192. package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
  193. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
  194. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
  195. package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
  196. package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
  197. package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
  198. package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
  199. package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
  200. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
  201. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
  202. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
  203. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
  204. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
  205. package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
  206. package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
  207. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
  208. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
  209. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
  210. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
  211. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
  212. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
  213. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
  214. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
  215. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
  216. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
  217. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
  218. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
  219. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
  220. package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
  221. package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
  222. package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
  223. package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
  224. package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
  225. package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
  226. package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
  227. package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
  228. package/dist/src/node_modules/es-define-property/index.js +0 -23
  229. package/dist/src/node_modules/es-errors/eval.js +0 -13
  230. package/dist/src/node_modules/es-errors/index.js +0 -13
  231. package/dist/src/node_modules/es-errors/range.js +0 -13
  232. package/dist/src/node_modules/es-errors/ref.js +0 -13
  233. package/dist/src/node_modules/es-errors/syntax.js +0 -13
  234. package/dist/src/node_modules/es-errors/type.js +0 -13
  235. package/dist/src/node_modules/es-errors/uri.js +0 -13
  236. package/dist/src/node_modules/es-object-atoms/index.js +0 -13
  237. package/dist/src/node_modules/function-bind/implementation.js +0 -93
  238. package/dist/src/node_modules/function-bind/index.js +0 -16
  239. package/dist/src/node_modules/get-intrinsic/index.js +0 -413
  240. package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
  241. package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
  242. package/dist/src/node_modules/get-proto/index.js +0 -40
  243. package/dist/src/node_modules/gopd/gOPD.js +0 -13
  244. package/dist/src/node_modules/gopd/index.js +0 -26
  245. package/dist/src/node_modules/has-symbols/index.js +0 -25
  246. package/dist/src/node_modules/has-symbols/shams.js +0 -54
  247. package/dist/src/node_modules/hasown/index.js +0 -19
  248. package/dist/src/node_modules/http-errors/index.js +0 -306
  249. package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
  250. package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
  251. package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
  252. package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
  253. package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
  254. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
  255. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
  256. package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
  257. package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
  258. package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
  259. package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
  260. package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
  261. package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
  262. package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
  263. package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
  264. package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
  265. package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
  266. package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
  267. package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
  268. package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
  269. package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
  270. package/dist/src/node_modules/inherits/inherits.js +0 -21
  271. package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
  272. package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
  273. package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
  274. package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
  275. package/dist/src/node_modules/math-intrinsics/max.js +0 -13
  276. package/dist/src/node_modules/math-intrinsics/min.js +0 -13
  277. package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
  278. package/dist/src/node_modules/math-intrinsics/round.js +0 -13
  279. package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
  280. package/dist/src/node_modules/media-typer/index.js +0 -153
  281. package/dist/src/node_modules/mime-db/db.json.js +0 -11656
  282. package/dist/src/node_modules/mime-db/index.js +0 -24
  283. package/dist/src/node_modules/mime-types/index.js +0 -226
  284. package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
  285. package/dist/src/node_modules/ms/index.js +0 -172
  286. package/dist/src/node_modules/object-assign/index.js +0 -99
  287. package/dist/src/node_modules/object-inspect/index.js +0 -557
  288. package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
  289. package/dist/src/node_modules/on-finished/index.js +0 -245
  290. package/dist/src/node_modules/qs/lib/formats.js +0 -32
  291. package/dist/src/node_modules/qs/lib/index.js +0 -24
  292. package/dist/src/node_modules/qs/lib/parse.js +0 -339
  293. package/dist/src/node_modules/qs/lib/stringify.js +0 -369
  294. package/dist/src/node_modules/qs/lib/utils.js +0 -279
  295. package/dist/src/node_modules/raw-body/index.js +0 -351
  296. package/dist/src/node_modules/safer-buffer/safer.js +0 -88
  297. package/dist/src/node_modules/setprototypeof/index.js +0 -26
  298. package/dist/src/node_modules/side-channel/index.js +0 -58
  299. package/dist/src/node_modules/side-channel-list/index.js +0 -125
  300. package/dist/src/node_modules/side-channel-map/index.js +0 -82
  301. package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
  302. package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
  303. package/dist/src/node_modules/socket.io/dist/client.js +0 -281
  304. package/dist/src/node_modules/socket.io/dist/index.js +0 -837
  305. package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
  306. package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
  307. package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
  308. package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
  309. package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
  310. package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
  311. package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
  312. package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
  313. package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
  314. package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
  315. package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
  316. package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
  317. package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
  318. package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
  319. package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
  320. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
  321. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
  322. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
  323. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
  324. package/dist/src/node_modules/socket.io/package.json.js +0 -5
  325. package/dist/src/node_modules/socket.io/wrapper.js +0 -5
  326. package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
  327. package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
  328. package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
  329. package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
  330. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
  331. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
  332. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
  333. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
  334. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
  335. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
  336. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
  337. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
  338. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
  339. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
  340. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
  341. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
  342. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
  343. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
  344. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
  345. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
  346. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
  347. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
  348. package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
  349. package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
  350. package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
  351. package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
  352. package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
  353. package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
  354. package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
  355. package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
  356. package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
  357. package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
  358. package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
  359. package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
  360. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
  361. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
  362. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
  363. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
  364. package/dist/src/node_modules/statuses/codes.json.js +0 -67
  365. package/dist/src/node_modules/statuses/index.js +0 -157
  366. package/dist/src/node_modules/toidentifier/index.js +0 -41
  367. package/dist/src/node_modules/type-is/index.js +0 -263
  368. package/dist/src/node_modules/unpipe/index.js +0 -78
  369. package/dist/src/node_modules/vary/index.js +0 -159
  370. package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
@@ -1,73 +0,0 @@
1
- import { __exports as engine_io } from '../../../_virtual/engine.io.js';
2
- import require$$2 from 'http';
3
- import { __require as requireServer } from './server.js';
4
- import { __require as requireTransports } from './transports/index.js';
5
- import { __require as requireCjs } from '../../engine.io-parser/build/cjs/index.js';
6
- import { __require as requireUserver } from './userver.js';
7
- import { __require as requireSocket } from './socket.js';
8
- import { __require as requireTransport } from './transport.js';
9
-
10
- var hasRequiredEngine_io;
11
-
12
- function requireEngine_io () {
13
- if (hasRequiredEngine_io) return engine_io;
14
- hasRequiredEngine_io = 1;
15
- (function (exports) {
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.protocol = exports.Transport = exports.Socket = exports.uServer = exports.parser = exports.transports = exports.Server = void 0;
18
- exports.listen = listen;
19
- exports.attach = attach;
20
- const http_1 = require$$2;
21
- const server_1 = requireServer();
22
- Object.defineProperty(exports, "Server", { enumerable: true, get: function () { return server_1.Server; } });
23
- const index_1 = requireTransports();
24
- exports.transports = index_1.default;
25
- const parser = requireCjs();
26
- exports.parser = parser;
27
- var userver_1 = requireUserver();
28
- Object.defineProperty(exports, "uServer", { enumerable: true, get: function () { return userver_1.uServer; } });
29
- var socket_1 = requireSocket();
30
- Object.defineProperty(exports, "Socket", { enumerable: true, get: function () { return socket_1.Socket; } });
31
- var transport_1 = requireTransport();
32
- Object.defineProperty(exports, "Transport", { enumerable: true, get: function () { return transport_1.Transport; } });
33
- exports.protocol = parser.protocol;
34
- /**
35
- * Creates an http.Server exclusively used for WS upgrades.
36
- *
37
- * @param {Number} port
38
- * @param {Function} callback
39
- * @param {Object} options
40
- * @return {Server} websocket.io server
41
- */
42
- function listen(port, options, fn) {
43
- if ("function" === typeof options) {
44
- fn = options;
45
- options = {};
46
- }
47
- const server = (0, http_1.createServer)(function (req, res) {
48
- res.writeHead(501);
49
- res.end("Not Implemented");
50
- });
51
- // create engine server
52
- const engine = attach(server, options);
53
- engine.httpServer = server;
54
- server.listen(port, fn);
55
- return engine;
56
- }
57
- /**
58
- * Captures upgrade requests for a http.Server.
59
- *
60
- * @param {http.Server} server
61
- * @param {Object} options
62
- * @return {Server} engine server
63
- */
64
- function attach(server, options) {
65
- const engine = new server_1.Server(options);
66
- engine.attach(server, options);
67
- return engine;
68
- }
69
- } (engine_io));
70
- return engine_io;
71
- }
72
-
73
- export { requireEngine_io as __require };
@@ -1,429 +0,0 @@
1
- import { __exports as parserV3 } from '../../../../_virtual/index21.js';
2
- import { __require as requireUtf8 } from './utf8.js';
3
-
4
- var hasRequiredParserV3;
5
-
6
- function requireParserV3 () {
7
- if (hasRequiredParserV3) return parserV3;
8
- hasRequiredParserV3 = 1;
9
- (function (exports) {
10
- // imported from https://github.com/socketio/engine.io-parser/tree/2.2.x
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.packets = exports.protocol = void 0;
13
- exports.encodePacket = encodePacket;
14
- exports.encodeBase64Packet = encodeBase64Packet;
15
- exports.decodePacket = decodePacket;
16
- exports.decodeBase64Packet = decodeBase64Packet;
17
- exports.encodePayload = encodePayload;
18
- exports.decodePayload = decodePayload;
19
- exports.encodePayloadAsBinary = encodePayloadAsBinary;
20
- exports.decodePayloadAsBinary = decodePayloadAsBinary;
21
- /**
22
- * Module dependencies.
23
- */
24
- var utf8 = requireUtf8();
25
- /**
26
- * Current protocol version.
27
- */
28
- exports.protocol = 3;
29
- const hasBinary = (packets) => {
30
- for (const packet of packets) {
31
- if (packet.data instanceof ArrayBuffer || ArrayBuffer.isView(packet.data)) {
32
- return true;
33
- }
34
- }
35
- return false;
36
- };
37
- /**
38
- * Packet types.
39
- */
40
- exports.packets = {
41
- open: 0 // non-ws
42
- ,
43
- close: 1 // non-ws
44
- ,
45
- ping: 2,
46
- pong: 3,
47
- message: 4,
48
- upgrade: 5,
49
- noop: 6
50
- };
51
- var packetslist = Object.keys(exports.packets);
52
- /**
53
- * Premade error packet.
54
- */
55
- var err = { type: 'error', data: 'parser error' };
56
- const EMPTY_BUFFER = Buffer.concat([]);
57
- /**
58
- * Encodes a packet.
59
- *
60
- * <packet type id> [ <data> ]
61
- *
62
- * Example:
63
- *
64
- * 5hello world
65
- * 3
66
- * 4
67
- *
68
- * Binary is encoded in an identical principle
69
- *
70
- * @api private
71
- */
72
- function encodePacket(packet, supportsBinary, utf8encode, callback) {
73
- if (typeof supportsBinary === 'function') {
74
- callback = supportsBinary;
75
- supportsBinary = null;
76
- }
77
- if (typeof utf8encode === 'function') {
78
- callback = utf8encode;
79
- utf8encode = null;
80
- }
81
- if (Buffer.isBuffer(packet.data)) {
82
- return encodeBuffer(packet, supportsBinary, callback);
83
- }
84
- else if (packet.data && (packet.data.buffer || packet.data) instanceof ArrayBuffer) {
85
- return encodeBuffer({ type: packet.type, data: arrayBufferToBuffer(packet.data) }, supportsBinary, callback);
86
- }
87
- // Sending data as a utf-8 string
88
- var encoded = exports.packets[packet.type];
89
- // data fragment is optional
90
- if (undefined !== packet.data) {
91
- encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);
92
- }
93
- return callback('' + encoded);
94
- }
95
- /**
96
- * Encode Buffer data
97
- */
98
- function encodeBuffer(packet, supportsBinary, callback) {
99
- if (!supportsBinary) {
100
- return encodeBase64Packet(packet, callback);
101
- }
102
- var data = packet.data;
103
- var typeBuffer = Buffer.allocUnsafe(1);
104
- typeBuffer[0] = exports.packets[packet.type];
105
- return callback(Buffer.concat([typeBuffer, data]));
106
- }
107
- /**
108
- * Encodes a packet with binary data in a base64 string
109
- *
110
- * @param {Object} packet, has `type` and `data`
111
- * @return {String} base64 encoded message
112
- */
113
- function encodeBase64Packet(packet, callback) {
114
- var data = Buffer.isBuffer(packet.data) ? packet.data : arrayBufferToBuffer(packet.data);
115
- var message = 'b' + exports.packets[packet.type];
116
- message += data.toString('base64');
117
- return callback(message);
118
- }
119
- /**
120
- * Decodes a packet. Data also available as an ArrayBuffer if requested.
121
- *
122
- * @return {Object} with `type` and `data` (if any)
123
- * @api private
124
- */
125
- function decodePacket(data, binaryType, utf8decode) {
126
- if (data === undefined) {
127
- return err;
128
- }
129
- var type;
130
- // String data
131
- if (typeof data === 'string') {
132
- type = data.charAt(0);
133
- if (type === 'b') {
134
- return decodeBase64Packet(data.slice(1), binaryType);
135
- }
136
- if (utf8decode) {
137
- data = tryDecode(data);
138
- if (data === false) {
139
- return err;
140
- }
141
- }
142
- if (Number(type) != type || !packetslist[type]) {
143
- return err;
144
- }
145
- if (data.length > 1) {
146
- return { type: packetslist[type], data: data.slice(1) };
147
- }
148
- else {
149
- return { type: packetslist[type] };
150
- }
151
- }
152
- // Binary data
153
- if (binaryType === 'arraybuffer') {
154
- // wrap Buffer/ArrayBuffer data into an Uint8Array
155
- var intArray = new Uint8Array(data);
156
- type = intArray[0];
157
- return { type: packetslist[type], data: intArray.buffer.slice(1) };
158
- }
159
- if (data instanceof ArrayBuffer) {
160
- data = arrayBufferToBuffer(data);
161
- }
162
- type = data[0];
163
- return { type: packetslist[type], data: data.slice(1) };
164
- }
165
- function tryDecode(data) {
166
- try {
167
- data = utf8.decode(data, { strict: false });
168
- }
169
- catch (e) {
170
- return false;
171
- }
172
- return data;
173
- }
174
- /**
175
- * Decodes a packet encoded in a base64 string.
176
- *
177
- * @param {String} base64 encoded message
178
- * @return {Object} with `type` and `data` (if any)
179
- */
180
- function decodeBase64Packet(msg, binaryType) {
181
- var type = packetslist[msg.charAt(0)];
182
- var data = Buffer.from(msg.slice(1), 'base64');
183
- if (binaryType === 'arraybuffer') {
184
- var abv = new Uint8Array(data.length);
185
- for (var i = 0; i < abv.length; i++) {
186
- abv[i] = data[i];
187
- }
188
- // @ts-ignore
189
- data = abv.buffer;
190
- }
191
- return { type: type, data: data };
192
- }
193
- /**
194
- * Encodes multiple messages (payload).
195
- *
196
- * <length>:data
197
- *
198
- * Example:
199
- *
200
- * 11:hello world2:hi
201
- *
202
- * If any contents are binary, they will be encoded as base64 strings. Base64
203
- * encoded strings are marked with a b before the length specifier
204
- *
205
- * @param {Array} packets
206
- * @api private
207
- */
208
- function encodePayload(packets, supportsBinary, callback) {
209
- if (typeof supportsBinary === 'function') {
210
- callback = supportsBinary;
211
- supportsBinary = null;
212
- }
213
- if (supportsBinary && hasBinary(packets)) {
214
- return encodePayloadAsBinary(packets, callback);
215
- }
216
- if (!packets.length) {
217
- return callback('0:');
218
- }
219
- function encodeOne(packet, doneCallback) {
220
- encodePacket(packet, supportsBinary, false, function (message) {
221
- doneCallback(null, setLengthHeader(message));
222
- });
223
- }
224
- map(packets, encodeOne, function (err, results) {
225
- return callback(results.join(''));
226
- });
227
- }
228
- function setLengthHeader(message) {
229
- return message.length + ':' + message;
230
- }
231
- /**
232
- * Async array map using after
233
- */
234
- function map(ary, each, done) {
235
- const results = new Array(ary.length);
236
- let count = 0;
237
- for (let i = 0; i < ary.length; i++) {
238
- each(ary[i], (error, msg) => {
239
- results[i] = msg;
240
- if (++count === ary.length) {
241
- done(null, results);
242
- }
243
- });
244
- }
245
- }
246
- /*
247
- * Decodes data when a payload is maybe expected. Possible binary contents are
248
- * decoded from their base64 representation
249
- *
250
- * @param {String} data, callback method
251
- * @api public
252
- */
253
- function decodePayload(data, binaryType, callback) {
254
- if (typeof data !== 'string') {
255
- return decodePayloadAsBinary(data, binaryType, callback);
256
- }
257
- if (typeof binaryType === 'function') {
258
- callback = binaryType;
259
- binaryType = null;
260
- }
261
- if (data === '') {
262
- // parser error - ignoring payload
263
- return callback(err, 0, 1);
264
- }
265
- var length = '', n, msg, packet;
266
- for (var i = 0, l = data.length; i < l; i++) {
267
- var chr = data.charAt(i);
268
- if (chr !== ':') {
269
- length += chr;
270
- continue;
271
- }
272
- // @ts-ignore
273
- if (length === '' || (length != (n = Number(length)))) {
274
- // parser error - ignoring payload
275
- return callback(err, 0, 1);
276
- }
277
- msg = data.slice(i + 1, i + 1 + n);
278
- if (length != msg.length) {
279
- // parser error - ignoring payload
280
- return callback(err, 0, 1);
281
- }
282
- if (msg.length) {
283
- packet = decodePacket(msg, binaryType, false);
284
- if (err.type === packet.type && err.data === packet.data) {
285
- // parser error in individual packet - ignoring payload
286
- return callback(err, 0, 1);
287
- }
288
- var more = callback(packet, i + n, l);
289
- if (false === more)
290
- return;
291
- }
292
- // advance cursor
293
- i += n;
294
- length = '';
295
- }
296
- if (length !== '') {
297
- // parser error - ignoring payload
298
- return callback(err, 0, 1);
299
- }
300
- }
301
- /**
302
- *
303
- * Converts a buffer to a utf8.js encoded string
304
- *
305
- * @api private
306
- */
307
- function bufferToString(buffer) {
308
- var str = '';
309
- for (var i = 0, l = buffer.length; i < l; i++) {
310
- str += String.fromCharCode(buffer[i]);
311
- }
312
- return str;
313
- }
314
- /**
315
- *
316
- * Converts a utf8.js encoded string to a buffer
317
- *
318
- * @api private
319
- */
320
- function stringToBuffer(string) {
321
- var buf = Buffer.allocUnsafe(string.length);
322
- for (var i = 0, l = string.length; i < l; i++) {
323
- buf.writeUInt8(string.charCodeAt(i), i);
324
- }
325
- return buf;
326
- }
327
- /**
328
- *
329
- * Converts an ArrayBuffer to a Buffer
330
- *
331
- * @api private
332
- */
333
- function arrayBufferToBuffer(data) {
334
- // data is either an ArrayBuffer or ArrayBufferView.
335
- var length = data.byteLength || data.length;
336
- var offset = data.byteOffset || 0;
337
- return Buffer.from(data.buffer || data, offset, length);
338
- }
339
- /**
340
- * Encodes multiple messages (payload) as binary.
341
- *
342
- * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
343
- * 255><data>
344
- *
345
- * Example:
346
- * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
347
- *
348
- * @param {Array} packets
349
- * @return {Buffer} encoded payload
350
- * @api private
351
- */
352
- function encodePayloadAsBinary(packets, callback) {
353
- if (!packets.length) {
354
- return callback(EMPTY_BUFFER);
355
- }
356
- map(packets, encodeOneBinaryPacket, function (err, results) {
357
- return callback(Buffer.concat(results));
358
- });
359
- }
360
- function encodeOneBinaryPacket(p, doneCallback) {
361
- function onBinaryPacketEncode(packet) {
362
- var encodingLength = '' + packet.length;
363
- var sizeBuffer;
364
- if (typeof packet === 'string') {
365
- sizeBuffer = Buffer.allocUnsafe(encodingLength.length + 2);
366
- sizeBuffer[0] = 0; // is a string (not true binary = 0)
367
- for (var i = 0; i < encodingLength.length; i++) {
368
- sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
369
- }
370
- sizeBuffer[sizeBuffer.length - 1] = 255;
371
- return doneCallback(null, Buffer.concat([sizeBuffer, stringToBuffer(packet)]));
372
- }
373
- sizeBuffer = Buffer.allocUnsafe(encodingLength.length + 2);
374
- sizeBuffer[0] = 1; // is binary (true binary = 1)
375
- for (var i = 0; i < encodingLength.length; i++) {
376
- sizeBuffer[i + 1] = parseInt(encodingLength[i], 10);
377
- }
378
- sizeBuffer[sizeBuffer.length - 1] = 255;
379
- doneCallback(null, Buffer.concat([sizeBuffer, packet]));
380
- }
381
- encodePacket(p, true, true, onBinaryPacketEncode);
382
- }
383
- /*
384
- * Decodes data when a payload is maybe expected. Strings are decoded by
385
- * interpreting each byte as a key code for entries marked to start with 0. See
386
- * description of encodePayloadAsBinary
387
-
388
- * @param {Buffer} data, callback method
389
- * @api public
390
- */
391
- function decodePayloadAsBinary(data, binaryType, callback) {
392
- if (typeof binaryType === 'function') {
393
- callback = binaryType;
394
- binaryType = null;
395
- }
396
- var bufferTail = data;
397
- var buffers = [];
398
- var i;
399
- while (bufferTail.length > 0) {
400
- var strLen = '';
401
- var isString = bufferTail[0] === 0;
402
- for (i = 1;; i++) {
403
- if (bufferTail[i] === 255)
404
- break;
405
- // 310 = char length of Number.MAX_VALUE
406
- if (strLen.length > 310) {
407
- return callback(err, 0, 1);
408
- }
409
- strLen += '' + bufferTail[i];
410
- }
411
- bufferTail = bufferTail.slice(strLen.length + 1);
412
- var msgLength = parseInt(strLen, 10);
413
- var msg = bufferTail.slice(1, msgLength + 1);
414
- if (isString)
415
- msg = bufferToString(msg);
416
- buffers.push(msg);
417
- bufferTail = bufferTail.slice(msgLength + 1);
418
- }
419
- var total = buffers.length;
420
- for (i = 0; i < total; i++) {
421
- var buffer = buffers[i];
422
- callback(decodePacket(buffer, binaryType, true), i, total);
423
- }
424
- }
425
- } (parserV3));
426
- return parserV3;
427
- }
428
-
429
- export { requireParserV3 as __require };
@@ -1,198 +0,0 @@
1
- /*! https://mths.be/utf8js v2.1.2 by @mathias */
2
-
3
- var utf8;
4
- var hasRequiredUtf8;
5
-
6
- function requireUtf8 () {
7
- if (hasRequiredUtf8) return utf8;
8
- hasRequiredUtf8 = 1;
9
- var stringFromCharCode = String.fromCharCode;
10
- // Taken from https://mths.be/punycode
11
- function ucs2decode(string) {
12
- var output = [];
13
- var counter = 0;
14
- var length = string.length;
15
- var value;
16
- var extra;
17
- while (counter < length) {
18
- value = string.charCodeAt(counter++);
19
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
20
- // high surrogate, and there is a next character
21
- extra = string.charCodeAt(counter++);
22
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
23
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
24
- }
25
- else {
26
- // unmatched surrogate; only append this code unit, in case the next
27
- // code unit is the high surrogate of a surrogate pair
28
- output.push(value);
29
- counter--;
30
- }
31
- }
32
- else {
33
- output.push(value);
34
- }
35
- }
36
- return output;
37
- }
38
- // Taken from https://mths.be/punycode
39
- function ucs2encode(array) {
40
- var length = array.length;
41
- var index = -1;
42
- var value;
43
- var output = '';
44
- while (++index < length) {
45
- value = array[index];
46
- if (value > 0xFFFF) {
47
- value -= 0x10000;
48
- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
49
- value = 0xDC00 | value & 0x3FF;
50
- }
51
- output += stringFromCharCode(value);
52
- }
53
- return output;
54
- }
55
- function checkScalarValue(codePoint, strict) {
56
- if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
57
- if (strict) {
58
- throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
59
- ' is not a scalar value');
60
- }
61
- return false;
62
- }
63
- return true;
64
- }
65
- /*--------------------------------------------------------------------------*/
66
- function createByte(codePoint, shift) {
67
- return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
68
- }
69
- function encodeCodePoint(codePoint, strict) {
70
- if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
71
- return stringFromCharCode(codePoint);
72
- }
73
- var symbol = '';
74
- if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
75
- symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
76
- }
77
- else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
78
- if (!checkScalarValue(codePoint, strict)) {
79
- codePoint = 0xFFFD;
80
- }
81
- symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
82
- symbol += createByte(codePoint, 6);
83
- }
84
- else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
85
- symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
86
- symbol += createByte(codePoint, 12);
87
- symbol += createByte(codePoint, 6);
88
- }
89
- symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
90
- return symbol;
91
- }
92
- function utf8encode(string, opts) {
93
- opts = opts || {};
94
- var strict = false !== opts.strict;
95
- var codePoints = ucs2decode(string);
96
- var length = codePoints.length;
97
- var index = -1;
98
- var codePoint;
99
- var byteString = '';
100
- while (++index < length) {
101
- codePoint = codePoints[index];
102
- byteString += encodeCodePoint(codePoint, strict);
103
- }
104
- return byteString;
105
- }
106
- /*--------------------------------------------------------------------------*/
107
- function readContinuationByte() {
108
- if (byteIndex >= byteCount) {
109
- throw Error('Invalid byte index');
110
- }
111
- var continuationByte = byteArray[byteIndex] & 0xFF;
112
- byteIndex++;
113
- if ((continuationByte & 0xC0) == 0x80) {
114
- return continuationByte & 0x3F;
115
- }
116
- // If we end up here, it’s not a continuation byte
117
- throw Error('Invalid continuation byte');
118
- }
119
- function decodeSymbol(strict) {
120
- var byte1;
121
- var byte2;
122
- var byte3;
123
- var byte4;
124
- var codePoint;
125
- if (byteIndex > byteCount) {
126
- throw Error('Invalid byte index');
127
- }
128
- if (byteIndex == byteCount) {
129
- return false;
130
- }
131
- // Read first byte
132
- byte1 = byteArray[byteIndex] & 0xFF;
133
- byteIndex++;
134
- // 1-byte sequence (no continuation bytes)
135
- if ((byte1 & 0x80) == 0) {
136
- return byte1;
137
- }
138
- // 2-byte sequence
139
- if ((byte1 & 0xE0) == 0xC0) {
140
- byte2 = readContinuationByte();
141
- codePoint = ((byte1 & 0x1F) << 6) | byte2;
142
- if (codePoint >= 0x80) {
143
- return codePoint;
144
- }
145
- else {
146
- throw Error('Invalid continuation byte');
147
- }
148
- }
149
- // 3-byte sequence (may include unpaired surrogates)
150
- if ((byte1 & 0xF0) == 0xE0) {
151
- byte2 = readContinuationByte();
152
- byte3 = readContinuationByte();
153
- codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
154
- if (codePoint >= 0x0800) {
155
- return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;
156
- }
157
- else {
158
- throw Error('Invalid continuation byte');
159
- }
160
- }
161
- // 4-byte sequence
162
- if ((byte1 & 0xF8) == 0xF0) {
163
- byte2 = readContinuationByte();
164
- byte3 = readContinuationByte();
165
- byte4 = readContinuationByte();
166
- codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
167
- (byte3 << 0x06) | byte4;
168
- if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
169
- return codePoint;
170
- }
171
- }
172
- throw Error('Invalid UTF-8 detected');
173
- }
174
- var byteArray;
175
- var byteCount;
176
- var byteIndex;
177
- function utf8decode(byteString, opts) {
178
- opts = opts || {};
179
- var strict = false !== opts.strict;
180
- byteArray = ucs2decode(byteString);
181
- byteCount = byteArray.length;
182
- byteIndex = 0;
183
- var codePoints = [];
184
- var tmp;
185
- while ((tmp = decodeSymbol(strict)) !== false) {
186
- codePoints.push(tmp);
187
- }
188
- return ucs2encode(codePoints);
189
- }
190
- utf8 = {
191
- version: '2.1.2',
192
- encode: utf8encode,
193
- decode: utf8decode
194
- };
195
- return utf8;
196
- }
197
-
198
- export { requireUtf8 as __require };