@wabot-dev/framework 0.0.14 → 0.0.16

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 (361) hide show
  1. package/dist/src/channels/cmd/@cmd.js +1 -1
  2. package/dist/src/channels/cmd/CmdChannel.js +1 -1
  3. package/dist/src/channels/telegram/@telegram.js +1 -1
  4. package/dist/src/channels/telegram/TelegramChannel.js +1 -1
  5. package/dist/src/channels/whatsapp/@whatsapp.js +1 -1
  6. package/dist/src/channels/whatsapp/WhatsAppChannel.js +1 -1
  7. package/dist/src/channels/whatsapp/WhatsAppConnection.js +1 -1
  8. package/dist/src/channels/whatsapp/WhatsAppDevConnection.js +2 -2
  9. package/dist/src/channels/whatsapp/WhatsAppProdConnection.js +1 -1
  10. package/dist/src/controller/socket.io/SocketIO.js +1 -1
  11. package/dist/src/logger/Logger.js +1 -1
  12. package/dist/src/server/runChannel.js +1 -1
  13. package/dist/src/server/runServer.js +4 -4
  14. package/package.json +2 -1
  15. package/dist/src/_virtual/XMLHttpRequest.js +0 -7
  16. package/dist/src/_virtual/_commonjsHelpers.js +0 -32
  17. package/dist/src/_virtual/base64id.js +0 -3
  18. package/dist/src/_virtual/binary.js +0 -3
  19. package/dist/src/_virtual/bom-handling.js +0 -3
  20. package/dist/src/_virtual/broadcast-operator.js +0 -3
  21. package/dist/src/_virtual/browser.js +0 -3
  22. package/dist/src/_virtual/browser2.js +0 -3
  23. package/dist/src/_virtual/browser3.js +0 -3
  24. package/dist/src/_virtual/browser4.js +0 -3
  25. package/dist/src/_virtual/browser5.js +0 -3
  26. package/dist/src/_virtual/buffer-util.js +0 -3
  27. package/dist/src/_virtual/buffer-util2.js +0 -3
  28. package/dist/src/_virtual/buffer-util3.js +0 -3
  29. package/dist/src/_virtual/charset.js +0 -3
  30. package/dist/src/_virtual/charset2.js +0 -3
  31. package/dist/src/_virtual/client.js +0 -3
  32. package/dist/src/_virtual/cluster-adapter.js +0 -3
  33. package/dist/src/_virtual/commons.js +0 -3
  34. package/dist/src/_virtual/dbcs-codec.js +0 -3
  35. package/dist/src/_virtual/decodePacket.js +0 -3
  36. package/dist/src/_virtual/encodePacket.js +0 -3
  37. package/dist/src/_virtual/encoding.js +0 -3
  38. package/dist/src/_virtual/encoding2.js +0 -3
  39. package/dist/src/_virtual/engine.io.js +0 -3
  40. package/dist/src/_virtual/in-memory-adapter.js +0 -3
  41. package/dist/src/_virtual/index.js +0 -7
  42. package/dist/src/_virtual/index10.js +0 -3
  43. package/dist/src/_virtual/index11.js +0 -3
  44. package/dist/src/_virtual/index12.js +0 -3
  45. package/dist/src/_virtual/index13.js +0 -3
  46. package/dist/src/_virtual/index14.js +0 -3
  47. package/dist/src/_virtual/index15.js +0 -3
  48. package/dist/src/_virtual/index16.js +0 -3
  49. package/dist/src/_virtual/index17.js +0 -3
  50. package/dist/src/_virtual/index18.js +0 -3
  51. package/dist/src/_virtual/index19.js +0 -3
  52. package/dist/src/_virtual/index2.js +0 -7
  53. package/dist/src/_virtual/index20.js +0 -3
  54. package/dist/src/_virtual/index21.js +0 -3
  55. package/dist/src/_virtual/index22.js +0 -3
  56. package/dist/src/_virtual/index23.js +0 -3
  57. package/dist/src/_virtual/index24.js +0 -3
  58. package/dist/src/_virtual/index25.js +0 -3
  59. package/dist/src/_virtual/index26.js +0 -3
  60. package/dist/src/_virtual/index27.js +0 -3
  61. package/dist/src/_virtual/index28.js +0 -3
  62. package/dist/src/_virtual/index29.js +0 -3
  63. package/dist/src/_virtual/index3.js +0 -7
  64. package/dist/src/_virtual/index30.js +0 -3
  65. package/dist/src/_virtual/index31.js +0 -3
  66. package/dist/src/_virtual/index32.js +0 -3
  67. package/dist/src/_virtual/index33.js +0 -3
  68. package/dist/src/_virtual/index4.js +0 -3
  69. package/dist/src/_virtual/index5.js +0 -3
  70. package/dist/src/_virtual/index6.js +0 -3
  71. package/dist/src/_virtual/index7.js +0 -3
  72. package/dist/src/_virtual/index8.js +0 -6
  73. package/dist/src/_virtual/index9.js +0 -3
  74. package/dist/src/_virtual/inherits.js +0 -3
  75. package/dist/src/_virtual/inherits_browser.js +0 -3
  76. package/dist/src/_virtual/is-binary.js +0 -3
  77. package/dist/src/_virtual/language.js +0 -3
  78. package/dist/src/_virtual/language2.js +0 -3
  79. package/dist/src/_virtual/mediaType.js +0 -3
  80. package/dist/src/_virtual/mediaType2.js +0 -3
  81. package/dist/src/_virtual/namespace.js +0 -3
  82. package/dist/src/_virtual/node.js +0 -3
  83. package/dist/src/_virtual/node2.js +0 -3
  84. package/dist/src/_virtual/node3.js +0 -3
  85. package/dist/src/_virtual/node4.js +0 -3
  86. package/dist/src/_virtual/node5.js +0 -3
  87. package/dist/src/_virtual/parent-namespace.js +0 -3
  88. package/dist/src/_virtual/polling-jsonp.js +0 -3
  89. package/dist/src/_virtual/polling.js +0 -3
  90. package/dist/src/_virtual/polling2.js +0 -3
  91. package/dist/src/_virtual/receiver.js +0 -3
  92. package/dist/src/_virtual/sbcs-codec.js +0 -3
  93. package/dist/src/_virtual/sender.js +0 -3
  94. package/dist/src/_virtual/server.js +0 -3
  95. package/dist/src/_virtual/socket-types.js +0 -3
  96. package/dist/src/_virtual/socket.js +0 -3
  97. package/dist/src/_virtual/socket2.js +0 -3
  98. package/dist/src/_virtual/stream.js +0 -3
  99. package/dist/src/_virtual/transport.js +0 -3
  100. package/dist/src/_virtual/typed-events.js +0 -3
  101. package/dist/src/_virtual/userver.js +0 -3
  102. package/dist/src/_virtual/utf16.js +0 -3
  103. package/dist/src/_virtual/utf32.js +0 -3
  104. package/dist/src/_virtual/utf7.js +0 -3
  105. package/dist/src/_virtual/uws.js +0 -3
  106. package/dist/src/_virtual/validation.js +0 -3
  107. package/dist/src/_virtual/validation2.js +0 -3
  108. package/dist/src/_virtual/validation3.js +0 -3
  109. package/dist/src/_virtual/websocket-server.js +0 -3
  110. package/dist/src/_virtual/websocket.js +0 -7
  111. package/dist/src/_virtual/websocket2.js +0 -3
  112. package/dist/src/_virtual/websocket3.js +0 -3
  113. package/dist/src/_virtual/webtransport.js +0 -3
  114. package/dist/src/_virtual/yeast.js +0 -3
  115. package/dist/src/node_modules/@socket.io/component-emitter/lib/esm/index.js +0 -171
  116. package/dist/src/node_modules/base64id/lib/base64id.js +0 -117
  117. package/dist/src/node_modules/body-parser/index.js +0 -96
  118. package/dist/src/node_modules/body-parser/lib/read.js +0 -225
  119. package/dist/src/node_modules/body-parser/lib/types/json.js +0 -222
  120. package/dist/src/node_modules/body-parser/lib/types/raw.js +0 -90
  121. package/dist/src/node_modules/body-parser/lib/types/text.js +0 -95
  122. package/dist/src/node_modules/body-parser/lib/types/urlencoded.js +0 -194
  123. package/dist/src/node_modules/body-parser/lib/utils.js +0 -96
  124. package/dist/src/node_modules/bytes/index.js +0 -180
  125. package/dist/src/node_modules/call-bind-apply-helpers/actualApply.js +0 -24
  126. package/dist/src/node_modules/call-bind-apply-helpers/functionApply.js +0 -13
  127. package/dist/src/node_modules/call-bind-apply-helpers/functionCall.js +0 -13
  128. package/dist/src/node_modules/call-bind-apply-helpers/index.js +0 -29
  129. package/dist/src/node_modules/call-bind-apply-helpers/reflectApply.js +0 -13
  130. package/dist/src/node_modules/call-bound/index.js +0 -31
  131. package/dist/src/node_modules/content-type/index.js +0 -235
  132. package/dist/src/node_modules/cookie/index.js +0 -345
  133. package/dist/src/node_modules/cors/lib/index.js +0 -249
  134. package/dist/src/node_modules/debug/src/browser.js +0 -286
  135. package/dist/src/node_modules/debug/src/common.js +0 -303
  136. package/dist/src/node_modules/debug/src/index.js +0 -23
  137. package/dist/src/node_modules/debug/src/node.js +0 -279
  138. package/dist/src/node_modules/depd/index.js +0 -550
  139. package/dist/src/node_modules/dunder-proto/get.js +0 -42
  140. package/dist/src/node_modules/ee-first/index.js +0 -104
  141. package/dist/src/node_modules/engine.io/build/engine.io.js +0 -73
  142. package/dist/src/node_modules/engine.io/build/parser-v3/index.js +0 -429
  143. package/dist/src/node_modules/engine.io/build/parser-v3/utf8.js +0 -198
  144. package/dist/src/node_modules/engine.io/build/server.js +0 -808
  145. package/dist/src/node_modules/engine.io/build/socket.js +0 -469
  146. package/dist/src/node_modules/engine.io/build/transport.js +0 -131
  147. package/dist/src/node_modules/engine.io/build/transports/index.js +0 -37
  148. package/dist/src/node_modules/engine.io/build/transports/polling-jsonp.js +0 -53
  149. package/dist/src/node_modules/engine.io/build/transports/polling.js +0 -346
  150. package/dist/src/node_modules/engine.io/build/transports/websocket.js +0 -106
  151. package/dist/src/node_modules/engine.io/build/transports/webtransport.js +0 -76
  152. package/dist/src/node_modules/engine.io/build/transports-uws/index.js +0 -20
  153. package/dist/src/node_modules/engine.io/build/transports-uws/polling.js +0 -378
  154. package/dist/src/node_modules/engine.io/build/transports-uws/websocket.js +0 -85
  155. package/dist/src/node_modules/engine.io/build/userver.js +0 -292
  156. package/dist/src/node_modules/engine.io/node_modules/accepts/index.js +0 -250
  157. package/dist/src/node_modules/engine.io/node_modules/debug/src/browser.js +0 -285
  158. package/dist/src/node_modules/engine.io/node_modules/debug/src/common.js +0 -285
  159. package/dist/src/node_modules/engine.io/node_modules/debug/src/index.js +0 -23
  160. package/dist/src/node_modules/engine.io/node_modules/debug/src/node.js +0 -279
  161. package/dist/src/node_modules/engine.io/node_modules/mime-db/db.json.js +0 -10704
  162. package/dist/src/node_modules/engine.io/node_modules/mime-db/index.js +0 -24
  163. package/dist/src/node_modules/engine.io/node_modules/mime-types/index.js +0 -202
  164. package/dist/src/node_modules/engine.io/node_modules/negotiator/index.js +0 -96
  165. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/charset.js +0 -179
  166. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/encoding.js +0 -193
  167. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/language.js +0 -188
  168. package/dist/src/node_modules/engine.io/node_modules/negotiator/lib/mediaType.js +0 -304
  169. package/dist/src/node_modules/engine.io/node_modules/ws/index.js +0 -28
  170. package/dist/src/node_modules/engine.io/node_modules/ws/lib/buffer-util.js +0 -142
  171. package/dist/src/node_modules/engine.io/node_modules/ws/lib/constants.js +0 -21
  172. package/dist/src/node_modules/engine.io/node_modules/ws/lib/event-target.js +0 -303
  173. package/dist/src/node_modules/engine.io/node_modules/ws/lib/extension.js +0 -214
  174. package/dist/src/node_modules/engine.io/node_modules/ws/lib/limiter.js +0 -64
  175. package/dist/src/node_modules/engine.io/node_modules/ws/lib/permessage-deflate.js +0 -528
  176. package/dist/src/node_modules/engine.io/node_modules/ws/lib/receiver.js +0 -719
  177. package/dist/src/node_modules/engine.io/node_modules/ws/lib/sender.js +0 -513
  178. package/dist/src/node_modules/engine.io/node_modules/ws/lib/stream.js +0 -170
  179. package/dist/src/node_modules/engine.io/node_modules/ws/lib/subprotocol.js +0 -73
  180. package/dist/src/node_modules/engine.io/node_modules/ws/lib/validation.js +0 -141
  181. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket-server.js +0 -559
  182. package/dist/src/node_modules/engine.io/node_modules/ws/lib/websocket.js +0 -1363
  183. package/dist/src/node_modules/engine.io-client/build/esm/contrib/has-cors.js +0 -13
  184. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseqs.js +0 -36
  185. package/dist/src/node_modules/engine.io-client/build/esm/contrib/parseuri.js +0 -66
  186. package/dist/src/node_modules/engine.io-client/build/esm/globals.node.js +0 -92
  187. package/dist/src/node_modules/engine.io-client/build/esm/index.js +0 -17
  188. package/dist/src/node_modules/engine.io-client/build/esm/socket.js +0 -728
  189. package/dist/src/node_modules/engine.io-client/build/esm/transport.js +0 -143
  190. package/dist/src/node_modules/engine.io-client/build/esm/transports/index.js +0 -11
  191. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +0 -256
  192. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling-xhr.node.js +0 -21
  193. package/dist/src/node_modules/engine.io-client/build/esm/transports/polling.js +0 -146
  194. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.js +0 -107
  195. package/dist/src/node_modules/engine.io-client/build/esm/transports/websocket.node.js +0 -48
  196. package/dist/src/node_modules/engine.io-client/build/esm/transports/webtransport.js +0 -83
  197. package/dist/src/node_modules/engine.io-client/build/esm/util.js +0 -62
  198. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js +0 -142
  199. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/constants.js +0 -21
  200. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/event-target.js +0 -303
  201. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/extension.js +0 -214
  202. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/limiter.js +0 -64
  203. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js +0 -528
  204. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/receiver.js +0 -719
  205. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/sender.js +0 -513
  206. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/stream.js +0 -170
  207. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js +0 -73
  208. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/validation.js +0 -141
  209. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js +0 -559
  210. package/dist/src/node_modules/engine.io-client/node_modules/ws/lib/websocket.js +0 -1363
  211. package/dist/src/node_modules/engine.io-parser/build/cjs/commons.js +0 -29
  212. package/dist/src/node_modules/engine.io-parser/build/cjs/decodePacket.js +0 -70
  213. package/dist/src/node_modules/engine.io-parser/build/cjs/encodePacket.js +0 -51
  214. package/dist/src/node_modules/engine.io-parser/build/cjs/index.js +0 -179
  215. package/dist/src/node_modules/engine.io-parser/build/esm/commons.js +0 -15
  216. package/dist/src/node_modules/engine.io-parser/build/esm/decodePacket.js +0 -58
  217. package/dist/src/node_modules/engine.io-parser/build/esm/encodePacket.js +0 -36
  218. package/dist/src/node_modules/engine.io-parser/build/esm/index.js +0 -158
  219. package/dist/src/node_modules/es-define-property/index.js +0 -23
  220. package/dist/src/node_modules/es-errors/eval.js +0 -13
  221. package/dist/src/node_modules/es-errors/index.js +0 -13
  222. package/dist/src/node_modules/es-errors/range.js +0 -13
  223. package/dist/src/node_modules/es-errors/ref.js +0 -13
  224. package/dist/src/node_modules/es-errors/syntax.js +0 -13
  225. package/dist/src/node_modules/es-errors/type.js +0 -13
  226. package/dist/src/node_modules/es-errors/uri.js +0 -13
  227. package/dist/src/node_modules/es-object-atoms/index.js +0 -13
  228. package/dist/src/node_modules/function-bind/implementation.js +0 -93
  229. package/dist/src/node_modules/function-bind/index.js +0 -16
  230. package/dist/src/node_modules/get-intrinsic/index.js +0 -413
  231. package/dist/src/node_modules/get-proto/Object.getPrototypeOf.js +0 -17
  232. package/dist/src/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -13
  233. package/dist/src/node_modules/get-proto/index.js +0 -40
  234. package/dist/src/node_modules/gopd/gOPD.js +0 -13
  235. package/dist/src/node_modules/gopd/index.js +0 -26
  236. package/dist/src/node_modules/has-symbols/index.js +0 -25
  237. package/dist/src/node_modules/has-symbols/shams.js +0 -54
  238. package/dist/src/node_modules/hasown/index.js +0 -19
  239. package/dist/src/node_modules/http-errors/index.js +0 -306
  240. package/dist/src/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -598
  241. package/dist/src/node_modules/iconv-lite/encodings/dbcs-data.js +0 -206
  242. package/dist/src/node_modules/iconv-lite/encodings/index.js +0 -44
  243. package/dist/src/node_modules/iconv-lite/encodings/internal.js +0 -210
  244. package/dist/src/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -83
  245. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -460
  246. package/dist/src/node_modules/iconv-lite/encodings/sbcs-data.js +0 -187
  247. package/dist/src/node_modules/iconv-lite/encodings/tables/big5-added.json.js +0 -506
  248. package/dist/src/node_modules/iconv-lite/encodings/tables/cp936.json.js +0 -2621
  249. package/dist/src/node_modules/iconv-lite/encodings/tables/cp949.json.js +0 -2380
  250. package/dist/src/node_modules/iconv-lite/encodings/tables/cp950.json.js +0 -729
  251. package/dist/src/node_modules/iconv-lite/encodings/tables/eucjp.json.js +0 -822
  252. package/dist/src/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json.js +0 -424
  253. package/dist/src/node_modules/iconv-lite/encodings/tables/gbk-added.json.js +0 -264
  254. package/dist/src/node_modules/iconv-lite/encodings/tables/shiftjis.json.js +0 -548
  255. package/dist/src/node_modules/iconv-lite/encodings/utf16.js +0 -206
  256. package/dist/src/node_modules/iconv-lite/encodings/utf32.js +0 -329
  257. package/dist/src/node_modules/iconv-lite/encodings/utf7.js +0 -297
  258. package/dist/src/node_modules/iconv-lite/lib/bom-handling.js +0 -61
  259. package/dist/src/node_modules/iconv-lite/lib/index.js +0 -192
  260. package/dist/src/node_modules/iconv-lite/lib/streams.js +0 -120
  261. package/dist/src/node_modules/inherits/inherits.js +0 -21
  262. package/dist/src/node_modules/inherits/inherits_browser.js +0 -38
  263. package/dist/src/node_modules/math-intrinsics/abs.js +0 -13
  264. package/dist/src/node_modules/math-intrinsics/floor.js +0 -13
  265. package/dist/src/node_modules/math-intrinsics/isNaN.js +0 -15
  266. package/dist/src/node_modules/math-intrinsics/max.js +0 -13
  267. package/dist/src/node_modules/math-intrinsics/min.js +0 -13
  268. package/dist/src/node_modules/math-intrinsics/pow.js +0 -13
  269. package/dist/src/node_modules/math-intrinsics/round.js +0 -13
  270. package/dist/src/node_modules/math-intrinsics/sign.js +0 -22
  271. package/dist/src/node_modules/media-typer/index.js +0 -153
  272. package/dist/src/node_modules/mime-db/db.json.js +0 -11656
  273. package/dist/src/node_modules/mime-db/index.js +0 -24
  274. package/dist/src/node_modules/mime-types/index.js +0 -226
  275. package/dist/src/node_modules/mime-types/mimeScore.js +0 -62
  276. package/dist/src/node_modules/ms/index.js +0 -172
  277. package/dist/src/node_modules/object-assign/index.js +0 -99
  278. package/dist/src/node_modules/object-inspect/index.js +0 -557
  279. package/dist/src/node_modules/object-inspect/util.inspect.js +0 -13
  280. package/dist/src/node_modules/on-finished/index.js +0 -245
  281. package/dist/src/node_modules/qs/lib/formats.js +0 -32
  282. package/dist/src/node_modules/qs/lib/index.js +0 -24
  283. package/dist/src/node_modules/qs/lib/parse.js +0 -339
  284. package/dist/src/node_modules/qs/lib/stringify.js +0 -369
  285. package/dist/src/node_modules/qs/lib/utils.js +0 -279
  286. package/dist/src/node_modules/raw-body/index.js +0 -351
  287. package/dist/src/node_modules/safer-buffer/safer.js +0 -88
  288. package/dist/src/node_modules/setprototypeof/index.js +0 -26
  289. package/dist/src/node_modules/side-channel/index.js +0 -58
  290. package/dist/src/node_modules/side-channel-list/index.js +0 -125
  291. package/dist/src/node_modules/side-channel-map/index.js +0 -82
  292. package/dist/src/node_modules/side-channel-weakmap/index.js +0 -99
  293. package/dist/src/node_modules/socket.io/dist/broadcast-operator.js +0 -448
  294. package/dist/src/node_modules/socket.io/dist/client.js +0 -281
  295. package/dist/src/node_modules/socket.io/dist/index.js +0 -837
  296. package/dist/src/node_modules/socket.io/dist/namespace.js +0 -597
  297. package/dist/src/node_modules/socket.io/dist/parent-namespace.js +0 -101
  298. package/dist/src/node_modules/socket.io/dist/socket-types.js +0 -21
  299. package/dist/src/node_modules/socket.io/dist/socket.js +0 -993
  300. package/dist/src/node_modules/socket.io/dist/typed-events.js +0 -92
  301. package/dist/src/node_modules/socket.io/dist/uws.js +0 -149
  302. package/dist/src/node_modules/socket.io/node_modules/accepts/index.js +0 -250
  303. package/dist/src/node_modules/socket.io/node_modules/debug/src/browser.js +0 -285
  304. package/dist/src/node_modules/socket.io/node_modules/debug/src/common.js +0 -285
  305. package/dist/src/node_modules/socket.io/node_modules/debug/src/index.js +0 -23
  306. package/dist/src/node_modules/socket.io/node_modules/debug/src/node.js +0 -279
  307. package/dist/src/node_modules/socket.io/node_modules/mime-db/db.json.js +0 -10704
  308. package/dist/src/node_modules/socket.io/node_modules/mime-db/index.js +0 -24
  309. package/dist/src/node_modules/socket.io/node_modules/mime-types/index.js +0 -202
  310. package/dist/src/node_modules/socket.io/node_modules/negotiator/index.js +0 -96
  311. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/charset.js +0 -179
  312. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/encoding.js +0 -193
  313. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/language.js +0 -188
  314. package/dist/src/node_modules/socket.io/node_modules/negotiator/lib/mediaType.js +0 -304
  315. package/dist/src/node_modules/socket.io/package.json.js +0 -5
  316. package/dist/src/node_modules/socket.io/wrapper.js +0 -5
  317. package/dist/src/node_modules/socket.io-adapter/dist/cluster-adapter.js +0 -689
  318. package/dist/src/node_modules/socket.io-adapter/dist/contrib/yeast.js +0 -64
  319. package/dist/src/node_modules/socket.io-adapter/dist/in-memory-adapter.js +0 -407
  320. package/dist/src/node_modules/socket.io-adapter/dist/index.js +0 -24
  321. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/browser.js +0 -285
  322. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/common.js +0 -285
  323. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/index.js +0 -23
  324. package/dist/src/node_modules/socket.io-adapter/node_modules/debug/src/node.js +0 -279
  325. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/index.js +0 -28
  326. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/buffer-util.js +0 -142
  327. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/constants.js +0 -21
  328. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/event-target.js +0 -303
  329. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/extension.js +0 -214
  330. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/limiter.js +0 -64
  331. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/permessage-deflate.js +0 -528
  332. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/receiver.js +0 -719
  333. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/sender.js +0 -513
  334. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/stream.js +0 -170
  335. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/subprotocol.js +0 -73
  336. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/validation.js +0 -141
  337. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket-server.js +0 -559
  338. package/dist/src/node_modules/socket.io-adapter/node_modules/ws/lib/websocket.js +0 -1363
  339. package/dist/src/node_modules/socket.io-client/build/esm/contrib/backo2.js +0 -68
  340. package/dist/src/node_modules/socket.io-client/build/esm/index.js +0 -50
  341. package/dist/src/node_modules/socket.io-client/build/esm/manager.js +0 -373
  342. package/dist/src/node_modules/socket.io-client/build/esm/on.js +0 -8
  343. package/dist/src/node_modules/socket.io-client/build/esm/socket.js +0 -884
  344. package/dist/src/node_modules/socket.io-client/build/esm/url.js +0 -63
  345. package/dist/src/node_modules/socket.io-parser/build/cjs/binary.js +0 -99
  346. package/dist/src/node_modules/socket.io-parser/build/cjs/index.js +0 -337
  347. package/dist/src/node_modules/socket.io-parser/build/cjs/is-binary.js +0 -65
  348. package/dist/src/node_modules/socket.io-parser/build/esm/binary.js +0 -86
  349. package/dist/src/node_modules/socket.io-parser/build/esm/index.js +0 -314
  350. package/dist/src/node_modules/socket.io-parser/build/esm/is-binary.js +0 -52
  351. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/browser.js +0 -285
  352. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/common.js +0 -285
  353. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/index.js +0 -23
  354. package/dist/src/node_modules/socket.io-parser/node_modules/debug/src/node.js +0 -279
  355. package/dist/src/node_modules/statuses/codes.json.js +0 -67
  356. package/dist/src/node_modules/statuses/index.js +0 -157
  357. package/dist/src/node_modules/toidentifier/index.js +0 -41
  358. package/dist/src/node_modules/type-is/index.js +0 -263
  359. package/dist/src/node_modules/unpipe/index.js +0 -78
  360. package/dist/src/node_modules/vary/index.js +0 -159
  361. package/dist/src/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js +0 -702
