@psnext/slingcli 2.4.20260520-2 → 2.4.20260520-4

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 (1292) hide show
  1. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +5 -5
  2. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  3. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +23 -0
  4. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +1 -1
  5. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +557 -385
  6. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +13 -82
  7. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +61 -144
  8. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/utils.js +14 -36
  9. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +234 -96
  10. package/node_modules/@earendil-works/pi-agent-core/dist/harness/prompt-templates.js +85 -55
  11. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-repo.js +101 -0
  12. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl-storage.js +231 -0
  13. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-repo.js +42 -0
  14. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/memory-storage.js +114 -0
  15. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo-utils.js +39 -0
  16. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +3 -2
  17. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/uuid.js +50 -0
  18. package/node_modules/@earendil-works/pi-agent-core/dist/harness/skills.js +125 -73
  19. package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js +86 -8
  20. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +85 -56
  21. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +103 -18
  22. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +4 -4
  23. package/node_modules/@earendil-works/pi-agent-core/dist/node.js +3 -0
  24. package/node_modules/@earendil-works/pi-agent-core/package.json +23 -10
  25. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +11 -3
  26. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +117 -353
  27. package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +35 -32
  28. package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +5 -2
  29. package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +19 -2
  30. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +35 -4
  31. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +24 -10
  32. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-prompt-cache.js +10 -0
  33. package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +19 -2
  34. package/node_modules/@earendil-works/pi-ai/dist/providers/register-builtins.js +13 -2
  35. package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +6 -4
  36. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +2 -2
  37. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +97 -0
  38. package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +1 -1
  39. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +3 -1
  40. package/node_modules/@earendil-works/pi-ai/package.json +15 -20
  41. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js +1 -1
  42. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +4 -6
  43. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +45 -22
  44. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-runtime.js +4 -5
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +127 -151
  46. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +1 -1
  47. package/node_modules/@earendil-works/pi-coding-agent/dist/core/bash-executor.js +1 -1
  48. package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +25 -15
  49. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +17 -3
  50. package/node_modules/@earendil-works/pi-coding-agent/dist/core/http-dispatcher.js +48 -0
  51. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +2 -2
  52. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +71 -33
  53. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prompt-templates.js +6 -4
  54. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +1 -1
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +39 -9
  56. package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +20 -0
  57. package/node_modules/@earendil-works/pi-coding-agent/dist/core/skills.js +2 -5
  58. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +7 -4
  59. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +1 -0
  60. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js +1 -1
  61. package/node_modules/@earendil-works/pi-coding-agent/dist/index.js +1 -0
  62. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +7 -11
  63. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +1 -1
  64. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +7 -4
  65. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/countdown-timer.js +2 -2
  66. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +14 -6
  67. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-selector.js +6 -1
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/footer.js +2 -2
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +2 -2
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +15 -0
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +99 -17
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +5 -4
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +5 -4
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +83 -41
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-client.js +1 -1
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +62 -7
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/ansi.js +52 -0
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js +9 -7
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/html.js +40 -0
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/mime.js +59 -16
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/paths.js +16 -0
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js +6 -1
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/syntax-highlight.js +118 -0
  84. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/tools-manager.js +80 -8
  85. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.js +9 -4
  86. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js +77 -0
  87. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/LICENSE +21 -0
  88. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Agent.md +84 -0
  89. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  90. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  91. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/CacheStore.md +164 -0
  92. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Client.md +287 -0
  93. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/ClientStats.md +27 -0
  94. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Connector.md +115 -0
  95. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  96. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Cookies.md +101 -0
  97. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Debug.md +62 -0
  98. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +315 -0
  99. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Dispatcher.md +1427 -0
  100. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +159 -0
  101. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Errors.md +49 -0
  102. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  103. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Fetch.md +60 -0
  104. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/GlobalInstallation.md +141 -0
  105. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/H2CClient.md +263 -0
  106. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockAgent.md +603 -0
  107. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockCallHistory.md +197 -0
  108. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockCallHistoryLog.md +43 -0
  109. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockClient.md +81 -0
  110. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  111. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/MockPool.md +555 -0
  112. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Pool.md +84 -0
  113. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  114. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/ProxyAgent.md +229 -0
  115. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RedirectHandler.md +98 -0
  116. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RetryAgent.md +49 -0
  117. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RetryHandler.md +116 -0
  118. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/RoundRobinPool.md +145 -0
  119. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/SnapshotAgent.md +639 -0
  120. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +274 -0
  121. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Util.md +25 -0
  122. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/WebSocket.md +141 -0
  123. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  124. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  125. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/crawling.md +58 -0
  126. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +231 -0
  127. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/mocking-request.md +190 -0
  128. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  129. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/undici-vs-builtin-fetch.md +224 -0
  130. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/best-practices/writing-tests.md +63 -0
  131. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/index-fetch.js +65 -0
  132. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/index.js +236 -0
  133. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/abort-signal.js +59 -0
  134. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-connect.js +112 -0
  135. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-pipeline.js +265 -0
  136. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-request.js +238 -0
  137. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-stream.js +270 -0
  138. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/api-upgrade.js +121 -0
  139. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/index.js +7 -0
  140. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/readable.js +581 -0
  141. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/memory-cache-store.js +234 -0
  142. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/sqlite-cache-store.js +463 -0
  143. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/connect.js +153 -0
  144. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/constants.js +120 -0
  145. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/diagnostics.js +227 -0
  146. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/errors.js +477 -0
  147. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/request.js +535 -0
  148. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/socks5-client.js +422 -0
  149. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/socks5-utils.js +212 -0
  150. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/symbols.js +76 -0
  151. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/tree.js +160 -0
  152. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/util.js +1019 -0
  153. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/agent.js +172 -0
  154. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/balanced-pool.js +214 -0
  155. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h1.js +1669 -0
  156. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h2.js +1326 -0
  157. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client.js +666 -0
  158. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher-base.js +184 -0
  159. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher.js +44 -0
  160. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +107 -0
  161. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +146 -0
  162. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/fixed-queue.js +135 -0
  163. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/h2c-client.js +51 -0
  164. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/pool-base.js +232 -0
  165. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/pool.js +143 -0
  166. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/proxy-agent.js +343 -0
  167. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  168. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/round-robin-pool.js +159 -0
  169. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +264 -0
  170. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/encoding/index.js +33 -0
  171. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/global.js +62 -0
  172. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-handler.js +586 -0
  173. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-revalidation-handler.js +124 -0
  174. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/decorator-handler.js +66 -0
  175. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/deduplication-handler.js +460 -0
  176. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/redirect-handler.js +192 -0
  177. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/retry-handler.js +407 -0
  178. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/cache.js +508 -0
  179. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/decompress.js +285 -0
  180. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/deduplicate.js +117 -0
  181. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dns.js +571 -0
  182. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dump.js +112 -0
  183. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/redirect.js +21 -0
  184. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/response-error.js +95 -0
  185. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/retry.js +19 -0
  186. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/constants.js +531 -0
  187. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/llhttp-wasm.js +15 -0
  188. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +15 -0
  189. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/llhttp/utils.js +12 -0
  190. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-agent.js +232 -0
  191. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-call-history.js +248 -0
  192. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-client.js +68 -0
  193. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-errors.js +29 -0
  194. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-interceptor.js +209 -0
  195. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-pool.js +68 -0
  196. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-symbols.js +32 -0
  197. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-utils.js +501 -0
  198. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  199. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-agent.js +363 -0
  200. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-recorder.js +623 -0
  201. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/snapshot-utils.js +158 -0
  202. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/cache.js +408 -0
  203. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/date.js +653 -0
  204. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/runtime-features.js +93 -0
  205. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/stats.js +32 -0
  206. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/timers.js +425 -0
  207. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/cache.js +862 -0
  208. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  209. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cache/util.js +45 -0
  210. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/constants.js +12 -0
  211. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/index.js +199 -0
  212. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/parse.js +322 -0
  213. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/util.js +282 -0
  214. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource-stream.js +494 -0
  215. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource.js +501 -0
  216. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/util.js +29 -0
  217. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  218. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/body.js +503 -0
  219. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/constants.js +131 -0
  220. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/data-url.js +596 -0
  221. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/formdata-parser.js +586 -0
  222. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/formdata.js +278 -0
  223. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/global.js +40 -0
  224. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/headers.js +719 -0
  225. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/index.js +2403 -0
  226. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/request.js +1115 -0
  227. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/response.js +641 -0
  228. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/util.js +1522 -0
  229. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/infra/index.js +229 -0
  230. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/subresource-integrity/Readme.md +9 -0
  231. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +307 -0
  232. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/webidl/index.js +1004 -0
  233. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/connection.js +329 -0
  234. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/constants.js +126 -0
  235. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/events.js +331 -0
  236. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/frame.js +127 -0
  237. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
  238. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/receiver.js +490 -0
  239. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/sender.js +109 -0
  240. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketerror.js +104 -0
  241. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketstream.js +491 -0
  242. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/util.js +347 -0
  243. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/websocket.js +756 -0
  244. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/package.json +152 -0
  245. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/scripts/strip-comments.js +10 -0
  246. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +1803 -0
  247. package/node_modules/@earendil-works/pi-coding-agent/package.json +34 -36
  248. package/node_modules/@earendil-works/pi-tui/dist/components/image.js +27 -14
  249. package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +4 -4
  250. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +11 -5
  251. package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +22 -0
  252. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +27 -15
  253. package/node_modules/@earendil-works/pi-tui/package.json +9 -12
  254. package/node_modules/cross-spawn/LICENSE +21 -0
  255. package/node_modules/cross-spawn/README.md +89 -0
  256. package/node_modules/cross-spawn/index.js +39 -0
  257. package/node_modules/cross-spawn/lib/enoent.js +59 -0
  258. package/node_modules/cross-spawn/lib/parse.js +91 -0
  259. package/node_modules/cross-spawn/lib/util/escape.js +47 -0
  260. package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  261. package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  262. package/node_modules/cross-spawn/package.json +73 -0
  263. package/node_modules/isexe/.npmignore +2 -0
  264. package/node_modules/isexe/README.md +51 -0
  265. package/node_modules/isexe/index.js +57 -0
  266. package/node_modules/isexe/mode.js +41 -0
  267. package/node_modules/isexe/package.json +31 -0
  268. package/node_modules/isexe/test/basic.js +221 -0
  269. package/node_modules/isexe/windows.js +42 -0
  270. package/node_modules/path-key/index.d.ts +40 -0
  271. package/node_modules/path-key/index.js +16 -0
  272. package/node_modules/path-key/package.json +39 -0
  273. package/node_modules/path-key/readme.md +61 -0
  274. package/node_modules/shebang-command/index.js +19 -0
  275. package/node_modules/shebang-command/license +9 -0
  276. package/node_modules/shebang-command/package.json +34 -0
  277. package/node_modules/shebang-command/readme.md +34 -0
  278. package/node_modules/shebang-regex/index.d.ts +22 -0
  279. package/node_modules/shebang-regex/index.js +2 -0
  280. package/node_modules/shebang-regex/package.json +35 -0
  281. package/node_modules/shebang-regex/readme.md +33 -0
  282. package/node_modules/which/README.md +54 -0
  283. package/node_modules/which/bin/node-which +52 -0
  284. package/node_modules/which/package.json +43 -0
  285. package/node_modules/which/which.js +125 -0
  286. package/package.json +6 -6
  287. package/slingshot/index.js +259 -255
  288. package/node_modules/@borewit/text-codec/LICENSE.txt +0 -9
  289. package/node_modules/@borewit/text-codec/README.md +0 -87
  290. package/node_modules/@borewit/text-codec/lib/index.d.ts +0 -6
  291. package/node_modules/@borewit/text-codec/lib/index.js +0 -380
  292. package/node_modules/@borewit/text-codec/package.json +0 -70
  293. package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +0 -3
  294. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +0 -92
  295. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +0 -42
  296. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +0 -31
  297. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +0 -170
  298. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +0 -90
  299. package/node_modules/@tokenizer/inflate/LICENSE +0 -15
  300. package/node_modules/@tokenizer/inflate/README.md +0 -114
  301. package/node_modules/@tokenizer/inflate/lib/GzipHandler.d.ts +0 -6
  302. package/node_modules/@tokenizer/inflate/lib/GzipHandler.js +0 -19
  303. package/node_modules/@tokenizer/inflate/lib/ZipHandler.d.ts +0 -26
  304. package/node_modules/@tokenizer/inflate/lib/ZipHandler.js +0 -233
  305. package/node_modules/@tokenizer/inflate/lib/ZipToken.d.ts +0 -94
  306. package/node_modules/@tokenizer/inflate/lib/ZipToken.js +0 -117
  307. package/node_modules/@tokenizer/inflate/lib/index.d.ts +0 -3
  308. package/node_modules/@tokenizer/inflate/lib/index.js +0 -2
  309. package/node_modules/@tokenizer/inflate/package.json +0 -76
  310. package/node_modules/@tokenizer/token/README.md +0 -19
  311. package/node_modules/@tokenizer/token/index.d.ts +0 -30
  312. package/node_modules/@tokenizer/token/package.json +0 -33
  313. package/node_modules/@tootallnate/quickjs-emscripten/LICENSE +0 -21
  314. package/node_modules/@tootallnate/quickjs-emscripten/README.md +0 -597
  315. package/node_modules/@tootallnate/quickjs-emscripten/c/interface.c +0 -819
  316. package/node_modules/@tootallnate/quickjs-emscripten/dist/asyncify-helpers.d.ts +0 -24
  317. package/node_modules/@tootallnate/quickjs-emscripten/dist/asyncify-helpers.js +0 -53
  318. package/node_modules/@tootallnate/quickjs-emscripten/dist/asyncify-helpers.js.map +0 -1
  319. package/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.d.ts +0 -48
  320. package/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.js +0 -58
  321. package/node_modules/@tootallnate/quickjs-emscripten/dist/context-asyncify.js.map +0 -1
  322. package/node_modules/@tootallnate/quickjs-emscripten/dist/context.d.ts +0 -371
  323. package/node_modules/@tootallnate/quickjs-emscripten/dist/context.js +0 -691
  324. package/node_modules/@tootallnate/quickjs-emscripten/dist/context.js.map +0 -1
  325. package/node_modules/@tootallnate/quickjs-emscripten/dist/debug.d.ts +0 -5
  326. package/node_modules/@tootallnate/quickjs-emscripten/dist/debug.js +0 -6
  327. package/node_modules/@tootallnate/quickjs-emscripten/dist/debug.js.map +0 -1
  328. package/node_modules/@tootallnate/quickjs-emscripten/dist/deferred-promise.d.ts +0 -75
  329. package/node_modules/@tootallnate/quickjs-emscripten/dist/deferred-promise.js +0 -96
  330. package/node_modules/@tootallnate/quickjs-emscripten/dist/deferred-promise.js.map +0 -1
  331. package/node_modules/@tootallnate/quickjs-emscripten/dist/emscripten-types.d.ts +0 -97
  332. package/node_modules/@tootallnate/quickjs-emscripten/dist/emscripten-types.js +0 -15
  333. package/node_modules/@tootallnate/quickjs-emscripten/dist/emscripten-types.js.map +0 -1
  334. package/node_modules/@tootallnate/quickjs-emscripten/dist/errors.d.ts +0 -28
  335. package/node_modules/@tootallnate/quickjs-emscripten/dist/errors.js +0 -58
  336. package/node_modules/@tootallnate/quickjs-emscripten/dist/errors.js.map +0 -1
  337. package/node_modules/@tootallnate/quickjs-emscripten/dist/esmHelpers.d.ts +0 -9
  338. package/node_modules/@tootallnate/quickjs-emscripten/dist/esmHelpers.js +0 -19
  339. package/node_modules/@tootallnate/quickjs-emscripten/dist/esmHelpers.js.map +0 -1
  340. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/emscripten-module.WASM_RELEASE_SYNC.d.ts +0 -5
  341. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/emscripten-module.WASM_RELEASE_SYNC.js +0 -387
  342. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/emscripten-module.WASM_RELEASE_SYNC.js.map +0 -1
  343. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/ffi.WASM_RELEASE_SYNC.d.ts +0 -67
  344. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/ffi.WASM_RELEASE_SYNC.js +0 -71
  345. package/node_modules/@tootallnate/quickjs-emscripten/dist/generated/ffi.WASM_RELEASE_SYNC.js.map +0 -1
  346. package/node_modules/@tootallnate/quickjs-emscripten/dist/index.d.ts +0 -75
  347. package/node_modules/@tootallnate/quickjs-emscripten/dist/index.js +0 -128
  348. package/node_modules/@tootallnate/quickjs-emscripten/dist/index.js.map +0 -1
  349. package/node_modules/@tootallnate/quickjs-emscripten/dist/lifetime.d.ts +0 -115
  350. package/node_modules/@tootallnate/quickjs-emscripten/dist/lifetime.js +0 -227
  351. package/node_modules/@tootallnate/quickjs-emscripten/dist/lifetime.js.map +0 -1
  352. package/node_modules/@tootallnate/quickjs-emscripten/dist/memory.d.ts +0 -18
  353. package/node_modules/@tootallnate/quickjs-emscripten/dist/memory.js +0 -41
  354. package/node_modules/@tootallnate/quickjs-emscripten/dist/memory.js.map +0 -1
  355. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-asyncify.d.ts +0 -53
  356. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-asyncify.js +0 -97
  357. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-asyncify.js.map +0 -1
  358. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-test.d.ts +0 -27
  359. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-test.js +0 -77
  360. package/node_modules/@tootallnate/quickjs-emscripten/dist/module-test.js.map +0 -1
  361. package/node_modules/@tootallnate/quickjs-emscripten/dist/module.d.ts +0 -152
  362. package/node_modules/@tootallnate/quickjs-emscripten/dist/module.js +0 -302
  363. package/node_modules/@tootallnate/quickjs-emscripten/dist/module.js.map +0 -1
  364. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime-asyncify.d.ts +0 -38
  365. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime-asyncify.js +0 -49
  366. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime-asyncify.js.map +0 -1
  367. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime.d.ts +0 -174
  368. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime.js +0 -300
  369. package/node_modules/@tootallnate/quickjs-emscripten/dist/runtime.js.map +0 -1
  370. package/node_modules/@tootallnate/quickjs-emscripten/dist/types-ffi.d.ts +0 -114
  371. package/node_modules/@tootallnate/quickjs-emscripten/dist/types-ffi.js +0 -38
  372. package/node_modules/@tootallnate/quickjs-emscripten/dist/types-ffi.js.map +0 -1
  373. package/node_modules/@tootallnate/quickjs-emscripten/dist/types.d.ts +0 -158
  374. package/node_modules/@tootallnate/quickjs-emscripten/dist/types.js +0 -58
  375. package/node_modules/@tootallnate/quickjs-emscripten/dist/types.js.map +0 -1
  376. package/node_modules/@tootallnate/quickjs-emscripten/dist/variants.d.ts +0 -113
  377. package/node_modules/@tootallnate/quickjs-emscripten/dist/variants.js +0 -169
  378. package/node_modules/@tootallnate/quickjs-emscripten/dist/variants.js.map +0 -1
  379. package/node_modules/@tootallnate/quickjs-emscripten/dist/vm-interface.d.ts +0 -68
  380. package/node_modules/@tootallnate/quickjs-emscripten/dist/vm-interface.js +0 -12
  381. package/node_modules/@tootallnate/quickjs-emscripten/dist/vm-interface.js.map +0 -1
  382. package/node_modules/@tootallnate/quickjs-emscripten/package.json +0 -60
  383. package/node_modules/@types/mime-types/LICENSE +0 -21
  384. package/node_modules/@types/mime-types/README.md +0 -28
  385. package/node_modules/@types/mime-types/index.d.ts +0 -9
  386. package/node_modules/@types/mime-types/package.json +0 -25
  387. package/node_modules/@types/yauzl/LICENSE +0 -21
  388. package/node_modules/@types/yauzl/README.md +0 -15
  389. package/node_modules/@types/yauzl/index.d.ts +0 -110
  390. package/node_modules/@types/yauzl/package.json +0 -27
  391. package/node_modules/ansi-regex/index.d.ts +0 -33
  392. package/node_modules/ansi-regex/index.js +0 -14
  393. package/node_modules/ansi-regex/license +0 -9
  394. package/node_modules/ansi-regex/package.json +0 -61
  395. package/node_modules/ansi-regex/readme.md +0 -66
  396. package/node_modules/ansi-styles/index.d.ts +0 -345
  397. package/node_modules/ansi-styles/index.js +0 -163
  398. package/node_modules/ansi-styles/package.json +0 -56
  399. package/node_modules/ansi-styles/readme.md +0 -152
  400. package/node_modules/any-promise/.jshintrc +0 -4
  401. package/node_modules/any-promise/.npmignore +0 -7
  402. package/node_modules/any-promise/LICENSE +0 -19
  403. package/node_modules/any-promise/README.md +0 -161
  404. package/node_modules/any-promise/implementation.d.ts +0 -3
  405. package/node_modules/any-promise/implementation.js +0 -1
  406. package/node_modules/any-promise/index.d.ts +0 -73
  407. package/node_modules/any-promise/index.js +0 -1
  408. package/node_modules/any-promise/loader.js +0 -78
  409. package/node_modules/any-promise/optional.js +0 -6
  410. package/node_modules/any-promise/package.json +0 -45
  411. package/node_modules/any-promise/register/bluebird.d.ts +0 -1
  412. package/node_modules/any-promise/register/bluebird.js +0 -2
  413. package/node_modules/any-promise/register/es6-promise.d.ts +0 -1
  414. package/node_modules/any-promise/register/es6-promise.js +0 -2
  415. package/node_modules/any-promise/register/lie.d.ts +0 -1
  416. package/node_modules/any-promise/register/lie.js +0 -2
  417. package/node_modules/any-promise/register/native-promise-only.d.ts +0 -1
  418. package/node_modules/any-promise/register/native-promise-only.js +0 -2
  419. package/node_modules/any-promise/register/pinkie.d.ts +0 -1
  420. package/node_modules/any-promise/register/pinkie.js +0 -2
  421. package/node_modules/any-promise/register/promise.d.ts +0 -1
  422. package/node_modules/any-promise/register/promise.js +0 -2
  423. package/node_modules/any-promise/register/q.d.ts +0 -1
  424. package/node_modules/any-promise/register/q.js +0 -2
  425. package/node_modules/any-promise/register/rsvp.d.ts +0 -1
  426. package/node_modules/any-promise/register/rsvp.js +0 -2
  427. package/node_modules/any-promise/register/vow.d.ts +0 -1
  428. package/node_modules/any-promise/register/vow.js +0 -2
  429. package/node_modules/any-promise/register/when.d.ts +0 -1
  430. package/node_modules/any-promise/register/when.js +0 -2
  431. package/node_modules/any-promise/register-shim.js +0 -18
  432. package/node_modules/any-promise/register.d.ts +0 -17
  433. package/node_modules/any-promise/register.js +0 -94
  434. package/node_modules/ast-types/.github/dependabot.yml +0 -9
  435. package/node_modules/ast-types/.github/workflows/main.yml +0 -29
  436. package/node_modules/ast-types/LICENSE +0 -20
  437. package/node_modules/ast-types/README.md +0 -512
  438. package/node_modules/ast-types/def/babel-core.d.ts +0 -2
  439. package/node_modules/ast-types/def/babel-core.js +0 -256
  440. package/node_modules/ast-types/def/babel.d.ts +0 -2
  441. package/node_modules/ast-types/def/babel.js +0 -11
  442. package/node_modules/ast-types/def/core.d.ts +0 -2
  443. package/node_modules/ast-types/def/core.js +0 -298
  444. package/node_modules/ast-types/def/es-proposals.d.ts +0 -2
  445. package/node_modules/ast-types/def/es-proposals.js +0 -33
  446. package/node_modules/ast-types/def/es2020.d.ts +0 -2
  447. package/node_modules/ast-types/def/es2020.js +0 -16
  448. package/node_modules/ast-types/def/es6.d.ts +0 -2
  449. package/node_modules/ast-types/def/es6.js +0 -210
  450. package/node_modules/ast-types/def/es7.d.ts +0 -2
  451. package/node_modules/ast-types/def/es7.js +0 -34
  452. package/node_modules/ast-types/def/esprima.d.ts +0 -2
  453. package/node_modules/ast-types/def/esprima.js +0 -49
  454. package/node_modules/ast-types/def/flow.d.ts +0 -2
  455. package/node_modules/ast-types/def/flow.js +0 -292
  456. package/node_modules/ast-types/def/jsx.d.ts +0 -2
  457. package/node_modules/ast-types/def/jsx.js +0 -103
  458. package/node_modules/ast-types/def/type-annotations.d.ts +0 -7
  459. package/node_modules/ast-types/def/type-annotations.js +0 -40
  460. package/node_modules/ast-types/def/typescript.d.ts +0 -2
  461. package/node_modules/ast-types/def/typescript.js +0 -344
  462. package/node_modules/ast-types/fork.d.ts +0 -42
  463. package/node_modules/ast-types/fork.js +0 -52
  464. package/node_modules/ast-types/gen/builders.d.ts +0 -2584
  465. package/node_modules/ast-types/gen/builders.js +0 -2
  466. package/node_modules/ast-types/gen/kinds.d.ts +0 -264
  467. package/node_modules/ast-types/gen/kinds.js +0 -2
  468. package/node_modules/ast-types/gen/namedTypes.d.ts +0 -1809
  469. package/node_modules/ast-types/gen/namedTypes.js +0 -6
  470. package/node_modules/ast-types/gen/visitor.d.ts +0 -268
  471. package/node_modules/ast-types/gen/visitor.js +0 -2
  472. package/node_modules/ast-types/lib/equiv.d.ts +0 -5
  473. package/node_modules/ast-types/lib/equiv.js +0 -154
  474. package/node_modules/ast-types/lib/node-path.d.ts +0 -22
  475. package/node_modules/ast-types/lib/node-path.js +0 -411
  476. package/node_modules/ast-types/lib/path-visitor.d.ts +0 -52
  477. package/node_modules/ast-types/lib/path-visitor.js +0 -343
  478. package/node_modules/ast-types/lib/path.d.ts +0 -25
  479. package/node_modules/ast-types/lib/path.js +0 -331
  480. package/node_modules/ast-types/lib/scope.d.ts +0 -26
  481. package/node_modules/ast-types/lib/scope.js +0 -318
  482. package/node_modules/ast-types/lib/shared.d.ts +0 -13
  483. package/node_modules/ast-types/lib/shared.js +0 -47
  484. package/node_modules/ast-types/lib/types.d.ts +0 -136
  485. package/node_modules/ast-types/lib/types.js +0 -780
  486. package/node_modules/ast-types/main.d.ts +0 -28
  487. package/node_modules/ast-types/main.js +0 -53
  488. package/node_modules/ast-types/package.json +0 -65
  489. package/node_modules/ast-types/tsconfig.json +0 -21
  490. package/node_modules/ast-types/types.d.ts +0 -6
  491. package/node_modules/ast-types/types.js +0 -2
  492. package/node_modules/basic-ftp/LICENSE.txt +0 -19
  493. package/node_modules/basic-ftp/README.md +0 -244
  494. package/node_modules/basic-ftp/dist/Client.d.ts +0 -340
  495. package/node_modules/basic-ftp/dist/Client.js +0 -785
  496. package/node_modules/basic-ftp/dist/FileInfo.d.ts +0 -80
  497. package/node_modules/basic-ftp/dist/FileInfo.js +0 -92
  498. package/node_modules/basic-ftp/dist/FtpContext.d.ts +0 -175
  499. package/node_modules/basic-ftp/dist/FtpContext.js +0 -375
  500. package/node_modules/basic-ftp/dist/ProgressTracker.d.ts +0 -45
  501. package/node_modules/basic-ftp/dist/ProgressTracker.js +0 -72
  502. package/node_modules/basic-ftp/dist/StringEncoding.d.ts +0 -1
  503. package/node_modules/basic-ftp/dist/StringEncoding.js +0 -2
  504. package/node_modules/basic-ftp/dist/StringWriter.d.ts +0 -10
  505. package/node_modules/basic-ftp/dist/StringWriter.js +0 -29
  506. package/node_modules/basic-ftp/dist/index.d.ts +0 -9
  507. package/node_modules/basic-ftp/dist/index.js +0 -28
  508. package/node_modules/basic-ftp/dist/netUtils.d.ts +0 -21
  509. package/node_modules/basic-ftp/dist/netUtils.js +0 -66
  510. package/node_modules/basic-ftp/dist/parseControlResponse.d.ts +0 -22
  511. package/node_modules/basic-ftp/dist/parseControlResponse.js +0 -66
  512. package/node_modules/basic-ftp/dist/parseList.d.ts +0 -5
  513. package/node_modules/basic-ftp/dist/parseList.js +0 -79
  514. package/node_modules/basic-ftp/dist/parseListDOS.d.ts +0 -12
  515. package/node_modules/basic-ftp/dist/parseListDOS.js +0 -52
  516. package/node_modules/basic-ftp/dist/parseListMLSD.d.ts +0 -20
  517. package/node_modules/basic-ftp/dist/parseListMLSD.js +0 -187
  518. package/node_modules/basic-ftp/dist/parseListUnix.d.ts +0 -12
  519. package/node_modules/basic-ftp/dist/parseListUnix.js +0 -155
  520. package/node_modules/basic-ftp/dist/transfer.d.ts +0 -39
  521. package/node_modules/basic-ftp/dist/transfer.js +0 -318
  522. package/node_modules/basic-ftp/package.json +0 -52
  523. package/node_modules/buffer-crc32/LICENSE +0 -19
  524. package/node_modules/buffer-crc32/README.md +0 -47
  525. package/node_modules/buffer-crc32/index.js +0 -111
  526. package/node_modules/buffer-crc32/package.json +0 -39
  527. package/node_modules/cli-highlight/LICENSE.txt +0 -15
  528. package/node_modules/cli-highlight/README.md +0 -88
  529. package/node_modules/cli-highlight/bin/highlight +0 -2
  530. package/node_modules/cli-highlight/dist/cli.d.ts +0 -1
  531. package/node_modules/cli-highlight/dist/cli.js +0 -102
  532. package/node_modules/cli-highlight/dist/cli.js.map +0 -1
  533. package/node_modules/cli-highlight/dist/index.d.ts +0 -53
  534. package/node_modules/cli-highlight/dist/index.js +0 -112
  535. package/node_modules/cli-highlight/dist/index.js.map +0 -1
  536. package/node_modules/cli-highlight/dist/test/test.d.ts +0 -1
  537. package/node_modules/cli-highlight/dist/test/test.js +0 -62
  538. package/node_modules/cli-highlight/dist/test/test.js.map +0 -1
  539. package/node_modules/cli-highlight/dist/theme.d.ts +0 -270
  540. package/node_modules/cli-highlight/dist/theme.js +0 -265
  541. package/node_modules/cli-highlight/dist/theme.js.map +0 -1
  542. package/node_modules/cli-highlight/node_modules/chalk/index.d.ts +0 -415
  543. package/node_modules/cli-highlight/node_modules/chalk/package.json +0 -68
  544. package/node_modules/cli-highlight/node_modules/chalk/readme.md +0 -341
  545. package/node_modules/cli-highlight/node_modules/chalk/source/index.js +0 -229
  546. package/node_modules/cli-highlight/node_modules/chalk/source/templates.js +0 -134
  547. package/node_modules/cli-highlight/node_modules/chalk/source/util.js +0 -39
  548. package/node_modules/cli-highlight/package.json +0 -129
  549. package/node_modules/cliui/LICENSE.txt +0 -14
  550. package/node_modules/cliui/README.md +0 -141
  551. package/node_modules/cliui/build/index.cjs +0 -302
  552. package/node_modules/cliui/build/lib/index.js +0 -287
  553. package/node_modules/cliui/build/lib/string-utils.js +0 -27
  554. package/node_modules/cliui/index.mjs +0 -13
  555. package/node_modules/cliui/node_modules/ansi-regex/index.d.ts +0 -37
  556. package/node_modules/cliui/node_modules/ansi-regex/index.js +0 -10
  557. package/node_modules/cliui/node_modules/ansi-regex/license +0 -9
  558. package/node_modules/cliui/node_modules/ansi-regex/package.json +0 -55
  559. package/node_modules/cliui/node_modules/ansi-regex/readme.md +0 -78
  560. package/node_modules/cliui/node_modules/strip-ansi/index.d.ts +0 -17
  561. package/node_modules/cliui/node_modules/strip-ansi/index.js +0 -4
  562. package/node_modules/cliui/node_modules/strip-ansi/license +0 -9
  563. package/node_modules/cliui/node_modules/strip-ansi/package.json +0 -54
  564. package/node_modules/cliui/node_modules/strip-ansi/readme.md +0 -46
  565. package/node_modules/cliui/package.json +0 -83
  566. package/node_modules/color-convert/LICENSE +0 -21
  567. package/node_modules/color-convert/README.md +0 -68
  568. package/node_modules/color-convert/conversions.js +0 -839
  569. package/node_modules/color-convert/index.js +0 -81
  570. package/node_modules/color-convert/package.json +0 -48
  571. package/node_modules/color-convert/route.js +0 -97
  572. package/node_modules/color-name/LICENSE +0 -8
  573. package/node_modules/color-name/README.md +0 -11
  574. package/node_modules/color-name/index.js +0 -152
  575. package/node_modules/color-name/package.json +0 -28
  576. package/node_modules/degenerator/README.md +0 -117
  577. package/node_modules/degenerator/dist/compile.d.ts +0 -11
  578. package/node_modules/degenerator/dist/compile.d.ts.map +0 -1
  579. package/node_modules/degenerator/dist/compile.js +0 -107
  580. package/node_modules/degenerator/dist/compile.js.map +0 -1
  581. package/node_modules/degenerator/dist/degenerator.d.ts +0 -12
  582. package/node_modules/degenerator/dist/degenerator.d.ts.map +0 -1
  583. package/node_modules/degenerator/dist/degenerator.js +0 -156
  584. package/node_modules/degenerator/dist/degenerator.js.map +0 -1
  585. package/node_modules/degenerator/dist/index.d.ts +0 -3
  586. package/node_modules/degenerator/dist/index.d.ts.map +0 -1
  587. package/node_modules/degenerator/dist/index.js +0 -19
  588. package/node_modules/degenerator/dist/index.js.map +0 -1
  589. package/node_modules/degenerator/package.json +0 -42
  590. package/node_modules/emoji-regex/LICENSE-MIT.txt +0 -20
  591. package/node_modules/emoji-regex/README.md +0 -73
  592. package/node_modules/emoji-regex/es2015/index.js +0 -6
  593. package/node_modules/emoji-regex/es2015/text.js +0 -6
  594. package/node_modules/emoji-regex/index.d.ts +0 -23
  595. package/node_modules/emoji-regex/index.js +0 -6
  596. package/node_modules/emoji-regex/package.json +0 -50
  597. package/node_modules/emoji-regex/text.js +0 -6
  598. package/node_modules/end-of-stream/LICENSE +0 -21
  599. package/node_modules/end-of-stream/README.md +0 -54
  600. package/node_modules/end-of-stream/index.js +0 -96
  601. package/node_modules/end-of-stream/package.json +0 -37
  602. package/node_modules/escalade/dist/index.js +0 -22
  603. package/node_modules/escalade/dist/index.mjs +0 -22
  604. package/node_modules/escalade/index.d.mts +0 -11
  605. package/node_modules/escalade/index.d.ts +0 -15
  606. package/node_modules/escalade/license +0 -9
  607. package/node_modules/escalade/package.json +0 -74
  608. package/node_modules/escalade/readme.md +0 -211
  609. package/node_modules/escalade/sync/index.d.mts +0 -9
  610. package/node_modules/escalade/sync/index.d.ts +0 -13
  611. package/node_modules/escalade/sync/index.js +0 -18
  612. package/node_modules/escalade/sync/index.mjs +0 -18
  613. package/node_modules/escodegen/LICENSE.BSD +0 -21
  614. package/node_modules/escodegen/README.md +0 -84
  615. package/node_modules/escodegen/bin/escodegen.js +0 -77
  616. package/node_modules/escodegen/bin/esgenerate.js +0 -64
  617. package/node_modules/escodegen/escodegen.js +0 -2667
  618. package/node_modules/escodegen/package.json +0 -63
  619. package/node_modules/esprima/LICENSE.BSD +0 -21
  620. package/node_modules/esprima/README.md +0 -46
  621. package/node_modules/esprima/bin/esparse.js +0 -139
  622. package/node_modules/esprima/bin/esvalidate.js +0 -236
  623. package/node_modules/esprima/dist/esprima.js +0 -6709
  624. package/node_modules/esprima/package.json +0 -112
  625. package/node_modules/estraverse/.jshintrc +0 -16
  626. package/node_modules/estraverse/LICENSE.BSD +0 -19
  627. package/node_modules/estraverse/README.md +0 -153
  628. package/node_modules/estraverse/estraverse.js +0 -805
  629. package/node_modules/estraverse/gulpfile.js +0 -70
  630. package/node_modules/estraverse/package.json +0 -40
  631. package/node_modules/esutils/LICENSE.BSD +0 -19
  632. package/node_modules/esutils/README.md +0 -174
  633. package/node_modules/esutils/lib/ast.js +0 -144
  634. package/node_modules/esutils/lib/code.js +0 -135
  635. package/node_modules/esutils/lib/keyword.js +0 -165
  636. package/node_modules/esutils/lib/utils.js +0 -33
  637. package/node_modules/esutils/package.json +0 -44
  638. package/node_modules/extract-zip/LICENSE +0 -23
  639. package/node_modules/extract-zip/cli.js +0 -19
  640. package/node_modules/extract-zip/index.d.ts +0 -21
  641. package/node_modules/extract-zip/index.js +0 -173
  642. package/node_modules/extract-zip/package.json +0 -80
  643. package/node_modules/extract-zip/readme.md +0 -57
  644. package/node_modules/fd-slicer/.npmignore +0 -2
  645. package/node_modules/fd-slicer/.travis.yml +0 -7
  646. package/node_modules/fd-slicer/CHANGELOG.md +0 -49
  647. package/node_modules/fd-slicer/LICENSE +0 -21
  648. package/node_modules/fd-slicer/README.md +0 -199
  649. package/node_modules/fd-slicer/index.js +0 -296
  650. package/node_modules/fd-slicer/package.json +0 -36
  651. package/node_modules/fd-slicer/test/test.js +0 -350
  652. package/node_modules/file-type/core.d.ts +0 -253
  653. package/node_modules/file-type/core.js +0 -2899
  654. package/node_modules/file-type/index.d.ts +0 -98
  655. package/node_modules/file-type/index.js +0 -163
  656. package/node_modules/file-type/license +0 -9
  657. package/node_modules/file-type/package.json +0 -290
  658. package/node_modules/file-type/readme.md +0 -667
  659. package/node_modules/file-type/supported.js +0 -360
  660. package/node_modules/file-type/util.js +0 -60
  661. package/node_modules/get-caller-file/LICENSE.md +0 -6
  662. package/node_modules/get-caller-file/README.md +0 -41
  663. package/node_modules/get-caller-file/index.d.ts +0 -2
  664. package/node_modules/get-caller-file/index.js +0 -22
  665. package/node_modules/get-caller-file/index.js.map +0 -1
  666. package/node_modules/get-caller-file/package.json +0 -42
  667. package/node_modules/get-stream/buffer-stream.js +0 -52
  668. package/node_modules/get-stream/index.d.ts +0 -108
  669. package/node_modules/get-stream/index.js +0 -60
  670. package/node_modules/get-stream/license +0 -9
  671. package/node_modules/get-stream/package.json +0 -50
  672. package/node_modules/get-stream/readme.md +0 -124
  673. package/node_modules/get-uri/LICENSE +0 -22
  674. package/node_modules/get-uri/README.md +0 -109
  675. package/node_modules/get-uri/dist/data.d.ts +0 -16
  676. package/node_modules/get-uri/dist/data.js +0 -43
  677. package/node_modules/get-uri/dist/data.js.map +0 -1
  678. package/node_modules/get-uri/dist/file.d.ts +0 -17
  679. package/node_modules/get-uri/dist/file.js +0 -57
  680. package/node_modules/get-uri/dist/file.js.map +0 -1
  681. package/node_modules/get-uri/dist/ftp.d.ts +0 -14
  682. package/node_modules/get-uri/dist/ftp.js +0 -93
  683. package/node_modules/get-uri/dist/ftp.js.map +0 -1
  684. package/node_modules/get-uri/dist/http-error.d.ts +0 -8
  685. package/node_modules/get-uri/dist/http-error.js +0 -15
  686. package/node_modules/get-uri/dist/http-error.js.map +0 -1
  687. package/node_modules/get-uri/dist/http.d.ts +0 -29
  688. package/node_modules/get-uri/dist/http.js +0 -191
  689. package/node_modules/get-uri/dist/http.js.map +0 -1
  690. package/node_modules/get-uri/dist/https.d.ts +0 -6
  691. package/node_modules/get-uri/dist/https.js +0 -16
  692. package/node_modules/get-uri/dist/https.js.map +0 -1
  693. package/node_modules/get-uri/dist/index.d.ts +0 -37
  694. package/node_modules/get-uri/dist/index.js +0 -57
  695. package/node_modules/get-uri/dist/index.js.map +0 -1
  696. package/node_modules/get-uri/dist/notfound.d.ts +0 -10
  697. package/node_modules/get-uri/dist/notfound.js +0 -16
  698. package/node_modules/get-uri/dist/notfound.js.map +0 -1
  699. package/node_modules/get-uri/dist/notmodified.d.ts +0 -10
  700. package/node_modules/get-uri/dist/notmodified.js +0 -17
  701. package/node_modules/get-uri/dist/notmodified.js.map +0 -1
  702. package/node_modules/get-uri/node_modules/data-uri-to-buffer/LICENSE +0 -22
  703. package/node_modules/get-uri/node_modules/data-uri-to-buffer/README.md +0 -61
  704. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.d.ts +0 -17
  705. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.d.ts.map +0 -1
  706. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.js +0 -54
  707. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/common.js.map +0 -1
  708. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.d.ts +0 -8
  709. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.d.ts.map +0 -1
  710. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.js +0 -48
  711. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/index.js.map +0 -1
  712. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.d.ts +0 -8
  713. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.d.ts.map +0 -1
  714. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.js +0 -26
  715. package/node_modules/get-uri/node_modules/data-uri-to-buffer/dist/node.js.map +0 -1
  716. package/node_modules/get-uri/node_modules/data-uri-to-buffer/package.json +0 -48
  717. package/node_modules/get-uri/package.json +0 -58
  718. package/node_modules/has-flag/index.d.ts +0 -39
  719. package/node_modules/has-flag/index.js +0 -8
  720. package/node_modules/has-flag/license +0 -9
  721. package/node_modules/has-flag/package.json +0 -46
  722. package/node_modules/has-flag/readme.md +0 -89
  723. package/node_modules/ieee754/LICENSE +0 -11
  724. package/node_modules/ieee754/README.md +0 -51
  725. package/node_modules/ieee754/index.d.ts +0 -10
  726. package/node_modules/ieee754/index.js +0 -85
  727. package/node_modules/ieee754/package.json +0 -52
  728. package/node_modules/ip-address/LICENSE +0 -19
  729. package/node_modules/ip-address/README.md +0 -278
  730. package/node_modules/ip-address/dist/address-error.d.ts +0 -4
  731. package/node_modules/ip-address/dist/address-error.js +0 -12
  732. package/node_modules/ip-address/dist/address-error.js.map +0 -1
  733. package/node_modules/ip-address/dist/common.d.ts +0 -20
  734. package/node_modules/ip-address/dist/common.js +0 -67
  735. package/node_modules/ip-address/dist/common.js.map +0 -1
  736. package/node_modules/ip-address/dist/ip-address.d.ts +0 -7
  737. package/node_modules/ip-address/dist/ip-address.js +0 -35
  738. package/node_modules/ip-address/dist/ip-address.js.map +0 -1
  739. package/node_modules/ip-address/dist/ipv4.d.ts +0 -267
  740. package/node_modules/ip-address/dist/ipv4.js +0 -485
  741. package/node_modules/ip-address/dist/ipv4.js.map +0 -1
  742. package/node_modules/ip-address/dist/ipv6.d.ts +0 -489
  743. package/node_modules/ip-address/dist/ipv6.js +0 -1217
  744. package/node_modules/ip-address/dist/ipv6.js.map +0 -1
  745. package/node_modules/ip-address/dist/v4/constants.d.ts +0 -4
  746. package/node_modules/ip-address/dist/v4/constants.js +0 -8
  747. package/node_modules/ip-address/dist/v4/constants.js.map +0 -1
  748. package/node_modules/ip-address/dist/v6/constants.d.ts +0 -44
  749. package/node_modules/ip-address/dist/v6/constants.js +0 -81
  750. package/node_modules/ip-address/dist/v6/constants.js.map +0 -1
  751. package/node_modules/ip-address/dist/v6/helpers.d.ts +0 -18
  752. package/node_modules/ip-address/dist/v6/helpers.js +0 -54
  753. package/node_modules/ip-address/dist/v6/helpers.js.map +0 -1
  754. package/node_modules/ip-address/dist/v6/regular-expressions.d.ts +0 -5
  755. package/node_modules/ip-address/dist/v6/regular-expressions.js +0 -95
  756. package/node_modules/ip-address/dist/v6/regular-expressions.js.map +0 -1
  757. package/node_modules/ip-address/package.json +0 -88
  758. package/node_modules/is-fullwidth-code-point/index.d.ts +0 -17
  759. package/node_modules/is-fullwidth-code-point/index.js +0 -50
  760. package/node_modules/is-fullwidth-code-point/license +0 -9
  761. package/node_modules/is-fullwidth-code-point/package.json +0 -42
  762. package/node_modules/is-fullwidth-code-point/readme.md +0 -39
  763. package/node_modules/mime-db/HISTORY.md +0 -541
  764. package/node_modules/mime-db/LICENSE +0 -23
  765. package/node_modules/mime-db/README.md +0 -109
  766. package/node_modules/mime-db/db.json +0 -9342
  767. package/node_modules/mime-db/index.js +0 -12
  768. package/node_modules/mime-db/package.json +0 -56
  769. package/node_modules/mime-types/HISTORY.md +0 -428
  770. package/node_modules/mime-types/LICENSE +0 -23
  771. package/node_modules/mime-types/README.md +0 -126
  772. package/node_modules/mime-types/index.js +0 -211
  773. package/node_modules/mime-types/mimeScore.js +0 -57
  774. package/node_modules/mime-types/package.json +0 -49
  775. package/node_modules/mz/LICENSE +0 -22
  776. package/node_modules/mz/README.md +0 -106
  777. package/node_modules/mz/child_process.js +0 -8
  778. package/node_modules/mz/crypto.js +0 -9
  779. package/node_modules/mz/dns.js +0 -16
  780. package/node_modules/mz/fs.js +0 -62
  781. package/node_modules/mz/index.js +0 -8
  782. package/node_modules/mz/package.json +0 -44
  783. package/node_modules/mz/readline.js +0 -64
  784. package/node_modules/mz/zlib.js +0 -13
  785. package/node_modules/netmask/CHANGELOG.md +0 -66
  786. package/node_modules/netmask/LICENSE.md +0 -21
  787. package/node_modules/netmask/README.md +0 -112
  788. package/node_modules/netmask/dist/netmask.d.ts +0 -21
  789. package/node_modules/netmask/dist/netmask.js +0 -68
  790. package/node_modules/netmask/dist/netmask4.d.ts +0 -20
  791. package/node_modules/netmask/dist/netmask4.js +0 -189
  792. package/node_modules/netmask/dist/netmask6.d.ts +0 -20
  793. package/node_modules/netmask/dist/netmask6.js +0 -187
  794. package/node_modules/netmask/package.json +0 -45
  795. package/node_modules/object-assign/index.js +0 -90
  796. package/node_modules/object-assign/license +0 -21
  797. package/node_modules/object-assign/package.json +0 -42
  798. package/node_modules/object-assign/readme.md +0 -61
  799. package/node_modules/once/README.md +0 -79
  800. package/node_modules/once/once.js +0 -42
  801. package/node_modules/once/package.json +0 -33
  802. package/node_modules/pac-proxy-agent/LICENSE +0 -22
  803. package/node_modules/pac-proxy-agent/README.md +0 -27
  804. package/node_modules/pac-proxy-agent/dist/index.d.ts +0 -60
  805. package/node_modules/pac-proxy-agent/dist/index.d.ts.map +0 -1
  806. package/node_modules/pac-proxy-agent/dist/index.js +0 -238
  807. package/node_modules/pac-proxy-agent/dist/index.js.map +0 -1
  808. package/node_modules/pac-proxy-agent/package.json +0 -58
  809. package/node_modules/pac-resolver/LICENSE +0 -22
  810. package/node_modules/pac-resolver/README.md +0 -59
  811. package/node_modules/pac-resolver/dist/dateRange.d.ts +0 -67
  812. package/node_modules/pac-resolver/dist/dateRange.d.ts.map +0 -1
  813. package/node_modules/pac-resolver/dist/dateRange.js +0 -73
  814. package/node_modules/pac-resolver/dist/dateRange.js.map +0 -1
  815. package/node_modules/pac-resolver/dist/dnsDomainIs.d.ts +0 -23
  816. package/node_modules/pac-resolver/dist/dnsDomainIs.d.ts.map +0 -1
  817. package/node_modules/pac-resolver/dist/dnsDomainIs.js +0 -30
  818. package/node_modules/pac-resolver/dist/dnsDomainIs.js.map +0 -1
  819. package/node_modules/pac-resolver/dist/dnsDomainLevels.d.ts +0 -18
  820. package/node_modules/pac-resolver/dist/dnsDomainLevels.d.ts.map +0 -1
  821. package/node_modules/pac-resolver/dist/dnsDomainLevels.js +0 -28
  822. package/node_modules/pac-resolver/dist/dnsDomainLevels.js.map +0 -1
  823. package/node_modules/pac-resolver/dist/dnsResolve.d.ts +0 -16
  824. package/node_modules/pac-resolver/dist/dnsResolve.d.ts.map +0 -1
  825. package/node_modules/pac-resolver/dist/dnsResolve.js +0 -32
  826. package/node_modules/pac-resolver/dist/dnsResolve.js.map +0 -1
  827. package/node_modules/pac-resolver/dist/index.d.ts +0 -50
  828. package/node_modules/pac-resolver/dist/index.d.ts.map +0 -1
  829. package/node_modules/pac-resolver/dist/index.js +0 -87
  830. package/node_modules/pac-resolver/dist/index.js.map +0 -1
  831. package/node_modules/pac-resolver/dist/ip.d.ts +0 -8
  832. package/node_modules/pac-resolver/dist/ip.d.ts.map +0 -1
  833. package/node_modules/pac-resolver/dist/ip.js +0 -50
  834. package/node_modules/pac-resolver/dist/ip.js.map +0 -1
  835. package/node_modules/pac-resolver/dist/isInNet.d.ts +0 -24
  836. package/node_modules/pac-resolver/dist/isInNet.d.ts.map +0 -1
  837. package/node_modules/pac-resolver/dist/isInNet.js +0 -42
  838. package/node_modules/pac-resolver/dist/isInNet.js.map +0 -1
  839. package/node_modules/pac-resolver/dist/isPlainHostName.d.ts +0 -18
  840. package/node_modules/pac-resolver/dist/isPlainHostName.d.ts.map +0 -1
  841. package/node_modules/pac-resolver/dist/isPlainHostName.js +0 -23
  842. package/node_modules/pac-resolver/dist/isPlainHostName.js.map +0 -1
  843. package/node_modules/pac-resolver/dist/isResolvable.d.ts +0 -8
  844. package/node_modules/pac-resolver/dist/isResolvable.d.ts.map +0 -1
  845. package/node_modules/pac-resolver/dist/isResolvable.js +0 -23
  846. package/node_modules/pac-resolver/dist/isResolvable.js.map +0 -1
  847. package/node_modules/pac-resolver/dist/localHostOrDomainIs.d.ts +0 -26
  848. package/node_modules/pac-resolver/dist/localHostOrDomainIs.d.ts.map +0 -1
  849. package/node_modules/pac-resolver/dist/localHostOrDomainIs.js +0 -40
  850. package/node_modules/pac-resolver/dist/localHostOrDomainIs.js.map +0 -1
  851. package/node_modules/pac-resolver/dist/myIpAddress.d.ts +0 -16
  852. package/node_modules/pac-resolver/dist/myIpAddress.d.ts.map +0 -1
  853. package/node_modules/pac-resolver/dist/myIpAddress.js +0 -50
  854. package/node_modules/pac-resolver/dist/myIpAddress.js.map +0 -1
  855. package/node_modules/pac-resolver/dist/shExpMatch.d.ts +0 -23
  856. package/node_modules/pac-resolver/dist/shExpMatch.d.ts.map +0 -1
  857. package/node_modules/pac-resolver/dist/shExpMatch.js +0 -41
  858. package/node_modules/pac-resolver/dist/shExpMatch.js.map +0 -1
  859. package/node_modules/pac-resolver/dist/timeRange.d.ts +0 -43
  860. package/node_modules/pac-resolver/dist/timeRange.d.ts.map +0 -1
  861. package/node_modules/pac-resolver/dist/timeRange.js +0 -92
  862. package/node_modules/pac-resolver/dist/timeRange.js.map +0 -1
  863. package/node_modules/pac-resolver/dist/util.d.ts +0 -6
  864. package/node_modules/pac-resolver/dist/util.d.ts.map +0 -1
  865. package/node_modules/pac-resolver/dist/util.js +0 -22
  866. package/node_modules/pac-resolver/dist/util.js.map +0 -1
  867. package/node_modules/pac-resolver/dist/weekdayRange.d.ts +0 -45
  868. package/node_modules/pac-resolver/dist/weekdayRange.d.ts.map +0 -1
  869. package/node_modules/pac-resolver/dist/weekdayRange.js +0 -91
  870. package/node_modules/pac-resolver/dist/weekdayRange.js.map +0 -1
  871. package/node_modules/pac-resolver/package.json +0 -47
  872. package/node_modules/parse5/LICENSE +0 -19
  873. package/node_modules/parse5/README.md +0 -38
  874. package/node_modules/parse5/lib/common/doctype.js +0 -162
  875. package/node_modules/parse5/lib/common/error-codes.js +0 -65
  876. package/node_modules/parse5/lib/common/foreign-content.js +0 -265
  877. package/node_modules/parse5/lib/common/html.js +0 -272
  878. package/node_modules/parse5/lib/common/unicode.js +0 -109
  879. package/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +0 -43
  880. package/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +0 -52
  881. package/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  882. package/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  883. package/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  884. package/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +0 -222
  885. package/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  886. package/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  887. package/node_modules/parse5/lib/index.js +0 -29
  888. package/node_modules/parse5/lib/parser/formatting-element-list.js +0 -181
  889. package/node_modules/parse5/lib/parser/index.js +0 -2956
  890. package/node_modules/parse5/lib/parser/open-element-stack.js +0 -482
  891. package/node_modules/parse5/lib/serializer/index.js +0 -176
  892. package/node_modules/parse5/lib/tokenizer/index.js +0 -2196
  893. package/node_modules/parse5/lib/tokenizer/named-entity-data.js +0 -5
  894. package/node_modules/parse5/lib/tokenizer/preprocessor.js +0 -159
  895. package/node_modules/parse5/lib/tree-adapters/default.js +0 -217
  896. package/node_modules/parse5/lib/utils/merge-options.js +0 -13
  897. package/node_modules/parse5/lib/utils/mixin.js +0 -39
  898. package/node_modules/parse5/package.json +0 -35
  899. package/node_modules/parse5-htmlparser2-tree-adapter/LICENSE +0 -19
  900. package/node_modules/parse5-htmlparser2-tree-adapter/README.md +0 -34
  901. package/node_modules/parse5-htmlparser2-tree-adapter/lib/index.js +0 -348
  902. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/LICENSE +0 -19
  903. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/README.md +0 -38
  904. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/doctype.js +0 -162
  905. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/error-codes.js +0 -65
  906. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/foreign-content.js +0 -265
  907. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/html.js +0 -272
  908. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/common/unicode.js +0 -109
  909. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/mixin-base.js +0 -43
  910. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/parser-mixin.js +0 -52
  911. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/preprocessor-mixin.js +0 -24
  912. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/error-reporting/tokenizer-mixin.js +0 -17
  913. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/open-element-stack-mixin.js +0 -35
  914. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/parser-mixin.js +0 -223
  915. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/location-info/tokenizer-mixin.js +0 -146
  916. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/extensions/position-tracking/preprocessor-mixin.js +0 -64
  917. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/index.js +0 -29
  918. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/formatting-element-list.js +0 -181
  919. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/index.js +0 -2956
  920. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/parser/open-element-stack.js +0 -482
  921. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/serializer/index.js +0 -176
  922. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/index.js +0 -2196
  923. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/named-entity-data.js +0 -5
  924. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tokenizer/preprocessor.js +0 -159
  925. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/tree-adapters/default.js +0 -221
  926. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/utils/merge-options.js +0 -13
  927. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/lib/utils/mixin.js +0 -39
  928. package/node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/package.json +0 -35
  929. package/node_modules/parse5-htmlparser2-tree-adapter/package.json +0 -27
  930. package/node_modules/pend/LICENSE +0 -23
  931. package/node_modules/pend/README.md +0 -41
  932. package/node_modules/pend/index.js +0 -55
  933. package/node_modules/pend/package.json +0 -18
  934. package/node_modules/pend/test.js +0 -137
  935. package/node_modules/proxy-agent/LICENSE +0 -22
  936. package/node_modules/proxy-agent/README.md +0 -59
  937. package/node_modules/proxy-agent/dist/index.d.ts +0 -62
  938. package/node_modules/proxy-agent/dist/index.d.ts.map +0 -1
  939. package/node_modules/proxy-agent/dist/index.js +0 -138
  940. package/node_modules/proxy-agent/dist/index.js.map +0 -1
  941. package/node_modules/proxy-agent/node_modules/lru-cache/LICENSE +0 -15
  942. package/node_modules/proxy-agent/node_modules/lru-cache/README.md +0 -1117
  943. package/node_modules/proxy-agent/node_modules/lru-cache/index.d.ts +0 -869
  944. package/node_modules/proxy-agent/node_modules/lru-cache/index.js +0 -1227
  945. package/node_modules/proxy-agent/node_modules/lru-cache/index.mjs +0 -1227
  946. package/node_modules/proxy-agent/node_modules/lru-cache/package.json +0 -96
  947. package/node_modules/proxy-agent/package.json +0 -60
  948. package/node_modules/proxy-from-env/.eslintrc +0 -29
  949. package/node_modules/proxy-from-env/.travis.yml +0 -10
  950. package/node_modules/proxy-from-env/LICENSE +0 -20
  951. package/node_modules/proxy-from-env/README.md +0 -131
  952. package/node_modules/proxy-from-env/index.js +0 -108
  953. package/node_modules/proxy-from-env/package.json +0 -34
  954. package/node_modules/proxy-from-env/test.js +0 -483
  955. package/node_modules/pump/.github/FUNDING.yml +0 -2
  956. package/node_modules/pump/.travis.yml +0 -5
  957. package/node_modules/pump/LICENSE +0 -21
  958. package/node_modules/pump/README.md +0 -74
  959. package/node_modules/pump/SECURITY.md +0 -5
  960. package/node_modules/pump/empty.js +0 -1
  961. package/node_modules/pump/index.js +0 -86
  962. package/node_modules/pump/package.json +0 -30
  963. package/node_modules/pump/test-browser.js +0 -66
  964. package/node_modules/pump/test-node.js +0 -53
  965. package/node_modules/require-directory/.jshintrc +0 -67
  966. package/node_modules/require-directory/.npmignore +0 -1
  967. package/node_modules/require-directory/.travis.yml +0 -3
  968. package/node_modules/require-directory/LICENSE +0 -22
  969. package/node_modules/require-directory/README.markdown +0 -184
  970. package/node_modules/require-directory/index.js +0 -86
  971. package/node_modules/require-directory/package.json +0 -40
  972. package/node_modules/smart-buffer/.prettierrc.yaml +0 -5
  973. package/node_modules/smart-buffer/.travis.yml +0 -13
  974. package/node_modules/smart-buffer/LICENSE +0 -20
  975. package/node_modules/smart-buffer/README.md +0 -633
  976. package/node_modules/smart-buffer/build/smartbuffer.js +0 -1233
  977. package/node_modules/smart-buffer/build/smartbuffer.js.map +0 -1
  978. package/node_modules/smart-buffer/build/utils.js +0 -108
  979. package/node_modules/smart-buffer/build/utils.js.map +0 -1
  980. package/node_modules/smart-buffer/docs/CHANGELOG.md +0 -70
  981. package/node_modules/smart-buffer/docs/README_v3.md +0 -367
  982. package/node_modules/smart-buffer/docs/ROADMAP.md +0 -0
  983. package/node_modules/smart-buffer/package.json +0 -79
  984. package/node_modules/smart-buffer/typings/smartbuffer.d.ts +0 -755
  985. package/node_modules/smart-buffer/typings/utils.d.ts +0 -66
  986. package/node_modules/socks/.eslintrc.cjs +0 -11
  987. package/node_modules/socks/.prettierrc.yaml +0 -7
  988. package/node_modules/socks/LICENSE +0 -20
  989. package/node_modules/socks/README.md +0 -686
  990. package/node_modules/socks/build/client/socksclient.js +0 -793
  991. package/node_modules/socks/build/client/socksclient.js.map +0 -1
  992. package/node_modules/socks/build/common/constants.js +0 -108
  993. package/node_modules/socks/build/common/constants.js.map +0 -1
  994. package/node_modules/socks/build/common/helpers.js +0 -167
  995. package/node_modules/socks/build/common/helpers.js.map +0 -1
  996. package/node_modules/socks/build/common/receivebuffer.js +0 -43
  997. package/node_modules/socks/build/common/receivebuffer.js.map +0 -1
  998. package/node_modules/socks/build/common/util.js +0 -25
  999. package/node_modules/socks/build/common/util.js.map +0 -1
  1000. package/node_modules/socks/build/index.js +0 -18
  1001. package/node_modules/socks/build/index.js.map +0 -1
  1002. package/node_modules/socks/docs/examples/index.md +0 -17
  1003. package/node_modules/socks/docs/examples/javascript/associateExample.md +0 -90
  1004. package/node_modules/socks/docs/examples/javascript/bindExample.md +0 -83
  1005. package/node_modules/socks/docs/examples/javascript/connectExample.md +0 -258
  1006. package/node_modules/socks/docs/examples/typescript/associateExample.md +0 -93
  1007. package/node_modules/socks/docs/examples/typescript/bindExample.md +0 -86
  1008. package/node_modules/socks/docs/examples/typescript/connectExample.md +0 -265
  1009. package/node_modules/socks/docs/index.md +0 -5
  1010. package/node_modules/socks/docs/migratingFromV1.md +0 -86
  1011. package/node_modules/socks/package.json +0 -58
  1012. package/node_modules/socks/typings/client/socksclient.d.ts +0 -162
  1013. package/node_modules/socks/typings/common/constants.d.ts +0 -151
  1014. package/node_modules/socks/typings/common/helpers.d.ts +0 -17
  1015. package/node_modules/socks/typings/common/receivebuffer.d.ts +0 -12
  1016. package/node_modules/socks/typings/common/util.d.ts +0 -14
  1017. package/node_modules/socks/typings/index.d.ts +0 -1
  1018. package/node_modules/socks-proxy-agent/LICENSE +0 -22
  1019. package/node_modules/socks-proxy-agent/README.md +0 -50
  1020. package/node_modules/socks-proxy-agent/dist/index.d.ts +0 -27
  1021. package/node_modules/socks-proxy-agent/dist/index.d.ts.map +0 -1
  1022. package/node_modules/socks-proxy-agent/dist/index.js +0 -195
  1023. package/node_modules/socks-proxy-agent/dist/index.js.map +0 -1
  1024. package/node_modules/socks-proxy-agent/package.json +0 -142
  1025. package/node_modules/source-map/LICENSE +0 -28
  1026. package/node_modules/source-map/README.md +0 -742
  1027. package/node_modules/source-map/dist/source-map.debug.js +0 -3234
  1028. package/node_modules/source-map/dist/source-map.js +0 -3233
  1029. package/node_modules/source-map/dist/source-map.min.js +0 -2
  1030. package/node_modules/source-map/dist/source-map.min.js.map +0 -1
  1031. package/node_modules/source-map/lib/array-set.js +0 -121
  1032. package/node_modules/source-map/lib/base64-vlq.js +0 -140
  1033. package/node_modules/source-map/lib/base64.js +0 -67
  1034. package/node_modules/source-map/lib/binary-search.js +0 -111
  1035. package/node_modules/source-map/lib/mapping-list.js +0 -79
  1036. package/node_modules/source-map/lib/quick-sort.js +0 -114
  1037. package/node_modules/source-map/lib/source-map-consumer.js +0 -1145
  1038. package/node_modules/source-map/lib/source-map-generator.js +0 -425
  1039. package/node_modules/source-map/lib/source-node.js +0 -413
  1040. package/node_modules/source-map/lib/util.js +0 -488
  1041. package/node_modules/source-map/package.json +0 -73
  1042. package/node_modules/source-map/source-map.d.ts +0 -98
  1043. package/node_modules/source-map/source-map.js +0 -8
  1044. package/node_modules/string-width/index.d.ts +0 -29
  1045. package/node_modules/string-width/index.js +0 -47
  1046. package/node_modules/string-width/license +0 -9
  1047. package/node_modules/string-width/node_modules/ansi-regex/index.d.ts +0 -37
  1048. package/node_modules/string-width/node_modules/ansi-regex/index.js +0 -10
  1049. package/node_modules/string-width/node_modules/ansi-regex/license +0 -9
  1050. package/node_modules/string-width/node_modules/ansi-regex/package.json +0 -55
  1051. package/node_modules/string-width/node_modules/ansi-regex/readme.md +0 -78
  1052. package/node_modules/string-width/node_modules/strip-ansi/index.d.ts +0 -17
  1053. package/node_modules/string-width/node_modules/strip-ansi/index.js +0 -4
  1054. package/node_modules/string-width/node_modules/strip-ansi/license +0 -9
  1055. package/node_modules/string-width/node_modules/strip-ansi/package.json +0 -54
  1056. package/node_modules/string-width/node_modules/strip-ansi/readme.md +0 -46
  1057. package/node_modules/string-width/package.json +0 -56
  1058. package/node_modules/string-width/readme.md +0 -50
  1059. package/node_modules/strip-ansi/index.d.ts +0 -15
  1060. package/node_modules/strip-ansi/index.js +0 -19
  1061. package/node_modules/strip-ansi/license +0 -9
  1062. package/node_modules/strip-ansi/package.json +0 -59
  1063. package/node_modules/strip-ansi/readme.md +0 -37
  1064. package/node_modules/strtok3/LICENSE.txt +0 -21
  1065. package/node_modules/strtok3/README.md +0 -399
  1066. package/node_modules/strtok3/lib/AbstractTokenizer.d.ts +0 -76
  1067. package/node_modules/strtok3/lib/AbstractTokenizer.js +0 -111
  1068. package/node_modules/strtok3/lib/BlobTokenizer.d.ts +0 -29
  1069. package/node_modules/strtok3/lib/BlobTokenizer.js +0 -53
  1070. package/node_modules/strtok3/lib/BufferTokenizer.d.ts +0 -29
  1071. package/node_modules/strtok3/lib/BufferTokenizer.js +0 -52
  1072. package/node_modules/strtok3/lib/FileTokenizer.d.ts +0 -37
  1073. package/node_modules/strtok3/lib/FileTokenizer.js +0 -61
  1074. package/node_modules/strtok3/lib/ReadStreamTokenizer.d.ts +0 -34
  1075. package/node_modules/strtok3/lib/ReadStreamTokenizer.js +0 -107
  1076. package/node_modules/strtok3/lib/core.d.ts +0 -40
  1077. package/node_modules/strtok3/lib/core.js +0 -62
  1078. package/node_modules/strtok3/lib/index.d.ts +0 -16
  1079. package/node_modules/strtok3/lib/index.js +0 -22
  1080. package/node_modules/strtok3/lib/stream/AbstractStreamReader.d.ts +0 -54
  1081. package/node_modules/strtok3/lib/stream/AbstractStreamReader.js +0 -71
  1082. package/node_modules/strtok3/lib/stream/Deferred.d.ts +0 -6
  1083. package/node_modules/strtok3/lib/stream/Deferred.js +0 -10
  1084. package/node_modules/strtok3/lib/stream/Errors.d.ts +0 -10
  1085. package/node_modules/strtok3/lib/stream/Errors.js +0 -16
  1086. package/node_modules/strtok3/lib/stream/StreamReader.d.ts +0 -29
  1087. package/node_modules/strtok3/lib/stream/StreamReader.js +0 -83
  1088. package/node_modules/strtok3/lib/stream/WebStreamByobReader.d.ts +0 -14
  1089. package/node_modules/strtok3/lib/stream/WebStreamByobReader.js +0 -27
  1090. package/node_modules/strtok3/lib/stream/WebStreamDefaultReader.d.ts +0 -19
  1091. package/node_modules/strtok3/lib/stream/WebStreamDefaultReader.js +0 -62
  1092. package/node_modules/strtok3/lib/stream/WebStreamReader.d.ts +0 -14
  1093. package/node_modules/strtok3/lib/stream/WebStreamReader.js +0 -13
  1094. package/node_modules/strtok3/lib/stream/WebStreamReaderFactory.d.ts +0 -5
  1095. package/node_modules/strtok3/lib/stream/WebStreamReaderFactory.js +0 -19
  1096. package/node_modules/strtok3/lib/stream/index.d.ts +0 -6
  1097. package/node_modules/strtok3/lib/stream/index.js +0 -5
  1098. package/node_modules/strtok3/lib/types.d.ts +0 -139
  1099. package/node_modules/strtok3/lib/types.js +0 -1
  1100. package/node_modules/strtok3/package.json +0 -94
  1101. package/node_modules/supports-color/browser.js +0 -5
  1102. package/node_modules/supports-color/index.js +0 -135
  1103. package/node_modules/supports-color/license +0 -9
  1104. package/node_modules/supports-color/package.json +0 -53
  1105. package/node_modules/supports-color/readme.md +0 -76
  1106. package/node_modules/thenify/LICENSE +0 -22
  1107. package/node_modules/thenify/README.md +0 -120
  1108. package/node_modules/thenify/index.js +0 -77
  1109. package/node_modules/thenify/package.json +0 -31
  1110. package/node_modules/thenify-all/LICENSE +0 -22
  1111. package/node_modules/thenify-all/README.md +0 -66
  1112. package/node_modules/thenify-all/index.js +0 -73
  1113. package/node_modules/thenify-all/package.json +0 -34
  1114. package/node_modules/token-types/LICENSE.txt +0 -9
  1115. package/node_modules/token-types/README.md +0 -120
  1116. package/node_modules/token-types/lib/index.d.ts +0 -135
  1117. package/node_modules/token-types/lib/index.js +0 -401
  1118. package/node_modules/token-types/package.json +0 -81
  1119. package/node_modules/uint8array-extras/index.d.ts +0 -331
  1120. package/node_modules/uint8array-extras/index.js +0 -318
  1121. package/node_modules/uint8array-extras/license +0 -9
  1122. package/node_modules/uint8array-extras/package.json +0 -54
  1123. package/node_modules/uint8array-extras/readme.md +0 -318
  1124. package/node_modules/uuid/LICENSE.md +0 -9
  1125. package/node_modules/uuid/README.md +0 -491
  1126. package/node_modules/uuid/dist/index.d.ts +0 -15
  1127. package/node_modules/uuid/dist/index.js +0 -14
  1128. package/node_modules/uuid/dist/max.d.ts +0 -2
  1129. package/node_modules/uuid/dist/max.js +0 -1
  1130. package/node_modules/uuid/dist/md5.d.ts +0 -2
  1131. package/node_modules/uuid/dist/md5.js +0 -135
  1132. package/node_modules/uuid/dist/nil.d.ts +0 -2
  1133. package/node_modules/uuid/dist/nil.js +0 -1
  1134. package/node_modules/uuid/dist/parse.d.ts +0 -3
  1135. package/node_modules/uuid/dist/parse.js +0 -9
  1136. package/node_modules/uuid/dist/regex.d.ts +0 -2
  1137. package/node_modules/uuid/dist/regex.js +0 -1
  1138. package/node_modules/uuid/dist/rng.d.ts +0 -1
  1139. package/node_modules/uuid/dist/rng.js +0 -4
  1140. package/node_modules/uuid/dist/sha1.d.ts +0 -2
  1141. package/node_modules/uuid/dist/sha1.js +0 -70
  1142. package/node_modules/uuid/dist/stringify.d.ts +0 -3
  1143. package/node_modules/uuid/dist/stringify.js +0 -35
  1144. package/node_modules/uuid/dist/types.d.ts +0 -22
  1145. package/node_modules/uuid/dist/types.js +0 -1
  1146. package/node_modules/uuid/dist/uuid-bin.d.ts +0 -1
  1147. package/node_modules/uuid/dist/uuid-bin.js +0 -70
  1148. package/node_modules/uuid/dist/v1.d.ts +0 -11
  1149. package/node_modules/uuid/dist/v1.js +0 -83
  1150. package/node_modules/uuid/dist/v1ToV6.d.ts +0 -3
  1151. package/node_modules/uuid/dist/v1ToV6.js +0 -10
  1152. package/node_modules/uuid/dist/v3.d.ts +0 -9
  1153. package/node_modules/uuid/dist/v3.js +0 -9
  1154. package/node_modules/uuid/dist/v35.d.ts +0 -7
  1155. package/node_modules/uuid/dist/v35.js +0 -39
  1156. package/node_modules/uuid/dist/v4.d.ts +0 -4
  1157. package/node_modules/uuid/dist/v4.js +0 -29
  1158. package/node_modules/uuid/dist/v5.d.ts +0 -9
  1159. package/node_modules/uuid/dist/v5.js +0 -9
  1160. package/node_modules/uuid/dist/v6.d.ts +0 -4
  1161. package/node_modules/uuid/dist/v6.js +0 -20
  1162. package/node_modules/uuid/dist/v6ToV1.d.ts +0 -2
  1163. package/node_modules/uuid/dist/v6ToV1.js +0 -10
  1164. package/node_modules/uuid/dist/v7.d.ts +0 -9
  1165. package/node_modules/uuid/dist/v7.js +0 -65
  1166. package/node_modules/uuid/dist/validate.d.ts +0 -2
  1167. package/node_modules/uuid/dist/validate.js +0 -5
  1168. package/node_modules/uuid/dist/version.d.ts +0 -2
  1169. package/node_modules/uuid/dist/version.js +0 -8
  1170. package/node_modules/uuid/dist-node/bin/uuid +0 -2
  1171. package/node_modules/uuid/dist-node/index.js +0 -14
  1172. package/node_modules/uuid/dist-node/max.js +0 -1
  1173. package/node_modules/uuid/dist-node/md5.js +0 -11
  1174. package/node_modules/uuid/dist-node/nil.js +0 -1
  1175. package/node_modules/uuid/dist-node/parse.js +0 -9
  1176. package/node_modules/uuid/dist-node/regex.js +0 -1
  1177. package/node_modules/uuid/dist-node/rng.js +0 -4
  1178. package/node_modules/uuid/dist-node/sha1.js +0 -11
  1179. package/node_modules/uuid/dist-node/stringify.js +0 -35
  1180. package/node_modules/uuid/dist-node/types.js +0 -1
  1181. package/node_modules/uuid/dist-node/uuid-bin.js +0 -70
  1182. package/node_modules/uuid/dist-node/v1.js +0 -83
  1183. package/node_modules/uuid/dist-node/v1ToV6.js +0 -10
  1184. package/node_modules/uuid/dist-node/v3.js +0 -9
  1185. package/node_modules/uuid/dist-node/v35.js +0 -39
  1186. package/node_modules/uuid/dist-node/v4.js +0 -29
  1187. package/node_modules/uuid/dist-node/v5.js +0 -9
  1188. package/node_modules/uuid/dist-node/v6.js +0 -20
  1189. package/node_modules/uuid/dist-node/v6ToV1.js +0 -10
  1190. package/node_modules/uuid/dist-node/v7.js +0 -65
  1191. package/node_modules/uuid/dist-node/validate.js +0 -5
  1192. package/node_modules/uuid/dist-node/version.js +0 -8
  1193. package/node_modules/uuid/package.json +0 -110
  1194. package/node_modules/wrap-ansi/index.js +0 -216
  1195. package/node_modules/wrap-ansi/license +0 -9
  1196. package/node_modules/wrap-ansi/node_modules/ansi-regex/index.d.ts +0 -37
  1197. package/node_modules/wrap-ansi/node_modules/ansi-regex/index.js +0 -10
  1198. package/node_modules/wrap-ansi/node_modules/ansi-regex/license +0 -9
  1199. package/node_modules/wrap-ansi/node_modules/ansi-regex/package.json +0 -55
  1200. package/node_modules/wrap-ansi/node_modules/ansi-regex/readme.md +0 -78
  1201. package/node_modules/wrap-ansi/node_modules/strip-ansi/index.d.ts +0 -17
  1202. package/node_modules/wrap-ansi/node_modules/strip-ansi/index.js +0 -4
  1203. package/node_modules/wrap-ansi/node_modules/strip-ansi/license +0 -9
  1204. package/node_modules/wrap-ansi/node_modules/strip-ansi/package.json +0 -54
  1205. package/node_modules/wrap-ansi/node_modules/strip-ansi/readme.md +0 -46
  1206. package/node_modules/wrap-ansi/package.json +0 -62
  1207. package/node_modules/wrap-ansi/readme.md +0 -91
  1208. package/node_modules/wrappy/README.md +0 -36
  1209. package/node_modules/wrappy/package.json +0 -29
  1210. package/node_modules/wrappy/wrappy.js +0 -33
  1211. package/node_modules/y18n/LICENSE +0 -13
  1212. package/node_modules/y18n/README.md +0 -127
  1213. package/node_modules/y18n/build/index.cjs +0 -203
  1214. package/node_modules/y18n/build/lib/cjs.js +0 -6
  1215. package/node_modules/y18n/build/lib/index.js +0 -174
  1216. package/node_modules/y18n/build/lib/platform-shims/node.js +0 -19
  1217. package/node_modules/y18n/index.mjs +0 -8
  1218. package/node_modules/y18n/package.json +0 -70
  1219. package/node_modules/yargs/LICENSE +0 -21
  1220. package/node_modules/yargs/README.md +0 -202
  1221. package/node_modules/yargs/browser.mjs +0 -7
  1222. package/node_modules/yargs/build/index.cjs +0 -2920
  1223. package/node_modules/yargs/build/lib/argsert.js +0 -62
  1224. package/node_modules/yargs/build/lib/command.js +0 -382
  1225. package/node_modules/yargs/build/lib/completion-templates.js +0 -47
  1226. package/node_modules/yargs/build/lib/completion.js +0 -128
  1227. package/node_modules/yargs/build/lib/middleware.js +0 -53
  1228. package/node_modules/yargs/build/lib/parse-command.js +0 -32
  1229. package/node_modules/yargs/build/lib/typings/common-types.js +0 -9
  1230. package/node_modules/yargs/build/lib/typings/yargs-parser-types.js +0 -1
  1231. package/node_modules/yargs/build/lib/usage.js +0 -548
  1232. package/node_modules/yargs/build/lib/utils/apply-extends.js +0 -59
  1233. package/node_modules/yargs/build/lib/utils/is-promise.js +0 -5
  1234. package/node_modules/yargs/build/lib/utils/levenshtein.js +0 -26
  1235. package/node_modules/yargs/build/lib/utils/obj-filter.js +0 -10
  1236. package/node_modules/yargs/build/lib/utils/process-argv.js +0 -17
  1237. package/node_modules/yargs/build/lib/utils/set-blocking.js +0 -12
  1238. package/node_modules/yargs/build/lib/utils/which-module.js +0 -10
  1239. package/node_modules/yargs/build/lib/validation.js +0 -308
  1240. package/node_modules/yargs/build/lib/yargs-factory.js +0 -1143
  1241. package/node_modules/yargs/build/lib/yerror.js +0 -7
  1242. package/node_modules/yargs/helpers/helpers.mjs +0 -10
  1243. package/node_modules/yargs/helpers/index.js +0 -14
  1244. package/node_modules/yargs/helpers/package.json +0 -3
  1245. package/node_modules/yargs/index.cjs +0 -39
  1246. package/node_modules/yargs/index.mjs +0 -8
  1247. package/node_modules/yargs/lib/platform-shims/browser.mjs +0 -92
  1248. package/node_modules/yargs/lib/platform-shims/esm.mjs +0 -67
  1249. package/node_modules/yargs/locales/be.json +0 -46
  1250. package/node_modules/yargs/locales/de.json +0 -46
  1251. package/node_modules/yargs/locales/en.json +0 -51
  1252. package/node_modules/yargs/locales/es.json +0 -46
  1253. package/node_modules/yargs/locales/fi.json +0 -49
  1254. package/node_modules/yargs/locales/fr.json +0 -53
  1255. package/node_modules/yargs/locales/hi.json +0 -49
  1256. package/node_modules/yargs/locales/hu.json +0 -46
  1257. package/node_modules/yargs/locales/id.json +0 -50
  1258. package/node_modules/yargs/locales/it.json +0 -46
  1259. package/node_modules/yargs/locales/ja.json +0 -51
  1260. package/node_modules/yargs/locales/ko.json +0 -49
  1261. package/node_modules/yargs/locales/nb.json +0 -44
  1262. package/node_modules/yargs/locales/nl.json +0 -49
  1263. package/node_modules/yargs/locales/nn.json +0 -44
  1264. package/node_modules/yargs/locales/pirate.json +0 -13
  1265. package/node_modules/yargs/locales/pl.json +0 -49
  1266. package/node_modules/yargs/locales/pt.json +0 -45
  1267. package/node_modules/yargs/locales/pt_BR.json +0 -48
  1268. package/node_modules/yargs/locales/ru.json +0 -46
  1269. package/node_modules/yargs/locales/th.json +0 -46
  1270. package/node_modules/yargs/locales/tr.json +0 -48
  1271. package/node_modules/yargs/locales/zh_CN.json +0 -48
  1272. package/node_modules/yargs/locales/zh_TW.json +0 -47
  1273. package/node_modules/yargs/package.json +0 -122
  1274. package/node_modules/yargs/yargs +0 -9
  1275. package/node_modules/yargs-parser/LICENSE.txt +0 -14
  1276. package/node_modules/yargs-parser/README.md +0 -518
  1277. package/node_modules/yargs-parser/browser.js +0 -29
  1278. package/node_modules/yargs-parser/build/index.cjs +0 -1042
  1279. package/node_modules/yargs-parser/build/lib/index.js +0 -59
  1280. package/node_modules/yargs-parser/build/lib/string-utils.js +0 -65
  1281. package/node_modules/yargs-parser/build/lib/tokenize-arg-string.js +0 -40
  1282. package/node_modules/yargs-parser/build/lib/yargs-parser-types.js +0 -12
  1283. package/node_modules/yargs-parser/build/lib/yargs-parser.js +0 -1037
  1284. package/node_modules/yargs-parser/package.json +0 -87
  1285. package/node_modules/yauzl/LICENSE +0 -21
  1286. package/node_modules/yauzl/README.md +0 -658
  1287. package/node_modules/yauzl/index.js +0 -796
  1288. package/node_modules/yauzl/package.json +0 -40
  1289. /package/node_modules/{once → isexe}/LICENSE +0 -0
  1290. /package/node_modules/{ansi-styles → path-key}/license +0 -0
  1291. /package/node_modules/{cli-highlight/node_modules/chalk → shebang-regex}/license +0 -0
  1292. /package/node_modules/{wrappy → which}/LICENSE +0 -0
