glitch-javascript-sdk 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -54,6 +54,44 @@ var __assign = function() {
54
54
  return __assign.apply(this, arguments);
55
55
  };
56
56
 
57
+ function __awaiter(thisArg, _arguments, P, generator) {
58
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
59
+ return new (P || (P = Promise))(function (resolve, reject) {
60
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
61
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
62
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
63
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
64
+ });
65
+ }
66
+
67
+ function __generator(thisArg, body) {
68
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
69
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
70
+ function verb(n) { return function (v) { return step([n, v]); }; }
71
+ function step(op) {
72
+ if (f) throw new TypeError("Generator is already executing.");
73
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
74
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
75
+ if (y = 0, t) op = [op[0] & 2, t.value];
76
+ switch (op[0]) {
77
+ case 0: case 1: t = op; break;
78
+ case 4: _.label++; return { value: op[1], done: false };
79
+ case 5: _.label++; y = op[1]; op = [0]; continue;
80
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
83
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
84
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
85
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
86
+ if (t[2]) _.ops.pop();
87
+ _.trys.pop(); continue;
88
+ }
89
+ op = body.call(thisArg, _);
90
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
91
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
92
+ }
93
+ }
94
+
57
95
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
58
96
  var e = new Error(message);
59
97
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -2993,13 +3031,13 @@ Item.prototype.run = function () {
2993
3031
  this.fun.apply(null, this.array);
2994
3032
  };
2995
3033
  var title = 'browser';
2996
- var platform$1 = 'browser';
2997
- var browser = true;
3034
+ var platform$2 = 'browser';
3035
+ var browser$1 = true;
2998
3036
  var env = {};
2999
3037
  var argv = [];
3000
3038
  var version = ''; // empty string to avoid regexp issues
3001
3039
  var versions = {};
3002
- var release = {};
3040
+ var release$1 = {};
3003
3041
  var config = {};
3004
3042
 
3005
3043
  function noop$1() {}
@@ -3049,16 +3087,16 @@ function hrtime(previousTimestamp){
3049
3087
  }
3050
3088
 
3051
3089
  var startTime = new Date();
