Brunobkr commited on
Commit
fc1fe22
·
verified ·
1 Parent(s): 6cec3a0

Upload folder using huggingface_hub (part 41)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tools/ui/node_modules/inline-style-parser/dist/inline-style-parser.min.js.map +1 -0
  2. tools/ui/node_modules/inline-style-parser/esm/index.d.mts +34 -0
  3. tools/ui/node_modules/inline-style-parser/esm/index.mjs +260 -0
  4. tools/ui/node_modules/inline-style-parser/esm/index.mjs.map +1 -0
  5. tools/ui/node_modules/inline-style-parser/index.d.ts +34 -0
  6. tools/ui/node_modules/inline-style-parser/package.json +77 -0
  7. tools/ui/node_modules/internal-slot/.attw.json +5 -0
  8. tools/ui/node_modules/internal-slot/.editorconfig +20 -0
  9. tools/ui/node_modules/internal-slot/.eslintrc +11 -0
  10. tools/ui/node_modules/internal-slot/.github/FUNDING.yml +12 -0
  11. tools/ui/node_modules/internal-slot/.nycrc +9 -0
  12. tools/ui/node_modules/internal-slot/CHANGELOG.md +114 -0
  13. tools/ui/node_modules/internal-slot/LICENSE +21 -0
  14. tools/ui/node_modules/internal-slot/README.md +58 -0
  15. tools/ui/node_modules/internal-slot/index.d.ts +12 -0
  16. tools/ui/node_modules/internal-slot/index.js +69 -0
  17. tools/ui/node_modules/internal-slot/package.json +79 -0
  18. tools/ui/node_modules/internal-slot/test/index.js +129 -0
  19. tools/ui/node_modules/internal-slot/tsconfig.json +9 -0
  20. tools/ui/node_modules/internmap/LICENSE +13 -0
  21. tools/ui/node_modules/internmap/README.md +94 -0
  22. tools/ui/node_modules/internmap/dist/internmap.js +75 -0
  23. tools/ui/node_modules/internmap/dist/internmap.min.js +2 -0
  24. tools/ui/node_modules/internmap/package.json +43 -0
  25. tools/ui/node_modules/internmap/src/index.js +61 -0
  26. tools/ui/node_modules/ip-address/LICENSE +19 -0
  27. tools/ui/node_modules/ip-address/README.md +298 -0
  28. tools/ui/node_modules/ip-address/dist/address-error.d.ts +4 -0
  29. tools/ui/node_modules/ip-address/dist/address-error.js +12 -0
  30. tools/ui/node_modules/ip-address/dist/address-error.js.map +1 -0
  31. tools/ui/node_modules/ip-address/dist/common.d.ts +49 -0
  32. tools/ui/node_modules/ip-address/dist/common.js +106 -0
  33. tools/ui/node_modules/ip-address/dist/common.js.map +1 -0
  34. tools/ui/node_modules/ip-address/dist/ip-address.d.ts +7 -0
  35. tools/ui/node_modules/ip-address/dist/ip-address.js +35 -0
  36. tools/ui/node_modules/ip-address/dist/ip-address.js.map +1 -0
  37. tools/ui/node_modules/ip-address/dist/ipv4.d.ts +274 -0
  38. tools/ui/node_modules/ip-address/dist/ipv4.js +489 -0
  39. tools/ui/node_modules/ip-address/dist/ipv4.js.map +1 -0
  40. tools/ui/node_modules/ip-address/dist/ipv6.d.ts +554 -0
  41. tools/ui/node_modules/ip-address/dist/ipv6.js +1344 -0
  42. tools/ui/node_modules/ip-address/dist/ipv6.js.map +1 -0
  43. tools/ui/node_modules/ip-address/dist/v4/constants.d.ts +4 -0
  44. tools/ui/node_modules/ip-address/dist/v4/constants.js +12 -0
  45. tools/ui/node_modules/ip-address/dist/v4/constants.js.map +1 -0
  46. tools/ui/node_modules/ip-address/dist/v6/constants.d.ts +44 -0
  47. tools/ui/node_modules/ip-address/dist/v6/constants.js +82 -0
  48. tools/ui/node_modules/ip-address/dist/v6/constants.js.map +1 -0
  49. tools/ui/node_modules/ip-address/dist/v6/helpers.d.ts +18 -0
  50. tools/ui/node_modules/ip-address/dist/v6/helpers.js +54 -0
