miolo 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cli/miolo.cli.iife.bundle.js +3090 -455
  2. package/dist/cli/miolo.cli.iife.bundle.js.map +1 -1
  3. package/dist/cli/miolo.cli.iife.bundle.min.js +2 -2
  4. package/dist/cli/miolo.cli.iife.js +4 -4
  5. package/dist/cli/miolo.cli.iife.js.map +1 -1
  6. package/dist/cli/miolo.cli.iife.min.js +2 -2
  7. package/dist/cli/miolo.cli.min.mjs +2 -2
  8. package/dist/cli/miolo.cli.mjs +3 -3
  9. package/dist/cli/miolo.cli.mjs.map +1 -1
  10. package/dist/cli/miolo.cli.umd.bundle.js +3092 -457
  11. package/dist/cli/miolo.cli.umd.bundle.js.map +1 -1
  12. package/dist/cli/miolo.cli.umd.bundle.min.js +2 -2
  13. package/dist/cli/miolo.cli.umd.js +6 -6
  14. package/dist/cli/miolo.cli.umd.js.map +1 -1
  15. package/dist/cli/miolo.cli.umd.min.js +2 -2
  16. package/dist/cli-react/miolo.cli-react.iife.bundle.js +3145 -510
  17. package/dist/cli-react/miolo.cli-react.iife.bundle.js.map +1 -1
  18. package/dist/cli-react/miolo.cli-react.iife.bundle.min.js +5 -5
  19. package/dist/cli-react/miolo.cli-react.iife.js +4 -4
  20. package/dist/cli-react/miolo.cli-react.iife.js.map +1 -1
  21. package/dist/cli-react/miolo.cli-react.iife.min.js +2 -2
  22. package/dist/cli-react/miolo.cli-react.min.mjs +2 -2
  23. package/dist/cli-react/miolo.cli-react.mjs +3 -3
  24. package/dist/cli-react/miolo.cli-react.mjs.map +1 -1
  25. package/dist/cli-react/miolo.cli-react.umd.bundle.js +3148 -513
  26. package/dist/cli-react/miolo.cli-react.umd.bundle.js.map +1 -1
  27. package/dist/cli-react/miolo.cli-react.umd.bundle.min.js +5 -5
  28. package/dist/cli-react/miolo.cli-react.umd.js +6 -6
  29. package/dist/cli-react/miolo.cli-react.umd.js.map +1 -1
  30. package/dist/cli-react/miolo.cli-react.umd.min.js +2 -2
  31. package/dist/server/miolo.server.cjs +37 -11
  32. package/dist/server/miolo.server.min.mjs +2 -2
  33. package/dist/server/miolo.server.mjs +34 -7
  34. package/dist/server/miolo.server.mjs.map +1 -1
  35. package/dist/server/miolo.server.node.mjs +37 -11
  36. package/package.json +7 -7
@@ -1,5 +1,5 @@
1
1
  /**
2
- * miolo v0.7.2
2
+ * miolo v0.7.4
3
3
  *
4
4
  * Copyright (c) Donato Lorenzo <donato@afialapis.com>
5
5
  *
@@ -8,28 +8,9 @@
8
8
  *
9
9
  * @license MIT
10
10
  */
