@psnext/slingcli 3.3.20260911-1 → 3.3.20260915-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 (471) hide show
  1. package/README.md +17 -0
  2. package/bin/sling.js +117 -43
  3. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-VDBOM5UG.js → chunk-VY7PRZDT.js} +2 -2
  4. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js +1 -1
  5. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  6. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  7. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/model-selector.js +79 -32
  8. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +2149 -248
  9. package/node_modules/@earendil-works/pi-coding-agent/package.json +1 -0
  10. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -0
  11. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +25 -8
  12. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -0
  13. package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.browser.js +2 -0
  14. package/node_modules/@smithy/core/dist-es/submodules/serde/util-stream/getAwsChunkedEncodingStream.js +23 -8
  15. package/node_modules/@smithy/core/package.json +1 -1
  16. package/node_modules/@types/node/README.md +2 -2
  17. package/node_modules/@types/node/assert/strict.d.ts +13 -56
  18. package/node_modules/@types/node/assert.d.ts +189 -190
  19. package/node_modules/@types/node/async_hooks.d.ts +151 -43
  20. package/node_modules/@types/node/buffer.buffer.d.ts +12 -13
  21. package/node_modules/@types/node/buffer.d.ts +103 -237
  22. package/node_modules/@types/node/child_process.d.ts +39 -154
  23. package/node_modules/@types/node/cluster.d.ts +238 -384
  24. package/node_modules/@types/node/console.d.ts +45 -404
  25. package/node_modules/@types/node/constants.d.ts +3 -10
  26. package/node_modules/@types/node/crypto.d.ts +1000 -1593
  27. package/node_modules/@types/node/dgram.d.ts +133 -81
  28. package/node_modules/@types/node/diagnostics_channel.d.ts +277 -59
  29. package/node_modules/@types/node/dns/promises.d.ts +9 -15
  30. package/node_modules/@types/node/dns.d.ts +136 -183
  31. package/node_modules/@types/node/domain.d.ts +12 -32
  32. package/node_modules/@types/node/events.d.ts +872 -840
  33. package/node_modules/@types/node/ffi.d.ts +486 -0
  34. package/node_modules/@types/node/fs/promises.d.ts +256 -85
  35. package/node_modules/@types/node/fs.d.ts +865 -525
  36. package/node_modules/@types/node/globals.d.ts +12 -34
  37. package/node_modules/@types/node/globals.typedarray.d.ts +63 -0
  38. package/node_modules/@types/node/http.d.ts +433 -312
  39. package/node_modules/@types/node/http2.d.ts +545 -891
  40. package/node_modules/@types/node/https.d.ts +64 -243
  41. package/node_modules/@types/node/index.d.ts +25 -7
  42. package/node_modules/@types/node/inspector/promises.d.ts +35 -0
  43. package/node_modules/@types/node/inspector.d.ts +70 -58
  44. package/node_modules/@types/node/inspector.generated.d.ts +764 -410
  45. package/node_modules/@types/node/module.d.ts +54 -219
  46. package/node_modules/@types/node/net.d.ts +208 -222
  47. package/node_modules/@types/node/os.d.ts +41 -49
  48. package/node_modules/@types/node/package.json +13 -3
  49. package/node_modules/@types/node/path/posix.d.ts +8 -0
  50. package/node_modules/@types/node/path/win32.d.ts +8 -0
  51. package/node_modules/@types/node/path.d.ts +119 -141
  52. package/node_modules/@types/node/perf_hooks.d.ts +339 -690
  53. package/node_modules/@types/node/process.d.ts +389 -205
  54. package/node_modules/@types/node/punycode.d.ts +3 -31
  55. package/node_modules/@types/node/querystring.d.ts +3 -16
  56. package/node_modules/@types/node/quic.d.ts +2153 -0
  57. package/node_modules/@types/node/readline/promises.d.ts +3 -6
  58. package/node_modules/@types/node/readline.d.ts +66 -152
  59. package/node_modules/@types/node/repl.d.ts +101 -109
  60. package/node_modules/@types/node/sea.d.ts +1 -116
  61. package/node_modules/@types/node/sqlite.d.ts +486 -68
  62. package/node_modules/@types/node/stream/consumers.d.ts +91 -15
  63. package/node_modules/@types/node/stream/iter.d.ts +452 -0
  64. package/node_modules/@types/node/stream/promises.d.ts +136 -15
  65. package/node_modules/@types/node/stream/web.d.ts +197 -454
  66. package/node_modules/@types/node/stream.d.ts +603 -491
  67. package/node_modules/@types/node/string_decoder.d.ts +3 -43
  68. package/node_modules/@types/node/test/reporters.d.ts +59 -0
  69. package/node_modules/@types/node/test.d.ts +513 -292
  70. package/node_modules/@types/node/timers/promises.d.ts +3 -18
  71. package/node_modules/@types/node/timers.d.ts +3 -141
  72. package/node_modules/@types/node/tls.d.ts +166 -257
  73. package/node_modules/@types/node/trace_events.d.ts +3 -97
  74. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -8
  75. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  76. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +2 -0
  77. package/node_modules/@types/node/ts5.6/index.d.ts +26 -6
  78. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  79. package/node_modules/@types/node/ts5.7/index.d.ts +118 -0
  80. package/node_modules/@types/node/tty.d.ts +61 -43
  81. package/node_modules/@types/node/url.d.ts +156 -584
  82. package/node_modules/@types/node/util/types.d.ts +558 -0
  83. package/node_modules/@types/node/util.d.ts +170 -1099
  84. package/node_modules/@types/node/v8.d.ts +175 -36
  85. package/node_modules/@types/node/vfs.d.ts +211 -0
  86. package/node_modules/@types/node/vm.d.ts +292 -209
  87. package/node_modules/@types/node/wasi.d.ts +24 -74
  88. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  89. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  90. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  91. package/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  92. package/node_modules/@types/node/web-globals/domexception.d.ts +15 -0
  93. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  94. package/node_modules/@types/node/web-globals/events.d.ts +9 -0
  95. package/node_modules/@types/node/web-globals/fetch.d.ts +14 -0
  96. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  97. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  98. package/node_modules/@types/node/web-globals/navigator.d.ts +3 -0
  99. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  100. package/node_modules/@types/node/web-globals/streams.d.ts +97 -0
  101. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  102. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  103. package/node_modules/@types/node/worker_threads.d.ts +257 -407
  104. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  105. package/node_modules/@types/node/zlib.d.ts +24 -165
  106. package/node_modules/brace-expansion/dist/commonjs/index.d.ts +4 -0
  107. package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -1
  108. package/node_modules/brace-expansion/dist/commonjs/index.js +69 -25
  109. package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
  110. package/node_modules/brace-expansion/dist/esm/index.d.ts +4 -0
  111. package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -1
  112. package/node_modules/brace-expansion/dist/esm/index.js +68 -24
  113. package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
  114. package/node_modules/brace-expansion/package.json +2 -1
  115. package/node_modules/fast-uri/index.js +10 -6
  116. package/node_modules/fast-uri/package.json +1 -1
  117. package/node_modules/fast-uri/test/security-normalization.test.js +38 -0
  118. package/node_modules/hono/README.md +1 -1
  119. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +5 -4
  120. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +5 -4
  121. package/node_modules/hono/dist/cjs/context.js +1 -1
  122. package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +1 -1
  123. package/node_modules/hono/dist/cjs/jsx/dom/render.js +44 -8
  124. package/node_modules/hono/dist/cjs/middleware/language/language.js +4 -1
  125. package/node_modules/hono/dist/cjs/request.js +4 -1
  126. package/node_modules/hono/dist/cjs/utils/accept.js +4 -7
  127. package/node_modules/hono/dist/context.js +1 -1
  128. package/node_modules/hono/dist/helper/accepts/accepts.js +1 -1
  129. package/node_modules/hono/dist/jsx/dom/render.js +44 -8
  130. package/node_modules/hono/dist/middleware/language/language.js +4 -1
  131. package/node_modules/hono/dist/request.js +4 -1
  132. package/node_modules/hono/dist/types/helper/proxy/index.d.ts +1 -1
  133. package/node_modules/hono/dist/types/helper/route/index.d.ts +2 -2
  134. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +3 -1
  135. package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
  136. package/node_modules/hono/dist/utils/accept.js +4 -7
  137. package/node_modules/hono/package.json +1 -1
  138. package/node_modules/ip-address/README.md +114 -114
  139. package/node_modules/ip-address/dist/common.d.ts +5 -0
  140. package/node_modules/ip-address/dist/common.js +12 -0
  141. package/node_modules/ip-address/dist/common.js.map +1 -1
  142. package/node_modules/ip-address/dist/ipv4.d.ts +5 -1
  143. package/node_modules/ip-address/dist/ipv4.js +12 -1
  144. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  145. package/node_modules/ip-address/dist/ipv6.d.ts +5 -1
  146. package/node_modules/ip-address/dist/ipv6.js +15 -1
  147. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  148. package/node_modules/ip-address/package.json +1 -1
  149. package/node_modules/proxy-addr/HISTORY.md +60 -54
  150. package/node_modules/proxy-addr/README.md +1 -1
  151. package/node_modules/proxy-addr/index.js +32 -0
  152. package/node_modules/proxy-addr/package.json +8 -4
  153. package/node_modules/undici-types/agent.d.ts +12 -13
  154. package/node_modules/undici-types/api.d.ts +26 -26
  155. package/node_modules/undici-types/balanced-pool.d.ts +13 -12
  156. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  157. package/node_modules/undici-types/client-stats.d.ts +15 -0
  158. package/node_modules/undici-types/client.d.ts +63 -37
  159. package/node_modules/undici-types/connector.d.ts +5 -2
  160. package/node_modules/undici-types/cookies.d.ts +3 -1
  161. package/node_modules/undici-types/diagnostics-channel.d.ts +18 -10
  162. package/node_modules/undici-types/dispatcher.d.ts +136 -139
  163. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +7 -0
  164. package/node_modules/undici-types/env-http-proxy-agent.d.ts +4 -3
  165. package/node_modules/undici-types/errors.d.ts +92 -54
  166. package/node_modules/undici-types/eventsource.d.ts +9 -4
  167. package/node_modules/undici-types/fetch.d.ts +51 -25
  168. package/node_modules/undici-types/formdata.d.ts +7 -7
  169. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  170. package/node_modules/undici-types/global-origin.d.ts +5 -5
  171. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  172. package/node_modules/undici-types/handlers.d.ts +10 -9
  173. package/node_modules/undici-types/header.d.ts +162 -1
  174. package/node_modules/undici-types/index.d.ts +69 -47
  175. package/node_modules/undici-types/interceptors.d.ts +72 -9
  176. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  177. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  178. package/node_modules/undici-types/mock-client.d.ts +6 -4
  179. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  180. package/node_modules/undici-types/mock-interceptor.d.ts +26 -21
  181. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  182. package/node_modules/undici-types/package.json +1 -1
  183. package/node_modules/undici-types/patch.d.ts +0 -4
  184. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  185. package/node_modules/undici-types/pool.d.ts +14 -14
  186. package/node_modules/undici-types/proxy-agent.d.ts +14 -6
  187. package/node_modules/undici-types/readable.d.ts +19 -16
  188. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  189. package/node_modules/undici-types/retry-handler.d.ts +19 -10
  190. package/node_modules/undici-types/round-robin-pool.d.ts +39 -0
  191. package/node_modules/undici-types/snapshot-agent.d.ts +113 -0
  192. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  193. package/node_modules/undici-types/util.d.ts +3 -3
  194. package/node_modules/undici-types/utility.d.ts +7 -0
  195. package/node_modules/undici-types/webidl.d.ts +148 -30
  196. package/node_modules/undici-types/websocket.d.ts +48 -10
  197. package/node_modules/zod/README.md +2 -2
  198. package/node_modules/zod/package.json +1 -1
  199. package/node_modules/zod/src/v4/classic/checks.ts +1 -0
  200. package/node_modules/zod/src/v4/classic/schemas.ts +14 -30
  201. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +1 -0
  202. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +2 -11
  203. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -4
  204. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +22 -0
  205. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +1 -1
  206. package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
  207. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +53 -137
  208. package/node_modules/zod/src/v4/classic/tests/string.test.ts +70 -1
  209. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +87 -35
  210. package/node_modules/zod/src/v4/core/api.ts +21 -29
  211. package/node_modules/zod/src/v4/core/checks.ts +61 -1
  212. package/node_modules/zod/src/v4/core/compile.ts +35 -24
  213. package/node_modules/zod/src/v4/core/core.ts +1 -3
  214. package/node_modules/zod/src/v4/core/json-schema-processors.ts +9 -63
  215. package/node_modules/zod/src/v4/core/memoizer.ts +2 -5
  216. package/node_modules/zod/src/v4/core/regexes.ts +4 -0
  217. package/node_modules/zod/src/v4/core/schemas.ts +36 -109
  218. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
  219. package/node_modules/zod/src/v4/core/tests/compile.test.ts +177 -0
  220. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
  221. package/node_modules/zod/src/v4/core/to-json-schema.ts +1 -1
  222. package/node_modules/zod/src/v4/core/util.ts +0 -4
  223. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  224. package/node_modules/zod/src/v4/core/visit.ts +0 -11
  225. package/node_modules/zod/src/v4/locales/ar.ts +1 -0
  226. package/node_modules/zod/src/v4/locales/az.ts +1 -0
  227. package/node_modules/zod/src/v4/locales/be.ts +1 -0
  228. package/node_modules/zod/src/v4/locales/bg.ts +1 -0
  229. package/node_modules/zod/src/v4/locales/bn.ts +1 -0
  230. package/node_modules/zod/src/v4/locales/ca.ts +1 -0
  231. package/node_modules/zod/src/v4/locales/ckb.ts +1 -0
  232. package/node_modules/zod/src/v4/locales/cs.ts +1 -0
  233. package/node_modules/zod/src/v4/locales/da.ts +1 -0
  234. package/node_modules/zod/src/v4/locales/de.ts +1 -0
  235. package/node_modules/zod/src/v4/locales/el.ts +1 -0
  236. package/node_modules/zod/src/v4/locales/en.ts +1 -0
  237. package/node_modules/zod/src/v4/locales/eo.ts +1 -0
  238. package/node_modules/zod/src/v4/locales/es.ts +1 -0
  239. package/node_modules/zod/src/v4/locales/fa.ts +1 -0
  240. package/node_modules/zod/src/v4/locales/fi.ts +1 -0
  241. package/node_modules/zod/src/v4/locales/fr-CA.ts +1 -0
  242. package/node_modules/zod/src/v4/locales/fr.ts +1 -0
  243. package/node_modules/zod/src/v4/locales/gu.ts +1 -0
  244. package/node_modules/zod/src/v4/locales/he.ts +1 -0
  245. package/node_modules/zod/src/v4/locales/hi.ts +1 -0
  246. package/node_modules/zod/src/v4/locales/hr.ts +1 -0
  247. package/node_modules/zod/src/v4/locales/hu.ts +1 -0
  248. package/node_modules/zod/src/v4/locales/hy.ts +1 -0
  249. package/node_modules/zod/src/v4/locales/id.ts +1 -0
  250. package/node_modules/zod/src/v4/locales/is.ts +1 -0
  251. package/node_modules/zod/src/v4/locales/it.ts +1 -0
  252. package/node_modules/zod/src/v4/locales/ja.ts +1 -0
  253. package/node_modules/zod/src/v4/locales/ka.ts +1 -0
  254. package/node_modules/zod/src/v4/locales/km.ts +1 -0
  255. package/node_modules/zod/src/v4/locales/kn.ts +1 -0
  256. package/node_modules/zod/src/v4/locales/ko.ts +1 -0
  257. package/node_modules/zod/src/v4/locales/lt.ts +1 -0
  258. package/node_modules/zod/src/v4/locales/mk.ts +1 -0
  259. package/node_modules/zod/src/v4/locales/ms.ts +1 -0
  260. package/node_modules/zod/src/v4/locales/ne.ts +1 -0
  261. package/node_modules/zod/src/v4/locales/nl.ts +1 -0
  262. package/node_modules/zod/src/v4/locales/nn.ts +1 -0
  263. package/node_modules/zod/src/v4/locales/no.ts +1 -0
  264. package/node_modules/zod/src/v4/locales/ota.ts +1 -0
  265. package/node_modules/zod/src/v4/locales/pl.ts +1 -0
  266. package/node_modules/zod/src/v4/locales/ps.ts +1 -0
  267. package/node_modules/zod/src/v4/locales/pt-BR.ts +1 -0
  268. package/node_modules/zod/src/v4/locales/pt.ts +1 -0
  269. package/node_modules/zod/src/v4/locales/ro.ts +1 -0
  270. package/node_modules/zod/src/v4/locales/ru.ts +1 -0
  271. package/node_modules/zod/src/v4/locales/sk.ts +1 -0
  272. package/node_modules/zod/src/v4/locales/sl.ts +1 -0
  273. package/node_modules/zod/src/v4/locales/sv.ts +1 -0
  274. package/node_modules/zod/src/v4/locales/ta.ts +1 -0
  275. package/node_modules/zod/src/v4/locales/tg.ts +1 -0
  276. package/node_modules/zod/src/v4/locales/th.ts +1 -0
  277. package/node_modules/zod/src/v4/locales/tk.ts +1 -0
  278. package/node_modules/zod/src/v4/locales/tr.ts +1 -0
  279. package/node_modules/zod/src/v4/locales/uk.ts +1 -0
  280. package/node_modules/zod/src/v4/locales/ur.ts +1 -0
  281. package/node_modules/zod/src/v4/locales/uz.ts +1 -0
  282. package/node_modules/zod/src/v4/locales/vi.ts +1 -0
  283. package/node_modules/zod/src/v4/locales/yo.ts +1 -0
  284. package/node_modules/zod/src/v4/locales/zh-CN.ts +1 -0
  285. package/node_modules/zod/src/v4/locales/zh-TW.ts +1 -0
  286. package/node_modules/zod/src/v4/mini/checks.ts +1 -0
  287. package/node_modules/zod/src/v4/mini/schemas.ts +12 -23
  288. package/node_modules/zod/src/v4/mini/tests/index.test.ts +56 -0
  289. package/node_modules/zod/src/v4/mini/tests/string.test.ts +7 -0
  290. package/node_modules/zod/v4/classic/checks.cjs +2 -1
  291. package/node_modules/zod/v4/classic/checks.d.cts +1 -1
  292. package/node_modules/zod/v4/classic/checks.d.ts +1 -1
  293. package/node_modules/zod/v4/classic/checks.js +1 -1
  294. package/node_modules/zod/v4/classic/schemas.cjs +11 -15
  295. package/node_modules/zod/v4/classic/schemas.d.cts +4 -6
  296. package/node_modules/zod/v4/classic/schemas.d.ts +4 -6
  297. package/node_modules/zod/v4/classic/schemas.js +9 -13
  298. package/node_modules/zod/v4/core/api.cjs +11 -23
  299. package/node_modules/zod/v4/core/api.d.cts +8 -4
  300. package/node_modules/zod/v4/core/api.d.ts +8 -4
  301. package/node_modules/zod/v4/core/api.js +11 -23
  302. package/node_modules/zod/v4/core/checks.cjs +32 -1
  303. package/node_modules/zod/v4/core/checks.d.cts +16 -0
  304. package/node_modules/zod/v4/core/checks.d.ts +16 -0
  305. package/node_modules/zod/v4/core/checks.js +31 -0
  306. package/node_modules/zod/v4/core/compile.cjs +12 -17
  307. package/node_modules/zod/v4/core/compile.js +13 -18
  308. package/node_modules/zod/v4/core/core.cjs +1 -1
  309. package/node_modules/zod/v4/core/core.js +1 -1
  310. package/node_modules/zod/v4/core/json-schema-processors.cjs +8 -44
  311. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -1
  312. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -1
  313. package/node_modules/zod/v4/core/json-schema-processors.js +8 -43
  314. package/node_modules/zod/v4/core/memoizer.cjs +2 -5
  315. package/node_modules/zod/v4/core/memoizer.js +2 -5
  316. package/node_modules/zod/v4/core/regexes.cjs +4 -2
  317. package/node_modules/zod/v4/core/regexes.d.cts +1 -0
  318. package/node_modules/zod/v4/core/regexes.d.ts +1 -0
  319. package/node_modules/zod/v4/core/regexes.js +2 -0
  320. package/node_modules/zod/v4/core/schemas.cjs +33 -73
  321. package/node_modules/zod/v4/core/schemas.d.cts +7 -22
  322. package/node_modules/zod/v4/core/schemas.d.ts +7 -22
  323. package/node_modules/zod/v4/core/schemas.js +30 -72
  324. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -1
  325. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -3
  326. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -3
  327. package/node_modules/zod/v4/core/to-json-schema.js +1 -1
  328. package/node_modules/zod/v4/core/util.cjs +0 -4
  329. package/node_modules/zod/v4/core/util.js +0 -4
  330. package/node_modules/zod/v4/core/versions.cjs +1 -1
  331. package/node_modules/zod/v4/core/versions.js +1 -1
  332. package/node_modules/zod/v4/core/visit.cjs +0 -12
  333. package/node_modules/zod/v4/core/visit.js +0 -12
  334. package/node_modules/zod/v4/locales/ar.cjs +1 -0
  335. package/node_modules/zod/v4/locales/ar.js +1 -0
  336. package/node_modules/zod/v4/locales/az.cjs +1 -0
  337. package/node_modules/zod/v4/locales/az.js +1 -0
  338. package/node_modules/zod/v4/locales/be.cjs +1 -0
  339. package/node_modules/zod/v4/locales/be.js +1 -0
  340. package/node_modules/zod/v4/locales/bg.cjs +1 -0
  341. package/node_modules/zod/v4/locales/bg.js +1 -0
  342. package/node_modules/zod/v4/locales/bn.cjs +1 -0
  343. package/node_modules/zod/v4/locales/bn.js +1 -0
  344. package/node_modules/zod/v4/locales/ca.cjs +1 -0
  345. package/node_modules/zod/v4/locales/ca.js +1 -0
  346. package/node_modules/zod/v4/locales/ckb.cjs +1 -0
  347. package/node_modules/zod/v4/locales/ckb.js +1 -0
  348. package/node_modules/zod/v4/locales/cs.cjs +1 -0
  349. package/node_modules/zod/v4/locales/cs.js +1 -0
  350. package/node_modules/zod/v4/locales/da.cjs +1 -0
  351. package/node_modules/zod/v4/locales/da.js +1 -0
  352. package/node_modules/zod/v4/locales/de.cjs +1 -0
  353. package/node_modules/zod/v4/locales/de.js +1 -0
  354. package/node_modules/zod/v4/locales/el.cjs +1 -0
  355. package/node_modules/zod/v4/locales/el.js +1 -0
  356. package/node_modules/zod/v4/locales/en.cjs +1 -0
  357. package/node_modules/zod/v4/locales/en.js +1 -0
  358. package/node_modules/zod/v4/locales/eo.cjs +1 -0
  359. package/node_modules/zod/v4/locales/eo.js +1 -0
  360. package/node_modules/zod/v4/locales/es.cjs +1 -0
  361. package/node_modules/zod/v4/locales/es.js +1 -0
  362. package/node_modules/zod/v4/locales/fa.cjs +1 -0
  363. package/node_modules/zod/v4/locales/fa.js +1 -0
  364. package/node_modules/zod/v4/locales/fi.cjs +1 -0
  365. package/node_modules/zod/v4/locales/fi.js +1 -0
  366. package/node_modules/zod/v4/locales/fr-CA.cjs +1 -0
  367. package/node_modules/zod/v4/locales/fr-CA.js +1 -0
  368. package/node_modules/zod/v4/locales/fr.cjs +1 -0
  369. package/node_modules/zod/v4/locales/fr.js +1 -0
  370. package/node_modules/zod/v4/locales/gu.cjs +1 -0
  371. package/node_modules/zod/v4/locales/gu.js +1 -0
  372. package/node_modules/zod/v4/locales/he.cjs +1 -0
  373. package/node_modules/zod/v4/locales/he.js +1 -0
  374. package/node_modules/zod/v4/locales/hi.cjs +1 -0
  375. package/node_modules/zod/v4/locales/hi.js +1 -0
  376. package/node_modules/zod/v4/locales/hr.cjs +1 -0
  377. package/node_modules/zod/v4/locales/hr.js +1 -0
  378. package/node_modules/zod/v4/locales/hu.cjs +1 -0
  379. package/node_modules/zod/v4/locales/hu.js +1 -0
  380. package/node_modules/zod/v4/locales/hy.cjs +1 -0
  381. package/node_modules/zod/v4/locales/hy.js +1 -0
  382. package/node_modules/zod/v4/locales/id.cjs +1 -0
  383. package/node_modules/zod/v4/locales/id.js +1 -0
  384. package/node_modules/zod/v4/locales/is.cjs +1 -0
  385. package/node_modules/zod/v4/locales/is.js +1 -0
  386. package/node_modules/zod/v4/locales/it.cjs +1 -0
  387. package/node_modules/zod/v4/locales/it.js +1 -0
  388. package/node_modules/zod/v4/locales/ja.cjs +1 -0
  389. package/node_modules/zod/v4/locales/ja.js +1 -0
  390. package/node_modules/zod/v4/locales/ka.cjs +1 -0
  391. package/node_modules/zod/v4/locales/ka.js +1 -0
  392. package/node_modules/zod/v4/locales/km.cjs +1 -0
  393. package/node_modules/zod/v4/locales/km.js +1 -0
  394. package/node_modules/zod/v4/locales/kn.cjs +1 -0
  395. package/node_modules/zod/v4/locales/kn.js +1 -0
  396. package/node_modules/zod/v4/locales/ko.cjs +1 -0
  397. package/node_modules/zod/v4/locales/ko.js +1 -0
  398. package/node_modules/zod/v4/locales/lt.cjs +1 -0
  399. package/node_modules/zod/v4/locales/lt.js +1 -0
  400. package/node_modules/zod/v4/locales/mk.cjs +1 -0
  401. package/node_modules/zod/v4/locales/mk.js +1 -0
  402. package/node_modules/zod/v4/locales/ms.cjs +1 -0
  403. package/node_modules/zod/v4/locales/ms.js +1 -0
  404. package/node_modules/zod/v4/locales/ne.cjs +1 -0
  405. package/node_modules/zod/v4/locales/ne.js +1 -0
  406. package/node_modules/zod/v4/locales/nl.cjs +1 -0
  407. package/node_modules/zod/v4/locales/nl.js +1 -0
  408. package/node_modules/zod/v4/locales/nn.cjs +1 -0
  409. package/node_modules/zod/v4/locales/nn.js +1 -0
  410. package/node_modules/zod/v4/locales/no.cjs +1 -0
  411. package/node_modules/zod/v4/locales/no.js +1 -0
  412. package/node_modules/zod/v4/locales/ota.cjs +1 -0
  413. package/node_modules/zod/v4/locales/ota.js +1 -0
  414. package/node_modules/zod/v4/locales/pl.cjs +1 -0
  415. package/node_modules/zod/v4/locales/pl.js +1 -0
  416. package/node_modules/zod/v4/locales/ps.cjs +1 -0
  417. package/node_modules/zod/v4/locales/ps.js +1 -0
  418. package/node_modules/zod/v4/locales/pt-BR.cjs +1 -0
  419. package/node_modules/zod/v4/locales/pt-BR.js +1 -0
  420. package/node_modules/zod/v4/locales/pt.cjs +1 -0
  421. package/node_modules/zod/v4/locales/pt.js +1 -0
  422. package/node_modules/zod/v4/locales/ro.cjs +1 -0
  423. package/node_modules/zod/v4/locales/ro.js +1 -0
  424. package/node_modules/zod/v4/locales/ru.cjs +1 -0
  425. package/node_modules/zod/v4/locales/ru.js +1 -0
  426. package/node_modules/zod/v4/locales/sk.cjs +1 -0
  427. package/node_modules/zod/v4/locales/sk.js +1 -0
  428. package/node_modules/zod/v4/locales/sl.cjs +1 -0
  429. package/node_modules/zod/v4/locales/sl.js +1 -0
  430. package/node_modules/zod/v4/locales/sv.cjs +1 -0
  431. package/node_modules/zod/v4/locales/sv.js +1 -0
  432. package/node_modules/zod/v4/locales/ta.cjs +1 -0
  433. package/node_modules/zod/v4/locales/ta.js +1 -0
  434. package/node_modules/zod/v4/locales/tg.cjs +1 -0
  435. package/node_modules/zod/v4/locales/tg.js +1 -0
  436. package/node_modules/zod/v4/locales/th.cjs +1 -0
  437. package/node_modules/zod/v4/locales/th.js +1 -0
  438. package/node_modules/zod/v4/locales/tk.cjs +1 -0
  439. package/node_modules/zod/v4/locales/tk.js +1 -0
  440. package/node_modules/zod/v4/locales/tr.cjs +1 -0
  441. package/node_modules/zod/v4/locales/tr.js +1 -0
  442. package/node_modules/zod/v4/locales/uk.cjs +1 -0
  443. package/node_modules/zod/v4/locales/uk.js +1 -0
  444. package/node_modules/zod/v4/locales/ur.cjs +1 -0
  445. package/node_modules/zod/v4/locales/ur.js +1 -0
  446. package/node_modules/zod/v4/locales/uz.cjs +1 -0
  447. package/node_modules/zod/v4/locales/uz.js +1 -0
  448. package/node_modules/zod/v4/locales/vi.cjs +1 -0
  449. package/node_modules/zod/v4/locales/vi.js +1 -0
  450. package/node_modules/zod/v4/locales/yo.cjs +1 -0
  451. package/node_modules/zod/v4/locales/yo.js +1 -0
  452. package/node_modules/zod/v4/locales/zh-CN.cjs +1 -0
  453. package/node_modules/zod/v4/locales/zh-CN.js +1 -0
  454. package/node_modules/zod/v4/locales/zh-TW.cjs +1 -0
  455. package/node_modules/zod/v4/locales/zh-TW.js +1 -0
  456. package/node_modules/zod/v4/mini/checks.cjs +2 -1
  457. package/node_modules/zod/v4/mini/checks.d.cts +1 -1
  458. package/node_modules/zod/v4/mini/checks.d.ts +1 -1
  459. package/node_modules/zod/v4/mini/checks.js +1 -1
  460. package/node_modules/zod/v4/mini/schemas.cjs +11 -13
  461. package/node_modules/zod/v4/mini/schemas.d.cts +1 -4
  462. package/node_modules/zod/v4/mini/schemas.d.ts +1 -4
  463. package/node_modules/zod/v4/mini/schemas.js +9 -11
  464. package/package.json +2 -2
  465. package/slingshot/index.js +268 -264
  466. package/node_modules/@types/node/compatibility/disposable.d.ts +0 -14
  467. package/node_modules/@types/node/compatibility/index.d.ts +0 -9
  468. package/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
  469. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -20
  470. package/node_modules/undici-types/file.d.ts +0 -39
  471. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1 +1 @@
