pixivflow 2.16.0 → 2.16.1

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 (788) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/version.js +1 -1
  3. package/dist/webui/package.json +1 -1
  4. package/node_modules/@redtidev/pixiv-client/LICENSE +21 -0
  5. package/node_modules/@redtidev/pixiv-client/README.md +103 -0
  6. package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.d.ts +6 -0
  7. package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.d.ts.map +1 -0
  8. package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.js +14 -0
  9. package/node_modules/@redtidev/pixiv-client/dist/app-api/exports.js.map +1 -0
  10. package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.d.ts +30 -0
  11. package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.d.ts.map +1 -0
  12. package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.js +137 -0
  13. package/node_modules/@redtidev/pixiv-client/dist/app-api/illustrations.js.map +1 -0
  14. package/node_modules/@redtidev/pixiv-client/dist/app-api/media.d.ts +16 -0
  15. package/node_modules/@redtidev/pixiv-client/dist/app-api/media.d.ts.map +1 -0
  16. package/node_modules/@redtidev/pixiv-client/dist/app-api/media.js +25 -0
  17. package/node_modules/@redtidev/pixiv-client/dist/app-api/media.js.map +1 -0
  18. package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.d.ts +43 -0
  19. package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.d.ts.map +1 -0
  20. package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.js +250 -0
  21. package/node_modules/@redtidev/pixiv-client/dist/app-api/novels.js.map +1 -0
  22. package/node_modules/@redtidev/pixiv-client/dist/app-api/options.d.ts +42 -0
  23. package/node_modules/@redtidev/pixiv-client/dist/app-api/options.d.ts.map +1 -0
  24. package/node_modules/@redtidev/pixiv-client/dist/app-api/options.js +7 -0
  25. package/node_modules/@redtidev/pixiv-client/dist/app-api/options.js.map +1 -0
  26. package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.d.ts +9 -0
  27. package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.d.ts.map +1 -0
  28. package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.js +22 -0
  29. package/node_modules/@redtidev/pixiv-client/dist/app-api/tags.js.map +1 -0
  30. package/node_modules/@redtidev/pixiv-client/dist/app-api/users.d.ts +17 -0
  31. package/node_modules/@redtidev/pixiv-client/dist/app-api/users.d.ts.map +1 -0
  32. package/node_modules/@redtidev/pixiv-client/dist/app-api/users.js +23 -0
  33. package/node_modules/@redtidev/pixiv-client/dist/app-api/users.js.map +1 -0
  34. package/node_modules/@redtidev/pixiv-client/dist/auth/types.d.ts +25 -0
  35. package/node_modules/@redtidev/pixiv-client/dist/auth/types.d.ts.map +1 -0
  36. package/node_modules/@redtidev/pixiv-client/dist/auth/types.js +24 -0
  37. package/node_modules/@redtidev/pixiv-client/dist/auth/types.js.map +1 -0
  38. package/node_modules/@redtidev/pixiv-client/dist/client.d.ts +42 -0
  39. package/node_modules/@redtidev/pixiv-client/dist/client.d.ts.map +1 -0
  40. package/node_modules/@redtidev/pixiv-client/dist/client.js +86 -0
  41. package/node_modules/@redtidev/pixiv-client/dist/client.js.map +1 -0
  42. package/node_modules/@redtidev/pixiv-client/dist/errors/errors.d.ts +117 -0
  43. package/node_modules/@redtidev/pixiv-client/dist/errors/errors.d.ts.map +1 -0
  44. package/node_modules/@redtidev/pixiv-client/dist/errors/errors.js +169 -0
  45. package/node_modules/@redtidev/pixiv-client/dist/errors/errors.js.map +1 -0
  46. package/node_modules/@redtidev/pixiv-client/dist/index.d.ts +25 -0
  47. package/node_modules/@redtidev/pixiv-client/dist/index.d.ts.map +1 -0
  48. package/node_modules/@redtidev/pixiv-client/dist/index.js +50 -0
  49. package/node_modules/@redtidev/pixiv-client/dist/index.js.map +1 -0
  50. package/node_modules/@redtidev/pixiv-client/dist/logger.d.ts +13 -0
  51. package/node_modules/@redtidev/pixiv-client/dist/logger.d.ts.map +1 -0
  52. package/node_modules/@redtidev/pixiv-client/dist/logger.js +10 -0
  53. package/node_modules/@redtidev/pixiv-client/dist/logger.js.map +1 -0
  54. package/node_modules/@redtidev/pixiv-client/dist/models/index.d.ts +112 -0
  55. package/node_modules/@redtidev/pixiv-client/dist/models/index.d.ts.map +1 -0
  56. package/node_modules/@redtidev/pixiv-client/dist/models/index.js +8 -0
  57. package/node_modules/@redtidev/pixiv-client/dist/models/index.js.map +1 -0
  58. package/node_modules/@redtidev/pixiv-client/dist/pagination.d.ts +22 -0
  59. package/node_modules/@redtidev/pixiv-client/dist/pagination.d.ts.map +1 -0
  60. package/node_modules/@redtidev/pixiv-client/dist/pagination.js +41 -0
  61. package/node_modules/@redtidev/pixiv-client/dist/pagination.js.map +1 -0
  62. package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.d.ts +95 -0
  63. package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.d.ts.map +1 -0
  64. package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.js +344 -0
  65. package/node_modules/@redtidev/pixiv-client/dist/rate-limit/RateLimitGate.js.map +1 -0
  66. package/node_modules/@redtidev/pixiv-client/dist/transport/transport.d.ts +65 -0
  67. package/node_modules/@redtidev/pixiv-client/dist/transport/transport.d.ts.map +1 -0
  68. package/node_modules/@redtidev/pixiv-client/dist/transport/transport.js +410 -0
  69. package/node_modules/@redtidev/pixiv-client/dist/transport/transport.js.map +1 -0
  70. package/node_modules/@redtidev/pixiv-client/dist/types.d.ts +186 -0
  71. package/node_modules/@redtidev/pixiv-client/dist/types.d.ts.map +1 -0
  72. package/node_modules/@redtidev/pixiv-client/dist/types.js +3 -0
  73. package/node_modules/@redtidev/pixiv-client/dist/types.js.map +1 -0
  74. package/node_modules/@redtidev/pixiv-client/dist/web-api/types.d.ts +19 -0
  75. package/node_modules/@redtidev/pixiv-client/dist/web-api/types.d.ts.map +1 -0
  76. package/node_modules/@redtidev/pixiv-client/dist/web-api/types.js +3 -0
  77. package/node_modules/@redtidev/pixiv-client/dist/web-api/types.js.map +1 -0
  78. package/node_modules/@redtidev/pixiv-client/package.json +55 -0
  79. package/node_modules/@redtidev/pixiv-client/src/__tests__/independence.test.ts +75 -0
  80. package/node_modules/@redtidev/pixiv-client/src/__tests__/integration.test.ts +268 -0
  81. package/node_modules/@redtidev/pixiv-client/src/app-api/__tests__/services.test.ts +199 -0
  82. package/node_modules/@redtidev/pixiv-client/src/app-api/exports.ts +5 -0
  83. package/node_modules/@redtidev/pixiv-client/src/app-api/illustrations.ts +144 -0
  84. package/node_modules/@redtidev/pixiv-client/src/app-api/media.ts +20 -0
  85. package/node_modules/@redtidev/pixiv-client/src/app-api/novels.ts +269 -0
  86. package/node_modules/@redtidev/pixiv-client/src/app-api/options.ts +73 -0
  87. package/node_modules/@redtidev/pixiv-client/src/app-api/tags.ts +21 -0
  88. package/node_modules/@redtidev/pixiv-client/src/app-api/users.ts +22 -0
  89. package/node_modules/@redtidev/pixiv-client/src/auth/types.ts +33 -0
  90. package/node_modules/@redtidev/pixiv-client/src/client.ts +105 -0
  91. package/node_modules/@redtidev/pixiv-client/src/errors/errors.ts +180 -0
  92. package/node_modules/@redtidev/pixiv-client/src/index.ts +91 -0
  93. package/node_modules/@redtidev/pixiv-client/src/logger.ts +18 -0
  94. package/node_modules/@redtidev/pixiv-client/src/models/index.ts +117 -0
  95. package/node_modules/@redtidev/pixiv-client/src/pagination.ts +46 -0
  96. package/node_modules/@redtidev/pixiv-client/src/rate-limit/RateLimitGate.ts +365 -0
  97. package/node_modules/@redtidev/pixiv-client/src/rate-limit/__tests__/RateLimitGate.test.ts +258 -0
  98. package/node_modules/@redtidev/pixiv-client/src/transport/__tests__/transport.test.ts +282 -0
  99. package/node_modules/@redtidev/pixiv-client/src/transport/transport.ts +500 -0
  100. package/node_modules/@redtidev/pixiv-client/src/types.ts +168 -0
  101. package/node_modules/@redtidev/pixiv-client/src/web-api/types.ts +19 -0
  102. package/node_modules/agent-base/LICENSE +22 -0
  103. package/node_modules/agent-base/README.md +69 -0
  104. package/node_modules/agent-base/dist/helpers.d.ts +15 -0
  105. package/node_modules/agent-base/dist/helpers.d.ts.map +1 -0
  106. package/node_modules/agent-base/dist/helpers.js +66 -0
  107. package/node_modules/agent-base/dist/helpers.js.map +1 -0
  108. package/node_modules/agent-base/dist/index.d.ts +41 -0
  109. package/node_modules/agent-base/dist/index.d.ts.map +1 -0
  110. package/node_modules/agent-base/dist/index.js +178 -0
  111. package/node_modules/agent-base/dist/index.js.map +1 -0
  112. package/node_modules/agent-base/package.json +46 -0
  113. package/node_modules/asynckit/LICENSE +21 -0
  114. package/node_modules/asynckit/README.md +233 -0
  115. package/node_modules/asynckit/bench.js +76 -0
  116. package/node_modules/asynckit/index.js +6 -0
  117. package/node_modules/asynckit/lib/abort.js +29 -0
  118. package/node_modules/asynckit/lib/async.js +34 -0
  119. package/node_modules/asynckit/lib/defer.js +26 -0
  120. package/node_modules/asynckit/lib/iterate.js +75 -0
  121. package/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  122. package/node_modules/asynckit/lib/readable_parallel.js +25 -0
  123. package/node_modules/asynckit/lib/readable_serial.js +25 -0
  124. package/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  125. package/node_modules/asynckit/lib/state.js +37 -0
  126. package/node_modules/asynckit/lib/streamify.js +141 -0
  127. package/node_modules/asynckit/lib/terminator.js +29 -0
  128. package/node_modules/asynckit/package.json +63 -0
  129. package/node_modules/asynckit/parallel.js +43 -0
  130. package/node_modules/asynckit/serial.js +17 -0
  131. package/node_modules/asynckit/serialOrdered.js +75 -0
  132. package/node_modules/asynckit/stream.js +21 -0
  133. package/node_modules/axios/CHANGELOG.md +1934 -0
  134. package/node_modules/axios/LICENSE +7 -0
  135. package/node_modules/axios/MIGRATION_GUIDE.md +877 -0
  136. package/node_modules/axios/README.md +2851 -0
  137. package/node_modules/axios/dist/axios.js +5807 -0
  138. package/node_modules/axios/dist/axios.min.js +5 -0
  139. package/node_modules/axios/dist/axios.min.js.map +1 -0
  140. package/node_modules/axios/dist/browser/axios.cjs +5829 -0
  141. package/node_modules/axios/dist/esm/axios.js +5850 -0
  142. package/node_modules/axios/dist/esm/axios.min.js +3 -0
  143. package/node_modules/axios/dist/esm/axios.min.js.map +1 -0
  144. package/node_modules/axios/dist/node/axios.cjs +6808 -0
  145. package/node_modules/axios/index.d.cts +766 -0
  146. package/node_modules/axios/index.d.ts +787 -0
  147. package/node_modules/axios/index.js +45 -0
  148. package/node_modules/axios/lib/adapters/README.md +36 -0
  149. package/node_modules/axios/lib/adapters/adapters.js +132 -0
  150. package/node_modules/axios/lib/adapters/fetch.js +696 -0
  151. package/node_modules/axios/lib/adapters/http.js +1490 -0
  152. package/node_modules/axios/lib/adapters/xhr.js +277 -0
  153. package/node_modules/axios/lib/axios.js +89 -0
  154. package/node_modules/axios/lib/cancel/CancelToken.js +135 -0
  155. package/node_modules/axios/lib/cancel/CanceledError.js +22 -0
  156. package/node_modules/axios/lib/cancel/isCancel.js +5 -0
  157. package/node_modules/axios/lib/core/Axios.js +306 -0
  158. package/node_modules/axios/lib/core/AxiosError.js +219 -0
  159. package/node_modules/axios/lib/core/AxiosHeaders.js +474 -0
  160. package/node_modules/axios/lib/core/InterceptorManager.js +171 -0
  161. package/node_modules/axios/lib/core/README.md +8 -0
  162. package/node_modules/axios/lib/core/buildFullPath.js +76 -0
  163. package/node_modules/axios/lib/core/dispatchRequest.js +95 -0
  164. package/node_modules/axios/lib/core/mergeConfig.js +174 -0
  165. package/node_modules/axios/lib/core/methodList.js +17 -0
  166. package/node_modules/axios/lib/core/setFormDataHeaders.js +27 -0
  167. package/node_modules/axios/lib/core/settle.js +27 -0
  168. package/node_modules/axios/lib/core/transformData.js +28 -0
  169. package/node_modules/axios/lib/defaults/index.js +178 -0
  170. package/node_modules/axios/lib/defaults/transitional.js +10 -0
  171. package/node_modules/axios/lib/env/README.md +3 -0
  172. package/node_modules/axios/lib/env/classes/FormData.js +2 -0
  173. package/node_modules/axios/lib/env/data.js +1 -0
  174. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +156 -0
  175. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +59 -0
  176. package/node_modules/axios/lib/helpers/Http2Sessions.js +121 -0
  177. package/node_modules/axios/lib/helpers/HttpStatusCode.js +88 -0
  178. package/node_modules/axios/lib/helpers/README.md +7 -0
  179. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +29 -0
  180. package/node_modules/axios/lib/helpers/bind.js +14 -0
  181. package/node_modules/axios/lib/helpers/buildURL.js +69 -0
  182. package/node_modules/axios/lib/helpers/callbackify.js +18 -0
  183. package/node_modules/axios/lib/helpers/combineURLs.js +23 -0
  184. package/node_modules/axios/lib/helpers/composeSignals.js +68 -0
  185. package/node_modules/axios/lib/helpers/cookies.js +64 -0
  186. package/node_modules/axios/lib/helpers/deprecatedMethod.js +31 -0
  187. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +166 -0
  188. package/node_modules/axios/lib/helpers/formDataToJSON.js +125 -0
  189. package/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  190. package/node_modules/axios/lib/helpers/fromDataURI.js +69 -0
  191. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +19 -0
  192. package/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  193. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
  194. package/node_modules/axios/lib/helpers/normalizeURLForProtocolCheck.js +24 -0
  195. package/node_modules/axios/lib/helpers/null.js +2 -0
  196. package/node_modules/axios/lib/helpers/parseHeaders.js +71 -0
  197. package/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  198. package/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  199. package/node_modules/axios/lib/helpers/readBlob.js +15 -0
  200. package/node_modules/axios/lib/helpers/resolveConfig.js +107 -0
  201. package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
  202. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +505 -0
  203. package/node_modules/axios/lib/helpers/speedometer.js +55 -0
  204. package/node_modules/axios/lib/helpers/spread.js +28 -0
  205. package/node_modules/axios/lib/helpers/throttle.js +45 -0
  206. package/node_modules/axios/lib/helpers/toFormData.js +279 -0
  207. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
  208. package/node_modules/axios/lib/helpers/trackStream.js +89 -0
  209. package/node_modules/axios/lib/helpers/validator.js +112 -0
  210. package/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
  211. package/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  212. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  213. package/node_modules/axios/lib/platform/browser/index.js +13 -0
  214. package/node_modules/axios/lib/platform/common/utils.js +52 -0
  215. package/node_modules/axios/lib/platform/index.js +7 -0
  216. package/node_modules/axios/lib/platform/node/classes/Buffer.js +11 -0
  217. package/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  218. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  219. package/node_modules/axios/lib/platform/node/index.js +37 -0
  220. package/node_modules/axios/lib/utils.js +1150 -0
  221. package/node_modules/axios/node_modules/agent-base/README.md +145 -0
  222. package/node_modules/axios/node_modules/agent-base/dist/src/index.d.ts +78 -0
  223. package/node_modules/axios/node_modules/agent-base/dist/src/index.js +203 -0
  224. package/node_modules/axios/node_modules/agent-base/dist/src/index.js.map +1 -0
  225. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
  226. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js +18 -0
  227. package/node_modules/axios/node_modules/agent-base/dist/src/promisify.js.map +1 -0
  228. package/node_modules/axios/node_modules/agent-base/package.json +64 -0
  229. package/node_modules/axios/node_modules/agent-base/src/index.ts +345 -0
  230. package/node_modules/axios/node_modules/agent-base/src/promisify.ts +33 -0
  231. package/node_modules/axios/node_modules/debug/LICENSE +20 -0
  232. package/node_modules/axios/node_modules/debug/README.md +481 -0
  233. package/node_modules/axios/node_modules/debug/package.json +64 -0
  234. package/node_modules/axios/node_modules/debug/src/browser.js +272 -0
  235. package/node_modules/axios/node_modules/debug/src/common.js +292 -0
  236. package/node_modules/axios/node_modules/debug/src/index.js +10 -0
  237. package/node_modules/axios/node_modules/debug/src/node.js +263 -0
  238. package/node_modules/axios/node_modules/https-proxy-agent/README.md +137 -0
  239. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
  240. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js +177 -0
  241. package/node_modules/axios/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
  242. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
  243. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js +14 -0
  244. package/node_modules/axios/node_modules/https-proxy-agent/dist/index.js.map +1 -0
  245. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
  246. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  247. package/node_modules/axios/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
  248. package/node_modules/axios/node_modules/https-proxy-agent/package.json +56 -0
  249. package/node_modules/axios/node_modules/ms/index.js +162 -0
  250. package/node_modules/axios/node_modules/ms/license.md +21 -0
  251. package/node_modules/axios/node_modules/ms/package.json +38 -0
  252. package/node_modules/axios/node_modules/ms/readme.md +59 -0
  253. package/node_modules/axios/package.json +203 -0
  254. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  255. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  256. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  257. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  258. package/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  259. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  260. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  261. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  262. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  263. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  264. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  265. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  266. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  267. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  268. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  269. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  270. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  271. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  272. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  273. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  274. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  275. package/node_modules/combined-stream/License +19 -0
  276. package/node_modules/combined-stream/Readme.md +138 -0
  277. package/node_modules/combined-stream/lib/combined_stream.js +208 -0
  278. package/node_modules/combined-stream/package.json +25 -0
  279. package/node_modules/delayed-stream/.npmignore +1 -0
  280. package/node_modules/delayed-stream/License +19 -0
  281. package/node_modules/delayed-stream/Makefile +7 -0
  282. package/node_modules/delayed-stream/Readme.md +141 -0
  283. package/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  284. package/node_modules/delayed-stream/package.json +27 -0
  285. package/node_modules/dunder-proto/.eslintrc +5 -0
  286. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  287. package/node_modules/dunder-proto/.nycrc +13 -0
  288. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  289. package/node_modules/dunder-proto/LICENSE +21 -0
  290. package/node_modules/dunder-proto/README.md +54 -0
  291. package/node_modules/dunder-proto/get.d.ts +5 -0
  292. package/node_modules/dunder-proto/get.js +30 -0
  293. package/node_modules/dunder-proto/package.json +76 -0
  294. package/node_modules/dunder-proto/set.d.ts +5 -0
  295. package/node_modules/dunder-proto/set.js +35 -0
  296. package/node_modules/dunder-proto/test/get.js +34 -0
  297. package/node_modules/dunder-proto/test/index.js +4 -0
  298. package/node_modules/dunder-proto/test/set.js +50 -0
  299. package/node_modules/dunder-proto/tsconfig.json +9 -0
  300. package/node_modules/es-define-property/.eslintrc +13 -0
  301. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  302. package/node_modules/es-define-property/.nycrc +9 -0
  303. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  304. package/node_modules/es-define-property/LICENSE +21 -0
  305. package/node_modules/es-define-property/README.md +49 -0
  306. package/node_modules/es-define-property/index.d.ts +3 -0
  307. package/node_modules/es-define-property/index.js +14 -0
  308. package/node_modules/es-define-property/package.json +81 -0
  309. package/node_modules/es-define-property/test/index.js +56 -0
  310. package/node_modules/es-define-property/tsconfig.json +10 -0
  311. package/node_modules/es-errors/.eslintrc +5 -0
  312. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  313. package/node_modules/es-errors/CHANGELOG.md +40 -0
  314. package/node_modules/es-errors/LICENSE +21 -0
  315. package/node_modules/es-errors/README.md +55 -0
  316. package/node_modules/es-errors/eval.d.ts +3 -0
  317. package/node_modules/es-errors/eval.js +4 -0
  318. package/node_modules/es-errors/index.d.ts +3 -0
  319. package/node_modules/es-errors/index.js +4 -0
  320. package/node_modules/es-errors/package.json +80 -0
  321. package/node_modules/es-errors/range.d.ts +3 -0
  322. package/node_modules/es-errors/range.js +4 -0
  323. package/node_modules/es-errors/ref.d.ts +3 -0
  324. package/node_modules/es-errors/ref.js +4 -0
  325. package/node_modules/es-errors/syntax.d.ts +3 -0
  326. package/node_modules/es-errors/syntax.js +4 -0
  327. package/node_modules/es-errors/test/index.js +19 -0
  328. package/node_modules/es-errors/tsconfig.json +49 -0
  329. package/node_modules/es-errors/type.d.ts +3 -0
  330. package/node_modules/es-errors/type.js +4 -0
  331. package/node_modules/es-errors/uri.d.ts +3 -0
  332. package/node_modules/es-errors/uri.js +4 -0
  333. package/node_modules/es-object-atoms/.eslintrc +16 -0
  334. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  335. package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  336. package/node_modules/es-object-atoms/LICENSE +21 -0
  337. package/node_modules/es-object-atoms/README.md +63 -0
  338. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  339. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  340. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  341. package/node_modules/es-object-atoms/ToObject.js +10 -0
  342. package/node_modules/es-object-atoms/index.d.ts +3 -0
  343. package/node_modules/es-object-atoms/index.js +4 -0
  344. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  345. package/node_modules/es-object-atoms/isObject.js +6 -0
  346. package/node_modules/es-object-atoms/package.json +80 -0
  347. package/node_modules/es-object-atoms/test/index.js +38 -0
  348. package/node_modules/es-object-atoms/tsconfig.json +6 -0
  349. package/node_modules/es-set-tostringtag/.eslintrc +13 -0
  350. package/node_modules/es-set-tostringtag/.nycrc +9 -0
  351. package/node_modules/es-set-tostringtag/CHANGELOG.md +67 -0
  352. package/node_modules/es-set-tostringtag/LICENSE +21 -0
  353. package/node_modules/es-set-tostringtag/README.md +53 -0
  354. package/node_modules/es-set-tostringtag/index.d.ts +10 -0
  355. package/node_modules/es-set-tostringtag/index.js +35 -0
  356. package/node_modules/es-set-tostringtag/package.json +78 -0
  357. package/node_modules/es-set-tostringtag/test/index.js +85 -0
  358. package/node_modules/es-set-tostringtag/tsconfig.json +9 -0
  359. package/node_modules/follow-redirects/LICENSE +18 -0
  360. package/node_modules/follow-redirects/README.md +157 -0
  361. package/node_modules/follow-redirects/debug.js +15 -0
  362. package/node_modules/follow-redirects/http.js +1 -0
  363. package/node_modules/follow-redirects/https.js +1 -0
  364. package/node_modules/follow-redirects/index.js +709 -0
  365. package/node_modules/follow-redirects/package.json +58 -0
  366. package/node_modules/form-data/CHANGELOG.md +686 -0
  367. package/node_modules/form-data/License +19 -0
  368. package/node_modules/form-data/README.md +355 -0
  369. package/node_modules/form-data/index.d.ts +62 -0
  370. package/node_modules/form-data/lib/browser.js +4 -0
  371. package/node_modules/form-data/lib/form_data.js +506 -0
  372. package/node_modules/form-data/lib/populate.js +10 -0
  373. package/node_modules/form-data/package.json +82 -0
  374. package/node_modules/function-bind/.eslintrc +21 -0
  375. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  376. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  377. package/node_modules/function-bind/.nycrc +13 -0
  378. package/node_modules/function-bind/CHANGELOG.md +136 -0
  379. package/node_modules/function-bind/LICENSE +20 -0
  380. package/node_modules/function-bind/README.md +46 -0
  381. package/node_modules/function-bind/implementation.js +84 -0
  382. package/node_modules/function-bind/index.js +5 -0
  383. package/node_modules/function-bind/package.json +87 -0
  384. package/node_modules/function-bind/test/.eslintrc +9 -0
  385. package/node_modules/function-bind/test/index.js +252 -0
  386. package/node_modules/get-intrinsic/.eslintrc +42 -0
  387. package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  388. package/node_modules/get-intrinsic/.nycrc +9 -0
  389. package/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  390. package/node_modules/get-intrinsic/LICENSE +21 -0
  391. package/node_modules/get-intrinsic/README.md +71 -0
  392. package/node_modules/get-intrinsic/index.js +378 -0
  393. package/node_modules/get-intrinsic/package.json +97 -0
  394. package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  395. package/node_modules/get-proto/.eslintrc +10 -0
  396. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  397. package/node_modules/get-proto/.nycrc +9 -0
  398. package/node_modules/get-proto/CHANGELOG.md +21 -0
  399. package/node_modules/get-proto/LICENSE +21 -0
  400. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  401. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  402. package/node_modules/get-proto/README.md +50 -0
  403. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  404. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  405. package/node_modules/get-proto/index.d.ts +5 -0
  406. package/node_modules/get-proto/index.js +27 -0
  407. package/node_modules/get-proto/package.json +81 -0
  408. package/node_modules/get-proto/test/index.js +68 -0
  409. package/node_modules/get-proto/tsconfig.json +9 -0
  410. package/node_modules/gopd/.eslintrc +16 -0
  411. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  412. package/node_modules/gopd/CHANGELOG.md +45 -0
  413. package/node_modules/gopd/LICENSE +21 -0
  414. package/node_modules/gopd/README.md +40 -0
  415. package/node_modules/gopd/gOPD.d.ts +1 -0
  416. package/node_modules/gopd/gOPD.js +4 -0
  417. package/node_modules/gopd/index.d.ts +5 -0
  418. package/node_modules/gopd/index.js +15 -0
  419. package/node_modules/gopd/package.json +77 -0
  420. package/node_modules/gopd/test/index.js +36 -0
  421. package/node_modules/gopd/tsconfig.json +9 -0
  422. package/node_modules/has-symbols/.eslintrc +11 -0
  423. package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  424. package/node_modules/has-symbols/.nycrc +9 -0
  425. package/node_modules/has-symbols/CHANGELOG.md +91 -0
  426. package/node_modules/has-symbols/LICENSE +21 -0
  427. package/node_modules/has-symbols/README.md +46 -0
  428. package/node_modules/has-symbols/index.d.ts +3 -0
  429. package/node_modules/has-symbols/index.js +14 -0
  430. package/node_modules/has-symbols/package.json +111 -0
  431. package/node_modules/has-symbols/shams.d.ts +3 -0
  432. package/node_modules/has-symbols/shams.js +45 -0
  433. package/node_modules/has-symbols/test/index.js +22 -0
  434. package/node_modules/has-symbols/test/shams/core-js.js +29 -0
  435. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  436. package/node_modules/has-symbols/test/tests.js +58 -0
  437. package/node_modules/has-symbols/tsconfig.json +10 -0
  438. package/node_modules/has-tostringtag/.eslintrc +5 -0
  439. package/node_modules/has-tostringtag/.github/FUNDING.yml +12 -0
  440. package/node_modules/has-tostringtag/.nycrc +13 -0
  441. package/node_modules/has-tostringtag/CHANGELOG.md +42 -0
  442. package/node_modules/has-tostringtag/LICENSE +21 -0
  443. package/node_modules/has-tostringtag/README.md +46 -0
  444. package/node_modules/has-tostringtag/index.d.ts +3 -0
  445. package/node_modules/has-tostringtag/index.js +8 -0
  446. package/node_modules/has-tostringtag/package.json +108 -0
  447. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  448. package/node_modules/has-tostringtag/shams.js +8 -0
  449. package/node_modules/has-tostringtag/test/index.js +21 -0
  450. package/node_modules/has-tostringtag/test/shams/core-js.js +31 -0
  451. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +30 -0
  452. package/node_modules/has-tostringtag/test/tests.js +15 -0
  453. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  454. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  455. package/node_modules/hasown/.nycrc +13 -0
  456. package/node_modules/hasown/CHANGELOG.md +58 -0
  457. package/node_modules/hasown/LICENSE +21 -0
  458. package/node_modules/hasown/README.md +40 -0
  459. package/node_modules/hasown/eslint.config.mjs +6 -0
  460. package/node_modules/hasown/index.d.ts +3 -0
  461. package/node_modules/hasown/index.js +8 -0
  462. package/node_modules/hasown/package.json +91 -0
  463. package/node_modules/hasown/tsconfig.json +6 -0
  464. package/node_modules/ip-address/LICENSE +19 -0
  465. package/node_modules/ip-address/README.md +308 -0
  466. package/node_modules/ip-address/dist/address-error.d.ts +15 -0
  467. package/node_modules/ip-address/dist/address-error.js +12 -0
  468. package/node_modules/ip-address/dist/address-error.js.map +1 -0
  469. package/node_modules/ip-address/dist/common.d.ts +69 -0
  470. package/node_modules/ip-address/dist/common.js +142 -0
  471. package/node_modules/ip-address/dist/common.js.map +1 -0
  472. package/node_modules/ip-address/dist/ip-address.d.ts +7 -0
  473. package/node_modules/ip-address/dist/ip-address.js +35 -0
  474. package/node_modules/ip-address/dist/ip-address.js.map +1 -0
  475. package/node_modules/ip-address/dist/ipv4.d.ts +340 -0
  476. package/node_modules/ip-address/dist/ipv4.js +580 -0
  477. package/node_modules/ip-address/dist/ipv4.js.map +1 -0
  478. package/node_modules/ip-address/dist/ipv6.d.ts +630 -0
  479. package/node_modules/ip-address/dist/ipv6.js +1443 -0
  480. package/node_modules/ip-address/dist/ipv6.js.map +1 -0
  481. package/node_modules/ip-address/dist/v4/constants.d.ts +16 -0
  482. package/node_modules/ip-address/dist/v4/constants.js +51 -0
  483. package/node_modules/ip-address/dist/v4/constants.js.map +1 -0
  484. package/node_modules/ip-address/dist/v6/constants.d.ts +58 -0
  485. package/node_modules/ip-address/dist/v6/constants.js +128 -0
  486. package/node_modules/ip-address/dist/v6/constants.js.map +1 -0
  487. package/node_modules/ip-address/dist/v6/helpers.d.ts +18 -0
  488. package/node_modules/ip-address/dist/v6/helpers.js +54 -0
  489. package/node_modules/ip-address/dist/v6/helpers.js.map +1 -0
  490. package/node_modules/ip-address/dist/v6/regular-expressions.d.ts +5 -0
  491. package/node_modules/ip-address/dist/v6/regular-expressions.js +95 -0
  492. package/node_modules/ip-address/dist/v6/regular-expressions.js.map +1 -0
  493. package/node_modules/ip-address/package.json +90 -0
  494. package/node_modules/math-intrinsics/.eslintrc +16 -0
  495. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  496. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  497. package/node_modules/math-intrinsics/LICENSE +21 -0
  498. package/node_modules/math-intrinsics/README.md +50 -0
  499. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  500. package/node_modules/math-intrinsics/abs.js +4 -0
  501. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  502. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  503. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  504. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  505. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  506. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  507. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  508. package/node_modules/math-intrinsics/floor.js +4 -0
  509. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  510. package/node_modules/math-intrinsics/isFinite.js +12 -0
  511. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  512. package/node_modules/math-intrinsics/isInteger.js +16 -0
  513. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  514. package/node_modules/math-intrinsics/isNaN.js +6 -0
  515. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  516. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  517. package/node_modules/math-intrinsics/max.d.ts +1 -0
  518. package/node_modules/math-intrinsics/max.js +4 -0
  519. package/node_modules/math-intrinsics/min.d.ts +1 -0
  520. package/node_modules/math-intrinsics/min.js +4 -0
  521. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  522. package/node_modules/math-intrinsics/mod.js +9 -0
  523. package/node_modules/math-intrinsics/package.json +86 -0
  524. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  525. package/node_modules/math-intrinsics/pow.js +4 -0
  526. package/node_modules/math-intrinsics/round.d.ts +1 -0
  527. package/node_modules/math-intrinsics/round.js +4 -0
  528. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  529. package/node_modules/math-intrinsics/sign.js +11 -0
  530. package/node_modules/math-intrinsics/test/index.js +192 -0
  531. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  532. package/node_modules/mime-db/HISTORY.md +507 -0
  533. package/node_modules/mime-db/LICENSE +23 -0
  534. package/node_modules/mime-db/README.md +100 -0
  535. package/node_modules/mime-db/db.json +8519 -0
  536. package/node_modules/mime-db/index.js +12 -0
  537. package/node_modules/mime-db/package.json +60 -0
  538. package/node_modules/mime-types/HISTORY.md +397 -0
  539. package/node_modules/mime-types/LICENSE +23 -0
  540. package/node_modules/mime-types/README.md +113 -0
  541. package/node_modules/mime-types/index.js +188 -0
  542. package/node_modules/mime-types/package.json +44 -0
  543. package/node_modules/proxy-from-env/LICENSE +20 -0
  544. package/node_modules/proxy-from-env/README.md +163 -0
  545. package/node_modules/proxy-from-env/index.cjs +105 -0
  546. package/node_modules/proxy-from-env/index.js +103 -0
  547. package/node_modules/proxy-from-env/package.json +43 -0
  548. package/node_modules/smart-buffer/.prettierrc.yaml +5 -0
  549. package/node_modules/smart-buffer/.travis.yml +13 -0
  550. package/node_modules/smart-buffer/LICENSE +20 -0
  551. package/node_modules/smart-buffer/README.md +633 -0
  552. package/node_modules/smart-buffer/build/smartbuffer.js +1233 -0
  553. package/node_modules/smart-buffer/build/smartbuffer.js.map +1 -0
  554. package/node_modules/smart-buffer/build/utils.js +108 -0
  555. package/node_modules/smart-buffer/build/utils.js.map +1 -0
  556. package/node_modules/smart-buffer/docs/CHANGELOG.md +70 -0
  557. package/node_modules/smart-buffer/docs/README_v3.md +367 -0
  558. package/node_modules/smart-buffer/docs/ROADMAP.md +0 -0
  559. package/node_modules/smart-buffer/package.json +79 -0
  560. package/node_modules/smart-buffer/typings/smartbuffer.d.ts +755 -0
  561. package/node_modules/smart-buffer/typings/utils.d.ts +66 -0
  562. package/node_modules/socks/.eslintrc.cjs +11 -0
  563. package/node_modules/socks/.prettierrc.yaml +7 -0
  564. package/node_modules/socks/LICENSE +20 -0
  565. package/node_modules/socks/README.md +686 -0
  566. package/node_modules/socks/build/client/socksclient.js +793 -0
  567. package/node_modules/socks/build/client/socksclient.js.map +1 -0
  568. package/node_modules/socks/build/common/constants.js +108 -0
  569. package/node_modules/socks/build/common/constants.js.map +1 -0
  570. package/node_modules/socks/build/common/helpers.js +167 -0
  571. package/node_modules/socks/build/common/helpers.js.map +1 -0
  572. package/node_modules/socks/build/common/receivebuffer.js +43 -0
  573. package/node_modules/socks/build/common/receivebuffer.js.map +1 -0
  574. package/node_modules/socks/build/common/util.js +25 -0
  575. package/node_modules/socks/build/common/util.js.map +1 -0
  576. package/node_modules/socks/build/index.js +18 -0
  577. package/node_modules/socks/build/index.js.map +1 -0
  578. package/node_modules/socks/docs/examples/index.md +17 -0
  579. package/node_modules/socks/docs/examples/javascript/associateExample.md +90 -0
  580. package/node_modules/socks/docs/examples/javascript/bindExample.md +83 -0
  581. package/node_modules/socks/docs/examples/javascript/connectExample.md +258 -0
  582. package/node_modules/socks/docs/examples/typescript/associateExample.md +93 -0
  583. package/node_modules/socks/docs/examples/typescript/bindExample.md +86 -0
  584. package/node_modules/socks/docs/examples/typescript/connectExample.md +265 -0
  585. package/node_modules/socks/docs/index.md +5 -0
  586. package/node_modules/socks/docs/migratingFromV1.md +86 -0
  587. package/node_modules/socks/package.json +58 -0
  588. package/node_modules/socks/typings/client/socksclient.d.ts +162 -0
  589. package/node_modules/socks/typings/common/constants.d.ts +151 -0
  590. package/node_modules/socks/typings/common/helpers.d.ts +17 -0
  591. package/node_modules/socks/typings/common/receivebuffer.d.ts +12 -0
  592. package/node_modules/socks/typings/common/util.d.ts +14 -0
  593. package/node_modules/socks/typings/index.d.ts +1 -0
  594. package/node_modules/socks-proxy-agent/LICENSE +22 -0
  595. package/node_modules/socks-proxy-agent/README.md +50 -0
  596. package/node_modules/socks-proxy-agent/dist/index.d.ts +27 -0
  597. package/node_modules/socks-proxy-agent/dist/index.d.ts.map +1 -0
  598. package/node_modules/socks-proxy-agent/dist/index.js +195 -0
  599. package/node_modules/socks-proxy-agent/dist/index.js.map +1 -0
  600. package/node_modules/socks-proxy-agent/node_modules/debug/LICENSE +20 -0
  601. package/node_modules/socks-proxy-agent/node_modules/debug/README.md +481 -0
  602. package/node_modules/socks-proxy-agent/node_modules/debug/package.json +64 -0
  603. package/node_modules/socks-proxy-agent/node_modules/debug/src/browser.js +272 -0
  604. package/node_modules/socks-proxy-agent/node_modules/debug/src/common.js +292 -0
  605. package/node_modules/socks-proxy-agent/node_modules/debug/src/index.js +10 -0
  606. package/node_modules/socks-proxy-agent/node_modules/debug/src/node.js +263 -0
  607. package/node_modules/socks-proxy-agent/node_modules/ms/index.js +162 -0
  608. package/node_modules/socks-proxy-agent/node_modules/ms/license.md +21 -0
  609. package/node_modules/socks-proxy-agent/node_modules/ms/package.json +38 -0
  610. package/node_modules/socks-proxy-agent/node_modules/ms/readme.md +59 -0
  611. package/node_modules/socks-proxy-agent/package.json +142 -0
  612. package/node_modules/undici/LICENSE +21 -0
  613. package/node_modules/undici/README.md +473 -0
  614. package/node_modules/undici/docs/docs/api/Agent.md +80 -0
  615. package/node_modules/undici/docs/docs/api/BalancedPool.md +99 -0
  616. package/node_modules/undici/docs/docs/api/CacheStorage.md +30 -0
  617. package/node_modules/undici/docs/docs/api/Client.md +277 -0
  618. package/node_modules/undici/docs/docs/api/Connector.md +115 -0
  619. package/node_modules/undici/docs/docs/api/ContentType.md +57 -0
  620. package/node_modules/undici/docs/docs/api/Cookies.md +101 -0
  621. package/node_modules/undici/docs/docs/api/Debug.md +62 -0
  622. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +204 -0
  623. package/node_modules/undici/docs/docs/api/DispatchInterceptor.md +60 -0
  624. package/node_modules/undici/docs/docs/api/Dispatcher.md +1347 -0
  625. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +162 -0
  626. package/node_modules/undici/docs/docs/api/Errors.md +49 -0
  627. package/node_modules/undici/docs/docs/api/EventSource.md +45 -0
  628. package/node_modules/undici/docs/docs/api/Fetch.md +52 -0
  629. package/node_modules/undici/docs/docs/api/MockAgent.md +540 -0
  630. package/node_modules/undici/docs/docs/api/MockClient.md +77 -0
  631. package/node_modules/undici/docs/docs/api/MockErrors.md +12 -0
  632. package/node_modules/undici/docs/docs/api/MockPool.md +547 -0
  633. package/node_modules/undici/docs/docs/api/Pool.md +84 -0
  634. package/node_modules/undici/docs/docs/api/PoolStats.md +35 -0
  635. package/node_modules/undici/docs/docs/api/ProxyAgent.md +131 -0
  636. package/node_modules/undici/docs/docs/api/RedirectHandler.md +96 -0
  637. package/node_modules/undici/docs/docs/api/RetryAgent.md +45 -0
  638. package/node_modules/undici/docs/docs/api/RetryHandler.md +117 -0
  639. package/node_modules/undici/docs/docs/api/Util.md +25 -0
  640. package/node_modules/undici/docs/docs/api/WebSocket.md +51 -0
  641. package/node_modules/undici/docs/docs/api/api-lifecycle.md +91 -0
  642. package/node_modules/undici/docs/docs/best-practices/client-certificate.md +64 -0
  643. package/node_modules/undici/docs/docs/best-practices/mocking-request.md +136 -0
  644. package/node_modules/undici/docs/docs/best-practices/proxy.md +127 -0
  645. package/node_modules/undici/docs/docs/best-practices/writing-tests.md +20 -0
  646. package/node_modules/undici/index-fetch.js +35 -0
  647. package/node_modules/undici/index.d.ts +3 -0
  648. package/node_modules/undici/index.js +169 -0
  649. package/node_modules/undici/lib/api/abort-signal.js +57 -0
  650. package/node_modules/undici/lib/api/api-connect.js +108 -0
  651. package/node_modules/undici/lib/api/api-pipeline.js +251 -0
  652. package/node_modules/undici/lib/api/api-request.js +214 -0
  653. package/node_modules/undici/lib/api/api-stream.js +220 -0
  654. package/node_modules/undici/lib/api/api-upgrade.js +108 -0
  655. package/node_modules/undici/lib/api/index.js +7 -0
  656. package/node_modules/undici/lib/api/readable.js +385 -0
  657. package/node_modules/undici/lib/api/util.js +93 -0
  658. package/node_modules/undici/lib/core/connect.js +240 -0
  659. package/node_modules/undici/lib/core/constants.js +118 -0
  660. package/node_modules/undici/lib/core/diagnostics.js +202 -0
  661. package/node_modules/undici/lib/core/errors.js +425 -0
  662. package/node_modules/undici/lib/core/request.js +416 -0
  663. package/node_modules/undici/lib/core/symbols.js +67 -0
  664. package/node_modules/undici/lib/core/tree.js +152 -0
  665. package/node_modules/undici/lib/core/util.js +719 -0
  666. package/node_modules/undici/lib/dispatcher/agent.js +129 -0
  667. package/node_modules/undici/lib/dispatcher/balanced-pool.js +209 -0
  668. package/node_modules/undici/lib/dispatcher/client-h1.js +1496 -0
  669. package/node_modules/undici/lib/dispatcher/client-h2.js +744 -0
  670. package/node_modules/undici/lib/dispatcher/client.js +623 -0
  671. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +199 -0
  672. package/node_modules/undici/lib/dispatcher/dispatcher.js +65 -0
  673. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +160 -0
  674. package/node_modules/undici/lib/dispatcher/fixed-queue.js +117 -0
  675. package/node_modules/undici/lib/dispatcher/pool-base.js +194 -0
  676. package/node_modules/undici/lib/dispatcher/pool-stats.js +34 -0
  677. package/node_modules/undici/lib/dispatcher/pool.js +107 -0
  678. package/node_modules/undici/lib/dispatcher/proxy-agent.js +274 -0
  679. package/node_modules/undici/lib/dispatcher/retry-agent.js +35 -0
  680. package/node_modules/undici/lib/global.js +32 -0
  681. package/node_modules/undici/lib/handler/decorator-handler.js +44 -0
  682. package/node_modules/undici/lib/handler/redirect-handler.js +232 -0
  683. package/node_modules/undici/lib/handler/retry-handler.js +408 -0
  684. package/node_modules/undici/lib/interceptor/dns.js +375 -0
  685. package/node_modules/undici/lib/interceptor/dump.js +123 -0
  686. package/node_modules/undici/lib/interceptor/redirect-interceptor.js +21 -0
  687. package/node_modules/undici/lib/interceptor/redirect.js +24 -0
  688. package/node_modules/undici/lib/interceptor/response-error.js +86 -0
  689. package/node_modules/undici/lib/interceptor/retry.js +19 -0
  690. package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
  691. package/node_modules/undici/lib/llhttp/constants.js +278 -0
  692. package/node_modules/undici/lib/llhttp/llhttp-wasm.js +5 -0
  693. package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +5 -0
  694. package/node_modules/undici/lib/llhttp/utils.js +15 -0
  695. package/node_modules/undici/lib/mock/mock-agent.js +160 -0
  696. package/node_modules/undici/lib/mock/mock-client.js +59 -0
  697. package/node_modules/undici/lib/mock/mock-errors.js +28 -0
  698. package/node_modules/undici/lib/mock/mock-interceptor.js +207 -0
  699. package/node_modules/undici/lib/mock/mock-pool.js +59 -0
  700. package/node_modules/undici/lib/mock/mock-symbols.js +23 -0
  701. package/node_modules/undici/lib/mock/mock-utils.js +367 -0
  702. package/node_modules/undici/lib/mock/pending-interceptors-formatter.js +43 -0
  703. package/node_modules/undici/lib/mock/pluralizer.js +29 -0
  704. package/node_modules/undici/lib/util/timers.js +423 -0
  705. package/node_modules/undici/lib/web/cache/cache.js +859 -0
  706. package/node_modules/undici/lib/web/cache/cachestorage.js +152 -0
  707. package/node_modules/undici/lib/web/cache/symbols.js +5 -0
  708. package/node_modules/undici/lib/web/cache/util.js +45 -0
  709. package/node_modules/undici/lib/web/cookies/constants.js +12 -0
  710. package/node_modules/undici/lib/web/cookies/index.js +184 -0
  711. package/node_modules/undici/lib/web/cookies/parse.js +310 -0
  712. package/node_modules/undici/lib/web/cookies/util.js +352 -0
  713. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +398 -0
  714. package/node_modules/undici/lib/web/eventsource/eventsource.js +480 -0
  715. package/node_modules/undici/lib/web/eventsource/util.js +37 -0
  716. package/node_modules/undici/lib/web/fetch/LICENSE +21 -0
  717. package/node_modules/undici/lib/web/fetch/body.js +529 -0
  718. package/node_modules/undici/lib/web/fetch/constants.js +124 -0
  719. package/node_modules/undici/lib/web/fetch/data-url.js +744 -0
  720. package/node_modules/undici/lib/web/fetch/dispatcher-weakref.js +46 -0
  721. package/node_modules/undici/lib/web/fetch/file.js +126 -0
  722. package/node_modules/undici/lib/web/fetch/formdata-parser.js +474 -0
  723. package/node_modules/undici/lib/web/fetch/formdata.js +252 -0
  724. package/node_modules/undici/lib/web/fetch/global.js +40 -0
  725. package/node_modules/undici/lib/web/fetch/headers.js +687 -0
  726. package/node_modules/undici/lib/web/fetch/index.js +2272 -0
  727. package/node_modules/undici/lib/web/fetch/request.js +1037 -0
  728. package/node_modules/undici/lib/web/fetch/response.js +610 -0
  729. package/node_modules/undici/lib/web/fetch/symbols.js +9 -0
  730. package/node_modules/undici/lib/web/fetch/util.js +1632 -0
  731. package/node_modules/undici/lib/web/fetch/webidl.js +695 -0
  732. package/node_modules/undici/lib/web/fileapi/encoding.js +290 -0
  733. package/node_modules/undici/lib/web/fileapi/filereader.js +344 -0
  734. package/node_modules/undici/lib/web/fileapi/progressevent.js +78 -0
  735. package/node_modules/undici/lib/web/fileapi/symbols.js +10 -0
  736. package/node_modules/undici/lib/web/fileapi/util.js +391 -0
  737. package/node_modules/undici/lib/web/websocket/connection.js +371 -0
  738. package/node_modules/undici/lib/web/websocket/constants.js +66 -0
  739. package/node_modules/undici/lib/web/websocket/events.js +329 -0
  740. package/node_modules/undici/lib/web/websocket/frame.js +96 -0
  741. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +100 -0
  742. package/node_modules/undici/lib/web/websocket/receiver.js +513 -0
  743. package/node_modules/undici/lib/web/websocket/sender.js +104 -0
  744. package/node_modules/undici/lib/web/websocket/symbols.js +12 -0
  745. package/node_modules/undici/lib/web/websocket/util.js +322 -0
  746. package/node_modules/undici/lib/web/websocket/websocket.js +595 -0
  747. package/node_modules/undici/package.json +160 -0
  748. package/node_modules/undici/scripts/strip-comments.js +8 -0
  749. package/node_modules/undici/types/README.md +6 -0
  750. package/node_modules/undici/types/agent.d.ts +31 -0
  751. package/node_modules/undici/types/api.d.ts +43 -0
  752. package/node_modules/undici/types/balanced-pool.d.ts +29 -0
  753. package/node_modules/undici/types/cache.d.ts +36 -0
  754. package/node_modules/undici/types/client.d.ts +125 -0
  755. package/node_modules/undici/types/connector.d.ts +34 -0
  756. package/node_modules/undici/types/content-type.d.ts +21 -0
  757. package/node_modules/undici/types/cookies.d.ts +28 -0
  758. package/node_modules/undici/types/diagnostics-channel.d.ts +66 -0
  759. package/node_modules/undici/types/dispatcher.d.ts +256 -0
  760. package/node_modules/undici/types/env-http-proxy-agent.d.ts +21 -0
  761. package/node_modules/undici/types/errors.d.ts +155 -0
  762. package/node_modules/undici/types/eventsource.d.ts +61 -0
  763. package/node_modules/undici/types/fetch.d.ts +209 -0
  764. package/node_modules/undici/types/file.d.ts +39 -0
  765. package/node_modules/undici/types/filereader.d.ts +54 -0
  766. package/node_modules/undici/types/formdata.d.ts +108 -0
  767. package/node_modules/undici/types/global-dispatcher.d.ts +9 -0
  768. package/node_modules/undici/types/global-origin.d.ts +7 -0
  769. package/node_modules/undici/types/handlers.d.ts +15 -0
  770. package/node_modules/undici/types/header.d.ts +4 -0
  771. package/node_modules/undici/types/index.d.ts +71 -0
  772. package/node_modules/undici/types/interceptors.d.ts +32 -0
  773. package/node_modules/undici/types/mock-agent.d.ts +50 -0
  774. package/node_modules/undici/types/mock-client.d.ts +25 -0
  775. package/node_modules/undici/types/mock-errors.d.ts +12 -0
  776. package/node_modules/undici/types/mock-interceptor.d.ts +93 -0
  777. package/node_modules/undici/types/mock-pool.d.ts +25 -0
  778. package/node_modules/undici/types/patch.d.ts +33 -0
  779. package/node_modules/undici/types/pool-stats.d.ts +19 -0
  780. package/node_modules/undici/types/pool.d.ts +39 -0
  781. package/node_modules/undici/types/proxy-agent.d.ts +29 -0
  782. package/node_modules/undici/types/readable.d.ts +65 -0
  783. package/node_modules/undici/types/retry-agent.d.ts +8 -0
  784. package/node_modules/undici/types/retry-handler.d.ts +116 -0
  785. package/node_modules/undici/types/util.d.ts +18 -0
  786. package/node_modules/undici/types/webidl.d.ts +228 -0
  787. package/node_modules/undici/types/websocket.d.ts +150 -0
  788. package/package.json +4 -1