11
- var miolo = (function (exports, node_util) {
11
+ var miolo = (function (exports) {
12
12
  'use strict';
13
13
 
14
- function _interopNamespaceDefault(e) {
15
- var n = Object.create(null);
16
- if (e) {
17
- Object.keys(e).forEach(function (k) {
18
- if (k !== 'default') {
19
- var d = Object.getOwnPropertyDescriptor(e, k);
20
- Object.defineProperty(n, k, d.get ? d : {
21
- enumerable: true,
22
- get: function () { return e[k]; }
23
- });
24
- }
25
- });
26
- }
27
- n.default = e;
28
- return Object.freeze(n);
29
- }
30
-
31
- var node_util__namespace = /*#__PURE__*/_interopNamespaceDefault(node_util);
32
-
33
14
  function init_catcher(catcher_url, fetcher) {
34
15
  if (typeof window == "undefined") {
35
16
  return;
@@ -918,115 +899,3042 @@ var miolo = (function (exports, node_util) {
918
899
  skipFurtherCaching = true;
919
900
  }
920
901
 
921
- intrinsicBaseName += '.' + part;
922
- intrinsicRealName = '%' + intrinsicBaseName + '%';
902
+ intrinsicBaseName += '.' + part;
903
+ intrinsicRealName = '%' + intrinsicBaseName + '%';
904
+
905
+ if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
906
+ value = INTRINSICS[intrinsicRealName];
907
+ } else if (value != null) {
908
+ if (!(part in value)) {
909
+ if (!allowMissing) {
910
+ throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
911
+ }
912
+ return void undefined$1;
913
+ }
914
+ if ($gOPD && (i + 1) >= parts.length) {
915
+ var desc = $gOPD(value, part);
916
+ isOwn = !!desc;
917
+
918
+ // By convention, when a data property is converted to an accessor
919
+ // property to emulate a data property that does not suffer from
920
+ // the override mistake, that accessor's getter is marked with
921
+ // an `originalValue` property. Here, when we detect this, we
922
+ // uphold the illusion by pretending to see that original data
923
+ // property, i.e., returning the value rather than the getter
924
+ // itself.
925
+ if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
926
+ value = desc.get;
927
+ } else {
928
+ value = value[part];
929
+ }
930
+ } else {
931
+ isOwn = hasOwn$1(value, part);
932
+ value = value[part];
933
+ }
934
+
935
+ if (isOwn && !skipFurtherCaching) {
936
+ INTRINSICS[intrinsicRealName] = value;
937
+ }
938
+ }
939
+ }
940
+ return value;
941
+ };
942
+
943
+ var callBind$1 = {exports: {}};
944
+
945
+ (function (module) {
946
+
947
+ var bind = functionBind;
948
+ var GetIntrinsic = getIntrinsic;
949
+
950
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
951
+ var $call = GetIntrinsic('%Function.prototype.call%');
952
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
953
+
954
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
955
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
956
+ var $max = GetIntrinsic('%Math.max%');
957
+
958
+ if ($defineProperty) {
959
+ try {
960
+ $defineProperty({}, 'a', { value: 1 });
961
+ } catch (e) {
962
+ // IE 8 has a broken defineProperty
963
+ $defineProperty = null;
964
+ }
965
+ }
966
+
967
+ module.exports = function callBind(originalFunction) {
968
+ var func = $reflectApply(bind, $call, arguments);
969
+ if ($gOPD && $defineProperty) {
970
+ var desc = $gOPD(func, 'length');
971
+ if (desc.configurable) {
972
+ // original length, plus the receiver, minus any additional arguments (after the receiver)
973
+ $defineProperty(
974
+ func,
975
+ 'length',
976
+ { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
977
+ );
978
+ }
979
+ }
980
+ return func;
981
+ };
982
+
983
+ var applyBind = function applyBind() {
984
+ return $reflectApply(bind, $apply, arguments);
985
+ };
986
+
987
+ if ($defineProperty) {
988
+ $defineProperty(module.exports, 'apply', { value: applyBind });
989
+ } else {
990
+ module.exports.apply = applyBind;
991
+ }
992
+ } (callBind$1));
993
+
994
+ var callBindExports = callBind$1.exports;
995
+
996
+ var GetIntrinsic$1 = getIntrinsic;
997
+
998
+ var callBind = callBindExports;
999
+
1000
+ var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
1001
+
1002
+ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
1003
+ var intrinsic = GetIntrinsic$1(name, !!allowMissing);
1004
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
1005
+ return callBind(intrinsic);
1006
+ }
1007
+ return intrinsic;
1008
+ };
1009
+
1010
+ var global$1 = (typeof global !== "undefined" ? global :
1011
+ typeof self !== "undefined" ? self :
1012
+ typeof window !== "undefined" ? window : {});
1013
+
1014
+ var lookup = [];
1015
+ var revLookup = [];
1016
+ var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array;
1017
+ var inited = false;
1018
+ function init () {
1019
+ inited = true;
1020
+ var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
1021
+ for (var i = 0, len = code.length; i < len; ++i) {
1022
+ lookup[i] = code[i];
1023
+ revLookup[code.charCodeAt(i)] = i;
1024
+ }
1025
+
1026
+ revLookup['-'.charCodeAt(0)] = 62;
1027
+ revLookup['_'.charCodeAt(0)] = 63;
1028
+ }
1029
+
1030
+ function toByteArray (b64) {
1031
+ if (!inited) {
1032
+ init();
1033
+ }
1034
+ var i, j, l, tmp, placeHolders, arr;
1035
+ var len = b64.length;
1036
+
1037
+ if (len % 4 > 0) {
1038
+ throw new Error('Invalid string. Length must be a multiple of 4')
1039
+ }
1040
+
1041
+ // the number of equal signs (place holders)
1042
+ // if there are two placeholders, than the two characters before it
1043
+ // represent one byte
1044
+ // if there is only one, then the three characters before it represent 2 bytes
1045
+ // this is just a cheap hack to not do indexOf twice
1046
+ placeHolders = b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
1047
+
1048
+ // base64 is 4/3 + up to two characters of the original data
1049
+ arr = new Arr(len * 3 / 4 - placeHolders);
1050
+
1051
+ // if there are placeholders, only get up to the last complete 4 chars
1052
+ l = placeHolders > 0 ? len - 4 : len;
1053
+
1054
+ var L = 0;
1055
+
1056
+ for (i = 0, j = 0; i < l; i += 4, j += 3) {
1057
+ tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)];
1058
+ arr[L++] = (tmp >> 16) & 0xFF;
1059
+ arr[L++] = (tmp >> 8) & 0xFF;
1060
+ arr[L++] = tmp & 0xFF;
1061
+ }
1062
+
1063
+ if (placeHolders === 2) {
1064
+ tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4);
1065
+ arr[L++] = tmp & 0xFF;
1066
+ } else if (placeHolders === 1) {
1067
+ tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2);
1068
+ arr[L++] = (tmp >> 8) & 0xFF;
1069
+ arr[L++] = tmp & 0xFF;
1070
+ }
1071
+
1072
+ return arr
1073
+ }
1074
+
1075
+ function tripletToBase64 (num) {
1076
+ return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
1077
+ }
1078
+
1079
+ function encodeChunk (uint8, start, end) {
1080
+ var tmp;
1081
+ var output = [];
1082
+ for (var i = start; i < end; i += 3) {
1083
+ tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]);
1084
+ output.push(tripletToBase64(tmp));
1085
+ }
1086
+ return output.join('')
1087
+ }
1088
+
1089
+ function fromByteArray (uint8) {
1090
+ if (!inited) {
1091
+ init();
1092
+ }
1093
+ var tmp;
1094
+ var len = uint8.length;
1095
+ var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
1096
+ var output = '';
1097
+ var parts = [];
1098
+ var maxChunkLength = 16383; // must be multiple of 3
1099
+
1100
+ // go through the array every three bytes, we'll deal with trailing stuff later
1101
+ for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
1102
+ parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
1103
+ }
1104
+
1105
+ // pad the end with zeros, but make sure to not forget the extra bytes
1106
+ if (extraBytes === 1) {
1107
+ tmp = uint8[len - 1];
1108
+ output += lookup[tmp >> 2];
1109
+ output += lookup[(tmp << 4) & 0x3F];
1110
+ output += '==';
1111
+ } else if (extraBytes === 2) {
1112
+ tmp = (uint8[len - 2] << 8) + (uint8[len - 1]);
1113
+ output += lookup[tmp >> 10];
1114
+ output += lookup[(tmp >> 4) & 0x3F];
1115
+ output += lookup[(tmp << 2) & 0x3F];
1116
+ output += '=';
1117
+ }
1118
+
1119
+ parts.push(output);
1120
+
1121
+ return parts.join('')
1122
+ }
1123
+
1124
+ function read (buffer, offset, isLE, mLen, nBytes) {
1125
+ var e, m;
1126
+ var eLen = nBytes * 8 - mLen - 1;
1127
+ var eMax = (1 << eLen) - 1;
1128
+ var eBias = eMax >> 1;
1129
+ var nBits = -7;
1130
+ var i = isLE ? (nBytes - 1) : 0;
1131
+ var d = isLE ? -1 : 1;
1132
+ var s = buffer[offset + i];
1133
+
1134
+ i += d;
1135
+
1136
+ e = s & ((1 << (-nBits)) - 1);
1137
+ s >>= (-nBits);
1138
+ nBits += eLen;
1139
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
1140
+
1141
+ m = e & ((1 << (-nBits)) - 1);
1142
+ e >>= (-nBits);
1143
+ nBits += mLen;
1144
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
1145
+
1146
+ if (e === 0) {
1147
+ e = 1 - eBias;
1148
+ } else if (e === eMax) {
1149
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
1150
+ } else {
1151
+ m = m + Math.pow(2, mLen);
1152
+ e = e - eBias;
1153
+ }
1154
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
1155
+ }
1156
+
1157
+ function write (buffer, value, offset, isLE, mLen, nBytes) {
1158
+ var e, m, c;
1159
+ var eLen = nBytes * 8 - mLen - 1;
1160
+ var eMax = (1 << eLen) - 1;
1161
+ var eBias = eMax >> 1;
1162
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);
1163
+ var i = isLE ? 0 : (nBytes - 1);
1164
+ var d = isLE ? 1 : -1;
1165
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
1166
+
1167
+ value = Math.abs(value);
1168
+
1169
+ if (isNaN(value) || value === Infinity) {
1170
+ m = isNaN(value) ? 1 : 0;
1171
+ e = eMax;
1172
+ } else {
1173
+ e = Math.floor(Math.log(value) / Math.LN2);
1174
+ if (value * (c = Math.pow(2, -e)) < 1) {
1175
+ e--;
1176
+ c *= 2;
1177
+ }
1178
+ if (e + eBias >= 1) {
1179
+ value += rt / c;
1180
+ } else {
1181
+ value += rt * Math.pow(2, 1 - eBias);
1182
+ }
1183
+ if (value * c >= 2) {
1184
+ e++;
1185
+ c /= 2;
1186
+ }
1187
+
1188
+ if (e + eBias >= eMax) {
1189
+ m = 0;
1190
+ e = eMax;
1191
+ } else if (e + eBias >= 1) {
1192
+ m = (value * c - 1) * Math.pow(2, mLen);
1193
+ e = e + eBias;
1194
+ } else {
1195
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
1196
+ e = 0;
1197
+ }
1198
+ }
1199
+
1200
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
1201
+
1202
+ e = (e << mLen) | m;
1203
+ eLen += mLen;
1204
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
1205
+
1206
+ buffer[offset + i - d] |= s * 128;
1207
+ }
1208
+
1209
+ var toString = {}.toString;
1210
+
1211
+ var isArray$4 = Array.isArray || function (arr) {
1212
+ return toString.call(arr) == '[object Array]';
1213
+ };
1214
+
1215
+ /*!
1216
+ * The buffer module from node.js, for the browser.
1217
+ *
1218
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
1219
+ * @license MIT
1220
+ */
1221
+
1222
+ var INSPECT_MAX_BYTES = 50;
1223
+
1224
+ /**
1225
+ * If `Buffer.TYPED_ARRAY_SUPPORT`:
1226
+ * === true Use Uint8Array implementation (fastest)
1227
+ * === false Use Object implementation (most compatible, even IE6)
1228
+ *
1229
+ * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
1230
+ * Opera 11.6+, iOS 4.2+.
1231
+ *
1232
+ * Due to various browser bugs, sometimes the Object implementation will be used even
1233
+ * when the browser supports typed arrays.
1234
+ *
1235
+ * Note:
1236
+ *
1237
+ * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
1238
+ * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
1239
+ *
1240
+ * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
1241
+ *
1242
+ * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
1243
+ * incorrect length in some situations.
1244
+
1245
+ * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
1246
+ * get the Object implementation, which is slower but behaves correctly.
1247
+ */
1248
+ Buffer$1.TYPED_ARRAY_SUPPORT = global$1.TYPED_ARRAY_SUPPORT !== undefined
1249
+ ? global$1.TYPED_ARRAY_SUPPORT
1250
+ : true;
1251
+
1252
+ /*
1253
+ * Export kMaxLength after typed array support is determined.
1254
+ */
1255
+ kMaxLength();
1256
+
1257
+ function kMaxLength () {
1258
+ return Buffer$1.TYPED_ARRAY_SUPPORT
1259
+ ? 0x7fffffff
1260
+ : 0x3fffffff
1261
+ }
1262
+
1263
+ function createBuffer (that, length) {
1264
+ if (kMaxLength() < length) {
1265
+ throw new RangeError('Invalid typed array length')
1266
+ }
1267
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1268
+ // Return an augmented `Uint8Array` instance, for best performance
1269
+ that = new Uint8Array(length);
1270
+ that.__proto__ = Buffer$1.prototype;
1271
+ } else {
1272
+ // Fallback: Return an object instance of the Buffer class
1273
+ if (that === null) {
1274
+ that = new Buffer$1(length);
1275
+ }
1276
+ that.length = length;
1277
+ }
1278
+
1279
+ return that
1280
+ }
1281
+
1282
+ /**
1283
+ * The Buffer constructor returns instances of `Uint8Array` that have their
1284
+ * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
1285
+ * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
1286
+ * and the `Uint8Array` methods. Square bracket notation works as expected -- it
1287
+ * returns a single octet.
1288
+ *
1289
+ * The `Uint8Array` prototype remains unmodified.
1290
+ */
1291
+
1292
+ function Buffer$1 (arg, encodingOrOffset, length) {
1293
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer$1)) {
1294
+ return new Buffer$1(arg, encodingOrOffset, length)
1295
+ }
1296
+
1297
+ // Common case.
1298
+ if (typeof arg === 'number') {
1299
+ if (typeof encodingOrOffset === 'string') {
1300
+ throw new Error(
1301
+ 'If encoding is specified then the first argument must be a string'
1302
+ )
1303
+ }
1304
+ return allocUnsafe(this, arg)
1305
+ }
1306
+ return from(this, arg, encodingOrOffset, length)
1307
+ }
1308
+
1309
+ Buffer$1.poolSize = 8192; // not used by this implementation
1310
+
1311
+ // TODO: Legacy, not needed anymore. Remove in next major version.
1312
+ Buffer$1._augment = function (arr) {
1313
+ arr.__proto__ = Buffer$1.prototype;
1314
+ return arr
1315
+ };
1316
+
1317
+ function from (that, value, encodingOrOffset, length) {
1318
+ if (typeof value === 'number') {
1319
+ throw new TypeError('"value" argument must not be a number')
1320
+ }
1321
+
1322
+ if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
1323
+ return fromArrayBuffer(that, value, encodingOrOffset, length)
1324
+ }
1325
+
1326
+ if (typeof value === 'string') {
1327
+ return fromString(that, value, encodingOrOffset)
1328
+ }
1329
+
1330
+ return fromObject(that, value)
1331
+ }
1332
+
1333
+ /**
1334
+ * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
1335
+ * if value is a number.
1336
+ * Buffer.from(str[, encoding])
1337
+ * Buffer.from(array)
1338
+ * Buffer.from(buffer)
1339
+ * Buffer.from(arrayBuffer[, byteOffset[, length]])
1340
+ **/
1341
+ Buffer$1.from = function (value, encodingOrOffset, length) {
1342
+ return from(null, value, encodingOrOffset, length)
1343
+ };
1344
+
1345
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1346
+ Buffer$1.prototype.__proto__ = Uint8Array.prototype;
1347
+ Buffer$1.__proto__ = Uint8Array;
1348
+ if (typeof Symbol !== 'undefined' && Symbol.species &&
1349
+ Buffer$1[Symbol.species] === Buffer$1) ;
1350
+ }
1351
+
1352
+ function assertSize (size) {
1353
+ if (typeof size !== 'number') {
1354
+ throw new TypeError('"size" argument must be a number')
1355
+ } else if (size < 0) {
1356
+ throw new RangeError('"size" argument must not be negative')
1357
+ }
1358
+ }
1359
+
1360
+ function alloc (that, size, fill, encoding) {
1361
+ assertSize(size);
1362
+ if (size <= 0) {
1363
+ return createBuffer(that, size)
1364
+ }
1365
+ if (fill !== undefined) {
1366
+ // Only pay attention to encoding if it's a string. This
1367
+ // prevents accidentally sending in a number that would
1368
+ // be interpretted as a start offset.
1369
+ return typeof encoding === 'string'
1370
+ ? createBuffer(that, size).fill(fill, encoding)
1371
+ : createBuffer(that, size).fill(fill)
1372
+ }
1373
+ return createBuffer(that, size)
1374
+ }
1375
+
1376
+ /**
1377
+ * Creates a new filled Buffer instance.
1378
+ * alloc(size[, fill[, encoding]])
1379
+ **/
1380
+ Buffer$1.alloc = function (size, fill, encoding) {
1381
+ return alloc(null, size, fill, encoding)
1382
+ };
1383
+
1384
+ function allocUnsafe (that, size) {
1385
+ assertSize(size);
1386
+ that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);
1387
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT) {
1388
+ for (var i = 0; i < size; ++i) {
1389
+ that[i] = 0;
1390
+ }
1391
+ }
1392
+ return that
1393
+ }
1394
+
1395
+ /**
1396
+ * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
1397
+ * */
1398
+ Buffer$1.allocUnsafe = function (size) {
1399
+ return allocUnsafe(null, size)
1400
+ };
1401
+ /**
1402
+ * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
1403
+ */
1404
+ Buffer$1.allocUnsafeSlow = function (size) {
1405
+ return allocUnsafe(null, size)
1406
+ };
1407
+
1408
+ function fromString (that, string, encoding) {
1409
+ if (typeof encoding !== 'string' || encoding === '') {
1410
+ encoding = 'utf8';
1411
+ }
1412
+
1413
+ if (!Buffer$1.isEncoding(encoding)) {
1414
+ throw new TypeError('"encoding" must be a valid string encoding')
1415
+ }
1416
+
1417
+ var length = byteLength(string, encoding) | 0;
1418
+ that = createBuffer(that, length);
1419
+
1420
+ var actual = that.write(string, encoding);
1421
+
1422
+ if (actual !== length) {
1423
+ // Writing a hex string, for example, that contains invalid characters will
1424
+ // cause everything after the first invalid character to be ignored. (e.g.
1425
+ // 'abxxcd' will be treated as 'ab')
1426
+ that = that.slice(0, actual);
1427
+ }
1428
+
1429
+ return that
1430
+ }
1431
+
1432
+ function fromArrayLike (that, array) {
1433
+ var length = array.length < 0 ? 0 : checked(array.length) | 0;
1434
+ that = createBuffer(that, length);
1435
+ for (var i = 0; i < length; i += 1) {
1436
+ that[i] = array[i] & 255;
1437
+ }
1438
+ return that
1439
+ }
1440
+
1441
+ function fromArrayBuffer (that, array, byteOffset, length) {
1442
+ array.byteLength; // this throws if `array` is not a valid ArrayBuffer
1443
+
1444
+ if (byteOffset < 0 || array.byteLength < byteOffset) {
1445
+ throw new RangeError('\'offset\' is out of bounds')
1446
+ }
1447
+
1448
+ if (array.byteLength < byteOffset + (length || 0)) {
1449
+ throw new RangeError('\'length\' is out of bounds')
1450
+ }
1451
+
1452
+ if (byteOffset === undefined && length === undefined) {
1453
+ array = new Uint8Array(array);
1454
+ } else if (length === undefined) {
1455
+ array = new Uint8Array(array, byteOffset);
1456
+ } else {
1457
+ array = new Uint8Array(array, byteOffset, length);
1458
+ }
1459
+
1460
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
1461
+ // Return an augmented `Uint8Array` instance, for best performance
1462
+ that = array;
1463
+ that.__proto__ = Buffer$1.prototype;
1464
+ } else {
1465
+ // Fallback: Return an object instance of the Buffer class
1466
+ that = fromArrayLike(that, array);
1467
+ }
1468
+ return that
1469
+ }
1470
+
1471
+ function fromObject (that, obj) {
1472
+ if (internalIsBuffer(obj)) {
1473
+ var len = checked(obj.length) | 0;
1474
+ that = createBuffer(that, len);
1475
+
1476
+ if (that.length === 0) {
1477
+ return that
1478
+ }
1479
+
1480
+ obj.copy(that, 0, 0, len);
1481
+ return that
1482
+ }
1483
+
1484
+ if (obj) {
1485
+ if ((typeof ArrayBuffer !== 'undefined' &&
1486
+ obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
1487
+ if (typeof obj.length !== 'number' || isnan(obj.length)) {
1488
+ return createBuffer(that, 0)
1489
+ }
1490
+ return fromArrayLike(that, obj)
1491
+ }
1492
+
1493
+ if (obj.type === 'Buffer' && isArray$4(obj.data)) {
1494
+ return fromArrayLike(that, obj.data)
1495
+ }
1496
+ }
1497
+
1498
+ throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
1499
+ }
1500
+
1501
+ function checked (length) {
1502
+ // Note: cannot use `length < kMaxLength()` here because that fails when
1503
+ // length is NaN (which is otherwise coerced to zero.)
1504
+ if (length >= kMaxLength()) {
1505
+ throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
1506
+ 'size: 0x' + kMaxLength().toString(16) + ' bytes')
1507
+ }
1508
+ return length | 0
1509
+ }
1510
+ Buffer$1.isBuffer = isBuffer$2;
1511
+ function internalIsBuffer (b) {
1512
+ return !!(b != null && b._isBuffer)
1513
+ }
1514
+
1515
+ Buffer$1.compare = function compare (a, b) {
1516
+ if (!internalIsBuffer(a) || !internalIsBuffer(b)) {
1517
+ throw new TypeError('Arguments must be Buffers')
1518
+ }
1519
+
1520
+ if (a === b) return 0
1521
+
1522
+ var x = a.length;
1523
+ var y = b.length;
1524
+
1525
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
1526
+ if (a[i] !== b[i]) {
1527
+ x = a[i];
1528
+ y = b[i];
1529
+ break
1530
+ }
1531
+ }
1532
+
1533
+ if (x < y) return -1
1534
+ if (y < x) return 1
1535
+ return 0
1536
+ };
1537
+
1538
+ Buffer$1.isEncoding = function isEncoding (encoding) {
1539
+ switch (String(encoding).toLowerCase()) {
1540
+ case 'hex':
1541
+ case 'utf8':
1542
+ case 'utf-8':
1543
+ case 'ascii':
1544
+ case 'latin1':
1545
+ case 'binary':
1546
+ case 'base64':
1547
+ case 'ucs2':
1548
+ case 'ucs-2':
1549
+ case 'utf16le':
1550
+ case 'utf-16le':
1551
+ return true
1552
+ default:
1553
+ return false
1554
+ }
1555
+ };
1556
+
1557
+ Buffer$1.concat = function concat (list, length) {
1558
+ if (!isArray$4(list)) {
1559
+ throw new TypeError('"list" argument must be an Array of Buffers')
1560
+ }
1561
+
1562
+ if (list.length === 0) {
1563
+ return Buffer$1.alloc(0)
1564
+ }
1565
+
1566
+ var i;
1567
+ if (length === undefined) {
1568
+ length = 0;
1569
+ for (i = 0; i < list.length; ++i) {
1570
+ length += list[i].length;
1571
+ }
1572
+ }
1573
+
1574
+ var buffer = Buffer$1.allocUnsafe(length);
1575
+ var pos = 0;
1576
+ for (i = 0; i < list.length; ++i) {
1577
+ var buf = list[i];
1578
+ if (!internalIsBuffer(buf)) {
1579
+ throw new TypeError('"list" argument must be an Array of Buffers')
1580
+ }
1581
+ buf.copy(buffer, pos);
1582
+ pos += buf.length;
1583
+ }
1584
+ return buffer
1585
+ };
1586
+
1587
+ function byteLength (string, encoding) {
1588
+ if (internalIsBuffer(string)) {
1589
+ return string.length
1590
+ }
1591
+ if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
1592
+ (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
1593
+ return string.byteLength
1594
+ }
1595
+ if (typeof string !== 'string') {
1596
+ string = '' + string;
1597
+ }
1598
+
1599
+ var len = string.length;
1600
+ if (len === 0) return 0
1601
+
1602
+ // Use a for loop to avoid recursion
1603
+ var loweredCase = false;
1604
+ for (;;) {
1605
+ switch (encoding) {
1606
+ case 'ascii':
1607
+ case 'latin1':
1608
+ case 'binary':
1609
+ return len
1610
+ case 'utf8':
1611
+ case 'utf-8':
1612
+ case undefined:
1613
+ return utf8ToBytes(string).length
1614
+ case 'ucs2':
1615
+ case 'ucs-2':
1616
+ case 'utf16le':
1617
+ case 'utf-16le':
1618
+ return len * 2
1619
+ case 'hex':
1620
+ return len >>> 1
1621
+ case 'base64':
1622
+ return base64ToBytes(string).length
1623
+ default:
1624
+ if (loweredCase) return utf8ToBytes(string).length // assume utf8
1625
+ encoding = ('' + encoding).toLowerCase();
1626
+ loweredCase = true;
1627
+ }
1628
+ }
1629
+ }
1630
+ Buffer$1.byteLength = byteLength;
1631
+
1632
+ function slowToString (encoding, start, end) {
1633
+ var loweredCase = false;
1634
+
1635
+ // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
1636
+ // property of a typed array.
1637
+
1638
+ // This behaves neither like String nor Uint8Array in that we set start/end
1639
+ // to their upper/lower bounds if the value passed is out of range.
1640
+ // undefined is handled specially as per ECMA-262 6th Edition,
1641
+ // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
1642
+ if (start === undefined || start < 0) {
1643
+ start = 0;
1644
+ }
1645
+ // Return early if start > this.length. Done here to prevent potential uint32
1646
+ // coercion fail below.
1647
+ if (start > this.length) {
1648
+ return ''
1649
+ }
1650
+
1651
+ if (end === undefined || end > this.length) {
1652
+ end = this.length;
1653
+ }
1654
+
1655
+ if (end <= 0) {
1656
+ return ''
1657
+ }
1658
+
1659
+ // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
1660
+ end >>>= 0;
1661
+ start >>>= 0;
1662
+
1663
+ if (end <= start) {
1664
+ return ''
1665
+ }
1666
+
1667
+ if (!encoding) encoding = 'utf8';
1668
+
1669
+ while (true) {
1670
+ switch (encoding) {
1671
+ case 'hex':
1672
+ return hexSlice(this, start, end)
1673
+
1674
+ case 'utf8':
1675
+ case 'utf-8':
1676
+ return utf8Slice(this, start, end)
1677
+
1678
+ case 'ascii':
1679
+ return asciiSlice(this, start, end)
1680
+
1681
+ case 'latin1':
1682
+ case 'binary':
1683
+ return latin1Slice(this, start, end)
1684
+
1685
+ case 'base64':
1686
+ return base64Slice(this, start, end)
1687
+
1688
+ case 'ucs2':
1689
+ case 'ucs-2':
1690
+ case 'utf16le':
1691
+ case 'utf-16le':
1692
+ return utf16leSlice(this, start, end)
1693
+
1694
+ default:
1695
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
1696
+ encoding = (encoding + '').toLowerCase();
1697
+ loweredCase = true;
1698
+ }
1699
+ }
1700
+ }
1701
+
1702
+ // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
1703
+ // Buffer instances.
1704
+ Buffer$1.prototype._isBuffer = true;
1705
+
1706
+ function swap (b, n, m) {
1707
+ var i = b[n];
1708
+ b[n] = b[m];
1709
+ b[m] = i;
1710
+ }
1711
+
1712
+ Buffer$1.prototype.swap16 = function swap16 () {
1713
+ var len = this.length;
1714
+ if (len % 2 !== 0) {
1715
+ throw new RangeError('Buffer size must be a multiple of 16-bits')
1716
+ }
1717
+ for (var i = 0; i < len; i += 2) {
1718
+ swap(this, i, i + 1);
1719
+ }
1720
+ return this
1721
+ };
1722
+
1723
+ Buffer$1.prototype.swap32 = function swap32 () {
1724
+ var len = this.length;
1725
+ if (len % 4 !== 0) {
1726
+ throw new RangeError('Buffer size must be a multiple of 32-bits')
1727
+ }
1728
+ for (var i = 0; i < len; i += 4) {
1729
+ swap(this, i, i + 3);
1730
+ swap(this, i + 1, i + 2);
1731
+ }
1732
+ return this
1733
+ };
1734
+
1735
+ Buffer$1.prototype.swap64 = function swap64 () {
1736
+ var len = this.length;
1737
+ if (len % 8 !== 0) {
1738
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
1739
+ }
1740
+ for (var i = 0; i < len; i += 8) {
1741
+ swap(this, i, i + 7);
1742
+ swap(this, i + 1, i + 6);
1743
+ swap(this, i + 2, i + 5);
1744
+ swap(this, i + 3, i + 4);
1745
+ }
1746
+ return this
1747
+ };
1748
+
1749
+ Buffer$1.prototype.toString = function toString () {
1750
+ var length = this.length | 0;
1751
+ if (length === 0) return ''
1752
+ if (arguments.length === 0) return utf8Slice(this, 0, length)
1753
+ return slowToString.apply(this, arguments)
1754
+ };
1755
+
1756
+ Buffer$1.prototype.equals = function equals (b) {
1757
+ if (!internalIsBuffer(b)) throw new TypeError('Argument must be a Buffer')
1758
+ if (this === b) return true
1759
+ return Buffer$1.compare(this, b) === 0
1760
+ };
1761
+
1762
+ Buffer$1.prototype.inspect = function inspect () {
1763
+ var str = '';
1764
+ var max = INSPECT_MAX_BYTES;
1765
+ if (this.length > 0) {
1766
+ str = this.toString('hex', 0, max).match(/.{2}/g).join(' ');
1767
+ if (this.length > max) str += ' ... ';
1768
+ }
1769
+ return '<Buffer ' + str + '>'
1770
+ };
1771
+
1772
+ Buffer$1.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
1773
+ if (!internalIsBuffer(target)) {
1774
+ throw new TypeError('Argument must be a Buffer')
1775
+ }
1776
+
1777
+ if (start === undefined) {
1778
+ start = 0;
1779
+ }
1780
+ if (end === undefined) {
1781
+ end = target ? target.length : 0;
1782
+ }
1783
+ if (thisStart === undefined) {
1784
+ thisStart = 0;
1785
+ }
1786
+ if (thisEnd === undefined) {
1787
+ thisEnd = this.length;
1788
+ }
1789
+
1790
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
1791
+ throw new RangeError('out of range index')
1792
+ }
1793
+
1794
+ if (thisStart >= thisEnd && start >= end) {
1795
+ return 0
1796
+ }
1797
+ if (thisStart >= thisEnd) {
1798
+ return -1
1799
+ }
1800
+ if (start >= end) {
1801
+ return 1
1802
+ }
1803
+
1804
+ start >>>= 0;
1805
+ end >>>= 0;
1806
+ thisStart >>>= 0;
1807
+ thisEnd >>>= 0;
1808
+
1809
+ if (this === target) return 0
1810
+
1811
+ var x = thisEnd - thisStart;
1812
+ var y = end - start;
1813
+ var len = Math.min(x, y);
1814
+
1815
+ var thisCopy = this.slice(thisStart, thisEnd);
1816
+ var targetCopy = target.slice(start, end);
1817
+
1818
+ for (var i = 0; i < len; ++i) {
1819
+ if (thisCopy[i] !== targetCopy[i]) {
1820
+ x = thisCopy[i];
1821
+ y = targetCopy[i];
1822
+ break
1823
+ }
1824
+ }
1825
+
1826
+ if (x < y) return -1
1827
+ if (y < x) return 1
1828
+ return 0
1829
+ };
1830
+
1831
+ // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
1832
+ // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
1833
+ //
1834
+ // Arguments:
1835
+ // - buffer - a Buffer to search
1836
+ // - val - a string, Buffer, or number
1837
+ // - byteOffset - an index into `buffer`; will be clamped to an int32
1838
+ // - encoding - an optional encoding, relevant is val is a string
1839
+ // - dir - true for indexOf, false for lastIndexOf
1840
+ function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
1841
+ // Empty buffer means no match
1842
+ if (buffer.length === 0) return -1
1843
+
1844
+ // Normalize byteOffset
1845
+ if (typeof byteOffset === 'string') {
1846
+ encoding = byteOffset;
1847
+ byteOffset = 0;
1848
+ } else if (byteOffset > 0x7fffffff) {
1849
+ byteOffset = 0x7fffffff;
1850
+ } else if (byteOffset < -0x80000000) {
1851
+ byteOffset = -0x80000000;
1852
+ }
1853
+ byteOffset = +byteOffset; // Coerce to Number.
1854
+ if (isNaN(byteOffset)) {
1855
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
1856
+ byteOffset = dir ? 0 : (buffer.length - 1);
1857
+ }
1858
+
1859
+ // Normalize byteOffset: negative offsets start from the end of the buffer
1860
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
1861
+ if (byteOffset >= buffer.length) {
1862
+ if (dir) return -1
1863
+ else byteOffset = buffer.length - 1;
1864
+ } else if (byteOffset < 0) {
1865
+ if (dir) byteOffset = 0;
1866
+ else return -1
1867
+ }
1868
+
1869
+ // Normalize val
1870
+ if (typeof val === 'string') {
1871
+ val = Buffer$1.from(val, encoding);
1872
+ }
1873
+
1874
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
1875
+ if (internalIsBuffer(val)) {
1876
+ // Special case: looking for empty string/buffer always fails
1877
+ if (val.length === 0) {
1878
+ return -1
1879
+ }
1880
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
1881
+ } else if (typeof val === 'number') {
1882
+ val = val & 0xFF; // Search for a byte value [0-255]
1883
+ if (Buffer$1.TYPED_ARRAY_SUPPORT &&
1884
+ typeof Uint8Array.prototype.indexOf === 'function') {
1885
+ if (dir) {
1886
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
1887
+ } else {
1888
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
1889
+ }
1890
+ }
1891
+ return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
1892
+ }
1893
+
1894
+ throw new TypeError('val must be string, number or Buffer')
1895
+ }
1896
+
1897
+ function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
1898
+ var indexSize = 1;
1899
+ var arrLength = arr.length;
1900
+ var valLength = val.length;
1901
+
1902
+ if (encoding !== undefined) {
1903
+ encoding = String(encoding).toLowerCase();
1904
+ if (encoding === 'ucs2' || encoding === 'ucs-2' ||
1905
+ encoding === 'utf16le' || encoding === 'utf-16le') {
1906
+ if (arr.length < 2 || val.length < 2) {
1907
+ return -1
1908
+ }
1909
+ indexSize = 2;
1910
+ arrLength /= 2;
1911
+ valLength /= 2;
1912
+ byteOffset /= 2;
1913
+ }
1914
+ }
1915
+
1916
+ function read (buf, i) {
1917
+ if (indexSize === 1) {
1918
+ return buf[i]
1919
+ } else {
1920
+ return buf.readUInt16BE(i * indexSize)
1921
+ }
1922
+ }
1923
+
1924
+ var i;
1925
+ if (dir) {
1926
+ var foundIndex = -1;
1927
+ for (i = byteOffset; i < arrLength; i++) {
1928
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
1929
+ if (foundIndex === -1) foundIndex = i;
1930
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
1931
+ } else {
1932
+ if (foundIndex !== -1) i -= i - foundIndex;
1933
+ foundIndex = -1;
1934
+ }
1935
+ }
1936
+ } else {
1937
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
1938
+ for (i = byteOffset; i >= 0; i--) {
1939
+ var found = true;
1940
+ for (var j = 0; j < valLength; j++) {
1941
+ if (read(arr, i + j) !== read(val, j)) {
1942
+ found = false;
1943
+ break
1944
+ }
1945
+ }
1946
+ if (found) return i
1947
+ }
1948
+ }
1949
+
1950
+ return -1
1951
+ }
1952
+
1953
+ Buffer$1.prototype.includes = function includes (val, byteOffset, encoding) {
1954
+ return this.indexOf(val, byteOffset, encoding) !== -1
1955
+ };
1956
+
1957
+ Buffer$1.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
1958
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
1959
+ };
1960
+
1961
+ Buffer$1.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
1962
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
1963
+ };
1964
+
1965
+ function hexWrite (buf, string, offset, length) {
1966
+ offset = Number(offset) || 0;
1967
+ var remaining = buf.length - offset;
1968
+ if (!length) {
1969
+ length = remaining;
1970
+ } else {
1971
+ length = Number(length);
1972
+ if (length > remaining) {
1973
+ length = remaining;
1974
+ }
1975
+ }
1976
+
1977
+ // must be an even number of digits
1978
+ var strLen = string.length;
1979
+ if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
1980
+
1981
+ if (length > strLen / 2) {
1982
+ length = strLen / 2;
1983
+ }
1984
+ for (var i = 0; i < length; ++i) {
1985
+ var parsed = parseInt(string.substr(i * 2, 2), 16);
1986
+ if (isNaN(parsed)) return i
1987
+ buf[offset + i] = parsed;
1988
+ }
1989
+ return i
1990
+ }
1991
+
1992
+ function utf8Write (buf, string, offset, length) {
1993
+ return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
1994
+ }
1995
+
1996
+ function asciiWrite (buf, string, offset, length) {
1997
+ return blitBuffer(asciiToBytes(string), buf, offset, length)
1998
+ }
1999
+
2000
+ function latin1Write (buf, string, offset, length) {
2001
+ return asciiWrite(buf, string, offset, length)
2002
+ }
2003
+
2004
+ function base64Write (buf, string, offset, length) {
2005
+ return blitBuffer(base64ToBytes(string), buf, offset, length)
2006
+ }
2007
+
2008
+ function ucs2Write (buf, string, offset, length) {
2009
+ return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
2010
+ }
2011
+
2012
+ Buffer$1.prototype.write = function write (string, offset, length, encoding) {
2013
+ // Buffer#write(string)
2014
+ if (offset === undefined) {
2015
+ encoding = 'utf8';
2016
+ length = this.length;
2017
+ offset = 0;
2018
+ // Buffer#write(string, encoding)
2019
+ } else if (length === undefined && typeof offset === 'string') {
2020
+ encoding = offset;
2021
+ length = this.length;
2022
+ offset = 0;
2023
+ // Buffer#write(string, offset[, length][, encoding])
2024
+ } else if (isFinite(offset)) {
2025
+ offset = offset | 0;
2026
+ if (isFinite(length)) {
2027
+ length = length | 0;
2028
+ if (encoding === undefined) encoding = 'utf8';
2029
+ } else {
2030
+ encoding = length;
2031
+ length = undefined;
2032
+ }
2033
+ // legacy write(string, encoding, offset, length) - remove in v0.13
2034
+ } else {
2035
+ throw new Error(
2036
+ 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
2037
+ )
2038
+ }
2039
+
2040
+ var remaining = this.length - offset;
2041
+ if (length === undefined || length > remaining) length = remaining;
2042
+
2043
+ if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
2044
+ throw new RangeError('Attempt to write outside buffer bounds')
2045
+ }
2046
+
2047
+ if (!encoding) encoding = 'utf8';
2048
+
2049
+ var loweredCase = false;
2050
+ for (;;) {
2051
+ switch (encoding) {
2052
+ case 'hex':
2053
+ return hexWrite(this, string, offset, length)
2054
+
2055
+ case 'utf8':
2056
+ case 'utf-8':
2057
+ return utf8Write(this, string, offset, length)
2058
+
2059
+ case 'ascii':
2060
+ return asciiWrite(this, string, offset, length)
2061
+
2062
+ case 'latin1':
2063
+ case 'binary':
2064
+ return latin1Write(this, string, offset, length)
2065
+
2066
+ case 'base64':
2067
+ // Warning: maxLength not taken into account in base64Write
2068
+ return base64Write(this, string, offset, length)
2069
+
2070
+ case 'ucs2':
2071
+ case 'ucs-2':
2072
+ case 'utf16le':
2073
+ case 'utf-16le':
2074
+ return ucs2Write(this, string, offset, length)
2075
+
2076
+ default:
2077
+ if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
2078
+ encoding = ('' + encoding).toLowerCase();
2079
+ loweredCase = true;
2080
+ }
2081
+ }
2082
+ };
2083
+
2084
+ Buffer$1.prototype.toJSON = function toJSON () {
2085
+ return {
2086
+ type: 'Buffer',
2087
+ data: Array.prototype.slice.call(this._arr || this, 0)
2088
+ }
2089
+ };
2090
+
2091
+ function base64Slice (buf, start, end) {
2092
+ if (start === 0 && end === buf.length) {
2093
+ return fromByteArray(buf)
2094
+ } else {
2095
+ return fromByteArray(buf.slice(start, end))
2096
+ }
2097
+ }
2098
+
2099
+ function utf8Slice (buf, start, end) {
2100
+ end = Math.min(buf.length, end);
2101
+ var res = [];
2102
+
2103
+ var i = start;
2104
+ while (i < end) {
2105
+ var firstByte = buf[i];
2106
+ var codePoint = null;
2107
+ var bytesPerSequence = (firstByte > 0xEF) ? 4
2108
+ : (firstByte > 0xDF) ? 3
2109
+ : (firstByte > 0xBF) ? 2
2110
+ : 1;
2111
+
2112
+ if (i + bytesPerSequence <= end) {
2113
+ var secondByte, thirdByte, fourthByte, tempCodePoint;
2114
+
2115
+ switch (bytesPerSequence) {
2116
+ case 1:
2117
+ if (firstByte < 0x80) {
2118
+ codePoint = firstByte;
2119
+ }
2120
+ break
2121
+ case 2:
2122
+ secondByte = buf[i + 1];
2123
+ if ((secondByte & 0xC0) === 0x80) {
2124
+ tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);
2125
+ if (tempCodePoint > 0x7F) {
2126
+ codePoint = tempCodePoint;
2127
+ }
2128
+ }
2129
+ break
2130
+ case 3:
2131
+ secondByte = buf[i + 1];
2132
+ thirdByte = buf[i + 2];
2133
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
2134
+ tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);
2135
+ if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
2136
+ codePoint = tempCodePoint;
2137
+ }
2138
+ }
2139
+ break
2140
+ case 4:
2141
+ secondByte = buf[i + 1];
2142
+ thirdByte = buf[i + 2];
2143
+ fourthByte = buf[i + 3];
2144
+ if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
2145
+ tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);
2146
+ if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
2147
+ codePoint = tempCodePoint;
2148
+ }
2149
+ }
2150
+ }
2151
+ }
2152
+
2153
+ if (codePoint === null) {
2154
+ // we did not generate a valid codePoint so insert a
2155
+ // replacement char (U+FFFD) and advance only 1 byte
2156
+ codePoint = 0xFFFD;
2157
+ bytesPerSequence = 1;
2158
+ } else if (codePoint > 0xFFFF) {
2159
+ // encode to utf16 (surrogate pair dance)
2160
+ codePoint -= 0x10000;
2161
+ res.push(codePoint >>> 10 & 0x3FF | 0xD800);
2162
+ codePoint = 0xDC00 | codePoint & 0x3FF;
2163
+ }
2164
+
2165
+ res.push(codePoint);
2166
+ i += bytesPerSequence;
2167
+ }
2168
+
2169
+ return decodeCodePointsArray(res)
2170
+ }
2171
+
2172
+ // Based on http://stackoverflow.com/a/22747272/680742, the browser with
2173
+ // the lowest limit is Chrome, with 0x10000 args.
2174
+ // We go 1 magnitude less, for safety
2175
+ var MAX_ARGUMENTS_LENGTH = 0x1000;
2176
+
2177
+ function decodeCodePointsArray (codePoints) {
2178
+ var len = codePoints.length;
2179
+ if (len <= MAX_ARGUMENTS_LENGTH) {
2180
+ return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
2181
+ }
2182
+
2183
+ // Decode in chunks to avoid "call stack size exceeded".
2184
+ var res = '';
2185
+ var i = 0;
2186
+ while (i < len) {
2187
+ res += String.fromCharCode.apply(
2188
+ String,
2189
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
2190
+ );
2191
+ }
2192
+ return res
2193
+ }
2194
+
2195
+ function asciiSlice (buf, start, end) {
2196
+ var ret = '';
2197
+ end = Math.min(buf.length, end);
2198
+
2199
+ for (var i = start; i < end; ++i) {
2200
+ ret += String.fromCharCode(buf[i] & 0x7F);
2201
+ }
2202
+ return ret
2203
+ }
2204
+
2205
+ function latin1Slice (buf, start, end) {
2206
+ var ret = '';
2207
+ end = Math.min(buf.length, end);
2208
+
2209
+ for (var i = start; i < end; ++i) {
2210
+ ret += String.fromCharCode(buf[i]);
2211
+ }
2212
+ return ret
2213
+ }
2214
+
2215
+ function hexSlice (buf, start, end) {
2216
+ var len = buf.length;
2217
+
2218
+ if (!start || start < 0) start = 0;
2219
+ if (!end || end < 0 || end > len) end = len;
2220
+
2221
+ var out = '';
2222
+ for (var i = start; i < end; ++i) {
2223
+ out += toHex(buf[i]);
2224
+ }
2225
+ return out
2226
+ }
2227
+
2228
+ function utf16leSlice (buf, start, end) {
2229
+ var bytes = buf.slice(start, end);
2230
+ var res = '';
2231
+ for (var i = 0; i < bytes.length; i += 2) {
2232
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
2233
+ }
2234
+ return res
2235
+ }
2236
+
2237
+ Buffer$1.prototype.slice = function slice (start, end) {
2238
+ var len = this.length;
2239
+ start = ~~start;
2240
+ end = end === undefined ? len : ~~end;
2241
+
2242
+ if (start < 0) {
2243
+ start += len;
2244
+ if (start < 0) start = 0;
2245
+ } else if (start > len) {
2246
+ start = len;
2247
+ }
2248
+
2249
+ if (end < 0) {
2250
+ end += len;
2251
+ if (end < 0) end = 0;
2252
+ } else if (end > len) {
2253
+ end = len;
2254
+ }
2255
+
2256
+ if (end < start) end = start;
2257
+
2258
+ var newBuf;
2259
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2260
+ newBuf = this.subarray(start, end);
2261
+ newBuf.__proto__ = Buffer$1.prototype;
2262
+ } else {
2263
+ var sliceLen = end - start;
2264
+ newBuf = new Buffer$1(sliceLen, undefined);
2265
+ for (var i = 0; i < sliceLen; ++i) {
2266
+ newBuf[i] = this[i + start];
2267
+ }
2268
+ }
2269
+
2270
+ return newBuf
2271
+ };
2272
+
2273
+ /*
2274
+ * Need to make sure that buffer isn't trying to write out of bounds.
2275
+ */
2276
+ function checkOffset (offset, ext, length) {
2277
+ if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
2278
+ if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
2279
+ }
2280
+
2281
+ Buffer$1.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
2282
+ offset = offset | 0;
2283
+ byteLength = byteLength | 0;
2284
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
2285
+
2286
+ var val = this[offset];
2287
+ var mul = 1;
2288
+ var i = 0;
2289
+ while (++i < byteLength && (mul *= 0x100)) {
2290
+ val += this[offset + i] * mul;
2291
+ }
2292
+
2293
+ return val
2294
+ };
2295
+
2296
+ Buffer$1.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
2297
+ offset = offset | 0;
2298
+ byteLength = byteLength | 0;
2299
+ if (!noAssert) {
2300
+ checkOffset(offset, byteLength, this.length);
2301
+ }
2302
+
2303
+ var val = this[offset + --byteLength];
2304
+ var mul = 1;
2305
+ while (byteLength > 0 && (mul *= 0x100)) {
2306
+ val += this[offset + --byteLength] * mul;
2307
+ }
2308
+
2309
+ return val
2310
+ };
2311
+
2312
+ Buffer$1.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
2313
+ if (!noAssert) checkOffset(offset, 1, this.length);
2314
+ return this[offset]
2315
+ };
2316
+
2317
+ Buffer$1.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
2318
+ if (!noAssert) checkOffset(offset, 2, this.length);
2319
+ return this[offset] | (this[offset + 1] << 8)
2320
+ };
2321
+
2322
+ Buffer$1.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
2323
+ if (!noAssert) checkOffset(offset, 2, this.length);
2324
+ return (this[offset] << 8) | this[offset + 1]
2325
+ };
2326
+
2327
+ Buffer$1.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
2328
+ if (!noAssert) checkOffset(offset, 4, this.length);
2329
+
2330
+ return ((this[offset]) |
2331
+ (this[offset + 1] << 8) |
2332
+ (this[offset + 2] << 16)) +
2333
+ (this[offset + 3] * 0x1000000)
2334
+ };
2335
+
2336
+ Buffer$1.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
2337
+ if (!noAssert) checkOffset(offset, 4, this.length);
2338
+
2339
+ return (this[offset] * 0x1000000) +
2340
+ ((this[offset + 1] << 16) |
2341
+ (this[offset + 2] << 8) |
2342
+ this[offset + 3])
2343
+ };
2344
+
2345
+ Buffer$1.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
2346
+ offset = offset | 0;
2347
+ byteLength = byteLength | 0;
2348
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
2349
+
2350
+ var val = this[offset];
2351
+ var mul = 1;
2352
+ var i = 0;
2353
+ while (++i < byteLength && (mul *= 0x100)) {
2354
+ val += this[offset + i] * mul;
2355
+ }
2356
+ mul *= 0x80;
2357
+
2358
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
2359
+
2360
+ return val
2361
+ };
2362
+
2363
+ Buffer$1.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
2364
+ offset = offset | 0;
2365
+ byteLength = byteLength | 0;
2366
+ if (!noAssert) checkOffset(offset, byteLength, this.length);
2367
+
2368
+ var i = byteLength;
2369
+ var mul = 1;
2370
+ var val = this[offset + --i];
2371
+ while (i > 0 && (mul *= 0x100)) {
2372
+ val += this[offset + --i] * mul;
2373
+ }
2374
+ mul *= 0x80;
2375
+
2376
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength);
2377
+
2378
+ return val
2379
+ };
2380
+
2381
+ Buffer$1.prototype.readInt8 = function readInt8 (offset, noAssert) {
2382
+ if (!noAssert) checkOffset(offset, 1, this.length);
2383
+ if (!(this[offset] & 0x80)) return (this[offset])
2384
+ return ((0xff - this[offset] + 1) * -1)
2385
+ };
2386
+
2387
+ Buffer$1.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
2388
+ if (!noAssert) checkOffset(offset, 2, this.length);
2389
+ var val = this[offset] | (this[offset + 1] << 8);
2390
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
2391
+ };
2392
+
2393
+ Buffer$1.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
2394
+ if (!noAssert) checkOffset(offset, 2, this.length);
2395
+ var val = this[offset + 1] | (this[offset] << 8);
2396
+ return (val & 0x8000) ? val | 0xFFFF0000 : val
2397
+ };
2398
+
2399
+ Buffer$1.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
2400
+ if (!noAssert) checkOffset(offset, 4, this.length);
2401
+
2402
+ return (this[offset]) |
2403
+ (this[offset + 1] << 8) |
2404
+ (this[offset + 2] << 16) |
2405
+ (this[offset + 3] << 24)
2406
+ };
2407
+
2408
+ Buffer$1.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
2409
+ if (!noAssert) checkOffset(offset, 4, this.length);
2410
+
2411
+ return (this[offset] << 24) |
2412
+ (this[offset + 1] << 16) |
2413
+ (this[offset + 2] << 8) |
2414
+ (this[offset + 3])
2415
+ };
2416
+
2417
+ Buffer$1.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
2418
+ if (!noAssert) checkOffset(offset, 4, this.length);
2419
+ return read(this, offset, true, 23, 4)
2420
+ };
2421
+
2422
+ Buffer$1.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
2423
+ if (!noAssert) checkOffset(offset, 4, this.length);
2424
+ return read(this, offset, false, 23, 4)
2425
+ };
2426
+
2427
+ Buffer$1.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
2428
+ if (!noAssert) checkOffset(offset, 8, this.length);
2429
+ return read(this, offset, true, 52, 8)
2430
+ };
2431
+
2432
+ Buffer$1.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
2433
+ if (!noAssert) checkOffset(offset, 8, this.length);
2434
+ return read(this, offset, false, 52, 8)
2435
+ };
2436
+
2437
+ function checkInt (buf, value, offset, ext, max, min) {
2438
+ if (!internalIsBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
2439
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
2440
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
2441
+ }
2442
+
2443
+ Buffer$1.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
2444
+ value = +value;
2445
+ offset = offset | 0;
2446
+ byteLength = byteLength | 0;
2447
+ if (!noAssert) {
2448
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1;
2449
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
2450
+ }
2451
+
2452
+ var mul = 1;
2453
+ var i = 0;
2454
+ this[offset] = value & 0xFF;
2455
+ while (++i < byteLength && (mul *= 0x100)) {
2456
+ this[offset + i] = (value / mul) & 0xFF;
2457
+ }
2458
+
2459
+ return offset + byteLength
2460
+ };
2461
+
2462
+ Buffer$1.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
2463
+ value = +value;
2464
+ offset = offset | 0;
2465
+ byteLength = byteLength | 0;
2466
+ if (!noAssert) {
2467
+ var maxBytes = Math.pow(2, 8 * byteLength) - 1;
2468
+ checkInt(this, value, offset, byteLength, maxBytes, 0);
2469
+ }
2470
+
2471
+ var i = byteLength - 1;
2472
+ var mul = 1;
2473
+ this[offset + i] = value & 0xFF;
2474
+ while (--i >= 0 && (mul *= 0x100)) {
2475
+ this[offset + i] = (value / mul) & 0xFF;
2476
+ }
2477
+
2478
+ return offset + byteLength
2479
+ };
2480
+
2481
+ Buffer$1.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
2482
+ value = +value;
2483
+ offset = offset | 0;
2484
+ if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);
2485
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
2486
+ this[offset] = (value & 0xff);
2487
+ return offset + 1
2488
+ };
2489
+
2490
+ function objectWriteUInt16 (buf, value, offset, littleEndian) {
2491
+ if (value < 0) value = 0xffff + value + 1;
2492
+ for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
2493
+ buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
2494
+ (littleEndian ? i : 1 - i) * 8;
2495
+ }
2496
+ }
2497
+
2498
+ Buffer$1.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
2499
+ value = +value;
2500
+ offset = offset | 0;
2501
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
2502
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2503
+ this[offset] = (value & 0xff);
2504
+ this[offset + 1] = (value >>> 8);
2505
+ } else {
2506
+ objectWriteUInt16(this, value, offset, true);
2507
+ }
2508
+ return offset + 2
2509
+ };
2510
+
2511
+ Buffer$1.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
2512
+ value = +value;
2513
+ offset = offset | 0;
2514
+ if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);
2515
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2516
+ this[offset] = (value >>> 8);
2517
+ this[offset + 1] = (value & 0xff);
2518
+ } else {
2519
+ objectWriteUInt16(this, value, offset, false);
2520
+ }
2521
+ return offset + 2
2522
+ };
2523
+
2524
+ function objectWriteUInt32 (buf, value, offset, littleEndian) {
2525
+ if (value < 0) value = 0xffffffff + value + 1;
2526
+ for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
2527
+ buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;
2528
+ }
2529
+ }
2530
+
2531
+ Buffer$1.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
2532
+ value = +value;
2533
+ offset = offset | 0;
2534
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
2535
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2536
+ this[offset + 3] = (value >>> 24);
2537
+ this[offset + 2] = (value >>> 16);
2538
+ this[offset + 1] = (value >>> 8);
2539
+ this[offset] = (value & 0xff);
2540
+ } else {
2541
+ objectWriteUInt32(this, value, offset, true);
2542
+ }
2543
+ return offset + 4
2544
+ };
2545
+
2546
+ Buffer$1.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
2547
+ value = +value;
2548
+ offset = offset | 0;
2549
+ if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);
2550
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2551
+ this[offset] = (value >>> 24);
2552
+ this[offset + 1] = (value >>> 16);
2553
+ this[offset + 2] = (value >>> 8);
2554
+ this[offset + 3] = (value & 0xff);
2555
+ } else {
2556
+ objectWriteUInt32(this, value, offset, false);
2557
+ }
2558
+ return offset + 4
2559
+ };
2560
+
2561
+ Buffer$1.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
2562
+ value = +value;
2563
+ offset = offset | 0;
2564
+ if (!noAssert) {
2565
+ var limit = Math.pow(2, 8 * byteLength - 1);
2566
+
2567
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
2568
+ }
2569
+
2570
+ var i = 0;
2571
+ var mul = 1;
2572
+ var sub = 0;
2573
+ this[offset] = value & 0xFF;
2574
+ while (++i < byteLength && (mul *= 0x100)) {
2575
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
2576
+ sub = 1;
2577
+ }
2578
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
2579
+ }
2580
+
2581
+ return offset + byteLength
2582
+ };
2583
+
2584
+ Buffer$1.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
2585
+ value = +value;
2586
+ offset = offset | 0;
2587
+ if (!noAssert) {
2588
+ var limit = Math.pow(2, 8 * byteLength - 1);
2589
+
2590
+ checkInt(this, value, offset, byteLength, limit - 1, -limit);
2591
+ }
2592
+
2593
+ var i = byteLength - 1;
2594
+ var mul = 1;
2595
+ var sub = 0;
2596
+ this[offset + i] = value & 0xFF;
2597
+ while (--i >= 0 && (mul *= 0x100)) {
2598
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
2599
+ sub = 1;
2600
+ }
2601
+ this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
2602
+ }
2603
+
2604
+ return offset + byteLength
2605
+ };
2606
+
2607
+ Buffer$1.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
2608
+ value = +value;
2609
+ offset = offset | 0;
2610
+ if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);
2611
+ if (!Buffer$1.TYPED_ARRAY_SUPPORT) value = Math.floor(value);
2612
+ if (value < 0) value = 0xff + value + 1;
2613
+ this[offset] = (value & 0xff);
2614
+ return offset + 1
2615
+ };
2616
+
2617
+ Buffer$1.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
2618
+ value = +value;
2619
+ offset = offset | 0;
2620
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
2621
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2622
+ this[offset] = (value & 0xff);
2623
+ this[offset + 1] = (value >>> 8);
2624
+ } else {
2625
+ objectWriteUInt16(this, value, offset, true);
2626
+ }
2627
+ return offset + 2
2628
+ };
2629
+
2630
+ Buffer$1.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
2631
+ value = +value;
2632
+ offset = offset | 0;
2633
+ if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);
2634
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2635
+ this[offset] = (value >>> 8);
2636
+ this[offset + 1] = (value & 0xff);
2637
+ } else {
2638
+ objectWriteUInt16(this, value, offset, false);
2639
+ }
2640
+ return offset + 2
2641
+ };
2642
+
2643
+ Buffer$1.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
2644
+ value = +value;
2645
+ offset = offset | 0;
2646
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
2647
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2648
+ this[offset] = (value & 0xff);
2649
+ this[offset + 1] = (value >>> 8);
2650
+ this[offset + 2] = (value >>> 16);
2651
+ this[offset + 3] = (value >>> 24);
2652
+ } else {
2653
+ objectWriteUInt32(this, value, offset, true);
2654
+ }
2655
+ return offset + 4
2656
+ };
2657
+
2658
+ Buffer$1.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
2659
+ value = +value;
2660
+ offset = offset | 0;
2661
+ if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);
2662
+ if (value < 0) value = 0xffffffff + value + 1;
2663
+ if (Buffer$1.TYPED_ARRAY_SUPPORT) {
2664
+ this[offset] = (value >>> 24);
2665
+ this[offset + 1] = (value >>> 16);
2666
+ this[offset + 2] = (value >>> 8);
2667
+ this[offset + 3] = (value & 0xff);
2668
+ } else {
2669
+ objectWriteUInt32(this, value, offset, false);
2670
+ }
2671
+ return offset + 4
2672
+ };
2673
+
2674
+ function checkIEEE754 (buf, value, offset, ext, max, min) {
2675
+ if (offset + ext > buf.length) throw new RangeError('Index out of range')
2676
+ if (offset < 0) throw new RangeError('Index out of range')
2677
+ }
2678
+
2679
+ function writeFloat (buf, value, offset, littleEndian, noAssert) {
2680
+ if (!noAssert) {
2681
+ checkIEEE754(buf, value, offset, 4);
2682
+ }
2683
+ write(buf, value, offset, littleEndian, 23, 4);
2684
+ return offset + 4
2685
+ }
2686
+
2687
+ Buffer$1.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
2688
+ return writeFloat(this, value, offset, true, noAssert)
2689
+ };
2690
+
2691
+ Buffer$1.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
2692
+ return writeFloat(this, value, offset, false, noAssert)
2693
+ };
2694
+
2695
+ function writeDouble (buf, value, offset, littleEndian, noAssert) {
2696
+ if (!noAssert) {
2697
+ checkIEEE754(buf, value, offset, 8);
2698
+ }
2699
+ write(buf, value, offset, littleEndian, 52, 8);
2700
+ return offset + 8
2701
+ }
2702
+
2703
+ Buffer$1.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
2704
+ return writeDouble(this, value, offset, true, noAssert)
2705
+ };
2706
+
2707
+ Buffer$1.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
2708
+ return writeDouble(this, value, offset, false, noAssert)
2709
+ };
2710
+
2711
+ // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
2712
+ Buffer$1.prototype.copy = function copy (target, targetStart, start, end) {
2713
+ if (!start) start = 0;
2714
+ if (!end && end !== 0) end = this.length;
2715
+ if (targetStart >= target.length) targetStart = target.length;
2716
+ if (!targetStart) targetStart = 0;
2717
+ if (end > 0 && end < start) end = start;
2718
+
2719
+ // Copy 0 bytes; we're done
2720
+ if (end === start) return 0
2721
+ if (target.length === 0 || this.length === 0) return 0
2722
+
2723
+ // Fatal error conditions
2724
+ if (targetStart < 0) {
2725
+ throw new RangeError('targetStart out of bounds')
2726
+ }
2727
+ if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
2728
+ if (end < 0) throw new RangeError('sourceEnd out of bounds')
2729
+
2730
+ // Are we oob?
2731
+ if (end > this.length) end = this.length;
2732
+ if (target.length - targetStart < end - start) {
2733
+ end = target.length - targetStart + start;
2734
+ }
2735
+
2736
+ var len = end - start;
2737
+ var i;
2738
+
2739
+ if (this === target && start < targetStart && targetStart < end) {
2740
+ // descending copy from end
2741
+ for (i = len - 1; i >= 0; --i) {
2742
+ target[i + targetStart] = this[i + start];
2743
+ }
2744
+ } else if (len < 1000 || !Buffer$1.TYPED_ARRAY_SUPPORT) {
2745
+ // ascending copy from start
2746
+ for (i = 0; i < len; ++i) {
2747
+ target[i + targetStart] = this[i + start];
2748
+ }
2749
+ } else {
2750
+ Uint8Array.prototype.set.call(
2751
+ target,
2752
+ this.subarray(start, start + len),
2753
+ targetStart
2754
+ );
2755
+ }
2756
+
2757
+ return len
2758
+ };
2759
+
2760
+ // Usage:
2761
+ // buffer.fill(number[, offset[, end]])
2762
+ // buffer.fill(buffer[, offset[, end]])
2763
+ // buffer.fill(string[, offset[, end]][, encoding])
2764
+ Buffer$1.prototype.fill = function fill (val, start, end, encoding) {
2765
+ // Handle string cases:
2766
+ if (typeof val === 'string') {
2767
+ if (typeof start === 'string') {
2768
+ encoding = start;
2769
+ start = 0;
2770
+ end = this.length;
2771
+ } else if (typeof end === 'string') {
2772
+ encoding = end;
2773
+ end = this.length;
2774
+ }
2775
+ if (val.length === 1) {
2776
+ var code = val.charCodeAt(0);
2777
+ if (code < 256) {
2778
+ val = code;
2779
+ }
2780
+ }
2781
+ if (encoding !== undefined && typeof encoding !== 'string') {
2782
+ throw new TypeError('encoding must be a string')
2783
+ }
2784
+ if (typeof encoding === 'string' && !Buffer$1.isEncoding(encoding)) {
2785
+ throw new TypeError('Unknown encoding: ' + encoding)
2786
+ }
2787
+ } else if (typeof val === 'number') {
2788
+ val = val & 255;
2789
+ }
2790
+
2791
+ // Invalid ranges are not set to a default, so can range check early.
2792
+ if (start < 0 || this.length < start || this.length < end) {
2793
+ throw new RangeError('Out of range index')
2794
+ }
2795
+
2796
+ if (end <= start) {
2797
+ return this
2798
+ }
2799
+
2800
+ start = start >>> 0;
2801
+ end = end === undefined ? this.length : end >>> 0;
2802
+
2803
+ if (!val) val = 0;
2804
+
2805
+ var i;
2806
+ if (typeof val === 'number') {
2807
+ for (i = start; i < end; ++i) {
2808
+ this[i] = val;
2809
+ }
2810
+ } else {
2811
+ var bytes = internalIsBuffer(val)
2812
+ ? val
2813
+ : utf8ToBytes(new Buffer$1(val, encoding).toString());
2814
+ var len = bytes.length;
2815
+ for (i = 0; i < end - start; ++i) {
2816
+ this[i + start] = bytes[i % len];
2817
+ }
2818
+ }
2819
+
2820
+ return this
2821
+ };
2822
+
2823
+ // HELPER FUNCTIONS
2824
+ // ================
2825
+
2826
+ var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g;
2827
+
2828
+ function base64clean (str) {
2829
+ // Node strips out invalid characters like \n and \t from the string, base64-js does not
2830
+ str = stringtrim(str).replace(INVALID_BASE64_RE, '');
2831
+ // Node converts strings with length < 2 to ''
2832
+ if (str.length < 2) return ''
2833
+ // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
2834
+ while (str.length % 4 !== 0) {
2835
+ str = str + '=';
2836
+ }
2837
+ return str
2838
+ }
2839
+
2840
+ function stringtrim (str) {
2841
+ if (str.trim) return str.trim()
2842
+ return str.replace(/^\s+|\s+$/g, '')
2843
+ }
2844
+
2845
+ function toHex (n) {
2846
+ if (n < 16) return '0' + n.toString(16)
2847
+ return n.toString(16)
2848
+ }
2849
+
2850
+ function utf8ToBytes (string, units) {
2851
+ units = units || Infinity;
2852
+ var codePoint;
2853
+ var length = string.length;
2854
+ var leadSurrogate = null;
2855
+ var bytes = [];
2856
+
2857
+ for (var i = 0; i < length; ++i) {
2858
+ codePoint = string.charCodeAt(i);
2859
+
2860
+ // is surrogate component
2861
+ if (codePoint > 0xD7FF && codePoint < 0xE000) {
2862
+ // last char was a lead
2863
+ if (!leadSurrogate) {
2864
+ // no lead yet
2865
+ if (codePoint > 0xDBFF) {
2866
+ // unexpected trail
2867
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2868
+ continue
2869
+ } else if (i + 1 === length) {
2870
+ // unpaired lead
2871
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2872
+ continue
2873
+ }
2874
+
2875
+ // valid lead
2876
+ leadSurrogate = codePoint;
2877
+
2878
+ continue
2879
+ }
2880
+
2881
+ // 2 leads in a row
2882
+ if (codePoint < 0xDC00) {
2883
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2884
+ leadSurrogate = codePoint;
2885
+ continue
2886
+ }
2887
+
2888
+ // valid surrogate pair
2889
+ codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;
2890
+ } else if (leadSurrogate) {
2891
+ // valid bmp char, but last char was a lead
2892
+ if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);
2893
+ }
2894
+
2895
+ leadSurrogate = null;
2896
+
2897
+ // encode utf8
2898
+ if (codePoint < 0x80) {
2899
+ if ((units -= 1) < 0) break
2900
+ bytes.push(codePoint);
2901
+ } else if (codePoint < 0x800) {
2902
+ if ((units -= 2) < 0) break
2903
+ bytes.push(
2904
+ codePoint >> 0x6 | 0xC0,
2905
+ codePoint & 0x3F | 0x80
2906
+ );
2907
+ } else if (codePoint < 0x10000) {
2908
+ if ((units -= 3) < 0) break
2909
+ bytes.push(
2910
+ codePoint >> 0xC | 0xE0,
2911
+ codePoint >> 0x6 & 0x3F | 0x80,
2912
+ codePoint & 0x3F | 0x80
2913
+ );
2914
+ } else if (codePoint < 0x110000) {
2915
+ if ((units -= 4) < 0) break
2916
+ bytes.push(
2917
+ codePoint >> 0x12 | 0xF0,
2918
+ codePoint >> 0xC & 0x3F | 0x80,
2919
+ codePoint >> 0x6 & 0x3F | 0x80,
2920
+ codePoint & 0x3F | 0x80
2921
+ );
2922
+ } else {
2923
+ throw new Error('Invalid code point')
2924
+ }
2925
+ }
2926
+
2927
+ return bytes
2928
+ }
2929
+
2930
+ function asciiToBytes (str) {
2931
+ var byteArray = [];
2932
+ for (var i = 0; i < str.length; ++i) {
2933
+ // Node's code seems to be doing this and not & 0x7F..
2934
+ byteArray.push(str.charCodeAt(i) & 0xFF);
2935
+ }
2936
+ return byteArray
2937
+ }
2938
+
2939
+ function utf16leToBytes (str, units) {
2940
+ var c, hi, lo;
2941
+ var byteArray = [];
2942
+ for (var i = 0; i < str.length; ++i) {
2943
+ if ((units -= 2) < 0) break
2944
+
2945
+ c = str.charCodeAt(i);
2946
+ hi = c >> 8;
2947
+ lo = c % 256;
2948
+ byteArray.push(lo);
2949
+ byteArray.push(hi);
2950
+ }
2951
+
2952
+ return byteArray
2953
+ }
2954
+
2955
+
2956
+ function base64ToBytes (str) {
2957
+ return toByteArray(base64clean(str))
2958
+ }
2959
+
2960
+ function blitBuffer (src, dst, offset, length) {
2961
+ for (var i = 0; i < length; ++i) {
2962
+ if ((i + offset >= dst.length) || (i >= src.length)) break
2963
+ dst[i + offset] = src[i];
2964
+ }
2965
+ return i
2966
+ }
2967
+
2968
+ function isnan (val) {
2969
+ return val !== val // eslint-disable-line no-self-compare
2970
+ }
2971
+
2972
+
2973
+ // the following is from is-buffer, also by Feross Aboukhadijeh and with same lisence
2974
+ // The _isBuffer check is for Safari 5-7 support, because it's missing
2975
+ // Object.prototype.constructor. Remove this eventually
2976
+ function isBuffer$2(obj) {
2977
+ return obj != null && (!!obj._isBuffer || isFastBuffer(obj) || isSlowBuffer(obj))
2978
+ }
2979
+
2980
+ function isFastBuffer (obj) {
2981
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
2982
+ }
2983
+
2984
+ // For Node v0.10 support. Remove this eventually.
2985
+ function isSlowBuffer (obj) {
2986
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isFastBuffer(obj.slice(0, 0))
2987
+ }
2988
+
2989
+ // shim for using process in browser
2990
+ // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
2991
+
2992
+ function defaultSetTimout() {
2993
+ throw new Error('setTimeout has not been defined');
2994
+ }
2995
+ function defaultClearTimeout () {
2996
+ throw new Error('clearTimeout has not been defined');
2997
+ }
2998
+ var cachedSetTimeout = defaultSetTimout;
2999
+ var cachedClearTimeout = defaultClearTimeout;
3000
+ if (typeof global$1.setTimeout === 'function') {
3001
+ cachedSetTimeout = setTimeout;
3002
+ }
3003
+ if (typeof global$1.clearTimeout === 'function') {
3004
+ cachedClearTimeout = clearTimeout;
3005
+ }
3006
+
3007
+ function runTimeout(fun) {
3008
+ if (cachedSetTimeout === setTimeout) {
3009
+ //normal enviroments in sane situations
3010
+ return setTimeout(fun, 0);
3011
+ }
3012
+ // if setTimeout wasn't available but was latter defined
3013
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
3014
+ cachedSetTimeout = setTimeout;
3015
+ return setTimeout(fun, 0);
3016
+ }
3017
+ try {
3018
+ // when when somebody has screwed with setTimeout but no I.E. maddness
3019
+ return cachedSetTimeout(fun, 0);
3020
+ } catch(e){
3021
+ try {
3022
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
3023
+ return cachedSetTimeout.call(null, fun, 0);
3024
+ } catch(e){
3025
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
3026
+ return cachedSetTimeout.call(this, fun, 0);
3027
+ }
3028
+ }
3029
+
3030
+
3031
+ }
3032
+ function runClearTimeout(marker) {
3033
+ if (cachedClearTimeout === clearTimeout) {
3034
+ //normal enviroments in sane situations
3035
+ return clearTimeout(marker);
3036
+ }
3037
+ // if clearTimeout wasn't available but was latter defined
3038
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
3039
+ cachedClearTimeout = clearTimeout;
3040
+ return clearTimeout(marker);
3041
+ }
3042
+ try {
3043
+ // when when somebody has screwed with setTimeout but no I.E. maddness
3044
+ return cachedClearTimeout(marker);
3045
+ } catch (e){
3046
+ try {
3047
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
3048
+ return cachedClearTimeout.call(null, marker);
3049
+ } catch (e){
3050
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
3051
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
3052
+ return cachedClearTimeout.call(this, marker);
3053
+ }
3054
+ }
3055
+
3056
+
3057
+
3058
+ }
3059
+ var queue = [];
3060
+ var draining = false;
3061
+ var currentQueue;
3062
+ var queueIndex = -1;
3063
+
3064
+ function cleanUpNextTick() {
3065
+ if (!draining || !currentQueue) {
3066
+ return;
3067
+ }
3068
+ draining = false;
3069
+ if (currentQueue.length) {
3070
+ queue = currentQueue.concat(queue);
3071
+ } else {
3072
+ queueIndex = -1;
3073
+ }
3074
+ if (queue.length) {
3075
+ drainQueue();
3076
+ }
3077
+ }
3078
+
3079
+ function drainQueue() {
3080
+ if (draining) {
3081
+ return;
3082
+ }
3083
+ var timeout = runTimeout(cleanUpNextTick);
3084
+ draining = true;
3085
+
3086
+ var len = queue.length;
3087
+ while(len) {
3088
+ currentQueue = queue;
3089
+ queue = [];
3090
+ while (++queueIndex < len) {
3091
+ if (currentQueue) {
3092
+ currentQueue[queueIndex].run();
3093
+ }
3094
+ }
3095
+ queueIndex = -1;
3096
+ len = queue.length;
3097
+ }
3098
+ currentQueue = null;
3099
+ draining = false;
3100
+ runClearTimeout(timeout);
3101
+ }
3102
+ function nextTick(fun) {
3103
+ var args = new Array(arguments.length - 1);
3104
+ if (arguments.length > 1) {
3105
+ for (var i = 1; i < arguments.length; i++) {
3106
+ args[i - 1] = arguments[i];
3107
+ }
3108
+ }
3109
+ queue.push(new Item(fun, args));
3110
+ if (queue.length === 1 && !draining) {
3111
+ runTimeout(drainQueue);
3112
+ }
3113
+ }
3114
+ // v8 likes predictible objects
3115
+ function Item(fun, array) {
3116
+ this.fun = fun;
3117
+ this.array = array;
3118
+ }
3119
+ Item.prototype.run = function () {
3120
+ this.fun.apply(null, this.array);
3121
+ };
3122
+ var title = 'browser';
3123
+ var platform = 'browser';
3124
+ var browser = true;
3125
+ var env = {};
3126
+ var argv = [];
3127
+ var version = ''; // empty string to avoid regexp issues
3128
+ var versions = {};
3129
+ var release = {};
3130
+ var config = {};
3131
+
3132
+ function noop() {}
3133
+
3134
+ var on = noop;
3135
+ var addListener = noop;
3136
+ var once = noop;
3137
+ var off = noop;
3138
+ var removeListener = noop;
3139
+ var removeAllListeners = noop;
3140
+ var emit = noop;
3141
+
3142
+ function binding(name) {
3143
+ throw new Error('process.binding is not supported');
3144
+ }
3145
+
3146
+ function cwd () { return '/' }
3147
+ function chdir (dir) {
3148
+ throw new Error('process.chdir is not supported');
3149
+ }function umask() { return 0; }
3150
+
3151
+ // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
3152
+ var performance = global$1.performance || {};
3153
+ var performanceNow =
3154
+ performance.now ||
3155
+ performance.mozNow ||
3156
+ performance.msNow ||
3157
+ performance.oNow ||
3158
+ performance.webkitNow ||
3159
+ function(){ return (new Date()).getTime() };
3160
+
3161
+ // generate timestamp or delta
3162
+ // see http://nodejs.org/api/process.html#process_process_hrtime
3163
+ function hrtime(previousTimestamp){
3164
+ var clocktime = performanceNow.call(performance)*1e-3;
3165
+ var seconds = Math.floor(clocktime);
3166
+ var nanoseconds = Math.floor((clocktime%1)*1e9);
3167
+ if (previousTimestamp) {
3168
+ seconds = seconds - previousTimestamp[0];
3169
+ nanoseconds = nanoseconds - previousTimestamp[1];
3170
+ if (nanoseconds<0) {
3171
+ seconds--;
3172
+ nanoseconds += 1e9;
3173
+ }
3174
+ }
3175
+ return [seconds,nanoseconds]
3176
+ }
3177
+
3178
+ var startTime = new Date();
3179
+ function uptime() {
3180
+ var currentTime = new Date();
3181
+ var dif = currentTime - startTime;
3182
+ return dif / 1000;
3183
+ }
3184
+
3185
+ var browser$1 = {
3186
+ nextTick: nextTick,
3187
+ title: title,
3188
+ browser: browser,
3189
+ env: env,
3190
+ argv: argv,
3191
+ version: version,
3192
+ versions: versions,
3193
+ on: on,
3194
+ addListener: addListener,
3195
+ once: once,
3196
+ off: off,
3197
+ removeListener: removeListener,
3198
+ removeAllListeners: removeAllListeners,
3199
+ emit: emit,
3200
+ binding: binding,
3201
+ cwd: cwd,
3202
+ chdir: chdir,
3203
+ umask: umask,
3204
+ hrtime: hrtime,
3205
+ platform: platform,
3206
+ release: release,
3207
+ config: config,
3208
+ uptime: uptime
3209
+ };
3210
+
3211
+ var inherits;
3212
+ if (typeof Object.create === 'function'){
3213
+ inherits = function inherits(ctor, superCtor) {
3214
+ // implementation from standard node.js 'util' module
3215
+ ctor.super_ = superCtor;
3216
+ ctor.prototype = Object.create(superCtor.prototype, {
3217
+ constructor: {
3218
+ value: ctor,
3219
+ enumerable: false,
3220
+ writable: true,
3221
+ configurable: true
3222
+ }
3223
+ });
3224
+ };
3225
+ } else {
3226
+ inherits = function inherits(ctor, superCtor) {
3227
+ ctor.super_ = superCtor;
3228
+ var TempCtor = function () {};
3229
+ TempCtor.prototype = superCtor.prototype;
3230
+ ctor.prototype = new TempCtor();
3231
+ ctor.prototype.constructor = ctor;
3232
+ };
3233
+ }
3234
+ var inherits$1 = inherits;
3235
+
3236
+ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
3237
+ function getOwnPropertyDescriptors(obj) {
3238
+ var keys = Object.keys(obj);
3239
+ var descriptors = {};
3240
+ for (var i = 0; i < keys.length; i++) {
3241
+ descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
3242
+ }
3243
+ return descriptors;
3244
+ };
3245
+
3246
+ var formatRegExp = /%[sdj%]/g;
3247
+ function format(f) {
3248
+ if (!isString$1(f)) {
3249
+ var objects = [];
3250
+ for (var i = 0; i < arguments.length; i++) {
3251
+ objects.push(inspect$1(arguments[i]));
3252
+ }
3253
+ return objects.join(' ');
3254
+ }
3255
+
3256
+ var i = 1;
3257
+ var args = arguments;
3258
+ var len = args.length;
3259
+ var str = String(f).replace(formatRegExp, function(x) {
3260
+ if (x === '%%') return '%';
3261
+ if (i >= len) return x;
3262
+ switch (x) {
3263
+ case '%s': return String(args[i++]);
3264
+ case '%d': return Number(args[i++]);
3265
+ case '%j':
3266
+ try {
3267
+ return JSON.stringify(args[i++]);
3268
+ } catch (_) {
3269
+ return '[Circular]';
3270
+ }
3271
+ default:
3272
+ return x;
3273
+ }
3274
+ });
3275
+ for (var x = args[i]; i < len; x = args[++i]) {
3276
+ if (isNull(x) || !isObject(x)) {
3277
+ str += ' ' + x;
3278
+ } else {
3279
+ str += ' ' + inspect$1(x);
3280
+ }
3281
+ }
3282
+ return str;
3283
+ }
3284
+
3285
+ // Mark that a method should not be used.
3286
+ // Returns a modified function which warns once by default.
3287
+ // If --no-deprecation is set, then it is a no-op.
3288
+ function deprecate(fn, msg) {
3289
+ // Allow for deprecating things in the process of starting up.
3290
+ if (isUndefined(global$1.process)) {
3291
+ return function() {
3292
+ return deprecate(fn, msg).apply(this, arguments);
3293
+ };
3294
+ }
3295
+
3296
+ if (browser$1.noDeprecation === true) {
3297
+ return fn;
3298
+ }
3299
+
3300
+ var warned = false;
3301
+ function deprecated() {
3302
+ if (!warned) {
3303
+ if (browser$1.throwDeprecation) {
3304
+ throw new Error(msg);
3305
+ } else if (browser$1.traceDeprecation) {
3306
+ console.trace(msg);
3307
+ } else {
3308
+ console.error(msg);
3309
+ }
3310
+ warned = true;
3311
+ }
3312
+ return fn.apply(this, arguments);
3313
+ }
3314
+
3315
+ return deprecated;
3316
+ }
3317
+
3318
+ var debugs = {};
3319
+ var debugEnviron;
3320
+ function debuglog(set) {
3321
+ if (isUndefined(debugEnviron))
3322
+ debugEnviron = browser$1.env.NODE_DEBUG || '';
3323
+ set = set.toUpperCase();
3324
+ if (!debugs[set]) {
3325
+ if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
3326
+ var pid = 0;
3327
+ debugs[set] = function() {
3328
+ var msg = format.apply(null, arguments);
3329
+ console.error('%s %d: %s', set, pid, msg);
3330
+ };
3331
+ } else {
3332
+ debugs[set] = function() {};
3333
+ }
3334
+ }
3335
+ return debugs[set];
3336
+ }
3337
+
3338
+ /**
3339
+ * Echos the value of a value. Trys to print the value out
3340
+ * in the best way possible given the different types.
3341
+ *
3342
+ * @param {Object} obj The object to print out.
3343
+ * @param {Object} opts Optional options object that alters the output.
3344
+ */
3345
+ /* legacy: obj, showHidden, depth, colors*/
3346
+ function inspect$1(obj, opts) {
3347
+ // default options
3348
+ var ctx = {
3349
+ seen: [],
3350
+ stylize: stylizeNoColor
3351
+ };
3352
+ // legacy...
3353
+ if (arguments.length >= 3) ctx.depth = arguments[2];
3354
+ if (arguments.length >= 4) ctx.colors = arguments[3];
3355
+ if (isBoolean$1(opts)) {
3356
+ // legacy...
3357
+ ctx.showHidden = opts;
3358
+ } else if (opts) {
3359
+ // got an "options" object
3360
+ _extend(ctx, opts);
3361
+ }
3362
+ // set default options
3363
+ if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
3364
+ if (isUndefined(ctx.depth)) ctx.depth = 2;
3365
+ if (isUndefined(ctx.colors)) ctx.colors = false;
3366
+ if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
3367
+ if (ctx.colors) ctx.stylize = stylizeWithColor;
3368
+ return formatValue(ctx, obj, ctx.depth);
3369
+ }
3370
+
3371
+ // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
3372
+ inspect$1.colors = {
3373
+ 'bold' : [1, 22],
3374
+ 'italic' : [3, 23],
3375
+ 'underline' : [4, 24],
3376
+ 'inverse' : [7, 27],
3377
+ 'white' : [37, 39],
3378
+ 'grey' : [90, 39],
3379
+ 'black' : [30, 39],
3380
+ 'blue' : [34, 39],
3381
+ 'cyan' : [36, 39],
3382
+ 'green' : [32, 39],
3383
+ 'magenta' : [35, 39],
3384
+ 'red' : [31, 39],
3385
+ 'yellow' : [33, 39]
3386
+ };
3387
+
3388
+ // Don't use 'blue' not visible on cmd.exe
3389
+ inspect$1.styles = {
3390
+ 'special': 'cyan',
3391
+ 'number': 'yellow',
3392
+ 'boolean': 'yellow',
3393
+ 'undefined': 'grey',
3394
+ 'null': 'bold',
3395
+ 'string': 'green',
3396
+ 'date': 'magenta',
3397
+ // "name": intentionally not styling
3398
+ 'regexp': 'red'
3399
+ };
3400
+
3401
+
3402
+ function stylizeWithColor(str, styleType) {
3403
+ var style = inspect$1.styles[styleType];
3404
+
3405
+ if (style) {
3406
+ return '\u001b[' + inspect$1.colors[style][0] + 'm' + str +
3407
+ '\u001b[' + inspect$1.colors[style][1] + 'm';
3408
+ } else {
3409
+ return str;
3410
+ }
3411
+ }
3412
+
3413
+
3414
+ function stylizeNoColor(str, styleType) {
3415
+ return str;
3416
+ }
3417
+
3418
+
3419
+ function arrayToHash(array) {
3420
+ var hash = {};
3421
+
3422
+ array.forEach(function(val, idx) {
3423
+ hash[val] = true;
3424
+ });
3425
+
3426
+ return hash;
3427
+ }
3428
+
3429
+
3430
+ function formatValue(ctx, value, recurseTimes) {
3431
+ // Provide a hook for user-specified inspect functions.
3432
+ // Check that value is an object with an inspect function on it
3433
+ if (ctx.customInspect &&
3434
+ value &&
3435
+ isFunction(value.inspect) &&
3436
+ // Filter out the util module, it's inspect function is special
3437
+ value.inspect !== inspect$1 &&
3438
+ // Also filter out any prototype objects using the circular check.
3439
+ !(value.constructor && value.constructor.prototype === value)) {
3440
+ var ret = value.inspect(recurseTimes, ctx);
3441
+ if (!isString$1(ret)) {
3442
+ ret = formatValue(ctx, ret, recurseTimes);
3443
+ }
3444
+ return ret;
3445
+ }
3446
+
3447
+ // Primitive types cannot have properties
3448
+ var primitive = formatPrimitive(ctx, value);
3449
+ if (primitive) {
3450
+ return primitive;
3451
+ }
3452
+
3453
+ // Look up the keys of the object.
3454
+ var keys = Object.keys(value);
3455
+ var visibleKeys = arrayToHash(keys);
3456
+
3457
+ if (ctx.showHidden) {
3458
+ keys = Object.getOwnPropertyNames(value);
3459
+ }
3460
+
3461
+ // IE doesn't make error fields non-enumerable
3462
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
3463
+ if (isError$1(value)
3464
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
3465
+ return formatError(value);
3466
+ }
3467
+
3468
+ // Some type of object without properties can be shortcutted.
3469
+ if (keys.length === 0) {
3470
+ if (isFunction(value)) {
3471
+ var name = value.name ? ': ' + value.name : '';
3472
+ return ctx.stylize('[Function' + name + ']', 'special');
3473
+ }
3474
+ if (isRegExp$2(value)) {
3475
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
3476
+ }
3477
+ if (isDate$1(value)) {
3478
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
3479
+ }
3480
+ if (isError$1(value)) {
3481
+ return formatError(value);
3482
+ }
3483
+ }
3484
+
3485
+ var base = '', array = false, braces = ['{', '}'];
3486
+
3487
+ // Make Array say that they are Array
3488
+ if (isArray$3(value)) {
3489
+ array = true;
3490
+ braces = ['[', ']'];
3491
+ }
3492
+
3493
+ // Make functions say that they are functions
3494
+ if (isFunction(value)) {
3495
+ var n = value.name ? ': ' + value.name : '';
3496
+ base = ' [Function' + n + ']';
3497
+ }
3498
+
3499
+ // Make RegExps say that they are RegExps
3500
+ if (isRegExp$2(value)) {
3501
+ base = ' ' + RegExp.prototype.toString.call(value);
3502
+ }
3503
+
3504
+ // Make dates with properties first say the date
3505
+ if (isDate$1(value)) {
3506
+ base = ' ' + Date.prototype.toUTCString.call(value);
3507
+ }
3508
+
3509
+ // Make error with message first say the error
3510
+ if (isError$1(value)) {
3511
+ base = ' ' + formatError(value);
3512
+ }
3513
+
3514
+ if (keys.length === 0 && (!array || value.length == 0)) {
3515
+ return braces[0] + base + braces[1];
3516
+ }
3517
+
3518
+ if (recurseTimes < 0) {
3519
+ if (isRegExp$2(value)) {
3520
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
3521
+ } else {
3522
+ return ctx.stylize('[Object]', 'special');
3523
+ }
3524
+ }
3525
+
3526
+ ctx.seen.push(value);
3527
+
3528
+ var output;
3529
+ if (array) {
3530
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
3531
+ } else {
3532
+ output = keys.map(function(key) {
3533
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
3534
+ });
3535
+ }
3536
+
3537
+ ctx.seen.pop();
3538
+
3539
+ return reduceToSingleString(output, base, braces);
3540
+ }
3541
+
3542
+
3543
+ function formatPrimitive(ctx, value) {
3544
+ if (isUndefined(value))
3545
+ return ctx.stylize('undefined', 'undefined');
3546
+ if (isString$1(value)) {
3547
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
3548
+ .replace(/'/g, "\\'")
3549
+ .replace(/\\"/g, '"') + '\'';
3550
+ return ctx.stylize(simple, 'string');
3551
+ }
3552
+ if (isNumber$1(value))
3553
+ return ctx.stylize('' + value, 'number');
3554
+ if (isBoolean$1(value))
3555
+ return ctx.stylize('' + value, 'boolean');
3556
+ // For some reason typeof null is "object", so special case here.
3557
+ if (isNull(value))
3558
+ return ctx.stylize('null', 'null');
3559
+ }
3560
+
3561
+
3562
+ function formatError(value) {
3563
+ return '[' + Error.prototype.toString.call(value) + ']';
3564
+ }
3565
+
3566
+
3567
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
3568
+ var output = [];
3569
+ for (var i = 0, l = value.length; i < l; ++i) {
3570
+ if (hasOwnProperty(value, String(i))) {
3571
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
3572
+ String(i), true));
3573
+ } else {
3574
+ output.push('');
3575
+ }
3576
+ }
3577
+ keys.forEach(function(key) {
3578
+ if (!key.match(/^\d+$/)) {
3579
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
3580
+ key, true));
3581
+ }
3582
+ });
3583
+ return output;
3584
+ }
3585
+
3586
+
3587
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
3588
+ var name, str, desc;
3589
+ desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
3590
+ if (desc.get) {
3591
+ if (desc.set) {
3592
+ str = ctx.stylize('[Getter/Setter]', 'special');
3593
+ } else {
3594
+ str = ctx.stylize('[Getter]', 'special');
3595
+ }
3596
+ } else {
3597
+ if (desc.set) {
3598
+ str = ctx.stylize('[Setter]', 'special');
3599
+ }
3600
+ }
3601
+ if (!hasOwnProperty(visibleKeys, key)) {
3602
+ name = '[' + key + ']';
3603
+ }
3604
+ if (!str) {
3605
+ if (ctx.seen.indexOf(desc.value) < 0) {
3606
+ if (isNull(recurseTimes)) {
3607
+ str = formatValue(ctx, desc.value, null);
3608
+ } else {
3609
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
3610
+ }
3611
+ if (str.indexOf('\n') > -1) {
3612
+ if (array) {
3613
+ str = str.split('\n').map(function(line) {
3614
+ return ' ' + line;
3615
+ }).join('\n').substr(2);
3616
+ } else {
3617
+ str = '\n' + str.split('\n').map(function(line) {
3618
+ return ' ' + line;
3619
+ }).join('\n');
3620
+ }
3621
+ }
3622
+ } else {
3623
+ str = ctx.stylize('[Circular]', 'special');
3624
+ }
3625
+ }
3626
+ if (isUndefined(name)) {
3627
+ if (array && key.match(/^\d+$/)) {
3628
+ return str;
3629
+ }
3630
+ name = JSON.stringify('' + key);
3631
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
3632
+ name = name.substr(1, name.length - 2);
3633
+ name = ctx.stylize(name, 'name');
3634
+ } else {
3635
+ name = name.replace(/'/g, "\\'")
3636
+ .replace(/\\"/g, '"')
3637
+ .replace(/(^"|"$)/g, "'");
3638
+ name = ctx.stylize(name, 'string');
3639
+ }
3640
+ }
3641
+
3642
+ return name + ': ' + str;
3643
+ }
3644
+
3645
+
3646
+ function reduceToSingleString(output, base, braces) {
3647
+ var length = output.reduce(function(prev, cur) {
3648
+ if (cur.indexOf('\n') >= 0) ;
3649
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
3650
+ }, 0);
3651
+
3652
+ if (length > 60) {
3653
+ return braces[0] +
3654
+ (base === '' ? '' : base + '\n ') +
3655
+ ' ' +
3656
+ output.join(',\n ') +
3657
+ ' ' +
3658
+ braces[1];
3659
+ }
3660
+
3661
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
3662
+ }
3663
+
3664
+
3665
+ // NOTE: These type checking functions intentionally don't use `instanceof`
3666
+ // because it is fragile and can be easily faked with `Object.create()`.
3667
+ function isArray$3(ar) {
3668
+ return Array.isArray(ar);
3669
+ }
3670
+
3671
+ function isBoolean$1(arg) {
3672
+ return typeof arg === 'boolean';
3673
+ }
3674
+
3675
+ function isNull(arg) {
3676
+ return arg === null;
3677
+ }
3678
+
3679
+ function isNullOrUndefined(arg) {
3680
+ return arg == null;
3681
+ }
3682
+
3683
+ function isNumber$1(arg) {
3684
+ return typeof arg === 'number';
3685
+ }
3686
+
3687
+ function isString$1(arg) {
3688
+ return typeof arg === 'string';
3689
+ }
3690
+
3691
+ function isSymbol$1(arg) {
3692
+ return typeof arg === 'symbol';
3693
+ }
3694
+
3695
+ function isUndefined(arg) {
3696
+ return arg === void 0;
3697
+ }
3698
+
3699
+ function isRegExp$2(re) {
3700
+ return isObject(re) && objectToString$1(re) === '[object RegExp]';
3701
+ }
3702
+
3703
+ function isObject(arg) {
3704
+ return typeof arg === 'object' && arg !== null;
3705
+ }
3706
+
3707
+ function isDate$1(d) {
3708
+ return isObject(d) && objectToString$1(d) === '[object Date]';
3709
+ }
3710
+
3711
+ function isError$1(e) {
3712
+ return isObject(e) &&
3713
+ (objectToString$1(e) === '[object Error]' || e instanceof Error);
3714
+ }
3715
+
3716
+ function isFunction(arg) {
3717
+ return typeof arg === 'function';
3718
+ }
3719
+
3720
+ function isPrimitive(arg) {
3721
+ return arg === null ||
3722
+ typeof arg === 'boolean' ||
3723
+ typeof arg === 'number' ||
3724
+ typeof arg === 'string' ||
3725
+ typeof arg === 'symbol' || // ES6 symbol
3726
+ typeof arg === 'undefined';
3727
+ }
923
3728
 
