meteor-node-stubs 1.2.1 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/asn1.js/node_modules/bn.js/package.json +2 -2
- package/node_modules/asn1.js/package.json +2 -2
- package/node_modules/assert/package.json +2 -2
- package/node_modules/available-typed-arrays/package.json +2 -2
- package/node_modules/base64-js/package.json +2 -2
- package/node_modules/bn.js/package.json +2 -2
- package/node_modules/brorand/package.json +2 -2
- package/node_modules/browserify-aes/package.json +2 -2
- package/node_modules/browserify-cipher/package.json +2 -2
- package/node_modules/browserify-des/package.json +2 -2
- package/node_modules/browserify-rsa/package.json +2 -2
- package/node_modules/browserify-sign/package.json +2 -2
- package/node_modules/browserify-zlib/package.json +2 -2
- package/node_modules/buffer/AUTHORS.md +0 -3
- package/node_modules/buffer/README.md +1 -1
- package/node_modules/buffer/index.d.ts +3 -11
- package/node_modules/buffer/index.js +135 -424
- package/node_modules/buffer/package.json +22 -19
- package/node_modules/buffer-xor/package.json +2 -2
- package/node_modules/builtin-status-codes/package.json +2 -2
- package/node_modules/call-bind/package.json +2 -2
- package/node_modules/cipher-base/package.json +2 -2
- package/node_modules/console-browserify/package.json +2 -2
- package/node_modules/constants-browserify/package.json +2 -2
- package/node_modules/create-ecdh/node_modules/bn.js/package.json +2 -2
- package/node_modules/create-ecdh/package.json +2 -2
- package/node_modules/create-hash/package.json +2 -2
- package/node_modules/create-hmac/package.json +2 -2
- package/node_modules/crypto-browserify/package.json +2 -2
- package/node_modules/define-properties/package.json +2 -2
- package/node_modules/des.js/package.json +2 -2
- package/node_modules/diffie-hellman/node_modules/bn.js/package.json +2 -2
- package/node_modules/diffie-hellman/package.json +2 -2
- package/node_modules/domain-browser/HISTORY.md +12 -0
- package/node_modules/domain-browser/LICENSE.md +1 -1
- package/node_modules/domain-browser/README.md +2 -2
- package/node_modules/domain-browser/package.json +23 -25
- package/node_modules/elliptic/node_modules/bn.js/package.json +2 -2
- package/node_modules/elliptic/package.json +2 -2
- package/node_modules/es-abstract/package.json +2 -2
- package/node_modules/es-to-primitive/package.json +2 -2
- package/node_modules/es6-object-assign/package.json +2 -2
- package/node_modules/events/package.json +2 -2
- package/node_modules/evp_bytestokey/package.json +2 -2
- package/node_modules/foreach/package.json +2 -2
- package/node_modules/function-bind/package.json +2 -2
- package/node_modules/get-intrinsic/package.json +2 -2
- package/node_modules/has/package.json +2 -2
- package/node_modules/has-bigints/package.json +2 -2
- package/node_modules/has-symbols/package.json +2 -2
- package/node_modules/hash-base/package.json +2 -2
- package/node_modules/hash.js/package.json +2 -2
- package/node_modules/hmac-drbg/package.json +2 -2
- package/node_modules/https-browserify/package.json +2 -2
- package/node_modules/ieee754/package.json +2 -2
- package/node_modules/inherits/package.json +2 -2
- package/node_modules/is-arguments/package.json +2 -2
- package/node_modules/is-bigint/package.json +2 -2
- package/node_modules/is-boolean-object/package.json +2 -2
- package/node_modules/is-callable/package.json +2 -2
- package/node_modules/is-date-object/package.json +2 -2
- package/node_modules/is-generator-function/package.json +2 -2
- package/node_modules/is-nan/package.json +2 -2
- package/node_modules/is-negative-zero/package.json +2 -2
- package/node_modules/is-number-object/package.json +2 -2
- package/node_modules/is-regex/package.json +2 -2
- package/node_modules/is-string/package.json +2 -2
- package/node_modules/is-symbol/package.json +2 -2
- package/node_modules/is-typed-array/package.json +2 -2
- package/node_modules/md5.js/package.json +2 -2
- package/node_modules/miller-rabin/node_modules/bn.js/package.json +2 -2
- package/node_modules/miller-rabin/package.json +2 -2
- package/node_modules/minimalistic-assert/package.json +2 -2
- package/node_modules/minimalistic-crypto-utils/package.json +2 -2
- package/node_modules/object-inspect/package.json +2 -2
- package/node_modules/object-is/package.json +2 -2
- package/node_modules/object-keys/package.json +2 -2
- package/node_modules/object.assign/package.json +2 -2
- package/node_modules/os-browserify/package.json +2 -2
- package/node_modules/pako/package.json +2 -2
- package/node_modules/parse-asn1/package.json +2 -2
- package/node_modules/path-browserify/package.json +2 -2
- package/node_modules/pbkdf2/package.json +2 -2
- package/node_modules/process/package.json +2 -2
- package/node_modules/public-encrypt/node_modules/bn.js/package.json +2 -2
- package/node_modules/public-encrypt/package.json +2 -2
- package/node_modules/punycode/README.md +63 -9
- package/node_modules/punycode/package.json +25 -23
- package/node_modules/punycode/punycode.js +478 -385
- package/node_modules/querystring/package.json +2 -2
- package/node_modules/querystring-es3/package.json +2 -2
- package/node_modules/randombytes/package.json +2 -2
- package/node_modules/randomfill/package.json +2 -2
- package/node_modules/readable-stream/package.json +2 -2
- package/node_modules/ripemd160/package.json +2 -2
- package/node_modules/safe-buffer/package.json +2 -2
- package/node_modules/safer-buffer/package.json +2 -2
- package/node_modules/setimmediate/package.json +2 -2
- package/node_modules/sha.js/package.json +2 -2
- package/node_modules/stream-browserify/package.json +2 -2
- package/node_modules/stream-http/package.json +2 -2
- package/node_modules/string.prototype.trimend/package.json +2 -2
- package/node_modules/string.prototype.trimstart/package.json +2 -2
- package/node_modules/string_decoder/package.json +2 -2
- package/node_modules/timers-browserify/package.json +2 -2
- package/node_modules/tty-browserify/package.json +2 -2
- package/node_modules/unbox-primitive/package.json +2 -2
- package/node_modules/url/node_modules/punycode/package.json +2 -2
- package/node_modules/url/package.json +2 -2
- package/node_modules/util/package.json +2 -2
- package/node_modules/util-deprecate/package.json +2 -2
- package/node_modules/vm-browserify/package.json +2 -2
- package/node_modules/which-boxed-primitive/package.json +2 -2
- package/node_modules/which-typed-array/package.json +2 -2
- package/node_modules/xtend/package.json +2 -2
- package/package.json +7 -7
- package/node_modules/domain-browser/.mergify.yml +0 -8
- package/node_modules/punycode/punycode.es6.js +0 -441
|
@@ -1,440 +1,533 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** Regular expressions */
|
|
17
|
-
const regexPunycode = /^xn--/;
|
|
18
|
-
const regexNonASCII = /[^\0-\x7E]/; // non-ASCII chars
|
|
19
|
-
const regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g; // RFC 3490 separators
|
|
20
|
-
|
|
21
|
-
/** Error messages */
|
|
22
|
-
const errors = {
|
|
23
|
-
'overflow': 'Overflow: input needs wider integers to process',
|
|
24
|
-
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
25
|
-
'invalid-input': 'Invalid input'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/** Convenience shortcuts */
|
|
29
|
-
const baseMinusTMin = base - tMin;
|
|
30
|
-
const floor = Math.floor;
|
|
31
|
-
const stringFromCharCode = String.fromCharCode;
|
|
32
|
-
|
|
33
|
-
/*--------------------------------------------------------------------------*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A generic error utility function.
|
|
37
|
-
* @private
|
|
38
|
-
* @param {String} type The error type.
|
|
39
|
-
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
40
|
-
*/
|
|
41
|
-
function error(type) {
|
|
42
|
-
throw new RangeError(errors[type]);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* A generic `Array#map` utility function.
|
|
47
|
-
* @private
|
|
48
|
-
* @param {Array} array The array to iterate over.
|
|
49
|
-
* @param {Function} callback The function that gets called for every array
|
|
50
|
-
* item.
|
|
51
|
-
* @returns {Array} A new array of values returned by the callback function.
|
|
52
|
-
*/
|
|
53
|
-
function map(array, fn) {
|
|
54
|
-
const result = [];
|
|
55
|
-
let length = array.length;
|
|
56
|
-
while (length--) {
|
|
57
|
-
result[length] = fn(array[length]);
|
|
1
|
+
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
2
|
+
;(function(root) {
|
|
3
|
+
|
|
4
|
+
/** Detect free variables */
|
|
5
|
+
var freeExports = typeof exports == 'object' && exports &&
|
|
6
|
+
!exports.nodeType && exports;
|
|
7
|
+
var freeModule = typeof module == 'object' && module &&
|
|
8
|
+
!module.nodeType && module;
|
|
9
|
+
var freeGlobal = typeof global == 'object' && global;
|
|
10
|
+
if (
|
|
11
|
+
freeGlobal.global === freeGlobal ||
|
|
12
|
+
freeGlobal.window === freeGlobal ||
|
|
13
|
+
freeGlobal.self === freeGlobal
|
|
14
|
+
) {
|
|
15
|
+
root = freeGlobal;
|
|
58
16
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The `punycode` object.
|
|
20
|
+
* @name punycode
|
|
21
|
+
* @type Object
|
|
22
|
+
*/
|
|
23
|
+
var punycode,
|
|
24
|
+
|
|
25
|
+
/** Highest positive signed 32-bit float value */
|
|
26
|
+
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
|
|
27
|
+
|
|
28
|
+
/** Bootstring parameters */
|
|
29
|
+
base = 36,
|
|
30
|
+
tMin = 1,
|
|
31
|
+
tMax = 26,
|
|
32
|
+
skew = 38,
|
|
33
|
+
damp = 700,
|
|
34
|
+
initialBias = 72,
|
|
35
|
+
initialN = 128, // 0x80
|
|
36
|
+
delimiter = '-', // '\x2D'
|
|
37
|
+
|
|
38
|
+
/** Regular expressions */
|
|
39
|
+
regexPunycode = /^xn--/,
|
|
40
|
+
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
|
|
41
|
+
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
|
|
42
|
+
|
|
43
|
+
/** Error messages */
|
|
44
|
+
errors = {
|
|
45
|
+
'overflow': 'Overflow: input needs wider integers to process',
|
|
46
|
+
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
|
|
47
|
+
'invalid-input': 'Invalid input'
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/** Convenience shortcuts */
|
|
51
|
+
baseMinusTMin = base - tMin,
|
|
52
|
+
floor = Math.floor,
|
|
53
|
+
stringFromCharCode = String.fromCharCode,
|
|
54
|
+
|
|
55
|
+
/** Temporary variable */
|
|
56
|
+
key;
|
|
57
|
+
|
|
58
|
+
/*--------------------------------------------------------------------------*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* A generic error utility function.
|
|
62
|
+
* @private
|
|
63
|
+
* @param {String} type The error type.
|
|
64
|
+
* @returns {Error} Throws a `RangeError` with the applicable error message.
|
|
65
|
+
*/
|
|
66
|
+
function error(type) {
|
|
67
|
+
throw new RangeError(errors[type]);
|
|
80
68
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A generic `Array#map` utility function.
|
|
72
|
+
* @private
|
|
73
|
+
* @param {Array} array The array to iterate over.
|
|
74
|
+
* @param {Function} callback The function that gets called for every array
|
|
75
|
+
* item.
|
|
76
|
+
* @returns {Array} A new array of values returned by the callback function.
|
|
77
|
+
*/
|
|
78
|
+
function map(array, fn) {
|
|
79
|
+
var length = array.length;
|
|
80
|
+
var result = [];
|
|
81
|
+
while (length--) {
|
|
82
|
+
result[length] = fn(array[length]);
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* A simple `Array#map`-like wrapper to work with domain name strings or email
|
|
89
|
+
* addresses.
|
|
90
|
+
* @private
|
|
91
|
+
* @param {String} domain The domain name or email address.
|
|
92
|
+
* @param {Function} callback The function that gets called for every
|
|
93
|
+
* character.
|
|
94
|
+
* @returns {Array} A new string of characters returned by the callback
|
|
95
|
+
* function.
|
|
96
|
+
*/
|
|
97
|
+
function mapDomain(string, fn) {
|
|
98
|
+
var parts = string.split('@');
|
|
99
|
+
var result = '';
|
|
100
|
+
if (parts.length > 1) {
|
|
101
|
+
// In email addresses, only the domain name should be punycoded. Leave
|
|
102
|
+
// the local part (i.e. everything up to `@`) intact.
|
|
103
|
+
result = parts[0] + '@';
|
|
104
|
+
string = parts[1];
|
|
105
|
+
}
|
|
106
|
+
// Avoid `split(regex)` for IE8 compatibility. See #17.
|
|
107
|
+
string = string.replace(regexSeparators, '\x2E');
|
|
108
|
+
var labels = string.split('.');
|
|
109
|
+
var encoded = map(labels, fn).join('.');
|
|
110
|
+
return result + encoded;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Creates an array containing the numeric code points of each Unicode
|
|
115
|
+
* character in the string. While JavaScript uses UCS-2 internally,
|
|
116
|
+
* this function will convert a pair of surrogate halves (each of which
|
|
117
|
+
* UCS-2 exposes as separate characters) into a single code point,
|
|
118
|
+
* matching UTF-16.
|
|
119
|
+
* @see `punycode.ucs2.encode`
|
|
120
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
121
|
+
* @memberOf punycode.ucs2
|
|
122
|
+
* @name decode
|
|
123
|
+
* @param {String} string The Unicode input string (UCS-2).
|
|
124
|
+
* @returns {Array} The new array of code points.
|
|
125
|
+
*/
|
|
126
|
+
function ucs2decode(string) {
|
|
127
|
+
var output = [],
|
|
128
|
+
counter = 0,
|
|
129
|
+
length = string.length,
|
|
130
|
+
value,
|
|
131
|
+
extra;
|
|
132
|
+
while (counter < length) {
|
|
133
|
+
value = string.charCodeAt(counter++);
|
|
134
|
+
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
|
|
135
|
+
// high surrogate, and there is a next character
|
|
136
|
+
extra = string.charCodeAt(counter++);
|
|
137
|
+
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
|
|
138
|
+
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
|
|
139
|
+
} else {
|
|
140
|
+
// unmatched surrogate; only append this code unit, in case the next
|
|
141
|
+
// code unit is the high surrogate of a surrogate pair
|
|
142
|
+
output.push(value);
|
|
143
|
+
counter--;
|
|
144
|
+
}
|
|
112
145
|
} else {
|
|
113
|
-
// It's an unmatched surrogate; only append this code unit, in case the
|
|
114
|
-
// next code unit is the high surrogate of a surrogate pair.
|
|
115
146
|
output.push(value);
|
|
116
|
-
counter--;
|
|
117
147
|
}
|
|
118
|
-
} else {
|
|
119
|
-
output.push(value);
|
|
120
148
|
}
|
|
149
|
+
return output;
|
|
121
150
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* the code point does not represent a value.
|
|
143
|
-
*/
|
|
144
|
-
const basicToDigit = function(codePoint) {
|
|
145
|
-
if (codePoint - 0x30 < 0x0A) {
|
|
146
|
-
return codePoint - 0x16;
|
|
147
|
-
}
|
|
148
|
-
if (codePoint - 0x41 < 0x1A) {
|
|
149
|
-
return codePoint - 0x41;
|
|
150
|
-
}
|
|
151
|
-
if (codePoint - 0x61 < 0x1A) {
|
|
152
|
-
return codePoint - 0x61;
|
|
153
|
-
}
|
|
154
|
-
return base;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Converts a digit/integer into a basic code point.
|
|
159
|
-
* @see `basicToDigit()`
|
|
160
|
-
* @private
|
|
161
|
-
* @param {Number} digit The numeric value of a basic code point.
|
|
162
|
-
* @returns {Number} The basic code point whose value (when used for
|
|
163
|
-
* representing integers) is `digit`, which needs to be in the range
|
|
164
|
-
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
165
|
-
* used; else, the lowercase form is used. The behavior is undefined
|
|
166
|
-
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
167
|
-
*/
|
|
168
|
-
const digitToBasic = function(digit, flag) {
|
|
169
|
-
// 0..25 map to ASCII a..z or A..Z
|
|
170
|
-
// 26..35 map to ASCII 0..9
|
|
171
|
-
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
176
|
-
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
177
|
-
* @private
|
|
178
|
-
*/
|
|
179
|
-
const adapt = function(delta, numPoints, firstTime) {
|
|
180
|
-
let k = 0;
|
|
181
|
-
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
182
|
-
delta += floor(delta / numPoints);
|
|
183
|
-
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
184
|
-
delta = floor(delta / baseMinusTMin);
|
|
185
|
-
}
|
|
186
|
-
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
191
|
-
* symbols.
|
|
192
|
-
* @memberOf punycode
|
|
193
|
-
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
194
|
-
* @returns {String} The resulting string of Unicode symbols.
|
|
195
|
-
*/
|
|
196
|
-
const decode = function(input) {
|
|
197
|
-
// Don't use UCS-2.
|
|
198
|
-
const output = [];
|
|
199
|
-
const inputLength = input.length;
|
|
200
|
-
let i = 0;
|
|
201
|
-
let n = initialN;
|
|
202
|
-
let bias = initialBias;
|
|
203
|
-
|
|
204
|
-
// Handle the basic code points: let `basic` be the number of input code
|
|
205
|
-
// points before the last delimiter, or `0` if there is none, then copy
|
|
206
|
-
// the first basic code points to the output.
|
|
207
|
-
|
|
208
|
-
let basic = input.lastIndexOf(delimiter);
|
|
209
|
-
if (basic < 0) {
|
|
210
|
-
basic = 0;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Creates a string based on an array of numeric code points.
|
|
154
|
+
* @see `punycode.ucs2.decode`
|
|
155
|
+
* @memberOf punycode.ucs2
|
|
156
|
+
* @name encode
|
|
157
|
+
* @param {Array} codePoints The array of numeric code points.
|
|
158
|
+
* @returns {String} The new Unicode string (UCS-2).
|
|
159
|
+
*/
|
|
160
|
+
function ucs2encode(array) {
|
|
161
|
+
return map(array, function(value) {
|
|
162
|
+
var output = '';
|
|
163
|
+
if (value > 0xFFFF) {
|
|
164
|
+
value -= 0x10000;
|
|
165
|
+
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
|
|
166
|
+
value = 0xDC00 | value & 0x3FF;
|
|
167
|
+
}
|
|
168
|
+
output += stringFromCharCode(value);
|
|
169
|
+
return output;
|
|
170
|
+
}).join('');
|
|
211
171
|
}
|
|
212
172
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Converts a basic code point into a digit/integer.
|
|
175
|
+
* @see `digitToBasic()`
|
|
176
|
+
* @private
|
|
177
|
+
* @param {Number} codePoint The basic numeric code point value.
|
|
178
|
+
* @returns {Number} The numeric value of a basic code point (for use in
|
|
179
|
+
* representing integers) in the range `0` to `base - 1`, or `base` if
|
|
180
|
+
* the code point does not represent a value.
|
|
181
|
+
*/
|
|
182
|
+
function basicToDigit(codePoint) {
|
|
183
|
+
if (codePoint - 48 < 10) {
|
|
184
|
+
return codePoint - 22;
|
|
185
|
+
}
|
|
186
|
+
if (codePoint - 65 < 26) {
|
|
187
|
+
return codePoint - 65;
|
|
217
188
|
}
|
|
218
|
-
|
|
189
|
+
if (codePoint - 97 < 26) {
|
|
190
|
+
return codePoint - 97;
|
|
191
|
+
}
|
|
192
|
+
return base;
|
|
219
193
|
}
|
|
220
194
|
|
|
221
|
-
|
|
222
|
-
|
|
195
|
+
/**
|
|
196
|
+
* Converts a digit/integer into a basic code point.
|
|
197
|
+
* @see `basicToDigit()`
|
|
198
|
+
* @private
|
|
199
|
+
* @param {Number} digit The numeric value of a basic code point.
|
|
200
|
+
* @returns {Number} The basic code point whose value (when used for
|
|
201
|
+
* representing integers) is `digit`, which needs to be in the range
|
|
202
|
+
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
|
|
203
|
+
* used; else, the lowercase form is used. The behavior is undefined
|
|
204
|
+
* if `flag` is non-zero and `digit` has no uppercase form.
|
|
205
|
+
*/
|
|
206
|
+
function digitToBasic(digit, flag) {
|
|
207
|
+
// 0..25 map to ASCII a..z or A..Z
|
|
208
|
+
// 26..35 map to ASCII 0..9
|
|
209
|
+
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
|
|
210
|
+
}
|
|
223
211
|
|
|
224
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Bias adaptation function as per section 3.4 of RFC 3492.
|
|
214
|
+
* https://tools.ietf.org/html/rfc3492#section-3.4
|
|
215
|
+
* @private
|
|
216
|
+
*/
|
|
217
|
+
function adapt(delta, numPoints, firstTime) {
|
|
218
|
+
var k = 0;
|
|
219
|
+
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
220
|
+
delta += floor(delta / numPoints);
|
|
221
|
+
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
|
|
222
|
+
delta = floor(delta / baseMinusTMin);
|
|
223
|
+
}
|
|
224
|
+
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
|
|
225
|
+
}
|
|
225
226
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
/**
|
|
228
|
+
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
|
|
229
|
+
* symbols.
|
|
230
|
+
* @memberOf punycode
|
|
231
|
+
* @param {String} input The Punycode string of ASCII-only symbols.
|
|
232
|
+
* @returns {String} The resulting string of Unicode symbols.
|
|
233
|
+
*/
|
|
234
|
+
function decode(input) {
|
|
235
|
+
// Don't use UCS-2
|
|
236
|
+
var output = [],
|
|
237
|
+
inputLength = input.length,
|
|
238
|
+
out,
|
|
239
|
+
i = 0,
|
|
240
|
+
n = initialN,
|
|
241
|
+
bias = initialBias,
|
|
242
|
+
basic,
|
|
243
|
+
j,
|
|
244
|
+
index,
|
|
245
|
+
oldi,
|
|
246
|
+
w,
|
|
247
|
+
k,
|
|
248
|
+
digit,
|
|
249
|
+
t,
|
|
250
|
+
/** Cached calculation results */
|
|
251
|
+
baseMinusT;
|
|
252
|
+
|
|
253
|
+
// Handle the basic code points: let `basic` be the number of input code
|
|
254
|
+
// points before the last delimiter, or `0` if there is none, then copy
|
|
255
|
+
// the first basic code points to the output.
|
|
256
|
+
|
|
257
|
+
basic = input.lastIndexOf(delimiter);
|
|
258
|
+
if (basic < 0) {
|
|
259
|
+
basic = 0;
|
|
260
|
+
}
|
|
233
261
|
|
|
234
|
-
|
|
235
|
-
|
|
262
|
+
for (j = 0; j < basic; ++j) {
|
|
263
|
+
// if it's not a basic code point
|
|
264
|
+
if (input.charCodeAt(j) >= 0x80) {
|
|
265
|
+
error('not-basic');
|
|
236
266
|
}
|
|
267
|
+
output.push(input.charCodeAt(j));
|
|
268
|
+
}
|
|
237
269
|
|
|
238
|
-
|
|
270
|
+
// Main decoding loop: start just after the last delimiter if any basic code
|
|
271
|
+
// points were copied; start at the beginning otherwise.
|
|
239
272
|
|
|
240
|
-
|
|
241
|
-
error('overflow');
|
|
242
|
-
}
|
|
273
|
+
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
|
|
243
274
|
|
|
244
|
-
|
|
245
|
-
|
|
275
|
+
// `index` is the index of the next character to be consumed.
|
|
276
|
+
// Decode a generalized variable-length integer into `delta`,
|
|
277
|
+
// which gets added to `i`. The overflow checking is easier
|
|
278
|
+
// if we increase `i` as we go, then subtract off its starting
|
|
279
|
+
// value at the end to obtain `delta`.
|
|
280
|
+
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
|
|
246
281
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
282
|
+
if (index >= inputLength) {
|
|
283
|
+
error('invalid-input');
|
|
284
|
+
}
|
|
250
285
|
|
|
251
|
-
|
|
252
|
-
if (w > floor(maxInt / baseMinusT)) {
|
|
253
|
-
error('overflow');
|
|
254
|
-
}
|
|
286
|
+
digit = basicToDigit(input.charCodeAt(index++));
|
|
255
287
|
|
|
256
|
-
|
|
288
|
+
if (digit >= base || digit > floor((maxInt - i) / w)) {
|
|
289
|
+
error('overflow');
|
|
290
|
+
}
|
|
257
291
|
|
|
258
|
-
|
|
292
|
+
i += digit * w;
|
|
293
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
259
294
|
|
|
260
|
-
|
|
261
|
-
|
|
295
|
+
if (digit < t) {
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
262
298
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
299
|
+
baseMinusT = base - t;
|
|
300
|
+
if (w > floor(maxInt / baseMinusT)) {
|
|
301
|
+
error('overflow');
|
|
302
|
+
}
|
|
268
303
|
|
|
269
|
-
|
|
270
|
-
i %= out;
|
|
304
|
+
w *= baseMinusT;
|
|
271
305
|
|
|
272
|
-
|
|
273
|
-
output.splice(i++, 0, n);
|
|
306
|
+
}
|
|
274
307
|
|
|
275
|
-
|
|
308
|
+
out = output.length + 1;
|
|
309
|
+
bias = adapt(i - oldi, out, oldi == 0);
|
|
276
310
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
* Punycode string of ASCII-only symbols.
|
|
283
|
-
* @memberOf punycode
|
|
284
|
-
* @param {String} input The string of Unicode symbols.
|
|
285
|
-
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
286
|
-
*/
|
|
287
|
-
const encode = function(input) {
|
|
288
|
-
const output = [];
|
|
289
|
-
|
|
290
|
-
// Convert the input in UCS-2 to an array of Unicode code points.
|
|
291
|
-
input = ucs2decode(input);
|
|
292
|
-
|
|
293
|
-
// Cache the length.
|
|
294
|
-
let inputLength = input.length;
|
|
295
|
-
|
|
296
|
-
// Initialize the state.
|
|
297
|
-
let n = initialN;
|
|
298
|
-
let delta = 0;
|
|
299
|
-
let bias = initialBias;
|
|
300
|
-
|
|
301
|
-
// Handle the basic code points.
|
|
302
|
-
for (const currentValue of input) {
|
|
303
|
-
if (currentValue < 0x80) {
|
|
304
|
-
output.push(stringFromCharCode(currentValue));
|
|
305
|
-
}
|
|
306
|
-
}
|
|
311
|
+
// `i` was supposed to wrap around from `out` to `0`,
|
|
312
|
+
// incrementing `n` each time, so we'll fix that now:
|
|
313
|
+
if (floor(i / out) > maxInt - n) {
|
|
314
|
+
error('overflow');
|
|
315
|
+
}
|
|
307
316
|
|
|
308
|
-
|
|
309
|
-
|
|
317
|
+
n += floor(i / out);
|
|
318
|
+
i %= out;
|
|
310
319
|
|
|
311
|
-
|
|
312
|
-
|
|
320
|
+
// Insert `n` at position `i` of the output
|
|
321
|
+
output.splice(i++, 0, n);
|
|
313
322
|
|
|
314
|
-
|
|
315
|
-
if (basicLength) {
|
|
316
|
-
output.push(delimiter);
|
|
317
|
-
}
|
|
323
|
+
}
|
|
318
324
|
|
|
319
|
-
|
|
320
|
-
|
|
325
|
+
return ucs2encode(output);
|
|
326
|
+
}
|
|
321
327
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
/**
|
|
329
|
+
* Converts a string of Unicode symbols (e.g. a domain name label) to a
|
|
330
|
+
* Punycode string of ASCII-only symbols.
|
|
331
|
+
* @memberOf punycode
|
|
332
|
+
* @param {String} input The string of Unicode symbols.
|
|
333
|
+
* @returns {String} The resulting Punycode string of ASCII-only symbols.
|
|
334
|
+
*/
|
|
335
|
+
function encode(input) {
|
|
336
|
+
var n,
|
|
337
|
+
delta,
|
|
338
|
+
handledCPCount,
|
|
339
|
+
basicLength,
|
|
340
|
+
bias,
|
|
341
|
+
j,
|
|
342
|
+
m,
|
|
343
|
+
q,
|
|
344
|
+
k,
|
|
345
|
+
t,
|
|
346
|
+
currentValue,
|
|
347
|
+
output = [],
|
|
348
|
+
/** `inputLength` will hold the number of code points in `input`. */
|
|
349
|
+
inputLength,
|
|
350
|
+
/** Cached calculation results */
|
|
351
|
+
handledCPCountPlusOne,
|
|
352
|
+
baseMinusT,
|
|
353
|
+
qMinusT;
|
|
354
|
+
|
|
355
|
+
// Convert the input in UCS-2 to Unicode
|
|
356
|
+
input = ucs2decode(input);
|
|
357
|
+
|
|
358
|
+
// Cache the length
|
|
359
|
+
inputLength = input.length;
|
|
360
|
+
|
|
361
|
+
// Initialize the state
|
|
362
|
+
n = initialN;
|
|
363
|
+
delta = 0;
|
|
364
|
+
bias = initialBias;
|
|
365
|
+
|
|
366
|
+
// Handle the basic code points
|
|
367
|
+
for (j = 0; j < inputLength; ++j) {
|
|
368
|
+
currentValue = input[j];
|
|
369
|
+
if (currentValue < 0x80) {
|
|
370
|
+
output.push(stringFromCharCode(currentValue));
|
|
328
371
|
}
|
|
329
372
|
}
|
|
330
373
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
374
|
+
handledCPCount = basicLength = output.length;
|
|
375
|
+
|
|
376
|
+
// `handledCPCount` is the number of code points that have been handled;
|
|
377
|
+
// `basicLength` is the number of basic code points.
|
|
378
|
+
|
|
379
|
+
// Finish the basic string - if it is not empty - with a delimiter
|
|
380
|
+
if (basicLength) {
|
|
381
|
+
output.push(delimiter);
|
|
336
382
|
}
|
|
337
383
|
|
|
338
|
-
|
|
339
|
-
|
|
384
|
+
// Main encoding loop:
|
|
385
|
+
while (handledCPCount < inputLength) {
|
|
386
|
+
|
|
387
|
+
// All non-basic code points < n have been handled already. Find the next
|
|
388
|
+
// larger one:
|
|
389
|
+
for (m = maxInt, j = 0; j < inputLength; ++j) {
|
|
390
|
+
currentValue = input[j];
|
|
391
|
+
if (currentValue >= n && currentValue < m) {
|
|
392
|
+
m = currentValue;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
340
395
|
|
|
341
|
-
|
|
342
|
-
|
|
396
|
+
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
|
|
397
|
+
// but guard against overflow
|
|
398
|
+
handledCPCountPlusOne = handledCPCount + 1;
|
|
399
|
+
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
|
|
343
400
|
error('overflow');
|
|
344
401
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const baseMinusT = base - t;
|
|
355
|
-
output.push(
|
|
356
|
-
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
357
|
-
);
|
|
358
|
-
q = floor(qMinusT / baseMinusT);
|
|
402
|
+
|
|
403
|
+
delta += (m - n) * handledCPCountPlusOne;
|
|
404
|
+
n = m;
|
|
405
|
+
|
|
406
|
+
for (j = 0; j < inputLength; ++j) {
|
|
407
|
+
currentValue = input[j];
|
|
408
|
+
|
|
409
|
+
if (currentValue < n && ++delta > maxInt) {
|
|
410
|
+
error('overflow');
|
|
359
411
|
}
|
|
360
412
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
413
|
+
if (currentValue == n) {
|
|
414
|
+
// Represent delta as a generalized variable-length integer
|
|
415
|
+
for (q = delta, k = base; /* no condition */; k += base) {
|
|
416
|
+
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
|
|
417
|
+
if (q < t) {
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
qMinusT = q - t;
|
|
421
|
+
baseMinusT = base - t;
|
|
422
|
+
output.push(
|
|
423
|
+
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
|
|
424
|
+
);
|
|
425
|
+
q = floor(qMinusT / baseMinusT);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
429
|
+
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
|
|
430
|
+
delta = 0;
|
|
431
|
+
++handledCPCount;
|
|
432
|
+
}
|
|
365
433
|
}
|
|
366
|
-
}
|
|
367
434
|
|
|
368
|
-
|
|
369
|
-
|
|
435
|
+
++delta;
|
|
436
|
+
++n;
|
|
370
437
|
|
|
438
|
+
}
|
|
439
|
+
return output.join('');
|
|
371
440
|
}
|
|
372
|
-
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
/**
|
|
376
|
-
* Converts a Punycode string representing a domain name or an email address
|
|
377
|
-
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
378
|
-
* it doesn't matter if you call it on a string that has already been
|
|
379
|
-
* converted to Unicode.
|
|
380
|
-
* @memberOf punycode
|
|
381
|
-
* @param {String} input The Punycoded domain name or email address to
|
|
382
|
-
* convert to Unicode.
|
|
383
|
-
* @returns {String} The Unicode representation of the given Punycode
|
|
384
|
-
* string.
|
|
385
|
-
*/
|
|
386
|
-
const toUnicode = function(input) {
|
|
387
|
-
return mapDomain(input, function(string) {
|
|
388
|
-
return regexPunycode.test(string)
|
|
389
|
-
? decode(string.slice(4).toLowerCase())
|
|
390
|
-
: string;
|
|
391
|
-
});
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Converts a Unicode string representing a domain name or an email address to
|
|
396
|
-
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
397
|
-
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
398
|
-
* ASCII.
|
|
399
|
-
* @memberOf punycode
|
|
400
|
-
* @param {String} input The domain name or email address to convert, as a
|
|
401
|
-
* Unicode string.
|
|
402
|
-
* @returns {String} The Punycode representation of the given domain name or
|
|
403
|
-
* email address.
|
|
404
|
-
*/
|
|
405
|
-
const toASCII = function(input) {
|
|
406
|
-
return mapDomain(input, function(string) {
|
|
407
|
-
return regexNonASCII.test(string)
|
|
408
|
-
? 'xn--' + encode(string)
|
|
409
|
-
: string;
|
|
410
|
-
});
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
/*--------------------------------------------------------------------------*/
|
|
414
|
-
|
|
415
|
-
/** Define the public API */
|
|
416
|
-
const punycode = {
|
|
441
|
+
|
|
417
442
|
/**
|
|
418
|
-
*
|
|
443
|
+
* Converts a Punycode string representing a domain name or an email address
|
|
444
|
+
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
|
|
445
|
+
* it doesn't matter if you call it on a string that has already been
|
|
446
|
+
* converted to Unicode.
|
|
419
447
|
* @memberOf punycode
|
|
420
|
-
* @
|
|
448
|
+
* @param {String} input The Punycoded domain name or email address to
|
|
449
|
+
* convert to Unicode.
|
|
450
|
+
* @returns {String} The Unicode representation of the given Punycode
|
|
451
|
+
* string.
|
|
421
452
|
*/
|
|
422
|
-
|
|
453
|
+
function toUnicode(input) {
|
|
454
|
+
return mapDomain(input, function(string) {
|
|
455
|
+
return regexPunycode.test(string)
|
|
456
|
+
? decode(string.slice(4).toLowerCase())
|
|
457
|
+
: string;
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
|
|
423
461
|
/**
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
462
|
+
* Converts a Unicode string representing a domain name or an email address to
|
|
463
|
+
* Punycode. Only the non-ASCII parts of the domain name will be converted,
|
|
464
|
+
* i.e. it doesn't matter if you call it with a domain that's already in
|
|
465
|
+
* ASCII.
|
|
427
466
|
* @memberOf punycode
|
|
428
|
-
* @
|
|
467
|
+
* @param {String} input The domain name or email address to convert, as a
|
|
468
|
+
* Unicode string.
|
|
469
|
+
* @returns {String} The Punycode representation of the given domain name or
|
|
470
|
+
* email address.
|
|
429
471
|
*/
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
472
|
+
function toASCII(input) {
|
|
473
|
+
return mapDomain(input, function(string) {
|
|
474
|
+
return regexNonASCII.test(string)
|
|
475
|
+
? 'xn--' + encode(string)
|
|
476
|
+
: string;
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/*--------------------------------------------------------------------------*/
|
|
481
|
+
|
|
482
|
+
/** Define the public API */
|
|
483
|
+
punycode = {
|
|
484
|
+
/**
|
|
485
|
+
* A string representing the current Punycode.js version number.
|
|
486
|
+
* @memberOf punycode
|
|
487
|
+
* @type String
|
|
488
|
+
*/
|
|
489
|
+
'version': '1.4.1',
|
|
490
|
+
/**
|
|
491
|
+
* An object of methods to convert from JavaScript's internal character
|
|
492
|
+
* representation (UCS-2) to Unicode code points, and back.
|
|
493
|
+
* @see <https://mathiasbynens.be/notes/javascript-encoding>
|
|
494
|
+
* @memberOf punycode
|
|
495
|
+
* @type Object
|
|
496
|
+
*/
|
|
497
|
+
'ucs2': {
|
|
498
|
+
'decode': ucs2decode,
|
|
499
|
+
'encode': ucs2encode
|
|
500
|
+
},
|
|
501
|
+
'decode': decode,
|
|
502
|
+
'encode': encode,
|
|
503
|
+
'toASCII': toASCII,
|
|
504
|
+
'toUnicode': toUnicode
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
/** Expose `punycode` */
|
|
508
|
+
// Some AMD build optimizers, like r.js, check for specific condition patterns
|
|
509
|
+
// like the following:
|
|
510
|
+
if (
|
|
511
|
+
typeof define == 'function' &&
|
|
512
|
+
typeof define.amd == 'object' &&
|
|
513
|
+
define.amd
|
|
514
|
+
) {
|
|
515
|
+
define('punycode', function() {
|
|
516
|
+
return punycode;
|
|
517
|
+
});
|
|
518
|
+
} else if (freeExports && freeModule) {
|
|
519
|
+
if (module.exports == freeExports) {
|
|
520
|
+
// in Node.js, io.js, or RingoJS v0.8.0+
|
|
521
|
+
freeModule.exports = punycode;
|
|
522
|
+
} else {
|
|
523
|
+
// in Narwhal or RingoJS v0.7.0-
|
|
524
|
+
for (key in punycode) {
|
|
525
|
+
punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
} else {
|
|
529
|
+
// in Rhino or a web browser
|
|
530
|
+
root.punycode = punycode;
|
|
531
|
+
}
|
|
439
532
|
|
|
440
|
-
|
|
533
|
+
}(this));
|