@@ -1,598 +0,0 @@
1
- import { __exports as dbcsCodec } from '../../../_virtual/dbcs-codec.js';
2
- import { __require as requireSafer } from '../../safer-buffer/safer.js';
3
-
4
- var hasRequiredDbcsCodec;
5
-
6
- function requireDbcsCodec () {
7
- if (hasRequiredDbcsCodec) return dbcsCodec;
8
- hasRequiredDbcsCodec = 1;
9
- var Buffer = requireSafer().Buffer;
10
-
11
- // Multibyte codec. In this scheme, a character is represented by 1 or more bytes.
12
- // Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences.
13
- // To save memory and loading time, we read table files only when requested.
14
-
15
- dbcsCodec._dbcs = DBCSCodec;
16
-
17
- var UNASSIGNED = -1,
18
- GB18030_CODE = -2,
19
- SEQ_START = -10,
20
- NODE_START = -1e3,
21
- UNASSIGNED_NODE = new Array(0x100),
22
- DEF_CHAR = -1;
23
-
24
- for (var i = 0; i < 0x100; i++)
25
- UNASSIGNED_NODE[i] = UNASSIGNED;
26
-
27
-
28
- // Class DBCSCodec reads and initializes mapping tables.
29
- function DBCSCodec(codecOptions, iconv) {
30
- this.encodingName = codecOptions.encodingName;
31
- if (!codecOptions)
32
- throw new Error("DBCS codec is called without the data.")
33
- if (!codecOptions.table)
34
- throw new Error("Encoding '" + this.encodingName + "' has no data.");
35
-
36
- // Load tables.
37
- var mappingTable = codecOptions.table();
38
-
39
-
40
- // Decode tables: MBCS -> Unicode.
41
-
42
- // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256.
43
- // Trie root is decodeTables[0].
44
- // Values: >= 0 -> unicode character code. can be > 0xFFFF
45
- // == UNASSIGNED -> unknown/unassigned sequence.
46
- // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence.
47
- // <= NODE_START -> index of the next node in our trie to process next byte.
48
- // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq.
49
- this.decodeTables = [];
50
- this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node.
51
-
52
- // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here.
53
- this.decodeTableSeq = [];
54
-
55
- // Actual mapping tables consist of chunks. Use them to fill up decode tables.
56
- for (var i = 0; i < mappingTable.length; i++)
57
- this._addDecodeChunk(mappingTable[i]);
58
-
59
- // Load & create GB18030 tables when needed.
60
- if (typeof codecOptions.gb18030 === 'function') {
61
- this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges.
62
-
63
- // Add GB18030 common decode nodes.
64
- var commonThirdByteNodeIdx = this.decodeTables.length;
65
- this.decodeTables.push(UNASSIGNED_NODE.slice(0));
66
-
67
- var commonFourthByteNodeIdx = this.decodeTables.length;
68
- this.decodeTables.push(UNASSIGNED_NODE.slice(0));
69
-
70
- // Fill out the tree
71
- var firstByteNode = this.decodeTables[0];
72
- for (var i = 0x81; i <= 0xFE; i++) {
73
- var secondByteNode = this.decodeTables[NODE_START - firstByteNode[i]];
74
- for (var j = 0x30; j <= 0x39; j++) {
75
- if (secondByteNode[j] === UNASSIGNED) {
76
- secondByteNode[j] = NODE_START - commonThirdByteNodeIdx;
77
- } else if (secondByteNode[j] > NODE_START) {
78
- throw new Error("gb18030 decode tables conflict at byte 2");
79
- }
80
-
81
- var thirdByteNode = this.decodeTables[NODE_START - secondByteNode[j]];
82
- for (var k = 0x81; k <= 0xFE; k++) {
83
- if (thirdByteNode[k] === UNASSIGNED) {
84
- thirdByteNode[k] = NODE_START - commonFourthByteNodeIdx;
85
- } else if (thirdByteNode[k] === NODE_START - commonFourthByteNodeIdx) {
86
- continue;
87
- } else if (thirdByteNode[k] > NODE_START) {
88
- throw new Error("gb18030 decode tables conflict at byte 3");
89
- }
90
-
91
- var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k]];
92
- for (var l = 0x30; l <= 0x39; l++) {
93
- if (fourthByteNode[l] === UNASSIGNED)
94
- fourthByteNode[l] = GB18030_CODE;
95
- }
96
- }
97
- }
98
- }
99
- }
100
-
101
- this.defaultCharUnicode = iconv.defaultCharUnicode;
102
-
103
-
104
- // Encode tables: Unicode -> DBCS.
105
-
106
- // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance.
107
- // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null.
108
- // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.).
109
- // == UNASSIGNED -> no conversion found. Output a default char.
110
- // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence.
111
- this.encodeTable = [];
112
-
113
- // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of
114
- // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key
115
- // means end of sequence (needed when one sequence is a strict subsequence of another).
116
- // Objects are kept separately from encodeTable to increase performance.
117
- this.encodeTableSeq = [];
118
-
119
- // Some chars can be decoded, but need not be encoded.
120
- var skipEncodeChars = {};
121
- if (codecOptions.encodeSkipVals)
122
- for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) {
123
- var val = codecOptions.encodeSkipVals[i];
124
- if (typeof val === 'number')
125
- skipEncodeChars[val] = true;
126
- else
127
- for (var j = val.from; j <= val.to; j++)
128
- skipEncodeChars[j] = true;
129
- }
130
-
131
- // Use decode trie to recursively fill out encode tables.
132
- this._fillEncodeTable(0, 0, skipEncodeChars);
133
-
134
- // Add more encoding pairs when needed.
135
- if (codecOptions.encodeAdd) {
136
- for (var uChar in codecOptions.encodeAdd)
137
- if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar))
138
- this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]);
139
- }
140
-
141
- this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)];
142
- if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?'];
143
- if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0);
144
- }
145
-
146
- DBCSCodec.prototype.encoder = DBCSEncoder;
147
- DBCSCodec.prototype.decoder = DBCSDecoder;
148
-
149
- // Decoder helpers
150
- DBCSCodec.prototype._getDecodeTrieNode = function(addr) {
151
- var bytes = [];
152
- for (; addr > 0; addr >>>= 8)
153
- bytes.push(addr & 0xFF);
154
- if (bytes.length == 0)
155
- bytes.push(0);
156
-
157
- var node = this.decodeTables[0];
158
- for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie.
159
- var val = node[bytes[i]];
160
-
161
- if (val == UNASSIGNED) { // Create new node.
162
- node[bytes[i]] = NODE_START - this.decodeTables.length;
163
- this.decodeTables.push(node = UNASSIGNED_NODE.slice(0));
164
- }
165
- else if (val <= NODE_START) { // Existing node.
166
- node = this.decodeTables[NODE_START - val];
167
- }
168
- else
169
- throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16));
170
- }
171
- return node;
172
- };
173
-
174
-
175
- DBCSCodec.prototype._addDecodeChunk = function(chunk) {
176
- // First element of chunk is the hex mbcs code where we start.
177
- var curAddr = parseInt(chunk[0], 16);
178
-
179
- // Choose the decoding node where we'll write our chars.
180
- var writeTable = this._getDecodeTrieNode(curAddr);
181
- curAddr = curAddr & 0xFF;
182
-
183
- // Write all other elements of the chunk to the table.
184
- for (var k = 1; k < chunk.length; k++) {
185
- var part = chunk[k];
186
- if (typeof part === "string") { // String, write as-is.
187
- for (var l = 0; l < part.length;) {
188
- var code = part.charCodeAt(l++);
189
- if (0xD800 <= code && code < 0xDC00) { // Decode surrogate
190
- var codeTrail = part.charCodeAt(l++);
191
- if (0xDC00 <= codeTrail && codeTrail < 0xE000)
192
- writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00);
193
- else
194
- throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]);
195
- }
196
- else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used)
197
- var len = 0xFFF - code + 2;
198
- var seq = [];
199
- for (var m = 0; m < len; m++)
200
- seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq.
201
-
202
- writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length;
203
- this.decodeTableSeq.push(seq);
204
- }
205
- else
206
- writeTable[curAddr++] = code; // Basic char
207
- }
208
- }
209
- else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character.
210
- var charCode = writeTable[curAddr - 1] + 1;
211
- for (var l = 0; l < part; l++)
212
- writeTable[curAddr++] = charCode++;
213
- }
214
- else
215
- throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]);
216
- }
217
- if (curAddr > 0xFF)
218
- throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr);
219
- };
220
-
221
- // Encoder helpers
222
- DBCSCodec.prototype._getEncodeBucket = function(uCode) {
223
- var high = uCode >> 8; // This could be > 0xFF because of astral characters.
224
- if (this.encodeTable[high] === undefined)
225
- this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand.
226
- return this.encodeTable[high];
227
- };
228
-
229
- DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) {
230
- var bucket = this._getEncodeBucket(uCode);
231
- var low = uCode & 0xFF;
232
- if (bucket[low] <= SEQ_START)
233
- this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it.
234
- else if (bucket[low] == UNASSIGNED)
235
- bucket[low] = dbcsCode;
236
- };
237
-
238
- DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) {
239
-
240
- // Get the root of character tree according to first character of the sequence.
241
- var uCode = seq[0];
242
- var bucket = this._getEncodeBucket(uCode);
243
- var low = uCode & 0xFF;
244
-
245
- var node;
246
- if (bucket[low] <= SEQ_START) {
247
- // There's already a sequence with - use it.
248
- node = this.encodeTableSeq[SEQ_START-bucket[low]];
249
- }
250
- else {
251
- // There was no sequence object - allocate a new one.
252
- node = {};
253
- if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence.
254
- bucket[low] = SEQ_START - this.encodeTableSeq.length;
255
- this.encodeTableSeq.push(node);
256
- }
257
-
258
- // Traverse the character tree, allocating new nodes as needed.
259
- for (var j = 1; j < seq.length-1; j++) {
260
- var oldVal = node[uCode];
261
- if (typeof oldVal === 'object')
262
- node = oldVal;
263
- else {
264
- node = node[uCode] = {};
265
- if (oldVal !== undefined)
266
- node[DEF_CHAR] = oldVal;
267
- }
268
- }
269
-
270
- // Set the leaf to given dbcsCode.
271
- uCode = seq[seq.length-1];
272
- node[uCode] = dbcsCode;
273
- };
274
-
275
- DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) {
276
- var node = this.decodeTables[nodeIdx];
277
- var hasValues = false;
278
- var subNodeEmpty = {};
279
- for (var i = 0; i < 0x100; i++) {
280
- var uCode = node[i];
281
- var mbCode = prefix + i;
282
- if (skipEncodeChars[mbCode])
283
- continue;
284
-
285
- if (uCode >= 0) {
286
- this._setEncodeChar(uCode, mbCode);
287
- hasValues = true;
288
- } else if (uCode <= NODE_START) {
289
- var subNodeIdx = NODE_START - uCode;
290
- if (!subNodeEmpty[subNodeIdx]) { // Skip empty subtrees (they are too large in gb18030).
291
- var newPrefix = (mbCode << 8) >>> 0; // NOTE: '>>> 0' keeps 32-bit num positive.
292
- if (this._fillEncodeTable(subNodeIdx, newPrefix, skipEncodeChars))
293
- hasValues = true;
294
- else
295
- subNodeEmpty[subNodeIdx] = true;
296
- }
297
- } else if (uCode <= SEQ_START) {
298
- this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode);
299
- hasValues = true;
300
- }
301
- }
302
- return hasValues;
303
- };
304
-
305
-
306
-
307
- // == Encoder ==================================================================
308
-
309
- function DBCSEncoder(options, codec) {
310
- // Encoder state
311
- this.leadSurrogate = -1;
312
- this.seqObj = undefined;
313
-
314
- // Static data
315
- this.encodeTable = codec.encodeTable;
316
- this.encodeTableSeq = codec.encodeTableSeq;
317
- this.defaultCharSingleByte = codec.defCharSB;
318
- this.gb18030 = codec.gb18030;
319
- }
320
-
321
- DBCSEncoder.prototype.write = function(str) {
322
- var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)),
323
- leadSurrogate = this.leadSurrogate,
324
- seqObj = this.seqObj, nextChar = -1,
325
- i = 0, j = 0;
326
-
327
- while (true) {
328
- // 0. Get next character.
329
- if (nextChar === -1) {
330
- if (i == str.length) break;
331
- var uCode = str.charCodeAt(i++);
332
- }
333
- else {
334
- var uCode = nextChar;
335
- nextChar = -1;
336
- }
337
-
338
- // 1. Handle surrogates.
339
- if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates.
340
- if (uCode < 0xDC00) { // We've got lead surrogate.
341
- if (leadSurrogate === -1) {
342
- leadSurrogate = uCode;
343
- continue;
344
- } else {
345
- leadSurrogate = uCode;
346
- // Double lead surrogate found.
347
- uCode = UNASSIGNED;
348
- }
349
- } else { // We've got trail surrogate.
350
- if (leadSurrogate !== -1) {
351
- uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00);
352
- leadSurrogate = -1;
353
- } else {
354
- // Incomplete surrogate pair - only trail surrogate found.
355
- uCode = UNASSIGNED;
356
- }
357
-
358
- }
359
- }
360
- else if (leadSurrogate !== -1) {
361
- // Incomplete surrogate pair - only lead surrogate found.
362
- nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char.
363
- leadSurrogate = -1;
364
- }
365
-
366
- // 2. Convert uCode character.
367
- var dbcsCode = UNASSIGNED;
368
- if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence
369
- var resCode = seqObj[uCode];
370
- if (typeof resCode === 'object') { // Sequence continues.
371
- seqObj = resCode;
372
- continue;
373
-
374
- } else if (typeof resCode == 'number') { // Sequence finished. Write it.
375
- dbcsCode = resCode;
376
-
377
- } else if (resCode == undefined) { // Current character is not part of the sequence.
378
-
379
- // Try default character for this sequence
380
- resCode = seqObj[DEF_CHAR];
381
- if (resCode !== undefined) {
382
- dbcsCode = resCode; // Found. Write it.
383
- nextChar = uCode; // Current character will be written too in the next iteration.
384
-
385
- }
386
- }
387
- seqObj = undefined;
388
- }
389
- else if (uCode >= 0) { // Regular character
390
- var subtable = this.encodeTable[uCode >> 8];
391
- if (subtable !== undefined)
392
- dbcsCode = subtable[uCode & 0xFF];
393
-
394
- if (dbcsCode <= SEQ_START) { // Sequence start
395
- seqObj = this.encodeTableSeq[SEQ_START-dbcsCode];
396
- continue;
397
- }
398
-
399
- if (dbcsCode == UNASSIGNED && this.gb18030) {
400
- // Use GB18030 algorithm to find character(s) to write.
401
- var idx = findIdx(this.gb18030.uChars, uCode);
402
- if (idx != -1) {
403
- var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]);
404
- newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600;
405
- newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260;
406
- newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10;
407
- newBuf[j++] = 0x30 + dbcsCode;
408
- continue;
409
- }
410
- }
411
- }
412
-
413
- // 3. Write dbcsCode character.
414
- if (dbcsCode === UNASSIGNED)
415
- dbcsCode = this.defaultCharSingleByte;
416
-
417
- if (dbcsCode < 0x100) {
418
- newBuf[j++] = dbcsCode;
419
- }
420
- else if (dbcsCode < 0x10000) {
421
- newBuf[j++] = dbcsCode >> 8; // high byte
422
- newBuf[j++] = dbcsCode & 0xFF; // low byte
423
- }
424
- else if (dbcsCode < 0x1000000) {
425
- newBuf[j++] = dbcsCode >> 16;
426
- newBuf[j++] = (dbcsCode >> 8) & 0xFF;
427
- newBuf[j++] = dbcsCode & 0xFF;
428
- } else {
429
- newBuf[j++] = dbcsCode >>> 24;
430
- newBuf[j++] = (dbcsCode >>> 16) & 0xFF;
431
- newBuf[j++] = (dbcsCode >>> 8) & 0xFF;
432
- newBuf[j++] = dbcsCode & 0xFF;
433
- }
434
- }
435
-
436
- this.seqObj = seqObj;
437
- this.leadSurrogate = leadSurrogate;
438
- return newBuf.slice(0, j);
439
- };
440
-
441
- DBCSEncoder.prototype.end = function() {
442
- if (this.leadSurrogate === -1 && this.seqObj === undefined)
443
- return; // All clean. Most often case.
444
-
445
- var newBuf = Buffer.alloc(10), j = 0;
446
-
447
- if (this.seqObj) { // We're in the sequence.
448
- var dbcsCode = this.seqObj[DEF_CHAR];
449
- if (dbcsCode !== undefined) { // Write beginning of the sequence.
450
- if (dbcsCode < 0x100) {
451
- newBuf[j++] = dbcsCode;
452
- }
453
- else {
454
- newBuf[j++] = dbcsCode >> 8; // high byte
455
- newBuf[j++] = dbcsCode & 0xFF; // low byte
456
- }
457
- }
458
- this.seqObj = undefined;
459
- }
460
-
461
- if (this.leadSurrogate !== -1) {
462
- // Incomplete surrogate pair - only lead surrogate found.
463
- newBuf[j++] = this.defaultCharSingleByte;
464
- this.leadSurrogate = -1;
465
- }
466
-
467
- return newBuf.slice(0, j);
468
- };
469
-
470
- // Export for testing
471
- DBCSEncoder.prototype.findIdx = findIdx;
472
-
473
-
474
- // == Decoder ==================================================================
475
-
476
- function DBCSDecoder(options, codec) {
477
- // Decoder state
478
- this.nodeIdx = 0;
479
- this.prevBytes = [];
480
-
481
- // Static data
482
- this.decodeTables = codec.decodeTables;
483
- this.decodeTableSeq = codec.decodeTableSeq;
484
- this.defaultCharUnicode = codec.defaultCharUnicode;
485
- this.gb18030 = codec.gb18030;
486
- }
487
-
488
- DBCSDecoder.prototype.write = function(buf) {
489
- var newBuf = Buffer.alloc(buf.length*2),
490
- nodeIdx = this.nodeIdx,
491
- prevBytes = this.prevBytes, prevOffset = this.prevBytes.length,
492
- seqStart = -this.prevBytes.length, // idx of the start of current parsed sequence.
493
- uCode;
494
-
495
- for (var i = 0, j = 0; i < buf.length; i++) {
496
- var curByte = (i >= 0) ? buf[i] : prevBytes[i + prevOffset];
497
-
498
- // Lookup in current trie node.
499
- var uCode = this.decodeTables[nodeIdx][curByte];
500
-
501
- if (uCode >= 0) ;
502
- else if (uCode === UNASSIGNED) { // Unknown char.
503
- // TODO: Callback with seq.
504
- uCode = this.defaultCharUnicode.charCodeAt(0);
505
- i = seqStart; // Skip one byte ('i' will be incremented by the for loop) and try to parse again.
506
- }
507
- else if (uCode === GB18030_CODE) {
508
- if (i >= 3) {
509
- var ptr = (buf[i-3]-0x81)*12600 + (buf[i-2]-0x30)*1260 + (buf[i-1]-0x81)*10 + (curByte-0x30);
510
- } else {
511
- var ptr = (prevBytes[i-3+prevOffset]-0x81)*12600 +
512
- (((i-2 >= 0) ? buf[i-2] : prevBytes[i-2+prevOffset])-0x30)*1260 +
513
- (((i-1 >= 0) ? buf[i-1] : prevBytes[i-1+prevOffset])-0x81)*10 +
514
- (curByte-0x30);
515
- }
516
- var idx = findIdx(this.gb18030.gbChars, ptr);
517
- uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx];
518
- }
519
- else if (uCode <= NODE_START) { // Go to next trie node.
520
- nodeIdx = NODE_START - uCode;
521
- continue;
522
- }
523
- else if (uCode <= SEQ_START) { // Output a sequence of chars.
524
- var seq = this.decodeTableSeq[SEQ_START - uCode];
525
- for (var k = 0; k < seq.length - 1; k++) {
526
- uCode = seq[k];
527
- newBuf[j++] = uCode & 0xFF;
528
- newBuf[j++] = uCode >> 8;
529
- }
530
- uCode = seq[seq.length-1];
531
- }
532
- else
533
- throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte);
534
-
535
- // Write the character to buffer, handling higher planes using surrogate pair.
536
- if (uCode >= 0x10000) {
537
- uCode -= 0x10000;
538
- var uCodeLead = 0xD800 | (uCode >> 10);
539
- newBuf[j++] = uCodeLead & 0xFF;
540
- newBuf[j++] = uCodeLead >> 8;
541
-
542
- uCode = 0xDC00 | (uCode & 0x3FF);
543
- }
544
- newBuf[j++] = uCode & 0xFF;
545
- newBuf[j++] = uCode >> 8;
546
-
547
- // Reset trie node.
548
- nodeIdx = 0; seqStart = i+1;
549
- }
550
-
551
- this.nodeIdx = nodeIdx;
552
- this.prevBytes = (seqStart >= 0)
553
- ? Array.prototype.slice.call(buf, seqStart)
554
- : prevBytes.slice(seqStart + prevOffset).concat(Array.prototype.slice.call(buf));
555
-
556
- return newBuf.slice(0, j).toString('ucs2');
557
- };
558
-
559
- DBCSDecoder.prototype.end = function() {
560
- var ret = '';
561
-
562
- // Try to parse all remaining chars.
563
- while (this.prevBytes.length > 0) {
564
- // Skip 1 character in the buffer.
565
- ret += this.defaultCharUnicode;
566
- var bytesArr = this.prevBytes.slice(1);
567
-
568
- // Parse remaining as usual.
569
- this.prevBytes = [];
570
- this.nodeIdx = 0;
571
- if (bytesArr.length > 0)
572
- ret += this.write(bytesArr);
573
- }
574
-
575
- this.prevBytes = [];
576
- this.nodeIdx = 0;
577
- return ret;
578
- };
579
-
580
- // Binary search for GB18030. Returns largest i such that table[i] <= val.
581
- function findIdx(table, val) {
582
- if (table[0] > val)
583
- return -1;
584
-
585
- var l = 0, r = table.length;
586
- while (l < r-1) { // always table[l] <= val < table[r]
587
- var mid = l + ((r-l+1) >> 1);
588
- if (table[mid] <= val)
589
- l = mid;
590
- else
591
- r = mid;
592
- }
593
- return l;
594
- }
595
- return dbcsCodec;
596
- }
597
-
598
- export { requireDbcsCodec as __require };