924
- if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
925
- value = INTRINSICS[intrinsicRealName];
926
- } else if (value != null) {
927
- if (!(part in value)) {
928
- if (!allowMissing) {
929
- throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
930
- }
931
- return void undefined$1;
932
- }
933
- if ($gOPD && (i + 1) >= parts.length) {
934
- var desc = $gOPD(value, part);
935
- isOwn = !!desc;
3729
+ function isBuffer$1(maybeBuf) {
3730
+ return Buffer$1.isBuffer(maybeBuf);
3731
+ }
936
3732
 
937
- // By convention, when a data property is converted to an accessor
938
- // property to emulate a data property that does not suffer from
939
- // the override mistake, that accessor's getter is marked with
940
- // an `originalValue` property. Here, when we detect this, we
941
- // uphold the illusion by pretending to see that original data
942
- // property, i.e., returning the value rather than the getter
943
- // itself.
944
- if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
945
- value = desc.get;
946
- } else {
947
- value = value[part];
948
- }
949
- } else {
950
- isOwn = hasOwn$1(value, part);
951
- value = value[part];
952
- }
3733
+ function objectToString$1(o) {
3734
+ return Object.prototype.toString.call(o);
3735
+ }
953
3736
 
954
- if (isOwn && !skipFurtherCaching) {
955
- INTRINSICS[intrinsicRealName] = value;
956
- }
957
- }
958
- }
959
- return value;
960
- };
961
3737
 
