@corellium/corellium-cli 1.0.3 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (490) hide show
  1. package/README.md +5 -17
  2. package/docs/OVERVIEW.md +1 -1
  3. package/jenkinsbuild/build.sh +1 -1
  4. package/package.json +3 -3
  5. package/src/TrialAccount.js +76 -0
  6. package/src/commands/Client.js +2 -2
  7. package/src/commands/agent/Agent.js +10 -19
  8. package/src/commands/agent/apps.js +2 -1
  9. package/src/commands/agent/file.js +2 -1
  10. package/src/commands/agent/index.js +1 -0
  11. package/src/commands/agent/ready.js +43 -0
  12. package/src/commands/extensions/delete.js +2 -1
  13. package/src/commands/extensions/list.js +2 -1
  14. package/src/commands/extensions/load.js +2 -1
  15. package/src/commands/extensions/validate.js +2 -1
  16. package/src/commands/firmware/list.js +2 -1
  17. package/src/commands/firmware/load.js +2 -1
  18. package/src/commands/images/create.js +2 -1
  19. package/src/commands/images/delete.js +2 -1
  20. package/src/commands/images/list.js +2 -1
  21. package/src/commands/instances/Instance.js +27 -0
  22. package/src/commands/instances/create.js +11 -4
  23. package/src/commands/instances/delete.js +20 -5
  24. package/src/commands/instances/index.js +2 -1
  25. package/src/commands/instances/list.js +11 -5
  26. package/src/commands/instances/start.js +2 -1
  27. package/src/commands/instances/stop.js +2 -1
  28. package/src/commands/instances/upgrade.js +90 -0
  29. package/src/commands/login.js +14 -2
  30. package/src/commands/logout.js +2 -1
  31. package/src/commands/projects/create.js +2 -1
  32. package/src/commands/projects/delete.js +2 -1
  33. package/src/commands/projects/list.js +2 -1
  34. package/src/commands/signup.js +14 -5
  35. package/src/commands/webplayer/WebPlayer.js +2 -1
  36. package/src/commands/webplayer/create.js +8 -1
  37. package/src/commands/webplayer/destroy.js +2 -1
  38. package/src/commands/webplayer/list.js +19 -17
  39. package/src/commands/webplayer/login.js +2 -1
  40. package/src/error.js +14 -1
  41. package/src/logging.js +1 -1
  42. package/src/profile.js +12 -9
  43. package/src/resumable.js +1314 -0
  44. package/src/table.js +7 -2
  45. package/src/upload.js +64 -2
  46. package/src/utils.js +11 -4
  47. package/test/test.js +89 -0
  48. package/example/WebPlayerSample.js +0 -263
  49. package/node_modules/@corellium/corellium-api/README.md +0 -1210
  50. package/node_modules/@corellium/corellium-api/node_modules/form-data/License +0 -19
  51. package/node_modules/@corellium/corellium-api/node_modules/form-data/README.md.bak +0 -356
  52. package/node_modules/@corellium/corellium-api/node_modules/form-data/Readme.md +0 -356
  53. package/node_modules/@corellium/corellium-api/node_modules/form-data/index.d.ts +0 -62
  54. package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/browser.js +0 -2
  55. package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/form_data.js +0 -498
  56. package/node_modules/@corellium/corellium-api/node_modules/form-data/lib/populate.js +0 -10
  57. package/node_modules/@corellium/corellium-api/node_modules/form-data/package.json +0 -104
  58. package/node_modules/@corellium/corellium-api/node_modules/uuid/AUTHORS +0 -5
  59. package/node_modules/@corellium/corellium-api/node_modules/uuid/CHANGELOG.md +0 -119
  60. package/node_modules/@corellium/corellium-api/node_modules/uuid/LICENSE.md +0 -21
  61. package/node_modules/@corellium/corellium-api/node_modules/uuid/README.md +0 -276
  62. package/node_modules/@corellium/corellium-api/node_modules/uuid/bin/uuid +0 -65
  63. package/node_modules/@corellium/corellium-api/node_modules/uuid/index.js +0 -8
  64. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/bytesToUuid.js +0 -26
  65. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/md5-browser.js +0 -216
  66. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/md5.js +0 -25
  67. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/rng-browser.js +0 -34
  68. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/rng.js +0 -8
  69. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/sha1-browser.js +0 -89
  70. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/sha1.js +0 -25
  71. package/node_modules/@corellium/corellium-api/node_modules/uuid/lib/v35.js +0 -57
  72. package/node_modules/@corellium/corellium-api/node_modules/uuid/package.json +0 -103
  73. package/node_modules/@corellium/corellium-api/node_modules/uuid/v1.js +0 -109
  74. package/node_modules/@corellium/corellium-api/node_modules/uuid/v3.js +0 -4
  75. package/node_modules/@corellium/corellium-api/node_modules/uuid/v4.js +0 -29
  76. package/node_modules/@corellium/corellium-api/node_modules/uuid/v5.js +0 -3
  77. package/node_modules/@corellium/corellium-api/package.json +0 -106
  78. package/node_modules/@corellium/corellium-api/resumable.js +0 -1312
  79. package/node_modules/@corellium/corellium-api/src/agent.js +0 -962
  80. package/node_modules/@corellium/corellium-api/src/corellium.js +0 -444
  81. package/node_modules/@corellium/corellium-api/src/images.js +0 -131
  82. package/node_modules/@corellium/corellium-api/src/input.js +0 -178
  83. package/node_modules/@corellium/corellium-api/src/instance-updater.js +0 -56
  84. package/node_modules/@corellium/corellium-api/src/instance.js +0 -1031
  85. package/node_modules/@corellium/corellium-api/src/netmon.js +0 -308
  86. package/node_modules/@corellium/corellium-api/src/project.js +0 -393
  87. package/node_modules/@corellium/corellium-api/src/role.js +0 -65
  88. package/node_modules/@corellium/corellium-api/src/snapshot.js +0 -77
  89. package/node_modules/@corellium/corellium-api/src/team.js +0 -29
  90. package/node_modules/@corellium/corellium-api/src/user.js +0 -51
  91. package/node_modules/@corellium/corellium-api/src/util/fetch.js +0 -62
  92. package/node_modules/@corellium/corellium-api/src/util/sleep.js +0 -7
  93. package/node_modules/@corellium/corellium-api/test/integration-tests.js +0 -1292
  94. package/node_modules/@corellium/corellium-api/test/root-hook-set-flag-if-test-failed.js +0 -7
  95. package/node_modules/async-limiter/.eslintignore +0 -2
  96. package/node_modules/async-limiter/.nycrc +0 -10
  97. package/node_modules/async-limiter/.travis.yml +0 -9
  98. package/node_modules/async-limiter/LICENSE +0 -8
  99. package/node_modules/async-limiter/index.js +0 -67
  100. package/node_modules/async-limiter/package.json +0 -72
  101. package/node_modules/async-limiter/readme.md +0 -132
  102. package/node_modules/buffer-crc32/LICENSE +0 -19
  103. package/node_modules/buffer-crc32/README.md +0 -47
  104. package/node_modules/buffer-crc32/index.js +0 -111
  105. package/node_modules/buffer-crc32/package.json +0 -72
  106. package/node_modules/cross-fetch/LICENSE +0 -21
  107. package/node_modules/cross-fetch/README.md +0 -169
  108. package/node_modules/cross-fetch/dist/browser-polyfill.js +0 -532
  109. package/node_modules/cross-fetch/dist/browser-ponyfill.js +0 -554
  110. package/node_modules/cross-fetch/dist/cross-fetch.js +0 -2
  111. package/node_modules/cross-fetch/dist/cross-fetch.js.map +0 -1
  112. package/node_modules/cross-fetch/dist/node-polyfill.js +0 -11
  113. package/node_modules/cross-fetch/dist/node-ponyfill.js +0 -22
  114. package/node_modules/cross-fetch/dist/react-native-polyfill.js +0 -12
  115. package/node_modules/cross-fetch/dist/react-native-ponyfill.js +0 -6
  116. package/node_modules/cross-fetch/index.d.ts +0 -14
  117. package/node_modules/cross-fetch/package.json +0 -160
  118. package/node_modules/cross-fetch/polyfill/package.json +0 -8
  119. package/node_modules/duplexify/.travis.yml +0 -6
  120. package/node_modules/duplexify/LICENSE +0 -21
  121. package/node_modules/duplexify/README.md +0 -97
  122. package/node_modules/duplexify/example.js +0 -21
  123. package/node_modules/duplexify/index.js +0 -234
  124. package/node_modules/duplexify/package.json +0 -69
  125. package/node_modules/duplexify/test.js +0 -295
  126. package/node_modules/end-of-stream/LICENSE +0 -21
  127. package/node_modules/end-of-stream/README.md +0 -54
  128. package/node_modules/end-of-stream/index.js +0 -94
  129. package/node_modules/end-of-stream/package.json +0 -69
  130. package/node_modules/fast-stable-stringify/.npmignore +0 -4
  131. package/node_modules/fast-stable-stringify/.travis.yml +0 -10
  132. package/node_modules/fast-stable-stringify/LICENSE +0 -21
  133. package/node_modules/fast-stable-stringify/README.md +0 -81
  134. package/node_modules/fast-stable-stringify/cli/files-to-comparison-results.js +0 -67
  135. package/node_modules/fast-stable-stringify/cli/format-table.js +0 -70
  136. package/node_modules/fast-stable-stringify/cli/index.js +0 -19
  137. package/node_modules/fast-stable-stringify/fixtures/index.js +0 -5
  138. package/node_modules/fast-stable-stringify/fixtures/input-data-types.js +0 -191
  139. package/node_modules/fast-stable-stringify/fixtures/log-result.json +0 -22
  140. package/node_modules/fast-stable-stringify/fixtures/log.txt +0 -24
  141. package/node_modules/fast-stable-stringify/index.js +0 -73
  142. package/node_modules/fast-stable-stringify/karma.conf.js +0 -124
  143. package/node_modules/fast-stable-stringify/karma.conf.travis.js +0 -95
  144. package/node_modules/fast-stable-stringify/package.json +0 -77
  145. package/node_modules/fast-stable-stringify/results/escape-long/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -57
  146. package/node_modules/fast-stable-stringify/results/escape-long/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -57
  147. package/node_modules/fast-stable-stringify/results/escape-long/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -57
  148. package/node_modules/fast-stable-stringify/results/escape-long/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -57
  149. package/node_modules/fast-stable-stringify/results/escape-long/IE 10.0.0 (Windows 7 0.0.0).json +0 -57
  150. package/node_modules/fast-stable-stringify/results/escape-long/IE 11.0.0 (Windows 7 0.0.0).json +0 -57
  151. package/node_modules/fast-stable-stringify/results/escape-long/IE 9.0.0 (Windows 7 0.0.0).json +0 -57
  152. package/node_modules/fast-stable-stringify/results/escape-long/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -57
  153. package/node_modules/fast-stable-stringify/results/escape-long/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -57
  154. package/node_modules/fast-stable-stringify/results/escape-short/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -57
  155. package/node_modules/fast-stable-stringify/results/escape-short/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -57
  156. package/node_modules/fast-stable-stringify/results/escape-short/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -57
  157. package/node_modules/fast-stable-stringify/results/escape-short/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -57
  158. package/node_modules/fast-stable-stringify/results/escape-short/IE 10.0.0 (Windows 7 0.0.0).json +0 -57
  159. package/node_modules/fast-stable-stringify/results/escape-short/IE 11.0.0 (Windows 7 0.0.0).json +0 -57
  160. package/node_modules/fast-stable-stringify/results/escape-short/IE 9.0.0 (Windows 7 0.0.0).json +0 -57
  161. package/node_modules/fast-stable-stringify/results/escape-short/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -57
  162. package/node_modules/fast-stable-stringify/results/escape-short/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -57
  163. package/node_modules/fast-stable-stringify/results/escape.md +0 -20
  164. package/node_modules/fast-stable-stringify/results/itar-long/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
  165. package/node_modules/fast-stable-stringify/results/itar-long/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
  166. package/node_modules/fast-stable-stringify/results/itar-long/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
  167. package/node_modules/fast-stable-stringify/results/itar-long/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
  168. package/node_modules/fast-stable-stringify/results/itar-long/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  169. package/node_modules/fast-stable-stringify/results/itar-long/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  170. package/node_modules/fast-stable-stringify/results/itar-long/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  171. package/node_modules/fast-stable-stringify/results/itar-long/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
  172. package/node_modules/fast-stable-stringify/results/itar-long/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
  173. package/node_modules/fast-stable-stringify/results/itar-short/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
  174. package/node_modules/fast-stable-stringify/results/itar-short/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
  175. package/node_modules/fast-stable-stringify/results/itar-short/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
  176. package/node_modules/fast-stable-stringify/results/itar-short/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
  177. package/node_modules/fast-stable-stringify/results/itar-short/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  178. package/node_modules/fast-stable-stringify/results/itar-short/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  179. package/node_modules/fast-stable-stringify/results/itar-short/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  180. package/node_modules/fast-stable-stringify/results/itar-short/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
  181. package/node_modules/fast-stable-stringify/results/itar-short/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
  182. package/node_modules/fast-stable-stringify/results/itar.md +0 -20
  183. package/node_modules/fast-stable-stringify/results/iter/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -35
  184. package/node_modules/fast-stable-stringify/results/iter/Chrome Mobile 39.0.0 (Android 5.1.1).json +0 -35
  185. package/node_modules/fast-stable-stringify/results/iter/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -35
  186. package/node_modules/fast-stable-stringify/results/iter/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -35
  187. package/node_modules/fast-stable-stringify/results/iter/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -35
  188. package/node_modules/fast-stable-stringify/results/iter/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  189. package/node_modules/fast-stable-stringify/results/iter/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  190. package/node_modules/fast-stable-stringify/results/iter/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  191. package/node_modules/fast-stable-stringify/results/iter/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -35
  192. package/node_modules/fast-stable-stringify/results/iter/Mobile Safari 9.0.0 (iOS 9.2.0).json +0 -35
  193. package/node_modules/fast-stable-stringify/results/iter/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -35
  194. package/node_modules/fast-stable-stringify/results/iter/Safari 9.1.2 (Mac OS X 10.11.6).json +0 -35
  195. package/node_modules/fast-stable-stringify/results/iter.md +0 -14
  196. package/node_modules/fast-stable-stringify/results/libs/Chrome 60.0.3112 (Windows 7 0.0.0).json +0 -46
  197. package/node_modules/fast-stable-stringify/results/libs/Chrome Mobile 55.0.2883 (Android 6.0.0).json +0 -46
  198. package/node_modules/fast-stable-stringify/results/libs/Edge 14.14393.0 (Windows 10 0.0.0).json +0 -46
  199. package/node_modules/fast-stable-stringify/results/libs/Firefox 54.0.0 (Windows 7 0.0.0).json +0 -46
  200. package/node_modules/fast-stable-stringify/results/libs/IE 10.0.0 (Windows 7 0.0.0).json +0 -35
  201. package/node_modules/fast-stable-stringify/results/libs/IE 11.0.0 (Windows 7 0.0.0).json +0 -35
  202. package/node_modules/fast-stable-stringify/results/libs/IE 9.0.0 (Windows 7 0.0.0).json +0 -35
  203. package/node_modules/fast-stable-stringify/results/libs/Mobile Safari 10.0.0 (iOS 10.3.0).json +0 -46
  204. package/node_modules/fast-stable-stringify/results/libs/Safari 10.0.1 (Mac OS X 10.12.1).json +0 -46
  205. package/node_modules/fast-stable-stringify/results/libs.md +0 -15
  206. package/node_modules/fast-stable-stringify/test/escape-long.js +0 -147
  207. package/node_modules/fast-stable-stringify/test/escape-short.js +0 -147
  208. package/node_modules/fast-stable-stringify/test/index.js +0 -6
  209. package/node_modules/fast-stable-stringify/test/itar-long.js +0 -52
  210. package/node_modules/fast-stable-stringify/test/itar-short.js +0 -52
  211. package/node_modules/fast-stable-stringify/test/iter.js +0 -84
  212. package/node_modules/fast-stable-stringify/test/libs.js +0 -57
  213. package/node_modules/fast-stable-stringify/test/travis.js +0 -43
  214. package/node_modules/fast-stable-stringify/test/validate.js +0 -24
  215. package/node_modules/fast-stable-stringify/util/eachRecursive.js +0 -9
  216. package/node_modules/fast-stable-stringify/util/get-git-hash-sync.js +0 -21
  217. package/node_modules/fast-stable-stringify/util/get-lib-info.js +0 -22
  218. package/node_modules/fast-stable-stringify/util/object-path.js +0 -47
  219. package/node_modules/fast-stable-stringify/v8-profile/bench.js +0 -8
  220. package/node_modules/fast-stable-stringify/v8-profile/run.sh +0 -2
  221. package/node_modules/fast-stable-stringify/zuul-local.sh +0 -2
  222. package/node_modules/hkdf/.npmignore +0 -2
  223. package/node_modules/hkdf/README.md +0 -23
  224. package/node_modules/hkdf/hkdf.py +0 -171
  225. package/node_modules/hkdf/hkdf.pyc +0 -0
  226. package/node_modules/hkdf/index.js +0 -1
  227. package/node_modules/hkdf/lib/hkdf.js +0 -55
  228. package/node_modules/hkdf/package.json +0 -55
  229. package/node_modules/hkdf/scripts/run_all_tests.sh +0 -19
  230. package/node_modules/hkdf/test/all-test.js +0 -79
  231. package/node_modules/hkdf/test.py +0 -11
  232. package/node_modules/immediate/LICENSE.txt +0 -20
  233. package/node_modules/immediate/README.md +0 -93
  234. package/node_modules/immediate/dist/immediate.js +0 -75
  235. package/node_modules/immediate/dist/immediate.min.js +0 -1
  236. package/node_modules/immediate/lib/browser.js +0 -69
  237. package/node_modules/immediate/lib/index.js +0 -73
  238. package/node_modules/immediate/package.json +0 -86
  239. package/node_modules/isarray/.npmignore +0 -1
  240. package/node_modules/isarray/.travis.yml +0 -4
  241. package/node_modules/isarray/Makefile +0 -6
  242. package/node_modules/isarray/README.md +0 -60
  243. package/node_modules/isarray/component.json +0 -19
  244. package/node_modules/isarray/index.js +0 -5
  245. package/node_modules/isarray/package.json +0 -77
  246. package/node_modules/isarray/test.js +0 -20
  247. package/node_modules/jszip/.codeclimate.yml +0 -16
  248. package/node_modules/jszip/.editorconfig +0 -8
  249. package/node_modules/jszip/.github/workflows/pr.yaml +0 -41
  250. package/node_modules/jszip/.jshintignore +0 -1
  251. package/node_modules/jszip/.jshintrc +0 -21
  252. package/node_modules/jszip/.travis.yml +0 -17
  253. package/node_modules/jszip/CHANGES.md +0 -192
  254. package/node_modules/jszip/LICENSE.markdown +0 -651
  255. package/node_modules/jszip/README.markdown +0 -33
  256. package/node_modules/jszip/dist/jszip.js +0 -11583
  257. package/node_modules/jszip/dist/jszip.min.js +0 -13
  258. package/node_modules/jszip/index.d.ts +0 -335
  259. package/node_modules/jszip/lib/base64.js +0 -106
  260. package/node_modules/jszip/lib/compressedObject.js +0 -74
  261. package/node_modules/jszip/lib/compressions.js +0 -14
  262. package/node_modules/jszip/lib/crc32.js +0 -77
  263. package/node_modules/jszip/lib/defaults.js +0 -11
  264. package/node_modules/jszip/lib/external.js +0 -19
  265. package/node_modules/jszip/lib/flate.js +0 -85
  266. package/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
  267. package/node_modules/jszip/lib/generate/index.js +0 -57
  268. package/node_modules/jszip/lib/index.js +0 -55
  269. package/node_modules/jszip/lib/license_header.js +0 -11
  270. package/node_modules/jszip/lib/load.js +0 -88
  271. package/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
  272. package/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
  273. package/node_modules/jszip/lib/nodejsUtils.js +0 -57
  274. package/node_modules/jszip/lib/object.js +0 -389
  275. package/node_modules/jszip/lib/readable-stream-browser.js +0 -9
  276. package/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
  277. package/node_modules/jszip/lib/reader/DataReader.js +0 -116
  278. package/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
  279. package/node_modules/jszip/lib/reader/StringReader.js +0 -38
  280. package/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
  281. package/node_modules/jszip/lib/reader/readerFor.js +0 -28
  282. package/node_modules/jszip/lib/signature.js +0 -7
  283. package/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
  284. package/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
  285. package/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
  286. package/node_modules/jszip/lib/stream/DataWorker.js +0 -116
  287. package/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
  288. package/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
  289. package/node_modules/jszip/lib/support.js +0 -38
  290. package/node_modules/jszip/lib/utf8.js +0 -275
  291. package/node_modules/jszip/lib/utils.js +0 -501
  292. package/node_modules/jszip/lib/zipEntries.js +0 -262
  293. package/node_modules/jszip/lib/zipEntry.js +0 -294
  294. package/node_modules/jszip/lib/zipObject.js +0 -133
  295. package/node_modules/jszip/package.json +0 -99
  296. package/node_modules/jszip/tsconfig.json +0 -101
  297. package/node_modules/jszip/vendor/FileSaver.js +0 -247
  298. package/node_modules/lie/README.md +0 -62
  299. package/node_modules/lie/dist/lie.js +0 -350
  300. package/node_modules/lie/dist/lie.min.js +0 -1
  301. package/node_modules/lie/dist/lie.polyfill.js +0 -358
  302. package/node_modules/lie/dist/lie.polyfill.min.js +0 -1
  303. package/node_modules/lie/lib/browser.js +0 -273
  304. package/node_modules/lie/lib/index.js +0 -298
  305. package/node_modules/lie/license.md +0 -7
  306. package/node_modules/lie/lie.d.ts +0 -244
  307. package/node_modules/lie/package.json +0 -98
  308. package/node_modules/lie/polyfill.js +0 -4
  309. package/node_modules/p-finally/index.js +0 -15
  310. package/node_modules/p-finally/license +0 -21
  311. package/node_modules/p-finally/package.json +0 -77
  312. package/node_modules/p-finally/readme.md +0 -47
  313. package/node_modules/p-retry/index.js +0 -52
  314. package/node_modules/p-retry/license +0 -9
  315. package/node_modules/p-retry/package.json +0 -83
  316. package/node_modules/p-retry/readme.md +0 -109
  317. package/node_modules/p-timeout/index.d.ts +0 -72
  318. package/node_modules/p-timeout/index.js +0 -57
  319. package/node_modules/p-timeout/license +0 -9
  320. package/node_modules/p-timeout/package.json +0 -80
  321. package/node_modules/p-timeout/readme.md +0 -87
  322. package/node_modules/pako/CHANGELOG.md +0 -164
  323. package/node_modules/pako/LICENSE +0 -21
  324. package/node_modules/pako/README.md +0 -191
  325. package/node_modules/pako/dist/pako.js +0 -6818
  326. package/node_modules/pako/dist/pako.min.js +0 -1
  327. package/node_modules/pako/dist/pako_deflate.js +0 -3997
  328. package/node_modules/pako/dist/pako_deflate.min.js +0 -1
  329. package/node_modules/pako/dist/pako_inflate.js +0 -3300
  330. package/node_modules/pako/dist/pako_inflate.min.js +0 -1
  331. package/node_modules/pako/index.js +0 -14
  332. package/node_modules/pako/lib/deflate.js +0 -400
  333. package/node_modules/pako/lib/inflate.js +0 -423
  334. package/node_modules/pako/lib/utils/common.js +0 -105
  335. package/node_modules/pako/lib/utils/strings.js +0 -187
  336. package/node_modules/pako/lib/zlib/README +0 -59
  337. package/node_modules/pako/lib/zlib/adler32.js +0 -51
  338. package/node_modules/pako/lib/zlib/constants.js +0 -68
  339. package/node_modules/pako/lib/zlib/crc32.js +0 -59
  340. package/node_modules/pako/lib/zlib/deflate.js +0 -1874
  341. package/node_modules/pako/lib/zlib/gzheader.js +0 -58
  342. package/node_modules/pako/lib/zlib/inffast.js +0 -345
  343. package/node_modules/pako/lib/zlib/inflate.js +0 -1556
  344. package/node_modules/pako/lib/zlib/inftrees.js +0 -343
  345. package/node_modules/pako/lib/zlib/messages.js +0 -32
  346. package/node_modules/pako/lib/zlib/trees.js +0 -1222
  347. package/node_modules/pako/lib/zlib/zstream.js +0 -47
  348. package/node_modules/pako/package.json +0 -94
  349. package/node_modules/process-nextick-args/index.js +0 -45
  350. package/node_modules/process-nextick-args/license.md +0 -19
  351. package/node_modules/process-nextick-args/package.json +0 -53
  352. package/node_modules/process-nextick-args/readme.md +0 -18
  353. package/node_modules/readable-stream/.travis.yml +0 -34
  354. package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  355. package/node_modules/readable-stream/GOVERNANCE.md +0 -136
  356. package/node_modules/readable-stream/LICENSE +0 -47
  357. package/node_modules/readable-stream/README.md +0 -58
  358. package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  359. package/node_modules/readable-stream/duplex-browser.js +0 -1
  360. package/node_modules/readable-stream/duplex.js +0 -1
  361. package/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  362. package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  363. package/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  364. package/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  365. package/node_modules/readable-stream/lib/_stream_writable.js +0 -687
  366. package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  367. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  368. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  369. package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  370. package/node_modules/readable-stream/package.json +0 -86
  371. package/node_modules/readable-stream/passthrough.js +0 -1
  372. package/node_modules/readable-stream/readable-browser.js +0 -7
  373. package/node_modules/readable-stream/readable.js +0 -19
  374. package/node_modules/readable-stream/transform.js +0 -1
  375. package/node_modules/readable-stream/writable-browser.js +0 -1
  376. package/node_modules/readable-stream/writable.js +0 -8
  377. package/node_modules/retry/.npmignore +0 -3
  378. package/node_modules/retry/.travis.yml +0 -15
  379. package/node_modules/retry/License +0 -21
  380. package/node_modules/retry/Makefile +0 -18
  381. package/node_modules/retry/README.md +0 -227
  382. package/node_modules/retry/equation.gif +0 -0
  383. package/node_modules/retry/example/dns.js +0 -31
  384. package/node_modules/retry/example/stop.js +0 -40
  385. package/node_modules/retry/index.js +0 -1
  386. package/node_modules/retry/lib/retry.js +0 -100
  387. package/node_modules/retry/lib/retry_operation.js +0 -158
  388. package/node_modules/retry/package.json +0 -67
  389. package/node_modules/retry/test/common.js +0 -10
  390. package/node_modules/retry/test/integration/test-forever.js +0 -24
  391. package/node_modules/retry/test/integration/test-retry-operation.js +0 -258
  392. package/node_modules/retry/test/integration/test-retry-wrap.js +0 -101
  393. package/node_modules/retry/test/integration/test-timeouts.js +0 -69
  394. package/node_modules/setimmediate/LICENSE.txt +0 -20
  395. package/node_modules/setimmediate/package.json +0 -77
  396. package/node_modules/setimmediate/setImmediate.js +0 -186
  397. package/node_modules/split/.npmignore +0 -3
  398. package/node_modules/split/.travis.yml +0 -3
  399. package/node_modules/split/LICENCE +0 -22
  400. package/node_modules/split/examples/pretty.js +0 -26
  401. package/node_modules/split/index.js +0 -63
  402. package/node_modules/split/package.json +0 -65
  403. package/node_modules/split/readme.markdown +0 -72
  404. package/node_modules/split/test/options.asynct.js +0 -46
  405. package/node_modules/split/test/partitioned_unicode.js +0 -34
  406. package/node_modules/split/test/split.asynct.js +0 -137
  407. package/node_modules/split/test/try_catch.asynct.js +0 -51
  408. package/node_modules/stream-shift/.travis.yml +0 -6
  409. package/node_modules/stream-shift/LICENSE +0 -21
  410. package/node_modules/stream-shift/README.md +0 -25
  411. package/node_modules/stream-shift/index.js +0 -20
  412. package/node_modules/stream-shift/package.json +0 -56
  413. package/node_modules/stream-shift/test.js +0 -48
  414. package/node_modules/ultron/LICENSE +0 -22
  415. package/node_modules/ultron/README.md +0 -113
  416. package/node_modules/ultron/index.js +0 -136
  417. package/node_modules/ultron/package.json +0 -71
  418. package/node_modules/websocket-stream/LICENSE +0 -8
  419. package/node_modules/websocket-stream/collaborators.md +0 -11
  420. package/node_modules/websocket-stream/echo-server.js +0 -51
  421. package/node_modules/websocket-stream/index.d.ts +0 -27
  422. package/node_modules/websocket-stream/index.js +0 -6
  423. package/node_modules/websocket-stream/package.json +0 -82
  424. package/node_modules/websocket-stream/readme.md +0 -148
  425. package/node_modules/websocket-stream/server.js +0 -29
  426. package/node_modules/websocket-stream/stream.js +0 -189
  427. package/node_modules/websocket-stream/test-client.js +0 -74
  428. package/node_modules/websocket-stream/test-server.js +0 -56
  429. package/node_modules/websocket-stream/test.js +0 -338
  430. package/node_modules/websocket-stream/ts-tests.ts +0 -69
  431. package/node_modules/websocket-stream/ws-fallback.js +0 -12
  432. package/node_modules/ws/LICENSE +0 -21
  433. package/node_modules/ws/README.md +0 -341
  434. package/node_modules/ws/index.js +0 -15
  435. package/node_modules/ws/lib/.DS_Store +0 -0
  436. package/node_modules/ws/lib/BufferUtil.js +0 -71
  437. package/node_modules/ws/lib/Constants.js +0 -10
  438. package/node_modules/ws/lib/ErrorCodes.js +0 -28
  439. package/node_modules/ws/lib/EventTarget.js +0 -151
  440. package/node_modules/ws/lib/Extensions.js +0 -203
  441. package/node_modules/ws/lib/PerMessageDeflate.js +0 -507
  442. package/node_modules/ws/lib/Receiver.js +0 -553
  443. package/node_modules/ws/lib/Sender.js +0 -412
  444. package/node_modules/ws/lib/Validation.js +0 -17
  445. package/node_modules/ws/lib/WebSocket.js +0 -717
  446. package/node_modules/ws/lib/WebSocketServer.js +0 -326
  447. package/node_modules/ws/package.json +0 -83
  448. package/node_modules/xhr2/CONTRIBUTING.md +0 -33
  449. package/node_modules/xhr2/Cakefile +0 -131
  450. package/node_modules/xhr2/LICENSE.txt +0 -19
  451. package/node_modules/xhr2/README.md +0 -142
  452. package/node_modules/xhr2/lib/browser.js +0 -1
  453. package/node_modules/xhr2/lib/xhr2.js +0 -1244
  454. package/node_modules/xhr2/package.json +0 -103
  455. package/node_modules/xhr2/src/000-xml_http_request_event_target.coffee +0 -89
  456. package/node_modules/xhr2/src/001-xml_http_request.coffee +0 -781
  457. package/node_modules/xhr2/src/errors.coffee +0 -31
  458. package/node_modules/xhr2/src/progress_event.coffee +0 -39
  459. package/node_modules/xhr2/src/xml_http_request_upload.coffee +0 -95
  460. package/node_modules/xhr2/test/fixtures/hello.json +0 -1
  461. package/node_modules/xhr2/test/fixtures/hello.txt +0 -1
  462. package/node_modules/xhr2/test/fixtures/xhr2.png +0 -0
  463. package/node_modules/xhr2/test/html/browser_test.html +0 -30
  464. package/node_modules/xhr2/test/src/event_target_test.coffee +0 -85
  465. package/node_modules/xhr2/test/src/events_test.coffee +0 -204
  466. package/node_modules/xhr2/test/src/headers_test.coffee +0 -168
  467. package/node_modules/xhr2/test/src/helpers/browser_mocha_runner.coffee +0 -10
  468. package/node_modules/xhr2/test/src/helpers/browser_mocha_setup.coffee +0 -1
  469. package/node_modules/xhr2/test/src/helpers/setup.coffee +0 -38
  470. package/node_modules/xhr2/test/src/helpers/xhr_server.coffee +0 -156
  471. package/node_modules/xhr2/test/src/nodejs_set_test.coffee +0 -162
  472. package/node_modules/xhr2/test/src/redirect_test.coffee +0 -57
  473. package/node_modules/xhr2/test/src/response_type_test.coffee +0 -88
  474. package/node_modules/xhr2/test/src/responseurl_test.coffee +0 -18
  475. package/node_modules/xhr2/test/src/send_test.coffee +0 -89
  476. package/node_modules/xhr2/test/src/status_test.coffee +0 -47
  477. package/node_modules/xhr2/test/src/xhr_test.coffee +0 -102
  478. package/node_modules/xtend/.jshintrc +0 -30
  479. package/node_modules/xtend/LICENSE +0 -20
  480. package/node_modules/xtend/README.md +0 -32
  481. package/node_modules/xtend/immutable.js +0 -19
  482. package/node_modules/xtend/mutable.js +0 -17
  483. package/node_modules/xtend/package.json +0 -89
  484. package/node_modules/xtend/test.js +0 -103
  485. package/node_modules/yazl/LICENSE +0 -21
  486. package/node_modules/yazl/README.md +0 -389
  487. package/node_modules/yazl/index.js +0 -749
  488. package/node_modules/yazl/package.json +0 -69
  489. package/src/commands/CorelliumAPI.js +0 -76
  490. package/src/subscriberInvite.js +0 -140