1
- {"version":3,"file":"ipv4.js","sourceRoot":"","sources":["../src/ipv4.ts"],"names":[],"mappings":";AAAA,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,iDAAmC;AACnC,0DAA4C;AAC5C,mDAA+C;AAE/C,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpD;;;GAGG;AACH,MAAa,QAAQ;IAWnB,YAAY,OAAe;QAT3B,uBAAkB,GAAW,EAAE,CAAC;QAChC,WAAM,GAAW,SAAS,CAAC,MAAM,CAAC;QAClC,kBAAa,GAAa,EAAE,CAAC;QAC7B,iBAAY,GAAW,EAAE,CAAC;QAC1B,WAAM,GAAW,KAAK,CAAC;QACvB,eAAU,GAAW,EAAE,CAAC;QACxB,OAAE,GAAY,IAAI,CAAC;QA0EnB;;;WAGG;QACH,cAAS,GAAG,UAAU,CAAC;QAkYvB;;;WAGG;QACH,eAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QAE/B;;;;;;;WAOG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,CAAC,eAAe,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG;IACvB,IAAI,QAAQ,CAAC,cAAc,CAAC;IAC5B,IAAI,QAAQ,CAAC,iBAAiB,CAAC;IAC/B,IAAI,QAAQ,CAAC,gBAAgB,CAAC;CAC/B,CAAC;AACF,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC;AACtD,MAAM,WAAW,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC;AAChD,MAAM,kBAAkB,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,AAAD,EAAG,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IACjF,MAAM,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC;IAC1B,SAAS;CACV,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-param-reassign */\n\nimport * as common from './common';\nimport * as constants from './v4/constants';\nimport { AddressError } from './address-error';\n\nconst isCorrect4 = common.isCorrect(constants.BITS);\n\n/**\n * Represents an IPv4 address\n * @param {string} address - An IPv4 address string\n */\nexport class Address4 {\n address: string;\n addressMinusSuffix: string = '';\n groups: number = constants.GROUPS;\n parsedAddress: string[] = [];\n parsedSubnet: string = '';\n subnet: string = '/32';\n subnetMask: number = 32;\n v4: boolean = true;\n private _binaryZeroPad?: string;\n\n constructor(address: string) {\n this.address = address;\n\n const subnet = constants.RE_SUBNET_STRING.exec(address);\n\n if (subnet) {\n this.parsedSubnet = subnet[0].replace('/', '');\n this.subnetMask = parseInt(this.parsedSubnet, 10);\n this.subnet = `/${this.subnetMask}`;\n\n if (this.subnetMask < 0 || this.subnetMask > constants.BITS) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n address = address.replace(constants.RE_SUBNET_STRING, '');\n }\n\n this.addressMinusSuffix = address;\n\n this.parsedAddress = this.parse(address);\n }\n\n /**\n * Returns true if the given string is a valid IPv4 address (with optional\n * CIDR subnet), false otherwise. Host bits in the subnet portion are\n * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address\n * validation compare `correctForm()` to `startAddress().correctForm()`,\n * or use `networkForm()`.\n */\n static isValid(address: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new Address4(address);\n\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Parses an IPv4 address string into its four octet groups and stores the\n * result on `this.parsedAddress`. Called automatically by the constructor;\n * you typically don't need to call it directly. Throws `AddressError` if\n * the input is not a valid IPv4 address.\n */\n parse(address: string) {\n const groups = address.split('.');\n\n // Checked before the general match so the error names the actual problem.\n // Address6 rejects the same notation on its v4-in-v6 path.\n if (groups.some((group) => /^0\\d/.test(group))) {\n throw new AddressError(\"IPv4 addresses can't have leading zeroes.\");\n }\n\n if (!address.match(constants.RE_ADDRESS)) {\n throw new AddressError('Invalid IPv4 address.');\n }\n\n return groups;\n }\n\n /**\n * Returns the address in correct form: octets joined with `.` and any\n * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the\n * canonical dotted-decimal representation.\n */\n correctForm(): string {\n return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');\n }\n\n /**\n * Returns true if the address is correct, false otherwise\n * @returns {Boolean}\n */\n isCorrect = isCorrect4;\n\n /**\n * Construct an `Address4` from an address and a dotted-decimal subnet\n * mask given as separate strings (e.g. as returned by Node's\n * `os.networkInterfaces()`). Throws `AddressError` if the mask is\n * non-contiguous (e.g. `255.0.255.0`).\n * @example\n * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');\n * address.subnetMask; // 24\n */\n static fromAddressAndMask(address: string, mask: string): Address4 {\n const bits = common.prefixLengthFromMask(new Address4(mask).bigInt(), constants.BITS);\n return new Address4(`${address}/${bits}`);\n }\n\n /**\n * Construct an `Address4` from an address and a Cisco-style wildcard mask\n * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard\n * mask is the bitwise inverse of the subnet mask. Throws `AddressError`\n * if the mask is non-contiguous (e.g. `0.255.0.255`).\n * @example\n * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');\n * address.subnetMask; // 24\n */\n static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address4 {\n const wildcard = new Address4(wildcardMask).bigInt();\n const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1);\n const mask = wildcard ^ allOnes;\n const bits = common.prefixLengthFromMask(mask, constants.BITS);\n return new Address4(`${address}/${bits}`);\n }\n\n /**\n * Construct an `Address4` from a wildcard pattern with trailing `*`\n * octets. The number of trailing wildcards determines the prefix\n * length: each `*` represents 8 bits.\n *\n * Only trailing whole-octet wildcards are supported. Partial-octet\n * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.\n * `192.*.0.1`) throw `AddressError`.\n * @example\n * Address4.fromWildcard('192.168.0.*').subnet; // '/24'\n * Address4.fromWildcard('192.168.*.*').subnet; // '/16'\n * Address4.fromWildcard('*.*.*.*').subnet; // '/0'\n */\n static fromWildcard(input: string): Address4 {\n const groups = input.split('.');\n\n if (groups.length !== constants.GROUPS) {\n throw new AddressError('Wildcard pattern must have 4 octets');\n }\n\n let firstWildcard = -1;\n\n for (let i = 0; i < groups.length; i++) {\n if (groups[i] === '*') {\n if (firstWildcard === -1) {\n firstWildcard = i;\n }\n } else if (firstWildcard !== -1) {\n throw new AddressError(\n 'Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)',\n );\n }\n }\n\n const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;\n const replaced = groups.map((g) => (g === '*' ? '0' : g));\n const subnetBits = constants.BITS - trailing * 8;\n\n return new Address4(`${replaced.join('.')}/${subnetBits}`);\n }\n\n /**\n * Converts a hex string to an IPv4 address object. Accepts 8 hex digits\n * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).\n * Throws `AddressError` for any other length or for non-hex characters.\n * @param {string} hex - a hex string to convert\n * @returns {Address4}\n */\n static fromHex(hex: string): Address4 {\n const stripped = hex.replace(/:/g, '');\n\n if (!/^[0-9a-fA-F]{8}$/.test(stripped)) {\n throw new AddressError('IPv4 hex must be exactly 8 hex digits');\n }\n\n const groups = [];\n\n for (let i = 0; i < 8; i += 2) {\n groups.push(parseInt(stripped.slice(i, i + 2), 16));\n }\n\n return new Address4(groups.join('.'));\n }\n\n /**\n * Converts an integer into a IPv4 address object. The integer must be a\n * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise\n * `AddressError` is thrown.\n * @param {integer} integer - a number to convert\n * @returns {Address4}\n */\n static fromInteger(integer: number): Address4 {\n if (!Number.isInteger(integer) || integer < 0 || integer > 0xffffffff) {\n throw new AddressError('IPv4 integer must be in the range 0 to 2**32 - 1');\n }\n\n return Address4.fromHex(integer.toString(16).padStart(8, '0'));\n }\n\n /**\n * Return an address from in-addr.arpa form\n * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address\n * @returns {Adress4}\n * @example\n * var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)\n * address.correctForm(); // '192.0.2.42'\n */\n static fromArpa(arpaFormAddress: string): Address4 {\n // remove ending \".in-addr.arpa.\" or just \".\"\n const leader = arpaFormAddress.replace(/(\\.in-addr\\.arpa)?\\.$/, '');\n\n const address = leader.split('.').reverse().join('.');\n\n return new Address4(address);\n }\n\n /**\n * Converts an IPv4 address object to a hex string\n * @returns {String}\n */\n toHex(): string {\n return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(':');\n }\n\n /**\n * Converts an IPv4 address object to an array of bytes.\n *\n * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.\n * @returns {Array}\n */\n toArray(): number[] {\n return this.parsedAddress.map((part) => parseInt(part, 10));\n }\n\n /**\n * Converts an IPv4 address object to an IPv6 address group\n * @returns {String}\n */\n toGroup6(): string {\n const output = [];\n let i;\n\n for (i = 0; i < constants.GROUPS; i += 2) {\n output.push(\n `${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(\n this.parsedAddress[i + 1],\n )}`,\n );\n }\n\n return output.join(':');\n }\n\n /**\n * Returns the address as a `bigint`\n * @returns {bigint}\n */\n bigInt(): bigint {\n return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join('')}`);\n }\n\n /**\n * Helper function getting start address.\n * @returns {bigint}\n */\n _startAddress(): bigint {\n return BigInt(`0b${this.mask() + '0'.repeat(constants.BITS - this.subnetMask)}`);\n }\n\n /**\n * The first address in the range given by this address' subnet.\n * Often referred to as the Network Address.\n * @returns {Address4}\n */\n startAddress(): Address4 {\n return Address4.fromBigInt(this._startAddress());\n }\n\n /**\n * The first host address in the range given by this address's subnet ie\n * the first address after the Network Address\n * @returns {Address4}\n */\n startAddressExclusive(): Address4 {\n const adjust = BigInt('1');\n return Address4.fromBigInt(this._startAddress() + adjust);\n }\n\n /**\n * Returns the address `n` addresses after this one (or before, when `n` is\n * negative), keeping this address's subnet mask. Throws `AddressError` when\n * the result would fall outside the IPv4 address space or `n` is not an\n * integer.\n * @param {number | bigint} n\n * @returns {Address4}\n * @example\n * new Address4('10.0.0.0/24').offset(1).correctForm(); // '10.0.0.1'\n */\n offset(n: number | bigint): Address4 {\n return Address4.fromBigInt(\n common.offsetBigInt(this.bigInt(), n, constants.BITS, 'IPv4'),\n ).withSubnetMask(this.subnetMask);\n }\n\n /**\n * Returns the network that follows this address's network: the address after\n * {@link endAddress}, with the same subnet mask. Throws `AddressError` when\n * this network is the last one in the address space.\n * @returns {Address4}\n * @example\n * new Address4('10.0.0.0/24').nextNetwork().networkForm(); // '10.0.1.0/24'\n */\n nextNetwork(): Address4 {\n return Address4.fromBigInt(\n common.offsetBigInt(this._endAddress(), 1, constants.BITS, 'IPv4'),\n ).withSubnetMask(this.subnetMask);\n }\n\n private withSubnetMask(subnetMask: number): Address4 {\n return new Address4(`${this.correctForm()}/${subnetMask}`);\n }\n\n /**\n * Helper function getting end address.\n * @returns {bigint}\n */\n _endAddress(): bigint {\n return BigInt(`0b${this.mask() + '1'.repeat(constants.BITS - this.subnetMask)}`);\n }\n\n /**\n * The last address in the range given by this address' subnet\n * Often referred to as the Broadcast\n * @returns {Address4}\n */\n endAddress(): Address4 {\n return Address4.fromBigInt(this._endAddress());\n }\n\n /**\n * The last host address in the range given by this address's subnet ie\n * the last address prior to the Broadcast Address\n * @returns {Address4}\n */\n endAddressExclusive(): Address4 {\n const adjust = BigInt('1');\n return Address4.fromBigInt(this._endAddress() - adjust);\n }\n\n /**\n * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for\n * a `/20`. Returns an `Address4`; call `.correctForm()` for the string.\n * @returns {Address4}\n */\n subnetMaskAddress(): Address4 {\n return Address4.fromBigInt(\n BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants.BITS - this.subnetMask)}`),\n );\n }\n\n /**\n * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is\n * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;\n * call `.correctForm()` for the string.\n * @returns {Address4}\n */\n wildcardMask(): Address4 {\n return Address4.fromBigInt(\n BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants.BITS - this.subnetMask)}`),\n );\n }\n\n /**\n * The network address in CIDR string form, e.g. `192.168.1.0/24` for\n * `192.168.1.5/24`. For an address with no explicit subnet the prefix is\n * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.\n * @returns {string}\n */\n networkForm(): string {\n return `${this.startAddress().correctForm()}/${this.subnetMask}`;\n }\n\n /**\n * Converts a BigInt to a v4 address object. The value must be in the\n * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.\n * @param {bigint} bigInt - a BigInt to convert\n * @returns {Address4}\n */\n static fromBigInt(bigInt: bigint): Address4 {\n if (bigInt < BigInt(0) || bigInt > BigInt(0xffffffff)) {\n throw new AddressError('IPv4 BigInt must be in the range 0 to 2**32 - 1');\n }\n\n return Address4.fromHex(bigInt.toString(16).padStart(8, '0'));\n }\n\n /**\n * Convert a byte array to an Address4 object. Throws `AddressError` unless\n * given exactly 4 integers from 0 to 255. Signed bytes are rejected, so\n * this differs from `Address6.fromByteArray`, which folds them; the two\n * contracts converge on this stricter form in the next major version.\n *\n * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.\n * @param {Array<number>} bytes - an array of 4 bytes (0-255)\n * @returns {Address4}\n */\n static fromByteArray(bytes: Array<number>): Address4 {\n common.assertByteArray(bytes, 4, 'IPv4', 0);\n\n return this.fromUnsignedByteArray(bytes);\n }\n\n /**\n * Convert an unsigned byte array to an Address4 object. Throws\n * `AddressError` unless given exactly 4 bytes, and rejects values outside\n * 0 to 255 when parsing the resulting address.\n *\n * To convert from a Node.js `Buffer`, spread it:\n * `Address4.fromUnsignedByteArray([...buf])`.\n * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)\n * @returns {Address4}\n */\n static fromUnsignedByteArray(bytes: Array<number>): Address4 {\n if (bytes.length !== 4) {\n throw new AddressError('IPv4 addresses require exactly 4 bytes');\n }\n\n const address = bytes.join('.');\n return new Address4(address);\n }\n\n /**\n * Returns the first n bits of the address, defaulting to the\n * subnet mask\n * @returns {String}\n */\n mask(mask?: number): string {\n if (mask === undefined) {\n mask = this.subnetMask;\n }\n\n return this.getBitsBase2(0, mask);\n }\n\n /**\n * Returns the bits in the given range as a base-2 string\n * @returns {string}\n */\n getBitsBase2(start: number, end: number): string {\n return this.binaryZeroPad().slice(start, end);\n }\n\n /**\n * Return the reversed in-addr.arpa form of the address, e.g.\n * `42.2.0.192.in-addr.arpa.` for `192.0.2.42`.\n * @param {Object} options\n * @param {boolean} options.omitSuffix - omit the \"in-addr.arpa\" suffix\n * @returns {String}\n */\n reverseForm(options?: common.ReverseFormOptions): string {\n if (!options) {\n options = {};\n }\n\n const reversed = this.correctForm().split('.').reverse().join('.');\n\n if (options.omitSuffix) {\n return reversed;\n }\n\n return `${reversed}.in-addr.arpa.`;\n }\n\n /**\n * Returns true if the given address is in the subnet of the current address\n * @returns {boolean}\n */\n isInSubnet = common.isInSubnet;\n\n /**\n * Returns true if this address's host bits fall inside the given subnet,\n * ignoring this address's own subnet mask. Prefer this over `isInSubnet`\n * when classifying a single address, so the answer doesn't change with the\n * CIDR suffix the caller happened to write — notably when the address came\n * from untrusted input and the result backs a trust-boundary decision.\n * @returns {boolean}\n */\n isHostInSubnet = common.isHostInSubnet;\n\n /**\n * Returns true if the given address is a multicast address\n * @returns {boolean}\n */\n isMulticast(): boolean {\n return this.isHostInSubnet(MULTICAST_V4);\n }\n\n /**\n * Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`).\n * @returns {boolean}\n */\n isPrivate(): boolean {\n return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet));\n }\n\n /**\n * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).\n * @returns {boolean}\n */\n isLoopback(): boolean {\n return this.isHostInSubnet(LOOPBACK_V4);\n }\n\n /**\n * Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)).\n * @returns {boolean}\n */\n isLinkLocal(): boolean {\n return this.isHostInSubnet(LINK_LOCAL_V4);\n }\n\n /**\n * Returns true if the address is the unspecified address `0.0.0.0`.\n * @returns {boolean}\n */\n isUnspecified(): boolean {\n return this.isHostInSubnet(UNSPECIFIED_V4);\n }\n\n /**\n * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).\n * @returns {boolean}\n */\n isBroadcast(): boolean {\n return this.isHostInSubnet(BROADCAST_V4);\n }\n\n /**\n * Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)).\n * @returns {boolean}\n */\n isCGNAT(): boolean {\n return this.isHostInSubnet(CGNAT_V4);\n }\n\n /**\n * Returns true if the address is in one of the documentation ranges\n * `192.0.2.0/24`, `198.51.100.0/24`, or `203.0.113.0/24` ([RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737)).\n * @returns {boolean}\n */\n isDocumentation(): boolean {\n return DOCUMENTATION_V4.some((subnet) => this.isHostInSubnet(subnet));\n }\n\n /**\n * Returns true if the address is in the benchmarking range `198.18.0.0/15` ([RFC 2544](https://datatracker.ietf.org/doc/html/rfc2544)).\n * @returns {boolean}\n */\n isBenchmarking(): boolean {\n return this.isHostInSubnet(BENCHMARKING_V4);\n }\n\n /**\n * Returns true if the address is in the reserved range `240.0.0.0/4` ([RFC 1112](https://datatracker.ietf.org/doc/html/rfc1112)),\n * which includes the limited broadcast address.\n * @returns {boolean}\n */\n isReserved(): boolean {\n return this.isHostInSubnet(RESERVED_V4);\n }\n\n /**\n * Returns true if the address is globally reachable: not multicast, and not\n * in any block the [IANA IPv4 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/)\n * marks as not globally reachable. That covers everything the individual\n * classifiers name (private, loopback, link-local, CGNAT, unspecified,\n * broadcast, documentation, benchmarking, reserved) and the blocks they do\n * not, such as `0.0.0.0/8` and the IETF protocol assignments in\n * `192.0.0.0/24`. This is the single predicate to use where a request must\n * not reach an internal or special-purpose destination; see SECURITY.md.\n * @returns {boolean}\n */\n isGlobal(): boolean {\n return !this.isMulticast() && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V4);\n }\n\n /**\n * Returns a zero-padded base-2 string representation of the address\n * @returns {string}\n */\n binaryZeroPad(): string {\n if (this._binaryZeroPad === undefined) {\n this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, '0');\n }\n return this._binaryZeroPad;\n }\n\n /**\n * Groups an IPv4 address for inclusion at the end of an IPv6 address.\n *\n * Returns an HTML fragment: each half of the address is wrapped in a\n * `<span>` carrying the group classes an address-inspector UI hovers on.\n * The address content is HTML-escaped; anything you concatenate around it\n * is your responsibility.\n * @returns {String}\n */\n groupForV6(): string {\n const segments = this.parsedAddress;\n\n return this.correctForm().replace(\n constants.RE_ADDRESS,\n `<span class=\"hover-group group-v4 group-6\">${segments\n .slice(0, 2)\n .join('.')}</span>.<span class=\"hover-group group-v4 group-7\">${segments\n .slice(2, 4)\n .join('.')}</span>`,\n );\n }\n}\n\nconst MULTICAST_V4 = new Address4('224.0.0.0/4');\nconst PRIVATE_V4 = [\n new Address4('10.0.0.0/8'),\n new Address4('172.16.0.0/12'),\n new Address4('192.168.0.0/16'),\n];\nconst LOOPBACK_V4 = new Address4('127.0.0.0/8');\nconst LINK_LOCAL_V4 = new Address4('169.254.0.0/16');\nconst UNSPECIFIED_V4 = new Address4('0.0.0.0/32');\nconst BROADCAST_V4 = new Address4('255.255.255.255/32');\nconst CGNAT_V4 = new Address4('100.64.0.0/10');\nconst DOCUMENTATION_V4 = [\n new Address4('192.0.2.0/24'),\n new Address4('198.51.100.0/24'),\n new Address4('203.0.113.0/24'),\n];\nconst BENCHMARKING_V4 = new Address4('198.18.0.0/15');\nconst RESERVED_V4 = new Address4('240.0.0.0/4');\nconst SPECIAL_PURPOSE_V4 = constants.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({\n subnet: new Address4(cidr),\n reachable,\n}));\n"]}
1
+ {"version":3,"file":"ipv4.js","sourceRoot":"","sources":["../src/ipv4.ts"],"names":[],"mappings":";AAAA,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtC,iDAAmC;AACnC,0DAA4C;AAC5C,mDAA+C;AAE/C,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAEpD;;;GAGG;AACH,MAAa,QAAQ;IAWnB,YAAY,OAAe;QAT3B,uBAAkB,GAAW,EAAE,CAAC;QAChC,WAAM,GAAW,SAAS,CAAC,MAAM,CAAC;QAClC,kBAAa,GAAa,EAAE,CAAC;QAC7B,iBAAY,GAAW,EAAE,CAAC;QAC1B,WAAM,GAAW,KAAK,CAAC;QACvB,e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,UAAU,GAAG;IACjB,IAAI,QAAQ,CAAC,YAAY,CAAC;IAC1B,IAAI,QAAQ,CAAC,eAAe,CAAC;IAC7B,IAAI,QAAQ,CAAC,gBAAgB,CAAC;CAC/B,CAAC;AACF,MAAM,WAAW,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC;AAChD,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AACrD,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;AAClD,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AACxD,MAAM,QAAQ,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC/C,MAAM,gBAAgB,GAAG;IACvB,IAAI,QAAQ,CAAC,cAAc,CAAC;IAC5B,IAAI,QAAQ,CAAC,iBAAiB,CAAC;IAC/B,IAAI,QAAQ,CAAC,gBAAgB,CAAC;CAC/B,CAAC;AACF,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC;AACtD,MAAM,WAAW,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC;AAChD,MAAM,kBAAkB,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,AAAD,EAAG,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IACjF,MAAM,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC;IAC1B,SAAS;CACV,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-param-reassign */\n\nimport * as common from './common';\nimport * as constants from './v4/constants';\nimport { AddressError } from './address-error';\n\nconst isCorrect4 = common.isCorrect(constants.BITS);\n\n/**\n * Represents an IPv4 address\n * @param {string} address - An IPv4 address string\n */\nexport class Address4 {\n address: string;\n addressMinusSuffix: string = '';\n groups: number = constants.GROUPS;\n parsedAddress: string[] = [];\n parsedSubnet: string = '';\n subnet: string = '/32';\n subnetMask: number = 32;\n v4: boolean = true;\n private _binaryZeroPad?: string;\n\n constructor(address: string) {\n this.address = address;\n\n const subnet = constants.RE_SUBNET_STRING.exec(address);\n\n if (subnet) {\n this.parsedSubnet = subnet[0].replace('/', '');\n this.subnetMask = parseInt(this.parsedSubnet, 10);\n this.subnet = `/${this.subnetMask}`;\n\n if (this.subnetMask < 0 || this.subnetMask > constants.BITS) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n address = address.replace(constants.RE_SUBNET_STRING, '');\n }\n\n // Four three-digit octets and three dots: the longest well-formed address\n // is 15 characters. Longer input is rejected before parsing, as Address6\n // does at its own limit.\n const longest = constants.GROUPS * 4 - 1;\n\n if (address.length > longest) {\n throw new AddressError(`IPv4 addresses are at most ${longest} characters.`);\n }\n\n this.addressMinusSuffix = address;\n\n this.parsedAddress = this.parse(address);\n }\n\n /**\n * Returns true if the given string is a valid IPv4 address (with optional\n * CIDR subnet), false otherwise. Host bits in the subnet portion are\n * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address\n * validation compare `correctForm()` to `startAddress().correctForm()`,\n * or use `networkForm()`.\n */\n static isValid(address: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new Address4(address);\n\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Parses an IPv4 address string into its four octet groups and stores the\n * result on `this.parsedAddress`. Called automatically by the constructor;\n * you typically don't need to call it directly. Throws `AddressError` if\n * the input is not a valid IPv4 address.\n */\n parse(address: string) {\n const groups = address.split('.');\n\n // Checked before the general match so the error names the actual problem.\n // Address6 rejects the same notation on its v4-in-v6 path.\n if (groups.some((group) => /^0\\d/.test(group))) {\n throw new AddressError(\"IPv4 addresses can't have leading zeroes.\");\n }\n\n if (!address.match(constants.RE_ADDRESS)) {\n throw new AddressError('Invalid IPv4 address.');\n }\n\n return groups;\n }\n\n /**\n * Returns the address in correct form: octets joined with `.` and any\n * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the\n * canonical dotted-decimal representation.\n */\n correctForm(): string {\n return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');\n }\n\n /**\n * Returns true if the address is correct, false otherwise\n * @returns {Boolean}\n */\n isCorrect = isCorrect4;\n\n /**\n * Construct an `Address4` from an address and a dotted-decimal subnet\n * mask given as separate strings (e.g. as returned by Node's\n * `os.networkInterfaces()`). Throws `AddressError` if the mask is\n * non-contiguous (e.g. `255.0.255.0`).\n * @example\n * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');\n * address.subnetMask; // 24\n */\n static fromAddressAndMask(address: string, mask: string): Address4 {\n const bits = common.prefixLengthFromMask(new Address4(mask).bigInt(), constants.BITS);\n return new Address4(`${address}/${bits}`);\n }\n\n /**\n * Construct an `Address4` from an address and a Cisco-style wildcard mask\n * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard\n * mask is the bitwise inverse of the subnet mask. Throws `AddressError`\n * if the mask is non-contiguous (e.g. `0.255.0.255`).\n * @example\n * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');\n * address.subnetMask; // 24\n */\n static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address4 {\n const wildcard = new Address4(wildcardMask).bigInt();\n const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1);\n const mask = wildcard ^ allOnes;\n const bits = common.prefixLengthFromMask(mask, constants.BITS);\n return new Address4(`${address}/${bits}`);\n }\n\n /**\n * Construct an `Address4` from a wildcard pattern with trailing `*`\n * octets. The number of trailing wildcards determines the prefix\n * length: each `*` represents 8 bits.\n *\n * Only trailing whole-octet wildcards are supported. Partial-octet\n * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.\n * `192.*.0.1`) throw `AddressError`.\n * @example\n * Address4.fromWildcard('192.168.0.*').subnet; // '/24'\n * Address4.fromWildcard('192.168.*.*').subnet; // '/16'\n * Address4.fromWildcard('*.*.*.*').subnet; // '/0'\n */\n static fromWildcard(input: string): Address4 {\n const groups = input.split('.');\n\n if (groups.length !== constants.GROUPS) {\n throw new AddressError('Wildcard pattern must have 4 octets');\n }\n\n let firstWildcard = -1;\n\n for (let i = 0; i < groups.length; i++) {\n if (groups[i] === '*') {\n if (firstWildcard === -1) {\n firstWildcard = i;\n }\n } else if (firstWildcard !== -1) {\n throw new AddressError(\n 'Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)',\n );\n }\n }\n\n const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;\n const replaced = groups.map((g) => (g === '*' ? '0' : g));\n const subnetBits = constants.BITS - trailing * 8;\n\n return new Address4(`${replaced.join('.')}/${subnetBits}`);\n }\n\n /**\n * Converts a hex string to an IPv4 address object. Accepts 8 hex digits\n * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).\n * Throws `AddressError` for any other length or for non-hex characters.\n * @param {string} hex - a hex string to convert\n * @returns {Address4}\n */\n static fromHex(hex: string): Address4 {\n const stripped = hex.replace(/:/g, '');\n\n if (!/^[0-9a-fA-F]{8}$/.test(stripped)) {\n throw new AddressError('IPv4 hex must be exactly 8 hex digits');\n }\n\n const groups = [];\n\n for (let i = 0; i < 8; i += 2) {\n groups.push(parseInt(stripped.slice(i, i + 2), 16));\n }\n\n return new Address4(groups.join('.'));\n }\n\n /**\n * Converts an integer into a IPv4 address object. The integer must be a\n * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise\n * `AddressError` is thrown.\n * @param {integer} integer - a number to convert\n * @returns {Address4}\n */\n static fromInteger(integer: number): Address4 {\n if (!Number.isInteger(integer) || integer < 0 || integer > 0xffffffff) {\n throw new AddressError('IPv4 integer must be in the range 0 to 2**32 - 1');\n }\n\n return Address4.fromHex(integer.toString(16).padStart(8, '0'));\n }\n\n /**\n * Return an address from in-addr.arpa form\n * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address\n * @returns {Adress4}\n * @example\n * var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)\n * address.correctForm(); // '192.0.2.42'\n */\n static fromArpa(arpaFormAddress: string): Address4 {\n // remove ending \".in-addr.arpa.\" or just \".\"\n const leader = arpaFormAddress.replace(/(\\.in-addr\\.arpa)?\\.$/, '');\n\n const address = leader.split('.').reverse().join('.');\n\n return new Address4(address);\n }\n\n /**\n * Converts an IPv4 address object to a hex string\n * @returns {String}\n */\n toHex(): string {\n return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(':');\n }\n\n /**\n * Converts an IPv4 address object to an array of bytes.\n *\n * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.\n * @returns {Array}\n */\n toArray(): number[] {\n return this.parsedAddress.map((part) => parseInt(part, 10));\n }\n\n /**\n * Converts an IPv4 address object to an IPv6 address group\n * @returns {String}\n */\n toGroup6(): string {\n const output = [];\n let i;\n\n for (i = 0; i < constants.GROUPS; i += 2) {\n output.push(\n `${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(\n this.parsedAddress[i + 1],\n )}`,\n );\n }\n\n return output.join(':');\n }\n\n /**\n * Returns the address as a `bigint`\n * @returns {bigint}\n */\n bigInt(): bigint {\n return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join('')}`);\n }\n\n /**\n * Helper function getting start address.\n * @returns {bigint}\n */\n _startAddress(): bigint {\n return BigInt(`0b${this.mask() + '0'.repeat(constants.BITS - this.subnetMask)}`);\n }\n\n /**\n * The first address in the range given by this address' subnet.\n * Often referred to as the Network Address.\n * @returns {Address4}\n */\n startAddress(): Address4 {\n return Address4.fromBigInt(this._startAddress());\n }\n\n /**\n * The first host address in the range given by this address's subnet ie\n * the first address after the Network Address\n * @returns {Address4}\n */\n startAddressExclusive(): Address4 {\n const adjust = BigInt('1');\n return Address4.fromBigInt(this._startAddress() + adjust);\n }\n\n /**\n * Returns the address `n` addresses after this one (or before, when `n` is\n * negative), keeping this address's subnet mask. Throws `AddressError` when\n * the result would fall outside the IPv4 address space or `n` is not an\n * integer.\n * @param {number | bigint} n\n * @returns {Address4}\n * @example\n * new Address4('10.0.0.0/24').offset(1).correctForm(); // '10.0.0.1'\n */\n offset(n: number | bigint): Address4 {\n return Address4.fromBigInt(\n common.offsetBigInt(this.bigInt(), n, constants.BITS, 'IPv4'),\n ).withSubnetMask(this.subnetMask);\n }\n\n /**\n * Returns the network that follows this address's network: the address after\n * {@link endAddress}, with the same subnet mask. Throws `AddressError` when\n * this network is the last one in the address space.\n * @returns {Address4}\n * @example\n * new Address4('10.0.0.0/24').nextNetwork().networkForm(); // '10.0.1.0/24'\n */\n nextNetwork(): Address4 {\n return Address4.fromBigInt(\n common.offsetBigInt(this._endAddress(), 1, constants.BITS, 'IPv4'),\n ).withSubnetMask(this.subnetMask);\n }\n\n private withSubnetMask(subnetMask: number): Address4 {\n return new Address4(`${this.correctForm()}/${subnetMask}`);\n }\n\n /**\n * Helper function getting end address.\n * @returns {bigint}\n */\n _endAddress(): bigint {\n return BigInt(`0b${this.mask() + '1'.repeat(constants.BITS - this.subnetMask)}`);\n }\n\n /**\n * The last address in the range given by this address' subnet\n * Often referred to as the Broadcast\n * @returns {Address4}\n */\n endAddress(): Address4 {\n return Address4.fromBigInt(this._endAddress());\n }\n\n /**\n * The last host address in the range given by this address's subnet ie\n * the last address prior to the Broadcast Address\n * @returns {Address4}\n */\n endAddressExclusive(): Address4 {\n const adjust = BigInt('1');\n return Address4.fromBigInt(this._endAddress() - adjust);\n }\n\n /**\n * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for\n * a `/20`. Returns an `Address4`; call `.correctForm()` for the string.\n * @returns {Address4}\n */\n subnetMaskAddress(): Address4 {\n return Address4.fromBigInt(\n BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants.BITS - this.subnetMask)}`),\n );\n }\n\n /**\n * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is\n * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;\n * call `.correctForm()` for the string.\n * @returns {Address4}\n */\n wildcardMask(): Address4 {\n return Address4.fromBigInt(\n BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants.BITS - this.subnetMask)}`),\n );\n }\n\n /**\n * The network address in CIDR string form, e.g. `192.168.1.0/24` for\n * `192.168.1.5/24`. For an address with no explicit subnet the prefix is\n * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.\n * @returns {string}\n */\n networkForm(): string {\n return `${this.startAddress().correctForm()}/${this.subnetMask}`;\n }\n\n /**\n * Converts a BigInt to a v4 address object. The value must be in the\n * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.\n * @param {bigint} bigInt - a BigInt to convert\n * @returns {Address4}\n */\n static fromBigInt(bigInt: bigint): Address4 {\n if (bigInt < BigInt(0) || bigInt > BigInt(0xffffffff)) {\n throw new AddressError('IPv4 BigInt must be in the range 0 to 2**32 - 1');\n }\n\n return Address4.fromHex(bigInt.toString(16).padStart(8, '0'));\n }\n\n /**\n * Convert a byte array to an Address4 object. Throws `AddressError` unless\n * given exactly 4 integers from 0 to 255. Signed bytes are rejected, so\n * this differs from `Address6.fromByteArray`, which folds them; the two\n * contracts converge on this stricter form in the next major version.\n *\n * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.\n * @param {Array<number>} bytes - an array of 4 bytes (0-255)\n * @returns {Address4}\n */\n static fromByteArray(bytes: Array<number>): Address4 {\n common.assertByteArray(bytes, 4, 'IPv4', 0);\n\n return this.fromUnsignedByteArray(bytes);\n }\n\n /**\n * Convert an unsigned byte array to an Address4 object. Throws\n * `AddressError` unless given exactly 4 bytes, and rejects values outside\n * 0 to 255 when parsing the resulting address.\n *\n * To convert from a Node.js `Buffer`, spread it:\n * `Address4.fromUnsignedByteArray([...buf])`.\n * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)\n * @returns {Address4}\n */\n static fromUnsignedByteArray(bytes: Array<number>): Address4 {\n if (bytes.length !== 4) {\n throw new AddressError('IPv4 addresses require exactly 4 bytes');\n }\n\n const address = bytes.join('.');\n return new Address4(address);\n }\n\n /**\n * Returns the first n bits of the address, defaulting to the\n * subnet mask\n * @returns {String}\n */\n mask(mask?: number): string {\n if (mask === undefined) {\n mask = this.subnetMask;\n }\n\n return this.getBitsBase2(0, mask);\n }\n\n /**\n * Returns the bits in the given range as a base-2 string\n * @returns {string}\n */\n getBitsBase2(start: number, end: number): string {\n return this.binaryZeroPad().slice(start, end);\n }\n\n /**\n * Return the reversed in-addr.arpa form of the address, e.g.\n * `42.2.0.192.in-addr.arpa.` for `192.0.2.42`.\n * @param {Object} options\n * @param {boolean} options.omitSuffix - omit the \"in-addr.arpa\" suffix\n * @returns {String}\n */\n reverseForm(options?: common.ReverseFormOptions): string {\n if (!options) {\n options = {};\n }\n\n const reversed = this.correctForm().split('.').reverse().join('.');\n\n if (options.omitSuffix) {\n return reversed;\n }\n\n return `${reversed}.in-addr.arpa.`;\n }\n\n /**\n * Returns true if the given address is in the subnet of the current address.\n * An `Address6` is never in the subnet of an `Address4`; convert with\n * `to4()` or `Address6.fromAddress4()` to compare across families.\n * @returns {boolean}\n */\n isInSubnet = common.isInSubnet;\n\n /**\n * Returns true if this address's host bits fall inside the given subnet,\n * ignoring this address's own subnet mask. Prefer this over `isInSubnet`\n * when classifying a single address, so the answer doesn't change with the\n * CIDR suffix the caller happened to write — notably when the address came\n * from untrusted input and the result backs a trust-boundary decision.\n * An `Address6` is never in the subnet of an `Address4`; convert with\n * `to4()` or `Address6.fromAddress4()` to compare across families.\n * @returns {boolean}\n */\n isHostInSubnet = common.isHostInSubnet;\n\n /**\n * Returns true if the given address is a multicast address\n * @returns {boolean}\n */\n isMulticast(): boolean {\n return this.isHostInSubnet(MULTICAST_V4);\n }\n\n /**\n * Returns true if the address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private address ranges (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`).\n * @returns {boolean}\n */\n isPrivate(): boolean {\n return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet));\n }\n\n /**\n * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).\n * @returns {boolean}\n */\n isLoopback(): boolean {\n return this.isHostInSubnet(LOOPBACK_V4);\n }\n\n /**\n * Returns true if the address is in the link-local range `169.254.0.0/16` ([RFC 3927](https://datatracker.ietf.org/doc/html/rfc3927)).\n * @returns {boolean}\n */\n isLinkLocal(): boolean {\n return this.isHostInSubnet(LINK_LOCAL_V4);\n }\n\n /**\n * Returns true if the address is the unspecified address `0.0.0.0`.\n * @returns {boolean}\n */\n isUnspecified(): boolean {\n return this.isHostInSubnet(UNSPECIFIED_V4);\n }\n\n /**\n * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).\n * @returns {boolean}\n */\n isBroadcast(): boolean {\n return this.isHostInSubnet(BROADCAST_V4);\n }\n\n /**\n * Returns true if the address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)).\n * @returns {boolean}\n */\n isCGNAT(): boolean {\n return this.isHostInSubnet(CGNAT_V4);\n }\n\n /**\n * Returns true if the address is in one of the documentation ranges\n * `192.0.2.0/24`, `198.51.100.0/24`, or `203.0.113.0/24` ([RFC 5737](https://datatracker.ietf.org/doc/html/rfc5737)).\n * @returns {boolean}\n */\n isDocumentation(): boolean {\n return DOCUMENTATION_V4.some((subnet) => this.isHostInSubnet(subnet));\n }\n\n /**\n * Returns true if the address is in the benchmarking range `198.18.0.0/15` ([RFC 2544](https://datatracker.ietf.org/doc/html/rfc2544)).\n * @returns {boolean}\n */\n isBenchmarking(): boolean {\n return this.isHostInSubnet(BENCHMARKING_V4);\n }\n\n /**\n * Returns true if the address is in the reserved range `240.0.0.0/4` ([RFC 1112](https://datatracker.ietf.org/doc/html/rfc1112)),\n * which includes the limited broadcast address.\n * @returns {boolean}\n */\n isReserved(): boolean {\n return this.isHostInSubnet(RESERVED_V4);\n }\n\n /**\n * Returns true if the address is globally reachable: not multicast, and not\n * in any block the [IANA IPv4 Special-Purpose Address Registry](https://www.iana.org/assignments/iana-ipv4-special-registry/)\n * marks as not globally reachable. That covers everything the individual\n * classifiers name (private, loopback, link-local, CGNAT, unspecified,\n * broadcast, documentation, benchmarking, reserved) and the blocks they do\n * not, such as `0.0.0.0/8` and the IETF protocol assignments in\n * `192.0.0.0/24`. This is the single predicate to use where a request must\n * not reach an internal or special-purpose destination; see SECURITY.md.\n * @returns {boolean}\n */\n isGlobal(): boolean {\n return !this.isMulticast() && common.isGloballyReachable.call(this, SPECIAL_PURPOSE_V4);\n }\n\n /**\n * Returns a zero-padded base-2 string representation of the address\n * @returns {string}\n */\n binaryZeroPad(): string {\n if (this._binaryZeroPad === undefined) {\n this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, '0');\n }\n return this._binaryZeroPad;\n }\n\n /**\n * Groups an IPv4 address for inclusion at the end of an IPv6 address.\n *\n * Returns an HTML fragment: each half of the address is wrapped in a\n * `<span>` carrying the group classes an address-inspector UI hovers on.\n * The address content is HTML-escaped; anything you concatenate around it\n * is your responsibility.\n * @returns {String}\n */\n groupForV6(): string {\n const segments = this.parsedAddress;\n\n return this.correctForm().replace(\n constants.RE_ADDRESS,\n `<span class=\"hover-group group-v4 group-6\">${segments\n .slice(0, 2)\n .join('.')}</span>.<span class=\"hover-group group-v4 group-7\">${segments\n .slice(2, 4)\n .join('.')}</span>`,\n );\n }\n}\n\nconst MULTICAST_V4 = new Address4('224.0.0.0/4');\nconst PRIVATE_V4 = [\n new Address4('10.0.0.0/8'),\n new Address4('172.16.0.0/12'),\n new Address4('192.168.0.0/16'),\n];\nconst LOOPBACK_V4 = new Address4('127.0.0.0/8');\nconst LINK_LOCAL_V4 = new Address4('169.254.0.0/16');\nconst UNSPECIFIED_V4 = new Address4('0.0.0.0/32');\nconst BROADCAST_V4 = new Address4('255.255.255.255/32');\nconst CGNAT_V4 = new Address4('100.64.0.0/10');\nconst DOCUMENTATION_V4 = [\n new Address4('192.0.2.0/24'),\n new Address4('198.51.100.0/24'),\n new Address4('203.0.113.0/24'),\n];\nconst BENCHMARKING_V4 = new Address4('198.18.0.0/15');\nconst RESERVED_V4 = new Address4('240.0.0.0/4');\nconst SPECIAL_PURPOSE_V4 = constants.SPECIAL_PURPOSE.map(([cidr, , reachable]) => ({\n subnet: new Address4(cidr),\n reachable,\n}));\n"]}
@@ -416,7 +416,9 @@ export declare class Address6 {
416
416
  */
417
417
  static fromUnsignedByteArray(bytes: Array<number>): Address6;
418
418
  /**
419
- * Returns true if the given address is in the subnet of the current address
419
+ * Returns true if the given address is in the subnet of the current address.
420
+ * An `Address4` is never in the subnet of an `Address6`; convert with
421
+ * `Address6.fromAddress4()` or `to4()` to compare across families.
420
422
  * @returns {boolean}
421
423
  */
422
424
  isInSubnet: typeof common.isInSubnet;
@@ -426,6 +428,8 @@ export declare class Address6 {
426
428
  * when classifying a single address, so the answer doesn't change with the
427
429
  * CIDR suffix the caller happened to write — notably when the address came
428
430
  * from untrusted input and the result backs a trust-boundary decision.
431
+ * An `Address4` is never in the subnet of an `Address6`; convert with
432
+ * `Address6.fromAddress4()` or `to4()` to compare across families.
429
433
  * @returns {boolean}
430
434
  */
431
435
  isHostInSubnet: typeof common.isHostInSubnet;
@@ -92,7 +92,9 @@ class Address6 {
92
92
  this.zone = '';
93
93
  // #region Attributes
94
94
  /**
95
- * Returns true if the given address is in the subnet of the current address
95
+ * Returns true if the given address is in the subnet of the current address.
96
+ * An `Address4` is never in the subnet of an `Address6`; convert with
97
+ * `Address6.fromAddress4()` or `to4()` to compare across families.
96
98
  * @returns {boolean}
97
99
  */
98
100
  this.isInSubnet = common.isInSubnet;
@@ -102,6 +104,8 @@ class Address6 {
102
104
  * when classifying a single address, so the answer doesn't change with the
103
105
  * CIDR suffix the caller happened to write — notably when the address came
104
106
  * from untrusted input and the result backs a trust-boundary decision.
107
+ * An `Address4` is never in the subnet of an `Address6`; convert with
108
+ * `Address6.fromAddress4()` or `to4()` to compare across families.
105
109
  * @returns {boolean}
106
110
  */
107
111
  this.isHostInSubnet = common.isHostInSubnet;
@@ -140,6 +144,16 @@ class Address6 {
140
144
  this.zone = zone[0];
141
145
  address = address.replace(constants6.RE_ZONE_STRING, '');
142
146
  }
147
+ // The longest well-formed address is all but the last two groups written
148
+ // as four hex digits with their colons, then a 15-character dotted quad:
149
+ // 5 * (groups - 2) + 15, which is 45 for eight groups, the same line
150
+ // CPython's ipaddress module draws. Rejecting longer input here keeps the
151
+ // parse diagnostics, which wrap every offending character in a span,
152
+ // proportional to an address rather than to whatever was passed in.
153
+ const longest = this.groups * 5 + 5;
154
+ if (address.length > longest) {
155
+ throw new address_error_1.AddressError(`IPv6 addresses are at most ${longest} characters.`);
156
+ }
143
157
  this.addressMinusSuffix = address;
144
158
  this.parsedAddress = this.parse(this.addressMinusSuffix);
145
159
  }