962
- var callBind$1 = {exports: {}};
3738
+ function pad(n) {
3739
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
3740
+ }
963
3741
 
964
- (function (module) {
965
3742
 
966
- var bind = functionBind;
967
- var GetIntrinsic = getIntrinsic;
3743
+ var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
3744
+ 'Oct', 'Nov', 'Dec'];
968
3745
 
969
- var $apply = GetIntrinsic('%Function.prototype.apply%');
970
- var $call = GetIntrinsic('%Function.prototype.call%');
971
- var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
3746
+ // 26 Feb 16:19:34
3747
+ function timestamp() {
3748
+ var d = new Date();
3749
+ var time = [pad(d.getHours()),
3750
+ pad(d.getMinutes()),
3751
+ pad(d.getSeconds())].join(':');
3752
+ return [d.getDate(), months[d.getMonth()], time].join(' ');
3753
+ }
972
3754
 
973
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
974
- var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
975
- var $max = GetIntrinsic('%Math.max%');
976
3755
 
977
- if ($defineProperty) {
978
- try {
979
- $defineProperty({}, 'a', { value: 1 });
980
- } catch (e) {
981
- // IE 8 has a broken defineProperty
982
- $defineProperty = null;
983
- }
984
- }
3756
+ // log is just a thin wrapper to console.log that prepends a timestamp
3757
+ function log() {
3758
+ console.log('%s - %s', timestamp(), format.apply(null, arguments));
3759
+ }
985
3760
 
986
- module.exports = function callBind(originalFunction) {
987
- var func = $reflectApply(bind, $call, arguments);
988
- if ($gOPD && $defineProperty) {
989
- var desc = $gOPD(func, 'length');
990
- if (desc.configurable) {
991
- // original length, plus the receiver, minus any additional arguments (after the receiver)
992
- $defineProperty(
993
- func,
994
- 'length',
995
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
996
- );
997
- }
998
- }
999
- return func;
1000
- };
3761
+ function _extend(origin, add) {
3762
+ // Don't do anything if add isn't an object
3763
+ if (!add || !isObject(add)) return origin;
1001
3764
 
1002
- var applyBind = function applyBind() {
1003
- return $reflectApply(bind, $apply, arguments);
1004
- };
3765
+ var keys = Object.keys(add);
3766
+ var i = keys.length;
3767
+ while (i--) {
3768
+ origin[keys[i]] = add[keys[i]];
3769
+ }
3770
+ return origin;
3771
+ }
3772
+ function hasOwnProperty(obj, prop) {
3773
+ return Object.prototype.hasOwnProperty.call(obj, prop);
3774
+ }
1005
3775
 
1006
- if ($defineProperty) {
1007
- $defineProperty(module.exports, 'apply', { value: applyBind });
1008
- } else {
1009
- module.exports.apply = applyBind;
1010
- }
1011
- } (callBind$1));
3776
+ var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
1012
3777
 