3052
- function uptime() {
3090
+ function uptime$1() {
3053
3091
  var currentTime = new Date();
3054
3092
  var dif = currentTime - startTime;
3055
3093
  return dif / 1000;
3056
3094
  }
3057
3095
 
3058
- var browser$1 = {
3096
+ var browser$1$1 = {
3059
3097
  nextTick: nextTick,
3060
3098
  title: title,
3061
- browser: browser,
3099
+ browser: browser$1,
3062
3100
  env: env,
3063
3101
  argv: argv,
3064
3102
  version: version,
@@ -3075,10 +3113,10 @@ var browser$1 = {
3075
3113
  chdir: chdir,
3076
3114
  umask: umask,
3077
3115
  hrtime: hrtime,
3078
- platform: platform$1,
3079
- release: release,
3116
+ platform: platform$2,
3117
+ release: release$1,
3080
3118
  config: config,
3081
- uptime: uptime
3119
+ uptime: uptime$1
3082
3120
  };
3083
3121
 
3084
3122
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -6198,7 +6236,7 @@ function IncomingMessage(xhr, response, mode) {
6198
6236
  // Fake the 'close' event, but only once 'end' fires
6199
6237
  self.on('end', function() {
6200
6238
  // The nextTick is necessary to prevent the 'request' module from causing an infinite loop
6201
- browser$1.nextTick(function() {
6239
+ browser$1$1.nextTick(function() {
6202
6240
  self.emit('close');
6203
6241
  });
6204
6242
  });
@@ -6534,7 +6572,7 @@ ClientRequest.prototype._onFinish = function() {
6534
6572
  try {
6535
6573
  xhr.open(self._opts.method, self._opts.url, true);
6536
6574
  } catch (err) {
6537
- browser$1.nextTick(function() {
6575
+ browser$1$1.nextTick(function() {
6538
6576
  self.emit('error', err);
6539
6577
  });
6540
6578
  return
@@ -6580,7 +6618,7 @@ ClientRequest.prototype._onFinish = function() {
6580
6618
  try {
6581
6619
  xhr.send(body);
6582
6620
  } catch (err) {
6583
- browser$1.nextTick(function() {
6621
+ browser$1$1.nextTick(function() {
6584
6622
  self.emit('error', err);
6585
6623
  });
6586
6624
  return
@@ -8143,7 +8181,7 @@ var _polyfillNode_https = /*#__PURE__*/Object.freeze({
8143
8181
 
8144
8182
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_https);
8145
8183
 
8146
- var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_url);
8184
+ var require$$0$3 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_url);
8147
8185
 
8148
8186
  var _polyfillNode_fs = {};
8149
8187
 
@@ -8156,7 +8194,7 @@ var require$$6 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_fs$1);
8156
8194
 
8157
8195
  var mimeTypes = {};
8158
8196
 
8159
- var require$$0 = {
8197
+ var require$$0$2 = {
8160
8198
  "application/1d-interleaved-parityfec": {
8161
8199
  source: "iana"
8162
8200
  },
@@ -18870,7 +18908,7 @@ var require$$0 = {
18870
18908
  * Module exports.
18871
18909
  */
18872
18910
 
18873
- var mimeDb = require$$0;
18911
+ var mimeDb = require$$0$2;
18874
18912
 
18875
18913
  /*!
18876
18914
  * mime-types
@@ -19074,8 +19112,8 @@ function defer$1(fn)
19074
19112
  var nextTick = typeof setImmediate == 'function'
19075
19113
  ? setImmediate
19076
19114
  : (
19077
- typeof browser$1 == 'object' && typeof browser$1.nextTick == 'function'
19078
- ? browser$1.nextTick
19115
+ typeof browser$1$1 == 'object' && typeof browser$1$1.nextTick == 'function'
19116
+ ? browser$1$1.nextTick
19079
19117
  : null
19080
19118
  );
19081
19119
 
@@ -19463,7 +19501,7 @@ var util = text_min;
19463
19501
  var path = require$$2$1;
19464
19502
  var http$1 = require$$1;
19465
19503
  var https$1 = require$$2;
19466
- var parseUrl$1 = require$$0$1.parse;
19504
+ var parseUrl$1 = require$$0$3.parse;
19467
19505
  var fs = require$$6;
19468
19506
  var Stream = require$$3.Stream;
19469
19507
  var mime = mimeTypes;
@@ -19859,7 +19897,7 @@ FormData$1.prototype.getLength = function(cb) {
19859
19897
  }
19860
19898
 
19861
19899
  if (!this._valuesToMeasure.length) {
19862
- browser$1.nextTick(cb.bind(this, null, knownLength));
19900
+ browser$1$1.nextTick(cb.bind(this, null, knownLength));
19863
19901
  return;
19864
19902
  }
19865
19903
 
@@ -20361,7 +20399,7 @@ var transitionalDefaults = {
20361
20399
 
20362
20400
  var URLSearchParams = url$1.URLSearchParams;
20363
20401
 
20364
- var platform = {
20402
+ var platform$1 = {
20365
20403
  isNode: true,
20366
20404
  classes: {
20367
20405
  URLSearchParams,
@@ -20372,7 +20410,7 @@ var platform = {
20372
20410
  };
20373
20411
 
20374
20412
  function toURLEncodedForm(data, options) {
20375
- return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
20413
+ return toFormData(data, new platform$1.classes.URLSearchParams(), Object.assign({
20376
20414
  visitor: function(value, key, path, helpers) {
20377
20415
  if (utils.isBuffer(value)) {
20378
20416
  this.append(key, value.toString('base64'));
@@ -20599,8 +20637,8 @@ const defaults = {
20599
20637
  maxBodyLength: -1,
20600
20638
 
20601
20639
  env: {
20602
- FormData: platform.classes.FormData,
20603
- Blob: platform.classes.Blob
20640
+ FormData: platform$1.classes.FormData,
20641
+ Blob: platform$1.classes.Blob
20604
20642
  },
20605
20643
 
20606
20644
  validateStatus: function validateStatus(status) {
@@ -21082,7 +21120,7 @@ function buildFullPath(baseURL, requestedURL) {
21082
21120
  return requestedURL;
21083
21121
  }
21084
21122
 
21085
- var parseUrl = require$$0$1.parse;
21123
+ var parseUrl = require$$0$3.parse;
21086
21124
 
21087
21125
  var DEFAULT_PORTS = {
21088
21126
  ftp: 21,
@@ -21184,7 +21222,7 @@ function shouldProxy(hostname, port) {
21184
21222
  * @private
21185
21223
  */
21186
21224
  function getEnv(key) {
21187
- return browser$1.env[key.toLowerCase()] || browser$1.env[key.toUpperCase()] || '';
21225
+ return browser$1$1.env[key.toLowerCase()] || browser$1$1.env[key.toUpperCase()] || '';
21188
21226
  }
21189
21227
 
21190
21228
  var getProxyForUrl_1 = getProxyForUrl;
@@ -21672,13 +21710,1379 @@ var _polyfillNode_assert = /*#__PURE__*/Object.freeze({
21672
21710
 
21673
21711
  var require$$4 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_assert);
21674
21712
 
21713
+ var src = {exports: {}};
21714
+
21715
+ var browser = {exports: {}};
21716
+
21717
+ /**
21718
+ * Helpers.
21719
+ */
21720
+
21721
+ var ms;
21722
+ var hasRequiredMs;
21723
+
21724
+ function requireMs () {
21725
+ if (hasRequiredMs) return ms;
21726
+ hasRequiredMs = 1;
21727
+ var s = 1000;
21728
+ var m = s * 60;
21729
+ var h = m * 60;
21730
+ var d = h * 24;
21731
+ var w = d * 7;
21732
+ var y = d * 365.25;
21733
+
21734
+ /**
21735
+ * Parse or format the given `val`.
21736
+ *
21737
+ * Options:
21738
+ *
21739
+ * - `long` verbose formatting [false]
21740
+ *
21741
+ * @param {String|Number} val
21742
+ * @param {Object} [options]
21743
+ * @throws {Error} throw an error if val is not a non-empty string or a number
21744
+ * @return {String|Number}
21745
+ * @api public
21746
+ */
21747
+
21748
+ ms = function(val, options) {
21749
+ options = options || {};
21750
+ var type = typeof val;
21751
+ if (type === 'string' && val.length > 0) {
21752
+ return parse(val);
21753
+ } else if (type === 'number' && isFinite(val)) {
21754
+ return options.long ? fmtLong(val) : fmtShort(val);
21755
+ }
21756
+ throw new Error(
21757
+ 'val is not a non-empty string or a valid number. val=' +
21758
+ JSON.stringify(val)
21759
+ );
21760
+ };
21761
+
21762
+ /**
21763
+ * Parse the given `str` and return milliseconds.
21764
+ *
21765
+ * @param {String} str
21766
+ * @return {Number}
21767
+ * @api private
21768
+ */
21769
+
21770
+ function parse(str) {
21771
+ str = String(str);
21772
+ if (str.length > 100) {
21773
+ return;
21774
+ }
21775
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
21776
+ str
21777
+ );
21778
+ if (!match) {
21779
+ return;
21780
+ }
21781
+ var n = parseFloat(match[1]);
21782
+ var type = (match[2] || 'ms').toLowerCase();
21783
+ switch (type) {
21784
+ case 'years':
21785
+ case 'year':
21786
+ case 'yrs':
21787
+ case 'yr':
21788
+ case 'y':
21789
+ return n * y;
21790
+ case 'weeks':
21791
+ case 'week':
21792
+ case 'w':
21793
+ return n * w;
21794
+ case 'days':
21795
+ case 'day':
21796
+ case 'd':
21797
+ return n * d;
21798
+ case 'hours':
21799
+ case 'hour':
21800
+ case 'hrs':
21801
+ case 'hr':
21802
+ case 'h':
21803
+ return n * h;
21804
+ case 'minutes':
21805
+ case 'minute':
21806
+ case 'mins':
21807
+ case 'min':
21808
+ case 'm':
21809
+ return n * m;
21810
+ case 'seconds':
21811
+ case 'second':
21812
+ case 'secs':
21813
+ case 'sec':
21814
+ case 's':
21815
+ return n * s;
21816
+ case 'milliseconds':
21817
+ case 'millisecond':
21818
+ case 'msecs':
21819
+ case 'msec':
21820
+ case 'ms':
21821
+ return n;
21822
+ default:
21823
+ return undefined;
21824
+ }
21825
+ }
21826
+
21827
+ /**
21828
+ * Short format for `ms`.
21829
+ *
21830
+ * @param {Number} ms
21831
+ * @return {String}
21832
+ * @api private
21833
+ */
21834
+
21835
+ function fmtShort(ms) {
21836
+ var msAbs = Math.abs(ms);
21837
+ if (msAbs >= d) {
21838
+ return Math.round(ms / d) + 'd';
21839
+ }
21840
+ if (msAbs >= h) {
21841
+ return Math.round(ms / h) + 'h';
21842
+ }
21843
+ if (msAbs >= m) {
21844
+ return Math.round(ms / m) + 'm';
21845
+ }
21846
+ if (msAbs >= s) {
21847
+ return Math.round(ms / s) + 's';
21848
+ }
21849
+ return ms + 'ms';
21850
+ }
21851
+
21852
+ /**
21853
+ * Long format for `ms`.
21854
+ *
21855
+ * @param {Number} ms
21856
+ * @return {String}
21857
+ * @api private
21858
+ */
21859
+
21860
+ function fmtLong(ms) {
21861
+ var msAbs = Math.abs(ms);
21862
+ if (msAbs >= d) {
21863
+ return plural(ms, msAbs, d, 'day');
21864
+ }
21865
+ if (msAbs >= h) {
21866
+ return plural(ms, msAbs, h, 'hour');
21867
+ }
21868
+ if (msAbs >= m) {
21869
+ return plural(ms, msAbs, m, 'minute');
21870
+ }
21871
+ if (msAbs >= s) {
21872
+ return plural(ms, msAbs, s, 'second');
21873
+ }
21874
+ return ms + ' ms';
21875
+ }
21876
+
21877
+ /**
21878
+ * Pluralization helper.
21879
+ */
21880
+
21881
+ function plural(ms, msAbs, n, name) {
21882
+ var isPlural = msAbs >= n * 1.5;
21883
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
21884
+ }
21885
+ return ms;
21886
+ }
21887
+
21888
+ var common;
21889
+ var hasRequiredCommon;
21890
+
21891
+ function requireCommon () {
21892
+ if (hasRequiredCommon) return common;
21893
+ hasRequiredCommon = 1;
21894
+ /**
21895
+ * This is the common logic for both the Node.js and web browser
21896
+ * implementations of `debug()`.
21897
+ */
21898
+
21899
+ function setup(env) {
21900
+ createDebug.debug = createDebug;
21901
+ createDebug.default = createDebug;
21902
+ createDebug.coerce = coerce;
21903
+ createDebug.disable = disable;
21904
+ createDebug.enable = enable;
21905
+ createDebug.enabled = enabled;
21906
+ createDebug.humanize = requireMs();
21907
+ createDebug.destroy = destroy;
21908
+
21909
+ Object.keys(env).forEach(key => {
21910
+ createDebug[key] = env[key];
21911
+ });
21912
+
21913
+ /**
21914
+ * The currently active debug mode names, and names to skip.
21915
+ */
21916
+
21917
+ createDebug.names = [];
21918
+ createDebug.skips = [];
21919
+
21920
+ /**
21921
+ * Map of special "%n" handling functions, for the debug "format" argument.
21922
+ *
21923
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
21924
+ */
21925
+ createDebug.formatters = {};
21926
+
21927
+ /**
21928
+ * Selects a color for a debug namespace
21929
+ * @param {String} namespace The namespace string for the debug instance to be colored
21930
+ * @return {Number|String} An ANSI color code for the given namespace
21931
+ * @api private
21932
+ */
21933
+ function selectColor(namespace) {
21934
+ let hash = 0;
21935
+
21936
+ for (let i = 0; i < namespace.length; i++) {
21937
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
21938
+ hash |= 0; // Convert to 32bit integer
21939
+ }
21940
+
21941
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
21942
+ }
21943
+ createDebug.selectColor = selectColor;
21944
+
21945
+ /**
21946
+ * Create a debugger with the given `namespace`.
21947
+ *
21948
+ * @param {String} namespace
21949
+ * @return {Function}
21950
+ * @api public
21951
+ */
21952
+ function createDebug(namespace) {
21953
+ let prevTime;
21954
+ let enableOverride = null;
21955
+ let namespacesCache;
21956
+ let enabledCache;
21957
+
21958
+ function debug(...args) {
21959
+ // Disabled?
21960
+ if (!debug.enabled) {
21961
+ return;
21962
+ }
21963
+
21964
+ const self = debug;
21965
+
21966
+ // Set `diff` timestamp
21967
+ const curr = Number(new Date());
21968
+ const ms = curr - (prevTime || curr);
21969
+ self.diff = ms;
21970
+ self.prev = prevTime;
21971
+ self.curr = curr;
21972
+ prevTime = curr;
21973
+
21974
+ args[0] = createDebug.coerce(args[0]);
21975
+
21976
+ if (typeof args[0] !== 'string') {
21977
+ // Anything else let's inspect with %O
21978
+ args.unshift('%O');
21979
+ }
21980
+
21981
+ // Apply any `formatters` transformations
21982
+ let index = 0;
21983
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
21984
+ // If we encounter an escaped % then don't increase the array index
21985
+ if (match === '%%') {
21986
+ return '%';
21987
+ }
21988
+ index++;
21989
+ const formatter = createDebug.formatters[format];
21990
+ if (typeof formatter === 'function') {
21991
+ const val = args[index];
21992
+ match = formatter.call(self, val);
21993
+
21994
+ // Now we need to remove `args[index]` since it's inlined in the `format`
21995
+ args.splice(index, 1);
21996
+ index--;
21997
+ }
21998
+ return match;
21999
+ });
22000
+
22001
+ // Apply env-specific formatting (colors, etc.)
22002
+ createDebug.formatArgs.call(self, args);
22003
+
22004
+ const logFn = self.log || createDebug.log;
22005
+ logFn.apply(self, args);
22006
+ }
22007
+
22008
+ debug.namespace = namespace;
22009
+ debug.useColors = createDebug.useColors();
22010
+ debug.color = createDebug.selectColor(namespace);
22011
+ debug.extend = extend;
22012
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
22013
+
22014
+ Object.defineProperty(debug, 'enabled', {
22015
+ enumerable: true,
22016
+ configurable: false,
22017
+ get: () => {
22018
+ if (enableOverride !== null) {
22019
+ return enableOverride;
22020
+ }
22021
+ if (namespacesCache !== createDebug.namespaces) {
22022
+ namespacesCache = createDebug.namespaces;
22023
+ enabledCache = createDebug.enabled(namespace);
22024
+ }
22025
+
22026
+ return enabledCache;
22027
+ },
22028
+ set: v => {
22029
+ enableOverride = v;
22030
+ }
22031
+ });
22032
+
22033
+ // Env-specific initialization logic for debug instances
22034
+ if (typeof createDebug.init === 'function') {
22035
+ createDebug.init(debug);
22036
+ }
22037
+
22038
+ return debug;
22039
+ }
22040
+
22041
+ function extend(namespace, delimiter) {
22042
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
22043
+ newDebug.log = this.log;
22044
+ return newDebug;
22045
+ }
22046
+
22047
+ /**
22048
+ * Enables a debug mode by namespaces. This can include modes
22049
+ * separated by a colon and wildcards.
22050
+ *
22051
+ * @param {String} namespaces
22052
+ * @api public
22053
+ */
22054
+ function enable(namespaces) {
22055
+ createDebug.save(namespaces);
22056
+ createDebug.namespaces = namespaces;
22057
+
22058
+ createDebug.names = [];
22059
+ createDebug.skips = [];
22060
+
22061
+ let i;
22062
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
22063
+ const len = split.length;
22064
+
22065
+ for (i = 0; i < len; i++) {
22066
+ if (!split[i]) {
22067
+ // ignore empty strings
22068
+ continue;
22069
+ }
22070
+
22071
+ namespaces = split[i].replace(/\*/g, '.*?');
22072
+
22073
+ if (namespaces[0] === '-') {
22074
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
22075
+ } else {
22076
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
22077
+ }
22078
+ }
22079
+ }
22080
+
22081
+ /**
22082
+ * Disable debug output.
22083
+ *
22084
+ * @return {String} namespaces
22085
+ * @api public
22086
+ */
22087
+ function disable() {
22088
+ const namespaces = [
22089
+ ...createDebug.names.map(toNamespace),
22090
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
22091
+ ].join(',');
22092
+ createDebug.enable('');
22093
+ return namespaces;
22094
+ }
22095
+
22096
+ /**
22097
+ * Returns true if the given mode name is enabled, false otherwise.
22098
+ *
22099
+ * @param {String} name
22100
+ * @return {Boolean}
22101
+ * @api public
22102
+ */
22103
+ function enabled(name) {
22104
+ if (name[name.length - 1] === '*') {
22105
+ return true;
22106
+ }
22107
+
22108
+ let i;
22109
+ let len;
22110
+
22111
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
22112
+ if (createDebug.skips[i].test(name)) {
22113
+ return false;
22114
+ }
22115
+ }
22116
+
22117
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
22118
+ if (createDebug.names[i].test(name)) {
22119
+ return true;
22120
+ }
22121
+ }
22122
+
22123
+ return false;
22124
+ }
22125
+
22126
+ /**
22127
+ * Convert regexp to namespace
22128
+ *
22129
+ * @param {RegExp} regxep
22130
+ * @return {String} namespace
22131
+ * @api private
22132
+ */
22133
+ function toNamespace(regexp) {
22134
+ return regexp.toString()
22135
+ .substring(2, regexp.toString().length - 2)
22136
+ .replace(/\.\*\?$/, '*');
22137
+ }
22138
+
22139
+ /**
22140
+ * Coerce `val`.
22141
+ *
22142
+ * @param {Mixed} val
22143
+ * @return {Mixed}
22144
+ * @api private
22145
+ */
22146
+ function coerce(val) {
22147
+ if (val instanceof Error) {
22148
+ return val.stack || val.message;
22149
+ }
22150
+ return val;
22151
+ }
22152
+
22153
+ /**
22154
+ * XXX DO NOT USE. This is a temporary stub function.
22155
+ * XXX It WILL be removed in the next major release.
22156
+ */
22157
+ function destroy() {
22158
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
22159
+ }
22160
+
22161
+ createDebug.enable(createDebug.load());
22162
+
22163
+ return createDebug;
22164
+ }
22165
+
22166
+ common = setup;
22167
+ return common;
22168
+ }
22169
+
22170
+ /* eslint-env browser */
22171
+
22172
+ var hasRequiredBrowser;
22173
+
22174
+ function requireBrowser () {
22175
+ if (hasRequiredBrowser) return browser.exports;
22176
+ hasRequiredBrowser = 1;
22177
+ (function (module, exports) {
22178
+ /**
22179
+ * This is the web browser implementation of `debug()`.
22180
+ */
22181
+
22182
+ exports.formatArgs = formatArgs;
22183
+ exports.save = save;
22184
+ exports.load = load;
22185
+ exports.useColors = useColors;
22186
+ exports.storage = localstorage();
22187
+ exports.destroy = (() => {
22188
+ let warned = false;
22189
+
22190
+ return () => {
22191
+ if (!warned) {
22192
+ warned = true;
22193
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
22194
+ }
22195
+ };
22196
+ })();
22197
+
22198
+ /**
22199
+ * Colors.
22200
+ */
22201
+
22202
+ exports.colors = [
22203
+ '#0000CC',
22204
+ '#0000FF',
22205
+ '#0033CC',
22206
+ '#0033FF',
22207
+ '#0066CC',
22208
+ '#0066FF',
22209
+ '#0099CC',
22210
+ '#0099FF',
22211
+ '#00CC00',
22212
+ '#00CC33',
22213
+ '#00CC66',
22214
+ '#00CC99',
22215
+ '#00CCCC',
22216
+ '#00CCFF',
22217
+ '#3300CC',
22218
+ '#3300FF',
22219
+ '#3333CC',
22220
+ '#3333FF',
22221
+ '#3366CC',
22222
+ '#3366FF',
22223
+ '#3399CC',
22224
+ '#3399FF',
22225
+ '#33CC00',
22226
+ '#33CC33',
22227
+ '#33CC66',
22228
+ '#33CC99',
22229
+ '#33CCCC',
22230
+ '#33CCFF',
22231
+ '#6600CC',
22232
+ '#6600FF',
22233
+ '#6633CC',
22234
+ '#6633FF',
22235
+ '#66CC00',
22236
+ '#66CC33',
22237
+ '#9900CC',
22238
+ '#9900FF',
22239
+ '#9933CC',
22240
+ '#9933FF',
22241
+ '#99CC00',
22242
+ '#99CC33',
22243
+ '#CC0000',
22244
+ '#CC0033',
22245
+ '#CC0066',
22246
+ '#CC0099',
22247
+ '#CC00CC',
22248
+ '#CC00FF',
22249
+ '#CC3300',
22250
+ '#CC3333',
22251
+ '#CC3366',
22252
+ '#CC3399',
22253
+ '#CC33CC',
22254
+ '#CC33FF',
22255
+ '#CC6600',
22256
+ '#CC6633',
22257
+ '#CC9900',
22258
+ '#CC9933',
22259
+ '#CCCC00',
22260
+ '#CCCC33',
22261
+ '#FF0000',
22262
+ '#FF0033',
22263
+ '#FF0066',
22264
+ '#FF0099',
22265
+ '#FF00CC',
22266
+ '#FF00FF',
22267
+ '#FF3300',
22268
+ '#FF3333',
22269
+ '#FF3366',
22270
+ '#FF3399',
22271
+ '#FF33CC',
22272
+ '#FF33FF',
22273
+ '#FF6600',
22274
+ '#FF6633',
22275
+ '#FF9900',
22276
+ '#FF9933',
22277
+ '#FFCC00',
22278
+ '#FFCC33'
22279
+ ];
22280
+
22281
+ /**
22282
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
22283
+ * and the Firebug extension (any Firefox version) are known
22284
+ * to support "%c" CSS customizations.
22285
+ *
22286
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
22287
+ */
22288
+
22289
+ // eslint-disable-next-line complexity
22290
+ function useColors() {
22291
+ // NB: In an Electron preload script, document will be defined but not fully
22292
+ // initialized. Since we know we're in Chrome, we'll just detect this case
22293
+ // explicitly
22294
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
22295
+ return true;
22296
+ }
22297
+
22298
+ // Internet Explorer and Edge do not support colors.
22299
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
22300
+ return false;
22301
+ }
22302
+
22303
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
22304
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
22305
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
22306
+ // Is firebug? http://stackoverflow.com/a/398120/376773
22307
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
22308
+ // Is firefox >= v31?
22309
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
22310
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
22311
+ // Double check webkit in userAgent just in case we are in a worker
22312
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
22313
+ }
22314
+
22315
+ /**
22316
+ * Colorize log arguments if enabled.
22317
+ *
22318
+ * @api public
22319
+ */
22320
+
22321
+ function formatArgs(args) {
22322
+ args[0] = (this.useColors ? '%c' : '') +
22323
+ this.namespace +
22324
+ (this.useColors ? ' %c' : ' ') +
22325
+ args[0] +
22326
+ (this.useColors ? '%c ' : ' ') +
22327
+ '+' + module.exports.humanize(this.diff);
22328
+
22329
+ if (!this.useColors) {
22330
+ return;
22331
+ }
22332
+
22333
+ const c = 'color: ' + this.color;
22334
+ args.splice(1, 0, c, 'color: inherit');
22335
+
22336
+ // The final "%c" is somewhat tricky, because there could be other
22337
+ // arguments passed either before or after the %c, so we need to
22338
+ // figure out the correct index to insert the CSS into
22339
+ let index = 0;
22340
+ let lastC = 0;
22341
+ args[0].replace(/%[a-zA-Z%]/g, match => {
22342
+ if (match === '%%') {
22343
+ return;
22344
+ }
22345
+ index++;
22346
+ if (match === '%c') {
22347
+ // We only are interested in the *last* %c
22348
+ // (the user may have provided their own)
22349
+ lastC = index;
22350
+ }
22351
+ });
22352
+
22353
+ args.splice(lastC, 0, c);
22354
+ }
22355
+
22356
+ /**
22357
+ * Invokes `console.debug()` when available.
22358
+ * No-op when `console.debug` is not a "function".
22359
+ * If `console.debug` is not available, falls back
22360
+ * to `console.log`.
22361
+ *
22362
+ * @api public
22363
+ */
22364
+ exports.log = console.debug || console.log || (() => {});
22365
+
22366
+ /**
22367
+ * Save `namespaces`.
22368
+ *
22369
+ * @param {String} namespaces
22370
+ * @api private
22371
+ */
22372
+ function save(namespaces) {
22373
+ try {
22374
+ if (namespaces) {
22375
+ exports.storage.setItem('debug', namespaces);
22376
+ } else {
22377
+ exports.storage.removeItem('debug');
22378
+ }
22379
+ } catch (error) {
22380
+ // Swallow
22381
+ // XXX (@Qix-) should we be logging these?
22382
+ }
22383
+ }
22384
+
22385
+ /**
22386
+ * Load `namespaces`.
22387
+ *
22388
+ * @return {String} returns the previously persisted debug modes
22389
+ * @api private
22390
+ */
22391
+ function load() {
22392
+ let r;
22393
+ try {
22394
+ r = exports.storage.getItem('debug');
22395
+ } catch (error) {
22396
+ // Swallow
22397
+ // XXX (@Qix-) should we be logging these?
22398
+ }
22399
+
22400
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
22401
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
22402
+ r = process.env.DEBUG;
22403
+ }
22404
+
22405
+ return r;
22406
+ }
22407
+
22408
+ /**
22409
+ * Localstorage attempts to return the localstorage.
22410
+ *
22411
+ * This is necessary because safari throws
22412
+ * when a user disables cookies/localstorage
22413
+ * and you attempt to access it.
22414
+ *
22415
+ * @return {LocalStorage}
22416
+ * @api private
22417
+ */
22418
+
22419
+ function localstorage() {
22420
+ try {
22421
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
22422
+ // The Browser also has localStorage in the global context.
22423
+ return localStorage;
22424
+ } catch (error) {
22425
+ // Swallow
22426
+ // XXX (@Qix-) should we be logging these?
22427
+ }
22428
+ }
22429
+
22430
+ module.exports = requireCommon()(exports);
22431
+
22432
+ const {formatters} = module.exports;
22433
+
22434
+ /**
22435
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
22436
+ */
22437
+
22438
+ formatters.j = function (v) {
22439
+ try {
22440
+ return JSON.stringify(v);
22441
+ } catch (error) {
22442
+ return '[UnexpectedJSONParseError]: ' + error.message;
22443
+ }
22444
+ };
22445
+ } (browser, browser.exports));
22446
+ return browser.exports;
22447
+ }
22448
+
22449
+ var node = {exports: {}};
22450
+
22451
+ // MIT lisence
22452
+ // from https://github.com/substack/tty-browserify/blob/1ba769a6429d242f36226538835b4034bf6b7886/index.js
22453
+
22454
+ function isatty() {
22455
+ return false;
22456
+ }
22457
+
22458
+ function ReadStream() {
22459
+ throw new Error('tty.ReadStream is not implemented');
22460
+ }
22461
+
22462
+ function WriteStream() {
22463
+ throw new Error('tty.ReadStream is not implemented');
22464
+ }
22465
+
22466
+ var _polyfillNode_tty = {
22467
+ isatty: isatty,
22468
+ ReadStream: ReadStream,
22469
+ WriteStream: WriteStream
22470
+ };
22471
+
22472
+ var _polyfillNode_tty$1 = /*#__PURE__*/Object.freeze({
22473
+ __proto__: null,
22474
+ ReadStream: ReadStream,
22475
+ WriteStream: WriteStream,
22476
+ default: _polyfillNode_tty,
22477
+ isatty: isatty
22478
+ });
22479
+
22480
+ var require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_tty$1);
22481
+
22482
+ /*
22483
+ The MIT License (MIT)
22484
+
22485
+ Copyright (c) 2016 CoderPuppy
22486
+
22487
+ Permission is hereby granted, free of charge, to any person obtaining a copy
22488
+ of this software and associated documentation files (the "Software"), to deal
22489
+ in the Software without restriction, including without limitation the rights
22490
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22491
+ copies of the Software, and to permit persons to whom the Software is
22492
+ furnished to do so, subject to the following conditions:
22493
+
22494
+ The above copyright notice and this permission notice shall be included in all
22495
+ copies or substantial portions of the Software.
22496
+
22497
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22498
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22499
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22500
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22501
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22502
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22503
+ SOFTWARE.
22504
+
22505
+ */
22506
+ var _endianness;
22507
+ function endianness() {
22508
+ if (typeof _endianness === 'undefined') {
22509
+ var a = new ArrayBuffer(2);
22510
+ var b = new Uint8Array(a);
22511
+ var c = new Uint16Array(a);
22512
+ b[0] = 1;
22513
+ b[1] = 2;
22514
+ if (c[0] === 258) {
22515
+ _endianness = 'BE';
22516
+ } else if (c[0] === 513){
22517
+ _endianness = 'LE';
22518
+ } else {
22519
+ throw new Error('unable to figure out endianess');
22520
+ }
22521
+ }
22522
+ return _endianness;
22523
+ }
22524
+
22525
+ function hostname() {
22526
+ if (typeof global$1.location !== 'undefined') {
22527
+ return global$1.location.hostname
22528
+ } else return '';
22529
+ }
22530
+
22531
+ function loadavg() {
22532
+ return [];
22533
+ }
22534
+
22535
+ function uptime() {
22536
+ return 0;
22537
+ }
22538
+
22539
+ function freemem() {
22540
+ return Number.MAX_VALUE;
22541
+ }
22542
+
22543
+ function totalmem() {
22544
+ return Number.MAX_VALUE;
22545
+ }
22546
+
22547
+ function cpus() {
22548
+ return [];
22549
+ }
22550
+
22551
+ function type() {
22552
+ return 'Browser';
22553
+ }
22554
+
22555
+ function release () {
22556
+ if (typeof global$1.navigator !== 'undefined') {
22557
+ return global$1.navigator.appVersion;
22558
+ }
22559
+ return '';
22560
+ }
22561
+
22562
+ function networkInterfaces () {
22563
+ return {};
22564
+ }
22565
+
22566
+ function getNetworkInterfaces () {
22567
+ return {};
22568
+ }
22569
+
22570
+ function arch() {
22571
+ return 'javascript';
22572
+ }
22573
+
22574
+ function platform() {
22575
+ return 'browser';
22576
+ }
22577
+
22578
+ function tmpDir() {
22579
+ return '/tmp';
22580
+ }
22581
+ var tmpdir = tmpDir;
22582
+
22583
+ var EOL = '\n';
22584
+
22585
+ function homedir(){
22586
+ return '$HOME'
22587
+ }
22588
+
22589
+ var _polyfillNode_os = {
22590
+ homedir: homedir,
22591
+ EOL: EOL,
22592
+ arch: arch,
22593
+ platform: platform,
22594
+ tmpdir: tmpdir,
22595
+ tmpDir: tmpDir,
22596
+ networkInterfaces:networkInterfaces,
22597
+ getNetworkInterfaces: getNetworkInterfaces,
22598
+ release: release,
22599
+ type: type,
22600
+ cpus: cpus,
22601
+ totalmem: totalmem,
22602
+ freemem: freemem,
22603
+ uptime: uptime,
22604
+ loadavg: loadavg,
22605
+ hostname: hostname,
22606
+ endianness: endianness,
22607
+ };
22608
+
22609
+ var _polyfillNode_os$1 = /*#__PURE__*/Object.freeze({
22610
+ __proto__: null,
22611
+ EOL: EOL,
22612
+ arch: arch,
22613
+ cpus: cpus,
22614
+ default: _polyfillNode_os,
22615
+ endianness: endianness,
22616
+ freemem: freemem,
22617
+ getNetworkInterfaces: getNetworkInterfaces,
22618
+ homedir: homedir,
22619
+ hostname: hostname,
22620
+ loadavg: loadavg,
22621
+ networkInterfaces: networkInterfaces,
22622
+ platform: platform,
22623
+ release: release,
22624
+ tmpDir: tmpDir,
22625
+ tmpdir: tmpdir,
22626
+ totalmem: totalmem,
22627
+ type: type,
22628
+ uptime: uptime
22629
+ });
22630
+
22631
+ var require$$0 = /*@__PURE__*/getAugmentedNamespace(_polyfillNode_os$1);
22632
+
22633
+ var hasFlag;
22634
+ var hasRequiredHasFlag;
22635
+
22636
+ function requireHasFlag () {
22637
+ if (hasRequiredHasFlag) return hasFlag;
22638
+ hasRequiredHasFlag = 1;
22639
+ hasFlag = (flag, argv) => {
22640
+ argv = argv || process.argv;
22641
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
22642
+ const pos = argv.indexOf(prefix + flag);
22643
+ const terminatorPos = argv.indexOf('--');
22644
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
22645
+ };
22646
+ return hasFlag;
22647
+ }
22648
+
22649
+ var supportsColor_1;
22650
+ var hasRequiredSupportsColor;
22651
+
22652
+ function requireSupportsColor () {
22653
+ if (hasRequiredSupportsColor) return supportsColor_1;
22654
+ hasRequiredSupportsColor = 1;
22655
+ const os = require$$0;
22656
+ const hasFlag = requireHasFlag();
22657
+
22658
+ const env = process.env;
22659
+
22660
+ let forceColor;
22661
+ if (hasFlag('no-color') ||
22662
+ hasFlag('no-colors') ||
22663
+ hasFlag('color=false')) {
22664
+ forceColor = false;
22665
+ } else if (hasFlag('color') ||
22666
+ hasFlag('colors') ||
22667
+ hasFlag('color=true') ||
22668
+ hasFlag('color=always')) {
22669
+ forceColor = true;
22670
+ }
22671
+ if ('FORCE_COLOR' in env) {
22672
+ forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
22673
+ }
22674
+
22675
+ function translateLevel(level) {
22676
+ if (level === 0) {
22677
+ return false;
22678
+ }
22679
+
22680
+ return {
22681
+ level,
22682
+ hasBasic: true,
22683
+ has256: level >= 2,
22684
+ has16m: level >= 3
22685
+ };
22686
+ }
22687
+
22688
+ function supportsColor(stream) {
22689
+ if (forceColor === false) {
22690
+ return 0;
22691
+ }
22692
+
22693
+ if (hasFlag('color=16m') ||
22694
+ hasFlag('color=full') ||
22695
+ hasFlag('color=truecolor')) {
22696
+ return 3;
22697
+ }
22698
+
22699
+ if (hasFlag('color=256')) {
22700
+ return 2;
22701
+ }
22702
+
22703
+ if (stream && !stream.isTTY && forceColor !== true) {
22704
+ return 0;
22705
+ }
22706
+
22707
+ const min = forceColor ? 1 : 0;
22708
+
22709
+ if (process.platform === 'win32') {
22710
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
22711
+ // libuv that enables 256 color output on Windows. Anything earlier and it
22712
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
22713
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows
22714
+ // release that supports 256 colors. Windows 10 build 14931 is the first release
22715
+ // that supports 16m/TrueColor.
22716
+ const osRelease = os.release().split('.');
22717
+ if (
22718
+ Number(process.versions.node.split('.')[0]) >= 8 &&
22719
+ Number(osRelease[0]) >= 10 &&
22720
+ Number(osRelease[2]) >= 10586
22721
+ ) {
22722
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
22723
+ }
22724
+
22725
+ return 1;
22726
+ }
22727
+
22728
+ if ('CI' in env) {
22729
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
22730
+ return 1;
22731
+ }
22732
+
22733
+ return min;
22734
+ }
22735
+
22736
+ if ('TEAMCITY_VERSION' in env) {
22737
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
22738
+ }
22739
+
22740
+ if (env.COLORTERM === 'truecolor') {
22741
+ return 3;
22742
+ }
22743
+
22744
+ if ('TERM_PROGRAM' in env) {
22745
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
22746
+
22747
+ switch (env.TERM_PROGRAM) {
22748
+ case 'iTerm.app':
22749
+ return version >= 3 ? 3 : 2;
22750
+ case 'Apple_Terminal':
22751
+ return 2;
22752
+ // No default
22753
+ }
22754
+ }
22755
+
22756
+ if (/-256(color)?$/i.test(env.TERM)) {
22757
+ return 2;
22758
+ }
22759
+
22760
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
22761
+ return 1;
22762
+ }
22763
+
22764
+ if ('COLORTERM' in env) {
22765
+ return 1;
22766
+ }
22767
+
22768
+ if (env.TERM === 'dumb') {
22769
+ return min;
22770
+ }
22771
+
22772
+ return min;
22773
+ }
22774
+
22775
+ function getSupportLevel(stream) {
22776
+ const level = supportsColor(stream);
22777
+ return translateLevel(level);
22778
+ }
22779
+
22780
+ supportsColor_1 = {
22781
+ supportsColor: getSupportLevel,
22782
+ stdout: getSupportLevel(process.stdout),
22783
+ stderr: getSupportLevel(process.stderr)
22784
+ };
22785
+ return supportsColor_1;
22786
+ }
22787
+
22788
+ /**
22789
+ * Module dependencies.
22790
+ */
22791
+
22792
+ var hasRequiredNode;
22793
+
22794
+ function requireNode () {
22795
+ if (hasRequiredNode) return node.exports;
22796
+ hasRequiredNode = 1;
22797
+ (function (module, exports) {
22798
+ const tty = require$$0$1;
22799
+ const util = text_min;
22800
+
22801
+ /**
22802
+ * This is the Node.js implementation of `debug()`.
22803
+ */
22804
+
22805
+ exports.init = init;
22806
+ exports.log = log;
22807
+ exports.formatArgs = formatArgs;
22808
+ exports.save = save;
22809
+ exports.load = load;
22810
+ exports.useColors = useColors;
22811
+ exports.destroy = util.deprecate(
22812
+ () => {},
22813
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
22814
+ );
22815
+
22816
+ /**
22817
+ * Colors.
22818
+ */
22819
+
22820
+ exports.colors = [6, 2, 3, 4, 5, 1];
22821
+
22822
+ try {
22823
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
22824
+ // eslint-disable-next-line import/no-extraneous-dependencies
22825
+ const supportsColor = requireSupportsColor();
22826
+
22827
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
22828
+ exports.colors = [
22829
+ 20,
22830
+ 21,
22831
+ 26,
22832
+ 27,
22833
+ 32,
22834
+ 33,
22835
+ 38,
22836
+ 39,
22837
+ 40,
22838
+ 41,
22839
+ 42,
22840
+ 43,
22841
+ 44,
22842
+ 45,
22843
+ 56,
22844
+ 57,
22845
+ 62,
22846
+ 63,
22847
+ 68,
22848
+ 69,
22849
+ 74,
22850
+ 75,
22851
+ 76,
22852
+ 77,
22853
+ 78,
22854
+ 79,
22855
+ 80,
22856
+ 81,
22857
+ 92,
22858
+ 93,
22859
+ 98,
22860
+ 99,
22861
+ 112,
22862
+ 113,
22863
+ 128,
22864
+ 129,
22865
+ 134,
22866
+ 135,
22867
+ 148,
22868
+ 149,
22869
+ 160,
22870
+ 161,
22871
+ 162,
22872
+ 163,
22873
+ 164,
22874
+ 165,
22875
+ 166,
22876
+ 167,
22877
+ 168,
22878
+ 169,
22879
+ 170,
22880
+ 171,
22881
+ 172,
22882
+ 173,
22883
+ 178,
22884
+ 179,
22885
+ 184,
22886
+ 185,
22887
+ 196,
22888
+ 197,
22889
+ 198,
22890
+ 199,
22891
+ 200,
22892
+ 201,
22893
+ 202,
22894
+ 203,
22895
+ 204,
22896
+ 205,
22897
+ 206,
22898
+ 207,
22899
+ 208,
22900
+ 209,
22901
+ 214,
22902
+ 215,
22903
+ 220,
22904
+ 221
22905
+ ];
22906
+ }
22907
+ } catch (error) {
22908
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
22909
+ }
22910
+
22911
+ /**
22912
+ * Build up the default `inspectOpts` object from the environment variables.
22913
+ *
22914
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
22915
+ */
22916
+
22917
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
22918
+ return /^debug_/i.test(key);
22919
+ }).reduce((obj, key) => {
22920
+ // Camel-case
22921
+ const prop = key
22922
+ .substring(6)
22923
+ .toLowerCase()
22924
+ .replace(/_([a-z])/g, (_, k) => {
22925
+ return k.toUpperCase();
22926
+ });
22927
+
22928
+ // Coerce string value into JS value
22929
+ let val = process.env[key];
22930
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
22931
+ val = true;
22932
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
22933
+ val = false;
22934
+ } else if (val === 'null') {
22935
+ val = null;
22936
+ } else {
22937
+ val = Number(val);
22938
+ }
22939
+
22940
+ obj[prop] = val;
22941
+ return obj;
22942
+ }, {});
22943
+
22944
+ /**
22945
+ * Is stdout a TTY? Colored output is enabled when `true`.
22946
+ */
22947
+
22948
+ function useColors() {
22949
+ return 'colors' in exports.inspectOpts ?
22950
+ Boolean(exports.inspectOpts.colors) :
22951
+ tty.isatty(process.stderr.fd);
22952
+ }
22953
+
22954
+ /**
22955
+ * Adds ANSI color escape codes if enabled.
22956
+ *
22957
+ * @api public
22958
+ */
22959
+
22960
+ function formatArgs(args) {
22961
+ const {namespace: name, useColors} = this;
22962
+
22963
+ if (useColors) {
22964
+ const c = this.color;
22965
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
22966
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
22967
+
22968
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
22969
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
22970
+ } else {
22971
+ args[0] = getDate() + name + ' ' + args[0];
22972
+ }
22973
+ }
22974
+
22975
+ function getDate() {
22976
+ if (exports.inspectOpts.hideDate) {
22977
+ return '';
22978
+ }
22979
+ return new Date().toISOString() + ' ';
22980
+ }
22981
+
22982
+ /**
22983
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
22984
+ */
22985
+
22986
+ function log(...args) {
22987
+ return process.stderr.write(util.format(...args) + '\n');
22988
+ }
22989
+
22990
+ /**
22991
+ * Save `namespaces`.
22992
+ *
22993
+ * @param {String} namespaces
22994
+ * @api private
22995
+ */
22996
+ function save(namespaces) {
22997
+ if (namespaces) {
22998
+ process.env.DEBUG = namespaces;
22999
+ } else {
23000
+ // If you set a process.env field to null or undefined, it gets cast to the
23001
+ // string 'null' or 'undefined'. Just delete instead.
23002
+ delete process.env.DEBUG;
23003
+ }
23004
+ }
23005
+
23006
+ /**
23007
+ * Load `namespaces`.
23008
+ *
23009
+ * @return {String} returns the previously persisted debug modes
23010
+ * @api private
23011
+ */
23012
+
23013
+ function load() {
23014
+ return process.env.DEBUG;
23015
+ }
23016
+
23017
+ /**
23018
+ * Init logic for `debug` instances.
23019
+ *
23020
+ * Create a new `inspectOpts` object in case `useColors` is set
23021
+ * differently for a particular `debug` instance.
23022
+ */
23023
+
23024
+ function init(debug) {
23025
+ debug.inspectOpts = {};
23026
+
23027
+ const keys = Object.keys(exports.inspectOpts);
23028
+ for (let i = 0; i < keys.length; i++) {
23029
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
23030
+ }
23031
+ }
23032
+
23033
+ module.exports = requireCommon()(exports);
23034
+
23035
+ const {formatters} = module.exports;
23036
+
23037
+ /**
23038
+ * Map %o to `util.inspect()`, all on a single line.
23039
+ */
23040
+
23041
+ formatters.o = function (v) {
23042
+ this.inspectOpts.colors = this.useColors;
23043
+ return util.inspect(v, this.inspectOpts)
23044
+ .split('\n')
23045
+ .map(str => str.trim())
23046
+ .join(' ');
23047
+ };
23048
+
23049
+ /**
23050
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
23051
+ */
23052
+
23053
+ formatters.O = function (v) {
23054
+ this.inspectOpts.colors = this.useColors;
23055
+ return util.inspect(v, this.inspectOpts);
23056
+ };
23057
+ } (node, node.exports));
23058
+ return node.exports;
23059
+ }
23060
+
23061
+ /**
23062
+ * Detect Electron renderer / nwjs process, which is node, but we should
23063
+ * treat as a browser.
23064
+ */
23065
+
23066
+ var hasRequiredSrc;
23067
+
23068
+ function requireSrc () {
23069
+ if (hasRequiredSrc) return src.exports;
23070
+ hasRequiredSrc = 1;
23071
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
23072
+ src.exports = requireBrowser();
23073
+ } else {
23074
+ src.exports = requireNode();
23075
+ }
23076
+ return src.exports;
23077
+ }
23078
+
21675
23079
  var debug$1;