tools/ui/node_modules/inline-style-parser/dist/inline-style-parser.min.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"inline-style-parser.min.js","sources":["../index.js"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nexport default function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n}\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n"],"names":["COMMENT_REGEX","NEWLINE_REGEX","WHITESPACE_REGEX","PROPERTY_REGEX","COLON_REGEX","VALUE_REGEX","SEMICOLON_REGEX","TRIM_REGEX","EMPTY_STRING","trim","str","replace","style","options","TypeError","lineno","column","updatePosition","lines","match","length","i","lastIndexOf","position","start","line","node","Position","whitespace","this","end","source","error","msg","err","Error","reason","filename","silent","re","m","exec","slice","comments","rules","c","comment","push","pos","charAt","type","declaration","prop","val","ret","property","value","prototype","content","decl","decls","declarations"],"mappings":"kPAEA,IAAIA,EAAgB,kCAEhBC,EAAgB,MAChBC,EAAmB,OAGnBC,EAAiB,yCACjBC,EAAc,QACdC,EAAc,uDACdC,EAAkB,UAGlBC,EAAa,aAMbC,EAAe,GA8OnB,SAASC,EAAKC,GACZ,OAAOA,EAAMA,EAAIC,QAAQJ,EAAYC,GAAgBA,CACvD,QAnOe,SAAUI,EAAOC,GAC9B,GAAqB,iBAAVD,EACT,MAAM,IAAIE,UAAU,mCAGtB,IAAKF,EAAO,MAAO,GAEnBC,EAAUA,GAAW,CAAA,EAKrB,IAAIE,EAAS,EACTC,EAAS,EAOb,SAASC,EAAeP,GACtB,IAAIQ,EAAQR,EAAIS,MAAMlB,GAClBiB,IAAOH,GAAUG,EAAME,QAC3B,IAAIC,EAAIX,EAAIY,YAvCF,MAwCVN,GAAUK,EAAIX,EAAIU,OAASC,EAAIL,EAASN,EAAIU,MAC9C,CAOA,SAASG,IACP,IAAIC,EAAQ,CAAEC,KAAMV,E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AQA,EAAM8B,MAAMrB,GACpBL,GAAU,EAEHgC,EAAI,CACTE,KApKa,UAqKbJ,QAASpC,GAvB0D,CAyBvE,CAQA,SAASyC,IACP,IAAIH,EAAMzB,IAGN6B,EAAOjC,EAAMhB,GACjB,GAAKiD,EAAL,CAIA,GAHAN,KAGK3B,EAAMf,GAAc,OAAO4B,EAAM,wBAGtC,IAAIqB,EAAMlC,EAAMd,GAEZiD,EAAMN,EAAI,CACZE,KA7LiB,cA8LjBK,SAAU9C,EAAK2C,EAAK,GAAGzC,QAAQX,EAAeQ,IAC9CgD,MAAOH,EACH5C,EAAK4C,EAAI,GAAG1C,QAAQX,EAAeQ,IACnCA,IAMN,OAFAW,EAAMb,GAECgD,CApBI,CAqBb,CAyBA,OA9JA3B,EAAS8B,UAAUC,QAAU9C,EA6J7BgB,IAjBA,WACE,IAKI+B,EALAC,EAAQ,GAMZ,IAJAjB,EAASiB,GAIDD,EAAOR,MACA,IAATQ,IACFC,EAAMb,KAAKY,GACXhB,EAASiB,IAIb,OAAOA,CACT,CAGOC,EACT"}
tools/ui/node_modules/inline-style-parser/esm/index.d.mts ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ interface Position {
2
+ start: {
3
+ line: number;
4
+ column: number;
5
+ };
6
+ end: {
7
+ line: number;
8
+ column: number;
9
+ };
10
+ source?: string;
11
+ }
12
+
13
+ export interface Declaration {
14
+ type: 'declaration';
15
+ property: string;
16
+ value: string;
17
+ position: Position;
18
+ }
19
+
20
+ export interface Comment {
21
+ type: 'comment';
22
+ comment: string;
23
+ position: Position;
24
+ }
25
+
26
+ interface Options {
27
+ source?: string;
28
+ silent?: boolean;
29
+ }
30
+
31
+ export default function InlineStyleParser(
32
+ style: string,
33
+ options?: Options
34
+ ): (Declaration | Comment)[];
tools/ui/node_modules/inline-style-parser/esm/index.mjs ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // http://www.w3.org/TR/CSS21/grammar.html
2
+ // https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027
3
+ var COMMENT_REGEX = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
4
+
5
+ var NEWLINE_REGEX = /\n/g;
6
+ var WHITESPACE_REGEX = /^\s*/;
7
+
8
+ // declaration
9
+ var PROPERTY_REGEX = /^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/;
10
+ var COLON_REGEX = /^:\s*/;
11
+ var VALUE_REGEX = /^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/;
12
+ var SEMICOLON_REGEX = /^[;\s]*/;
13
+
14
+ // https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
15
+ var TRIM_REGEX = /^\s+|\s+$/g;
16
+
17
+ // strings
18
+ var NEWLINE = '\n';
19
+ var FORWARD_SLASH = '/';
20
+ var ASTERISK = '*';
21
+ var EMPTY_STRING = '';
22
+
23
+ // types
24
+ var TYPE_COMMENT = 'comment';
25
+ var TYPE_DECLARATION = 'declaration';
26
+
27
+ /**
28
+ * @param {String} style
29
+ * @param {Object} [options]
30
+ * @return {Object[]}
31
+ * @throws {TypeError}
32
+ * @throws {Error}
33
+ */
34
+ function index (style, options) {
35
+ if (typeof style !== 'string') {
36
+ throw new TypeError('First argument must be a string');
37
+ }
38
+
39
+ if (!style) return [];
40
+
41
+ options = options || {};
42
+
43
+ /**
44
+ * Positional.
45
+ */
46
+ var lineno = 1;
47
+ var column = 1;
48
+
49
+ /**
50
+ * Update lineno and column based on `str`.
51
+ *
52
+ * @param {String} str
53
+ */
54
+ function updatePosition(str) {
55
+ var lines = str.match(NEWLINE_REGEX);
56
+ if (lines) lineno += lines.length;
57
+ var i = str.lastIndexOf(NEWLINE);
58
+ column = ~i ? str.length - i : column + str.length;
59
+ }
60
+
61
+ /**
62
+ * Mark position and patch `node.position`.
63
+ *
64
+ * @return {Function}
65
+ */
66
+ function position() {
67
+ var start = { line: lineno, column: column };
68
+ return function (node) {
69
+ node.position = new Position(start);
70
+ whitespace();
71
+ return node;
72
+ };
73
+ }
74
+
75
+ /**
76
+ * Store position information for a node.
77
+ *
78
+ * @constructor
79
+ * @property {Object} start
80
+ * @property {Object} end
81
+ * @property {undefined|String} source
82
+ */
83
+ function Position(start) {
84
+ this.start = start;
85
+ this.end = { line: lineno, column: column };
86
+ this.source = options.source;
87
+ }
88
+
89
+ /**
90
+ * Non-enumerable source string.
91
+ */
92
+ Position.prototype.content = style;
93
+
94
+ /**
95
+ * Error `msg`.
96
+ *
97
+ * @param {String} msg
98
+ * @throws {Error}
99
+ */
100
+ function error(msg) {
101
+ var err = new Error(
102
+ options.source + ':' + lineno + ':' + column + ': ' + msg
103
+ );
104
+ err.reason = msg;
105
+ err.filename = options.source;
106
+ err.line = lineno;
107
+ err.column = column;
108
+ err.source = style;
109
+
110
+ if (options.silent) ; else {
111
+ throw err;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Match `re` and return captures.
117
+ *
118
+ * @param {RegExp} re
119
+ * @return {undefined|Array}
120
+ */
121
+ function match(re) {
122
+ var m = re.exec(style);
123
+ if (!m) return;
124
+ var str = m[0];
125
+ updatePosition(str);
126
+ style = style.slice(str.length);
127
+ return m;
128
+ }
129
+
130
+ /**
131
+ * Parse whitespace.
132
+ */
133
+ function whitespace() {
134
+ match(WHITESPACE_REGEX);
135
+ }
136
+
137
+ /**
138
+ * Parse comments.
139
+ *
140
+ * @param {Object[]} [rules]
141
+ * @return {Object[]}
142
+ */
143
+ function comments(rules) {
144
+ var c;
145
+ rules = rules || [];
146
+ while ((c = comment())) {
147
+ if (c !== false) {
148
+ rules.push(c);
149
+ }
150
+ }
151
+ return rules;
152
+ }
153
+
154
+ /**
155
+ * Parse comment.
156
+ *
157
+ * @return {Object}
158
+ * @throws {Error}
159
+ */
160
+ function comment() {
161
+ var pos = position();
162
+ if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;
163
+
164
+ var i = 2;
165
+ while (
166
+ EMPTY_STRING != style.charAt(i) &&
167
+ (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))
168
+ ) {
169
+ ++i;
170
+ }
171
+ i += 2;
172
+
173
+ if (EMPTY_STRING === style.charAt(i - 1)) {
174
+ return error('End of comment missing');
175
+ }
176
+
177
+ var str = style.slice(2, i - 2);
178
+ column += 2;
179
+ updatePosition(str);
180
+ style = style.slice(i);
181
+ column += 2;
182
+
183
+ return pos({
184
+ type: TYPE_COMMENT,
185
+ comment: str
186
+ });
187
+ }
188
+
189
+ /**
190
+ * Parse declaration.
191
+ *
192
+ * @return {Object}
193
+ * @throws {Error}
194
+ */
195
+ function declaration() {
196
+ var pos = position();
197
+
198
+ // prop
199
+ var prop = match(PROPERTY_REGEX);
200
+ if (!prop) return;
201
+ comment();
202
+
203
+ // :
204
+ if (!match(COLON_REGEX)) return error("property missing ':'");
205
+
206
+ // val
207
+ var val = match(VALUE_REGEX);
208
+
209
+ var ret = pos({
210
+ type: TYPE_DECLARATION,
211
+ property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),
212
+ value: val
213
+ ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))
214
+ : EMPTY_STRING
215
+ });
216
+
217
+ // ;
218
+ match(SEMICOLON_REGEX);
219
+
220
+ return ret;
221
+ }
222
+
223
+ /**
224
+ * Parse declarations.
225
+ *
226
+ * @return {Object[]}
227
+ */
228
+ function declarations() {
229
+ var decls = [];
230
+
231
+ comments(decls);
232
+
233
+ // declarations
234
+ var decl;
235
+ while ((decl = declaration())) {
236
+ if (decl !== false) {
237
+ decls.push(decl);
238
+ comments(decls);
239
+ }
240
+ }
241
+
242
+ return decls;
243
+ }
244
+
245
+ whitespace();
246
+ return declarations();
247
+ }
248
+
249
+ /**
250
+ * Trim `str`.
251
+ *
252
+ * @param {String} str
253
+ * @return {String}
254
+ */
255
+ function trim(str) {
256
+ return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;
257
+ }
258
+
259
+ export { index as default };
260
+ //# sourceMappingURL=index.mjs.map
tools/ui/node_modules/inline-style-parser/esm/index.mjs.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.mjs","sources":["../index.js"],"sourcesContent":["// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nexport default function (style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function (node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n}\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA,IAAI,aAAa,GAAG,iCAAiC;;AAErD,IAAI,aAAa,GAAG,KAAK;AACzB,IAAI,gBAAgB,GAAG,MAAM;;AAE7B;AACA,IAAI,cAAc,GAAG,wCAAwC;AAC7D,IAAI,WAAW,GAAG,OAAO;AACzB,IAAI,WAAW,GAAG,sDAAsD;AACxE,IAAI,eAAe,GAAG,SAAS;;AAE/B;AACA,IAAI,UAAU,GAAG,YAAY;;AAE7B;AACA,IAAI,OAAO,GAAG,IAAI;AAClB,IAAI,aAAa,GAAG,GAAG;AACvB,IAAI,QAAQ,GAAG,GAAG;AAClB,IAAI,YAAY,GAAG,EAAE;;AAErB;AACA,IAAI,YAAY,GAAG,SAAS;AAC5B,IAAI,gBAAgB,GAAG,aAAa;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACe,cAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;AACzC,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AACjC,IAAI,MAAM,IAAI,SAAS,CAAC,iCAAiC,CAAC;AAC1D,EAAE;;AAEF,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE;;AAEvB,EAAE,OAAO,GAAG,OAAO,IAAI,EAAE;;AAEzB;AACA;AACA;AACA,EAAE,IAAI,MAAM,GAAG,CAAC;AAChB,EAAE,IAAI,MAAM,GAAG,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,cAAc,CAAC,GAAG,EAAE;AAC/B,IAAI,IAAI,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC;AACxC,IAAI,IAAI,KAAK,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM;AACrC,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC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AI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AAClE,MAAM,KAAK,EAAE;AACb,UAAU,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC;AAC1D,UAAU;AACV,KAAK,CAAC;;AAEN;AACA,IAAI,KAAK,CAAC,eAAe,CAAC;;AAE1B,IAAI,OAAO,GAAG;AACd,EAAE;;AAEF;AACA;AACA;AACA;AACA;AACA,EAAE,SAAS,YAAY,GAAG;AAC1B,IAAI,IAAI,KAAK,GAAG,EAAE;;AAElB,IAAI,QAAQ,CAAC,KAAK,CAAC;;AAEnB;AACA,IAAI,IAAI,IAAI;AACZ,IAAI,QAAQ,IAAI,GAAG,WAAW,EAAE,GAAG;AACnC,MAAM,IAAI,IAAI,KAAK,KAAK,EAAE;AAC1B,QAAQ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AACxB,QAAQ,QAAQ,CAAC,KAAK,CAAC;AACvB,MAAM;AACN,IAAI;;AAEJ,IAAI,OAAO,KAAK;AAChB,EAAE;;AAEF,EAAE,UAAU,EAAE;AACd,EAAE,OAAO,YAAY,EAAE;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI,CAAC,GAAG,EAAE;AACnB,EAAE,OAAO,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,YAAY,CAAC,GAAG,YAAY;AACnE;;;;"}
tools/ui/node_modules/inline-style-parser/index.d.ts ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ interface Position {
2
+ start: {
3
+ line: number;
4
+ column: number;
5
+ };
6
+ end: {
7
+ line: number;
8
+ column: number;
9
+ };
10
+ source?: string;
11
+ }
12
+
13
+ export interface Declaration {
14
+ type: 'declaration';
15
+ property: string;
16
+ value: string;
17
+ position: Position;
18
+ }
19
+
20
+ export interface Comment {
21
+ type: 'comment';
22
+ comment: string;
23
+ position: Position;
24
+ }
25
+
26
+ interface Options {
27
+ source?: string;
28
+ silent?: boolean;
29
+ }
30
+
31
+ export default function InlineStyleParser(
32
+ style: string,
33
+ options?: Options
34
+ ): (Declaration | Comment)[];
tools/ui/node_modules/inline-style-parser/package.json ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "inline-style-parser",
3
+ "version": "0.2.7",
4
+ "description": "An inline style parser.",
5
+ "main": "./cjs/index.js",
6
+ "module": "./esm/index.mjs",
7
+ "types": "./esm/index.d.mts",
8
+ "exports": {
9
+ "import": {
10
+ "types": "./esm/index.d.mts",
11
+ "default": "./esm/index.mjs"
12
+ },
13
+ "require": {
14
+ "types": "./cjs/index.d.cts",
15
+ "default": "./cjs/index.js"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "build": "run-s build:*",
20
+ "build:cjs": "rollup --config rollup.cjs.config.mjs --failAfterWarnings && cp index.d.ts cjs/index.d.cts",
21
+ "build:esm": "rollup --config rollup.esm.config.mjs --failAfterWarnings && cp index.d.ts esm/index.d.mts",
22
+ "build:umd": "rollup --config rollup.umd.config.mjs --failAfterWarnings",
23
+ "clean": "rm -rf cjs dist esm",
24
+ "lint": "eslint .",
25
+ "lint:fix": "npm run lint -- --fix",
26
+ "lint:package": "publint",
27
+ "prepare": "husky",
28
+ "prepublishOnly": "npm run lint && npm run build && npm test",
29
+ "test": "jest --colors --testPathIgnorePatterns=test/index.test.mjs",
30
+ "test:ci": "CI=true npm test -- --ci --coverage --collectCoverageFrom=cjs/index.js",
31
+ "test:esm": "node --test **/*.test.mjs",
32
+ "test:watch": "npm test -- --watch"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/remarkablemark/inline-style-parser.git"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/remarkablemark/inline-style-parser/issues"
40
+ },
41
+ "keywords": [
42
+ "inline-style-parser",
43
+ "inline-style",
44
+ "style",
45
+ "parser",
46
+ "css"
47
+ ],
48
+ "devDependencies": {
49
+ "@commitlint/cli": "20.1.0",
50
+ "@commitlint/config-conventional": "20.0.0",
51
+ "@eslint/compat": "2.0.0",
52
+ "@eslint/eslintrc": "3.3.1",
53
+ "@eslint/js": "9.39.1",
54
+ "@rollup/plugin-commonjs": "29.0.0",
55
+ "@rollup/plugin-node-resolve": "16.0.3",
56
+ "@rollup/plugin-terser": "0.4.4",
57
+ "css": "3.0.0",
58
+ "eslint": "9.39.1",
59
+ "eslint-plugin-prettier": "5.5.4",
60
+ "eslint-plugin-simple-import-sort": "12.1.1",
61
+ "globals": "16.5.0",
62
+ "husky": "9.1.7",
63
+ "jest": "30.2.0",
64
+ "lint-staged": "16.2.6",
65
+ "npm-run-all": "4.1.5",
66
+ "prettier": "3.6.2",
67
+ "publint": "0.3.15",
68
+ "rollup": "4.53.2"
69
+ },
70
+ "files": [
71
+ "/cjs",
72
+ "/dist",
73
+ "/esm",
74
+ "/index.d.ts"
75
+ ],
76
+ "license": "MIT"
77
+ }
tools/ui/node_modules/internal-slot/.attw.json ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ {
2
+ "ignoreRules": [
3
+ "named-exports"
4
+ ]
5
+ }
tools/ui/node_modules/internal-slot/.editorconfig ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = tab
5
+ indent_size = 4
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ max_line_length = 150
11
+
12
+ [CHANGELOG.md]
13
+ indent_style = space
14
+ indent_size = 2
15
+
16
+ [*.json]
17
+ max_line_length = off
18
+
19
+ [Makefile]
20
+ max_line_length = off
tools/ui/node_modules/internal-slot/.eslintrc ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "root": true,
3
+
4
+ "extends": "@ljharb",
5
+
6
+ "rules": {
7
+ "max-params": [2, 3],
8
+ "new-cap": [2, { "capIsNewExceptions": ["GetIntrinsic"] }],
9
+ "no-magic-numbers": 0,
10
+ },
11
+ }
tools/ui/node_modules/internal-slot/.github/FUNDING.yml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # These are supported funding model platforms
2
+
3
+ github: [ljharb]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: npm/internal-slot
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ otechie: # Replace with a single Otechie username
12
+ custom: # Replace with a single custom sponsorship URL
tools/ui/node_modules/internal-slot/.nycrc ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "all": true,
3
+ "check-coverage": false,
4
+ "reporter": ["text-summary", "text", "html", "json"],
5
+ "exclude": [
6
+ "coverage",
7
+ "test"
8
+ ]
9
+ }
tools/ui/node_modules/internal-slot/CHANGELOG.md ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Changelog
2
+
3
+ All notable changes to this project will be documented in this file. Dates are displayed in UTC.
4
+
5
+ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
+
7
+ #### [v1.1.0](https://github.com/ljharb/internal-slot/compare/v1.0.7...v1.1.0)
8
+
9
+ > 13 December 2024
10
+
11
+ - [New] add types [`295d25d`](https://github.com/ljharb/internal-slot/commit/295d25d55cfcb6ba1dd2520b36f4270c5a613c09)
12
+ - [actions] split out node 10-20, and 20+ [`9c9a2ab`](https://github.com/ljharb/internal-slot/commit/9c9a2ab345f0cb6d202cc92297060889e9ed5e06)
13
+ - [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `tape` [`9c5621b`](https://github.com/ljharb/internal-slot/commit/9c5621bc88dd9fcf20e2347a7c26af7fdcd509a2)
14
+ - [Deps] update `hasown`, `side-channel` [`5281391`](https://github.com/ljharb/internal-slot/commit/52813911eb534cda56e414810b6e2bfe85fa340c)
15
+ - [Tests] replace `aud` with `npm audit` [`64ce191`](https://github.com/ljharb/internal-slot/commit/64ce191a0603f10017854cb7dc5629da2b5fca6b)
16
+ - [Dev Deps] add missing peer dep [`d500343`](https://github.com/ljharb/internal-slot/commit/d5003432d47d7d5dced1c5c5f3543a4f1b65bb1f)
17
+
18
+ #### [v1.0.7](https://github.com/ljharb/internal-slot/compare/v1.0.6...v1.0.7)
19
+
20
+ > 5 February 2024
21
+
22
+ - [Dev Deps] update `aud`, `npmignore`, `tape` [`89c88c1`](https://github.com/ljharb/internal-slot/commit/89c88c1ed8de7c681fd3cec7bb2f045db0268d84)
23
+ - [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`b437631`](https://github.com/ljharb/internal-slot/commit/b4376312d4a5d7bc99fb383cae3f15bd2f3d36d1)
24
+
25
+ #### [v1.0.6](https://github.com/ljharb/internal-slot/compare/v1.0.5...v1.0.6)
26
+
27
+ > 20 October 2023
28
+
29
+ - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`4d568d2`](https://github.com/ljharb/internal-slot/commit/4d568d2897a2efe9b0604ae240bc89787924070f)
30
+ - [Refactor] use `hasown` instead of `has` [`f946e94`](https://github.com/ljharb/internal-slot/commit/f946e94885f5fa092a4de04f366d746c0c5a2f2f)
31
+ - [Deps] update `get-intrinsic` [`1bbc885`](https://github.com/ljharb/internal-slot/commit/1bbc885b0225dadac6e50f421cda5814c242b0bb)
32
+ - [meta] remove unused `.eslintignore` [`6fdde1a`](https://github.com/ljharb/internal-slot/commit/6fdde1a25348cf9fc41c9808d342e6502f37658d)
33
+
34
+ #### [v1.0.5](https://github.com/ljharb/internal-slot/compare/v1.0.4...v1.0.5)
35
+
36
+ > 9 February 2023
37
+
38
+ - [Dev Deps] update `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`e427703`](https://github.com/ljharb/internal-slot/commit/e427703bfc669c590a863ec77ecd3789d7b7c458)
39
+ - [Deps] update `get-intrinsic` [`aa652f0`](https://github.com/ljharb/internal-slot/commit/aa652f05c5c15b4ed1a118be60f0565e47bd7208)
40
+ - [Fix] improve assertion message [`8df86e3`](https://github.com/ljharb/internal-slot/commit/8df86e3ea21786b5eb7654f22202665c8b63accf)
41
+
42
+ #### [v1.0.4](https://github.com/ljharb/internal-slot/compare/v1.0.3...v1.0.4)
43
+
44
+ > 13 December 2022
45
+
46
+ - [actions] reuse common workflows [`82a1aee`](https://github.com/ljharb/internal-slot/commit/82a1aee603bce8627930597edb3a04b4970ed151)
47
+ - [meta] use `npmignore` to autogenerate an npmignore file [`56f7e71`](https://github.com/ljharb/internal-slot/commit/56f7e7182dd934dd6c1b80497a110670d02a91b9)
48
+ - [actions] use `node/install` instead of `node/run`; use `codecov` action [`e25ff67`](https://github.com/ljharb/internal-slot/commit/e25ff67d568f77c1b66168957d82b080779e1c0a)
49
+ - [actions] update rebase action to use reusable workflow [`227e81e`](https://github.com/ljharb/internal-slot/commit/227e81eaef7230a265103ef1ef0618d2920c3f30)
50
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `foreach`, `object-inspect`, `tape` [`fc9f319`](https://github.com/ljharb/internal-slot/commit/fc9f319d136ddf2e79910390d1e7ad279d41cc01)
51
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest`, `tape` [`0a72a0f`](https://github.com/ljharb/internal-slot/commit/0a72a0f389511b41645f441da19257a266cb37f7)
52
+ - [actions] update codecov uploader [`e2b993f`](https://github.com/ljharb/internal-slot/commit/e2b993f143278a30424ebd5526019e59828989d0)
53
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `object-inspect`, `tape` [`8f0ab80`](https://github.com/ljharb/internal-slot/commit/8f0ab808afdd458001c35c828962dc714d824754)
54
+ - [actions] update checkout action [`8da4b91`](https://github.com/ljharb/internal-slot/commit/8da4b91c3454671da2e53a831ca0928147965a09)
55
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@safe-publish-latest`, `tape` [`7ab37aa`](https://github.com/ljharb/internal-slot/commit/7ab37aabf01ded2605fa583a9866b62172f82e30)
56
+ - [readme] add github actions/codecov badges [`71234be`](https://github.com/ljharb/internal-slot/commit/71234bef4ef99e2f17d72ae3a1b7c0522519b7d7)
57
+ - [Fix] `assert`: throw on a nonexistent slot even when an object already has other slots [`12580bd`](https://github.com/ljharb/internal-slot/commit/12580bd26fe9f8603566e9e076092b5e1fb7340b)
58
+ - [Tests] use `for-each` instead of `foreach` [`7229df0`](https://github.com/ljharb/internal-slot/commit/7229df01666ccb022dde82686d84b97b7bcfc53a)
59
+ - [meta] use `prepublishOnly` script for npm 7+ [`8728872`](https://github.com/ljharb/internal-slot/commit/8728872cfbd735d3ae87e885c081a08d5b26edf0)
60
+ - [Deps] update `get-intrinsic` [`1b7088f`](https://github.com/ljharb/internal-slot/commit/1b7088fa970c33757816b08357814bdbf6d722b6)
61
+ - [Deps] update `get-intrinsic` [`063621e`](https://github.com/ljharb/internal-slot/commit/063621ec99d1b9262d3898c0ecad0e1e98be5f75)
62
+
63
+ #### [v1.0.3](https://github.com/ljharb/internal-slot/compare/v1.0.2...v1.0.3)
64
+
65
+ > 26 January 2021
66
+
67
+ - [Tests] use shared travis-ci configs [`0ef2263`](https://github.com/ljharb/internal-slot/commit/0ef22634fa2269d9df0d784aca3c5748e8eabd3b)
68
+ - [Tests] migrate tests to Github Actions [`6253915`](https://github.com/ljharb/internal-slot/commit/6253915d28721df2eda5630849bc6b57647e3ee2)
69
+ - [meta] do not publish github action workflow files [`ef94e55`](https://github.com/ljharb/internal-slot/commit/ef94e555727ed6a649ef64010904fe89a468d459)
70
+ - [Tests] run `nyc` on all tests; use `tape` runner [`917d6ca`](https://github.com/ljharb/internal-slot/commit/917d6ca630cdcd6b4da9a2c300c6a3abb6e724fe)
71
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`8dcb6fe`](https://github.com/ljharb/internal-slot/commit/8dcb6fe01d6a45e1af17a9dace95ca47c99b4328)
72
+ - [actions] add "Allow Edits" workflow [`7aa3e86`](https://github.com/ljharb/internal-slot/commit/7aa3e86edb0149fd882717481885760aeb28474e)
73
+ - [Refactor] use `get-intrinsic` instead of `es-abstract`; update `side-channel` [`11ad17d`](https://github.com/ljharb/internal-slot/commit/11ad17d4255adcbc55fd4eca0bf6733bac59f1bf)
74
+ - [readme] remove travis badge [`5b75452`](https://github.com/ljharb/internal-slot/commit/5b754523aa07e8f67d0135df75059a18047292bb)
75
+ - [actions] switch Automatic Rebase workflow to `pull_request_target` event [`d531688`](https://github.com/ljharb/internal-slot/commit/d5316880956b4dd83e6b6c9ab48fdd8171a4a268)
76
+ - [Dev Deps] update `@ljharb/eslint-config`, `tape` [`c76fa91`](https://github.com/ljharb/internal-slot/commit/c76fa91a7e623a738e22332bee4e985aea41122e)
77
+ - [Dev Deps] update `eslint`, `tape` [`e733ccd`](https://github.com/ljharb/internal-slot/commit/e733ccd68e81c72ef2e02726e001895053de7887)
78
+ - [Dev Deps] update `auto-changelog`; add `aud` [`df20bf5`](https://github.com/ljharb/internal-slot/commit/df20bf5d3943a533c20799d8cc1449997e85d53b)
79
+ - [meta] fix autochangelog [`e89e6f1`](https://github.com/ljharb/internal-slot/commit/e89e6f1ff9f10f386e6400b586db78ad9c0f1309)
80
+ - [Tests] only audit prod deps [`71317b9`](https://github.com/ljharb/internal-slot/commit/71317b95ec6bbd9877807da0c0316ee9f5f30fab)
81
+ - [Deps] update `es-abstract` [`c17ccf4`](https://github.com/ljharb/internal-slot/commit/c17ccf45f4cb0d3b7a1536e9cd3a7ff9a7dafd21)
82
+ - [Dev Deps] update `tape` [`d81ae03`](https://github.com/ljharb/internal-slot/commit/d81ae030a0e8f58cee00f752601ce60405a93d78)
83
+ - [Deps] update `es-abstract` [`b56303b`](https://github.com/ljharb/internal-slot/commit/b56303b4c3af7a510f9f51860895a46fd2e14752)
84
+ - [Deps] update `es-abstract` [`9996d1c`](https://github.com/ljharb/internal-slot/commit/9996d1cf3507750c7a6845a2fb0d0f849ea898a1)
85
+
86
+ #### [v1.0.2](https://github.com/ljharb/internal-slot/compare/v1.0.1...v1.0.2)
87
+
88
+ > 20 December 2019
89
+
90
+ - [Deps] update `es-abstract`, `side-channel` [`5c9df03`](https://github.com/ljharb/internal-slot/commit/5c9df03a25518f5c482cff4e1447a26fa071df9a)
91
+ - [Dev Deps] update `@ljharb/eslint-config`, `tape` [`7820f98`](https://github.com/ljharb/internal-slot/commit/7820f984e523a64ddf3068c4e5631abf61eb1ea4)
92
+
93
+ #### [v1.0.1](https://github.com/ljharb/internal-slot/compare/v1.0.0...v1.0.1)
94
+
95
+ > 1 December 2019
96
+
97
+ - [Refactor] use `side-channel` package [`d38639f`](https://github.com/ljharb/internal-slot/commit/d38639f0a3cdb5090711179d0e78df857ecbd5d3)
98
+ - [actions] add automatic rebasing / merge commit blocking [`74267e6`](https://github.com/ljharb/internal-slot/commit/74267e6e591e18ba39186cb99139d3fd7a757c9f)
99
+ - [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `auto-changelog`, `object-inspect`, `safe-publish-latest` [`b042eef`](https://github.com/ljharb/internal-slot/commit/b042eefc067b830bbd370833f7f21754e802b0b2)
100
+ - [Deps] update `es-abstract` [`98cf4e8`](https://github.com/ljharb/internal-slot/commit/98cf4e86c1bfe99eda7b11a8ea70394368f33e4f)
101
+
102
+ #### v1.0.0
103
+
104
+ > 20 October 2019
105
+
106
+ - Tests [`b50fa41`](https://github.com/ljharb/internal-slot/commit/b50fa41b6f47aba39ac4cb733658580974a0b00a)
107
+ - implementation [`c5a59f3`](https://github.com/ljharb/internal-slot/commit/c5a59f3753677f81aa12a0226d3b1187846d06dd)
108
+ - Initial commit [`15ebe4d`](https://github.com/ljharb/internal-slot/commit/15ebe4dc6d46885f67969d64c9c3e705780963f8)
109
+ - readme [`382a3f5`](https://github.com/ljharb/internal-slot/commit/382a3f53d8975e6488373a0fc2abcdc7c4c44247)
110
+ - npm init [`d5e7c97`](https://github.com/ljharb/internal-slot/commit/d5e7c977ef694e89c245fd11165f63c06a7a5040)
111
+ - [meta] add FUNDING.yml [`685b608`](https://github.com/ljharb/internal-slot/commit/685b6087613f6735f4411a558500d92f8a3ec3f2)
112
+ - [meta] add `auto-changelog`, `safe-publish-latest` [`f8fdf1c`](https://github.com/ljharb/internal-slot/commit/f8fdf1c3f0c592f71746da6d7f8bea18f8946dda)
113
+ - [Tests] add `npm run lint` [`baaaa09`](https://github.com/ljharb/internal-slot/commit/baaaa09ab6e5bc5fcc0e7c76e10c55aa18f4ca7e)
114
+ - Only apps should have lockfiles [`dfa7efa`](https://github.com/ljharb/internal-slot/commit/dfa7efa3d5cd23261cb75c2adab6ee3c06790fee)
tools/ui/node_modules/internal-slot/LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Jordan Harband
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
tools/ui/node_modules/internal-slot/README.md ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # internal-slot <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
+
3
+ [![github actions][actions-image]][actions-url]
4
+ [![coverage][codecov-image]][codecov-url]
5
+ [![dependency status][deps-svg]][deps-url]
6
+ [![dev dependency status][dev-deps-svg]][dev-deps-url]
7
+ [![License][license-image]][license-url]
8
+ [![Downloads][downloads-image]][downloads-url]
9
+
10
+ [![npm badge][npm-badge-png]][package-url]
11
+
12
+ Truly private storage, akin to the JS spec’s concept of internal slots.
13
+
14
+ Uses a WeakMap when available; a Map when not; and a regular object in even older engines. Performance and garbage collection behavior will reflect the environment’s capabilities accordingly.
15
+
16
+ ## Example
17
+
18
+ ```js
19
+ var SLOT = require('internal-slot');
20
+ var assert = require('assert');
21
+
22
+ var o = {};
23
+
24
+ assert.throws(function () { SLOT.assert(o, 'foo'); });
25
+
26
+ assert.equal(SLOT.has(o, 'foo'), false);
27
+ assert.equal(SLOT.get(o, 'foo'), undefined);
28
+
29
+ SLOT.set(o, 'foo', 42);
30
+
31
+ assert.equal(SLOT.has(o, 'foo'), true);
32
+ assert.equal(SLOT.get(o, 'foo'), 42);
33
+
34
+ assert.doesNotThrow(function () { SLOT.assert(o, 'foo'); });
35
+ ```
36
+
37
+ ## Tests
38
+ Simply clone the repo, `npm install`, and run `npm test`
39
+
40
+ ## Security
41
+
42
+ Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report.
43
+
44
+ [package-url]: https://npmjs.org/package/internal-slot
45
+ [npm-version-svg]: https://versionbadg.es/ljharb/internal-slot.svg
46
+ [deps-svg]: https://david-dm.org/ljharb/internal-slot.svg
47
+ [deps-url]: https://david-dm.org/ljharb/internal-slot
48
+ [dev-deps-svg]: https://david-dm.org/ljharb/internal-slot/dev-status.svg
49
+ [dev-deps-url]: https://david-dm.org/ljharb/internal-slot#info=devDependencies
50
+ [npm-badge-png]: https://nodei.co/npm/internal-slot.png?downloads=true&stars=true
51
+ [license-image]: https://img.shields.io/npm/l/internal-slot.svg
52
+ [license-url]: LICENSE
53
+ [downloads-image]: https://img.shields.io/npm/dm/internal-slot.svg
54
+ [downloads-url]: https://npm-stat.com/charts.html?package=internal-slot
55
+ [codecov-image]: https://codecov.io/gh/ljharb/internal-slot/branch/main/graphs/badge.svg
56
+ [codecov-url]: https://app.codecov.io/gh/ljharb/internal-slot/
57
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/internal-slot
58
+ [actions-url]: https://github.com/ljharb/internal-slot/actions
tools/ui/node_modules/internal-slot/index.d.ts ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ declare namespace SLOT {
2
+ type InternalSlot = string; // `[[${string}]]`; // TODO: restrict this to require the brackets
3
+ }
4
+
5
+ declare const SLOT: {
6
+ assert(O: object, slot: SLOT.InternalSlot): void;
7
+ get(O: object, slot: SLOT.InternalSlot): unknown;
8
+ set(O: object, slot: SLOT.InternalSlot, value?: unknown): void;
9
+ has(O: object, slot: SLOT.InternalSlot): boolean;
10
+ }
11
+
12
+ export = SLOT;
tools/ui/node_modules/internal-slot/index.js ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ /** @typedef {`$${import('.').InternalSlot}`} SaltedInternalSlot */
4
+ /** @typedef {{ [k in SaltedInternalSlot]?: unknown }} SlotsObject */
5
+
6
+ var hasOwn = require('hasown');
7
+ /** @type {import('side-channel').Channel<object, SlotsObject>} */
8
+ var channel = require('side-channel')();
9
+
10
+ var $TypeError = require('es-errors/type');
11
+
12
+ /** @type {import('.')} */
13
+ var SLOT = {
14
+ assert: function (O, slot) {
15
+ if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
16
+ throw new $TypeError('`O` is not an object');
17
+ }
18
+ if (typeof slot !== 'string') {
19
+ throw new $TypeError('`slot` must be a string');
20
+ }
21
+ channel.assert(O);
22
+ if (!SLOT.has(O, slot)) {
23
+ throw new $TypeError('`' + slot + '` is not present on `O`');
24
+ }
25
+ },
26
+ get: function (O, slot) {
27
+ if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
28
+ throw new $TypeError('`O` is not an object');
29
+ }
30
+ if (typeof slot !== 'string') {
31
+ throw new $TypeError('`slot` must be a string');
32
+ }
33
+ var slots = channel.get(O);
34
+ // eslint-disable-next-line no-extra-parens
35
+ return slots && slots[/** @type {SaltedInternalSlot} */ ('$' + slot)];
36
+ },
37
+ has: function (O, slot) {
38
+ if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
39
+ throw new $TypeError('`O` is not an object');
40
+ }
41
+ if (typeof slot !== 'string') {
42
+ throw new $TypeError('`slot` must be a string');
43
+ }
44
+ var slots = channel.get(O);
45
+ // eslint-disable-next-line no-extra-parens
46
+ return !!slots && hasOwn(slots, /** @type {SaltedInternalSlot} */ ('$' + slot));
47
+ },
48
+ set: function (O, slot, V) {
49
+ if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
50
+ throw new $TypeError('`O` is not an object');
51
+ }
52
+ if (typeof slot !== 'string') {
53
+ throw new $TypeError('`slot` must be a string');
54
+ }
55
+ var slots = channel.get(O);
56
+ if (!slots) {
57
+ slots = {};
58
+ channel.set(O, slots);
59
+ }
60
+ // eslint-disable-next-line no-extra-parens
61
+ slots[/** @type {SaltedInternalSlot} */ ('$' + slot)] = V;
62
+ }
63
+ };
64
+
65
+ if (Object.freeze) {
66
+ Object.freeze(SLOT);
67
+ }
68
+
69
+ module.exports = SLOT;
tools/ui/node_modules/internal-slot/package.json ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "internal-slot",
3
+ "version": "1.1.0",
4
+ "description": "ES spec-like internal slots",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "prepack": "npmignore --auto --commentLines=autogenerated",
8
+ "prepublishOnly": "safe-publish-latest",
9
+ "prepublish": "not-in-publish || npm run prepublishOnly",
10
+ "version": "auto-changelog && git add CHANGELOG.md",
11
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
12
+ "pretest": "npm run lint",
13
+ "lint": "eslint --ext=js,mjs .",
14
+ "postlint": "tsc && attw -P",
15
+ "tests-only": "nyc tape 'test/**/*.js'",
16
+ "test": "npm run tests-only",
17
+ "posttest": "npx npm@'>= 10.2' audit --production"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/ljharb/internal-slot.git"
22
+ },
23
+ "keywords": [
24
+ "internal",
25
+ "slot",
26
+ "internal slot",
27
+ "ecmascript",
28
+ "es",
29
+ "spec",
30
+ "private",
31
+ "data",
32
+ "private data",
33
+ "weakmap"
34
+ ],
35
+ "author": "Jordan Harband <ljharb@gmail.com>",
36
+ "license": "MIT",
37
+ "bugs": {
38
+ "url": "https://github.com/ljharb/internal-slot/issues"
39
+ },
40
+ "homepage": "https://github.com/ljharb/internal-slot#readme",
41
+ "engines": {
42
+ "node": ">= 0.4"
43
+ },
44
+ "devDependencies": {
45
+ "@arethetypeswrong/cli": "^0.17.1",
46
+ "@ljharb/eslint-config": "^21.1.1",
47
+ "@ljharb/tsconfig": "^0.2.2",
48
+ "@types/for-each": "^0.3.3",
49
+ "@types/object-inspect": "^1.13.0",
50
+ "@types/tape": "^5.6.5",
51
+ "auto-changelog": "^2.5.0",
52
+ "encoding": "^0.1.13",
53
+ "eslint": "=8.8.0",
54
+ "for-each": "^0.3.3",
55
+ "in-publish": "^2.0.1",
56
+ "npmignore": "^0.3.1",
57
+ "nyc": "^10.3.2",
58
+ "object-inspect": "^1.13.3",
59
+ "safe-publish-latest": "^2.0.0",
60
+ "tape": "^5.9.0",
61
+ "typescript": "next"
62
+ },
63
+ "dependencies": {
64
+ "es-errors": "^1.3.0",
65
+ "hasown": "^2.0.2",
66
+ "side-channel": "^1.1.0"
67
+ },
68
+ "auto-changelog": {
69
+ "output": "CHANGELOG.md",
70
+ "unreleased": false,
71
+ "commitLimit": false,
72
+ "backfillLimit": false
73
+ },
74
+ "publishConfig": {
75
+ "ignore": [
76
+ ".github/workflows"
77
+ ]
78
+ }
79
+ }
tools/ui/node_modules/internal-slot/test/index.js ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+ var inspect = require('object-inspect');
5
+ var forEach = require('for-each');
6
+
7
+ var SLOT = require('../');
8
+
9
+ test('assert', function (t) {
10
+ forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) {
11
+ t['throws'](
12
+ // @ts-expect-error
13
+ function () { SLOT.assert(primitive, ''); },
14
+ TypeError,
15
+ inspect(primitive) + ' is not an Object'
16
+ );
17
+ });
18
+
19
+ forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) {
20
+ t['throws'](
21
+ // @ts-expect-error
22
+ function () { SLOT.assert({}, nonString); },
23
+ TypeError,
24
+ inspect(nonString) + ' is not a String'
25
+ );
26
+ });
27
+
28
+ t['throws'](
29
+ function () { SLOT.assert({}, '[[whatever]]'); },
30
+ TypeError,
31
+ 'nonexistent slot throws'
32
+ );
33
+
34
+ var o = {};
35
+ SLOT.set(o, 'x');
36
+ t.doesNotThrow(function () { SLOT.assert(o, 'x'); }, 'existent slot noops');
37
+ t['throws'](function () { SLOT.assert(o, 'y'); }, 'thing with a slot throws on a nonexistent slot');
38
+
39
+ t.end();
40
+ });
41
+
42
+ test('has', function (t) {
43
+ forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) {
44
+ t['throws'](
45
+ // @ts-expect-error
46
+ function () { SLOT.has(primitive, ''); },
47
+ TypeError,
48
+ inspect(primitive) + ' is not an Object'
49
+ );
50
+ });
51
+
52
+ forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) {
53
+ t['throws'](
54
+ // @ts-expect-error
55
+ function () { SLOT.has({}, nonString); },
56
+ TypeError,
57
+ inspect(nonString) + ' is not a String'
58
+ );
59
+ });
60
+
61
+ var o = {};
62
+
63
+ t.equal(SLOT.has(o, '[[nonexistent]]'), false, 'nonexistent slot yields false');
64
+
65
+ SLOT.set(o, 'foo');
66
+ t.equal(SLOT.has(o, 'foo'), true, 'existent slot yields true');
67
+
68
+ t.end();
69
+ });
70
+
71
+ test('get', function (t) {
72
+ forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) {
73
+ t['throws'](
74
+ // @ts-expect-error
75
+ function () { SLOT.get(primitive, ''); },
76
+ TypeError,
77
+ inspect(primitive) + ' is not an Object'
78
+ );
79
+ });
80
+
81
+ forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) {
82
+ t['throws'](
83
+ // @ts-expect-error
84
+ function () { SLOT.get({}, nonString); },
85
+ TypeError,
86
+ inspect(nonString) + ' is not a String'
87
+ );
88
+ });
89
+
90
+ var o = {};
91
+ t.equal(SLOT.get(o, 'nonexistent'), undefined, 'nonexistent slot is undefined');
92
+
93
+ var v = {};
94
+ SLOT.set(o, 'f', v);
95
+ t.equal(SLOT.get(o, 'f'), v, '"get" retrieves value set by "set"');
96
+
97
+ t.end();
98
+ });
99
+
100
+ test('set', function (t) {
101
+ forEach([null, undefined, true, false, 'foo', '', 42, 0], function (primitive) {
102
+ t['throws'](
103
+ // @ts-expect-error
104
+ function () { SLOT.set(primitive, ''); },
105
+ TypeError,
106
+ inspect(primitive) + ' is not an Object'
107
+ );
108
+ });
109
+
110
+ forEach([null, undefined, true, false, 42, 0, {}, [], function () {}, /a/g], function (nonString) {
111
+ t['throws'](
112
+ // @ts-expect-error
113
+ function () { SLOT.set({}, nonString); },
114
+ TypeError,
115
+ inspect(nonString) + ' is not a String'
116
+ );
117
+ });
118
+
119
+ var o = function () {};
120
+ t.equal(SLOT.get(o, 'f'), undefined, 'slot not set');
121
+
122
+ SLOT.set(o, 'f', 42);
123
+ t.equal(SLOT.get(o, 'f'), 42, 'slot was set');
124
+
125
+ SLOT.set(o, 'f', Infinity);
126
+ t.equal(SLOT.get(o, 'f'), Infinity, 'slot was set again');
127
+
128
+ t.end();
129
+ });
tools/ui/node_modules/internal-slot/tsconfig.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "extends": "@ljharb/tsconfig",
3
+ "compilerOptions": {
4
+ //"target": "es2021",
5
+ },
6
+ "exclude": [
7
+ "coverage",
8
+ ],
9
+ }
tools/ui/node_modules/internmap/LICENSE ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2021 Mike Bostock
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.
tools/ui/node_modules/internmap/README.md ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # InternMap
2
+
3
+ *For live examples, see https://observablehq.com/@mbostock/internmap.*
4
+
5
+ If you use dates as keys in a JavaScript Map (or as values in a Set), you may be surprised that it won’t work as you expect.
6
+
7
+ ```js
8
+ dateMap = new Map([
9
+ [new Date(Date.UTC(2001, 0, 1)), "red"],
10
+ [new Date(Date.UTC(2001, 0, 1)), "green"] // distinct key!
11
+ ])
12
+ ```
13
+ ```js
14
+ dateMap.get(new Date(Date.UTC(2001, 0, 1))) // undefined!
15
+ ```
16
+
17
+ That’s because Map uses the [SameValueZero algorithm](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness) to determine key equality: for two dates to be considered the same, they must be the same instance (the same object), not just the same moment in time. This is true of the equality operator, too.
18
+
19
+ ```js
20
+ {
21
+ const date1 = new Date(Date.UTC(2001, 0, 1));
22
+ const date2 = new Date(Date.UTC(2001, 0, 1));
23
+ return date1 === date2; // false!
24
+ }
25
+ ```
26
+
27
+ You can avoid this issue by using primitive values such as numbers or strings as keys instead. But it’s tedious and easy to forget to coerce types. (You’ll also need to do the inverse type conversion when pulling keys out of the map, say when using *map*.keys or *map*.entries, or when iterating over the map. The inverse above is new Date(*key*). Also, if you forget to coerce your key to a number when using *map*.get, it’s easy not to notice because the map won’t throw an error; it’ll simply return undefined.)
28
+
29
+ ```js
30
+ numberMap = new Map([[978307200000, "red"]])
31
+ numberMap.get(978307200000) // "red"
32
+ numberMap.get(new Date(978307200000)) // undefined; oops!
33
+ ```
34
+
35
+ Wouldn’t it be easier if Map and Set “just worked” with dates? Or with any object that supports [*object*.valueOf](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/valueOf)?
36
+
37
+ Enter **InternMap**. [*Interning*](https://en.wikipedia.org/wiki/String_interning) refers to storing only one copy of each distinct key. An InternMap considers two Date instances representing the same moment to be equal, storing only the first instance.
38
+
39
+ ```js
40
+ map = new InternMap([
41
+ [new Date(Date.UTC(2001, 0, 1)), "red"],
42
+ [new Date(Date.UTC(2001, 0, 1)), "green"] // replaces previous entry
43
+ ])
44
+ ```
45
+ ```js
46
+ map.get(new Date(Date.UTC(2001, 0, 1))) // "green"
47
+ ```
48
+ ```js
49
+ [...map.keys()] // [2001-01-01]
50
+ ```
51
+
52
+ InternMap extends Map, so you can simply drop it in whenever you’d prefer this behavior to the SameValueZero algorithm. Because InternMap calls *object*.valueOf only for non-primitive keys, note that you can pass primitive keys, too.
53
+
54
+ ```js
55
+ map.get(978307200000) // "green"; this works too!
56
+ ```
57
+
58
+ InternMap keeps only the first distinct key according to its associated primitive value. Avoid adding keys to the map with inconsistent types.
59
+
60
+ ```js
61
+ map2 = new InternMap([
62
+ [978307200000, "red"], // danger!
63
+ [new Date(Date.UTC(2001, 0, 1)), "blue"]
64
+ ])
65
+ ```
66
+ ```js
67
+ map2.get(new Date(Date.UTC(2001, 0, 1))) // "blue"; this still works…
68
+ ```
69
+ ```js
70
+ [...map2.keys()] // [978307200000]; but the key isn’t a Date
71
+ ```
72
+
73
+ While InternMap uses *object*.valueOf by default to compute the intern key, you can pass a key function as a second argument to the constructor to change the behavior. For example, if you use JSON.stringify, you can use arrays as compound keys (assuming that the array elements can be serialized to JSON).
74
+
75
+ ```js
76
+ map3 = new InternMap([
77
+ [["foo", "bar"], 1],
78
+ [["foo", "baz"], 2],
79
+ [["goo", "bee"], 3]
80
+ ], JSON.stringify)
81
+ ```
82
+ ```js
83
+ map3.get(["foo", "baz"]) // 2
84
+ ```
85
+
86
+ There’s an **InternSet** class, too.
87
+
88
+ ```js
89
+ set = new InternSet([
90
+ new Date(Date.UTC(2000, 0, 1)),
91
+ new Date(Date.UTC(2001, 0, 1)),
92
+ new Date(Date.UTC(2001, 0, 1))
93
+ ])
94
+ ```
tools/ui/node_modules/internmap/dist/internmap.js ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // https://github.com/mbostock/internmap/ v2.0.3 Copyright 2021 Mike Bostock
2
+ (function (global, factory) {
3
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
+ typeof define === 'function' && define.amd ? define(['exports'], factory) :
5
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.internmap = {}));
6
+ }(this, (function (exports) { 'use strict';
7
+
8
+ class InternMap extends Map {
9
+ constructor(entries, key = keyof) {
10
+ super();
11
+ Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
12
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
13
+ }
14
+ get(key) {
15
+ return super.get(intern_get(this, key));
16
+ }
17
+ has(key) {
18
+ return super.has(intern_get(this, key));
19
+ }
20
+ set(key, value) {
21
+ return super.set(intern_set(this, key), value);
22
+ }
23
+ delete(key) {
24
+ return super.delete(intern_delete(this, key));
25
+ }
26
+ }
27
+
28
+ class InternSet extends Set {
29
+ constructor(values, key = keyof) {
30
+ super();
31
+ Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
32
+ if (values != null) for (const value of values) this.add(value);
33
+ }
34
+ has(value) {
35
+ return super.has(intern_get(this, value));
36
+ }
37
+ add(value) {
38
+ return super.add(intern_set(this, value));
39
+ }
40
+ delete(value) {
41
+ return super.delete(intern_delete(this, value));
42
+ }
43
+ }
44
+
45
+ function intern_get({_intern, _key}, value) {
46
+ const key = _key(value);
47
+ return _intern.has(key) ? _intern.get(key) : value;
48
+ }
49
+
50
+ function intern_set({_intern, _key}, value) {
51
+ const key = _key(value);
52
+ if (_intern.has(key)) return _intern.get(key);
53
+ _intern.set(key, value);
54
+ return value;
55
+ }
56
+
57
+ function intern_delete({_intern, _key}, value) {
58
+ const key = _key(value);
59
+ if (_intern.has(key)) {
60
+ value = _intern.get(key);
61
+ _intern.delete(key);
62
+ }
63
+ return value;
64
+ }
65
+
66
+ function keyof(value) {
67
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
68
+ }
69
+
70
+ exports.InternMap = InternMap;
71
+ exports.InternSet = InternSet;
72
+
73
+ Object.defineProperty(exports, '__esModule', { value: true });
74
+
75
+ })));
tools/ui/node_modules/internmap/dist/internmap.min.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ // https://github.com/mbostock/internmap/ v2.0.3 Copyright 2021 Mike Bostock
2
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).internmap={})}(this,(function(e){"use strict";class InternMap extends Map{constructor(e,t=r){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,n]of e)this.set(t,n)}get(e){return super.get(t(this,e))}has(e){return super.has(t(this,e))}set(e,t){return super.set(n(this,e),t)}delete(e){return super.delete(s(this,e))}}class InternSet extends Set{constructor(e,t=r){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const t of e)this.add(t)}has(e){return super.has(t(this,e))}add(e){return super.add(n(this,e))}delete(e){return super.delete(s(this,e))}}function t({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function n({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function s({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function r(e){return null!==e&&"object"==typeof e?e.valueOf():e}e.InternMap=InternMap,e.InternSet=InternSet,Object.defineProperty(e,"__esModule",{value:!0})}));
tools/ui/node_modules/internmap/package.json ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "internmap",
3
+ "version": "2.0.3",
4
+ "description": "Map and Set with automatic key interning",
5
+ "homepage": "https://github.com/mbostock/internmap/",
6
+ "license": "ISC",
7
+ "author": {
8
+ "name": "Mike Bostock",
9
+ "url": "https://bost.ocks.org/mike"
10
+ },
11
+ "type": "module",
12
+ "main": "src/index.js",
13
+ "module": "src/index.js",
14
+ "jsdelivr": "dist/internmap.min.js",
15
+ "unpkg": "dist/internmap.min.js",
16
+ "exports": {
17
+ "umd": "./dist/internmap.min.js",
18
+ "default": "./src/index.js"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/mbostock/internmap.git"
23
+ },
24
+ "files": [
25
+ "dist/**/*.js",
26
+ "src/**/*.js"
27
+ ],
28
+ "scripts": {
29
+ "test": "mocha 'test/**/*-test.js' && eslint src test",
30
+ "prepublishOnly": "rm -rf dist && yarn test && rollup -c",
31
+ "postpublish": "git push && git push --tags"
32
+ },
33
+ "sideEffects": false,
34
+ "devDependencies": {
35
+ "eslint": "^7.32.0",
36
+ "mocha": "^9.1.1",
37
+ "rollup": "^2.56.3",
38
+ "rollup-plugin-terser": "^7.0.2"
39
+ },
40
+ "engines": {
41
+ "node": ">=12"
42
+ }
43
+ }
tools/ui/node_modules/internmap/src/index.js ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export class InternMap extends Map {
2
+ constructor(entries, key = keyof) {
3
+ super();
4
+ Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
5
+ if (entries != null) for (const [key, value] of entries) this.set(key, value);
6
+ }
7
+ get(key) {
8
+ return super.get(intern_get(this, key));
9
+ }
10
+ has(key) {
11
+ return super.has(intern_get(this, key));
12
+ }
13
+ set(key, value) {
14
+ return super.set(intern_set(this, key), value);
15
+ }
16
+ delete(key) {
17
+ return super.delete(intern_delete(this, key));
18
+ }
19
+ }
20
+
21
+ export class InternSet extends Set {
22
+ constructor(values, key = keyof) {
23
+ super();
24
+ Object.defineProperties(this, {_intern: {value: new Map()}, _key: {value: key}});
25
+ if (values != null) for (const value of values) this.add(value);
26
+ }
27
+ has(value) {
28
+ return super.has(intern_get(this, value));
29
+ }
30
+ add(value) {
31
+ return super.add(intern_set(this, value));
32
+ }
33
+ delete(value) {
34
+ return super.delete(intern_delete(this, value));
35
+ }
36
+ }
37
+
38
+ function intern_get({_intern, _key}, value) {
39
+ const key = _key(value);
40
+ return _intern.has(key) ? _intern.get(key) : value;
41
+ }
42
+
43
+ function intern_set({_intern, _key}, value) {
44
+ const key = _key(value);
45
+ if (_intern.has(key)) return _intern.get(key);
46
+ _intern.set(key, value);
47
+ return value;
48
+ }
49
+
50
+ function intern_delete({_intern, _key}, value) {
51
+ const key = _key(value);
52
+ if (_intern.has(key)) {
53
+ value = _intern.get(key);
54
+ _intern.delete(key);
55
+ }
56
+ return value;
57
+ }
58
+
59
+ function keyof(value) {
60
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
61
+ }
tools/ui/node_modules/ip-address/LICENSE ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (C) 2011 by Beau Gunderson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
tools/ui/node_modules/ip-address/README.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [![CI](https://github.com/beaugunderson/ip-address/actions/workflows/ci.yml/badge.svg)](https://github.com/beaugunderson/ip-address/actions/workflows/ci.yml)
2
+ [![codecov]](https://codecov.io/github/beaugunderson/ip-address?branch=master)
3
+ [![downloads]](https://www.npmjs.com/package/ip-address)
4
+ [![npm]](https://www.npmjs.com/package/ip-address)
5
+
6
+ [codecov]: https://codecov.io/github/beaugunderson/ip-address/coverage.svg?branch=master
7
+ [downloads]: https://img.shields.io/npm/dm/ip-address.svg
8
+ [npm]: https://img.shields.io/npm/v/ip-address.svg
9
+
10
+ ## ip-address
11
+
12
+ `ip-address` is a library for validating and manipulating IPv4 and IPv6 addresses in JavaScript and TypeScript.
13
+
14
+ ### Install
15
+
16
+ ```sh
17
+ npm install ip-address
18
+ ```
19
+
20
+ ### Examples
21
+
22
+ <!-- prettier-ignore -->
23
+ ```ts
24
+ import { Address4, Address6 } from 'ip-address';
25
+
26
+ // Validation
27
+ Address4.isValid('192.168.1.1'); // true
28
+ Address6.isValid('2001:db8::1'); // true
29
+ Address6.isValid('not an address'); // false
30
+
31
+ // Parsing (throws AddressError on invalid input)
32
+ const v4 = new Address4('192.168.1.1/24');
33
+ const v6 = new Address6('2001:db8::1/64');
34
+
35
+ // Subnet membership
36
+ const host = new Address4('192.168.1.42');
37
+ const network = new Address4('192.168.1.0/24');
38
+ host.isInSubnet(network); // true
39
+
40
+ // Subnet range
41
+ network.startAddress().correctForm(); // '192.168.1.0'
42
+ network.endAddress().correctForm(); // '192.168.1.255'
43
+
44
+ // Strict network-address check (host bits must be zero).
45
+ // isValid() accepts CIDRs with host bits set — '192.168.1.5/24' is a valid
46
+ // host-with-subnet, but it isn't a network address.
47
+ const cidr = new Address4('192.168.1.5/24');
48
+ Address4.isValid('192.168.1.5/24'); // true
49
+ cidr.correctForm() === cidr.startAddress().correctForm(); // false
50
+
51
+ // Address properties
52
+ const link = new Address6('fe80::1');
53
+ link.isLinkLocal(); // true
54
+ link.isMulticast(); // false
55
+ link.isLoopback(); // false
56
+
57
+ new Address4('192.168.1.1').isPrivate(); // true (RFC 1918)
58
+ new Address6('fc00::1').isULA(); // true (RFC 4193)
59
+
60
+ // Numeric and byte representations
61
+ v4.bigInt(); // 3232235777n
62
+ v4.toArray(); // [192, 168, 1, 1]
63
+ v6.canonicalForm(); // '2001:0db8:0000:0000:0000:0000:0000:0001'
64
+
65
+ // Embedded IPv4 + Teredo
66
+ const teredo = new Address6('2001:0:ce49:7601:e866:efff:62c3:fffe');
67
+ teredo.inspectTeredo().client4; // '157.60.0.1'
68
+
69
+ // Parse host + port from a URL
70
+ Address6.fromURL('http://[2001:db8::1]:8080/').port; // 8080
71
+ ```
72
+
73
+ ### Features
74
+
75
+ - Written in TypeScript with full type definitions; usable from CommonJS and ESM
76
+ - Zero runtime dependencies
77
+ - Parses all standard IPv4 and IPv6 notations, including subnets and zones
78
+ - Parses IPv6 hosts (and ports) from URLs via `Address6.fromURL(url)`
79
+ - Subnet membership checks (`isInSubnet`) and range queries (`startAddress` / `endAddress`)
80
+ - Special-property checks: private (RFC 1918) / ULA (RFC 4193), loopback, link-local, multicast, broadcast, unspecified, CGNAT, documentation, Teredo, 6to4, v4-in-v6
81
+ - Decodes [Teredo](http://en.wikipedia.org/wiki/Teredo_tunneling#IPv6_addressing) and 6to4 tunneling information
82
+ - Conversions: canonical/correct form, hex, binary, decimal, byte arrays, BigInt, `in-addr.arpa` / `ip6.arpa`
83
+ - Runs in Node.js and the browser
84
+ - Thousands of test cases
85
+
86
+ ### Terminology
87
+
88
+ A few terms used throughout the API can be confusing if you haven't worked deeply with IPv6 before:
89
+
90
+ - **Correct form** — the shortest valid representation, per [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros stripped, the longest run of zero groups collapsed to `::`, and hex digits lowercased (e.g. `2001:db8::1`). This is what most software displays.
91
+ - **Canonical form** — the fully expanded representation: all 8 groups, each padded to 4 hex digits, no `::` collapsing (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and byte-exact comparison.
92
+ - **Subnet** — the network portion of an address expressed as a CIDR prefix length (e.g. `/24` for IPv4, `/64` for IPv6). `startAddress()` / `endAddress()` return the bounds of the subnet's range.
93
+ - **Zone** — the IPv6 scope identifier appended after `%`, used to disambiguate link-local addresses across interfaces (e.g. `fe80::1%eth0`).
94
+ - **v4-in-v6** — mixed notation that embeds an IPv4 address as the last 32 bits of an IPv6 address, e.g. `::ffff:192.168.0.1`. Used for IPv4-mapped IPv6 addresses.
95
+ - **Teredo** — a tunneling protocol that encodes an IPv4 endpoint, port, and flags inside a `2001::/32` IPv6 address. `inspectTeredo()` decodes those fields.
96
+ - **6to4** — a tunneling protocol that embeds an IPv4 address as the second 16 bits of a `2002::/16` IPv6 address. `inspect6to4()` decodes the embedded v4 address.
97
+
98
+ ### API
99
+
100
+ <!-- API:START -->
101
+
102
+ <details>
103
+ <summary><a id="address4"></a><strong>Address4</strong> — Represents an IPv4 address</summary>
104
+
105
+ **Constructor**
106
+
107
+ - `new Address4(address: string): Address4`
108
+
109
+ **Static methods**
110
+
111
+ - `static isValid(address: string): boolean` — Returns true if the given string is a valid IPv4 address (with optional CIDR subnet), false otherwise. Host bits in the subnet portion are allowed (e.g. `192.168.1.5/24` is valid); for strict network-address validation compare `correctForm()` to `startAddress().correctForm()`, or use `networkForm()`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L53)
112
+ - `static fromAddressAndMask(address: string, mask: string): Address4` — Construct an `Address4` from an address and a dotted-decimal subnet mask given as separate strings (e.g. as returned by Node's `os.networkInterfaces()`). Throws `AddressError` if the mask is non-contiguous (e.g. `255.0.255.0`). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L110)
113
+ - `static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address4` — Construct an `Address4` from an address and a Cisco-style wildcard mask given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard mask is the bitwise inverse of the subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g. `0.255.0.255`). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L124)
114
+ - `static fromWildcard(input: string): Address4` — Construct an `Address4` from a wildcard pattern with trailing `*` octets. The number of trailing wildcards determines the prefix length: each `*` represents 8 bits. Only trailing whole-octet wildcards are supported. Partial-octet wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g. `192.*.0.1`) throw `AddressError`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L145)
115
+ - `static fromHex(hex: string): Address4` — Converts a hex string to an IPv4 address object. Accepts 8 hex digits with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`). Throws `AddressError` for any other length or for non-hex characters. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L180)
116
+ - `static fromInteger(integer: number): Address4` — Converts an integer into a IPv4 address object. The integer must be a non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L203)
117
+ - `static fromArpa(arpaFormAddress: string): Address4` — Return an address from in-addr.arpa form [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L219)
118
+ - `static fromBigInt(bigInt: bigint): Address4` — Converts a BigInt to a v4 address object. The value must be in the range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L366)
119
+ - `static fromByteArray(bytes: number[]): Address4` — Convert a byte array to an Address4 object. To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L381)
120
+ - `static fromUnsignedByteArray(bytes: number[]): Address4` — Convert an unsigned byte array to an Address4 object [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L392)
121
+
122
+ **Instance methods**
123
+
124
+ - `parse(address: string): string[]` — Parses an IPv4 address string into its four octet groups and stores the result on `this.parsedAddress`. Called automatically by the constructor; you typically don't need to call it directly. Throws `AddressError` if the input is not a valid IPv4 address. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L70)
125
+ - `correctForm(): string` — Returns the address in correct form: octets joined with `.` and any leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the canonical dotted-decimal representation. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L91)
126
+ - `toHex(): string` — Converts an IPv4 address object to a hex string [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L232)
127
+ - `toArray(): number[]` — Converts an IPv4 address object to an array of bytes. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L242)
128
+ - `toGroup6(): string` — Converts an IPv4 address object to an IPv6 address group [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L250)
129
+ - `bigInt(): bigint` — Returns the address as a `bigint` [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L269)
130
+ - `startAddress(): Address4` — The first address in the range given by this address' subnet. Often referred to as the Network Address. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L286)
131
+ - `startAddressExclusive(): Address4` — The first host address in the range given by this address's subnet ie the first address after the Network Address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L295)
132
+ - `endAddress(): Address4` — The last address in the range given by this address' subnet Often referred to as the Broadcast [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L313)
133
+ - `endAddressExclusive(): Address4` — The last host address in the range given by this address's subnet ie the last address prior to the Broadcast Address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L322)
134
+ - `subnetMaskAddress(): Address4` — The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for a `/20`. Returns an `Address4`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L332)
135
+ - `wildcardMask(): Address4` — The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L344)
136
+ - `networkForm(): string` — The network address in CIDR string form, e.g. `192.168.1.0/24` for `192.168.1.5/24`. For an address with no explicit subnet the prefix is `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L356)
137
+ - `mask(mask?: number): string` — Returns the first n bits of the address, defaulting to the subnet mask [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L406)
138
+ - `getBitsBase2(start: number, end: number): string` — Returns the bits in the given range as a base-2 string [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L418)
139
+ - `reverseForm(options?: ReverseFormOptions): string` — Return the reversed ip6.arpa form of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L428)
140
+ - `isMulticast(): boolean` — Returns true if the given address is a multicast address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L460)
141
+ - `isPrivate(): boolean` — 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`). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L468)
142
+ - `isLoopback(): boolean` — Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L476)
143
+ - `isLinkLocal(): boolean` — 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)). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L484)
144
+ - `isUnspecified(): boolean` — Returns true if the address is the unspecified address `0.0.0.0`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L492)
145
+ - `isBroadcast(): boolean` — Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L500)
146
+ - `isCGNAT(): boolean` — 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)). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L508)
147
+ - `binaryZeroPad(): string` — Returns a zero-padded base-2 string representation of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L516)
148
+ - `groupForV6(): string` — Groups an IPv4 address for inclusion at the end of an IPv6 address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L527)
149
+
150
+ **Properties**
151
+
152
+ - `address: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L14)
153
+ - `addressMinusSuffix: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L15)
154
+ - `groups: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L16)
155
+ - `parsedAddress: string[]` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L17)
156
+ - `parsedSubnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L18)
157
+ - `subnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L19)
158
+ - `subnetMask: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L20)
159
+ - `v4: boolean` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L21)
160
+ - `isCorrect: (this: Address4 | Address6) => boolean` — Returns true if the address is correct, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L99)
161
+ - `isInSubnet: (this: Address4 | Address6, address: Address4 | Address6) => boolean` — Returns true if the given address is in the subnet of the current address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L446)
162
+ - `isHostInSubnet: (this: Address4 | Address6, address: Address4 | Address6) => boolean` — Returns true if this address's host bits fall inside the given subnet, ignoring this address's own subnet mask. See common.isHostInSubnet. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv4.ts#L454)
163
+
164
+ </details>
165
+
166
+ <details>
167
+ <summary><a id="address6"></a><strong>Address6</strong> — Represents an IPv6 address</summary>
168
+
169
+ **Constructor**
170
+
171
+ - `new Address6(address: string, optionalGroups?: number): Address6`
172
+
173
+ **Static methods**
174
+
175
+ - `static isValid(address: string): boolean` — Returns true if the given string is a valid IPv6 address (with optional CIDR subnet and zone identifier), false otherwise. Host bits in the subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict network-address validation compare `correctForm()` to `startAddress().correctForm()`, or use `networkForm()`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L167)
176
+ - `static fromBigInt(bigInt: bigint): Address6` — Convert a BigInt to a v6 address object. The value must be in the range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L188)
177
+ - `static fromURL(url: string): { error: string; address: null; port: null } | { error?: undefined; address: Address6; port: number | null }` — Parse a URL (with optional bracketed host and port) into an address and port. Returns either `{ address, port }` on success or `{ error, address: null, port: null }` if the URL could not be parsed. Ports are returned as numbers (or `null` if absent or out of range). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L213)
178
+ - `static fromAddressAndMask(address: string, mask: string): Address6` — Construct an `Address6` from an address and a hex subnet mask given as separate strings (e.g. as returned by Node's `os.networkInterfaces()`). Throws `AddressError` if the mask is non-contiguous (e.g. `ffff::ffff`). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L277)
179
+ - `static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address6` — Construct an `Address6` from an address and a Cisco-style wildcard mask given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`). The wildcard mask is the bitwise inverse of the subnet mask. Throws `AddressError` if the mask is non-contiguous. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L291)
180
+ - `static fromWildcard(input: string): Address6` — Construct an `Address6` from a wildcard pattern with trailing `*` groups. The number of trailing wildcards determines the prefix length: each `*` represents 16 bits. `::` is expanded to zero groups (not wildcards) before evaluating trailing wildcards. Only trailing whole-group wildcards are supported. Partial-group wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g. `*::1`) throw `AddressError`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L313)
181
+ - `static fromAddress4(address: string): Address6` — Create an IPv6-mapped address given an IPv4 address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L374)
182
+ - `static fromArpa(arpaFormAddress: string): Address6` — Return an address from ip6.arpa form [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L390)
183
+ - `static fromAddress4Nat64(address: string, prefix: string): Address6` — Embed an IPv4 address into a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. The prefix length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter than /64 the IPv4 octets are split around the reserved bits 64–71. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1060)
184
+ - `static fromByteArray(bytes: number[]): Address6` — Convert a byte array to an Address6 object. Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an `Int8Array` or a Java `byte[]` holds them), folding signed values to their unsigned equivalent. Throws `AddressError` unless given exactly 16 integers from -128 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1175)
185
+ - `static fromUnsignedByteArray(bytes: number[]): Address6` — Convert an unsigned byte array to an Address6 object. Throws `AddressError` unless given exactly 16 integers from 0 to 255. To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1192)
186
+
187
+ **Instance methods**
188
+
189
+ - `microsoftTranscription(): string` — Return the Microsoft UNC transcription of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L416)
190
+ - `mask(mask?: number): string` — Return the first n bits of the address, defaulting to the subnet mask [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L425)
191
+ - `possibleSubnets(subnetSize?: number): string` — Return the number of possible subnets of a given size in the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L435)
192
+ - `startAddress(): Address6` — The first address in the range given by this address' subnet Often referred to as the Network Address. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L460)
193
+ - `startAddressExclusive(): Address6` — The first host address in the range given by this address's subnet ie the first address after the Network Address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L469)
194
+ - `endAddress(): Address6` — The last address in the range given by this address' subnet Often referred to as the Broadcast [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L487)
195
+ - `endAddressExclusive(): Address6` — The last host address in the range given by this address's subnet ie the last address prior to the Broadcast Address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L496)
196
+ - `subnetMaskAddress(): Address6` — The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a `/64`. Returns an `Address6`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L506)
197
+ - `wildcardMask(): Address6` — The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns an `Address6`; call `.correctForm()` for the string. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L518)
198
+ - `networkForm(): string` — The network address in CIDR string form, e.g. `2001:db8::/32` for `2001:db8::1/32`. For an address with no explicit subnet the prefix is `/128`, e.g. `networkForm()` on `2001:db8::1` returns `2001:db8::1/128`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L531)
199
+ - `getScope(): string` — Return the scope of the address. The 4-bit scope field ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7)) is only defined for multicast addresses; for unicast addresses the scope is derived from the address type per [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L543)
200
+ - `getType(): string` — Return the type of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L570)
201
+ - `getBits(start: number, end: number): bigint` — Return the bits in the given range as a BigInt [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L585)
202
+ - `getBitsBase2(start: number, end: number): string` — Return the bits in the given range as a base-2 string [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L593)
203
+ - `getBitsBase16(start: number, end: number): string` — Return the bits in the given range as a base-16 string [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L601)
204
+ - `getBitsPastSubnet(): string` — Return the bits that are set past the subnet mask length [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L617)
205
+ - `reverseForm(options?: ReverseFormOptions): string` — Return the reversed ip6.arpa form of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L627)
206
+ - `correctForm(): string` — Returns the address in correct form, per [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros stripped, the longest run of zero groups collapsed to `::`, and hex digits lowercased (e.g. `2001:db8::1`). This is the recommended form for display. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L662)
207
+ - `binaryZeroPad(): string` — Return a zero-padded base-2 string representation of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L724)
208
+ - `parse4in6(address: string): string` — Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the trailing IPv4 address into `this.address4` / `this.parsedAddress4` and returning the address with the v4 portion converted to two v6 groups. Used internally by `parse()`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L738)
209
+ - `parse(address: string): string[]` — Parses an IPv6 address string into its 8 hexadecimal groups (expanding any `::` elision and any trailing v4-in-v6 portion) and stores the result on `this.parsedAddress`. Called automatically by the constructor; you typically don't need to call it directly. Throws `AddressError` if the input is malformed. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L795)
210
+ - `canonicalForm(): string` — Returns the canonical (fully expanded) form of the address: all 8 groups, each padded to 4 hex digits, with no `::` collapsing (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and byte-exact comparison. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L875)
211
+ - `decimal(): string` — Return the decimal form of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L883)
212
+ - `bigInt(): bigint` — Return the address as a BigInt [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L891)
213
+ - `to4(): Address4` — Return the last two groups of this address as an IPv4 address string. If this address carries a CIDR prefix that covers the trailing 32 bits (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to `/32`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L906)
214
+ - `to4in6(): string` — Return the v4-in-v6 form of the address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L930)
215
+ - `inspectTeredo(): TeredoProperties` — Decodes the Teredo tunneling fields embedded in this address. Returns the Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag, UDP port, and Microsoft-format flag breakdown (reserved, universal/local, group/individual, nonce). Only meaningful for addresses in `2001::/32`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L951)
216
+ - `inspect6to4(): SixToFourProperties` — Decodes the 6to4 tunneling fields embedded in this address. Returns the 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for addresses in `2002::/16`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1014)
217
+ - `to6to4(): Address6 | null` — Return a v6 6to4 address from a v6 v4inv6 address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1034)
218
+ - `toAddress4Nat64(prefix: string): Address4 | null` — Extract the embedded IPv4 address from a NAT64 IPv6 address using the encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052). The default prefix is the well-known prefix `64:ff9b::/96`. Returns `null` if this address is not contained within the given prefix. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1103)
219
+ - `toByteArray(): number[]` — Return a byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1138)
220
+ - `toUnsignedByteArray(): number[]` — Return an unsigned byte array. To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1157)
221
+ - `isCanonical(): boolean` — Returns true if the address is in the canonical form, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1233)
222
+ - `isLinkLocal(): boolean` — Returns true if the address is a link local address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1241)
223
+ - `isMulticast(): boolean` — Returns true if the address is a multicast address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1262)
224
+ - `is4(): boolean` — Returns true if the address was written in v4-in-v6 dotted-quad notation (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag and does not reflect whether the address bits lie in the IPv4-mapped (`::ffff:0:0/96`) subnet — for that, see isMapped4. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1279)
225
+ - `isMapped4(): boolean` — Returns true if the address is an IPv4-mapped IPv6 address in `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)), false otherwise. Unlike is4, this checks the underlying address bits rather than the textual notation, so `::ffff:127.0.0.1` and `::ffff:7f00:1` both return true. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1291)
226
+ - `embeddedIPv4(): Address4 | null` — If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`, [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that embedded address as an Address4; otherwise return null. The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`, `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and delegate to the embedded Address4 when present, so a literal such as `::ffff:127.0.0.1` is classified by what it actually reaches (loopback) rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped). This matters wherever the checks back a trust-boundary decision (e.g. an SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`, `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as non-internal. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1312)
227
+ - `isTeredo(): boolean` — Returns true if the address is a Teredo address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1324)
228
+ - `is6to4(): boolean` — Returns true if the address is a 6to4 address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1332)
229
+ - `isLoopback(): boolean` — Returns true if the address is a loopback address, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1340)
230
+ - `isULA(): boolean` — 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. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1353)
231
+ - `isPrivate(): boolean` — Returns true if the address is private, i.e. a Unique Local Address in `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)) or an IPv4-mapped / NAT64 address whose embedded IPv4 address is in one of the [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to Address4.isPrivate; use it instead of isULA when you need to catch mapped RFC 1918 addresses as well as native ULAs. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1367)
232
+ - `isCGNAT(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is in the carrier-grade NAT range `100.64.0.0/10` ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false otherwise. There is no native IPv6 CGNAT range, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1384)
233
+ - `isBroadcast(): boolean` — Returns true if the address is an IPv4-mapped / NAT64 address whose embedded IPv4 address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise. There is no IPv6 broadcast, so this only ever returns true for an embedded IPv4 address (e.g. `::ffff:255.255.255.255`). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1401)
234
+ - `isUnspecified(): boolean` — Returns true if the address is the unspecified address `::`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1414)
235
+ - `isDocumentation(): boolean` — Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)). [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1427)
236
+ - `href(optionalPort?: string | number): string` — Returns the address as an HTTP URL with the host bracketed, e.g. `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended, e.g. `http://[2001:db8::1]:8080/`. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1438)
237
+ - `link(options?: { className?: string; prefix?: string; v4?: boolean }): string` — Returns an HTML `<a>` element whose `href` encodes the address in a URL hash fragment (default prefix `/#address=`). Useful for linking between pages of an address-inspector UI. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1456)
238
+ - `group(): string` — Groups an address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1496)
239
+ - `regularExpressionString(this: Address6, substringSearch: boolean): string` — Generate a regular expression string that can be used to find or validate all variations of this address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1548)
240
+ - `regularExpression(this: Address6, substringSearch: boolean): RegExp` — Generate a regular expression that can be used to find or validate all variations of this address. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1602)
241
+
242
+ **Properties**
243
+
244
+ - `address4: Address4` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L97)
245
+ - `address: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L98)
246
+ - `addressMinusSuffix: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L99)
247
+ - `elidedGroups: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L100)
248
+ - `elisionBegin: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L101)
249
+ - `elisionEnd: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L102)
250
+ - `groups: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L103)
251
+ - `parsedAddress4: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L104)
252
+ - `parsedAddress: string[]` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L105)
253
+ - `parsedSubnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L106)
254
+ - `subnet: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L107)
255
+ - `subnetMask: number` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L108)
256
+ - `v4: boolean` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L109)
257
+ - `zone: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L110)
258
+ - `isInSubnet: (this: Address4 | Address6, address: Address4 | Address6) => boolean` — Returns true if the given address is in the subnet of the current address [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1213)
259
+ - `isHostInSubnet: (this: Address4 | Address6, address: Address4 | Address6) => boolean` — Returns true if this address's host bits fall inside the given subnet, ignoring this address's own subnet mask. See common.isHostInSubnet. [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1221)
260
+ - `isCorrect: (this: Address4 | Address6) => boolean` — Returns true if the address is correct, false otherwise [src](https://github.com/beaugunderson/ip-address/blob/master/src/ipv6.ts#L1227)
261
+
262
+ </details>
263
+
264
+ <details>
265
+ <summary><a id="addresserror"></a><strong>AddressError</strong></summary>
266
+
267
+ **Constructor**
268
+
269
+ - `new AddressError(message: string, parseMessage?: string): AddressError`
270
+
271
+ **Properties**
272
+
273
+ - `parseMessage: string` — [src](https://github.com/beaugunderson/ip-address/blob/master/src/address-error.ts#L2)
274
+
275
+ </details>
276
+
277
+ <!-- API:END -->
278
+
279
+ ### Security
280
+
281
+ Vulnerabilities go through [GitHub's private vulnerability reporting](https://github.com/beaugunderson/ip-address/security/advisories/new); [SECURITY.md](./SECURITY.md) has the scope and what to expect. Confirmed issues get a fix, a release, and a public [advisory](https://github.com/beaugunderson/ip-address/security/advisories) with a CVE, rather than a quiet patch.
282
+
283
+ Releases are built and published by CI through npm trusted publishing. Every version from 10.2.1 onward carries a provenance attestation tying the tarball to the commit and workflow that built it. Check it with `npm audit signatures`.
284
+
285
+ If you are using the address-property checks as a security control, read [that section of SECURITY.md](./SECURITY.md#classifiers-are-not-an-ssrf-defense) first. `isPrivate()`, `isLoopback()`, `isInSubnet()` and their siblings classify an address that has already been parsed, which makes them one layer of an SSRF guard rather than the whole of it. A hostname that resolves to an internal address, a DNS record that changes after your check, or a redirect will all sail past a guard built only on them.
286
+
287
+ ### Used by
288
+
289
+ `ip-address` is downloaded ~66 million times per week, mostly via the Node proxy/agent ecosystem. The dependency chain runs through a handful of widely-used packages:
290
+
291
+ - [**socks**](https://github.com/JoshGlazebrook/socks) (~53M weekly) — SOCKS4/5 client for Node; depends on `ip-address` directly. The single biggest source of downloads.
292
+ - [**socks-proxy-agent**](https://github.com/TooTallNate/proxy-agents/tree/main/packages/socks-proxy-agent) (~57M weekly) — `http.Agent` for SOCKS proxies; depends on `socks`. Bundled by virtually every CLI that respects `HTTPS_PROXY`.
293
+ - [**npm**](https://github.com/npm/cli) and [**pnpm**](https://github.com/pnpm/pnpm) — both bundle `socks-proxy-agent` through their HTTP fetch stack (`make-fetch-happen` → `@npmcli/agent`), so every Node install on the planet pulls in `ip-address` as a transitive dependency.
294
+ - [**Puppeteer**](https://github.com/puppeteer/puppeteer) — `@puppeteer/browsers` uses `proxy-agent` for browser-binary downloads, which routes through `socks-proxy-agent` → `socks` → `ip-address`.
295
+ - [**proxy-agent**](https://github.com/TooTallNate/proxy-agents/tree/main/packages/proxy-agent) (~28M weekly) and [**pac-proxy-agent**](https://github.com/TooTallNate/proxy-agents/tree/main/packages/pac-proxy-agent) (~27M weekly) — auto-detecting proxy agents (HTTP/HTTPS/SOCKS/PAC) used widely in scraping, headless-browser, and CI tooling.
296
+ - [**cacache**](https://github.com/npm/cacache) (~44M weekly) — npm's content-addressable cache; pulls in the same fetch stack.
297
+
298
+ Beyond the proxy chain, `ip-address` has been used by Juniper Networks' Contrail, Ably's proxy-protocol implementation, Rackspace's serialization framework, IPFS, and the [SwitchyOmega](https://github.com/FelisCatus/SwitchyOmega) Chrome extension, among many others.
tools/ui/node_modules/ip-address/dist/address-error.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ export declare class AddressError extends Error {
2
+ parseMessage?: string;
3
+ constructor(message: string, parseMessage?: string);
4
+ }
tools/ui/node_modules/ip-address/dist/address-error.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddressError = void 0;
4
+ class AddressError extends Error {
5
+ constructor(message, parseMessage) {
6
+ super(message);
7
+ this.name = 'AddressError';
8
+ this.parseMessage = parseMessage;
9
+ }
10
+ }
11
+ exports.AddressError = AddressError;
12
+ //# sourceMappingURL=address-error.js.map
tools/ui/node_modules/ip-address/dist/address-error.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"address-error.js","sourceRoot":"","sources":["../src/address-error.ts"],"names":[],"mappings":";;;AAAA,MAAa,YAAa,SAAQ,KAAK;IAGrC,YAAY,OAAe,EAAE,YAAqB;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAVD,oCAUC","sourcesContent":["export class AddressError extends Error {\n parseMessage?: string;\n\n constructor(message: string, parseMessage?: string) {\n super(message);\n\n this.name = 'AddressError';\n\n this.parseMessage = parseMessage;\n }\n}\n"]}
tools/ui/node_modules/ip-address/dist/common.d.ts ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Address4 } from './ipv4';
2
+ import { Address6 } from './ipv6';
3
+ export interface ReverseFormOptions {
4
+ omitSuffix?: boolean;
5
+ }
6
+ /**
7
+ * Returns whether this address's *network* is contained within `address`,
8
+ * i.e. whether every address this one can represent also falls inside
9
+ * `address`. A network wider than `address` is not contained in it, so
10
+ * `10.0.0.0/8` is not in `10.0.0.0/16`.
11
+ *
12
+ * To ask whether the address itself falls inside a range, ignoring any CIDR
13
+ * suffix it was written with, use {@link isHostInSubnet} instead. That is the
14
+ * question the special-use classifiers ask.
15
+ */
16
+ export declare function isInSubnet(this: Address4 | Address6, address: Address4 | Address6): boolean;
17
+ /**
18
+ * Returns whether this address's host bits fall inside `address`, ignoring
19
+ * this address's own subnet mask.
20
+ *
21
+ * This is the primitive the special-use classifiers (`isLoopback`,
22
+ * `isPrivate`, `isLinkLocal`, `getType`, …) are built on: they answer a
23
+ * question about the address, so the answer must not change with the CIDR
24
+ * suffix the caller happened to write. Use this rather than
25
+ * {@link isInSubnet} when classifying a single address — notably when the
26
+ * address came from untrusted input and the result backs a trust-boundary
27
+ * decision such as an SSRF allow/deny filter.
28
+ */
29
+ export declare function isHostInSubnet(this: Address4 | Address6, address: Address4 | Address6): boolean;
30
+ export declare function isCorrect(defaultBits: number): (this: Address4 | Address6) => boolean;
31
+ /**
32
+ * Returns the prefix length (number of leading 1 bits) of a contiguous
33
+ * subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
34
+ * `255.0.255.0`).
35
+ */
36
+ export declare function prefixLengthFromMask(value: bigint, totalBits: number): number;
37
+ /**
38
+ * Throws `AddressError` unless `bytes` holds exactly `byteCount` integers,
39
+ * each from `minimum` to 255. Pass a `minimum` of `-128` where signed bytes
40
+ * are accepted and folded to unsigned, and `0` where they are not.
41
+ */
42
+ export declare function assertByteArray(bytes: number[], byteCount: number, family: 'IPv4' | 'IPv6', minimum: number): void;
43
+ export declare function numberToPaddedHex(number: number): string;
44
+ export declare function stringToPaddedHex(numberString: string): string;
45
+ /**
46
+ * @param binaryValue Binary representation of a value (e.g. `10`)
47
+ * @param position Byte position, where 0 is the least significant bit
48
+ */
49
+ export declare function testBit(binaryValue: string, position: number): boolean;
tools/ui/node_modules/ip-address/dist/common.js ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isInSubnet = isInSubnet;
4
+ exports.isHostInSubnet = isHostInSubnet;
5
+ exports.isCorrect = isCorrect;
6
+ exports.prefixLengthFromMask = prefixLengthFromMask;
7
+ exports.assertByteArray = assertByteArray;
8
+ exports.numberToPaddedHex = numberToPaddedHex;
9
+ exports.stringToPaddedHex = stringToPaddedHex;
10
+ exports.testBit = testBit;
11
+ const address_error_1 = require("./address-error");
12
+ /**
13
+ * Returns whether this address's *network* is contained within `address`,
14
+ * i.e. whether every address this one can represent also falls inside
15
+ * `address`. A network wider than `address` is not contained in it, so
16
+ * `10.0.0.0/8` is not in `10.0.0.0/16`.
17
+ *
18
+ * To ask whether the address itself falls inside a range, ignoring any CIDR
19
+ * suffix it was written with, use {@link isHostInSubnet} instead. That is the
20
+ * question the special-use classifiers ask.
21
+ */
22
+ function isInSubnet(address) {
23
+ if (this.subnetMask < address.subnetMask) {
24
+ return false;
25
+ }
26
+ return isHostInSubnet.call(this, address);
27
+ }
28
+ /**
29
+ * Returns whether this address's host bits fall inside `address`, ignoring
30
+ * this address's own subnet mask.
31
+ *
32
+ * This is the primitive the special-use classifiers (`isLoopback`,
33
+ * `isPrivate`, `isLinkLocal`, `getType`, …) are built on: they answer a
34
+ * question about the address, so the answer must not change with the CIDR
35
+ * suffix the caller happened to write. Use this rather than
36
+ * {@link isInSubnet} when classifying a single address — notably when the
37
+ * address came from untrusted input and the result backs a trust-boundary
38
+ * decision such as an SSRF allow/deny filter.
39
+ */
40
+ function isHostInSubnet(address) {
41
+ return this.mask(address.subnetMask) === address.mask();
42
+ }
43
+ function isCorrect(defaultBits) {
44
+ return function isCorrectForm() {
45
+ if (this.addressMinusSuffix !== this.correctForm()) {
46
+ return false;
47
+ }
48
+ if (this.subnetMask === defaultBits && !this.parsedSubnet) {
49
+ return true;
50
+ }
51
+ return this.parsedSubnet === String(this.subnetMask);
52
+ };
53
+ }
54
+ /**
55
+ * Returns the prefix length (number of leading 1 bits) of a contiguous
56
+ * subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.
57
+ * `255.0.255.0`).
58
+ */
59
+ function prefixLengthFromMask(value, totalBits) {
60
+ const binary = value.toString(2).padStart(totalBits, '0');
61
+ if (binary.length > totalBits) {
62
+ throw new address_error_1.AddressError('Invalid subnet mask.');
63
+ }
64
+ const firstZero = binary.indexOf('0');
65
+ if (firstZero === -1) {
66
+ return totalBits;
67
+ }
68
+ if (binary.slice(firstZero).includes('1')) {
69
+ throw new address_error_1.AddressError('Invalid subnet mask.');
70
+ }
71
+ return firstZero;
72
+ }
73
+ /**
74
+ * Throws `AddressError` unless `bytes` holds exactly `byteCount` integers,
75
+ * each from `minimum` to 255. Pass a `minimum` of `-128` where signed bytes
76
+ * are accepted and folded to unsigned, and `0` where they are not.
77
+ */
78
+ function assertByteArray(bytes, byteCount, family, minimum) {
79
+ if (bytes.length !== byteCount) {
80
+ throw new address_error_1.AddressError(`${family} addresses require exactly ${byteCount} bytes`);
81
+ }
82
+ for (let i = 0; i < bytes.length; i++) {
83
+ if (!Number.isInteger(bytes[i]) || bytes[i] < minimum || bytes[i] > 255) {
84
+ throw new address_error_1.AddressError(`All bytes must be integers between ${minimum} and 255`);
85
+ }
86
+ }
87
+ }
88
+ function numberToPaddedHex(number) {
89
+ return number.toString(16).padStart(2, '0');
90
+ }
91
+ function stringToPaddedHex(numberString) {
92
+ return numberToPaddedHex(parseInt(numberString, 10));
93
+ }
94
+ /**
95
+ * @param binaryValue Binary representation of a value (e.g. `10`)
96
+ * @param position Byte position, where 0 is the least significant bit
97
+ */
98
+ function testBit(binaryValue, position) {
99
+ const { length } = binaryValue;
100
+ if (position > length) {
101
+ return false;
102
+ }
103
+ const positionInString = length - position;
104
+ return binaryValue.substring(positionInString, positionInString + 1) === '1';
105
+ }
106
+ //# sourceMappingURL=common.js.map
tools/ui/node_modules/ip-address/dist/common.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":";;AAkBA,gCAMC;AAcD,wCAEC;AAED,8BAYC;AAOD,oDAkBC;AAOD,0CAeC;AAED,8CAEC;AAED,8CAEC;AAMD,0BASC;AA1HD,mDAA+C;AAM/C;;;;;;;;;GASG;AACH,SAAgB,UAAU,CAA4B,OAA4B;IAChF,IAAI,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,cAAc,CAA4B,OAA4B;IACpF,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC;AAC1D,CAAC;AAED,SAAgB,SAAS,CAAC,WAAmB;IAC3C,OAAO,SAAS,aAAa;QAC3B,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACnD,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,KAAK,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,KAAa,EAAE,SAAiB;IACnE,MAAM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CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,WAAmB,EAAE,QAAgB;IAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;IAE/B,IAAI,QAAQ,GAAG,MAAM,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC3C,OAAO,WAAW,CAAC,SAAS,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;AAC/E,CAAC","sourcesContent":["import { Address4 } from './ipv4';\nimport { Address6 } from './ipv6';\nimport { AddressError } from './address-error';\n\nexport interface ReverseFormOptions {\n omitSuffix?: boolean;\n}\n\n/**\n * Returns whether this address's *network* is contained within `address`,\n * i.e. whether every address this one can represent also falls inside\n * `address`. A network wider than `address` is not contained in it, so\n * `10.0.0.0/8` is not in `10.0.0.0/16`.\n *\n * To ask whether the address itself falls inside a range, ignoring any CIDR\n * suffix it was written with, use {@link isHostInSubnet} instead. That is the\n * question the special-use classifiers ask.\n */\nexport function isInSubnet(this: Address4 | Address6, address: Address4 | Address6) {\n if (this.subnetMask < address.subnetMask) {\n return false;\n }\n\n return isHostInSubnet.call(this, address);\n}\n\n/**\n * Returns whether this address's host bits fall inside `address`, ignoring\n * this address's own subnet mask.\n *\n * This is the primitive the special-use classifiers (`isLoopback`,\n * `isPrivate`, `isLinkLocal`, `getType`, …) are built on: they answer a\n * question about the address, so the answer must not change with the CIDR\n * suffix the caller happened to write. Use this rather than\n * {@link isInSubnet} when classifying a single address — notably when the\n * address came from untrusted input and the result backs a trust-boundary\n * decision such as an SSRF allow/deny filter.\n */\nexport function isHostInSubnet(this: Address4 | Address6, address: Address4 | Address6) {\n return this.mask(address.subnetMask) === address.mask();\n}\n\nexport function isCorrect(defaultBits: number) {\n return function isCorrectForm(this: Address4 | Address6) {\n if (this.addressMinusSuffix !== this.correctForm()) {\n return false;\n }\n\n if (this.subnetMask === defaultBits && !this.parsedSubnet) {\n return true;\n }\n\n return this.parsedSubnet === String(this.subnetMask);\n };\n}\n\n/**\n * Returns the prefix length (number of leading 1 bits) of a contiguous\n * subnet mask. Throws `AddressError` if the mask is non-contiguous (e.g.\n * `255.0.255.0`).\n */\nexport function prefixLengthFromMask(value: bigint, totalBits: number): number {\n const binary = value.toString(2).padStart(totalBits, '0');\n\n if (binary.length > totalBits) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n const firstZero = binary.indexOf('0');\n\n if (firstZero === -1) {\n return totalBits;\n }\n\n if (binary.slice(firstZero).includes('1')) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n return firstZero;\n}\n\n/**\n * Throws `AddressError` unless `bytes` holds exactly `byteCount` integers,\n * each from `minimum` to 255. Pass a `minimum` of `-128` where signed bytes\n * are accepted and folded to unsigned, and `0` where they are not.\n */\nexport function assertByteArray(\n bytes: number[],\n byteCount: number,\n family: 'IPv4' | 'IPv6',\n minimum: number,\n): void {\n if (bytes.length !== byteCount) {\n throw new AddressError(`${family} addresses require exactly ${byteCount} bytes`);\n }\n\n for (let i = 0; i < bytes.length; i++) {\n if (!Number.isInteger(bytes[i]) || bytes[i] < minimum || bytes[i] > 255) {\n throw new AddressError(`All bytes must be integers between ${minimum} and 255`);\n }\n }\n}\n\nexport function numberToPaddedHex(number: number) {\n return number.toString(16).padStart(2, '0');\n}\n\nexport function stringToPaddedHex(numberString: string) {\n return numberToPaddedHex(parseInt(numberString, 10));\n}\n\n/**\n * @param binaryValue Binary representation of a value (e.g. `10`)\n * @param position Byte position, where 0 is the least significant bit\n */\nexport function testBit(binaryValue: string, position: number): boolean {\n const { length } = binaryValue;\n\n if (position > length) {\n return false;\n }\n\n const positionInString = length - position;\n return binaryValue.substring(positionInString, positionInString + 1) === '1';\n}\n"]}
tools/ui/node_modules/ip-address/dist/ip-address.d.ts ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ export { Address4 } from './ipv4';
2
+ export { Address6 } from './ipv6';
3
+ export { AddressError } from './address-error';
4
+ import * as helpers from './v6/helpers';
5
+ export declare const v6: {
6
+ helpers: typeof helpers;
7
+ };
tools/ui/node_modules/ip-address/dist/ip-address.js ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.v6 = exports.AddressError = exports.Address6 = exports.Address4 = void 0;
27
+ var ipv4_1 = require("./ipv4");
28
+ Object.defineProperty(exports, "Address4", { enumerable: true, get: function () { return ipv4_1.Address4; } });
29
+ var ipv6_1 = require("./ipv6");
30
+ Object.defineProperty(exports, "Address6", { enumerable: true, get: function () { return ipv6_1.Address6; } });
31
+ var address_error_1 = require("./address-error");
32
+ Object.defineProperty(exports, "AddressError", { enumerable: true, get: function () { return address_error_1.AddressError; } });
33
+ const helpers = __importStar(require("./v6/helpers"));
34
+ exports.v6 = { helpers };
35
+ //# sourceMappingURL=ip-address.js.map
tools/ui/node_modules/ip-address/dist/ip-address.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"ip-address.js","sourceRoot":"","sources":["../src/ip-address.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAkC;AAAzB,gGAAA,QAAQ,OAAA;AACjB,+BAAkC;AAAzB,gGAAA,QAAQ,OAAA;AACjB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,sDAAwC;AAE3B,QAAA,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC","sourcesContent":["export { Address4 } from './ipv4';\nexport { Address6 } from './ipv6';\nexport { AddressError } from './address-error';\n\nimport * as helpers from './v6/helpers';\n\nexport const v6 = { helpers };\n"]}
tools/ui/node_modules/ip-address/dist/ipv4.d.ts ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as common from './common';
2
+ /**
3
+ * Represents an IPv4 address
4
+ * @param {string} address - An IPv4 address string
5
+ */
6
+ export declare class Address4 {
7
+ address: string;
8
+ addressMinusSuffix: string;
9
+ groups: number;
10
+ parsedAddress: string[];
11
+ parsedSubnet: string;
12
+ subnet: string;
13
+ subnetMask: number;
14
+ v4: boolean;
15
+ private _binaryZeroPad?;
16
+ constructor(address: string);
17
+ /**
18
+ * Returns true if the given string is a valid IPv4 address (with optional
19
+ * CIDR subnet), false otherwise. Host bits in the subnet portion are
20
+ * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address
21
+ * validation compare `correctForm()` to `startAddress().correctForm()`,
22
+ * or use `networkForm()`.
23
+ */
24
+ static isValid(address: string): boolean;
25
+ /**
26
+ * Parses an IPv4 address string into its four octet groups and stores the
27
+ * result on `this.parsedAddress`. Called automatically by the constructor;
28
+ * you typically don't need to call it directly. Throws `AddressError` if
29
+ * the input is not a valid IPv4 address.
30
+ */
31
+ parse(address: string): string[];
32
+ /**
33
+ * Returns the address in correct form: octets joined with `.` and any
34
+ * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the
35
+ * canonical dotted-decimal representation.
36
+ */
37
+ correctForm(): string;
38
+ /**
39
+ * Returns true if the address is correct, false otherwise
40
+ * @returns {Boolean}
41
+ */
42
+ isCorrect: (this: Address4 | import("./ipv6").Address6) => boolean;
43
+ /**
44
+ * Construct an `Address4` from an address and a dotted-decimal subnet
45
+ * mask given as separate strings (e.g. as returned by Node's
46
+ * `os.networkInterfaces()`). Throws `AddressError` if the mask is
47
+ * non-contiguous (e.g. `255.0.255.0`).
48
+ * @example
49
+ * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');
50
+ * address.subnetMask; // 24
51
+ */
52
+ static fromAddressAndMask(address: string, mask: string): Address4;
53
+ /**
54
+ * Construct an `Address4` from an address and a Cisco-style wildcard mask
55
+ * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard
56
+ * mask is the bitwise inverse of the subnet mask. Throws `AddressError`
57
+ * if the mask is non-contiguous (e.g. `0.255.0.255`).
58
+ * @example
59
+ * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');
60
+ * address.subnetMask; // 24
61
+ */
62
+ static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address4;
63
+ /**
64
+ * Construct an `Address4` from a wildcard pattern with trailing `*`
65
+ * octets. The number of trailing wildcards determines the prefix
66
+ * length: each `*` represents 8 bits.
67
+ *
68
+ * Only trailing whole-octet wildcards are supported. Partial-octet
69
+ * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.
70
+ * `192.*.0.1`) throw `AddressError`.
71
+ * @example
72
+ * Address4.fromWildcard('192.168.0.*').subnet; // '/24'
73
+ * Address4.fromWildcard('192.168.*.*').subnet; // '/16'
74
+ * Address4.fromWildcard('*.*.*.*').subnet; // '/0'
75
+ */
76
+ static fromWildcard(input: string): Address4;
77
+ /**
78
+ * Converts a hex string to an IPv4 address object. Accepts 8 hex digits
79
+ * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).
80
+ * Throws `AddressError` for any other length or for non-hex characters.
81
+ * @param {string} hex - a hex string to convert
82
+ * @returns {Address4}
83
+ */
84
+ static fromHex(hex: string): Address4;
85
+ /**
86
+ * Converts an integer into a IPv4 address object. The integer must be a
87
+ * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise
88
+ * `AddressError` is thrown.
89
+ * @param {integer} integer - a number to convert
90
+ * @returns {Address4}
91
+ */
92
+ static fromInteger(integer: number): Address4;
93
+ /**
94
+ * Return an address from in-addr.arpa form
95
+ * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
96
+ * @returns {Adress4}
97
+ * @example
98
+ * var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)
99
+ * address.correctForm(); // '192.0.2.42'
100
+ */
101
+ static fromArpa(arpaFormAddress: string): Address4;
102
+ /**
103
+ * Converts an IPv4 address object to a hex string
104
+ * @returns {String}
105
+ */
106
+ toHex(): string;
107
+ /**
108
+ * Converts an IPv4 address object to an array of bytes.
109
+ *
110
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.
111
+ * @returns {Array}
112
+ */
113
+ toArray(): number[];
114
+ /**
115
+ * Converts an IPv4 address object to an IPv6 address group
116
+ * @returns {String}
117
+ */
118
+ toGroup6(): string;
119
+ /**
120
+ * Returns the address as a `bigint`
121
+ * @returns {bigint}
122
+ */
123
+ bigInt(): bigint;
124
+ /**
125
+ * Helper function getting start address.
126
+ * @returns {bigint}
127
+ */
128
+ _startAddress(): bigint;
129
+ /**
130
+ * The first address in the range given by this address' subnet.
131
+ * Often referred to as the Network Address.
132
+ * @returns {Address4}
133
+ */
134
+ startAddress(): Address4;
135
+ /**
136
+ * The first host address in the range given by this address's subnet ie
137
+ * the first address after the Network Address
138
+ * @returns {Address4}
139
+ */
140
+ startAddressExclusive(): Address4;
141
+ /**
142
+ * Helper function getting end address.
143
+ * @returns {bigint}
144
+ */
145
+ _endAddress(): bigint;
146
+ /**
147
+ * The last address in the range given by this address' subnet
148
+ * Often referred to as the Broadcast
149
+ * @returns {Address4}
150
+ */
151
+ endAddress(): Address4;
152
+ /**
153
+ * The last host address in the range given by this address's subnet ie
154
+ * the last address prior to the Broadcast Address
155
+ * @returns {Address4}
156
+ */
157
+ endAddressExclusive(): Address4;
158
+ /**
159
+ * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for
160
+ * a `/20`. Returns an `Address4`; call `.correctForm()` for the string.
161
+ * @returns {Address4}
162
+ */
163
+ subnetMaskAddress(): Address4;
164
+ /**
165
+ * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is
166
+ * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;
167
+ * call `.correctForm()` for the string.
168
+ * @returns {Address4}
169
+ */
170
+ wildcardMask(): Address4;
171
+ /**
172
+ * The network address in CIDR string form, e.g. `192.168.1.0/24` for
173
+ * `192.168.1.5/24`. For an address with no explicit subnet the prefix is
174
+ * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.
175
+ * @returns {string}
176
+ */
177
+ networkForm(): string;
178
+ /**
179
+ * Converts a BigInt to a v4 address object. The value must be in the
180
+ * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.
181
+ * @param {bigint} bigInt - a BigInt to convert
182
+ * @returns {Address4}
183
+ */
184
+ static fromBigInt(bigInt: bigint): Address4;
185
+ /**
186
+ * Convert a byte array to an Address4 object.
187
+ *
188
+ * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.
189
+ * @param {Array<number>} bytes - an array of 4 bytes (0-255)
190
+ * @returns {Address4}
191
+ */
192
+ static fromByteArray(bytes: Array<number>): Address4;
193
+ /**
194
+ * Convert an unsigned byte array to an Address4 object
195
+ * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
196
+ * @returns {Address4}
197
+ */
198
+ static fromUnsignedByteArray(bytes: Array<number>): Address4;
199
+ /**
200
+ * Returns the first n bits of the address, defaulting to the
201
+ * subnet mask
202
+ * @returns {String}
203
+ */
204
+ mask(mask?: number): string;
205
+ /**
206
+ * Returns the bits in the given range as a base-2 string
207
+ * @returns {string}
208
+ */
209
+ getBitsBase2(start: number, end: number): string;
210
+ /**
211
+ * Return the reversed ip6.arpa form of the address
212
+ * @param {Object} options
213
+ * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
214
+ * @returns {String}
215
+ */
216
+ reverseForm(options?: common.ReverseFormOptions): string;
217
+ /**
218
+ * Returns true if the given address is in the subnet of the current address
219
+ * @returns {boolean}
220
+ */
221
+ isInSubnet: typeof common.isInSubnet;
222
+ /**
223
+ * Returns true if this address's host bits fall inside the given subnet,
224
+ * ignoring this address's own subnet mask. See
225
+ * {@link common.isHostInSubnet}.
226
+ * @returns {boolean}
227
+ */
228
+ isHostInSubnet: typeof common.isHostInSubnet;
229
+ /**
230
+ * Returns true if the given address is a multicast address
231
+ * @returns {boolean}
232
+ */
233
+ isMulticast(): boolean;
234
+ /**
235
+ * 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`).
236
+ * @returns {boolean}
237
+ */
238
+ isPrivate(): boolean;
239
+ /**
240
+ * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).
241
+ * @returns {boolean}
242
+ */
243
+ isLoopback(): boolean;
244
+ /**
245
+ * 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)).
246
+ * @returns {boolean}
247
+ */
248
+ isLinkLocal(): boolean;
249
+ /**
250
+ * Returns true if the address is the unspecified address `0.0.0.0`.
251
+ * @returns {boolean}
252
+ */
253
+ isUnspecified(): boolean;
254
+ /**
255
+ * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).
256
+ * @returns {boolean}
257
+ */
258
+ isBroadcast(): boolean;
259
+ /**
260
+ * 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)).
261
+ * @returns {boolean}
262
+ */
263
+ isCGNAT(): boolean;
264
+ /**
265
+ * Returns a zero-padded base-2 string representation of the address
266
+ * @returns {string}
267
+ */
268
+ binaryZeroPad(): string;
269
+ /**
270
+ * Groups an IPv4 address for inclusion at the end of an IPv6 address
271
+ * @returns {String}
272
+ */
273
+ groupForV6(): string;
274
+ }
tools/ui/node_modules/ip-address/dist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eslint-disable no-param-reassign */
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.Address4 = void 0;
28
+ const common = __importStar(require("./common"));
29
+ const constants = __importStar(require("./v4/constants"));
30
+ const address_error_1 = require("./address-error");
31
+ const isCorrect4 = common.isCorrect(constants.BITS);
32
+ /**
33
+ * Represents an IPv4 address
34
+ * @param {string} address - An IPv4 address string
35
+ */
36
+ class Address4 {
37
+ constructor(address) {
38
+ this.addressMinusSuffix = '';
39
+ this.groups = constants.GROUPS;
40
+ this.parsedAddress = [];
41
+ this.parsedSubnet = '';
42
+ this.subnet = '/32';
43
+ this.subnetMask = 32;
44
+ this.v4 = true;
45
+ /**
46
+ * Returns true if the address is correct, false otherwise
47
+ * @returns {Boolean}
48
+ */
49
+ this.isCorrect = isCorrect4;
50
+ /**
51
+ * Returns true if the given address is in the subnet of the current address
52
+ * @returns {boolean}
53
+ */
54
+ this.isInSubnet = common.isInSubnet;
55
+ /**
56
+ * Returns true if this address's host bits fall inside the given subnet,
57
+ * ignoring this address's own subnet mask. See
58
+ * {@link common.isHostInSubnet}.
59
+ * @returns {boolean}
60
+ */
61
+ this.isHostInSubnet = common.isHostInSubnet;
62
+ this.address = address;
63
+ const subnet = constants.RE_SUBNET_STRING.exec(address);
64
+ if (subnet) {
65
+ this.parsedSubnet = subnet[0].replace('/', '');
66
+ this.subnetMask = parseInt(this.parsedSubnet, 10);
67
+ this.subnet = `/${this.subnetMask}`;
68
+ if (this.subnetMask < 0 || this.subnetMask > constants.BITS) {
69
+ throw new address_error_1.AddressError('Invalid subnet mask.');
70
+ }
71
+ address = address.replace(constants.RE_SUBNET_STRING, '');
72
+ }
73
+ this.addressMinusSuffix = address;
74
+ this.parsedAddress = this.parse(address);
75
+ }
76
+ /**
77
+ * Returns true if the given string is a valid IPv4 address (with optional
78
+ * CIDR subnet), false otherwise. Host bits in the subnet portion are
79
+ * allowed (e.g. `192.168.1.5/24` is valid); for strict network-address
80
+ * validation compare `correctForm()` to `startAddress().correctForm()`,
81
+ * or use `networkForm()`.
82
+ */
83
+ static isValid(address) {
84
+ try {
85
+ // eslint-disable-next-line no-new
86
+ new Address4(address);
87
+ return true;
88
+ }
89
+ catch {
90
+ return false;
91
+ }
92
+ }
93
+ /**
94
+ * Parses an IPv4 address string into its four octet groups and stores the
95
+ * result on `this.parsedAddress`. Called automatically by the constructor;
96
+ * you typically don't need to call it directly. Throws `AddressError` if
97
+ * the input is not a valid IPv4 address.
98
+ */
99
+ parse(address) {
100
+ const groups = address.split('.');
101
+ // Checked before the general match so the error names the actual problem.
102
+ // Address6 rejects the same notation on its v4-in-v6 path.
103
+ if (groups.some((group) => /^0\d/.test(group))) {
104
+ throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.");
105
+ }
106
+ if (!address.match(constants.RE_ADDRESS)) {
107
+ throw new address_error_1.AddressError('Invalid IPv4 address.');
108
+ }
109
+ return groups;
110
+ }
111
+ /**
112
+ * Returns the address in correct form: octets joined with `.` and any
113
+ * leading zeros stripped (e.g. `192.168.1.1`). For IPv4 this matches the
114
+ * canonical dotted-decimal representation.
115
+ */
116
+ correctForm() {
117
+ return this.parsedAddress.map((part) => parseInt(part, 10)).join('.');
118
+ }
119
+ /**
120
+ * Construct an `Address4` from an address and a dotted-decimal subnet
121
+ * mask given as separate strings (e.g. as returned by Node's
122
+ * `os.networkInterfaces()`). Throws `AddressError` if the mask is
123
+ * non-contiguous (e.g. `255.0.255.0`).
124
+ * @example
125
+ * var address = Address4.fromAddressAndMask('192.168.1.1', '255.255.255.0');
126
+ * address.subnetMask; // 24
127
+ */
128
+ static fromAddressAndMask(address, mask) {
129
+ const bits = common.prefixLengthFromMask(new Address4(mask).bigInt(), constants.BITS);
130
+ return new Address4(`${address}/${bits}`);
131
+ }
132
+ /**
133
+ * Construct an `Address4` from an address and a Cisco-style wildcard mask
134
+ * given as separate strings (e.g. `0.0.0.255` for a `/24`). The wildcard
135
+ * mask is the bitwise inverse of the subnet mask. Throws `AddressError`
136
+ * if the mask is non-contiguous (e.g. `0.255.0.255`).
137
+ * @example
138
+ * var address = Address4.fromAddressAndWildcardMask('10.0.0.1', '0.0.0.255');
139
+ * address.subnetMask; // 24
140
+ */
141
+ static fromAddressAndWildcardMask(address, wildcardMask) {
142
+ const wildcard = new Address4(wildcardMask).bigInt();
143
+ const allOnes = (BigInt(1) << BigInt(constants.BITS)) - BigInt(1);
144
+ const mask = wildcard ^ allOnes;
145
+ const bits = common.prefixLengthFromMask(mask, constants.BITS);
146
+ return new Address4(`${address}/${bits}`);
147
+ }
148
+ /**
149
+ * Construct an `Address4` from a wildcard pattern with trailing `*`
150
+ * octets. The number of trailing wildcards determines the prefix
151
+ * length: each `*` represents 8 bits.
152
+ *
153
+ * Only trailing whole-octet wildcards are supported. Partial-octet
154
+ * wildcards (e.g. `192.168.0.1*`) and interior wildcards (e.g.
155
+ * `192.*.0.1`) throw `AddressError`.
156
+ * @example
157
+ * Address4.fromWildcard('192.168.0.*').subnet; // '/24'
158
+ * Address4.fromWildcard('192.168.*.*').subnet; // '/16'
159
+ * Address4.fromWildcard('*.*.*.*').subnet; // '/0'
160
+ */
161
+ static fromWildcard(input) {
162
+ const groups = input.split('.');
163
+ if (groups.length !== constants.GROUPS) {
164
+ throw new address_error_1.AddressError('Wildcard pattern must have 4 octets');
165
+ }
166
+ let firstWildcard = -1;
167
+ for (let i = 0; i < groups.length; i++) {
168
+ if (groups[i] === '*') {
169
+ if (firstWildcard === -1) {
170
+ firstWildcard = i;
171
+ }
172
+ }
173
+ else if (firstWildcard !== -1) {
174
+ throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing octets (e.g. `192.168.0.*`)');
175
+ }
176
+ }
177
+ const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
178
+ const replaced = groups.map((g) => (g === '*' ? '0' : g));
179
+ const subnetBits = constants.BITS - trailing * 8;
180
+ return new Address4(`${replaced.join('.')}/${subnetBits}`);
181
+ }
182
+ /**
183
+ * Converts a hex string to an IPv4 address object. Accepts 8 hex digits
184
+ * with optional `:` separators (e.g. `'7f000001'` or `'7f:00:00:01'`).
185
+ * Throws `AddressError` for any other length or for non-hex characters.
186
+ * @param {string} hex - a hex string to convert
187
+ * @returns {Address4}
188
+ */
189
+ static fromHex(hex) {
190
+ const stripped = hex.replace(/:/g, '');
191
+ if (!/^[0-9a-fA-F]{8}$/.test(stripped)) {
192
+ throw new address_error_1.AddressError('IPv4 hex must be exactly 8 hex digits');
193
+ }
194
+ const groups = [];
195
+ for (let i = 0; i < 8; i += 2) {
196
+ groups.push(parseInt(stripped.slice(i, i + 2), 16));
197
+ }
198
+ return new Address4(groups.join('.'));
199
+ }
200
+ /**
201
+ * Converts an integer into a IPv4 address object. The integer must be a
202
+ * non-negative safe integer in the range `[0, 2**32 - 1]`; otherwise
203
+ * `AddressError` is thrown.
204
+ * @param {integer} integer - a number to convert
205
+ * @returns {Address4}
206
+ */
207
+ static fromInteger(integer) {
208
+ if (!Number.isInteger(integer) || integer < 0 || integer > 0xffffffff) {
209
+ throw new address_error_1.AddressError('IPv4 integer must be in the range 0 to 2**32 - 1');
210
+ }
211
+ return Address4.fromHex(integer.toString(16).padStart(8, '0'));
212
+ }
213
+ /**
214
+ * Return an address from in-addr.arpa form
215
+ * @param {string} arpaFormAddress - an 'in-addr.arpa' form ipv4 address
216
+ * @returns {Adress4}
217
+ * @example
218
+ * var address = Address4.fromArpa(42.2.0.192.in-addr.arpa.)
219
+ * address.correctForm(); // '192.0.2.42'
220
+ */
221
+ static fromArpa(arpaFormAddress) {
222
+ // remove ending ".in-addr.arpa." or just "."
223
+ const leader = arpaFormAddress.replace(/(\.in-addr\.arpa)?\.$/, '');
224
+ const address = leader.split('.').reverse().join('.');
225
+ return new Address4(address);
226
+ }
227
+ /**
228
+ * Converts an IPv4 address object to a hex string
229
+ * @returns {String}
230
+ */
231
+ toHex() {
232
+ return this.parsedAddress.map((part) => common.stringToPaddedHex(part)).join(':');
233
+ }
234
+ /**
235
+ * Converts an IPv4 address object to an array of bytes.
236
+ *
237
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toArray())`.
238
+ * @returns {Array}
239
+ */
240
+ toArray() {
241
+ return this.parsedAddress.map((part) => parseInt(part, 10));
242
+ }
243
+ /**
244
+ * Converts an IPv4 address object to an IPv6 address group
245
+ * @returns {String}
246
+ */
247
+ toGroup6() {
248
+ const output = [];
249
+ let i;
250
+ for (i = 0; i < constants.GROUPS; i += 2) {
251
+ output.push(`${common.stringToPaddedHex(this.parsedAddress[i])}${common.stringToPaddedHex(this.parsedAddress[i + 1])}`);
252
+ }
253
+ return output.join(':');
254
+ }
255
+ /**
256
+ * Returns the address as a `bigint`
257
+ * @returns {bigint}
258
+ */
259
+ bigInt() {
260
+ return BigInt(`0x${this.parsedAddress.map((n) => common.stringToPaddedHex(n)).join('')}`);
261
+ }
262
+ /**
263
+ * Helper function getting start address.
264
+ * @returns {bigint}
265
+ */
266
+ _startAddress() {
267
+ return BigInt(`0b${this.mask() + '0'.repeat(constants.BITS - this.subnetMask)}`);
268
+ }
269
+ /**
270
+ * The first address in the range given by this address' subnet.
271
+ * Often referred to as the Network Address.
272
+ * @returns {Address4}
273
+ */
274
+ startAddress() {
275
+ return Address4.fromBigInt(this._startAddress());
276
+ }
277
+ /**
278
+ * The first host address in the range given by this address's subnet ie
279
+ * the first address after the Network Address
280
+ * @returns {Address4}
281
+ */
282
+ startAddressExclusive() {
283
+ const adjust = BigInt('1');
284
+ return Address4.fromBigInt(this._startAddress() + adjust);
285
+ }
286
+ /**
287
+ * Helper function getting end address.
288
+ * @returns {bigint}
289
+ */
290
+ _endAddress() {
291
+ return BigInt(`0b${this.mask() + '1'.repeat(constants.BITS - this.subnetMask)}`);
292
+ }
293
+ /**
294
+ * The last address in the range given by this address' subnet
295
+ * Often referred to as the Broadcast
296
+ * @returns {Address4}
297
+ */
298
+ endAddress() {
299
+ return Address4.fromBigInt(this._endAddress());
300
+ }
301
+ /**
302
+ * The last host address in the range given by this address's subnet ie
303
+ * the last address prior to the Broadcast Address
304
+ * @returns {Address4}
305
+ */
306
+ endAddressExclusive() {
307
+ const adjust = BigInt('1');
308
+ return Address4.fromBigInt(this._endAddress() - adjust);
309
+ }
310
+ /**
311
+ * The dotted-decimal form of the subnet mask, e.g. `255.255.240.0` for
312
+ * a `/20`. Returns an `Address4`; call `.correctForm()` for the string.
313
+ * @returns {Address4}
314
+ */
315
+ subnetMaskAddress() {
316
+ return Address4.fromBigInt(BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants.BITS - this.subnetMask)}`));
317
+ }
318
+ /**
319
+ * The Cisco-style wildcard mask, e.g. `0.0.0.255` for a `/24`. This is
320
+ * the bitwise inverse of `subnetMaskAddress()`. Returns an `Address4`;
321
+ * call `.correctForm()` for the string.
322
+ * @returns {Address4}
323
+ */
324
+ wildcardMask() {
325
+ return Address4.fromBigInt(BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants.BITS - this.subnetMask)}`));
326
+ }
327
+ /**
328
+ * The network address in CIDR string form, e.g. `192.168.1.0/24` for
329
+ * `192.168.1.5/24`. For an address with no explicit subnet the prefix is
330
+ * `/32`, e.g. `networkForm()` on `192.168.1.5` returns `192.168.1.5/32`.
331
+ * @returns {string}
332
+ */
333
+ networkForm() {
334
+ return `${this.startAddress().correctForm()}/${this.subnetMask}`;
335
+ }
336
+ /**
337
+ * Converts a BigInt to a v4 address object. The value must be in the
338
+ * range `[0, 2**32 - 1]`; otherwise `AddressError` is thrown.
339
+ * @param {bigint} bigInt - a BigInt to convert
340
+ * @returns {Address4}
341
+ */
342
+ static fromBigInt(bigInt) {
343
+ if (bigInt < BigInt(0) || bigInt > BigInt(0xffffffff)) {
344
+ throw new address_error_1.AddressError('IPv4 BigInt must be in the range 0 to 2**32 - 1');
345
+ }
346
+ return Address4.fromHex(bigInt.toString(16).padStart(8, '0'));
347
+ }
348
+ /**
349
+ * Convert a byte array to an Address4 object.
350
+ *
351
+ * To convert from a Node.js `Buffer`, spread it: `Address4.fromByteArray([...buf])`.
352
+ * @param {Array<number>} bytes - an array of 4 bytes (0-255)
353
+ * @returns {Address4}
354
+ */
355
+ static fromByteArray(bytes) {
356
+ common.assertByteArray(bytes, 4, 'IPv4', 0);
357
+ return this.fromUnsignedByteArray(bytes);
358
+ }
359
+ /**
360
+ * Convert an unsigned byte array to an Address4 object
361
+ * @param {Array<number>} bytes - an array of 4 unsigned bytes (0-255)
362
+ * @returns {Address4}
363
+ */
364
+ static fromUnsignedByteArray(bytes) {
365
+ if (bytes.length !== 4) {
366
+ throw new address_error_1.AddressError('IPv4 addresses require exactly 4 bytes');
367
+ }
368
+ const address = bytes.join('.');
369
+ return new Address4(address);
370
+ }
371
+ /**
372
+ * Returns the first n bits of the address, defaulting to the
373
+ * subnet mask
374
+ * @returns {String}
375
+ */
376
+ mask(mask) {
377
+ if (mask === undefined) {
378
+ mask = this.subnetMask;
379
+ }
380
+ return this.getBitsBase2(0, mask);
381
+ }
382
+ /**
383
+ * Returns the bits in the given range as a base-2 string
384
+ * @returns {string}
385
+ */
386
+ getBitsBase2(start, end) {
387
+ return this.binaryZeroPad().slice(start, end);
388
+ }
389
+ /**
390
+ * Return the reversed ip6.arpa form of the address
391
+ * @param {Object} options
392
+ * @param {boolean} options.omitSuffix - omit the "in-addr.arpa" suffix
393
+ * @returns {String}
394
+ */
395
+ reverseForm(options) {
396
+ if (!options) {
397
+ options = {};
398
+ }
399
+ const reversed = this.correctForm().split('.').reverse().join('.');
400
+ if (options.omitSuffix) {
401
+ return reversed;
402
+ }
403
+ return `${reversed}.in-addr.arpa.`;
404
+ }
405
+ /**
406
+ * Returns true if the given address is a multicast address
407
+ * @returns {boolean}
408
+ */
409
+ isMulticast() {
410
+ return this.isHostInSubnet(MULTICAST_V4);
411
+ }
412
+ /**
413
+ * 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`).
414
+ * @returns {boolean}
415
+ */
416
+ isPrivate() {
417
+ return PRIVATE_V4.some((subnet) => this.isHostInSubnet(subnet));
418
+ }
419
+ /**
420
+ * Returns true if the address is in the loopback range `127.0.0.0/8` ([RFC 1122](https://datatracker.ietf.org/doc/html/rfc1122)).
421
+ * @returns {boolean}
422
+ */
423
+ isLoopback() {
424
+ return this.isHostInSubnet(LOOPBACK_V4);
425
+ }
426
+ /**
427
+ * 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)).
428
+ * @returns {boolean}
429
+ */
430
+ isLinkLocal() {
431
+ return this.isHostInSubnet(LINK_LOCAL_V4);
432
+ }
433
+ /**
434
+ * Returns true if the address is the unspecified address `0.0.0.0`.
435
+ * @returns {boolean}
436
+ */
437
+ isUnspecified() {
438
+ return this.isHostInSubnet(UNSPECIFIED_V4);
439
+ }
440
+ /**
441
+ * Returns true if the address is the limited broadcast address `255.255.255.255` ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)).
442
+ * @returns {boolean}
443
+ */
444
+ isBroadcast() {
445
+ return this.isHostInSubnet(BROADCAST_V4);
446
+ }
447
+ /**
448
+ * 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)).
449
+ * @returns {boolean}
450
+ */
451
+ isCGNAT() {
452
+ return this.isHostInSubnet(CGNAT_V4);
453
+ }
454
+ /**
455
+ * Returns a zero-padded base-2 string representation of the address
456
+ * @returns {string}
457
+ */
458
+ binaryZeroPad() {
459
+ if (this._binaryZeroPad === undefined) {
460
+ this._binaryZeroPad = this.bigInt().toString(2).padStart(constants.BITS, '0');
461
+ }
462
+ return this._binaryZeroPad;
463
+ }
464
+ /**
465
+ * Groups an IPv4 address for inclusion at the end of an IPv6 address
466
+ * @returns {String}
467
+ */
468
+ groupForV6() {
469
+ const segments = this.parsedAddress;
470
+ return this.correctForm().replace(constants.RE_ADDRESS, `<span class="hover-group group-v4 group-6">${segments
471
+ .slice(0, 2)
472
+ .join('.')}</span>.<span class="hover-group group-v4 group-7">${segments
473
+ .slice(2, 4)
474
+ .join('.')}</span>`);
475
+ }
476
+ }
477
+ exports.Address4 = Address4;
478
+ const MULTICAST_V4 = new Address4('224.0.0.0/4');
479
+ const PRIVATE_V4 = [
480
+ new Address4('10.0.0.0/8'),
481
+ new Address4('172.16.0.0/12'),
482
+ new Address4('192.168.0.0/16'),
483
+ ];
484
+ const LOOPBACK_V4 = new Address4('127.0.0.0/8');
485
+ const LINK_LOCAL_V4 = new Address4('169.254.0.0/16');
486
+ const UNSPECIFIED_V4 = new Address4('0.0.0.0/32');
487
+ const BROADCAST_V4 = new Address4('255.255.255.255/32');
488
+ const CGNAT_V4 = new Address4('100.64.0.0/10');
489
+ //# sourceMappingURL=ipv4.js.map
tools/ui/node_modules/ip-address/dist/ipv4.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"ipv4.js","sourceRoot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AQ;aACnD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aACX,IAAI,CAAC,GAAG,CAAC,sDAAsD,QAAQ;aACvE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;aACX,IAAI,CAAC,GAAG,CAAC,SAAS,CACtB,CAAC;IACJ,CAAC;CACF;AA9gBD,4BA8gBC;AAED,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC;AACjD,MAAM,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","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 * 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.\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\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 ip6.arpa form of the address\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. See\n * {@link common.isHostInSubnet}.\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 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 * @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');\n"]}
tools/ui/node_modules/ip-address/dist/ipv6.d.ts ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as common from './common';
2
+ import { Address4 } from './ipv4';
3
+ interface SixToFourProperties {
4
+ prefix: string;
5
+ gateway: string;
6
+ }
7
+ interface TeredoProperties {
8
+ prefix: string;
9
+ server4: string;
10
+ client4: string;
11
+ flags: string;
12
+ coneNat: boolean;
13
+ microsoft: {
14
+ reserved: boolean;
15
+ universalLocal: boolean;
16
+ groupIndividual: boolean;
17
+ nonce: string;
18
+ };
19
+ udpPort: string;
20
+ }
21
+ /**
22
+ * Represents an IPv6 address
23
+ * @param {string} address - An IPv6 address string
24
+ * @param {number} [groups=8] - How many octets to parse
25
+ * @example
26
+ * var address = new Address6('2001::/32');
27
+ */
28
+ export declare class Address6 {
29
+ address4?: Address4;
30
+ address: string;
31
+ addressMinusSuffix: string;
32
+ elidedGroups?: number;
33
+ elisionBegin?: number;
34
+ elisionEnd?: number;
35
+ groups: number;
36
+ parsedAddress4?: string;
37
+ parsedAddress: string[];
38
+ parsedSubnet: string;
39
+ subnet: string;
40
+ subnetMask: number;
41
+ v4: boolean;
42
+ zone: string;
43
+ private _binaryZeroPad?;
44
+ constructor(address: string, optionalGroups?: number);
45
+ /**
46
+ * Returns true if the given string is a valid IPv6 address (with optional
47
+ * CIDR subnet and zone identifier), false otherwise. Host bits in the
48
+ * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict
49
+ * network-address validation compare `correctForm()` to
50
+ * `startAddress().correctForm()`, or use `networkForm()`.
51
+ */
52
+ static isValid(address: string): boolean;
53
+ /**
54
+ * Convert a BigInt to a v6 address object. The value must be in the
55
+ * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.
56
+ * @param {bigint} bigInt - a BigInt to convert
57
+ * @returns {Address6}
58
+ * @example
59
+ * var bigInt = BigInt('1000000000000');
60
+ * var address = Address6.fromBigInt(bigInt);
61
+ * address.correctForm(); // '::e8:d4a5:1000'
62
+ */
63
+ static fromBigInt(bigInt: bigint): Address6;
64
+ /**
65
+ * Parse a URL (with optional bracketed host and port) into an address and
66
+ * port. Returns either `{ address, port }` on success or
67
+ * `{ error, address: null, port: null }` if the URL could not be parsed.
68
+ * Ports are returned as numbers (or `null` if absent or out of range).
69
+ * @example
70
+ * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
71
+ * addressAndPort.address.correctForm(); // 'ffff::'
72
+ * addressAndPort.port; // 8080
73
+ */
74
+ static fromURL(url: string): {
75
+ error: string;
76
+ address: null;
77
+ port: null;
78
+ } | {
79
+ address: Address6;
80
+ port: number | null;
81
+ error?: undefined;
82
+ };
83
+ /**
84
+ * Construct an `Address6` from an address and a hex subnet mask given as
85
+ * separate strings (e.g. as returned by Node's `os.networkInterfaces()`).
86
+ * Throws `AddressError` if the mask is non-contiguous (e.g.
87
+ * `ffff::ffff`).
88
+ * @example
89
+ * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');
90
+ * address.subnetMask; // 64
91
+ */
92
+ static fromAddressAndMask(address: string, mask: string): Address6;
93
+ /**
94
+ * Construct an `Address6` from an address and a Cisco-style wildcard mask
95
+ * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).
96
+ * The wildcard mask is the bitwise inverse of the subnet mask. Throws
97
+ * `AddressError` if the mask is non-contiguous.
98
+ * @example
99
+ * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');
100
+ * address.subnetMask; // 64
101
+ */
102
+ static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address6;
103
+ /**
104
+ * Construct an `Address6` from a wildcard pattern with trailing `*`
105
+ * groups. The number of trailing wildcards determines the prefix
106
+ * length: each `*` represents 16 bits. `::` is expanded to zero groups
107
+ * (not wildcards) before evaluating trailing wildcards.
108
+ *
109
+ * Only trailing whole-group wildcards are supported. Partial-group
110
+ * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.
111
+ * `*::1`) throw `AddressError`.
112
+ * @example
113
+ * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'
114
+ * Address6.fromWildcard('2001:db8::*').subnet; // '/112'
115
+ * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'
116
+ */
117
+ static fromWildcard(input: string): Address6;
118
+ /**
119
+ * Create an IPv6-mapped address given an IPv4 address
120
+ * @param {string} address - An IPv4 address string
121
+ * @returns {Address6}
122
+ * @example
123
+ * var address = Address6.fromAddress4('192.168.0.1');
124
+ * address.correctForm(); // '::ffff:c0a8:1'
125
+ * address.to4in6(); // '::ffff:192.168.0.1'
126
+ */
127
+ static fromAddress4(address: string): Address6;
128
+ /**
129
+ * Return an address from ip6.arpa form
130
+ * @param {string} arpaFormAddress - an 'ip6.arpa' form address
131
+ * @returns {Adress6}
132
+ * @example
133
+ * 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.)
134
+ * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'
135
+ */
136
+ static fromArpa(arpaFormAddress: string): Address6;
137
+ /**
138
+ * Return the Microsoft UNC transcription of the address
139
+ * @returns {String} the Microsoft UNC transcription of the address
140
+ */
141
+ microsoftTranscription(): string;
142
+ /**
143
+ * Return the first n bits of the address, defaulting to the subnet mask
144
+ * @param {number} [mask=subnet] - the number of bits to mask
145
+ * @returns {String} the first n bits of the address as a string
146
+ */
147
+ mask(mask?: number): string;
148
+ /**
149
+ * Return the number of possible subnets of a given size in the address
150
+ * @param {number} [subnetSize=128] - the subnet size
151
+ * @returns {String}
152
+ */
153
+ possibleSubnets(subnetSize?: number): string;
154
+ /**
155
+ * Helper function getting start address.
156
+ * @returns {bigint}
157
+ */
158
+ _startAddress(): bigint;
159
+ /**
160
+ * The first address in the range given by this address' subnet
161
+ * Often referred to as the Network Address.
162
+ * @returns {Address6}
163
+ */
164
+ startAddress(): Address6;
165
+ /**
166
+ * The first host address in the range given by this address's subnet ie
167
+ * the first address after the Network Address
168
+ * @returns {Address6}
169
+ */
170
+ startAddressExclusive(): Address6;
171
+ /**
172
+ * Helper function getting end address.
173
+ * @returns {bigint}
174
+ */
175
+ _endAddress(): bigint;
176
+ /**
177
+ * The last address in the range given by this address' subnet
178
+ * Often referred to as the Broadcast
179
+ * @returns {Address6}
180
+ */
181
+ endAddress(): Address6;
182
+ /**
183
+ * The last host address in the range given by this address's subnet ie
184
+ * the last address prior to the Broadcast Address
185
+ * @returns {Address6}
186
+ */
187
+ endAddressExclusive(): Address6;
188
+ /**
189
+ * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a
190
+ * `/64`. Returns an `Address6`; call `.correctForm()` for the string.
191
+ * @returns {Address6}
192
+ */
193
+ subnetMaskAddress(): Address6;
194
+ /**
195
+ * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a
196
+ * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns
197
+ * an `Address6`; call `.correctForm()` for the string.
198
+ * @returns {Address6}
199
+ */
200
+ wildcardMask(): Address6;
201
+ /**
202
+ * The network address in CIDR string form, e.g. `2001:db8::/32` for
203
+ * `2001:db8::1/32`. For an address with no explicit subnet the prefix
204
+ * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns
205
+ * `2001:db8::1/128`.
206
+ * @returns {string}
207
+ */
208
+ networkForm(): string;
209
+ /**
210
+ * Return the scope of the address. The 4-bit scope field
211
+ * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))
212
+ * is only defined for multicast addresses; for unicast addresses the scope
213
+ * is derived from the address type per
214
+ * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).
215
+ * @returns {String}
216
+ */
217
+ getScope(): string;
218
+ /**
219
+ * Return the type of the address
220
+ * @returns {String}
221
+ */
222
+ getType(): string;
223
+ /**
224
+ * Return the bits in the given range as a BigInt
225
+ * @returns {bigint}
226
+ */
227
+ getBits(start: number, end: number): bigint;
228
+ /**
229
+ * Return the bits in the given range as a base-2 string
230
+ * @returns {String}
231
+ */
232
+ getBitsBase2(start: number, end: number): string;
233
+ /**
234
+ * Return the bits in the given range as a base-16 string
235
+ * @returns {String}
236
+ */
237
+ getBitsBase16(start: number, end: number): string;
238
+ /**
239
+ * Return the bits that are set past the subnet mask length
240
+ * @returns {String}
241
+ */
242
+ getBitsPastSubnet(): string;
243
+ /**
244
+ * Return the reversed ip6.arpa form of the address
245
+ * @param {Object} options
246
+ * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
247
+ * @returns {String}
248
+ */
249
+ reverseForm(options?: common.ReverseFormOptions): string;
250
+ /**
251
+ * Returns the address in correct form, per
252
+ * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros
253
+ * stripped, the longest run of zero groups collapsed to `::`, and hex digits
254
+ * lowercased (e.g. `2001:db8::1`). This is the recommended form for display.
255
+ */
256
+ correctForm(): string;
257
+ /**
258
+ * Return a zero-padded base-2 string representation of the address
259
+ * @returns {String}
260
+ * @example
261
+ * var address = new Address6('2001:4860:4001:803::1011');
262
+ * address.binaryZeroPad();
263
+ * // '0010000000000001010010000110000001000000000000010000100000000011
264
+ * // 0000000000000000000000000000000000000000000000000001000000010001'
265
+ */
266
+ binaryZeroPad(): string;
267
+ /**
268
+ * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the
269
+ * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and
270
+ * returning the address with the v4 portion converted to two v6 groups.
271
+ * Used internally by `parse()`.
272
+ */
273
+ parse4in6(address: string): string;
274
+ /**
275
+ * Parses an IPv6 address string into its 8 hexadecimal groups (expanding
276
+ * any `::` elision and any trailing v4-in-v6 portion) and stores the result
277
+ * on `this.parsedAddress`. Called automatically by the constructor; you
278
+ * typically don't need to call it directly. Throws `AddressError` if the
279
+ * input is malformed.
280
+ */
281
+ parse(address: string): string[];
282
+ /**
283
+ * Returns the canonical (fully expanded) form of the address: all 8 groups,
284
+ * each padded to 4 hex digits, with no `::` collapsing
285
+ * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and
286
+ * byte-exact comparison.
287
+ */
288
+ canonicalForm(): string;
289
+ /**
290
+ * Return the decimal form of the address
291
+ * @returns {String}
292
+ */
293
+ decimal(): string;
294
+ /**
295
+ * Return the address as a BigInt
296
+ * @returns {bigint}
297
+ */
298
+ bigInt(): bigint;
299
+ /**
300
+ * Return the last two groups of this address as an IPv4 address string.
301
+ * If this address carries a CIDR prefix that covers the trailing 32 bits
302
+ * (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the
303
+ * corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to
304
+ * `/32`.
305
+ * @returns {Address4}
306
+ * @example
307
+ * var address = new Address6('2001:4860:4001::1825:bf11');
308
+ * address.to4().correctForm(); // '24.37.191.17'
309
+ */
310
+ to4(): Address4;
311
+ /**
312
+ * Return the v4-in-v6 form of the address
313
+ * @returns {String}
314
+ */
315
+ to4in6(): string;
316
+ /**
317
+ * Decodes the Teredo tunneling fields embedded in this address. Returns the
318
+ * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,
319
+ * UDP port, and Microsoft-format flag breakdown (reserved, universal/local,
320
+ * group/individual, nonce). Only meaningful for addresses in `2001::/32`.
321
+ */
322
+ inspectTeredo(): TeredoProperties;
323
+ /**
324
+ * Decodes the 6to4 tunneling fields embedded in this address. Returns the
325
+ * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for
326
+ * addresses in `2002::/16`.
327
+ */
328
+ inspect6to4(): SixToFourProperties;
329
+ /**
330
+ * Return a v6 6to4 address from a v6 v4inv6 address
331
+ * @returns {Address6}
332
+ */
333
+ to6to4(): Address6 | null;
334
+ /**
335
+ * Embed an IPv4 address into a NAT64 IPv6 address using the encoding
336
+ * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
337
+ * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix
338
+ * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter
339
+ * than /64 the IPv4 octets are split around the reserved bits 64–71.
340
+ * @example
341
+ * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'
342
+ * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'
343
+ */
344
+ static fromAddress4Nat64(address: string, prefix?: string): Address6;
345
+ /**
346
+ * Extract the embedded IPv4 address from a NAT64 IPv6 address using the
347
+ * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
348
+ * The default prefix is the well-known prefix `64:ff9b::/96`. Returns
349
+ * `null` if this address is not contained within the given prefix.
350
+ * @example
351
+ * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'
352
+ */
353
+ toAddress4Nat64(prefix?: string): Address4 | null;
354
+ /**
355
+ * Return a byte array.
356
+ *
357
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.
358
+ * @returns {Array}
359
+ */
360
+ toByteArray(): number[];
361
+ /**
362
+ * Return an unsigned byte array.
363
+ *
364
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.
365
+ * @returns {Array}
366
+ */
367
+ toUnsignedByteArray(): number[];
368
+ /**
369
+ * Convert a byte array to an Address6 object.
370
+ *
371
+ * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an
372
+ * `Int8Array` or a Java `byte[]` holds them), folding signed values to their
373
+ * unsigned equivalent. Throws `AddressError` unless given exactly 16
374
+ * integers from -128 to 255.
375
+ *
376
+ * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
377
+ * @returns {Address6}
378
+ */
379
+ static fromByteArray(bytes: Array<number>): Address6;
380
+ /**
381
+ * Convert an unsigned byte array to an Address6 object.
382
+ *
383
+ * Throws `AddressError` unless given exactly 16 integers from 0 to 255.
384
+ *
385
+ * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
386
+ * @returns {Address6}
387
+ */
388
+ static fromUnsignedByteArray(bytes: Array<number>): Address6;
389
+ /**
390
+ * Returns true if the given address is in the subnet of the current address
391
+ * @returns {boolean}
392
+ */
393
+ isInSubnet: typeof common.isInSubnet;
394
+ /**
395
+ * Returns true if this address's host bits fall inside the given subnet,
396
+ * ignoring this address's own subnet mask. See
397
+ * {@link common.isHostInSubnet}.
398
+ * @returns {boolean}
399
+ */
400
+ isHostInSubnet: typeof common.isHostInSubnet;
401
+ /**
402
+ * Returns true if the address is correct, false otherwise
403
+ * @returns {boolean}
404
+ */
405
+ isCorrect: (this: Address4 | Address6) => boolean;
406
+ /**
407
+ * Returns true if the address is in the canonical form, false otherwise
408
+ * @returns {boolean}
409
+ */
410
+ isCanonical(): boolean;
411
+ /**
412
+ * Returns true if the address is a link local address, false otherwise
413
+ * @returns {boolean}
414
+ */
415
+ isLinkLocal(): boolean;
416
+ /**
417
+ * Returns true if the address is a multicast address, false otherwise
418
+ * @returns {boolean}
419
+ */
420
+ isMulticast(): boolean;
421
+ /**
422
+ * Returns true if the address was written in v4-in-v6 dotted-quad notation
423
+ * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag
424
+ * and does not reflect whether the address bits lie in the IPv4-mapped
425
+ * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}.
426
+ * @returns {boolean}
427
+ */
428
+ is4(): boolean;
429
+ /**
430
+ * Returns true if the address is an IPv4-mapped IPv6 address in
431
+ * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),
432
+ * false otherwise. Unlike {@link is4}, this checks the underlying address
433
+ * bits rather than the textual notation, so `::ffff:127.0.0.1` and
434
+ * `::ffff:7f00:1` both return true.
435
+ * @returns {boolean}
436
+ */
437
+ isMapped4(): boolean;
438
+ /**
439
+ * If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped
440
+ * (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`,
441
+ * [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that
442
+ * embedded address as an {@link Address4}; otherwise return null.
443
+ *
444
+ * The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`,
445
+ * `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and
446
+ * delegate to the embedded {@link Address4} when present, so a literal such as
447
+ * `::ffff:127.0.0.1` is classified by what it actually reaches (loopback)
448
+ * rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped).
449
+ * This matters wherever the checks back a trust-boundary decision (e.g. an
450
+ * SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`,
451
+ * `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as
452
+ * non-internal.
453
+ * @returns {Address4 | null}
454
+ */
455
+ embeddedIPv4(): Address4 | null;
456
+ /**
457
+ * Returns true if the address is a Teredo address, false otherwise
458
+ * @returns {boolean}
459
+ */
460
+ isTeredo(): boolean;
461
+ /**
462
+ * Returns true if the address is a 6to4 address, false otherwise
463
+ * @returns {boolean}
464
+ */
465
+ is6to4(): boolean;
466
+ /**
467
+ * Returns true if the address is a loopback address, false otherwise
468
+ * @returns {boolean}
469
+ */
470
+ isLoopback(): boolean;
471
+ /**
472
+ * 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.
473
+ * @returns {boolean}
474
+ */
475
+ isULA(): boolean;
476
+ /**
477
+ * Returns true if the address is private, i.e. a Unique Local Address in
478
+ * `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)) or an
479
+ * IPv4-mapped / NAT64 address whose embedded IPv4 address is in one of the
480
+ * [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges
481
+ * (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to
482
+ * {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to
483
+ * catch mapped RFC 1918 addresses as well as native ULAs.
484
+ * @returns {boolean}
485
+ */
486
+ isPrivate(): boolean;
487
+ /**
488
+ * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
489
+ * IPv4 address is in the carrier-grade NAT range `100.64.0.0/10`
490
+ * ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false
491
+ * otherwise. There is no native IPv6 CGNAT range, so this only ever returns
492
+ * true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`).
493
+ * @returns {boolean}
494
+ */
495
+ isCGNAT(): boolean;
496
+ /**
497
+ * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
498
+ * IPv4 address is the limited broadcast address `255.255.255.255`
499
+ * ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise.
500
+ * There is no IPv6 broadcast, so this only ever returns true for an embedded
501
+ * IPv4 address (e.g. `::ffff:255.255.255.255`).
502
+ * @returns {boolean}
503
+ */
504
+ isBroadcast(): boolean;
505
+ /**
506
+ * Returns true if the address is the unspecified address `::`.
507
+ * @returns {boolean}
508
+ */
509
+ isUnspecified(): boolean;
510
+ /**
511
+ * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).
512
+ * @returns {boolean}
513
+ */
514
+ isDocumentation(): boolean;
515
+ /**
516
+ * Returns the address as an HTTP URL with the host bracketed, e.g.
517
+ * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,
518
+ * e.g. `http://[2001:db8::1]:8080/`.
519
+ */
520
+ href(optionalPort?: number | string): string;
521
+ /**
522
+ * Returns an HTML `<a>` element whose `href` encodes the address in a URL
523
+ * hash fragment (default prefix `/#address=`). Useful for linking between
524
+ * pages of an address-inspector UI.
525
+ * @param options.className - CSS class for the rendered `<a>` element
526
+ * @param options.prefix - hash prefix prepended to the address (default `/#address=`)
527
+ * @param options.v4 - when true, render the address in v4-in-v6 form
528
+ */
529
+ link(options?: {
530
+ className?: string;
531
+ prefix?: string;
532
+ v4?: boolean;
533
+ }): string;
534
+ /**
535
+ * Groups an address
536
+ * @returns {String}
537
+ */
538
+ group(): string;
539
+ /**
540
+ * Generate a regular expression string that can be used to find or validate
541
+ * all variations of this address
542
+ * @param {boolean} substringSearch
543
+ * @returns {string}
544
+ */
545
+ regularExpressionString(this: Address6, substringSearch?: boolean): string;
546
+ /**
547
+ * Generate a regular expression that can be used to find or validate all
548
+ * variations of this address.
549
+ * @param {boolean} substringSearch
550
+ * @returns {RegExp}
551
+ */
552
+ regularExpression(this: Address6, substringSearch?: boolean): RegExp;
553
+ }
554
+ export {};
tools/ui/node_modules/ip-address/dist/ipv6.js ADDED
@@ -0,0 +1,1344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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. See
102
+ * {@link common.isHostInSubnet}.
103
+ * @returns {boolean}
104
+ */
105
+ this.isHostInSubnet = common.isHostInSubnet;
106
+ /**
107
+ * Returns true if the address is correct, false otherwise
108
+ * @returns {boolean}
109
+ */
110
+ this.isCorrect = isCorrect6;
111
+ if (optionalGroups === undefined) {
112
+ this.groups = constants6.GROUPS;
113
+ }
114
+ else {
115
+ this.groups = optionalGroups;
116
+ }
117
+ this.address = address;
118
+ const subnet = constants6.RE_SUBNET_STRING.exec(address);
119
+ if (subnet) {
120
+ this.parsedSubnet = subnet[0].replace('/', '');
121
+ this.subnetMask = parseInt(this.parsedSubnet, 10);
122
+ this.subnet = `/${this.subnetMask}`;
123
+ if (Number.isNaN(this.subnetMask) ||
124
+ this.subnetMask < 0 ||
125
+ this.subnetMask > constants6.BITS) {
126
+ throw new address_error_1.AddressError('Invalid subnet mask.');
127
+ }
128
+ address = address.replace(constants6.RE_SUBNET_STRING, '');
129
+ }
130
+ // RE_SUBNET_STRING anchors on the end of the address, so it strips only
131
+ // the trailing suffix. A second one left behind (`::/0/1`) is malformed
132
+ // and must be rejected rather than parsed as an address group.
133
+ if (/\//.test(address)) {
134
+ throw new address_error_1.AddressError('Invalid subnet mask.');
135
+ }
136
+ const zone = constants6.RE_ZONE_STRING.exec(address);
137
+ if (zone) {
138
+ this.zone = zone[0];
139
+ address = address.replace(constants6.RE_ZONE_STRING, '');
140
+ }
141
+ this.addressMinusSuffix = address;
142
+ this.parsedAddress = this.parse(this.addressMinusSuffix);
143
+ }
144
+ /**
145
+ * Returns true if the given string is a valid IPv6 address (with optional
146
+ * CIDR subnet and zone identifier), false otherwise. Host bits in the
147
+ * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict
148
+ * network-address validation compare `correctForm()` to
149
+ * `startAddress().correctForm()`, or use `networkForm()`.
150
+ */
151
+ static isValid(address) {
152
+ try {
153
+ // eslint-disable-next-line no-new
154
+ new Address6(address);
155
+ return true;
156
+ }
157
+ catch {
158
+ return false;
159
+ }
160
+ }
161
+ /**
162
+ * Convert a BigInt to a v6 address object. The value must be in the
163
+ * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.
164
+ * @param {bigint} bigInt - a BigInt to convert
165
+ * @returns {Address6}
166
+ * @example
167
+ * var bigInt = BigInt('1000000000000');
168
+ * var address = Address6.fromBigInt(bigInt);
169
+ * address.correctForm(); // '::e8:d4a5:1000'
170
+ */
171
+ static fromBigInt(bigInt) {
172
+ if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) {
173
+ throw new address_error_1.AddressError('IPv6 BigInt must be in the range 0 to 2**128 - 1');
174
+ }
175
+ const hex = bigInt.toString(16).padStart(32, '0');
176
+ const groups = [];
177
+ for (let i = 0; i < constants6.GROUPS; i++) {
178
+ groups.push(hex.slice(i * 4, (i + 1) * 4));
179
+ }
180
+ return new Address6(groups.join(':'));
181
+ }
182
+ /**
183
+ * Parse a URL (with optional bracketed host and port) into an address and
184
+ * port. Returns either `{ address, port }` on success or
185
+ * `{ error, address: null, port: null }` if the URL could not be parsed.
186
+ * Ports are returned as numbers (or `null` if absent or out of range).
187
+ * @example
188
+ * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');
189
+ * addressAndPort.address.correctForm(); // 'ffff::'
190
+ * addressAndPort.port; // 8080
191
+ */
192
+ static fromURL(url) {
193
+ var _a;
194
+ let host;
195
+ let port = null;
196
+ let result;
197
+ // Remove the protocol prefix, if any
198
+ const stripped = url.replace(/^[a-z][a-z0-9+.-]*:\/\//i, '');
199
+ // If we have brackets parse them and find a port
200
+ if (stripped.indexOf('[') !== -1 && stripped.indexOf(']:') !== -1) {
201
+ result = constants6.RE_URL_WITH_PORT.exec(stripped);
202
+ if (result === null) {
203
+ return {
204
+ error: 'failed to parse address with port',
205
+ address: null,
206
+ port: null,
207
+ };
208
+ }
209
+ host = result[1];
210
+ port = result[2];
211
+ }
212
+ else {
213
+ result = constants6.RE_URL.exec(stripped);
214
+ if (result === null) {
215
+ return {
216
+ error: 'failed to parse address from URL',
217
+ address: null,
218
+ port: null,
219
+ };
220
+ }
221
+ host = (_a = result[1]) !== null && _a !== void 0 ? _a : result[2];
222
+ }
223
+ // If there's a port convert it to an integer
224
+ if (port) {
225
+ port = parseInt(port, 10);
226
+ // squelch out of range ports (valid ports are 0-65535)
227
+ if (port < 0 || port > 65535) {
228
+ port = null;
229
+ }
230
+ }
231
+ else {
232
+ // Standardize `undefined` to `null`
233
+ port = null;
234
+ }
235
+ return {
236
+ address: new Address6(host),
237
+ port,
238
+ };
239
+ }
240
+ /**
241
+ * Construct an `Address6` from an address and a hex subnet mask given as
242
+ * separate strings (e.g. as returned by Node's `os.networkInterfaces()`).
243
+ * Throws `AddressError` if the mask is non-contiguous (e.g.
244
+ * `ffff::ffff`).
245
+ * @example
246
+ * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');
247
+ * address.subnetMask; // 64
248
+ */
249
+ static fromAddressAndMask(address, mask) {
250
+ const bits = common.prefixLengthFromMask(new Address6(mask).bigInt(), constants6.BITS);
251
+ return new Address6(`${address}/${bits}`);
252
+ }
253
+ /**
254
+ * Construct an `Address6` from an address and a Cisco-style wildcard mask
255
+ * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).
256
+ * The wildcard mask is the bitwise inverse of the subnet mask. Throws
257
+ * `AddressError` if the mask is non-contiguous.
258
+ * @example
259
+ * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');
260
+ * address.subnetMask; // 64
261
+ */
262
+ static fromAddressAndWildcardMask(address, wildcardMask) {
263
+ const wildcard = new Address6(wildcardMask).bigInt();
264
+ const allOnes = (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1);
265
+ const mask = wildcard ^ allOnes;
266
+ const bits = common.prefixLengthFromMask(mask, constants6.BITS);
267
+ return new Address6(`${address}/${bits}`);
268
+ }
269
+ /**
270
+ * Construct an `Address6` from a wildcard pattern with trailing `*`
271
+ * groups. The number of trailing wildcards determines the prefix
272
+ * length: each `*` represents 16 bits. `::` is expanded to zero groups
273
+ * (not wildcards) before evaluating trailing wildcards.
274
+ *
275
+ * Only trailing whole-group wildcards are supported. Partial-group
276
+ * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.
277
+ * `*::1`) throw `AddressError`.
278
+ * @example
279
+ * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'
280
+ * Address6.fromWildcard('2001:db8::*').subnet; // '/112'
281
+ * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'
282
+ */
283
+ static fromWildcard(input) {
284
+ if (input.includes('%') || input.includes('/')) {
285
+ throw new address_error_1.AddressError('Wildcard pattern must not include a zone or CIDR suffix');
286
+ }
287
+ const halves = input.split('::');
288
+ if (halves.length > 2) {
289
+ throw new address_error_1.AddressError("Wildcard pattern cannot contain more than one '::'");
290
+ }
291
+ let groups;
292
+ if (halves.length === 2) {
293
+ const left = halves[0] === '' ? [] : halves[0].split(':');
294
+ const right = halves[1] === '' ? [] : halves[1].split(':');
295
+ const remaining = constants6.GROUPS - left.length - right.length;
296
+ if (remaining < 1) {
297
+ throw new address_error_1.AddressError("Wildcard pattern with '::' has too many groups");
298
+ }
299
+ groups = [...left, ...new Array(remaining).fill('0'), ...right];
300
+ }
301
+ else {
302
+ groups = input.split(':');
303
+ }
304
+ if (groups.length !== constants6.GROUPS) {
305
+ throw new address_error_1.AddressError('Wildcard pattern must have 8 groups');
306
+ }
307
+ let firstWildcard = -1;
308
+ for (let i = 0; i < groups.length; i++) {
309
+ if (groups[i] === '*') {
310
+ if (firstWildcard === -1) {
311
+ firstWildcard = i;
312
+ }
313
+ }
314
+ else if (firstWildcard !== -1) {
315
+ throw new address_error_1.AddressError('Wildcard `*` must only appear in trailing groups (e.g. `2001:db8:*:*:*:*:*:*`)');
316
+ }
317
+ }
318
+ const trailing = firstWildcard === -1 ? 0 : groups.length - firstWildcard;
319
+ const replaced = groups.map((g) => (g === '*' ? '0' : g));
320
+ const subnetBits = constants6.BITS - trailing * 16;
321
+ return new Address6(`${replaced.join(':')}/${subnetBits}`);
322
+ }
323
+ /**
324
+ * Create an IPv6-mapped address given an IPv4 address
325
+ * @param {string} address - An IPv4 address string
326
+ * @returns {Address6}
327
+ * @example
328
+ * var address = Address6.fromAddress4('192.168.0.1');
329
+ * address.correctForm(); // '::ffff:c0a8:1'
330
+ * address.to4in6(); // '::ffff:192.168.0.1'
331
+ */
332
+ static fromAddress4(address) {
333
+ const address4 = new ipv4_1.Address4(address);
334
+ const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask);
335
+ return new Address6(`::ffff:${address4.correctForm()}/${mask6}`);
336
+ }
337
+ /**
338
+ * Return an address from ip6.arpa form
339
+ * @param {string} arpaFormAddress - an 'ip6.arpa' form address
340
+ * @returns {Adress6}
341
+ * @example
342
+ * 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.)
343
+ * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'
344
+ */
345
+ static fromArpa(arpaFormAddress) {
346
+ // remove ending ".ip6.arpa." or just "."
347
+ let address = arpaFormAddress.replace(/(\.ip6\.arpa)?\.$/, '');
348
+ const semicolonAmount = 7;
349
+ // correct ip6.arpa form with ending removed will be 63 characters
350
+ if (address.length !== 63) {
351
+ throw new address_error_1.AddressError("Invalid 'ip6.arpa' form.");
352
+ }
353
+ const parts = address.split('.').reverse();
354
+ for (let i = semicolonAmount; i > 0; i--) {
355
+ const insertIndex = i * 4;
356
+ parts.splice(insertIndex, 0, ':');
357
+ }
358
+ address = parts.join('');
359
+ return new Address6(address);
360
+ }
361
+ /**
362
+ * Return the Microsoft UNC transcription of the address
363
+ * @returns {String} the Microsoft UNC transcription of the address
364
+ */
365
+ microsoftTranscription() {
366
+ return `${this.correctForm().replace(/:/g, '-')}.ipv6-literal.net`;
367
+ }
368
+ /**
369
+ * Return the first n bits of the address, defaulting to the subnet mask
370
+ * @param {number} [mask=subnet] - the number of bits to mask
371
+ * @returns {String} the first n bits of the address as a string
372
+ */
373
+ mask(mask = this.subnetMask) {
374
+ return this.getBitsBase2(0, mask);
375
+ }
376
+ /**
377
+ * Return the number of possible subnets of a given size in the address
378
+ * @param {number} [subnetSize=128] - the subnet size
379
+ * @returns {String}
380
+ */
381
+ // TODO: probably useful to have a numeric version of this too
382
+ possibleSubnets(subnetSize = 128) {
383
+ const availableBits = constants6.BITS - this.subnetMask;
384
+ const subnetBits = Math.abs(subnetSize - constants6.BITS);
385
+ const subnetPowers = availableBits - subnetBits;
386
+ if (subnetPowers < 0) {
387
+ return '0';
388
+ }
389
+ return addCommas((BigInt('2') ** BigInt(subnetPowers)).toString(10));
390
+ }
391
+ /**
392
+ * Helper function getting start address.
393
+ * @returns {bigint}
394
+ */
395
+ _startAddress() {
396
+ return BigInt(`0b${this.mask() + '0'.repeat(constants6.BITS - this.subnetMask)}`);
397
+ }
398
+ /**
399
+ * The first address in the range given by this address' subnet
400
+ * Often referred to as the Network Address.
401
+ * @returns {Address6}
402
+ */
403
+ startAddress() {
404
+ return Address6.fromBigInt(this._startAddress());
405
+ }
406
+ /**
407
+ * The first host address in the range given by this address's subnet ie
408
+ * the first address after the Network Address
409
+ * @returns {Address6}
410
+ */
411
+ startAddressExclusive() {
412
+ const adjust = BigInt('1');
413
+ return Address6.fromBigInt(this._startAddress() + adjust);
414
+ }
415
+ /**
416
+ * Helper function getting end address.
417
+ * @returns {bigint}
418
+ */
419
+ _endAddress() {
420
+ return BigInt(`0b${this.mask() + '1'.repeat(constants6.BITS - this.subnetMask)}`);
421
+ }
422
+ /**
423
+ * The last address in the range given by this address' subnet
424
+ * Often referred to as the Broadcast
425
+ * @returns {Address6}
426
+ */
427
+ endAddress() {
428
+ return Address6.fromBigInt(this._endAddress());
429
+ }
430
+ /**
431
+ * The last host address in the range given by this address's subnet ie
432
+ * the last address prior to the Broadcast Address
433
+ * @returns {Address6}
434
+ */
435
+ endAddressExclusive() {
436
+ const adjust = BigInt('1');
437
+ return Address6.fromBigInt(this._endAddress() - adjust);
438
+ }
439
+ /**
440
+ * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a
441
+ * `/64`. Returns an `Address6`; call `.correctForm()` for the string.
442
+ * @returns {Address6}
443
+ */
444
+ subnetMaskAddress() {
445
+ return Address6.fromBigInt(BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants6.BITS - this.subnetMask)}`));
446
+ }
447
+ /**
448
+ * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a
449
+ * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns
450
+ * an `Address6`; call `.correctForm()` for the string.
451
+ * @returns {Address6}
452
+ */
453
+ wildcardMask() {
454
+ return Address6.fromBigInt(BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants6.BITS - this.subnetMask)}`));
455
+ }
456
+ /**
457
+ * The network address in CIDR string form, e.g. `2001:db8::/32` for
458
+ * `2001:db8::1/32`. For an address with no explicit subnet the prefix
459
+ * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns
460
+ * `2001:db8::1/128`.
461
+ * @returns {string}
462
+ */
463
+ networkForm() {
464
+ return `${this.startAddress().correctForm()}/${this.subnetMask}`;
465
+ }
466
+ /**
467
+ * Return the scope of the address. The 4-bit scope field
468
+ * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))
469
+ * is only defined for multicast addresses; for unicast addresses the scope
470
+ * is derived from the address type per
471
+ * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).
472
+ * @returns {String}
473
+ */
474
+ getScope() {
475
+ const type = this.getType();
476
+ if (type === 'Multicast' || type.startsWith('Multicast ')) {
477
+ const scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)];
478
+ return scope || 'Unknown';
479
+ }
480
+ // RFC 4291 §2.5.3: the loopback address is treated as having Link-Local
481
+ // scope. (Multicast scope 1, "Interface-Local", is a different concept
482
+ // used only for loopback transmission of multicast.)
483
+ if (type === 'Link-local unicast' || type === 'Loopback') {
484
+ return 'Link local';
485
+ }
486
+ // RFC 4007 §6: the unspecified address has no scope.
487
+ if (type === 'Unspecified') {
488
+ return 'Unknown';
489
+ }
490
+ return 'Global';
491
+ }
492
+ /**
493
+ * Return the type of the address
494
+ * @returns {String}
495
+ */
496
+ getType() {
497
+ for (let i = 0; i < TYPE_SUBNETS.length; i++) {
498
+ const entry = TYPE_SUBNETS[i];
499
+ if (this.isHostInSubnet(entry[0])) {
500
+ return entry[1];
501
+ }
502
+ }
503
+ return 'Global unicast';
504
+ }
505
+ /**
506
+ * Return the bits in the given range as a BigInt
507
+ * @returns {bigint}
508
+ */
509
+ getBits(start, end) {
510
+ return BigInt(`0b${this.getBitsBase2(start, end)}`);
511
+ }
512
+ /**
513
+ * Return the bits in the given range as a base-2 string
514
+ * @returns {String}
515
+ */
516
+ getBitsBase2(start, end) {
517
+ return this.binaryZeroPad().slice(start, end);
518
+ }
519
+ /**
520
+ * Return the bits in the given range as a base-16 string
521
+ * @returns {String}
522
+ */
523
+ getBitsBase16(start, end) {
524
+ const length = end - start;
525
+ if (length % 4 !== 0) {
526
+ throw new Error('Length of bits to retrieve must be divisible by four');
527
+ }
528
+ return this.getBits(start, end)
529
+ .toString(16)
530
+ .padStart(length / 4, '0');
531
+ }
532
+ /**
533
+ * Return the bits that are set past the subnet mask length
534
+ * @returns {String}
535
+ */
536
+ getBitsPastSubnet() {
537
+ return this.getBitsBase2(this.subnetMask, constants6.BITS);
538
+ }
539
+ /**
540
+ * Return the reversed ip6.arpa form of the address
541
+ * @param {Object} options
542
+ * @param {boolean} options.omitSuffix - omit the "ip6.arpa" suffix
543
+ * @returns {String}
544
+ */
545
+ reverseForm(options) {
546
+ if (!options) {
547
+ options = {};
548
+ }
549
+ const characters = Math.floor(this.subnetMask / 4);
550
+ const reversed = this.canonicalForm()
551
+ .replace(/:/g, '')
552
+ .split('')
553
+ .slice(0, characters)
554
+ .reverse()
555
+ .join('.');
556
+ if (characters > 0) {
557
+ if (options.omitSuffix) {
558
+ return reversed;
559
+ }
560
+ return `${reversed}.ip6.arpa.`;
561
+ }
562
+ if (options.omitSuffix) {
563
+ return '';
564
+ }
565
+ return 'ip6.arpa.';
566
+ }
567
+ /**
568
+ * Returns the address in correct form, per
569
+ * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros
570
+ * stripped, the longest run of zero groups collapsed to `::`, and hex digits
571
+ * lowercased (e.g. `2001:db8::1`). This is the recommended form for display.
572
+ */
573
+ correctForm() {
574
+ let i;
575
+ let groups = [];
576
+ let zeroCounter = 0;
577
+ const zeroes = [];
578
+ for (i = 0; i < this.parsedAddress.length; i++) {
579
+ const value = parseInt(this.parsedAddress[i], 16);
580
+ if (value === 0) {
581
+ zeroCounter++;
582
+ }
583
+ if (value !== 0 && zeroCounter > 0) {
584
+ if (zeroCounter > 1) {
585
+ zeroes.push([i - zeroCounter, i - 1]);
586
+ }
587
+ zeroCounter = 0;
588
+ }
589
+ }
590
+ // Do we end with a string of zeroes?
591
+ if (zeroCounter > 1) {
592
+ zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]);
593
+ }
594
+ const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1);
595
+ if (zeroes.length > 0) {
596
+ const index = zeroLengths.indexOf(Math.max(...zeroLengths));
597
+ groups = compact(this.parsedAddress, zeroes[index]);
598
+ }
599
+ else {
600
+ groups = this.parsedAddress;
601
+ }
602
+ for (i = 0; i < groups.length; i++) {
603
+ if (groups[i] !== 'compact') {
604
+ groups[i] = parseInt(groups[i], 16).toString(16);
605
+ }
606
+ }
607
+ let correct = groups.join(':');
608
+ correct = correct.replace(/^compact$/, '::');
609
+ correct = correct.replace(/(^compact)|(compact$)/, ':');
610
+ correct = correct.replace(/compact/, '');
611
+ return correct;
612
+ }
613
+ /**
614
+ * Return a zero-padded base-2 string representation of the address
615
+ * @returns {String}
616
+ * @example
617
+ * var address = new Address6('2001:4860:4001:803::1011');
618
+ * address.binaryZeroPad();
619
+ * // '0010000000000001010010000110000001000000000000010000100000000011
620
+ * // 0000000000000000000000000000000000000000000000000001000000010001'
621
+ */
622
+ binaryZeroPad() {
623
+ if (this._binaryZeroPad === undefined) {
624
+ this._binaryZeroPad = this.bigInt().toString(2).padStart(constants6.BITS, '0');
625
+ }
626
+ return this._binaryZeroPad;
627
+ }
628
+ /**
629
+ * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the
630
+ * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and
631
+ * returning the address with the v4 portion converted to two v6 groups.
632
+ * Used internally by `parse()`.
633
+ */
634
+ // TODO: Improve the semantics of this helper function
635
+ parse4in6(address) {
636
+ if (address.indexOf('.') === -1) {
637
+ return address;
638
+ }
639
+ const groups = address.split(':');
640
+ const lastGroup = groups.slice(-1)[0];
641
+ // RE_ADDRESS rejects octets with a leading zero, so a dotted-quad tail is
642
+ // matched permissively first: that way this notation still gets its own
643
+ // message with the offending octet highlighted, rather than falling
644
+ // through as an unrecognized group.
645
+ const v4Octets = lastGroup.split('.');
646
+ if (v4Octets.length === constants4.GROUPS &&
647
+ v4Octets.every((octet) => /^\d{1,3}$/.test(octet))) {
648
+ if (v4Octets.some((octet) => /^0\d/.test(octet))) {
649
+ // The prefix groups haven't been through the bad-character check
650
+ // yet, so escape them before including in the error HTML.
651
+ const highlighted = v4Octets.map(spanLeadingZeroes4).join('.');
652
+ const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(':');
653
+ const separator = groups.length > 1 ? ':' : '';
654
+ throw new address_error_1.AddressError("IPv4 addresses can't have leading zeroes.", `${prefix}${separator}${highlighted}`);
655
+ }
656
+ }
657
+ const address4 = lastGroup.match(constants4.RE_ADDRESS);
658
+ if (address4) {
659
+ this.parsedAddress4 = address4[0];
660
+ const v4Suffix = this.subnetMask >= 96 ? `/${this.subnetMask - 96}` : '';
661
+ this.address4 = new ipv4_1.Address4(`${this.parsedAddress4}${v4Suffix}`);
662
+ this.v4 = true;
663
+ groups[groups.length - 1] = this.address4.toGroup6();
664
+ address = groups.join(':');
665
+ }
666
+ return address;
667
+ }
668
+ /**
669
+ * Parses an IPv6 address string into its 8 hexadecimal groups (expanding
670
+ * any `::` elision and any trailing v4-in-v6 portion) and stores the result
671
+ * on `this.parsedAddress`. Called automatically by the constructor; you
672
+ * typically don't need to call it directly. Throws `AddressError` if the
673
+ * input is malformed.
674
+ */
675
+ // TODO: Make private?
676
+ parse(address) {
677
+ address = this.parse4in6(address);
678
+ const badCharacters = address.match(constants6.RE_BAD_CHARACTERS);
679
+ if (badCharacters) {
680
+ 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>'));
681
+ }
682
+ const badAddress = address.match(constants6.RE_BAD_ADDRESS);
683
+ if (badAddress) {
684
+ throw new address_error_1.AddressError(`Address failed regex: ${badAddress.join('')}`, address.replace(constants6.RE_BAD_ADDRESS, '<span class="parse-error">$1</span>'));
685
+ }
686
+ let groups = [];
687
+ const halves = address.split('::');
688
+ if (halves.length === 2) {
689
+ let first = halves[0].split(':');
690
+ let last = halves[1].split(':');
691
+ if (first.length === 1 && first[0] === '') {
692
+ first = [];
693
+ }
694
+ if (last.length === 1 && last[0] === '') {
695
+ last = [];
696
+ }
697
+ const remaining = this.groups - (first.length + last.length);
698
+ if (!remaining) {
699
+ throw new address_error_1.AddressError('Error parsing groups');
700
+ }
701
+ this.elidedGroups = remaining;
702
+ this.elisionBegin = first.length;
703
+ this.elisionEnd = first.length + this.elidedGroups;
704
+ groups = groups.concat(first);
705
+ for (let i = 0; i < remaining; i++) {
706
+ groups.push('0');
707
+ }
708
+ groups = groups.concat(last);
709
+ }
710
+ else if (halves.length === 1) {
711
+ groups = address.split(':');
712
+ this.elidedGroups = 0;
713
+ }
714
+ else {
715
+ throw new address_error_1.AddressError('Too many :: groups found');
716
+ }
717
+ groups = groups.map((group) => parseInt(group, 16).toString(16));
718
+ if (groups.length !== this.groups) {
719
+ throw new address_error_1.AddressError('Incorrect number of groups found');
720
+ }
721
+ return groups;
722
+ }
723
+ /**
724
+ * Returns the canonical (fully expanded) form of the address: all 8 groups,
725
+ * each padded to 4 hex digits, with no `::` collapsing
726
+ * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and
727
+ * byte-exact comparison.
728
+ */
729
+ canonicalForm() {
730
+ return this.parsedAddress.map(paddedHex).join(':');
731
+ }
732
+ /**
733
+ * Return the decimal form of the address
734
+ * @returns {String}
735
+ */
736
+ decimal() {
737
+ return this.parsedAddress.map((n) => parseInt(n, 16).toString(10).padStart(5, '0')).join(':');
738
+ }
739
+ /**
740
+ * Return the address as a BigInt
741
+ * @returns {bigint}
742
+ */
743
+ bigInt() {
744
+ return BigInt(`0x${this.parsedAddress.map(paddedHex).join('')}`);
745
+ }
746
+ /**
747
+ * Return the last two groups of this address as an IPv4 address string.
748
+ * If this address carries a CIDR prefix that covers the trailing 32 bits
749
+ * (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the
750
+ * corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to
751
+ * `/32`.
752
+ * @returns {Address4}
753
+ * @example
754
+ * var address = new Address6('2001:4860:4001::1825:bf11');
755
+ * address.to4().correctForm(); // '24.37.191.17'
756
+ */
757
+ to4() {
758
+ const binary = this.binaryZeroPad().split('');
759
+ const hex = BigInt(`0b${binary.slice(96, 128).join('')}`)
760
+ .toString(16)
761
+ .padStart(8, '0');
762
+ if (this.subnetMask >= 96) {
763
+ const v4Mask = this.subnetMask - 96;
764
+ const groups = [];
765
+ for (let i = 0; i < 8; i += 2) {
766
+ groups.push(parseInt(hex.slice(i, i + 2), 16));
767
+ }
768
+ return new ipv4_1.Address4(`${groups.join('.')}/${v4Mask}`);
769
+ }
770
+ return ipv4_1.Address4.fromHex(hex);
771
+ }
772
+ /**
773
+ * Return the v4-in-v6 form of the address
774
+ * @returns {String}
775
+ */
776
+ to4in6() {
777
+ const address4 = this.to4();
778
+ const address6 = new Address6(this.parsedAddress.slice(0, 6).join(':'), 6);
779
+ const correct = address6.correctForm();
780
+ let infix = '';
781
+ if (!/:$/.test(correct)) {
782
+ infix = ':';
783
+ }
784
+ return correct + infix + address4.correctForm();
785
+ }
786
+ /**
787
+ * Decodes the Teredo tunneling fields embedded in this address. Returns the
788
+ * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,
789
+ * UDP port, and Microsoft-format flag breakdown (reserved, universal/local,
790
+ * group/individual, nonce). Only meaningful for addresses in `2001::/32`.
791
+ */
792
+ inspectTeredo() {
793
+ /*
794
+ - Bits 0 to 31 are set to the Teredo prefix (normally 2001:0000::/32).
795
+ - Bits 32 to 63 embed the primary IPv4 address of the Teredo server that
796
+ is used.
797
+ - Bits 64 to 79 can be used to define some flags. Currently only the
798
+ higher order bit is used; it is set to 1 if the Teredo client is
799
+ located behind a cone NAT, 0 otherwise. For Microsoft's Windows Vista
800
+ and Windows Server 2008 implementations, more bits are used. In those
801
+ implementations, the format for these 16 bits is "CRAAAAUG AAAAAAAA",
802
+ where "C" remains the "Cone" flag. The "R" bit is reserved for future
803
+ use. The "U" bit is for the Universal/Local flag (set to 0). The "G" bit
804
+ is Individual/Group flag (set to 0). The A bits are set to a 12-bit
805
+ randomly generated number chosen by the Teredo client to introduce
806
+ additional protection for the Teredo node against IPv6-based scanning
807
+ attacks.
808
+ - Bits 80 to 95 contains the obfuscated UDP port number. This is the
809
+ port number that is mapped by the NAT to the Teredo client with all
810
+ bits inverted.
811
+ - Bits 96 to 127 contains the obfuscated IPv4 address. This is the
812
+ public IPv4 address of the NAT with all bits inverted.
813
+ */
814
+ const prefix = this.getBitsBase16(0, 32);
815
+ const bitsForUdpPort = this.getBits(80, 96);
816
+ const udpPort = (bitsForUdpPort ^ BigInt('0xffff')).toString();
817
+ const server4 = ipv4_1.Address4.fromHex(this.getBitsBase16(32, 64));
818
+ const bitsForClient4 = this.getBits(96, 128);
819
+ const client4 = ipv4_1.Address4.fromHex((bitsForClient4 ^ BigInt('0xffffffff')).toString(16).padStart(8, '0'));
820
+ const flagsBase2 = this.getBitsBase2(64, 80);
821
+ const coneNat = (0, common_1.testBit)(flagsBase2, 15);
822
+ const reserved = (0, common_1.testBit)(flagsBase2, 14);
823
+ const groupIndividual = (0, common_1.testBit)(flagsBase2, 8);
824
+ const universalLocal = (0, common_1.testBit)(flagsBase2, 9);
825
+ const nonce = BigInt(`0b${flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16)}`).toString(10);
826
+ return {
827
+ prefix: `${prefix.slice(0, 4)}:${prefix.slice(4, 8)}`,
828
+ server4: server4.address,
829
+ client4: client4.address,
830
+ flags: flagsBase2,
831
+ coneNat,
832
+ microsoft: {
833
+ reserved,
834
+ universalLocal,
835
+ groupIndividual,
836
+ nonce,
837
+ },
838
+ udpPort,
839
+ };
840
+ }
841
+ /**
842
+ * Decodes the 6to4 tunneling fields embedded in this address. Returns the
843
+ * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for
844
+ * addresses in `2002::/16`.
845
+ */
846
+ inspect6to4() {
847
+ /*
848
+ - Bits 0 to 15 are set to the 6to4 prefix (2002::/16).
849
+ - Bits 16 to 48 embed the IPv4 address of the 6to4 gateway that is used.
850
+ */
851
+ const prefix = this.getBitsBase16(0, 16);
852
+ const gateway = ipv4_1.Address4.fromHex(this.getBitsBase16(16, 48));
853
+ return {
854
+ prefix: prefix.slice(0, 4),
855
+ gateway: gateway.address,
856
+ };
857
+ }
858
+ /**
859
+ * Return a v6 6to4 address from a v6 v4inv6 address
860
+ * @returns {Address6}
861
+ */
862
+ to6to4() {
863
+ if (!this.is4()) {
864
+ return null;
865
+ }
866
+ const addr6to4 = [
867
+ '2002',
868
+ this.getBitsBase16(96, 112),
869
+ this.getBitsBase16(112, 128),
870
+ '',
871
+ '/16',
872
+ ].join(':');
873
+ return new Address6(addr6to4);
874
+ }
875
+ /**
876
+ * Embed an IPv4 address into a NAT64 IPv6 address using the encoding
877
+ * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
878
+ * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix
879
+ * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter
880
+ * than /64 the IPv4 octets are split around the reserved bits 64–71.
881
+ * @example
882
+ * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'
883
+ * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'
884
+ */
885
+ static fromAddress4Nat64(address, prefix = '64:ff9b::/96') {
886
+ const v4 = new ipv4_1.Address4(address);
887
+ const prefix6 = new Address6(prefix);
888
+ const pl = prefix6.subnetMask;
889
+ if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {
890
+ throw new address_error_1.AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');
891
+ }
892
+ const prefixBits = prefix6.binaryZeroPad();
893
+ const v4Bits = v4.binaryZeroPad();
894
+ let bits;
895
+ if (pl === 96) {
896
+ bits = prefixBits.slice(0, 96) + v4Bits;
897
+ }
898
+ else {
899
+ const beforeU = 64 - pl;
900
+ bits = [
901
+ prefixBits.slice(0, pl),
902
+ v4Bits.slice(0, beforeU),
903
+ // Bits 64 to 71 are the reserved u octet and are always zero.
904
+ '00000000',
905
+ v4Bits.slice(beforeU),
906
+ '0'.repeat(128 - 72 - (32 - beforeU)),
907
+ ].join('');
908
+ }
909
+ const hex = BigInt(`0b${bits}`).toString(16).padStart(32, '0');
910
+ const groups = [];
911
+ for (let i = 0; i < 8; i++) {
912
+ groups.push(hex.slice(i * 4, (i + 1) * 4));
913
+ }
914
+ return new Address6(groups.join(':'));
915
+ }
916
+ /**
917
+ * Extract the embedded IPv4 address from a NAT64 IPv6 address using the
918
+ * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).
919
+ * The default prefix is the well-known prefix `64:ff9b::/96`. Returns
920
+ * `null` if this address is not contained within the given prefix.
921
+ * @example
922
+ * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'
923
+ */
924
+ toAddress4Nat64(prefix = '64:ff9b::/96') {
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
+ if (!this.isHostInSubnet(prefix6)) {
931
+ return null;
932
+ }
933
+ const bits = this.binaryZeroPad();
934
+ let v4Bits;
935
+ if (pl === 96) {
936
+ v4Bits = bits.slice(96, 128);
937
+ }
938
+ else {
939
+ const beforeU = 64 - pl;
940
+ v4Bits = bits.slice(pl, pl + beforeU) + bits.slice(72, 72 + (32 - beforeU));
941
+ }
942
+ const octets = [];
943
+ for (let i = 0; i < 4; i++) {
944
+ octets.push(parseInt(v4Bits.slice(i * 8, (i + 1) * 8), 2).toString());
945
+ }
946
+ return new ipv4_1.Address4(octets.join('.'));
947
+ }
948
+ /**
949
+ * Return a byte array.
950
+ *
951
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.
952
+ * @returns {Array}
953
+ */
954
+ toByteArray() {
955
+ const value = this.bigInt()
956
+ .toString(16)
957
+ .padStart(constants6.BITS / 4, '0');
958
+ const bytes = [];
959
+ for (let i = 0, length = value.length; i < length; i += 2) {
960
+ bytes.push(parseInt(value.substring(i, i + 2), 16));
961
+ }
962
+ return bytes;
963
+ }
964
+ /**
965
+ * Return an unsigned byte array.
966
+ *
967
+ * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.
968
+ * @returns {Array}
969
+ */
970
+ toUnsignedByteArray() {
971
+ // toByteArray() emits 0 to 255, so unsigning it is an identity mapping and
972
+ // the two methods return equal arrays. 11.0.0 keeps one of them and makes
973
+ // this a deprecated alias; test/common-test.ts fails at that version.
974
+ return this.toByteArray().map(unsignByte);
975
+ }
976
+ /**
977
+ * Convert a byte array to an Address6 object.
978
+ *
979
+ * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an
980
+ * `Int8Array` or a Java `byte[]` holds them), folding signed values to their
981
+ * unsigned equivalent. Throws `AddressError` unless given exactly 16
982
+ * integers from -128 to 255.
983
+ *
984
+ * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
985
+ * @returns {Address6}
986
+ */
987
+ static fromByteArray(bytes) {
988
+ // Address4.fromByteArray takes unsigned bytes only. 11.0.0 aligns this
989
+ // method with it, at which point the -128 floor here, unsignByte, and the
990
+ // mapping below all go; test/common-test.ts fails at that version.
991
+ common.assertByteArray(bytes, 16, 'IPv6', -128);
992
+ return this.fromUnsignedByteArray(bytes.map(unsignByte));
993
+ }
994
+ /**
995
+ * Convert an unsigned byte array to an Address6 object.
996
+ *
997
+ * Throws `AddressError` unless given exactly 16 integers from 0 to 255.
998
+ *
999
+ * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
1000
+ * @returns {Address6}
1001
+ */
1002
+ static fromUnsignedByteArray(bytes) {
1003
+ common.assertByteArray(bytes, 16, 'IPv6', 0);
1004
+ const BYTE_MAX = BigInt('256');
1005
+ let result = BigInt('0');
1006
+ let multiplier = BigInt('1');
1007
+ for (let i = bytes.length - 1; i >= 0; i--) {
1008
+ result += multiplier * BigInt(bytes[i].toString(10));
1009
+ multiplier *= BYTE_MAX;
1010
+ }
1011
+ return Address6.fromBigInt(result);
1012
+ }
1013
+ /**
1014
+ * Returns true if the address is in the canonical form, false otherwise
1015
+ * @returns {boolean}
1016
+ */
1017
+ isCanonical() {
1018
+ return this.addressMinusSuffix === this.canonicalForm();
1019
+ }
1020
+ /**
1021
+ * Returns true if the address is a link local address, false otherwise
1022
+ * @returns {boolean}
1023
+ */
1024
+ isLinkLocal() {
1025
+ const embedded = this.embeddedIPv4();
1026
+ if (embedded) {
1027
+ return embedded.isLinkLocal();
1028
+ }
1029
+ // Zeroes are required, i.e. we can't check isHostInSubnet with 'fe80::/10'
1030
+ if (this.getBitsBase2(0, 64) ===
1031
+ '1111111010000000000000000000000000000000000000000000000000000000') {
1032
+ return true;
1033
+ }
1034
+ return false;
1035
+ }
1036
+ /**
1037
+ * Returns true if the address is a multicast address, false otherwise
1038
+ * @returns {boolean}
1039
+ */
1040
+ isMulticast() {
1041
+ const embedded = this.embeddedIPv4();
1042
+ if (embedded) {
1043
+ return embedded.isMulticast();
1044
+ }
1045
+ const type = this.getType();
1046
+ return type === 'Multicast' || type.startsWith('Multicast ');
1047
+ }
1048
+ /**
1049
+ * Returns true if the address was written in v4-in-v6 dotted-quad notation
1050
+ * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag
1051
+ * and does not reflect whether the address bits lie in the IPv4-mapped
1052
+ * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}.
1053
+ * @returns {boolean}
1054
+ */
1055
+ is4() {
1056
+ return this.v4;
1057
+ }
1058
+ /**
1059
+ * Returns true if the address is an IPv4-mapped IPv6 address in
1060
+ * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),
1061
+ * false otherwise. Unlike {@link is4}, this checks the underlying address
1062
+ * bits rather than the textual notation, so `::ffff:127.0.0.1` and
1063
+ * `::ffff:7f00:1` both return true.
1064
+ * @returns {boolean}
1065
+ */
1066
+ isMapped4() {
1067
+ return this.isHostInSubnet(IPV4_MAPPED_SUBNET);
1068
+ }
1069
+ /**
1070
+ * If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped
1071
+ * (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`,
1072
+ * [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that
1073
+ * embedded address as an {@link Address4}; otherwise return null.
1074
+ *
1075
+ * The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`,
1076
+ * `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and
1077
+ * delegate to the embedded {@link Address4} when present, so a literal such as
1078
+ * `::ffff:127.0.0.1` is classified by what it actually reaches (loopback)
1079
+ * rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped).
1080
+ * This matters wherever the checks back a trust-boundary decision (e.g. an
1081
+ * SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`,
1082
+ * `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as
1083
+ * non-internal.
1084
+ * @returns {Address4 | null}
1085
+ */
1086
+ embeddedIPv4() {
1087
+ if (this.isMapped4() || this.isHostInSubnet(NAT64_WELL_KNOWN_SUBNET)) {
1088
+ return this.to4();
1089
+ }
1090
+ return null;
1091
+ }
1092
+ /**
1093
+ * Returns true if the address is a Teredo address, false otherwise
1094
+ * @returns {boolean}
1095
+ */
1096
+ isTeredo() {
1097
+ return this.isHostInSubnet(TEREDO_SUBNET);
1098
+ }
1099
+ /**
1100
+ * Returns true if the address is a 6to4 address, false otherwise
1101
+ * @returns {boolean}
1102
+ */
1103
+ is6to4() {
1104
+ return this.isHostInSubnet(SIX_TO_FOUR_SUBNET);
1105
+ }
1106
+ /**
1107
+ * Returns true if the address is a loopback address, false otherwise
1108
+ * @returns {boolean}
1109
+ */
1110
+ isLoopback() {
1111
+ const embedded = this.embeddedIPv4();
1112
+ if (embedded) {
1113
+ return embedded.isLoopback();
1114
+ }
1115
+ return this.getType() === 'Loopback';
1116
+ }
1117
+ /**
1118
+ * 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.
1119
+ * @returns {boolean}
1120
+ */
1121
+ isULA() {
1122
+ return this.isHostInSubnet(ULA_SUBNET);
1123
+ }
1124
+ /**
1125
+ * Returns true if the address is private, i.e. a Unique Local Address in
1126
+ * `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)) or an
1127
+ * IPv4-mapped / NAT64 address whose embedded IPv4 address is in one of the
1128
+ * [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges
1129
+ * (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to
1130
+ * {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to
1131
+ * catch mapped RFC 1918 addresses as well as native ULAs.
1132
+ * @returns {boolean}
1133
+ */
1134
+ isPrivate() {
1135
+ const embedded = this.embeddedIPv4();
1136
+ if (embedded) {
1137
+ return embedded.isPrivate();
1138
+ }
1139
+ return this.isULA();
1140
+ }
1141
+ /**
1142
+ * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
1143
+ * IPv4 address is in the carrier-grade NAT range `100.64.0.0/10`
1144
+ * ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false
1145
+ * otherwise. There is no native IPv6 CGNAT range, so this only ever returns
1146
+ * true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`).
1147
+ * @returns {boolean}
1148
+ */
1149
+ isCGNAT() {
1150
+ const embedded = this.embeddedIPv4();
1151
+ if (embedded) {
1152
+ return embedded.isCGNAT();
1153
+ }
1154
+ return false;
1155
+ }
1156
+ /**
1157
+ * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded
1158
+ * IPv4 address is the limited broadcast address `255.255.255.255`
1159
+ * ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise.
1160
+ * There is no IPv6 broadcast, so this only ever returns true for an embedded
1161
+ * IPv4 address (e.g. `::ffff:255.255.255.255`).
1162
+ * @returns {boolean}
1163
+ */
1164
+ isBroadcast() {
1165
+ const embedded = this.embeddedIPv4();
1166
+ if (embedded) {
1167
+ return embedded.isBroadcast();
1168
+ }
1169
+ return false;
1170
+ }
1171
+ /**
1172
+ * Returns true if the address is the unspecified address `::`.
1173
+ * @returns {boolean}
1174
+ */
1175
+ isUnspecified() {
1176
+ const embedded = this.embeddedIPv4();
1177
+ if (embedded) {
1178
+ return embedded.isUnspecified();
1179
+ }
1180
+ return this.getType() === 'Unspecified';
1181
+ }
1182
+ /**
1183
+ * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).
1184
+ * @returns {boolean}
1185
+ */
1186
+ isDocumentation() {
1187
+ return this.isHostInSubnet(DOCUMENTATION_SUBNET);
1188
+ }
1189
+ // #endregion
1190
+ // #region HTML
1191
+ /**
1192
+ * Returns the address as an HTTP URL with the host bracketed, e.g.
1193
+ * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,
1194
+ * e.g. `http://[2001:db8::1]:8080/`.
1195
+ */
1196
+ href(optionalPort) {
1197
+ if (optionalPort === undefined) {
1198
+ optionalPort = '';
1199
+ }
1200
+ else {
1201
+ optionalPort = `:${optionalPort}`;
1202
+ }
1203
+ return `http://[${this.correctForm()}]${optionalPort}/`;
1204
+ }
1205
+ /**
1206
+ * Returns an HTML `<a>` element whose `href` encodes the address in a URL
1207
+ * hash fragment (default prefix `/#address=`). Useful for linking between
1208
+ * pages of an address-inspector UI.
1209
+ * @param options.className - CSS class for the rendered `<a>` element
1210
+ * @param options.prefix - hash prefix prepended to the address (default `/#address=`)
1211
+ * @param options.v4 - when true, render the address in v4-in-v6 form
1212
+ */
1213
+ link(options) {
1214
+ if (!options) {
1215
+ options = {};
1216
+ }
1217
+ if (options.className === undefined) {
1218
+ options.className = '';
1219
+ }
1220
+ if (options.prefix === undefined) {
1221
+ options.prefix = '/#address=';
1222
+ }
1223
+ if (options.v4 === undefined) {
1224
+ options.v4 = false;
1225
+ }
1226
+ let formFunction = this.correctForm;
1227
+ if (options.v4) {
1228
+ formFunction = this.to4in6;
1229
+ }
1230
+ const form = formFunction.call(this);
1231
+ const safeHref = helpers.escapeHtml(`${options.prefix}${form}`);
1232
+ const safeForm = helpers.escapeHtml(form);
1233
+ if (options.className) {
1234
+ const safeClass = helpers.escapeHtml(options.className);
1235
+ return `<a href="${safeHref}" class="${safeClass}">${safeForm}</a>`;
1236
+ }
1237
+ return `<a href="${safeHref}">${safeForm}</a>`;
1238
+ }
1239
+ /**
1240
+ * Groups an address
1241
+ * @returns {String}
1242
+ */
1243
+ group() {
1244
+ if (this.elidedGroups === 0) {
1245
+ // The simple case
1246
+ return helpers.simpleGroup(this.addressMinusSuffix).join(':');
1247
+ }
1248
+ assert(typeof this.elidedGroups === 'number');
1249
+ assert(typeof this.elisionBegin === 'number');
1250
+ // The elided case
1251
+ const output = [];
1252
+ const [left, right] = this.addressMinusSuffix.split('::');
1253
+ if (left.length) {
1254
+ output.push(...helpers.simpleGroup(left));
1255
+ }
1256
+ else {
1257
+ output.push('');
1258
+ }
1259
+ const classes = ['hover-group'];
1260
+ for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) {
1261
+ classes.push(`group-${i}`);
1262
+ }
1263
+ output.push(`<span class="${classes.join(' ')}"></span>`);
1264
+ if (right.length) {
1265
+ output.push(...helpers.simpleGroup(right, this.elisionEnd));
1266
+ }
1267
+ else {
1268
+ output.push('');
1269
+ }
1270
+ if (this.is4()) {
1271
+ assert(this.address4 instanceof ipv4_1.Address4);
1272
+ output.pop();
1273
+ output.push(this.address4.groupForV6());
1274
+ }
1275
+ return output.join(':');
1276
+ }
1277
+ // #endregion
1278
+ // #region Regular expressions
1279
+ /**
1280
+ * Generate a regular expression string that can be used to find or validate
1281
+ * all variations of this address
1282
+ * @param {boolean} substringSearch
1283
+ * @returns {string}
1284
+ */
1285
+ regularExpressionString(substringSearch = false) {
1286
+ let output = [];
1287
+ // TODO: revisit why this is necessary
1288
+ const address6 = new Address6(this.correctForm());
1289
+ if (address6.elidedGroups === 0) {
1290
+ // The simple case
1291
+ output.push((0, regular_expressions_1.simpleRegularExpression)(address6.parsedAddress));
1292
+ }
1293
+ else if (address6.elidedGroups === constants6.GROUPS) {
1294
+ // A completely elided address
1295
+ output.push((0, regular_expressions_1.possibleElisions)(constants6.GROUPS));
1296
+ }
1297
+ else {
1298
+ // A partially elided address
1299
+ const halves = address6.address.split('::');
1300
+ if (halves[0].length) {
1301
+ output.push((0, regular_expressions_1.simpleRegularExpression)(halves[0].split(':')));
1302
+ }
1303
+ assert(typeof address6.elidedGroups === 'number');
1304
+ output.push((0, regular_expressions_1.possibleElisions)(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0));
1305
+ if (halves[1].length) {
1306
+ output.push((0, regular_expressions_1.simpleRegularExpression)(halves[1].split(':')));
1307
+ }
1308
+ output = [output.join(':')];
1309
+ }
1310
+ if (!substringSearch) {
1311
+ output = [
1312
+ '(?=^|',
1313
+ regular_expressions_1.ADDRESS_BOUNDARY,
1314
+ '|[^\\w\\:])(',
1315
+ ...output,
1316
+ ')(?=[^\\w\\:]|',
1317
+ regular_expressions_1.ADDRESS_BOUNDARY,
1318
+ '|$)',
1319
+ ];
1320
+ }
1321
+ return output.join('');
1322
+ }
1323
+ /**
1324
+ * Generate a regular expression that can be used to find or validate all
1325
+ * variations of this address.
1326
+ * @param {boolean} substringSearch
1327
+ * @returns {RegExp}
1328
+ */
1329
+ regularExpression(substringSearch = false) {
1330
+ return new RegExp(this.regularExpressionString(substringSearch), 'i');
1331
+ }
1332
+ }
1333
+ exports.Address6 = Address6;
1334
+ const TYPE_SUBNETS = Object.keys(constants6.TYPES).map((subnet) => [
1335
+ new Address6(subnet),
1336
+ constants6.TYPES[subnet],
1337
+ ]);
1338
+ const TEREDO_SUBNET = new Address6('2001::/32');
1339
+ const SIX_TO_FOUR_SUBNET = new Address6('2002::/16');
1340
+ const ULA_SUBNET = new Address6('fc00::/7');
1341
+ const DOCUMENTATION_SUBNET = new Address6('2001:db8::/32');
1342
+ const IPV4_MAPPED_SUBNET = new Address6('::ffff:0:0/96');
1343
+ const NAT64_WELL_KNOWN_SUBNET = new Address6('64:ff9b::/96');
1344
+ //# sourceMappingURL=ipv6.js.map
tools/ui/node_modules/ip-address/dist/ipv6.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"ipv6.js","sourceRoot":"","sources":["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;YACrB,MAAM,GAAG;gBACP,OAAO;gBACP,sCAAgB;gBAChB,cAAc;gBACd,GAAG,MAAM;gBACT,gBAAgB;gBAChB,sCAAgB;gBAChB,KAAK;aACN,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,iBAAiB,CAAiB,kBAA2B,KAAK;QAChE,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,uBAAuB,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC,CAAC;IACxE,CAAC;CAEF;AAt+CD,4BAs+CC;AAED,MAAM,YAAY,GAA8B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC5F,IAAI,QAAQ,CAAC,MAAM,CAAC;IACpB,UAAU,CAAC,KAAK,CAAC,MAAM,CAAW;CACnC,CAAC,CAAC;AACH,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;AAChD,MAAM,kBAAkB,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;AACrD,MAAM,UAAU,GAAG,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC5C,MAAM,oBAAoB,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC;AAC3D,MAAM,kBAAkB,GAAG,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC;AACzD,MAAM,uBAAuB,GAAG,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable prefer-destructuring */\n/* eslint-disable no-param-reassign */\n\nimport * as common from './common';\nimport * as constants4 from './v4/constants';\nimport * as constants6 from './v6/constants';\nimport * as helpers from './v6/helpers';\nimport { Address4 } from './ipv4';\nimport {\n ADDRESS_BOUNDARY,\n possibleElisions,\n simpleRegularExpression,\n} from './v6/regular-expressions';\nimport { AddressError } from './address-error';\nimport { testBit } from './common';\n\nconst isCorrect6 = common.isCorrect(constants6.BITS);\n\nfunction assert(condition: any): asserts condition {\n if (!condition) {\n throw new Error('Assertion failed.');\n }\n}\n\nfunction addCommas(number: string): string {\n const r = /(\\d+)(\\d{3})/;\n\n while (r.test(number)) {\n number = number.replace(r, '$1,$2');\n }\n\n return number;\n}\n\nfunction spanLeadingZeroes4(n: string): string {\n n = n.replace(/^(0{1,})([1-9]+)$/, '<span class=\"parse-error\">$1</span>$2');\n n = n.replace(/^(0{1,})(0)$/, '<span class=\"parse-error\">$1</span>$2');\n\n return n;\n}\n\n/*\n * A helper function to compact an array\n */\nfunction compact(address: string[], slice: number[]) {\n const s1 = [];\n const s2 = [];\n let i;\n\n for (i = 0; i < address.length; i++) {\n if (i < slice[0]) {\n s1.push(address[i]);\n } else if (i > slice[1]) {\n s2.push(address[i]);\n }\n }\n\n return s1.concat(['compact']).concat(s2);\n}\n\nfunction paddedHex(octet: string): string {\n return parseInt(octet, 16).toString(16).padStart(4, '0');\n}\n\nfunction unsignByte(b: number) {\n return b & 0xff;\n}\n\ninterface SixToFourProperties {\n prefix: string;\n gateway: string;\n}\n\ninterface TeredoProperties {\n prefix: string;\n server4: string;\n client4: string;\n flags: string;\n coneNat: boolean;\n microsoft: {\n reserved: boolean;\n universalLocal: boolean;\n groupIndividual: boolean;\n nonce: string;\n };\n udpPort: string;\n}\n\n/**\n * Represents an IPv6 address\n * @param {string} address - An IPv6 address string\n * @param {number} [groups=8] - How many octets to parse\n * @example\n * var address = new Address6('2001::/32');\n */\nexport class Address6 {\n address4?: Address4;\n address: string;\n addressMinusSuffix: string = '';\n elidedGroups?: number;\n elisionBegin?: number;\n elisionEnd?: number;\n groups: number;\n parsedAddress4?: string;\n parsedAddress: string[];\n parsedSubnet: string = '';\n subnet: string = '/128';\n subnetMask: number = 128;\n v4: boolean = false;\n zone: string = '';\n private _binaryZeroPad?: string;\n\n constructor(address: string, optionalGroups?: number) {\n if (optionalGroups === undefined) {\n this.groups = constants6.GROUPS;\n } else {\n this.groups = optionalGroups;\n }\n\n this.address = address;\n\n const subnet = constants6.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 (\n Number.isNaN(this.subnetMask) ||\n this.subnetMask < 0 ||\n this.subnetMask > constants6.BITS\n ) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n address = address.replace(constants6.RE_SUBNET_STRING, '');\n }\n\n // RE_SUBNET_STRING anchors on the end of the address, so it strips only\n // the trailing suffix. A second one left behind (`::/0/1`) is malformed\n // and must be rejected rather than parsed as an address group.\n if (/\\//.test(address)) {\n throw new AddressError('Invalid subnet mask.');\n }\n\n const zone = constants6.RE_ZONE_STRING.exec(address);\n\n if (zone) {\n this.zone = zone[0];\n\n address = address.replace(constants6.RE_ZONE_STRING, '');\n }\n\n this.addressMinusSuffix = address;\n\n this.parsedAddress = this.parse(this.addressMinusSuffix);\n }\n\n /**\n * Returns true if the given string is a valid IPv6 address (with optional\n * CIDR subnet and zone identifier), false otherwise. Host bits in the\n * subnet portion are allowed (e.g. `2001:db8::1/32` is valid); for strict\n * network-address validation compare `correctForm()` to\n * `startAddress().correctForm()`, or use `networkForm()`.\n */\n static isValid(address: string): boolean {\n try {\n // eslint-disable-next-line no-new\n new Address6(address);\n\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Convert a BigInt to a v6 address object. The value must be in the\n * range `[0, 2**128 - 1]`; otherwise `AddressError` is thrown.\n * @param {bigint} bigInt - a BigInt to convert\n * @returns {Address6}\n * @example\n * var bigInt = BigInt('1000000000000');\n * var address = Address6.fromBigInt(bigInt);\n * address.correctForm(); // '::e8:d4a5:1000'\n */\n static fromBigInt(bigInt: bigint): Address6 {\n if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) {\n throw new AddressError('IPv6 BigInt must be in the range 0 to 2**128 - 1');\n }\n\n const hex = bigInt.toString(16).padStart(32, '0');\n const groups = [];\n\n for (let i = 0; i < constants6.GROUPS; i++) {\n groups.push(hex.slice(i * 4, (i + 1) * 4));\n }\n\n return new Address6(groups.join(':'));\n }\n\n /**\n * Parse a URL (with optional bracketed host and port) into an address and\n * port. Returns either `{ address, port }` on success or\n * `{ error, address: null, port: null }` if the URL could not be parsed.\n * Ports are returned as numbers (or `null` if absent or out of range).\n * @example\n * var addressAndPort = Address6.fromURL('http://[ffff::]:8080/foo/');\n * addressAndPort.address.correctForm(); // 'ffff::'\n * addressAndPort.port; // 8080\n */\n static fromURL(url: string) {\n let host: string;\n let port: string | number | null = null;\n let result: RegExpExecArray | null;\n\n // Remove the protocol prefix, if any\n const stripped = url.replace(/^[a-z][a-z0-9+.-]*:\\/\\//i, '');\n\n // If we have brackets parse them and find a port\n if (stripped.indexOf('[') !== -1 && stripped.indexOf(']:') !== -1) {\n result = constants6.RE_URL_WITH_PORT.exec(stripped);\n\n if (result === null) {\n return {\n error: 'failed to parse address with port',\n address: null,\n port: null,\n };\n }\n\n host = result[1];\n port = result[2];\n } else {\n result = constants6.RE_URL.exec(stripped);\n\n if (result === null) {\n return {\n error: 'failed to parse address from URL',\n address: null,\n port: null,\n };\n }\n\n host = result[1] ?? result[2];\n }\n\n // If there's a port convert it to an integer\n if (port) {\n port = parseInt(port, 10);\n\n // squelch out of range ports (valid ports are 0-65535)\n if (port < 0 || port > 65535) {\n port = null;\n }\n } else {\n // Standardize `undefined` to `null`\n port = null;\n }\n\n return {\n address: new Address6(host),\n port,\n };\n }\n\n /**\n * Construct an `Address6` from an address and a hex subnet mask given as\n * separate strings (e.g. as returned by Node's `os.networkInterfaces()`).\n * Throws `AddressError` if the mask is non-contiguous (e.g.\n * `ffff::ffff`).\n * @example\n * var address = Address6.fromAddressAndMask('fe80::1', 'ffff:ffff:ffff:ffff::');\n * address.subnetMask; // 64\n */\n static fromAddressAndMask(address: string, mask: string): Address6 {\n const bits = common.prefixLengthFromMask(new Address6(mask).bigInt(), constants6.BITS);\n return new Address6(`${address}/${bits}`);\n }\n\n /**\n * Construct an `Address6` from an address and a Cisco-style wildcard mask\n * given as separate strings (e.g. `::ffff:ffff:ffff:ffff` for a `/64`).\n * The wildcard mask is the bitwise inverse of the subnet mask. Throws\n * `AddressError` if the mask is non-contiguous.\n * @example\n * var address = Address6.fromAddressAndWildcardMask('fe80::1', '::ffff:ffff:ffff:ffff');\n * address.subnetMask; // 64\n */\n static fromAddressAndWildcardMask(address: string, wildcardMask: string): Address6 {\n const wildcard = new Address6(wildcardMask).bigInt();\n const allOnes = (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1);\n const mask = wildcard ^ allOnes;\n const bits = common.prefixLengthFromMask(mask, constants6.BITS);\n return new Address6(`${address}/${bits}`);\n }\n\n /**\n * Construct an `Address6` from a wildcard pattern with trailing `*`\n * groups. The number of trailing wildcards determines the prefix\n * length: each `*` represents 16 bits. `::` is expanded to zero groups\n * (not wildcards) before evaluating trailing wildcards.\n *\n * Only trailing whole-group wildcards are supported. Partial-group\n * wildcards (e.g. `2001:db8::0*`) and interior wildcards (e.g.\n * `*::1`) throw `AddressError`.\n * @example\n * Address6.fromWildcard('2001:db8:*:*:*:*:*:*').subnet; // '/32'\n * Address6.fromWildcard('2001:db8::*').subnet; // '/112'\n * Address6.fromWildcard('*:*:*:*:*:*:*:*').subnet; // '/0'\n */\n static fromWildcard(input: string): Address6 {\n if (input.includes('%') || input.includes('/')) {\n throw new AddressError('Wildcard pattern must not include a zone or CIDR suffix');\n }\n\n const halves = input.split('::');\n\n if (halves.length > 2) {\n throw new AddressError(\"Wildcard pattern cannot contain more than one '::'\");\n }\n\n let groups: string[];\n\n if (halves.length === 2) {\n const left = halves[0] === '' ? [] : halves[0].split(':');\n const right = halves[1] === '' ? [] : halves[1].split(':');\n const remaining = constants6.GROUPS - left.length - right.length;\n\n if (remaining < 1) {\n throw new AddressError(\"Wildcard pattern with '::' has too many groups\");\n }\n\n groups = [...left, ...new Array(remaining).fill('0'), ...right];\n } else {\n groups = input.split(':');\n }\n\n if (groups.length !== constants6.GROUPS) {\n throw new AddressError('Wildcard pattern must have 8 groups');\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 groups (e.g. `2001:db8:*:*:*:*:*:*`)',\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 = constants6.BITS - trailing * 16;\n\n return new Address6(`${replaced.join(':')}/${subnetBits}`);\n }\n\n /**\n * Create an IPv6-mapped address given an IPv4 address\n * @param {string} address - An IPv4 address string\n * @returns {Address6}\n * @example\n * var address = Address6.fromAddress4('192.168.0.1');\n * address.correctForm(); // '::ffff:c0a8:1'\n * address.to4in6(); // '::ffff:192.168.0.1'\n */\n static fromAddress4(address: string): Address6 {\n const address4 = new Address4(address);\n\n const mask6 = constants6.BITS - (constants4.BITS - address4.subnetMask);\n\n return new Address6(`::ffff:${address4.correctForm()}/${mask6}`);\n }\n\n /**\n * Return an address from ip6.arpa form\n * @param {string} arpaFormAddress - an 'ip6.arpa' form address\n * @returns {Adress6}\n * @example\n * 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.)\n * address.correctForm(); // '2001:0:ce49:7601:e866:efff:62c3:fffe'\n */\n static fromArpa(arpaFormAddress: string): Address6 {\n // remove ending \".ip6.arpa.\" or just \".\"\n let address = arpaFormAddress.replace(/(\\.ip6\\.arpa)?\\.$/, '');\n const semicolonAmount = 7;\n\n // correct ip6.arpa form with ending removed will be 63 characters\n if (address.length !== 63) {\n throw new AddressError(\"Invalid 'ip6.arpa' form.\");\n }\n\n const parts = address.split('.').reverse();\n\n for (let i = semicolonAmount; i > 0; i--) {\n const insertIndex = i * 4;\n parts.splice(insertIndex, 0, ':');\n }\n\n address = parts.join('');\n\n return new Address6(address);\n }\n\n /**\n * Return the Microsoft UNC transcription of the address\n * @returns {String} the Microsoft UNC transcription of the address\n */\n microsoftTranscription(): string {\n return `${this.correctForm().replace(/:/g, '-')}.ipv6-literal.net`;\n }\n\n /**\n * Return the first n bits of the address, defaulting to the subnet mask\n * @param {number} [mask=subnet] - the number of bits to mask\n * @returns {String} the first n bits of the address as a string\n */\n mask(mask: number = this.subnetMask): string {\n return this.getBitsBase2(0, mask);\n }\n\n /**\n * Return the number of possible subnets of a given size in the address\n * @param {number} [subnetSize=128] - the subnet size\n * @returns {String}\n */\n // TODO: probably useful to have a numeric version of this too\n possibleSubnets(subnetSize: number = 128): string {\n const availableBits = constants6.BITS - this.subnetMask;\n const subnetBits = Math.abs(subnetSize - constants6.BITS);\n const subnetPowers = availableBits - subnetBits;\n\n if (subnetPowers < 0) {\n return '0';\n }\n\n return addCommas((BigInt('2') ** BigInt(subnetPowers)).toString(10));\n }\n\n /**\n * Helper function getting start address.\n * @returns {bigint}\n */\n _startAddress(): bigint {\n return BigInt(`0b${this.mask() + '0'.repeat(constants6.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 {Address6}\n */\n startAddress(): Address6 {\n return Address6.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 {Address6}\n */\n startAddressExclusive(): Address6 {\n const adjust = BigInt('1');\n return Address6.fromBigInt(this._startAddress() + adjust);\n }\n\n /**\n * Helper function getting end address.\n * @returns {bigint}\n */\n _endAddress(): bigint {\n return BigInt(`0b${this.mask() + '1'.repeat(constants6.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 {Address6}\n */\n endAddress(): Address6 {\n return Address6.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 {Address6}\n */\n endAddressExclusive(): Address6 {\n const adjust = BigInt('1');\n return Address6.fromBigInt(this._endAddress() - adjust);\n }\n\n /**\n * The hex form of the subnet mask, e.g. `ffff:ffff:ffff:ffff::` for a\n * `/64`. Returns an `Address6`; call `.correctForm()` for the string.\n * @returns {Address6}\n */\n subnetMaskAddress(): Address6 {\n return Address6.fromBigInt(\n BigInt(`0b${'1'.repeat(this.subnetMask)}${'0'.repeat(constants6.BITS - this.subnetMask)}`),\n );\n }\n\n /**\n * The Cisco-style wildcard mask, e.g. `::ffff:ffff:ffff:ffff` for a\n * `/64`. This is the bitwise inverse of `subnetMaskAddress()`. Returns\n * an `Address6`; call `.correctForm()` for the string.\n * @returns {Address6}\n */\n wildcardMask(): Address6 {\n return Address6.fromBigInt(\n BigInt(`0b${'0'.repeat(this.subnetMask)}${'1'.repeat(constants6.BITS - this.subnetMask)}`),\n );\n }\n\n /**\n * The network address in CIDR string form, e.g. `2001:db8::/32` for\n * `2001:db8::1/32`. For an address with no explicit subnet the prefix\n * is `/128`, e.g. `networkForm()` on `2001:db8::1` returns\n * `2001:db8::1/128`.\n * @returns {string}\n */\n networkForm(): string {\n return `${this.startAddress().correctForm()}/${this.subnetMask}`;\n }\n\n /**\n * Return the scope of the address. The 4-bit scope field\n * ([RFC 4291 §2.7](https://datatracker.ietf.org/doc/html/rfc4291#section-2.7))\n * is only defined for multicast addresses; for unicast addresses the scope\n * is derived from the address type per\n * [RFC 4007 §6](https://datatracker.ietf.org/doc/html/rfc4007#section-6).\n * @returns {String}\n */\n getScope(): string {\n const type = this.getType();\n\n if (type === 'Multicast' || type.startsWith('Multicast ')) {\n const scope = constants6.SCOPES[parseInt(this.getBits(12, 16).toString(10), 10)];\n return scope || 'Unknown';\n }\n\n // RFC 4291 §2.5.3: the loopback address is treated as having Link-Local\n // scope. (Multicast scope 1, \"Interface-Local\", is a different concept\n // used only for loopback transmission of multicast.)\n if (type === 'Link-local unicast' || type === 'Loopback') {\n return 'Link local';\n }\n\n // RFC 4007 §6: the unspecified address has no scope.\n if (type === 'Unspecified') {\n return 'Unknown';\n }\n\n return 'Global';\n }\n\n /**\n * Return the type of the address\n * @returns {String}\n */\n getType(): string {\n for (let i = 0; i < TYPE_SUBNETS.length; i++) {\n const entry = TYPE_SUBNETS[i];\n if (this.isHostInSubnet(entry[0])) {\n return entry[1];\n }\n }\n\n return 'Global unicast';\n }\n\n /**\n * Return the bits in the given range as a BigInt\n * @returns {bigint}\n */\n getBits(start: number, end: number): bigint {\n return BigInt(`0b${this.getBitsBase2(start, end)}`);\n }\n\n /**\n * Return 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 bits in the given range as a base-16 string\n * @returns {String}\n */\n getBitsBase16(start: number, end: number): string {\n const length = end - start;\n\n if (length % 4 !== 0) {\n throw new Error('Length of bits to retrieve must be divisible by four');\n }\n\n return this.getBits(start, end)\n .toString(16)\n .padStart(length / 4, '0');\n }\n\n /**\n * Return the bits that are set past the subnet mask length\n * @returns {String}\n */\n getBitsPastSubnet(): string {\n return this.getBitsBase2(this.subnetMask, constants6.BITS);\n }\n\n /**\n * Return the reversed ip6.arpa form of the address\n * @param {Object} options\n * @param {boolean} options.omitSuffix - omit the \"ip6.arpa\" suffix\n * @returns {String}\n */\n reverseForm(options?: common.ReverseFormOptions): string {\n if (!options) {\n options = {};\n }\n\n const characters = Math.floor(this.subnetMask / 4);\n\n const reversed = this.canonicalForm()\n .replace(/:/g, '')\n .split('')\n .slice(0, characters)\n .reverse()\n .join('.');\n\n if (characters > 0) {\n if (options.omitSuffix) {\n return reversed;\n }\n\n return `${reversed}.ip6.arpa.`;\n }\n\n if (options.omitSuffix) {\n return '';\n }\n\n return 'ip6.arpa.';\n }\n\n /**\n * Returns the address in correct form, per\n * [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952): leading zeros\n * stripped, the longest run of zero groups collapsed to `::`, and hex digits\n * lowercased (e.g. `2001:db8::1`). This is the recommended form for display.\n */\n correctForm(): string {\n let i;\n let groups = [];\n\n let zeroCounter = 0;\n const zeroes = [];\n\n for (i = 0; i < this.parsedAddress.length; i++) {\n const value = parseInt(this.parsedAddress[i], 16);\n\n if (value === 0) {\n zeroCounter++;\n }\n\n if (value !== 0 && zeroCounter > 0) {\n if (zeroCounter > 1) {\n zeroes.push([i - zeroCounter, i - 1]);\n }\n\n zeroCounter = 0;\n }\n }\n\n // Do we end with a string of zeroes?\n if (zeroCounter > 1) {\n zeroes.push([this.parsedAddress.length - zeroCounter, this.parsedAddress.length - 1]);\n }\n\n const zeroLengths = zeroes.map((n) => n[1] - n[0] + 1);\n\n if (zeroes.length > 0) {\n const index = zeroLengths.indexOf(Math.max(...zeroLengths) as number);\n\n groups = compact(this.parsedAddress, zeroes[index]);\n } else {\n groups = this.parsedAddress;\n }\n\n for (i = 0; i < groups.length; i++) {\n if (groups[i] !== 'compact') {\n groups[i] = parseInt(groups[i], 16).toString(16);\n }\n }\n\n let correct = groups.join(':');\n\n correct = correct.replace(/^compact$/, '::');\n correct = correct.replace(/(^compact)|(compact$)/, ':');\n correct = correct.replace(/compact/, '');\n\n return correct;\n }\n\n /**\n * Return a zero-padded base-2 string representation of the address\n * @returns {String}\n * @example\n * var address = new Address6('2001:4860:4001:803::1011');\n * address.binaryZeroPad();\n * // '0010000000000001010010000110000001000000000000010000100000000011\n * // 0000000000000000000000000000000000000000000000000001000000010001'\n */\n binaryZeroPad(): string {\n if (this._binaryZeroPad === undefined) {\n this._binaryZeroPad = this.bigInt().toString(2).padStart(constants6.BITS, '0');\n }\n return this._binaryZeroPad;\n }\n\n /**\n * Parses a v4-in-v6 string (e.g. `::ffff:192.168.0.1`) by extracting the\n * trailing IPv4 address into `this.address4` / `this.parsedAddress4` and\n * returning the address with the v4 portion converted to two v6 groups.\n * Used internally by `parse()`.\n */\n // TODO: Improve the semantics of this helper function\n parse4in6(address: string): string {\n if (address.indexOf('.') === -1) {\n return address;\n }\n\n const groups = address.split(':');\n const lastGroup = groups.slice(-1)[0];\n\n // RE_ADDRESS rejects octets with a leading zero, so a dotted-quad tail is\n // matched permissively first: that way this notation still gets its own\n // message with the offending octet highlighted, rather than falling\n // through as an unrecognized group.\n const v4Octets = lastGroup.split('.');\n\n if (\n v4Octets.length === constants4.GROUPS &&\n v4Octets.every((octet) => /^\\d{1,3}$/.test(octet))\n ) {\n if (v4Octets.some((octet) => /^0\\d/.test(octet))) {\n // The prefix groups haven't been through the bad-character check\n // yet, so escape them before including in the error HTML.\n const highlighted = v4Octets.map(spanLeadingZeroes4).join('.');\n const prefix = groups.slice(0, -1).map(helpers.escapeHtml).join(':');\n const separator = groups.length > 1 ? ':' : '';\n\n throw new AddressError(\n \"IPv4 addresses can't have leading zeroes.\",\n `${prefix}${separator}${highlighted}`,\n );\n }\n }\n\n const address4 = lastGroup.match(constants4.RE_ADDRESS);\n\n if (address4) {\n this.parsedAddress4 = address4[0];\n const v4Suffix = this.subnetMask >= 96 ? `/${this.subnetMask - 96}` : '';\n this.address4 = new Address4(`${this.parsedAddress4}${v4Suffix}`);\n\n this.v4 = true;\n\n groups[groups.length - 1] = this.address4.toGroup6();\n\n address = groups.join(':');\n }\n\n return address;\n }\n\n /**\n * Parses an IPv6 address string into its 8 hexadecimal groups (expanding\n * any `::` elision and any trailing v4-in-v6 portion) and stores the result\n * on `this.parsedAddress`. Called automatically by the constructor; you\n * typically don't need to call it directly. Throws `AddressError` if the\n * input is malformed.\n */\n // TODO: Make private?\n parse(address: string): string[] {\n address = this.parse4in6(address);\n\n const badCharacters = address.match(constants6.RE_BAD_CHARACTERS);\n\n if (badCharacters) {\n throw new AddressError(\n `Bad character${\n badCharacters.length > 1 ? 's' : ''\n } detected in address: ${badCharacters.join('')}`,\n address.replace(constants6.RE_BAD_CHARACTERS, '<span class=\"parse-error\">$1</span>'),\n );\n }\n\n const badAddress = address.match(constants6.RE_BAD_ADDRESS);\n\n if (badAddress) {\n throw new AddressError(\n `Address failed regex: ${badAddress.join('')}`,\n address.replace(constants6.RE_BAD_ADDRESS, '<span class=\"parse-error\">$1</span>'),\n );\n }\n\n let groups: string[] = [];\n\n const halves = address.split('::');\n\n if (halves.length === 2) {\n let first = halves[0].split(':');\n let last = halves[1].split(':');\n\n if (first.length === 1 && first[0] === '') {\n first = [];\n }\n\n if (last.length === 1 && last[0] === '') {\n last = [];\n }\n\n const remaining = this.groups - (first.length + last.length);\n\n if (!remaining) {\n throw new AddressError('Error parsing groups');\n }\n\n this.elidedGroups = remaining;\n\n this.elisionBegin = first.length;\n this.elisionEnd = first.length + this.elidedGroups;\n\n groups = groups.concat(first);\n\n for (let i = 0; i < remaining; i++) {\n groups.push('0');\n }\n\n groups = groups.concat(last);\n } else if (halves.length === 1) {\n groups = address.split(':');\n\n this.elidedGroups = 0;\n } else {\n throw new AddressError('Too many :: groups found');\n }\n\n groups = groups.map((group: string) => parseInt(group, 16).toString(16));\n\n if (groups.length !== this.groups) {\n throw new AddressError('Incorrect number of groups found');\n }\n\n return groups;\n }\n\n /**\n * Returns the canonical (fully expanded) form of the address: all 8 groups,\n * each padded to 4 hex digits, with no `::` collapsing\n * (e.g. `2001:0db8:0000:0000:0000:0000:0000:0001`). Useful for sorting and\n * byte-exact comparison.\n */\n canonicalForm(): string {\n return this.parsedAddress.map(paddedHex).join(':');\n }\n\n /**\n * Return the decimal form of the address\n * @returns {String}\n */\n decimal(): string {\n return this.parsedAddress.map((n) => parseInt(n, 16).toString(10).padStart(5, '0')).join(':');\n }\n\n /**\n * Return the address as a BigInt\n * @returns {bigint}\n */\n bigInt(): bigint {\n return BigInt(`0x${this.parsedAddress.map(paddedHex).join('')}`);\n }\n\n /**\n * Return the last two groups of this address as an IPv4 address string.\n * If this address carries a CIDR prefix that covers the trailing 32 bits\n * (i.e. `subnetMask >= 96`), the resulting `Address4` inherits the\n * corresponding v4 prefix (`subnetMask - 96`); otherwise it defaults to\n * `/32`.\n * @returns {Address4}\n * @example\n * var address = new Address6('2001:4860:4001::1825:bf11');\n * address.to4().correctForm(); // '24.37.191.17'\n */\n to4(): Address4 {\n const binary = this.binaryZeroPad().split('');\n const hex = BigInt(`0b${binary.slice(96, 128).join('')}`)\n .toString(16)\n .padStart(8, '0');\n\n if (this.subnetMask >= 96) {\n const v4Mask = this.subnetMask - 96;\n const groups = [];\n\n for (let i = 0; i < 8; i += 2) {\n groups.push(parseInt(hex.slice(i, i + 2), 16));\n }\n\n return new Address4(`${groups.join('.')}/${v4Mask}`);\n }\n\n return Address4.fromHex(hex);\n }\n\n /**\n * Return the v4-in-v6 form of the address\n * @returns {String}\n */\n to4in6(): string {\n const address4 = this.to4();\n const address6 = new Address6(this.parsedAddress.slice(0, 6).join(':'), 6);\n\n const correct = address6.correctForm();\n\n let infix = '';\n\n if (!/:$/.test(correct)) {\n infix = ':';\n }\n\n return correct + infix + address4.correctForm();\n }\n\n /**\n * Decodes the Teredo tunneling fields embedded in this address. Returns the\n * Teredo prefix, server IPv4, client IPv4, raw flag bits, cone-NAT flag,\n * UDP port, and Microsoft-format flag breakdown (reserved, universal/local,\n * group/individual, nonce). Only meaningful for addresses in `2001::/32`.\n */\n inspectTeredo(): TeredoProperties {\n /*\n - Bits 0 to 31 are set to the Teredo prefix (normally 2001:0000::/32).\n - Bits 32 to 63 embed the primary IPv4 address of the Teredo server that\n is used.\n - Bits 64 to 79 can be used to define some flags. Currently only the\n higher order bit is used; it is set to 1 if the Teredo client is\n located behind a cone NAT, 0 otherwise. For Microsoft's Windows Vista\n and Windows Server 2008 implementations, more bits are used. In those\n implementations, the format for these 16 bits is \"CRAAAAUG AAAAAAAA\",\n where \"C\" remains the \"Cone\" flag. The \"R\" bit is reserved for future\n use. The \"U\" bit is for the Universal/Local flag (set to 0). The \"G\" bit\n is Individual/Group flag (set to 0). The A bits are set to a 12-bit\n randomly generated number chosen by the Teredo client to introduce\n additional protection for the Teredo node against IPv6-based scanning\n attacks.\n - Bits 80 to 95 contains the obfuscated UDP port number. This is the\n port number that is mapped by the NAT to the Teredo client with all\n bits inverted.\n - Bits 96 to 127 contains the obfuscated IPv4 address. This is the\n public IPv4 address of the NAT with all bits inverted.\n */\n const prefix = this.getBitsBase16(0, 32);\n\n const bitsForUdpPort: bigint = this.getBits(80, 96);\n const udpPort = (bitsForUdpPort ^ BigInt('0xffff')).toString();\n\n const server4 = Address4.fromHex(this.getBitsBase16(32, 64));\n\n const bitsForClient4 = this.getBits(96, 128);\n const client4 = Address4.fromHex(\n (bitsForClient4 ^ BigInt('0xffffffff')).toString(16).padStart(8, '0'),\n );\n\n const flagsBase2 = this.getBitsBase2(64, 80);\n\n const coneNat = testBit(flagsBase2, 15);\n const reserved = testBit(flagsBase2, 14);\n const groupIndividual = testBit(flagsBase2, 8);\n const universalLocal = testBit(flagsBase2, 9);\n const nonce = BigInt(`0b${flagsBase2.slice(2, 6) + flagsBase2.slice(8, 16)}`).toString(10);\n\n return {\n prefix: `${prefix.slice(0, 4)}:${prefix.slice(4, 8)}`,\n server4: server4.address,\n client4: client4.address,\n flags: flagsBase2,\n coneNat,\n microsoft: {\n reserved,\n universalLocal,\n groupIndividual,\n nonce,\n },\n udpPort,\n };\n }\n\n /**\n * Decodes the 6to4 tunneling fields embedded in this address. Returns the\n * 6to4 prefix and the embedded IPv4 gateway address. Only meaningful for\n * addresses in `2002::/16`.\n */\n inspect6to4(): SixToFourProperties {\n /*\n - Bits 0 to 15 are set to the 6to4 prefix (2002::/16).\n - Bits 16 to 48 embed the IPv4 address of the 6to4 gateway that is used.\n */\n\n const prefix = this.getBitsBase16(0, 16);\n\n const gateway = Address4.fromHex(this.getBitsBase16(16, 48));\n\n return {\n prefix: prefix.slice(0, 4),\n gateway: gateway.address,\n };\n }\n\n /**\n * Return a v6 6to4 address from a v6 v4inv6 address\n * @returns {Address6}\n */\n to6to4(): Address6 | null {\n if (!this.is4()) {\n return null;\n }\n\n const addr6to4 = [\n '2002',\n this.getBitsBase16(96, 112),\n this.getBitsBase16(112, 128),\n '',\n '/16',\n ].join(':');\n\n return new Address6(addr6to4);\n }\n\n /**\n * Embed an IPv4 address into a NAT64 IPv6 address using the encoding\n * defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).\n * The default prefix is the well-known prefix `64:ff9b::/96`. The prefix\n * length must be one of 32, 40, 48, 56, 64, or 96; for prefixes shorter\n * than /64 the IPv4 octets are split around the reserved bits 64–71.\n * @example\n * Address6.fromAddress4Nat64('192.0.2.33').correctForm(); // '64:ff9b::c000:221'\n * Address6.fromAddress4Nat64('192.0.2.33', '2001:db8::/32').correctForm(); // '2001:db8:c000:221::'\n */\n static fromAddress4Nat64(address: string, prefix: string = '64:ff9b::/96'): Address6 {\n const v4 = new Address4(address);\n const prefix6 = new Address6(prefix);\n const pl = prefix6.subnetMask;\n\n if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {\n throw new AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');\n }\n\n const prefixBits = prefix6.binaryZeroPad();\n const v4Bits = v4.binaryZeroPad();\n\n let bits: string;\n if (pl === 96) {\n bits = prefixBits.slice(0, 96) + v4Bits;\n } else {\n const beforeU = 64 - pl;\n bits = [\n prefixBits.slice(0, pl),\n v4Bits.slice(0, beforeU),\n // Bits 64 to 71 are the reserved u octet and are always zero.\n '00000000',\n v4Bits.slice(beforeU),\n '0'.repeat(128 - 72 - (32 - beforeU)),\n ].join('');\n }\n\n const hex = BigInt(`0b${bits}`).toString(16).padStart(32, '0');\n const groups: string[] = [];\n for (let i = 0; i < 8; i++) {\n groups.push(hex.slice(i * 4, (i + 1) * 4));\n }\n return new Address6(groups.join(':'));\n }\n\n /**\n * Extract the embedded IPv4 address from a NAT64 IPv6 address using the\n * encoding defined by [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052).\n * The default prefix is the well-known prefix `64:ff9b::/96`. Returns\n * `null` if this address is not contained within the given prefix.\n * @example\n * new Address6('64:ff9b::c000:221').toAddress4Nat64()!.correctForm(); // '192.0.2.33'\n */\n toAddress4Nat64(prefix: string = '64:ff9b::/96'): Address4 | null {\n const prefix6 = new Address6(prefix);\n const pl = prefix6.subnetMask;\n\n if (pl !== 32 && pl !== 40 && pl !== 48 && pl !== 56 && pl !== 64 && pl !== 96) {\n throw new AddressError('NAT64 prefix length must be 32, 40, 48, 56, 64, or 96');\n }\n\n if (!this.isHostInSubnet(prefix6)) {\n return null;\n }\n\n const bits = this.binaryZeroPad();\n let v4Bits: string;\n\n if (pl === 96) {\n v4Bits = bits.slice(96, 128);\n } else {\n const beforeU = 64 - pl;\n v4Bits = bits.slice(pl, pl + beforeU) + bits.slice(72, 72 + (32 - beforeU));\n }\n\n const octets: string[] = [];\n for (let i = 0; i < 4; i++) {\n octets.push(parseInt(v4Bits.slice(i * 8, (i + 1) * 8), 2).toString());\n }\n return new Address4(octets.join('.'));\n }\n\n /**\n * Return a byte array.\n *\n * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toByteArray())`.\n * @returns {Array}\n */\n toByteArray(): number[] {\n const value = this.bigInt()\n .toString(16)\n .padStart(constants6.BITS / 4, '0');\n\n const bytes = [];\n for (let i = 0, length = value.length; i < length; i += 2) {\n bytes.push(parseInt(value.substring(i, i + 2), 16));\n }\n\n return bytes;\n }\n\n /**\n * Return an unsigned byte array.\n *\n * To get a Node.js `Buffer`, wrap the result: `Buffer.from(address.toUnsignedByteArray())`.\n * @returns {Array}\n */\n toUnsignedByteArray(): number[] {\n // toByteArray() emits 0 to 255, so unsigning it is an identity mapping and\n // the two methods return equal arrays. 11.0.0 keeps one of them and makes\n // this a deprecated alias; test/common-test.ts fails at that version.\n return this.toByteArray().map(unsignByte);\n }\n\n /**\n * Convert a byte array to an Address6 object.\n *\n * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an\n * `Int8Array` or a Java `byte[]` holds them), folding signed values to their\n * unsigned equivalent. Throws `AddressError` unless given exactly 16\n * integers from -128 to 255.\n *\n * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.\n * @returns {Address6}\n */\n static fromByteArray(bytes: Array<number>): Address6 {\n // Address4.fromByteArray takes unsigned bytes only. 11.0.0 aligns this\n // method with it, at which point the -128 floor here, unsignByte, and the\n // mapping below all go; test/common-test.ts fails at that version.\n common.assertByteArray(bytes, 16, 'IPv6', -128);\n\n return this.fromUnsignedByteArray(bytes.map(unsignByte));\n }\n\n /**\n * Convert an unsigned byte array to an Address6 object.\n *\n * Throws `AddressError` unless given exactly 16 integers from 0 to 255.\n *\n * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.\n * @returns {Address6}\n */\n static fromUnsignedByteArray(bytes: Array<number>): Address6 {\n common.assertByteArray(bytes, 16, 'IPv6', 0);\n\n const BYTE_MAX = BigInt('256');\n let result = BigInt('0');\n let multiplier = BigInt('1');\n\n for (let i = bytes.length - 1; i >= 0; i--) {\n result += multiplier * BigInt(bytes[i].toString(10));\n\n multiplier *= BYTE_MAX;\n }\n\n return Address6.fromBigInt(result);\n }\n\n // #region Attributes\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. See\n * {@link common.isHostInSubnet}.\n * @returns {boolean}\n */\n isHostInSubnet = common.isHostInSubnet;\n\n /**\n * Returns true if the address is correct, false otherwise\n * @returns {boolean}\n */\n isCorrect = isCorrect6;\n\n /**\n * Returns true if the address is in the canonical form, false otherwise\n * @returns {boolean}\n */\n isCanonical(): boolean {\n return this.addressMinusSuffix === this.canonicalForm();\n }\n\n /**\n * Returns true if the address is a link local address, false otherwise\n * @returns {boolean}\n */\n isLinkLocal(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isLinkLocal();\n }\n\n // Zeroes are required, i.e. we can't check isHostInSubnet with 'fe80::/10'\n if (\n this.getBitsBase2(0, 64) ===\n '1111111010000000000000000000000000000000000000000000000000000000'\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Returns true if the address is a multicast address, false otherwise\n * @returns {boolean}\n */\n isMulticast(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isMulticast();\n }\n\n const type = this.getType();\n return type === 'Multicast' || type.startsWith('Multicast ');\n }\n\n /**\n * Returns true if the address was written in v4-in-v6 dotted-quad notation\n * (e.g. `::ffff:127.0.0.1`), false otherwise. This is a notation-level flag\n * and does not reflect whether the address bits lie in the IPv4-mapped\n * (`::ffff:0:0/96`) subnet — for that, see {@link isMapped4}.\n * @returns {boolean}\n */\n is4(): boolean {\n return this.v4;\n }\n\n /**\n * Returns true if the address is an IPv4-mapped IPv6 address in\n * `::ffff:0:0/96` ([RFC 4291 §2.5.5.2](https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2)),\n * false otherwise. Unlike {@link is4}, this checks the underlying address\n * bits rather than the textual notation, so `::ffff:127.0.0.1` and\n * `::ffff:7f00:1` both return true.\n * @returns {boolean}\n */\n isMapped4(): boolean {\n return this.isHostInSubnet(IPV4_MAPPED_SUBNET);\n }\n\n /**\n * If this address embeds a routable IPv4 address — i.e. it is IPv4-mapped\n * (`::ffff:0:0/96`) or sits in the NAT64 well-known prefix (`64:ff9b::/96`,\n * [RFC 6052](https://datatracker.ietf.org/doc/html/rfc6052)) — return that\n * embedded address as an {@link Address4}; otherwise return null.\n *\n * The special-property checks (`isLoopback`, `isLinkLocal`, `isMulticast`,\n * `isUnspecified`, `isPrivate`, `isCGNAT`, `isBroadcast`) call this first and\n * delegate to the embedded {@link Address4} when present, so a literal such as\n * `::ffff:127.0.0.1` is classified by what it actually reaches (loopback)\n * rather than by its IPv6 wrapper (which `getType()` reports as IPv4-mapped).\n * This matters wherever the checks back a trust-boundary decision (e.g. an\n * SSRF allow/deny filter): without normalization, `::ffff:10.0.0.1`,\n * `::ffff:169.254.169.254`, `64:ff9b::7f00:1`, etc. would all read as\n * non-internal.\n * @returns {Address4 | null}\n */\n embeddedIPv4(): Address4 | null {\n if (this.isMapped4() || this.isHostInSubnet(NAT64_WELL_KNOWN_SUBNET)) {\n return this.to4();\n }\n\n return null;\n }\n\n /**\n * Returns true if the address is a Teredo address, false otherwise\n * @returns {boolean}\n */\n isTeredo(): boolean {\n return this.isHostInSubnet(TEREDO_SUBNET);\n }\n\n /**\n * Returns true if the address is a 6to4 address, false otherwise\n * @returns {boolean}\n */\n is6to4(): boolean {\n return this.isHostInSubnet(SIX_TO_FOUR_SUBNET);\n }\n\n /**\n * Returns true if the address is a loopback address, false otherwise\n * @returns {boolean}\n */\n isLoopback(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isLoopback();\n }\n\n return this.getType() === 'Loopback';\n }\n\n /**\n * 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.\n * @returns {boolean}\n */\n isULA(): boolean {\n return this.isHostInSubnet(ULA_SUBNET);\n }\n\n /**\n * Returns true if the address is private, i.e. a Unique Local Address in\n * `fc00::/7` ([RFC 4193](https://datatracker.ietf.org/doc/html/rfc4193)) or an\n * IPv4-mapped / NAT64 address whose embedded IPv4 address is in one of the\n * [RFC 1918](https://datatracker.ietf.org/doc/html/rfc1918) private ranges\n * (e.g. `::ffff:10.0.0.1`). This is the IPv6 counterpart to\n * {@link Address4.isPrivate}; use it instead of {@link isULA} when you need to\n * catch mapped RFC 1918 addresses as well as native ULAs.\n * @returns {boolean}\n */\n isPrivate(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isPrivate();\n }\n\n return this.isULA();\n }\n\n /**\n * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded\n * IPv4 address is in the carrier-grade NAT range `100.64.0.0/10`\n * ([RFC 6598](https://datatracker.ietf.org/doc/html/rfc6598)), false\n * otherwise. There is no native IPv6 CGNAT range, so this only ever returns\n * true for an embedded IPv4 address (e.g. `::ffff:100.64.0.1`).\n * @returns {boolean}\n */\n isCGNAT(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isCGNAT();\n }\n\n return false;\n }\n\n /**\n * Returns true if the address is an IPv4-mapped / NAT64 address whose embedded\n * IPv4 address is the limited broadcast address `255.255.255.255`\n * ([RFC 919](https://datatracker.ietf.org/doc/html/rfc919)), false otherwise.\n * There is no IPv6 broadcast, so this only ever returns true for an embedded\n * IPv4 address (e.g. `::ffff:255.255.255.255`).\n * @returns {boolean}\n */\n isBroadcast(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isBroadcast();\n }\n\n return false;\n }\n\n /**\n * Returns true if the address is the unspecified address `::`.\n * @returns {boolean}\n */\n isUnspecified(): boolean {\n const embedded = this.embeddedIPv4();\n if (embedded) {\n return embedded.isUnspecified();\n }\n\n return this.getType() === 'Unspecified';\n }\n\n /**\n * Returns true if the address is in the documentation prefix `2001:db8::/32` ([RFC 3849](https://datatracker.ietf.org/doc/html/rfc3849)).\n * @returns {boolean}\n */\n isDocumentation(): boolean {\n return this.isHostInSubnet(DOCUMENTATION_SUBNET);\n }\n // #endregion\n\n // #region HTML\n /**\n * Returns the address as an HTTP URL with the host bracketed, e.g.\n * `http://[2001:db8::1]/`. If `optionalPort` is provided it is appended,\n * e.g. `http://[2001:db8::1]:8080/`.\n */\n href(optionalPort?: number | string): string {\n if (optionalPort === undefined) {\n optionalPort = '';\n } else {\n optionalPort = `:${optionalPort}`;\n }\n\n return `http://[${this.correctForm()}]${optionalPort}/`;\n }\n\n /**\n * Returns an HTML `<a>` element whose `href` encodes the address in a URL\n * hash fragment (default prefix `/#address=`). Useful for linking between\n * pages of an address-inspector UI.\n * @param options.className - CSS class for the rendered `<a>` element\n * @param options.prefix - hash prefix prepended to the address (default `/#address=`)\n * @param options.v4 - when true, render the address in v4-in-v6 form\n */\n link(options?: { className?: string; prefix?: string; v4?: boolean }): string {\n if (!options) {\n options = {};\n }\n\n if (options.className === undefined) {\n options.className = '';\n }\n\n if (options.prefix === undefined) {\n options.prefix = '/#address=';\n }\n\n if (options.v4 === undefined) {\n options.v4 = false;\n }\n\n let formFunction = this.correctForm;\n\n if (options.v4) {\n formFunction = this.to4in6;\n }\n\n const form = formFunction.call(this);\n const safeHref = helpers.escapeHtml(`${options.prefix}${form}`);\n const safeForm = helpers.escapeHtml(form);\n\n if (options.className) {\n const safeClass = helpers.escapeHtml(options.className);\n\n return `<a href=\"${safeHref}\" class=\"${safeClass}\">${safeForm}</a>`;\n }\n\n return `<a href=\"${safeHref}\">${safeForm}</a>`;\n }\n\n /**\n * Groups an address\n * @returns {String}\n */\n group(): string {\n if (this.elidedGroups === 0) {\n // The simple case\n return helpers.simpleGroup(this.addressMinusSuffix).join(':');\n }\n\n assert(typeof this.elidedGroups === 'number');\n assert(typeof this.elisionBegin === 'number');\n\n // The elided case\n const output = [];\n\n const [left, right] = this.addressMinusSuffix.split('::');\n\n if (left.length) {\n output.push(...helpers.simpleGroup(left));\n } else {\n output.push('');\n }\n\n const classes = ['hover-group'];\n\n for (let i = this.elisionBegin; i < this.elisionBegin + this.elidedGroups; i++) {\n classes.push(`group-${i}`);\n }\n\n output.push(`<span class=\"${classes.join(' ')}\"></span>`);\n\n if (right.length) {\n output.push(...helpers.simpleGroup(right, this.elisionEnd));\n } else {\n output.push('');\n }\n\n if (this.is4()) {\n assert(this.address4 instanceof Address4);\n\n output.pop();\n output.push(this.address4.groupForV6());\n }\n\n return output.join(':');\n }\n // #endregion\n\n // #region Regular expressions\n /**\n * Generate a regular expression string that can be used to find or validate\n * all variations of this address\n * @param {boolean} substringSearch\n * @returns {string}\n */\n regularExpressionString(this: Address6, substringSearch: boolean = false): string {\n let output: string[] = [];\n\n // TODO: revisit why this is necessary\n const address6 = new Address6(this.correctForm());\n\n if (address6.elidedGroups === 0) {\n // The simple case\n output.push(simpleRegularExpression(address6.parsedAddress));\n } else if (address6.elidedGroups === constants6.GROUPS) {\n // A completely elided address\n output.push(possibleElisions(constants6.GROUPS));\n } else {\n // A partially elided address\n const halves = address6.address.split('::');\n\n if (halves[0].length) {\n output.push(simpleRegularExpression(halves[0].split(':')));\n }\n\n assert(typeof address6.elidedGroups === 'number');\n\n output.push(\n possibleElisions(address6.elidedGroups, halves[0].length !== 0, halves[1].length !== 0),\n );\n\n if (halves[1].length) {\n output.push(simpleRegularExpression(halves[1].split(':')));\n }\n\n output = [output.join(':')];\n }\n\n if (!substringSearch) {\n output = [\n '(?=^|',\n ADDRESS_BOUNDARY,\n '|[^\\\\w\\\\:])(',\n ...output,\n ')(?=[^\\\\w\\\\:]|',\n ADDRESS_BOUNDARY,\n '|$)',\n ];\n }\n\n return output.join('');\n }\n\n /**\n * Generate a regular expression that can be used to find or validate all\n * variations of this address.\n * @param {boolean} substringSearch\n * @returns {RegExp}\n */\n regularExpression(this: Address6, substringSearch: boolean = false): RegExp {\n return new RegExp(this.regularExpressionString(substringSearch), 'i');\n }\n // #endregion\n}\n\nconst TYPE_SUBNETS: Array<[Address6, string]> = Object.keys(constants6.TYPES).map((subnet) => [\n new Address6(subnet),\n constants6.TYPES[subnet] as string,\n]);\nconst TEREDO_SUBNET = new Address6('2001::/32');\nconst SIX_TO_FOUR_SUBNET = new Address6('2002::/16');\nconst ULA_SUBNET = new Address6('fc00::/7');\nconst DOCUMENTATION_SUBNET = new Address6('2001:db8::/32');\nconst IPV4_MAPPED_SUBNET = new Address6('::ffff:0:0/96');\nconst NAT64_WELL_KNOWN_SUBNET = new Address6('64:ff9b::/96');\n"]}
tools/ui/node_modules/ip-address/dist/v4/constants.d.ts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ export declare const BITS = 32;
2
+ export declare const GROUPS = 4;
3
+ export declare const RE_ADDRESS: RegExp;
4
+ export declare const RE_SUBNET_STRING: RegExp;
tools/ui/node_modules/ip-address/dist/v4/constants.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RE_SUBNET_STRING = exports.RE_ADDRESS = exports.GROUPS = exports.BITS = void 0;
4
+ exports.BITS = 32;
5
+ exports.GROUPS = 4;
6
+ // Each octet is 0-255 written without a leading zero. A leading zero is
7
+ // octal to the WHATWG URL parser, inet_aton, and getaddrinfo, but decimal to
8
+ // parseInt(part, 10), so accepting the notation would make this library
9
+ // disagree with the network stack about which host a string names.
10
+ exports.RE_ADDRESS = /^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g;
11
+ exports.RE_SUBNET_STRING = /\/\d{1,2}$/;
12
+ //# sourceMappingURL=constants.js.map
tools/ui/node_modules/ip-address/dist/v4/constants.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/v4/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,IAAI,GAAG,EAAE,CAAC;AACV,QAAA,MAAM,GAAG,CAAC,CAAC;AAExB,wEAAwE;AACxE,6EAA6E;AAC7E,wEAAwE;AACxE,mEAAmE;AACtD,QAAA,UAAU,GACrB,+LAA+L,CAAC;AAErL,QAAA,gBAAgB,GAAG,YAAY,CAAC","sourcesContent":["export const BITS = 32;\nexport const GROUPS = 4;\n\n// Each octet is 0-255 written without a leading zero. A leading zero is\n// octal to the WHATWG URL parser, inet_aton, and getaddrinfo, but decimal to\n// parseInt(part, 10), so accepting the notation would make this library\n// disagree with the network stack about which host a string names.\nexport const RE_ADDRESS =\n /^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])$/g;\n\nexport const RE_SUBNET_STRING = /\\/\\d{1,2}$/;\n"]}
tools/ui/node_modules/ip-address/dist/v6/constants.d.ts ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export declare const BITS = 128;
2
+ export declare const GROUPS = 8;
3
+ /**
4
+ * Represents IPv6 address scopes
5
+ * @memberof Address6
6
+ * @static
7
+ */
8
+ export declare const SCOPES: {
9
+ [key: number]: string | undefined;
10
+ };
11
+ /**
12
+ * Represents IPv6 address types
13
+ * @memberof Address6
14
+ * @static
15
+ */
16
+ export declare const TYPES: {
17
+ [key: string]: string | undefined;
18
+ };
19
+ /**
20
+ * A regular expression that matches bad characters in an IPv6 address
21
+ * @memberof Address6
22
+ * @static
23
+ */
24
+ export declare const RE_BAD_CHARACTERS: RegExp;
25
+ /**
26
+ * A regular expression that matches an incorrect IPv6 address
27
+ * @memberof Address6
28
+ * @static
29
+ */
30
+ export declare const RE_BAD_ADDRESS: RegExp;
31
+ /**
32
+ * A regular expression that matches an IPv6 subnet
33
+ * @memberof Address6
34
+ * @static
35
+ */
36
+ export declare const RE_SUBNET_STRING: RegExp;
37
+ /**
38
+ * A regular expression that matches an IPv6 zone
39
+ * @memberof Address6
40
+ * @static
41
+ */
42
+ export declare const RE_ZONE_STRING: RegExp;
43
+ export declare const RE_URL: RegExp;
44
+ export declare const RE_URL_WITH_PORT: RegExp;
tools/ui/node_modules/ip-address/dist/v6/constants.js ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RE_URL_WITH_PORT = exports.RE_URL = exports.RE_ZONE_STRING = exports.RE_SUBNET_STRING = exports.RE_BAD_ADDRESS = exports.RE_BAD_CHARACTERS = exports.TYPES = exports.SCOPES = exports.GROUPS = exports.BITS = void 0;
4
+ exports.BITS = 128;
5
+ exports.GROUPS = 8;
6
+ /**
7
+ * Represents IPv6 address scopes
8
+ * @memberof Address6
9
+ * @static
10
+ */
11
+ exports.SCOPES = {
12
+ 0: 'Reserved',
13
+ 1: 'Interface local',
14
+ 2: 'Link local',
15
+ 4: 'Admin local',
16
+ 5: 'Site local',
17
+ 8: 'Organization local',
18
+ 14: 'Global',
19
+ 15: 'Reserved',
20
+ };
21
+ /**
22
+ * Represents IPv6 address types
23
+ * @memberof Address6
24
+ * @static
25
+ */
26
+ exports.TYPES = {
27
+ 'ff01::1/128': 'Multicast (All nodes on this interface)',
28
+ 'ff01::2/128': 'Multicast (All routers on this interface)',
29
+ 'ff02::1/128': 'Multicast (All nodes on this link)',
30
+ 'ff02::2/128': 'Multicast (All routers on this link)',
31
+ 'ff05::2/128': 'Multicast (All routers in this site)',
32
+ 'ff02::5/128': 'Multicast (OSPFv3 AllSPF routers)',
33
+ 'ff02::6/128': 'Multicast (OSPFv3 AllDR routers)',
34
+ 'ff02::9/128': 'Multicast (RIP routers)',
35
+ 'ff02::a/128': 'Multicast (EIGRP routers)',
36
+ 'ff02::d/128': 'Multicast (PIM routers)',
37
+ 'ff02::16/128': 'Multicast (MLDv2 reports)',
38
+ 'ff01::fb/128': 'Multicast (mDNSv6)',
39
+ 'ff02::fb/128': 'Multicast (mDNSv6)',
40
+ 'ff05::fb/128': 'Multicast (mDNSv6)',
41
+ 'ff02::1:2/128': 'Multicast (All DHCP servers and relay agents on this link)',
42
+ 'ff05::1:2/128': 'Multicast (All DHCP servers and relay agents in this site)',
43
+ 'ff02::1:3/128': 'Multicast (All DHCP servers on this link)',
44
+ 'ff05::1:3/128': 'Multicast (All DHCP servers in this site)',
45
+ '::/128': 'Unspecified',
46
+ '::1/128': 'Loopback',
47
+ '::ffff:0:0/96': 'IPv4-mapped',
48
+ 'ff00::/8': 'Multicast',
49
+ 'fe80::/10': 'Link-local unicast',
50
+ 'fc00::/7': 'Unique local',
51
+ '2002::/16': '6to4',
52
+ '2001:db8::/32': 'Documentation',
53
+ '64:ff9b::/96': 'NAT64 (well-known)',
54
+ '64:ff9b:1::/48': 'NAT64 (local-use)',
55
+ };
56
+ /**
57
+ * A regular expression that matches bad characters in an IPv6 address
58
+ * @memberof Address6
59
+ * @static
60
+ */
61
+ exports.RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi;
62
+ /**
63
+ * A regular expression that matches an incorrect IPv6 address
64
+ * @memberof Address6
65
+ * @static
66
+ */
67
+ exports.RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi;
68
+ /**
69
+ * A regular expression that matches an IPv6 subnet
70
+ * @memberof Address6
71
+ * @static
72
+ */
73
+ exports.RE_SUBNET_STRING = /\/\d{1,3}(?=%|$)/;
74
+ /**
75
+ * A regular expression that matches an IPv6 zone
76
+ * @memberof Address6
77
+ * @static
78
+ */
79
+ exports.RE_ZONE_STRING = /%.*$/;
80
+ exports.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;
81
+ exports.RE_URL_WITH_PORT = /^\[([0-9a-f:.]+)\]:([0-9]{1,5})(?:[/?#].*)?$/i;
82
+ //# sourceMappingURL=constants.js.map
tools/ui/node_modules/ip-address/dist/v6/constants.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,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;;;GAIG;AACU,QAAA,cAAc,GAAG,0CAA0C,CAAC;AAEzE;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,kBAAkB,CAAC;AAEnD;;;;GAIG;AACU,QAAA,cAAc,GAAG,MAAM,CAAC;AAExB,QAAA,MAAM,GAAG,oDAAoD,CAAC;AAC9D,QAAA,gBAAgB,GAAG,+CAA+C,CAAC","sourcesContent":["export const BITS = 128;\nexport const GROUPS = 8;\n\n/**\n * Represents IPv6 address scopes\n * @memberof Address6\n * @static\n */\nexport const SCOPES: { [key: number]: string | undefined } = {\n 0: 'Reserved',\n 1: 'Interface local',\n 2: 'Link local',\n 4: 'Admin local',\n 5: 'Site local',\n 8: 'Organization local',\n 14: 'Global',\n 15: 'Reserved',\n} as const;\n\n/**\n * Represents IPv6 address types\n * @memberof Address6\n * @static\n */\nexport const TYPES: { [key: string]: string | undefined } = {\n 'ff01::1/128': 'Multicast (All nodes on this interface)',\n 'ff01::2/128': 'Multicast (All routers on this interface)',\n 'ff02::1/128': 'Multicast (All nodes on this link)',\n 'ff02::2/128': 'Multicast (All routers on this link)',\n 'ff05::2/128': 'Multicast (All routers in this site)',\n 'ff02::5/128': 'Multicast (OSPFv3 AllSPF routers)',\n 'ff02::6/128': 'Multicast (OSPFv3 AllDR routers)',\n 'ff02::9/128': 'Multicast (RIP routers)',\n 'ff02::a/128': 'Multicast (EIGRP routers)',\n 'ff02::d/128': 'Multicast (PIM routers)',\n 'ff02::16/128': 'Multicast (MLDv2 reports)',\n 'ff01::fb/128': 'Multicast (mDNSv6)',\n 'ff02::fb/128': 'Multicast (mDNSv6)',\n 'ff05::fb/128': 'Multicast (mDNSv6)',\n 'ff02::1:2/128': 'Multicast (All DHCP servers and relay agents on this link)',\n 'ff05::1:2/128': 'Multicast (All DHCP servers and relay agents in this site)',\n 'ff02::1:3/128': 'Multicast (All DHCP servers on this link)',\n 'ff05::1:3/128': 'Multicast (All DHCP servers in this site)',\n '::/128': 'Unspecified',\n '::1/128': 'Loopback',\n '::ffff:0:0/96': 'IPv4-mapped',\n 'ff00::/8': 'Multicast',\n 'fe80::/10': 'Link-local unicast',\n 'fc00::/7': 'Unique local',\n '2002::/16': '6to4',\n '2001:db8::/32': 'Documentation',\n '64:ff9b::/96': 'NAT64 (well-known)',\n '64:ff9b:1::/48': 'NAT64 (local-use)',\n} as const;\n\n/**\n * A regular expression that matches bad characters in an IPv6 address\n * @memberof Address6\n * @static\n */\nexport const RE_BAD_CHARACTERS = /([^0-9a-f:/%])/gi;\n\n/**\n * A regular expression that matches an incorrect IPv6 address\n * @memberof Address6\n * @static\n */\nexport const RE_BAD_ADDRESS = /([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\\/$)/gi;\n\n/**\n * A regular expression that matches an IPv6 subnet\n * @memberof Address6\n * @static\n */\nexport const RE_SUBNET_STRING = /\\/\\d{1,3}(?=%|$)/;\n\n/**\n * A regular expression that matches an IPv6 zone\n * @memberof Address6\n * @static\n */\nexport const RE_ZONE_STRING = /%.*$/;\n\nexport const RE_URL = /^(?:\\[([0-9a-f:.]+)\\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;\nexport const RE_URL_WITH_PORT = /^\\[([0-9a-f:.]+)\\]:([0-9]{1,5})(?:[/?#].*)?$/i;\n"]}
tools/ui/node_modules/ip-address/dist/v6/helpers.d.ts ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export declare function escapeHtml(s: string): string;
2
+ /**
3
+ * @returns {String} the string with all zeroes contained in a <span>
4
+ */
5
+ export declare function spanAllZeroes(s: string): string;
6
+ /**
7
+ * @returns {String} the string with each character contained in a <span>
8
+ */
9
+ export declare function spanAll(s: string, offset?: number): string;
10
+ /**
11
+ * @returns {String} the string with leading zeroes contained in a <span>
12
+ */
13
+ export declare function spanLeadingZeroes(address: string): string;
14
+ /**
15
+ * Groups an address
16
+ * @returns {String} a grouped address
17
+ */
18
+ export declare function simpleGroup(addressString: string, offset?: number): string[];
tools/ui/node_modules/ip-address/dist/v6/helpers.js ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.escapeHtml = escapeHtml;
4
+ exports.spanAllZeroes = spanAllZeroes;
5
+ exports.spanAll = spanAll;
6
+ exports.spanLeadingZeroes = spanLeadingZeroes;
7
+ exports.simpleGroup = simpleGroup;
8
+ function escapeHtml(s) {
9
+ return s
10
+ .replace(/&/g, '&amp;')
11
+ .replace(/</g, '&lt;')
12
+ .replace(/>/g, '&gt;')
13
+ .replace(/"/g, '&quot;')
14
+ .replace(/'/g, '&#39;');
15
+ }
16
+ /**
17
+ * @returns {String} the string with all zeroes contained in a <span>
18
+ */
19
+ function spanAllZeroes(s) {
20
+ return escapeHtml(s).replace(/(0+)/g, '<span class="zero">$1</span>');
21
+ }
22
+ /**
23
+ * @returns {String} the string with each character contained in a <span>
24
+ */
25
+ function spanAll(s, offset = 0) {
26
+ const letters = s.split('');
27
+ return letters
28
+ .map((n, i) => `<span class="digit value-${escapeHtml(n)} position-${i + offset}">${spanAllZeroes(n)}</span>`)
29
+ .join('');
30
+ }
31
+ function spanLeadingZeroesSimple(group) {
32
+ return escapeHtml(group).replace(/^(0+)/, '<span class="zero">$1</span>');
33
+ }
34
+ /**
35
+ * @returns {String} the string with leading zeroes contained in a <span>
36
+ */
37
+ function spanLeadingZeroes(address) {
38
+ const groups = address.split(':');
39
+ return groups.map((g) => spanLeadingZeroesSimple(g)).join(':');
40
+ }
41
+ /**
42
+ * Groups an address
43
+ * @returns {String} a grouped address
44
+ */
45
+ function simpleGroup(addressString, offset = 0) {
46
+ const groups = addressString.split(':');
47
+ return groups.map((g, i) => {
48
+ if (/group-v4/.test(g)) {
49
+ return g;
50
+ }
51
+ return `<span class="hover-group group-${i + offset}">${spanLeadingZeroesSimple(g)}</span>`;
52
+ });
53
+ }
54
+ //# sourceMappingURL=helpers.js.map