1013
- var callBindExports = callBind$1.exports;
3778
+ function promisify(original) {
3779
+ if (typeof original !== 'function')
3780
+ throw new TypeError('The "original" argument must be of type Function');
1014
3781
 
1015
- var GetIntrinsic$1 = getIntrinsic;
3782
+ if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
3783
+ var fn = original[kCustomPromisifiedSymbol];
3784
+ if (typeof fn !== 'function') {
3785
+ throw new TypeError('The "util.promisify.custom" argument must be of type Function');
3786
+ }
3787
+ Object.defineProperty(fn, kCustomPromisifiedSymbol, {
3788
+ value: fn, enumerable: false, writable: false, configurable: true
3789
+ });
3790
+ return fn;
3791
+ }
1016
3792
 
1017
- var callBind = callBindExports;
3793
+ function fn() {
3794
+ var promiseResolve, promiseReject;
3795
+ var promise = new Promise(function (resolve, reject) {
3796
+ promiseResolve = resolve;
3797
+ promiseReject = reject;
3798
+ });
1018
3799
 
1019
- var $indexOf = callBind(GetIntrinsic$1('String.prototype.indexOf'));
3800
+ var args = [];
3801
+ for (var i = 0; i < arguments.length; i++) {
3802
+ args.push(arguments[i]);
3803
+ }
3804
+ args.push(function (err, value) {
3805
+ if (err) {
3806
+ promiseReject(err);
3807
+ } else {
3808
+ promiseResolve(value);
3809
+ }
3810
+ });
1020
3811
 
1021
- var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
1022
- var intrinsic = GetIntrinsic$1(name, !!allowMissing);
1023
- if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
1024
- return callBind(intrinsic);
1025
- }
1026
- return intrinsic;
3812
+ try {
3813
+ original.apply(this, args);
3814
+ } catch (err) {
3815
+ promiseReject(err);
3816
+ }
3817
+
3818
+ return promise;
3819
+ }
3820
+
3821
+ Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
3822
+
3823
+ if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
3824
+ value: fn, enumerable: false, writable: false, configurable: true
3825
+ });
3826
+ return Object.defineProperties(
3827
+ fn,
3828
+ getOwnPropertyDescriptors(original)
3829
+ );
3830
+ }
3831
+
3832
+ promisify.custom = kCustomPromisifiedSymbol;
3833
+
3834
+ function callbackifyOnRejected(reason, cb) {
3835
+ // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
3836
+ // Because `null` is a special error value in callbacks which means "no error
3837
+ // occurred", we error-wrap so the callback consumer can distinguish between
3838
+ // "the promise rejected with null" or "the promise fulfilled with undefined".
3839
+ if (!reason) {
3840
+ var newReason = new Error('Promise was rejected with a falsy value');
3841
+ newReason.reason = reason;
3842
+ reason = newReason;
3843
+ }
3844
+ return cb(reason);
3845
+ }
3846
+
3847
+ function callbackify(original) {
3848
+ if (typeof original !== 'function') {
3849
+ throw new TypeError('The "original" argument must be of type Function');
3850
+ }
3851
+
3852
+ // We DO NOT return the promise as it gives the user a false sense that
3853
+ // the promise is actually somehow related to the callback's execution
3854
+ // and that the callback throwing will reject the promise.
3855
+ function callbackified() {
3856
+ var args = [];
3857
+ for (var i = 0; i < arguments.length; i++) {
3858
+ args.push(arguments[i]);
3859
+ }
3860
+
3861
+ var maybeCb = args.pop();
3862
+ if (typeof maybeCb !== 'function') {
3863
+ throw new TypeError('The last argument must be of type Function');
3864
+ }
3865
+ var self = this;
3866
+ var cb = function() {
3867
+ return maybeCb.apply(self, arguments);
3868
+ };
3869
+ // In true node style we process the callback on `nextTick` with all the
3870
+ // implications (stack, `uncaughtException`, `async_hooks`)
3871
+ original.apply(this, args)
3872
+ .then(function(ret) { browser$1.nextTick(cb.bind(null, null, ret)); },
3873
+ function(rej) { browser$1.nextTick(callbackifyOnRejected.bind(null, rej, cb)); });
3874
+ }
3875
+
3876
+ Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
3877
+ Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
3878
+ return callbackified;
3879
+ }
3880
+
3881
+ var _polyfillNode_util = {
3882
+ inherits: inherits$1,
3883
+ _extend: _extend,
3884
+ log: log,
3885
+ isBuffer: isBuffer$1,
3886
+ isPrimitive: isPrimitive,
3887
+ isFunction: isFunction,
3888
+ isError: isError$1,
3889
+ isDate: isDate$1,
3890
+ isObject: isObject,
3891
+ isRegExp: isRegExp$2,
3892
+ isUndefined: isUndefined,
3893
+ isSymbol: isSymbol$1,
3894
+ isString: isString$1,
3895
+ isNumber: isNumber$1,
3896
+ isNullOrUndefined: isNullOrUndefined,
3897
+ isNull: isNull,
3898
+ isBoolean: isBoolean$1,
3899
+ isArray: isArray$3,
3900
+ inspect: inspect$1,
3901
+ deprecate: deprecate,
3902
+ format: format,
3903
+ debuglog: debuglog,
3904
+ promisify: promisify,
3905
+ callbackify: callbackify,
1027
3906
  };
