@oclif/plugin-test-esbuild 0.4.19 → 0.4.21

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,4907 @@
1
+ import {
2
+ __commonJS,
3
+ __require,
4
+ init_cjs_shims
5
+ } from "./chunk-RRP6KXWN.js";
6
+
7
+ // node_modules/lru-cache/dist/commonjs/index.js
8
+ var require_commonjs = __commonJS({
9
+ "node_modules/lru-cache/dist/commonjs/index.js"(exports) {
10
+ "use strict";
11
+ init_cjs_shims();
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.LRUCache = void 0;
14
+ var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
15
+ var warned = /* @__PURE__ */ new Set();
16
+ var PROCESS = typeof process === "object" && !!process ? process : {};
17
+ var emitWarning = (msg, type, code, fn) => {
18
+ typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
19
+ };
20
+ var AC = globalThis.AbortController;
21
+ var AS = globalThis.AbortSignal;
22
+ if (typeof AC === "undefined") {
23
+ AS = class AbortSignal {
24
+ onabort;
25
+ _onabort = [];
26
+ reason;
27
+ aborted = false;
28
+ addEventListener(_, fn) {
29
+ this._onabort.push(fn);
30
+ }
31
+ };
32
+ AC = class AbortController {
33
+ constructor() {
34
+ warnACPolyfill();
35
+ }
36
+ signal = new AS();
37
+ abort(reason) {
38
+ if (this.signal.aborted)
39
+ return;
40
+ this.signal.reason = reason;
41
+ this.signal.aborted = true;
42
+ for (const fn of this.signal._onabort) {
43
+ fn(reason);
44
+ }
45
+ this.signal.onabort?.(reason);
46
+ }
47
+ };
48
+ let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
49
+ const warnACPolyfill = () => {
50
+ if (!printACPolyfillWarning)
51
+ return;
52
+ printACPolyfillWarning = false;
53
+ emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
54
+ };
55
+ }
56
+ var shouldWarn = (code) => !warned.has(code);
57
+ var TYPE = Symbol("type");
58
+ var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
59
+ var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
60
+ var ZeroArray = class extends Array {
61
+ constructor(size) {
62
+ super(size);
63
+ this.fill(0);
64
+ }
65
+ };
66
+ var Stack = class _Stack {
67
+ heap;
68
+ length;
69
+ // private constructor
70
+ static #constructing = false;
71
+ static create(max) {
72
+ const HeapCls = getUintArray(max);
73
+ if (!HeapCls)
74
+ return [];
75
+ _Stack.#constructing = true;
76
+ const s = new _Stack(max, HeapCls);
77
+ _Stack.#constructing = false;
78
+ return s;
79
+ }
80
+ constructor(max, HeapCls) {
81
+ if (!_Stack.#constructing) {
82
+ throw new TypeError("instantiate Stack using Stack.create(n)");
83
+ }
84
+ this.heap = new HeapCls(max);
85
+ this.length = 0;
86
+ }
87
+ push(n) {
88
+ this.heap[this.length++] = n;
89
+ }
90
+ pop() {
91
+ return this.heap[--this.length];
92
+ }
93
+ };
94
+ var LRUCache = class _LRUCache {
95
+ // properties coming in from the options of these, only max and maxSize
96
+ // really *need* to be protected. The rest can be modified, as they just
97
+ // set defaults for various methods.
98
+ #max;
99
+ #maxSize;
100
+ #dispose;
101
+ #disposeAfter;
102
+ #fetchMethod;
103
+ /**
104
+ * {@link LRUCache.OptionsBase.ttl}
105
+ */
106
+ ttl;
107
+ /**
108
+ * {@link LRUCache.OptionsBase.ttlResolution}
109
+ */
110
+ ttlResolution;
111
+ /**
112
+ * {@link LRUCache.OptionsBase.ttlAutopurge}
113
+ */
114
+ ttlAutopurge;
115
+ /**
116
+ * {@link LRUCache.OptionsBase.updateAgeOnGet}
117
+ */
118
+ updateAgeOnGet;
119
+ /**
120
+ * {@link LRUCache.OptionsBase.updateAgeOnHas}
121
+ */
122
+ updateAgeOnHas;
123
+ /**
124
+ * {@link LRUCache.OptionsBase.allowStale}
125
+ */
126
+ allowStale;
127
+ /**
128
+ * {@link LRUCache.OptionsBase.noDisposeOnSet}
129
+ */
130
+ noDisposeOnSet;
131
+ /**
132
+ * {@link LRUCache.OptionsBase.noUpdateTTL}
133
+ */
134
+ noUpdateTTL;
135
+ /**
136
+ * {@link LRUCache.OptionsBase.maxEntrySize}
137
+ */
138
+ maxEntrySize;
139
+ /**
140
+ * {@link LRUCache.OptionsBase.sizeCalculation}
141
+ */
142
+ sizeCalculation;
143
+ /**
144
+ * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
145
+ */
146
+ noDeleteOnFetchRejection;
147
+ /**
148
+ * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
149
+ */
150
+ noDeleteOnStaleGet;
151
+ /**
152
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
153
+ */
154
+ allowStaleOnFetchAbort;
155
+ /**
156
+ * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
157
+ */
158
+ allowStaleOnFetchRejection;
159
+ /**
160
+ * {@link LRUCache.OptionsBase.ignoreFetchAbort}
161
+ */
162
+ ignoreFetchAbort;
163
+ // computed properties
164
+ #size;
165
+ #calculatedSize;
166
+ #keyMap;
167
+ #keyList;
168
+ #valList;
169
+ #next;
170
+ #prev;
171
+ #head;
172
+ #tail;
173
+ #free;
174
+ #disposed;
175
+ #sizes;
176
+ #starts;
177
+ #ttls;
178
+ #hasDispose;
179
+ #hasFetchMethod;
180
+ #hasDisposeAfter;
181
+ /**
182
+ * Do not call this method unless you need to inspect the
183
+ * inner workings of the cache. If anything returned by this
184
+ * object is modified in any way, strange breakage may occur.
185
+ *
186
+ * These fields are private for a reason!
187
+ *
188
+ * @internal
189
+ */
190
+ static unsafeExposeInternals(c) {
191
+ return {
192
+ // properties
193
+ starts: c.#starts,
194
+ ttls: c.#ttls,
195
+ sizes: c.#sizes,
196
+ keyMap: c.#keyMap,
197
+ keyList: c.#keyList,
198
+ valList: c.#valList,
199
+ next: c.#next,
200
+ prev: c.#prev,
201
+ get head() {
202
+ return c.#head;
203
+ },
204
+ get tail() {
205
+ return c.#tail;
206
+ },
207
+ free: c.#free,
208
+ // methods
209
+ isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
210
+ backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
211
+ moveToTail: (index) => c.#moveToTail(index),
212
+ indexes: (options) => c.#indexes(options),
213
+ rindexes: (options) => c.#rindexes(options),
214
+ isStale: (index) => c.#isStale(index)
215
+ };
216
+ }
217
+ // Protected read-only members
218
+ /**
219
+ * {@link LRUCache.OptionsBase.max} (read-only)
220
+ */
221
+ get max() {
222
+ return this.#max;
223
+ }
224
+ /**
225
+ * {@link LRUCache.OptionsBase.maxSize} (read-only)
226
+ */
227
+ get maxSize() {
228
+ return this.#maxSize;
229
+ }
230
+ /**
231
+ * The total computed size of items in the cache (read-only)
232
+ */
233
+ get calculatedSize() {
234
+ return this.#calculatedSize;
235
+ }
236
+ /**
237
+ * The number of items stored in the cache (read-only)
238
+ */
239
+ get size() {
240
+ return this.#size;
241
+ }
242
+ /**
243
+ * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
244
+ */
245
+ get fetchMethod() {
246
+ return this.#fetchMethod;
247
+ }
248
+ /**
249
+ * {@link LRUCache.OptionsBase.dispose} (read-only)
250
+ */
251
+ get dispose() {
252
+ return this.#dispose;
253
+ }
254
+ /**
255
+ * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
256
+ */
257
+ get disposeAfter() {
258
+ return this.#disposeAfter;
259
+ }
260
+ constructor(options) {
261
+ const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
262
+ if (max !== 0 && !isPosInt(max)) {
263
+ throw new TypeError("max option must be a nonnegative integer");
264
+ }
265
+ const UintArray = max ? getUintArray(max) : Array;
266
+ if (!UintArray) {
267
+ throw new Error("invalid max value: " + max);
268
+ }
269
+ this.#max = max;
270
+ this.#maxSize = maxSize;
271
+ this.maxEntrySize = maxEntrySize || this.#maxSize;
272
+ this.sizeCalculation = sizeCalculation;
273
+ if (this.sizeCalculation) {
274
+ if (!this.#maxSize && !this.maxEntrySize) {
275
+ throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
276
+ }
277
+ if (typeof this.sizeCalculation !== "function") {
278
+ throw new TypeError("sizeCalculation set to non-function");
279
+ }
280
+ }
281
+ if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
282
+ throw new TypeError("fetchMethod must be a function if specified");
283
+ }
284
+ this.#fetchMethod = fetchMethod;
285
+ this.#hasFetchMethod = !!fetchMethod;
286
+ this.#keyMap = /* @__PURE__ */ new Map();
287
+ this.#keyList = new Array(max).fill(void 0);
288
+ this.#valList = new Array(max).fill(void 0);
289
+ this.#next = new UintArray(max);
290
+ this.#prev = new UintArray(max);
291
+ this.#head = 0;
292
+ this.#tail = 0;
293
+ this.#free = Stack.create(max);
294
+ this.#size = 0;
295
+ this.#calculatedSize = 0;
296
+ if (typeof dispose === "function") {
297
+ this.#dispose = dispose;
298
+ }
299
+ if (typeof disposeAfter === "function") {
300
+ this.#disposeAfter = disposeAfter;
301
+ this.#disposed = [];
302
+ } else {
303
+ this.#disposeAfter = void 0;
304
+ this.#disposed = void 0;
305
+ }
306
+ this.#hasDispose = !!this.#dispose;
307
+ this.#hasDisposeAfter = !!this.#disposeAfter;
308
+ this.noDisposeOnSet = !!noDisposeOnSet;
309
+ this.noUpdateTTL = !!noUpdateTTL;
310
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
311
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
312
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
313
+ this.ignoreFetchAbort = !!ignoreFetchAbort;
314
+ if (this.maxEntrySize !== 0) {
315
+ if (this.#maxSize !== 0) {
316
+ if (!isPosInt(this.#maxSize)) {
317
+ throw new TypeError("maxSize must be a positive integer if specified");
318
+ }
319
+ }
320
+ if (!isPosInt(this.maxEntrySize)) {
321
+ throw new TypeError("maxEntrySize must be a positive integer if specified");
322
+ }
323
+ this.#initializeSizeTracking();
324
+ }
325
+ this.allowStale = !!allowStale;
326
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
327
+ this.updateAgeOnGet = !!updateAgeOnGet;
328
+ this.updateAgeOnHas = !!updateAgeOnHas;
329
+ this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
330
+ this.ttlAutopurge = !!ttlAutopurge;
331
+ this.ttl = ttl || 0;
332
+ if (this.ttl) {
333
+ if (!isPosInt(this.ttl)) {
334
+ throw new TypeError("ttl must be a positive integer if specified");
335
+ }
336
+ this.#initializeTTLTracking();
337
+ }
338
+ if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
339
+ throw new TypeError("At least one of max, maxSize, or ttl is required");
340
+ }
341
+ if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
342
+ const code = "LRU_CACHE_UNBOUNDED";
343
+ if (shouldWarn(code)) {
344
+ warned.add(code);
345
+ const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
346
+ emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache);
347
+ }
348
+ }
349
+ }
350
+ /**
351
+ * Return the remaining TTL time for a given entry key
352
+ */
353
+ getRemainingTTL(key) {
354
+ return this.#keyMap.has(key) ? Infinity : 0;
355
+ }
356
+ #initializeTTLTracking() {
357
+ const ttls = new ZeroArray(this.#max);
358
+ const starts = new ZeroArray(this.#max);
359
+ this.#ttls = ttls;
360
+ this.#starts = starts;
361
+ this.#setItemTTL = (index, ttl, start = perf.now()) => {
362
+ starts[index] = ttl !== 0 ? start : 0;
363
+ ttls[index] = ttl;
364
+ if (ttl !== 0 && this.ttlAutopurge) {
365
+ const t = setTimeout(() => {
366
+ if (this.#isStale(index)) {
367
+ this.delete(this.#keyList[index]);
368
+ }
369
+ }, ttl + 1);
370
+ if (t.unref) {
371
+ t.unref();
372
+ }
373
+ }
374
+ };
375
+ this.#updateItemAge = (index) => {
376
+ starts[index] = ttls[index] !== 0 ? perf.now() : 0;
377
+ };
378
+ this.#statusTTL = (status, index) => {
379
+ if (ttls[index]) {
380
+ const ttl = ttls[index];
381
+ const start = starts[index];
382
+ if (!ttl || !start)
383
+ return;
384
+ status.ttl = ttl;
385
+ status.start = start;
386
+ status.now = cachedNow || getNow();
387
+ const age = status.now - start;
388
+ status.remainingTTL = ttl - age;
389
+ }
390
+ };
391
+ let cachedNow = 0;
392
+ const getNow = () => {
393
+ const n = perf.now();
394
+ if (this.ttlResolution > 0) {
395
+ cachedNow = n;
396
+ const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
397
+ if (t.unref) {
398
+ t.unref();
399
+ }
400
+ }
401
+ return n;
402
+ };
403
+ this.getRemainingTTL = (key) => {
404
+ const index = this.#keyMap.get(key);
405
+ if (index === void 0) {
406
+ return 0;
407
+ }
408
+ const ttl = ttls[index];
409
+ const start = starts[index];
410
+ if (!ttl || !start) {
411
+ return Infinity;
412
+ }
413
+ const age = (cachedNow || getNow()) - start;
414
+ return ttl - age;
415
+ };
416
+ this.#isStale = (index) => {
417
+ const s = starts[index];
418
+ const t = ttls[index];
419
+ return !!t && !!s && (cachedNow || getNow()) - s > t;
420
+ };
421
+ }
422
+ // conditionally set private methods related to TTL
423
+ #updateItemAge = () => {
424
+ };
425
+ #statusTTL = () => {
426
+ };
427
+ #setItemTTL = () => {
428
+ };
429
+ /* c8 ignore stop */
430
+ #isStale = () => false;
431
+ #initializeSizeTracking() {
432
+ const sizes = new ZeroArray(this.#max);
433
+ this.#calculatedSize = 0;
434
+ this.#sizes = sizes;
435
+ this.#removeItemSize = (index) => {
436
+ this.#calculatedSize -= sizes[index];
437
+ sizes[index] = 0;
438
+ };
439
+ this.#requireSize = (k, v, size, sizeCalculation) => {
440
+ if (this.#isBackgroundFetch(v)) {
441
+ return 0;
442
+ }
443
+ if (!isPosInt(size)) {
444
+ if (sizeCalculation) {
445
+ if (typeof sizeCalculation !== "function") {
446
+ throw new TypeError("sizeCalculation must be a function");
447
+ }
448
+ size = sizeCalculation(v, k);
449
+ if (!isPosInt(size)) {
450
+ throw new TypeError("sizeCalculation return invalid (expect positive integer)");
451
+ }
452
+ } else {
453
+ throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
454
+ }
455
+ }
456
+ return size;
457
+ };
458
+ this.#addItemSize = (index, size, status) => {
459
+ sizes[index] = size;
460
+ if (this.#maxSize) {
461
+ const maxSize = this.#maxSize - sizes[index];
462
+ while (this.#calculatedSize > maxSize) {
463
+ this.#evict(true);
464
+ }
465
+ }
466
+ this.#calculatedSize += sizes[index];
467
+ if (status) {
468
+ status.entrySize = size;
469
+ status.totalCalculatedSize = this.#calculatedSize;
470
+ }
471
+ };
472
+ }
473
+ #removeItemSize = (_i) => {
474
+ };
475
+ #addItemSize = (_i, _s, _st) => {
476
+ };
477
+ #requireSize = (_k, _v, size, sizeCalculation) => {
478
+ if (size || sizeCalculation) {
479
+ throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
480
+ }
481
+ return 0;
482
+ };
483
+ *#indexes({ allowStale = this.allowStale } = {}) {
484
+ if (this.#size) {
485
+ for (let i = this.#tail; true; ) {
486
+ if (!this.#isValidIndex(i)) {
487
+ break;
488
+ }
489
+ if (allowStale || !this.#isStale(i)) {
490
+ yield i;
491
+ }
492
+ if (i === this.#head) {
493
+ break;
494
+ } else {
495
+ i = this.#prev[i];
496
+ }
497
+ }
498
+ }
499
+ }
500
+ *#rindexes({ allowStale = this.allowStale } = {}) {
501
+ if (this.#size) {
502
+ for (let i = this.#head; true; ) {
503
+ if (!this.#isValidIndex(i)) {
504
+ break;
505
+ }
506
+ if (allowStale || !this.#isStale(i)) {
507
+ yield i;
508
+ }
509
+ if (i === this.#tail) {
510
+ break;
511
+ } else {
512
+ i = this.#next[i];
513
+ }
514
+ }
515
+ }
516
+ }
517
+ #isValidIndex(index) {
518
+ return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
519
+ }
520
+ /**
521
+ * Return a generator yielding `[key, value]` pairs,
522
+ * in order from most recently used to least recently used.
523
+ */
524
+ *entries() {
525
+ for (const i of this.#indexes()) {
526
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
527
+ yield [this.#keyList[i], this.#valList[i]];
528
+ }
529
+ }
530
+ }
531
+ /**
532
+ * Inverse order version of {@link LRUCache.entries}
533
+ *
534
+ * Return a generator yielding `[key, value]` pairs,
535
+ * in order from least recently used to most recently used.
536
+ */
537
+ *rentries() {
538
+ for (const i of this.#rindexes()) {
539
+ if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
540
+ yield [this.#keyList[i], this.#valList[i]];
541
+ }
542
+ }
543
+ }
544
+ /**
545
+ * Return a generator yielding the keys in the cache,
546
+ * in order from most recently used to least recently used.
547
+ */
548
+ *keys() {
549
+ for (const i of this.#indexes()) {
550
+ const k = this.#keyList[i];
551
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
552
+ yield k;
553
+ }
554
+ }
555
+ }
556
+ /**
557
+ * Inverse order version of {@link LRUCache.keys}
558
+ *
559
+ * Return a generator yielding the keys in the cache,
560
+ * in order from least recently used to most recently used.
561
+ */
562
+ *rkeys() {
563
+ for (const i of this.#rindexes()) {
564
+ const k = this.#keyList[i];
565
+ if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
566
+ yield k;
567
+ }
568
+ }
569
+ }
570
+ /**
571
+ * Return a generator yielding the values in the cache,
572
+ * in order from most recently used to least recently used.
573
+ */
574
+ *values() {
575
+ for (const i of this.#indexes()) {
576
+ const v = this.#valList[i];
577
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
578
+ yield this.#valList[i];
579
+ }
580
+ }
581
+ }
582
+ /**
583
+ * Inverse order version of {@link LRUCache.values}
584
+ *
585
+ * Return a generator yielding the values in the cache,
586
+ * in order from least recently used to most recently used.
587
+ */
588
+ *rvalues() {
589
+ for (const i of this.#rindexes()) {
590
+ const v = this.#valList[i];
591
+ if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
592
+ yield this.#valList[i];
593
+ }
594
+ }
595
+ }
596
+ /**
597
+ * Iterating over the cache itself yields the same results as
598
+ * {@link LRUCache.entries}
599
+ */
600
+ [Symbol.iterator]() {
601
+ return this.entries();
602
+ }
603
+ /**
604
+ * A String value that is used in the creation of the default string description of an object.
605
+ * Called by the built-in method Object.prototype.toString.
606
+ */
607
+ [Symbol.toStringTag] = "LRUCache";
608
+ /**
609
+ * Find a value for which the supplied fn method returns a truthy value,
610
+ * similar to Array.find(). fn is called as fn(value, key, cache).
611
+ */
612
+ find(fn, getOptions = {}) {
613
+ for (const i of this.#indexes()) {
614
+ const v = this.#valList[i];
615
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
616
+ if (value === void 0)
617
+ continue;
618
+ if (fn(value, this.#keyList[i], this)) {
619
+ return this.get(this.#keyList[i], getOptions);
620
+ }
621
+ }
622
+ }
623
+ /**
624
+ * Call the supplied function on each item in the cache, in order from
625
+ * most recently used to least recently used. fn is called as
626
+ * fn(value, key, cache). Does not update age or recenty of use.
627
+ * Does not iterate over stale values.
628
+ */
629
+ forEach(fn, thisp = this) {
630
+ for (const i of this.#indexes()) {
631
+ const v = this.#valList[i];
632
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
633
+ if (value === void 0)
634
+ continue;
635
+ fn.call(thisp, value, this.#keyList[i], this);
636
+ }
637
+ }
638
+ /**
639
+ * The same as {@link LRUCache.forEach} but items are iterated over in
640
+ * reverse order. (ie, less recently used items are iterated over first.)
641
+ */
642
+ rforEach(fn, thisp = this) {
643
+ for (const i of this.#rindexes()) {
644
+ const v = this.#valList[i];
645
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
646
+ if (value === void 0)
647
+ continue;
648
+ fn.call(thisp, value, this.#keyList[i], this);
649
+ }
650
+ }
651
+ /**
652
+ * Delete any stale entries. Returns true if anything was removed,
653
+ * false otherwise.
654
+ */
655
+ purgeStale() {
656
+ let deleted = false;
657
+ for (const i of this.#rindexes({ allowStale: true })) {
658
+ if (this.#isStale(i)) {
659
+ this.delete(this.#keyList[i]);
660
+ deleted = true;
661
+ }
662
+ }
663
+ return deleted;
664
+ }
665
+ /**
666
+ * Get the extended info about a given entry, to get its value, size, and
667
+ * TTL info simultaneously. Like {@link LRUCache#dump}, but just for a
668
+ * single key. Always returns stale values, if their info is found in the
669
+ * cache, so be sure to check for expired TTLs if relevant.
670
+ */
671
+ info(key) {
672
+ const i = this.#keyMap.get(key);
673
+ if (i === void 0)
674
+ return void 0;
675
+ const v = this.#valList[i];
676
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
677
+ if (value === void 0)
678
+ return void 0;
679
+ const entry = { value };
680
+ if (this.#ttls && this.#starts) {
681
+ const ttl = this.#ttls[i];
682
+ const start = this.#starts[i];
683
+ if (ttl && start) {
684
+ const remain = ttl - (perf.now() - start);
685
+ entry.ttl = remain;
686
+ entry.start = Date.now();
687
+ }
688
+ }
689
+ if (this.#sizes) {
690
+ entry.size = this.#sizes[i];
691
+ }
692
+ return entry;
693
+ }
694
+ /**
695
+ * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
696
+ * passed to cache.load()
697
+ */
698
+ dump() {
699
+ const arr = [];
700
+ for (const i of this.#indexes({ allowStale: true })) {
701
+ const key = this.#keyList[i];
702
+ const v = this.#valList[i];
703
+ const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
704
+ if (value === void 0 || key === void 0)
705
+ continue;
706
+ const entry = { value };
707
+ if (this.#ttls && this.#starts) {
708
+ entry.ttl = this.#ttls[i];
709
+ const age = perf.now() - this.#starts[i];
710
+ entry.start = Math.floor(Date.now() - age);
711
+ }
712
+ if (this.#sizes) {
713
+ entry.size = this.#sizes[i];
714
+ }
715
+ arr.unshift([key, entry]);
716
+ }
717
+ return arr;
718
+ }
719
+ /**
720
+ * Reset the cache and load in the items in entries in the order listed.
721
+ * Note that the shape of the resulting cache may be different if the
722
+ * same options are not used in both caches.
723
+ */
724
+ load(arr) {
725
+ this.clear();
726
+ for (const [key, entry] of arr) {
727
+ if (entry.start) {
728
+ const age = Date.now() - entry.start;
729
+ entry.start = perf.now() - age;
730
+ }
731
+ this.set(key, entry.value, entry);
732
+ }
733
+ }
734
+ /**
735
+ * Add a value to the cache.
736
+ *
737
+ * Note: if `undefined` is specified as a value, this is an alias for
738
+ * {@link LRUCache#delete}
739
+ */
740
+ set(k, v, setOptions = {}) {
741
+ if (v === void 0) {
742
+ this.delete(k);
743
+ return this;
744
+ }
745
+ const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
746
+ let { noUpdateTTL = this.noUpdateTTL } = setOptions;
747
+ const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
748
+ if (this.maxEntrySize && size > this.maxEntrySize) {
749
+ if (status) {
750
+ status.set = "miss";
751
+ status.maxEntrySizeExceeded = true;
752
+ }
753
+ this.delete(k);
754
+ return this;
755
+ }
756
+ let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
757
+ if (index === void 0) {
758
+ index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
759
+ this.#keyList[index] = k;
760
+ this.#valList[index] = v;
761
+ this.#keyMap.set(k, index);
762
+ this.#next[this.#tail] = index;
763
+ this.#prev[index] = this.#tail;
764
+ this.#tail = index;
765
+ this.#size++;
766
+ this.#addItemSize(index, size, status);
767
+ if (status)
768
+ status.set = "add";
769
+ noUpdateTTL = false;
770
+ } else {
771
+ this.#moveToTail(index);
772
+ const oldVal = this.#valList[index];
773
+ if (v !== oldVal) {
774
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
775
+ oldVal.__abortController.abort(new Error("replaced"));
776
+ const { __staleWhileFetching: s } = oldVal;
777
+ if (s !== void 0 && !noDisposeOnSet) {
778
+ if (this.#hasDispose) {
779
+ this.#dispose?.(s, k, "set");
780
+ }
781
+ if (this.#hasDisposeAfter) {
782
+ this.#disposed?.push([s, k, "set"]);
783
+ }
784
+ }
785
+ } else if (!noDisposeOnSet) {
786
+ if (this.#hasDispose) {
787
+ this.#dispose?.(oldVal, k, "set");
788
+ }
789
+ if (this.#hasDisposeAfter) {
790
+ this.#disposed?.push([oldVal, k, "set"]);
791
+ }
792
+ }
793
+ this.#removeItemSize(index);
794
+ this.#addItemSize(index, size, status);
795
+ this.#valList[index] = v;
796
+ if (status) {
797
+ status.set = "replace";
798
+ const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
799
+ if (oldValue !== void 0)
800
+ status.oldValue = oldValue;
801
+ }
802
+ } else if (status) {
803
+ status.set = "update";
804
+ }
805
+ }
806
+ if (ttl !== 0 && !this.#ttls) {
807
+ this.#initializeTTLTracking();
808
+ }
809
+ if (this.#ttls) {
810
+ if (!noUpdateTTL) {
811
+ this.#setItemTTL(index, ttl, start);
812
+ }
813
+ if (status)
814
+ this.#statusTTL(status, index);
815
+ }
816
+ if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
817
+ const dt = this.#disposed;
818
+ let task;
819
+ while (task = dt?.shift()) {
820
+ this.#disposeAfter?.(...task);
821
+ }
822
+ }
823
+ return this;
824
+ }
825
+ /**
826
+ * Evict the least recently used item, returning its value or
827
+ * `undefined` if cache is empty.
828
+ */
829
+ pop() {
830
+ try {
831
+ while (this.#size) {
832
+ const val = this.#valList[this.#head];
833
+ this.#evict(true);
834
+ if (this.#isBackgroundFetch(val)) {
835
+ if (val.__staleWhileFetching) {
836
+ return val.__staleWhileFetching;
837
+ }
838
+ } else if (val !== void 0) {
839
+ return val;
840
+ }
841
+ }
842
+ } finally {
843
+ if (this.#hasDisposeAfter && this.#disposed) {
844
+ const dt = this.#disposed;
845
+ let task;
846
+ while (task = dt?.shift()) {
847
+ this.#disposeAfter?.(...task);
848
+ }
849
+ }
850
+ }
851
+ }
852
+ #evict(free) {
853
+ const head = this.#head;
854
+ const k = this.#keyList[head];
855
+ const v = this.#valList[head];
856
+ if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
857
+ v.__abortController.abort(new Error("evicted"));
858
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
859
+ if (this.#hasDispose) {
860
+ this.#dispose?.(v, k, "evict");
861
+ }
862
+ if (this.#hasDisposeAfter) {
863
+ this.#disposed?.push([v, k, "evict"]);
864
+ }
865
+ }
866
+ this.#removeItemSize(head);
867
+ if (free) {
868
+ this.#keyList[head] = void 0;
869
+ this.#valList[head] = void 0;
870
+ this.#free.push(head);
871
+ }
872
+ if (this.#size === 1) {
873
+ this.#head = this.#tail = 0;
874
+ this.#free.length = 0;
875
+ } else {
876
+ this.#head = this.#next[head];
877
+ }
878
+ this.#keyMap.delete(k);
879
+ this.#size--;
880
+ return head;
881
+ }
882
+ /**
883
+ * Check if a key is in the cache, without updating the recency of use.
884
+ * Will return false if the item is stale, even though it is technically
885
+ * in the cache.
886
+ *
887
+ * Will not update item age unless
888
+ * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
889
+ */
890
+ has(k, hasOptions = {}) {
891
+ const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
892
+ const index = this.#keyMap.get(k);
893
+ if (index !== void 0) {
894
+ const v = this.#valList[index];
895
+ if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
896
+ return false;
897
+ }
898
+ if (!this.#isStale(index)) {
899
+ if (updateAgeOnHas) {
900
+ this.#updateItemAge(index);
901
+ }
902
+ if (status) {
903
+ status.has = "hit";
904
+ this.#statusTTL(status, index);
905
+ }
906
+ return true;
907
+ } else if (status) {
908
+ status.has = "stale";
909
+ this.#statusTTL(status, index);
910
+ }
911
+ } else if (status) {
912
+ status.has = "miss";
913
+ }
914
+ return false;
915
+ }
916
+ /**
917
+ * Like {@link LRUCache#get} but doesn't update recency or delete stale
918
+ * items.
919
+ *
920
+ * Returns `undefined` if the item is stale, unless
921
+ * {@link LRUCache.OptionsBase.allowStale} is set.
922
+ */
923
+ peek(k, peekOptions = {}) {
924
+ const { allowStale = this.allowStale } = peekOptions;
925
+ const index = this.#keyMap.get(k);
926
+ if (index === void 0 || !allowStale && this.#isStale(index)) {
927
+ return;
928
+ }
929
+ const v = this.#valList[index];
930
+ return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
931
+ }
932
+ #backgroundFetch(k, index, options, context) {
933
+ const v = index === void 0 ? void 0 : this.#valList[index];
934
+ if (this.#isBackgroundFetch(v)) {
935
+ return v;
936
+ }
937
+ const ac = new AC();
938
+ const { signal } = options;
939
+ signal?.addEventListener("abort", () => ac.abort(signal.reason), {
940
+ signal: ac.signal
941
+ });
942
+ const fetchOpts = {
943
+ signal: ac.signal,
944
+ options,
945
+ context
946
+ };
947
+ const cb = (v2, updateCache = false) => {
948
+ const { aborted } = ac.signal;
949
+ const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
950
+ if (options.status) {
951
+ if (aborted && !updateCache) {
952
+ options.status.fetchAborted = true;
953
+ options.status.fetchError = ac.signal.reason;
954
+ if (ignoreAbort)
955
+ options.status.fetchAbortIgnored = true;
956
+ } else {
957
+ options.status.fetchResolved = true;
958
+ }
959
+ }
960
+ if (aborted && !ignoreAbort && !updateCache) {
961
+ return fetchFail(ac.signal.reason);
962
+ }
963
+ const bf2 = p;
964
+ if (this.#valList[index] === p) {
965
+ if (v2 === void 0) {
966
+ if (bf2.__staleWhileFetching) {
967
+ this.#valList[index] = bf2.__staleWhileFetching;
968
+ } else {
969
+ this.delete(k);
970
+ }
971
+ } else {
972
+ if (options.status)
973
+ options.status.fetchUpdated = true;
974
+ this.set(k, v2, fetchOpts.options);
975
+ }
976
+ }
977
+ return v2;
978
+ };
979
+ const eb = (er) => {
980
+ if (options.status) {
981
+ options.status.fetchRejected = true;
982
+ options.status.fetchError = er;
983
+ }
984
+ return fetchFail(er);
985
+ };
986
+ const fetchFail = (er) => {
987
+ const { aborted } = ac.signal;
988
+ const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
989
+ const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
990
+ const noDelete = allowStale || options.noDeleteOnFetchRejection;
991
+ const bf2 = p;
992
+ if (this.#valList[index] === p) {
993
+ const del = !noDelete || bf2.__staleWhileFetching === void 0;
994
+ if (del) {
995
+ this.delete(k);
996
+ } else if (!allowStaleAborted) {
997
+ this.#valList[index] = bf2.__staleWhileFetching;
998
+ }
999
+ }
1000
+ if (allowStale) {
1001
+ if (options.status && bf2.__staleWhileFetching !== void 0) {
1002
+ options.status.returnedStale = true;
1003
+ }
1004
+ return bf2.__staleWhileFetching;
1005
+ } else if (bf2.__returned === bf2) {
1006
+ throw er;
1007
+ }
1008
+ };
1009
+ const pcall = (res, rej) => {
1010
+ const fmp = this.#fetchMethod?.(k, v, fetchOpts);
1011
+ if (fmp && fmp instanceof Promise) {
1012
+ fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej);
1013
+ }
1014
+ ac.signal.addEventListener("abort", () => {
1015
+ if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
1016
+ res(void 0);
1017
+ if (options.allowStaleOnFetchAbort) {
1018
+ res = (v2) => cb(v2, true);
1019
+ }
1020
+ }
1021
+ });
1022
+ };
1023
+ if (options.status)
1024
+ options.status.fetchDispatched = true;
1025
+ const p = new Promise(pcall).then(cb, eb);
1026
+ const bf = Object.assign(p, {
1027
+ __abortController: ac,
1028
+ __staleWhileFetching: v,
1029
+ __returned: void 0
1030
+ });
1031
+ if (index === void 0) {
1032
+ this.set(k, bf, { ...fetchOpts.options, status: void 0 });
1033
+ index = this.#keyMap.get(k);
1034
+ } else {
1035
+ this.#valList[index] = bf;
1036
+ }
1037
+ return bf;
1038
+ }
1039
+ #isBackgroundFetch(p) {
1040
+ if (!this.#hasFetchMethod)
1041
+ return false;
1042
+ const b = p;
1043
+ return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
1044
+ }
1045
+ async fetch(k, fetchOptions = {}) {
1046
+ const {
1047
+ // get options
1048
+ allowStale = this.allowStale,
1049
+ updateAgeOnGet = this.updateAgeOnGet,
1050
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
1051
+ // set options
1052
+ ttl = this.ttl,
1053
+ noDisposeOnSet = this.noDisposeOnSet,
1054
+ size = 0,
1055
+ sizeCalculation = this.sizeCalculation,
1056
+ noUpdateTTL = this.noUpdateTTL,
1057
+ // fetch exclusive options
1058
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
1059
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
1060
+ ignoreFetchAbort = this.ignoreFetchAbort,
1061
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
1062
+ context,
1063
+ forceRefresh = false,
1064
+ status,
1065
+ signal
1066
+ } = fetchOptions;
1067
+ if (!this.#hasFetchMethod) {
1068
+ if (status)
1069
+ status.fetch = "get";
1070
+ return this.get(k, {
1071
+ allowStale,
1072
+ updateAgeOnGet,
1073
+ noDeleteOnStaleGet,
1074
+ status
1075
+ });
1076
+ }
1077
+ const options = {
1078
+ allowStale,
1079
+ updateAgeOnGet,
1080
+ noDeleteOnStaleGet,
1081
+ ttl,
1082
+ noDisposeOnSet,
1083
+ size,
1084
+ sizeCalculation,
1085
+ noUpdateTTL,
1086
+ noDeleteOnFetchRejection,
1087
+ allowStaleOnFetchRejection,
1088
+ allowStaleOnFetchAbort,
1089
+ ignoreFetchAbort,
1090
+ status,
1091
+ signal
1092
+ };
1093
+ let index = this.#keyMap.get(k);
1094
+ if (index === void 0) {
1095
+ if (status)
1096
+ status.fetch = "miss";
1097
+ const p = this.#backgroundFetch(k, index, options, context);
1098
+ return p.__returned = p;
1099
+ } else {
1100
+ const v = this.#valList[index];
1101
+ if (this.#isBackgroundFetch(v)) {
1102
+ const stale = allowStale && v.__staleWhileFetching !== void 0;
1103
+ if (status) {
1104
+ status.fetch = "inflight";
1105
+ if (stale)
1106
+ status.returnedStale = true;
1107
+ }
1108
+ return stale ? v.__staleWhileFetching : v.__returned = v;
1109
+ }
1110
+ const isStale = this.#isStale(index);
1111
+ if (!forceRefresh && !isStale) {
1112
+ if (status)
1113
+ status.fetch = "hit";
1114
+ this.#moveToTail(index);
1115
+ if (updateAgeOnGet) {
1116
+ this.#updateItemAge(index);
1117
+ }
1118
+ if (status)
1119
+ this.#statusTTL(status, index);
1120
+ return v;
1121
+ }
1122
+ const p = this.#backgroundFetch(k, index, options, context);
1123
+ const hasStale = p.__staleWhileFetching !== void 0;
1124
+ const staleVal = hasStale && allowStale;
1125
+ if (status) {
1126
+ status.fetch = isStale ? "stale" : "refresh";
1127
+ if (staleVal && isStale)
1128
+ status.returnedStale = true;
1129
+ }
1130
+ return staleVal ? p.__staleWhileFetching : p.__returned = p;
1131
+ }
1132
+ }
1133
+ /**
1134
+ * Return a value from the cache. Will update the recency of the cache
1135
+ * entry found.
1136
+ *
1137
+ * If the key is not found, get() will return `undefined`.
1138
+ */
1139
+ get(k, getOptions = {}) {
1140
+ const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
1141
+ const index = this.#keyMap.get(k);
1142
+ if (index !== void 0) {
1143
+ const value = this.#valList[index];
1144
+ const fetching = this.#isBackgroundFetch(value);
1145
+ if (status)
1146
+ this.#statusTTL(status, index);
1147
+ if (this.#isStale(index)) {
1148
+ if (status)
1149
+ status.get = "stale";
1150
+ if (!fetching) {
1151
+ if (!noDeleteOnStaleGet) {
1152
+ this.delete(k);
1153
+ }
1154
+ if (status && allowStale)
1155
+ status.returnedStale = true;
1156
+ return allowStale ? value : void 0;
1157
+ } else {
1158
+ if (status && allowStale && value.__staleWhileFetching !== void 0) {
1159
+ status.returnedStale = true;
1160
+ }
1161
+ return allowStale ? value.__staleWhileFetching : void 0;
1162
+ }
1163
+ } else {
1164
+ if (status)
1165
+ status.get = "hit";
1166
+ if (fetching) {
1167
+ return value.__staleWhileFetching;
1168
+ }
1169
+ this.#moveToTail(index);
1170
+ if (updateAgeOnGet) {
1171
+ this.#updateItemAge(index);
1172
+ }
1173
+ return value;
1174
+ }
1175
+ } else if (status) {
1176
+ status.get = "miss";
1177
+ }
1178
+ }
1179
+ #connect(p, n) {
1180
+ this.#prev[n] = p;
1181
+ this.#next[p] = n;
1182
+ }
1183
+ #moveToTail(index) {
1184
+ if (index !== this.#tail) {
1185
+ if (index === this.#head) {
1186
+ this.#head = this.#next[index];
1187
+ } else {
1188
+ this.#connect(this.#prev[index], this.#next[index]);
1189
+ }
1190
+ this.#connect(this.#tail, index);
1191
+ this.#tail = index;
1192
+ }
1193
+ }
1194
+ /**
1195
+ * Deletes a key out of the cache.
1196
+ * Returns true if the key was deleted, false otherwise.
1197
+ */
1198
+ delete(k) {
1199
+ let deleted = false;
1200
+ if (this.#size !== 0) {
1201
+ const index = this.#keyMap.get(k);
1202
+ if (index !== void 0) {
1203
+ deleted = true;
1204
+ if (this.#size === 1) {
1205
+ this.clear();
1206
+ } else {
1207
+ this.#removeItemSize(index);
1208
+ const v = this.#valList[index];
1209
+ if (this.#isBackgroundFetch(v)) {
1210
+ v.__abortController.abort(new Error("deleted"));
1211
+ } else if (this.#hasDispose || this.#hasDisposeAfter) {
1212
+ if (this.#hasDispose) {
1213
+ this.#dispose?.(v, k, "delete");
1214
+ }
1215
+ if (this.#hasDisposeAfter) {
1216
+ this.#disposed?.push([v, k, "delete"]);
1217
+ }
1218
+ }
1219
+ this.#keyMap.delete(k);
1220
+ this.#keyList[index] = void 0;
1221
+ this.#valList[index] = void 0;
1222
+ if (index === this.#tail) {
1223
+ this.#tail = this.#prev[index];
1224
+ } else if (index === this.#head) {
1225
+ this.#head = this.#next[index];
1226
+ } else {
1227
+ const pi = this.#prev[index];
1228
+ this.#next[pi] = this.#next[index];
1229
+ const ni = this.#next[index];
1230
+ this.#prev[ni] = this.#prev[index];
1231
+ }
1232
+ this.#size--;
1233
+ this.#free.push(index);
1234
+ }
1235
+ }
1236
+ }
1237
+ if (this.#hasDisposeAfter && this.#disposed?.length) {
1238
+ const dt = this.#disposed;
1239
+ let task;
1240
+ while (task = dt?.shift()) {
1241
+ this.#disposeAfter?.(...task);
1242
+ }
1243
+ }
1244
+ return deleted;
1245
+ }
1246
+ /**
1247
+ * Clear the cache entirely, throwing away all values.
1248
+ */
1249
+ clear() {
1250
+ for (const index of this.#rindexes({ allowStale: true })) {
1251
+ const v = this.#valList[index];
1252
+ if (this.#isBackgroundFetch(v)) {
1253
+ v.__abortController.abort(new Error("deleted"));
1254
+ } else {
1255
+ const k = this.#keyList[index];
1256
+ if (this.#hasDispose) {
1257
+ this.#dispose?.(v, k, "delete");
1258
+ }
1259
+ if (this.#hasDisposeAfter) {
1260
+ this.#disposed?.push([v, k, "delete"]);
1261
+ }
1262
+ }
1263
+ }
1264
+ this.#keyMap.clear();
1265
+ this.#valList.fill(void 0);
1266
+ this.#keyList.fill(void 0);
1267
+ if (this.#ttls && this.#starts) {
1268
+ this.#ttls.fill(0);
1269
+ this.#starts.fill(0);
1270
+ }
1271
+ if (this.#sizes) {
1272
+ this.#sizes.fill(0);
1273
+ }
1274
+ this.#head = 0;
1275
+ this.#tail = 0;
1276
+ this.#free.length = 0;
1277
+ this.#calculatedSize = 0;
1278
+ this.#size = 0;
1279
+ if (this.#hasDisposeAfter && this.#disposed) {
1280
+ const dt = this.#disposed;
1281
+ let task;
1282
+ while (task = dt?.shift()) {
1283
+ this.#disposeAfter?.(...task);
1284
+ }
1285
+ }
1286
+ }
1287
+ };
1288
+ exports.LRUCache = LRUCache;
1289
+ }
1290
+ });
1291
+
1292
+ // node_modules/hosted-git-info/lib/hosts.js
1293
+ var require_hosts = __commonJS({
1294
+ "node_modules/hosted-git-info/lib/hosts.js"(exports, module) {
1295
+ "use strict";
1296
+ init_cjs_shims();
1297
+ var maybeJoin = (...args) => args.every((arg) => arg) ? args.join("") : "";
1298
+ var maybeEncode = (arg) => arg ? encodeURIComponent(arg) : "";
1299
+ var formatHashFragment = (f) => f.toLowerCase().replace(/^\W+|\/|\W+$/g, "").replace(/\W+/g, "-");
1300
+ var defaults = {
1301
+ sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin("#", committish)}`,
1302
+ sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
1303
+ edittemplate: ({ domain, user, project, committish, editpath, path }) => `https://${domain}/${user}/${project}${maybeJoin("/", editpath, "/", maybeEncode(committish || "HEAD"), "/", path)}`,
1304
+ browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}`,
1305
+ browsetreetemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || "HEAD")}/${path}${maybeJoin("#", hashformat(fragment || ""))}`,
1306
+ browseblobtemplate: ({ domain, user, project, committish, blobpath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish || "HEAD")}/${path}${maybeJoin("#", hashformat(fragment || ""))}`,
1307
+ docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}#readme`,
1308
+ httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
1309
+ filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || "HEAD")}/${path}`,
1310
+ shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin("#", committish)}`,
1311
+ pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin("#", committish)}`,
1312
+ bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`,
1313
+ hashformat: formatHashFragment
1314
+ };
1315
+ var hosts = {};
1316
+ hosts.github = {
1317
+ // First two are insecure and generally shouldn't be used any more, but
1318
+ // they are still supported.
1319
+ protocols: ["git:", "http:", "git+ssh:", "git+https:", "ssh:", "https:"],
1320
+ domain: "github.com",
1321
+ treepath: "tree",
1322
+ blobpath: "blob",
1323
+ editpath: "edit",
1324
+ filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, "@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || "HEAD")}/${path}`,
1325
+ gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
1326
+ tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`,
1327
+ extract: (url) => {
1328
+ let [, user, project, type, committish] = url.pathname.split("/", 5);
1329
+ if (type && type !== "tree") {
1330
+ return;
1331
+ }
1332
+ if (!type) {
1333
+ committish = url.hash.slice(1);
1334
+ }
1335
+ if (project && project.endsWith(".git")) {
1336
+ project = project.slice(0, -4);
1337
+ }
1338
+ if (!user || !project) {
1339
+ return;
1340
+ }
1341
+ return { user, project, committish };
1342
+ }
1343
+ };
1344
+ hosts.bitbucket = {
1345
+ protocols: ["git+ssh:", "git+https:", "ssh:", "https:"],
1346
+ domain: "bitbucket.org",
1347
+ treepath: "src",
1348
+ blobpath: "src",
1349
+ editpath: "?mode=edit",
1350
+ edittemplate: ({ domain, user, project, committish, treepath, path, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish || "HEAD"), "/", path, editpath)}`,
1351
+ tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish || "HEAD")}.tar.gz`,
1352
+ extract: (url) => {
1353
+ let [, user, project, aux] = url.pathname.split("/", 4);
1354
+ if (["get"].includes(aux)) {
1355
+ return;
1356
+ }
1357
+ if (project && project.endsWith(".git")) {
1358
+ project = project.slice(0, -4);
1359
+ }
1360
+ if (!user || !project) {
1361
+ return;
1362
+ }
1363
+ return { user, project, committish: url.hash.slice(1) };
1364
+ }
1365
+ };
1366
+ hosts.gitlab = {
1367
+ protocols: ["git+ssh:", "git+https:", "ssh:", "https:"],
1368
+ domain: "gitlab.com",
1369
+ treepath: "tree",
1370
+ blobpath: "tree",
1371
+ editpath: "-/edit",
1372
+ httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
1373
+ tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish || "HEAD")}`,
1374
+ extract: (url) => {
1375
+ const path = url.pathname.slice(1);
1376
+ if (path.includes("/-/") || path.includes("/archive.tar.gz")) {
1377
+ return;
1378
+ }
1379
+ const segments = path.split("/");
1380
+ let project = segments.pop();
1381
+ if (project.endsWith(".git")) {
1382
+ project = project.slice(0, -4);
1383
+ }
1384
+ const user = segments.join("/");
1385
+ if (!user || !project) {
1386
+ return;
1387
+ }
1388
+ return { user, project, committish: url.hash.slice(1) };
1389
+ }
1390
+ };
1391
+ hosts.gist = {
1392
+ protocols: ["git:", "git+ssh:", "git+https:", "ssh:", "https:"],
1393
+ domain: "gist.github.com",
1394
+ editpath: "edit",
1395
+ sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin("#", committish)}`,
1396
+ sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin("#", committish)}`,
1397
+ edittemplate: ({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", maybeEncode(committish))}/${editpath}`,
1398
+ browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`,
1399
+ browsetreetemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path))}`,
1400
+ browseblobtemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path))}`,
1401
+ docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`,
1402
+ httpstemplate: ({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin("#", committish)}`,
1403
+ filetemplate: ({ user, project, committish, path }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/", maybeEncode(committish))}/${path}`,
1404
+ shortcuttemplate: ({ type, project, committish }) => `${type}:${project}${maybeJoin("#", committish)}`,
1405
+ pathtemplate: ({ project, committish }) => `${project}${maybeJoin("#", committish)}`,
1406
+ bugstemplate: ({ domain, project }) => `https://${domain}/${project}`,
1407
+ gittemplate: ({ domain, project, committish }) => `git://${domain}/${project}.git${maybeJoin("#", committish)}`,
1408
+ tarballtemplate: ({ project, committish }) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`,
1409
+ extract: (url) => {
1410
+ let [, user, project, aux] = url.pathname.split("/", 4);
1411
+ if (aux === "raw") {
1412
+ return;
1413
+ }
1414
+ if (!project) {
1415
+ if (!user) {
1416
+ return;
1417
+ }
1418
+ project = user;
1419
+ user = null;
1420
+ }
1421
+ if (project.endsWith(".git")) {
1422
+ project = project.slice(0, -4);
1423
+ }
1424
+ return { user, project, committish: url.hash.slice(1) };
1425
+ },
1426
+ hashformat: function(fragment) {
1427
+ return fragment && "file-" + formatHashFragment(fragment);
1428
+ }
1429
+ };
1430
+ hosts.sourcehut = {
1431
+ protocols: ["git+ssh:", "https:"],
1432
+ domain: "git.sr.ht",
1433
+ treepath: "tree",
1434
+ blobpath: "tree",
1435
+ filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || "HEAD"}/${path}`,
1436
+ httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
1437
+ tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || "HEAD"}.tar.gz`,
1438
+ bugstemplate: ({ user, project }) => null,
1439
+ extract: (url) => {
1440
+ let [, user, project, aux] = url.pathname.split("/", 4);
1441
+ if (["archive"].includes(aux)) {
1442
+ return;
1443
+ }
1444
+ if (project && project.endsWith(".git")) {
1445
+ project = project.slice(0, -4);
1446
+ }
1447
+ if (!user || !project) {
1448
+ return;
1449
+ }
1450
+ return { user, project, committish: url.hash.slice(1) };
1451
+ }
1452
+ };
1453
+ for (const [name, host] of Object.entries(hosts)) {
1454
+ hosts[name] = Object.assign({}, defaults, host);
1455
+ }
1456
+ module.exports = hosts;
1457
+ }
1458
+ });
1459
+
1460
+ // node_modules/hosted-git-info/lib/parse-url.js
1461
+ var require_parse_url = __commonJS({
1462
+ "node_modules/hosted-git-info/lib/parse-url.js"(exports, module) {
1463
+ init_cjs_shims();
1464
+ var url = __require("url");
1465
+ var lastIndexOfBefore = (str, char, beforeChar) => {
1466
+ const startPosition = str.indexOf(beforeChar);
1467
+ return str.lastIndexOf(char, startPosition > -1 ? startPosition : Infinity);
1468
+ };
1469
+ var safeUrl = (u) => {
1470
+ try {
1471
+ return new url.URL(u);
1472
+ } catch {
1473
+ }
1474
+ };
1475
+ var correctProtocol = (arg, protocols) => {
1476
+ const firstColon = arg.indexOf(":");
1477
+ const proto = arg.slice(0, firstColon + 1);
1478
+ if (Object.prototype.hasOwnProperty.call(protocols, proto)) {
1479
+ return arg;
1480
+ }
1481
+ const firstAt = arg.indexOf("@");
1482
+ if (firstAt > -1) {
1483
+ if (firstAt > firstColon) {
1484
+ return `git+ssh://${arg}`;
1485
+ } else {
1486
+ return arg;
1487
+ }
1488
+ }
1489
+ const doubleSlash = arg.indexOf("//");
1490
+ if (doubleSlash === firstColon + 1) {
1491
+ return arg;
1492
+ }
1493
+ return `${arg.slice(0, firstColon + 1)}//${arg.slice(firstColon + 1)}`;
1494
+ };
1495
+ var correctUrl = (giturl) => {
1496
+ const firstAt = lastIndexOfBefore(giturl, "@", "#");
1497
+ const lastColonBeforeHash = lastIndexOfBefore(giturl, ":", "#");
1498
+ if (lastColonBeforeHash > firstAt) {
1499
+ giturl = giturl.slice(0, lastColonBeforeHash) + "/" + giturl.slice(lastColonBeforeHash + 1);
1500
+ }
1501
+ if (lastIndexOfBefore(giturl, ":", "#") === -1 && giturl.indexOf("//") === -1) {
1502
+ giturl = `git+ssh://${giturl}`;
1503
+ }
1504
+ return giturl;
1505
+ };
1506
+ module.exports = (giturl, protocols) => {
1507
+ const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl;
1508
+ return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol));
1509
+ };
1510
+ }
1511
+ });
1512
+
1513
+ // node_modules/hosted-git-info/lib/from-url.js
1514
+ var require_from_url = __commonJS({
1515
+ "node_modules/hosted-git-info/lib/from-url.js"(exports, module) {
1516
+ "use strict";
1517
+ init_cjs_shims();
1518
+ var parseUrl = require_parse_url();
1519
+ var isGitHubShorthand = (arg) => {
1520
+ const firstHash = arg.indexOf("#");
1521
+ const firstSlash = arg.indexOf("/");
1522
+ const secondSlash = arg.indexOf("/", firstSlash + 1);
1523
+ const firstColon = arg.indexOf(":");
1524
+ const firstSpace = /\s/.exec(arg);
1525
+ const firstAt = arg.indexOf("@");
1526
+ const spaceOnlyAfterHash = !firstSpace || firstHash > -1 && firstSpace.index > firstHash;
1527
+ const atOnlyAfterHash = firstAt === -1 || firstHash > -1 && firstAt > firstHash;
1528
+ const colonOnlyAfterHash = firstColon === -1 || firstHash > -1 && firstColon > firstHash;
1529
+ const secondSlashOnlyAfterHash = secondSlash === -1 || firstHash > -1 && secondSlash > firstHash;
1530
+ const hasSlash = firstSlash > 0;
1531
+ const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== "/" : !arg.endsWith("/");
1532
+ const doesNotStartWithDot = !arg.startsWith(".");
1533
+ return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash;
1534
+ };
1535
+ module.exports = (giturl, opts, { gitHosts, protocols }) => {
1536
+ if (!giturl) {
1537
+ return;
1538
+ }
1539
+ const correctedUrl = isGitHubShorthand(giturl) ? `github:${giturl}` : giturl;
1540
+ const parsed = parseUrl(correctedUrl, protocols);
1541
+ if (!parsed) {
1542
+ return;
1543
+ }
1544
+ const gitHostShortcut = gitHosts.byShortcut[parsed.protocol];
1545
+ const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith("www.") ? parsed.hostname.slice(4) : parsed.hostname];
1546
+ const gitHostName = gitHostShortcut || gitHostDomain;
1547
+ if (!gitHostName) {
1548
+ return;
1549
+ }
1550
+ const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain];
1551
+ let auth = null;
1552
+ if (protocols[parsed.protocol]?.auth && (parsed.username || parsed.password)) {
1553
+ auth = `${parsed.username}${parsed.password ? ":" + parsed.password : ""}`;
1554
+ }
1555
+ let committish = null;
1556
+ let user = null;
1557
+ let project = null;
1558
+ let defaultRepresentation = null;
1559
+ try {
1560
+ if (gitHostShortcut) {
1561
+ let pathname = parsed.pathname.startsWith("/") ? parsed.pathname.slice(1) : parsed.pathname;
1562
+ const firstAt = pathname.indexOf("@");
1563
+ if (firstAt > -1) {
1564
+ pathname = pathname.slice(firstAt + 1);
1565
+ }
1566
+ const lastSlash = pathname.lastIndexOf("/");
1567
+ if (lastSlash > -1) {
1568
+ user = decodeURIComponent(pathname.slice(0, lastSlash));
1569
+ if (!user) {
1570
+ user = null;
1571
+ }
1572
+ project = decodeURIComponent(pathname.slice(lastSlash + 1));
1573
+ } else {
1574
+ project = decodeURIComponent(pathname);
1575
+ }
1576
+ if (project.endsWith(".git")) {
1577
+ project = project.slice(0, -4);
1578
+ }
1579
+ if (parsed.hash) {
1580
+ committish = decodeURIComponent(parsed.hash.slice(1));
1581
+ }
1582
+ defaultRepresentation = "shortcut";
1583
+ } else {
1584
+ if (!gitHostInfo.protocols.includes(parsed.protocol)) {
1585
+ return;
1586
+ }
1587
+ const segments = gitHostInfo.extract(parsed);
1588
+ if (!segments) {
1589
+ return;
1590
+ }
1591
+ user = segments.user && decodeURIComponent(segments.user);
1592
+ project = decodeURIComponent(segments.project);
1593
+ committish = decodeURIComponent(segments.committish);
1594
+ defaultRepresentation = protocols[parsed.protocol]?.name || parsed.protocol.slice(0, -1);
1595
+ }
1596
+ } catch (err) {
1597
+ if (err instanceof URIError) {
1598
+ return;
1599
+ } else {
1600
+ throw err;
1601
+ }
1602
+ }
1603
+ return [gitHostName, user, auth, project, committish, defaultRepresentation, opts];
1604
+ };
1605
+ }
1606
+ });
1607
+
1608
+ // node_modules/hosted-git-info/lib/index.js
1609
+ var require_lib = __commonJS({
1610
+ "node_modules/hosted-git-info/lib/index.js"(exports, module) {
1611
+ "use strict";
1612
+ init_cjs_shims();
1613
+ var { LRUCache } = require_commonjs();
1614
+ var hosts = require_hosts();
1615
+ var fromUrl = require_from_url();
1616
+ var parseUrl = require_parse_url();
1617
+ var cache = new LRUCache({ max: 1e3 });
1618
+ var GitHost = class _GitHost {
1619
+ constructor(type, user, auth, project, committish, defaultRepresentation, opts = {}) {
1620
+ Object.assign(this, _GitHost.#gitHosts[type], {
1621
+ type,
1622
+ user,
1623
+ auth,
1624
+ project,
1625
+ committish,
1626
+ default: defaultRepresentation,
1627
+ opts
1628
+ });
1629
+ }
1630
+ static #gitHosts = { byShortcut: {}, byDomain: {} };
1631
+ static #protocols = {
1632
+ "git+ssh:": { name: "sshurl" },
1633
+ "ssh:": { name: "sshurl" },
1634
+ "git+https:": { name: "https", auth: true },
1635
+ "git:": { auth: true },
1636
+ "http:": { auth: true },
1637
+ "https:": { auth: true },
1638
+ "git+http:": { auth: true }
1639
+ };
1640
+ static addHost(name, host) {
1641
+ _GitHost.#gitHosts[name] = host;
1642
+ _GitHost.#gitHosts.byDomain[host.domain] = name;
1643
+ _GitHost.#gitHosts.byShortcut[`${name}:`] = name;
1644
+ _GitHost.#protocols[`${name}:`] = { name };
1645
+ }
1646
+ static fromUrl(giturl, opts) {
1647
+ if (typeof giturl !== "string") {
1648
+ return;
1649
+ }
1650
+ const key = giturl + JSON.stringify(opts || {});
1651
+ if (!cache.has(key)) {
1652
+ const hostArgs = fromUrl(giturl, opts, {
1653
+ gitHosts: _GitHost.#gitHosts,
1654
+ protocols: _GitHost.#protocols
1655
+ });
1656
+ cache.set(key, hostArgs ? new _GitHost(...hostArgs) : void 0);
1657
+ }
1658
+ return cache.get(key);
1659
+ }
1660
+ static parseUrl(url) {
1661
+ return parseUrl(url);
1662
+ }
1663
+ #fill(template, opts) {
1664
+ if (typeof template !== "function") {
1665
+ return null;
1666
+ }
1667
+ const options = { ...this, ...this.opts, ...opts };
1668
+ if (!options.path) {
1669
+ options.path = "";
1670
+ }
1671
+ if (options.path.startsWith("/")) {
1672
+ options.path = options.path.slice(1);
1673
+ }
1674
+ if (options.noCommittish) {
1675
+ options.committish = null;
1676
+ }
1677
+ const result = template(options);
1678
+ return options.noGitPlus && result.startsWith("git+") ? result.slice(4) : result;
1679
+ }
1680
+ hash() {
1681
+ return this.committish ? `#${this.committish}` : "";
1682
+ }
1683
+ ssh(opts) {
1684
+ return this.#fill(this.sshtemplate, opts);
1685
+ }
1686
+ sshurl(opts) {
1687
+ return this.#fill(this.sshurltemplate, opts);
1688
+ }
1689
+ browse(path, ...args) {
1690
+ if (typeof path !== "string") {
1691
+ return this.#fill(this.browsetemplate, path);
1692
+ }
1693
+ if (typeof args[0] !== "string") {
1694
+ return this.#fill(this.browsetreetemplate, { ...args[0], path });
1695
+ }
1696
+ return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path });
1697
+ }
1698
+ // If the path is known to be a file, then browseFile should be used. For some hosts
1699
+ // the url is the same as browse, but for others like GitHub a file can use both `/tree/`
1700
+ // and `/blob/` in the path. When using a default committish of `HEAD` then the `/tree/`
1701
+ // path will redirect to a specific commit. Using the `/blob/` path avoids this and
1702
+ // does not redirect to a different commit.
1703
+ browseFile(path, ...args) {
1704
+ if (typeof args[0] !== "string") {
1705
+ return this.#fill(this.browseblobtemplate, { ...args[0], path });
1706
+ }
1707
+ return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path });
1708
+ }
1709
+ docs(opts) {
1710
+ return this.#fill(this.docstemplate, opts);
1711
+ }
1712
+ bugs(opts) {
1713
+ return this.#fill(this.bugstemplate, opts);
1714
+ }
1715
+ https(opts) {
1716
+ return this.#fill(this.httpstemplate, opts);
1717
+ }
1718
+ git(opts) {
1719
+ return this.#fill(this.gittemplate, opts);
1720
+ }
1721
+ shortcut(opts) {
1722
+ return this.#fill(this.shortcuttemplate, opts);
1723
+ }
1724
+ path(opts) {
1725
+ return this.#fill(this.pathtemplate, opts);
1726
+ }
1727
+ tarball(opts) {
1728
+ return this.#fill(this.tarballtemplate, { ...opts, noCommittish: false });
1729
+ }
1730
+ file(path, opts) {
1731
+ return this.#fill(this.filetemplate, { ...opts, path });
1732
+ }
1733
+ edit(path, opts) {
1734
+ return this.#fill(this.edittemplate, { ...opts, path });
1735
+ }
1736
+ getDefaultRepresentation() {
1737
+ return this.default;
1738
+ }
1739
+ toString(opts) {
1740
+ if (this.default && typeof this[this.default] === "function") {
1741
+ return this[this.default](opts);
1742
+ }
1743
+ return this.sshurl(opts);
1744
+ }
1745
+ };
1746
+ for (const [name, host] of Object.entries(hosts)) {
1747
+ GitHost.addHost(name, host);
1748
+ }
1749
+ module.exports = GitHost;
1750
+ }
1751
+ });
1752
+
1753
+ // node_modules/semver/internal/constants.js
1754
+ var require_constants = __commonJS({
1755
+ "node_modules/semver/internal/constants.js"(exports, module) {
1756
+ init_cjs_shims();
1757
+ var SEMVER_SPEC_VERSION = "2.0.0";
1758
+ var MAX_LENGTH = 256;
1759
+ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
1760
+ 9007199254740991;
1761
+ var MAX_SAFE_COMPONENT_LENGTH = 16;
1762
+ var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
1763
+ var RELEASE_TYPES = [
1764
+ "major",
1765
+ "premajor",
1766
+ "minor",
1767
+ "preminor",
1768
+ "patch",
1769
+ "prepatch",
1770
+ "prerelease"
1771
+ ];
1772
+ module.exports = {
1773
+ MAX_LENGTH,
1774
+ MAX_SAFE_COMPONENT_LENGTH,
1775
+ MAX_SAFE_BUILD_LENGTH,
1776
+ MAX_SAFE_INTEGER,
1777
+ RELEASE_TYPES,
1778
+ SEMVER_SPEC_VERSION,
1779
+ FLAG_INCLUDE_PRERELEASE: 1,
1780
+ FLAG_LOOSE: 2
1781
+ };
1782
+ }
1783
+ });
1784
+
1785
+ // node_modules/semver/internal/debug.js
1786
+ var require_debug = __commonJS({
1787
+ "node_modules/semver/internal/debug.js"(exports, module) {
1788
+ init_cjs_shims();
1789
+ var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
1790
+ };
1791
+ module.exports = debug;
1792
+ }
1793
+ });
1794
+
1795
+ // node_modules/semver/internal/re.js
1796
+ var require_re = __commonJS({
1797
+ "node_modules/semver/internal/re.js"(exports, module) {
1798
+ init_cjs_shims();
1799
+ var {
1800
+ MAX_SAFE_COMPONENT_LENGTH,
1801
+ MAX_SAFE_BUILD_LENGTH,
1802
+ MAX_LENGTH
1803
+ } = require_constants();
1804
+ var debug = require_debug();
1805
+ exports = module.exports = {};
1806
+ var re = exports.re = [];
1807
+ var safeRe = exports.safeRe = [];
1808
+ var src = exports.src = [];
1809
+ var t = exports.t = {};
1810
+ var R = 0;
1811
+ var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
1812
+ var safeRegexReplacements = [
1813
+ ["\\s", 1],
1814
+ ["\\d", MAX_LENGTH],
1815
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
1816
+ ];
1817
+ var makeSafeRegex = (value) => {
1818
+ for (const [token, max] of safeRegexReplacements) {
1819
+ value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
1820
+ }
1821
+ return value;
1822
+ };
1823
+ var createToken = (name, value, isGlobal) => {
1824
+ const safe = makeSafeRegex(value);
1825
+ const index = R++;
1826
+ debug(name, index, value);
1827
+ t[name] = index;
1828
+ src[index] = value;
1829
+ re[index] = new RegExp(value, isGlobal ? "g" : void 0);
1830
+ safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
1831
+ };
1832
+ createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
1833
+ createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
1834
+ createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
1835
+ createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
1836
+ createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
1837
+ createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
1838
+ createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
1839
+ createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
1840
+ createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
1841
+ createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
1842
+ createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
1843
+ createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
1844
+ createToken("FULL", `^${src[t.FULLPLAIN]}$`);
1845
+ createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
1846
+ createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
1847
+ createToken("GTLT", "((?:<|>)?=?)");
1848
+ createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
1849
+ createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
1850
+ createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
1851
+ createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
1852
+ createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
1853
+ createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
1854
+ createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
1855
+ createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
1856
+ createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
1857
+ createToken("COERCERTL", src[t.COERCE], true);
1858
+ createToken("COERCERTLFULL", src[t.COERCEFULL], true);
1859
+ createToken("LONETILDE", "(?:~>?)");
1860
+ createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
1861
+ exports.tildeTrimReplace = "$1~";
1862
+ createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
1863
+ createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
1864
+ createToken("LONECARET", "(?:\\^)");
1865
+ createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
1866
+ exports.caretTrimReplace = "$1^";
1867
+ createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
1868
+ createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
1869
+ createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
1870
+ createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
1871
+ createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
1872
+ exports.comparatorTrimReplace = "$1$2$3";
1873
+ createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
1874
+ createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
1875
+ createToken("STAR", "(<|>)?=?\\s*\\*");
1876
+ createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
1877
+ createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
1878
+ }
1879
+ });
1880
+
1881
+ // node_modules/semver/internal/parse-options.js
1882
+ var require_parse_options = __commonJS({
1883
+ "node_modules/semver/internal/parse-options.js"(exports, module) {
1884
+ init_cjs_shims();
1885
+ var looseOption = Object.freeze({ loose: true });
1886
+ var emptyOpts = Object.freeze({});
1887
+ var parseOptions = (options) => {
1888
+ if (!options) {
1889
+ return emptyOpts;
1890
+ }
1891
+ if (typeof options !== "object") {
1892
+ return looseOption;
1893
+ }
1894
+ return options;
1895
+ };
1896
+ module.exports = parseOptions;
1897
+ }
1898
+ });
1899
+
1900
+ // node_modules/semver/internal/identifiers.js
1901
+ var require_identifiers = __commonJS({
1902
+ "node_modules/semver/internal/identifiers.js"(exports, module) {
1903
+ init_cjs_shims();
1904
+ var numeric = /^[0-9]+$/;
1905
+ var compareIdentifiers = (a, b) => {
1906
+ const anum = numeric.test(a);
1907
+ const bnum = numeric.test(b);
1908
+ if (anum && bnum) {
1909
+ a = +a;
1910
+ b = +b;
1911
+ }
1912
+ return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
1913
+ };
1914
+ var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
1915
+ module.exports = {
1916
+ compareIdentifiers,
1917
+ rcompareIdentifiers
1918
+ };
1919
+ }
1920
+ });
1921
+
1922
+ // node_modules/semver/classes/semver.js
1923
+ var require_semver = __commonJS({
1924
+ "node_modules/semver/classes/semver.js"(exports, module) {
1925
+ init_cjs_shims();
1926
+ var debug = require_debug();
1927
+ var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
1928
+ var { safeRe: re, t } = require_re();
1929
+ var parseOptions = require_parse_options();
1930
+ var { compareIdentifiers } = require_identifiers();
1931
+ var SemVer = class _SemVer {
1932
+ constructor(version, options) {
1933
+ options = parseOptions(options);
1934
+ if (version instanceof _SemVer) {
1935
+ if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
1936
+ return version;
1937
+ } else {
1938
+ version = version.version;
1939
+ }
1940
+ } else if (typeof version !== "string") {
1941
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
1942
+ }
1943
+ if (version.length > MAX_LENGTH) {
1944
+ throw new TypeError(
1945
+ `version is longer than ${MAX_LENGTH} characters`
1946
+ );
1947
+ }
1948
+ debug("SemVer", version, options);
1949
+ this.options = options;
1950
+ this.loose = !!options.loose;
1951
+ this.includePrerelease = !!options.includePrerelease;
1952
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
1953
+ if (!m) {
1954
+ throw new TypeError(`Invalid Version: ${version}`);
1955
+ }
1956
+ this.raw = version;
1957
+ this.major = +m[1];
1958
+ this.minor = +m[2];
1959
+ this.patch = +m[3];
1960
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
1961
+ throw new TypeError("Invalid major version");
1962
+ }
1963
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
1964
+ throw new TypeError("Invalid minor version");
1965
+ }
1966
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
1967
+ throw new TypeError("Invalid patch version");
1968
+ }
1969
+ if (!m[4]) {
1970
+ this.prerelease = [];
1971
+ } else {
1972
+ this.prerelease = m[4].split(".").map((id) => {
1973
+ if (/^[0-9]+$/.test(id)) {
1974
+ const num = +id;
1975
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
1976
+ return num;
1977
+ }
1978
+ }
1979
+ return id;
1980
+ });
1981
+ }
1982
+ this.build = m[5] ? m[5].split(".") : [];
1983
+ this.format();
1984
+ }
1985
+ format() {
1986
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
1987
+ if (this.prerelease.length) {
1988
+ this.version += `-${this.prerelease.join(".")}`;
1989
+ }
1990
+ return this.version;
1991
+ }
1992
+ toString() {
1993
+ return this.version;
1994
+ }
1995
+ compare(other) {
1996
+ debug("SemVer.compare", this.version, this.options, other);
1997
+ if (!(other instanceof _SemVer)) {
1998
+ if (typeof other === "string" && other === this.version) {
1999
+ return 0;
2000
+ }
2001
+ other = new _SemVer(other, this.options);
2002
+ }
2003
+ if (other.version === this.version) {
2004
+ return 0;
2005
+ }
2006
+ return this.compareMain(other) || this.comparePre(other);
2007
+ }
2008
+ compareMain(other) {
2009
+ if (!(other instanceof _SemVer)) {
2010
+ other = new _SemVer(other, this.options);
2011
+ }
2012
+ return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
2013
+ }
2014
+ comparePre(other) {
2015
+ if (!(other instanceof _SemVer)) {
2016
+ other = new _SemVer(other, this.options);
2017
+ }
2018
+ if (this.prerelease.length && !other.prerelease.length) {
2019
+ return -1;
2020
+ } else if (!this.prerelease.length && other.prerelease.length) {
2021
+ return 1;
2022
+ } else if (!this.prerelease.length && !other.prerelease.length) {
2023
+ return 0;
2024
+ }
2025
+ let i = 0;
2026
+ do {
2027
+ const a = this.prerelease[i];
2028
+ const b = other.prerelease[i];
2029
+ debug("prerelease compare", i, a, b);
2030
+ if (a === void 0 && b === void 0) {
2031
+ return 0;
2032
+ } else if (b === void 0) {
2033
+ return 1;
2034
+ } else if (a === void 0) {
2035
+ return -1;
2036
+ } else if (a === b) {
2037
+ continue;
2038
+ } else {
2039
+ return compareIdentifiers(a, b);
2040
+ }
2041
+ } while (++i);
2042
+ }
2043
+ compareBuild(other) {
2044
+ if (!(other instanceof _SemVer)) {
2045
+ other = new _SemVer(other, this.options);
2046
+ }
2047
+ let i = 0;
2048
+ do {
2049
+ const a = this.build[i];
2050
+ const b = other.build[i];
2051
+ debug("prerelease compare", i, a, b);
2052
+ if (a === void 0 && b === void 0) {
2053
+ return 0;
2054
+ } else if (b === void 0) {
2055
+ return 1;
2056
+ } else if (a === void 0) {
2057
+ return -1;
2058
+ } else if (a === b) {
2059
+ continue;
2060
+ } else {
2061
+ return compareIdentifiers(a, b);
2062
+ }
2063
+ } while (++i);
2064
+ }
2065
+ // preminor will bump the version up to the next minor release, and immediately
2066
+ // down to pre-release. premajor and prepatch work the same way.
2067
+ inc(release, identifier, identifierBase) {
2068
+ switch (release) {
2069
+ case "premajor":
2070
+ this.prerelease.length = 0;
2071
+ this.patch = 0;
2072
+ this.minor = 0;
2073
+ this.major++;
2074
+ this.inc("pre", identifier, identifierBase);
2075
+ break;
2076
+ case "preminor":
2077
+ this.prerelease.length = 0;
2078
+ this.patch = 0;
2079
+ this.minor++;
2080
+ this.inc("pre", identifier, identifierBase);
2081
+ break;
2082
+ case "prepatch":
2083
+ this.prerelease.length = 0;
2084
+ this.inc("patch", identifier, identifierBase);
2085
+ this.inc("pre", identifier, identifierBase);
2086
+ break;
2087
+ case "prerelease":
2088
+ if (this.prerelease.length === 0) {
2089
+ this.inc("patch", identifier, identifierBase);
2090
+ }
2091
+ this.inc("pre", identifier, identifierBase);
2092
+ break;
2093
+ case "major":
2094
+ if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
2095
+ this.major++;
2096
+ }
2097
+ this.minor = 0;
2098
+ this.patch = 0;
2099
+ this.prerelease = [];
2100
+ break;
2101
+ case "minor":
2102
+ if (this.patch !== 0 || this.prerelease.length === 0) {
2103
+ this.minor++;
2104
+ }
2105
+ this.patch = 0;
2106
+ this.prerelease = [];
2107
+ break;
2108
+ case "patch":
2109
+ if (this.prerelease.length === 0) {
2110
+ this.patch++;
2111
+ }
2112
+ this.prerelease = [];
2113
+ break;
2114
+ case "pre": {
2115
+ const base = Number(identifierBase) ? 1 : 0;
2116
+ if (!identifier && identifierBase === false) {
2117
+ throw new Error("invalid increment argument: identifier is empty");
2118
+ }
2119
+ if (this.prerelease.length === 0) {
2120
+ this.prerelease = [base];
2121
+ } else {
2122
+ let i = this.prerelease.length;
2123
+ while (--i >= 0) {
2124
+ if (typeof this.prerelease[i] === "number") {
2125
+ this.prerelease[i]++;
2126
+ i = -2;
2127
+ }
2128
+ }
2129
+ if (i === -1) {
2130
+ if (identifier === this.prerelease.join(".") && identifierBase === false) {
2131
+ throw new Error("invalid increment argument: identifier already exists");
2132
+ }
2133
+ this.prerelease.push(base);
2134
+ }
2135
+ }
2136
+ if (identifier) {
2137
+ let prerelease = [identifier, base];
2138
+ if (identifierBase === false) {
2139
+ prerelease = [identifier];
2140
+ }
2141
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
2142
+ if (isNaN(this.prerelease[1])) {
2143
+ this.prerelease = prerelease;
2144
+ }
2145
+ } else {
2146
+ this.prerelease = prerelease;
2147
+ }
2148
+ }
2149
+ break;
2150
+ }
2151
+ default:
2152
+ throw new Error(`invalid increment argument: ${release}`);
2153
+ }
2154
+ this.raw = this.format();
2155
+ if (this.build.length) {
2156
+ this.raw += `+${this.build.join(".")}`;
2157
+ }
2158
+ return this;
2159
+ }
2160
+ };
2161
+ module.exports = SemVer;
2162
+ }
2163
+ });
2164
+
2165
+ // node_modules/semver/functions/parse.js
2166
+ var require_parse = __commonJS({
2167
+ "node_modules/semver/functions/parse.js"(exports, module) {
2168
+ init_cjs_shims();
2169
+ var SemVer = require_semver();
2170
+ var parse = (version, options, throwErrors = false) => {
2171
+ if (version instanceof SemVer) {
2172
+ return version;
2173
+ }
2174
+ try {
2175
+ return new SemVer(version, options);
2176
+ } catch (er) {
2177
+ if (!throwErrors) {
2178
+ return null;
2179
+ }
2180
+ throw er;
2181
+ }
2182
+ };
2183
+ module.exports = parse;
2184
+ }
2185
+ });
2186
+
2187
+ // node_modules/semver/functions/valid.js
2188
+ var require_valid = __commonJS({
2189
+ "node_modules/semver/functions/valid.js"(exports, module) {
2190
+ init_cjs_shims();
2191
+ var parse = require_parse();
2192
+ var valid = (version, options) => {
2193
+ const v = parse(version, options);
2194
+ return v ? v.version : null;
2195
+ };
2196
+ module.exports = valid;
2197
+ }
2198
+ });
2199
+
2200
+ // node_modules/semver/functions/clean.js
2201
+ var require_clean = __commonJS({
2202
+ "node_modules/semver/functions/clean.js"(exports, module) {
2203
+ init_cjs_shims();
2204
+ var parse = require_parse();
2205
+ var clean = (version, options) => {
2206
+ const s = parse(version.trim().replace(/^[=v]+/, ""), options);
2207
+ return s ? s.version : null;
2208
+ };
2209
+ module.exports = clean;
2210
+ }
2211
+ });
2212
+
2213
+ // node_modules/semver/functions/inc.js
2214
+ var require_inc = __commonJS({
2215
+ "node_modules/semver/functions/inc.js"(exports, module) {
2216
+ init_cjs_shims();
2217
+ var SemVer = require_semver();
2218
+ var inc = (version, release, options, identifier, identifierBase) => {
2219
+ if (typeof options === "string") {
2220
+ identifierBase = identifier;
2221
+ identifier = options;
2222
+ options = void 0;
2223
+ }
2224
+ try {
2225
+ return new SemVer(
2226
+ version instanceof SemVer ? version.version : version,
2227
+ options
2228
+ ).inc(release, identifier, identifierBase).version;
2229
+ } catch (er) {
2230
+ return null;
2231
+ }
2232
+ };
2233
+ module.exports = inc;
2234
+ }
2235
+ });
2236
+
2237
+ // node_modules/semver/functions/diff.js
2238
+ var require_diff = __commonJS({
2239
+ "node_modules/semver/functions/diff.js"(exports, module) {
2240
+ init_cjs_shims();
2241
+ var parse = require_parse();
2242
+ var diff = (version1, version2) => {
2243
+ const v1 = parse(version1, null, true);
2244
+ const v2 = parse(version2, null, true);
2245
+ const comparison = v1.compare(v2);
2246
+ if (comparison === 0) {
2247
+ return null;
2248
+ }
2249
+ const v1Higher = comparison > 0;
2250
+ const highVersion = v1Higher ? v1 : v2;
2251
+ const lowVersion = v1Higher ? v2 : v1;
2252
+ const highHasPre = !!highVersion.prerelease.length;
2253
+ const lowHasPre = !!lowVersion.prerelease.length;
2254
+ if (lowHasPre && !highHasPre) {
2255
+ if (!lowVersion.patch && !lowVersion.minor) {
2256
+ return "major";
2257
+ }
2258
+ if (highVersion.patch) {
2259
+ return "patch";
2260
+ }
2261
+ if (highVersion.minor) {
2262
+ return "minor";
2263
+ }
2264
+ return "major";
2265
+ }
2266
+ const prefix = highHasPre ? "pre" : "";
2267
+ if (v1.major !== v2.major) {
2268
+ return prefix + "major";
2269
+ }
2270
+ if (v1.minor !== v2.minor) {
2271
+ return prefix + "minor";
2272
+ }
2273
+ if (v1.patch !== v2.patch) {
2274
+ return prefix + "patch";
2275
+ }
2276
+ return "prerelease";
2277
+ };
2278
+ module.exports = diff;
2279
+ }
2280
+ });
2281
+
2282
+ // node_modules/semver/functions/major.js
2283
+ var require_major = __commonJS({
2284
+ "node_modules/semver/functions/major.js"(exports, module) {
2285
+ init_cjs_shims();
2286
+ var SemVer = require_semver();
2287
+ var major = (a, loose) => new SemVer(a, loose).major;
2288
+ module.exports = major;
2289
+ }
2290
+ });
2291
+
2292
+ // node_modules/semver/functions/minor.js
2293
+ var require_minor = __commonJS({
2294
+ "node_modules/semver/functions/minor.js"(exports, module) {
2295
+ init_cjs_shims();
2296
+ var SemVer = require_semver();
2297
+ var minor = (a, loose) => new SemVer(a, loose).minor;
2298
+ module.exports = minor;
2299
+ }
2300
+ });
2301
+
2302
+ // node_modules/semver/functions/patch.js
2303
+ var require_patch = __commonJS({
2304
+ "node_modules/semver/functions/patch.js"(exports, module) {
2305
+ init_cjs_shims();
2306
+ var SemVer = require_semver();
2307
+ var patch = (a, loose) => new SemVer(a, loose).patch;
2308
+ module.exports = patch;
2309
+ }
2310
+ });
2311
+
2312
+ // node_modules/semver/functions/prerelease.js
2313
+ var require_prerelease = __commonJS({
2314
+ "node_modules/semver/functions/prerelease.js"(exports, module) {
2315
+ init_cjs_shims();
2316
+ var parse = require_parse();
2317
+ var prerelease = (version, options) => {
2318
+ const parsed = parse(version, options);
2319
+ return parsed && parsed.prerelease.length ? parsed.prerelease : null;
2320
+ };
2321
+ module.exports = prerelease;
2322
+ }
2323
+ });
2324
+
2325
+ // node_modules/semver/functions/compare.js
2326
+ var require_compare = __commonJS({
2327
+ "node_modules/semver/functions/compare.js"(exports, module) {
2328
+ init_cjs_shims();
2329
+ var SemVer = require_semver();
2330
+ var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
2331
+ module.exports = compare;
2332
+ }
2333
+ });
2334
+
2335
+ // node_modules/semver/functions/rcompare.js
2336
+ var require_rcompare = __commonJS({
2337
+ "node_modules/semver/functions/rcompare.js"(exports, module) {
2338
+ init_cjs_shims();
2339
+ var compare = require_compare();
2340
+ var rcompare = (a, b, loose) => compare(b, a, loose);
2341
+ module.exports = rcompare;
2342
+ }
2343
+ });
2344
+
2345
+ // node_modules/semver/functions/compare-loose.js
2346
+ var require_compare_loose = __commonJS({
2347
+ "node_modules/semver/functions/compare-loose.js"(exports, module) {
2348
+ init_cjs_shims();
2349
+ var compare = require_compare();
2350
+ var compareLoose = (a, b) => compare(a, b, true);
2351
+ module.exports = compareLoose;
2352
+ }
2353
+ });
2354
+
2355
+ // node_modules/semver/functions/compare-build.js
2356
+ var require_compare_build = __commonJS({
2357
+ "node_modules/semver/functions/compare-build.js"(exports, module) {
2358
+ init_cjs_shims();
2359
+ var SemVer = require_semver();
2360
+ var compareBuild = (a, b, loose) => {
2361
+ const versionA = new SemVer(a, loose);
2362
+ const versionB = new SemVer(b, loose);
2363
+ return versionA.compare(versionB) || versionA.compareBuild(versionB);
2364
+ };
2365
+ module.exports = compareBuild;
2366
+ }
2367
+ });
2368
+
2369
+ // node_modules/semver/functions/sort.js
2370
+ var require_sort = __commonJS({
2371
+ "node_modules/semver/functions/sort.js"(exports, module) {
2372
+ init_cjs_shims();
2373
+ var compareBuild = require_compare_build();
2374
+ var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
2375
+ module.exports = sort;
2376
+ }
2377
+ });
2378
+
2379
+ // node_modules/semver/functions/rsort.js
2380
+ var require_rsort = __commonJS({
2381
+ "node_modules/semver/functions/rsort.js"(exports, module) {
2382
+ init_cjs_shims();
2383
+ var compareBuild = require_compare_build();
2384
+ var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
2385
+ module.exports = rsort;
2386
+ }
2387
+ });
2388
+
2389
+ // node_modules/semver/functions/gt.js
2390
+ var require_gt = __commonJS({
2391
+ "node_modules/semver/functions/gt.js"(exports, module) {
2392
+ init_cjs_shims();
2393
+ var compare = require_compare();
2394
+ var gt = (a, b, loose) => compare(a, b, loose) > 0;
2395
+ module.exports = gt;
2396
+ }
2397
+ });
2398
+
2399
+ // node_modules/semver/functions/lt.js
2400
+ var require_lt = __commonJS({
2401
+ "node_modules/semver/functions/lt.js"(exports, module) {
2402
+ init_cjs_shims();
2403
+ var compare = require_compare();
2404
+ var lt = (a, b, loose) => compare(a, b, loose) < 0;
2405
+ module.exports = lt;
2406
+ }
2407
+ });
2408
+
2409
+ // node_modules/semver/functions/eq.js
2410
+ var require_eq = __commonJS({
2411
+ "node_modules/semver/functions/eq.js"(exports, module) {
2412
+ init_cjs_shims();
2413
+ var compare = require_compare();
2414
+ var eq = (a, b, loose) => compare(a, b, loose) === 0;
2415
+ module.exports = eq;
2416
+ }
2417
+ });
2418
+
2419
+ // node_modules/semver/functions/neq.js
2420
+ var require_neq = __commonJS({
2421
+ "node_modules/semver/functions/neq.js"(exports, module) {
2422
+ init_cjs_shims();
2423
+ var compare = require_compare();
2424
+ var neq = (a, b, loose) => compare(a, b, loose) !== 0;
2425
+ module.exports = neq;
2426
+ }
2427
+ });
2428
+
2429
+ // node_modules/semver/functions/gte.js
2430
+ var require_gte = __commonJS({
2431
+ "node_modules/semver/functions/gte.js"(exports, module) {
2432
+ init_cjs_shims();
2433
+ var compare = require_compare();
2434
+ var gte = (a, b, loose) => compare(a, b, loose) >= 0;
2435
+ module.exports = gte;
2436
+ }
2437
+ });
2438
+
2439
+ // node_modules/semver/functions/lte.js
2440
+ var require_lte = __commonJS({
2441
+ "node_modules/semver/functions/lte.js"(exports, module) {
2442
+ init_cjs_shims();
2443
+ var compare = require_compare();
2444
+ var lte = (a, b, loose) => compare(a, b, loose) <= 0;
2445
+ module.exports = lte;
2446
+ }
2447
+ });
2448
+
2449
+ // node_modules/semver/functions/cmp.js
2450
+ var require_cmp = __commonJS({
2451
+ "node_modules/semver/functions/cmp.js"(exports, module) {
2452
+ init_cjs_shims();
2453
+ var eq = require_eq();
2454
+ var neq = require_neq();
2455
+ var gt = require_gt();
2456
+ var gte = require_gte();
2457
+ var lt = require_lt();
2458
+ var lte = require_lte();
2459
+ var cmp = (a, op, b, loose) => {
2460
+ switch (op) {
2461
+ case "===":
2462
+ if (typeof a === "object") {
2463
+ a = a.version;
2464
+ }
2465
+ if (typeof b === "object") {
2466
+ b = b.version;
2467
+ }
2468
+ return a === b;
2469
+ case "!==":
2470
+ if (typeof a === "object") {
2471
+ a = a.version;
2472
+ }
2473
+ if (typeof b === "object") {
2474
+ b = b.version;
2475
+ }
2476
+ return a !== b;
2477
+ case "":
2478
+ case "=":
2479
+ case "==":
2480
+ return eq(a, b, loose);
2481
+ case "!=":
2482
+ return neq(a, b, loose);
2483
+ case ">":
2484
+ return gt(a, b, loose);
2485
+ case ">=":
2486
+ return gte(a, b, loose);
2487
+ case "<":
2488
+ return lt(a, b, loose);
2489
+ case "<=":
2490
+ return lte(a, b, loose);
2491
+ default:
2492
+ throw new TypeError(`Invalid operator: ${op}`);
2493
+ }
2494
+ };
2495
+ module.exports = cmp;
2496
+ }
2497
+ });
2498
+
2499
+ // node_modules/semver/functions/coerce.js
2500
+ var require_coerce = __commonJS({
2501
+ "node_modules/semver/functions/coerce.js"(exports, module) {
2502
+ init_cjs_shims();
2503
+ var SemVer = require_semver();
2504
+ var parse = require_parse();
2505
+ var { safeRe: re, t } = require_re();
2506
+ var coerce = (version, options) => {
2507
+ if (version instanceof SemVer) {
2508
+ return version;
2509
+ }
2510
+ if (typeof version === "number") {
2511
+ version = String(version);
2512
+ }
2513
+ if (typeof version !== "string") {
2514
+ return null;
2515
+ }
2516
+ options = options || {};
2517
+ let match = null;
2518
+ if (!options.rtl) {
2519
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
2520
+ } else {
2521
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
2522
+ let next;
2523
+ while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
2524
+ if (!match || next.index + next[0].length !== match.index + match[0].length) {
2525
+ match = next;
2526
+ }
2527
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
2528
+ }
2529
+ coerceRtlRegex.lastIndex = -1;
2530
+ }
2531
+ if (match === null) {
2532
+ return null;
2533
+ }
2534
+ const major = match[2];
2535
+ const minor = match[3] || "0";
2536
+ const patch = match[4] || "0";
2537
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
2538
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
2539
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
2540
+ };
2541
+ module.exports = coerce;
2542
+ }
2543
+ });
2544
+
2545
+ // node_modules/yallist/iterator.js
2546
+ var require_iterator = __commonJS({
2547
+ "node_modules/yallist/iterator.js"(exports, module) {
2548
+ "use strict";
2549
+ init_cjs_shims();
2550
+ module.exports = function(Yallist) {
2551
+ Yallist.prototype[Symbol.iterator] = function* () {
2552
+ for (let walker = this.head; walker; walker = walker.next) {
2553
+ yield walker.value;
2554
+ }
2555
+ };
2556
+ };
2557
+ }
2558
+ });
2559
+
2560
+ // node_modules/yallist/yallist.js
2561
+ var require_yallist = __commonJS({
2562
+ "node_modules/yallist/yallist.js"(exports, module) {
2563
+ "use strict";
2564
+ init_cjs_shims();
2565
+ module.exports = Yallist;
2566
+ Yallist.Node = Node;
2567
+ Yallist.create = Yallist;
2568
+ function Yallist(list) {
2569
+ var self = this;
2570
+ if (!(self instanceof Yallist)) {
2571
+ self = new Yallist();
2572
+ }
2573
+ self.tail = null;
2574
+ self.head = null;
2575
+ self.length = 0;
2576
+ if (list && typeof list.forEach === "function") {
2577
+ list.forEach(function(item) {
2578
+ self.push(item);
2579
+ });
2580
+ } else if (arguments.length > 0) {
2581
+ for (var i = 0, l = arguments.length; i < l; i++) {
2582
+ self.push(arguments[i]);
2583
+ }
2584
+ }
2585
+ return self;
2586
+ }
2587
+ Yallist.prototype.removeNode = function(node) {
2588
+ if (node.list !== this) {
2589
+ throw new Error("removing node which does not belong to this list");
2590
+ }
2591
+ var next = node.next;
2592
+ var prev = node.prev;
2593
+ if (next) {
2594
+ next.prev = prev;
2595
+ }
2596
+ if (prev) {
2597
+ prev.next = next;
2598
+ }
2599
+ if (node === this.head) {
2600
+ this.head = next;
2601
+ }
2602
+ if (node === this.tail) {
2603
+ this.tail = prev;
2604
+ }
2605
+ node.list.length--;
2606
+ node.next = null;
2607
+ node.prev = null;
2608
+ node.list = null;
2609
+ return next;
2610
+ };
2611
+ Yallist.prototype.unshiftNode = function(node) {
2612
+ if (node === this.head) {
2613
+ return;
2614
+ }
2615
+ if (node.list) {
2616
+ node.list.removeNode(node);
2617
+ }
2618
+ var head = this.head;
2619
+ node.list = this;
2620
+ node.next = head;
2621
+ if (head) {
2622
+ head.prev = node;
2623
+ }
2624
+ this.head = node;
2625
+ if (!this.tail) {
2626
+ this.tail = node;
2627
+ }
2628
+ this.length++;
2629
+ };
2630
+ Yallist.prototype.pushNode = function(node) {
2631
+ if (node === this.tail) {
2632
+ return;
2633
+ }
2634
+ if (node.list) {
2635
+ node.list.removeNode(node);
2636
+ }
2637
+ var tail = this.tail;
2638
+ node.list = this;
2639
+ node.prev = tail;
2640
+ if (tail) {
2641
+ tail.next = node;
2642
+ }
2643
+ this.tail = node;
2644
+ if (!this.head) {
2645
+ this.head = node;
2646
+ }
2647
+ this.length++;
2648
+ };
2649
+ Yallist.prototype.push = function() {
2650
+ for (var i = 0, l = arguments.length; i < l; i++) {
2651
+ push(this, arguments[i]);
2652
+ }
2653
+ return this.length;
2654
+ };
2655
+ Yallist.prototype.unshift = function() {
2656
+ for (var i = 0, l = arguments.length; i < l; i++) {
2657
+ unshift(this, arguments[i]);
2658
+ }
2659
+ return this.length;
2660
+ };
2661
+ Yallist.prototype.pop = function() {
2662
+ if (!this.tail) {
2663
+ return void 0;
2664
+ }
2665
+ var res = this.tail.value;
2666
+ this.tail = this.tail.prev;
2667
+ if (this.tail) {
2668
+ this.tail.next = null;
2669
+ } else {
2670
+ this.head = null;
2671
+ }
2672
+ this.length--;
2673
+ return res;
2674
+ };
2675
+ Yallist.prototype.shift = function() {
2676
+ if (!this.head) {
2677
+ return void 0;
2678
+ }
2679
+ var res = this.head.value;
2680
+ this.head = this.head.next;
2681
+ if (this.head) {
2682
+ this.head.prev = null;
2683
+ } else {
2684
+ this.tail = null;
2685
+ }
2686
+ this.length--;
2687
+ return res;
2688
+ };
2689
+ Yallist.prototype.forEach = function(fn, thisp) {
2690
+ thisp = thisp || this;
2691
+ for (var walker = this.head, i = 0; walker !== null; i++) {
2692
+ fn.call(thisp, walker.value, i, this);
2693
+ walker = walker.next;
2694
+ }
2695
+ };
2696
+ Yallist.prototype.forEachReverse = function(fn, thisp) {
2697
+ thisp = thisp || this;
2698
+ for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
2699
+ fn.call(thisp, walker.value, i, this);
2700
+ walker = walker.prev;
2701
+ }
2702
+ };
2703
+ Yallist.prototype.get = function(n) {
2704
+ for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
2705
+ walker = walker.next;
2706
+ }
2707
+ if (i === n && walker !== null) {
2708
+ return walker.value;
2709
+ }
2710
+ };
2711
+ Yallist.prototype.getReverse = function(n) {
2712
+ for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
2713
+ walker = walker.prev;
2714
+ }
2715
+ if (i === n && walker !== null) {
2716
+ return walker.value;
2717
+ }
2718
+ };
2719
+ Yallist.prototype.map = function(fn, thisp) {
2720
+ thisp = thisp || this;
2721
+ var res = new Yallist();
2722
+ for (var walker = this.head; walker !== null; ) {
2723
+ res.push(fn.call(thisp, walker.value, this));
2724
+ walker = walker.next;
2725
+ }
2726
+ return res;
2727
+ };
2728
+ Yallist.prototype.mapReverse = function(fn, thisp) {
2729
+ thisp = thisp || this;
2730
+ var res = new Yallist();
2731
+ for (var walker = this.tail; walker !== null; ) {
2732
+ res.push(fn.call(thisp, walker.value, this));
2733
+ walker = walker.prev;
2734
+ }
2735
+ return res;
2736
+ };
2737
+ Yallist.prototype.reduce = function(fn, initial) {
2738
+ var acc;
2739
+ var walker = this.head;
2740
+ if (arguments.length > 1) {
2741
+ acc = initial;
2742
+ } else if (this.head) {
2743
+ walker = this.head.next;
2744
+ acc = this.head.value;
2745
+ } else {
2746
+ throw new TypeError("Reduce of empty list with no initial value");
2747
+ }
2748
+ for (var i = 0; walker !== null; i++) {
2749
+ acc = fn(acc, walker.value, i);
2750
+ walker = walker.next;
2751
+ }
2752
+ return acc;
2753
+ };
2754
+ Yallist.prototype.reduceReverse = function(fn, initial) {
2755
+ var acc;
2756
+ var walker = this.tail;
2757
+ if (arguments.length > 1) {
2758
+ acc = initial;
2759
+ } else if (this.tail) {
2760
+ walker = this.tail.prev;
2761
+ acc = this.tail.value;
2762
+ } else {
2763
+ throw new TypeError("Reduce of empty list with no initial value");
2764
+ }
2765
+ for (var i = this.length - 1; walker !== null; i--) {
2766
+ acc = fn(acc, walker.value, i);
2767
+ walker = walker.prev;
2768
+ }
2769
+ return acc;
2770
+ };
2771
+ Yallist.prototype.toArray = function() {
2772
+ var arr = new Array(this.length);
2773
+ for (var i = 0, walker = this.head; walker !== null; i++) {
2774
+ arr[i] = walker.value;
2775
+ walker = walker.next;
2776
+ }
2777
+ return arr;
2778
+ };
2779
+ Yallist.prototype.toArrayReverse = function() {
2780
+ var arr = new Array(this.length);
2781
+ for (var i = 0, walker = this.tail; walker !== null; i++) {
2782
+ arr[i] = walker.value;
2783
+ walker = walker.prev;
2784
+ }
2785
+ return arr;
2786
+ };
2787
+ Yallist.prototype.slice = function(from, to) {
2788
+ to = to || this.length;
2789
+ if (to < 0) {
2790
+ to += this.length;
2791
+ }
2792
+ from = from || 0;
2793
+ if (from < 0) {
2794
+ from += this.length;
2795
+ }
2796
+ var ret = new Yallist();
2797
+ if (to < from || to < 0) {
2798
+ return ret;
2799
+ }
2800
+ if (from < 0) {
2801
+ from = 0;
2802
+ }
2803
+ if (to > this.length) {
2804
+ to = this.length;
2805
+ }
2806
+ for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
2807
+ walker = walker.next;
2808
+ }
2809
+ for (; walker !== null && i < to; i++, walker = walker.next) {
2810
+ ret.push(walker.value);
2811
+ }
2812
+ return ret;
2813
+ };
2814
+ Yallist.prototype.sliceReverse = function(from, to) {
2815
+ to = to || this.length;
2816
+ if (to < 0) {
2817
+ to += this.length;
2818
+ }
2819
+ from = from || 0;
2820
+ if (from < 0) {
2821
+ from += this.length;
2822
+ }
2823
+ var ret = new Yallist();
2824
+ if (to < from || to < 0) {
2825
+ return ret;
2826
+ }
2827
+ if (from < 0) {
2828
+ from = 0;
2829
+ }
2830
+ if (to > this.length) {
2831
+ to = this.length;
2832
+ }
2833
+ for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
2834
+ walker = walker.prev;
2835
+ }
2836
+ for (; walker !== null && i > from; i--, walker = walker.prev) {
2837
+ ret.push(walker.value);
2838
+ }
2839
+ return ret;
2840
+ };
2841
+ Yallist.prototype.splice = function(start, deleteCount, ...nodes) {
2842
+ if (start > this.length) {
2843
+ start = this.length - 1;
2844
+ }
2845
+ if (start < 0) {
2846
+ start = this.length + start;
2847
+ }
2848
+ for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
2849
+ walker = walker.next;
2850
+ }
2851
+ var ret = [];
2852
+ for (var i = 0; walker && i < deleteCount; i++) {
2853
+ ret.push(walker.value);
2854
+ walker = this.removeNode(walker);
2855
+ }
2856
+ if (walker === null) {
2857
+ walker = this.tail;
2858
+ }
2859
+ if (walker !== this.head && walker !== this.tail) {
2860
+ walker = walker.prev;
2861
+ }
2862
+ for (var i = 0; i < nodes.length; i++) {
2863
+ walker = insert(this, walker, nodes[i]);
2864
+ }
2865
+ return ret;
2866
+ };
2867
+ Yallist.prototype.reverse = function() {
2868
+ var head = this.head;
2869
+ var tail = this.tail;
2870
+ for (var walker = head; walker !== null; walker = walker.prev) {
2871
+ var p = walker.prev;
2872
+ walker.prev = walker.next;
2873
+ walker.next = p;
2874
+ }
2875
+ this.head = tail;
2876
+ this.tail = head;
2877
+ return this;
2878
+ };
2879
+ function insert(self, node, value) {
2880
+ var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self);
2881
+ if (inserted.next === null) {
2882
+ self.tail = inserted;
2883
+ }
2884
+ if (inserted.prev === null) {
2885
+ self.head = inserted;
2886
+ }
2887
+ self.length++;
2888
+ return inserted;
2889
+ }
2890
+ function push(self, item) {
2891
+ self.tail = new Node(item, self.tail, null, self);
2892
+ if (!self.head) {
2893
+ self.head = self.tail;
2894
+ }
2895
+ self.length++;
2896
+ }
2897
+ function unshift(self, item) {
2898
+ self.head = new Node(item, null, self.head, self);
2899
+ if (!self.tail) {
2900
+ self.tail = self.head;
2901
+ }
2902
+ self.length++;
2903
+ }
2904
+ function Node(value, prev, next, list) {
2905
+ if (!(this instanceof Node)) {
2906
+ return new Node(value, prev, next, list);
2907
+ }
2908
+ this.list = list;
2909
+ this.value = value;
2910
+ if (prev) {
2911
+ prev.next = this;
2912
+ this.prev = prev;
2913
+ } else {
2914
+ this.prev = null;
2915
+ }
2916
+ if (next) {
2917
+ next.prev = this;
2918
+ this.next = next;
2919
+ } else {
2920
+ this.next = null;
2921
+ }
2922
+ }
2923
+ try {
2924
+ require_iterator()(Yallist);
2925
+ } catch (er) {
2926
+ }
2927
+ }
2928
+ });
2929
+
2930
+ // node_modules/semver/node_modules/lru-cache/index.js
2931
+ var require_lru_cache = __commonJS({
2932
+ "node_modules/semver/node_modules/lru-cache/index.js"(exports, module) {
2933
+ "use strict";
2934
+ init_cjs_shims();
2935
+ var Yallist = require_yallist();
2936
+ var MAX = Symbol("max");
2937
+ var LENGTH = Symbol("length");
2938
+ var LENGTH_CALCULATOR = Symbol("lengthCalculator");
2939
+ var ALLOW_STALE = Symbol("allowStale");
2940
+ var MAX_AGE = Symbol("maxAge");
2941
+ var DISPOSE = Symbol("dispose");
2942
+ var NO_DISPOSE_ON_SET = Symbol("noDisposeOnSet");
2943
+ var LRU_LIST = Symbol("lruList");
2944
+ var CACHE = Symbol("cache");
2945
+ var UPDATE_AGE_ON_GET = Symbol("updateAgeOnGet");
2946
+ var naiveLength = () => 1;
2947
+ var LRUCache = class {
2948
+ constructor(options) {
2949
+ if (typeof options === "number")
2950
+ options = { max: options };
2951
+ if (!options)
2952
+ options = {};
2953
+ if (options.max && (typeof options.max !== "number" || options.max < 0))
2954
+ throw new TypeError("max must be a non-negative number");
2955
+ const max = this[MAX] = options.max || Infinity;
2956
+ const lc = options.length || naiveLength;
2957
+ this[LENGTH_CALCULATOR] = typeof lc !== "function" ? naiveLength : lc;
2958
+ this[ALLOW_STALE] = options.stale || false;
2959
+ if (options.maxAge && typeof options.maxAge !== "number")
2960
+ throw new TypeError("maxAge must be a number");
2961
+ this[MAX_AGE] = options.maxAge || 0;
2962
+ this[DISPOSE] = options.dispose;
2963
+ this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
2964
+ this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;
2965
+ this.reset();
2966
+ }
2967
+ // resize the cache when the max changes.
2968
+ set max(mL) {
2969
+ if (typeof mL !== "number" || mL < 0)
2970
+ throw new TypeError("max must be a non-negative number");
2971
+ this[MAX] = mL || Infinity;
2972
+ trim(this);
2973
+ }
2974
+ get max() {
2975
+ return this[MAX];
2976
+ }
2977
+ set allowStale(allowStale) {
2978
+ this[ALLOW_STALE] = !!allowStale;
2979
+ }
2980
+ get allowStale() {
2981
+ return this[ALLOW_STALE];
2982
+ }
2983
+ set maxAge(mA) {
2984
+ if (typeof mA !== "number")
2985
+ throw new TypeError("maxAge must be a non-negative number");
2986
+ this[MAX_AGE] = mA;
2987
+ trim(this);
2988
+ }
2989
+ get maxAge() {
2990
+ return this[MAX_AGE];
2991
+ }
2992
+ // resize the cache when the lengthCalculator changes.
2993
+ set lengthCalculator(lC) {
2994
+ if (typeof lC !== "function")
2995
+ lC = naiveLength;
2996
+ if (lC !== this[LENGTH_CALCULATOR]) {
2997
+ this[LENGTH_CALCULATOR] = lC;
2998
+ this[LENGTH] = 0;
2999
+ this[LRU_LIST].forEach((hit) => {
3000
+ hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
3001
+ this[LENGTH] += hit.length;
3002
+ });
3003
+ }
3004
+ trim(this);
3005
+ }
3006
+ get lengthCalculator() {
3007
+ return this[LENGTH_CALCULATOR];
3008
+ }
3009
+ get length() {
3010
+ return this[LENGTH];
3011
+ }
3012
+ get itemCount() {
3013
+ return this[LRU_LIST].length;
3014
+ }
3015
+ rforEach(fn, thisp) {
3016
+ thisp = thisp || this;
3017
+ for (let walker = this[LRU_LIST].tail; walker !== null; ) {
3018
+ const prev = walker.prev;
3019
+ forEachStep(this, fn, walker, thisp);
3020
+ walker = prev;
3021
+ }
3022
+ }
3023
+ forEach(fn, thisp) {
3024
+ thisp = thisp || this;
3025
+ for (let walker = this[LRU_LIST].head; walker !== null; ) {
3026
+ const next = walker.next;
3027
+ forEachStep(this, fn, walker, thisp);
3028
+ walker = next;
3029
+ }
3030
+ }
3031
+ keys() {
3032
+ return this[LRU_LIST].toArray().map((k) => k.key);
3033
+ }
3034
+ values() {
3035
+ return this[LRU_LIST].toArray().map((k) => k.value);
3036
+ }
3037
+ reset() {
3038
+ if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
3039
+ this[LRU_LIST].forEach((hit) => this[DISPOSE](hit.key, hit.value));
3040
+ }
3041
+ this[CACHE] = /* @__PURE__ */ new Map();
3042
+ this[LRU_LIST] = new Yallist();
3043
+ this[LENGTH] = 0;
3044
+ }
3045
+ dump() {
3046
+ return this[LRU_LIST].map((hit) => isStale(this, hit) ? false : {
3047
+ k: hit.key,
3048
+ v: hit.value,
3049
+ e: hit.now + (hit.maxAge || 0)
3050
+ }).toArray().filter((h) => h);
3051
+ }
3052
+ dumpLru() {
3053
+ return this[LRU_LIST];
3054
+ }
3055
+ set(key, value, maxAge) {
3056
+ maxAge = maxAge || this[MAX_AGE];
3057
+ if (maxAge && typeof maxAge !== "number")
3058
+ throw new TypeError("maxAge must be a number");
3059
+ const now = maxAge ? Date.now() : 0;
3060
+ const len = this[LENGTH_CALCULATOR](value, key);
3061
+ if (this[CACHE].has(key)) {
3062
+ if (len > this[MAX]) {
3063
+ del(this, this[CACHE].get(key));
3064
+ return false;
3065
+ }
3066
+ const node = this[CACHE].get(key);
3067
+ const item = node.value;
3068
+ if (this[DISPOSE]) {
3069
+ if (!this[NO_DISPOSE_ON_SET])
3070
+ this[DISPOSE](key, item.value);
3071
+ }
3072
+ item.now = now;
3073
+ item.maxAge = maxAge;
3074
+ item.value = value;
3075
+ this[LENGTH] += len - item.length;
3076
+ item.length = len;
3077
+ this.get(key);
3078
+ trim(this);
3079
+ return true;
3080
+ }
3081
+ const hit = new Entry(key, value, len, now, maxAge);
3082
+ if (hit.length > this[MAX]) {
3083
+ if (this[DISPOSE])
3084
+ this[DISPOSE](key, value);
3085
+ return false;
3086
+ }
3087
+ this[LENGTH] += hit.length;
3088
+ this[LRU_LIST].unshift(hit);
3089
+ this[CACHE].set(key, this[LRU_LIST].head);
3090
+ trim(this);
3091
+ return true;
3092
+ }
3093
+ has(key) {
3094
+ if (!this[CACHE].has(key)) return false;
3095
+ const hit = this[CACHE].get(key).value;
3096
+ return !isStale(this, hit);
3097
+ }
3098
+ get(key) {
3099
+ return get(this, key, true);
3100
+ }
3101
+ peek(key) {
3102
+ return get(this, key, false);
3103
+ }
3104
+ pop() {
3105
+ const node = this[LRU_LIST].tail;
3106
+ if (!node)
3107
+ return null;
3108
+ del(this, node);
3109
+ return node.value;
3110
+ }
3111
+ del(key) {
3112
+ del(this, this[CACHE].get(key));
3113
+ }
3114
+ load(arr) {
3115
+ this.reset();
3116
+ const now = Date.now();
3117
+ for (let l = arr.length - 1; l >= 0; l--) {
3118
+ const hit = arr[l];
3119
+ const expiresAt = hit.e || 0;
3120
+ if (expiresAt === 0)
3121
+ this.set(hit.k, hit.v);
3122
+ else {
3123
+ const maxAge = expiresAt - now;
3124
+ if (maxAge > 0) {
3125
+ this.set(hit.k, hit.v, maxAge);
3126
+ }
3127
+ }
3128
+ }
3129
+ }
3130
+ prune() {
3131
+ this[CACHE].forEach((value, key) => get(this, key, false));
3132
+ }
3133
+ };
3134
+ var get = (self, key, doUse) => {
3135
+ const node = self[CACHE].get(key);
3136
+ if (node) {
3137
+ const hit = node.value;
3138
+ if (isStale(self, hit)) {
3139
+ del(self, node);
3140
+ if (!self[ALLOW_STALE])
3141
+ return void 0;
3142
+ } else {
3143
+ if (doUse) {
3144
+ if (self[UPDATE_AGE_ON_GET])
3145
+ node.value.now = Date.now();
3146
+ self[LRU_LIST].unshiftNode(node);
3147
+ }
3148
+ }
3149
+ return hit.value;
3150
+ }
3151
+ };
3152
+ var isStale = (self, hit) => {
3153
+ if (!hit || !hit.maxAge && !self[MAX_AGE])
3154
+ return false;
3155
+ const diff = Date.now() - hit.now;
3156
+ return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE];
3157
+ };
3158
+ var trim = (self) => {
3159
+ if (self[LENGTH] > self[MAX]) {
3160
+ for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
3161
+ const prev = walker.prev;
3162
+ del(self, walker);
3163
+ walker = prev;
3164
+ }
3165
+ }
3166
+ };
3167
+ var del = (self, node) => {
3168
+ if (node) {
3169
+ const hit = node.value;
3170
+ if (self[DISPOSE])
3171
+ self[DISPOSE](hit.key, hit.value);
3172
+ self[LENGTH] -= hit.length;
3173
+ self[CACHE].delete(hit.key);
3174
+ self[LRU_LIST].removeNode(node);
3175
+ }
3176
+ };
3177
+ var Entry = class {
3178
+ constructor(key, value, length, now, maxAge) {
3179
+ this.key = key;
3180
+ this.value = value;
3181
+ this.length = length;
3182
+ this.now = now;
3183
+ this.maxAge = maxAge || 0;
3184
+ }
3185
+ };
3186
+ var forEachStep = (self, fn, node, thisp) => {
3187
+ let hit = node.value;
3188
+ if (isStale(self, hit)) {
3189
+ del(self, node);
3190
+ if (!self[ALLOW_STALE])
3191
+ hit = void 0;
3192
+ }
3193
+ if (hit)
3194
+ fn.call(thisp, hit.value, hit.key, self);
3195
+ };
3196
+ module.exports = LRUCache;
3197
+ }
3198
+ });
3199
+
3200
+ // node_modules/semver/classes/range.js
3201
+ var require_range = __commonJS({
3202
+ "node_modules/semver/classes/range.js"(exports, module) {
3203
+ init_cjs_shims();
3204
+ var Range = class _Range {
3205
+ constructor(range, options) {
3206
+ options = parseOptions(options);
3207
+ if (range instanceof _Range) {
3208
+ if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
3209
+ return range;
3210
+ } else {
3211
+ return new _Range(range.raw, options);
3212
+ }
3213
+ }
3214
+ if (range instanceof Comparator) {
3215
+ this.raw = range.value;
3216
+ this.set = [[range]];
3217
+ this.format();
3218
+ return this;
3219
+ }
3220
+ this.options = options;
3221
+ this.loose = !!options.loose;
3222
+ this.includePrerelease = !!options.includePrerelease;
3223
+ this.raw = range.trim().split(/\s+/).join(" ");
3224
+ this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
3225
+ if (!this.set.length) {
3226
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
3227
+ }
3228
+ if (this.set.length > 1) {
3229
+ const first = this.set[0];
3230
+ this.set = this.set.filter((c) => !isNullSet(c[0]));
3231
+ if (this.set.length === 0) {
3232
+ this.set = [first];
3233
+ } else if (this.set.length > 1) {
3234
+ for (const c of this.set) {
3235
+ if (c.length === 1 && isAny(c[0])) {
3236
+ this.set = [c];
3237
+ break;
3238
+ }
3239
+ }
3240
+ }
3241
+ }
3242
+ this.format();
3243
+ }
3244
+ format() {
3245
+ this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
3246
+ return this.range;
3247
+ }
3248
+ toString() {
3249
+ return this.range;
3250
+ }
3251
+ parseRange(range) {
3252
+ const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
3253
+ const memoKey = memoOpts + ":" + range;
3254
+ const cached = cache.get(memoKey);
3255
+ if (cached) {
3256
+ return cached;
3257
+ }
3258
+ const loose = this.options.loose;
3259
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
3260
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
3261
+ debug("hyphen replace", range);
3262
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
3263
+ debug("comparator trim", range);
3264
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
3265
+ debug("tilde trim", range);
3266
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
3267
+ debug("caret trim", range);
3268
+ let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
3269
+ if (loose) {
3270
+ rangeList = rangeList.filter((comp) => {
3271
+ debug("loose invalid filter", comp, this.options);
3272
+ return !!comp.match(re[t.COMPARATORLOOSE]);
3273
+ });
3274
+ }
3275
+ debug("range list", rangeList);
3276
+ const rangeMap = /* @__PURE__ */ new Map();
3277
+ const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
3278
+ for (const comp of comparators) {
3279
+ if (isNullSet(comp)) {
3280
+ return [comp];
3281
+ }
3282
+ rangeMap.set(comp.value, comp);
3283
+ }
3284
+ if (rangeMap.size > 1 && rangeMap.has("")) {
3285
+ rangeMap.delete("");
3286
+ }
3287
+ const result = [...rangeMap.values()];
3288
+ cache.set(memoKey, result);
3289
+ return result;
3290
+ }
3291
+ intersects(range, options) {
3292
+ if (!(range instanceof _Range)) {
3293
+ throw new TypeError("a Range is required");
3294
+ }
3295
+ return this.set.some((thisComparators) => {
3296
+ return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
3297
+ return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
3298
+ return rangeComparators.every((rangeComparator) => {
3299
+ return thisComparator.intersects(rangeComparator, options);
3300
+ });
3301
+ });
3302
+ });
3303
+ });
3304
+ }
3305
+ // if ANY of the sets match ALL of its comparators, then pass
3306
+ test(version) {
3307
+ if (!version) {
3308
+ return false;
3309
+ }
3310
+ if (typeof version === "string") {
3311
+ try {
3312
+ version = new SemVer(version, this.options);
3313
+ } catch (er) {
3314
+ return false;
3315
+ }
3316
+ }
3317
+ for (let i = 0; i < this.set.length; i++) {
3318
+ if (testSet(this.set[i], version, this.options)) {
3319
+ return true;
3320
+ }
3321
+ }
3322
+ return false;
3323
+ }
3324
+ };
3325
+ module.exports = Range;
3326
+ var LRU = require_lru_cache();
3327
+ var cache = new LRU({ max: 1e3 });
3328
+ var parseOptions = require_parse_options();
3329
+ var Comparator = require_comparator();
3330
+ var debug = require_debug();
3331
+ var SemVer = require_semver();
3332
+ var {
3333
+ safeRe: re,
3334
+ t,
3335
+ comparatorTrimReplace,
3336
+ tildeTrimReplace,
3337
+ caretTrimReplace
3338
+ } = require_re();
3339
+ var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
3340
+ var isNullSet = (c) => c.value === "<0.0.0-0";
3341
+ var isAny = (c) => c.value === "";
3342
+ var isSatisfiable = (comparators, options) => {
3343
+ let result = true;
3344
+ const remainingComparators = comparators.slice();
3345
+ let testComparator = remainingComparators.pop();
3346
+ while (result && remainingComparators.length) {
3347
+ result = remainingComparators.every((otherComparator) => {
3348
+ return testComparator.intersects(otherComparator, options);
3349
+ });
3350
+ testComparator = remainingComparators.pop();
3351
+ }
3352
+ return result;
3353
+ };
3354
+ var parseComparator = (comp, options) => {
3355
+ debug("comp", comp, options);
3356
+ comp = replaceCarets(comp, options);
3357
+ debug("caret", comp);
3358
+ comp = replaceTildes(comp, options);
3359
+ debug("tildes", comp);
3360
+ comp = replaceXRanges(comp, options);
3361
+ debug("xrange", comp);
3362
+ comp = replaceStars(comp, options);
3363
+ debug("stars", comp);
3364
+ return comp;
3365
+ };
3366
+ var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
3367
+ var replaceTildes = (comp, options) => {
3368
+ return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
3369
+ };
3370
+ var replaceTilde = (comp, options) => {
3371
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
3372
+ return comp.replace(r, (_, M, m, p, pr) => {
3373
+ debug("tilde", comp, _, M, m, p, pr);
3374
+ let ret;
3375
+ if (isX(M)) {
3376
+ ret = "";
3377
+ } else if (isX(m)) {
3378
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
3379
+ } else if (isX(p)) {
3380
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
3381
+ } else if (pr) {
3382
+ debug("replaceTilde pr", pr);
3383
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3384
+ } else {
3385
+ ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
3386
+ }
3387
+ debug("tilde return", ret);
3388
+ return ret;
3389
+ });
3390
+ };
3391
+ var replaceCarets = (comp, options) => {
3392
+ return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
3393
+ };
3394
+ var replaceCaret = (comp, options) => {
3395
+ debug("caret", comp, options);
3396
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
3397
+ const z = options.includePrerelease ? "-0" : "";
3398
+ return comp.replace(r, (_, M, m, p, pr) => {
3399
+ debug("caret", comp, _, M, m, p, pr);
3400
+ let ret;
3401
+ if (isX(M)) {
3402
+ ret = "";
3403
+ } else if (isX(m)) {
3404
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
3405
+ } else if (isX(p)) {
3406
+ if (M === "0") {
3407
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
3408
+ } else {
3409
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
3410
+ }
3411
+ } else if (pr) {
3412
+ debug("replaceCaret pr", pr);
3413
+ if (M === "0") {
3414
+ if (m === "0") {
3415
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
3416
+ } else {
3417
+ ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
3418
+ }
3419
+ } else {
3420
+ ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
3421
+ }
3422
+ } else {
3423
+ debug("no pr");
3424
+ if (M === "0") {
3425
+ if (m === "0") {
3426
+ ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
3427
+ } else {
3428
+ ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
3429
+ }
3430
+ } else {
3431
+ ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
3432
+ }
3433
+ }
3434
+ debug("caret return", ret);
3435
+ return ret;
3436
+ });
3437
+ };
3438
+ var replaceXRanges = (comp, options) => {
3439
+ debug("replaceXRanges", comp, options);
3440
+ return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
3441
+ };
3442
+ var replaceXRange = (comp, options) => {
3443
+ comp = comp.trim();
3444
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
3445
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
3446
+ debug("xRange", comp, ret, gtlt, M, m, p, pr);
3447
+ const xM = isX(M);
3448
+ const xm = xM || isX(m);
3449
+ const xp = xm || isX(p);
3450
+ const anyX = xp;
3451
+ if (gtlt === "=" && anyX) {
3452
+ gtlt = "";
3453
+ }
3454
+ pr = options.includePrerelease ? "-0" : "";
3455
+ if (xM) {
3456
+ if (gtlt === ">" || gtlt === "<") {
3457
+ ret = "<0.0.0-0";
3458
+ } else {
3459
+ ret = "*";
3460
+ }
3461
+ } else if (gtlt && anyX) {
3462
+ if (xm) {
3463
+ m = 0;
3464
+ }
3465
+ p = 0;
3466
+ if (gtlt === ">") {
3467
+ gtlt = ">=";
3468
+ if (xm) {
3469
+ M = +M + 1;
3470
+ m = 0;
3471
+ p = 0;
3472
+ } else {
3473
+ m = +m + 1;
3474
+ p = 0;
3475
+ }
3476
+ } else if (gtlt === "<=") {
3477
+ gtlt = "<";
3478
+ if (xm) {
3479
+ M = +M + 1;
3480
+ } else {
3481
+ m = +m + 1;
3482
+ }
3483
+ }
3484
+ if (gtlt === "<") {
3485
+ pr = "-0";
3486
+ }
3487
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
3488
+ } else if (xm) {
3489
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
3490
+ } else if (xp) {
3491
+ ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
3492
+ }
3493
+ debug("xRange return", ret);
3494
+ return ret;
3495
+ });
3496
+ };
3497
+ var replaceStars = (comp, options) => {
3498
+ debug("replaceStars", comp, options);
3499
+ return comp.trim().replace(re[t.STAR], "");
3500
+ };
3501
+ var replaceGTE0 = (comp, options) => {
3502
+ debug("replaceGTE0", comp, options);
3503
+ return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
3504
+ };
3505
+ var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) => {
3506
+ if (isX(fM)) {
3507
+ from = "";
3508
+ } else if (isX(fm)) {
3509
+ from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
3510
+ } else if (isX(fp)) {
3511
+ from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
3512
+ } else if (fpr) {
3513
+ from = `>=${from}`;
3514
+ } else {
3515
+ from = `>=${from}${incPr ? "-0" : ""}`;
3516
+ }
3517
+ if (isX(tM)) {
3518
+ to = "";
3519
+ } else if (isX(tm)) {
3520
+ to = `<${+tM + 1}.0.0-0`;
3521
+ } else if (isX(tp)) {
3522
+ to = `<${tM}.${+tm + 1}.0-0`;
3523
+ } else if (tpr) {
3524
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
3525
+ } else if (incPr) {
3526
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
3527
+ } else {
3528
+ to = `<=${to}`;
3529
+ }
3530
+ return `${from} ${to}`.trim();
3531
+ };
3532
+ var testSet = (set, version, options) => {
3533
+ for (let i = 0; i < set.length; i++) {
3534
+ if (!set[i].test(version)) {
3535
+ return false;
3536
+ }
3537
+ }
3538
+ if (version.prerelease.length && !options.includePrerelease) {
3539
+ for (let i = 0; i < set.length; i++) {
3540
+ debug(set[i].semver);
3541
+ if (set[i].semver === Comparator.ANY) {
3542
+ continue;
3543
+ }
3544
+ if (set[i].semver.prerelease.length > 0) {
3545
+ const allowed = set[i].semver;
3546
+ if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
3547
+ return true;
3548
+ }
3549
+ }
3550
+ }
3551
+ return false;
3552
+ }
3553
+ return true;
3554
+ };
3555
+ }
3556
+ });
3557
+
3558
+ // node_modules/semver/classes/comparator.js
3559
+ var require_comparator = __commonJS({
3560
+ "node_modules/semver/classes/comparator.js"(exports, module) {
3561
+ init_cjs_shims();
3562
+ var ANY = Symbol("SemVer ANY");
3563
+ var Comparator = class _Comparator {
3564
+ static get ANY() {
3565
+ return ANY;
3566
+ }
3567
+ constructor(comp, options) {
3568
+ options = parseOptions(options);
3569
+ if (comp instanceof _Comparator) {
3570
+ if (comp.loose === !!options.loose) {
3571
+ return comp;
3572
+ } else {
3573
+ comp = comp.value;
3574
+ }
3575
+ }
3576
+ comp = comp.trim().split(/\s+/).join(" ");
3577
+ debug("comparator", comp, options);
3578
+ this.options = options;
3579
+ this.loose = !!options.loose;
3580
+ this.parse(comp);
3581
+ if (this.semver === ANY) {
3582
+ this.value = "";
3583
+ } else {
3584
+ this.value = this.operator + this.semver.version;
3585
+ }
3586
+ debug("comp", this);
3587
+ }
3588
+ parse(comp) {
3589
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
3590
+ const m = comp.match(r);
3591
+ if (!m) {
3592
+ throw new TypeError(`Invalid comparator: ${comp}`);
3593
+ }
3594
+ this.operator = m[1] !== void 0 ? m[1] : "";
3595
+ if (this.operator === "=") {
3596
+ this.operator = "";
3597
+ }
3598
+ if (!m[2]) {
3599
+ this.semver = ANY;
3600
+ } else {
3601
+ this.semver = new SemVer(m[2], this.options.loose);
3602
+ }
3603
+ }
3604
+ toString() {
3605
+ return this.value;
3606
+ }
3607
+ test(version) {
3608
+ debug("Comparator.test", version, this.options.loose);
3609
+ if (this.semver === ANY || version === ANY) {
3610
+ return true;
3611
+ }
3612
+ if (typeof version === "string") {
3613
+ try {
3614
+ version = new SemVer(version, this.options);
3615
+ } catch (er) {
3616
+ return false;
3617
+ }
3618
+ }
3619
+ return cmp(version, this.operator, this.semver, this.options);
3620
+ }
3621
+ intersects(comp, options) {
3622
+ if (!(comp instanceof _Comparator)) {
3623
+ throw new TypeError("a Comparator is required");
3624
+ }
3625
+ if (this.operator === "") {
3626
+ if (this.value === "") {
3627
+ return true;
3628
+ }
3629
+ return new Range(comp.value, options).test(this.value);
3630
+ } else if (comp.operator === "") {
3631
+ if (comp.value === "") {
3632
+ return true;
3633
+ }
3634
+ return new Range(this.value, options).test(comp.semver);
3635
+ }
3636
+ options = parseOptions(options);
3637
+ if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
3638
+ return false;
3639
+ }
3640
+ if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
3641
+ return false;
3642
+ }
3643
+ if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
3644
+ return true;
3645
+ }
3646
+ if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
3647
+ return true;
3648
+ }
3649
+ if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
3650
+ return true;
3651
+ }
3652
+ if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
3653
+ return true;
3654
+ }
3655
+ if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
3656
+ return true;
3657
+ }
3658
+ return false;
3659
+ }
3660
+ };
3661
+ module.exports = Comparator;
3662
+ var parseOptions = require_parse_options();
3663
+ var { safeRe: re, t } = require_re();
3664
+ var cmp = require_cmp();
3665
+ var debug = require_debug();
3666
+ var SemVer = require_semver();
3667
+ var Range = require_range();
3668
+ }
3669
+ });
3670
+
3671
+ // node_modules/semver/functions/satisfies.js
3672
+ var require_satisfies = __commonJS({
3673
+ "node_modules/semver/functions/satisfies.js"(exports, module) {
3674
+ init_cjs_shims();
3675
+ var Range = require_range();
3676
+ var satisfies = (version, range, options) => {
3677
+ try {
3678
+ range = new Range(range, options);
3679
+ } catch (er) {
3680
+ return false;
3681
+ }
3682
+ return range.test(version);
3683
+ };
3684
+ module.exports = satisfies;
3685
+ }
3686
+ });
3687
+
3688
+ // node_modules/semver/ranges/to-comparators.js
3689
+ var require_to_comparators = __commonJS({
3690
+ "node_modules/semver/ranges/to-comparators.js"(exports, module) {
3691
+ init_cjs_shims();
3692
+ var Range = require_range();
3693
+ var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
3694
+ module.exports = toComparators;
3695
+ }
3696
+ });
3697
+
3698
+ // node_modules/semver/ranges/max-satisfying.js
3699
+ var require_max_satisfying = __commonJS({
3700
+ "node_modules/semver/ranges/max-satisfying.js"(exports, module) {
3701
+ init_cjs_shims();
3702
+ var SemVer = require_semver();
3703
+ var Range = require_range();
3704
+ var maxSatisfying = (versions, range, options) => {
3705
+ let max = null;
3706
+ let maxSV = null;
3707
+ let rangeObj = null;
3708
+ try {
3709
+ rangeObj = new Range(range, options);
3710
+ } catch (er) {
3711
+ return null;
3712
+ }
3713
+ versions.forEach((v) => {
3714
+ if (rangeObj.test(v)) {
3715
+ if (!max || maxSV.compare(v) === -1) {
3716
+ max = v;
3717
+ maxSV = new SemVer(max, options);
3718
+ }
3719
+ }
3720
+ });
3721
+ return max;
3722
+ };
3723
+ module.exports = maxSatisfying;
3724
+ }
3725
+ });
3726
+
3727
+ // node_modules/semver/ranges/min-satisfying.js
3728
+ var require_min_satisfying = __commonJS({
3729
+ "node_modules/semver/ranges/min-satisfying.js"(exports, module) {
3730
+ init_cjs_shims();
3731
+ var SemVer = require_semver();
3732
+ var Range = require_range();
3733
+ var minSatisfying = (versions, range, options) => {
3734
+ let min = null;
3735
+ let minSV = null;
3736
+ let rangeObj = null;
3737
+ try {
3738
+ rangeObj = new Range(range, options);
3739
+ } catch (er) {
3740
+ return null;
3741
+ }
3742
+ versions.forEach((v) => {
3743
+ if (rangeObj.test(v)) {
3744
+ if (!min || minSV.compare(v) === 1) {
3745
+ min = v;
3746
+ minSV = new SemVer(min, options);
3747
+ }
3748
+ }
3749
+ });
3750
+ return min;
3751
+ };
3752
+ module.exports = minSatisfying;
3753
+ }
3754
+ });
3755
+
3756
+ // node_modules/semver/ranges/min-version.js
3757
+ var require_min_version = __commonJS({
3758
+ "node_modules/semver/ranges/min-version.js"(exports, module) {
3759
+ init_cjs_shims();
3760
+ var SemVer = require_semver();
3761
+ var Range = require_range();
3762
+ var gt = require_gt();
3763
+ var minVersion = (range, loose) => {
3764
+ range = new Range(range, loose);
3765
+ let minver = new SemVer("0.0.0");
3766
+ if (range.test(minver)) {
3767
+ return minver;
3768
+ }
3769
+ minver = new SemVer("0.0.0-0");
3770
+ if (range.test(minver)) {
3771
+ return minver;
3772
+ }
3773
+ minver = null;
3774
+ for (let i = 0; i < range.set.length; ++i) {
3775
+ const comparators = range.set[i];
3776
+ let setMin = null;
3777
+ comparators.forEach((comparator) => {
3778
+ const compver = new SemVer(comparator.semver.version);
3779
+ switch (comparator.operator) {
3780
+ case ">":
3781
+ if (compver.prerelease.length === 0) {
3782
+ compver.patch++;
3783
+ } else {
3784
+ compver.prerelease.push(0);
3785
+ }
3786
+ compver.raw = compver.format();
3787
+ case "":
3788
+ case ">=":
3789
+ if (!setMin || gt(compver, setMin)) {
3790
+ setMin = compver;
3791
+ }
3792
+ break;
3793
+ case "<":
3794
+ case "<=":
3795
+ break;
3796
+ default:
3797
+ throw new Error(`Unexpected operation: ${comparator.operator}`);
3798
+ }
3799
+ });
3800
+ if (setMin && (!minver || gt(minver, setMin))) {
3801
+ minver = setMin;
3802
+ }
3803
+ }
3804
+ if (minver && range.test(minver)) {
3805
+ return minver;
3806
+ }
3807
+ return null;
3808
+ };
3809
+ module.exports = minVersion;
3810
+ }
3811
+ });
3812
+
3813
+ // node_modules/semver/ranges/valid.js
3814
+ var require_valid2 = __commonJS({
3815
+ "node_modules/semver/ranges/valid.js"(exports, module) {
3816
+ init_cjs_shims();
3817
+ var Range = require_range();
3818
+ var validRange = (range, options) => {
3819
+ try {
3820
+ return new Range(range, options).range || "*";
3821
+ } catch (er) {
3822
+ return null;
3823
+ }
3824
+ };
3825
+ module.exports = validRange;
3826
+ }
3827
+ });
3828
+
3829
+ // node_modules/semver/ranges/outside.js
3830
+ var require_outside = __commonJS({
3831
+ "node_modules/semver/ranges/outside.js"(exports, module) {
3832
+ init_cjs_shims();
3833
+ var SemVer = require_semver();
3834
+ var Comparator = require_comparator();
3835
+ var { ANY } = Comparator;
3836
+ var Range = require_range();
3837
+ var satisfies = require_satisfies();
3838
+ var gt = require_gt();
3839
+ var lt = require_lt();
3840
+ var lte = require_lte();
3841
+ var gte = require_gte();
3842
+ var outside = (version, range, hilo, options) => {
3843
+ version = new SemVer(version, options);
3844
+ range = new Range(range, options);
3845
+ let gtfn, ltefn, ltfn, comp, ecomp;
3846
+ switch (hilo) {
3847
+ case ">":
3848
+ gtfn = gt;
3849
+ ltefn = lte;
3850
+ ltfn = lt;
3851
+ comp = ">";
3852
+ ecomp = ">=";
3853
+ break;
3854
+ case "<":
3855
+ gtfn = lt;
3856
+ ltefn = gte;
3857
+ ltfn = gt;
3858
+ comp = "<";
3859
+ ecomp = "<=";
3860
+ break;
3861
+ default:
3862
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
3863
+ }
3864
+ if (satisfies(version, range, options)) {
3865
+ return false;
3866
+ }
3867
+ for (let i = 0; i < range.set.length; ++i) {
3868
+ const comparators = range.set[i];
3869
+ let high = null;
3870
+ let low = null;
3871
+ comparators.forEach((comparator) => {
3872
+ if (comparator.semver === ANY) {
3873
+ comparator = new Comparator(">=0.0.0");
3874
+ }
3875
+ high = high || comparator;
3876
+ low = low || comparator;
3877
+ if (gtfn(comparator.semver, high.semver, options)) {
3878
+ high = comparator;
3879
+ } else if (ltfn(comparator.semver, low.semver, options)) {
3880
+ low = comparator;
3881
+ }
3882
+ });
3883
+ if (high.operator === comp || high.operator === ecomp) {
3884
+ return false;
3885
+ }
3886
+ if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
3887
+ return false;
3888
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
3889
+ return false;
3890
+ }
3891
+ }
3892
+ return true;
3893
+ };
3894
+ module.exports = outside;
3895
+ }
3896
+ });
3897
+
3898
+ // node_modules/semver/ranges/gtr.js
3899
+ var require_gtr = __commonJS({
3900
+ "node_modules/semver/ranges/gtr.js"(exports, module) {
3901
+ init_cjs_shims();
3902
+ var outside = require_outside();
3903
+ var gtr = (version, range, options) => outside(version, range, ">", options);
3904
+ module.exports = gtr;
3905
+ }
3906
+ });
3907
+
3908
+ // node_modules/semver/ranges/ltr.js
3909
+ var require_ltr = __commonJS({
3910
+ "node_modules/semver/ranges/ltr.js"(exports, module) {
3911
+ init_cjs_shims();
3912
+ var outside = require_outside();
3913
+ var ltr = (version, range, options) => outside(version, range, "<", options);
3914
+ module.exports = ltr;
3915
+ }
3916
+ });
3917
+
3918
+ // node_modules/semver/ranges/intersects.js
3919
+ var require_intersects = __commonJS({
3920
+ "node_modules/semver/ranges/intersects.js"(exports, module) {
3921
+ init_cjs_shims();
3922
+ var Range = require_range();
3923
+ var intersects = (r1, r2, options) => {
3924
+ r1 = new Range(r1, options);
3925
+ r2 = new Range(r2, options);
3926
+ return r1.intersects(r2, options);
3927
+ };
3928
+ module.exports = intersects;
3929
+ }
3930
+ });
3931
+
3932
+ // node_modules/semver/ranges/simplify.js
3933
+ var require_simplify = __commonJS({
3934
+ "node_modules/semver/ranges/simplify.js"(exports, module) {
3935
+ init_cjs_shims();
3936
+ var satisfies = require_satisfies();
3937
+ var compare = require_compare();
3938
+ module.exports = (versions, range, options) => {
3939
+ const set = [];
3940
+ let first = null;
3941
+ let prev = null;
3942
+ const v = versions.sort((a, b) => compare(a, b, options));
3943
+ for (const version of v) {
3944
+ const included = satisfies(version, range, options);
3945
+ if (included) {
3946
+ prev = version;
3947
+ if (!first) {
3948
+ first = version;
3949
+ }
3950
+ } else {
3951
+ if (prev) {
3952
+ set.push([first, prev]);
3953
+ }
3954
+ prev = null;
3955
+ first = null;
3956
+ }
3957
+ }
3958
+ if (first) {
3959
+ set.push([first, null]);
3960
+ }
3961
+ const ranges = [];
3962
+ for (const [min, max] of set) {
3963
+ if (min === max) {
3964
+ ranges.push(min);
3965
+ } else if (!max && min === v[0]) {
3966
+ ranges.push("*");
3967
+ } else if (!max) {
3968
+ ranges.push(`>=${min}`);
3969
+ } else if (min === v[0]) {
3970
+ ranges.push(`<=${max}`);
3971
+ } else {
3972
+ ranges.push(`${min} - ${max}`);
3973
+ }
3974
+ }
3975
+ const simplified = ranges.join(" || ");
3976
+ const original = typeof range.raw === "string" ? range.raw : String(range);
3977
+ return simplified.length < original.length ? simplified : range;
3978
+ };
3979
+ }
3980
+ });
3981
+
3982
+ // node_modules/semver/ranges/subset.js
3983
+ var require_subset = __commonJS({
3984
+ "node_modules/semver/ranges/subset.js"(exports, module) {
3985
+ init_cjs_shims();
3986
+ var Range = require_range();
3987
+ var Comparator = require_comparator();
3988
+ var { ANY } = Comparator;
3989
+ var satisfies = require_satisfies();
3990
+ var compare = require_compare();
3991
+ var subset = (sub, dom, options = {}) => {
3992
+ if (sub === dom) {
3993
+ return true;
3994
+ }
3995
+ sub = new Range(sub, options);
3996
+ dom = new Range(dom, options);
3997
+ let sawNonNull = false;
3998
+ OUTER: for (const simpleSub of sub.set) {
3999
+ for (const simpleDom of dom.set) {
4000
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
4001
+ sawNonNull = sawNonNull || isSub !== null;
4002
+ if (isSub) {
4003
+ continue OUTER;
4004
+ }
4005
+ }
4006
+ if (sawNonNull) {
4007
+ return false;
4008
+ }
4009
+ }
4010
+ return true;
4011
+ };
4012
+ var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
4013
+ var minimumVersion = [new Comparator(">=0.0.0")];
4014
+ var simpleSubset = (sub, dom, options) => {
4015
+ if (sub === dom) {
4016
+ return true;
4017
+ }
4018
+ if (sub.length === 1 && sub[0].semver === ANY) {
4019
+ if (dom.length === 1 && dom[0].semver === ANY) {
4020
+ return true;
4021
+ } else if (options.includePrerelease) {
4022
+ sub = minimumVersionWithPreRelease;
4023
+ } else {
4024
+ sub = minimumVersion;
4025
+ }
4026
+ }
4027
+ if (dom.length === 1 && dom[0].semver === ANY) {
4028
+ if (options.includePrerelease) {
4029
+ return true;
4030
+ } else {
4031
+ dom = minimumVersion;
4032
+ }
4033
+ }
4034
+ const eqSet = /* @__PURE__ */ new Set();
4035
+ let gt, lt;
4036
+ for (const c of sub) {
4037
+ if (c.operator === ">" || c.operator === ">=") {
4038
+ gt = higherGT(gt, c, options);
4039
+ } else if (c.operator === "<" || c.operator === "<=") {
4040
+ lt = lowerLT(lt, c, options);
4041
+ } else {
4042
+ eqSet.add(c.semver);
4043
+ }
4044
+ }
4045
+ if (eqSet.size > 1) {
4046
+ return null;
4047
+ }
4048
+ let gtltComp;
4049
+ if (gt && lt) {
4050
+ gtltComp = compare(gt.semver, lt.semver, options);
4051
+ if (gtltComp > 0) {
4052
+ return null;
4053
+ } else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
4054
+ return null;
4055
+ }
4056
+ }
4057
+ for (const eq of eqSet) {
4058
+ if (gt && !satisfies(eq, String(gt), options)) {
4059
+ return null;
4060
+ }
4061
+ if (lt && !satisfies(eq, String(lt), options)) {
4062
+ return null;
4063
+ }
4064
+ for (const c of dom) {
4065
+ if (!satisfies(eq, String(c), options)) {
4066
+ return false;
4067
+ }
4068
+ }
4069
+ return true;
4070
+ }
4071
+ let higher, lower;
4072
+ let hasDomLT, hasDomGT;
4073
+ let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
4074
+ let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
4075
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
4076
+ needDomLTPre = false;
4077
+ }
4078
+ for (const c of dom) {
4079
+ hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
4080
+ hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
4081
+ if (gt) {
4082
+ if (needDomGTPre) {
4083
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
4084
+ needDomGTPre = false;
4085
+ }
4086
+ }
4087
+ if (c.operator === ">" || c.operator === ">=") {
4088
+ higher = higherGT(gt, c, options);
4089
+ if (higher === c && higher !== gt) {
4090
+ return false;
4091
+ }
4092
+ } else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
4093
+ return false;
4094
+ }
4095
+ }
4096
+ if (lt) {
4097
+ if (needDomLTPre) {
4098
+ if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
4099
+ needDomLTPre = false;
4100
+ }
4101
+ }
4102
+ if (c.operator === "<" || c.operator === "<=") {
4103
+ lower = lowerLT(lt, c, options);
4104
+ if (lower === c && lower !== lt) {
4105
+ return false;
4106
+ }
4107
+ } else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
4108
+ return false;
4109
+ }
4110
+ }
4111
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
4112
+ return false;
4113
+ }
4114
+ }
4115
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
4116
+ return false;
4117
+ }
4118
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
4119
+ return false;
4120
+ }
4121
+ if (needDomGTPre || needDomLTPre) {
4122
+ return false;
4123
+ }
4124
+ return true;
4125
+ };
4126
+ var higherGT = (a, b, options) => {
4127
+ if (!a) {
4128
+ return b;
4129
+ }
4130
+ const comp = compare(a.semver, b.semver, options);
4131
+ return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
4132
+ };
4133
+ var lowerLT = (a, b, options) => {
4134
+ if (!a) {
4135
+ return b;
4136
+ }
4137
+ const comp = compare(a.semver, b.semver, options);
4138
+ return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
4139
+ };
4140
+ module.exports = subset;
4141
+ }
4142
+ });
4143
+
4144
+ // node_modules/semver/index.js
4145
+ var require_semver2 = __commonJS({
4146
+ "node_modules/semver/index.js"(exports, module) {
4147
+ init_cjs_shims();
4148
+ var internalRe = require_re();
4149
+ var constants = require_constants();
4150
+ var SemVer = require_semver();
4151
+ var identifiers = require_identifiers();
4152
+ var parse = require_parse();
4153
+ var valid = require_valid();
4154
+ var clean = require_clean();
4155
+ var inc = require_inc();
4156
+ var diff = require_diff();
4157
+ var major = require_major();
4158
+ var minor = require_minor();
4159
+ var patch = require_patch();
4160
+ var prerelease = require_prerelease();
4161
+ var compare = require_compare();
4162
+ var rcompare = require_rcompare();
4163
+ var compareLoose = require_compare_loose();
4164
+ var compareBuild = require_compare_build();
4165
+ var sort = require_sort();
4166
+ var rsort = require_rsort();
4167
+ var gt = require_gt();
4168
+ var lt = require_lt();
4169
+ var eq = require_eq();
4170
+ var neq = require_neq();
4171
+ var gte = require_gte();
4172
+ var lte = require_lte();
4173
+ var cmp = require_cmp();
4174
+ var coerce = require_coerce();
4175
+ var Comparator = require_comparator();
4176
+ var Range = require_range();
4177
+ var satisfies = require_satisfies();
4178
+ var toComparators = require_to_comparators();
4179
+ var maxSatisfying = require_max_satisfying();
4180
+ var minSatisfying = require_min_satisfying();
4181
+ var minVersion = require_min_version();
4182
+ var validRange = require_valid2();
4183
+ var outside = require_outside();
4184
+ var gtr = require_gtr();
4185
+ var ltr = require_ltr();
4186
+ var intersects = require_intersects();
4187
+ var simplifyRange = require_simplify();
4188
+ var subset = require_subset();
4189
+ module.exports = {
4190
+ parse,
4191
+ valid,
4192
+ clean,
4193
+ inc,
4194
+ diff,
4195
+ major,
4196
+ minor,
4197
+ patch,
4198
+ prerelease,
4199
+ compare,
4200
+ rcompare,
4201
+ compareLoose,
4202
+ compareBuild,
4203
+ sort,
4204
+ rsort,
4205
+ gt,
4206
+ lt,
4207
+ eq,
4208
+ neq,
4209
+ gte,
4210
+ lte,
4211
+ cmp,
4212
+ coerce,
4213
+ Comparator,
4214
+ Range,
4215
+ satisfies,
4216
+ toComparators,
4217
+ maxSatisfying,
4218
+ minSatisfying,
4219
+ minVersion,
4220
+ validRange,
4221
+ outside,
4222
+ gtr,
4223
+ ltr,
4224
+ intersects,
4225
+ simplifyRange,
4226
+ subset,
4227
+ SemVer,
4228
+ re: internalRe.re,
4229
+ src: internalRe.src,
4230
+ tokens: internalRe.t,
4231
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
4232
+ RELEASE_TYPES: constants.RELEASE_TYPES,
4233
+ compareIdentifiers: identifiers.compareIdentifiers,
4234
+ rcompareIdentifiers: identifiers.rcompareIdentifiers
4235
+ };
4236
+ }
4237
+ });
4238
+
4239
+ // node_modules/builtins/index.js
4240
+ var require_builtins = __commonJS({
4241
+ "node_modules/builtins/index.js"(exports, module) {
4242
+ "use strict";
4243
+ init_cjs_shims();
4244
+ var semver = require_semver2();
4245
+ var permanentModules = [
4246
+ "assert",
4247
+ "buffer",
4248
+ "child_process",
4249
+ "cluster",
4250
+ "console",
4251
+ "constants",
4252
+ "crypto",
4253
+ "dgram",
4254
+ "dns",
4255
+ "domain",
4256
+ "events",
4257
+ "fs",
4258
+ "http",
4259
+ "https",
4260
+ "module",
4261
+ "net",
4262
+ "os",
4263
+ "path",
4264
+ "punycode",
4265
+ "querystring",
4266
+ "readline",
4267
+ "repl",
4268
+ "stream",
4269
+ "string_decoder",
4270
+ "sys",
4271
+ "timers",
4272
+ "tls",
4273
+ "tty",
4274
+ "url",
4275
+ "util",
4276
+ "vm",
4277
+ "zlib"
4278
+ ];
4279
+ var versionLockedModules = {
4280
+ freelist: "<6.0.0",
4281
+ v8: ">=1.0.0",
4282
+ process: ">=1.1.0",
4283
+ inspector: ">=8.0.0",
4284
+ async_hooks: ">=8.1.0",
4285
+ http2: ">=8.4.0",
4286
+ perf_hooks: ">=8.5.0",
4287
+ trace_events: ">=10.0.0",
4288
+ worker_threads: ">=12.0.0",
4289
+ "node:test": ">=18.0.0"
4290
+ };
4291
+ var experimentalModules = {
4292
+ worker_threads: ">=10.5.0",
4293
+ wasi: ">=12.16.0",
4294
+ diagnostics_channel: "^14.17.0 || >=15.1.0"
4295
+ };
4296
+ module.exports = ({ version = process.version, experimental = false } = {}) => {
4297
+ const builtins = [...permanentModules];
4298
+ for (const [name, semverRange] of Object.entries(versionLockedModules)) {
4299
+ if (version === "*" || semver.satisfies(version, semverRange)) {
4300
+ builtins.push(name);
4301
+ }
4302
+ }
4303
+ if (experimental) {
4304
+ for (const [name, semverRange] of Object.entries(experimentalModules)) {
4305
+ if (!builtins.includes(name) && (version === "*" || semver.satisfies(version, semverRange))) {
4306
+ builtins.push(name);
4307
+ }
4308
+ }
4309
+ }
4310
+ return builtins;
4311
+ };
4312
+ }
4313
+ });
4314
+
4315
+ // node_modules/validate-npm-package-name/lib/index.js
4316
+ var require_lib2 = __commonJS({
4317
+ "node_modules/validate-npm-package-name/lib/index.js"(exports, module) {
4318
+ "use strict";
4319
+ init_cjs_shims();
4320
+ var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
4321
+ var builtins = require_builtins();
4322
+ var blacklist = [
4323
+ "node_modules",
4324
+ "favicon.ico"
4325
+ ];
4326
+ function validate(name) {
4327
+ var warnings = [];
4328
+ var errors = [];
4329
+ if (name === null) {
4330
+ errors.push("name cannot be null");
4331
+ return done(warnings, errors);
4332
+ }
4333
+ if (name === void 0) {
4334
+ errors.push("name cannot be undefined");
4335
+ return done(warnings, errors);
4336
+ }
4337
+ if (typeof name !== "string") {
4338
+ errors.push("name must be a string");
4339
+ return done(warnings, errors);
4340
+ }
4341
+ if (!name.length) {
4342
+ errors.push("name length must be greater than zero");
4343
+ }
4344
+ if (name.match(/^\./)) {
4345
+ errors.push("name cannot start with a period");
4346
+ }
4347
+ if (name.match(/^_/)) {
4348
+ errors.push("name cannot start with an underscore");
4349
+ }
4350
+ if (name.trim() !== name) {
4351
+ errors.push("name cannot contain leading or trailing spaces");
4352
+ }
4353
+ blacklist.forEach(function(blacklistedName) {
4354
+ if (name.toLowerCase() === blacklistedName) {
4355
+ errors.push(blacklistedName + " is a blacklisted name");
4356
+ }
4357
+ });
4358
+ builtins({ version: "*" }).forEach(function(builtin) {
4359
+ if (name.toLowerCase() === builtin) {
4360
+ warnings.push(builtin + " is a core module name");
4361
+ }
4362
+ });
4363
+ if (name.length > 214) {
4364
+ warnings.push("name can no longer contain more than 214 characters");
4365
+ }
4366
+ if (name.toLowerCase() !== name) {
4367
+ warnings.push("name can no longer contain capital letters");
4368
+ }
4369
+ if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) {
4370
+ warnings.push(`name can no longer contain special characters ("~'!()*")`);
4371
+ }
4372
+ if (encodeURIComponent(name) !== name) {
4373
+ var nameMatch = name.match(scopedPackagePattern);
4374
+ if (nameMatch) {
4375
+ var user = nameMatch[1];
4376
+ var pkg = nameMatch[2];
4377
+ if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) {
4378
+ return done(warnings, errors);
4379
+ }
4380
+ }
4381
+ errors.push("name can only contain URL-friendly characters");
4382
+ }
4383
+ return done(warnings, errors);
4384
+ }
4385
+ var done = function(warnings, errors) {
4386
+ var result = {
4387
+ validForNewPackages: errors.length === 0 && warnings.length === 0,
4388
+ validForOldPackages: errors.length === 0,
4389
+ warnings,
4390
+ errors
4391
+ };
4392
+ if (!result.warnings.length) {
4393
+ delete result.warnings;
4394
+ }
4395
+ if (!result.errors.length) {
4396
+ delete result.errors;
4397
+ }
4398
+ return result;
4399
+ };
4400
+ module.exports = validate;
4401
+ }
4402
+ });
4403
+
4404
+ // node_modules/proc-log/lib/index.js
4405
+ var require_lib3 = __commonJS({
4406
+ "node_modules/proc-log/lib/index.js"(exports, module) {
4407
+ init_cjs_shims();
4408
+ var META = Symbol("proc-log.meta");
4409
+ module.exports = {
4410
+ META,
4411
+ output: {
4412
+ LEVELS: [
4413
+ "standard",
4414
+ "error",
4415
+ "buffer",
4416
+ "flush"
4417
+ ],
4418
+ KEYS: {
4419
+ standard: "standard",
4420
+ error: "error",
4421
+ buffer: "buffer",
4422
+ flush: "flush"
4423
+ },
4424
+ standard: function(...args) {
4425
+ return process.emit("output", "standard", ...args);
4426
+ },
4427
+ error: function(...args) {
4428
+ return process.emit("output", "error", ...args);
4429
+ },
4430
+ buffer: function(...args) {
4431
+ return process.emit("output", "buffer", ...args);
4432
+ },
4433
+ flush: function(...args) {
4434
+ return process.emit("output", "flush", ...args);
4435
+ }
4436
+ },
4437
+ log: {
4438
+ LEVELS: [
4439
+ "notice",
4440
+ "error",
4441
+ "warn",
4442
+ "info",
4443
+ "verbose",
4444
+ "http",
4445
+ "silly",
4446
+ "timing",
4447
+ "pause",
4448
+ "resume"
4449
+ ],
4450
+ KEYS: {
4451
+ notice: "notice",
4452
+ error: "error",
4453
+ warn: "warn",
4454
+ info: "info",
4455
+ verbose: "verbose",
4456
+ http: "http",
4457
+ silly: "silly",
4458
+ timing: "timing",
4459
+ pause: "pause",
4460
+ resume: "resume"
4461
+ },
4462
+ error: function(...args) {
4463
+ return process.emit("log", "error", ...args);
4464
+ },
4465
+ notice: function(...args) {
4466
+ return process.emit("log", "notice", ...args);
4467
+ },
4468
+ warn: function(...args) {
4469
+ return process.emit("log", "warn", ...args);
4470
+ },
4471
+ info: function(...args) {
4472
+ return process.emit("log", "info", ...args);
4473
+ },
4474
+ verbose: function(...args) {
4475
+ return process.emit("log", "verbose", ...args);
4476
+ },
4477
+ http: function(...args) {
4478
+ return process.emit("log", "http", ...args);
4479
+ },
4480
+ silly: function(...args) {
4481
+ return process.emit("log", "silly", ...args);
4482
+ },
4483
+ timing: function(...args) {
4484
+ return process.emit("log", "timing", ...args);
4485
+ },
4486
+ pause: function() {
4487
+ return process.emit("log", "pause");
4488
+ },
4489
+ resume: function() {
4490
+ return process.emit("log", "resume");
4491
+ }
4492
+ },
4493
+ time: {
4494
+ LEVELS: [
4495
+ "start",
4496
+ "end"
4497
+ ],
4498
+ KEYS: {
4499
+ start: "start",
4500
+ end: "end"
4501
+ },
4502
+ start: function(name, fn) {
4503
+ process.emit("time", "start", name);
4504
+ function end() {
4505
+ return process.emit("time", "end", name);
4506
+ }
4507
+ if (typeof fn === "function") {
4508
+ const res = fn();
4509
+ if (res && res.finally) {
4510
+ return res.finally(end);
4511
+ }
4512
+ end();
4513
+ return res;
4514
+ }
4515
+ return end;
4516
+ },
4517
+ end: function(name) {
4518
+ return process.emit("time", "end", name);
4519
+ }
4520
+ },
4521
+ input: {
4522
+ LEVELS: [
4523
+ "start",
4524
+ "end",
4525
+ "read"
4526
+ ],
4527
+ KEYS: {
4528
+ start: "start",
4529
+ end: "end",
4530
+ read: "read"
4531
+ },
4532
+ start: function(fn) {
4533
+ process.emit("input", "start");
4534
+ function end() {
4535
+ return process.emit("input", "end");
4536
+ }
4537
+ if (typeof fn === "function") {
4538
+ const res = fn();
4539
+ if (res && res.finally) {
4540
+ return res.finally(end);
4541
+ }
4542
+ end();
4543
+ return res;
4544
+ }
4545
+ return end;
4546
+ },
4547
+ end: function() {
4548
+ return process.emit("input", "end");
4549
+ },
4550
+ read: function(...args) {
4551
+ let resolve, reject;
4552
+ const promise = new Promise((_resolve, _reject) => {
4553
+ resolve = _resolve;
4554
+ reject = _reject;
4555
+ });
4556
+ process.emit("input", "read", resolve, reject, ...args);
4557
+ return promise;
4558
+ }
4559
+ }
4560
+ };
4561
+ }
4562
+ });
4563
+
4564
+ // node_modules/npm-package-arg/lib/npa.js
4565
+ var require_npa = __commonJS({
4566
+ "node_modules/npm-package-arg/lib/npa.js"(exports, module) {
4567
+ init_cjs_shims();
4568
+ module.exports = npa;
4569
+ module.exports.resolve = resolve;
4570
+ module.exports.toPurl = toPurl;
4571
+ module.exports.Result = Result;
4572
+ var { URL } = __require("url");
4573
+ var HostedGit = require_lib();
4574
+ var semver = require_semver2();
4575
+ var path = global.FAKE_WINDOWS ? __require("path").win32 : __require("path");
4576
+ var validatePackageName = require_lib2();
4577
+ var { homedir } = __require("os");
4578
+ var { log } = require_lib3();
4579
+ var isWindows = process.platform === "win32" || global.FAKE_WINDOWS;
4580
+ var hasSlashes = isWindows ? /\\|[/]/ : /[/]/;
4581
+ var isURL = /^(?:git[+])?[a-z]+:/i;
4582
+ var isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i;
4583
+ var isFilename = /[.](?:tgz|tar.gz|tar)$/i;
4584
+ function npa(arg, where) {
4585
+ let name;
4586
+ let spec;
4587
+ if (typeof arg === "object") {
4588
+ if (arg instanceof Result && (!where || where === arg.where)) {
4589
+ return arg;
4590
+ } else if (arg.name && arg.rawSpec) {
4591
+ return npa.resolve(arg.name, arg.rawSpec, where || arg.where);
4592
+ } else {
4593
+ return npa(arg.raw, where || arg.where);
4594
+ }
4595
+ }
4596
+ const nameEndsAt = arg[0] === "@" ? arg.slice(1).indexOf("@") + 1 : arg.indexOf("@");
4597
+ const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg;
4598
+ if (isURL.test(arg)) {
4599
+ spec = arg;
4600
+ } else if (isGit.test(arg)) {
4601
+ spec = `git+ssh://${arg}`;
4602
+ } else if (namePart[0] !== "@" && (hasSlashes.test(namePart) || isFilename.test(namePart))) {
4603
+ spec = arg;
4604
+ } else if (nameEndsAt > 0) {
4605
+ name = namePart;
4606
+ spec = arg.slice(nameEndsAt + 1) || "*";
4607
+ } else {
4608
+ const valid = validatePackageName(arg);
4609
+ if (valid.validForOldPackages) {
4610
+ name = arg;
4611
+ spec = "*";
4612
+ } else {
4613
+ spec = arg;
4614
+ }
4615
+ }
4616
+ return resolve(name, spec, where, arg);
4617
+ }
4618
+ var isFilespec = isWindows ? /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/ : /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/;
4619
+ function resolve(name, spec, where, arg) {
4620
+ const res = new Result({
4621
+ raw: arg,
4622
+ name,
4623
+ rawSpec: spec,
4624
+ fromArgument: arg != null
4625
+ });
4626
+ if (name) {
4627
+ res.setName(name);
4628
+ }
4629
+ if (spec && (isFilespec.test(spec) || /^file:/i.test(spec))) {
4630
+ return fromFile(res, where);
4631
+ } else if (spec && /^npm:/i.test(spec)) {
4632
+ return fromAlias(res, where);
4633
+ }
4634
+ const hosted = HostedGit.fromUrl(spec, {
4635
+ noGitPlus: true,
4636
+ noCommittish: true
4637
+ });
4638
+ if (hosted) {
4639
+ return fromHostedGit(res, hosted);
4640
+ } else if (spec && isURL.test(spec)) {
4641
+ return fromURL(res);
4642
+ } else if (spec && (hasSlashes.test(spec) || isFilename.test(spec))) {
4643
+ return fromFile(res, where);
4644
+ } else {
4645
+ return fromRegistry(res);
4646
+ }
4647
+ }
4648
+ var defaultRegistry = "https://registry.npmjs.org";
4649
+ function toPurl(arg, reg = defaultRegistry) {
4650
+ const res = npa(arg);
4651
+ if (res.type !== "version") {
4652
+ throw invalidPurlType(res.type, res.raw);
4653
+ }
4654
+ let purl = "pkg:npm/" + res.name.replace(/^@/, "%40") + "@" + res.rawSpec;
4655
+ if (reg !== defaultRegistry) {
4656
+ purl += "?repository_url=" + reg;
4657
+ }
4658
+ return purl;
4659
+ }
4660
+ function invalidPackageName(name, valid, raw) {
4661
+ const err = new Error(`Invalid package name "${name}" of package "${raw}": ${valid.errors.join("; ")}.`);
4662
+ err.code = "EINVALIDPACKAGENAME";
4663
+ return err;
4664
+ }
4665
+ function invalidTagName(name, raw) {
4666
+ const err = new Error(`Invalid tag name "${name}" of package "${raw}": Tags may not have any characters that encodeURIComponent encodes.`);
4667
+ err.code = "EINVALIDTAGNAME";
4668
+ return err;
4669
+ }
4670
+ function invalidPurlType(type, raw) {
4671
+ const err = new Error(`Invalid type "${type}" of package "${raw}": Purl can only be generated for "version" types.`);
4672
+ err.code = "EINVALIDPURLTYPE";
4673
+ return err;
4674
+ }
4675
+ function Result(opts) {
4676
+ this.type = opts.type;
4677
+ this.registry = opts.registry;
4678
+ this.where = opts.where;
4679
+ if (opts.raw == null) {
4680
+ this.raw = opts.name ? opts.name + "@" + opts.rawSpec : opts.rawSpec;
4681
+ } else {
4682
+ this.raw = opts.raw;
4683
+ }
4684
+ this.name = void 0;
4685
+ this.escapedName = void 0;
4686
+ this.scope = void 0;
4687
+ this.rawSpec = opts.rawSpec || "";
4688
+ this.saveSpec = opts.saveSpec;
4689
+ this.fetchSpec = opts.fetchSpec;
4690
+ if (opts.name) {
4691
+ this.setName(opts.name);
4692
+ }
4693
+ this.gitRange = opts.gitRange;
4694
+ this.gitCommittish = opts.gitCommittish;
4695
+ this.gitSubdir = opts.gitSubdir;
4696
+ this.hosted = opts.hosted;
4697
+ }
4698
+ Result.prototype.setName = function(name) {
4699
+ const valid = validatePackageName(name);
4700
+ if (!valid.validForOldPackages) {
4701
+ throw invalidPackageName(name, valid, this.raw);
4702
+ }
4703
+ this.name = name;
4704
+ this.scope = name[0] === "@" ? name.slice(0, name.indexOf("/")) : void 0;
4705
+ this.escapedName = name.replace("/", "%2f");
4706
+ return this;
4707
+ };
4708
+ Result.prototype.toString = function() {
4709
+ const full = [];
4710
+ if (this.name != null && this.name !== "") {
4711
+ full.push(this.name);
4712
+ }
4713
+ const spec = this.saveSpec || this.fetchSpec || this.rawSpec;
4714
+ if (spec != null && spec !== "") {
4715
+ full.push(spec);
4716
+ }
4717
+ return full.length ? full.join("@") : this.raw;
4718
+ };
4719
+ Result.prototype.toJSON = function() {
4720
+ const result = Object.assign({}, this);
4721
+ delete result.hosted;
4722
+ return result;
4723
+ };
4724
+ function setGitAttrs(res, committish) {
4725
+ if (!committish) {
4726
+ res.gitCommittish = null;
4727
+ return;
4728
+ }
4729
+ for (const part of committish.split("::")) {
4730
+ if (!part.includes(":")) {
4731
+ if (res.gitRange) {
4732
+ throw new Error("cannot override existing semver range with a committish");
4733
+ }
4734
+ if (res.gitCommittish) {
4735
+ throw new Error("cannot override existing committish with a second committish");
4736
+ }
4737
+ res.gitCommittish = part;
4738
+ continue;
4739
+ }
4740
+ const [name, value] = part.split(":");
4741
+ if (name === "semver") {
4742
+ if (res.gitCommittish) {
4743
+ throw new Error("cannot override existing committish with a semver range");
4744
+ }
4745
+ if (res.gitRange) {
4746
+ throw new Error("cannot override existing semver range with a second semver range");
4747
+ }
4748
+ res.gitRange = decodeURIComponent(value);
4749
+ continue;
4750
+ }
4751
+ if (name === "path") {
4752
+ if (res.gitSubdir) {
4753
+ throw new Error("cannot override existing path with a second path");
4754
+ }
4755
+ res.gitSubdir = `/${value}`;
4756
+ continue;
4757
+ }
4758
+ log.warn("npm-package-arg", `ignoring unknown key "${name}"`);
4759
+ }
4760
+ }
4761
+ function fromFile(res, where) {
4762
+ if (!where) {
4763
+ where = process.cwd();
4764
+ }
4765
+ res.type = isFilename.test(res.rawSpec) ? "file" : "directory";
4766
+ res.where = where;
4767
+ let specUrl;
4768
+ let resolvedUrl;
4769
+ const prefix = !/^file:/.test(res.rawSpec) ? "file:" : "";
4770
+ const rawWithPrefix = prefix + res.rawSpec;
4771
+ let rawNoPrefix = rawWithPrefix.replace(/^file:/, "");
4772
+ try {
4773
+ resolvedUrl = new URL(rawWithPrefix, `file://${path.resolve(where)}/`);
4774
+ specUrl = new URL(rawWithPrefix);
4775
+ } catch (originalError) {
4776
+ const er = new Error("Invalid file: URL, must comply with RFC 8089");
4777
+ throw Object.assign(er, {
4778
+ raw: res.rawSpec,
4779
+ spec: res,
4780
+ where,
4781
+ originalError
4782
+ });
4783
+ }
4784
+ if (resolvedUrl.host && resolvedUrl.host !== "localhost") {
4785
+ const rawSpec = res.rawSpec.replace(/^file:\/\//, "file:///");
4786
+ resolvedUrl = new URL(rawSpec, `file://${path.resolve(where)}/`);
4787
+ specUrl = new URL(rawSpec);
4788
+ rawNoPrefix = rawSpec.replace(/^file:/, "");
4789
+ }
4790
+ if (/^\/{1,3}\.\.?(\/|$)/.test(rawNoPrefix)) {
4791
+ const rawSpec = res.rawSpec.replace(/^file:\/{1,3}/, "file:");
4792
+ resolvedUrl = new URL(rawSpec, `file://${path.resolve(where)}/`);
4793
+ specUrl = new URL(rawSpec);
4794
+ rawNoPrefix = rawSpec.replace(/^file:/, "");
4795
+ }
4796
+ let specPath = decodeURIComponent(specUrl.pathname);
4797
+ let resolvedPath = decodeURIComponent(resolvedUrl.pathname);
4798
+ if (isWindows) {
4799
+ specPath = specPath.replace(/^\/+([a-z]:\/)/i, "$1");
4800
+ resolvedPath = resolvedPath.replace(/^\/+([a-z]:\/)/i, "$1");
4801
+ }
4802
+ if (/^\/~(\/|$)/.test(specPath)) {
4803
+ res.saveSpec = `file:${specPath.substr(1)}`;
4804
+ resolvedPath = path.resolve(homedir(), specPath.substr(3));
4805
+ } else if (!path.isAbsolute(rawNoPrefix)) {
4806
+ res.saveSpec = `file:${path.relative(where, resolvedPath)}`;
4807
+ } else {
4808
+ res.saveSpec = `file:${path.resolve(resolvedPath)}`;
4809
+ }
4810
+ res.fetchSpec = path.resolve(where, resolvedPath);
4811
+ return res;
4812
+ }
4813
+ function fromHostedGit(res, hosted) {
4814
+ res.type = "git";
4815
+ res.hosted = hosted;
4816
+ res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false });
4817
+ res.fetchSpec = hosted.getDefaultRepresentation() === "shortcut" ? null : hosted.toString();
4818
+ setGitAttrs(res, hosted.committish);
4819
+ return res;
4820
+ }
4821
+ function unsupportedURLType(protocol, spec) {
4822
+ const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`);
4823
+ err.code = "EUNSUPPORTEDPROTOCOL";
4824
+ return err;
4825
+ }
4826
+ function fromURL(res) {
4827
+ let rawSpec = res.rawSpec;
4828
+ res.saveSpec = rawSpec;
4829
+ if (rawSpec.startsWith("git+ssh:")) {
4830
+ const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i);
4831
+ if (matched && !matched[1].match(/:[0-9]+\/?.*$/i)) {
4832
+ res.type = "git";
4833
+ setGitAttrs(res, matched[2]);
4834
+ res.fetchSpec = matched[1];
4835
+ return res;
4836
+ }
4837
+ } else if (rawSpec.startsWith("git+file://")) {
4838
+ rawSpec = rawSpec.replace(/\\/g, "/");
4839
+ }
4840
+ const parsedUrl = new URL(rawSpec);
4841
+ switch (parsedUrl.protocol) {
4842
+ case "git:":
4843
+ case "git+http:":
4844
+ case "git+https:":
4845
+ case "git+rsync:":
4846
+ case "git+ftp:":
4847
+ case "git+file:":
4848
+ case "git+ssh:":
4849
+ res.type = "git";
4850
+ setGitAttrs(res, parsedUrl.hash.slice(1));
4851
+ if (parsedUrl.protocol === "git+file:" && /^git\+file:\/\/[a-z]:/i.test(rawSpec)) {
4852
+ res.fetchSpec = `git+file://${parsedUrl.host.toLowerCase()}:${parsedUrl.pathname}`;
4853
+ } else {
4854
+ parsedUrl.hash = "";
4855
+ res.fetchSpec = parsedUrl.toString();
4856
+ }
4857
+ if (res.fetchSpec.startsWith("git+")) {
4858
+ res.fetchSpec = res.fetchSpec.slice(4);
4859
+ }
4860
+ break;
4861
+ case "http:":
4862
+ case "https:":
4863
+ res.type = "remote";
4864
+ res.fetchSpec = res.saveSpec;
4865
+ break;
4866
+ default:
4867
+ throw unsupportedURLType(parsedUrl.protocol, rawSpec);
4868
+ }
4869
+ return res;
4870
+ }
4871
+ function fromAlias(res, where) {
4872
+ const subSpec = npa(res.rawSpec.substr(4), where);
4873
+ if (subSpec.type === "alias") {
4874
+ throw new Error("nested aliases not supported");
4875
+ }
4876
+ if (!subSpec.registry) {
4877
+ throw new Error("aliases only work for registry deps");
4878
+ }
4879
+ res.subSpec = subSpec;
4880
+ res.registry = true;
4881
+ res.type = "alias";
4882
+ res.saveSpec = null;
4883
+ res.fetchSpec = null;
4884
+ return res;
4885
+ }
4886
+ function fromRegistry(res) {
4887
+ res.registry = true;
4888
+ const spec = res.rawSpec.trim();
4889
+ res.saveSpec = null;
4890
+ res.fetchSpec = spec;
4891
+ const version = semver.valid(spec, true);
4892
+ const range = semver.validRange(spec, true);
4893
+ if (version) {
4894
+ res.type = "version";
4895
+ } else if (range) {
4896
+ res.type = "range";
4897
+ } else {
4898
+ if (encodeURIComponent(spec) !== spec) {
4899
+ throw invalidTagName(spec, res.raw);
4900
+ }
4901
+ res.type = "tag";
4902
+ }
4903
+ return res;
4904
+ }
4905
+ }
4906
+ });
4907
+ export default require_npa();