@jointhedots/gear 1.0.21 → 1.1.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 (334) hide show
  1. package/browser-modules/asap-raw.js +79 -0
  2. package/browser-modules/asap.js +57 -0
  3. package/browser-modules/buffer.js +3 -1
  4. package/browser-modules/child_process.js +145 -0
  5. package/browser-modules/events.js +200 -0
  6. package/browser-modules/side-effects.js +7 -0
  7. package/browser-modules/stream.js +323 -0
  8. package/browser-modules/util.js +170 -0
  9. package/browser-modules/worker_threads.js +85 -0
  10. package/esm/builder/build-app-bundle.js +185 -0
  11. package/esm/builder/build-app-bundle.js.map +1 -0
  12. package/esm/builder/build-app-host.js +170 -0
  13. package/esm/builder/build-app-host.js.map +1 -0
  14. package/esm/builder/build-application.js +219 -63
  15. package/esm/builder/build-application.js.map +1 -1
  16. package/esm/builder/build-library.js +17 -33
  17. package/esm/builder/build-library.js.map +1 -1
  18. package/esm/builder/build-target.js +45 -76
  19. package/esm/builder/build-target.js.map +1 -1
  20. package/esm/builder/emit-dts.js +110 -87
  21. package/esm/builder/emit-dts.js.map +1 -1
  22. package/esm/builder/esbuild-plugins.js +256 -59
  23. package/esm/builder/esbuild-plugins.js.map +1 -1
  24. package/esm/builder/helpers/path-helpers.js +95 -0
  25. package/esm/builder/helpers/path-helpers.js.map +1 -0
  26. package/esm/cli.js +0 -1
  27. package/esm/cli.js.map +1 -1
  28. package/esm/commands/init.js +1 -0
  29. package/esm/commands/init.js.map +1 -1
  30. package/esm/commands/make.js +52 -9
  31. package/esm/commands/make.js.map +1 -1
  32. package/esm/commands/publish.js +1 -0
  33. package/esm/commands/publish.js.map +1 -1
  34. package/esm/commands/run.js +1 -0
  35. package/esm/commands/run.js.map +1 -1
  36. package/esm/commands/serve.js +42 -9
  37. package/esm/commands/serve.js.map +1 -1
  38. package/esm/model/component.js +4 -8
  39. package/esm/model/component.js.map +1 -1
  40. package/esm/model/helpers/create-manifests.js +73 -0
  41. package/esm/model/helpers/create-manifests.js.map +1 -0
  42. package/esm/model/helpers/discover-workspace.js +227 -0
  43. package/esm/model/helpers/discover-workspace.js.map +1 -0
  44. package/esm/model/helpers/logger.js +116 -0
  45. package/esm/model/helpers/logger.js.map +1 -0
  46. package/esm/model/storage.js +82 -24
  47. package/esm/model/storage.js.map +1 -1
  48. package/esm/model/workspace.js +97 -147
  49. package/esm/model/workspace.js.map +1 -1
  50. package/esm/publish/publish_aws_s3.js +1 -0
  51. package/esm/publish/publish_aws_s3.js.map +1 -1
  52. package/esm/utils/file.js +10 -2
  53. package/esm/utils/file.js.map +1 -1
  54. package/esm/utils/graph-ordering.js +86 -0
  55. package/esm/utils/graph-ordering.js.map +1 -0
  56. package/esm/utils/normalized-name.js +94 -0
  57. package/esm/utils/normalized-name.js.map +1 -0
  58. package/node_modules/@jspm/core/.github/workflows/ci.yml +64 -0
  59. package/node_modules/@jspm/core/LICENSE +796 -0
  60. package/node_modules/@jspm/core/README.md +11 -0
  61. package/node_modules/@jspm/core/chompfile.toml +28 -0
  62. package/node_modules/@jspm/core/generate-node-libs.mjs +10 -0
  63. package/node_modules/@jspm/core/nodelibs/@empty.dew.js +7 -0
  64. package/node_modules/@jspm/core/nodelibs/@empty.js +3 -0
  65. package/node_modules/@jspm/core/nodelibs/browser/_stream_duplex.js +13 -0
  66. package/node_modules/@jspm/core/nodelibs/browser/_stream_passthrough.js +12 -0
  67. package/node_modules/@jspm/core/nodelibs/browser/_stream_readable.js +14 -0
  68. package/node_modules/@jspm/core/nodelibs/browser/_stream_transform.js +12 -0
  69. package/node_modules/@jspm/core/nodelibs/browser/_stream_writable.js +13 -0
  70. package/node_modules/@jspm/core/nodelibs/browser/assert/strict.js +29 -0
  71. package/node_modules/@jspm/core/nodelibs/browser/assert.js +2574 -0
  72. package/node_modules/@jspm/core/nodelibs/browser/async_hooks.js +14 -0
  73. package/node_modules/@jspm/core/nodelibs/browser/buffer.js +10 -0
  74. package/node_modules/@jspm/core/nodelibs/browser/child_process.js +17 -0
  75. package/node_modules/@jspm/core/nodelibs/browser/chunk-B6-G-Ftj.js +158 -0
  76. package/node_modules/@jspm/core/nodelibs/browser/chunk-B738Er4n.js +5524 -0
  77. package/node_modules/@jspm/core/nodelibs/browser/chunk-BlJi4mNy.js +448 -0
  78. package/node_modules/@jspm/core/nodelibs/browser/chunk-BsRZ0PEC.js +74 -0
  79. package/node_modules/@jspm/core/nodelibs/browser/chunk-C4rKjYLo.js +20 -0
  80. package/node_modules/@jspm/core/nodelibs/browser/chunk-CbQqNoLO.js +32 -0
  81. package/node_modules/@jspm/core/nodelibs/browser/chunk-CcCWfKp1.js +360 -0
  82. package/node_modules/@jspm/core/nodelibs/browser/chunk-CjPlbOtt.js +47 -0
  83. package/node_modules/@jspm/core/nodelibs/browser/chunk-CkFCi-G1.js +36 -0
  84. package/node_modules/@jspm/core/nodelibs/browser/chunk-D3uu3VYh.js +33 -0
  85. package/node_modules/@jspm/core/nodelibs/browser/chunk-DEMDiNwt.js +275 -0
  86. package/node_modules/@jspm/core/nodelibs/browser/chunk-DHWh-hmB.js +1344 -0
  87. package/node_modules/@jspm/core/nodelibs/browser/chunk-DtDiafJB.js +96 -0
  88. package/node_modules/@jspm/core/nodelibs/browser/chunk-DtcTpLWz.js +826 -0
  89. package/node_modules/@jspm/core/nodelibs/browser/chunk-DtuTasat.js +1923 -0
  90. package/node_modules/@jspm/core/nodelibs/browser/chunk-b0rmRow7.js +246 -0
  91. package/node_modules/@jspm/core/nodelibs/browser/chunk-tHuMsdT0.js +8 -0
  92. package/node_modules/@jspm/core/nodelibs/browser/cluster.js +33 -0
  93. package/node_modules/@jspm/core/nodelibs/browser/console.js +103 -0
  94. package/node_modules/@jspm/core/nodelibs/browser/constants.js +419 -0
  95. package/node_modules/@jspm/core/nodelibs/browser/crypto.js +109730 -0
  96. package/node_modules/@jspm/core/nodelibs/browser/dgram.js +11 -0
  97. package/node_modules/@jspm/core/nodelibs/browser/diagnostics_channel.js +153 -0
  98. package/node_modules/@jspm/core/nodelibs/browser/dns/promises.js +26 -0
  99. package/node_modules/@jspm/core/nodelibs/browser/dns.js +101 -0
  100. package/node_modules/@jspm/core/nodelibs/browser/domain.js +77 -0
  101. package/node_modules/@jspm/core/nodelibs/browser/events.js +491 -0
  102. package/node_modules/@jspm/core/nodelibs/browser/fs/promises.js +50 -0
  103. package/node_modules/@jspm/core/nodelibs/browser/fs.js +4139 -0
  104. package/node_modules/@jspm/core/nodelibs/browser/http.js +3513 -0
  105. package/node_modules/@jspm/core/nodelibs/browser/http2.js +88 -0
  106. package/node_modules/@jspm/core/nodelibs/browser/https.js +873 -0
  107. package/node_modules/@jspm/core/nodelibs/browser/module.js +58 -0
  108. package/node_modules/@jspm/core/nodelibs/browser/net.js +20 -0
  109. package/node_modules/@jspm/core/nodelibs/browser/os.js +94 -0
  110. package/node_modules/@jspm/core/nodelibs/browser/path/posix.js +40 -0
  111. package/node_modules/@jspm/core/nodelibs/browser/path/win32.js +27 -0
  112. package/node_modules/@jspm/core/nodelibs/browser/path.js +20 -0
  113. package/node_modules/@jspm/core/nodelibs/browser/perf_hooks.js +30 -0
  114. package/node_modules/@jspm/core/nodelibs/browser/process-production.js +274 -0
  115. package/node_modules/@jspm/core/nodelibs/browser/process.js +277 -0
  116. package/node_modules/@jspm/core/nodelibs/browser/punycode.js +436 -0
  117. package/node_modules/@jspm/core/nodelibs/browser/querystring.js +118 -0
  118. package/node_modules/@jspm/core/nodelibs/browser/readline.js +15 -0
  119. package/node_modules/@jspm/core/nodelibs/browser/repl.js +21 -0
  120. package/node_modules/@jspm/core/nodelibs/browser/stream/consumers.js +61 -0
  121. package/node_modules/@jspm/core/nodelibs/browser/stream/promises.js +12 -0
  122. package/node_modules/@jspm/core/nodelibs/browser/stream/web.js +35 -0
  123. package/node_modules/@jspm/core/nodelibs/browser/stream.js +6574 -0
  124. package/node_modules/@jspm/core/nodelibs/browser/string_decoder.js +2 -0
  125. package/node_modules/@jspm/core/nodelibs/browser/sys.js +9 -0
  126. package/node_modules/@jspm/core/nodelibs/browser/timers/promises.js +17 -0
  127. package/node_modules/@jspm/core/nodelibs/browser/timers.js +256 -0
  128. package/node_modules/@jspm/core/nodelibs/browser/tls.js +34 -0
  129. package/node_modules/@jspm/core/nodelibs/browser/tty.js +20 -0
  130. package/node_modules/@jspm/core/nodelibs/browser/url.js +2361 -0
  131. package/node_modules/@jspm/core/nodelibs/browser/util/types.js +51 -0
  132. package/node_modules/@jspm/core/nodelibs/browser/util.js +1345 -0
  133. package/node_modules/@jspm/core/nodelibs/browser/v8.js +21 -0
  134. package/node_modules/@jspm/core/nodelibs/browser/vm.js +139 -0
  135. package/node_modules/@jspm/core/nodelibs/browser/wasi.js +160 -0
  136. package/node_modules/@jspm/core/nodelibs/browser/worker_threads.js +140 -0
  137. package/node_modules/@jspm/core/nodelibs/browser/zlib.js +6545 -0
  138. package/node_modules/@jspm/core/nodelibs/deno/_stream_duplex.ts +5 -0
  139. package/node_modules/@jspm/core/nodelibs/deno/_stream_passthrough.ts +1 -0
  140. package/node_modules/@jspm/core/nodelibs/deno/_stream_readable.ts +5 -0
  141. package/node_modules/@jspm/core/nodelibs/deno/_stream_transform.ts +1 -0
  142. package/node_modules/@jspm/core/nodelibs/deno/_stream_writable.ts +5 -0
  143. package/node_modules/@jspm/core/nodelibs/deno/assert/strict.ts +2 -0
  144. package/node_modules/@jspm/core/nodelibs/deno/assert.ts +2 -0
  145. package/node_modules/@jspm/core/nodelibs/deno/async_hooks.ts +2 -0
  146. package/node_modules/@jspm/core/nodelibs/deno/buffer.ts +5 -0
  147. package/node_modules/@jspm/core/nodelibs/deno/child_process.ts +2 -0
  148. package/node_modules/@jspm/core/nodelibs/deno/cluster.ts +2 -0
  149. package/node_modules/@jspm/core/nodelibs/deno/console.ts +2 -0
  150. package/node_modules/@jspm/core/nodelibs/deno/constants.ts +2 -0
  151. package/node_modules/@jspm/core/nodelibs/deno/crypto.ts +2 -0
  152. package/node_modules/@jspm/core/nodelibs/deno/dgram.ts +2 -0
  153. package/node_modules/@jspm/core/nodelibs/deno/diagnostics_channel.ts +2 -0
  154. package/node_modules/@jspm/core/nodelibs/deno/dns/promises.ts +2 -0
  155. package/node_modules/@jspm/core/nodelibs/deno/dns.ts +2 -0
  156. package/node_modules/@jspm/core/nodelibs/deno/domain.ts +2 -0
  157. package/node_modules/@jspm/core/nodelibs/deno/events.ts +2 -0
  158. package/node_modules/@jspm/core/nodelibs/deno/fs/promises.ts +2 -0
  159. package/node_modules/@jspm/core/nodelibs/deno/fs.ts +2 -0
  160. package/node_modules/@jspm/core/nodelibs/deno/http.ts +2 -0
  161. package/node_modules/@jspm/core/nodelibs/deno/http2.ts +2 -0
  162. package/node_modules/@jspm/core/nodelibs/deno/https.ts +2 -0
  163. package/node_modules/@jspm/core/nodelibs/deno/inspector.ts +2 -0
  164. package/node_modules/@jspm/core/nodelibs/deno/module.ts +2 -0
  165. package/node_modules/@jspm/core/nodelibs/deno/net.ts +2 -0
  166. package/node_modules/@jspm/core/nodelibs/deno/os.ts +2 -0
  167. package/node_modules/@jspm/core/nodelibs/deno/path/posix.ts +2 -0
  168. package/node_modules/@jspm/core/nodelibs/deno/path/win32.ts +2 -0
  169. package/node_modules/@jspm/core/nodelibs/deno/path.ts +2 -0
  170. package/node_modules/@jspm/core/nodelibs/deno/perf_hooks.ts +2 -0
  171. package/node_modules/@jspm/core/nodelibs/deno/process-production.ts +4 -0
  172. package/node_modules/@jspm/core/nodelibs/deno/process.ts +2 -0
  173. package/node_modules/@jspm/core/nodelibs/deno/punycode.ts +2 -0
  174. package/node_modules/@jspm/core/nodelibs/deno/querystring.ts +2 -0
  175. package/node_modules/@jspm/core/nodelibs/deno/readline/promises.ts +2 -0
  176. package/node_modules/@jspm/core/nodelibs/deno/readline.ts +2 -0
  177. package/node_modules/@jspm/core/nodelibs/deno/repl.ts +2 -0
  178. package/node_modules/@jspm/core/nodelibs/deno/stream/consumers.ts +2 -0
  179. package/node_modules/@jspm/core/nodelibs/deno/stream/promises.ts +2 -0
  180. package/node_modules/@jspm/core/nodelibs/deno/stream/web.ts +2 -0
  181. package/node_modules/@jspm/core/nodelibs/deno/stream.ts +2 -0
  182. package/node_modules/@jspm/core/nodelibs/deno/string_decoder.ts +2 -0
  183. package/node_modules/@jspm/core/nodelibs/deno/timers/promises.ts +2 -0
  184. package/node_modules/@jspm/core/nodelibs/deno/timers.ts +2 -0
  185. package/node_modules/@jspm/core/nodelibs/deno/tls.ts +2 -0
  186. package/node_modules/@jspm/core/nodelibs/deno/tty.ts +2 -0
  187. package/node_modules/@jspm/core/nodelibs/deno/url.ts +2 -0
  188. package/node_modules/@jspm/core/nodelibs/deno/util/types.ts +2 -0
  189. package/node_modules/@jspm/core/nodelibs/deno/util.ts +2 -0
  190. package/node_modules/@jspm/core/nodelibs/deno/v8.ts +2 -0
  191. package/node_modules/@jspm/core/nodelibs/deno/vm.ts +2 -0
  192. package/node_modules/@jspm/core/nodelibs/deno/wasi.ts +2 -0
  193. package/node_modules/@jspm/core/nodelibs/deno/worker_threads.ts +2 -0
  194. package/node_modules/@jspm/core/nodelibs/deno/zlib.ts +2 -0
  195. package/node_modules/@jspm/core/nodelibs/node/_http_agent.js +2 -0
  196. package/node_modules/@jspm/core/nodelibs/node/_http_client.js +2 -0
  197. package/node_modules/@jspm/core/nodelibs/node/_http_common.js +2 -0
  198. package/node_modules/@jspm/core/nodelibs/node/_http_incoming.js +2 -0
  199. package/node_modules/@jspm/core/nodelibs/node/_http_outgoing.js +2 -0
  200. package/node_modules/@jspm/core/nodelibs/node/_http_server.js +2 -0
  201. package/node_modules/@jspm/core/nodelibs/node/_stream_duplex.js +2 -0
  202. package/node_modules/@jspm/core/nodelibs/node/_stream_passthrough.js +2 -0
  203. package/node_modules/@jspm/core/nodelibs/node/_stream_readable.js +2 -0
  204. package/node_modules/@jspm/core/nodelibs/node/_stream_transform.js +2 -0
  205. package/node_modules/@jspm/core/nodelibs/node/_stream_wrap.js +2 -0
  206. package/node_modules/@jspm/core/nodelibs/node/_stream_writable.js +2 -0
  207. package/node_modules/@jspm/core/nodelibs/node/_tls_common.js +2 -0
  208. package/node_modules/@jspm/core/nodelibs/node/_tls_wrap.js +2 -0
  209. package/node_modules/@jspm/core/nodelibs/node/assert/strict.js +2 -0
  210. package/node_modules/@jspm/core/nodelibs/node/assert.js +2 -0
  211. package/node_modules/@jspm/core/nodelibs/node/async_hooks.js +2 -0
  212. package/node_modules/@jspm/core/nodelibs/node/buffer.js +2 -0
  213. package/node_modules/@jspm/core/nodelibs/node/child_process.js +2 -0
  214. package/node_modules/@jspm/core/nodelibs/node/cluster.js +2 -0
  215. package/node_modules/@jspm/core/nodelibs/node/console.js +2 -0
  216. package/node_modules/@jspm/core/nodelibs/node/constants.js +2 -0
  217. package/node_modules/@jspm/core/nodelibs/node/crypto.js +2 -0
  218. package/node_modules/@jspm/core/nodelibs/node/dgram.js +2 -0
  219. package/node_modules/@jspm/core/nodelibs/node/diagnostics_channel.js +2 -0
  220. package/node_modules/@jspm/core/nodelibs/node/dns/promises.js +2 -0
  221. package/node_modules/@jspm/core/nodelibs/node/dns.js +2 -0
  222. package/node_modules/@jspm/core/nodelibs/node/domain.js +2 -0
  223. package/node_modules/@jspm/core/nodelibs/node/events.js +2 -0
  224. package/node_modules/@jspm/core/nodelibs/node/fs/promises.js +2 -0
  225. package/node_modules/@jspm/core/nodelibs/node/fs.js +2 -0
  226. package/node_modules/@jspm/core/nodelibs/node/http.js +2 -0
  227. package/node_modules/@jspm/core/nodelibs/node/http2.js +2 -0
  228. package/node_modules/@jspm/core/nodelibs/node/https.js +2 -0
  229. package/node_modules/@jspm/core/nodelibs/node/inspector/promises.js +2 -0
  230. package/node_modules/@jspm/core/nodelibs/node/inspector.js +2 -0
  231. package/node_modules/@jspm/core/nodelibs/node/module.js +2 -0
  232. package/node_modules/@jspm/core/nodelibs/node/net.js +2 -0
  233. package/node_modules/@jspm/core/nodelibs/node/os.js +2 -0
  234. package/node_modules/@jspm/core/nodelibs/node/path/posix.js +2 -0
  235. package/node_modules/@jspm/core/nodelibs/node/path/win32.js +2 -0
  236. package/node_modules/@jspm/core/nodelibs/node/path.js +2 -0
  237. package/node_modules/@jspm/core/nodelibs/node/perf_hooks.js +2 -0
  238. package/node_modules/@jspm/core/nodelibs/node/process-production.js +4 -0
  239. package/node_modules/@jspm/core/nodelibs/node/process.js +2 -0
  240. package/node_modules/@jspm/core/nodelibs/node/punycode.js +2 -0
  241. package/node_modules/@jspm/core/nodelibs/node/querystring.js +2 -0
  242. package/node_modules/@jspm/core/nodelibs/node/readline/promises.js +2 -0
  243. package/node_modules/@jspm/core/nodelibs/node/readline.js +2 -0
  244. package/node_modules/@jspm/core/nodelibs/node/repl.js +2 -0
  245. package/node_modules/@jspm/core/nodelibs/node/stream/consumers.js +2 -0
  246. package/node_modules/@jspm/core/nodelibs/node/stream/promises.js +2 -0
  247. package/node_modules/@jspm/core/nodelibs/node/stream/web.js +2 -0
  248. package/node_modules/@jspm/core/nodelibs/node/stream.js +2 -0
  249. package/node_modules/@jspm/core/nodelibs/node/string_decoder.js +2 -0
  250. package/node_modules/@jspm/core/nodelibs/node/sys.js +2 -0
  251. package/node_modules/@jspm/core/nodelibs/node/timers/promises.js +2 -0
  252. package/node_modules/@jspm/core/nodelibs/node/timers.js +2 -0
  253. package/node_modules/@jspm/core/nodelibs/node/tls.js +2 -0
  254. package/node_modules/@jspm/core/nodelibs/node/trace_events.js +2 -0
  255. package/node_modules/@jspm/core/nodelibs/node/tty.js +2 -0
  256. package/node_modules/@jspm/core/nodelibs/node/url.js +2 -0
  257. package/node_modules/@jspm/core/nodelibs/node/util/types.js +2 -0
  258. package/node_modules/@jspm/core/nodelibs/node/util.js +2 -0
  259. package/node_modules/@jspm/core/nodelibs/node/v8.js +2 -0
  260. package/node_modules/@jspm/core/nodelibs/node/vm.js +2 -0
  261. package/node_modules/@jspm/core/nodelibs/node/wasi.js +2 -0
  262. package/node_modules/@jspm/core/nodelibs/node/worker_threads.js +2 -0
  263. package/node_modules/@jspm/core/nodelibs/node/zlib.js +2 -0
  264. package/node_modules/@jspm/core/package.json +75 -0
  265. package/node_modules/@jspm/core/rollup.config.mjs +55 -0
  266. package/node_modules/@jspm/core/src-browser/__tty.js +11 -0
  267. package/node_modules/@jspm/core/src-browser/_stream_duplex.js +3 -0
  268. package/node_modules/@jspm/core/src-browser/_stream_passthrough.js +2 -0
  269. package/node_modules/@jspm/core/src-browser/_stream_readable.js +5 -0
  270. package/node_modules/@jspm/core/src-browser/_stream_transform.js +2 -0
  271. package/node_modules/@jspm/core/src-browser/_stream_writable.js +3 -0
  272. package/node_modules/@jspm/core/src-browser/assert/strict.js +26 -0
  273. package/node_modules/@jspm/core/src-browser/assert.js +19 -0
  274. package/node_modules/@jspm/core/src-browser/async_hooks.js +21 -0
  275. package/node_modules/@jspm/core/src-browser/buffer.js +5 -0
  276. package/node_modules/@jspm/core/src-browser/child_process.js +27 -0
  277. package/node_modules/@jspm/core/src-browser/cluster.js +38 -0
  278. package/node_modules/@jspm/core/src-browser/console.js +25 -0
  279. package/node_modules/@jspm/core/src-browser/constants.js +209 -0
  280. package/node_modules/@jspm/core/src-browser/crypto.js +63 -0
  281. package/node_modules/@jspm/core/src-browser/dgram.js +15 -0
  282. package/node_modules/@jspm/core/src-browser/diagnostics_channel.js +6 -0
  283. package/node_modules/@jspm/core/src-browser/dns/promises.js +45 -0
  284. package/node_modules/@jspm/core/src-browser/dns.js +121 -0
  285. package/node_modules/@jspm/core/src-browser/domain.js +4 -0
  286. package/node_modules/@jspm/core/src-browser/events.js +105 -0
  287. package/node_modules/@jspm/core/src-browser/fs/promises.js +34 -0
  288. package/node_modules/@jspm/core/src-browser/fs.js +209 -0
  289. package/node_modules/@jspm/core/src-browser/http.js +10 -0
  290. package/node_modules/@jspm/core/src-browser/http2.js +86 -0
  291. package/node_modules/@jspm/core/src-browser/https.js +10 -0
  292. package/node_modules/@jspm/core/src-browser/module.js +75 -0
  293. package/node_modules/@jspm/core/src-browser/net.js +33 -0
  294. package/node_modules/@jspm/core/src-browser/os.js +35 -0
  295. package/node_modules/@jspm/core/src-browser/path/posix.js +38 -0
  296. package/node_modules/@jspm/core/src-browser/path/win32.js +42 -0
  297. package/node_modules/@jspm/core/src-browser/path.js +17 -0
  298. package/node_modules/@jspm/core/src-browser/perf_hooks.js +30 -0
  299. package/node_modules/@jspm/core/src-browser/process-production.js +279 -0
  300. package/node_modules/@jspm/core/src-browser/process.js +282 -0
  301. package/node_modules/@jspm/core/src-browser/punycode.js +8 -0
  302. package/node_modules/@jspm/core/src-browser/querystring.js +6 -0
  303. package/node_modules/@jspm/core/src-browser/readline.js +23 -0
  304. package/node_modules/@jspm/core/src-browser/repl.js +26 -0
  305. package/node_modules/@jspm/core/src-browser/stream/consumers.js +57 -0
  306. package/node_modules/@jspm/core/src-browser/stream/promises.js +4 -0
  307. package/node_modules/@jspm/core/src-browser/stream/web.js +33 -0
  308. package/node_modules/@jspm/core/src-browser/stream.js +26 -0
  309. package/node_modules/@jspm/core/src-browser/string_decoder.js +3 -0
  310. package/node_modules/@jspm/core/src-browser/sys.js +3 -0
  311. package/node_modules/@jspm/core/src-browser/timers/promises.js +12 -0
  312. package/node_modules/@jspm/core/src-browser/timers.js +13 -0
  313. package/node_modules/@jspm/core/src-browser/tls.js +46 -0
  314. package/node_modules/@jspm/core/src-browser/tty.js +3 -0
  315. package/node_modules/@jspm/core/src-browser/url.js +154 -0
  316. package/node_modules/@jspm/core/src-browser/util/types.js +48 -0
  317. package/node_modules/@jspm/core/src-browser/util.js +30 -0
  318. package/node_modules/@jspm/core/src-browser/v8.js +35 -0
  319. package/node_modules/@jspm/core/src-browser/vm.js +9 -0
  320. package/node_modules/@jspm/core/src-browser/wasi.js +15 -0
  321. package/node_modules/@jspm/core/src-browser/worker_threads.js +139 -0
  322. package/node_modules/@jspm/core/src-browser/zlib.js +71 -0
  323. package/node_modules/@jspm/core/test/chrome-worker_threads.test.js +14 -0
  324. package/node_modules/@jspm/core/test/cowsay.wasm +0 -0
  325. package/node_modules/@jspm/core/test/exports.test.js +99 -0
  326. package/node_modules/@jspm/core/test/fs.test.js +13 -0
  327. package/node_modules/@jspm/core/test/os.test.js +7 -0
  328. package/node_modules/@jspm/core/test/process.test.js +15 -0
  329. package/node_modules/@jspm/core/test/server.js +177 -0
  330. package/node_modules/@jspm/core/test/test.html +29 -0
  331. package/node_modules/@jspm/core/test/wasi.test.js +13 -0
  332. package/package.json +38 -24
  333. package/esm/utils/helpers.js +0 -32
  334. package/esm/utils/helpers.js.map +0 -1