1028
3907
 
1029
- var require$$0 = /*@__PURE__*/getAugmentedNamespace(node_util__namespace);
3908
+ var _polyfillNode_util$1 = /*#__PURE__*/Object.freeze({
3909
+ __proto__: null,
3910
+ _extend: _extend,
3911
+ callbackify: callbackify,
3912
+ debuglog: debuglog,
3913
+ default: _polyfillNode_util,
3914
+ deprecate: deprecate,
3915
+ format: format,
3916
+ inherits: inherits$1,
3917
+ inspect: inspect$1,
3918
+ isArray: isArray$3,
3919
+ isBoolean: isBoolean$1,
3920
+ isBuffer: isBuffer$1,
3921
+ isDate: isDate$1,
3922
+ isError: isError$1,
3923
+ isFunction: isFunction,
3924
+ isNull: isNull,
3925
+ isNullOrUndefined: isNullOrUndefined,
3926
+ isNumber: isNumber$1,
3927
+ isObject: isObject,
3928
+ isPrimitive: isPrimitive,
3929
+ isRegExp: isRegExp$2,
3930
+ isString: isString$1,
3931
+ isSymbol: isSymbol$1,
3932
+ isUndefined: isUndefined,
3933
+ log: log,
3934
+ promisify: promisify
3935
+ });
3936
+
3937
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_util$1);
1030
3938
 