@@ -0,0 +1,1443 @@
1
+ "use strict";
2
+ /* eslint-disable prefer-destructuring */
3
+ /* eslint-disable no-param-reassign */
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || function (mod) {
21
+ if (mod && mod.__esModule) return mod;
22
+ var result = {};
23
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
24
+ __setModuleDefault(result, mod);
25
+ return result;
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.Address6 = void 0;
29
+ const common = __importStar(require("./common"));
30
+ const constants4 = __importStar(require("./v4/constants"));
31
+ const constants6 = __importStar(require("./v6/constants"));
32
+ const helpers = __importStar(require("./v6/helpers"));
33
+ const ipv4_1 = require("./ipv4");
34
+ const regular_expressions_1 = require("./v6/regular-expressions");
35
+ const address_error_1 = require("./address-error");
36
+ const common_1 = require("./common");
37
+ const isCorrect6 = common.isCorrect(constants6.BITS);
38
+ function assert(condition) {
39
+ if (!condition) {
40
+ throw new Error('Assertion failed.');
41
+ }
42
+ }
43
+ function addCommas(number) {
44
+ const r = /(\d+)(\d{3})/;
45
+ while (r.test(number)) {
46
+ number = number.replace(r, '$1,$2');
47
+ }
48
+ return number;
49
+ }
50
+ function spanLeadingZeroes4(n) {
51
+ n = n.replace(/^(0{1,})([1-9]+)$/, '<span class="parse-error">$1</span>$2');
52
+ n = n.replace(/^(0{1,})(0)$/, '<span class="parse-error">$1</span>$2');
53
+ return n;
54
+ }
55
+ /*
56
+ * A helper function to compact an array
57
+ */
58
+ function compact(address, slice) {
59
+ const s1 = [];
60
+ const s2 = [];
61
+ let i;
62
+ for (i = 0; i < address.length; i++) {
63
+ if (i < slice[0]) {
64
+ s1.push(address[i]);
65
+ }
66
+ else if (i > slice[1]) {
67
+ s2.push(address[i]);
68
+ }
69
+ }
70
+ return s1.concat(['compact']).concat(s2);
71
+ }
72
+ function paddedHex(octet) {
73
+ return parseInt(octet, 16).toString(16).padStart(4, '0');
74
+ }
75
+ function unsignByte(b) {
76
+ return b & 0xff;
77
+ }
78
+ /**
79
+ * Represents an IPv6 address
80
+ * @param {string} address - An IPv6 address string
81
+ * @param {number} [groups=8] - How many octets to parse
82
+ * @example
83
+ * var address = new Address6('2001::/32');
84
+ */
85
+ class Address6 {
86
+ constructor(address, optionalGroups) {
87
+ this.addressMinusSuffix = '';
88
+ this.parsedSubnet = '';
89
+ this.subnet = '/128';
90
+ this.subnetMask = 128;
91
+ this.v4 = false;
92
+ this.zone = '';
93
+ // #region Attributes
94
+ /**
95
+ * Returns true if the given address is in the subnet of the current address
96
+ * @returns {boolean}
97
+ */
98
+ this.isInSubnet = common.isInSubnet;
99
+ /**
100
+ * Returns true if this address's host bits fall inside the given subnet,
101
+ * ignoring this address's own subnet mask. Prefer this over `isInSubnet`
102
+ * when classifying a single address, so the answer doesn't change with the
103
+ * CIDR suffix the caller happened to write — notably when the address came
104
+ * from untrusted input and the result backs a trust-boundary decision.
105
+ * @returns {boolean}
106
+ */
107
+ this.isHostInSubnet = common.isHostInSubnet;
108
+ /**
109
+ * Returns true if the address is correct, false otherwise
110
+ * @returns {boolean}
111
+ */
112
+ this.isCorrect = isCorrect6;
113
+ if (optionalGroups === undefined) {
114
+ this.groups = constants6.GROUPS;
115
+ }
116
+ else {
117
+ this.groups = optionalGroups;
118
+ }
119
+ this.address = address;
120
+ const subnet = constants6.RE_SUBNET_STRING.exec(address);
121
+ if (subnet) {
122
+ this.parsedSubnet = subnet[0].replace('/', '');
123
+ this.subnetMask = parseInt(this.parsedSubnet, 10);
124
+ this.subnet = `/${this.subnetMask}`;
125
+ if (Number.isNaN(this.subnetMask) ||
126
+ this.subnetMask < 0 ||
127
+ this.subnetMask > constants6.BITS) {
128
+ throw new address_error_1.AddressError('Invalid subnet mask.');
129
+ }
130
+ address = address.replace(constants6.RE_SUBNET_STRING, '');
131
+ }
132
+ // RE_SUBNET_STRING anchors on the end of the address, so it strips only
133
+ // the trailing suffix. A second one left behind (`::/0/1`) is malformed
134
+ // and must be rejected rather than parsed as an address group.
135
+ if (/\//.test(address)) {
136
+ throw new address_error_1.AddressError('Invalid subnet mask.');
137
+ }
138
+ const zone = constants6.RE_ZONE_STRING.exec(address);
139
+ if (zone) {
140
+ this.zone = zone[0];
141
+ address = address.replace(constants6.RE_ZONE_STRING, '');
142
+ }
143
+ this.addressMinusSuffix = address;
144
+ this.parsedAddress = this.parse(this.addressMinusSuffix);
145
+ }
146
+ /**
147
+ * Returns true if the given string is a valid IPv6 address (with optional
148
+ * CIDR subnet and zone identifier), false otherwise. Host bits in the
149
+ * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict
150
+ * network-address validation compare `correctForm()` to
151
+ * `startAddress().correctForm()`, or use `networkForm()`.
152
+ */
153
+ static isValid(address) {
154
+ try {
155
+ // eslint-disable-next-line no-new
156
+ new Address6(address);
157
+ return true;
158
+ }
159
+ catch {
160
+ return false;
161
+ }
162
+ }
163
+ /**
164
+ * Convert a BigInt to a v6 address object. The value must be in the
165
+ * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.
166
+ * @param {bigint} bigInt - a BigInt to convert
167
+ * @returns {Address6}
168
+ * @example
169
+ * var bigInt = BigInt('1000000000000');
170
+ * var address = Address6.fromBigInt(bigInt);
171
+ * address.correctForm(); // '::e8:d4a5:1000'
172
+ */
173
+ static fromBigInt(bigInt) {
174
+ if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) {
175
+ throw new address_error_1.AddressError('IPv6 BigInt must be in the range 0 to 2**128 - 1');
176
+ }
177
+ const hex = bigInt.toString(16).padStart(32, '0');
178
+ const groups = [];
179
+ for (let i = 0; i < constants6.GROUPS; i++) {
180
+ groups.push(hex.slice(i * 4, (i + 1) * 4));
181
+ }
182
+ return new Address6(groups.join(':'));
183
+ }
184
+ /**
185
+ * Parse a URL (with optional bracketed host and port) into an address and
186
+ * port. Returns either `{ address, port }` on success or
187
+ * `{ error, address: null, port: null }` if the URL could not be parsed.
188
+ * Ports are returned as numbers (or `null` if absent or out of range).
189
+ * @example
190
+ * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
191
+ * addressAndPort.address.correctForm(); // 'ffff::'
192
+ * addressAndPort.port; // 8080
193
+ */
194
+ static fromURL(url) {
195
+ var _a;
196
+ let host;
197
+ let port = null;
198
+ let result;
199
+ let error;
200
+ // Remove the protocol prefix, if any
201
+ const stripped = url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, '');
202
+ // If we have brackets parse them and find a port
203
+ if (stripped.indexOf('[') !== -1 && stripped.indexOf(']:') !== -1) {
204
+ error = 'failed to parse address with port';
205
+ result = constants6.RE_URL_WITH_PORT.exec(stripped);
206
+ if (result === null) {
207
+ return { error, address: null, port: null };
208
+ }
209
+ host = result[1];
210
+ port = result[2];
211
+ }
212
+ else {
213
+ error = 'failed to parse address from URL';
214
+ result = constants6.RE_URL.exec(stripped);
215
+ if (result === null) {
216
+ return { error, address: null, port: null };
217
+ }
218
+ host = (_a = result[1]) !== null && _a !== void 0 ? _a : result[2];
219
+ }
220
+ // If there's a port convert it to an integer
221
+ if (port) {
222
+ port = parseInt(port, 10);
223
+ // squelch out of range ports (valid ports are 0-65535)
224
+ if (port < 0 || port > 65535) {
225
+ port = null;
226
+ }
227
+ }
228
+ else {
229
+ // Standardize `undefined` to `null`
230
+ port = null;
231
+ }
232
+ // The URL character class is a superset of valid IPv6, so a host the
233
+ // regex accepted (an IPv4 literal, bare punctuation, too many groups)
234
+ // can still be rejected by the parser
235
+ let address;
236
+ try {
237
+ address = new Address6(host);
238
+ }
239
+ catch {
240
+ return { error, address: null, port: null };
241
+ }
242
+ return { address, port };
243
+ }
244
+ /**
245
+ * Construct an `Address6` from an address and a hex subnet mask given as
246
+ * separate strings (e.g. as returned by Node's `os.networkInterfaces()`).
247
+ * Throws `AddressError` if the mask is non-contiguous (e.g.
248
+ * `ffff::ffff`).
249
+ * @example
250
+ * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');
251
+ * address.subnetMask; // 64
252
+ */
253
+ static fromAddressAndMask(address, mask) {
254
+ const bits = common.prefixLengthFromMask(new Address6(mask).bigInt(), constants6.BITS);
255
+ return new Address6(`${address}/${bits}`);
256
+ }
257
+ /**
258
+ * Construct an `Address6` from an address and a Cisco-style wildcard mask
259
+ * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).
260
+ * The wildcard mask is the bitwise inverse of the subnet mask. Throws
261
+ * `AddressError` if the mask is non-contiguous.
262
+ * @example
263
+ * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');
264
+ * address.subnetMask; // 64
265
+ */
266
+ static fromAddressAndWildcardMask(address, wildcardMask) {
267
+ const wildcard = new Address6(wildcardMask).bigInt();
268
+ const allOnes = (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1);
269
+ const mask = wildcard ^ allOnes;
270
+ const bits = common.prefixLengthFromMask(mask, constants6.BITS);
271
+ return new Address6(`${address}/${bits}`);
272
+ }
273
+ /**
274
+ * Construct an `Address6` from a wildcard pattern with trailing `*`
275
+ * groups. The number of trailing wildcards determines the prefix
276
+ * length: each `*` represents 16 bits. `::` is expanded to zero groups
277
+ * (not wildcards) before evaluating trailing wildcards.
278
+ *
279
+ * Only trailing whole-group wildcards are supported. Partial-group
280
+ * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.
281
+ * `*::1`) throw `AddressError`.
282
+ * @example
283
+ * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'
284
+ * Address6.fromWildcard('2001:db8::*').subnet; // '/112'
285
+ * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'
286
+ */
287
+ static fromWildcard(input) {
288
+ if (input.includes('%') || input.includes('/')) {
289
+ throw new address_error_1.AddressError('Wildcard pattern must not include a zone or CIDR suffix');
290
+ }
291
+ const halves = input.split('::');
292
+ if (halves.length > 2) {
293
+ throw new address_error_1.AddressError("Wildcard pattern cannot contain more than one '::'");
294
+ }
295
+ let groups;
296
+ if (halves.length === 2) {
297
+ const left = halves[0] === '' ? [] : halves[0].split(':');
298
+ const right = halves[1] === '' ? [] : halves[1].split(':');
299
+ const remaining = constants6.GROUPS - left.length - right.length;
300
+ if (remaining < 1) {
301
+ throw new address_error_1.AddressError("Wildcard pattern with '::' has too many groups");
302
+ }
303
+ groups = [...left, ...new Array(remaining).fill('0'), ...right];
304
+ }
305
+ else {
306
+ groups = input.split(':');
307
+ }
308
+ if (groups.length !== constants6.GROUPS) {
309
+ throw new address_error_1.AddressError('Wildcard pattern must have 8 groups');
310
+ }
311
+ let firstWildcard = -1;
312
+ for (let i = 0; i < groups.length; i++) {
313
+ if (groups[i] === '*') {
314
+ if (firstWildcard === -1) {
315
+ firstWildcard = i;
316
+ }
317
+ }
318
+ else if (firstWildcard !== -1) {
319
+ throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)');
320
+ }
321
+ }
322
+ const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
323
+ const replaced = groups.map((g) => (g === '*' ? '0' : g));
324
+ const subnetBits = constants6.BITS - trailing * 16;
325
+ return new Address6(`${replaced.join(':')}/${subnetBits}`);
326
+ }
327
+ /**
328
+ * Create an IPv6-mapped address given an IPv4 address
329
+ * @param {string} address - An IPv4 address string
330
+ * @returns {Address6}
331
+ * @example
332
+ * var address = Address6.fromAddress4('192.168.0.1');
333
+ * address.correctForm(); // '::ffff:c0a8:1'
334
+ * address.to4in6(); // '::ffff:192.168.0.1'
335
+ */
336
+ static fromAddress4(address) {
337
+ const address4 = new ipv4_1.Address4(address);
338
+ const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask);
339
+ return new Address6(`::ffff:${address4.correctForm()}/${mask6}`);
340
+ }
341
+ /**
342
+ * Return an address from ip6.arpa form. A full 32-nibble name gives a /128
343
+ * address; a shorter name, as used for a delegated reverse zone, gives the
344
+ * network it covers, with a subnet mask of four bits per nibble, so
345
+ * `fromArpa(x.reverseForm())` round-trips {@link reverseForm} for any prefix.
346
+ * @param {string} arpaFormAddress - an 'ip6.arpa' form address
347
+ * @returns {Adress6}
348
+ * @example
349
+ * var address = Address6.fromArpa(e.f.f.f.3.c.2.6.f.f.f.e.6.6.8.e.1.0.6.7.9.4.e.c.0.0.0.0.1.0.0.2.ip6.arpa.)
350
+ * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'
351
+ * Address6.fromArpa('8.b.d.0.1.0.0.2.ip6.arpa.').networkForm(); // '2001:db8::/32'
352
+ */
353
+ static fromArpa(arpaFormAddress) {
354
+ // remove an ending ".ip6.arpa", with or without the root dot
355
+ const nibbles = arpaFormAddress.replace(/(\.ip6\.arpa)?\.?$/, '');
356
+ if (!/^[0-9a-f](\.[0-9a-f]){0,31}$/i.test(nibbles)) {
357
+ throw new address_error_1.AddressError("Invalid 'ip6.arpa' form.");
358
+ }
359
+ const reversed = nibbles.split('.').reverse();
360
+ const subnetMask = reversed.length * 4;
361
+ const hex = reversed.join('').padEnd(32, '0');
362
+ const groups = [];
363
+ for (let i = 0; i < constants6.GROUPS; i++) {
364
+ groups.push(hex.slice(i * 4, (i + 1) * 4));
365
+ }
366
+ return new Address6(`${groups.join(':')}/${subnetMask}`);
367
+ }
368
+ /**
369
+ * Return the Microsoft UNC transcription of the address
370
+ * @returns {String} the Microsoft UNC transcription of the address
371
+ */
372
+ microsoftTranscription() {
373
+ return `${this.correctForm().replace(/:/g, '-')}.ipv6-literal.net`;
374
+ }
375
+ /**
376
+ * Return the first n bits of the address, defaulting to the subnet mask
377
+ * @param {number} [mask=subnet] - the number of bits to mask
378
+ * @returns {String} the first n bits of the address as a string
379
+ */
380
+ mask(mask = this.subnetMask) {
381
+ return this.getBitsBase2(0, mask);
382
+ }
383
+ /**
384
+ * Return the number of possible subnets of a given size in the address
385
+ * @param {number} [subnetSize=128] - the subnet size
386
+ * @returns {String}
387
+ */
388
+ // TODO: probably useful to have a numeric version of this too
389
+ possibleSubnets(subnetSize = 128) {
390
+ const availableBits = constants6.BITS - this.subnetMask;
391
+ const subnetBits = Math.abs(subnetSize - constants6.BITS);
392
+ const subnetPowers = availableBits - subnetBits;
393
+ if (subnetPowers < 0) {
394
+ return '0';
395
+ }
396
+ return addCommas((BigInt('2') ** BigInt(subnetPowers)).toString(10));
397
+ }
398
+ /**
399
+ * Helper function getting start address.
400
+ * @returns {bigint}
401
+ */
402
+ _startAddress() {
403
+ return BigInt(`0b${this.mask() + '0'.repeat(constants6.BITS - this.subnetMask)}`);
404
+ }
405
+ /**
406
+ * The first address in the range given by this address' subnet
407
+ * Often referred to as the Network Address.
408
+ * @returns {Address6}
409
+ */
410
+ startAddress() {
411
+ return Address6.fromBigInt(this._startAddress());
412
+ }
413
+ /**
414
+ * The first host address in the range given by this address's subnet ie
415
+ * the first address after the Network Address
416
+ * @returns {Address6}
417
+ */
418
+ startAddressExclusive() {
419
+ const adjust = BigInt('1');
420
+ return Address6.fromBigInt(this._startAddress() + adjust);
421
+ }
422
+ /**
423
+ * Helper function getting end address.
424
+ * @returns {bigint}
425
+ */
426
+ _endAddress() {
427
+ return BigInt(`0b${this.mask() + '1'.repeat(constants6.BITS - this.subnetMask)}`);
428
+ }
429
+ /**
430
+ * The last address in the range given by this address's subnet. IPv6 has
431
+ * no broadcast address, so this is an ordinary assignable address (in a
432
+ * 64-bit-interface-identifier subnet it falls inside the reserved
433
+ * subnet-anycast block of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526)).
434
+ * @returns {Address6}
435
+ */
436
+ endAddress() {
437
+ return Address6.fromBigInt(this._endAddress());
438
+ }
439
+ /**
440
+ * The address one before {@link endAddress}. This is the IPv6 counterpart
441
+ * of the IPv4 method that skips the broadcast address; IPv6 has no broadcast,
442
+ * so it drops exactly one address and does not model the 128 reserved
443
+ * subnet-anycast identifiers of [RFC 2526](https://datatracker.ietf.org/doc/html/rfc2526).
444
+ * @returns {Address6}
445
+ */
446
+ endAddressExclusive() {
447
+ const adjust = BigInt('1');
448
+ return Address6.fromBigInt(this._endAddress() - adjust);
449
+ }
450
+ /**
451
+ * Returns the address `n` addresses after this one (or before, when `n` is
452
+ * negative), keeping this address's subnet mask. Throws `AddressError` when
453
+ * the result would fall outside the IPv6 address space or `n` is not an
454
+ * integer.
455
+ * @param {number | bigint} n
456
+ * @returns {Address6}
457
+ * @example
458
+ * new Address6('2001:db8::/64').offset(1).correctForm(); // '2001:db8::1'
459
+ */
460
+ offset(n) {
461
+ return Address6.fromBigInt(common.offsetBigInt(this.bigInt(), n, constants6.BITS, 'IPv6')).withSubnetMask(this.subnetMask);
462
+ }
463
+ /**
464
+ * Returns the network that follows this address's network: the address after
465
+ * {@link endAddress}, with the same subnet mask. Throws `AddressError` when
466
+ * this network is the last one in the address space.
467
+ * @returns {Address6}
468
+ * @example
469
+ * new Address6('2001:db8::/64').nextNetwork().networkForm(); // '2001:db8:0:1::/64'
470
+ */
471
+ nextNetwork() {
472
+ return Address6.fromBigInt(common.offsetBigInt(this._endAddress(), 1, constants6.BITS, 'IPv6')).withSubnetMask(this.subnetMask);
473
+ }
474
+ withSubnetMask(subnetMask) {
475
+ return new Address6(`${this.correctForm()}/${subnetMask}`);
476
+ }
477
+ /**
478
+ * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a
479
+ * `/64`. Returns an `Address6`; call `.correctForm()` for the string.
480
+ * @returns {Address6}
481
+ */
482
+ subnetMaskAddress() {
483
+ return Address6.fromBigInt(BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants6.BITS - this.subnetMask)}`));
484
+ }
485
+ /**
486
+ * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a
487
+ * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns
488
+ * an `Address6`; call `.correctForm()` for the string.
489
+ * @returns {Address6}
490
+ */
491
+ wildcardMask() {
492
+ return Address6.fromBigInt(BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants6.BITS - this.subnetMask)}`));
493
+ }
494
+ /**
495
+ * The network address in CIDR string form, e.g. `2001:db8::/32` for
496
+ * `2001:db8::1/32`. For an address with no explicit subnet the prefix
497
+ * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns
498
+ * `2001:db8::1/128`.
499
+ * @returns {string}
500
+ */
501
+ networkForm() {
502
+ return `${this.startAddress().correctForm()}/${this.subnetMask}`;
503
+ }
504
+ /**
505
+ * Return the scope of the address. The 4-bit scope field
506
+ * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))
507
+ * is only defined for multicast addresses; for unicast addresses the scope
508
+ * is derived from the address type per
509
+ * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).
510
+ * @returns {String}
511
+ */
512
+ getScope() {
513
+ const type = this.getType();
514
+ if (type === 'Multicast' || type.startsWith('Multicast ')) {
515
+ const scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)];
516
+ return scope || 'Unknown';
517
+ }
518
+ // RFC 4291 §2.5.3: the loopback address is treated as having Link-Local
519
+ // scope. (Multicast scope 1, "Interface-Local", is a different concept
520
+ // used only for loopback transmission of multicast.)
521
+ if (type === 'Link-local unicast' || type === 'Loopback') {
522
+ return 'Link local';
523
+ }
524
+ // RFC 4007 §6: the unspecified address has no scope.
525
+ if (type === 'Unspecified') {
526
+ return 'Unknown';
527
+ }
528
+ return 'Global';
529
+ }
530
+ /**
531
+ * Return the type of the address
532
+ * @returns {String}
533
+ */
534
+ getType() {
535
+ for (let i = 0; i < TYPE_SUBNETS.length; i++) {
536
+ const entry = TYPE_SUBNETS[i];
537
+ if (this.isHostInSubnet(entry[0])) {
538
+ return entry[1];
539
+ }
540
+ }
541
+ return 'Global unicast';
542
+ }
543
+ /**
544
+ * Return the bits in the given range as a BigInt
545
+ * @returns {bigint}
546
+ */
547
+ getBits(start, end) {
548
+ return BigInt(`0b${this.getBitsBase2(start, end)}`);
549
+ }
550
+ /**
551
+ * Return the bits in the given range as a base-2 string
552
+ * @returns {String}
553
+ */
554
+ getBitsBase2(start, end) {
555
+ return this.binaryZeroPad().slice(start, end);
556
+ }
557
+ /**
558
+ * Return the bits in the given range as a base-16 string
559
+ * @returns {String}
560
+ */
561
+ getBitsBase16(start, end) {
562
+ const length = end - start;
563
+ if (length % 4 !== 0) {
564
+ throw new Error('Length of bits to retrieve must be divisible by four');
565
+ }
566
+ return this.getBits(start, end)
567
+ .toString(16)
568
+ .padStart(length / 4, '0');
569
+ }
570
+ /**
571
+ * Return the bits that are set past the subnet mask length
572
+ * @returns {String}
573
+ */
574
+ getBitsPastSubnet() {
575
+ return this.getBitsBase2(this.subnetMask, constants6.BITS);
576
+ }
577
+ /**
578
+ * Return the reversed ip6.arpa form of the address
579
+ * @param {Object} options
580
+ * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
581
+ * @returns {String}
582
+ */
583
+ reverseForm(options) {
584
+ if (!options) {
585
+ options = {};
586
+ }
587
+ const characters = Math.floor(this.subnetMask / 4);
588
+ const reversed = this.canonicalForm()
589
+ .replace(/:/g, '')
590
+ .split('')
591
+ .slice(0, characters)
592
+ .reverse()
593
+ .join('.');
594
+ if (characters > 0) {
595
+ if (options.omitSuffix) {
596
+ return reversed;
597
+ }
598
+ return `${reversed}.ip6.arpa.`;
599
+ }
600
+ if (options.omitSuffix) {
601
+ return '';
602
+ }
603
+ return 'ip6.arpa.';
604
+ }
605
+ /**
606
+ * Returns the address in correct form, per
607
+ * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros
608
+ * stripped, the longest run of zero groups collapsed to `::`, and hex digits
609
+ * lowercased (e.g. `2001:db8::1`). This is the recommended form for display.
610
+ */
611
+ correctForm() {
612
+ let i;
613
+ let groups = [];
614
+ let zeroCounter = 0;
615
+ const zeroes = [];
616
+ for (i = 0; i < this.parsedAddress.length; i++) {
617
+ const value = parseInt(this.parsedAddress[i], 16);
618
+ if (value === 0) {
619
+ zeroCounter++;
620
+ }
621
+ if (value !== 0 && zeroCounter > 0) {
622
+ if (zeroCounter > 1) {
623
+ zeroes.push([i - zeroCounter, i - 1]);
624
+ }
625
+ zeroCounter = 0;
626
+ }
627
+ }
628
+ // Do we end with a string of zeroes?
629
+ if (zeroCounter > 1) {
630
+ zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]);
631
+ }
632
+ const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1);
633
+ if (zeroes.length > 0) {
634
+ const index = zeroLengths.indexOf(Math.max(...zeroLengths));
635
+ groups = compact(this.parsedAddress, zeroes[index]);
636
+ }
637
+ else {
638
+ groups = this.parsedAddress;
639
+ }
640
+ for (i = 0; i < groups.length; i++) {
641
+ if (groups[i] !== 'compact') {
642
+ groups[i] = parseInt(groups[i], 16).toString(16);
643
+ }
644
+ }
645
+ let correct = groups.join(':');
646
+ correct = correct.replace(/^compact$/, '::');
647
+ correct = correct.replace(/(^compact)|(compact$)/, ':');
648
+ correct = correct.replace(/compact/, '');
649
+ return correct;
650
+ }
651
+ /**
652
+ * Return a zero-padded base-2 string representation of the address
653
+ * @returns {String}
654
+ * @example
655
+ * var address = new Address6('2001:4860:4001:803::1011');
656
+ * address.binaryZeroPad();
657
+ * // '0010000000000001010010000110000001000000000000010000100000000011
658
+ * // 0000000000000000000000000000000000000000000000000001000000010001'
659
+ */
660
+ binaryZeroPad() {
661
+ if (this._binaryZeroPad === undefined) {
662
+ this._binaryZeroPad = this.bigInt().toString(2).padStart(constants6.BITS, '0');
663
+ }
664
+ return this._binaryZeroPad;
665
+ }
666
+ /**
667
+ * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the
668
+ * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and
669
+ * returning the address with the v4 portion converted to two v6 groups.
670
+ * Used internally by `parse()`.
671
+ */
672
+ // TODO: Improve the semantics of this helper function
673
+ parse4in6(address) {
674
+ if (address.indexOf('.') === -1) {
675
+ return address;
676
+ }
677
+ const groups = address.split(':');
678
+ const lastGroup = groups.slice(-1)[0];
679
+ // RE_ADDRESS rejects octets with a leading zero, so a dotted-quad tail is
680
+ // matched permissively first: that way this notation still gets its own
681
+ // message with the offending octet highlighted, rather than falling
682
+ // through as an unrecognized group.
683
+ const v4Octets = lastGroup.split('.');
684
+ if (v4Octets.length === constants4.GROUPS &&
685
+ v4Octets.every((octet) => /^\d{1,3}$/.test(octet))) {
686
+ if (v4Octets.some((octet) => /^0\d/.test(octet))) {
687
+ // The prefix groups haven't been through the bad-character check
688
+ // yet, so escape them before including in the error HTML.
689
+ const highlighted = v4Octets.map(spanLeadingZeroes4).join('.');
690
+ const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(':');
691
+ const separator = groups.length > 1 ? ':' : '';
692
+ throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", `${prefix}${separator}${highlighted}`);
693
+ }
694
+ }
695
+ const address4 = lastGroup.match(constants4.RE_ADDRESS);
696
+ if (address4) {
697
+ this.parsedAddress4 = address4[0];
698
+ const v4Suffix = this.subnetMask >= 96 ? `/${this.subnetMask - 96}` : '';
699
+ this.address4 = new ipv4_1.Address4(`${this.parsedAddress4}${v4Suffix}`);
700
+ this.v4 = true;
701
+ groups[groups.length - 1] = this.address4.toGroup6();
702
+ address = groups.join(':');
703
+ }
704
+ return address;
705
+ }
706
+ /**
707
+ * Parses an IPv6 address string into its 8 hexadecimal groups (expanding
708
+ * any `::` elision and any trailing v4-in-v6 portion) and stores the result
709
+ * on `this.parsedAddress`. Called automatically by the constructor; you
710
+ * typically don't need to call it directly. Throws `AddressError` if the
711
+ * input is malformed.
712
+ */
713
+ // TODO: Make private?
714
+ parse(address) {
715
+ address = this.parse4in6(address);
716
+ const badCharacters = address.match(constants6.RE_BAD_CHARACTERS);
717
+ if (badCharacters) {
718
+ throw new address_error_1.AddressError(`Bad character${badCharacters.length > 1 ? 's' : ''} detected in address: ${badCharacters.join('')}`, address.replace(constants6.RE_BAD_CHARACTERS, '<span class="parse-error">$1</span>'));
719
+ }
720
+ const badAddress = address.match(constants6.RE_BAD_ADDRESS);
721
+ if (badAddress) {
722
+ throw new address_error_1.AddressError(`Address failed regex: ${badAddress.join('')}`, address.replace(constants6.RE_BAD_ADDRESS, '<span class="parse-error">$1</span>'));
723
+ }
724
+ let groups = [];
725
+ const halves = address.split('::');
726
+ if (halves.length === 2) {
727
+ let first = halves[0].split(':');
728
+ let last = halves[1].split(':');
729
+ if (first.length === 1 && first[0] === '') {
730
+ first = [];
731
+ }
732
+ if (last.length === 1 && last[0] === '') {
733
+ last = [];
734
+ }
735
+ const remaining = this.groups - (first.length + last.length);
736
+ if (!remaining) {
737
+ throw new address_error_1.AddressError('Error parsing groups');
738
+ }
739
+ this.elidedGroups = remaining;
740
+ this.elisionBegin = first.length;
741
+ this.elisionEnd = first.length + this.elidedGroups;
742
+ groups = groups.concat(first);
743
+ for (let i = 0; i < remaining; i++) {
744
+ groups.push('0');
745
+ }
746
+ groups = groups.concat(last);
747
+ }
748
+ else if (halves.length === 1) {
749
+ groups = address.split(':');
750
+ this.elidedGroups = 0;
751
+ }
752
+ else {
753
+ throw new address_error_1.AddressError('Too many :: groups found');
754
+ }
755
+ groups = groups.map((group) => parseInt(group, 16).toString(16));
756
+ if (groups.length !== this.groups) {
757
+ throw new address_error_1.AddressError('Incorrect number of groups found');
758
+ }
759
+ return groups;
760
+ }
761
+ /**
762
+ * Returns the canonical (fully expanded) form of the address: all 8 groups,
763
+ * each padded to 4 hex digits, with no `::` collapsing
764
+ * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and
765
+ * byte-exact comparison.
766
+ */
767
+ canonicalForm() {
768
+ return this.parsedAddress.map(paddedHex).join(':');
769
+ }
770
+ /**
771
+ * Return the decimal form of the address
772
+ * @returns {String}
773
+ */
774
+ decimal() {
775
+ return this.parsedAddress.map((n) => parseInt(n, 16).toString(10).padStart(5, '0')).join(':');
776
+ }
777
+ /**
778
+ * Return the address as a BigInt
779
+ * @returns {bigint}
780
+ */
781
+ bigInt() {
782
+ return BigInt(`0x${this.parsedAddress.map(paddedHex).join('')}`);
783
+ }
784
+ /**
785
+ * Return the last two groups of this address as an IPv4 address string.
786
+ * If this address carries a CIDR prefix that covers the trailing 32 bits
787
+ * (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the
788
+ * corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to
789
+ * `/32`.
790
+ * @returns {Address4}
791
+ * @example
792
+ * var address = new Address6('2001:4860:4001::1825:bf11');
793
+ * address.to4().correctForm(); // '24.37.191.17'
794
+ */
795
+ to4() {
796
+ const binary = this.binaryZeroPad().split('');
797
+ const hex = BigInt(`0b${binary.slice(96, 128).join('')}`)
798
+ .toString(16)
799
+ .padStart(8, '0');
800
+ if (this.subnetMask >= 96) {
801
+ const v4Mask = this.subnetMask - 96;
802
+ const groups = [];
803
+ for (let i = 0; i < 8; i += 2) {
804
+ groups.push(parseInt(hex.slice(i, i + 2), 16));
805
+ }
806
+ return new ipv4_1.Address4(`${groups.join('.')}/${v4Mask}`);
807
+ }
808
+ return ipv4_1.Address4.fromHex(hex);
809
+ }
810
+ /**
811
+ * Return the v4-in-v6 form of the address
812
+ * @returns {String}
813
+ */
814
+ to4in6() {
815
+ const address4 = this.to4();
816
+ const address6 = new Address6(this.parsedAddress.slice(0, 6).join(':'), 6);
817
+ const correct = address6.correctForm();
818
+ let infix = '';
819
+ if (!/:$/.test(correct)) {
820
+ infix = ':';
821
+ }
822
+ return correct + infix + address4.correctForm();
823
+ }
824
+ /**
825
+ * Decodes the Teredo tunneling fields embedded in this address. Returns the
826
+ * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,
827
+ * UDP port, and Microsoft-format flag breakdown (reserved, universal/local,
828
+ * group/individual, nonce). Only meaningful for addresses in `2001::/32`.
829
+ */
830
+ inspectTeredo() {
831
+ /*
832
+ - Bits 0 to 31 are set to the Teredo prefix (normally 2001:0000::/32).
833
+ - Bits 32 to 63 embed the primary IPv4 address of the Teredo server that
834
+ is used.
835
+ - Bits 64 to 79 can be used to define some flags. Currently only the
836
+ higher order bit is used; it is set to 1 if the Teredo client is
837
+ located behind a cone NAT, 0 otherwise. For Microsoft's Windows Vista
838
+ and Windows Server 2008 implementations, more bits are used. In those
839
+ implementations, the format for these 16 bits is "CRAAAAUG AAAAAAAA",
840
+ where "C" remains the "Cone" flag. The "R" bit is reserved for future
841
+ use. The "U" bit is for the Universal/Local flag (set to 0). The "G" bit
842
+ is Individual/Group flag (set to 0). The A bits are set to a 12-bit
843
+ randomly generated number chosen by the Teredo client to introduce
844
+ additional protection for the Teredo node against IPv6-based scanning
845
+ attacks.
846
+ - Bits 80 to 95 contains the obfuscated UDP port number. This is the
847
+ port number that is mapped by the NAT to the Teredo client with all
848
+ bits inverted.
849
+ - Bits 96 to 127 contains the obfuscated IPv4 address. This is the
850
+ public IPv4 address of the NAT with all bits inverted.
851
+ */
852
+ const prefix = this.getBitsBase16(0, 32);
853
+ const bitsForUdpPort = this.getBits(80, 96);
854
+ const udpPort = (bitsForUdpPort ^ BigInt('0xffff')).toString();
855
+ const server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64));
856
+ const bitsForClient4 = this.getBits(96, 128);
857
+ const client4 = ipv4_1.Address4.fromHex((bitsForClient4 ^ BigInt('0xffffffff')).toString(16).padStart(8, '0'));
858
+ const flagsBase2 = this.getBitsBase2(64, 80);
859
+ const coneNat = (0, common_1.testBit)(flagsBase2, 15);
860
+ const reserved = (0, common_1.testBit)(flagsBase2, 14);
861
+ const groupIndividual = (0, common_1.testBit)(flagsBase2, 8);
862
+ const universalLocal = (0, common_1.testBit)(flagsBase2, 9);
863
+ const nonce = BigInt(`0b${flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16)}`).toString(10);
864
+ return {
865
+ prefix: `${prefix.slice(0, 4)}:${prefix.slice(4, 8)}`,
866
+ server4: server4.address,
867
+ client4: client4.address,
868
+ flags: flagsBase2,
869
+ coneNat,
870
+ microsoft: {
871
+ reserved,
872
+ universalLocal,
873
+ groupIndividual,
874
+ nonce,
875
+ },
876
+ udpPort,
877
+ };
878
+ }
879
+ /**
880
+ * Decodes the 6to4 tunneling fields embedded in this address. Returns the
881
+ * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for
882
+ * addresses in `2002::/16`.
883
+ */
884
+ inspect6to4() {
885
+ /*
886
+ - Bits 0 to 15 are set to the 6to4 prefix (2002::/16).
887
+ - Bits 16 to 48 embed the IPv4 address of the 6to4 gateway that is used.
888
+ */
889
+ const prefix = this.getBitsBase16(0, 16);
890
+ const gateway = ipv4_1.Address4.fromHex(this.getBitsBase16(16, 48));
891
+ return {
892
+ prefix: prefix.slice(0, 4),
893
+ gateway: gateway.address,
894
+ };
895
+ }
896
+ /**
897
+ * Return a v6 6to4 address from a v6 v4inv6 address
898
+ * @returns {Address6}
899
+ */
900
+ to6to4() {
901
+ if (!this.is4()) {
902
+ return null;
903
+ }
904
+ const addr6to4 = [
905
+ '2002',
906
+ this.getBitsBase16(96, 112),
907
+ this.getBitsBase16(112, 128),
908
+ '',
909
+ '/16',
910
+ ].join(':');
911
+ return new Address6(addr6to4);
912
+ }
913
+ /**
914
+ * Embed an IPv4 address into a NAT64 IPv6 address using the encoding
915
+ * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
916
+ * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix
917
+ * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter
918
+ * than /64 the IPv4 octets are split around the reserved bits 64–71.
919
+ * @example
920
+ * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'
921
+ * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'
922
+ */
923
+ static fromAddress4Nat64(address, prefix = '64:ff9b::/96') {
924
+ const v4 = new ipv4_1.Address4(address);
925
+ const prefix6 = new Address6(prefix);
926
+ const pl = prefix6.subnetMask;
927
+ if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {
928
+ throw new address_error_1.AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');
929
+ }
930
+ const prefixBits = prefix6.binaryZeroPad();
931
+ const v4Bits = v4.binaryZeroPad();
932
+ let bits;
933
+ if (pl === 96) {
934
+ bits = prefixBits.slice(0, 96) + v4Bits;
935
+ }
936
+ else {
937
+ const beforeU = 64 - pl;
938
+ bits = [
939
+ prefixBits.slice(0, pl),
940
+ v4Bits.slice(0, beforeU),
941
+ // Bits 64 to 71 are the reserved u octet and are always zero.
942
+ '00000000',
943
+ v4Bits.slice(beforeU),
944
+ '0'.repeat(128 - 72 - (32 - beforeU)),
945
+ ].join('');
946
+ }
947
+ const hex = BigInt(`0b${bits}`).toString(16).padStart(32, '0');
948
+ const groups = [];
949
+ for (let i = 0; i < 8; i++) {
950
+ groups.push(hex.slice(i * 4, (i + 1) * 4));
951
+ }
952
+ return new Address6(groups.join(':'));
953
+ }
954
+ /**
955
+ * Extract the embedded IPv4 address from a NAT64 IPv6 address using the
956
+ * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
957
+ * The default prefix is the well-known prefix `64:ff9b::/96`. Returns
958
+ * `null` if this address is not contained within the given prefix.
959
+ * @example
960
+ * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'
961
+ */
962
+ toAddress4Nat64(prefix = '64:ff9b::/96') {
963
+ const prefix6 = new Address6(prefix);
964
+ const pl = prefix6.subnetMask;
965
+ if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {
966
+ throw new address_error_1.AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');
967
+ }
968
+ if (!this.isHostInSubnet(prefix6)) {
969
+ return null;
970
+ }
971
+ const bits = this.binaryZeroPad();
972
+ let v4Bits;
973
+ if (pl === 96) {
974
+ v4Bits = bits.slice(96, 128);
975
+ }
976
+ else {
977
+ const beforeU = 64 - pl;
978
+ v4Bits = bits.slice(pl, pl + beforeU) + bits.slice(72, 72 + (32 - beforeU));
979
+ }
980
+ const octets = [];
981
+ for (let i = 0; i < 4; i++) {
982
+ octets.push(parseInt(v4Bits.slice(i * 8, (i + 1) * 8), 2).toString());
983
+ }
984
+ return new ipv4_1.Address4(octets.join('.'));
985
+ }
986
+ /**
987
+ * Return a byte array.
988
+ *
989
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.
990
+ * @returns {Array}
991
+ */
992
+ toByteArray() {
993
+ const value = this.bigInt()
994
+ .toString(16)
995
+ .padStart(constants6.BITS / 4, '0');
996
+ const bytes = [];
997
+ for (let i = 0, length = value.length; i < length; i += 2) {
998
+ bytes.push(parseInt(value.substring(i, i + 2), 16));
999
+ }
1000
+ return bytes;
1001
+ }
1002
+ /**
1003
+ * Return an unsigned byte array.
1004
+ *
1005
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.
1006
+ * @returns {Array}
1007
+ */
1008
+ toUnsignedByteArray() {
1009
+ // toByteArray() emits 0 to 255, so unsigning it is an identity mapping and
1010
+ // the two methods return equal arrays. 11.0.0 keeps one of them and makes
1011
+ // this a deprecated alias; test/common-test.ts fails at that version.
1012
+ return this.toByteArray().map(unsignByte);
1013
+ }
1014
+ /**
1015
+ * Convert a byte array to an Address6 object.
1016
+ *
1017
+ * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an
1018
+ * `Int8Array` or a Java `byte[]` holds them), folding signed values to their
1019
+ * unsigned equivalent. Throws `AddressError` unless given exactly 16
1020
+ * integers from -128 to 255.
1021
+ *
1022
+ * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
1023
+ * @returns {Address6}
1024
+ */
1025
+ static fromByteArray(bytes) {
1026
+ // Address4.fromByteArray takes unsigned bytes only. 11.0.0 aligns this
1027
+ // method with it, at which point the -128 floor here, unsignByte, and the
1028
+ // mapping below all go; test/common-test.ts fails at that version.
1029
+ common.assertByteArray(bytes, 16, 'IPv6', -128);
1030
+ return this.fromUnsignedByteArray(bytes.map(unsignByte));
1031
+ }
1032
+ /**
1033
+ * Convert an unsigned byte array to an Address6 object.
1034
+ *
1035
+ * Throws `AddressError` unless given exactly 16 integers from 0 to 255.
1036
+ *
1037
+ * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
1038
+ * @returns {Address6}
1039
+ */
1040
+ static fromUnsignedByteArray(bytes) {
1041
+ common.assertByteArray(bytes, 16, 'IPv6', 0);
1042
+ const BYTE_MAX = BigInt('256');
1043
+ let result = BigInt('0');
1044
+ let multiplier = BigInt('1');
1045
+ for (let i = bytes.length - 1; i >= 0; i--) {
1046
+ result += multiplier * BigInt(bytes[i].toString(10));
1047
+ multiplier *= BYTE_MAX;
1048
+ }
1049
+ return Address6.fromBigInt(result);
1050
+ }
1051
+ /**
1052
+ * Returns true if the address is in the canonical form, false otherwise
1053
+ * @returns {boolean}
1054
+ */
1055
+ isCanonical() {
1056
+ return this.addressMinusSuffix === this.canonicalForm();
1057
+ }
1058
+ /**
1059
+ * Returns true if the address is a link-local unicast address in `fe80::/10`
1060
+ * ([RFC 4291 §2.4](https://datatracker.ietf.org/doc/html/rfc4291#section-2.4))
1061
+ * or an IPv4-mapped / NAT64 address whose embedded IPv4 address is link-local
1062
+ * (`169.254.0.0/16`, e.g. `::ffff:169.254.169.254`), false otherwise.
1063
+ * @returns {boolean}
1064
+ */
1065
+ isLinkLocal() {
1066
+ const embedded = this.embeddedIPv4();
1067
+ if (embedded) {
1068
+ return embedded.isLinkLocal();
1069
+ }
1070
+ return this.isHostInSubnet(LINK_LOCAL_SUBNET);
1071
+ }
1072
+ /**
1073
+ * Returns true if the address is a multicast address, false otherwise
1074
+ * @returns {boolean}
1075
+ */
1076
+ isMulticast() {
1077
+ const embedded = this.embeddedIPv4();
1078
+ if (embedded) {
1079
+ return embedded.isMulticast();
1080
+ }
1081
+ const type = this.getType();
1082
+ return type === 'Multicast' || type.startsWith('Multicast ');
1083
+ }
1084
+ /**
1085
+ * Returns true if the address was written in v4-in-v6 dotted-quad notation
1086
+ * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag
1087
+ * and does not reflect whether the address bits lie in the IPv4-mapped
1088
+ * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}.
1089
+ * @returns {boolean}
1090
+ */
1091
+ is4() {
1092
+ return this.v4;
1093
+ }
1094
+ /**
1095
+ * Returns true if the address is an IPv4-mapped IPv6 address in
1096
+ * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),
1097
+ * false otherwise. Unlike {@link is4}, this checks the underlying address
1098
+ * bits rather than the textual notation, so `::ffff:127.0.0.1` and
1099
+ * `::ffff:7f00:1` both return true.
1100
+ * @returns {boolean}
1101
+ */
1102
+ isMapped4() {
1103
+ return this.isHostInSubnet(IPV4_MAPPED_SUBNET);
1104
+ }
1105
+ /**
1106
+ * If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped
1107
+ * (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`,
1108
+ * [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that
1109
+ * embedded address as an {@link Address4}; otherwise return null.
1110
+ *
1111
+ * The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`,
1112
+ * `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and
1113
+ * delegate to the embedded {@link Address4} when present, so a literal such as
1114
+ * `::ffff:127.0.0.1` is classified by what it actually reaches (loopback)
1115
+ * rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped).
1116
+ * This matters wherever the checks back a trust-boundary decision (e.g. an
1117
+ * SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`,
1118
+ * `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as
1119
+ * non-internal.
1120
+ * @returns {Address4 | null}
1121
+ */
1122
+ embeddedIPv4() {
1123
+ if (this.isMapped4() || this.isHostInSubnet(NAT64_WELL_KNOWN_SUBNET)) {
1124
+ return this.to4();
1125
+ }
1126
+ return null;
1127
+ }
1128
+ /**
1129
+ * Returns true if the address is a Teredo address, false otherwise
1130
+ * @returns {boolean}
1131
+ */
1132
+ isTeredo() {
1133
+ return this.isHostInSubnet(TEREDO_SUBNET);
1134
+ }
1135
+ /**
1136
+ * Returns true if the address is a 6to4 address, false otherwise
1137
+ * @returns {boolean}
1138
+ */
1139
+ is6to4() {
1140
+ return this.isHostInSubnet(SIX_TO_FOUR_SUBNET);
1141
+ }
1142
+ /**
1143
+ * Returns true if the address is a loopback address, false otherwise
1144
+ * @returns {boolean}
1145
+ */
1146
+ isLoopback() {
1147
+ const embedded = this.embeddedIPv4();
1148
+ if (embedded) {
1149
+ return embedded.isLoopback();
1150
+ }
1151
+ return this.getType() === 'Loopback';
1152
+ }
1153
+ /**
1154
+ * Returns true if the address is a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)). ULAs are the IPv6 equivalent of IPv4 [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private addresses.
1155
+ * @returns {boolean}
1156
+ */
1157
+ isULA() {
1158
+ return this.isHostInSubnet(ULA_SUBNET);
1159
+ }
1160
+ /**
1161
+ * Returns true if the address is private, i.e. a Unique Local Address in
1162
+ * `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)), an
1163
+ * address in the NAT64 local-use range `64:ff9b:1::/48`
1164
+ * ([RFC 8215](https://datatracker.ietf.org/doc/html/rfc8215)), or an
1165
+ * IPv4-mapped / NAT64 well-known address whose embedded IPv4 address is in
1166
+ * one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918)
1167
+ * private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to
1168
+ * {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to
1169
+ * catch mapped RFC 1918 addresses as well as native ULAs.
1170
+ *
1171
+ * The local-use NAT64 range is reported private as a whole rather than by
1172
+ * its embedded IPv4 address: an operator may carve a prefix of any RFC 6052
1173
+ * length out of `64:ff9b:1::/48`, so the same bits decode to different IPv4
1174
+ * addresses under different deployments and no single decoding is correct.
1175
+ * Use {@link toAddress4Nat64} with the deployment's prefix to decode one.
1176
+ * @returns {boolean}
1177
+ */
1178
+ isPrivate() {
1179
+ const embedded = this.embeddedIPv4();
1180
+ if (embedded) {
1181
+ return embedded.isPrivate();
1182
+ }
1183
+ return this.isULA() || this.isHostInSubnet(NAT64_LOCAL_USE_SUBNET);
1184
+ }
1185
+ /**
1186
+ * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
1187
+ * IPv4 address is in the carrier-grade NAT range `100.64.0.0/10`
1188
+ * ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false
1189
+ * otherwise. There is no native IPv6 CGNAT range, so this only ever returns
1190
+ * true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`).
1191
+ * @returns {boolean}
1192
+ */
1193
+ isCGNAT() {
1194
+ const embedded = this.embeddedIPv4();
1195
+ if (embedded) {
1196
+ return embedded.isCGNAT();
1197
+ }
1198
+ return false;
1199
+ }
1200
+ /**
1201
+ * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
1202
+ * IPv4 address is the limited broadcast address `255.255.255.255`
1203
+ * ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise.
1204
+ * There is no IPv6 broadcast, so this only ever returns true for an embedded
1205
+ * IPv4 address (e.g. `::ffff:255.255.255.255`).
1206
+ * @returns {boolean}
1207
+ */
1208
+ isBroadcast() {
1209
+ const embedded = this.embeddedIPv4();
1210
+ if (embedded) {
1211
+ return embedded.isBroadcast();
1212
+ }
1213
+ return false;
1214
+ }
1215
+ /**
1216
+ * Returns true if the address is the unspecified address `::`.
1217
+ * @returns {boolean}
1218
+ */
1219
+ isUnspecified() {
1220
+ const embedded = this.embeddedIPv4();
1221
+ if (embedded) {
1222
+ return embedded.isUnspecified();
1223
+ }
1224
+ return this.getType() === 'Unspecified';
1225
+ }
1226
+ /**
1227
+ * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).
1228
+ * @returns {boolean}
1229
+ */
1230
+ isDocumentation() {
1231
+ return DOCUMENTATION_SUBNETS.some((subnet) => this.isHostInSubnet(subnet));
1232
+ }
1233
+ /**
1234
+ * Returns true if the address is in the benchmarking range `2001:2::/48`
1235
+ * ([RFC 5180](https://datatracker.ietf.org/doc/html/rfc5180)) or is an
1236
+ * IPv4-mapped / NAT64 address whose embedded IPv4 address is in
1237
+ * `198.18.0.0/15`, false otherwise.
1238
+ * @returns {boolean}
1239
+ */
1240
+ isBenchmarking() {
1241
+ const embedded = this.embeddedIPv4();
1242
+ if (embedded) {
1243
+ return embedded.isBenchmarking();
1244
+ }
1245
+ return this.isHostInSubnet(BENCHMARKING_SUBNET);
1246
+ }
1247
+ /**
1248
+ * Returns true if the address is globally reachable: inside the global
1249
+ * unicast allocation `2000::/3` (the only range the [IANA IPv6 Address Space
1250
+ * Registry](https://www.iana.org/assignments/ipv6-address-space/) assigns
1251
+ * for global unicast; everything else is reserved, ULA, link-local, or
1252
+ * multicast) and not in any block the [IANA IPv6 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/)
1253
+ * marks as not globally reachable. An IPv4-mapped or NAT64 well-known
1254
+ * address answers for its embedded IPv4 address, so `::ffff:10.0.0.1` and
1255
+ * `64:ff9b::7f00:1` are not global. Teredo (`2001::/32`) and 6to4
1256
+ * (`2002::/16`) are not global either: the registry lists them as N/A and a
1257
+ * packet to one needs a relay.
1258
+ *
1259
+ * This covers everything the individual classifiers name and the blocks they
1260
+ * do not: the discard-only prefix `100::/64`, the IETF protocol assignments
1261
+ * in `2001::/23`, the deprecated site-local `fec0::/10` and IPv4-compatible
1262
+ * `::/96` ranges, and unallocated space such as `4000::/3`. It is the single
1263
+ * predicate to use where a request must not reach an internal or
1264
+ * special-purpose destination; see SECURITY.md.
1265
+ * @returns {boolean}
1266
+ */
1267
+ isGlobal() {
1268
+ const embedded = this.embeddedIPv4();
1269
+ if (embedded) {
1270
+ return embedded.isGlobal();
1271
+ }
1272
+ return (this.isHostInSubnet(GLOBAL_UNICAST_SUBNET) &&
1273
+ common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V6));
1274
+ }
1275
+ // #endregion
1276
+ // #region HTML
1277
+ /**
1278
+ * Returns the address as an HTTP URL with the host bracketed, e.g.
1279
+ * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,
1280
+ * e.g. `http://[2001:db8::1]:8080/`.
1281
+ */
1282
+ href(optionalPort) {
1283
+ if (optionalPort === undefined) {
1284
+ optionalPort = '';
1285
+ }
1286
+ else {
1287
+ optionalPort = `:${optionalPort}`;
1288
+ }
1289
+ return `http://[${this.correctForm()}]${optionalPort}/`;
1290
+ }
1291
+ /**
1292
+ * Returns an HTML `<a>` element whose `href` encodes the address in a URL
1293
+ * hash fragment (default prefix `/#address=`). Useful for linking between
1294
+ * pages of an address-inspector UI.
1295
+ * @param options.className - CSS class for the rendered `<a>` element
1296
+ * @param options.prefix - hash prefix prepended to the address (default `/#address=`)
1297
+ * @param options.v4 - when true, render the address in v4-in-v6 form
1298
+ */
1299
+ link(options) {
1300
+ if (!options) {
1301
+ options = {};
1302
+ }
1303
+ if (options.className === undefined) {
1304
+ options.className = '';
1305
+ }
1306
+ if (options.prefix === undefined) {
1307
+ options.prefix = '/#address=';
1308
+ }
1309
+ if (options.v4 === undefined) {
1310
+ options.v4 = false;
1311
+ }
1312
+ let formFunction = this.correctForm;
1313
+ if (options.v4) {
1314
+ formFunction = this.to4in6;
1315
+ }
1316
+ const form = formFunction.call(this);
1317
+ const safeHref = helpers.escapeHtml(`${options.prefix}${form}`);
1318
+ const safeForm = helpers.escapeHtml(form);
1319
+ if (options.className) {
1320
+ const safeClass = helpers.escapeHtml(options.className);
1321
+ return `<a href="${safeHref}" class="${safeClass}">${safeForm}</a>`;
1322
+ }
1323
+ return `<a href="${safeHref}">${safeForm}</a>`;
1324
+ }
1325
+ /**
1326
+ * Groups an address.
1327
+ *
1328
+ * Returns an HTML fragment: each group is wrapped in a `<span>` carrying
1329
+ * the group classes an address-inspector UI hovers on. The address content
1330
+ * is HTML-escaped; anything you concatenate around it is your
1331
+ * responsibility.
1332
+ * @returns {String}
1333
+ */
1334
+ group() {
1335
+ if (this.elidedGroups === 0) {
1336
+ // The simple case
1337
+ return helpers.simpleGroup(this.addressMinusSuffix).join(':');
1338
+ }
1339
+ assert(typeof this.elidedGroups === 'number');
1340
+ assert(typeof this.elisionBegin === 'number');
1341
+ // The elided case
1342
+ const output = [];
1343
+ const [left, right] = this.addressMinusSuffix.split('::');
1344
+ if (left.length) {
1345
+ output.push(...helpers.simpleGroup(left));
1346
+ }
1347
+ else {
1348
+ output.push('');
1349
+ }
1350
+ const classes = ['hover-group'];
1351
+ for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) {
1352
+ classes.push(`group-${i}`);
1353
+ }
1354
+ output.push(`<span class="${classes.join(' ')}"></span>`);
1355
+ if (right.length) {
1356
+ output.push(...helpers.simpleGroup(right, this.elisionEnd));
1357
+ }
1358
+ else {
1359
+ output.push('');
1360
+ }
1361
+ if (this.is4()) {
1362
+ assert(this.address4 instanceof ipv4_1.Address4);
1363
+ output.pop();
1364
+ output.push(this.address4.groupForV6());
1365
+ }
1366
+ return output.join(':');
1367
+ }
1368
+ // #endregion
1369
+ // #region Regular expressions
1370
+ /**
1371
+ * Generate a regular expression string that can be used to find or validate
1372
+ * all variations of this address
1373
+ * @param {boolean} substringSearch
1374
+ * @returns {string}
1375
+ */
1376
+ regularExpressionString(substringSearch = false) {
1377
+ let output = [];
1378
+ // TODO: revisit why this is necessary
1379
+ const address6 = new Address6(this.correctForm());
1380
+ if (address6.elidedGroups === 0) {
1381
+ // The simple case
1382
+ output.push((0, regular_expressions_1.simpleRegularExpression)(address6.parsedAddress));
1383
+ }
1384
+ else if (address6.elidedGroups === constants6.GROUPS) {
1385
+ // A completely elided address
1386
+ output.push((0, regular_expressions_1.possibleElisions)(constants6.GROUPS));
1387
+ }
1388
+ else {
1389
+ // A partially elided address
1390
+ const halves = address6.address.split('::');
1391
+ if (halves[0].length) {
1392
+ output.push((0, regular_expressions_1.simpleRegularExpression)(halves[0].split(':')));
1393
+ }
1394
+ assert(typeof address6.elidedGroups === 'number');
1395
+ output.push((0, regular_expressions_1.possibleElisions)(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0));
1396
+ if (halves[1].length) {
1397
+ output.push((0, regular_expressions_1.simpleRegularExpression)(halves[1].split(':')));
1398
+ }
1399
+ output = [output.join(':')];
1400
+ }
1401
+ if (!substringSearch) {
1402
+ output = [
1403
+ '(?=^|',
1404
+ regular_expressions_1.ADDRESS_BOUNDARY,
1405
+ '|[^\\w\\:])(',
1406
+ ...output,
1407
+ ')(?=[^\\w\\:]|',
1408
+ regular_expressions_1.ADDRESS_BOUNDARY,
1409
+ '|$)',
1410
+ ];
1411
+ }
1412
+ return output.join('');
1413
+ }
1414
+ /**
1415
+ * Generate a regular expression that can be used to find or validate all
1416
+ * variations of this address.
1417
+ * @param {boolean} substringSearch
1418
+ * @returns {RegExp}
1419
+ */
1420
+ regularExpression(substringSearch = false) {
1421
+ return new RegExp(this.regularExpressionString(substringSearch), 'i');
1422
+ }
1423
+ }
1424
+ exports.Address6 = Address6;
1425
+ const TYPE_SUBNETS = Object.keys(constants6.TYPES).map((subnet) => [
1426
+ new Address6(subnet),
1427
+ constants6.TYPES[subnet],
1428
+ ]);
1429
+ const TEREDO_SUBNET = new Address6('2001::/32');
1430
+ const SIX_TO_FOUR_SUBNET = new Address6('2002::/16');
1431
+ const ULA_SUBNET = new Address6('fc00::/7');
1432
+ const LINK_LOCAL_SUBNET = new Address6('fe80::/10');
1433
+ const DOCUMENTATION_SUBNETS = [new Address6('2001:db8::/32'), new Address6('3fff::/20')];
1434
+ const BENCHMARKING_SUBNET = new Address6('2001:2::/48');
1435
+ const GLOBAL_UNICAST_SUBNET = new Address6('2000::/3');
1436
+ const SPECIAL_PURPOSE_V6 = constants6.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({
1437
+ subnet: new Address6(cidr),
1438
+ reachable,
1439
+ }));
1440
+ const IPV4_MAPPED_SUBNET = new Address6('::ffff:0:0/96');
1441
+ const NAT64_WELL_KNOWN_SUBNET = new Address6('64:ff9b::/96');
1442
+ const NAT64_LOCAL_USE_SUBNET = new Address6('64:ff9b:1::/48');
1443
+ //# sourceMappingURL=ipv6.js.map