@@ -1,2899 +0,0 @@
1
- /**
2
- Primary entry point, Node.js specific entry point is index.js
3
- */
4
-
5
- import * as Token from 'token-types';
6
- import * as strtok3 from 'strtok3/core';
7
- import {ZipHandler, GzipHandler} from '@tokenizer/inflate';
8
- import {getUintBE} from 'uint8array-extras';
9
- import {
10
- stringToBytes,
11
- tarHeaderChecksumMatches,
12
- uint32SyncSafeToken,
13
- } from './util.js';
14
- import {extensions, mimeTypes} from './supported.js';
15
-
16
- export const reasonableDetectionSizeInBytes = 4100; // A fair amount of file-types are detectable within this range.
17
- // Keep defensive limits small enough to avoid accidental memory spikes from untrusted inputs.
18
- const maximumMpegOffsetTolerance = reasonableDetectionSizeInBytes - 2;
19
- const maximumZipEntrySizeInBytes = 1024 * 1024;
20
- const maximumZipEntryCount = 1024;
21
- const maximumZipBufferedReadSizeInBytes = (2 ** 31) - 1;
22
- const maximumUntrustedSkipSizeInBytes = 16 * 1024 * 1024;
23
- const maximumUnknownSizePayloadProbeSizeInBytes = maximumZipEntrySizeInBytes;
24
- const maximumZipTextEntrySizeInBytes = maximumZipEntrySizeInBytes;
25
- const maximumNestedGzipDetectionSizeInBytes = maximumUntrustedSkipSizeInBytes;
26
- const maximumNestedGzipProbeDepth = 1;
27
- const unknownSizeGzipProbeTimeoutInMilliseconds = 100;
28
- const maximumId3HeaderSizeInBytes = maximumUntrustedSkipSizeInBytes;
29
- const maximumEbmlDocumentTypeSizeInBytes = 64;
30
- const maximumEbmlElementPayloadSizeInBytes = maximumUnknownSizePayloadProbeSizeInBytes;
31
- const maximumEbmlElementCount = 256;
32
- const maximumPngChunkCount = 512;
33
- const maximumPngStreamScanBudgetInBytes = maximumUntrustedSkipSizeInBytes;
34
- const maximumAsfHeaderObjectCount = 512;
35
- const maximumTiffTagCount = 512;
36
- const maximumDetectionReentryCount = 256;
37
- const maximumPngChunkSizeInBytes = maximumUnknownSizePayloadProbeSizeInBytes;
38
- const maximumAsfHeaderPayloadSizeInBytes = maximumUnknownSizePayloadProbeSizeInBytes;
39
- const maximumTiffStreamIfdOffsetInBytes = maximumUnknownSizePayloadProbeSizeInBytes;
40
- const maximumTiffIfdOffsetInBytes = maximumUntrustedSkipSizeInBytes;
41
- const recoverableZipErrorMessages = new Set([
42
- 'Unexpected signature',
43
- 'Encrypted ZIP',
44
- 'Expected Central-File-Header signature',
45
- ]);
46
- const recoverableZipErrorMessagePrefixes = [
47
- 'ZIP entry count exceeds ',
48
- 'Unsupported ZIP compression method:',
49
- 'ZIP entry compressed data exceeds ',
50
- 'ZIP entry decompressed data exceeds ',
51
- 'Expected data-descriptor-signature at position ',
52
- ];
53
- const recoverableZipErrorCodes = new Set([
54
- 'Z_BUF_ERROR',
55
- 'Z_DATA_ERROR',
56
- 'ERR_INVALID_STATE',
57
- ]);
58
-
59
- class ParserHardLimitError extends Error {}
60
-
61
- function patchWebByobTokenizerClose(tokenizer) {
62
- const streamReader = tokenizer?.streamReader;
63
- if (streamReader?.constructor?.name !== 'WebStreamByobReader') {
64
- return tokenizer;
65
- }
66
-
67
- const {reader} = streamReader;
68
- const cancelAndRelease = async () => {
69
- await reader.cancel();
70
- reader.releaseLock();
71
- };
72
-
73
- streamReader.close = cancelAndRelease;
74
- streamReader.abort = async () => {
75
- streamReader.interrupted = true;
76
- await cancelAndRelease();
77
- };
78
-
79
- return tokenizer;
80
- }
81
-
82
- function getSafeBound(value, maximum, reason) {
83
- if (
84
- !Number.isFinite(value)
85
- || value < 0
86
- || value > maximum
87
- ) {
88
- throw new ParserHardLimitError(`${reason} has invalid size ${value} (maximum ${maximum} bytes)`);
89
- }
90
-
91
- return value;
92
- }
93
-
94
- async function safeIgnore(tokenizer, length, {maximumLength = maximumUntrustedSkipSizeInBytes, reason = 'skip'} = {}) {
95
- const safeLength = getSafeBound(length, maximumLength, reason);
96
- await tokenizer.ignore(safeLength);
97
- }
98
-
99
- async function safeReadBuffer(tokenizer, buffer, options, {maximumLength = buffer.length, reason = 'read'} = {}) {
100
- const length = options?.length ?? buffer.length;
101
- const safeLength = getSafeBound(length, maximumLength, reason);
102
- return tokenizer.readBuffer(buffer, {
103
- ...options,
104
- length: safeLength,
105
- });
106
- }
107
-
108
- async function decompressDeflateRawWithLimit(data, {maximumLength = maximumZipEntrySizeInBytes} = {}) {
109
- const input = new ReadableStream({
110
- start(controller) {
111
- controller.enqueue(data);
112
- controller.close();
113
- },
114
- });
115
- const output = input.pipeThrough(new DecompressionStream('deflate-raw'));
116
- const reader = output.getReader();
117
- const chunks = [];
118
- let totalLength = 0;
119
-
120
- try {
121
- for (;;) {
122
- const {done, value} = await reader.read();
123
- if (done) {
124
- break;
125
- }
126
-
127
- totalLength += value.length;
128
- if (totalLength > maximumLength) {
129
- await reader.cancel();
130
- throw new Error(`ZIP entry decompressed data exceeds ${maximumLength} bytes`);
131
- }
132
-
133
- chunks.push(value);
134
- }
135
- } finally {
136
- reader.releaseLock();
137
- }
138
-
139
- const uncompressedData = new Uint8Array(totalLength);
140
- let offset = 0;
141
- for (const chunk of chunks) {
142
- uncompressedData.set(chunk, offset);
143
- offset += chunk.length;
144
- }
145
-
146
- return uncompressedData;
147
- }
148
-
149
- const zipDataDescriptorSignature = 0x08_07_4B_50;
150
- const zipDataDescriptorLengthInBytes = 16;
151
- const zipDataDescriptorOverlapLengthInBytes = zipDataDescriptorLengthInBytes - 1;
152
-
153
- function findZipDataDescriptorOffset(buffer, bytesConsumed) {
154
- if (buffer.length < zipDataDescriptorLengthInBytes) {
155
- return -1;
156
- }
157
-
158
- const lastPossibleDescriptorOffset = buffer.length - zipDataDescriptorLengthInBytes;
159
- for (let index = 0; index <= lastPossibleDescriptorOffset; index++) {
160
- if (
161
- Token.UINT32_LE.get(buffer, index) === zipDataDescriptorSignature
162
- && Token.UINT32_LE.get(buffer, index + 8) === bytesConsumed + index
163
- ) {
164
- return index;
165
- }
166
- }
167
-
168
- return -1;
169
- }
170
-
171
- function isPngAncillaryChunk(type) {
172
- return (type.codePointAt(0) & 0x20) !== 0;
173
- }
174
-
175
- function mergeByteChunks(chunks, totalLength) {
176
- const merged = new Uint8Array(totalLength);
177
- let offset = 0;
178
-
179
- for (const chunk of chunks) {
180
- merged.set(chunk, offset);
181
- offset += chunk.length;
182
- }
183
-
184
- return merged;
185
- }
186
-
187
- async function readZipDataDescriptorEntryWithLimit(zipHandler, {shouldBuffer, maximumLength = maximumZipEntrySizeInBytes} = {}) {
188
- const {syncBuffer} = zipHandler;
189
- const {length: syncBufferLength} = syncBuffer;
190
- const chunks = [];
191
- let bytesConsumed = 0;
192
-
193
- for (;;) {
194
- const length = await zipHandler.tokenizer.peekBuffer(syncBuffer, {mayBeLess: true});
195
- const dataDescriptorOffset = findZipDataDescriptorOffset(syncBuffer.subarray(0, length), bytesConsumed);
196
- const retainedLength = dataDescriptorOffset >= 0
197
- ? 0
198
- : (
199
- length === syncBufferLength
200
- ? Math.min(zipDataDescriptorOverlapLengthInBytes, length - 1)
201
- : 0
202
- );
203
- const chunkLength = dataDescriptorOffset >= 0 ? dataDescriptorOffset : length - retainedLength;
204
-
205
- if (chunkLength === 0) {
206
- break;
207
- }
208
-
209
- bytesConsumed += chunkLength;
210
- if (bytesConsumed > maximumLength) {
211
- throw new Error(`ZIP entry compressed data exceeds ${maximumLength} bytes`);
212
- }
213
-
214
- if (shouldBuffer) {
215
- const data = new Uint8Array(chunkLength);
216
- await zipHandler.tokenizer.readBuffer(data);
217
- chunks.push(data);
218
- } else {
219
- await zipHandler.tokenizer.ignore(chunkLength);
220
- }
221
-
222
- if (dataDescriptorOffset >= 0) {
223
- break;
224
- }
225
- }
226
-
227
- if (!hasUnknownFileSize(zipHandler.tokenizer)) {
228
- zipHandler.knownSizeDescriptorScannedBytes += bytesConsumed;
229
- }
230
-
231
- if (!shouldBuffer) {
232
- return;
233
- }
234
-
235
- return mergeByteChunks(chunks, bytesConsumed);
236
- }
237
-
238
- function getRemainingZipScanBudget(zipHandler, startOffset) {
239
- if (hasUnknownFileSize(zipHandler.tokenizer)) {
240
- return Math.max(0, maximumUntrustedSkipSizeInBytes - (zipHandler.tokenizer.position - startOffset));
241
- }
242
-
243
- return Math.max(0, maximumZipEntrySizeInBytes - zipHandler.knownSizeDescriptorScannedBytes);
244
- }
245
-
246
- async function readZipEntryData(zipHandler, zipHeader, {shouldBuffer, maximumDescriptorLength = maximumZipEntrySizeInBytes} = {}) {
247
- if (
248
- zipHeader.dataDescriptor
249
- && zipHeader.compressedSize === 0
250
- ) {
251
- return readZipDataDescriptorEntryWithLimit(zipHandler, {
252
- shouldBuffer,
253
- maximumLength: maximumDescriptorLength,
254
- });
255
- }
256
-
257
- if (!shouldBuffer) {
258
- await safeIgnore(zipHandler.tokenizer, zipHeader.compressedSize, {
259
- maximumLength: hasUnknownFileSize(zipHandler.tokenizer) ? maximumZipEntrySizeInBytes : zipHandler.tokenizer.fileInfo.size,
260
- reason: 'ZIP entry compressed data',
261
- });
262
- return;
263
- }
264
-
265
- const maximumLength = getMaximumZipBufferedReadLength(zipHandler.tokenizer);
266
- if (
267
- !Number.isFinite(zipHeader.compressedSize)
268
- || zipHeader.compressedSize < 0
269
- || zipHeader.compressedSize > maximumLength
270
- ) {
271
- throw new Error(`ZIP entry compressed data exceeds ${maximumLength} bytes`);
272
- }
273
-
274
- const fileData = new Uint8Array(zipHeader.compressedSize);
275
- await zipHandler.tokenizer.readBuffer(fileData);
276
- return fileData;
277
- }
278
-
279
- // Override the default inflate to enforce decompression size limits, since @tokenizer/inflate does not expose a configuration hook for this.
280
- ZipHandler.prototype.inflate = async function (zipHeader, fileData, callback) {
281
- if (zipHeader.compressedMethod === 0) {
282
- return callback(fileData);
283
- }
284
-
285
- if (zipHeader.compressedMethod !== 8) {
286
- throw new Error(`Unsupported ZIP compression method: ${zipHeader.compressedMethod}`);
287
- }
288
-
289
- const uncompressedData = await decompressDeflateRawWithLimit(fileData, {maximumLength: maximumZipEntrySizeInBytes});
290
- return callback(uncompressedData);
291
- };
292
-
293
- ZipHandler.prototype.unzip = async function (fileCallback) {
294
- let stop = false;
295
- let zipEntryCount = 0;
296
- const zipScanStart = this.tokenizer.position;
297
- this.knownSizeDescriptorScannedBytes = 0;
298
- do {
299
- if (hasExceededUnknownSizeScanBudget(this.tokenizer, zipScanStart, maximumUntrustedSkipSizeInBytes)) {
300
- throw new ParserHardLimitError(`ZIP stream probing exceeds ${maximumUntrustedSkipSizeInBytes} bytes`);
301
- }
302
-
303
- const zipHeader = await this.readLocalFileHeader();
304
- if (!zipHeader) {
305
- break;
306
- }
307
-
308
- zipEntryCount++;
309
- if (zipEntryCount > maximumZipEntryCount) {
310
- throw new Error(`ZIP entry count exceeds ${maximumZipEntryCount}`);
311
- }
312
-
313
- const next = fileCallback(zipHeader);
314
- stop = Boolean(next.stop);
315
- await this.tokenizer.ignore(zipHeader.extraFieldLength);
316
- const fileData = await readZipEntryData(this, zipHeader, {
317
- shouldBuffer: Boolean(next.handler),
318
- maximumDescriptorLength: Math.min(maximumZipEntrySizeInBytes, getRemainingZipScanBudget(this, zipScanStart)),
319
- });
320
-
321
- if (next.handler) {
322
- await this.inflate(zipHeader, fileData, next.handler);
323
- }
324
-
325
- if (zipHeader.dataDescriptor) {
326
- const dataDescriptor = new Uint8Array(zipDataDescriptorLengthInBytes);
327
- await this.tokenizer.readBuffer(dataDescriptor);
328
- if (Token.UINT32_LE.get(dataDescriptor, 0) !== zipDataDescriptorSignature) {
329
- throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position - dataDescriptor.length}`);
330
- }
331
- }
332
-
333
- if (hasExceededUnknownSizeScanBudget(this.tokenizer, zipScanStart, maximumUntrustedSkipSizeInBytes)) {
334
- throw new ParserHardLimitError(`ZIP stream probing exceeds ${maximumUntrustedSkipSizeInBytes} bytes`);
335
- }
336
- } while (!stop);
337
- };
338
-
339
- function createByteLimitedReadableStream(stream, maximumBytes) {
340
- const reader = stream.getReader();
341
- let emittedBytes = 0;
342
- let sourceDone = false;
343
- let sourceCanceled = false;
344
-
345
- const cancelSource = async reason => {
346
- if (
347
- sourceDone
348
- || sourceCanceled
349
- ) {
350
- return;
351
- }
352
-
353
- sourceCanceled = true;
354
- await reader.cancel(reason);
355
- };
356
-
357
- return new ReadableStream({
358
- async pull(controller) {
359
- if (emittedBytes >= maximumBytes) {
360
- controller.close();
361
- await cancelSource();
362
- return;
363
- }
364
-
365
- const {done, value} = await reader.read();
366
- if (
367
- done
368
- || !value
369
- ) {
370
- sourceDone = true;
371
- controller.close();
372
- return;
373
- }
374
-
375
- const remainingBytes = maximumBytes - emittedBytes;
376
- if (value.length > remainingBytes) {
377
- controller.enqueue(value.subarray(0, remainingBytes));
378
- emittedBytes += remainingBytes;
379
- controller.close();
380
- await cancelSource();
381
- return;
382
- }
383
-
384
- controller.enqueue(value);
385
- emittedBytes += value.length;
386
- },
387
- async cancel(reason) {
388
- await cancelSource(reason);
389
- },
390
- });
391
- }
392
-
393
- export async function fileTypeFromStream(stream, options) {
394
- return new FileTypeParser(options).fromStream(stream);
395
- }
396
-
397
- export async function fileTypeFromBuffer(input, options) {
398
- return new FileTypeParser(options).fromBuffer(input);
399
- }
400
-
401
- export async function fileTypeFromBlob(blob, options) {
402
- return new FileTypeParser(options).fromBlob(blob);
403
- }
404
-
405
- function getFileTypeFromMimeType(mimeType) {
406
- mimeType = mimeType.toLowerCase();
407
- switch (mimeType) {
408
- case 'application/epub+zip':
409
- return {
410
- ext: 'epub',
411
- mime: mimeType,
412
- };
413
- case 'application/vnd.oasis.opendocument.text':
414
- return {
415
- ext: 'odt',
416
- mime: mimeType,
417
- };
418
- case 'application/vnd.oasis.opendocument.text-template':
419
- return {
420
- ext: 'ott',
421
- mime: mimeType,
422
- };
423
- case 'application/vnd.oasis.opendocument.spreadsheet':
424
- return {
425
- ext: 'ods',
426
- mime: mimeType,
427
- };
428
- case 'application/vnd.oasis.opendocument.spreadsheet-template':
429
- return {
430
- ext: 'ots',
431
- mime: mimeType,
432
- };
433
- case 'application/vnd.oasis.opendocument.presentation':
434
- return {
435
- ext: 'odp',
436
- mime: mimeType,
437
- };
438
- case 'application/vnd.oasis.opendocument.presentation-template':
439
- return {
440
- ext: 'otp',
441
- mime: mimeType,
442
- };
443
- case 'application/vnd.oasis.opendocument.graphics':
444
- return {
445
- ext: 'odg',
446
- mime: mimeType,
447
- };
448
- case 'application/vnd.oasis.opendocument.graphics-template':
449
- return {
450
- ext: 'otg',
451
- mime: mimeType,
452
- };
453
- case 'application/vnd.openxmlformats-officedocument.presentationml.slideshow':
454
- return {
455
- ext: 'ppsx',
456
- mime: mimeType,
457
- };
458
- case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
459
- return {
460
- ext: 'xlsx',
461
- mime: mimeType,
462
- };
463
- case 'application/vnd.ms-excel.sheet.macroenabled':
464
- return {
465
- ext: 'xlsm',
466
- mime: 'application/vnd.ms-excel.sheet.macroenabled.12',
467
- };
468
- case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template':
469
- return {
470
- ext: 'xltx',
471
- mime: mimeType,
472
- };
473
- case 'application/vnd.ms-excel.template.macroenabled':
474
- return {
475
- ext: 'xltm',
476
- mime: 'application/vnd.ms-excel.template.macroenabled.12',
477
- };
478
- case 'application/vnd.ms-powerpoint.slideshow.macroenabled':
479
- return {
480
- ext: 'ppsm',
481
- mime: 'application/vnd.ms-powerpoint.slideshow.macroenabled.12',
482
- };
483
- case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
484
- return {
485
- ext: 'docx',
486
- mime: mimeType,
487
- };
488
- case 'application/vnd.ms-word.document.macroenabled':
489
- return {
490
- ext: 'docm',
491
- mime: 'application/vnd.ms-word.document.macroenabled.12',
492
- };
493
- case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
494
- return {
495
- ext: 'dotx',
496
- mime: mimeType,
497
- };
498
- case 'application/vnd.ms-word.template.macroenabledtemplate':
499
- return {
500
- ext: 'dotm',
501
- mime: 'application/vnd.ms-word.template.macroenabled.12',
502
- };
503
- case 'application/vnd.openxmlformats-officedocument.presentationml.template':
504
- return {
505
- ext: 'potx',
506
- mime: mimeType,
507
- };
508
- case 'application/vnd.ms-powerpoint.template.macroenabled':
509
- return {
510
- ext: 'potm',
511
- mime: 'application/vnd.ms-powerpoint.template.macroenabled.12',
512
- };
513
- case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
514
- return {
515
- ext: 'pptx',
516
- mime: mimeType,
517
- };
518
- case 'application/vnd.ms-powerpoint.presentation.macroenabled':
519
- return {
520
- ext: 'pptm',
521
- mime: 'application/vnd.ms-powerpoint.presentation.macroenabled.12',
522
- };
523
- case 'application/vnd.ms-visio.drawing':
524
- return {
525
- ext: 'vsdx',
526
- mime: 'application/vnd.visio',
527
- };
528
- case 'application/vnd.ms-package.3dmanufacturing-3dmodel+xml':
529
- return {
530
- ext: '3mf',
531
- mime: 'model/3mf',
532
- };
533
- default:
534
- }
535
- }
536
-
537
- function _check(buffer, headers, options) {
538
- options = {
539
- offset: 0,
540
- ...options,
541
- };
542
-
543
- for (const [index, header] of headers.entries()) {
544
- // If a bitmask is set
545
- if (options.mask) {
546
- // If header doesn't equal `buf` with bits masked off
547
- if (header !== (options.mask[index] & buffer[index + options.offset])) {
548
- return false;
549
- }
550
- } else if (header !== buffer[index + options.offset]) {
551
- return false;
552
- }
553
- }
554
-
555
- return true;
556
- }
557
-
558
- export function normalizeSampleSize(sampleSize) {
559
- // `sampleSize` is an explicit caller-controlled tuning knob, not untrusted file input.
560
- // Preserve valid caller-requested probe depth here; applications must bound attacker-derived option values themselves.
561
- if (!Number.isFinite(sampleSize)) {
562
- return reasonableDetectionSizeInBytes;
563
- }
564
-
565
- return Math.max(1, Math.trunc(sampleSize));
566
- }
567
-
568
- function readByobReaderWithSignal(reader, buffer, signal) {
569
- if (signal === undefined) {
570
- return reader.read(buffer);
571
- }
572
-
573
- signal.throwIfAborted();
574
-
575
- return new Promise((resolve, reject) => {
576
- const cleanup = () => {
577
- signal.removeEventListener('abort', onAbort);
578
- };
579
-
580
- const onAbort = () => {
581
- const abortReason = signal.reason;
582
- cleanup();
583
-
584
- (async () => {
585
- try {
586
- await reader.cancel(abortReason);
587
- } catch {}
588
- })();
589
-
590
- reject(abortReason);
591
- };
592
-
593
- signal.addEventListener('abort', onAbort, {once: true});
594
- (async () => {
595
- try {
596
- const result = await reader.read(buffer);
597
- cleanup();
598
- resolve(result);
599
- } catch (error) {
600
- cleanup();
601
- reject(error);
602
- }
603
- })();
604
- });
605
- }
606
-
607
- function normalizeMpegOffsetTolerance(mpegOffsetTolerance) {
608
- // This value controls scan depth and therefore worst-case CPU work.
609
- if (!Number.isFinite(mpegOffsetTolerance)) {
610
- return 0;
611
- }
612
-
613
- return Math.max(0, Math.min(maximumMpegOffsetTolerance, Math.trunc(mpegOffsetTolerance)));
614
- }
615
-
616
- function getKnownFileSizeOrMaximum(fileSize) {
617
- if (!Number.isFinite(fileSize)) {
618
- return Number.MAX_SAFE_INTEGER;
619
- }
620
-
621
- return Math.max(0, fileSize);
622
- }
623
-
624
- function hasUnknownFileSize(tokenizer) {
625
- const fileSize = tokenizer.fileInfo.size;
626
- return (
627
- !Number.isFinite(fileSize)
628
- || fileSize === Number.MAX_SAFE_INTEGER
629
- );
630
- }
631
-
632
- function hasExceededUnknownSizeScanBudget(tokenizer, startOffset, maximumBytes) {
633
- return (
634
- hasUnknownFileSize(tokenizer)
635
- && tokenizer.position - startOffset > maximumBytes
636
- );
637
- }
638
-
639
- function getMaximumZipBufferedReadLength(tokenizer) {
640
- const fileSize = tokenizer.fileInfo.size;
641
- const remainingBytes = Number.isFinite(fileSize)
642
- ? Math.max(0, fileSize - tokenizer.position)
643
- : Number.MAX_SAFE_INTEGER;
644
-
645
- return Math.min(remainingBytes, maximumZipBufferedReadSizeInBytes);
646
- }
647
-
648
- function isRecoverableZipError(error) {
649
- if (error instanceof strtok3.EndOfStreamError) {
650
- return true;
651
- }
652
-
653
- if (error instanceof ParserHardLimitError) {
654
- return true;
655
- }
656
-
657
- if (!(error instanceof Error)) {
658
- return false;
659
- }
660
-
661
- if (recoverableZipErrorMessages.has(error.message)) {
662
- return true;
663
- }
664
-
665
- if (recoverableZipErrorCodes.has(error.code)) {
666
- return true;
667
- }
668
-
669
- for (const prefix of recoverableZipErrorMessagePrefixes) {
670
- if (error.message.startsWith(prefix)) {
671
- return true;
672
- }
673
- }
674
-
675
- return false;
676
- }
677
-
678
- function canReadZipEntryForDetection(zipHeader, maximumSize = maximumZipEntrySizeInBytes) {
679
- const sizes = [zipHeader.compressedSize, zipHeader.uncompressedSize];
680
- for (const size of sizes) {
681
- if (
682
- !Number.isFinite(size)
683
- || size < 0
684
- || size > maximumSize
685
- ) {
686
- return false;
687
- }
688
- }
689
-
690
- return true;
691
- }
692
-
693
- function createOpenXmlZipDetectionState() {
694
- return {
695
- hasContentTypesEntry: false,
696
- hasParsedContentTypesEntry: false,
697
- isParsingContentTypes: false,
698
- hasUnparseableContentTypes: false,
699
- hasWordDirectory: false,
700
- hasPresentationDirectory: false,
701
- hasSpreadsheetDirectory: false,
702
- hasThreeDimensionalModelEntry: false,
703
- };
704
- }
705
-
706
- function updateOpenXmlZipDetectionStateFromFilename(openXmlState, filename) {
707
- if (filename.startsWith('word/')) {
708
- openXmlState.hasWordDirectory = true;
709
- }
710
-
711
- if (filename.startsWith('ppt/')) {
712
- openXmlState.hasPresentationDirectory = true;
713
- }
714
-
715
- if (filename.startsWith('xl/')) {
716
- openXmlState.hasSpreadsheetDirectory = true;
717
- }
718
-
719
- if (
720
- filename.startsWith('3D/')
721
- && filename.endsWith('.model')
722
- ) {
723
- openXmlState.hasThreeDimensionalModelEntry = true;
724
- }
725
- }
726
-
727
- function getOpenXmlFileTypeFromZipEntries(openXmlState) {
728
- // Only use directory-name heuristic when [Content_Types].xml was present in the archive
729
- // but its handler was skipped (not invoked, not currently running, and not already resolved).
730
- // This avoids guessing from directory names when content-type parsing already gave a definitive answer or failed.
731
- if (
732
- !openXmlState.hasContentTypesEntry
733
- || openXmlState.hasUnparseableContentTypes
734
- || openXmlState.isParsingContentTypes
735
- || openXmlState.hasParsedContentTypesEntry
736
- ) {
737
- return;
738
- }
739
-
740
- if (openXmlState.hasWordDirectory) {
741
- return {
742
- ext: 'docx',
743
- mime: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
744
- };
745
- }
746
-
747
- if (openXmlState.hasPresentationDirectory) {
748
- return {
749
- ext: 'pptx',
750
- mime: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
751
- };
752
- }
753
-
754
- if (openXmlState.hasSpreadsheetDirectory) {
755
- return {
756
- ext: 'xlsx',
757
- mime: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
758
- };
759
- }
760
-
761
- if (openXmlState.hasThreeDimensionalModelEntry) {
762
- return {
763
- ext: '3mf',
764
- mime: 'model/3mf',
765
- };
766
- }
767
- }
768
-
769
- function getOpenXmlMimeTypeFromContentTypesXml(xmlContent) {
770
- // We only need the `ContentType="...main+xml"` value, so a small string scan is enough and avoids full XML parsing.
771
- const endPosition = xmlContent.indexOf('.main+xml"');
772
- if (endPosition === -1) {
773
- const mimeType = 'application/vnd.ms-package.3dmanufacturing-3dmodel+xml';
774
- if (xmlContent.includes(`ContentType="${mimeType}"`)) {
775
- return mimeType;
776
- }
777
-
778
- return;
779
- }
780
-
781
- const truncatedContent = xmlContent.slice(0, endPosition);
782
- const firstQuotePosition = truncatedContent.lastIndexOf('"');
783
- // If no quote is found, `lastIndexOf` returns -1 and this intentionally falls back to the full truncated prefix.
784
- return truncatedContent.slice(firstQuotePosition + 1);
785
- }
786
-
787
- export async function fileTypeFromTokenizer(tokenizer, options) {
788
- return new FileTypeParser(options).fromTokenizer(tokenizer);
789
- }
790
-
791
- export async function fileTypeStream(webStream, options) {
792
- return new FileTypeParser(options).toDetectionStream(webStream, options);
793
- }
794
-
795
- export class FileTypeParser {
796
- constructor(options) {
797
- const normalizedMpegOffsetTolerance = normalizeMpegOffsetTolerance(options?.mpegOffsetTolerance);
798
- this.options = {
799
- ...options,
800
- mpegOffsetTolerance: normalizedMpegOffsetTolerance,
801
- };
802
-
803
- this.detectors = [...(this.options.customDetectors ?? []),
804
- {id: 'core', detect: this.detectConfident},
805
- {id: 'core.imprecise', detect: this.detectImprecise}];
806
- this.tokenizerOptions = {
807
- abortSignal: this.options.signal,
808
- };
809
- this.gzipProbeDepth = 0;
810
- }
811
-
812
- getTokenizerOptions() {
813
- return {
814
- ...this.tokenizerOptions,
815
- };
816
- }
817
-
818
- createTokenizerFromWebStream(stream) {
819
- return patchWebByobTokenizerClose(strtok3.fromWebStream(stream, this.getTokenizerOptions()));
820
- }
821
-
822
- async parseTokenizer(tokenizer, detectionReentryCount = 0) {
823
- this.detectionReentryCount = detectionReentryCount;
824
- const initialPosition = tokenizer.position;
825
- // Iterate through all file-type detectors
826
- for (const detector of this.detectors) {
827
- let fileType;
828
- try {
829
- fileType = await detector.detect(tokenizer);
830
- } catch (error) {
831
- if (error instanceof strtok3.EndOfStreamError) {
832
- return;
833
- }
834
-
835
- if (error instanceof ParserHardLimitError) {
836
- return;
837
- }
838
-
839
- throw error;
840
- }
841
-
842
- if (fileType) {
843
- return fileType;
844
- }
845
-
846
- if (initialPosition !== tokenizer.position) {
847
- return undefined; // Cannot proceed scanning of the tokenizer is at an arbitrary position
848
- }
849
- }
850
- }
851
-
852
- async fromTokenizer(tokenizer) {
853
- try {
854
- return await this.parseTokenizer(tokenizer);
855
- } finally {
856
- await tokenizer.close();
857
- }
858
- }
859
-
860
- async fromBuffer(input) {
861
- if (!(input instanceof Uint8Array || input instanceof ArrayBuffer)) {
862
- throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof input}\``);
863
- }
864
-
865
- const buffer = input instanceof Uint8Array ? input : new Uint8Array(input);
866
-
867
- if (!(buffer?.length > 1)) {
868
- return;
869
- }
870
-
871
- return this.fromTokenizer(strtok3.fromBuffer(buffer, this.getTokenizerOptions()));
872
- }
873
-
874
- async fromBlob(blob) {
875
- this.options.signal?.throwIfAborted();
876
- const tokenizer = strtok3.fromBlob(blob, this.getTokenizerOptions());
877
- return this.fromTokenizer(tokenizer);
878
- }
879
-
880
- async fromStream(stream) {
881
- this.options.signal?.throwIfAborted();
882
- const tokenizer = this.createTokenizerFromWebStream(stream);
883
- return this.fromTokenizer(tokenizer);
884
- }
885
-
886
- async toDetectionStream(stream, options) {
887
- const sampleSize = normalizeSampleSize(options?.sampleSize ?? reasonableDetectionSizeInBytes);
888
- let detectedFileType;
889
- let firstChunk;
890
-
891
- const reader = stream.getReader({mode: 'byob'});
892
- try {
893
- // Read the first chunk from the stream
894
- const {value: chunk, done} = await readByobReaderWithSignal(reader, new Uint8Array(sampleSize), this.options.signal);
895
- firstChunk = chunk;
896
- if (!done && chunk) {
897
- try {
898
- // Attempt to detect the file type from the chunk
899
- detectedFileType = await this.fromBuffer(chunk.subarray(0, sampleSize));
900
- } catch (error) {
901
- if (!(error instanceof strtok3.EndOfStreamError)) {
902
- throw error; // Re-throw non-EndOfStreamError
903
- }
904
-
905
- detectedFileType = undefined;
906
- }
907
- }
908
-
909
- firstChunk = chunk;
910
- } finally {
911
- reader.releaseLock(); // Ensure the reader is released
912
- }
913
-
914
- // Create a new ReadableStream to manage locking issues
915
- const transformStream = new TransformStream({
916
- async start(controller) {
917
- controller.enqueue(firstChunk); // Enqueue the initial chunk
918
- },
919
- transform(chunk, controller) {
920
- // Pass through the chunks without modification
921
- controller.enqueue(chunk);
922
- },
923
- });
924
-
925
- const newStream = stream.pipeThrough(transformStream);
926
- newStream.fileType = detectedFileType;
927
-
928
- return newStream;
929
- }
930
-
931
- async detectGzip(tokenizer) {
932
- if (this.gzipProbeDepth >= maximumNestedGzipProbeDepth) {
933
- return {
934
- ext: 'gz',
935
- mime: 'application/gzip',
936
- };
937
- }
938
-
939
- const gzipHandler = new GzipHandler(tokenizer);
940
- const limitedInflatedStream = createByteLimitedReadableStream(gzipHandler.inflate(), maximumNestedGzipDetectionSizeInBytes);
941
- const hasUnknownSize = hasUnknownFileSize(tokenizer);
942
- let timeout;
943
- let probeSignal;
944
- let probeParser;
945
- let compressedFileType;
946
-
947
- if (hasUnknownSize) {
948
- const timeoutController = new AbortController();
949
- timeout = setTimeout(() => {
950
- timeoutController.abort(new DOMException(`Operation timed out after ${unknownSizeGzipProbeTimeoutInMilliseconds} ms`, 'TimeoutError'));
951
- }, unknownSizeGzipProbeTimeoutInMilliseconds);
952
- probeSignal = this.options.signal === undefined
953
- ? timeoutController.signal
954
- // eslint-disable-next-line n/no-unsupported-features/node-builtins
955
- : AbortSignal.any([this.options.signal, timeoutController.signal]);
956
- probeParser = new FileTypeParser({
957
- ...this.options,
958
- signal: probeSignal,
959
- });
960
- probeParser.gzipProbeDepth = this.gzipProbeDepth + 1;
961
- } else {
962
- this.gzipProbeDepth++;
963
- }
964
-
965
- try {
966
- compressedFileType = await (probeParser ?? this).fromStream(limitedInflatedStream);
967
- } catch (error) {
968
- if (
969
- error?.name === 'AbortError'
970
- && probeSignal?.reason?.name !== 'TimeoutError'
971
- ) {
972
- throw error;
973
- }
974
-
975
- // Timeout, decompression, or inner-detection failures are expected for non-tar gzip files.
976
- } finally {
977
- clearTimeout(timeout);
978
- if (!hasUnknownSize) {
979
- this.gzipProbeDepth--;
980
- }
981
- }
982
-
983
- if (compressedFileType?.ext === 'tar') {
984
- return {
985
- ext: 'tar.gz',
986
- mime: 'application/gzip',
987
- };
988
- }
989
-
990
- return {
991
- ext: 'gz',
992
- mime: 'application/gzip',
993
- };
994
- }
995
-
996
- check(header, options) {
997
- return _check(this.buffer, header, options);
998
- }
999
-
1000
- checkString(header, options) {
1001
- return this.check(stringToBytes(header, options?.encoding), options);
1002
- }
1003
-
1004
- // Detections with a high degree of certainty in identifying the correct file type
1005
- detectConfident = async tokenizer => {
1006
- this.buffer = new Uint8Array(reasonableDetectionSizeInBytes);
1007
-
1008
- // Keep reading until EOF if the file size is unknown.
1009
- if (tokenizer.fileInfo.size === undefined) {
1010
- tokenizer.fileInfo.size = Number.MAX_SAFE_INTEGER;
1011
- }
1012
-
1013
- this.tokenizer = tokenizer;
1014
-
1015
- if (hasUnknownFileSize(tokenizer)) {
1016
- await tokenizer.peekBuffer(this.buffer, {length: 3, mayBeLess: true});
1017
- if (this.check([0x1F, 0x8B, 0x8])) {
1018
- return this.detectGzip(tokenizer);
1019
- }
1020
- }
1021
-
1022
- await tokenizer.peekBuffer(this.buffer, {length: 32, mayBeLess: true});
1023
-
1024
- // -- 2-byte signatures --
1025
-
1026
- if (this.check([0x42, 0x4D])) {
1027
- return {
1028
- ext: 'bmp',
1029
- mime: 'image/bmp',
1030
- };
1031
- }
1032
-
1033
- if (this.check([0x0B, 0x77])) {
1034
- return {
1035
- ext: 'ac3',
1036
- mime: 'audio/vnd.dolby.dd-raw',
1037
- };
1038
- }
1039
-
1040
- if (this.check([0x78, 0x01])) {
1041
- return {
1042
- ext: 'dmg',
1043
- mime: 'application/x-apple-diskimage',
1044
- };
1045
- }
1046
-
1047
- if (this.check([0x4D, 0x5A])) {
1048
- return {
1049
- ext: 'exe',
1050
- mime: 'application/x-msdownload',
1051
- };
1052
- }
1053
-
1054
- if (this.check([0x25, 0x21])) {
1055
- await tokenizer.peekBuffer(this.buffer, {length: 24, mayBeLess: true});
1056
-
1057
- if (
1058
- this.checkString('PS-Adobe-', {offset: 2})
1059
- && this.checkString(' EPSF-', {offset: 14})
1060
- ) {
1061
- return {
1062
- ext: 'eps',
1063
- mime: 'application/eps',
1064
- };
1065
- }
1066
-
1067
- return {
1068
- ext: 'ps',
1069
- mime: 'application/postscript',
1070
- };
1071
- }
1072
-
1073
- if (
1074
- this.check([0x1F, 0xA0])
1075
- || this.check([0x1F, 0x9D])
1076
- ) {
1077
- return {
1078
- ext: 'Z',
1079
- mime: 'application/x-compress',
1080
- };
1081
- }
1082
-
1083
- if (this.check([0xC7, 0x71])) {
1084
- return {
1085
- ext: 'cpio',
1086
- mime: 'application/x-cpio',
1087
- };
1088
- }
1089
-
1090
- if (this.check([0x60, 0xEA])) {
1091
- return {
1092
- ext: 'arj',
1093
- mime: 'application/x-arj',
1094
- };
1095
- }
1096
-
1097
- // -- 3-byte signatures --
1098
-
1099
- if (this.check([0xEF, 0xBB, 0xBF])) { // UTF-8-BOM
1100
- if (this.detectionReentryCount >= maximumDetectionReentryCount) {
1101
- return;
1102
- }
1103
-
1104
- this.detectionReentryCount++;
1105
- // Strip off UTF-8-BOM
1106
- await this.tokenizer.ignore(3);
1107
- return this.detectConfident(tokenizer);
1108
- }
1109
-
1110
- if (this.check([0x47, 0x49, 0x46])) {
1111
- return {
1112
- ext: 'gif',
1113
- mime: 'image/gif',
1114
- };
1115
- }
1116
-
1117
- if (this.check([0x49, 0x49, 0xBC])) {
1118
- return {
1119
- ext: 'jxr',
1120
- mime: 'image/vnd.ms-photo',
1121
- };
1122
- }
1123
-
1124
- if (this.check([0x1F, 0x8B, 0x8])) {
1125
- return this.detectGzip(tokenizer);
1126
- }
1127
-
1128
- if (this.check([0x42, 0x5A, 0x68])) {
1129
- return {
1130
- ext: 'bz2',
1131
- mime: 'application/x-bzip2',
1132
- };
1133
- }
1134
-
1135
- if (this.checkString('ID3')) {
1136
- await safeIgnore(tokenizer, 6, {
1137
- maximumLength: 6,
1138
- reason: 'ID3 header prefix',
1139
- }); // Skip ID3 header until the header size
1140
- const id3HeaderLength = await tokenizer.readToken(uint32SyncSafeToken);
1141
- const isUnknownFileSize = hasUnknownFileSize(tokenizer);
1142
- if (
1143
- !Number.isFinite(id3HeaderLength)
1144
- || id3HeaderLength < 0
1145
- // Keep ID3 probing bounded for unknown-size streams to avoid attacker-controlled large skips.
1146
- || (
1147
- isUnknownFileSize
1148
- && (
1149
- id3HeaderLength > maximumId3HeaderSizeInBytes
1150
- || (tokenizer.position + id3HeaderLength) > maximumId3HeaderSizeInBytes
1151
- )
1152
- )
1153
- ) {
1154
- return;
1155
- }
1156
-
1157
- if (tokenizer.position + id3HeaderLength > tokenizer.fileInfo.size) {
1158
- if (isUnknownFileSize) {
1159
- return;
1160
- }
1161
-
1162
- return {
1163
- ext: 'mp3',
1164
- mime: 'audio/mpeg',
1165
- };
1166
- }
1167
-
1168
- try {
1169
- await safeIgnore(tokenizer, id3HeaderLength, {
1170
- maximumLength: isUnknownFileSize ? maximumId3HeaderSizeInBytes : tokenizer.fileInfo.size,
1171
- reason: 'ID3 payload',
1172
- });
1173
- } catch (error) {
1174
- if (error instanceof strtok3.EndOfStreamError) {
1175
- return;
1176
- }
1177
-
1178
- throw error;
1179
- }
1180
-
1181
- if (this.detectionReentryCount >= maximumDetectionReentryCount) {
1182
- return;
1183
- }
1184
-
1185
- this.detectionReentryCount++;
1186
- return this.parseTokenizer(tokenizer, this.detectionReentryCount); // Skip ID3 header, recursion
1187
- }
1188
-
1189
- // Musepack, SV7
1190
- if (this.checkString('MP+')) {
1191
- return {
1192
- ext: 'mpc',
1193
- mime: 'audio/x-musepack',
1194
- };
1195
- }
1196
-
1197
- if (
1198
- (this.buffer[0] === 0x43 || this.buffer[0] === 0x46)
1199
- && this.check([0x57, 0x53], {offset: 1})
1200
- ) {
1201
- return {
1202
- ext: 'swf',
1203
- mime: 'application/x-shockwave-flash',
1204
- };
1205
- }
1206
-
1207
- // -- 4-byte signatures --
1208
-
1209
- // Requires a sample size of 4 bytes
1210
- if (this.check([0xFF, 0xD8, 0xFF])) {
1211
- if (this.check([0xF7], {offset: 3})) { // JPG7/SOF55, indicating a ISO/IEC 14495 / JPEG-LS file
1212
- return {
1213
- ext: 'jls',
1214
- mime: 'image/jls',
1215
- };
1216
- }
1217
-
1218
- return {
1219
- ext: 'jpg',
1220
- mime: 'image/jpeg',
1221
- };
1222
- }
1223
-
1224
- if (this.check([0x4F, 0x62, 0x6A, 0x01])) {
1225
- return {
1226
- ext: 'avro',
1227
- mime: 'application/avro',
1228
- };
1229
- }
1230
-
1231
- if (this.checkString('FLIF')) {
1232
- return {
1233
- ext: 'flif',
1234
- mime: 'image/flif',
1235
- };
1236
- }
1237
-
1238
- if (this.checkString('8BPS')) {
1239
- return {
1240
- ext: 'psd',
1241
- mime: 'image/vnd.adobe.photoshop',
1242
- };
1243
- }
1244
-
1245
- // Musepack, SV8
1246
- if (this.checkString('MPCK')) {
1247
- return {
1248
- ext: 'mpc',
1249
- mime: 'audio/x-musepack',
1250
- };
1251
- }
1252
-
1253
- if (this.checkString('FORM')) {
1254
- return {
1255
- ext: 'aif',
1256
- mime: 'audio/aiff',
1257
- };
1258
- }
1259
-
1260
- if (this.checkString('icns', {offset: 0})) {
1261
- return {
1262
- ext: 'icns',
1263
- mime: 'image/icns',
1264
- };
1265
- }
1266
-
1267
- // Zip-based file formats
1268
- // Need to be before the `zip` check
1269
- if (this.check([0x50, 0x4B, 0x3, 0x4])) { // Local file header signature
1270
- let fileType;
1271
- const openXmlState = createOpenXmlZipDetectionState();
1272
-
1273
- try {
1274
- await new ZipHandler(tokenizer).unzip(zipHeader => {
1275
- updateOpenXmlZipDetectionStateFromFilename(openXmlState, zipHeader.filename);
1276
-
1277
- const isOpenXmlContentTypesEntry = zipHeader.filename === '[Content_Types].xml';
1278
- const openXmlFileTypeFromEntries = getOpenXmlFileTypeFromZipEntries(openXmlState);
1279
- if (
1280
- !isOpenXmlContentTypesEntry
1281
- && openXmlFileTypeFromEntries
1282
- ) {
1283
- fileType = openXmlFileTypeFromEntries;
1284
- return {
1285
- stop: true,
1286
- };
1287
- }
1288
-
1289
- switch (zipHeader.filename) {
1290
- case 'META-INF/mozilla.rsa':
1291
- fileType = {
1292
- ext: 'xpi',
1293
- mime: 'application/x-xpinstall',
1294
- };
1295
- return {
1296
- stop: true,
1297
- };
1298
- case 'META-INF/MANIFEST.MF':
1299
- fileType = {
1300
- ext: 'jar',
1301
- mime: 'application/java-archive',
1302
- };
1303
- return {
1304
- stop: true,
1305
- };
1306
- case 'mimetype':
1307
- if (!canReadZipEntryForDetection(zipHeader, maximumZipTextEntrySizeInBytes)) {
1308
- return {};
1309
- }
1310
-
1311
- return {
1312
- async handler(fileData) {
1313
- // Use TextDecoder to decode the UTF-8 encoded data
1314
- const mimeType = new TextDecoder('utf-8').decode(fileData).trim();
1315
- fileType = getFileTypeFromMimeType(mimeType);
1316
- },
1317
- stop: true,
1318
- };
1319
-
1320
- case '[Content_Types].xml': {
1321
- openXmlState.hasContentTypesEntry = true;
1322
-
1323
- if (!canReadZipEntryForDetection(zipHeader, maximumZipTextEntrySizeInBytes)) {
1324
- openXmlState.hasUnparseableContentTypes = true;
1325
- return {};
1326
- }
1327
-
1328
- openXmlState.isParsingContentTypes = true;
1329
- return {
1330
- async handler(fileData) {
1331
- // Use TextDecoder to decode the UTF-8 encoded data
1332
- const xmlContent = new TextDecoder('utf-8').decode(fileData);
1333
- const mimeType = getOpenXmlMimeTypeFromContentTypesXml(xmlContent);
1334
- if (mimeType) {
1335
- fileType = getFileTypeFromMimeType(mimeType);
1336
- }
1337
-
1338
- openXmlState.hasParsedContentTypesEntry = true;
1339
- openXmlState.isParsingContentTypes = false;
1340
- },
1341
- stop: true,
1342
- };
1343
- }
1344
-
1345
- default:
1346
- if (/classes\d*\.dex/.test(zipHeader.filename)) {
1347
- fileType = {
1348
- ext: 'apk',
1349
- mime: 'application/vnd.android.package-archive',
1350
- };
1351
- return {stop: true};
1352
- }
1353
-
1354
- return {};
1355
- }
1356
- });
1357
- } catch (error) {
1358
- if (!isRecoverableZipError(error)) {
1359
- throw error;
1360
- }
1361
-
1362
- if (openXmlState.isParsingContentTypes) {
1363
- openXmlState.isParsingContentTypes = false;
1364
- openXmlState.hasUnparseableContentTypes = true;
1365
- }
1366
- }
1367
-
1368
- return fileType ?? getOpenXmlFileTypeFromZipEntries(openXmlState) ?? {
1369
- ext: 'zip',
1370
- mime: 'application/zip',
1371
- };
1372
- }
1373
-
1374
- if (this.checkString('OggS')) {
1375
- // This is an OGG container
1376
- await tokenizer.ignore(28);
1377
- const type = new Uint8Array(8);
1378
- await tokenizer.readBuffer(type);
1379
-
1380
- // Needs to be before `ogg` check
1381
- if (_check(type, [0x4F, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64])) {
1382
- return {
1383
- ext: 'opus',
1384
- mime: 'audio/ogg; codecs=opus',
1385
- };
1386
- }
1387
-
1388
- // If ' theora' in header.
1389
- if (_check(type, [0x80, 0x74, 0x68, 0x65, 0x6F, 0x72, 0x61])) {
1390
- return {
1391
- ext: 'ogv',
1392
- mime: 'video/ogg',
1393
- };
1394
- }
1395
-
1396
- // If '\x01video' in header.
1397
- if (_check(type, [0x01, 0x76, 0x69, 0x64, 0x65, 0x6F, 0x00])) {
1398
- return {
1399
- ext: 'ogm',
1400
- mime: 'video/ogg',
1401
- };
1402
- }
1403
-
1404
- // If ' FLAC' in header https://xiph.org/flac/faq.html
1405
- if (_check(type, [0x7F, 0x46, 0x4C, 0x41, 0x43])) {
1406
- return {
1407
- ext: 'oga',
1408
- mime: 'audio/ogg',
1409
- };
1410
- }
1411
-
1412
- // 'Speex ' in header https://en.wikipedia.org/wiki/Speex
1413
- if (_check(type, [0x53, 0x70, 0x65, 0x65, 0x78, 0x20, 0x20])) {
1414
- return {
1415
- ext: 'spx',
1416
- mime: 'audio/ogg',
1417
- };
1418
- }
1419
-
1420
- // If '\x01vorbis' in header
1421
- if (_check(type, [0x01, 0x76, 0x6F, 0x72, 0x62, 0x69, 0x73])) {
1422
- return {
1423
- ext: 'ogg',
1424
- mime: 'audio/ogg',
1425
- };
1426
- }
1427
-
1428
- // Default OGG container https://www.iana.org/assignments/media-types/application/ogg
1429
- return {
1430
- ext: 'ogx',
1431
- mime: 'application/ogg',
1432
- };
1433
- }
1434
-
1435
- if (
1436
- this.check([0x50, 0x4B])
1437
- && (this.buffer[2] === 0x3 || this.buffer[2] === 0x5 || this.buffer[2] === 0x7)
1438
- && (this.buffer[3] === 0x4 || this.buffer[3] === 0x6 || this.buffer[3] === 0x8)
1439
- ) {
1440
- return {
1441
- ext: 'zip',
1442
- mime: 'application/zip',
1443
- };
1444
- }
1445
-
1446
- if (this.checkString('MThd')) {
1447
- return {
1448
- ext: 'mid',
1449
- mime: 'audio/midi',
1450
- };
1451
- }
1452
-
1453
- if (
1454
- this.checkString('wOFF')
1455
- && (
1456
- this.check([0x00, 0x01, 0x00, 0x00], {offset: 4})
1457
- || this.checkString('OTTO', {offset: 4})
1458
- )
1459
- ) {
1460
- return {
1461
- ext: 'woff',
1462
- mime: 'font/woff',
1463
- };
1464
- }
1465
-
1466
- if (
1467
- this.checkString('wOF2')
1468
- && (
1469
- this.check([0x00, 0x01, 0x00, 0x00], {offset: 4})
1470
- || this.checkString('OTTO', {offset: 4})
1471
- )
1472
- ) {
1473
- return {
1474
- ext: 'woff2',
1475
- mime: 'font/woff2',
1476
- };
1477
- }
1478
-
1479
- if (this.check([0xD4, 0xC3, 0xB2, 0xA1]) || this.check([0xA1, 0xB2, 0xC3, 0xD4])) {
1480
- return {
1481
- ext: 'pcap',
1482
- mime: 'application/vnd.tcpdump.pcap',
1483
- };
1484
- }
1485
-
1486
- // Sony DSD Stream File (DSF)
1487
- if (this.checkString('DSD ')) {
1488
- return {
1489
- ext: 'dsf',
1490
- mime: 'audio/x-dsf', // Non-standard
1491
- };
1492
- }
1493
-
1494
- if (this.checkString('LZIP')) {
1495
- return {
1496
- ext: 'lz',
1497
- mime: 'application/x-lzip',
1498
- };
1499
- }
1500
-
1501
- if (this.checkString('fLaC')) {
1502
- return {
1503
- ext: 'flac',
1504
- mime: 'audio/flac',
1505
- };
1506
- }
1507
-
1508
- if (this.check([0x42, 0x50, 0x47, 0xFB])) {
1509
- return {
1510
- ext: 'bpg',
1511
- mime: 'image/bpg',
1512
- };
1513
- }
1514
-
1515
- if (this.checkString('wvpk')) {
1516
- return {
1517
- ext: 'wv',
1518
- mime: 'audio/wavpack',
1519
- };
1520
- }
1521
-
1522
- if (this.checkString('%PDF')) {
1523
- // Assume this is just a normal PDF
1524
- return {
1525
- ext: 'pdf',
1526
- mime: 'application/pdf',
1527
- };
1528
- }
1529
-
1530
- if (this.check([0x00, 0x61, 0x73, 0x6D])) {
1531
- return {
1532
- ext: 'wasm',
1533
- mime: 'application/wasm',
1534
- };
1535
- }
1536
-
1537
- // TIFF, little-endian type
1538
- if (this.check([0x49, 0x49])) {
1539
- const fileType = await this.readTiffHeader(false);
1540
- if (fileType) {
1541
- return fileType;
1542
- }
1543
- }
1544
-
1545
- // TIFF, big-endian type
1546
- if (this.check([0x4D, 0x4D])) {
1547
- const fileType = await this.readTiffHeader(true);
1548
- if (fileType) {
1549
- return fileType;
1550
- }
1551
- }
1552
-
1553
- if (this.checkString('MAC ')) {
1554
- return {
1555
- ext: 'ape',
1556
- mime: 'audio/ape',
1557
- };
1558
- }
1559
-
1560
- // https://github.com/file/file/blob/master/magic/Magdir/matroska
1561
- if (this.check([0x1A, 0x45, 0xDF, 0xA3])) { // Root element: EBML
1562
- async function readField() {
1563
- const msb = await tokenizer.peekNumber(Token.UINT8);
1564
- let mask = 0x80;
1565
- let ic = 0; // 0 = A, 1 = B, 2 = C, 3 = D
1566
-
1567
- while ((msb & mask) === 0 && mask !== 0) {
1568
- ++ic;
1569
- mask >>= 1;
1570
- }
1571
-
1572
- const id = new Uint8Array(ic + 1);
1573
- await safeReadBuffer(tokenizer, id, undefined, {
1574
- maximumLength: id.length,
1575
- reason: 'EBML field',
1576
- });
1577
- return id;
1578
- }
1579
-
1580
- async function readElement() {
1581
- const idField = await readField();
1582
- const lengthField = await readField();
1583
-
1584
- lengthField[0] ^= 0x80 >> (lengthField.length - 1);
1585
- const nrLength = Math.min(6, lengthField.length); // JavaScript can max read 6 bytes integer
1586
-
1587
- const idView = new DataView(idField.buffer);
1588
- const lengthView = new DataView(lengthField.buffer, lengthField.length - nrLength, nrLength);
1589
-
1590
- return {
1591
- id: getUintBE(idView),
1592
- len: getUintBE(lengthView),
1593
- };
1594
- }
1595
-
1596
- async function readChildren(children) {
1597
- let ebmlElementCount = 0;
1598
- while (children > 0) {
1599
- ebmlElementCount++;
1600
- if (ebmlElementCount > maximumEbmlElementCount) {
1601
- return;
1602
- }
1603
-
1604
- if (hasExceededUnknownSizeScanBudget(tokenizer, ebmlScanStart, maximumUntrustedSkipSizeInBytes)) {
1605
- return;
1606
- }
1607
-
1608
- const previousPosition = tokenizer.position;
1609
- const element = await readElement();
1610
-
1611
- if (element.id === 0x42_82) {
1612
- // `DocType` is a short string ("webm", "matroska", ...), reject implausible lengths to avoid large allocations.
1613
- if (element.len > maximumEbmlDocumentTypeSizeInBytes) {
1614
- return;
1615
- }
1616
-
1617
- const documentTypeLength = getSafeBound(element.len, maximumEbmlDocumentTypeSizeInBytes, 'EBML DocType');
1618
- const rawValue = await tokenizer.readToken(new Token.StringType(documentTypeLength));
1619
- return rawValue.replaceAll(/\00.*$/g, ''); // Return DocType
1620
- }
1621
-
1622
- if (
1623
- hasUnknownFileSize(tokenizer)
1624
- && (
1625
- !Number.isFinite(element.len)
1626
- || element.len < 0
1627
- || element.len > maximumEbmlElementPayloadSizeInBytes
1628
- )
1629
- ) {
1630
- return;
1631
- }
1632
-
1633
- await safeIgnore(tokenizer, element.len, {
1634
- maximumLength: hasUnknownFileSize(tokenizer) ? maximumEbmlElementPayloadSizeInBytes : tokenizer.fileInfo.size,
1635
- reason: 'EBML payload',
1636
- }); // ignore payload
1637
- --children;
1638
-
1639
- // Safeguard against malformed files: bail if the position did not advance.
1640
- if (tokenizer.position <= previousPosition) {
1641
- return;
1642
- }
1643
- }
1644
- }
1645
-
1646
- const rootElement = await readElement();
1647
- const ebmlScanStart = tokenizer.position;
1648
- const documentType = await readChildren(rootElement.len);
1649
-
1650
- switch (documentType) {
1651
- case 'webm':
1652
- return {
1653
- ext: 'webm',
1654
- mime: 'video/webm',
1655
- };
1656
-
1657
- case 'matroska':
1658
- return {
1659
- ext: 'mkv',
1660
- mime: 'video/matroska',
1661
- };
1662
-
1663
- default:
1664
- return;
1665
- }
1666
- }
1667
-
1668
- if (this.checkString('SQLi')) {
1669
- return {
1670
- ext: 'sqlite',
1671
- mime: 'application/x-sqlite3',
1672
- };
1673
- }
1674
-
1675
- if (this.check([0x4E, 0x45, 0x53, 0x1A])) {
1676
- return {
1677
- ext: 'nes',
1678
- mime: 'application/x-nintendo-nes-rom',
1679
- };
1680
- }
1681
-
1682
- if (this.checkString('Cr24')) {
1683
- return {
1684
- ext: 'crx',
1685
- mime: 'application/x-google-chrome-extension',
1686
- };
1687
- }
1688
-
1689
- if (
1690
- this.checkString('MSCF')
1691
- || this.checkString('ISc(')
1692
- ) {
1693
- return {
1694
- ext: 'cab',
1695
- mime: 'application/vnd.ms-cab-compressed',
1696
- };
1697
- }
1698
-
1699
- if (this.check([0xED, 0xAB, 0xEE, 0xDB])) {
1700
- return {
1701
- ext: 'rpm',
1702
- mime: 'application/x-rpm',
1703
- };
1704
- }
1705
-
1706
- if (this.check([0xC5, 0xD0, 0xD3, 0xC6])) {
1707
- return {
1708
- ext: 'eps',
1709
- mime: 'application/eps',
1710
- };
1711
- }
1712
-
1713
- if (this.check([0x28, 0xB5, 0x2F, 0xFD])) {
1714
- return {
1715
- ext: 'zst',
1716
- mime: 'application/zstd',
1717
- };
1718
- }
1719
-
1720
- if (this.check([0x7F, 0x45, 0x4C, 0x46])) {
1721
- return {
1722
- ext: 'elf',
1723
- mime: 'application/x-elf',
1724
- };
1725
- }
1726
-
1727
- if (this.check([0x21, 0x42, 0x44, 0x4E])) {
1728
- return {
1729
- ext: 'pst',
1730
- mime: 'application/vnd.ms-outlook',
1731
- };
1732
- }
1733
-
1734
- if (this.checkString('PAR1') || this.checkString('PARE')) {
1735
- return {
1736
- ext: 'parquet',
1737
- mime: 'application/vnd.apache.parquet',
1738
- };
1739
- }
1740
-
1741
- if (this.checkString('ttcf')) {
1742
- return {
1743
- ext: 'ttc',
1744
- mime: 'font/collection',
1745
- };
1746
- }
1747
-
1748
- if (
1749
- this.check([0xFE, 0xED, 0xFA, 0xCE]) // 32-bit, big-endian
1750
- || this.check([0xFE, 0xED, 0xFA, 0xCF]) // 64-bit, big-endian
1751
- || this.check([0xCE, 0xFA, 0xED, 0xFE]) // 32-bit, little-endian
1752
- || this.check([0xCF, 0xFA, 0xED, 0xFE]) // 64-bit, little-endian
1753
- ) {
1754
- return {
1755
- ext: 'macho',
1756
- mime: 'application/x-mach-binary',
1757
- };
1758
- }
1759
-
1760
- if (this.check([0x04, 0x22, 0x4D, 0x18])) {
1761
- return {
1762
- ext: 'lz4',
1763
- mime: 'application/x-lz4', // Invented by us
1764
- };
1765
- }
1766
-
1767
- if (this.checkString('regf')) {
1768
- return {
1769
- ext: 'dat',
1770
- mime: 'application/x-ft-windows-registry-hive',
1771
- };
1772
- }
1773
-
1774
- // SPSS Statistical Data File
1775
- if (this.checkString('$FL2') || this.checkString('$FL3')) {
1776
- return {
1777
- ext: 'sav',
1778
- mime: 'application/x-spss-sav',
1779
- };
1780
- }
1781
-
1782
- // -- 5-byte signatures --
1783
-
1784
- if (this.check([0x4F, 0x54, 0x54, 0x4F, 0x00])) {
1785
- return {
1786
- ext: 'otf',
1787
- mime: 'font/otf',
1788
- };
1789
- }
1790
-
1791
- if (this.checkString('#!AMR')) {
1792
- return {
1793
- ext: 'amr',
1794
- mime: 'audio/amr',
1795
- };
1796
- }
1797
-
1798
- if (this.checkString('{\\rtf')) {
1799
- return {
1800
- ext: 'rtf',
1801
- mime: 'application/rtf',
1802
- };
1803
- }
1804
-
1805
- if (this.check([0x46, 0x4C, 0x56, 0x01])) {
1806
- return {
1807
- ext: 'flv',
1808
- mime: 'video/x-flv',
1809
- };
1810
- }
1811
-
1812
- if (this.checkString('IMPM')) {
1813
- return {
1814
- ext: 'it',
1815
- mime: 'audio/x-it',
1816
- };
1817
- }
1818
-
1819
- if (
1820
- this.checkString('-lh0-', {offset: 2})
1821
- || this.checkString('-lh1-', {offset: 2})
1822
- || this.checkString('-lh2-', {offset: 2})
1823
- || this.checkString('-lh3-', {offset: 2})
1824
- || this.checkString('-lh4-', {offset: 2})
1825
- || this.checkString('-lh5-', {offset: 2})
1826
- || this.checkString('-lh6-', {offset: 2})
1827
- || this.checkString('-lh7-', {offset: 2})
1828
- || this.checkString('-lzs-', {offset: 2})
1829
- || this.checkString('-lz4-', {offset: 2})
1830
- || this.checkString('-lz5-', {offset: 2})
1831
- || this.checkString('-lhd-', {offset: 2})
1832
- ) {
1833
- return {
1834
- ext: 'lzh',
1835
- mime: 'application/x-lzh-compressed',
1836
- };
1837
- }
1838
-
1839
- // MPEG program stream (PS or MPEG-PS)
1840
- if (this.check([0x00, 0x00, 0x01, 0xBA])) {
1841
- // MPEG-PS, MPEG-1 Part 1
1842
- if (this.check([0x21], {offset: 4, mask: [0xF1]})) {
1843
- return {
1844
- ext: 'mpg', // May also be .ps, .mpeg
1845
- mime: 'video/MP1S',
1846
- };
1847
- }
1848
-
1849
- // MPEG-PS, MPEG-2 Part 1
1850
- if (this.check([0x44], {offset: 4, mask: [0xC4]})) {
1851
- return {
1852
- ext: 'mpg', // May also be .mpg, .m2p, .vob or .sub
1853
- mime: 'video/MP2P',
1854
- };
1855
- }
1856
- }
1857
-
1858
- if (this.checkString('ITSF')) {
1859
- return {
1860
- ext: 'chm',
1861
- mime: 'application/vnd.ms-htmlhelp',
1862
- };
1863
- }
1864
-
1865
- if (this.check([0xCA, 0xFE, 0xBA, 0xBE])) {
1866
- // Java bytecode and Mach-O universal binaries have the same magic number.
1867
- // We disambiguate based on the next 4 bytes, as done by `file`.
1868
- // See https://github.com/file/file/blob/master/magic/Magdir/cafebabe
1869
- const machOArchitectureCount = Token.UINT32_BE.get(this.buffer, 4);
1870
- const javaClassFileMajorVersion = Token.UINT16_BE.get(this.buffer, 6);
1871
-
1872
- if (machOArchitectureCount > 0 && machOArchitectureCount <= 30) {
1873
- return {
1874
- ext: 'macho',
1875
- mime: 'application/x-mach-binary',
1876
- };
1877
- }
1878
-
1879
- if (javaClassFileMajorVersion > 30) {
1880
- return {
1881
- ext: 'class',
1882
- mime: 'application/java-vm',
1883
- };
1884
- }
1885
- }
1886
-
1887
- if (this.checkString('.RMF')) {
1888
- return {
1889
- ext: 'rm',
1890
- mime: 'application/vnd.rn-realmedia',
1891
- };
1892
- }
1893
-
1894
- // -- 5-byte signatures --
1895
-
1896
- if (this.checkString('DRACO')) {
1897
- return {
1898
- ext: 'drc',
1899
- mime: 'application/vnd.google.draco', // Invented by us
1900
- };
1901
- }
1902
-
1903
- // -- 6-byte signatures --
1904
-
1905
- if (this.check([0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00])) {
1906
- return {
1907
- ext: 'xz',
1908
- mime: 'application/x-xz',
1909
- };
1910
- }
1911
-
1912
- if (this.checkString('<?xml ')) {
1913
- return {
1914
- ext: 'xml',
1915
- mime: 'application/xml',
1916
- };
1917
- }
1918
-
1919
- if (this.check([0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C])) {
1920
- return {
1921
- ext: '7z',
1922
- mime: 'application/x-7z-compressed',
1923
- };
1924
- }
1925
-
1926
- if (
1927
- this.check([0x52, 0x61, 0x72, 0x21, 0x1A, 0x7])
1928
- && (this.buffer[6] === 0x0 || this.buffer[6] === 0x1)
1929
- ) {
1930
- return {
1931
- ext: 'rar',
1932
- mime: 'application/x-rar-compressed',
1933
- };
1934
- }
1935
-
1936
- if (this.checkString('solid ')) {
1937
- return {
1938
- ext: 'stl',
1939
- mime: 'model/stl',
1940
- };
1941
- }
1942
-
1943
- if (this.checkString('AC')) {
1944
- const version = new Token.StringType(4, 'latin1').get(this.buffer, 2);
1945
- if (version.match('^d*') && version >= 1000 && version <= 1050) {
1946
- return {
1947
- ext: 'dwg',
1948
- mime: 'image/vnd.dwg',
1949
- };
1950
- }
1951
- }
1952
-
1953
- if (this.checkString('070707')) {
1954
- return {
1955
- ext: 'cpio',
1956
- mime: 'application/x-cpio',
1957
- };
1958
- }
1959
-
1960
- // -- 7-byte signatures --
1961
-
1962
- if (this.checkString('BLENDER')) {
1963
- return {
1964
- ext: 'blend',
1965
- mime: 'application/x-blender',
1966
- };
1967
- }
1968
-
1969
- if (this.checkString('!<arch>')) {
1970
- await tokenizer.ignore(8);
1971
- const string = await tokenizer.readToken(new Token.StringType(13, 'ascii'));
1972
- if (string === 'debian-binary') {
1973
- return {
1974
- ext: 'deb',
1975
- mime: 'application/x-deb',
1976
- };
1977
- }
1978
-
1979
- return {
1980
- ext: 'ar',
1981
- mime: 'application/x-unix-archive',
1982
- };
1983
- }
1984
-
1985
- if (
1986
- this.checkString('WEBVTT')
1987
- && (
1988
- // One of LF, CR, tab, space, or end of file must follow "WEBVTT" per the spec (see `fixture/fixture-vtt-*.vtt` for examples). Note that `\0` is technically the null character (there is no such thing as an EOF character). However, checking for `\0` gives us the same result as checking for the end of the stream.
1989
- (['\n', '\r', '\t', ' ', '\0'].some(char7 => this.checkString(char7, {offset: 6}))))
1990
- ) {
1991
- return {
1992
- ext: 'vtt',
1993
- mime: 'text/vtt',
1994
- };
1995
- }
1996
-
1997
- // -- 8-byte signatures --
1998
-
1999
- if (this.check([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])) {
2000
- const pngFileType = {
2001
- ext: 'png',
2002
- mime: 'image/png',
2003
- };
2004
-
2005
- const apngFileType = {
2006
- ext: 'apng',
2007
- mime: 'image/apng',
2008
- };
2009
-
2010
- // APNG format (https://wiki.mozilla.org/APNG_Specification)
2011
- // 1. Find the first IDAT (image data) chunk (49 44 41 54)
2012
- // 2. Check if there is an "acTL" chunk before the IDAT one (61 63 54 4C)
2013
-
2014
- // Offset calculated as follows:
2015
- // - 8 bytes: PNG signature
2016
- // - 4 (length) + 4 (chunk type) + 13 (chunk data) + 4 (CRC): IHDR chunk
2017
-
2018
- await tokenizer.ignore(8); // ignore PNG signature
2019
-
2020
- async function readChunkHeader() {
2021
- return {
2022
- length: await tokenizer.readToken(Token.INT32_BE),
2023
- type: await tokenizer.readToken(new Token.StringType(4, 'latin1')),
2024
- };
2025
- }
2026
-
2027
- const isUnknownPngStream = hasUnknownFileSize(tokenizer);
2028
- const pngScanStart = tokenizer.position;
2029
- let pngChunkCount = 0;
2030
- let hasSeenImageHeader = false;
2031
- do {
2032
- pngChunkCount++;
2033
- if (pngChunkCount > maximumPngChunkCount) {
2034
- break;
2035
- }
2036
-
2037
- if (hasExceededUnknownSizeScanBudget(tokenizer, pngScanStart, maximumPngStreamScanBudgetInBytes)) {
2038
- break;
2039
- }
2040
-
2041
- const previousPosition = tokenizer.position;
2042
- const chunk = await readChunkHeader();
2043
- if (chunk.length < 0) {
2044
- return; // Invalid chunk length
2045
- }
2046
-
2047
- if (chunk.type === 'IHDR') {
2048
- // PNG requires the first real image header to be a 13-byte IHDR chunk.
2049
- if (chunk.length !== 13) {
2050
- return;
2051
- }
2052
-
2053
- hasSeenImageHeader = true;
2054
- }
2055
-
2056
- switch (chunk.type) {
2057
- case 'IDAT':
2058
- return pngFileType;
2059
- case 'acTL':
2060
- return apngFileType;
2061
- default:
2062
- if (
2063
- !hasSeenImageHeader
2064
- && chunk.type !== 'CgBI'
2065
- ) {
2066
- return;
2067
- }
2068
-
2069
- if (
2070
- isUnknownPngStream
2071
- && chunk.length > maximumPngChunkSizeInBytes
2072
- ) {
2073
- // Avoid huge attacker-controlled skips when probing unknown-size streams.
2074
- return hasSeenImageHeader && isPngAncillaryChunk(chunk.type) ? pngFileType : undefined;
2075
- }
2076
-
2077
- try {
2078
- await safeIgnore(tokenizer, chunk.length + 4, {
2079
- maximumLength: isUnknownPngStream ? maximumPngChunkSizeInBytes + 4 : tokenizer.fileInfo.size,
2080
- reason: 'PNG chunk payload',
2081
- }); // Ignore chunk-data + CRC
2082
- } catch (error) {
2083
- if (
2084
- !isUnknownPngStream
2085
- && (
2086
- error instanceof ParserHardLimitError
2087
- || error instanceof strtok3.EndOfStreamError
2088
- )
2089
- ) {
2090
- return pngFileType;
2091
- }
2092
-
2093
- throw error;
2094
- }
2095
- }
2096
-
2097
- // Safeguard against malformed files: bail if the position did not advance.
2098
- if (tokenizer.position <= previousPosition) {
2099
- break;
2100
- }
2101
- } while (tokenizer.position + 8 < tokenizer.fileInfo.size);
2102
-
2103
- return pngFileType;
2104
- }
2105
-
2106
- if (this.check([0x41, 0x52, 0x52, 0x4F, 0x57, 0x31, 0x00, 0x00])) {
2107
- return {
2108
- ext: 'arrow',
2109
- mime: 'application/vnd.apache.arrow.file',
2110
- };
2111
- }
2112
-
2113
- if (this.check([0x67, 0x6C, 0x54, 0x46, 0x02, 0x00, 0x00, 0x00])) {
2114
- return {
2115
- ext: 'glb',
2116
- mime: 'model/gltf-binary',
2117
- };
2118
- }
2119
-
2120
- // `mov` format variants
2121
- if (
2122
- this.check([0x66, 0x72, 0x65, 0x65], {offset: 4}) // `free`
2123
- || this.check([0x6D, 0x64, 0x61, 0x74], {offset: 4}) // `mdat` MJPEG
2124
- || this.check([0x6D, 0x6F, 0x6F, 0x76], {offset: 4}) // `moov`
2125
- || this.check([0x77, 0x69, 0x64, 0x65], {offset: 4}) // `wide`
2126
- ) {
2127
- return {
2128
- ext: 'mov',
2129
- mime: 'video/quicktime',
2130
- };
2131
- }
2132
-
2133
- // -- 9-byte signatures --
2134
-
2135
- if (this.check([0x49, 0x49, 0x52, 0x4F, 0x08, 0x00, 0x00, 0x00, 0x18])) {
2136
- return {
2137
- ext: 'orf',
2138
- mime: 'image/x-olympus-orf',
2139
- };
2140
- }
2141
-
2142
- if (this.checkString('gimp xcf ')) {
2143
- return {
2144
- ext: 'xcf',
2145
- mime: 'image/x-xcf',
2146
- };
2147
- }
2148
-
2149
- // File Type Box (https://en.wikipedia.org/wiki/ISO_base_media_file_format)
2150
- // It's not required to be first, but it's recommended to be. Almost all ISO base media files start with `ftyp` box.
2151
- // `ftyp` box must contain a brand major identifier, which must consist of ISO 8859-1 printable characters.
2152
- // Here we check for 8859-1 printable characters (for simplicity, it's a mask which also catches one non-printable character).
2153
- if (
2154
- this.checkString('ftyp', {offset: 4})
2155
- && (this.buffer[8] & 0x60) !== 0x00 // Brand major, first character ASCII?
2156
- ) {
2157
- // They all can have MIME `video/mp4` except `application/mp4` special-case which is hard to detect.
2158
- // For some cases, we're specific, everything else falls to `video/mp4` with `mp4` extension.
2159
- const brandMajor = new Token.StringType(4, 'latin1').get(this.buffer, 8).replace('\0', ' ').trim();
2160
- switch (brandMajor) {
2161
- case 'avif':
2162
- case 'avis':
2163
- return {ext: 'avif', mime: 'image/avif'};
2164
- case 'mif1':
2165
- return {ext: 'heic', mime: 'image/heif'};
2166
- case 'msf1':
2167
- return {ext: 'heic', mime: 'image/heif-sequence'};
2168
- case 'heic':
2169
- case 'heix':
2170
- return {ext: 'heic', mime: 'image/heic'};
2171
- case 'hevc':
2172
- case 'hevx':
2173
- return {ext: 'heic', mime: 'image/heic-sequence'};
2174
- case 'qt':
2175
- return {ext: 'mov', mime: 'video/quicktime'};
2176
- case 'M4V':
2177
- case 'M4VH':
2178
- case 'M4VP':
2179
- return {ext: 'm4v', mime: 'video/x-m4v'};
2180
- case 'M4P':
2181
- return {ext: 'm4p', mime: 'video/mp4'};
2182
- case 'M4B':
2183
- return {ext: 'm4b', mime: 'audio/mp4'};
2184
- case 'M4A':
2185
- return {ext: 'm4a', mime: 'audio/x-m4a'};
2186
- case 'F4V':
2187
- return {ext: 'f4v', mime: 'video/mp4'};
2188
- case 'F4P':
2189
- return {ext: 'f4p', mime: 'video/mp4'};
2190
- case 'F4A':
2191
- return {ext: 'f4a', mime: 'audio/mp4'};
2192
- case 'F4B':
2193
- return {ext: 'f4b', mime: 'audio/mp4'};
2194
- case 'crx':
2195
- return {ext: 'cr3', mime: 'image/x-canon-cr3'};
2196
- default:
2197
- if (brandMajor.startsWith('3g')) {
2198
- if (brandMajor.startsWith('3g2')) {
2199
- return {ext: '3g2', mime: 'video/3gpp2'};
2200
- }
2201
-
2202
- return {ext: '3gp', mime: 'video/3gpp'};
2203
- }
2204
-
2205
- return {ext: 'mp4', mime: 'video/mp4'};
2206
- }
2207
- }
2208
-
2209
- // -- 10-byte signatures --
2210
-
2211
- if (this.checkString('REGEDIT4\r\n')) {
2212
- return {
2213
- ext: 'reg',
2214
- mime: 'application/x-ms-regedit',
2215
- };
2216
- }
2217
-
2218
- // -- 12-byte signatures --
2219
-
2220
- // RIFF file format which might be AVI, WAV, QCP, etc
2221
- if (this.check([0x52, 0x49, 0x46, 0x46])) {
2222
- if (this.checkString('WEBP', {offset: 8})) {
2223
- return {
2224
- ext: 'webp',
2225
- mime: 'image/webp',
2226
- };
2227
- }
2228
-
2229
- if (this.check([0x41, 0x56, 0x49], {offset: 8})) {
2230
- return {
2231
- ext: 'avi',
2232
- mime: 'video/vnd.avi',
2233
- };
2234
- }
2235
-
2236
- if (this.check([0x57, 0x41, 0x56, 0x45], {offset: 8})) {
2237
- return {
2238
- ext: 'wav',
2239
- mime: 'audio/wav',
2240
- };
2241
- }
2242
-
2243
- // QLCM, QCP file
2244
- if (this.check([0x51, 0x4C, 0x43, 0x4D], {offset: 8})) {
2245
- return {
2246
- ext: 'qcp',
2247
- mime: 'audio/qcelp',
2248
- };
2249
- }
2250
- }
2251
-
2252
- if (this.check([0x49, 0x49, 0x55, 0x00, 0x18, 0x00, 0x00, 0x00, 0x88, 0xE7, 0x74, 0xD8])) {
2253
- return {
2254
- ext: 'rw2',
2255
- mime: 'image/x-panasonic-rw2',
2256
- };
2257
- }
2258
-
2259
- // ASF_Header_Object first 80 bytes
2260
- if (this.check([0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9])) {
2261
- let isMalformedAsf = false;
2262
- try {
2263
- async function readHeader() {
2264
- const guid = new Uint8Array(16);
2265
- await safeReadBuffer(tokenizer, guid, undefined, {
2266
- maximumLength: guid.length,
2267
- reason: 'ASF header GUID',
2268
- });
2269
- return {
2270
- id: guid,
2271
- size: Number(await tokenizer.readToken(Token.UINT64_LE)),
2272
- };
2273
- }
2274
-
2275
- await safeIgnore(tokenizer, 30, {
2276
- maximumLength: 30,
2277
- reason: 'ASF header prelude',
2278
- });
2279
- const isUnknownFileSize = hasUnknownFileSize(tokenizer);
2280
- const asfHeaderScanStart = tokenizer.position;
2281
- let asfHeaderObjectCount = 0;
2282
- while (tokenizer.position + 24 < tokenizer.fileInfo.size) {
2283
- asfHeaderObjectCount++;
2284
- if (asfHeaderObjectCount > maximumAsfHeaderObjectCount) {
2285
- break;
2286
- }
2287
-
2288
- if (hasExceededUnknownSizeScanBudget(tokenizer, asfHeaderScanStart, maximumUntrustedSkipSizeInBytes)) {
2289
- break;
2290
- }
2291
-
2292
- const previousPosition = tokenizer.position;
2293
- const header = await readHeader();
2294
- let payload = header.size - 24;
2295
- if (
2296
- !Number.isFinite(payload)
2297
- || payload < 0
2298
- ) {
2299
- isMalformedAsf = true;
2300
- break;
2301
- }
2302
-
2303
- if (_check(header.id, [0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65])) {
2304
- // Sync on Stream-Properties-Object (B7DC0791-A9B7-11CF-8EE6-00C00C205365)
2305
- const typeId = new Uint8Array(16);
2306
- payload -= await safeReadBuffer(tokenizer, typeId, undefined, {
2307
- maximumLength: typeId.length,
2308
- reason: 'ASF stream type GUID',
2309
- });
2310
-
2311
- if (_check(typeId, [0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) {
2312
- // Found audio:
2313
- return {
2314
- ext: 'asf',
2315
- mime: 'audio/x-ms-asf',
2316
- };
2317
- }
2318
-
2319
- if (_check(typeId, [0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B])) {
2320
- // Found video:
2321
- return {
2322
- ext: 'asf',
2323
- mime: 'video/x-ms-asf',
2324
- };
2325
- }
2326
-
2327
- break;
2328
- }
2329
-
2330
- if (
2331
- isUnknownFileSize
2332
- && payload > maximumAsfHeaderPayloadSizeInBytes
2333
- ) {
2334
- isMalformedAsf = true;
2335
- break;
2336
- }
2337
-
2338
- await safeIgnore(tokenizer, payload, {
2339
- maximumLength: isUnknownFileSize ? maximumAsfHeaderPayloadSizeInBytes : tokenizer.fileInfo.size,
2340
- reason: 'ASF header payload',
2341
- });
2342
-
2343
- // Safeguard against malformed files: break if the position did not advance.
2344
- if (tokenizer.position <= previousPosition) {
2345
- isMalformedAsf = true;
2346
- break;
2347
- }
2348
- }
2349
- } catch (error) {
2350
- if (
2351
- error instanceof strtok3.EndOfStreamError
2352
- || error instanceof ParserHardLimitError
2353
- ) {
2354
- if (hasUnknownFileSize(tokenizer)) {
2355
- isMalformedAsf = true;
2356
- }
2357
- } else {
2358
- throw error;
2359
- }
2360
- }
2361
-
2362
- if (isMalformedAsf) {
2363
- return;
2364
- }
2365
-
2366
- // Default to ASF generic extension
2367
- return {
2368
- ext: 'asf',
2369
- mime: 'application/vnd.ms-asf',
2370
- };
2371
- }
2372
-
2373
- if (this.check([0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A])) {
2374
- return {
2375
- ext: 'ktx',
2376
- mime: 'image/ktx',
2377
- };
2378
- }
2379
-
2380
- if ((this.check([0x7E, 0x10, 0x04]) || this.check([0x7E, 0x18, 0x04])) && this.check([0x30, 0x4D, 0x49, 0x45], {offset: 4})) {
2381
- return {
2382
- ext: 'mie',
2383
- mime: 'application/x-mie',
2384
- };
2385
- }
2386
-
2387
- if (this.check([0x27, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], {offset: 2})) {
2388
- return {
2389
- ext: 'shp',
2390
- mime: 'application/x-esri-shape',
2391
- };
2392
- }
2393
-
2394
- if (this.check([0xFF, 0x4F, 0xFF, 0x51])) {
2395
- return {
2396
- ext: 'j2c',
2397
- mime: 'image/j2c',
2398
- };
2399
- }
2400
-
2401
- if (this.check([0x00, 0x00, 0x00, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A])) {
2402
- // JPEG-2000 family
2403
-
2404
- await tokenizer.ignore(20);
2405
- const type = await tokenizer.readToken(new Token.StringType(4, 'ascii'));
2406
- switch (type) {
2407
- case 'jp2 ':
2408
- return {
2409
- ext: 'jp2',
2410
- mime: 'image/jp2',
2411
- };
2412
- case 'jpx ':
2413
- return {
2414
- ext: 'jpx',
2415
- mime: 'image/jpx',
2416
- };
2417
- case 'jpm ':
2418
- return {
2419
- ext: 'jpm',
2420
- mime: 'image/jpm',
2421
- };
2422
- case 'mjp2':
2423
- return {
2424
- ext: 'mj2',
2425
- mime: 'image/mj2',
2426
- };
2427
- default:
2428
- return;
2429
- }
2430
- }
2431
-
2432
- if (
2433
- this.check([0xFF, 0x0A])
2434
- || this.check([0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x4C, 0x20, 0x0D, 0x0A, 0x87, 0x0A])
2435
- ) {
2436
- return {
2437
- ext: 'jxl',
2438
- mime: 'image/jxl',
2439
- };
2440
- }
2441
-
2442
- if (this.check([0xFE, 0xFF])) { // UTF-16-BOM-BE
2443
- if (this.checkString('<?xml ', {offset: 2, encoding: 'utf-16be'})) {
2444
- return {
2445
- ext: 'xml',
2446
- mime: 'application/xml',
2447
- };
2448
- }
2449
-
2450
- return undefined; // Some unknown text based format
2451
- }
2452
-
2453
- if (this.check([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])) {
2454
- // Detected Microsoft Compound File Binary File (MS-CFB) Format.
2455
- return {
2456
- ext: 'cfb',
2457
- mime: 'application/x-cfb',
2458
- };
2459
- }
2460
-
2461
- // Increase sample size from 32 to 256.
2462
- await tokenizer.peekBuffer(this.buffer, {length: Math.min(256, tokenizer.fileInfo.size), mayBeLess: true});
2463
-
2464
- if (this.check([0x61, 0x63, 0x73, 0x70], {offset: 36})) {
2465
- return {
2466
- ext: 'icc',
2467
- mime: 'application/vnd.iccprofile',
2468
- };
2469
- }
2470
-
2471
- // ACE: requires 14 bytes in the buffer
2472
- if (this.checkString('**ACE', {offset: 7}) && this.checkString('**', {offset: 12})) {
2473
- return {
2474
- ext: 'ace',
2475
- mime: 'application/x-ace-compressed',
2476
- };
2477
- }
2478
-
2479
- // -- 15-byte signatures --
2480
-
2481
- if (this.checkString('BEGIN:')) {
2482
- if (this.checkString('VCARD', {offset: 6})) {
2483
- return {
2484
- ext: 'vcf',
2485
- mime: 'text/vcard',
2486
- };
2487
- }
2488
-
2489
- if (this.checkString('VCALENDAR', {offset: 6})) {
2490
- return {
2491
- ext: 'ics',
2492
- mime: 'text/calendar',
2493
- };
2494
- }
2495
- }
2496
-
2497
- // `raf` is here just to keep all the raw image detectors together.
2498
- if (this.checkString('FUJIFILMCCD-RAW')) {
2499
- return {
2500
- ext: 'raf',
2501
- mime: 'image/x-fujifilm-raf',
2502
- };
2503
- }
2504
-
2505
- if (this.checkString('Extended Module:')) {
2506
- return {
2507
- ext: 'xm',
2508
- mime: 'audio/x-xm',
2509
- };
2510
- }
2511
-
2512
- if (this.checkString('Creative Voice File')) {
2513
- return {
2514
- ext: 'voc',
2515
- mime: 'audio/x-voc',
2516
- };
2517
- }
2518
-
2519
- if (this.check([0x04, 0x00, 0x00, 0x00]) && this.buffer.length >= 16) { // Rough & quick check Pickle/ASAR
2520
- const jsonSize = new DataView(this.buffer.buffer).getUint32(12, true);
2521
-
2522
- if (jsonSize > 12 && this.buffer.length >= jsonSize + 16) {
2523
- try {
2524
- const header = new TextDecoder().decode(this.buffer.subarray(16, jsonSize + 16));
2525
- const json = JSON.parse(header);
2526
- // Check if Pickle is ASAR
2527
- if (json.files) { // Final check, assuring Pickle/ASAR format
2528
- return {
2529
- ext: 'asar',
2530
- mime: 'application/x-asar',
2531
- };
2532
- }
2533
- } catch {}
2534
- }
2535
- }
2536
-
2537
- if (this.check([0x06, 0x0E, 0x2B, 0x34, 0x02, 0x05, 0x01, 0x01, 0x0D, 0x01, 0x02, 0x01, 0x01, 0x02])) {
2538
- return {
2539
- ext: 'mxf',
2540
- mime: 'application/mxf',
2541
- };
2542
- }
2543
-
2544
- if (this.checkString('SCRM', {offset: 44})) {
2545
- return {
2546
- ext: 's3m',
2547
- mime: 'audio/x-s3m',
2548
- };
2549
- }
2550
-
2551
- // Raw MPEG-2 transport stream (188-byte packets)
2552
- if (this.check([0x47]) && this.check([0x47], {offset: 188})) {
2553
- return {
2554
- ext: 'mts',
2555
- mime: 'video/mp2t',
2556
- };
2557
- }
2558
-
2559
- // Blu-ray Disc Audio-Video (BDAV) MPEG-2 transport stream has 4-byte TP_extra_header before each 188-byte packet
2560
- if (this.check([0x47], {offset: 4}) && this.check([0x47], {offset: 196})) {
2561
- return {
2562
- ext: 'mts',
2563
- mime: 'video/mp2t',
2564
- };
2565
- }
2566
-
2567
- if (this.check([0x42, 0x4F, 0x4F, 0x4B, 0x4D, 0x4F, 0x42, 0x49], {offset: 60})) {
2568
- return {
2569
- ext: 'mobi',
2570
- mime: 'application/x-mobipocket-ebook',
2571
- };
2572
- }
2573
-
2574
- if (this.check([0x44, 0x49, 0x43, 0x4D], {offset: 128})) {
2575
- return {
2576
- ext: 'dcm',
2577
- mime: 'application/dicom',
2578
- };
2579
- }
2580
-
2581
- if (this.check([0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46])) {
2582
- return {
2583
- ext: 'lnk',
2584
- mime: 'application/x.ms.shortcut', // Invented by us
2585
- };
2586
- }
2587
-
2588
- if (this.check([0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00])) {
2589
- return {
2590
- ext: 'alias',
2591
- mime: 'application/x.apple.alias', // Invented by us
2592
- };
2593
- }
2594
-
2595
- if (this.checkString('Kaydara FBX Binary \u0000')) {
2596
- return {
2597
- ext: 'fbx',
2598
- mime: 'application/x.autodesk.fbx', // Invented by us
2599
- };
2600
- }
2601
-
2602
- if (
2603
- this.check([0x4C, 0x50], {offset: 34})
2604
- && (
2605
- this.check([0x00, 0x00, 0x01], {offset: 8})
2606
- || this.check([0x01, 0x00, 0x02], {offset: 8})
2607
- || this.check([0x02, 0x00, 0x02], {offset: 8})
2608
- )
2609
- ) {
2610
- return {
2611
- ext: 'eot',
2612
- mime: 'application/vnd.ms-fontobject',
2613
- };
2614
- }
2615
-
2616
- if (this.check([0x06, 0x06, 0xED, 0xF5, 0xD8, 0x1D, 0x46, 0xE5, 0xBD, 0x31, 0xEF, 0xE7, 0xFE, 0x74, 0xB7, 0x1D])) {
2617
- return {
2618
- ext: 'indd',
2619
- mime: 'application/x-indesign',
2620
- };
2621
- }
2622
-
2623
- // -- 16-byte signatures --
2624
-
2625
- // JMP files - check for both Little Endian and Big Endian signatures
2626
- if (this.check([0xFF, 0xFF, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00])
2627
- || this.check([0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01])) {
2628
- return {
2629
- ext: 'jmp',
2630
- mime: 'application/x-jmp-data',
2631
- };
2632
- }
2633
-
2634
- // Increase sample size from 256 to 512
2635
- await tokenizer.peekBuffer(this.buffer, {length: Math.min(512, tokenizer.fileInfo.size), mayBeLess: true});
2636
-
2637
- // Requires a buffer size of 512 bytes
2638
- if ((this.checkString('ustar', {offset: 257}) && (this.checkString('\0', {offset: 262}) || this.checkString(' ', {offset: 262})))
2639
- || (this.check([0, 0, 0, 0, 0, 0], {offset: 257}) && tarHeaderChecksumMatches(this.buffer))) {
2640
- return {
2641
- ext: 'tar',
2642
- mime: 'application/x-tar',
2643
- };
2644
- }
2645
-
2646
- if (this.check([0xFF, 0xFE])) { // UTF-16-BOM-LE
2647
- const encoding = 'utf-16le';
2648
- if (this.checkString('<?xml ', {offset: 2, encoding})) {
2649
- return {
2650
- ext: 'xml',
2651
- mime: 'application/xml',
2652
- };
2653
- }
2654
-
2655
- if (this.check([0xFF, 0x0E], {offset: 2}) && this.checkString('SketchUp Model', {offset: 4, encoding})) {
2656
- return {
2657
- ext: 'skp',
2658
- mime: 'application/vnd.sketchup.skp',
2659
- };
2660
- }
2661
-
2662
- if (this.checkString('Windows Registry Editor Version 5.00\r\n', {offset: 2, encoding})) {
2663
- return {
2664
- ext: 'reg',
2665
- mime: 'application/x-ms-regedit',
2666
- };
2667
- }
2668
-
2669
- return undefined; // Some text based format
2670
- }
2671
-
2672
- if (this.checkString('-----BEGIN PGP MESSAGE-----')) {
2673
- return {
2674
- ext: 'pgp',
2675
- mime: 'application/pgp-encrypted',
2676
- };
2677
- }
2678
- };
2679
- // Detections with limited supporting data, resulting in a higher likelihood of false positives
2680
- detectImprecise = async tokenizer => {
2681
- this.buffer = new Uint8Array(reasonableDetectionSizeInBytes);
2682
- const fileSize = getKnownFileSizeOrMaximum(tokenizer.fileInfo.size);
2683
-
2684
- // Read initial sample size of 8 bytes
2685
- await tokenizer.peekBuffer(this.buffer, {length: Math.min(8, fileSize), mayBeLess: true});
2686
-
2687
- if (
2688
- this.check([0x0, 0x0, 0x1, 0xBA])
2689
- || this.check([0x0, 0x0, 0x1, 0xB3])
2690
- ) {
2691
- return {
2692
- ext: 'mpg',
2693
- mime: 'video/mpeg',
2694
- };
2695
- }
2696
-
2697
- if (this.check([0x00, 0x01, 0x00, 0x00, 0x00])) {
2698
- return {
2699
- ext: 'ttf',
2700
- mime: 'font/ttf',
2701
- };
2702
- }
2703
-
2704
- if (this.check([0x00, 0x00, 0x01, 0x00])) {
2705
- return {
2706
- ext: 'ico',
2707
- mime: 'image/x-icon',
2708
- };
2709
- }
2710
-
2711
- if (this.check([0x00, 0x00, 0x02, 0x00])) {
2712
- return {
2713
- ext: 'cur',
2714
- mime: 'image/x-icon',
2715
- };
2716
- }
2717
-
2718
- // Adjust buffer to `mpegOffsetTolerance`
2719
- await tokenizer.peekBuffer(this.buffer, {length: Math.min(2 + this.options.mpegOffsetTolerance, fileSize), mayBeLess: true});
2720
-
2721
- // Check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE)
2722
- if (this.buffer.length >= (2 + this.options.mpegOffsetTolerance)) {
2723
- for (let depth = 0; depth <= this.options.mpegOffsetTolerance; ++depth) {
2724
- const type = this.scanMpeg(depth);
2725
- if (type) {
2726
- return type;
2727
- }
2728
- }
2729
- }
2730
- };
2731
-
2732
- async readTiffTag(bigEndian) {
2733
- const tagId = await this.tokenizer.readToken(bigEndian ? Token.UINT16_BE : Token.UINT16_LE);
2734
- await this.tokenizer.ignore(10);
2735
- switch (tagId) {
2736
- case 50_341:
2737
- return {
2738
- ext: 'arw',
2739
- mime: 'image/x-sony-arw',
2740
- };
2741
- case 50_706:
2742
- return {
2743
- ext: 'dng',
2744
- mime: 'image/x-adobe-dng',
2745
- };
2746
- default:
2747
- }
2748
- }
2749
-
2750
- async readTiffIFD(bigEndian) {
2751
- const numberOfTags = await this.tokenizer.readToken(bigEndian ? Token.UINT16_BE : Token.UINT16_LE);
2752
- if (numberOfTags > maximumTiffTagCount) {
2753
- return;
2754
- }
2755
-
2756
- if (
2757
- hasUnknownFileSize(this.tokenizer)
2758
- && (2 + (numberOfTags * 12)) > maximumTiffIfdOffsetInBytes
2759
- ) {
2760
- return;
2761
- }
2762
-
2763
- for (let n = 0; n < numberOfTags; ++n) {
2764
- const fileType = await this.readTiffTag(bigEndian);
2765
- if (fileType) {
2766
- return fileType;
2767
- }
2768
- }
2769
- }
2770
-
2771
- async readTiffHeader(bigEndian) {
2772
- const tiffFileType = {
2773
- ext: 'tif',
2774
- mime: 'image/tiff',
2775
- };
2776
-
2777
- const version = (bigEndian ? Token.UINT16_BE : Token.UINT16_LE).get(this.buffer, 2);
2778
- const ifdOffset = (bigEndian ? Token.UINT32_BE : Token.UINT32_LE).get(this.buffer, 4);
2779
-
2780
- if (version === 42) {
2781
- // TIFF file header
2782
- if (ifdOffset >= 6) {
2783
- if (this.checkString('CR', {offset: 8})) {
2784
- return {
2785
- ext: 'cr2',
2786
- mime: 'image/x-canon-cr2',
2787
- };
2788
- }
2789
-
2790
- if (ifdOffset >= 8) {
2791
- const someId1 = (bigEndian ? Token.UINT16_BE : Token.UINT16_LE).get(this.buffer, 8);
2792
- const someId2 = (bigEndian ? Token.UINT16_BE : Token.UINT16_LE).get(this.buffer, 10);
2793
-
2794
- if (
2795
- (someId1 === 0x1C && someId2 === 0xFE)
2796
- || (someId1 === 0x1F && someId2 === 0x0B)) {
2797
- return {
2798
- ext: 'nef',
2799
- mime: 'image/x-nikon-nef',
2800
- };
2801
- }
2802
- }
2803
- }
2804
-
2805
- if (
2806
- hasUnknownFileSize(this.tokenizer)
2807
- && ifdOffset > maximumTiffStreamIfdOffsetInBytes
2808
- ) {
2809
- return tiffFileType;
2810
- }
2811
-
2812
- const maximumTiffOffset = hasUnknownFileSize(this.tokenizer) ? maximumTiffIfdOffsetInBytes : this.tokenizer.fileInfo.size;
2813
-
2814
- try {
2815
- await safeIgnore(this.tokenizer, ifdOffset, {
2816
- maximumLength: maximumTiffOffset,
2817
- reason: 'TIFF IFD offset',
2818
- });
2819
- } catch (error) {
2820
- if (error instanceof strtok3.EndOfStreamError) {
2821
- return;
2822
- }
2823
-
2824
- throw error;
2825
- }
2826
-
2827
- let fileType;
2828
- try {
2829
- fileType = await this.readTiffIFD(bigEndian);
2830
- } catch (error) {
2831
- if (error instanceof strtok3.EndOfStreamError) {
2832
- return;
2833
- }
2834
-
2835
- throw error;
2836
- }
2837
-
2838
- return fileType ?? tiffFileType;
2839
- }
2840
-
2841
- if (version === 43) { // Big TIFF file header
2842
- return tiffFileType;
2843
- }
2844
- }
2845
-
2846
- /**
2847
- Scan check MPEG 1 or 2 Layer 3 header, or 'layer 0' for ADTS (MPEG sync-word 0xFFE).
2848
-
2849
- @param offset - Offset to scan for sync-preamble.
2850
- @returns {{ext: string, mime: string}}
2851
- */
2852
- scanMpeg(offset) {
2853
- if (this.check([0xFF, 0xE0], {offset, mask: [0xFF, 0xE0]})) {
2854
- if (this.check([0x10], {offset: offset + 1, mask: [0x16]})) {
2855
- // Check for (ADTS) MPEG-2
2856
- if (this.check([0x08], {offset: offset + 1, mask: [0x08]})) {
2857
- return {
2858
- ext: 'aac',
2859
- mime: 'audio/aac',
2860
- };
2861
- }
2862
-
2863
- // Must be (ADTS) MPEG-4
2864
- return {
2865
- ext: 'aac',
2866
- mime: 'audio/aac',
2867
- };
2868
- }
2869
-
2870
- // MPEG 1 or 2 Layer 3 header
2871
- // Check for MPEG layer 3
2872
- if (this.check([0x02], {offset: offset + 1, mask: [0x06]})) {
2873
- return {
2874
- ext: 'mp3',
2875
- mime: 'audio/mpeg',
2876
- };
2877
- }
2878
-
2879
- // Check for MPEG layer 2
2880
- if (this.check([0x04], {offset: offset + 1, mask: [0x06]})) {
2881
- return {
2882
- ext: 'mp2',
2883
- mime: 'audio/mpeg',
2884
- };
2885
- }
2886
-
2887
- // Check for MPEG layer 1
2888
- if (this.check([0x06], {offset: offset + 1, mask: [0x06]})) {
2889
- return {
2890
- ext: 'mp1',
2891
- mime: 'audio/mpeg',
2892
- };
2893
- }
2894
- }
2895
- }
2896
- }
2897
-
2898
- export const supportedExtensions = new Set(extensions);
2899
- export const supportedMimeTypes = new Set(mimeTypes);