1031
3939
  var util_inspect = require$$0.inspect;
1032
3940
 
@@ -1104,31 +4012,31 @@ var miolo = (function (exports, node_util) {
1104
4012
  var objectInspect = function inspect_(obj, options, depth, seen) {
1105
4013
  var opts = options || {};
1106
4014
 
1107
- if (has$3(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
4015
+ if (has$2(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
1108
4016
  throw new TypeError('option "quoteStyle" must be "single" or "double"');
1109
4017
  }
1110
4018
  if (
1111
- has$3(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
4019
+ has$2(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
1112
4020
  ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
1113
4021
  : opts.maxStringLength !== null
1114
4022
  )
1115
4023
  ) {
1116
4024
  throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
1117
4025
  }
1118
- var customInspect = has$3(opts, 'customInspect') ? opts.customInspect : true;
4026
+ var customInspect = has$2(opts, 'customInspect') ? opts.customInspect : true;
1119
4027
  if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
1120
4028
  throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
1121
4029
  }
1122
4030
 
1123
4031
  if (
1124
- has$3(opts, 'indent')
4032
+ has$2(opts, 'indent')
1125
4033
  && opts.indent !== null
1126
4034
  && opts.indent !== '\t'
1127
4035
  && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
1128
4036
  ) {
1129
4037
  throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
1130
4038
  }
1131
- if (has$3(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
4039
+ if (has$2(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
1132
4040
  throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
1133
4041
  }
1134
4042
  var numericSeparator = opts.numericSeparator;
@@ -1161,7 +4069,7 @@ var miolo = (function (exports, node_util) {
1161
4069
  var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
1162
4070
  if (typeof depth === 'undefined') { depth = 0; }
1163
4071
  if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
1164
- return isArray$3(obj) ? '[Array]' : '[Object]';
4072
+ return isArray$2(obj) ? '[Array]' : '[Object]';
1165
4073
  }
1166
4074
 
1167
4075
  var indent = getIndent(opts, depth);
@@ -1181,7 +4089,7 @@ var miolo = (function (exports, node_util) {
1181
4089
  var newOpts = {
1182
4090
  depth: opts.depth
1183
4091
  };
1184
- if (has$3(opts, 'quoteStyle')) {
4092
+ if (has$2(opts, 'quoteStyle')) {
1185
4093
  newOpts.quoteStyle = opts.quoteStyle;
1186
4094
  }
1187
4095
  return inspect_(value, newOpts, depth + 1, seen);
@@ -1209,7 +4117,7 @@ var miolo = (function (exports, node_util) {
1209
4117
  s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
1210
4118
  return s;
1211
4119
  }
1212
- if (isArray$3(obj)) {
4120
+ if (isArray$2(obj)) {
1213
4121
  if (obj.length === 0) { return '[]'; }
1214
4122
  var xs = arrObjKeys(obj, inspect);
1215
4123
  if (indent && !singleLineValues(xs)) {
@@ -1296,7 +4204,7 @@ var miolo = (function (exports, node_util) {
1296
4204
  return $replace.call(String(s), /"/g, '&quot;');
1297
4205
  }
1298
4206
 
1299
- function isArray$3(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
4207
+ function isArray$2(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1300
4208
  function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1301
4209
  function isRegExp$1(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
1302
4210
  function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
@@ -1334,7 +4242,7 @@ var miolo = (function (exports, node_util) {
1334
4242
  }
1335
4243
 
1336
4244
  var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
1337
- function has$3(obj, key) {
4245
+ function has$2(obj, key) {
1338
4246
  return hasOwn.call(obj, key);
1339
4247
  }
1340
4248
 
@@ -1508,12 +4416,12 @@ var miolo = (function (exports, node_util) {
1508
4416
  }
1509
4417
 
1510
4418
  function arrObjKeys(obj, inspect) {
1511
- var isArr = isArray$3(obj);
4419
+ var isArr = isArray$2(obj);
1512
4420
  var xs = [];
1513
4421
  if (isArr) {
1514
4422
  xs.length = obj.length;
1515
4423
  for (var i = 0; i < obj.length; i++) {
1516
- xs[i] = has$3(obj, i) ? inspect(obj[i], obj) : '';
4424
+ xs[i] = has$2(obj, i) ? inspect(obj[i], obj) : '';
1517
4425
  }
1518
4426
  }
1519
4427
  var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
@@ -1526,7 +4434,7 @@ var miolo = (function (exports, node_util) {
1526
4434
  }
1527
4435
 
1528
4436
  for (var key in obj) { // eslint-disable-line no-restricted-syntax
1529
- if (!has$3(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
4437
+ if (!has$2(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1530
4438
  if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
1531
4439
  if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
1532
4440
  // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
@@ -1678,7 +4586,7 @@ var miolo = (function (exports, node_util) {
1678
4586
  RFC3986: 'RFC3986'
1679
4587
  };
1680
4588
 
1681
- var formats$3 = {
4589
+ var formats$2 = {
1682
4590
  'default': Format.RFC3986,
1683
4591
  formatters: {
1684
4592
  RFC1738: function (value) {
@@ -1692,10 +4600,10 @@ var miolo = (function (exports, node_util) {
1692
4600
  RFC3986: Format.RFC3986
1693
4601
  };
1694
4602
 
1695
- var formats$2 = formats$3;
4603
+ var formats$1 = formats$2;
1696
4604
 
1697
- var has$2 = Object.prototype.hasOwnProperty;
1698
- var isArray$2 = Array.isArray;
4605
+ var has$1 = Object.prototype.hasOwnProperty;
4606
+ var isArray$1 = Array.isArray;
1699
4607
 
1700
4608
  var hexTable = (function () {
1701
4609
  var array = [];
@@ -1711,7 +4619,7 @@ var miolo = (function (exports, node_util) {
1711
4619
  var item = queue.pop();
1712
4620
  var obj = item.obj[item.prop];
1713
4621
 
1714
- if (isArray$2(obj)) {
4622
+ if (isArray$1(obj)) {
1715
4623
  var compacted = [];
1716
4624
 
1717
4625
  for (var j = 0; j < obj.length; ++j) {
@@ -1743,10 +4651,10 @@ var miolo = (function (exports, node_util) {
1743
4651
  }
1744
4652
 
1745
4653
  if (typeof source !== 'object') {
1746
- if (isArray$2(target)) {
4654
+ if (isArray$1(target)) {
1747
4655
  target.push(source);
1748
4656
  } else if (target && typeof target === 'object') {
1749
- if ((options && (options.plainObjects || options.allowPrototypes)) || !has$2.call(Object.prototype, source)) {
4657
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has$1.call(Object.prototype, source)) {
1750
4658
  target[source] = true;
1751
4659
  }
1752
4660
  } else {
@@ -1761,13 +4669,13 @@ var miolo = (function (exports, node_util) {
1761
4669
  }
1762
4670
 
1763
4671
  var mergeTarget = target;
1764
- if (isArray$2(target) && !isArray$2(source)) {
4672
+ if (isArray$1(target) && !isArray$1(source)) {
1765
4673
  mergeTarget = arrayToObject(target, options);
1766
4674
  }
1767
4675
 
1768
- if (isArray$2(target) && isArray$2(source)) {
4676
+ if (isArray$1(target) && isArray$1(source)) {
1769
4677
  source.forEach(function (item, i) {
1770
- if (has$2.call(target, i)) {
4678
+ if (has$1.call(target, i)) {
1771
4679
  var targetItem = target[i];
1772
4680
  if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
1773
4681
  target[i] = merge(targetItem, item, options);
@@ -1784,7 +4692,7 @@ var miolo = (function (exports, node_util) {
1784
4692
  return Object.keys(source).reduce(function (acc, key) {
1785
4693
  var value = source[key];
1786
4694
 
1787
- if (has$2.call(acc, key)) {
4695
+ if (has$1.call(acc, key)) {
1788
4696
  acc[key] = merge(acc[key], value, options);
1789
4697
  } else {
1790
4698
  acc[key] = value;
@@ -1846,7 +4754,7 @@ var miolo = (function (exports, node_util) {
1846
4754
  || (c >= 0x30 && c <= 0x39) // 0-9
1847
4755
  || (c >= 0x41 && c <= 0x5A) // a-z
1848
4756
  || (c >= 0x61 && c <= 0x7A) // A-Z
1849
- || (format === formats$2.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
4757
+ || (format === formats$1.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
1850
4758
  ) {
1851
4759
  out += string.charAt(i);
1852
4760
  continue;
@@ -1920,7 +4828,7 @@ var miolo = (function (exports, node_util) {
1920
4828
  };
1921
4829
 
1922
4830
  var maybeMap = function maybeMap(val, fn) {
1923
- if (isArray$2(val)) {
4831
+ if (isArray$1(val)) {
1924
4832
  var mapped = [];
1925
4833
  for (var i = 0; i < val.length; i += 1) {
1926
4834
  mapped.push(fn(val[i]));
@@ -1930,7 +4838,7 @@ var miolo = (function (exports, node_util) {
1930
4838
  return fn(val);
1931
4839
  };
1932
4840
 
1933
- var utils$2 = {
4841
+ var utils$1 = {
1934
4842
  arrayToObject: arrayToObject,
1935
4843
  assign: assign,
1936
4844
  combine: combine,
@@ -1944,9 +4852,9 @@ var miolo = (function (exports, node_util) {
1944
4852
  };
1945
4853
 
1946
4854
  var getSideChannel = sideChannel;
1947
- var utils$1 = utils$2;
1948
- var formats$1 = formats$3;
1949
- var has$1 = Object.prototype.hasOwnProperty;
4855
+ var utils = utils$1;
4856
+ var formats = formats$2;
4857
+ var has = Object.prototype.hasOwnProperty;
1950
4858
 
1951
4859
  var arrayPrefixGenerators = {
1952
4860
  brackets: function brackets(prefix) {
@@ -1961,26 +4869,26 @@ var miolo = (function (exports, node_util) {
1961
4869
  }
1962
4870
  };
1963
4871
 
1964
- var isArray$1 = Array.isArray;
4872
+ var isArray = Array.isArray;
1965
4873
  var push = Array.prototype.push;
1966
4874
  var pushToArray = function (arr, valueOrArray) {
1967
- push.apply(arr, isArray$1(valueOrArray) ? valueOrArray : [valueOrArray]);
4875
+ push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
1968
4876
  };
1969
4877
 
1970
4878
  var toISO = Date.prototype.toISOString;
1971
4879
 
1972
- var defaultFormat = formats$1['default'];
1973
- var defaults$1 = {
4880
+ var defaultFormat = formats['default'];
4881
+ var defaults = {
1974
4882
  addQueryPrefix: false,
1975
4883
  allowDots: false,
1976
4884
  charset: 'utf-8',
1977
4885
  charsetSentinel: false,
1978
4886
  delimiter: '&',
1979
4887
  encode: true,
1980
- encoder: utils$1.encode,
4888
+ encoder: utils.encode,
1981
4889
  encodeValuesOnly: false,
1982
4890
  format: defaultFormat,
1983
- formatter: formats$1.formatters[defaultFormat],
4891
+ formatter: formats.formatters[defaultFormat],
1984
4892
  // deprecated
1985
4893
  indices: false,
1986
4894
  serializeDate: function serializeDate(date) {
@@ -2000,7 +4908,7 @@ var miolo = (function (exports, node_util) {
2000
4908
 
2001
4909
  var sentinel = {};
2002
4910
 
2003
- var stringify$1 = function stringify(
4911
+ var stringify = function stringify(
2004
4912
  object,
2005
4913
  prefix,
2006
4914
  generateArrayPrefix,
@@ -2043,8 +4951,8 @@ var miolo = (function (exports, node_util) {
2043
4951
  obj = filter(prefix, obj);
2044
4952
  } else if (obj instanceof Date) {
2045
4953
  obj = serializeDate(obj);
2046
- } else if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
2047
- obj = utils$1.maybeMap(obj, function (value) {
4954
+ } else if (generateArrayPrefix === 'comma' && isArray(obj)) {
4955
+ obj = utils.maybeMap(obj, function (value) {
2048
4956
  if (value instanceof Date) {
2049
4957
  return serializeDate(value);
2050
4958
  }
@@ -2054,16 +4962,16 @@ var miolo = (function (exports, node_util) {
2054
4962
 
2055
4963
  if (obj === null) {
2056
4964
  if (strictNullHandling) {
2057
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults$1.encoder, charset, 'key', format) : prefix;
4965
+ return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
2058
4966
  }
2059
4967
 
2060
4968
  obj = '';
2061
4969
  }
2062
4970
 
2063
- if (isNonNullishPrimitive(obj) || utils$1.isBuffer(obj)) {
4971
+ if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
2064
4972
  if (encoder) {
2065
- var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults$1.encoder, charset, 'key', format);
2066
- return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults$1.encoder, charset, 'value', format))];
4973
+ var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
4974
+ return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
2067
4975
  }
2068
4976
  return [formatter(prefix) + '=' + formatter(String(obj))];
2069
4977
  }
@@ -2075,20 +4983,20 @@ var miolo = (function (exports, node_util) {
2075
4983
  }
2076
4984
 
2077
4985
  var objKeys;
2078
- if (generateArrayPrefix === 'comma' && isArray$1(obj)) {
4986
+ if (generateArrayPrefix === 'comma' && isArray(obj)) {
2079
4987
  // we need to join elements in
2080
4988
  if (encodeValuesOnly && encoder) {
2081
- obj = utils$1.maybeMap(obj, encoder);
4989
+ obj = utils.maybeMap(obj, encoder);
2082
4990
  }
2083
4991
  objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
2084
- } else if (isArray$1(filter)) {
4992
+ } else if (isArray(filter)) {
2085
4993
  objKeys = filter;
2086
4994
  } else {
2087
4995
  var keys = Object.keys(obj);
2088
4996
  objKeys = sort ? keys.sort(sort) : keys;
2089
4997
  }
2090
4998
 
2091
- var adjustedPrefix = commaRoundTrip && isArray$1(obj) && obj.length === 1 ? prefix + '[]' : prefix;
4999
+ var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
2092
5000
 
2093
5001
  for (var j = 0; j < objKeys.length; ++j) {
2094
5002
  var key = objKeys[j];
@@ -2098,7 +5006,7 @@ var miolo = (function (exports, node_util) {
2098
5006
  continue;
2099
5007
  }
2100
5008
 
2101
- var keyPrefix = isArray$1(obj)
5009
+ var keyPrefix = isArray(obj)
2102
5010
  ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
2103
5011
  : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
2104
5012
 
@@ -2112,7 +5020,7 @@ var miolo = (function (exports, node_util) {
2112
5020
  commaRoundTrip,
2113
5021
  strictNullHandling,
2114
5022
  skipNulls,
2115
- generateArrayPrefix === 'comma' && encodeValuesOnly && isArray$1(obj) ? null : encoder,
5023
+ generateArrayPrefix === 'comma' && encodeValuesOnly && isArray(obj) ? null : encoder,
2116
5024
  filter,
2117
5025
  sort,
2118
5026
  allowDots,
@@ -2130,48 +5038,48 @@ var miolo = (function (exports, node_util) {
2130
5038
 
2131
5039
  var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
2132
5040
  if (!opts) {
2133
- return defaults$1;
5041
+ return defaults;
2134
5042
  }
2135
5043
 
2136
5044
  if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
2137
5045
  throw new TypeError('Encoder has to be a function.');
2138
5046
  }
2139
5047
 
2140
- var charset = opts.charset || defaults$1.charset;
5048
+ var charset = opts.charset || defaults.charset;
2141
5049
  if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2142
5050
  throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2143
5051
  }
2144
5052
 
2145
- var format = formats$1['default'];
5053
+ var format = formats['default'];
2146
5054
  if (typeof opts.format !== 'undefined') {
2147
- if (!has$1.call(formats$1.formatters, opts.format)) {
5055
+ if (!has.call(formats.formatters, opts.format)) {
2148
5056
  throw new TypeError('Unknown format option provided.');
2149
5057
  }
2150
5058
  format = opts.format;
2151
5059
  }
2152
- var formatter = formats$1.formatters[format];
5060
+ var formatter = formats.formatters[format];
2153
5061
 
2154
- var filter = defaults$1.filter;
2155
- if (typeof opts.filter === 'function' || isArray$1(opts.filter)) {
5062
+ var filter = defaults.filter;
5063
+ if (typeof opts.filter === 'function' || isArray(opts.filter)) {
2156
5064
  filter = opts.filter;
2157
5065
  }
2158
5066
 
2159
5067
  return {
2160
- addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults$1.addQueryPrefix,
2161
- allowDots: typeof opts.allowDots === 'undefined' ? defaults$1.allowDots : !!opts.allowDots,
5068
+ addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
5069
+ allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
2162
5070
  charset: charset,
2163
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults$1.charsetSentinel,
2164
- delimiter: typeof opts.delimiter === 'undefined' ? defaults$1.delimiter : opts.delimiter,
2165
- encode: typeof opts.encode === 'boolean' ? opts.encode : defaults$1.encode,
2166
- encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults$1.encoder,
2167
- encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults$1.encodeValuesOnly,
5071
+ charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
5072
+ delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
5073
+ encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
5074
+ encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
5075
+ encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
2168
5076
  filter: filter,
2169
5077
  format: format,
2170
5078
  formatter: formatter,
2171
- serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults$1.serializeDate,
2172
- skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults$1.skipNulls,
5079
+ serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
5080
+ skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
2173
5081
  sort: typeof opts.sort === 'function' ? opts.sort : null,
2174
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults$1.strictNullHandling
5082
+ strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
2175
5083
  };
2176
5084
  };
2177
5085
 
@@ -2185,7 +5093,7 @@ var miolo = (function (exports, node_util) {
2185
5093
  if (typeof options.filter === 'function') {
2186
5094
  filter = options.filter;
2187
5095
  obj = filter('', obj);
2188
- } else if (isArray$1(options.filter)) {
5096
+ } else if (isArray(options.filter)) {
2189
5097
  filter = options.filter;
2190
5098
  objKeys = filter;
2191
5099
  }
@@ -2226,7 +5134,7 @@ var miolo = (function (exports, node_util) {
2226
5134
  if (options.skipNulls && obj[key] === null) {
2227
5135
  continue;
2228
5136
  }
2229
- pushToArray(keys, stringify$1(
5137
+ pushToArray(keys, stringify(
2230
5138
  obj[key],
2231
5139
  key,
2232
5140
  generateArrayPrefix,
@@ -2262,287 +5170,14 @@ var miolo = (function (exports, node_util) {
2262
5170
  return joined.length > 0 ? prefix + joined : '';
2263
5171
  };
2264
5172
 
2265
- var utils = utils$2;
2266
-
2267
- var has = Object.prototype.hasOwnProperty;
2268
- var isArray = Array.isArray;
2269
-
2270
- var defaults = {
2271
- allowDots: false,
2272
- allowPrototypes: false,
2273
- allowSparse: false,
2274
- arrayLimit: 20,
2275
- charset: 'utf-8',
2276
- charsetSentinel: false,
2277
- comma: false,
2278
- decoder: utils.decode,
2279
- delimiter: '&',
2280
- depth: 5,
2281
- ignoreQueryPrefix: false,
2282
- interpretNumericEntities: false,
2283
- parameterLimit: 1000,
2284
- parseArrays: true,
2285
- plainObjects: false,
2286
- strictNullHandling: false
2287
- };
2288
-
2289
- var interpretNumericEntities = function (str) {
2290
- return str.replace(/&#(\d+);/g, function ($0, numberStr) {
2291
- return String.fromCharCode(parseInt(numberStr, 10));
2292
- });
2293
- };
2294
-
2295
- var parseArrayValue = function (val, options) {
2296
- if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
2297
- return val.split(',');
2298
- }
2299
-
2300
- return val;
2301
- };
2302
-
2303
- // This is what browsers will submit when the ✓ character occurs in an
2304
- // application/x-www-form-urlencoded body and the encoding of the page containing
2305
- // the form is iso-8859-1, or when the submitted form has an accept-charset
2306
- // attribute of iso-8859-1. Presumably also with other charsets that do not contain
2307
- // the ✓ character, such as us-ascii.
2308
- var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('&#10003;')
2309
-
2310
- // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
2311
- var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
2312
-
2313
- var parseValues = function parseQueryStringValues(str, options) {
2314
- var obj = { __proto__: null };
2315
-
2316
- var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
2317
- var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
2318
- var parts = cleanStr.split(options.delimiter, limit);
2319
- var skipIndex = -1; // Keep track of where the utf8 sentinel was found
2320
- var i;
2321
-
2322
- var charset = options.charset;
2323
- if (options.charsetSentinel) {
2324
- for (i = 0; i < parts.length; ++i) {
2325
- if (parts[i].indexOf('utf8=') === 0) {
2326
- if (parts[i] === charsetSentinel) {
2327
- charset = 'utf-8';
2328
- } else if (parts[i] === isoSentinel) {
2329
- charset = 'iso-8859-1';
2330
- }
2331
- skipIndex = i;
2332
- i = parts.length; // The eslint settings do not allow break;
2333
- }
2334
- }
2335
- }
2336
-
2337
- for (i = 0; i < parts.length; ++i) {
2338
- if (i === skipIndex) {
2339
- continue;
2340
- }
2341
- var part = parts[i];
2342
-
2343
- var bracketEqualsPos = part.indexOf(']=');
2344
- var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
2345
-
2346
- var key, val;
2347
- if (pos === -1) {
2348
- key = options.decoder(part, defaults.decoder, charset, 'key');
2349
- val = options.strictNullHandling ? null : '';
2350
- } else {
2351
- key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
2352
- val = utils.maybeMap(
2353
- parseArrayValue(part.slice(pos + 1), options),
2354
- function (encodedVal) {
2355
- return options.decoder(encodedVal, defaults.decoder, charset, 'value');
2356
- }
2357
- );
2358
- }
2359
-
2360
- if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
2361
- val = interpretNumericEntities(val);
2362
- }
2363
-
2364
- if (part.indexOf('[]=') > -1) {
2365
- val = isArray(val) ? [val] : val;
2366
- }
2367
-
2368
- if (has.call(obj, key)) {
2369
- obj[key] = utils.combine(obj[key], val);
2370
- } else {
2371
- obj[key] = val;
2372
- }
2373
- }
2374
-
2375
- return obj;
2376
- };
2377
-
2378
- var parseObject = function (chain, val, options, valuesParsed) {
2379
- var leaf = valuesParsed ? val : parseArrayValue(val, options);
2380
-
2381
- for (var i = chain.length - 1; i >= 0; --i) {
2382
- var obj;
2383
- var root = chain[i];
2384
-
2385
- if (root === '[]' && options.parseArrays) {
2386
- obj = [].concat(leaf);
2387
- } else {
2388
- obj = options.plainObjects ? Object.create(null) : {};
2389
- var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
2390
- var index = parseInt(cleanRoot, 10);
2391
- if (!options.parseArrays && cleanRoot === '') {
2392
- obj = { 0: leaf };
2393
- } else if (
2394
- !isNaN(index)
2395
- && root !== cleanRoot
2396
- && String(index) === cleanRoot
2397
- && index >= 0
2398
- && (options.parseArrays && index <= options.arrayLimit)
2399
- ) {
2400
- obj = [];
2401
- obj[index] = leaf;
2402
- } else if (cleanRoot !== '__proto__') {
2403
- obj[cleanRoot] = leaf;
2404
- }
2405
- }
2406
-
2407
- leaf = obj;
2408
- }
2409
-
2410
- return leaf;
2411
- };
2412
-
2413
- var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
2414
- if (!givenKey) {
2415
- return;
2416
- }
2417
-
2418
- // Transform dot notation to bracket notation
2419
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
2420
-
2421
- // The regex chunks
2422
-
2423
- var brackets = /(\[[^[\]]*])/;
2424
- var child = /(\[[^[\]]*])/g;
2425
-
2426
- // Get the parent
2427
-
2428
- var segment = options.depth > 0 && brackets.exec(key);
2429
- var parent = segment ? key.slice(0, segment.index) : key;
2430
-
2431
- // Stash the parent if it exists
2432
-
2433
- var keys = [];
2434
- if (parent) {
2435
- // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
2436
- if (!options.plainObjects && has.call(Object.prototype, parent)) {
2437
- if (!options.allowPrototypes) {
2438
- return;
2439
- }
2440
- }
2441
-
2442
- keys.push(parent);
2443
- }
2444
-
2445
- // Loop through children appending to the array until we hit depth
2446
-
2447
- var i = 0;
2448
- while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
2449
- i += 1;
2450
- if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
2451
- if (!options.allowPrototypes) {
2452
- return;
2453
- }
2454
- }
2455
- keys.push(segment[1]);
2456
- }
2457
-
2458
- // If there's a remainder, just add whatever is left
2459
-
2460
- if (segment) {
2461
- keys.push('[' + key.slice(segment.index) + ']');
2462
- }
2463
-
2464
- return parseObject(keys, val, options, valuesParsed);
2465
- };
2466
-
2467
- var normalizeParseOptions = function normalizeParseOptions(opts) {
2468
- if (!opts) {
2469
- return defaults;
2470
- }
2471
-
2472
- if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
2473
- throw new TypeError('Decoder has to be a function.');
2474
- }
2475
-
2476
- if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
2477
- throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
2478
- }
2479
- var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
2480
-
2481
- return {
2482
- allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
2483
- allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
2484
- allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
2485
- arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
2486
- charset: charset,
2487
- charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
2488
- comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
2489
- decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
2490
- delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
2491
- // eslint-disable-next-line no-implicit-coercion, no-extra-parens
2492
- depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
2493
- ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
2494
- interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
2495
- parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
2496
- parseArrays: opts.parseArrays !== false,
2497
- plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
2498
- strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
2499
- };
2500
- };
2501
-
2502
- var parse$1 = function (str, opts) {
2503
- var options = normalizeParseOptions(opts);
2504
-
2505
- if (str === '' || str === null || typeof str === 'undefined') {
2506
- return options.plainObjects ? Object.create(null) : {};
2507
- }
2508
-
2509
- var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
2510
- var obj = options.plainObjects ? Object.create(null) : {};
2511
-
2512
- // Iterate over the keys and setup the new object
2513
-
2514
- var keys = Object.keys(tempObj);
2515
- for (var i = 0; i < keys.length; ++i) {
2516
- var key = keys[i];
2517
- var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
2518
- obj = utils.merge(obj, newObj, options);
2519
- }
2520
-
2521
- if (options.allowSparse === true) {
2522
- return obj;
2523
- }
2524
-
2525
- return utils.compact(obj);
2526
- };
2527
-
2528
- var stringify = stringify_1;
2529
- var parse = parse$1;
2530
- var formats = formats$3;
2531
-
2532
- var lib = {
2533
- formats: formats,
2534
- parse: parse,
2535
- stringify: stringify
2536
- };
2537
-
2538
- var qs = /*@__PURE__*/getDefaultExportFromCjs(lib);
5173
+ var stringify$1 = /*@__PURE__*/getDefaultExportFromCjs(stringify_1);
2539
5174
 
2540
5175
  /**
2541
5176
  * Transform an JSON object to a query string
2542
5177
  */
2543
5178
  function json_to_query_string(params) {
2544
5179
  if (params && Object.keys(params).length > 0) {
2545
- return "?" + qs.stringify(params);
5180
+ return "?" + stringify$1(params);
2546
5181
  }
2547
5182
  return '';
2548
5183
  }
@@ -3308,5 +5943,5 @@ var miolo = (function (exports, node_util) {
3308
5943
 
3309
5944
  return exports;
3310
5945
 
3311
- })({}, node_util);
5946
+ })({});
3312
5947
  //# sourceMappingURL=miolo.cli.iife.bundle.js.map