@@ -1,1556 +0,0 @@
1
- 'use strict';
2
-
3
- // (C) 1995-2013 Jean-loup Gailly and Mark Adler
4
- // (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin
5
- //
6
- // This software is provided 'as-is', without any express or implied
7
- // warranty. In no event will the authors be held liable for any damages
8
- // arising from the use of this software.
9
- //
10
- // Permission is granted to anyone to use this software for any purpose,
11
- // including commercial applications, and to alter it and redistribute it
12
- // freely, subject to the following restrictions:
13
- //
14
- // 1. The origin of this software must not be misrepresented; you must not
15
- // claim that you wrote the original software. If you use this software
16
- // in a product, an acknowledgment in the product documentation would be
17
- // appreciated but is not required.
18
- // 2. Altered source versions must be plainly marked as such, and must not be
19
- // misrepresented as being the original software.
20
- // 3. This notice may not be removed or altered from any source distribution.
21
-
22
- var utils = require('../utils/common');
23
- var adler32 = require('./adler32');
24
- var crc32 = require('./crc32');
25
- var inflate_fast = require('./inffast');
26
- var inflate_table = require('./inftrees');
27
-
28
- var CODES = 0;
29
- var LENS = 1;
30
- var DISTS = 2;
31
-
32
- /* Public constants ==========================================================*/
33
- /* ===========================================================================*/
34
-
35
-
36
- /* Allowed flush values; see deflate() and inflate() below for details */
37
- //var Z_NO_FLUSH = 0;
38
- //var Z_PARTIAL_FLUSH = 1;
39
- //var Z_SYNC_FLUSH = 2;
40
- //var Z_FULL_FLUSH = 3;
41
- var Z_FINISH = 4;
42
- var Z_BLOCK = 5;
43
- var Z_TREES = 6;
44
-
45
-
46
- /* Return codes for the compression/decompression functions. Negative values
47
- * are errors, positive values are used for special but normal events.
48
- */
49
- var Z_OK = 0;
50
- var Z_STREAM_END = 1;
51
- var Z_NEED_DICT = 2;
52
- //var Z_ERRNO = -1;
53
- var Z_STREAM_ERROR = -2;
54
- var Z_DATA_ERROR = -3;
55
- var Z_MEM_ERROR = -4;
56
- var Z_BUF_ERROR = -5;
57
- //var Z_VERSION_ERROR = -6;
58
-
59
- /* The deflate compression method */
60
- var Z_DEFLATED = 8;
61
-
62
-
63
- /* STATES ====================================================================*/
64
- /* ===========================================================================*/
65
-
66
-
67
- var HEAD = 1; /* i: waiting for magic header */
68
- var FLAGS = 2; /* i: waiting for method and flags (gzip) */
69
- var TIME = 3; /* i: waiting for modification time (gzip) */
70
- var OS = 4; /* i: waiting for extra flags and operating system (gzip) */
71
- var EXLEN = 5; /* i: waiting for extra length (gzip) */
72
- var EXTRA = 6; /* i: waiting for extra bytes (gzip) */
73
- var NAME = 7; /* i: waiting for end of file name (gzip) */
74
- var COMMENT = 8; /* i: waiting for end of comment (gzip) */
75
- var HCRC = 9; /* i: waiting for header crc (gzip) */
76
- var DICTID = 10; /* i: waiting for dictionary check value */
77
- var DICT = 11; /* waiting for inflateSetDictionary() call */
78
- var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
79
- var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */
80
- var STORED = 14; /* i: waiting for stored size (length and complement) */
81
- var COPY_ = 15; /* i/o: same as COPY below, but only first time in */
82
- var COPY = 16; /* i/o: waiting for input or output to copy stored block */
83
- var TABLE = 17; /* i: waiting for dynamic block table lengths */
84
- var LENLENS = 18; /* i: waiting for code length code lengths */
85
- var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */
86
- var LEN_ = 20; /* i: same as LEN below, but only first time in */
87
- var LEN = 21; /* i: waiting for length/lit/eob code */
88
- var LENEXT = 22; /* i: waiting for length extra bits */
89
- var DIST = 23; /* i: waiting for distance code */
90
- var DISTEXT = 24; /* i: waiting for distance extra bits */
91
- var MATCH = 25; /* o: waiting for output space to copy string */
92
- var LIT = 26; /* o: waiting for output space to write literal */
93
- var CHECK = 27; /* i: waiting for 32-bit check value */
94
- var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */
95
- var DONE = 29; /* finished check, done -- remain here until reset */
96
- var BAD = 30; /* got a data error -- remain here until reset */
97
- var MEM = 31; /* got an inflate() memory error -- remain here until reset */
98
- var SYNC = 32; /* looking for synchronization bytes to restart inflate() */
99
-
100
- /* ===========================================================================*/
101
-
102
-
103
-
104
- var ENOUGH_LENS = 852;
105
- var ENOUGH_DISTS = 592;
106
- //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);
107
-
108
- var MAX_WBITS = 15;
109
- /* 32K LZ77 window */
110
- var DEF_WBITS = MAX_WBITS;
111
-
112
-
113
- function zswap32(q) {
114
- return (((q >>> 24) & 0xff) +
115
- ((q >>> 8) & 0xff00) +
116
- ((q & 0xff00) << 8) +
117
- ((q & 0xff) << 24));
118
- }
119
-
120
-
121
- function InflateState() {
122
- this.mode = 0; /* current inflate mode */
123
- this.last = false; /* true if processing last block */
124
- this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
125
- this.havedict = false; /* true if dictionary provided */
126
- this.flags = 0; /* gzip header method and flags (0 if zlib) */
127
- this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */
128
- this.check = 0; /* protected copy of check value */
129
- this.total = 0; /* protected copy of output count */
130
- // TODO: may be {}
131
- this.head = null; /* where to save gzip header information */
132
-
133
- /* sliding window */
134
- this.wbits = 0; /* log base 2 of requested window size */
135
- this.wsize = 0; /* window size or zero if not using window */
136
- this.whave = 0; /* valid bytes in the window */
137
- this.wnext = 0; /* window write index */
138
- this.window = null; /* allocated sliding window, if needed */
139
-
140
- /* bit accumulator */
141
- this.hold = 0; /* input bit accumulator */
142
- this.bits = 0; /* number of bits in "in" */
143
-
144
- /* for string and stored block copying */
145
- this.length = 0; /* literal or length of data to copy */
146
- this.offset = 0; /* distance back to copy string from */
147
-
148
- /* for table and code decoding */
149
- this.extra = 0; /* extra bits needed */
150
-
151
- /* fixed and dynamic code tables */
152
- this.lencode = null; /* starting table for length/literal codes */
153
- this.distcode = null; /* starting table for distance codes */
154
- this.lenbits = 0; /* index bits for lencode */
155
- this.distbits = 0; /* index bits for distcode */
156
-
157
- /* dynamic table building */
158
- this.ncode = 0; /* number of code length code lengths */
159
- this.nlen = 0; /* number of length code lengths */
160
- this.ndist = 0; /* number of distance code lengths */
161
- this.have = 0; /* number of code lengths in lens[] */
162
- this.next = null; /* next available space in codes[] */
163
-
164
- this.lens = new utils.Buf16(320); /* temporary storage for code lengths */
165
- this.work = new utils.Buf16(288); /* work area for code table building */
166
-
167
- /*
168
- because we don't have pointers in js, we use lencode and distcode directly
169
- as buffers so we don't need codes
170
- */
171
- //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */
172
- this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */
173
- this.distdyn = null; /* dynamic table for distance codes (JS specific) */
174
- this.sane = 0; /* if false, allow invalid distance too far */
175
- this.back = 0; /* bits back of last unprocessed length/lit */
176
- this.was = 0; /* initial length of match */
177
- }
178
-
179
- function inflateResetKeep(strm) {
180
- var state;
181
-
182
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
183
- state = strm.state;
184
- strm.total_in = strm.total_out = state.total = 0;
185
- strm.msg = ''; /*Z_NULL*/
186
- if (state.wrap) { /* to support ill-conceived Java test suite */
187
- strm.adler = state.wrap & 1;
188
- }
189
- state.mode = HEAD;
190
- state.last = 0;
191
- state.havedict = 0;
192
- state.dmax = 32768;
193
- state.head = null/*Z_NULL*/;
194
- state.hold = 0;
195
- state.bits = 0;
196
- //state.lencode = state.distcode = state.next = state.codes;
197
- state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS);
198
- state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS);
199
-
200
- state.sane = 1;
201
- state.back = -1;
202
- //Tracev((stderr, "inflate: reset\n"));
203
- return Z_OK;
204
- }
205
-
206
- function inflateReset(strm) {
207
- var state;
208
-
209
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
210
- state = strm.state;
211
- state.wsize = 0;
212
- state.whave = 0;
213
- state.wnext = 0;
214
- return inflateResetKeep(strm);
215
-
216
- }
217
-
218
- function inflateReset2(strm, windowBits) {
219
- var wrap;
220
- var state;
221
-
222
- /* get the state */
223
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
224
- state = strm.state;
225
-
226
- /* extract wrap request from windowBits parameter */
227
- if (windowBits < 0) {
228
- wrap = 0;
229
- windowBits = -windowBits;
230
- }
231
- else {
232
- wrap = (windowBits >> 4) + 1;
233
- if (windowBits < 48) {
234
- windowBits &= 15;
235
- }
236
- }
237
-
238
- /* set number of window bits, free window if different */
239
- if (windowBits && (windowBits < 8 || windowBits > 15)) {
240
- return Z_STREAM_ERROR;
241
- }
242
- if (state.window !== null && state.wbits !== windowBits) {
243
- state.window = null;
244
- }
245
-
246
- /* update state and reset the rest of it */
247
- state.wrap = wrap;
248
- state.wbits = windowBits;
249
- return inflateReset(strm);
250
- }
251
-
252
- function inflateInit2(strm, windowBits) {
253
- var ret;
254
- var state;
255
-
256
- if (!strm) { return Z_STREAM_ERROR; }
257
- //strm.msg = Z_NULL; /* in case we return an error */
258
-
259
- state = new InflateState();
260
-
261
- //if (state === Z_NULL) return Z_MEM_ERROR;
262
- //Tracev((stderr, "inflate: allocated\n"));
263
- strm.state = state;
264
- state.window = null/*Z_NULL*/;
265
- ret = inflateReset2(strm, windowBits);
266
- if (ret !== Z_OK) {
267
- strm.state = null/*Z_NULL*/;
268
- }
269
- return ret;
270
- }
271
-
272
- function inflateInit(strm) {
273
- return inflateInit2(strm, DEF_WBITS);
274
- }
275
-
276
-
277
- /*
278
- Return state with length and distance decoding tables and index sizes set to
279
- fixed code decoding. Normally this returns fixed tables from inffixed.h.
280
- If BUILDFIXED is defined, then instead this routine builds the tables the
281
- first time it's called, and returns those tables the first time and
282
- thereafter. This reduces the size of the code by about 2K bytes, in
283
- exchange for a little execution time. However, BUILDFIXED should not be
284
- used for threaded applications, since the rewriting of the tables and virgin
285
- may not be thread-safe.
286
- */
287
- var virgin = true;
288
-
289
- var lenfix, distfix; // We have no pointers in JS, so keep tables separate
290
-
291
- function fixedtables(state) {
292
- /* build fixed huffman tables if first call (may not be thread safe) */
293
- if (virgin) {
294
- var sym;
295
-
296
- lenfix = new utils.Buf32(512);
297
- distfix = new utils.Buf32(32);
298
-
299
- /* literal/length table */
300
- sym = 0;
301
- while (sym < 144) { state.lens[sym++] = 8; }
302
- while (sym < 256) { state.lens[sym++] = 9; }
303
- while (sym < 280) { state.lens[sym++] = 7; }
304
- while (sym < 288) { state.lens[sym++] = 8; }
305
-
306
- inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
307
-
308
- /* distance table */
309
- sym = 0;
310
- while (sym < 32) { state.lens[sym++] = 5; }
311
-
312
- inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
313
-
314
- /* do this just once */
315
- virgin = false;
316
- }
317
-
318
- state.lencode = lenfix;
319
- state.lenbits = 9;
320
- state.distcode = distfix;
321
- state.distbits = 5;
322
- }
323
-
324
-
325
- /*
326
- Update the window with the last wsize (normally 32K) bytes written before
327
- returning. If window does not exist yet, create it. This is only called
328
- when a window is already in use, or when output has been written during this
329
- inflate call, but the end of the deflate stream has not been reached yet.
330
- It is also called to create a window for dictionary data when a dictionary
331
- is loaded.
332
-
333
- Providing output buffers larger than 32K to inflate() should provide a speed
334
- advantage, since only the last 32K of output is copied to the sliding window
335
- upon return from inflate(), and since all distances after the first 32K of
336
- output will fall in the output data, making match copies simpler and faster.
337
- The advantage may be dependent on the size of the processor's data caches.
338
- */
339
- function updatewindow(strm, src, end, copy) {
340
- var dist;
341
- var state = strm.state;
342
-
343
- /* if it hasn't been done already, allocate space for the window */
344
- if (state.window === null) {
345
- state.wsize = 1 << state.wbits;
346
- state.wnext = 0;
347
- state.whave = 0;
348
-
349
- state.window = new utils.Buf8(state.wsize);
350
- }
351
-
352
- /* copy state->wsize or less output bytes into the circular window */
353
- if (copy >= state.wsize) {
354
- utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0);
355
- state.wnext = 0;
356
- state.whave = state.wsize;
357
- }
358
- else {
359
- dist = state.wsize - state.wnext;
360
- if (dist > copy) {
361
- dist = copy;
362
- }
363
- //zmemcpy(state->window + state->wnext, end - copy, dist);
364
- utils.arraySet(state.window, src, end - copy, dist, state.wnext);
365
- copy -= dist;
366
- if (copy) {
367
- //zmemcpy(state->window, end - copy, copy);
368
- utils.arraySet(state.window, src, end - copy, copy, 0);
369
- state.wnext = copy;
370
- state.whave = state.wsize;
371
- }
372
- else {
373
- state.wnext += dist;
374
- if (state.wnext === state.wsize) { state.wnext = 0; }
375
- if (state.whave < state.wsize) { state.whave += dist; }
376
- }
377
- }
378
- return 0;
379
- }
380
-
381
- function inflate(strm, flush) {
382
- var state;
383
- var input, output; // input/output buffers
384
- var next; /* next input INDEX */
385
- var put; /* next output INDEX */
386
- var have, left; /* available input and output */
387
- var hold; /* bit buffer */
388
- var bits; /* bits in bit buffer */
389
- var _in, _out; /* save starting available input and output */
390
- var copy; /* number of stored or match bytes to copy */
391
- var from; /* where to copy match bytes from */
392
- var from_source;
393
- var here = 0; /* current decoding table entry */
394
- var here_bits, here_op, here_val; // paked "here" denormalized (JS specific)
395
- //var last; /* parent table entry */
396
- var last_bits, last_op, last_val; // paked "last" denormalized (JS specific)
397
- var len; /* length to copy for repeats, bits to drop */
398
- var ret; /* return code */
399
- var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */
400
- var opts;
401
-
402
- var n; // temporary var for NEED_BITS
403
-
404
- var order = /* permutation of code lengths */
405
- [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
406
-
407
-
408
- if (!strm || !strm.state || !strm.output ||
409
- (!strm.input && strm.avail_in !== 0)) {
410
- return Z_STREAM_ERROR;
411
- }
412
-
413
- state = strm.state;
414
- if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */
415
-
416
-
417
- //--- LOAD() ---
418
- put = strm.next_out;
419
- output = strm.output;
420
- left = strm.avail_out;
421
- next = strm.next_in;
422
- input = strm.input;
423
- have = strm.avail_in;
424
- hold = state.hold;
425
- bits = state.bits;
426
- //---
427
-
428
- _in = have;
429
- _out = left;
430
- ret = Z_OK;
431
-
432
- inf_leave: // goto emulation
433
- for (;;) {
434
- switch (state.mode) {
435
- case HEAD:
436
- if (state.wrap === 0) {
437
- state.mode = TYPEDO;
438
- break;
439
- }
440
- //=== NEEDBITS(16);
441
- while (bits < 16) {
442
- if (have === 0) { break inf_leave; }
443
- have--;
444
- hold += input[next++] << bits;
445
- bits += 8;
446
- }
447
- //===//
448
- if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */
449
- state.check = 0/*crc32(0L, Z_NULL, 0)*/;
450
- //=== CRC2(state.check, hold);
451
- hbuf[0] = hold & 0xff;
452
- hbuf[1] = (hold >>> 8) & 0xff;
453
- state.check = crc32(state.check, hbuf, 2, 0);
454
- //===//
455
-
456
- //=== INITBITS();
457
- hold = 0;
458
- bits = 0;
459
- //===//
460
- state.mode = FLAGS;
461
- break;
462
- }
463
- state.flags = 0; /* expect zlib header */
464
- if (state.head) {
465
- state.head.done = false;
466
- }
467
- if (!(state.wrap & 1) || /* check if zlib header allowed */
468
- (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) {
469
- strm.msg = 'incorrect header check';
470
- state.mode = BAD;
471
- break;
472
- }
473
- if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) {
474
- strm.msg = 'unknown compression method';
475
- state.mode = BAD;
476
- break;
477
- }
478
- //--- DROPBITS(4) ---//
479
- hold >>>= 4;
480
- bits -= 4;
481
- //---//
482
- len = (hold & 0x0f)/*BITS(4)*/ + 8;
483
- if (state.wbits === 0) {
484
- state.wbits = len;
485
- }
486
- else if (len > state.wbits) {
487
- strm.msg = 'invalid window size';
488
- state.mode = BAD;
489
- break;
490
- }
491
- state.dmax = 1 << len;
492
- //Tracev((stderr, "inflate: zlib header ok\n"));
493
- strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
494
- state.mode = hold & 0x200 ? DICTID : TYPE;
495
- //=== INITBITS();
496
- hold = 0;
497
- bits = 0;
498
- //===//
499
- break;
500
- case FLAGS:
501
- //=== NEEDBITS(16); */
502
- while (bits < 16) {
503
- if (have === 0) { break inf_leave; }
504
- have--;
505
- hold += input[next++] << bits;
506
- bits += 8;
507
- }
508
- //===//
509
- state.flags = hold;
510
- if ((state.flags & 0xff) !== Z_DEFLATED) {
511
- strm.msg = 'unknown compression method';
512
- state.mode = BAD;
513
- break;
514
- }
515
- if (state.flags & 0xe000) {
516
- strm.msg = 'unknown header flags set';
517
- state.mode = BAD;
518
- break;
519
- }
520
- if (state.head) {
521
- state.head.text = ((hold >> 8) & 1);
522
- }
523
- if (state.flags & 0x0200) {
524
- //=== CRC2(state.check, hold);
525
- hbuf[0] = hold & 0xff;
526
- hbuf[1] = (hold >>> 8) & 0xff;
527
- state.check = crc32(state.check, hbuf, 2, 0);
528
- //===//
529
- }
530
- //=== INITBITS();
531
- hold = 0;
532
- bits = 0;
533
- //===//
534
- state.mode = TIME;
535
- /* falls through */
536
- case TIME:
537
- //=== NEEDBITS(32); */
538
- while (bits < 32) {
539
- if (have === 0) { break inf_leave; }
540
- have--;
541
- hold += input[next++] << bits;
542
- bits += 8;
543
- }
544
- //===//
545
- if (state.head) {
546
- state.head.time = hold;
547
- }
548
- if (state.flags & 0x0200) {
549
- //=== CRC4(state.check, hold)
550
- hbuf[0] = hold & 0xff;
551
- hbuf[1] = (hold >>> 8) & 0xff;
552
- hbuf[2] = (hold >>> 16) & 0xff;
553
- hbuf[3] = (hold >>> 24) & 0xff;
554
- state.check = crc32(state.check, hbuf, 4, 0);
555
- //===
556
- }
557
- //=== INITBITS();
558
- hold = 0;
559
- bits = 0;
560
- //===//
561
- state.mode = OS;
562
- /* falls through */
563
- case OS:
564
- //=== NEEDBITS(16); */
565
- while (bits < 16) {
566
- if (have === 0) { break inf_leave; }
567
- have--;
568
- hold += input[next++] << bits;
569
- bits += 8;
570
- }
571
- //===//
572
- if (state.head) {
573
- state.head.xflags = (hold & 0xff);
574
- state.head.os = (hold >> 8);
575
- }
576
- if (state.flags & 0x0200) {
577
- //=== CRC2(state.check, hold);
578
- hbuf[0] = hold & 0xff;
579
- hbuf[1] = (hold >>> 8) & 0xff;
580
- state.check = crc32(state.check, hbuf, 2, 0);
581
- //===//
582
- }
583
- //=== INITBITS();
584
- hold = 0;
585
- bits = 0;
586
- //===//
587
- state.mode = EXLEN;
588
- /* falls through */
589
- case EXLEN:
590
- if (state.flags & 0x0400) {
591
- //=== NEEDBITS(16); */
592
- while (bits < 16) {
593
- if (have === 0) { break inf_leave; }
594
- have--;
595
- hold += input[next++] << bits;
596
- bits += 8;
597
- }
598
- //===//
599
- state.length = hold;
600
- if (state.head) {
601
- state.head.extra_len = hold;
602
- }
603
- if (state.flags & 0x0200) {
604
- //=== CRC2(state.check, hold);
605
- hbuf[0] = hold & 0xff;
606
- hbuf[1] = (hold >>> 8) & 0xff;
607
- state.check = crc32(state.check, hbuf, 2, 0);
608
- //===//
609
- }
610
- //=== INITBITS();
611
- hold = 0;
612
- bits = 0;
613
- //===//
614
- }
615
- else if (state.head) {
616
- state.head.extra = null/*Z_NULL*/;
617
- }
618
- state.mode = EXTRA;
619
- /* falls through */
620
- case EXTRA:
621
- if (state.flags & 0x0400) {
622
- copy = state.length;
623
- if (copy > have) { copy = have; }
624
- if (copy) {
625
- if (state.head) {
626
- len = state.head.extra_len - state.length;
627
- if (!state.head.extra) {
628
- // Use untyped array for more convenient processing later
629
- state.head.extra = new Array(state.head.extra_len);
630
- }
631
- utils.arraySet(
632
- state.head.extra,
633
- input,
634
- next,
635
- // extra field is limited to 65536 bytes
636
- // - no need for additional size check
637
- copy,
638
- /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/
639
- len
640
- );
641
- //zmemcpy(state.head.extra + len, next,
642
- // len + copy > state.head.extra_max ?
643
- // state.head.extra_max - len : copy);
644
- }
645
- if (state.flags & 0x0200) {
646
- state.check = crc32(state.check, input, copy, next);
647
- }
648
- have -= copy;
649
- next += copy;
650
- state.length -= copy;
651
- }
652
- if (state.length) { break inf_leave; }
653
- }
654
- state.length = 0;
655
- state.mode = NAME;
656
- /* falls through */
657
- case NAME:
658
- if (state.flags & 0x0800) {
659
- if (have === 0) { break inf_leave; }
660
- copy = 0;
661
- do {
662
- // TODO: 2 or 1 bytes?
663
- len = input[next + copy++];
664
- /* use constant limit because in js we should not preallocate memory */
665
- if (state.head && len &&
666
- (state.length < 65536 /*state.head.name_max*/)) {
667
- state.head.name += String.fromCharCode(len);
668
- }
669
- } while (len && copy < have);
670
-
671
- if (state.flags & 0x0200) {
672
- state.check = crc32(state.check, input, copy, next);
673
- }
674
- have -= copy;
675
- next += copy;
676
- if (len) { break inf_leave; }
677
- }
678
- else if (state.head) {
679
- state.head.name = null;
680
- }
681
- state.length = 0;
682
- state.mode = COMMENT;
683
- /* falls through */
684
- case COMMENT:
685
- if (state.flags & 0x1000) {
686
- if (have === 0) { break inf_leave; }
687
- copy = 0;
688
- do {
689
- len = input[next + copy++];
690
- /* use constant limit because in js we should not preallocate memory */
691
- if (state.head && len &&
692
- (state.length < 65536 /*state.head.comm_max*/)) {
693
- state.head.comment += String.fromCharCode(len);
694
- }
695
- } while (len && copy < have);
696
- if (state.flags & 0x0200) {
697
- state.check = crc32(state.check, input, copy, next);
698
- }
699
- have -= copy;
700
- next += copy;
701
- if (len) { break inf_leave; }
702
- }
703
- else if (state.head) {
704
- state.head.comment = null;
705
- }
706
- state.mode = HCRC;
707
- /* falls through */
708
- case HCRC:
709
- if (state.flags & 0x0200) {
710
- //=== NEEDBITS(16); */
711
- while (bits < 16) {
712
- if (have === 0) { break inf_leave; }
713
- have--;
714
- hold += input[next++] << bits;
715
- bits += 8;
716
- }
717
- //===//
718
- if (hold !== (state.check & 0xffff)) {
719
- strm.msg = 'header crc mismatch';
720
- state.mode = BAD;
721
- break;
722
- }
723
- //=== INITBITS();
724
- hold = 0;
725
- bits = 0;
726
- //===//
727
- }
728
- if (state.head) {
729
- state.head.hcrc = ((state.flags >> 9) & 1);
730
- state.head.done = true;
731
- }
732
- strm.adler = state.check = 0;
733
- state.mode = TYPE;
734
- break;
735
- case DICTID:
736
- //=== NEEDBITS(32); */
737
- while (bits < 32) {
738
- if (have === 0) { break inf_leave; }
739
- have--;
740
- hold += input[next++] << bits;
741
- bits += 8;
742
- }
743
- //===//
744
- strm.adler = state.check = zswap32(hold);
745
- //=== INITBITS();
746
- hold = 0;
747
- bits = 0;
748
- //===//
749
- state.mode = DICT;
750
- /* falls through */
751
- case DICT:
752
- if (state.havedict === 0) {
753
- //--- RESTORE() ---
754
- strm.next_out = put;
755
- strm.avail_out = left;
756
- strm.next_in = next;
757
- strm.avail_in = have;
758
- state.hold = hold;
759
- state.bits = bits;
760
- //---
761
- return Z_NEED_DICT;
762
- }
763
- strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/;
764
- state.mode = TYPE;
765
- /* falls through */
766
- case TYPE:
767
- if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; }
768
- /* falls through */
769
- case TYPEDO:
770
- if (state.last) {
771
- //--- BYTEBITS() ---//
772
- hold >>>= bits & 7;
773
- bits -= bits & 7;
774
- //---//
775
- state.mode = CHECK;
776
- break;
777
- }
778
- //=== NEEDBITS(3); */
779
- while (bits < 3) {
780
- if (have === 0) { break inf_leave; }
781
- have--;
782
- hold += input[next++] << bits;
783
- bits += 8;
784
- }
785
- //===//
786
- state.last = (hold & 0x01)/*BITS(1)*/;
787
- //--- DROPBITS(1) ---//
788
- hold >>>= 1;
789
- bits -= 1;
790
- //---//
791
-
792
- switch ((hold & 0x03)/*BITS(2)*/) {
793
- case 0: /* stored block */
794
- //Tracev((stderr, "inflate: stored block%s\n",
795
- // state.last ? " (last)" : ""));
796
- state.mode = STORED;
797
- break;
798
- case 1: /* fixed block */
799
- fixedtables(state);
800
- //Tracev((stderr, "inflate: fixed codes block%s\n",
801
- // state.last ? " (last)" : ""));
802
- state.mode = LEN_; /* decode codes */
803
- if (flush === Z_TREES) {
804
- //--- DROPBITS(2) ---//
805
- hold >>>= 2;
806
- bits -= 2;
807
- //---//
808
- break inf_leave;
809
- }
810
- break;
811
- case 2: /* dynamic block */
812
- //Tracev((stderr, "inflate: dynamic codes block%s\n",
813
- // state.last ? " (last)" : ""));
814
- state.mode = TABLE;
815
- break;
816
- case 3:
817
- strm.msg = 'invalid block type';
818
- state.mode = BAD;
819
- }
820
- //--- DROPBITS(2) ---//
821
- hold >>>= 2;
822
- bits -= 2;
823
- //---//
824
- break;
825
- case STORED:
826
- //--- BYTEBITS() ---// /* go to byte boundary */
827
- hold >>>= bits & 7;
828
- bits -= bits & 7;
829
- //---//
830
- //=== NEEDBITS(32); */
831
- while (bits < 32) {
832
- if (have === 0) { break inf_leave; }
833
- have--;
834
- hold += input[next++] << bits;
835
- bits += 8;
836
- }
837
- //===//
838
- if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {
839
- strm.msg = 'invalid stored block lengths';
840
- state.mode = BAD;
841
- break;
842
- }
843
- state.length = hold & 0xffff;
844
- //Tracev((stderr, "inflate: stored length %u\n",
845
- // state.length));
846
- //=== INITBITS();
847
- hold = 0;
848
- bits = 0;
849
- //===//
850
- state.mode = COPY_;
851
- if (flush === Z_TREES) { break inf_leave; }
852
- /* falls through */
853
- case COPY_:
854
- state.mode = COPY;
855
- /* falls through */
856
- case COPY:
857
- copy = state.length;
858
- if (copy) {
859
- if (copy > have) { copy = have; }
860
- if (copy > left) { copy = left; }
861
- if (copy === 0) { break inf_leave; }
862
- //--- zmemcpy(put, next, copy); ---
863
- utils.arraySet(output, input, next, copy, put);
864
- //---//
865
- have -= copy;
866
- next += copy;
867
- left -= copy;
868
- put += copy;
869
- state.length -= copy;
870
- break;
871
- }
872
- //Tracev((stderr, "inflate: stored end\n"));
873
- state.mode = TYPE;
874
- break;
875
- case TABLE:
876
- //=== NEEDBITS(14); */
877
- while (bits < 14) {
878
- if (have === 0) { break inf_leave; }
879
- have--;
880
- hold += input[next++] << bits;
881
- bits += 8;
882
- }
883
- //===//
884
- state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257;
885
- //--- DROPBITS(5) ---//
886
- hold >>>= 5;
887
- bits -= 5;
888
- //---//
889
- state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1;
890
- //--- DROPBITS(5) ---//
891
- hold >>>= 5;
892
- bits -= 5;
893
- //---//
894
- state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4;
895
- //--- DROPBITS(4) ---//
896
- hold >>>= 4;
897
- bits -= 4;
898
- //---//
899
- //#ifndef PKZIP_BUG_WORKAROUND
900
- if (state.nlen > 286 || state.ndist > 30) {
901
- strm.msg = 'too many length or distance symbols';
902
- state.mode = BAD;
903
- break;
904
- }
905
- //#endif
906
- //Tracev((stderr, "inflate: table sizes ok\n"));
907
- state.have = 0;
908
- state.mode = LENLENS;
909
- /* falls through */
910
- case LENLENS:
911
- while (state.have < state.ncode) {
912
- //=== NEEDBITS(3);
913
- while (bits < 3) {
914
- if (have === 0) { break inf_leave; }
915
- have--;
916
- hold += input[next++] << bits;
917
- bits += 8;
918
- }
919
- //===//
920
- state.lens[order[state.have++]] = (hold & 0x07);//BITS(3);
921
- //--- DROPBITS(3) ---//
922
- hold >>>= 3;
923
- bits -= 3;
924
- //---//
925
- }
926
- while (state.have < 19) {
927
- state.lens[order[state.have++]] = 0;
928
- }
929
- // We have separate tables & no pointers. 2 commented lines below not needed.
930
- //state.next = state.codes;
931
- //state.lencode = state.next;
932
- // Switch to use dynamic table
933
- state.lencode = state.lendyn;
934
- state.lenbits = 7;
935
-
936
- opts = { bits: state.lenbits };
937
- ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts);
938
- state.lenbits = opts.bits;
939
-
940
- if (ret) {
941
- strm.msg = 'invalid code lengths set';
942
- state.mode = BAD;
943
- break;
944
- }
945
- //Tracev((stderr, "inflate: code lengths ok\n"));
946
- state.have = 0;
947
- state.mode = CODELENS;
948
- /* falls through */
949
- case CODELENS:
950
- while (state.have < state.nlen + state.ndist) {
951
- for (;;) {
952
- here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/
953
- here_bits = here >>> 24;
954
- here_op = (here >>> 16) & 0xff;
955
- here_val = here & 0xffff;
956
-
957
- if ((here_bits) <= bits) { break; }
958
- //--- PULLBYTE() ---//
959
- if (have === 0) { break inf_leave; }
960
- have--;
961
- hold += input[next++] << bits;
962
- bits += 8;
963
- //---//
964
- }
965
- if (here_val < 16) {
966
- //--- DROPBITS(here.bits) ---//
967
- hold >>>= here_bits;
968
- bits -= here_bits;
969
- //---//
970
- state.lens[state.have++] = here_val;
971
- }
972
- else {
973
- if (here_val === 16) {
974
- //=== NEEDBITS(here.bits + 2);
975
- n = here_bits + 2;
976
- while (bits < n) {
977
- if (have === 0) { break inf_leave; }
978
- have--;
979
- hold += input[next++] << bits;
980
- bits += 8;
981
- }
982
- //===//
983
- //--- DROPBITS(here.bits) ---//
984
- hold >>>= here_bits;
985
- bits -= here_bits;
986
- //---//
987
- if (state.have === 0) {
988
- strm.msg = 'invalid bit length repeat';
989
- state.mode = BAD;
990
- break;
991
- }
992
- len = state.lens[state.have - 1];
993
- copy = 3 + (hold & 0x03);//BITS(2);
994
- //--- DROPBITS(2) ---//
995
- hold >>>= 2;
996
- bits -= 2;
997
- //---//
998
- }
999
- else if (here_val === 17) {
1000
- //=== NEEDBITS(here.bits + 3);
1001
- n = here_bits + 3;
1002
- while (bits < n) {
1003
- if (have === 0) { break inf_leave; }
1004
- have--;
1005
- hold += input[next++] << bits;
1006
- bits += 8;
1007
- }
1008
- //===//
1009
- //--- DROPBITS(here.bits) ---//
1010
- hold >>>= here_bits;
1011
- bits -= here_bits;
1012
- //---//
1013
- len = 0;
1014
- copy = 3 + (hold & 0x07);//BITS(3);
1015
- //--- DROPBITS(3) ---//
1016
- hold >>>= 3;
1017
- bits -= 3;
1018
- //---//
1019
- }
1020
- else {
1021
- //=== NEEDBITS(here.bits + 7);
1022
- n = here_bits + 7;
1023
- while (bits < n) {
1024
- if (have === 0) { break inf_leave; }
1025
- have--;
1026
- hold += input[next++] << bits;
1027
- bits += 8;
1028
- }
1029
- //===//
1030
- //--- DROPBITS(here.bits) ---//
1031
- hold >>>= here_bits;
1032
- bits -= here_bits;
1033
- //---//
1034
- len = 0;
1035
- copy = 11 + (hold & 0x7f);//BITS(7);
1036
- //--- DROPBITS(7) ---//
1037
- hold >>>= 7;
1038
- bits -= 7;
1039
- //---//
1040
- }
1041
- if (state.have + copy > state.nlen + state.ndist) {
1042
- strm.msg = 'invalid bit length repeat';
1043
- state.mode = BAD;
1044
- break;
1045
- }
1046
- while (copy--) {
1047
- state.lens[state.have++] = len;
1048
- }
1049
- }
1050
- }
1051
-
1052
- /* handle error breaks in while */
1053
- if (state.mode === BAD) { break; }
1054
-
1055
- /* check for end-of-block code (better have one) */
1056
- if (state.lens[256] === 0) {
1057
- strm.msg = 'invalid code -- missing end-of-block';
1058
- state.mode = BAD;
1059
- break;
1060
- }
1061
-
1062
- /* build code tables -- note: do not change the lenbits or distbits
1063
- values here (9 and 6) without reading the comments in inftrees.h
1064
- concerning the ENOUGH constants, which depend on those values */
1065
- state.lenbits = 9;
1066
-
1067
- opts = { bits: state.lenbits };
1068
- ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
1069
- // We have separate tables & no pointers. 2 commented lines below not needed.
1070
- // state.next_index = opts.table_index;
1071
- state.lenbits = opts.bits;
1072
- // state.lencode = state.next;
1073
-
1074
- if (ret) {
1075
- strm.msg = 'invalid literal/lengths set';
1076
- state.mode = BAD;
1077
- break;
1078
- }
1079
-
1080
- state.distbits = 6;
1081
- //state.distcode.copy(state.codes);
1082
- // Switch to use dynamic table
1083
- state.distcode = state.distdyn;
1084
- opts = { bits: state.distbits };
1085
- ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
1086
- // We have separate tables & no pointers. 2 commented lines below not needed.
1087
- // state.next_index = opts.table_index;
1088
- state.distbits = opts.bits;
1089
- // state.distcode = state.next;
1090
-
1091
- if (ret) {
1092
- strm.msg = 'invalid distances set';
1093
- state.mode = BAD;
1094
- break;
1095
- }
1096
- //Tracev((stderr, 'inflate: codes ok\n'));
1097
- state.mode = LEN_;
1098
- if (flush === Z_TREES) { break inf_leave; }
1099
- /* falls through */
1100
- case LEN_:
1101
- state.mode = LEN;
1102
- /* falls through */
1103
- case LEN:
1104
- if (have >= 6 && left >= 258) {
1105
- //--- RESTORE() ---
1106
- strm.next_out = put;
1107
- strm.avail_out = left;
1108
- strm.next_in = next;
1109
- strm.avail_in = have;
1110
- state.hold = hold;
1111
- state.bits = bits;
1112
- //---
1113
- inflate_fast(strm, _out);
1114
- //--- LOAD() ---
1115
- put = strm.next_out;
1116
- output = strm.output;
1117
- left = strm.avail_out;
1118
- next = strm.next_in;
1119
- input = strm.input;
1120
- have = strm.avail_in;
1121
- hold = state.hold;
1122
- bits = state.bits;
1123
- //---
1124
-
1125
- if (state.mode === TYPE) {
1126
- state.back = -1;
1127
- }
1128
- break;
1129
- }
1130
- state.back = 0;
1131
- for (;;) {
1132
- here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/
1133
- here_bits = here >>> 24;
1134
- here_op = (here >>> 16) & 0xff;
1135
- here_val = here & 0xffff;
1136
-
1137
- if (here_bits <= bits) { break; }
1138
- //--- PULLBYTE() ---//
1139
- if (have === 0) { break inf_leave; }
1140
- have--;
1141
- hold += input[next++] << bits;
1142
- bits += 8;
1143
- //---//
1144
- }
1145
- if (here_op && (here_op & 0xf0) === 0) {
1146
- last_bits = here_bits;
1147
- last_op = here_op;
1148
- last_val = here_val;
1149
- for (;;) {
1150
- here = state.lencode[last_val +
1151
- ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
1152
- here_bits = here >>> 24;
1153
- here_op = (here >>> 16) & 0xff;
1154
- here_val = here & 0xffff;
1155
-
1156
- if ((last_bits + here_bits) <= bits) { break; }
1157
- //--- PULLBYTE() ---//
1158
- if (have === 0) { break inf_leave; }
1159
- have--;
1160
- hold += input[next++] << bits;
1161
- bits += 8;
1162
- //---//
1163
- }
1164
- //--- DROPBITS(last.bits) ---//
1165
- hold >>>= last_bits;
1166
- bits -= last_bits;
1167
- //---//
1168
- state.back += last_bits;
1169
- }
1170
- //--- DROPBITS(here.bits) ---//
1171
- hold >>>= here_bits;
1172
- bits -= here_bits;
1173
- //---//
1174
- state.back += here_bits;
1175
- state.length = here_val;
1176
- if (here_op === 0) {
1177
- //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
1178
- // "inflate: literal '%c'\n" :
1179
- // "inflate: literal 0x%02x\n", here.val));
1180
- state.mode = LIT;
1181
- break;
1182
- }
1183
- if (here_op & 32) {
1184
- //Tracevv((stderr, "inflate: end of block\n"));
1185
- state.back = -1;
1186
- state.mode = TYPE;
1187
- break;
1188
- }
1189
- if (here_op & 64) {
1190
- strm.msg = 'invalid literal/length code';
1191
- state.mode = BAD;
1192
- break;
1193
- }
1194
- state.extra = here_op & 15;
1195
- state.mode = LENEXT;
1196
- /* falls through */
1197
- case LENEXT:
1198
- if (state.extra) {
1199
- //=== NEEDBITS(state.extra);
1200
- n = state.extra;
1201
- while (bits < n) {
1202
- if (have === 0) { break inf_leave; }
1203
- have--;
1204
- hold += input[next++] << bits;
1205
- bits += 8;
1206
- }
1207
- //===//
1208
- state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
1209
- //--- DROPBITS(state.extra) ---//
1210
- hold >>>= state.extra;
1211
- bits -= state.extra;
1212
- //---//
1213
- state.back += state.extra;
1214
- }
1215
- //Tracevv((stderr, "inflate: length %u\n", state.length));
1216
- state.was = state.length;
1217
- state.mode = DIST;
1218
- /* falls through */
1219
- case DIST:
1220
- for (;;) {
1221
- here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/
1222
- here_bits = here >>> 24;
1223
- here_op = (here >>> 16) & 0xff;
1224
- here_val = here & 0xffff;
1225
-
1226
- if ((here_bits) <= bits) { break; }
1227
- //--- PULLBYTE() ---//
1228
- if (have === 0) { break inf_leave; }
1229
- have--;
1230
- hold += input[next++] << bits;
1231
- bits += 8;
1232
- //---//
1233
- }
1234
- if ((here_op & 0xf0) === 0) {
1235
- last_bits = here_bits;
1236
- last_op = here_op;
1237
- last_val = here_val;
1238
- for (;;) {
1239
- here = state.distcode[last_val +
1240
- ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)];
1241
- here_bits = here >>> 24;
1242
- here_op = (here >>> 16) & 0xff;
1243
- here_val = here & 0xffff;
1244
-
1245
- if ((last_bits + here_bits) <= bits) { break; }
1246
- //--- PULLBYTE() ---//
1247
- if (have === 0) { break inf_leave; }
1248
- have--;
1249
- hold += input[next++] << bits;
1250
- bits += 8;
1251
- //---//
1252
- }
1253
- //--- DROPBITS(last.bits) ---//
1254
- hold >>>= last_bits;
1255
- bits -= last_bits;
1256
- //---//
1257
- state.back += last_bits;
1258
- }
1259
- //--- DROPBITS(here.bits) ---//
1260
- hold >>>= here_bits;
1261
- bits -= here_bits;
1262
- //---//
1263
- state.back += here_bits;
1264
- if (here_op & 64) {
1265
- strm.msg = 'invalid distance code';
1266
- state.mode = BAD;
1267
- break;
1268
- }
1269
- state.offset = here_val;
1270
- state.extra = (here_op) & 15;
1271
- state.mode = DISTEXT;
1272
- /* falls through */
1273
- case DISTEXT:
1274
- if (state.extra) {
1275
- //=== NEEDBITS(state.extra);
1276
- n = state.extra;
1277
- while (bits < n) {
1278
- if (have === 0) { break inf_leave; }
1279
- have--;
1280
- hold += input[next++] << bits;
1281
- bits += 8;
1282
- }
1283
- //===//
1284
- state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/;
1285
- //--- DROPBITS(state.extra) ---//
1286
- hold >>>= state.extra;
1287
- bits -= state.extra;
1288
- //---//
1289
- state.back += state.extra;
1290
- }
1291
- //#ifdef INFLATE_STRICT
1292
- if (state.offset > state.dmax) {
1293
- strm.msg = 'invalid distance too far back';
1294
- state.mode = BAD;
1295
- break;
1296
- }
1297
- //#endif
1298
- //Tracevv((stderr, "inflate: distance %u\n", state.offset));
1299
- state.mode = MATCH;
1300
- /* falls through */
1301
- case MATCH:
1302
- if (left === 0) { break inf_leave; }
1303
- copy = _out - left;
1304
- if (state.offset > copy) { /* copy from window */
1305
- copy = state.offset - copy;
1306
- if (copy > state.whave) {
1307
- if (state.sane) {
1308
- strm.msg = 'invalid distance too far back';
1309
- state.mode = BAD;
1310
- break;
1311
- }
1312
- // (!) This block is disabled in zlib defaults,
1313
- // don't enable it for binary compatibility
1314
- //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
1315
- // Trace((stderr, "inflate.c too far\n"));
1316
- // copy -= state.whave;
1317
- // if (copy > state.length) { copy = state.length; }
1318
- // if (copy > left) { copy = left; }
1319
- // left -= copy;
1320
- // state.length -= copy;
1321
- // do {
1322
- // output[put++] = 0;
1323
- // } while (--copy);
1324
- // if (state.length === 0) { state.mode = LEN; }
1325
- // break;
1326
- //#endif
1327
- }
1328
- if (copy > state.wnext) {
1329
- copy -= state.wnext;
1330
- from = state.wsize - copy;
1331
- }
1332
- else {
1333
- from = state.wnext - copy;
1334
- }
1335
- if (copy > state.length) { copy = state.length; }
1336
- from_source = state.window;
1337
- }
1338
- else { /* copy from output */
1339
- from_source = output;
1340
- from = put - state.offset;
1341
- copy = state.length;
1342
- }
1343
- if (copy > left) { copy = left; }
1344
- left -= copy;
1345
- state.length -= copy;
1346
- do {
1347
- output[put++] = from_source[from++];
1348
- } while (--copy);
1349
- if (state.length === 0) { state.mode = LEN; }
1350
- break;
1351
- case LIT:
1352
- if (left === 0) { break inf_leave; }
1353
- output[put++] = state.length;
1354
- left--;
1355
- state.mode = LEN;
1356
- break;
1357
- case CHECK:
1358
- if (state.wrap) {
1359
- //=== NEEDBITS(32);
1360
- while (bits < 32) {
1361
- if (have === 0) { break inf_leave; }
1362
- have--;
1363
- // Use '|' instead of '+' to make sure that result is signed
1364
- hold |= input[next++] << bits;
1365
- bits += 8;
1366
- }
1367
- //===//
1368
- _out -= left;
1369
- strm.total_out += _out;
1370
- state.total += _out;
1371
- if (_out) {
1372
- strm.adler = state.check =
1373
- /*UPDATE(state.check, put - _out, _out);*/
1374
- (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out));
1375
-
1376
- }
1377
- _out = left;
1378
- // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too
1379
- if ((state.flags ? hold : zswap32(hold)) !== state.check) {
1380
- strm.msg = 'incorrect data check';
1381
- state.mode = BAD;
1382
- break;
1383
- }
1384
- //=== INITBITS();
1385
- hold = 0;
1386
- bits = 0;
1387
- //===//
1388
- //Tracev((stderr, "inflate: check matches trailer\n"));
1389
- }
1390
- state.mode = LENGTH;
1391
- /* falls through */
1392
- case LENGTH:
1393
- if (state.wrap && state.flags) {
1394
- //=== NEEDBITS(32);
1395
- while (bits < 32) {
1396
- if (have === 0) { break inf_leave; }
1397
- have--;
1398
- hold += input[next++] << bits;
1399
- bits += 8;
1400
- }
1401
- //===//
1402
- if (hold !== (state.total & 0xffffffff)) {
1403
- strm.msg = 'incorrect length check';
1404
- state.mode = BAD;
1405
- break;
1406
- }
1407
- //=== INITBITS();
1408
- hold = 0;
1409
- bits = 0;
1410
- //===//
1411
- //Tracev((stderr, "inflate: length matches trailer\n"));
1412
- }
1413
- state.mode = DONE;
1414
- /* falls through */
1415
- case DONE:
1416
- ret = Z_STREAM_END;
1417
- break inf_leave;
1418
- case BAD:
1419
- ret = Z_DATA_ERROR;
1420
- break inf_leave;
1421
- case MEM:
1422
- return Z_MEM_ERROR;
1423
- case SYNC:
1424
- /* falls through */
1425
- default:
1426
- return Z_STREAM_ERROR;
1427
- }
1428
- }
1429
-
1430
- // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave"
1431
-
1432
- /*
1433
- Return from inflate(), updating the total counts and the check value.
1434
- If there was no progress during the inflate() call, return a buffer
1435
- error. Call updatewindow() to create and/or update the window state.
1436
- Note: a memory error from inflate() is non-recoverable.
1437
- */
1438
-
1439
- //--- RESTORE() ---
1440
- strm.next_out = put;
1441
- strm.avail_out = left;
1442
- strm.next_in = next;
1443
- strm.avail_in = have;
1444
- state.hold = hold;
1445
- state.bits = bits;
1446
- //---
1447
-
1448
- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD &&
1449
- (state.mode < CHECK || flush !== Z_FINISH))) {
1450
- if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {
1451
- state.mode = MEM;
1452
- return Z_MEM_ERROR;
1453
- }
1454
- }
1455
- _in -= strm.avail_in;
1456
- _out -= strm.avail_out;
1457
- strm.total_in += _in;
1458
- strm.total_out += _out;
1459
- state.total += _out;
1460
- if (state.wrap && _out) {
1461
- strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/
1462
- (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out));
1463
- }
1464
- strm.data_type = state.bits + (state.last ? 64 : 0) +
1465
- (state.mode === TYPE ? 128 : 0) +
1466
- (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
1467
- if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {
1468
- ret = Z_BUF_ERROR;
1469
- }
1470
- return ret;
1471
- }
1472
-
1473
- function inflateEnd(strm) {
1474
-
1475
- if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {
1476
- return Z_STREAM_ERROR;
1477
- }
1478
-
1479
- var state = strm.state;
1480
- if (state.window) {
1481
- state.window = null;
1482
- }
1483
- strm.state = null;
1484
- return Z_OK;
1485
- }
1486
-
1487
- function inflateGetHeader(strm, head) {
1488
- var state;
1489
-
1490
- /* check state */
1491
- if (!strm || !strm.state) { return Z_STREAM_ERROR; }
1492
- state = strm.state;
1493
- if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; }
1494
-
1495
- /* save header structure */
1496
- state.head = head;
1497
- head.done = false;
1498
- return Z_OK;
1499
- }
1500
-
1501
- function inflateSetDictionary(strm, dictionary) {
1502
- var dictLength = dictionary.length;
1503
-
1504
- var state;
1505
- var dictid;
1506
- var ret;
1507
-
1508
- /* check state */
1509
- if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; }
1510
- state = strm.state;
1511
-
1512
- if (state.wrap !== 0 && state.mode !== DICT) {
1513
- return Z_STREAM_ERROR;
1514
- }
1515
-
1516
- /* check for correct dictionary identifier */
1517
- if (state.mode === DICT) {
1518
- dictid = 1; /* adler32(0, null, 0)*/
1519
- /* dictid = adler32(dictid, dictionary, dictLength); */
1520
- dictid = adler32(dictid, dictionary, dictLength, 0);
1521
- if (dictid !== state.check) {
1522
- return Z_DATA_ERROR;
1523
- }
1524
- }
1525
- /* copy dictionary to window using updatewindow(), which will amend the
1526
- existing dictionary if appropriate */
1527
- ret = updatewindow(strm, dictionary, dictLength, dictLength);
1528
- if (ret) {
1529
- state.mode = MEM;
1530
- return Z_MEM_ERROR;
1531
- }
1532
- state.havedict = 1;
1533
- // Tracev((stderr, "inflate: dictionary set\n"));
1534
- return Z_OK;
1535
- }
1536
-
1537
- exports.inflateReset = inflateReset;
1538
- exports.inflateReset2 = inflateReset2;
1539
- exports.inflateResetKeep = inflateResetKeep;
1540
- exports.inflateInit = inflateInit;
1541
- exports.inflateInit2 = inflateInit2;
1542
- exports.inflate = inflate;
1543
- exports.inflateEnd = inflateEnd;
1544
- exports.inflateGetHeader = inflateGetHeader;
1545
- exports.inflateSetDictionary = inflateSetDictionary;
1546
- exports.inflateInfo = 'pako inflate (from Nodeca project)';
1547
-
1548
- /* Not implemented
1549
- exports.inflateCopy = inflateCopy;
1550
- exports.inflateGetDictionary = inflateGetDictionary;
1551
- exports.inflateMark = inflateMark;
1552
- exports.inflatePrime = inflatePrime;
1553
- exports.inflateSync = inflateSync;
1554
- exports.inflateSyncPoint = inflateSyncPoint;
1555
- exports.inflateUndermine = inflateUndermine;
1556
- */