@@ -0,0 +1,2361 @@
1
+ import exports$9 from './punycode.js';
2
+ import { g as dew$8, a as dew$9, h as dew$a } from './chunk-DtcTpLWz.js';
3
+ import { e as exports$a } from './chunk-BlJi4mNy.js';
4
+ import './chunk-DEMDiNwt.js';
5
+
6
+ var empty = Object.freeze(Object.create(null));
7
+
8
+ var exports$8 = {},
9
+ _dewExec$7 = false;
10
+ var _global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
11
+ function dew$7() {
12
+ if (_dewExec$7) return exports$8;
13
+ _dewExec$7 = true;
14
+ var hasMap = typeof Map === "function" && Map.prototype;
15
+ var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null;
16
+ var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === "function" ? mapSizeDescriptor.get : null;
17
+ var mapForEach = hasMap && Map.prototype.forEach;
18
+ var hasSet = typeof Set === "function" && Set.prototype;
19
+ var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null;
20
+ var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === "function" ? setSizeDescriptor.get : null;
21
+ var setForEach = hasSet && Set.prototype.forEach;
22
+ var hasWeakMap = typeof WeakMap === "function" && WeakMap.prototype;
23
+ var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
24
+ var hasWeakSet = typeof WeakSet === "function" && WeakSet.prototype;
25
+ var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
26
+ var hasWeakRef = typeof WeakRef === "function" && WeakRef.prototype;
27
+ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
28
+ var booleanValueOf = Boolean.prototype.valueOf;
29
+ var objectToString = Object.prototype.toString;
30
+ var functionToString = Function.prototype.toString;
31
+ var $match = String.prototype.match;
32
+ var $slice = String.prototype.slice;
33
+ var $replace = String.prototype.replace;
34
+ var $toUpperCase = String.prototype.toUpperCase;
35
+ var $toLowerCase = String.prototype.toLowerCase;
36
+ var $test = RegExp.prototype.test;
37
+ var $concat = Array.prototype.concat;
38
+ var $join = Array.prototype.join;
39
+ var $arrSlice = Array.prototype.slice;
40
+ var $floor = Math.floor;
41
+ var bigIntValueOf = typeof BigInt === "function" ? BigInt.prototype.valueOf : null;
42
+ var gOPS = Object.getOwnPropertySymbols;
43
+ var symToString = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? Symbol.prototype.toString : null;
44
+ var hasShammedSymbols = typeof Symbol === "function" && typeof Symbol.iterator === "object";
45
+ // ie, `has-tostringtag/shams
46
+ var toStringTag = typeof Symbol === "function" && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? "object" : "symbol") ? Symbol.toStringTag : null;
47
+ var isEnumerable = Object.prototype.propertyIsEnumerable;
48
+ var gPO = (typeof Reflect === "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype // eslint-disable-line no-proto
49
+ ? function (O) {
50
+ return O.__proto__; // eslint-disable-line no-proto
51
+ } : null);
52
+ function addNumericSeparator(num, str) {
53
+ if (num === Infinity || num === -Infinity || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) {
54
+ return str;
55
+ }
56
+ var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
57
+ if (typeof num === "number") {
58
+ var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
59
+ if (int !== num) {
60
+ var intStr = String(int);
61
+ var dec = $slice.call(str, intStr.length + 1);
62
+ return $replace.call(intStr, sepRegex, "$&_") + "." + $replace.call($replace.call(dec, /([0-9]{3})/g, "$&_"), /_$/, "");
63
+ }
64
+ }
65
+ return $replace.call(str, sepRegex, "$&_");
66
+ }
67
+ var utilInspect = empty;
68
+ var inspectCustom = utilInspect.custom;
69
+ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
70
+ exports$8 = function inspect_(obj, options, depth, seen) {
71
+ var opts = options || {};
72
+ if (has(opts, "quoteStyle") && opts.quoteStyle !== "single" && opts.quoteStyle !== "double") {
73
+ throw new TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
74
+ }
75
+ if (has(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) {
76
+ throw new TypeError("option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`");
77
+ }
78
+ var customInspect = has(opts, "customInspect") ? opts.customInspect : true;
79
+ if (typeof customInspect !== "boolean" && customInspect !== "symbol") {
80
+ throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
81
+ }
82
+ if (has(opts, "indent") && opts.indent !== null && opts.indent !== "\t" && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) {
83
+ throw new TypeError("option \"indent\" must be \"\\t\", an integer > 0, or `null`");
84
+ }
85
+ if (has(opts, "numericSeparator") && typeof opts.numericSeparator !== "boolean") {
86
+ throw new TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
87
+ }
88
+ var numericSeparator = opts.numericSeparator;
89
+ if (typeof obj === "undefined") {
90
+ return "undefined";
91
+ }
92
+ if (obj === null) {
93
+ return "null";
94
+ }
95
+ if (typeof obj === "boolean") {
96
+ return obj ? "true" : "false";
97
+ }
98
+ if (typeof obj === "string") {
99
+ return inspectString(obj, opts);
100
+ }
101
+ if (typeof obj === "number") {
102
+ if (obj === 0) {
103
+ return Infinity / obj > 0 ? "0" : "-0";
104
+ }
105
+ var str = String(obj);
106
+ return numericSeparator ? addNumericSeparator(obj, str) : str;
107
+ }
108
+ if (typeof obj === "bigint") {
109
+ var bigIntStr = String(obj) + "n";
110
+ return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
111
+ }
112
+ var maxDepth = typeof opts.depth === "undefined" ? 5 : opts.depth;
113
+ if (typeof depth === "undefined") {
114
+ depth = 0;
115
+ }
116
+ if (depth >= maxDepth && maxDepth > 0 && typeof obj === "object") {
117
+ return isArray(obj) ? "[Array]" : "[Object]";
118
+ }
119
+ var indent = getIndent(opts, depth);
120
+ if (typeof seen === "undefined") {
121
+ seen = [];
122
+ } else if (indexOf(seen, obj) >= 0) {
123
+ return "[Circular]";
124
+ }
125
+ function inspect(value, from, noIndent) {
126
+ if (from) {
127
+ seen = $arrSlice.call(seen);
128
+ seen.push(from);
129
+ }
130
+ if (noIndent) {
131
+ var newOpts = {
132
+ depth: opts.depth
133
+ };
134
+ if (has(opts, "quoteStyle")) {
135
+ newOpts.quoteStyle = opts.quoteStyle;
136
+ }
137
+ return inspect_(value, newOpts, depth + 1, seen);
138
+ }
139
+ return inspect_(value, opts, depth + 1, seen);
140
+ }
141
+ if (typeof obj === "function" && !isRegExp(obj)) {
142
+ // in older engines, regexes are callable
143
+ var name = nameOf(obj);
144
+ var keys = arrObjKeys(obj, inspect);
145
+ return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : "");
146
+ }
147
+ if (isSymbol(obj)) {
148
+ var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj);
149
+ return typeof obj === "object" && !hasShammedSymbols ? markBoxed(symString) : symString;
150
+ }
151
+ if (isElement(obj)) {
152
+ var s = "<" + $toLowerCase.call(String(obj.nodeName));
153
+ var attrs = obj.attributes || [];
154
+ for (var i = 0; i < attrs.length; i++) {
155
+ s += " " + attrs[i].name + "=" + wrapQuotes(quote(attrs[i].value), "double", opts);
156
+ }
157
+ s += ">";
158
+ if (obj.childNodes && obj.childNodes.length) {
159
+ s += "...";
160
+ }
161
+ s += "</" + $toLowerCase.call(String(obj.nodeName)) + ">";
162
+ return s;
163
+ }
164
+ if (isArray(obj)) {
165
+ if (obj.length === 0) {
166
+ return "[]";
167
+ }
168
+ var xs = arrObjKeys(obj, inspect);
169
+ if (indent && !singleLineValues(xs)) {
170
+ return "[" + indentedJoin(xs, indent) + "]";
171
+ }
172
+ return "[ " + $join.call(xs, ", ") + " ]";
173
+ }
174
+ if (isError(obj)) {
175
+ var parts = arrObjKeys(obj, inspect);
176
+ if (!("cause" in Error.prototype) && "cause" in obj && !isEnumerable.call(obj, "cause")) {
177
+ return "{ [" + String(obj) + "] " + $join.call($concat.call("[cause]: " + inspect(obj.cause), parts), ", ") + " }";
178
+ }
179
+ if (parts.length === 0) {
180
+ return "[" + String(obj) + "]";
181
+ }
182
+ return "{ [" + String(obj) + "] " + $join.call(parts, ", ") + " }";
183
+ }
184
+ if (typeof obj === "object" && customInspect) {
185
+ if (inspectSymbol && typeof obj[inspectSymbol] === "function" && utilInspect) {
186
+ return utilInspect(obj, {
187
+ depth: maxDepth - depth
188
+ });
189
+ } else if (customInspect !== "symbol" && typeof obj.inspect === "function") {
190
+ return obj.inspect();
191
+ }
192
+ }
193
+ if (isMap(obj)) {
194
+ var mapParts = [];
195
+ if (mapForEach) {
196
+ mapForEach.call(obj, function (value, key) {
197
+ mapParts.push(inspect(key, obj, true) + " => " + inspect(value, obj));
198
+ });
199
+ }
200
+ return collectionOf("Map", mapSize.call(obj), mapParts, indent);
201
+ }
202
+ if (isSet(obj)) {
203
+ var setParts = [];
204
+ if (setForEach) {
205
+ setForEach.call(obj, function (value) {
206
+ setParts.push(inspect(value, obj));
207
+ });
208
+ }
209
+ return collectionOf("Set", setSize.call(obj), setParts, indent);
210
+ }
211
+ if (isWeakMap(obj)) {
212
+ return weakCollectionOf("WeakMap");
213
+ }
214
+ if (isWeakSet(obj)) {
215
+ return weakCollectionOf("WeakSet");
216
+ }
217
+ if (isWeakRef(obj)) {
218
+ return weakCollectionOf("WeakRef");
219
+ }
220
+ if (isNumber(obj)) {
221
+ return markBoxed(inspect(Number(obj)));
222
+ }
223
+ if (isBigInt(obj)) {
224
+ return markBoxed(inspect(bigIntValueOf.call(obj)));
225
+ }
226
+ if (isBoolean(obj)) {
227
+ return markBoxed(booleanValueOf.call(obj));
228
+ }
229
+ if (isString(obj)) {
230
+ return markBoxed(inspect(String(obj)));
231
+ }
232
+ // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
233
+ /* eslint-env browser */
234
+ if (typeof window !== "undefined" && obj === window) {
235
+ return "{ [object Window] }";
236
+ }
237
+ if (typeof globalThis !== "undefined" && obj === globalThis || typeof _global !== "undefined" && obj === _global) {
238
+ return "{ [object globalThis] }";
239
+ }
240
+ if (!isDate(obj) && !isRegExp(obj)) {
241
+ var ys = arrObjKeys(obj, inspect);
242
+ var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
243
+ var protoTag = obj instanceof Object ? "" : "null prototype";
244
+ var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
245
+ var constructorTag = isPlainObject || typeof obj.constructor !== "function" ? "" : obj.constructor.name ? obj.constructor.name + " " : "";
246
+ var tag = constructorTag + (stringTag || protoTag ? "[" + $join.call($concat.call([], stringTag || [], protoTag || []), ": ") + "] " : "");
247
+ if (ys.length === 0) {
248
+ return tag + "{}";
249
+ }
250
+ if (indent) {
251
+ return tag + "{" + indentedJoin(ys, indent) + "}";
252
+ }
253
+ return tag + "{ " + $join.call(ys, ", ") + " }";
254
+ }
255
+ return String(obj);
256
+ };
257
+ function wrapQuotes(s, defaultStyle, opts) {
258
+ var quoteChar = (opts.quoteStyle || defaultStyle) === "double" ? "\"" : "'";
259
+ return quoteChar + s + quoteChar;
260
+ }
261
+ function quote(s) {
262
+ return $replace.call(String(s), /"/g, "&quot;");
263
+ }
264
+ function isArray(obj) {
265
+ return toStr(obj) === "[object Array]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
266
+ }
267
+ function isDate(obj) {
268
+ return toStr(obj) === "[object Date]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
269
+ }
270
+ function isRegExp(obj) {
271
+ return toStr(obj) === "[object RegExp]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
272
+ }
273
+ function isError(obj) {
274
+ return toStr(obj) === "[object Error]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
275
+ }
276
+ function isString(obj) {
277
+ return toStr(obj) === "[object String]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
278
+ }
279
+ function isNumber(obj) {
280
+ return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
281
+ }
282
+ function isBoolean(obj) {
283
+ return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj));
284
+ }
285
+
286
+ // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
287
+ function isSymbol(obj) {
288
+ if (hasShammedSymbols) {
289
+ return obj && typeof obj === "object" && obj instanceof Symbol;
290
+ }
291
+ if (typeof obj === "symbol") {
292
+ return true;
293
+ }
294
+ if (!obj || typeof obj !== "object" || !symToString) {
295
+ return false;
296
+ }
297
+ try {
298
+ symToString.call(obj);
299
+ return true;
300
+ } catch (e) {}
301
+ return false;
302
+ }
303
+ function isBigInt(obj) {
304
+ if (!obj || typeof obj !== "object" || !bigIntValueOf) {
305
+ return false;
306
+ }
307
+ try {
308
+ bigIntValueOf.call(obj);
309
+ return true;
310
+ } catch (e) {}
311
+ return false;
312
+ }
313
+ var hasOwn = Object.prototype.hasOwnProperty || function (key) {
314
+ return key in (this || _global);
315
+ };
316
+ function has(obj, key) {
317
+ return hasOwn.call(obj, key);
318
+ }
319
+ function toStr(obj) {
320
+ return objectToString.call(obj);
321
+ }
322
+ function nameOf(f) {
323
+ if (f.name) {
324
+ return f.name;
325
+ }
326
+ var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
327
+ if (m) {
328
+ return m[1];
329
+ }
330
+ return null;
331
+ }
332
+ function indexOf(xs, x) {
333
+ if (xs.indexOf) {
334
+ return xs.indexOf(x);
335
+ }
336
+ for (var i = 0, l = xs.length; i < l; i++) {
337
+ if (xs[i] === x) {
338
+ return i;
339
+ }
340
+ }
341
+ return -1;
342
+ }
343
+ function isMap(x) {
344
+ if (!mapSize || !x || typeof x !== "object") {
345
+ return false;
346
+ }
347
+ try {
348
+ mapSize.call(x);
349
+ try {
350
+ setSize.call(x);
351
+ } catch (s) {
352
+ return true;
353
+ }
354
+ return x instanceof Map; // core-js workaround, pre-v2.5.0
355
+ } catch (e) {}
356
+ return false;
357
+ }
358
+ function isWeakMap(x) {
359
+ if (!weakMapHas || !x || typeof x !== "object") {
360
+ return false;
361
+ }
362
+ try {
363
+ weakMapHas.call(x, weakMapHas);
364
+ try {
365
+ weakSetHas.call(x, weakSetHas);
366
+ } catch (s) {
367
+ return true;
368
+ }
369
+ return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
370
+ } catch (e) {}
371
+ return false;
372
+ }
373
+ function isWeakRef(x) {
374
+ if (!weakRefDeref || !x || typeof x !== "object") {
375
+ return false;
376
+ }
377
+ try {
378
+ weakRefDeref.call(x);
379
+ return true;
380
+ } catch (e) {}
381
+ return false;
382
+ }
383
+ function isSet(x) {
384
+ if (!setSize || !x || typeof x !== "object") {
385
+ return false;
386
+ }
387
+ try {
388
+ setSize.call(x);
389
+ try {
390
+ mapSize.call(x);
391
+ } catch (m) {
392
+ return true;
393
+ }
394
+ return x instanceof Set; // core-js workaround, pre-v2.5.0
395
+ } catch (e) {}
396
+ return false;
397
+ }
398
+ function isWeakSet(x) {
399
+ if (!weakSetHas || !x || typeof x !== "object") {
400
+ return false;
401
+ }
402
+ try {
403
+ weakSetHas.call(x, weakSetHas);
404
+ try {
405
+ weakMapHas.call(x, weakMapHas);
406
+ } catch (s) {
407
+ return true;
408
+ }
409
+ return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
410
+ } catch (e) {}
411
+ return false;
412
+ }
413
+ function isElement(x) {
414
+ if (!x || typeof x !== "object") {
415
+ return false;
416
+ }
417
+ if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
418
+ return true;
419
+ }
420
+ return typeof x.nodeName === "string" && typeof x.getAttribute === "function";
421
+ }
422
+ function inspectString(str, opts) {
423
+ if (str.length > opts.maxStringLength) {
424
+ var remaining = str.length - opts.maxStringLength;
425
+ var trailer = "... " + remaining + " more character" + (remaining > 1 ? "s" : "");
426
+ return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
427
+ }
428
+ // eslint-disable-next-line no-control-regex
429
+ var s = $replace.call($replace.call(str, /(['\\])/g, "\\$1"), /[\x00-\x1f]/g, lowbyte);
430
+ return wrapQuotes(s, "single", opts);
431
+ }
432
+ function lowbyte(c) {
433
+ var n = c.charCodeAt(0);
434
+ var x = {
435
+ 8: "b",
436
+ 9: "t",
437
+ 10: "n",
438
+ 12: "f",
439
+ 13: "r"
440
+ }[n];
441
+ if (x) {
442
+ return "\\" + x;
443
+ }
444
+ return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16));
445
+ }
446
+ function markBoxed(str) {
447
+ return "Object(" + str + ")";
448
+ }
449
+ function weakCollectionOf(type) {
450
+ return type + " { ? }";
451
+ }
452
+ function collectionOf(type, size, entries, indent) {
453
+ var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ", ");
454
+ return type + " (" + size + ") {" + joinedEntries + "}";
455
+ }
456
+ function singleLineValues(xs) {
457
+ for (var i = 0; i < xs.length; i++) {
458
+ if (indexOf(xs[i], "\n") >= 0) {
459
+ return false;
460
+ }
461
+ }
462
+ return true;
463
+ }
464
+ function getIndent(opts, depth) {
465
+ var baseIndent;
466
+ if (opts.indent === "\t") {
467
+ baseIndent = "\t";
468
+ } else if (typeof opts.indent === "number" && opts.indent > 0) {
469
+ baseIndent = $join.call(Array(opts.indent + 1), " ");
470
+ } else {
471
+ return null;
472
+ }
473
+ return {
474
+ base: baseIndent,
475
+ prev: $join.call(Array(depth + 1), baseIndent)
476
+ };
477
+ }
478
+ function indentedJoin(xs, indent) {
479
+ if (xs.length === 0) {
480
+ return "";
481
+ }
482
+ var lineJoiner = "\n" + indent.prev + indent.base;
483
+ return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent.prev;
484
+ }
485
+ function arrObjKeys(obj, inspect) {
486
+ var isArr = isArray(obj);
487
+ var xs = [];
488
+ if (isArr) {
489
+ xs.length = obj.length;
490
+ for (var i = 0; i < obj.length; i++) {
491
+ xs[i] = has(obj, i) ? inspect(obj[i], obj) : "";
492
+ }
493
+ }
494
+ var syms = typeof gOPS === "function" ? gOPS(obj) : [];
495
+ var symMap;
496
+ if (hasShammedSymbols) {
497
+ symMap = {};
498
+ for (var k = 0; k < syms.length; k++) {
499
+ symMap["$" + syms[k]] = syms[k];
500
+ }
501
+ }
502
+ for (var key in obj) {
503
+ // eslint-disable-line no-restricted-syntax
504
+ if (!has(obj, key)) {
505
+ continue;
506
+ } // eslint-disable-line no-restricted-syntax, no-continue
507
+ if (isArr && String(Number(key)) === key && key < obj.length) {
508
+ continue;
509
+ } // eslint-disable-line no-restricted-syntax, no-continue
510
+ if (hasShammedSymbols && symMap["$" + key] instanceof Symbol) {
511
+ // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
512
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
513
+ } else if ($test.call(/[^\w$]/, key)) {
514
+ xs.push(inspect(key, obj) + ": " + inspect(obj[key], obj));
515
+ } else {
516
+ xs.push(key + ": " + inspect(obj[key], obj));
517
+ }
518
+ }
519
+ if (typeof gOPS === "function") {
520
+ for (var j = 0; j < syms.length; j++) {
521
+ if (isEnumerable.call(obj, syms[j])) {
522
+ xs.push("[" + inspect(syms[j]) + "]: " + inspect(obj[syms[j]], obj));
523
+ }
524
+ }
525
+ }
526
+ return xs;
527
+ }
528
+ return exports$8;
529
+ }
530
+
531
+ var exports$7 = {},
532
+ _dewExec$6 = false;
533
+ function dew$6() {
534
+ if (_dewExec$6) return exports$7;
535
+ _dewExec$6 = true;
536
+ var GetIntrinsic = dew$8();
537
+ var callBound = dew$9();
538
+ var inspect = dew$7();
539
+ var $TypeError = dew$a();
540
+ var $WeakMap = GetIntrinsic("%WeakMap%", true);
541
+ var $Map = GetIntrinsic("%Map%", true);
542
+ var $weakMapGet = callBound("WeakMap.prototype.get", true);
543
+ var $weakMapSet = callBound("WeakMap.prototype.set", true);
544
+ var $weakMapHas = callBound("WeakMap.prototype.has", true);
545
+ var $mapGet = callBound("Map.prototype.get", true);
546
+ var $mapSet = callBound("Map.prototype.set", true);
547
+ var $mapHas = callBound("Map.prototype.has", true);
548
+
549
+ /*
550
+ * This function traverses the list returning the node corresponding to the given key.
551
+ *
552
+ * That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly.
553
+ */
554
+ /** @type {import('.').listGetNode} */
555
+ var listGetNode = function (list, key) {
556
+ // eslint-disable-line consistent-return
557
+ /** @type {typeof list | NonNullable<(typeof list)['next']>} */
558
+ var prev = list;
559
+ /** @type {(typeof list)['next']} */
560
+ var curr;
561
+ for (; (curr = prev.next) !== null; prev = curr) {
562
+ if (curr.key === key) {
563
+ prev.next = curr.next;
564
+ // eslint-disable-next-line no-extra-parens
565
+ curr.next = /** @type {NonNullable<typeof list.next>} */list.next;
566
+ list.next = curr; // eslint-disable-line no-param-reassign
567
+ return curr;
568
+ }
569
+ }
570
+ };
571
+
572
+ /** @type {import('.').listGet} */
573
+ var listGet = function (objects, key) {
574
+ var node = listGetNode(objects, key);
575
+ return node && node.value;
576
+ };
577
+ /** @type {import('.').listSet} */
578
+ var listSet = function (objects, key, value) {
579
+ var node = listGetNode(objects, key);
580
+ if (node) {
581
+ node.value = value;
582
+ } else {
583
+ // Prepend the new node to the beginning of the list
584
+ objects.next = /** @type {import('.').ListNode<typeof value>} */{
585
+ // eslint-disable-line no-param-reassign, no-extra-parens
586
+ key: key,
587
+ next: objects.next,
588
+ value: value
589
+ };
590
+ }
591
+ };
592
+ /** @type {import('.').listHas} */
593
+ var listHas = function (objects, key) {
594
+ return !!listGetNode(objects, key);
595
+ };
596
+
597
+ /** @type {import('.')} */
598
+ exports$7 = function getSideChannel() {
599
+ /** @type {WeakMap<object, unknown>} */var $wm;
600
+ /** @type {Map<object, unknown>} */
601
+ var $m;
602
+ /** @type {import('.').RootNode<unknown>} */
603
+ var $o;
604
+
605
+ /** @type {import('.').Channel} */
606
+ var channel = {
607
+ assert: function (key) {
608
+ if (!channel.has(key)) {
609
+ throw new $TypeError("Side channel does not contain " + inspect(key));
610
+ }
611
+ },
612
+ get: function (key) {
613
+ // eslint-disable-line consistent-return
614
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
615
+ if ($wm) {
616
+ return $weakMapGet($wm, key);
617
+ }
618
+ } else if ($Map) {
619
+ if ($m) {
620
+ return $mapGet($m, key);
621
+ }
622
+ } else {
623
+ if ($o) {
624
+ // eslint-disable-line no-lonely-if
625
+ return listGet($o, key);
626
+ }
627
+ }
628
+ },
629
+ has: function (key) {
630
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
631
+ if ($wm) {
632
+ return $weakMapHas($wm, key);
633
+ }
634
+ } else if ($Map) {
635
+ if ($m) {
636
+ return $mapHas($m, key);
637
+ }
638
+ } else {
639
+ if ($o) {
640
+ // eslint-disable-line no-lonely-if
641
+ return listHas($o, key);
642
+ }
643
+ }
644
+ return false;
645
+ },
646
+ set: function (key, value) {
647
+ if ($WeakMap && key && (typeof key === "object" || typeof key === "function")) {
648
+ if (!$wm) {
649
+ $wm = new $WeakMap();
650
+ }
651
+ $weakMapSet($wm, key, value);
652
+ } else if ($Map) {
653
+ if (!$m) {
654
+ $m = new $Map();
655
+ }
656
+ $mapSet($m, key, value);
657
+ } else {
658
+ if (!$o) {
659
+ // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
660
+ $o = {
661
+ key: {},
662
+ next: null
663
+ };
664
+ }
665
+ listSet($o, key, value);
666
+ }
667
+ }
668
+ };
669
+ return channel;
670
+ };
671
+ return exports$7;
672
+ }
673
+
674
+ var exports$6 = {},
675
+ _dewExec$5 = false;
676
+ function dew$5() {
677
+ if (_dewExec$5) return exports$6;
678
+ _dewExec$5 = true;
679
+ var replace = String.prototype.replace;
680
+ var percentTwenties = /%20/g;
681
+ var Format = {
682
+ RFC1738: "RFC1738",
683
+ RFC3986: "RFC3986"
684
+ };
685
+ exports$6 = {
686
+ "default": Format.RFC3986,
687
+ formatters: {
688
+ RFC1738: function (value) {
689
+ return replace.call(value, percentTwenties, "+");
690
+ },
691
+ RFC3986: function (value) {
692
+ return String(value);
693
+ }
694
+ },
695
+ RFC1738: Format.RFC1738,
696
+ RFC3986: Format.RFC3986
697
+ };
698
+ return exports$6;
699
+ }
700
+
701
+ var exports$5 = {},
702
+ _dewExec$4 = false;
703
+ function dew$4() {
704
+ if (_dewExec$4) return exports$5;
705
+ _dewExec$4 = true;
706
+ var formats = dew$5();
707
+ var has = Object.prototype.hasOwnProperty;
708
+ var isArray = Array.isArray;
709
+ var hexTable = function () {
710
+ var array = [];
711
+ for (var i = 0; i < 256; ++i) {
712
+ array.push("%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase());
713
+ }
714
+ return array;
715
+ }();
716
+ var compactQueue = function compactQueue(queue) {
717
+ while (queue.length > 1) {
718
+ var item = queue.pop();
719
+ var obj = item.obj[item.prop];
720
+ if (isArray(obj)) {
721
+ var compacted = [];
722
+ for (var j = 0; j < obj.length; ++j) {
723
+ if (typeof obj[j] !== "undefined") {
724
+ compacted.push(obj[j]);
725
+ }
726
+ }
727
+ item.obj[item.prop] = compacted;
728
+ }
729
+ }
730
+ };
731
+ var arrayToObject = function arrayToObject(source, options) {
732
+ var obj = options && options.plainObjects ? Object.create(null) : {};
733
+ for (var i = 0; i < source.length; ++i) {
734
+ if (typeof source[i] !== "undefined") {
735
+ obj[i] = source[i];
736
+ }
737
+ }
738
+ return obj;
739
+ };
740
+ var merge = function merge(target, source, options) {
741
+ /* eslint no-param-reassign: 0 */
742
+ if (!source) {
743
+ return target;
744
+ }
745
+ if (typeof source !== "object") {
746
+ if (isArray(target)) {
747
+ target.push(source);
748
+ } else if (target && typeof target === "object") {
749
+ if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) {
750
+ target[source] = true;
751
+ }
752
+ } else {
753
+ return [target, source];
754
+ }
755
+ return target;
756
+ }
757
+ if (!target || typeof target !== "object") {
758
+ return [target].concat(source);
759
+ }
760
+ var mergeTarget = target;
761
+ if (isArray(target) && !isArray(source)) {
762
+ mergeTarget = arrayToObject(target, options);
763
+ }
764
+ if (isArray(target) && isArray(source)) {
765
+ source.forEach(function (item, i) {
766
+ if (has.call(target, i)) {
767
+ var targetItem = target[i];
768
+ if (targetItem && typeof targetItem === "object" && item && typeof item === "object") {
769
+ target[i] = merge(targetItem, item, options);
770
+ } else {
771
+ target.push(item);
772
+ }
773
+ } else {
774
+ target[i] = item;
775
+ }
776
+ });
777
+ return target;
778
+ }
779
+ return Object.keys(source).reduce(function (acc, key) {
780
+ var value = source[key];
781
+ if (has.call(acc, key)) {
782
+ acc[key] = merge(acc[key], value, options);
783
+ } else {
784
+ acc[key] = value;
785
+ }
786
+ return acc;
787
+ }, mergeTarget);
788
+ };
789
+ var assign = function assignSingleSource(target, source) {
790
+ return Object.keys(source).reduce(function (acc, key) {
791
+ acc[key] = source[key];
792
+ return acc;
793
+ }, target);
794
+ };
795
+ var decode = function (str, decoder, charset) {
796
+ var strWithoutPlus = str.replace(/\+/g, " ");
797
+ if (charset === "iso-8859-1") {
798
+ // unescape never throws, no try...catch needed:
799
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
800
+ }
801
+ // utf-8
802
+ try {
803
+ return decodeURIComponent(strWithoutPlus);
804
+ } catch (e) {
805
+ return strWithoutPlus;
806
+ }
807
+ };
808
+ var limit = 1024;
809
+
810
+ /* eslint operator-linebreak: [2, "before"] */
811
+
812
+ var encode = function encode(str, defaultEncoder, charset, kind, format) {
813
+ // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
814
+ // It has been adapted here for stricter adherence to RFC 3986
815
+ if (str.length === 0) {
816
+ return str;
817
+ }
818
+ var string = str;
819
+ if (typeof str === "symbol") {
820
+ string = Symbol.prototype.toString.call(str);
821
+ } else if (typeof str !== "string") {
822
+ string = String(str);
823
+ }
824
+ if (charset === "iso-8859-1") {
825
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
826
+ return "%26%23" + parseInt($0.slice(2), 16) + "%3B";
827
+ });
828
+ }
829
+ var out = "";
830
+ for (var j = 0; j < string.length; j += limit) {
831
+ var segment = string.length >= limit ? string.slice(j, j + limit) : string;
832
+ var arr = [];
833
+ for (var i = 0; i < segment.length; ++i) {
834
+ var c = segment.charCodeAt(i);
835
+ if (c === 45 // -
836
+ || c === 46 // .
837
+ || c === 95 // _
838
+ || c === 126 // ~
839
+ || c >= 48 && c <= 57 // 0-9
840
+ || c >= 65 && c <= 90 // a-z
841
+ || c >= 97 && c <= 122 // A-Z
842
+ || format === formats.RFC1738 && (c === 40 || c === 41) // ( )
843
+ ) {
844
+ arr[arr.length] = segment.charAt(i);
845
+ continue;
846
+ }
847
+ if (c < 128) {
848
+ arr[arr.length] = hexTable[c];
849
+ continue;
850
+ }
851
+ if (c < 2048) {
852
+ arr[arr.length] = hexTable[192 | c >> 6] + hexTable[128 | c & 63];
853
+ continue;
854
+ }
855
+ if (c < 55296 || c >= 57344) {
856
+ arr[arr.length] = hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
857
+ continue;
858
+ }
859
+ i += 1;
860
+ c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023);
861
+ arr[arr.length] = hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
862
+ }
863
+ out += arr.join("");
864
+ }
865
+ return out;
866
+ };
867
+ var compact = function compact(value) {
868
+ var queue = [{
869
+ obj: {
870
+ o: value
871
+ },
872
+ prop: "o"
873
+ }];
874
+ var refs = [];
875
+ for (var i = 0; i < queue.length; ++i) {
876
+ var item = queue[i];
877
+ var obj = item.obj[item.prop];
878
+ var keys = Object.keys(obj);
879
+ for (var j = 0; j < keys.length; ++j) {
880
+ var key = keys[j];
881
+ var val = obj[key];
882
+ if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) {
883
+ queue.push({
884
+ obj: obj,
885
+ prop: key
886
+ });
887
+ refs.push(val);
888
+ }
889
+ }
890
+ }
891
+ compactQueue(queue);
892
+ return value;
893
+ };
894
+ var isRegExp = function isRegExp(obj) {
895
+ return Object.prototype.toString.call(obj) === "[object RegExp]";
896
+ };
897
+ var isBuffer = function isBuffer(obj) {
898
+ if (!obj || typeof obj !== "object") {
899
+ return false;
900
+ }
901
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
902
+ };
903
+ var combine = function combine(a, b) {
904
+ return [].concat(a, b);
905
+ };
906
+ var maybeMap = function maybeMap(val, fn) {
907
+ if (isArray(val)) {
908
+ var mapped = [];
909
+ for (var i = 0; i < val.length; i += 1) {
910
+ mapped.push(fn(val[i]));
911
+ }
912
+ return mapped;
913
+ }
914
+ return fn(val);
915
+ };
916
+ exports$5 = {
917
+ arrayToObject: arrayToObject,
918
+ assign: assign,
919
+ combine: combine,
920
+ compact: compact,
921
+ decode: decode,
922
+ encode: encode,
923
+ isBuffer: isBuffer,
924
+ isRegExp: isRegExp,
925
+ maybeMap: maybeMap,
926
+ merge: merge
927
+ };
928
+ return exports$5;
929
+ }
930
+
931
+ var exports$4 = {},
932
+ _dewExec$3 = false;
933
+ function dew$3() {
934
+ if (_dewExec$3) return exports$4;
935
+ _dewExec$3 = true;
936
+ var getSideChannel = dew$6();
937
+ var utils = dew$4();
938
+ var formats = dew$5();
939
+ var has = Object.prototype.hasOwnProperty;
940
+ var arrayPrefixGenerators = {
941
+ brackets: function brackets(prefix) {
942
+ return prefix + "[]";
943
+ },
944
+ comma: "comma",
945
+ indices: function indices(prefix, key) {
946
+ return prefix + "[" + key + "]";
947
+ },
948
+ repeat: function repeat(prefix) {
949
+ return prefix;
950
+ }
951
+ };
952
+ var isArray = Array.isArray;
953
+ var push = Array.prototype.push;
954
+ var pushToArray = function (arr, valueOrArray) {
955
+ push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
956
+ };
957
+ var toISO = Date.prototype.toISOString;
958
+ var defaultFormat = formats["default"];
959
+ var defaults = {
960
+ addQueryPrefix: false,
961
+ allowDots: false,
962
+ allowEmptyArrays: false,
963
+ arrayFormat: "indices",
964
+ charset: "utf-8",
965
+ charsetSentinel: false,
966
+ delimiter: "&",
967
+ encode: true,
968
+ encodeDotInKeys: false,
969
+ encoder: utils.encode,
970
+ encodeValuesOnly: false,
971
+ format: defaultFormat,
972
+ formatter: formats.formatters[defaultFormat],
973
+ // deprecated
974
+ indices: false,
975
+ serializeDate: function serializeDate(date) {
976
+ return toISO.call(date);
977
+ },
978
+ skipNulls: false,
979
+ strictNullHandling: false
980
+ };
981
+ var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
982
+ return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint";
983
+ };
984
+ var sentinel = {};
985
+ var stringify = function stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
986
+ var obj = object;
987
+ var tmpSc = sideChannel;
988
+ var step = 0;
989
+ var findFlag = false;
990
+ while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
991
+ // Where object last appeared in the ref tree
992
+ var pos = tmpSc.get(object);
993
+ step += 1;
994
+ if (typeof pos !== "undefined") {
995
+ if (pos === step) {
996
+ throw new RangeError("Cyclic object value");
997
+ } else {
998
+ findFlag = true; // Break while
999
+ }
1000
+ }
1001
+ if (typeof tmpSc.get(sentinel) === "undefined") {
1002
+ step = 0;
1003
+ }
1004
+ }
1005
+ if (typeof filter === "function") {
1006
+ obj = filter(prefix, obj);
1007
+ } else if (obj instanceof Date) {
1008
+ obj = serializeDate(obj);
1009
+ } else if (generateArrayPrefix === "comma" && isArray(obj)) {
1010
+ obj = utils.maybeMap(obj, function (value) {
1011
+ if (value instanceof Date) {
1012
+ return serializeDate(value);
1013
+ }
1014
+ return value;
1015
+ });
1016
+ }
1017
+ if (obj === null) {
1018
+ if (strictNullHandling) {
1019
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
1020
+ }
1021
+ obj = "";
1022
+ }
1023
+ if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
1024
+ if (encoder) {
1025
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, "key", format);
1026
+ return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults.encoder, charset, "value", format))];
1027
+ }
1028
+ return [formatter(prefix) + "=" + formatter(String(obj))];
1029
+ }
1030
+ var values = [];
1031
+ if (typeof obj === "undefined") {
1032
+ return values;
1033
+ }
1034
+ var objKeys;
1035
+ if (generateArrayPrefix === "comma" && isArray(obj)) {
1036
+ // we need to join elements in
1037
+ if (encodeValuesOnly && encoder) {
1038
+ obj = utils.maybeMap(obj, encoder);
1039
+ }
1040
+ objKeys = [{
1041
+ value: obj.length > 0 ? obj.join(",") || null : void undefined
1042
+ }];
1043
+ } else if (isArray(filter)) {
1044
+ objKeys = filter;
1045
+ } else {
1046
+ var keys = Object.keys(obj);
1047
+ objKeys = sort ? keys.sort(sort) : keys;
1048
+ }
1049
+ var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, "%2E") : prefix;
1050
+ var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix;
1051
+ if (allowEmptyArrays && isArray(obj) && obj.length === 0) {
1052
+ return adjustedPrefix + "[]";
1053
+ }
1054
+ for (var j = 0; j < objKeys.length; ++j) {
1055
+ var key = objKeys[j];
1056
+ var value = typeof key === "object" && typeof key.value !== "undefined" ? key.value : obj[key];
1057
+ if (skipNulls && value === null) {
1058
+ continue;
1059
+ }
1060
+ var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, "%2E") : key;
1061
+ var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]");
1062
+ sideChannel.set(object, step);
1063
+ var valueSideChannel = getSideChannel();
1064
+ valueSideChannel.set(sentinel, sideChannel);
1065
+ pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel));
1066
+ }
1067
+ return values;
1068
+ };
1069
+ var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
1070
+ if (!opts) {
1071
+ return defaults;
1072
+ }
1073
+ if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
1074
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
1075
+ }
1076
+ if (typeof opts.encodeDotInKeys !== "undefined" && typeof opts.encodeDotInKeys !== "boolean") {
1077
+ throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");
1078
+ }
1079
+ if (opts.encoder !== null && typeof opts.encoder !== "undefined" && typeof opts.encoder !== "function") {
1080
+ throw new TypeError("Encoder has to be a function.");
1081
+ }
1082
+ var charset = opts.charset || defaults.charset;
1083
+ if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
1084
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
1085
+ }
1086
+ var format = formats["default"];
1087
+ if (typeof opts.format !== "undefined") {
1088
+ if (!has.call(formats.formatters, opts.format)) {
1089
+ throw new TypeError("Unknown format option provided.");
1090
+ }
1091
+ format = opts.format;
1092
+ }
1093
+ var formatter = formats.formatters[format];
1094
+ var filter = defaults.filter;
1095
+ if (typeof opts.filter === "function" || isArray(opts.filter)) {
1096
+ filter = opts.filter;
1097
+ }
1098
+ var arrayFormat;
1099
+ if (opts.arrayFormat in arrayPrefixGenerators) {
1100
+ arrayFormat = opts.arrayFormat;
1101
+ } else if ("indices" in opts) {
1102
+ arrayFormat = opts.indices ? "indices" : "repeat";
1103
+ } else {
1104
+ arrayFormat = defaults.arrayFormat;
1105
+ }
1106
+ if ("commaRoundTrip" in opts && typeof opts.commaRoundTrip !== "boolean") {
1107
+ throw new TypeError("`commaRoundTrip` must be a boolean, or absent");
1108
+ }
1109
+ var allowDots = typeof opts.allowDots === "undefined" ? opts.encodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
1110
+ return {
1111
+ addQueryPrefix: typeof opts.addQueryPrefix === "boolean" ? opts.addQueryPrefix : defaults.addQueryPrefix,
1112
+ allowDots: allowDots,
1113
+ allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
1114
+ arrayFormat: arrayFormat,
1115
+ charset: charset,
1116
+ charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
1117
+ commaRoundTrip: opts.commaRoundTrip,
1118
+ delimiter: typeof opts.delimiter === "undefined" ? defaults.delimiter : opts.delimiter,
1119
+ encode: typeof opts.encode === "boolean" ? opts.encode : defaults.encode,
1120
+ encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys,
1121
+ encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder,
1122
+ encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
1123
+ filter: filter,
1124
+ format: format,
1125
+ formatter: formatter,
1126
+ serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate,
1127
+ skipNulls: typeof opts.skipNulls === "boolean" ? opts.skipNulls : defaults.skipNulls,
1128
+ sort: typeof opts.sort === "function" ? opts.sort : null,
1129
+ strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
1130
+ };
1131
+ };
1132
+ exports$4 = function (object, opts) {
1133
+ var obj = object;
1134
+ var options = normalizeStringifyOptions(opts);
1135
+ var objKeys;
1136
+ var filter;
1137
+ if (typeof options.filter === "function") {
1138
+ filter = options.filter;
1139
+ obj = filter("", obj);
1140
+ } else if (isArray(options.filter)) {
1141
+ filter = options.filter;
1142
+ objKeys = filter;
1143
+ }
1144
+ var keys = [];
1145
+ if (typeof obj !== "object" || obj === null) {
1146
+ return "";
1147
+ }
1148
+ var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat];
1149
+ var commaRoundTrip = generateArrayPrefix === "comma" && options.commaRoundTrip;
1150
+ if (!objKeys) {
1151
+ objKeys = Object.keys(obj);
1152
+ }
1153
+ if (options.sort) {
1154
+ objKeys.sort(options.sort);
1155
+ }
1156
+ var sideChannel = getSideChannel();
1157
+ for (var i = 0; i < objKeys.length; ++i) {
1158
+ var key = objKeys[i];
1159
+ if (options.skipNulls && obj[key] === null) {
1160
+ continue;
1161
+ }
1162
+ pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel));
1163
+ }
1164
+ var joined = keys.join(options.delimiter);
1165
+ var prefix = options.addQueryPrefix === true ? "?" : "";
1166
+ if (options.charsetSentinel) {
1167
+ if (options.charset === "iso-8859-1") {
1168
+ // encodeURIComponent('&#10003;'), the "numeric entity" representation of a checkmark
1169
+ prefix += "utf8=%26%2310003%3B&";
1170
+ } else {
1171
+ // encodeURIComponent('✓')
1172
+ prefix += "utf8=%E2%9C%93&";
1173
+ }
1174
+ }
1175
+ return joined.length > 0 ? prefix + joined : "";
1176
+ };
1177
+ return exports$4;
1178
+ }
1179
+
1180
+ var exports$3 = {},
1181
+ _dewExec$2 = false;
1182
+ function dew$2() {
1183
+ if (_dewExec$2) return exports$3;
1184
+ _dewExec$2 = true;
1185
+ var utils = dew$4();
1186
+ var has = Object.prototype.hasOwnProperty;
1187
+ var isArray = Array.isArray;
1188
+ var defaults = {
1189
+ allowDots: false,
1190
+ allowEmptyArrays: false,
1191
+ allowPrototypes: false,
1192
+ allowSparse: false,
1193
+ arrayLimit: 20,
1194
+ charset: "utf-8",
1195
+ charsetSentinel: false,
1196
+ comma: false,
1197
+ decodeDotInKeys: false,
1198
+ decoder: utils.decode,
1199
+ delimiter: "&",
1200
+ depth: 5,
1201
+ duplicates: "combine",
1202
+ ignoreQueryPrefix: false,
1203
+ interpretNumericEntities: false,
1204
+ parameterLimit: 1000,
1205
+ parseArrays: true,
1206
+ plainObjects: false,
1207
+ strictDepth: false,
1208
+ strictNullHandling: false
1209
+ };
1210
+ var interpretNumericEntities = function (str) {
1211
+ return str.replace(/&#(\d+);/g, function ($0, numberStr) {
1212
+ return String.fromCharCode(parseInt(numberStr, 10));
1213
+ });
1214
+ };
1215
+ var parseArrayValue = function (val, options) {
1216
+ if (val && typeof val === "string" && options.comma && val.indexOf(",") > -1) {
1217
+ return val.split(",");
1218
+ }
1219
+ return val;
1220
+ };
1221
+
1222
+ // This is what browsers will submit when the ✓ character occurs in an
1223
+ // application/x-www-form-urlencoded body and the encoding of the page containing
1224
+ // the form is iso-8859-1, or when the submitted form has an accept-charset
1225
+ // attribute of iso-8859-1. Presumably also with other charsets that do not contain
1226
+ // the ✓ character, such as us-ascii.
1227
+ var isoSentinel = "utf8=%26%2310003%3B"; // encodeURIComponent('&#10003;')
1228
+
1229
+ // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
1230
+ var charsetSentinel = "utf8=%E2%9C%93"; // encodeURIComponent('✓')
1231
+
1232
+ var parseValues = function parseQueryStringValues(str, options) {
1233
+ var obj = {
1234
+ __proto__: null
1235
+ };
1236
+ var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, "") : str;
1237
+ cleanStr = cleanStr.replace(/%5B/gi, "[").replace(/%5D/gi, "]");
1238
+ var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
1239
+ var parts = cleanStr.split(options.delimiter, limit);
1240
+ var skipIndex = -1; // Keep track of where the utf8 sentinel was found
1241
+ var i;
1242
+ var charset = options.charset;
1243
+ if (options.charsetSentinel) {
1244
+ for (i = 0; i < parts.length; ++i) {
1245
+ if (parts[i].indexOf("utf8=") === 0) {
1246
+ if (parts[i] === charsetSentinel) {
1247
+ charset = "utf-8";
1248
+ } else if (parts[i] === isoSentinel) {
1249
+ charset = "iso-8859-1";
1250
+ }
1251
+ skipIndex = i;
1252
+ i = parts.length; // The eslint settings do not allow break;
1253
+ }
1254
+ }
1255
+ }
1256
+ for (i = 0; i < parts.length; ++i) {
1257
+ if (i === skipIndex) {
1258
+ continue;
1259
+ }
1260
+ var part = parts[i];
1261
+ var bracketEqualsPos = part.indexOf("]=");
1262
+ var pos = bracketEqualsPos === -1 ? part.indexOf("=") : bracketEqualsPos + 1;
1263
+ var key, val;
1264
+ if (pos === -1) {
1265
+ key = options.decoder(part, defaults.decoder, charset, "key");
1266
+ val = options.strictNullHandling ? null : "";
1267
+ } else {
1268
+ key = options.decoder(part.slice(0, pos), defaults.decoder, charset, "key");
1269
+ val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function (encodedVal) {
1270
+ return options.decoder(encodedVal, defaults.decoder, charset, "value");
1271
+ });
1272
+ }
1273
+ if (val && options.interpretNumericEntities && charset === "iso-8859-1") {
1274
+ val = interpretNumericEntities(val);
1275
+ }
1276
+ if (part.indexOf("[]=") > -1) {
1277
+ val = isArray(val) ? [val] : val;
1278
+ }
1279
+ var existing = has.call(obj, key);
1280
+ if (existing && options.duplicates === "combine") {
1281
+ obj[key] = utils.combine(obj[key], val);
1282
+ } else if (!existing || options.duplicates === "last") {
1283
+ obj[key] = val;
1284
+ }
1285
+ }
1286
+ return obj;
1287
+ };
1288
+ var parseObject = function (chain, val, options, valuesParsed) {
1289
+ var leaf = valuesParsed ? val : parseArrayValue(val, options);
1290
+ for (var i = chain.length - 1; i >= 0; --i) {
1291
+ var obj;
1292
+ var root = chain[i];
1293
+ if (root === "[]" && options.parseArrays) {
1294
+ obj = options.allowEmptyArrays && (leaf === "" || options.strictNullHandling && leaf === null) ? [] : [].concat(leaf);
1295
+ } else {
1296
+ obj = options.plainObjects ? Object.create(null) : {};
1297
+ var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root;
1298
+ var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot;
1299
+ var index = parseInt(decodedRoot, 10);
1300
+ if (!options.parseArrays && decodedRoot === "") {
1301
+ obj = {
1302
+ 0: leaf
1303
+ };
1304
+ } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && options.parseArrays && index <= options.arrayLimit) {
1305
+ obj = [];
1306
+ obj[index] = leaf;
1307
+ } else if (decodedRoot !== "__proto__") {
1308
+ obj[decodedRoot] = leaf;
1309
+ }
1310
+ }
1311
+ leaf = obj;
1312
+ }
1313
+ return leaf;
1314
+ };
1315
+ var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
1316
+ if (!givenKey) {
1317
+ return;
1318
+ }
1319
+
1320
+ // Transform dot notation to bracket notation
1321
+ var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
1322
+
1323
+ // The regex chunks
1324
+
1325
+ var brackets = /(\[[^[\]]*])/;
1326
+ var child = /(\[[^[\]]*])/g;
1327
+
1328
+ // Get the parent
1329
+
1330
+ var segment = options.depth > 0 && brackets.exec(key);
1331
+ var parent = segment ? key.slice(0, segment.index) : key;
1332
+
1333
+ // Stash the parent if it exists
1334
+
1335
+ var keys = [];
1336
+ if (parent) {
1337
+ // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
1338
+ if (!options.plainObjects && has.call(Object.prototype, parent)) {
1339
+ if (!options.allowPrototypes) {
1340
+ return;
1341
+ }
1342
+ }
1343
+ keys.push(parent);
1344
+ }
1345
+
1346
+ // Loop through children appending to the array until we hit depth
1347
+
1348
+ var i = 0;
1349
+ while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
1350
+ i += 1;
1351
+ if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
1352
+ if (!options.allowPrototypes) {
1353
+ return;
1354
+ }
1355
+ }
1356
+ keys.push(segment[1]);
1357
+ }
1358
+
1359
+ // If there's a remainder, check strictDepth option for throw, else just add whatever is left
1360
+
1361
+ if (segment) {
1362
+ if (options.strictDepth === true) {
1363
+ throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
1364
+ }
1365
+ keys.push("[" + key.slice(segment.index) + "]");
1366
+ }
1367
+ return parseObject(keys, val, options, valuesParsed);
1368
+ };
1369
+ var normalizeParseOptions = function normalizeParseOptions(opts) {
1370
+ if (!opts) {
1371
+ return defaults;
1372
+ }
1373
+ if (typeof opts.allowEmptyArrays !== "undefined" && typeof opts.allowEmptyArrays !== "boolean") {
1374
+ throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");
1375
+ }
1376
+ if (typeof opts.decodeDotInKeys !== "undefined" && typeof opts.decodeDotInKeys !== "boolean") {
1377
+ throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");
1378
+ }
1379
+ if (opts.decoder !== null && typeof opts.decoder !== "undefined" && typeof opts.decoder !== "function") {
1380
+ throw new TypeError("Decoder has to be a function.");
1381
+ }
1382
+ if (typeof opts.charset !== "undefined" && opts.charset !== "utf-8" && opts.charset !== "iso-8859-1") {
1383
+ throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");
1384
+ }
1385
+ var charset = typeof opts.charset === "undefined" ? defaults.charset : opts.charset;
1386
+ var duplicates = typeof opts.duplicates === "undefined" ? defaults.duplicates : opts.duplicates;
1387
+ if (duplicates !== "combine" && duplicates !== "first" && duplicates !== "last") {
1388
+ throw new TypeError("The duplicates option must be either combine, first, or last");
1389
+ }
1390
+ var allowDots = typeof opts.allowDots === "undefined" ? opts.decodeDotInKeys === true ? true : defaults.allowDots : !!opts.allowDots;
1391
+ return {
1392
+ allowDots: allowDots,
1393
+ allowEmptyArrays: typeof opts.allowEmptyArrays === "boolean" ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays,
1394
+ allowPrototypes: typeof opts.allowPrototypes === "boolean" ? opts.allowPrototypes : defaults.allowPrototypes,
1395
+ allowSparse: typeof opts.allowSparse === "boolean" ? opts.allowSparse : defaults.allowSparse,
1396
+ arrayLimit: typeof opts.arrayLimit === "number" ? opts.arrayLimit : defaults.arrayLimit,
1397
+ charset: charset,
1398
+ charsetSentinel: typeof opts.charsetSentinel === "boolean" ? opts.charsetSentinel : defaults.charsetSentinel,
1399
+ comma: typeof opts.comma === "boolean" ? opts.comma : defaults.comma,
1400
+ decodeDotInKeys: typeof opts.decodeDotInKeys === "boolean" ? opts.decodeDotInKeys : defaults.decodeDotInKeys,
1401
+ decoder: typeof opts.decoder === "function" ? opts.decoder : defaults.decoder,
1402
+ delimiter: typeof opts.delimiter === "string" || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
1403
+ // eslint-disable-next-line no-implicit-coercion, no-extra-parens
1404
+ depth: typeof opts.depth === "number" || opts.depth === false ? +opts.depth : defaults.depth,
1405
+ duplicates: duplicates,
1406
+ ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
1407
+ interpretNumericEntities: typeof opts.interpretNumericEntities === "boolean" ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
1408
+ parameterLimit: typeof opts.parameterLimit === "number" ? opts.parameterLimit : defaults.parameterLimit,
1409
+ parseArrays: opts.parseArrays !== false,
1410
+ plainObjects: typeof opts.plainObjects === "boolean" ? opts.plainObjects : defaults.plainObjects,
1411
+ strictDepth: typeof opts.strictDepth === "boolean" ? !!opts.strictDepth : defaults.strictDepth,
1412
+ strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling
1413
+ };
1414
+ };
1415
+ exports$3 = function (str, opts) {
1416
+ var options = normalizeParseOptions(opts);
1417
+ if (str === "" || str === null || typeof str === "undefined") {
1418
+ return options.plainObjects ? Object.create(null) : {};
1419
+ }
1420
+ var tempObj = typeof str === "string" ? parseValues(str, options) : str;
1421
+ var obj = options.plainObjects ? Object.create(null) : {};
1422
+
1423
+ // Iterate over the keys and setup the new object
1424
+
1425
+ var keys = Object.keys(tempObj);
1426
+ for (var i = 0; i < keys.length; ++i) {
1427
+ var key = keys[i];
1428
+ var newObj = parseKeys(key, tempObj[key], options, typeof str === "string");
1429
+ obj = utils.merge(obj, newObj, options);
1430
+ }
1431
+ if (options.allowSparse === true) {
1432
+ return obj;
1433
+ }
1434
+ return utils.compact(obj);
1435
+ };
1436
+ return exports$3;
1437
+ }
1438
+
1439
+ var exports$2 = {},
1440
+ _dewExec$1 = false;
1441
+ function dew$1() {
1442
+ if (_dewExec$1) return exports$2;
1443
+ _dewExec$1 = true;
1444
+ var stringify = dew$3();
1445
+ var parse = dew$2();
1446
+ var formats = dew$5();
1447
+ exports$2 = {
1448
+ formats: formats,
1449
+ parse: parse,
1450
+ stringify: stringify
1451
+ };
1452
+ return exports$2;
1453
+ }
1454
+
1455
+ var exports$1 = {},
1456
+ _dewExec = false;
1457
+ function dew() {
1458
+ if (_dewExec) return exports$1;
1459
+ _dewExec = true;
1460
+ var punycode = exports$9;
1461
+ function Url() {
1462
+ this.protocol = null;
1463
+ this.slashes = null;
1464
+ this.auth = null;
1465
+ this.host = null;
1466
+ this.port = null;
1467
+ this.hostname = null;
1468
+ this.hash = null;
1469
+ this.search = null;
1470
+ this.query = null;
1471
+ this.pathname = null;
1472
+ this.path = null;
1473
+ this.href = null;
1474
+ }
1475
+
1476
+ // Reference: RFC 3986, RFC 1808, RFC 2396
1477
+
1478
+ /*
1479
+ * define these here so at least they only have to be
1480
+ * compiled once on the first module load.
1481
+ */
1482
+ var protocolPattern = /^([a-z0-9.+-]+:)/i,
1483
+ portPattern = /:[0-9]*$/,
1484
+ // Special case for a simple path URL
1485
+ simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,
1486
+ /*
1487
+ * RFC 2396: characters reserved for delimiting URLs.
1488
+ * We actually just auto-escape these.
1489
+ */
1490
+ delims = ["<", ">", "\"", "`", " ", "\r", "\n", "\t"],
1491
+ // RFC 2396: characters not allowed for various reasons.
1492
+ unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims),
1493
+ // Allowed by RFCs, but cause of XSS attacks. Always escape these.
1494
+ autoEscape = ["'"].concat(unwise),
1495
+ /*
1496
+ * Characters that are never ever allowed in a hostname.
1497
+ * Note that any invalid chars are also handled, but these
1498
+ * are the ones that are *expected* to be seen, so we fast-path
1499
+ * them.
1500
+ */
1501
+ nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape),
1502
+ hostEndingChars = ["/", "?", "#"],
1503
+ hostnameMaxLen = 255,
1504
+ hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
1505
+ hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
1506
+ // protocols that can allow "unsafe" and "unwise" chars.
1507
+ unsafeProtocol = {
1508
+ javascript: true,
1509
+ "javascript:": true
1510
+ },
1511
+ // protocols that never have a hostname.
1512
+ hostlessProtocol = {
1513
+ javascript: true,
1514
+ "javascript:": true
1515
+ },
1516
+ // protocols that always contain a // bit.
1517
+ slashedProtocol = {
1518
+ http: true,
1519
+ https: true,
1520
+ ftp: true,
1521
+ gopher: true,
1522
+ file: true,
1523
+ "http:": true,
1524
+ "https:": true,
1525
+ "ftp:": true,
1526
+ "gopher:": true,
1527
+ "file:": true
1528
+ },
1529
+ querystring = dew$1();
1530
+ function urlParse(url, parseQueryString, slashesDenoteHost) {
1531
+ if (url && typeof url === "object" && url instanceof Url) {
1532
+ return url;
1533
+ }
1534
+ var u = new Url();
1535
+ u.parse(url, parseQueryString, slashesDenoteHost);
1536
+ return u;
1537
+ }
1538
+ Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
1539
+ if (typeof url !== "string") {
1540
+ throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
1541
+ }
1542
+
1543
+ /*
1544
+ * Copy chrome, IE, opera backslash-handling behavior.
1545
+ * Back slashes before the query string get converted to forward slashes
1546
+ * See: https://code.google.com/p/chromium/issues/detail?id=25916
1547
+ */
1548
+ var queryIndex = url.indexOf("?"),
1549
+ splitter = queryIndex !== -1 && queryIndex < url.indexOf("#") ? "?" : "#",
1550
+ uSplit = url.split(splitter),
1551
+ slashRegex = /\\/g;
1552
+ uSplit[0] = uSplit[0].replace(slashRegex, "/");
1553
+ url = uSplit.join(splitter);
1554
+ var rest = url;
1555
+
1556
+ /*
1557
+ * trim before proceeding.
1558
+ * This is to support parse stuff like " http://foo.com \n"
1559
+ */
1560
+ rest = rest.trim();
1561
+ if (!slashesDenoteHost && url.split("#").length === 1) {
1562
+ // Try fast path regexp
1563
+ var simplePath = simplePathPattern.exec(rest);
1564
+ if (simplePath) {
1565
+ this.path = rest;
1566
+ this.href = rest;
1567
+ this.pathname = simplePath[1];
1568
+ if (simplePath[2]) {
1569
+ this.search = simplePath[2];
1570
+ if (parseQueryString) {
1571
+ this.query = querystring.parse(this.search.substr(1));
1572
+ } else {
1573
+ this.query = this.search.substr(1);
1574
+ }
1575
+ } else if (parseQueryString) {
1576
+ this.search = "";
1577
+ this.query = {};
1578
+ }
1579
+ return this;
1580
+ }
1581
+ }
1582
+ var proto = protocolPattern.exec(rest);
1583
+ if (proto) {
1584
+ proto = proto[0];
1585
+ var lowerProto = proto.toLowerCase();
1586
+ this.protocol = lowerProto;
1587
+ rest = rest.substr(proto.length);
1588
+ }
1589
+
1590
+ /*
1591
+ * figure out if it's got a host
1592
+ * user@server is *always* interpreted as a hostname, and url
1593
+ * resolution will treat //foo/bar as host=foo,path=bar because that's
1594
+ * how the browser resolves relative URLs.
1595
+ */
1596
+ if (slashesDenoteHost || proto || rest.match(/^\/\/[^@/]+@[^@/]+/)) {
1597
+ var slashes = rest.substr(0, 2) === "//";
1598
+ if (slashes && !(proto && hostlessProtocol[proto])) {
1599
+ rest = rest.substr(2);
1600
+ this.slashes = true;
1601
+ }
1602
+ }
1603
+ if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
1604
+ /*
1605
+ * there's a hostname.
1606
+ * the first instance of /, ?, ;, or # ends the host.
1607
+ *
1608
+ * If there is an @ in the hostname, then non-host chars *are* allowed
1609
+ * to the left of the last @ sign, unless some host-ending character
1610
+ * comes *before* the @-sign.
1611
+ * URLs are obnoxious.
1612
+ *
1613
+ * ex:
1614
+ * http://a@b@c/ => user:a@b host:c
1615
+ * http://a@b?@c => user:a host:c path:/?@c
1616
+ */
1617
+
1618
+ /*
1619
+ * v0.12 TODO(isaacs): This is not quite how Chrome does things.
1620
+ * Review our test case against browsers more comprehensively.
1621
+ */
1622
+
1623
+ // find the first instance of any hostEndingChars
1624
+ var hostEnd = -1;
1625
+ for (var i = 0; i < hostEndingChars.length; i++) {
1626
+ var hec = rest.indexOf(hostEndingChars[i]);
1627
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
1628
+ hostEnd = hec;
1629
+ }
1630
+ }
1631
+
1632
+ /*
1633
+ * at this point, either we have an explicit point where the
1634
+ * auth portion cannot go past, or the last @ char is the decider.
1635
+ */
1636
+ var auth, atSign;
1637
+ if (hostEnd === -1) {
1638
+ // atSign can be anywhere.
1639
+ atSign = rest.lastIndexOf("@");
1640
+ } else {
1641
+ /*
1642
+ * atSign must be in auth portion.
1643
+ * http://a@b/c@d => host:b auth:a path:/c@d
1644
+ */
1645
+ atSign = rest.lastIndexOf("@", hostEnd);
1646
+ }
1647
+
1648
+ /*
1649
+ * Now we have a portion which is definitely the auth.
1650
+ * Pull that off.
1651
+ */
1652
+ if (atSign !== -1) {
1653
+ auth = rest.slice(0, atSign);
1654
+ rest = rest.slice(atSign + 1);
1655
+ this.auth = decodeURIComponent(auth);
1656
+ }
1657
+
1658
+ // the host is the remaining to the left of the first non-host char
1659
+ hostEnd = -1;
1660
+ for (var i = 0; i < nonHostChars.length; i++) {
1661
+ var hec = rest.indexOf(nonHostChars[i]);
1662
+ if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) {
1663
+ hostEnd = hec;
1664
+ }
1665
+ }
1666
+ // if we still have not hit it, then the entire thing is a host.
1667
+ if (hostEnd === -1) {
1668
+ hostEnd = rest.length;
1669
+ }
1670
+ this.host = rest.slice(0, hostEnd);
1671
+ rest = rest.slice(hostEnd);
1672
+
1673
+ // pull out port.
1674
+ this.parseHost();
1675
+
1676
+ /*
1677
+ * we've indicated that there is a hostname,
1678
+ * so even if it's empty, it has to be present.
1679
+ */
1680
+ this.hostname = this.hostname || "";
1681
+
1682
+ /*
1683
+ * if hostname begins with [ and ends with ]
1684
+ * assume that it's an IPv6 address.
1685
+ */
1686
+ var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
1687
+
1688
+ // validate a little.
1689
+ if (!ipv6Hostname) {
1690
+ var hostparts = this.hostname.split(/\./);
1691
+ for (var i = 0, l = hostparts.length; i < l; i++) {
1692
+ var part = hostparts[i];
1693
+ if (!part) {
1694
+ continue;
1695
+ }
1696
+ if (!part.match(hostnamePartPattern)) {
1697
+ var newpart = "";
1698
+ for (var j = 0, k = part.length; j < k; j++) {
1699
+ if (part.charCodeAt(j) > 127) {
1700
+ /*
1701
+ * we replace non-ASCII char with a temporary placeholder
1702
+ * we need this to make sure size of hostname is not
1703
+ * broken by replacing non-ASCII by nothing
1704
+ */
1705
+ newpart += "x";
1706
+ } else {
1707
+ newpart += part[j];
1708
+ }
1709
+ }
1710
+ // we test again with ASCII char only
1711
+ if (!newpart.match(hostnamePartPattern)) {
1712
+ var validParts = hostparts.slice(0, i);
1713
+ var notHost = hostparts.slice(i + 1);
1714
+ var bit = part.match(hostnamePartStart);
1715
+ if (bit) {
1716
+ validParts.push(bit[1]);
1717
+ notHost.unshift(bit[2]);
1718
+ }
1719
+ if (notHost.length) {
1720
+ rest = "/" + notHost.join(".") + rest;
1721
+ }
1722
+ this.hostname = validParts.join(".");
1723
+ break;
1724
+ }
1725
+ }
1726
+ }
1727
+ }
1728
+ if (this.hostname.length > hostnameMaxLen) {
1729
+ this.hostname = "";
1730
+ } else {
1731
+ // hostnames are always lower case.
1732
+ this.hostname = this.hostname.toLowerCase();
1733
+ }
1734
+ if (!ipv6Hostname) {
1735
+ /*
1736
+ * IDNA Support: Returns a punycoded representation of "domain".
1737
+ * It only converts parts of the domain name that
1738
+ * have non-ASCII characters, i.e. it doesn't matter if
1739
+ * you call it with a domain that already is ASCII-only.
1740
+ */
1741
+ this.hostname = punycode.toASCII(this.hostname);
1742
+ }
1743
+ var p = this.port ? ":" + this.port : "";
1744
+ var h = this.hostname || "";
1745
+ this.host = h + p;
1746
+ this.href += this.host;
1747
+
1748
+ /*
1749
+ * strip [ and ] from the hostname
1750
+ * the host field still retains them, though
1751
+ */
1752
+ if (ipv6Hostname) {
1753
+ this.hostname = this.hostname.substr(1, this.hostname.length - 2);
1754
+ if (rest[0] !== "/") {
1755
+ rest = "/" + rest;
1756
+ }
1757
+ }
1758
+ }
1759
+
1760
+ /*
1761
+ * now rest is set to the post-host stuff.
1762
+ * chop off any delim chars.
1763
+ */
1764
+ if (!unsafeProtocol[lowerProto]) {
1765
+ /*
1766
+ * First, make 100% sure that any "autoEscape" chars get
1767
+ * escaped, even if encodeURIComponent doesn't think they
1768
+ * need to be.
1769
+ */
1770
+ for (var i = 0, l = autoEscape.length; i < l; i++) {
1771
+ var ae = autoEscape[i];
1772
+ if (rest.indexOf(ae) === -1) {
1773
+ continue;
1774
+ }
1775
+ var esc = encodeURIComponent(ae);
1776
+ if (esc === ae) {
1777
+ esc = escape(ae);
1778
+ }
1779
+ rest = rest.split(ae).join(esc);
1780
+ }
1781
+ }
1782
+
1783
+ // chop off from the tail first.
1784
+ var hash = rest.indexOf("#");
1785
+ if (hash !== -1) {
1786
+ // got a fragment string.
1787
+ this.hash = rest.substr(hash);
1788
+ rest = rest.slice(0, hash);
1789
+ }
1790
+ var qm = rest.indexOf("?");
1791
+ if (qm !== -1) {
1792
+ this.search = rest.substr(qm);
1793
+ this.query = rest.substr(qm + 1);
1794
+ if (parseQueryString) {
1795
+ this.query = querystring.parse(this.query);
1796
+ }
1797
+ rest = rest.slice(0, qm);
1798
+ } else if (parseQueryString) {
1799
+ // no query string, but parseQueryString still requested
1800
+ this.search = "";
1801
+ this.query = {};
1802
+ }
1803
+ if (rest) {
1804
+ this.pathname = rest;
1805
+ }
1806
+ if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
1807
+ this.pathname = "/";
1808
+ }
1809
+
1810
+ // to support http.request
1811
+ if (this.pathname || this.search) {
1812
+ var p = this.pathname || "";
1813
+ var s = this.search || "";
1814
+ this.path = p + s;
1815
+ }
1816
+
1817
+ // finally, reconstruct the href based on what has been validated.
1818
+ this.href = this.format();
1819
+ return this;
1820
+ };
1821
+
1822
+ // format a parsed object into a url string
1823
+ function urlFormat(obj) {
1824
+ /*
1825
+ * ensure it's an object, and not a string url.
1826
+ * If it's an obj, this is a no-op.
1827
+ * this way, you can call url_format() on strings
1828
+ * to clean up potentially wonky urls.
1829
+ */
1830
+ if (typeof obj === "string") {
1831
+ obj = urlParse(obj);
1832
+ }
1833
+ if (!(obj instanceof Url)) {
1834
+ return Url.prototype.format.call(obj);
1835
+ }
1836
+ return obj.format();
1837
+ }
1838
+ Url.prototype.format = function () {
1839
+ var auth = this.auth || "";
1840
+ if (auth) {
1841
+ auth = encodeURIComponent(auth);
1842
+ auth = auth.replace(/%3A/i, ":");
1843
+ auth += "@";
1844
+ }
1845
+ var protocol = this.protocol || "",
1846
+ pathname = this.pathname || "",
1847
+ hash = this.hash || "",
1848
+ host = false,
1849
+ query = "";
1850
+ if (this.host) {
1851
+ host = auth + this.host;
1852
+ } else if (this.hostname) {
1853
+ host = auth + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]");
1854
+ if (this.port) {
1855
+ host += ":" + this.port;
1856
+ }
1857
+ }
1858
+ if (this.query && typeof this.query === "object" && Object.keys(this.query).length) {
1859
+ query = querystring.stringify(this.query, {
1860
+ arrayFormat: "repeat",
1861
+ addQueryPrefix: false
1862
+ });
1863
+ }
1864
+ var search = this.search || query && "?" + query || "";
1865
+ if (protocol && protocol.substr(-1) !== ":") {
1866
+ protocol += ":";
1867
+ }
1868
+
1869
+ /*
1870
+ * only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
1871
+ * unless they had them to begin with.
1872
+ */
1873
+ if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
1874
+ host = "//" + (host || "");
1875
+ if (pathname && pathname.charAt(0) !== "/") {
1876
+ pathname = "/" + pathname;
1877
+ }
1878
+ } else if (!host) {
1879
+ host = "";
1880
+ }
1881
+ if (hash && hash.charAt(0) !== "#") {
1882
+ hash = "#" + hash;
1883
+ }
1884
+ if (search && search.charAt(0) !== "?") {
1885
+ search = "?" + search;
1886
+ }
1887
+ pathname = pathname.replace(/[?#]/g, function (match) {
1888
+ return encodeURIComponent(match);
1889
+ });
1890
+ search = search.replace("#", "%23");
1891
+ return protocol + host + pathname + search + hash;
1892
+ };
1893
+ function urlResolve(source, relative) {
1894
+ return urlParse(source, false, true).resolve(relative);
1895
+ }
1896
+ Url.prototype.resolve = function (relative) {
1897
+ return this.resolveObject(urlParse(relative, false, true)).format();
1898
+ };
1899
+ function urlResolveObject(source, relative) {
1900
+ if (!source) {
1901
+ return relative;
1902
+ }
1903
+ return urlParse(source, false, true).resolveObject(relative);
1904
+ }
1905
+ Url.prototype.resolveObject = function (relative) {
1906
+ if (typeof relative === "string") {
1907
+ var rel = new Url();
1908
+ rel.parse(relative, false, true);
1909
+ relative = rel;
1910
+ }
1911
+ var result = new Url();
1912
+ var tkeys = Object.keys(this);
1913
+ for (var tk = 0; tk < tkeys.length; tk++) {
1914
+ var tkey = tkeys[tk];
1915
+ result[tkey] = this[tkey];
1916
+ }
1917
+
1918
+ /*
1919
+ * hash is always overridden, no matter what.
1920
+ * even href="" will remove it.
1921
+ */
1922
+ result.hash = relative.hash;
1923
+
1924
+ // if the relative url is empty, then there's nothing left to do here.
1925
+ if (relative.href === "") {
1926
+ result.href = result.format();
1927
+ return result;
1928
+ }
1929
+
1930
+ // hrefs like //foo/bar always cut to the protocol.
1931
+ if (relative.slashes && !relative.protocol) {
1932
+ // take everything except the protocol from relative
1933
+ var rkeys = Object.keys(relative);
1934
+ for (var rk = 0; rk < rkeys.length; rk++) {
1935
+ var rkey = rkeys[rk];
1936
+ if (rkey !== "protocol") {
1937
+ result[rkey] = relative[rkey];
1938
+ }
1939
+ }
1940
+
1941
+ // urlParse appends trailing / to urls like http://www.example.com
1942
+ if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
1943
+ result.pathname = "/";
1944
+ result.path = result.pathname;
1945
+ }
1946
+ result.href = result.format();
1947
+ return result;
1948
+ }
1949
+ if (relative.protocol && relative.protocol !== result.protocol) {
1950
+ /*
1951
+ * if it's a known url protocol, then changing
1952
+ * the protocol does weird things
1953
+ * first, if it's not file:, then we MUST have a host,
1954
+ * and if there was a path
1955
+ * to begin with, then we MUST have a path.
1956
+ * if it is file:, then the host is dropped,
1957
+ * because that's known to be hostless.
1958
+ * anything else is assumed to be absolute.
1959
+ */
1960
+ if (!slashedProtocol[relative.protocol]) {
1961
+ var keys = Object.keys(relative);
1962
+ for (var v = 0; v < keys.length; v++) {
1963
+ var k = keys[v];
1964
+ result[k] = relative[k];
1965
+ }
1966
+ result.href = result.format();
1967
+ return result;
1968
+ }
1969
+ result.protocol = relative.protocol;
1970
+ if (!relative.host && !hostlessProtocol[relative.protocol]) {
1971
+ var relPath = (relative.pathname || "").split("/");
1972
+ while (relPath.length && !(relative.host = relPath.shift())) {}
1973
+ if (!relative.host) {
1974
+ relative.host = "";
1975
+ }
1976
+ if (!relative.hostname) {
1977
+ relative.hostname = "";
1978
+ }
1979
+ if (relPath[0] !== "") {
1980
+ relPath.unshift("");
1981
+ }
1982
+ if (relPath.length < 2) {
1983
+ relPath.unshift("");
1984
+ }
1985
+ result.pathname = relPath.join("/");
1986
+ } else {
1987
+ result.pathname = relative.pathname;
1988
+ }
1989
+ result.search = relative.search;
1990
+ result.query = relative.query;
1991
+ result.host = relative.host || "";
1992
+ result.auth = relative.auth;
1993
+ result.hostname = relative.hostname || relative.host;
1994
+ result.port = relative.port;
1995
+ // to support http.request
1996
+ if (result.pathname || result.search) {
1997
+ var p = result.pathname || "";
1998
+ var s = result.search || "";
1999
+ result.path = p + s;
2000
+ }
2001
+ result.slashes = result.slashes || relative.slashes;
2002
+ result.href = result.format();
2003
+ return result;
2004
+ }
2005
+ var isSourceAbs = result.pathname && result.pathname.charAt(0) === "/",
2006
+ isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === "/",
2007
+ mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
2008
+ removeAllDots = mustEndAbs,
2009
+ srcPath = result.pathname && result.pathname.split("/") || [],
2010
+ relPath = relative.pathname && relative.pathname.split("/") || [],
2011
+ psychotic = result.protocol && !slashedProtocol[result.protocol];
2012
+
2013
+ /*
2014
+ * if the url is a non-slashed url, then relative
2015
+ * links like ../.. should be able
2016
+ * to crawl up to the hostname, as well. This is strange.
2017
+ * result.protocol has already been set by now.
2018
+ * Later on, put the first path part into the host field.
2019
+ */
2020
+ if (psychotic) {
2021
+ result.hostname = "";
2022
+ result.port = null;
2023
+ if (result.host) {
2024
+ if (srcPath[0] === "") {
2025
+ srcPath[0] = result.host;
2026
+ } else {
2027
+ srcPath.unshift(result.host);
2028
+ }
2029
+ }
2030
+ result.host = "";
2031
+ if (relative.protocol) {
2032
+ relative.hostname = null;
2033
+ relative.port = null;
2034
+ if (relative.host) {
2035
+ if (relPath[0] === "") {
2036
+ relPath[0] = relative.host;
2037
+ } else {
2038
+ relPath.unshift(relative.host);
2039
+ }
2040
+ }
2041
+ relative.host = null;
2042
+ }
2043
+ mustEndAbs = mustEndAbs && (relPath[0] === "" || srcPath[0] === "");
2044
+ }
2045
+ if (isRelAbs) {
2046
+ // it's absolute.
2047
+ result.host = relative.host || relative.host === "" ? relative.host : result.host;
2048
+ result.hostname = relative.hostname || relative.hostname === "" ? relative.hostname : result.hostname;
2049
+ result.search = relative.search;
2050
+ result.query = relative.query;
2051
+ srcPath = relPath;
2052
+ // fall through to the dot-handling below.
2053
+ } else if (relPath.length) {
2054
+ /*
2055
+ * it's relative
2056
+ * throw away the existing file, and take the new path instead.
2057
+ */
2058
+ if (!srcPath) {
2059
+ srcPath = [];
2060
+ }
2061
+ srcPath.pop();
2062
+ srcPath = srcPath.concat(relPath);
2063
+ result.search = relative.search;
2064
+ result.query = relative.query;
2065
+ } else if (relative.search != null) {
2066
+ /*
2067
+ * just pull out the search.
2068
+ * like href='?foo'.
2069
+ * Put this after the other two cases because it simplifies the booleans
2070
+ */
2071
+ if (psychotic) {
2072
+ result.host = srcPath.shift();
2073
+ result.hostname = result.host;
2074
+ /*
2075
+ * occationaly the auth can get stuck only in host
2076
+ * this especially happens in cases like
2077
+ * url.resolveObject('mailto:local1@domain1', 'local2@domain2')
2078
+ */
2079
+ var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
2080
+ if (authInHost) {
2081
+ result.auth = authInHost.shift();
2082
+ result.hostname = authInHost.shift();
2083
+ result.host = result.hostname;
2084
+ }
2085
+ }
2086
+ result.search = relative.search;
2087
+ result.query = relative.query;
2088
+ // to support http.request
2089
+ if (result.pathname !== null || result.search !== null) {
2090
+ result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
2091
+ }
2092
+ result.href = result.format();
2093
+ return result;
2094
+ }
2095
+ if (!srcPath.length) {
2096
+ /*
2097
+ * no path at all. easy.
2098
+ * we've already handled the other stuff above.
2099
+ */
2100
+ result.pathname = null;
2101
+ // to support http.request
2102
+ if (result.search) {
2103
+ result.path = "/" + result.search;
2104
+ } else {
2105
+ result.path = null;
2106
+ }
2107
+ result.href = result.format();
2108
+ return result;
2109
+ }
2110
+
2111
+ /*
2112
+ * if a url ENDs in . or .., then it must get a trailing slash.
2113
+ * however, if it ends in anything else non-slashy,
2114
+ * then it must NOT get a trailing slash.
2115
+ */
2116
+ var last = srcPath.slice(-1)[0];
2117
+ var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..") || last === "";
2118
+
2119
+ /*
2120
+ * strip single dots, resolve double dots to parent dir
2121
+ * if the path tries to go above the root, `up` ends up > 0
2122
+ */
2123
+ var up = 0;
2124
+ for (var i = srcPath.length; i >= 0; i--) {
2125
+ last = srcPath[i];
2126
+ if (last === ".") {
2127
+ srcPath.splice(i, 1);
2128
+ } else if (last === "..") {
2129
+ srcPath.splice(i, 1);
2130
+ up++;
2131
+ } else if (up) {
2132
+ srcPath.splice(i, 1);
2133
+ up--;
2134
+ }
2135
+ }
2136
+
2137
+ // if the path is allowed to go above the root, restore leading ..s
2138
+ if (!mustEndAbs && !removeAllDots) {
2139
+ for (; up--; up) {
2140
+ srcPath.unshift("..");
2141
+ }
2142
+ }
2143
+ if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) {
2144
+ srcPath.unshift("");
2145
+ }
2146
+ if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") {
2147
+ srcPath.push("");
2148
+ }
2149
+ var isAbsolute = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
2150
+
2151
+ // put the host back
2152
+ if (psychotic) {
2153
+ result.hostname = isAbsolute ? "" : srcPath.length ? srcPath.shift() : "";
2154
+ result.host = result.hostname;
2155
+ /*
2156
+ * occationaly the auth can get stuck only in host
2157
+ * this especially happens in cases like
2158
+ * url.resolveObject('mailto:local1@domain1', 'local2@domain2')
2159
+ */
2160
+ var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
2161
+ if (authInHost) {
2162
+ result.auth = authInHost.shift();
2163
+ result.hostname = authInHost.shift();
2164
+ result.host = result.hostname;
2165
+ }
2166
+ }
2167
+ mustEndAbs = mustEndAbs || result.host && srcPath.length;
2168
+ if (mustEndAbs && !isAbsolute) {
2169
+ srcPath.unshift("");
2170
+ }
2171
+ if (srcPath.length > 0) {
2172
+ result.pathname = srcPath.join("/");
2173
+ } else {
2174
+ result.pathname = null;
2175
+ result.path = null;
2176
+ }
2177
+
2178
+ // to support request.http
2179
+ if (result.pathname !== null || result.search !== null) {
2180
+ result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
2181
+ }
2182
+ result.auth = relative.auth || result.auth;
2183
+ result.slashes = result.slashes || relative.slashes;
2184
+ result.href = result.format();
2185
+ return result;
2186
+ };
2187
+ Url.prototype.parseHost = function () {
2188
+ var host = this.host;
2189
+ var port = portPattern.exec(host);
2190
+ if (port) {
2191
+ port = port[0];
2192
+ if (port !== ":") {
2193
+ this.port = port.substr(1);
2194
+ }
2195
+ host = host.substr(0, host.length - port.length);
2196
+ }
2197
+ if (host) {
2198
+ this.hostname = host;
2199
+ }
2200
+ };
2201
+ exports$1.parse = urlParse;
2202
+ exports$1.resolve = urlResolve;
2203
+ exports$1.resolveObject = urlResolveObject;
2204
+ exports$1.format = urlFormat;
2205
+ exports$1.Url = Url;
2206
+ return exports$1;
2207
+ }
2208
+
2209
+ const exports = dew();
2210
+ exports['parse']; exports['resolve']; exports['resolveObject']; exports['format']; exports['Url'];
2211
+
2212
+ // Copyright Joyent, Inc. and other Node contributors.
2213
+ //
2214
+ // Permission is hereby granted, free of charge, to any person obtaining a
2215
+ // copy of this software and associated documentation files (the
2216
+ // "Software"), to deal in the Software without restriction, including
2217
+ // without limitation the rights to use, copy, modify, merge, publish,
2218
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
2219
+ // persons to whom the Software is furnished to do so, subject to the
2220
+ // following conditions:
2221
+ //
2222
+ // The above copyright notice and this permission notice shall be included
2223
+ // in all copies or substantial portions of the Software.
2224
+ //
2225
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
2226
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2227
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
2228
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
2229
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2230
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2231
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
2232
+
2233
+
2234
+ const processPlatform = typeof Deno !== 'undefined' ? (Deno.build.os === "windows" ? "win32" : Deno.build.os) : undefined;
2235
+
2236
+ exports.URL = typeof URL !== 'undefined' ? URL : null;
2237
+ exports.pathToFileURL = pathToFileURL;
2238
+ exports.fileURLToPath = fileURLToPath;
2239
+
2240
+ var Url = exports.Url;
2241
+ var format = exports.format;
2242
+ var resolve = exports.resolve;
2243
+ var resolveObject = exports.resolveObject;
2244
+ var parse = exports.parse;
2245
+
2246
+ const _URL = exports.URL;
2247
+
2248
+ const CHAR_BACKWARD_SLASH = 92;
2249
+ const CHAR_FORWARD_SLASH = 47;
2250
+ const CHAR_LOWERCASE_A = 97;
2251
+ const CHAR_LOWERCASE_Z = 122;
2252
+
2253
+ const isWindows = processPlatform === 'win32';
2254
+
2255
+ const forwardSlashRegEx = /\//g;
2256
+ const percentRegEx = /%/g;
2257
+ const backslashRegEx = /\\/g;
2258
+ const newlineRegEx = /\n/g;
2259
+ const carriageReturnRegEx = /\r/g;
2260
+ const tabRegEx = /\t/g;
2261
+
2262
+ /**
2263
+ * Get fully resolved platform-specific file path from the given URL string/ object
2264
+ * @param path The file URL string or URL object to convert to a path
2265
+ */
2266
+ function fileURLToPath(path) {
2267
+ if (typeof path === "string") path = new URL(path);
2268
+ else if (!(path instanceof URL)) {
2269
+ throw new Deno.errors.InvalidData(
2270
+ "invalid argument path , must be a string or URL",
2271
+ );
2272
+ }
2273
+ if (path.protocol !== "file:") {
2274
+ throw new Deno.errors.InvalidData("invalid url scheme");
2275
+ }
2276
+ return isWindows ? getPathFromURLWin(path) : getPathFromURLPosix(path);
2277
+ }
2278
+
2279
+ function getPathFromURLWin(url) {
2280
+ const hostname = url.hostname;
2281
+ let pathname = url.pathname;
2282
+ for (let n = 0; n < pathname.length; n++) {
2283
+ if (pathname[n] === "%") {
2284
+ const third = pathname.codePointAt(n + 2) || 0x20;
2285
+ if (
2286
+ (pathname[n + 1] === "2" && third === 102) || // 2f 2F /
2287
+ (pathname[n + 1] === "5" && third === 99)
2288
+ ) {
2289
+ // 5c 5C \
2290
+ throw new Deno.errors.InvalidData(
2291
+ "must not include encoded \\ or / characters",
2292
+ );
2293
+ }
2294
+ }
2295
+ }
2296
+
2297
+ pathname = pathname.replace(forwardSlashRegEx, "\\");
2298
+ pathname = decodeURIComponent(pathname);
2299
+ if (hostname !== "") {
2300
+ //TODO add support for punycode encodings
2301
+ return `\\\\${hostname}${pathname}`;
2302
+ } else {
2303
+ // Otherwise, it's a local path that requires a drive letter
2304
+ const letter = pathname.codePointAt(1) | 0x20;
2305
+ const sep = pathname[2];
2306
+ if (
2307
+ letter < CHAR_LOWERCASE_A ||
2308
+ letter > CHAR_LOWERCASE_Z || // a..z A..Z
2309
+ sep !== ":"
2310
+ ) {
2311
+ throw new Deno.errors.InvalidData("file url path must be absolute");
2312
+ }
2313
+ return pathname.slice(1);
2314
+ }
2315
+ }
2316
+ function getPathFromURLPosix(url) {
2317
+ if (url.hostname !== "") {
2318
+ throw new Deno.errors.InvalidData("invalid file url hostname");
2319
+ }
2320
+ const pathname = url.pathname;
2321
+ for (let n = 0; n < pathname.length; n++) {
2322
+ if (pathname[n] === "%") {
2323
+ const third = pathname.codePointAt(n + 2) || 0x20;
2324
+ if (pathname[n + 1] === "2" && third === 102) {
2325
+ throw new Deno.errors.InvalidData(
2326
+ "must not include encoded / characters",
2327
+ );
2328
+ }
2329
+ }
2330
+ }
2331
+ return decodeURIComponent(pathname);
2332
+ }
2333
+
2334
+ /** Get fully resolved platform-specific File URL from the given file path */
2335
+ function pathToFileURL(filepath) {
2336
+ let resolved = exports$a.resolve(filepath);
2337
+ // path.resolve strips trailing slashes so we must add them back
2338
+ const filePathLast = filepath.charCodeAt(filepath.length - 1);
2339
+ if (
2340
+ (filePathLast === CHAR_FORWARD_SLASH ||
2341
+ (isWindows && filePathLast === CHAR_BACKWARD_SLASH)) &&
2342
+ resolved[resolved.length - 1] !== exports$a.sep
2343
+ ) {
2344
+ resolved += "/";
2345
+ }
2346
+ const outURL = new URL("file://");
2347
+ if (resolved.includes("%")) resolved = resolved.replace(percentRegEx, "%25");
2348
+ // In posix, "/" is a valid character in paths
2349
+ if (!isWindows && resolved.includes("\\")) {
2350
+ resolved = resolved.replace(backslashRegEx, "%5C");
2351
+ }
2352
+ if (resolved.includes("\n")) resolved = resolved.replace(newlineRegEx, "%0A");
2353
+ if (resolved.includes("\r")) {
2354
+ resolved = resolved.replace(carriageReturnRegEx, "%0D");
2355
+ }
2356
+ if (resolved.includes("\t")) resolved = resolved.replace(tabRegEx, "%09");
2357
+ outURL.pathname = resolved;
2358
+ return outURL;
2359
+ }
2360
+
2361
+ export { _URL as URL, Url, exports as default, fileURLToPath, format, parse, pathToFileURL, resolve, resolveObject };