vite 3.0.0-alpha.0 → 3.0.0-alpha.11

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.
@@ -0,0 +1,4174 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var path$3 = require('path');
6
+ var url = require('url');
7
+ var fs$1 = require('fs');
8
+ var os$1 = require('os');
9
+ var require$$1 = require('util');
10
+ var module$1 = require('module');
11
+ var require$$0 = require('tty');
12
+ var require$$0$1 = require('crypto');
13
+ var readline = require('readline');
14
+
15
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
16
+
17
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path$3);
18
+ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
19
+ var os__default = /*#__PURE__*/_interopDefaultLegacy(os$1);
20
+ var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
21
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
22
+ var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
23
+ var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
24
+
25
+ var version = "3.0.0-alpha.11";
26
+
27
+ const VERSION = version;
28
+ const VITE_PACKAGE_DIR = path$3.resolve(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))), '../../..');
29
+ const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
30
+ path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
31
+ path__default.dirname(CLIENT_ENTRY);
32
+
33
+ // This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
34
+ const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
35
+ const cssLangRE = new RegExp(cssLangs);
36
+ const isCSSRequest = (request) => cssLangRE.test(request);
37
+ // Use splitVendorChunkPlugin() to get the same manualChunks strategy as Vite 2.7
38
+ // We don't recommend using this strategy as a general solution moving forward
39
+ // splitVendorChunk is a simple index/vendor strategy that was used in Vite
40
+ // until v2.8. It is exposed to let people continue to use it in case it was
41
+ // working well for their setups.
42
+ // The cache needs to be reset on buildStart for watch mode to work correctly
43
+ // Don't use this manualChunks strategy for ssr, lib mode, and 'umd' or 'iife'
44
+ class SplitVendorChunkCache {
45
+ constructor() {
46
+ this.cache = new Map();
47
+ }
48
+ reset() {
49
+ this.cache = new Map();
50
+ }
51
+ }
52
+ function splitVendorChunk(options = {}) {
53
+ const cache = options.cache ?? new SplitVendorChunkCache();
54
+ return (id, { getModuleInfo }) => {
55
+ if (id.includes('node_modules') &&
56
+ !isCSSRequest(id) &&
57
+ staticImportedByEntry(id, getModuleInfo, cache.cache)) {
58
+ return 'vendor';
59
+ }
60
+ };
61
+ }
62
+ function staticImportedByEntry(id, getModuleInfo, cache, importStack = []) {
63
+ if (cache.has(id)) {
64
+ return cache.get(id);
65
+ }
66
+ if (importStack.includes(id)) {
67
+ // circular deps!
68
+ cache.set(id, false);
69
+ return false;
70
+ }
71
+ const mod = getModuleInfo(id);
72
+ if (!mod) {
73
+ cache.set(id, false);
74
+ return false;
75
+ }
76
+ if (mod.isEntry) {
77
+ cache.set(id, true);
78
+ return true;
79
+ }
80
+ const someImporterIs = mod.importers.some((importer) => staticImportedByEntry(importer, getModuleInfo, cache, importStack.concat(id)));
81
+ cache.set(id, someImporterIs);
82
+ return someImporterIs;
83
+ }
84
+ function splitVendorChunkPlugin() {
85
+ const caches = [];
86
+ function createSplitVendorChunk(output, config) {
87
+ const cache = new SplitVendorChunkCache();
88
+ caches.push(cache);
89
+ const build = config.build ?? {};
90
+ const format = output?.format;
91
+ if (!build.ssr && !build.lib && format !== 'umd' && format !== 'iife') {
92
+ return splitVendorChunk({ cache });
93
+ }
94
+ }
95
+ return {
96
+ name: 'vite:split-vendor-chunk',
97
+ config(config) {
98
+ let outputs = config?.build?.rollupOptions?.output;
99
+ if (outputs) {
100
+ outputs = Array.isArray(outputs) ? outputs : [outputs];
101
+ for (const output of outputs) {
102
+ const viteManualChunks = createSplitVendorChunk(output, config);
103
+ if (viteManualChunks) {
104
+ if (output.manualChunks) {
105
+ if (typeof output.manualChunks === 'function') {
106
+ const userManualChunks = output.manualChunks;
107
+ output.manualChunks = (id, api) => {
108
+ return userManualChunks(id, api) ?? viteManualChunks(id, api);
109
+ };
110
+ }
111
+ // else, leave the object form of manualChunks untouched, as
112
+ // we can't safely replicate rollup handling.
113
+ }
114
+ else {
115
+ output.manualChunks = viteManualChunks;
116
+ }
117
+ }
118
+ }
119
+ }
120
+ else {
121
+ return {
122
+ build: {
123
+ rollupOptions: {
124
+ output: {
125
+ manualChunks: createSplitVendorChunk({}, config)
126
+ }
127
+ }
128
+ }
129
+ };
130
+ }
131
+ },
132
+ buildStart() {
133
+ caches.forEach((cache) => cache.reset());
134
+ }
135
+ };
136
+ }
137
+
138
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
139
+ const intToChar = new Uint8Array(64); // 64 possible chars.
140
+ const charToInt = new Uint8Array(128); // z is 122 in ASCII
141
+ for (let i = 0; i < chars.length; i++) {
142
+ const c = chars.charCodeAt(i);
143
+ intToChar[i] = c;
144
+ charToInt[c] = i;
145
+ }
146
+
147
+ var picocolors = {exports: {}};
148
+
149
+ let tty = require$$0__default;
150
+
151
+ let isColorSupported =
152
+ !("NO_COLOR" in process.env || process.argv.includes("--no-color")) &&
153
+ ("FORCE_COLOR" in process.env ||
154
+ process.argv.includes("--color") ||
155
+ process.platform === "win32" ||
156
+ (tty.isatty(1) && process.env.TERM !== "dumb") ||
157
+ "CI" in process.env);
158
+
159
+ let formatter =
160
+ (open, close, replace = open) =>
161
+ input => {
162
+ let string = "" + input;
163
+ let index = string.indexOf(close, open.length);
164
+ return ~index
165
+ ? open + replaceClose(string, close, replace, index) + close
166
+ : open + string + close
167
+ };
168
+
169
+ let replaceClose = (string, close, replace, index) => {
170
+ let start = string.substring(0, index) + replace;
171
+ let end = string.substring(index + close.length);
172
+ let nextIndex = end.indexOf(close);
173
+ return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end
174
+ };
175
+
176
+ let createColors = (enabled = isColorSupported) => ({
177
+ isColorSupported: enabled,
178
+ reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String,
179
+ bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String,
180
+ dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String,
181
+ italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String,
182
+ underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String,
183
+ inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String,
184
+ hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String,
185
+ strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String,
186
+ black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String,
187
+ red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String,
188
+ green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String,
189
+ yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String,
190
+ blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String,
191
+ magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String,
192
+ cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String,
193
+ white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String,
194
+ gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String,
195
+ bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String,
196
+ bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String,
197
+ bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String,
198
+ bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String,
199
+ bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String,
200
+ bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String,
201
+ bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String,
202
+ bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String,
203
+ });
204
+
205
+ picocolors.exports = createColors();
206
+ picocolors.exports.createColors = createColors;
207
+
208
+ var colors = picocolors.exports;
209
+
210
+ var src = {exports: {}};
211
+
212
+ var browser = {exports: {}};
213
+
214
+ /**
215
+ * Helpers.
216
+ */
217
+
218
+ var s = 1000;
219
+ var m = s * 60;
220
+ var h = m * 60;
221
+ var d = h * 24;
222
+ var w = d * 7;
223
+ var y = d * 365.25;
224
+
225
+ /**
226
+ * Parse or format the given `val`.
227
+ *
228
+ * Options:
229
+ *
230
+ * - `long` verbose formatting [false]
231
+ *
232
+ * @param {String|Number} val
233
+ * @param {Object} [options]
234
+ * @throws {Error} throw an error if val is not a non-empty string or a number
235
+ * @return {String|Number}
236
+ * @api public
237
+ */
238
+
239
+ var ms = function(val, options) {
240
+ options = options || {};
241
+ var type = typeof val;
242
+ if (type === 'string' && val.length > 0) {
243
+ return parse$3(val);
244
+ } else if (type === 'number' && isFinite(val)) {
245
+ return options.long ? fmtLong(val) : fmtShort(val);
246
+ }
247
+ throw new Error(
248
+ 'val is not a non-empty string or a valid number. val=' +
249
+ JSON.stringify(val)
250
+ );
251
+ };
252
+
253
+ /**
254
+ * Parse the given `str` and return milliseconds.
255
+ *
256
+ * @param {String} str
257
+ * @return {Number}
258
+ * @api private
259
+ */
260
+
261
+ function parse$3(str) {
262
+ str = String(str);
263
+ if (str.length > 100) {
264
+ return;
265
+ }
266
+ 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(
267
+ str
268
+ );
269
+ if (!match) {
270
+ return;
271
+ }
272
+ var n = parseFloat(match[1]);
273
+ var type = (match[2] || 'ms').toLowerCase();
274
+ switch (type) {
275
+ case 'years':
276
+ case 'year':
277
+ case 'yrs':
278
+ case 'yr':
279
+ case 'y':
280
+ return n * y;
281
+ case 'weeks':
282
+ case 'week':
283
+ case 'w':
284
+ return n * w;
285
+ case 'days':
286
+ case 'day':
287
+ case 'd':
288
+ return n * d;
289
+ case 'hours':
290
+ case 'hour':
291
+ case 'hrs':
292
+ case 'hr':
293
+ case 'h':
294
+ return n * h;
295
+ case 'minutes':
296
+ case 'minute':
297
+ case 'mins':
298
+ case 'min':
299
+ case 'm':
300
+ return n * m;
301
+ case 'seconds':
302
+ case 'second':
303
+ case 'secs':
304
+ case 'sec':
305
+ case 's':
306
+ return n * s;
307
+ case 'milliseconds':
308
+ case 'millisecond':
309
+ case 'msecs':
310
+ case 'msec':
311
+ case 'ms':
312
+ return n;
313
+ default:
314
+ return undefined;
315
+ }
316
+ }
317
+
318
+ /**
319
+ * Short format for `ms`.
320
+ *
321
+ * @param {Number} ms
322
+ * @return {String}
323
+ * @api private
324
+ */
325
+
326
+ function fmtShort(ms) {
327
+ var msAbs = Math.abs(ms);
328
+ if (msAbs >= d) {
329
+ return Math.round(ms / d) + 'd';
330
+ }
331
+ if (msAbs >= h) {
332
+ return Math.round(ms / h) + 'h';
333
+ }
334
+ if (msAbs >= m) {
335
+ return Math.round(ms / m) + 'm';
336
+ }
337
+ if (msAbs >= s) {
338
+ return Math.round(ms / s) + 's';
339
+ }
340
+ return ms + 'ms';
341
+ }
342
+
343
+ /**
344
+ * Long format for `ms`.
345
+ *
346
+ * @param {Number} ms
347
+ * @return {String}
348
+ * @api private
349
+ */
350
+
351
+ function fmtLong(ms) {
352
+ var msAbs = Math.abs(ms);
353
+ if (msAbs >= d) {
354
+ return plural(ms, msAbs, d, 'day');
355
+ }
356
+ if (msAbs >= h) {
357
+ return plural(ms, msAbs, h, 'hour');
358
+ }
359
+ if (msAbs >= m) {
360
+ return plural(ms, msAbs, m, 'minute');
361
+ }
362
+ if (msAbs >= s) {
363
+ return plural(ms, msAbs, s, 'second');
364
+ }
365
+ return ms + ' ms';
366
+ }
367
+
368
+ /**
369
+ * Pluralization helper.
370
+ */
371
+
372
+ function plural(ms, msAbs, n, name) {
373
+ var isPlural = msAbs >= n * 1.5;
374
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
375
+ }
376
+
377
+ /**
378
+ * This is the common logic for both the Node.js and web browser
379
+ * implementations of `debug()`.
380
+ */
381
+
382
+ function setup(env) {
383
+ createDebug.debug = createDebug;
384
+ createDebug.default = createDebug;
385
+ createDebug.coerce = coerce;
386
+ createDebug.disable = disable;
387
+ createDebug.enable = enable;
388
+ createDebug.enabled = enabled;
389
+ createDebug.humanize = ms;
390
+ createDebug.destroy = destroy;
391
+
392
+ Object.keys(env).forEach(key => {
393
+ createDebug[key] = env[key];
394
+ });
395
+
396
+ /**
397
+ * The currently active debug mode names, and names to skip.
398
+ */
399
+
400
+ createDebug.names = [];
401
+ createDebug.skips = [];
402
+
403
+ /**
404
+ * Map of special "%n" handling functions, for the debug "format" argument.
405
+ *
406
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
407
+ */
408
+ createDebug.formatters = {};
409
+
410
+ /**
411
+ * Selects a color for a debug namespace
412
+ * @param {String} namespace The namespace string for the debug instance to be colored
413
+ * @return {Number|String} An ANSI color code for the given namespace
414
+ * @api private
415
+ */
416
+ function selectColor(namespace) {
417
+ let hash = 0;
418
+
419
+ for (let i = 0; i < namespace.length; i++) {
420
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
421
+ hash |= 0; // Convert to 32bit integer
422
+ }
423
+
424
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
425
+ }
426
+ createDebug.selectColor = selectColor;
427
+
428
+ /**
429
+ * Create a debugger with the given `namespace`.
430
+ *
431
+ * @param {String} namespace
432
+ * @return {Function}
433
+ * @api public
434
+ */
435
+ function createDebug(namespace) {
436
+ let prevTime;
437
+ let enableOverride = null;
438
+ let namespacesCache;
439
+ let enabledCache;
440
+
441
+ function debug(...args) {
442
+ // Disabled?
443
+ if (!debug.enabled) {
444
+ return;
445
+ }
446
+
447
+ const self = debug;
448
+
449
+ // Set `diff` timestamp
450
+ const curr = Number(new Date());
451
+ const ms = curr - (prevTime || curr);
452
+ self.diff = ms;
453
+ self.prev = prevTime;
454
+ self.curr = curr;
455
+ prevTime = curr;
456
+
457
+ args[0] = createDebug.coerce(args[0]);
458
+
459
+ if (typeof args[0] !== 'string') {
460
+ // Anything else let's inspect with %O
461
+ args.unshift('%O');
462
+ }
463
+
464
+ // Apply any `formatters` transformations
465
+ let index = 0;
466
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
467
+ // If we encounter an escaped % then don't increase the array index
468
+ if (match === '%%') {
469
+ return '%';
470
+ }
471
+ index++;
472
+ const formatter = createDebug.formatters[format];
473
+ if (typeof formatter === 'function') {
474
+ const val = args[index];
475
+ match = formatter.call(self, val);
476
+
477
+ // Now we need to remove `args[index]` since it's inlined in the `format`
478
+ args.splice(index, 1);
479
+ index--;
480
+ }
481
+ return match;
482
+ });
483
+
484
+ // Apply env-specific formatting (colors, etc.)
485
+ createDebug.formatArgs.call(self, args);
486
+
487
+ const logFn = self.log || createDebug.log;
488
+ logFn.apply(self, args);
489
+ }
490
+
491
+ debug.namespace = namespace;
492
+ debug.useColors = createDebug.useColors();
493
+ debug.color = createDebug.selectColor(namespace);
494
+ debug.extend = extend;
495
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
496
+
497
+ Object.defineProperty(debug, 'enabled', {
498
+ enumerable: true,
499
+ configurable: false,
500
+ get: () => {
501
+ if (enableOverride !== null) {
502
+ return enableOverride;
503
+ }
504
+ if (namespacesCache !== createDebug.namespaces) {
505
+ namespacesCache = createDebug.namespaces;
506
+ enabledCache = createDebug.enabled(namespace);
507
+ }
508
+
509
+ return enabledCache;
510
+ },
511
+ set: v => {
512
+ enableOverride = v;
513
+ }
514
+ });
515
+
516
+ // Env-specific initialization logic for debug instances
517
+ if (typeof createDebug.init === 'function') {
518
+ createDebug.init(debug);
519
+ }
520
+
521
+ return debug;
522
+ }
523
+
524
+ function extend(namespace, delimiter) {
525
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
526
+ newDebug.log = this.log;
527
+ return newDebug;
528
+ }
529
+
530
+ /**
531
+ * Enables a debug mode by namespaces. This can include modes
532
+ * separated by a colon and wildcards.
533
+ *
534
+ * @param {String} namespaces
535
+ * @api public
536
+ */
537
+ function enable(namespaces) {
538
+ createDebug.save(namespaces);
539
+ createDebug.namespaces = namespaces;
540
+
541
+ createDebug.names = [];
542
+ createDebug.skips = [];
543
+
544
+ let i;
545
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
546
+ const len = split.length;
547
+
548
+ for (i = 0; i < len; i++) {
549
+ if (!split[i]) {
550
+ // ignore empty strings
551
+ continue;
552
+ }
553
+
554
+ namespaces = split[i].replace(/\*/g, '.*?');
555
+
556
+ if (namespaces[0] === '-') {
557
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
558
+ } else {
559
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
560
+ }
561
+ }
562
+ }
563
+
564
+ /**
565
+ * Disable debug output.
566
+ *
567
+ * @return {String} namespaces
568
+ * @api public
569
+ */
570
+ function disable() {
571
+ const namespaces = [
572
+ ...createDebug.names.map(toNamespace),
573
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
574
+ ].join(',');
575
+ createDebug.enable('');
576
+ return namespaces;
577
+ }
578
+
579
+ /**
580
+ * Returns true if the given mode name is enabled, false otherwise.
581
+ *
582
+ * @param {String} name
583
+ * @return {Boolean}
584
+ * @api public
585
+ */
586
+ function enabled(name) {
587
+ if (name[name.length - 1] === '*') {
588
+ return true;
589
+ }
590
+
591
+ let i;
592
+ let len;
593
+
594
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
595
+ if (createDebug.skips[i].test(name)) {
596
+ return false;
597
+ }
598
+ }
599
+
600
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
601
+ if (createDebug.names[i].test(name)) {
602
+ return true;
603
+ }
604
+ }
605
+
606
+ return false;
607
+ }
608
+
609
+ /**
610
+ * Convert regexp to namespace
611
+ *
612
+ * @param {RegExp} regxep
613
+ * @return {String} namespace
614
+ * @api private
615
+ */
616
+ function toNamespace(regexp) {
617
+ return regexp.toString()
618
+ .substring(2, regexp.toString().length - 2)
619
+ .replace(/\.\*\?$/, '*');
620
+ }
621
+
622
+ /**
623
+ * Coerce `val`.
624
+ *
625
+ * @param {Mixed} val
626
+ * @return {Mixed}
627
+ * @api private
628
+ */
629
+ function coerce(val) {
630
+ if (val instanceof Error) {
631
+ return val.stack || val.message;
632
+ }
633
+ return val;
634
+ }
635
+
636
+ /**
637
+ * XXX DO NOT USE. This is a temporary stub function.
638
+ * XXX It WILL be removed in the next major release.
639
+ */
640
+ function destroy() {
641
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
642
+ }
643
+
644
+ createDebug.enable(createDebug.load());
645
+
646
+ return createDebug;
647
+ }
648
+
649
+ var common = setup;
650
+
651
+ /* eslint-env browser */
652
+
653
+ (function (module, exports) {
654
+ /**
655
+ * This is the web browser implementation of `debug()`.
656
+ */
657
+
658
+ exports.formatArgs = formatArgs;
659
+ exports.save = save;
660
+ exports.load = load;
661
+ exports.useColors = useColors;
662
+ exports.storage = localstorage();
663
+ exports.destroy = (() => {
664
+ let warned = false;
665
+
666
+ return () => {
667
+ if (!warned) {
668
+ warned = true;
669
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
670
+ }
671
+ };
672
+ })();
673
+
674
+ /**
675
+ * Colors.
676
+ */
677
+
678
+ exports.colors = [
679
+ '#0000CC',
680
+ '#0000FF',
681
+ '#0033CC',
682
+ '#0033FF',
683
+ '#0066CC',
684
+ '#0066FF',
685
+ '#0099CC',
686
+ '#0099FF',
687
+ '#00CC00',
688
+ '#00CC33',
689
+ '#00CC66',
690
+ '#00CC99',
691
+ '#00CCCC',
692
+ '#00CCFF',
693
+ '#3300CC',
694
+ '#3300FF',
695
+ '#3333CC',
696
+ '#3333FF',
697
+ '#3366CC',
698
+ '#3366FF',
699
+ '#3399CC',
700
+ '#3399FF',
701
+ '#33CC00',
702
+ '#33CC33',
703
+ '#33CC66',
704
+ '#33CC99',
705
+ '#33CCCC',
706
+ '#33CCFF',
707
+ '#6600CC',
708
+ '#6600FF',
709
+ '#6633CC',
710
+ '#6633FF',
711
+ '#66CC00',
712
+ '#66CC33',
713
+ '#9900CC',
714
+ '#9900FF',
715
+ '#9933CC',
716
+ '#9933FF',
717
+ '#99CC00',
718
+ '#99CC33',
719
+ '#CC0000',
720
+ '#CC0033',
721
+ '#CC0066',
722
+ '#CC0099',
723
+ '#CC00CC',
724
+ '#CC00FF',
725
+ '#CC3300',
726
+ '#CC3333',
727
+ '#CC3366',
728
+ '#CC3399',
729
+ '#CC33CC',
730
+ '#CC33FF',
731
+ '#CC6600',
732
+ '#CC6633',
733
+ '#CC9900',
734
+ '#CC9933',
735
+ '#CCCC00',
736
+ '#CCCC33',
737
+ '#FF0000',
738
+ '#FF0033',
739
+ '#FF0066',
740
+ '#FF0099',
741
+ '#FF00CC',
742
+ '#FF00FF',
743
+ '#FF3300',
744
+ '#FF3333',
745
+ '#FF3366',
746
+ '#FF3399',
747
+ '#FF33CC',
748
+ '#FF33FF',
749
+ '#FF6600',
750
+ '#FF6633',
751
+ '#FF9900',
752
+ '#FF9933',
753
+ '#FFCC00',
754
+ '#FFCC33'
755
+ ];
756
+
757
+ /**
758
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
759
+ * and the Firebug extension (any Firefox version) are known
760
+ * to support "%c" CSS customizations.
761
+ *
762
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
763
+ */
764
+
765
+ // eslint-disable-next-line complexity
766
+ function useColors() {
767
+ // NB: In an Electron preload script, document will be defined but not fully
768
+ // initialized. Since we know we're in Chrome, we'll just detect this case
769
+ // explicitly
770
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
771
+ return true;
772
+ }
773
+
774
+ // Internet Explorer and Edge do not support colors.
775
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
776
+ return false;
777
+ }
778
+
779
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
780
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
781
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
782
+ // Is firebug? http://stackoverflow.com/a/398120/376773
783
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
784
+ // Is firefox >= v31?
785
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
786
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
787
+ // Double check webkit in userAgent just in case we are in a worker
788
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
789
+ }
790
+
791
+ /**
792
+ * Colorize log arguments if enabled.
793
+ *
794
+ * @api public
795
+ */
796
+
797
+ function formatArgs(args) {
798
+ args[0] = (this.useColors ? '%c' : '') +
799
+ this.namespace +
800
+ (this.useColors ? ' %c' : ' ') +
801
+ args[0] +
802
+ (this.useColors ? '%c ' : ' ') +
803
+ '+' + module.exports.humanize(this.diff);
804
+
805
+ if (!this.useColors) {
806
+ return;
807
+ }
808
+
809
+ const c = 'color: ' + this.color;
810
+ args.splice(1, 0, c, 'color: inherit');
811
+
812
+ // The final "%c" is somewhat tricky, because there could be other
813
+ // arguments passed either before or after the %c, so we need to
814
+ // figure out the correct index to insert the CSS into
815
+ let index = 0;
816
+ let lastC = 0;
817
+ args[0].replace(/%[a-zA-Z%]/g, match => {
818
+ if (match === '%%') {
819
+ return;
820
+ }
821
+ index++;
822
+ if (match === '%c') {
823
+ // We only are interested in the *last* %c
824
+ // (the user may have provided their own)
825
+ lastC = index;
826
+ }
827
+ });
828
+
829
+ args.splice(lastC, 0, c);
830
+ }
831
+
832
+ /**
833
+ * Invokes `console.debug()` when available.
834
+ * No-op when `console.debug` is not a "function".
835
+ * If `console.debug` is not available, falls back
836
+ * to `console.log`.
837
+ *
838
+ * @api public
839
+ */
840
+ exports.log = console.debug || console.log || (() => {});
841
+
842
+ /**
843
+ * Save `namespaces`.
844
+ *
845
+ * @param {String} namespaces
846
+ * @api private
847
+ */
848
+ function save(namespaces) {
849
+ try {
850
+ if (namespaces) {
851
+ exports.storage.setItem('debug', namespaces);
852
+ } else {
853
+ exports.storage.removeItem('debug');
854
+ }
855
+ } catch (error) {
856
+ // Swallow
857
+ // XXX (@Qix-) should we be logging these?
858
+ }
859
+ }
860
+
861
+ /**
862
+ * Load `namespaces`.
863
+ *
864
+ * @return {String} returns the previously persisted debug modes
865
+ * @api private
866
+ */
867
+ function load() {
868
+ let r;
869
+ try {
870
+ r = exports.storage.getItem('debug');
871
+ } catch (error) {
872
+ // Swallow
873
+ // XXX (@Qix-) should we be logging these?
874
+ }
875
+
876
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
877
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
878
+ r = process.env.DEBUG;
879
+ }
880
+
881
+ return r;
882
+ }
883
+
884
+ /**
885
+ * Localstorage attempts to return the localstorage.
886
+ *
887
+ * This is necessary because safari throws
888
+ * when a user disables cookies/localstorage
889
+ * and you attempt to access it.
890
+ *
891
+ * @return {LocalStorage}
892
+ * @api private
893
+ */
894
+
895
+ function localstorage() {
896
+ try {
897
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
898
+ // The Browser also has localStorage in the global context.
899
+ return localStorage;
900
+ } catch (error) {
901
+ // Swallow
902
+ // XXX (@Qix-) should we be logging these?
903
+ }
904
+ }
905
+
906
+ module.exports = common(exports);
907
+
908
+ const {formatters} = module.exports;
909
+
910
+ /**
911
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
912
+ */
913
+
914
+ formatters.j = function (v) {
915
+ try {
916
+ return JSON.stringify(v);
917
+ } catch (error) {
918
+ return '[UnexpectedJSONParseError]: ' + error.message;
919
+ }
920
+ };
921
+ }(browser, browser.exports));
922
+
923
+ var node = {exports: {}};
924
+
925
+ /**
926
+ * Module dependencies.
927
+ */
928
+
929
+ (function (module, exports) {
930
+ const tty = require$$0__default;
931
+ const util = require$$1__default;
932
+
933
+ /**
934
+ * This is the Node.js implementation of `debug()`.
935
+ */
936
+
937
+ exports.init = init;
938
+ exports.log = log;
939
+ exports.formatArgs = formatArgs;
940
+ exports.save = save;
941
+ exports.load = load;
942
+ exports.useColors = useColors;
943
+ exports.destroy = util.deprecate(
944
+ () => {},
945
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
946
+ );
947
+
948
+ /**
949
+ * Colors.
950
+ */
951
+
952
+ exports.colors = [6, 2, 3, 4, 5, 1];
953
+
954
+ try {
955
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
956
+ // eslint-disable-next-line import/no-extraneous-dependencies
957
+ const supportsColor = require('supports-color');
958
+
959
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
960
+ exports.colors = [
961
+ 20,
962
+ 21,
963
+ 26,
964
+ 27,
965
+ 32,
966
+ 33,
967
+ 38,
968
+ 39,
969
+ 40,
970
+ 41,
971
+ 42,
972
+ 43,
973
+ 44,
974
+ 45,
975
+ 56,
976
+ 57,
977
+ 62,
978
+ 63,
979
+ 68,
980
+ 69,
981
+ 74,
982
+ 75,
983
+ 76,
984
+ 77,
985
+ 78,
986
+ 79,
987
+ 80,
988
+ 81,
989
+ 92,
990
+ 93,
991
+ 98,
992
+ 99,
993
+ 112,
994
+ 113,
995
+ 128,
996
+ 129,
997
+ 134,
998
+ 135,
999
+ 148,
1000
+ 149,
1001
+ 160,
1002
+ 161,
1003
+ 162,
1004
+ 163,
1005
+ 164,
1006
+ 165,
1007
+ 166,
1008
+ 167,
1009
+ 168,
1010
+ 169,
1011
+ 170,
1012
+ 171,
1013
+ 172,
1014
+ 173,
1015
+ 178,
1016
+ 179,
1017
+ 184,
1018
+ 185,
1019
+ 196,
1020
+ 197,
1021
+ 198,
1022
+ 199,
1023
+ 200,
1024
+ 201,
1025
+ 202,
1026
+ 203,
1027
+ 204,
1028
+ 205,
1029
+ 206,
1030
+ 207,
1031
+ 208,
1032
+ 209,
1033
+ 214,
1034
+ 215,
1035
+ 220,
1036
+ 221
1037
+ ];
1038
+ }
1039
+ } catch (error) {
1040
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
1041
+ }
1042
+
1043
+ /**
1044
+ * Build up the default `inspectOpts` object from the environment variables.
1045
+ *
1046
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
1047
+ */
1048
+
1049
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
1050
+ return /^debug_/i.test(key);
1051
+ }).reduce((obj, key) => {
1052
+ // Camel-case
1053
+ const prop = key
1054
+ .substring(6)
1055
+ .toLowerCase()
1056
+ .replace(/_([a-z])/g, (_, k) => {
1057
+ return k.toUpperCase();
1058
+ });
1059
+
1060
+ // Coerce string value into JS value
1061
+ let val = process.env[key];
1062
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
1063
+ val = true;
1064
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
1065
+ val = false;
1066
+ } else if (val === 'null') {
1067
+ val = null;
1068
+ } else {
1069
+ val = Number(val);
1070
+ }
1071
+
1072
+ obj[prop] = val;
1073
+ return obj;
1074
+ }, {});
1075
+
1076
+ /**
1077
+ * Is stdout a TTY? Colored output is enabled when `true`.
1078
+ */
1079
+
1080
+ function useColors() {
1081
+ return 'colors' in exports.inspectOpts ?
1082
+ Boolean(exports.inspectOpts.colors) :
1083
+ tty.isatty(process.stderr.fd);
1084
+ }
1085
+
1086
+ /**
1087
+ * Adds ANSI color escape codes if enabled.
1088
+ *
1089
+ * @api public
1090
+ */
1091
+
1092
+ function formatArgs(args) {
1093
+ const {namespace: name, useColors} = this;
1094
+
1095
+ if (useColors) {
1096
+ const c = this.color;
1097
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
1098
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
1099
+
1100
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
1101
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
1102
+ } else {
1103
+ args[0] = getDate() + name + ' ' + args[0];
1104
+ }
1105
+ }
1106
+
1107
+ function getDate() {
1108
+ if (exports.inspectOpts.hideDate) {
1109
+ return '';
1110
+ }
1111
+ return new Date().toISOString() + ' ';
1112
+ }
1113
+
1114
+ /**
1115
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
1116
+ */
1117
+
1118
+ function log(...args) {
1119
+ return process.stderr.write(util.format(...args) + '\n');
1120
+ }
1121
+
1122
+ /**
1123
+ * Save `namespaces`.
1124
+ *
1125
+ * @param {String} namespaces
1126
+ * @api private
1127
+ */
1128
+ function save(namespaces) {
1129
+ if (namespaces) {
1130
+ process.env.DEBUG = namespaces;
1131
+ } else {
1132
+ // If you set a process.env field to null or undefined, it gets cast to the
1133
+ // string 'null' or 'undefined'. Just delete instead.
1134
+ delete process.env.DEBUG;
1135
+ }
1136
+ }
1137
+
1138
+ /**
1139
+ * Load `namespaces`.
1140
+ *
1141
+ * @return {String} returns the previously persisted debug modes
1142
+ * @api private
1143
+ */
1144
+
1145
+ function load() {
1146
+ return process.env.DEBUG;
1147
+ }
1148
+
1149
+ /**
1150
+ * Init logic for `debug` instances.
1151
+ *
1152
+ * Create a new `inspectOpts` object in case `useColors` is set
1153
+ * differently for a particular `debug` instance.
1154
+ */
1155
+
1156
+ function init(debug) {
1157
+ debug.inspectOpts = {};
1158
+
1159
+ const keys = Object.keys(exports.inspectOpts);
1160
+ for (let i = 0; i < keys.length; i++) {
1161
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
1162
+ }
1163
+ }
1164
+
1165
+ module.exports = common(exports);
1166
+
1167
+ const {formatters} = module.exports;
1168
+
1169
+ /**
1170
+ * Map %o to `util.inspect()`, all on a single line.
1171
+ */
1172
+
1173
+ formatters.o = function (v) {
1174
+ this.inspectOpts.colors = this.useColors;
1175
+ return util.inspect(v, this.inspectOpts)
1176
+ .split('\n')
1177
+ .map(str => str.trim())
1178
+ .join(' ');
1179
+ };
1180
+
1181
+ /**
1182
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
1183
+ */
1184
+
1185
+ formatters.O = function (v) {
1186
+ this.inspectOpts.colors = this.useColors;
1187
+ return util.inspect(v, this.inspectOpts);
1188
+ };
1189
+ }(node, node.exports));
1190
+
1191
+ /**
1192
+ * Detect Electron renderer / nwjs process, which is node, but we should
1193
+ * treat as a browser.
1194
+ */
1195
+
1196
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
1197
+ src.exports = browser.exports;
1198
+ } else {
1199
+ src.exports = node.exports;
1200
+ }
1201
+
1202
+ var debug = src.exports;
1203
+
1204
+ var utils$3 = {};
1205
+
1206
+ const path$2 = path__default;
1207
+ const WIN_SLASH = '\\\\/';
1208
+ const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
1209
+
1210
+ /**
1211
+ * Posix glob regex
1212
+ */
1213
+
1214
+ const DOT_LITERAL = '\\.';
1215
+ const PLUS_LITERAL = '\\+';
1216
+ const QMARK_LITERAL = '\\?';
1217
+ const SLASH_LITERAL = '\\/';
1218
+ const ONE_CHAR = '(?=.)';
1219
+ const QMARK = '[^/]';
1220
+ const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
1221
+ const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
1222
+ const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
1223
+ const NO_DOT = `(?!${DOT_LITERAL})`;
1224
+ const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
1225
+ const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
1226
+ const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
1227
+ const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
1228
+ const STAR = `${QMARK}*?`;
1229
+
1230
+ const POSIX_CHARS = {
1231
+ DOT_LITERAL,
1232
+ PLUS_LITERAL,
1233
+ QMARK_LITERAL,
1234
+ SLASH_LITERAL,
1235
+ ONE_CHAR,
1236
+ QMARK,
1237
+ END_ANCHOR,
1238
+ DOTS_SLASH,
1239
+ NO_DOT,
1240
+ NO_DOTS,
1241
+ NO_DOT_SLASH,
1242
+ NO_DOTS_SLASH,
1243
+ QMARK_NO_DOT,
1244
+ STAR,
1245
+ START_ANCHOR
1246
+ };
1247
+
1248
+ /**
1249
+ * Windows glob regex
1250
+ */
1251
+
1252
+ const WINDOWS_CHARS = {
1253
+ ...POSIX_CHARS,
1254
+
1255
+ SLASH_LITERAL: `[${WIN_SLASH}]`,
1256
+ QMARK: WIN_NO_SLASH,
1257
+ STAR: `${WIN_NO_SLASH}*?`,
1258
+ DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
1259
+ NO_DOT: `(?!${DOT_LITERAL})`,
1260
+ NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1261
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
1262
+ NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
1263
+ QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
1264
+ START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
1265
+ END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
1266
+ };
1267
+
1268
+ /**
1269
+ * POSIX Bracket Regex
1270
+ */
1271
+
1272
+ const POSIX_REGEX_SOURCE$1 = {
1273
+ alnum: 'a-zA-Z0-9',
1274
+ alpha: 'a-zA-Z',
1275
+ ascii: '\\x00-\\x7F',
1276
+ blank: ' \\t',
1277
+ cntrl: '\\x00-\\x1F\\x7F',
1278
+ digit: '0-9',
1279
+ graph: '\\x21-\\x7E',
1280
+ lower: 'a-z',
1281
+ print: '\\x20-\\x7E ',
1282
+ punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
1283
+ space: ' \\t\\r\\n\\v\\f',
1284
+ upper: 'A-Z',
1285
+ word: 'A-Za-z0-9_',
1286
+ xdigit: 'A-Fa-f0-9'
1287
+ };
1288
+
1289
+ var constants$2 = {
1290
+ MAX_LENGTH: 1024 * 64,
1291
+ POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
1292
+
1293
+ // regular expressions
1294
+ REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
1295
+ REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
1296
+ REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
1297
+ REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
1298
+ REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
1299
+ REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
1300
+
1301
+ // Replace globs with equivalent patterns to reduce parsing time.
1302
+ REPLACEMENTS: {
1303
+ '***': '*',
1304
+ '**/**': '**',
1305
+ '**/**/**': '**'
1306
+ },
1307
+
1308
+ // Digits
1309
+ CHAR_0: 48, /* 0 */
1310
+ CHAR_9: 57, /* 9 */
1311
+
1312
+ // Alphabet chars.
1313
+ CHAR_UPPERCASE_A: 65, /* A */
1314
+ CHAR_LOWERCASE_A: 97, /* a */
1315
+ CHAR_UPPERCASE_Z: 90, /* Z */
1316
+ CHAR_LOWERCASE_Z: 122, /* z */
1317
+
1318
+ CHAR_LEFT_PARENTHESES: 40, /* ( */
1319
+ CHAR_RIGHT_PARENTHESES: 41, /* ) */
1320
+
1321
+ CHAR_ASTERISK: 42, /* * */
1322
+
1323
+ // Non-alphabetic chars.
1324
+ CHAR_AMPERSAND: 38, /* & */
1325
+ CHAR_AT: 64, /* @ */
1326
+ CHAR_BACKWARD_SLASH: 92, /* \ */
1327
+ CHAR_CARRIAGE_RETURN: 13, /* \r */
1328
+ CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
1329
+ CHAR_COLON: 58, /* : */
1330
+ CHAR_COMMA: 44, /* , */
1331
+ CHAR_DOT: 46, /* . */
1332
+ CHAR_DOUBLE_QUOTE: 34, /* " */
1333
+ CHAR_EQUAL: 61, /* = */
1334
+ CHAR_EXCLAMATION_MARK: 33, /* ! */
1335
+ CHAR_FORM_FEED: 12, /* \f */
1336
+ CHAR_FORWARD_SLASH: 47, /* / */
1337
+ CHAR_GRAVE_ACCENT: 96, /* ` */
1338
+ CHAR_HASH: 35, /* # */
1339
+ CHAR_HYPHEN_MINUS: 45, /* - */
1340
+ CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
1341
+ CHAR_LEFT_CURLY_BRACE: 123, /* { */
1342
+ CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
1343
+ CHAR_LINE_FEED: 10, /* \n */
1344
+ CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
1345
+ CHAR_PERCENT: 37, /* % */
1346
+ CHAR_PLUS: 43, /* + */
1347
+ CHAR_QUESTION_MARK: 63, /* ? */
1348
+ CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
1349
+ CHAR_RIGHT_CURLY_BRACE: 125, /* } */
1350
+ CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
1351
+ CHAR_SEMICOLON: 59, /* ; */
1352
+ CHAR_SINGLE_QUOTE: 39, /* ' */
1353
+ CHAR_SPACE: 32, /* */
1354
+ CHAR_TAB: 9, /* \t */
1355
+ CHAR_UNDERSCORE: 95, /* _ */
1356
+ CHAR_VERTICAL_LINE: 124, /* | */
1357
+ CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
1358
+
1359
+ SEP: path$2.sep,
1360
+
1361
+ /**
1362
+ * Create EXTGLOB_CHARS
1363
+ */
1364
+
1365
+ extglobChars(chars) {
1366
+ return {
1367
+ '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
1368
+ '?': { type: 'qmark', open: '(?:', close: ')?' },
1369
+ '+': { type: 'plus', open: '(?:', close: ')+' },
1370
+ '*': { type: 'star', open: '(?:', close: ')*' },
1371
+ '@': { type: 'at', open: '(?:', close: ')' }
1372
+ };
1373
+ },
1374
+
1375
+ /**
1376
+ * Create GLOB_CHARS
1377
+ */
1378
+
1379
+ globChars(win32) {
1380
+ return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
1381
+ }
1382
+ };
1383
+
1384
+ (function (exports) {
1385
+
1386
+ const path = path__default;
1387
+ const win32 = process.platform === 'win32';
1388
+ const {
1389
+ REGEX_BACKSLASH,
1390
+ REGEX_REMOVE_BACKSLASH,
1391
+ REGEX_SPECIAL_CHARS,
1392
+ REGEX_SPECIAL_CHARS_GLOBAL
1393
+ } = constants$2;
1394
+
1395
+ exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
1396
+ exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
1397
+ exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
1398
+ exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
1399
+ exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
1400
+
1401
+ exports.removeBackslashes = str => {
1402
+ return str.replace(REGEX_REMOVE_BACKSLASH, match => {
1403
+ return match === '\\' ? '' : match;
1404
+ });
1405
+ };
1406
+
1407
+ exports.supportsLookbehinds = () => {
1408
+ const segs = process.version.slice(1).split('.').map(Number);
1409
+ if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
1410
+ return true;
1411
+ }
1412
+ return false;
1413
+ };
1414
+
1415
+ exports.isWindows = options => {
1416
+ if (options && typeof options.windows === 'boolean') {
1417
+ return options.windows;
1418
+ }
1419
+ return win32 === true || path.sep === '\\';
1420
+ };
1421
+
1422
+ exports.escapeLast = (input, char, lastIdx) => {
1423
+ const idx = input.lastIndexOf(char, lastIdx);
1424
+ if (idx === -1) return input;
1425
+ if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
1426
+ return `${input.slice(0, idx)}\\${input.slice(idx)}`;
1427
+ };
1428
+
1429
+ exports.removePrefix = (input, state = {}) => {
1430
+ let output = input;
1431
+ if (output.startsWith('./')) {
1432
+ output = output.slice(2);
1433
+ state.prefix = './';
1434
+ }
1435
+ return output;
1436
+ };
1437
+
1438
+ exports.wrapOutput = (input, state = {}, options = {}) => {
1439
+ const prepend = options.contains ? '' : '^';
1440
+ const append = options.contains ? '' : '$';
1441
+
1442
+ let output = `${prepend}(?:${input})${append}`;
1443
+ if (state.negated === true) {
1444
+ output = `(?:^(?!${output}).*$)`;
1445
+ }
1446
+ return output;
1447
+ };
1448
+ }(utils$3));
1449
+
1450
+ const utils$2 = utils$3;
1451
+ const {
1452
+ CHAR_ASTERISK, /* * */
1453
+ CHAR_AT, /* @ */
1454
+ CHAR_BACKWARD_SLASH, /* \ */
1455
+ CHAR_COMMA, /* , */
1456
+ CHAR_DOT, /* . */
1457
+ CHAR_EXCLAMATION_MARK, /* ! */
1458
+ CHAR_FORWARD_SLASH, /* / */
1459
+ CHAR_LEFT_CURLY_BRACE, /* { */
1460
+ CHAR_LEFT_PARENTHESES, /* ( */
1461
+ CHAR_LEFT_SQUARE_BRACKET, /* [ */
1462
+ CHAR_PLUS, /* + */
1463
+ CHAR_QUESTION_MARK, /* ? */
1464
+ CHAR_RIGHT_CURLY_BRACE, /* } */
1465
+ CHAR_RIGHT_PARENTHESES, /* ) */
1466
+ CHAR_RIGHT_SQUARE_BRACKET /* ] */
1467
+ } = constants$2;
1468
+
1469
+ const isPathSeparator = code => {
1470
+ return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
1471
+ };
1472
+
1473
+ const depth = token => {
1474
+ if (token.isPrefix !== true) {
1475
+ token.depth = token.isGlobstar ? Infinity : 1;
1476
+ }
1477
+ };
1478
+
1479
+ /**
1480
+ * Quickly scans a glob pattern and returns an object with a handful of
1481
+ * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
1482
+ * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
1483
+ * with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
1484
+ *
1485
+ * ```js
1486
+ * const pm = require('picomatch');
1487
+ * console.log(pm.scan('foo/bar/*.js'));
1488
+ * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
1489
+ * ```
1490
+ * @param {String} `str`
1491
+ * @param {Object} `options`
1492
+ * @return {Object} Returns an object with tokens and regex source string.
1493
+ * @api public
1494
+ */
1495
+
1496
+ const scan$1 = (input, options) => {
1497
+ const opts = options || {};
1498
+
1499
+ const length = input.length - 1;
1500
+ const scanToEnd = opts.parts === true || opts.scanToEnd === true;
1501
+ const slashes = [];
1502
+ const tokens = [];
1503
+ const parts = [];
1504
+
1505
+ let str = input;
1506
+ let index = -1;
1507
+ let start = 0;
1508
+ let lastIndex = 0;
1509
+ let isBrace = false;
1510
+ let isBracket = false;
1511
+ let isGlob = false;
1512
+ let isExtglob = false;
1513
+ let isGlobstar = false;
1514
+ let braceEscaped = false;
1515
+ let backslashes = false;
1516
+ let negated = false;
1517
+ let negatedExtglob = false;
1518
+ let finished = false;
1519
+ let braces = 0;
1520
+ let prev;
1521
+ let code;
1522
+ let token = { value: '', depth: 0, isGlob: false };
1523
+
1524
+ const eos = () => index >= length;
1525
+ const peek = () => str.charCodeAt(index + 1);
1526
+ const advance = () => {
1527
+ prev = code;
1528
+ return str.charCodeAt(++index);
1529
+ };
1530
+
1531
+ while (index < length) {
1532
+ code = advance();
1533
+ let next;
1534
+
1535
+ if (code === CHAR_BACKWARD_SLASH) {
1536
+ backslashes = token.backslashes = true;
1537
+ code = advance();
1538
+
1539
+ if (code === CHAR_LEFT_CURLY_BRACE) {
1540
+ braceEscaped = true;
1541
+ }
1542
+ continue;
1543
+ }
1544
+
1545
+ if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
1546
+ braces++;
1547
+
1548
+ while (eos() !== true && (code = advance())) {
1549
+ if (code === CHAR_BACKWARD_SLASH) {
1550
+ backslashes = token.backslashes = true;
1551
+ advance();
1552
+ continue;
1553
+ }
1554
+
1555
+ if (code === CHAR_LEFT_CURLY_BRACE) {
1556
+ braces++;
1557
+ continue;
1558
+ }
1559
+
1560
+ if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
1561
+ isBrace = token.isBrace = true;
1562
+ isGlob = token.isGlob = true;
1563
+ finished = true;
1564
+
1565
+ if (scanToEnd === true) {
1566
+ continue;
1567
+ }
1568
+
1569
+ break;
1570
+ }
1571
+
1572
+ if (braceEscaped !== true && code === CHAR_COMMA) {
1573
+ isBrace = token.isBrace = true;
1574
+ isGlob = token.isGlob = true;
1575
+ finished = true;
1576
+
1577
+ if (scanToEnd === true) {
1578
+ continue;
1579
+ }
1580
+
1581
+ break;
1582
+ }
1583
+
1584
+ if (code === CHAR_RIGHT_CURLY_BRACE) {
1585
+ braces--;
1586
+
1587
+ if (braces === 0) {
1588
+ braceEscaped = false;
1589
+ isBrace = token.isBrace = true;
1590
+ finished = true;
1591
+ break;
1592
+ }
1593
+ }
1594
+ }
1595
+
1596
+ if (scanToEnd === true) {
1597
+ continue;
1598
+ }
1599
+
1600
+ break;
1601
+ }
1602
+
1603
+ if (code === CHAR_FORWARD_SLASH) {
1604
+ slashes.push(index);
1605
+ tokens.push(token);
1606
+ token = { value: '', depth: 0, isGlob: false };
1607
+
1608
+ if (finished === true) continue;
1609
+ if (prev === CHAR_DOT && index === (start + 1)) {
1610
+ start += 2;
1611
+ continue;
1612
+ }
1613
+
1614
+ lastIndex = index + 1;
1615
+ continue;
1616
+ }
1617
+
1618
+ if (opts.noext !== true) {
1619
+ const isExtglobChar = code === CHAR_PLUS
1620
+ || code === CHAR_AT
1621
+ || code === CHAR_ASTERISK
1622
+ || code === CHAR_QUESTION_MARK
1623
+ || code === CHAR_EXCLAMATION_MARK;
1624
+
1625
+ if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
1626
+ isGlob = token.isGlob = true;
1627
+ isExtglob = token.isExtglob = true;
1628
+ finished = true;
1629
+ if (code === CHAR_EXCLAMATION_MARK && index === start) {
1630
+ negatedExtglob = true;
1631
+ }
1632
+
1633
+ if (scanToEnd === true) {
1634
+ while (eos() !== true && (code = advance())) {
1635
+ if (code === CHAR_BACKWARD_SLASH) {
1636
+ backslashes = token.backslashes = true;
1637
+ code = advance();
1638
+ continue;
1639
+ }
1640
+
1641
+ if (code === CHAR_RIGHT_PARENTHESES) {
1642
+ isGlob = token.isGlob = true;
1643
+ finished = true;
1644
+ break;
1645
+ }
1646
+ }
1647
+ continue;
1648
+ }
1649
+ break;
1650
+ }
1651
+ }
1652
+
1653
+ if (code === CHAR_ASTERISK) {
1654
+ if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
1655
+ isGlob = token.isGlob = true;
1656
+ finished = true;
1657
+
1658
+ if (scanToEnd === true) {
1659
+ continue;
1660
+ }
1661
+ break;
1662
+ }
1663
+
1664
+ if (code === CHAR_QUESTION_MARK) {
1665
+ isGlob = token.isGlob = true;
1666
+ finished = true;
1667
+
1668
+ if (scanToEnd === true) {
1669
+ continue;
1670
+ }
1671
+ break;
1672
+ }
1673
+
1674
+ if (code === CHAR_LEFT_SQUARE_BRACKET) {
1675
+ while (eos() !== true && (next = advance())) {
1676
+ if (next === CHAR_BACKWARD_SLASH) {
1677
+ backslashes = token.backslashes = true;
1678
+ advance();
1679
+ continue;
1680
+ }
1681
+
1682
+ if (next === CHAR_RIGHT_SQUARE_BRACKET) {
1683
+ isBracket = token.isBracket = true;
1684
+ isGlob = token.isGlob = true;
1685
+ finished = true;
1686
+ break;
1687
+ }
1688
+ }
1689
+
1690
+ if (scanToEnd === true) {
1691
+ continue;
1692
+ }
1693
+
1694
+ break;
1695
+ }
1696
+
1697
+ if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
1698
+ negated = token.negated = true;
1699
+ start++;
1700
+ continue;
1701
+ }
1702
+
1703
+ if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
1704
+ isGlob = token.isGlob = true;
1705
+
1706
+ if (scanToEnd === true) {
1707
+ while (eos() !== true && (code = advance())) {
1708
+ if (code === CHAR_LEFT_PARENTHESES) {
1709
+ backslashes = token.backslashes = true;
1710
+ code = advance();
1711
+ continue;
1712
+ }
1713
+
1714
+ if (code === CHAR_RIGHT_PARENTHESES) {
1715
+ finished = true;
1716
+ break;
1717
+ }
1718
+ }
1719
+ continue;
1720
+ }
1721
+ break;
1722
+ }
1723
+
1724
+ if (isGlob === true) {
1725
+ finished = true;
1726
+
1727
+ if (scanToEnd === true) {
1728
+ continue;
1729
+ }
1730
+
1731
+ break;
1732
+ }
1733
+ }
1734
+
1735
+ if (opts.noext === true) {
1736
+ isExtglob = false;
1737
+ isGlob = false;
1738
+ }
1739
+
1740
+ let base = str;
1741
+ let prefix = '';
1742
+ let glob = '';
1743
+
1744
+ if (start > 0) {
1745
+ prefix = str.slice(0, start);
1746
+ str = str.slice(start);
1747
+ lastIndex -= start;
1748
+ }
1749
+
1750
+ if (base && isGlob === true && lastIndex > 0) {
1751
+ base = str.slice(0, lastIndex);
1752
+ glob = str.slice(lastIndex);
1753
+ } else if (isGlob === true) {
1754
+ base = '';
1755
+ glob = str;
1756
+ } else {
1757
+ base = str;
1758
+ }
1759
+
1760
+ if (base && base !== '' && base !== '/' && base !== str) {
1761
+ if (isPathSeparator(base.charCodeAt(base.length - 1))) {
1762
+ base = base.slice(0, -1);
1763
+ }
1764
+ }
1765
+
1766
+ if (opts.unescape === true) {
1767
+ if (glob) glob = utils$2.removeBackslashes(glob);
1768
+
1769
+ if (base && backslashes === true) {
1770
+ base = utils$2.removeBackslashes(base);
1771
+ }
1772
+ }
1773
+
1774
+ const state = {
1775
+ prefix,
1776
+ input,
1777
+ start,
1778
+ base,
1779
+ glob,
1780
+ isBrace,
1781
+ isBracket,
1782
+ isGlob,
1783
+ isExtglob,
1784
+ isGlobstar,
1785
+ negated,
1786
+ negatedExtglob
1787
+ };
1788
+
1789
+ if (opts.tokens === true) {
1790
+ state.maxDepth = 0;
1791
+ if (!isPathSeparator(code)) {
1792
+ tokens.push(token);
1793
+ }
1794
+ state.tokens = tokens;
1795
+ }
1796
+
1797
+ if (opts.parts === true || opts.tokens === true) {
1798
+ let prevIndex;
1799
+
1800
+ for (let idx = 0; idx < slashes.length; idx++) {
1801
+ const n = prevIndex ? prevIndex + 1 : start;
1802
+ const i = slashes[idx];
1803
+ const value = input.slice(n, i);
1804
+ if (opts.tokens) {
1805
+ if (idx === 0 && start !== 0) {
1806
+ tokens[idx].isPrefix = true;
1807
+ tokens[idx].value = prefix;
1808
+ } else {
1809
+ tokens[idx].value = value;
1810
+ }
1811
+ depth(tokens[idx]);
1812
+ state.maxDepth += tokens[idx].depth;
1813
+ }
1814
+ if (idx !== 0 || value !== '') {
1815
+ parts.push(value);
1816
+ }
1817
+ prevIndex = i;
1818
+ }
1819
+
1820
+ if (prevIndex && prevIndex + 1 < input.length) {
1821
+ const value = input.slice(prevIndex + 1);
1822
+ parts.push(value);
1823
+
1824
+ if (opts.tokens) {
1825
+ tokens[tokens.length - 1].value = value;
1826
+ depth(tokens[tokens.length - 1]);
1827
+ state.maxDepth += tokens[tokens.length - 1].depth;
1828
+ }
1829
+ }
1830
+
1831
+ state.slashes = slashes;
1832
+ state.parts = parts;
1833
+ }
1834
+
1835
+ return state;
1836
+ };
1837
+
1838
+ var scan_1 = scan$1;
1839
+
1840
+ const constants$1 = constants$2;
1841
+ const utils$1 = utils$3;
1842
+
1843
+ /**
1844
+ * Constants
1845
+ */
1846
+
1847
+ const {
1848
+ MAX_LENGTH,
1849
+ POSIX_REGEX_SOURCE,
1850
+ REGEX_NON_SPECIAL_CHARS,
1851
+ REGEX_SPECIAL_CHARS_BACKREF,
1852
+ REPLACEMENTS
1853
+ } = constants$1;
1854
+
1855
+ /**
1856
+ * Helpers
1857
+ */
1858
+
1859
+ const expandRange = (args, options) => {
1860
+ if (typeof options.expandRange === 'function') {
1861
+ return options.expandRange(...args, options);
1862
+ }
1863
+
1864
+ args.sort();
1865
+ const value = `[${args.join('-')}]`;
1866
+
1867
+ return value;
1868
+ };
1869
+
1870
+ /**
1871
+ * Create the message for a syntax error
1872
+ */
1873
+
1874
+ const syntaxError = (type, char) => {
1875
+ return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
1876
+ };
1877
+
1878
+ /**
1879
+ * Parse the given input string.
1880
+ * @param {String} input
1881
+ * @param {Object} options
1882
+ * @return {Object}
1883
+ */
1884
+
1885
+ const parse$2 = (input, options) => {
1886
+ if (typeof input !== 'string') {
1887
+ throw new TypeError('Expected a string');
1888
+ }
1889
+
1890
+ input = REPLACEMENTS[input] || input;
1891
+
1892
+ const opts = { ...options };
1893
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
1894
+
1895
+ let len = input.length;
1896
+ if (len > max) {
1897
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
1898
+ }
1899
+
1900
+ const bos = { type: 'bos', value: '', output: opts.prepend || '' };
1901
+ const tokens = [bos];
1902
+
1903
+ const capture = opts.capture ? '' : '?:';
1904
+ const win32 = utils$1.isWindows(options);
1905
+
1906
+ // create constants based on platform, for windows or posix
1907
+ const PLATFORM_CHARS = constants$1.globChars(win32);
1908
+ const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
1909
+
1910
+ const {
1911
+ DOT_LITERAL,
1912
+ PLUS_LITERAL,
1913
+ SLASH_LITERAL,
1914
+ ONE_CHAR,
1915
+ DOTS_SLASH,
1916
+ NO_DOT,
1917
+ NO_DOT_SLASH,
1918
+ NO_DOTS_SLASH,
1919
+ QMARK,
1920
+ QMARK_NO_DOT,
1921
+ STAR,
1922
+ START_ANCHOR
1923
+ } = PLATFORM_CHARS;
1924
+
1925
+ const globstar = opts => {
1926
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
1927
+ };
1928
+
1929
+ const nodot = opts.dot ? '' : NO_DOT;
1930
+ const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
1931
+ let star = opts.bash === true ? globstar(opts) : STAR;
1932
+
1933
+ if (opts.capture) {
1934
+ star = `(${star})`;
1935
+ }
1936
+
1937
+ // minimatch options support
1938
+ if (typeof opts.noext === 'boolean') {
1939
+ opts.noextglob = opts.noext;
1940
+ }
1941
+
1942
+ const state = {
1943
+ input,
1944
+ index: -1,
1945
+ start: 0,
1946
+ dot: opts.dot === true,
1947
+ consumed: '',
1948
+ output: '',
1949
+ prefix: '',
1950
+ backtrack: false,
1951
+ negated: false,
1952
+ brackets: 0,
1953
+ braces: 0,
1954
+ parens: 0,
1955
+ quotes: 0,
1956
+ globstar: false,
1957
+ tokens
1958
+ };
1959
+
1960
+ input = utils$1.removePrefix(input, state);
1961
+ len = input.length;
1962
+
1963
+ const extglobs = [];
1964
+ const braces = [];
1965
+ const stack = [];
1966
+ let prev = bos;
1967
+ let value;
1968
+
1969
+ /**
1970
+ * Tokenizing helpers
1971
+ */
1972
+
1973
+ const eos = () => state.index === len - 1;
1974
+ const peek = state.peek = (n = 1) => input[state.index + n];
1975
+ const advance = state.advance = () => input[++state.index] || '';
1976
+ const remaining = () => input.slice(state.index + 1);
1977
+ const consume = (value = '', num = 0) => {
1978
+ state.consumed += value;
1979
+ state.index += num;
1980
+ };
1981
+
1982
+ const append = token => {
1983
+ state.output += token.output != null ? token.output : token.value;
1984
+ consume(token.value);
1985
+ };
1986
+
1987
+ const negate = () => {
1988
+ let count = 1;
1989
+
1990
+ while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
1991
+ advance();
1992
+ state.start++;
1993
+ count++;
1994
+ }
1995
+
1996
+ if (count % 2 === 0) {
1997
+ return false;
1998
+ }
1999
+
2000
+ state.negated = true;
2001
+ state.start++;
2002
+ return true;
2003
+ };
2004
+
2005
+ const increment = type => {
2006
+ state[type]++;
2007
+ stack.push(type);
2008
+ };
2009
+
2010
+ const decrement = type => {
2011
+ state[type]--;
2012
+ stack.pop();
2013
+ };
2014
+
2015
+ /**
2016
+ * Push tokens onto the tokens array. This helper speeds up
2017
+ * tokenizing by 1) helping us avoid backtracking as much as possible,
2018
+ * and 2) helping us avoid creating extra tokens when consecutive
2019
+ * characters are plain text. This improves performance and simplifies
2020
+ * lookbehinds.
2021
+ */
2022
+
2023
+ const push = tok => {
2024
+ if (prev.type === 'globstar') {
2025
+ const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
2026
+ const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
2027
+
2028
+ if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
2029
+ state.output = state.output.slice(0, -prev.output.length);
2030
+ prev.type = 'star';
2031
+ prev.value = '*';
2032
+ prev.output = star;
2033
+ state.output += prev.output;
2034
+ }
2035
+ }
2036
+
2037
+ if (extglobs.length && tok.type !== 'paren') {
2038
+ extglobs[extglobs.length - 1].inner += tok.value;
2039
+ }
2040
+
2041
+ if (tok.value || tok.output) append(tok);
2042
+ if (prev && prev.type === 'text' && tok.type === 'text') {
2043
+ prev.value += tok.value;
2044
+ prev.output = (prev.output || '') + tok.value;
2045
+ return;
2046
+ }
2047
+
2048
+ tok.prev = prev;
2049
+ tokens.push(tok);
2050
+ prev = tok;
2051
+ };
2052
+
2053
+ const extglobOpen = (type, value) => {
2054
+ const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
2055
+
2056
+ token.prev = prev;
2057
+ token.parens = state.parens;
2058
+ token.output = state.output;
2059
+ const output = (opts.capture ? '(' : '') + token.open;
2060
+
2061
+ increment('parens');
2062
+ push({ type, value, output: state.output ? '' : ONE_CHAR });
2063
+ push({ type: 'paren', extglob: true, value: advance(), output });
2064
+ extglobs.push(token);
2065
+ };
2066
+
2067
+ const extglobClose = token => {
2068
+ let output = token.close + (opts.capture ? ')' : '');
2069
+ let rest;
2070
+
2071
+ if (token.type === 'negate') {
2072
+ let extglobStar = star;
2073
+
2074
+ if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
2075
+ extglobStar = globstar(opts);
2076
+ }
2077
+
2078
+ if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
2079
+ output = token.close = `)$))${extglobStar}`;
2080
+ }
2081
+
2082
+ if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
2083
+ // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
2084
+ // In this case, we need to parse the string and use it in the output of the original pattern.
2085
+ // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
2086
+ //
2087
+ // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
2088
+ const expression = parse$2(rest, { ...options, fastpaths: false }).output;
2089
+
2090
+ output = token.close = `)${expression})${extglobStar})`;
2091
+ }
2092
+
2093
+ if (token.prev.type === 'bos') {
2094
+ state.negatedExtglob = true;
2095
+ }
2096
+ }
2097
+
2098
+ push({ type: 'paren', extglob: true, value, output });
2099
+ decrement('parens');
2100
+ };
2101
+
2102
+ /**
2103
+ * Fast paths
2104
+ */
2105
+
2106
+ if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
2107
+ let backslashes = false;
2108
+
2109
+ let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
2110
+ if (first === '\\') {
2111
+ backslashes = true;
2112
+ return m;
2113
+ }
2114
+
2115
+ if (first === '?') {
2116
+ if (esc) {
2117
+ return esc + first + (rest ? QMARK.repeat(rest.length) : '');
2118
+ }
2119
+ if (index === 0) {
2120
+ return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
2121
+ }
2122
+ return QMARK.repeat(chars.length);
2123
+ }
2124
+
2125
+ if (first === '.') {
2126
+ return DOT_LITERAL.repeat(chars.length);
2127
+ }
2128
+
2129
+ if (first === '*') {
2130
+ if (esc) {
2131
+ return esc + first + (rest ? star : '');
2132
+ }
2133
+ return star;
2134
+ }
2135
+ return esc ? m : `\\${m}`;
2136
+ });
2137
+
2138
+ if (backslashes === true) {
2139
+ if (opts.unescape === true) {
2140
+ output = output.replace(/\\/g, '');
2141
+ } else {
2142
+ output = output.replace(/\\+/g, m => {
2143
+ return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
2144
+ });
2145
+ }
2146
+ }
2147
+
2148
+ if (output === input && opts.contains === true) {
2149
+ state.output = input;
2150
+ return state;
2151
+ }
2152
+
2153
+ state.output = utils$1.wrapOutput(output, state, options);
2154
+ return state;
2155
+ }
2156
+
2157
+ /**
2158
+ * Tokenize input until we reach end-of-string
2159
+ */
2160
+
2161
+ while (!eos()) {
2162
+ value = advance();
2163
+
2164
+ if (value === '\u0000') {
2165
+ continue;
2166
+ }
2167
+
2168
+ /**
2169
+ * Escaped characters
2170
+ */
2171
+
2172
+ if (value === '\\') {
2173
+ const next = peek();
2174
+
2175
+ if (next === '/' && opts.bash !== true) {
2176
+ continue;
2177
+ }
2178
+
2179
+ if (next === '.' || next === ';') {
2180
+ continue;
2181
+ }
2182
+
2183
+ if (!next) {
2184
+ value += '\\';
2185
+ push({ type: 'text', value });
2186
+ continue;
2187
+ }
2188
+
2189
+ // collapse slashes to reduce potential for exploits
2190
+ const match = /^\\+/.exec(remaining());
2191
+ let slashes = 0;
2192
+
2193
+ if (match && match[0].length > 2) {
2194
+ slashes = match[0].length;
2195
+ state.index += slashes;
2196
+ if (slashes % 2 !== 0) {
2197
+ value += '\\';
2198
+ }
2199
+ }
2200
+
2201
+ if (opts.unescape === true) {
2202
+ value = advance();
2203
+ } else {
2204
+ value += advance();
2205
+ }
2206
+
2207
+ if (state.brackets === 0) {
2208
+ push({ type: 'text', value });
2209
+ continue;
2210
+ }
2211
+ }
2212
+
2213
+ /**
2214
+ * If we're inside a regex character class, continue
2215
+ * until we reach the closing bracket.
2216
+ */
2217
+
2218
+ if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
2219
+ if (opts.posix !== false && value === ':') {
2220
+ const inner = prev.value.slice(1);
2221
+ if (inner.includes('[')) {
2222
+ prev.posix = true;
2223
+
2224
+ if (inner.includes(':')) {
2225
+ const idx = prev.value.lastIndexOf('[');
2226
+ const pre = prev.value.slice(0, idx);
2227
+ const rest = prev.value.slice(idx + 2);
2228
+ const posix = POSIX_REGEX_SOURCE[rest];
2229
+ if (posix) {
2230
+ prev.value = pre + posix;
2231
+ state.backtrack = true;
2232
+ advance();
2233
+
2234
+ if (!bos.output && tokens.indexOf(prev) === 1) {
2235
+ bos.output = ONE_CHAR;
2236
+ }
2237
+ continue;
2238
+ }
2239
+ }
2240
+ }
2241
+ }
2242
+
2243
+ if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
2244
+ value = `\\${value}`;
2245
+ }
2246
+
2247
+ if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
2248
+ value = `\\${value}`;
2249
+ }
2250
+
2251
+ if (opts.posix === true && value === '!' && prev.value === '[') {
2252
+ value = '^';
2253
+ }
2254
+
2255
+ prev.value += value;
2256
+ append({ value });
2257
+ continue;
2258
+ }
2259
+
2260
+ /**
2261
+ * If we're inside a quoted string, continue
2262
+ * until we reach the closing double quote.
2263
+ */
2264
+
2265
+ if (state.quotes === 1 && value !== '"') {
2266
+ value = utils$1.escapeRegex(value);
2267
+ prev.value += value;
2268
+ append({ value });
2269
+ continue;
2270
+ }
2271
+
2272
+ /**
2273
+ * Double quotes
2274
+ */
2275
+
2276
+ if (value === '"') {
2277
+ state.quotes = state.quotes === 1 ? 0 : 1;
2278
+ if (opts.keepQuotes === true) {
2279
+ push({ type: 'text', value });
2280
+ }
2281
+ continue;
2282
+ }
2283
+
2284
+ /**
2285
+ * Parentheses
2286
+ */
2287
+
2288
+ if (value === '(') {
2289
+ increment('parens');
2290
+ push({ type: 'paren', value });
2291
+ continue;
2292
+ }
2293
+
2294
+ if (value === ')') {
2295
+ if (state.parens === 0 && opts.strictBrackets === true) {
2296
+ throw new SyntaxError(syntaxError('opening', '('));
2297
+ }
2298
+
2299
+ const extglob = extglobs[extglobs.length - 1];
2300
+ if (extglob && state.parens === extglob.parens + 1) {
2301
+ extglobClose(extglobs.pop());
2302
+ continue;
2303
+ }
2304
+
2305
+ push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
2306
+ decrement('parens');
2307
+ continue;
2308
+ }
2309
+
2310
+ /**
2311
+ * Square brackets
2312
+ */
2313
+
2314
+ if (value === '[') {
2315
+ if (opts.nobracket === true || !remaining().includes(']')) {
2316
+ if (opts.nobracket !== true && opts.strictBrackets === true) {
2317
+ throw new SyntaxError(syntaxError('closing', ']'));
2318
+ }
2319
+
2320
+ value = `\\${value}`;
2321
+ } else {
2322
+ increment('brackets');
2323
+ }
2324
+
2325
+ push({ type: 'bracket', value });
2326
+ continue;
2327
+ }
2328
+
2329
+ if (value === ']') {
2330
+ if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
2331
+ push({ type: 'text', value, output: `\\${value}` });
2332
+ continue;
2333
+ }
2334
+
2335
+ if (state.brackets === 0) {
2336
+ if (opts.strictBrackets === true) {
2337
+ throw new SyntaxError(syntaxError('opening', '['));
2338
+ }
2339
+
2340
+ push({ type: 'text', value, output: `\\${value}` });
2341
+ continue;
2342
+ }
2343
+
2344
+ decrement('brackets');
2345
+
2346
+ const prevValue = prev.value.slice(1);
2347
+ if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
2348
+ value = `/${value}`;
2349
+ }
2350
+
2351
+ prev.value += value;
2352
+ append({ value });
2353
+
2354
+ // when literal brackets are explicitly disabled
2355
+ // assume we should match with a regex character class
2356
+ if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
2357
+ continue;
2358
+ }
2359
+
2360
+ const escaped = utils$1.escapeRegex(prev.value);
2361
+ state.output = state.output.slice(0, -prev.value.length);
2362
+
2363
+ // when literal brackets are explicitly enabled
2364
+ // assume we should escape the brackets to match literal characters
2365
+ if (opts.literalBrackets === true) {
2366
+ state.output += escaped;
2367
+ prev.value = escaped;
2368
+ continue;
2369
+ }
2370
+
2371
+ // when the user specifies nothing, try to match both
2372
+ prev.value = `(${capture}${escaped}|${prev.value})`;
2373
+ state.output += prev.value;
2374
+ continue;
2375
+ }
2376
+
2377
+ /**
2378
+ * Braces
2379
+ */
2380
+
2381
+ if (value === '{' && opts.nobrace !== true) {
2382
+ increment('braces');
2383
+
2384
+ const open = {
2385
+ type: 'brace',
2386
+ value,
2387
+ output: '(',
2388
+ outputIndex: state.output.length,
2389
+ tokensIndex: state.tokens.length
2390
+ };
2391
+
2392
+ braces.push(open);
2393
+ push(open);
2394
+ continue;
2395
+ }
2396
+
2397
+ if (value === '}') {
2398
+ const brace = braces[braces.length - 1];
2399
+
2400
+ if (opts.nobrace === true || !brace) {
2401
+ push({ type: 'text', value, output: value });
2402
+ continue;
2403
+ }
2404
+
2405
+ let output = ')';
2406
+
2407
+ if (brace.dots === true) {
2408
+ const arr = tokens.slice();
2409
+ const range = [];
2410
+
2411
+ for (let i = arr.length - 1; i >= 0; i--) {
2412
+ tokens.pop();
2413
+ if (arr[i].type === 'brace') {
2414
+ break;
2415
+ }
2416
+ if (arr[i].type !== 'dots') {
2417
+ range.unshift(arr[i].value);
2418
+ }
2419
+ }
2420
+
2421
+ output = expandRange(range, opts);
2422
+ state.backtrack = true;
2423
+ }
2424
+
2425
+ if (brace.comma !== true && brace.dots !== true) {
2426
+ const out = state.output.slice(0, brace.outputIndex);
2427
+ const toks = state.tokens.slice(brace.tokensIndex);
2428
+ brace.value = brace.output = '\\{';
2429
+ value = output = '\\}';
2430
+ state.output = out;
2431
+ for (const t of toks) {
2432
+ state.output += (t.output || t.value);
2433
+ }
2434
+ }
2435
+
2436
+ push({ type: 'brace', value, output });
2437
+ decrement('braces');
2438
+ braces.pop();
2439
+ continue;
2440
+ }
2441
+
2442
+ /**
2443
+ * Pipes
2444
+ */
2445
+
2446
+ if (value === '|') {
2447
+ if (extglobs.length > 0) {
2448
+ extglobs[extglobs.length - 1].conditions++;
2449
+ }
2450
+ push({ type: 'text', value });
2451
+ continue;
2452
+ }
2453
+
2454
+ /**
2455
+ * Commas
2456
+ */
2457
+
2458
+ if (value === ',') {
2459
+ let output = value;
2460
+
2461
+ const brace = braces[braces.length - 1];
2462
+ if (brace && stack[stack.length - 1] === 'braces') {
2463
+ brace.comma = true;
2464
+ output = '|';
2465
+ }
2466
+
2467
+ push({ type: 'comma', value, output });
2468
+ continue;
2469
+ }
2470
+
2471
+ /**
2472
+ * Slashes
2473
+ */
2474
+
2475
+ if (value === '/') {
2476
+ // if the beginning of the glob is "./", advance the start
2477
+ // to the current index, and don't add the "./" characters
2478
+ // to the state. This greatly simplifies lookbehinds when
2479
+ // checking for BOS characters like "!" and "." (not "./")
2480
+ if (prev.type === 'dot' && state.index === state.start + 1) {
2481
+ state.start = state.index + 1;
2482
+ state.consumed = '';
2483
+ state.output = '';
2484
+ tokens.pop();
2485
+ prev = bos; // reset "prev" to the first token
2486
+ continue;
2487
+ }
2488
+
2489
+ push({ type: 'slash', value, output: SLASH_LITERAL });
2490
+ continue;
2491
+ }
2492
+
2493
+ /**
2494
+ * Dots
2495
+ */
2496
+
2497
+ if (value === '.') {
2498
+ if (state.braces > 0 && prev.type === 'dot') {
2499
+ if (prev.value === '.') prev.output = DOT_LITERAL;
2500
+ const brace = braces[braces.length - 1];
2501
+ prev.type = 'dots';
2502
+ prev.output += value;
2503
+ prev.value += value;
2504
+ brace.dots = true;
2505
+ continue;
2506
+ }
2507
+
2508
+ if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
2509
+ push({ type: 'text', value, output: DOT_LITERAL });
2510
+ continue;
2511
+ }
2512
+
2513
+ push({ type: 'dot', value, output: DOT_LITERAL });
2514
+ continue;
2515
+ }
2516
+
2517
+ /**
2518
+ * Question marks
2519
+ */
2520
+
2521
+ if (value === '?') {
2522
+ const isGroup = prev && prev.value === '(';
2523
+ if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
2524
+ extglobOpen('qmark', value);
2525
+ continue;
2526
+ }
2527
+
2528
+ if (prev && prev.type === 'paren') {
2529
+ const next = peek();
2530
+ let output = value;
2531
+
2532
+ if (next === '<' && !utils$1.supportsLookbehinds()) {
2533
+ throw new Error('Node.js v10 or higher is required for regex lookbehinds');
2534
+ }
2535
+
2536
+ if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
2537
+ output = `\\${value}`;
2538
+ }
2539
+
2540
+ push({ type: 'text', value, output });
2541
+ continue;
2542
+ }
2543
+
2544
+ if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
2545
+ push({ type: 'qmark', value, output: QMARK_NO_DOT });
2546
+ continue;
2547
+ }
2548
+
2549
+ push({ type: 'qmark', value, output: QMARK });
2550
+ continue;
2551
+ }
2552
+
2553
+ /**
2554
+ * Exclamation
2555
+ */
2556
+
2557
+ if (value === '!') {
2558
+ if (opts.noextglob !== true && peek() === '(') {
2559
+ if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
2560
+ extglobOpen('negate', value);
2561
+ continue;
2562
+ }
2563
+ }
2564
+
2565
+ if (opts.nonegate !== true && state.index === 0) {
2566
+ negate();
2567
+ continue;
2568
+ }
2569
+ }
2570
+
2571
+ /**
2572
+ * Plus
2573
+ */
2574
+
2575
+ if (value === '+') {
2576
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
2577
+ extglobOpen('plus', value);
2578
+ continue;
2579
+ }
2580
+
2581
+ if ((prev && prev.value === '(') || opts.regex === false) {
2582
+ push({ type: 'plus', value, output: PLUS_LITERAL });
2583
+ continue;
2584
+ }
2585
+
2586
+ if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
2587
+ push({ type: 'plus', value });
2588
+ continue;
2589
+ }
2590
+
2591
+ push({ type: 'plus', value: PLUS_LITERAL });
2592
+ continue;
2593
+ }
2594
+
2595
+ /**
2596
+ * Plain text
2597
+ */
2598
+
2599
+ if (value === '@') {
2600
+ if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
2601
+ push({ type: 'at', extglob: true, value, output: '' });
2602
+ continue;
2603
+ }
2604
+
2605
+ push({ type: 'text', value });
2606
+ continue;
2607
+ }
2608
+
2609
+ /**
2610
+ * Plain text
2611
+ */
2612
+
2613
+ if (value !== '*') {
2614
+ if (value === '$' || value === '^') {
2615
+ value = `\\${value}`;
2616
+ }
2617
+
2618
+ const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
2619
+ if (match) {
2620
+ value += match[0];
2621
+ state.index += match[0].length;
2622
+ }
2623
+
2624
+ push({ type: 'text', value });
2625
+ continue;
2626
+ }
2627
+
2628
+ /**
2629
+ * Stars
2630
+ */
2631
+
2632
+ if (prev && (prev.type === 'globstar' || prev.star === true)) {
2633
+ prev.type = 'star';
2634
+ prev.star = true;
2635
+ prev.value += value;
2636
+ prev.output = star;
2637
+ state.backtrack = true;
2638
+ state.globstar = true;
2639
+ consume(value);
2640
+ continue;
2641
+ }
2642
+
2643
+ let rest = remaining();
2644
+ if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
2645
+ extglobOpen('star', value);
2646
+ continue;
2647
+ }
2648
+
2649
+ if (prev.type === 'star') {
2650
+ if (opts.noglobstar === true) {
2651
+ consume(value);
2652
+ continue;
2653
+ }
2654
+
2655
+ const prior = prev.prev;
2656
+ const before = prior.prev;
2657
+ const isStart = prior.type === 'slash' || prior.type === 'bos';
2658
+ const afterStar = before && (before.type === 'star' || before.type === 'globstar');
2659
+
2660
+ if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
2661
+ push({ type: 'star', value, output: '' });
2662
+ continue;
2663
+ }
2664
+
2665
+ const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
2666
+ const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
2667
+ if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
2668
+ push({ type: 'star', value, output: '' });
2669
+ continue;
2670
+ }
2671
+
2672
+ // strip consecutive `/**/`
2673
+ while (rest.slice(0, 3) === '/**') {
2674
+ const after = input[state.index + 4];
2675
+ if (after && after !== '/') {
2676
+ break;
2677
+ }
2678
+ rest = rest.slice(3);
2679
+ consume('/**', 3);
2680
+ }
2681
+
2682
+ if (prior.type === 'bos' && eos()) {
2683
+ prev.type = 'globstar';
2684
+ prev.value += value;
2685
+ prev.output = globstar(opts);
2686
+ state.output = prev.output;
2687
+ state.globstar = true;
2688
+ consume(value);
2689
+ continue;
2690
+ }
2691
+
2692
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
2693
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
2694
+ prior.output = `(?:${prior.output}`;
2695
+
2696
+ prev.type = 'globstar';
2697
+ prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
2698
+ prev.value += value;
2699
+ state.globstar = true;
2700
+ state.output += prior.output + prev.output;
2701
+ consume(value);
2702
+ continue;
2703
+ }
2704
+
2705
+ if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
2706
+ const end = rest[1] !== void 0 ? '|$' : '';
2707
+
2708
+ state.output = state.output.slice(0, -(prior.output + prev.output).length);
2709
+ prior.output = `(?:${prior.output}`;
2710
+
2711
+ prev.type = 'globstar';
2712
+ prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
2713
+ prev.value += value;
2714
+
2715
+ state.output += prior.output + prev.output;
2716
+ state.globstar = true;
2717
+
2718
+ consume(value + advance());
2719
+
2720
+ push({ type: 'slash', value: '/', output: '' });
2721
+ continue;
2722
+ }
2723
+
2724
+ if (prior.type === 'bos' && rest[0] === '/') {
2725
+ prev.type = 'globstar';
2726
+ prev.value += value;
2727
+ prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
2728
+ state.output = prev.output;
2729
+ state.globstar = true;
2730
+ consume(value + advance());
2731
+ push({ type: 'slash', value: '/', output: '' });
2732
+ continue;
2733
+ }
2734
+
2735
+ // remove single star from output
2736
+ state.output = state.output.slice(0, -prev.output.length);
2737
+
2738
+ // reset previous token to globstar
2739
+ prev.type = 'globstar';
2740
+ prev.output = globstar(opts);
2741
+ prev.value += value;
2742
+
2743
+ // reset output with globstar
2744
+ state.output += prev.output;
2745
+ state.globstar = true;
2746
+ consume(value);
2747
+ continue;
2748
+ }
2749
+
2750
+ const token = { type: 'star', value, output: star };
2751
+
2752
+ if (opts.bash === true) {
2753
+ token.output = '.*?';
2754
+ if (prev.type === 'bos' || prev.type === 'slash') {
2755
+ token.output = nodot + token.output;
2756
+ }
2757
+ push(token);
2758
+ continue;
2759
+ }
2760
+
2761
+ if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
2762
+ token.output = value;
2763
+ push(token);
2764
+ continue;
2765
+ }
2766
+
2767
+ if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
2768
+ if (prev.type === 'dot') {
2769
+ state.output += NO_DOT_SLASH;
2770
+ prev.output += NO_DOT_SLASH;
2771
+
2772
+ } else if (opts.dot === true) {
2773
+ state.output += NO_DOTS_SLASH;
2774
+ prev.output += NO_DOTS_SLASH;
2775
+
2776
+ } else {
2777
+ state.output += nodot;
2778
+ prev.output += nodot;
2779
+ }
2780
+
2781
+ if (peek() !== '*') {
2782
+ state.output += ONE_CHAR;
2783
+ prev.output += ONE_CHAR;
2784
+ }
2785
+ }
2786
+
2787
+ push(token);
2788
+ }
2789
+
2790
+ while (state.brackets > 0) {
2791
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
2792
+ state.output = utils$1.escapeLast(state.output, '[');
2793
+ decrement('brackets');
2794
+ }
2795
+
2796
+ while (state.parens > 0) {
2797
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
2798
+ state.output = utils$1.escapeLast(state.output, '(');
2799
+ decrement('parens');
2800
+ }
2801
+
2802
+ while (state.braces > 0) {
2803
+ if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
2804
+ state.output = utils$1.escapeLast(state.output, '{');
2805
+ decrement('braces');
2806
+ }
2807
+
2808
+ if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
2809
+ push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
2810
+ }
2811
+
2812
+ // rebuild the output if we had to backtrack at any point
2813
+ if (state.backtrack === true) {
2814
+ state.output = '';
2815
+
2816
+ for (const token of state.tokens) {
2817
+ state.output += token.output != null ? token.output : token.value;
2818
+
2819
+ if (token.suffix) {
2820
+ state.output += token.suffix;
2821
+ }
2822
+ }
2823
+ }
2824
+
2825
+ return state;
2826
+ };
2827
+
2828
+ /**
2829
+ * Fast paths for creating regular expressions for common glob patterns.
2830
+ * This can significantly speed up processing and has very little downside
2831
+ * impact when none of the fast paths match.
2832
+ */
2833
+
2834
+ parse$2.fastpaths = (input, options) => {
2835
+ const opts = { ...options };
2836
+ const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
2837
+ const len = input.length;
2838
+ if (len > max) {
2839
+ throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
2840
+ }
2841
+
2842
+ input = REPLACEMENTS[input] || input;
2843
+ const win32 = utils$1.isWindows(options);
2844
+
2845
+ // create constants based on platform, for windows or posix
2846
+ const {
2847
+ DOT_LITERAL,
2848
+ SLASH_LITERAL,
2849
+ ONE_CHAR,
2850
+ DOTS_SLASH,
2851
+ NO_DOT,
2852
+ NO_DOTS,
2853
+ NO_DOTS_SLASH,
2854
+ STAR,
2855
+ START_ANCHOR
2856
+ } = constants$1.globChars(win32);
2857
+
2858
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
2859
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
2860
+ const capture = opts.capture ? '' : '?:';
2861
+ const state = { negated: false, prefix: '' };
2862
+ let star = opts.bash === true ? '.*?' : STAR;
2863
+
2864
+ if (opts.capture) {
2865
+ star = `(${star})`;
2866
+ }
2867
+
2868
+ const globstar = opts => {
2869
+ if (opts.noglobstar === true) return star;
2870
+ return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
2871
+ };
2872
+
2873
+ const create = str => {
2874
+ switch (str) {
2875
+ case '*':
2876
+ return `${nodot}${ONE_CHAR}${star}`;
2877
+
2878
+ case '.*':
2879
+ return `${DOT_LITERAL}${ONE_CHAR}${star}`;
2880
+
2881
+ case '*.*':
2882
+ return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2883
+
2884
+ case '*/*':
2885
+ return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
2886
+
2887
+ case '**':
2888
+ return nodot + globstar(opts);
2889
+
2890
+ case '**/*':
2891
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
2892
+
2893
+ case '**/*.*':
2894
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
2895
+
2896
+ case '**/.*':
2897
+ return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
2898
+
2899
+ default: {
2900
+ const match = /^(.*?)\.(\w+)$/.exec(str);
2901
+ if (!match) return;
2902
+
2903
+ const source = create(match[1]);
2904
+ if (!source) return;
2905
+
2906
+ return source + DOT_LITERAL + match[2];
2907
+ }
2908
+ }
2909
+ };
2910
+
2911
+ const output = utils$1.removePrefix(input, state);
2912
+ let source = create(output);
2913
+
2914
+ if (source && opts.strictSlashes !== true) {
2915
+ source += `${SLASH_LITERAL}?`;
2916
+ }
2917
+
2918
+ return source;
2919
+ };
2920
+
2921
+ var parse_1 = parse$2;
2922
+
2923
+ const path$1 = path__default;
2924
+ const scan = scan_1;
2925
+ const parse$1 = parse_1;
2926
+ const utils = utils$3;
2927
+ const constants = constants$2;
2928
+ const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
2929
+
2930
+ /**
2931
+ * Creates a matcher function from one or more glob patterns. The
2932
+ * returned function takes a string to match as its first argument,
2933
+ * and returns true if the string is a match. The returned matcher
2934
+ * function also takes a boolean as the second argument that, when true,
2935
+ * returns an object with additional information.
2936
+ *
2937
+ * ```js
2938
+ * const picomatch = require('picomatch');
2939
+ * // picomatch(glob[, options]);
2940
+ *
2941
+ * const isMatch = picomatch('*.!(*a)');
2942
+ * console.log(isMatch('a.a')); //=> false
2943
+ * console.log(isMatch('a.b')); //=> true
2944
+ * ```
2945
+ * @name picomatch
2946
+ * @param {String|Array} `globs` One or more glob patterns.
2947
+ * @param {Object=} `options`
2948
+ * @return {Function=} Returns a matcher function.
2949
+ * @api public
2950
+ */
2951
+
2952
+ const picomatch$1 = (glob, options, returnState = false) => {
2953
+ if (Array.isArray(glob)) {
2954
+ const fns = glob.map(input => picomatch$1(input, options, returnState));
2955
+ const arrayMatcher = str => {
2956
+ for (const isMatch of fns) {
2957
+ const state = isMatch(str);
2958
+ if (state) return state;
2959
+ }
2960
+ return false;
2961
+ };
2962
+ return arrayMatcher;
2963
+ }
2964
+
2965
+ const isState = isObject$1(glob) && glob.tokens && glob.input;
2966
+
2967
+ if (glob === '' || (typeof glob !== 'string' && !isState)) {
2968
+ throw new TypeError('Expected pattern to be a non-empty string');
2969
+ }
2970
+
2971
+ const opts = options || {};
2972
+ const posix = utils.isWindows(options);
2973
+ const regex = isState
2974
+ ? picomatch$1.compileRe(glob, options)
2975
+ : picomatch$1.makeRe(glob, options, false, true);
2976
+
2977
+ const state = regex.state;
2978
+ delete regex.state;
2979
+
2980
+ let isIgnored = () => false;
2981
+ if (opts.ignore) {
2982
+ const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
2983
+ isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
2984
+ }
2985
+
2986
+ const matcher = (input, returnObject = false) => {
2987
+ const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
2988
+ const result = { glob, state, regex, posix, input, output, match, isMatch };
2989
+
2990
+ if (typeof opts.onResult === 'function') {
2991
+ opts.onResult(result);
2992
+ }
2993
+
2994
+ if (isMatch === false) {
2995
+ result.isMatch = false;
2996
+ return returnObject ? result : false;
2997
+ }
2998
+
2999
+ if (isIgnored(input)) {
3000
+ if (typeof opts.onIgnore === 'function') {
3001
+ opts.onIgnore(result);
3002
+ }
3003
+ result.isMatch = false;
3004
+ return returnObject ? result : false;
3005
+ }
3006
+
3007
+ if (typeof opts.onMatch === 'function') {
3008
+ opts.onMatch(result);
3009
+ }
3010
+ return returnObject ? result : true;
3011
+ };
3012
+
3013
+ if (returnState) {
3014
+ matcher.state = state;
3015
+ }
3016
+
3017
+ return matcher;
3018
+ };
3019
+
3020
+ /**
3021
+ * Test `input` with the given `regex`. This is used by the main
3022
+ * `picomatch()` function to test the input string.
3023
+ *
3024
+ * ```js
3025
+ * const picomatch = require('picomatch');
3026
+ * // picomatch.test(input, regex[, options]);
3027
+ *
3028
+ * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
3029
+ * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
3030
+ * ```
3031
+ * @param {String} `input` String to test.
3032
+ * @param {RegExp} `regex`
3033
+ * @return {Object} Returns an object with matching info.
3034
+ * @api public
3035
+ */
3036
+
3037
+ picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
3038
+ if (typeof input !== 'string') {
3039
+ throw new TypeError('Expected input to be a string');
3040
+ }
3041
+
3042
+ if (input === '') {
3043
+ return { isMatch: false, output: '' };
3044
+ }
3045
+
3046
+ const opts = options || {};
3047
+ const format = opts.format || (posix ? utils.toPosixSlashes : null);
3048
+ let match = input === glob;
3049
+ let output = (match && format) ? format(input) : input;
3050
+
3051
+ if (match === false) {
3052
+ output = format ? format(input) : input;
3053
+ match = output === glob;
3054
+ }
3055
+
3056
+ if (match === false || opts.capture === true) {
3057
+ if (opts.matchBase === true || opts.basename === true) {
3058
+ match = picomatch$1.matchBase(input, regex, options, posix);
3059
+ } else {
3060
+ match = regex.exec(output);
3061
+ }
3062
+ }
3063
+
3064
+ return { isMatch: Boolean(match), match, output };
3065
+ };
3066
+
3067
+ /**
3068
+ * Match the basename of a filepath.
3069
+ *
3070
+ * ```js
3071
+ * const picomatch = require('picomatch');
3072
+ * // picomatch.matchBase(input, glob[, options]);
3073
+ * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
3074
+ * ```
3075
+ * @param {String} `input` String to test.
3076
+ * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
3077
+ * @return {Boolean}
3078
+ * @api public
3079
+ */
3080
+
3081
+ picomatch$1.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
3082
+ const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
3083
+ return regex.test(path$1.basename(input));
3084
+ };
3085
+
3086
+ /**
3087
+ * Returns true if **any** of the given glob `patterns` match the specified `string`.
3088
+ *
3089
+ * ```js
3090
+ * const picomatch = require('picomatch');
3091
+ * // picomatch.isMatch(string, patterns[, options]);
3092
+ *
3093
+ * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
3094
+ * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
3095
+ * ```
3096
+ * @param {String|Array} str The string to test.
3097
+ * @param {String|Array} patterns One or more glob patterns to use for matching.
3098
+ * @param {Object} [options] See available [options](#options).
3099
+ * @return {Boolean} Returns true if any patterns match `str`
3100
+ * @api public
3101
+ */
3102
+
3103
+ picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
3104
+
3105
+ /**
3106
+ * Parse a glob pattern to create the source string for a regular
3107
+ * expression.
3108
+ *
3109
+ * ```js
3110
+ * const picomatch = require('picomatch');
3111
+ * const result = picomatch.parse(pattern[, options]);
3112
+ * ```
3113
+ * @param {String} `pattern`
3114
+ * @param {Object} `options`
3115
+ * @return {Object} Returns an object with useful properties and output to be used as a regex source string.
3116
+ * @api public
3117
+ */
3118
+
3119
+ picomatch$1.parse = (pattern, options) => {
3120
+ if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
3121
+ return parse$1(pattern, { ...options, fastpaths: false });
3122
+ };
3123
+
3124
+ /**
3125
+ * Scan a glob pattern to separate the pattern into segments.
3126
+ *
3127
+ * ```js
3128
+ * const picomatch = require('picomatch');
3129
+ * // picomatch.scan(input[, options]);
3130
+ *
3131
+ * const result = picomatch.scan('!./foo/*.js');
3132
+ * console.log(result);
3133
+ * { prefix: '!./',
3134
+ * input: '!./foo/*.js',
3135
+ * start: 3,
3136
+ * base: 'foo',
3137
+ * glob: '*.js',
3138
+ * isBrace: false,
3139
+ * isBracket: false,
3140
+ * isGlob: true,
3141
+ * isExtglob: false,
3142
+ * isGlobstar: false,
3143
+ * negated: true }
3144
+ * ```
3145
+ * @param {String} `input` Glob pattern to scan.
3146
+ * @param {Object} `options`
3147
+ * @return {Object} Returns an object with
3148
+ * @api public
3149
+ */
3150
+
3151
+ picomatch$1.scan = (input, options) => scan(input, options);
3152
+
3153
+ /**
3154
+ * Compile a regular expression from the `state` object returned by the
3155
+ * [parse()](#parse) method.
3156
+ *
3157
+ * @param {Object} `state`
3158
+ * @param {Object} `options`
3159
+ * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
3160
+ * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
3161
+ * @return {RegExp}
3162
+ * @api public
3163
+ */
3164
+
3165
+ picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
3166
+ if (returnOutput === true) {
3167
+ return state.output;
3168
+ }
3169
+
3170
+ const opts = options || {};
3171
+ const prepend = opts.contains ? '' : '^';
3172
+ const append = opts.contains ? '' : '$';
3173
+
3174
+ let source = `${prepend}(?:${state.output})${append}`;
3175
+ if (state && state.negated === true) {
3176
+ source = `^(?!${source}).*$`;
3177
+ }
3178
+
3179
+ const regex = picomatch$1.toRegex(source, options);
3180
+ if (returnState === true) {
3181
+ regex.state = state;
3182
+ }
3183
+
3184
+ return regex;
3185
+ };
3186
+
3187
+ /**
3188
+ * Create a regular expression from a parsed glob pattern.
3189
+ *
3190
+ * ```js
3191
+ * const picomatch = require('picomatch');
3192
+ * const state = picomatch.parse('*.js');
3193
+ * // picomatch.compileRe(state[, options]);
3194
+ *
3195
+ * console.log(picomatch.compileRe(state));
3196
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3197
+ * ```
3198
+ * @param {String} `state` The object returned from the `.parse` method.
3199
+ * @param {Object} `options`
3200
+ * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
3201
+ * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
3202
+ * @return {RegExp} Returns a regex created from the given pattern.
3203
+ * @api public
3204
+ */
3205
+
3206
+ picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
3207
+ if (!input || typeof input !== 'string') {
3208
+ throw new TypeError('Expected a non-empty string');
3209
+ }
3210
+
3211
+ let parsed = { negated: false, fastpaths: true };
3212
+
3213
+ if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
3214
+ parsed.output = parse$1.fastpaths(input, options);
3215
+ }
3216
+
3217
+ if (!parsed.output) {
3218
+ parsed = parse$1(input, options);
3219
+ }
3220
+
3221
+ return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
3222
+ };
3223
+
3224
+ /**
3225
+ * Create a regular expression from the given regex source string.
3226
+ *
3227
+ * ```js
3228
+ * const picomatch = require('picomatch');
3229
+ * // picomatch.toRegex(source[, options]);
3230
+ *
3231
+ * const { output } = picomatch.parse('*.js');
3232
+ * console.log(picomatch.toRegex(output));
3233
+ * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
3234
+ * ```
3235
+ * @param {String} `source` Regular expression source string.
3236
+ * @param {Object} `options`
3237
+ * @return {RegExp}
3238
+ * @api public
3239
+ */
3240
+
3241
+ picomatch$1.toRegex = (source, options) => {
3242
+ try {
3243
+ const opts = options || {};
3244
+ return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
3245
+ } catch (err) {
3246
+ if (options && options.debug === true) throw err;
3247
+ return /$^/;
3248
+ }
3249
+ };
3250
+
3251
+ /**
3252
+ * Picomatch constants.
3253
+ * @return {Object}
3254
+ */
3255
+
3256
+ picomatch$1.constants = constants;
3257
+
3258
+ /**
3259
+ * Expose "picomatch"
3260
+ */
3261
+
3262
+ var picomatch_1 = picomatch$1;
3263
+
3264
+ var picomatch = picomatch_1;
3265
+
3266
+ // Helper since Typescript can't detect readonly arrays with Array.isArray
3267
+ function isArray(arg) {
3268
+ return Array.isArray(arg);
3269
+ }
3270
+ function ensureArray(thing) {
3271
+ if (isArray(thing))
3272
+ return thing;
3273
+ if (thing == null)
3274
+ return [];
3275
+ return [thing];
3276
+ }
3277
+
3278
+ const normalizePath$1 = function normalizePath(filename) {
3279
+ return filename.split(path$3.win32.sep).join(path$3.posix.sep);
3280
+ };
3281
+
3282
+ function getMatcherString(id, resolutionBase) {
3283
+ if (resolutionBase === false || path$3.isAbsolute(id) || id.startsWith('*')) {
3284
+ return normalizePath$1(id);
3285
+ }
3286
+ // resolve('') is valid and will default to process.cwd()
3287
+ const basePath = normalizePath$1(path$3.resolve(resolutionBase || ''))
3288
+ // escape all possible (posix + win) path characters that might interfere with regex
3289
+ .replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
3290
+ // Note that we use posix.join because:
3291
+ // 1. the basePath has been normalized to use /
3292
+ // 2. the incoming glob (id) matcher, also uses /
3293
+ // otherwise Node will force backslash (\) on windows
3294
+ return path$3.posix.join(basePath, normalizePath$1(id));
3295
+ }
3296
+ const createFilter$1 = function createFilter(include, exclude, options) {
3297
+ const resolutionBase = options && options.resolve;
3298
+ const getMatcher = (id) => id instanceof RegExp
3299
+ ? id
3300
+ : {
3301
+ test: (what) => {
3302
+ // this refactor is a tad overly verbose but makes for easy debugging
3303
+ const pattern = getMatcherString(id, resolutionBase);
3304
+ const fn = picomatch(pattern, { dot: true });
3305
+ const result = fn(what);
3306
+ return result;
3307
+ }
3308
+ };
3309
+ const includeMatchers = ensureArray(include).map(getMatcher);
3310
+ const excludeMatchers = ensureArray(exclude).map(getMatcher);
3311
+ return function result(id) {
3312
+ if (typeof id !== 'string')
3313
+ return false;
3314
+ if (/\0/.test(id))
3315
+ return false;
3316
+ const pathId = normalizePath$1(id);
3317
+ for (let i = 0; i < excludeMatchers.length; ++i) {
3318
+ const matcher = excludeMatchers[i];
3319
+ if (matcher.test(pathId))
3320
+ return false;
3321
+ }
3322
+ for (let i = 0; i < includeMatchers.length; ++i) {
3323
+ const matcher = includeMatchers[i];
3324
+ if (matcher.test(pathId))
3325
+ return true;
3326
+ }
3327
+ return !includeMatchers.length;
3328
+ };
3329
+ };
3330
+
3331
+ const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
3332
+ const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
3333
+ const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
3334
+ forbiddenIdentifiers.add('');
3335
+
3336
+ const createFilter = createFilter$1;
3337
+ function slash(p) {
3338
+ return p.replace(/\\/g, '/');
3339
+ }
3340
+ // TODO: use import()
3341
+ const _require = module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
3342
+ try {
3343
+ Boolean(_require('pnpapi'));
3344
+ }
3345
+ catch { }
3346
+ // set in bin/vite.js
3347
+ const filter = process.env.VITE_DEBUG_FILTER;
3348
+ const DEBUG = process.env.DEBUG;
3349
+ function createDebugger(namespace, options = {}) {
3350
+ const log = debug(namespace);
3351
+ const { onlyWhenFocused } = options;
3352
+ const focus = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace;
3353
+ return (msg, ...args) => {
3354
+ if (filter && !msg.includes(filter)) {
3355
+ return;
3356
+ }
3357
+ if (onlyWhenFocused && !DEBUG?.includes(focus)) {
3358
+ return;
3359
+ }
3360
+ log(msg, ...args);
3361
+ };
3362
+ }
3363
+ function testCaseInsensitiveFS() {
3364
+ if (!CLIENT_ENTRY.endsWith('client.mjs')) {
3365
+ throw new Error(`cannot test case insensitive FS, CLIENT_ENTRY const doesn't contain client.mjs`);
3366
+ }
3367
+ if (!fs__default.existsSync(CLIENT_ENTRY)) {
3368
+ throw new Error('cannot test case insensitive FS, CLIENT_ENTRY does not point to an existing file: ' +
3369
+ CLIENT_ENTRY);
3370
+ }
3371
+ return fs__default.existsSync(CLIENT_ENTRY.replace('client.mjs', 'cLiEnT.mjs'));
3372
+ }
3373
+ testCaseInsensitiveFS();
3374
+ const isWindows = os__default.platform() === 'win32';
3375
+ function normalizePath(id) {
3376
+ return path__default.posix.normalize(isWindows ? slash(id) : id);
3377
+ }
3378
+ function isObject(value) {
3379
+ return Object.prototype.toString.call(value) === '[object Object]';
3380
+ }
3381
+ function lookupFile(dir, formats, options) {
3382
+ for (const format of formats) {
3383
+ const fullPath = path__default.join(dir, format);
3384
+ if (fs__default.existsSync(fullPath) && fs__default.statSync(fullPath).isFile()) {
3385
+ return options?.pathOnly ? fullPath : fs__default.readFileSync(fullPath, 'utf-8');
3386
+ }
3387
+ }
3388
+ const parentDir = path__default.dirname(dir);
3389
+ if (parentDir !== dir &&
3390
+ (!options?.rootDir || parentDir.startsWith(options?.rootDir))) {
3391
+ return lookupFile(parentDir, formats, options);
3392
+ }
3393
+ }
3394
+ /**
3395
+ * Use fs.statSync(filename) instead of fs.existsSync(filename)
3396
+ * #2051 if we don't have read permission on a directory, existsSync() still
3397
+ * works and will result in massively slow subsequent checks (which are
3398
+ * unnecessary in the first place)
3399
+ */
3400
+ function isFileReadable(filename) {
3401
+ try {
3402
+ const stat = fs__default.statSync(filename, { throwIfNoEntry: false });
3403
+ return !!stat;
3404
+ }
3405
+ catch {
3406
+ return false;
3407
+ }
3408
+ }
3409
+ isWindows
3410
+ ? require$$1.promisify(gracefulRemoveDir)
3411
+ : function removeDirSync(dir) {
3412
+ fs__default.rmSync(dir, { recursive: true, force: true });
3413
+ };
3414
+ isWindows ? require$$1.promisify(gracefulRename) : fs__default.renameSync;
3415
+ function arraify(target) {
3416
+ return Array.isArray(target) ? target : [target];
3417
+ }
3418
+ // @ts-expect-error
3419
+ const usingDynamicImport = typeof jest === 'undefined';
3420
+ /**
3421
+ * Dynamically import files. It will make sure it's not being compiled away by TS/Rollup.
3422
+ *
3423
+ * As a temporary workaround for Jest's lack of stable ESM support, we fallback to require
3424
+ * if we're in a Jest environment.
3425
+ * See https://github.com/vitejs/vite/pull/5197#issuecomment-938054077
3426
+ *
3427
+ * @param file File path to import.
3428
+ */
3429
+ usingDynamicImport
3430
+ ? new Function('file', 'return import(file)')
3431
+ : _require;
3432
+ // Based on node-graceful-fs
3433
+ // The ISC License
3434
+ // Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors
3435
+ // https://github.com/isaacs/node-graceful-fs/blob/main/LICENSE
3436
+ // On Windows, A/V software can lock the directory, causing this
3437
+ // to fail with an EACCES or EPERM if the directory contains newly
3438
+ // created files. The original tried for up to 60 seconds, we only
3439
+ // wait for 5 seconds, as a longer time would be seen as an error
3440
+ const GRACEFUL_RENAME_TIMEOUT = 5000;
3441
+ function gracefulRename(from, to, cb) {
3442
+ const start = Date.now();
3443
+ let backoff = 0;
3444
+ fs__default.rename(from, to, function CB(er) {
3445
+ if (er &&
3446
+ (er.code === 'EACCES' || er.code === 'EPERM') &&
3447
+ Date.now() - start < GRACEFUL_RENAME_TIMEOUT) {
3448
+ setTimeout(function () {
3449
+ fs__default.stat(to, function (stater, st) {
3450
+ if (stater && stater.code === 'ENOENT')
3451
+ fs__default.rename(from, to, CB);
3452
+ else
3453
+ CB(er);
3454
+ });
3455
+ }, backoff);
3456
+ if (backoff < 100)
3457
+ backoff += 10;
3458
+ return;
3459
+ }
3460
+ if (cb)
3461
+ cb(er);
3462
+ });
3463
+ }
3464
+ const GRACEFUL_REMOVE_DIR_TIMEOUT = 5000;
3465
+ function gracefulRemoveDir(dir, cb) {
3466
+ const start = Date.now();
3467
+ let backoff = 0;
3468
+ fs__default.rm(dir, { recursive: true }, function CB(er) {
3469
+ if (er) {
3470
+ if ((er.code === 'ENOTEMPTY' ||
3471
+ er.code === 'EACCES' ||
3472
+ er.code === 'EPERM') &&
3473
+ Date.now() - start < GRACEFUL_REMOVE_DIR_TIMEOUT) {
3474
+ setTimeout(function () {
3475
+ fs__default.rm(dir, { recursive: true }, CB);
3476
+ }, backoff);
3477
+ if (backoff < 100)
3478
+ backoff += 10;
3479
+ return;
3480
+ }
3481
+ if (er.code === 'ENOENT') {
3482
+ er = null;
3483
+ }
3484
+ }
3485
+ if (cb)
3486
+ cb(er);
3487
+ });
3488
+ }
3489
+ function mergeConfigRecursively(defaults, overrides, rootPath) {
3490
+ const merged = { ...defaults };
3491
+ for (const key in overrides) {
3492
+ const value = overrides[key];
3493
+ if (value == null) {
3494
+ continue;
3495
+ }
3496
+ const existing = merged[key];
3497
+ if (existing == null) {
3498
+ merged[key] = value;
3499
+ continue;
3500
+ }
3501
+ // fields that require special handling
3502
+ if (key === 'alias' && (rootPath === 'resolve' || rootPath === '')) {
3503
+ merged[key] = mergeAlias(existing, value);
3504
+ continue;
3505
+ }
3506
+ else if (key === 'assetsInclude' && rootPath === '') {
3507
+ merged[key] = [].concat(existing, value);
3508
+ continue;
3509
+ }
3510
+ else if (key === 'noExternal' &&
3511
+ rootPath === 'ssr' &&
3512
+ (existing === true || value === true)) {
3513
+ merged[key] = true;
3514
+ continue;
3515
+ }
3516
+ if (Array.isArray(existing) || Array.isArray(value)) {
3517
+ merged[key] = [...arraify(existing ?? []), ...arraify(value ?? [])];
3518
+ continue;
3519
+ }
3520
+ if (isObject(existing) && isObject(value)) {
3521
+ merged[key] = mergeConfigRecursively(existing, value, rootPath ? `${rootPath}.${key}` : key);
3522
+ continue;
3523
+ }
3524
+ merged[key] = value;
3525
+ }
3526
+ return merged;
3527
+ }
3528
+ function mergeConfig(defaults, overrides, isRoot = true) {
3529
+ return mergeConfigRecursively(defaults, overrides, isRoot ? '' : '.');
3530
+ }
3531
+ function mergeAlias(a, b) {
3532
+ if (!a)
3533
+ return b;
3534
+ if (!b)
3535
+ return a;
3536
+ if (isObject(a) && isObject(b)) {
3537
+ return { ...a, ...b };
3538
+ }
3539
+ // the order is flipped because the alias is resolved from top-down,
3540
+ // where the later should have higher priority
3541
+ return [...normalizeAlias(b), ...normalizeAlias(a)];
3542
+ }
3543
+ function normalizeAlias(o = []) {
3544
+ return Array.isArray(o)
3545
+ ? o.map(normalizeSingleAlias)
3546
+ : Object.keys(o).map((find) => normalizeSingleAlias({
3547
+ find,
3548
+ replacement: o[find]
3549
+ }));
3550
+ }
3551
+ // https://github.com/vitejs/vite/issues/1363
3552
+ // work around https://github.com/rollup/plugins/issues/759
3553
+ function normalizeSingleAlias({ find, replacement, customResolver }) {
3554
+ if (typeof find === 'string' &&
3555
+ find.endsWith('/') &&
3556
+ replacement.endsWith('/')) {
3557
+ find = find.slice(0, find.length - 1);
3558
+ replacement = replacement.slice(0, replacement.length - 1);
3559
+ }
3560
+ const alias = {
3561
+ find,
3562
+ replacement
3563
+ };
3564
+ if (customResolver) {
3565
+ alias.customResolver = customResolver;
3566
+ }
3567
+ return alias;
3568
+ }
3569
+
3570
+ /*!
3571
+ * etag
3572
+ * Copyright(c) 2014-2016 Douglas Christopher Wilson
3573
+ * MIT Licensed
3574
+ */
3575
+
3576
+ /**
3577
+ * Module exports.
3578
+ * @public
3579
+ */
3580
+
3581
+ var etag_1 = etag;
3582
+
3583
+ /**
3584
+ * Module dependencies.
3585
+ * @private
3586
+ */
3587
+
3588
+ var crypto = require$$0__default$1;
3589
+ var Stats = fs__default.Stats;
3590
+
3591
+ /**
3592
+ * Module variables.
3593
+ * @private
3594
+ */
3595
+
3596
+ var toString = Object.prototype.toString;
3597
+
3598
+ /**
3599
+ * Generate an entity tag.
3600
+ *
3601
+ * @param {Buffer|string} entity
3602
+ * @return {string}
3603
+ * @private
3604
+ */
3605
+
3606
+ function entitytag (entity) {
3607
+ if (entity.length === 0) {
3608
+ // fast-path empty
3609
+ return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"'
3610
+ }
3611
+
3612
+ // compute hash of entity
3613
+ var hash = crypto
3614
+ .createHash('sha1')
3615
+ .update(entity, 'utf8')
3616
+ .digest('base64')
3617
+ .substring(0, 27);
3618
+
3619
+ // compute length of entity
3620
+ var len = typeof entity === 'string'
3621
+ ? Buffer.byteLength(entity, 'utf8')
3622
+ : entity.length;
3623
+
3624
+ return '"' + len.toString(16) + '-' + hash + '"'
3625
+ }
3626
+
3627
+ /**
3628
+ * Create a simple ETag.
3629
+ *
3630
+ * @param {string|Buffer|Stats} entity
3631
+ * @param {object} [options]
3632
+ * @param {boolean} [options.weak]
3633
+ * @return {String}
3634
+ * @public
3635
+ */
3636
+
3637
+ function etag (entity, options) {
3638
+ if (entity == null) {
3639
+ throw new TypeError('argument entity is required')
3640
+ }
3641
+
3642
+ // support fs.Stats object
3643
+ var isStats = isstats(entity);
3644
+ var weak = options && typeof options.weak === 'boolean'
3645
+ ? options.weak
3646
+ : isStats;
3647
+
3648
+ // validate argument
3649
+ if (!isStats && typeof entity !== 'string' && !Buffer.isBuffer(entity)) {
3650
+ throw new TypeError('argument entity must be string, Buffer, or fs.Stats')
3651
+ }
3652
+
3653
+ // generate entity tag
3654
+ var tag = isStats
3655
+ ? stattag(entity)
3656
+ : entitytag(entity);
3657
+
3658
+ return weak
3659
+ ? 'W/' + tag
3660
+ : tag
3661
+ }
3662
+
3663
+ /**
3664
+ * Determine if object is a Stats object.
3665
+ *
3666
+ * @param {object} obj
3667
+ * @return {boolean}
3668
+ * @api private
3669
+ */
3670
+
3671
+ function isstats (obj) {
3672
+ // genuine fs.Stats
3673
+ if (typeof Stats === 'function' && obj instanceof Stats) {
3674
+ return true
3675
+ }
3676
+
3677
+ // quack quack
3678
+ return obj && typeof obj === 'object' &&
3679
+ 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' &&
3680
+ 'mtime' in obj && toString.call(obj.mtime) === '[object Date]' &&
3681
+ 'ino' in obj && typeof obj.ino === 'number' &&
3682
+ 'size' in obj && typeof obj.size === 'number'
3683
+ }
3684
+
3685
+ /**
3686
+ * Generate a tag for a stat.
3687
+ *
3688
+ * @param {object} stat
3689
+ * @return {string}
3690
+ * @private
3691
+ */
3692
+
3693
+ function stattag (stat) {
3694
+ var mtime = stat.mtime.getTime().toString(16);
3695
+ var size = stat.size.toString(16);
3696
+
3697
+ return '"' + size + '-' + mtime + '"'
3698
+ }
3699
+
3700
+ const isDebug = !!process.env.DEBUG;
3701
+ createDebugger('vite:sourcemap', {
3702
+ onlyWhenFocused: true
3703
+ });
3704
+ function genSourceMapUrl(map) {
3705
+ if (typeof map !== 'string') {
3706
+ map = JSON.stringify(map);
3707
+ }
3708
+ return `data:application/json;base64,${Buffer.from(map).toString('base64')}`;
3709
+ }
3710
+ function getCodeWithSourcemap(type, code, map) {
3711
+ if (isDebug) {
3712
+ code += `\n/*${JSON.stringify(map, null, 2).replace(/\*\//g, '*\\/')}*/\n`;
3713
+ }
3714
+ if (type === 'js') {
3715
+ code += `\n//# sourceMappingURL=${genSourceMapUrl(map ?? undefined)}`;
3716
+ }
3717
+ else if (type === 'css') {
3718
+ code += `\n/*# sourceMappingURL=${genSourceMapUrl(map ?? undefined)} */`;
3719
+ }
3720
+ return code;
3721
+ }
3722
+
3723
+ const alias = {
3724
+ js: 'application/javascript',
3725
+ css: 'text/css',
3726
+ html: 'text/html',
3727
+ json: 'application/json'
3728
+ };
3729
+ function send(req, res, content, type, options) {
3730
+ const { etag = etag_1(content, { weak: true }), cacheControl = 'no-cache', headers, map } = options;
3731
+ if (res.writableEnded) {
3732
+ return;
3733
+ }
3734
+ if (req.headers['if-none-match'] === etag) {
3735
+ res.statusCode = 304;
3736
+ res.end();
3737
+ return;
3738
+ }
3739
+ res.setHeader('Content-Type', alias[type] || type);
3740
+ res.setHeader('Cache-Control', cacheControl);
3741
+ res.setHeader('Etag', etag);
3742
+ if (headers) {
3743
+ for (const name in headers) {
3744
+ res.setHeader(name, headers[name]);
3745
+ }
3746
+ }
3747
+ // inject source map reference
3748
+ if (map && map.mappings) {
3749
+ if (type === 'js' || type === 'css') {
3750
+ content = getCodeWithSourcemap(type, content.toString(), map);
3751
+ }
3752
+ }
3753
+ res.statusCode = 200;
3754
+ res.end(content);
3755
+ return;
3756
+ }
3757
+
3758
+ /* eslint no-console: 0 */
3759
+ const LogLevels = {
3760
+ silent: 0,
3761
+ error: 1,
3762
+ warn: 2,
3763
+ info: 3
3764
+ };
3765
+ let lastType;
3766
+ let lastMsg;
3767
+ let sameCount = 0;
3768
+ function clearScreen() {
3769
+ const repeatCount = process.stdout.rows - 2;
3770
+ const blank = repeatCount > 0 ? '\n'.repeat(repeatCount) : '';
3771
+ console.log(blank);
3772
+ readline__default.cursorTo(process.stdout, 0, 0);
3773
+ readline__default.clearScreenDown(process.stdout);
3774
+ }
3775
+ function createLogger(level = 'info', options = {}) {
3776
+ if (options.customLogger) {
3777
+ return options.customLogger;
3778
+ }
3779
+ const loggedErrors = new WeakSet();
3780
+ const { prefix = '[vite]', allowClearScreen = true } = options;
3781
+ const thresh = LogLevels[level];
3782
+ const canClearScreen = allowClearScreen && process.stdout.isTTY && !process.env.CI;
3783
+ const clear = canClearScreen ? clearScreen : () => { };
3784
+ function output(type, msg, options = {}) {
3785
+ if (thresh >= LogLevels[type]) {
3786
+ const method = type === 'info' ? 'log' : type;
3787
+ const format = () => {
3788
+ if (options.timestamp) {
3789
+ const tag = type === 'info'
3790
+ ? colors.cyan(colors.bold(prefix))
3791
+ : type === 'warn'
3792
+ ? colors.yellow(colors.bold(prefix))
3793
+ : colors.red(colors.bold(prefix));
3794
+ return `${colors.dim(new Date().toLocaleTimeString())} ${tag} ${msg}`;
3795
+ }
3796
+ else {
3797
+ return msg;
3798
+ }
3799
+ };
3800
+ if (options.error) {
3801
+ loggedErrors.add(options.error);
3802
+ }
3803
+ if (canClearScreen) {
3804
+ if (type === lastType && msg === lastMsg) {
3805
+ sameCount++;
3806
+ clear();
3807
+ console[method](format(), colors.yellow(`(x${sameCount + 1})`));
3808
+ }
3809
+ else {
3810
+ sameCount = 0;
3811
+ lastMsg = msg;
3812
+ lastType = type;
3813
+ if (options.clear) {
3814
+ clear();
3815
+ }
3816
+ console[method](format());
3817
+ }
3818
+ }
3819
+ else {
3820
+ console[method](format());
3821
+ }
3822
+ }
3823
+ }
3824
+ const warnedMessages = new Set();
3825
+ const logger = {
3826
+ hasWarned: false,
3827
+ info(msg, opts) {
3828
+ output('info', msg, opts);
3829
+ },
3830
+ warn(msg, opts) {
3831
+ logger.hasWarned = true;
3832
+ output('warn', msg, opts);
3833
+ },
3834
+ warnOnce(msg, opts) {
3835
+ if (warnedMessages.has(msg))
3836
+ return;
3837
+ logger.hasWarned = true;
3838
+ output('warn', msg, opts);
3839
+ warnedMessages.add(msg);
3840
+ },
3841
+ error(msg, opts) {
3842
+ logger.hasWarned = true;
3843
+ output('error', msg, opts);
3844
+ },
3845
+ clearScreen(type) {
3846
+ if (thresh >= LogLevels[type]) {
3847
+ clear();
3848
+ }
3849
+ },
3850
+ hasErrorLogged(error) {
3851
+ return loggedErrors.has(error);
3852
+ }
3853
+ };
3854
+ return logger;
3855
+ }
3856
+
3857
+ // https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
3858
+ const ROOT_FILES = [
3859
+ // '.git',
3860
+ // https://pnpm.js.org/workspaces/
3861
+ 'pnpm-workspace.yaml',
3862
+ // https://rushjs.io/pages/advanced/config_files/
3863
+ // 'rush.json',
3864
+ // https://nx.dev/latest/react/getting-started/nx-setup
3865
+ // 'workspace.json',
3866
+ // 'nx.json',
3867
+ // https://github.com/lerna/lerna#lernajson
3868
+ 'lerna.json'
3869
+ ];
3870
+ // npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
3871
+ // yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
3872
+ function hasWorkspacePackageJSON(root) {
3873
+ const path = path$3.join(root, 'package.json');
3874
+ if (!isFileReadable(path)) {
3875
+ return false;
3876
+ }
3877
+ const content = JSON.parse(fs__default.readFileSync(path, 'utf-8')) || {};
3878
+ return !!content.workspaces;
3879
+ }
3880
+ function hasRootFile(root) {
3881
+ return ROOT_FILES.some((file) => fs__default.existsSync(path$3.join(root, file)));
3882
+ }
3883
+ function hasPackageJSON(root) {
3884
+ const path = path$3.join(root, 'package.json');
3885
+ return fs__default.existsSync(path);
3886
+ }
3887
+ /**
3888
+ * Search up for the nearest `package.json`
3889
+ */
3890
+ function searchForPackageRoot(current, root = current) {
3891
+ if (hasPackageJSON(current))
3892
+ return current;
3893
+ const dir = path$3.dirname(current);
3894
+ // reach the fs root
3895
+ if (!dir || dir === current)
3896
+ return root;
3897
+ return searchForPackageRoot(dir, root);
3898
+ }
3899
+ /**
3900
+ * Search up for the nearest workspace root
3901
+ */
3902
+ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
3903
+ if (hasRootFile(current))
3904
+ return current;
3905
+ if (hasWorkspacePackageJSON(current))
3906
+ return current;
3907
+ const dir = path$3.dirname(current);
3908
+ // reach the fs root
3909
+ if (!dir || dir === current)
3910
+ return root;
3911
+ return searchForWorkspaceRoot(dir, root);
3912
+ }
3913
+
3914
+ var main$1 = {exports: {}};
3915
+
3916
+ const fs = fs__default;
3917
+ const path = path__default;
3918
+ const os = os__default;
3919
+
3920
+ function log (message) {
3921
+ console.log(`[dotenv][DEBUG] ${message}`);
3922
+ }
3923
+
3924
+ const NEWLINE = '\n';
3925
+ const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*("[^"]*"|'[^']*'|.*?)(\s+#.*)?$/;
3926
+ const RE_NEWLINES = /\\n/g;
3927
+ const NEWLINES_MATCH = /\r\n|\n|\r/;
3928
+
3929
+ // Parses src into an Object
3930
+ function parse (src, options) {
3931
+ const debug = Boolean(options && options.debug);
3932
+ const multiline = Boolean(options && options.multiline);
3933
+ const obj = {};
3934
+
3935
+ // convert Buffers before splitting into lines and processing
3936
+ const lines = src.toString().split(NEWLINES_MATCH);
3937
+
3938
+ for (let idx = 0; idx < lines.length; idx++) {
3939
+ let line = lines[idx];
3940
+
3941
+ // matching "KEY' and 'VAL' in 'KEY=VAL'
3942
+ const keyValueArr = line.match(RE_INI_KEY_VAL);
3943
+ // matched?
3944
+ if (keyValueArr != null) {
3945
+ const key = keyValueArr[1];
3946
+ // default undefined or missing values to empty string
3947
+ let val = (keyValueArr[2] || '');
3948
+ let end = val.length - 1;
3949
+ const isDoubleQuoted = val[0] === '"' && val[end] === '"';
3950
+ const isSingleQuoted = val[0] === "'" && val[end] === "'";
3951
+
3952
+ const isMultilineDoubleQuoted = val[0] === '"' && val[end] !== '"';
3953
+ const isMultilineSingleQuoted = val[0] === "'" && val[end] !== "'";
3954
+
3955
+ // if parsing line breaks and the value starts with a quote
3956
+ if (multiline && (isMultilineDoubleQuoted || isMultilineSingleQuoted)) {
3957
+ const quoteChar = isMultilineDoubleQuoted ? '"' : "'";
3958
+
3959
+ val = val.substring(1);
3960
+
3961
+ while (idx++ < lines.length - 1) {
3962
+ line = lines[idx];
3963
+ end = line.length - 1;
3964
+ if (line[end] === quoteChar) {
3965
+ val += NEWLINE + line.substring(0, end);
3966
+ break
3967
+ }
3968
+ val += NEWLINE + line;
3969
+ }
3970
+ // if single or double quoted, remove quotes
3971
+ } else if (isSingleQuoted || isDoubleQuoted) {
3972
+ val = val.substring(1, end);
3973
+
3974
+ // if double quoted, expand newlines
3975
+ if (isDoubleQuoted) {
3976
+ val = val.replace(RE_NEWLINES, NEWLINE);
3977
+ }
3978
+ } else {
3979
+ // remove surrounding whitespace
3980
+ val = val.trim();
3981
+ }
3982
+
3983
+ obj[key] = val;
3984
+ } else if (debug) {
3985
+ const trimmedLine = line.trim();
3986
+
3987
+ // ignore empty and commented lines
3988
+ if (trimmedLine.length && trimmedLine[0] !== '#') {
3989
+ log(`Failed to match key and value when parsing line ${idx + 1}: ${line}`);
3990
+ }
3991
+ }
3992
+ }
3993
+
3994
+ return obj
3995
+ }
3996
+
3997
+ function resolveHome (envPath) {
3998
+ return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
3999
+ }
4000
+
4001
+ // Populates process.env from .env file
4002
+ function config (options) {
4003
+ let dotenvPath = path.resolve(process.cwd(), '.env');
4004
+ let encoding = 'utf8';
4005
+ const debug = Boolean(options && options.debug);
4006
+ const override = Boolean(options && options.override);
4007
+ const multiline = Boolean(options && options.multiline);
4008
+
4009
+ if (options) {
4010
+ if (options.path != null) {
4011
+ dotenvPath = resolveHome(options.path);
4012
+ }
4013
+ if (options.encoding != null) {
4014
+ encoding = options.encoding;
4015
+ }
4016
+ }
4017
+
4018
+ try {
4019
+ // specifying an encoding returns a string instead of a buffer
4020
+ const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }), { debug, multiline });
4021
+
4022
+ Object.keys(parsed).forEach(function (key) {
4023
+ if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
4024
+ process.env[key] = parsed[key];
4025
+ } else {
4026
+ if (override === true) {
4027
+ process.env[key] = parsed[key];
4028
+ }
4029
+
4030
+ if (debug) {
4031
+ if (override === true) {
4032
+ log(`"${key}" is already defined in \`process.env\` and WAS overwritten`);
4033
+ } else {
4034
+ log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`);
4035
+ }
4036
+ }
4037
+ }
4038
+ });
4039
+
4040
+ return { parsed }
4041
+ } catch (e) {
4042
+ if (debug) {
4043
+ log(`Failed to load ${dotenvPath} ${e.message}`);
4044
+ }
4045
+
4046
+ return { error: e }
4047
+ }
4048
+ }
4049
+
4050
+ const DotenvModule = {
4051
+ config,
4052
+ parse
4053
+ };
4054
+
4055
+ main$1.exports.config = DotenvModule.config;
4056
+ main$1.exports.parse = DotenvModule.parse;
4057
+ main$1.exports = DotenvModule;
4058
+
4059
+ var dotenv = main$1.exports;
4060
+
4061
+ var dotenvExpand = function (config) {
4062
+ // if ignoring process.env, use a blank object
4063
+ var environment = config.ignoreProcessEnv ? {} : process.env;
4064
+
4065
+ var interpolate = function (envValue) {
4066
+ var matches = envValue.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g) || [];
4067
+
4068
+ return matches.reduce(function (newEnv, match) {
4069
+ var parts = /(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(match);
4070
+ var prefix = parts[1];
4071
+
4072
+ var value, replacePart;
4073
+
4074
+ if (prefix === '\\') {
4075
+ replacePart = parts[0];
4076
+ value = replacePart.replace('\\$', '$');
4077
+ } else {
4078
+ var key = parts[2];
4079
+ replacePart = parts[0].substring(prefix.length);
4080
+ // process.env value 'wins' over .env file's value
4081
+ value = environment.hasOwnProperty(key) ? environment[key] : (config.parsed[key] || '');
4082
+
4083
+ // Resolve recursive interpolations
4084
+ value = interpolate(value);
4085
+ }
4086
+
4087
+ return newEnv.replace(replacePart, value)
4088
+ }, envValue)
4089
+ };
4090
+
4091
+ for (var configKey in config.parsed) {
4092
+ var value = environment.hasOwnProperty(configKey) ? environment[configKey] : config.parsed[configKey];
4093
+
4094
+ config.parsed[configKey] = interpolate(value);
4095
+ }
4096
+
4097
+ for (var processKey in config.parsed) {
4098
+ environment[processKey] = config.parsed[processKey];
4099
+ }
4100
+
4101
+ return config
4102
+ };
4103
+
4104
+ var main = dotenvExpand;
4105
+
4106
+ function loadEnv(mode, envDir, prefixes = 'VITE_') {
4107
+ if (mode === 'local') {
4108
+ throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
4109
+ `the .local postfix for .env files.`);
4110
+ }
4111
+ prefixes = arraify(prefixes);
4112
+ const env = {};
4113
+ const envFiles = [
4114
+ /** mode local file */ `.env.${mode}.local`,
4115
+ /** mode file */ `.env.${mode}`,
4116
+ /** local file */ `.env.local`,
4117
+ /** default file */ `.env`
4118
+ ];
4119
+ // check if there are actual env variables starting with VITE_*
4120
+ // these are typically provided inline and should be prioritized
4121
+ for (const key in process.env) {
4122
+ if (prefixes.some((prefix) => key.startsWith(prefix)) &&
4123
+ env[key] === undefined) {
4124
+ env[key] = process.env[key];
4125
+ }
4126
+ }
4127
+ for (const file of envFiles) {
4128
+ const path = lookupFile(envDir, [file], { pathOnly: true, rootDir: envDir });
4129
+ if (path) {
4130
+ const parsed = dotenv.parse(fs__default.readFileSync(path), {
4131
+ debug: process.env.DEBUG?.includes('vite:dotenv') || undefined
4132
+ });
4133
+ // let environment variables use each other
4134
+ main({
4135
+ parsed,
4136
+ // prevent process.env mutation
4137
+ ignoreProcessEnv: true
4138
+ });
4139
+ // only keys that start with prefix are exposed to client
4140
+ for (const [key, value] of Object.entries(parsed)) {
4141
+ if (prefixes.some((prefix) => key.startsWith(prefix)) &&
4142
+ env[key] === undefined) {
4143
+ env[key] = value;
4144
+ }
4145
+ else if (key === 'NODE_ENV' &&
4146
+ process.env.VITE_USER_NODE_ENV === undefined) {
4147
+ // NODE_ENV override in .env file
4148
+ process.env.VITE_USER_NODE_ENV = value;
4149
+ }
4150
+ }
4151
+ }
4152
+ }
4153
+ return env;
4154
+ }
4155
+ function resolveEnvPrefix({ envPrefix = 'VITE_' }) {
4156
+ envPrefix = arraify(envPrefix);
4157
+ if (envPrefix.some((prefix) => prefix === '')) {
4158
+ throw new Error(`envPrefix option contains value '', which could lead unexpected exposure of sensitive information.`);
4159
+ }
4160
+ return envPrefix;
4161
+ }
4162
+
4163
+ exports.createFilter = createFilter;
4164
+ exports.createLogger = createLogger;
4165
+ exports.loadEnv = loadEnv;
4166
+ exports.mergeAlias = mergeAlias;
4167
+ exports.mergeConfig = mergeConfig;
4168
+ exports.normalizePath = normalizePath;
4169
+ exports.resolveEnvPrefix = resolveEnvPrefix;
4170
+ exports.searchForWorkspaceRoot = searchForWorkspaceRoot;
4171
+ exports.send = send;
4172
+ exports.splitVendorChunk = splitVendorChunk;
4173
+ exports.splitVendorChunkPlugin = splitVendorChunkPlugin;
4174
+ exports.version = VERSION;