21676
23080
 
21677
23081
  var debug_1 = function () {
21678
23082
  if (!debug$1) {
21679
23083
  try {
21680
23084
  /* eslint global-require: off */
21681
- debug$1 = require("debug")("follow-redirects");
23085
+ debug$1 = requireSrc()("follow-redirects");
21682
23086
  }
21683
23087
  catch (error) { /* */ }
21684
23088
  if (typeof debug$1 !== "function") {
@@ -21688,7 +23092,7 @@ var debug_1 = function () {
21688
23092
  debug$1.apply(null, arguments);
21689
23093
  };
21690
23094
 
21691
- var url = require$$0$1;
23095
+ var url = require$$0$3;
21692
23096
  var URL$1 = url.URL;
21693
23097
  var http = require$$1;
21694
23098
  var https = require$$2;
@@ -27763,7 +29167,7 @@ Zlib$1.prototype.write = function(flush, input, in_off, in_len, out, out_off, ou
27763
29167
  this.write_in_progress = true;
27764
29168
 
27765
29169
  var self = this;
27766
- browser$1.nextTick(function() {
29170
+ browser$1$1.nextTick(function() {
27767
29171
  self.write_in_progress = false;
27768
29172
  var res = self._write(flush, input, in_off, in_len, out, out_off, out_len);
27769
29173
  self.callback(res[0], res[1]);
@@ -28307,7 +29711,7 @@ Zlib.prototype.params = function(level, strategy, callback) {
28307
29711
  }
28308
29712
  });
28309
29713
  } else {
28310
- browser$1.nextTick(callback);
29714
+ browser$1$1.nextTick(callback);
28311
29715
  }
28312
29716
  };
28313
29717
 
@@ -28331,7 +29735,7 @@ Zlib.prototype.flush = function(kind, callback) {
28331
29735
 
28332
29736
  if (ws.ended) {
28333
29737
  if (callback)
28334
- browser$1.nextTick(callback);
29738
+ browser$1$1.nextTick(callback);
28335
29739
  } else if (ws.ending) {
28336
29740
  if (callback)
28337
29741
  this.once('end', callback);
@@ -28348,7 +29752,7 @@ Zlib.prototype.flush = function(kind, callback) {
28348
29752
 
28349
29753
  Zlib.prototype.close = function(callback) {
28350
29754
  if (callback)
28351
- browser$1.nextTick(callback);
29755
+ browser$1$1.nextTick(callback);
28352
29756
 
28353
29757
  if (this._closed)
28354
29758
  return;
@@ -28358,7 +29762,7 @@ Zlib.prototype.close = function(callback) {
28358
29762
  this._binding.close();
28359
29763
 
28360
29764
  var self = this;
28361
- browser$1.nextTick(function() {
29765
+ browser$1$1.nextTick(function() {
28362
29766
  self.emit('close');
28363
29767
  });
28364
29768
  };
@@ -28556,7 +29960,7 @@ const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
28556
29960
  * @returns {Buffer|Blob}
28557
29961
  */
28558
29962
  function fromDataURI(uri, asBlob, options) {
28559
- const _Blob = options && options.Blob || platform.classes.Blob;
29963
+ const _Blob = options && options.Blob || platform$1.classes.Blob;
28560
29964
  const protocol = parseProtocol(uri);
28561
29965
 
28562
29966
  if (asBlob === undefined && _Blob) {
@@ -28731,7 +30135,7 @@ class AxiosTransformStream extends Stream$3.Transform{
28731
30135
 
28732
30136
  bytesNotified = bytesTransferred;
28733
30137
 
28734
- browser$1.nextTick(() => {
30138
+ browser$1$1.nextTick(() => {
28735
30139
  self.emit('progress', {
28736
30140
  'loaded': bytesTransferred,
28737
30141
  'total': totalBytes,
@@ -28785,11 +30189,11 @@ class AxiosTransformStream extends Stream$3.Transform{
28785
30189
  }
28786
30190
 
28787
30191
  if (self.push(_chunk)) {
28788
- browser$1.nextTick(_callback);
30192
+ browser$1$1.nextTick(_callback);
28789
30193
  } else {
28790
30194
  internals.onReadCallback = () => {
28791
30195
  internals.onReadCallback = null;
28792
- browser$1.nextTick(_callback);
30196
+ browser$1$1.nextTick(_callback);
28793
30197
  };
28794
30198
  }
28795
30199
  }
@@ -28833,7 +30237,7 @@ class AxiosTransformStream extends Stream$3.Transform{
28833
30237
  }
28834
30238
 
28835
30239
  pushChunk(_chunk, chunkRemainder ? () => {
28836
- browser$1.nextTick(_callback, null, chunkRemainder);
30240
+ browser$1$1.nextTick(_callback, null, chunkRemainder);
28837
30241
  } : _callback);
28838
30242
  };
28839
30243
 
@@ -29037,7 +30441,7 @@ const {http: httpFollow, https: httpsFollow} = followRedirects;
29037
30441
 
29038
30442
  const isHttps = /https:?/;
29039
30443
 
29040
- const supportedProtocols = platform.protocols.map(protocol => {
30444
+ const supportedProtocols = platform$1.protocols.map(protocol => {
29041
30445
  return protocol + ':';
29042
30446
  });
29043
30447
 
@@ -29111,7 +30515,7 @@ function setProxy(options, configProxy, location) {
29111
30515
  };
29112
30516
  }
29113
30517
 
29114
- const isHttpAdapterSupported = typeof browser$1 !== 'undefined' && utils.kindOf(browser$1) === 'process';
30518
+ const isHttpAdapterSupported = typeof browser$1$1 !== 'undefined' && utils.kindOf(browser$1$1) === 'process';
29115
30519
 
29116
30520
  // temporary hotfix
29117
30521
 
@@ -29659,7 +31063,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
29659
31063
  });
29660
31064
  };
29661
31065
 
29662
- var cookies = platform.isStandardBrowserEnv ?
31066
+ var cookies = platform$1.isStandardBrowserEnv ?
29663
31067
 
29664
31068
  // Standard browser envs support document.cookie
29665
31069
  (function standardBrowserEnv() {
@@ -29707,7 +31111,7 @@ var cookies = platform.isStandardBrowserEnv ?
29707
31111
  };
29708
31112
  })();
29709
31113
 
29710
- var isURLSameOrigin = platform.isStandardBrowserEnv ?
31114
+ var isURLSameOrigin = platform$1.isStandardBrowserEnv ?
29711
31115
 
29712
31116
  // Standard browser envs have full support of the APIs needed to test
29713
31117
  // whether the request URL is of the same origin as current location.
@@ -29820,7 +31224,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
29820
31224
  let contentType;
29821
31225
 
29822
31226
  if (utils.isFormData(requestData)) {
29823
- if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
31227
+ if (platform$1.isStandardBrowserEnv || platform$1.isStandardBrowserWebWorkerEnv) {
29824
31228
  requestHeaders.setContentType(false); // Let the browser set it
29825
31229
  } else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
29826
31230
  requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
@@ -29942,7 +31346,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
29942
31346
  // Add xsrf header
29943
31347
  // This is only done if running in a standard browser environment.
29944
31348
  // Specifically not if we're in a web worker, or react-native.
29945
- if (platform.isStandardBrowserEnv) {
31349
+ if (platform$1.isStandardBrowserEnv) {
29946
31350
  // Add xsrf header
29947
31351
  const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
29948
31352
  && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
@@ -30002,7 +31406,7 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
30002
31406
 
30003
31407
  const protocol = parseProtocol(fullPath);
30004
31408
 
30005
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
31409
+ if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
30006
31410
  reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
30007
31411
  return;
30008
31412
  }
@@ -33524,6 +34928,68 @@ var Posts = /** @class */ (function () {
33524
34928
  Posts.createWithBlob = function (blob, data) {
33525
34929
  return Requests.uploadBlob(PostsRoute.routes.create.url, 'file', blob, data);
33526
34930
  };
34931
+ /**
34932
+ * Create a new post with a file divided into chunks.
34933
+ *
34934
+ * @param file The file object to upload.
34935
+ * @param chunkSize Size of each chunk in bytes. Default is 1MB.
34936
+ * @param data Any additional data to pass along to the upload.
34937
+ *
34938
+ * @returns Promise
34939
+ */
34940
+ /**
34941
+ * Create a new post with a file divided into chunks.
34942
+ *
34943
+ * @param file The file object to upload.
34944
+ * @param chunkSize Size of each chunk in bytes. Default is 1MB.
34945
+ * @param data Any additional data to pass along to the upload.
34946
+ *
34947
+ * @returns Promise
34948
+ */
34949
+ Posts.createWithFileInChunks = function (file, chunkSize, data) {
34950
+ if (chunkSize === void 0) { chunkSize = 1 * 1024 * 1024; }
34951
+ if (data === void 0) { data = {}; }
34952
+ return __awaiter(this, void 0, void 0, function () {
34953
+ var totalChunks, i, start, end, chunk, formData, key;
34954
+ return __generator(this, function (_a) {
34955
+ switch (_a.label) {
34956
+ case 0:
34957
+ totalChunks = Math.ceil(file.size / chunkSize);
34958
+ i = 0;
34959
+ _a.label = 1;
34960
+ case 1:
34961
+ if (!(i < totalChunks)) return [3 /*break*/, 6];
34962
+ start = i * chunkSize;
34963
+ end = start + chunkSize;
34964
+ chunk = file.slice(start, end);
34965
+ formData = new FormData();
34966
+ formData.append('file', chunk, "".concat(i, "-").concat(file.name)); // Naming chunks as index-filename for identification
34967
+ formData.append('totalChunks', totalChunks.toString());
34968
+ formData.append('currentChunk', i.toString());
34969
+ // merge any other data if provided
34970
+ for (key in data) {
34971
+ formData.append(key, data[key]);
34972
+ }
34973
+ if (!(i === totalChunks - 1)) return [3 /*break*/, 3];
34974
+ return [4 /*yield*/, Requests.uploadFile(PostsRoute.routes.create.url, 'file', chunk, formData)];
34975
+ case 2:
34976
+ _a.sent();
34977
+ return [3 /*break*/, 5];
34978
+ case 3: return [4 /*yield*/, Requests.uploadFile(PostsRoute.routes.create.url, 'file', chunk, formData)];
34979
+ case 4:
34980
+ _a.sent();
34981
+ _a.label = 5;
34982
+ case 5:
34983
+ i++;
34984
+ return [3 /*break*/, 1];
34985
+ case 6:
34986
+ {
34987
+ throw new Error("No response from the last chunk upload");
34988
+ }
34989
+ }
34990
+ });
34991
+ });
34992
+ };
33527
34993
  /**
33528
34994
  * Update a post.
33529
34995
  *
@@ -34000,6 +35466,55 @@ var TipPackagePurchases = /** @class */ (function () {
34000
35466
  return TipPackagePurchases;
34001
35467
  }());
34002
35468
 
35469
+ var SocialPostsRoute = /** @class */ (function () {
35470
+ function SocialPostsRoute() {
35471
+ }
35472
+ SocialPostsRoute.routes = {
35473
+ getPosts: { url: '/socialposts', method: HTTP_METHODS.GET },
35474
+ createPost: { url: '/socialposts', method: HTTP_METHODS.POST },
35475
+ retrievePost: { url: '/socialposts/{post_id}', method: HTTP_METHODS.GET },
35476
+ };
35477
+ return SocialPostsRoute;
35478
+ }());
35479
+
35480
+ var SocialPosts = /** @class */ (function () {
35481
+ function SocialPosts() {
35482
+ }
35483
+ /**
35484
+ * List all the Posts.
35485
+ *
35486
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
35487
+ *
35488
+ * @returns promise
35489
+ */
35490
+ SocialPosts.list = function (params) {
35491
+ return Requests.processRoute(SocialPostsRoute.routes.getPosts, undefined, undefined, params);
35492
+ };
35493
+ /**
35494
+ * Give a tip to another user
35495
+ *
35496
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
35497
+ *
35498
+ * @returns A promise
35499
+ */
35500
+ SocialPosts.create = function (data, params) {
35501
+ return Requests.processRoute(SocialPostsRoute.routes.create, data, {}, params);
35502
+ };
35503
+ /**
35504
+ * Retrieve the information for a single post.
35505
+ *
35506
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
35507
+ *
35508
+ * @param post_id The id fo the post to retrieve.
35509
+ *
35510
+ * @returns promise
35511
+ */
35512
+ SocialPosts.view = function (post_id, params) {
35513
+ return Requests.processRoute(SocialPostsRoute.routes.retrievePost, {}, { post_id: post_id }, params);
35514
+ };
35515
+ return SocialPosts;
35516
+ }());
35517
+
34003
35518
  var Parser = /** @class */ (function () {
34004
35519
  function Parser() {
34005
35520
  }
@@ -34381,6 +35896,7 @@ var Glitch = /** @class */ (function () {
34381
35896
  Utility: Utility,
34382
35897
  Tips: Tips,
34383
35898
  Social: Social,
35899
+ SocialPosts: SocialPosts,
34384
35900
  TipPackages: TipPackages,
34385
35901
  TipEmojis: TipEmojis,
34386
35902
  TipPackagePurchases: TipPackagePurchases