@telia-ace/alliance-utilities 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,2093 @@
1
+ import He from "fs";
2
+ import V from "path";
3
+ import { pipeline as kn } from "stream/promises";
4
+ var me = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
+ function Pn(e) {
6
+ var t = e.default;
7
+ if (typeof t == "function") {
8
+ var n = function() {
9
+ return t.apply(this, arguments);
10
+ };
11
+ n.prototype = t.prototype;
12
+ } else
13
+ n = {};
14
+ return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
15
+ var i = Object.getOwnPropertyDescriptor(e, r);
16
+ Object.defineProperty(n, r, i.get ? i : {
17
+ enumerable: !0,
18
+ get: function() {
19
+ return e[r];
20
+ }
21
+ });
22
+ }), n;
23
+ }
24
+ var se = {}, H = {};
25
+ H.fromCallback = function(e) {
26
+ return Object.defineProperty(function(...t) {
27
+ if (typeof t[t.length - 1] == "function")
28
+ e.apply(this, t);
29
+ else
30
+ return new Promise((n, r) => {
31
+ e.call(
32
+ this,
33
+ ...t,
34
+ (i, o) => i != null ? r(i) : n(o)
35
+ );
36
+ });
37
+ }, "name", { value: e.name });
38
+ };
39
+ H.fromPromise = function(e) {
40
+ return Object.defineProperty(function(...t) {
41
+ const n = t[t.length - 1];
42
+ if (typeof n != "function")
43
+ return e.apply(this, t);
44
+ e.apply(this, t.slice(0, -1)).then((r) => n(null, r), n);
45
+ }, "name", { value: e.name });
46
+ };
47
+ const _n = {}, Dn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
48
+ __proto__: null,
49
+ default: _n
50
+ }, Symbol.toStringTag, { value: "Module" })), re = /* @__PURE__ */ Pn(Dn);
51
+ var oe = re, Nn = process.cwd, Le = null, Tn = process.env.GRACEFUL_FS_PLATFORM || process.platform;
52
+ process.cwd = function() {
53
+ return Le || (Le = Nn.call(process)), Le;
54
+ };
55
+ try {
56
+ process.cwd();
57
+ } catch {
58
+ }
59
+ if (typeof process.chdir == "function") {
60
+ var at = process.chdir;
61
+ process.chdir = function(e) {
62
+ Le = null, at.call(process, e);
63
+ }, Object.setPrototypeOf && Object.setPrototypeOf(process.chdir, at);
64
+ }
65
+ var Ln = In;
66
+ function In(e) {
67
+ oe.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && t(e), e.lutimes || n(e), e.chown = o(e.chown), e.fchown = o(e.fchown), e.lchown = o(e.lchown), e.chmod = r(e.chmod), e.fchmod = r(e.fchmod), e.lchmod = r(e.lchmod), e.chownSync = c(e.chownSync), e.fchownSync = c(e.fchownSync), e.lchownSync = c(e.lchownSync), e.chmodSync = i(e.chmodSync), e.fchmodSync = i(e.fchmodSync), e.lchmodSync = i(e.lchmodSync), e.stat = a(e.stat), e.fstat = a(e.fstat), e.lstat = a(e.lstat), e.statSync = s(e.statSync), e.fstatSync = s(e.fstatSync), e.lstatSync = s(e.lstatSync), e.lchmod || (e.lchmod = function(f, m, h) {
68
+ h && process.nextTick(h);
69
+ }, e.lchmodSync = function() {
70
+ }), e.lchown || (e.lchown = function(f, m, h, d) {
71
+ d && process.nextTick(d);
72
+ }, e.lchownSync = function() {
73
+ }), Tn === "win32" && (e.rename = function(f) {
74
+ return function(m, h, d) {
75
+ var E = Date.now(), F = 0;
76
+ f(m, h, function u(l) {
77
+ if (l && (l.code === "EACCES" || l.code === "EPERM") && Date.now() - E < 6e4) {
78
+ setTimeout(function() {
79
+ e.stat(h, function(y, S) {
80
+ y && y.code === "ENOENT" ? f(m, h, u) : d(l);
81
+ });
82
+ }, F), F < 100 && (F += 10);
83
+ return;
84
+ }
85
+ d && d(l);
86
+ });
87
+ };
88
+ }(e.rename)), e.read = function(f) {
89
+ function m(h, d, E, F, u, l) {
90
+ var y;
91
+ if (l && typeof l == "function") {
92
+ var S = 0;
93
+ y = function(w, P, D) {
94
+ if (w && w.code === "EAGAIN" && S < 10)
95
+ return S++, f.call(e, h, d, E, F, u, y);
96
+ l.apply(this, arguments);
97
+ };
98
+ }
99
+ return f.call(e, h, d, E, F, u, y);
100
+ }
101
+ return Object.setPrototypeOf && Object.setPrototypeOf(m, f), m;
102
+ }(e.read), e.readSync = function(f) {
103
+ return function(m, h, d, E, F) {
104
+ for (var u = 0; ; )
105
+ try {
106
+ return f.call(e, m, h, d, E, F);
107
+ } catch (l) {
108
+ if (l.code === "EAGAIN" && u < 10) {
109
+ u++;
110
+ continue;
111
+ }
112
+ throw l;
113
+ }
114
+ };
115
+ }(e.readSync);
116
+ function t(f) {
117
+ f.lchmod = function(m, h, d) {
118
+ f.open(
119
+ m,
120
+ oe.O_WRONLY | oe.O_SYMLINK,
121
+ h,
122
+ function(E, F) {
123
+ if (E) {
124
+ d && d(E);
125
+ return;
126
+ }
127
+ f.fchmod(F, h, function(u) {
128
+ f.close(F, function(l) {
129
+ d && d(u || l);
130
+ });
131
+ });
132
+ }
133
+ );
134
+ }, f.lchmodSync = function(m, h) {
135
+ var d = f.openSync(m, oe.O_WRONLY | oe.O_SYMLINK, h), E = !0, F;
136
+ try {
137
+ F = f.fchmodSync(d, h), E = !1;
138
+ } finally {
139
+ if (E)
140
+ try {
141
+ f.closeSync(d);
142
+ } catch {
143
+ }
144
+ else
145
+ f.closeSync(d);
146
+ }
147
+ return F;
148
+ };
149
+ }
150
+ function n(f) {
151
+ oe.hasOwnProperty("O_SYMLINK") ? (f.lutimes = function(m, h, d, E) {
152
+ f.open(m, oe.O_SYMLINK, function(F, u) {
153
+ if (F) {
154
+ E && E(F);
155
+ return;
156
+ }
157
+ f.futimes(u, h, d, function(l) {
158
+ f.close(u, function(y) {
159
+ E && E(l || y);
160
+ });
161
+ });
162
+ });
163
+ }, f.lutimesSync = function(m, h, d) {
164
+ var E = f.openSync(m, oe.O_SYMLINK), F, u = !0;
165
+ try {
166
+ F = f.futimesSync(E, h, d), u = !1;
167
+ } finally {
168
+ if (u)
169
+ try {
170
+ f.closeSync(E);
171
+ } catch {
172
+ }
173
+ else
174
+ f.closeSync(E);
175
+ }
176
+ return F;
177
+ }) : (f.lutimes = function(m, h, d, E) {
178
+ E && process.nextTick(E);
179
+ }, f.lutimesSync = function() {
180
+ });
181
+ }
182
+ function r(f) {
183
+ return f && function(m, h, d) {
184
+ return f.call(e, m, h, function(E) {
185
+ v(E) && (E = null), d && d.apply(this, arguments);
186
+ });
187
+ };
188
+ }
189
+ function i(f) {
190
+ return f && function(m, h) {
191
+ try {
192
+ return f.call(e, m, h);
193
+ } catch (d) {
194
+ if (!v(d))
195
+ throw d;
196
+ }
197
+ };
198
+ }
199
+ function o(f) {
200
+ return f && function(m, h, d, E) {
201
+ return f.call(e, m, h, d, function(F) {
202
+ v(F) && (F = null), E && E.apply(this, arguments);
203
+ });
204
+ };
205
+ }
206
+ function c(f) {
207
+ return f && function(m, h, d) {
208
+ try {
209
+ return f.call(e, m, h, d);
210
+ } catch (E) {
211
+ if (!v(E))
212
+ throw E;
213
+ }
214
+ };
215
+ }
216
+ function a(f) {
217
+ return f && function(m, h, d) {
218
+ typeof h == "function" && (d = h, h = null);
219
+ function E(F, u) {
220
+ u && (u.uid < 0 && (u.uid += 4294967296), u.gid < 0 && (u.gid += 4294967296)), d && d.apply(this, arguments);
221
+ }
222
+ return h ? f.call(e, m, h, E) : f.call(e, m, E);
223
+ };
224
+ }
225
+ function s(f) {
226
+ return f && function(m, h) {
227
+ var d = h ? f.call(e, m, h) : f.call(e, m);
228
+ return d && (d.uid < 0 && (d.uid += 4294967296), d.gid < 0 && (d.gid += 4294967296)), d;
229
+ };
230
+ }
231
+ function v(f) {
232
+ if (!f || f.code === "ENOSYS")
233
+ return !0;
234
+ var m = !process.getuid || process.getuid() !== 0;
235
+ return !!(m && (f.code === "EINVAL" || f.code === "EPERM"));
236
+ }
237
+ }
238
+ var ft = re.Stream, Cn = jn;
239
+ function jn(e) {
240
+ return {
241
+ ReadStream: t,
242
+ WriteStream: n
243
+ };
244
+ function t(r, i) {
245
+ if (!(this instanceof t))
246
+ return new t(r, i);
247
+ ft.call(this);
248
+ var o = this;
249
+ this.path = r, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 64 * 1024, i = i || {};
250
+ for (var c = Object.keys(i), a = 0, s = c.length; a < s; a++) {
251
+ var v = c[a];
252
+ this[v] = i[v];
253
+ }
254
+ if (this.encoding && this.setEncoding(this.encoding), this.start !== void 0) {
255
+ if (typeof this.start != "number")
256
+ throw TypeError("start must be a Number");
257
+ if (this.end === void 0)
258
+ this.end = 1 / 0;
259
+ else if (typeof this.end != "number")
260
+ throw TypeError("end must be a Number");
261
+ if (this.start > this.end)
262
+ throw new Error("start must be <= end");
263
+ this.pos = this.start;
264
+ }
265
+ if (this.fd !== null) {
266
+ process.nextTick(function() {
267
+ o._read();
268
+ });
269
+ return;
270
+ }
271
+ e.open(this.path, this.flags, this.mode, function(f, m) {
272
+ if (f) {
273
+ o.emit("error", f), o.readable = !1;
274
+ return;
275
+ }
276
+ o.fd = m, o.emit("open", m), o._read();
277
+ });
278
+ }
279
+ function n(r, i) {
280
+ if (!(this instanceof n))
281
+ return new n(r, i);
282
+ ft.call(this), this.path = r, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, i = i || {};
283
+ for (var o = Object.keys(i), c = 0, a = o.length; c < a; c++) {
284
+ var s = o[c];
285
+ this[s] = i[s];
286
+ }
287
+ if (this.start !== void 0) {
288
+ if (typeof this.start != "number")
289
+ throw TypeError("start must be a Number");
290
+ if (this.start < 0)
291
+ throw new Error("start must be >= zero");
292
+ this.pos = this.start;
293
+ }
294
+ this.busy = !1, this._queue = [], this.fd === null && (this._open = e.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush());
295
+ }
296
+ }
297
+ var xn = Mn, Rn = Object.getPrototypeOf || function(e) {
298
+ return e.__proto__;
299
+ };
300
+ function Mn(e) {
301
+ if (e === null || typeof e != "object")
302
+ return e;
303
+ if (e instanceof Object)
304
+ var t = { __proto__: Rn(e) };
305
+ else
306
+ var t = /* @__PURE__ */ Object.create(null);
307
+ return Object.getOwnPropertyNames(e).forEach(function(n) {
308
+ Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(e, n));
309
+ }), t;
310
+ }
311
+ var j = He, Wn = Ln, An = Cn, qn = xn, Pe = re, U, je;
312
+ typeof Symbol == "function" && typeof Symbol.for == "function" ? (U = Symbol.for("graceful-fs.queue"), je = Symbol.for("graceful-fs.previous")) : (U = "___graceful-fs.queue", je = "___graceful-fs.previous");
313
+ function Bn() {
314
+ }
315
+ function Ct(e, t) {
316
+ Object.defineProperty(e, U, {
317
+ get: function() {
318
+ return t;
319
+ }
320
+ });
321
+ }
322
+ var fe = Bn;
323
+ Pe.debuglog ? fe = Pe.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (fe = function() {
324
+ var e = Pe.format.apply(Pe, arguments);
325
+ e = "GFS4: " + e.split(/\n/).join(`
326
+ GFS4: `), console.error(e);
327
+ });
328
+ if (!j[U]) {
329
+ var Yn = me[U] || [];
330
+ Ct(j, Yn), j.close = function(e) {
331
+ function t(n, r) {
332
+ return e.call(j, n, function(i) {
333
+ i || st(), typeof r == "function" && r.apply(this, arguments);
334
+ });
335
+ }
336
+ return Object.defineProperty(t, je, {
337
+ value: e
338
+ }), t;
339
+ }(j.close), j.closeSync = function(e) {
340
+ function t(n) {
341
+ e.apply(j, arguments), st();
342
+ }
343
+ return Object.defineProperty(t, je, {
344
+ value: e
345
+ }), t;
346
+ }(j.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", function() {
347
+ fe(j[U]), re.equal(j[U].length, 0);
348
+ });
349
+ }
350
+ me[U] || Ct(me, j[U]);
351
+ var ee = Xe(qn(j));
352
+ process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !j.__patched && (ee = Xe(j), j.__patched = !0);
353
+ function Xe(e) {
354
+ Wn(e), e.gracefulify = Xe, e.createReadStream = w, e.createWriteStream = P;
355
+ var t = e.readFile;
356
+ e.readFile = n;
357
+ function n(p, g, O) {
358
+ return typeof g == "function" && (O = g, g = null), M(p, g, O);
359
+ function M(x, W, R, B) {
360
+ return t(x, W, function(k) {
361
+ k && (k.code === "EMFILE" || k.code === "ENFILE") ? ye([M, [x, W, R], k, B || Date.now(), Date.now()]) : typeof R == "function" && R.apply(this, arguments);
362
+ });
363
+ }
364
+ }
365
+ var r = e.writeFile;
366
+ e.writeFile = i;
367
+ function i(p, g, O, M) {
368
+ return typeof O == "function" && (M = O, O = null), x(p, g, O, M);
369
+ function x(W, R, B, k, X) {
370
+ return r(W, R, B, function(N) {
371
+ N && (N.code === "EMFILE" || N.code === "ENFILE") ? ye([x, [W, R, B, k], N, X || Date.now(), Date.now()]) : typeof k == "function" && k.apply(this, arguments);
372
+ });
373
+ }
374
+ }
375
+ var o = e.appendFile;
376
+ o && (e.appendFile = c);
377
+ function c(p, g, O, M) {
378
+ return typeof O == "function" && (M = O, O = null), x(p, g, O, M);
379
+ function x(W, R, B, k, X) {
380
+ return o(W, R, B, function(N) {
381
+ N && (N.code === "EMFILE" || N.code === "ENFILE") ? ye([x, [W, R, B, k], N, X || Date.now(), Date.now()]) : typeof k == "function" && k.apply(this, arguments);
382
+ });
383
+ }
384
+ }
385
+ var a = e.copyFile;
386
+ a && (e.copyFile = s);
387
+ function s(p, g, O, M) {
388
+ return typeof O == "function" && (M = O, O = 0), x(p, g, O, M);
389
+ function x(W, R, B, k, X) {
390
+ return a(W, R, B, function(N) {
391
+ N && (N.code === "EMFILE" || N.code === "ENFILE") ? ye([x, [W, R, B, k], N, X || Date.now(), Date.now()]) : typeof k == "function" && k.apply(this, arguments);
392
+ });
393
+ }
394
+ }
395
+ var v = e.readdir;
396
+ e.readdir = f;
397
+ function f(p, g, O) {
398
+ return typeof g == "function" && (O = g, g = null), M(p, g, O);
399
+ function M(x, W, R, B) {
400
+ return v(x, W, function(k, X) {
401
+ k && (k.code === "EMFILE" || k.code === "ENFILE") ? ye([M, [x, W, R], k, B || Date.now(), Date.now()]) : (X && X.sort && X.sort(), typeof R == "function" && R.call(this, k, X));
402
+ });
403
+ }
404
+ }
405
+ if (process.version.substr(0, 4) === "v0.8") {
406
+ var m = An(e);
407
+ u = m.ReadStream, y = m.WriteStream;
408
+ }
409
+ var h = e.ReadStream;
410
+ h && (u.prototype = Object.create(h.prototype), u.prototype.open = l);
411
+ var d = e.WriteStream;
412
+ d && (y.prototype = Object.create(d.prototype), y.prototype.open = S), Object.defineProperty(e, "ReadStream", {
413
+ get: function() {
414
+ return u;
415
+ },
416
+ set: function(p) {
417
+ u = p;
418
+ },
419
+ enumerable: !0,
420
+ configurable: !0
421
+ }), Object.defineProperty(e, "WriteStream", {
422
+ get: function() {
423
+ return y;
424
+ },
425
+ set: function(p) {
426
+ y = p;
427
+ },
428
+ enumerable: !0,
429
+ configurable: !0
430
+ });
431
+ var E = u;
432
+ Object.defineProperty(e, "FileReadStream", {
433
+ get: function() {
434
+ return E;
435
+ },
436
+ set: function(p) {
437
+ E = p;
438
+ },
439
+ enumerable: !0,
440
+ configurable: !0
441
+ });
442
+ var F = y;
443
+ Object.defineProperty(e, "FileWriteStream", {
444
+ get: function() {
445
+ return F;
446
+ },
447
+ set: function(p) {
448
+ F = p;
449
+ },
450
+ enumerable: !0,
451
+ configurable: !0
452
+ });
453
+ function u(p, g) {
454
+ return this instanceof u ? (h.apply(this, arguments), this) : u.apply(Object.create(u.prototype), arguments);
455
+ }
456
+ function l() {
457
+ var p = this;
458
+ I(p.path, p.flags, p.mode, function(g, O) {
459
+ g ? (p.autoClose && p.destroy(), p.emit("error", g)) : (p.fd = O, p.emit("open", O), p.read());
460
+ });
461
+ }
462
+ function y(p, g) {
463
+ return this instanceof y ? (d.apply(this, arguments), this) : y.apply(Object.create(y.prototype), arguments);
464
+ }
465
+ function S() {
466
+ var p = this;
467
+ I(p.path, p.flags, p.mode, function(g, O) {
468
+ g ? (p.destroy(), p.emit("error", g)) : (p.fd = O, p.emit("open", O));
469
+ });
470
+ }
471
+ function w(p, g) {
472
+ return new e.ReadStream(p, g);
473
+ }
474
+ function P(p, g) {
475
+ return new e.WriteStream(p, g);
476
+ }
477
+ var D = e.open;
478
+ e.open = I;
479
+ function I(p, g, O, M) {
480
+ return typeof O == "function" && (M = O, O = null), x(p, g, O, M);
481
+ function x(W, R, B, k, X) {
482
+ return D(W, R, B, function(N, ut) {
483
+ N && (N.code === "EMFILE" || N.code === "ENFILE") ? ye([x, [W, R, B, k], N, X || Date.now(), Date.now()]) : typeof k == "function" && k.apply(this, arguments);
484
+ });
485
+ }
486
+ }
487
+ return e;
488
+ }
489
+ function ye(e) {
490
+ fe("ENQUEUE", e[0].name, e[1]), j[U].push(e), Ze();
491
+ }
492
+ var _e;
493
+ function st() {
494
+ for (var e = Date.now(), t = 0; t < j[U].length; ++t)
495
+ j[U][t].length > 2 && (j[U][t][3] = e, j[U][t][4] = e);
496
+ Ze();
497
+ }
498
+ function Ze() {
499
+ if (clearTimeout(_e), _e = void 0, j[U].length !== 0) {
500
+ var e = j[U].shift(), t = e[0], n = e[1], r = e[2], i = e[3], o = e[4];
501
+ if (i === void 0)
502
+ fe("RETRY", t.name, n), t.apply(null, n);
503
+ else if (Date.now() - i >= 6e4) {
504
+ fe("TIMEOUT", t.name, n);
505
+ var c = n.pop();
506
+ typeof c == "function" && c.call(null, r);
507
+ } else {
508
+ var a = Date.now() - o, s = Math.max(o - i, 1), v = Math.min(s * 1.2, 100);
509
+ a >= v ? (fe("RETRY", t.name, n), t.apply(null, n.concat([i]))) : j[U].push(e);
510
+ }
511
+ _e === void 0 && (_e = setTimeout(Ze, 0));
512
+ }
513
+ }
514
+ (function(e) {
515
+ const t = H.fromCallback, n = ee, r = [
516
+ "access",
517
+ "appendFile",
518
+ "chmod",
519
+ "chown",
520
+ "close",
521
+ "copyFile",
522
+ "fchmod",
523
+ "fchown",
524
+ "fdatasync",
525
+ "fstat",
526
+ "fsync",
527
+ "ftruncate",
528
+ "futimes",
529
+ "lchmod",
530
+ "lchown",
531
+ "link",
532
+ "lstat",
533
+ "mkdir",
534
+ "mkdtemp",
535
+ "open",
536
+ "opendir",
537
+ "readdir",
538
+ "readFile",
539
+ "readlink",
540
+ "realpath",
541
+ "rename",
542
+ "rm",
543
+ "rmdir",
544
+ "stat",
545
+ "symlink",
546
+ "truncate",
547
+ "unlink",
548
+ "utimes",
549
+ "writeFile"
550
+ ].filter((i) => typeof n[i] == "function");
551
+ Object.assign(e, n), r.forEach((i) => {
552
+ e[i] = t(n[i]);
553
+ }), e.exists = function(i, o) {
554
+ return typeof o == "function" ? n.exists(i, o) : new Promise((c) => n.exists(i, c));
555
+ }, e.read = function(i, o, c, a, s, v) {
556
+ return typeof v == "function" ? n.read(i, o, c, a, s, v) : new Promise((f, m) => {
557
+ n.read(i, o, c, a, s, (h, d, E) => {
558
+ if (h)
559
+ return m(h);
560
+ f({ bytesRead: d, buffer: E });
561
+ });
562
+ });
563
+ }, e.write = function(i, o, ...c) {
564
+ return typeof c[c.length - 1] == "function" ? n.write(i, o, ...c) : new Promise((a, s) => {
565
+ n.write(i, o, ...c, (v, f, m) => {
566
+ if (v)
567
+ return s(v);
568
+ a({ bytesWritten: f, buffer: m });
569
+ });
570
+ });
571
+ }, typeof n.writev == "function" && (e.writev = function(i, o, ...c) {
572
+ return typeof c[c.length - 1] == "function" ? n.writev(i, o, ...c) : new Promise((a, s) => {
573
+ n.writev(i, o, ...c, (v, f, m) => {
574
+ if (v)
575
+ return s(v);
576
+ a({ bytesWritten: f, buffers: m });
577
+ });
578
+ });
579
+ }), typeof n.realpath.native == "function" ? e.realpath.native = t(n.realpath.native) : process.emitWarning(
580
+ "fs.realpath.native is not a function. Is fs being monkey-patched?",
581
+ "Warning",
582
+ "fs-extra-WARN0003"
583
+ );
584
+ })(se);
585
+ var et = {}, jt = {};
586
+ const Jn = V;
587
+ jt.checkPath = function(t) {
588
+ if (process.platform === "win32" && /[<>:"|?*]/.test(t.replace(Jn.parse(t).root, ""))) {
589
+ const r = new Error(`Path contains invalid characters: ${t}`);
590
+ throw r.code = "EINVAL", r;
591
+ }
592
+ };
593
+ const xt = se, { checkPath: Rt } = jt, Mt = (e) => {
594
+ const t = { mode: 511 };
595
+ return typeof e == "number" ? e : { ...t, ...e }.mode;
596
+ };
597
+ et.makeDir = async (e, t) => (Rt(e), xt.mkdir(e, {
598
+ mode: Mt(t),
599
+ recursive: !0
600
+ }));
601
+ et.makeDirSync = (e, t) => (Rt(e), xt.mkdirSync(e, {
602
+ mode: Mt(t),
603
+ recursive: !0
604
+ }));
605
+ const bn = H.fromPromise, { makeDir: Gn, makeDirSync: Ye } = et, Je = bn(Gn);
606
+ var ie = {
607
+ mkdirs: Je,
608
+ mkdirsSync: Ye,
609
+ mkdirp: Je,
610
+ mkdirpSync: Ye,
611
+ ensureDir: Je,
612
+ ensureDirSync: Ye
613
+ };
614
+ const Un = H.fromPromise, Wt = se;
615
+ function Kn(e) {
616
+ return Wt.access(e).then(() => !0).catch(() => !1);
617
+ }
618
+ var le = {
619
+ pathExists: Un(Kn),
620
+ pathExistsSync: Wt.existsSync
621
+ };
622
+ const de = ee;
623
+ function Qn(e, t, n, r) {
624
+ de.open(e, "r+", (i, o) => {
625
+ if (i)
626
+ return r(i);
627
+ de.futimes(o, t, n, (c) => {
628
+ de.close(o, (a) => {
629
+ r && r(c || a);
630
+ });
631
+ });
632
+ });
633
+ }
634
+ function Vn(e, t, n) {
635
+ const r = de.openSync(e, "r+");
636
+ return de.futimesSync(r, t, n), de.closeSync(r);
637
+ }
638
+ var At = {
639
+ utimesMillis: Qn,
640
+ utimesMillisSync: Vn
641
+ };
642
+ const he = se, Y = V, zn = re;
643
+ function Hn(e, t, n) {
644
+ const r = n.dereference ? (i) => he.stat(i, { bigint: !0 }) : (i) => he.lstat(i, { bigint: !0 });
645
+ return Promise.all([
646
+ r(e),
647
+ r(t).catch((i) => {
648
+ if (i.code === "ENOENT")
649
+ return null;
650
+ throw i;
651
+ })
652
+ ]).then(([i, o]) => ({ srcStat: i, destStat: o }));
653
+ }
654
+ function Xn(e, t, n) {
655
+ let r;
656
+ const i = n.dereference ? (c) => he.statSync(c, { bigint: !0 }) : (c) => he.lstatSync(c, { bigint: !0 }), o = i(e);
657
+ try {
658
+ r = i(t);
659
+ } catch (c) {
660
+ if (c.code === "ENOENT")
661
+ return { srcStat: o, destStat: null };
662
+ throw c;
663
+ }
664
+ return { srcStat: o, destStat: r };
665
+ }
666
+ function Zn(e, t, n, r, i) {
667
+ zn.callbackify(Hn)(e, t, r, (o, c) => {
668
+ if (o)
669
+ return i(o);
670
+ const { srcStat: a, destStat: s } = c;
671
+ if (s) {
672
+ if (ke(a, s)) {
673
+ const v = Y.basename(e), f = Y.basename(t);
674
+ return n === "move" && v !== f && v.toLowerCase() === f.toLowerCase() ? i(null, { srcStat: a, destStat: s, isChangingCase: !0 }) : i(new Error("Source and destination must not be the same."));
675
+ }
676
+ if (a.isDirectory() && !s.isDirectory())
677
+ return i(new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`));
678
+ if (!a.isDirectory() && s.isDirectory())
679
+ return i(new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`));
680
+ }
681
+ return a.isDirectory() && tt(e, t) ? i(new Error(Me(e, t, n))) : i(null, { srcStat: a, destStat: s });
682
+ });
683
+ }
684
+ function er(e, t, n, r) {
685
+ const { srcStat: i, destStat: o } = Xn(e, t, r);
686
+ if (o) {
687
+ if (ke(i, o)) {
688
+ const c = Y.basename(e), a = Y.basename(t);
689
+ if (n === "move" && c !== a && c.toLowerCase() === a.toLowerCase())
690
+ return { srcStat: i, destStat: o, isChangingCase: !0 };
691
+ throw new Error("Source and destination must not be the same.");
692
+ }
693
+ if (i.isDirectory() && !o.isDirectory())
694
+ throw new Error(`Cannot overwrite non-directory '${t}' with directory '${e}'.`);
695
+ if (!i.isDirectory() && o.isDirectory())
696
+ throw new Error(`Cannot overwrite directory '${t}' with non-directory '${e}'.`);
697
+ }
698
+ if (i.isDirectory() && tt(e, t))
699
+ throw new Error(Me(e, t, n));
700
+ return { srcStat: i, destStat: o };
701
+ }
702
+ function qt(e, t, n, r, i) {
703
+ const o = Y.resolve(Y.dirname(e)), c = Y.resolve(Y.dirname(n));
704
+ if (c === o || c === Y.parse(c).root)
705
+ return i();
706
+ he.stat(c, { bigint: !0 }, (a, s) => a ? a.code === "ENOENT" ? i() : i(a) : ke(t, s) ? i(new Error(Me(e, n, r))) : qt(e, t, c, r, i));
707
+ }
708
+ function Bt(e, t, n, r) {
709
+ const i = Y.resolve(Y.dirname(e)), o = Y.resolve(Y.dirname(n));
710
+ if (o === i || o === Y.parse(o).root)
711
+ return;
712
+ let c;
713
+ try {
714
+ c = he.statSync(o, { bigint: !0 });
715
+ } catch (a) {
716
+ if (a.code === "ENOENT")
717
+ return;
718
+ throw a;
719
+ }
720
+ if (ke(t, c))
721
+ throw new Error(Me(e, n, r));
722
+ return Bt(e, t, o, r);
723
+ }
724
+ function ke(e, t) {
725
+ return t.ino && t.dev && t.ino === e.ino && t.dev === e.dev;
726
+ }
727
+ function tt(e, t) {
728
+ const n = Y.resolve(e).split(Y.sep).filter((i) => i), r = Y.resolve(t).split(Y.sep).filter((i) => i);
729
+ return n.reduce((i, o, c) => i && r[c] === o, !0);
730
+ }
731
+ function Me(e, t, n) {
732
+ return `Cannot ${n} '${e}' to a subdirectory of itself, '${t}'.`;
733
+ }
734
+ var pe = {
735
+ checkPaths: Zn,
736
+ checkPathsSync: er,
737
+ checkParentPaths: qt,
738
+ checkParentPathsSync: Bt,
739
+ isSrcSubdir: tt,
740
+ areIdentical: ke
741
+ };
742
+ const Z = ee, Ee = V, tr = ie.mkdirs, nr = le.pathExists, rr = At.utimesMillis, $e = pe;
743
+ function ir(e, t, n, r) {
744
+ typeof n == "function" && !r ? (r = n, n = {}) : typeof n == "function" && (n = { filter: n }), r = r || function() {
745
+ }, n = n || {}, n.clobber = "clobber" in n ? !!n.clobber : !0, n.overwrite = "overwrite" in n ? !!n.overwrite : n.clobber, n.preserveTimestamps && process.arch === "ia32" && process.emitWarning(
746
+ `Using the preserveTimestamps option in 32-bit node is not recommended;
747
+
748
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,
749
+ "Warning",
750
+ "fs-extra-WARN0001"
751
+ ), $e.checkPaths(e, t, "copy", n, (i, o) => {
752
+ if (i)
753
+ return r(i);
754
+ const { srcStat: c, destStat: a } = o;
755
+ $e.checkParentPaths(e, c, t, "copy", (s) => s ? r(s) : n.filter ? Yt(lt, a, e, t, n, r) : lt(a, e, t, n, r));
756
+ });
757
+ }
758
+ function lt(e, t, n, r, i) {
759
+ const o = Ee.dirname(n);
760
+ nr(o, (c, a) => {
761
+ if (c)
762
+ return i(c);
763
+ if (a)
764
+ return xe(e, t, n, r, i);
765
+ tr(o, (s) => s ? i(s) : xe(e, t, n, r, i));
766
+ });
767
+ }
768
+ function Yt(e, t, n, r, i, o) {
769
+ Promise.resolve(i.filter(n, r)).then((c) => c ? e(t, n, r, i, o) : o(), (c) => o(c));
770
+ }
771
+ function or(e, t, n, r, i) {
772
+ return r.filter ? Yt(xe, e, t, n, r, i) : xe(e, t, n, r, i);
773
+ }
774
+ function xe(e, t, n, r, i) {
775
+ (r.dereference ? Z.stat : Z.lstat)(t, (c, a) => c ? i(c) : a.isDirectory() ? yr(a, e, t, n, r, i) : a.isFile() || a.isCharacterDevice() || a.isBlockDevice() ? cr(a, e, t, n, r, i) : a.isSymbolicLink() ? hr(e, t, n, r, i) : a.isSocket() ? i(new Error(`Cannot copy a socket file: ${t}`)) : a.isFIFO() ? i(new Error(`Cannot copy a FIFO pipe: ${t}`)) : i(new Error(`Unknown file: ${t}`)));
776
+ }
777
+ function cr(e, t, n, r, i, o) {
778
+ return t ? ur(e, n, r, i, o) : Jt(e, n, r, i, o);
779
+ }
780
+ function ur(e, t, n, r, i) {
781
+ if (r.overwrite)
782
+ Z.unlink(n, (o) => o ? i(o) : Jt(e, t, n, r, i));
783
+ else
784
+ return r.errorOnExist ? i(new Error(`'${n}' already exists`)) : i();
785
+ }
786
+ function Jt(e, t, n, r, i) {
787
+ Z.copyFile(t, n, (o) => o ? i(o) : r.preserveTimestamps ? ar(e.mode, t, n, i) : We(n, e.mode, i));
788
+ }
789
+ function ar(e, t, n, r) {
790
+ return fr(e) ? sr(n, e, (i) => i ? r(i) : yt(e, t, n, r)) : yt(e, t, n, r);
791
+ }
792
+ function fr(e) {
793
+ return (e & 128) === 0;
794
+ }
795
+ function sr(e, t, n) {
796
+ return We(e, t | 128, n);
797
+ }
798
+ function yt(e, t, n, r) {
799
+ lr(t, n, (i) => i ? r(i) : We(n, e, r));
800
+ }
801
+ function We(e, t, n) {
802
+ return Z.chmod(e, t, n);
803
+ }
804
+ function lr(e, t, n) {
805
+ Z.stat(e, (r, i) => r ? n(r) : rr(t, i.atime, i.mtime, n));
806
+ }
807
+ function yr(e, t, n, r, i, o) {
808
+ return t ? bt(n, r, i, o) : mr(e.mode, n, r, i, o);
809
+ }
810
+ function mr(e, t, n, r, i) {
811
+ Z.mkdir(n, (o) => {
812
+ if (o)
813
+ return i(o);
814
+ bt(t, n, r, (c) => c ? i(c) : We(n, e, i));
815
+ });
816
+ }
817
+ function bt(e, t, n, r) {
818
+ Z.readdir(e, (i, o) => i ? r(i) : Gt(o, e, t, n, r));
819
+ }
820
+ function Gt(e, t, n, r, i) {
821
+ const o = e.pop();
822
+ return o ? dr(e, o, t, n, r, i) : i();
823
+ }
824
+ function dr(e, t, n, r, i, o) {
825
+ const c = Ee.join(n, t), a = Ee.join(r, t);
826
+ $e.checkPaths(c, a, "copy", i, (s, v) => {
827
+ if (s)
828
+ return o(s);
829
+ const { destStat: f } = v;
830
+ or(f, c, a, i, (m) => m ? o(m) : Gt(e, n, r, i, o));
831
+ });
832
+ }
833
+ function hr(e, t, n, r, i) {
834
+ Z.readlink(t, (o, c) => {
835
+ if (o)
836
+ return i(o);
837
+ if (r.dereference && (c = Ee.resolve(process.cwd(), c)), e)
838
+ Z.readlink(n, (a, s) => a ? a.code === "EINVAL" || a.code === "UNKNOWN" ? Z.symlink(c, n, i) : i(a) : (r.dereference && (s = Ee.resolve(process.cwd(), s)), $e.isSrcSubdir(c, s) ? i(new Error(`Cannot copy '${c}' to a subdirectory of itself, '${s}'.`)) : e.isDirectory() && $e.isSrcSubdir(s, c) ? i(new Error(`Cannot overwrite '${s}' with '${c}'.`)) : Sr(c, n, i)));
839
+ else
840
+ return Z.symlink(c, n, i);
841
+ });
842
+ }
843
+ function Sr(e, t, n) {
844
+ Z.unlink(t, (r) => r ? n(r) : Z.symlink(e, t, n));
845
+ }
846
+ var pr = ir;
847
+ const K = ee, ge = V, vr = ie.mkdirsSync, wr = At.utimesMillisSync, Fe = pe;
848
+ function Er(e, t, n) {
849
+ typeof n == "function" && (n = { filter: n }), n = n || {}, n.clobber = "clobber" in n ? !!n.clobber : !0, n.overwrite = "overwrite" in n ? !!n.overwrite : n.clobber, n.preserveTimestamps && process.arch === "ia32" && process.emitWarning(
850
+ `Using the preserveTimestamps option in 32-bit node is not recommended;
851
+
852
+ see https://github.com/jprichardson/node-fs-extra/issues/269`,
853
+ "Warning",
854
+ "fs-extra-WARN0002"
855
+ );
856
+ const { srcStat: r, destStat: i } = Fe.checkPathsSync(e, t, "copy", n);
857
+ return Fe.checkParentPathsSync(e, r, t, "copy"), $r(i, e, t, n);
858
+ }
859
+ function $r(e, t, n, r) {
860
+ if (r.filter && !r.filter(t, n))
861
+ return;
862
+ const i = ge.dirname(n);
863
+ return K.existsSync(i) || vr(i), Ut(e, t, n, r);
864
+ }
865
+ function gr(e, t, n, r) {
866
+ if (!(r.filter && !r.filter(t, n)))
867
+ return Ut(e, t, n, r);
868
+ }
869
+ function Ut(e, t, n, r) {
870
+ const o = (r.dereference ? K.statSync : K.lstatSync)(t);
871
+ if (o.isDirectory())
872
+ return Nr(o, e, t, n, r);
873
+ if (o.isFile() || o.isCharacterDevice() || o.isBlockDevice())
874
+ return Fr(o, e, t, n, r);
875
+ if (o.isSymbolicLink())
876
+ return Ir(e, t, n, r);
877
+ throw o.isSocket() ? new Error(`Cannot copy a socket file: ${t}`) : o.isFIFO() ? new Error(`Cannot copy a FIFO pipe: ${t}`) : new Error(`Unknown file: ${t}`);
878
+ }
879
+ function Fr(e, t, n, r, i) {
880
+ return t ? Or(e, n, r, i) : Kt(e, n, r, i);
881
+ }
882
+ function Or(e, t, n, r) {
883
+ if (r.overwrite)
884
+ return K.unlinkSync(n), Kt(e, t, n, r);
885
+ if (r.errorOnExist)
886
+ throw new Error(`'${n}' already exists`);
887
+ }
888
+ function Kt(e, t, n, r) {
889
+ return K.copyFileSync(t, n), r.preserveTimestamps && kr(e.mode, t, n), nt(n, e.mode);
890
+ }
891
+ function kr(e, t, n) {
892
+ return Pr(e) && _r(n, e), Dr(t, n);
893
+ }
894
+ function Pr(e) {
895
+ return (e & 128) === 0;
896
+ }
897
+ function _r(e, t) {
898
+ return nt(e, t | 128);
899
+ }
900
+ function nt(e, t) {
901
+ return K.chmodSync(e, t);
902
+ }
903
+ function Dr(e, t) {
904
+ const n = K.statSync(e);
905
+ return wr(t, n.atime, n.mtime);
906
+ }
907
+ function Nr(e, t, n, r, i) {
908
+ return t ? Qt(n, r, i) : Tr(e.mode, n, r, i);
909
+ }
910
+ function Tr(e, t, n, r) {
911
+ return K.mkdirSync(n), Qt(t, n, r), nt(n, e);
912
+ }
913
+ function Qt(e, t, n) {
914
+ K.readdirSync(e).forEach((r) => Lr(r, e, t, n));
915
+ }
916
+ function Lr(e, t, n, r) {
917
+ const i = ge.join(t, e), o = ge.join(n, e), { destStat: c } = Fe.checkPathsSync(i, o, "copy", r);
918
+ return gr(c, i, o, r);
919
+ }
920
+ function Ir(e, t, n, r) {
921
+ let i = K.readlinkSync(t);
922
+ if (r.dereference && (i = ge.resolve(process.cwd(), i)), e) {
923
+ let o;
924
+ try {
925
+ o = K.readlinkSync(n);
926
+ } catch (c) {
927
+ if (c.code === "EINVAL" || c.code === "UNKNOWN")
928
+ return K.symlinkSync(i, n);
929
+ throw c;
930
+ }
931
+ if (r.dereference && (o = ge.resolve(process.cwd(), o)), Fe.isSrcSubdir(i, o))
932
+ throw new Error(`Cannot copy '${i}' to a subdirectory of itself, '${o}'.`);
933
+ if (K.statSync(n).isDirectory() && Fe.isSrcSubdir(o, i))
934
+ throw new Error(`Cannot overwrite '${o}' with '${i}'.`);
935
+ return Cr(i, n);
936
+ } else
937
+ return K.symlinkSync(i, n);
938
+ }
939
+ function Cr(e, t) {
940
+ return K.unlinkSync(t), K.symlinkSync(e, t);
941
+ }
942
+ var jr = Er;
943
+ const xr = H.fromCallback;
944
+ var rt = {
945
+ copy: xr(pr),
946
+ copySync: jr
947
+ };
948
+ const mt = ee, Vt = V, L = re, Oe = process.platform === "win32";
949
+ function zt(e) {
950
+ [
951
+ "unlink",
952
+ "chmod",
953
+ "stat",
954
+ "lstat",
955
+ "rmdir",
956
+ "readdir"
957
+ ].forEach((n) => {
958
+ e[n] = e[n] || mt[n], n = n + "Sync", e[n] = e[n] || mt[n];
959
+ }), e.maxBusyTries = e.maxBusyTries || 3;
960
+ }
961
+ function it(e, t, n) {
962
+ let r = 0;
963
+ typeof t == "function" && (n = t, t = {}), L(e, "rimraf: missing path"), L.strictEqual(typeof e, "string", "rimraf: path should be a string"), L.strictEqual(typeof n, "function", "rimraf: callback function required"), L(t, "rimraf: invalid options argument provided"), L.strictEqual(typeof t, "object", "rimraf: options should be object"), zt(t), dt(e, t, function i(o) {
964
+ if (o) {
965
+ if ((o.code === "EBUSY" || o.code === "ENOTEMPTY" || o.code === "EPERM") && r < t.maxBusyTries) {
966
+ r++;
967
+ const c = r * 100;
968
+ return setTimeout(() => dt(e, t, i), c);
969
+ }
970
+ o.code === "ENOENT" && (o = null);
971
+ }
972
+ n(o);
973
+ });
974
+ }
975
+ function dt(e, t, n) {
976
+ L(e), L(t), L(typeof n == "function"), t.lstat(e, (r, i) => {
977
+ if (r && r.code === "ENOENT")
978
+ return n(null);
979
+ if (r && r.code === "EPERM" && Oe)
980
+ return ht(e, t, r, n);
981
+ if (i && i.isDirectory())
982
+ return Ie(e, t, r, n);
983
+ t.unlink(e, (o) => {
984
+ if (o) {
985
+ if (o.code === "ENOENT")
986
+ return n(null);
987
+ if (o.code === "EPERM")
988
+ return Oe ? ht(e, t, o, n) : Ie(e, t, o, n);
989
+ if (o.code === "EISDIR")
990
+ return Ie(e, t, o, n);
991
+ }
992
+ return n(o);
993
+ });
994
+ });
995
+ }
996
+ function ht(e, t, n, r) {
997
+ L(e), L(t), L(typeof r == "function"), t.chmod(e, 438, (i) => {
998
+ i ? r(i.code === "ENOENT" ? null : n) : t.stat(e, (o, c) => {
999
+ o ? r(o.code === "ENOENT" ? null : n) : c.isDirectory() ? Ie(e, t, n, r) : t.unlink(e, r);
1000
+ });
1001
+ });
1002
+ }
1003
+ function St(e, t, n) {
1004
+ let r;
1005
+ L(e), L(t);
1006
+ try {
1007
+ t.chmodSync(e, 438);
1008
+ } catch (i) {
1009
+ if (i.code === "ENOENT")
1010
+ return;
1011
+ throw n;
1012
+ }
1013
+ try {
1014
+ r = t.statSync(e);
1015
+ } catch (i) {
1016
+ if (i.code === "ENOENT")
1017
+ return;
1018
+ throw n;
1019
+ }
1020
+ r.isDirectory() ? Ce(e, t, n) : t.unlinkSync(e);
1021
+ }
1022
+ function Ie(e, t, n, r) {
1023
+ L(e), L(t), L(typeof r == "function"), t.rmdir(e, (i) => {
1024
+ i && (i.code === "ENOTEMPTY" || i.code === "EEXIST" || i.code === "EPERM") ? Rr(e, t, r) : i && i.code === "ENOTDIR" ? r(n) : r(i);
1025
+ });
1026
+ }
1027
+ function Rr(e, t, n) {
1028
+ L(e), L(t), L(typeof n == "function"), t.readdir(e, (r, i) => {
1029
+ if (r)
1030
+ return n(r);
1031
+ let o = i.length, c;
1032
+ if (o === 0)
1033
+ return t.rmdir(e, n);
1034
+ i.forEach((a) => {
1035
+ it(Vt.join(e, a), t, (s) => {
1036
+ if (!c) {
1037
+ if (s)
1038
+ return n(c = s);
1039
+ --o === 0 && t.rmdir(e, n);
1040
+ }
1041
+ });
1042
+ });
1043
+ });
1044
+ }
1045
+ function Ht(e, t) {
1046
+ let n;
1047
+ t = t || {}, zt(t), L(e, "rimraf: missing path"), L.strictEqual(typeof e, "string", "rimraf: path should be a string"), L(t, "rimraf: missing options"), L.strictEqual(typeof t, "object", "rimraf: options should be object");
1048
+ try {
1049
+ n = t.lstatSync(e);
1050
+ } catch (r) {
1051
+ if (r.code === "ENOENT")
1052
+ return;
1053
+ r.code === "EPERM" && Oe && St(e, t, r);
1054
+ }
1055
+ try {
1056
+ n && n.isDirectory() ? Ce(e, t, null) : t.unlinkSync(e);
1057
+ } catch (r) {
1058
+ if (r.code === "ENOENT")
1059
+ return;
1060
+ if (r.code === "EPERM")
1061
+ return Oe ? St(e, t, r) : Ce(e, t, r);
1062
+ if (r.code !== "EISDIR")
1063
+ throw r;
1064
+ Ce(e, t, r);
1065
+ }
1066
+ }
1067
+ function Ce(e, t, n) {
1068
+ L(e), L(t);
1069
+ try {
1070
+ t.rmdirSync(e);
1071
+ } catch (r) {
1072
+ if (r.code === "ENOTDIR")
1073
+ throw n;
1074
+ if (r.code === "ENOTEMPTY" || r.code === "EEXIST" || r.code === "EPERM")
1075
+ Mr(e, t);
1076
+ else if (r.code !== "ENOENT")
1077
+ throw r;
1078
+ }
1079
+ }
1080
+ function Mr(e, t) {
1081
+ if (L(e), L(t), t.readdirSync(e).forEach((n) => Ht(Vt.join(e, n), t)), Oe) {
1082
+ const n = Date.now();
1083
+ do
1084
+ try {
1085
+ return t.rmdirSync(e, t);
1086
+ } catch {
1087
+ }
1088
+ while (Date.now() - n < 500);
1089
+ } else
1090
+ return t.rmdirSync(e, t);
1091
+ }
1092
+ var Wr = it;
1093
+ it.sync = Ht;
1094
+ const Re = ee, Ar = H.fromCallback, Xt = Wr;
1095
+ function qr(e, t) {
1096
+ if (Re.rm)
1097
+ return Re.rm(e, { recursive: !0, force: !0 }, t);
1098
+ Xt(e, t);
1099
+ }
1100
+ function Br(e) {
1101
+ if (Re.rmSync)
1102
+ return Re.rmSync(e, { recursive: !0, force: !0 });
1103
+ Xt.sync(e);
1104
+ }
1105
+ var Ae = {
1106
+ remove: Ar(qr),
1107
+ removeSync: Br
1108
+ };
1109
+ const Yr = H.fromPromise, Zt = se, en = V, tn = ie, nn = Ae, pt = Yr(async function(t) {
1110
+ let n;
1111
+ try {
1112
+ n = await Zt.readdir(t);
1113
+ } catch {
1114
+ return tn.mkdirs(t);
1115
+ }
1116
+ return Promise.all(n.map((r) => nn.remove(en.join(t, r))));
1117
+ });
1118
+ function vt(e) {
1119
+ let t;
1120
+ try {
1121
+ t = Zt.readdirSync(e);
1122
+ } catch {
1123
+ return tn.mkdirsSync(e);
1124
+ }
1125
+ t.forEach((n) => {
1126
+ n = en.join(e, n), nn.removeSync(n);
1127
+ });
1128
+ }
1129
+ var Jr = {
1130
+ emptyDirSync: vt,
1131
+ emptydirSync: vt,
1132
+ emptyDir: pt,
1133
+ emptydir: pt
1134
+ };
1135
+ const br = H.fromCallback, rn = V, ue = ee, on = ie;
1136
+ function Gr(e, t) {
1137
+ function n() {
1138
+ ue.writeFile(e, "", (r) => {
1139
+ if (r)
1140
+ return t(r);
1141
+ t();
1142
+ });
1143
+ }
1144
+ ue.stat(e, (r, i) => {
1145
+ if (!r && i.isFile())
1146
+ return t();
1147
+ const o = rn.dirname(e);
1148
+ ue.stat(o, (c, a) => {
1149
+ if (c)
1150
+ return c.code === "ENOENT" ? on.mkdirs(o, (s) => {
1151
+ if (s)
1152
+ return t(s);
1153
+ n();
1154
+ }) : t(c);
1155
+ a.isDirectory() ? n() : ue.readdir(o, (s) => {
1156
+ if (s)
1157
+ return t(s);
1158
+ });
1159
+ });
1160
+ });
1161
+ }
1162
+ function Ur(e) {
1163
+ let t;
1164
+ try {
1165
+ t = ue.statSync(e);
1166
+ } catch {
1167
+ }
1168
+ if (t && t.isFile())
1169
+ return;
1170
+ const n = rn.dirname(e);
1171
+ try {
1172
+ ue.statSync(n).isDirectory() || ue.readdirSync(n);
1173
+ } catch (r) {
1174
+ if (r && r.code === "ENOENT")
1175
+ on.mkdirsSync(n);
1176
+ else
1177
+ throw r;
1178
+ }
1179
+ ue.writeFileSync(e, "");
1180
+ }
1181
+ var Kr = {
1182
+ createFile: br(Gr),
1183
+ createFileSync: Ur
1184
+ };
1185
+ const Qr = H.fromCallback, cn = V, ce = ee, un = ie, Vr = le.pathExists, { areIdentical: an } = pe;
1186
+ function zr(e, t, n) {
1187
+ function r(i, o) {
1188
+ ce.link(i, o, (c) => {
1189
+ if (c)
1190
+ return n(c);
1191
+ n(null);
1192
+ });
1193
+ }
1194
+ ce.lstat(t, (i, o) => {
1195
+ ce.lstat(e, (c, a) => {
1196
+ if (c)
1197
+ return c.message = c.message.replace("lstat", "ensureLink"), n(c);
1198
+ if (o && an(a, o))
1199
+ return n(null);
1200
+ const s = cn.dirname(t);
1201
+ Vr(s, (v, f) => {
1202
+ if (v)
1203
+ return n(v);
1204
+ if (f)
1205
+ return r(e, t);
1206
+ un.mkdirs(s, (m) => {
1207
+ if (m)
1208
+ return n(m);
1209
+ r(e, t);
1210
+ });
1211
+ });
1212
+ });
1213
+ });
1214
+ }
1215
+ function Hr(e, t) {
1216
+ let n;
1217
+ try {
1218
+ n = ce.lstatSync(t);
1219
+ } catch {
1220
+ }
1221
+ try {
1222
+ const o = ce.lstatSync(e);
1223
+ if (n && an(o, n))
1224
+ return;
1225
+ } catch (o) {
1226
+ throw o.message = o.message.replace("lstat", "ensureLink"), o;
1227
+ }
1228
+ const r = cn.dirname(t);
1229
+ return ce.existsSync(r) || un.mkdirsSync(r), ce.linkSync(e, t);
1230
+ }
1231
+ var Xr = {
1232
+ createLink: Qr(zr),
1233
+ createLinkSync: Hr
1234
+ };
1235
+ const ae = V, ve = ee, Zr = le.pathExists;
1236
+ function ei(e, t, n) {
1237
+ if (ae.isAbsolute(e))
1238
+ return ve.lstat(e, (r) => r ? (r.message = r.message.replace("lstat", "ensureSymlink"), n(r)) : n(null, {
1239
+ toCwd: e,
1240
+ toDst: e
1241
+ }));
1242
+ {
1243
+ const r = ae.dirname(t), i = ae.join(r, e);
1244
+ return Zr(i, (o, c) => o ? n(o) : c ? n(null, {
1245
+ toCwd: i,
1246
+ toDst: e
1247
+ }) : ve.lstat(e, (a) => a ? (a.message = a.message.replace("lstat", "ensureSymlink"), n(a)) : n(null, {
1248
+ toCwd: e,
1249
+ toDst: ae.relative(r, e)
1250
+ })));
1251
+ }
1252
+ }
1253
+ function ti(e, t) {
1254
+ let n;
1255
+ if (ae.isAbsolute(e)) {
1256
+ if (n = ve.existsSync(e), !n)
1257
+ throw new Error("absolute srcpath does not exist");
1258
+ return {
1259
+ toCwd: e,
1260
+ toDst: e
1261
+ };
1262
+ } else {
1263
+ const r = ae.dirname(t), i = ae.join(r, e);
1264
+ if (n = ve.existsSync(i), n)
1265
+ return {
1266
+ toCwd: i,
1267
+ toDst: e
1268
+ };
1269
+ if (n = ve.existsSync(e), !n)
1270
+ throw new Error("relative srcpath does not exist");
1271
+ return {
1272
+ toCwd: e,
1273
+ toDst: ae.relative(r, e)
1274
+ };
1275
+ }
1276
+ }
1277
+ var ni = {
1278
+ symlinkPaths: ei,
1279
+ symlinkPathsSync: ti
1280
+ };
1281
+ const fn = ee;
1282
+ function ri(e, t, n) {
1283
+ if (n = typeof t == "function" ? t : n, t = typeof t == "function" ? !1 : t, t)
1284
+ return n(null, t);
1285
+ fn.lstat(e, (r, i) => {
1286
+ if (r)
1287
+ return n(null, "file");
1288
+ t = i && i.isDirectory() ? "dir" : "file", n(null, t);
1289
+ });
1290
+ }
1291
+ function ii(e, t) {
1292
+ let n;
1293
+ if (t)
1294
+ return t;
1295
+ try {
1296
+ n = fn.lstatSync(e);
1297
+ } catch {
1298
+ return "file";
1299
+ }
1300
+ return n && n.isDirectory() ? "dir" : "file";
1301
+ }
1302
+ var oi = {
1303
+ symlinkType: ri,
1304
+ symlinkTypeSync: ii
1305
+ };
1306
+ const ci = H.fromCallback, sn = V, ne = se, ln = ie, ui = ln.mkdirs, ai = ln.mkdirsSync, yn = ni, fi = yn.symlinkPaths, si = yn.symlinkPathsSync, mn = oi, li = mn.symlinkType, yi = mn.symlinkTypeSync, mi = le.pathExists, { areIdentical: dn } = pe;
1307
+ function di(e, t, n, r) {
1308
+ r = typeof n == "function" ? n : r, n = typeof n == "function" ? !1 : n, ne.lstat(t, (i, o) => {
1309
+ !i && o.isSymbolicLink() ? Promise.all([
1310
+ ne.stat(e),
1311
+ ne.stat(t)
1312
+ ]).then(([c, a]) => {
1313
+ if (dn(c, a))
1314
+ return r(null);
1315
+ wt(e, t, n, r);
1316
+ }) : wt(e, t, n, r);
1317
+ });
1318
+ }
1319
+ function wt(e, t, n, r) {
1320
+ fi(e, t, (i, o) => {
1321
+ if (i)
1322
+ return r(i);
1323
+ e = o.toDst, li(o.toCwd, n, (c, a) => {
1324
+ if (c)
1325
+ return r(c);
1326
+ const s = sn.dirname(t);
1327
+ mi(s, (v, f) => {
1328
+ if (v)
1329
+ return r(v);
1330
+ if (f)
1331
+ return ne.symlink(e, t, a, r);
1332
+ ui(s, (m) => {
1333
+ if (m)
1334
+ return r(m);
1335
+ ne.symlink(e, t, a, r);
1336
+ });
1337
+ });
1338
+ });
1339
+ });
1340
+ }
1341
+ function hi(e, t, n) {
1342
+ let r;
1343
+ try {
1344
+ r = ne.lstatSync(t);
1345
+ } catch {
1346
+ }
1347
+ if (r && r.isSymbolicLink()) {
1348
+ const a = ne.statSync(e), s = ne.statSync(t);
1349
+ if (dn(a, s))
1350
+ return;
1351
+ }
1352
+ const i = si(e, t);
1353
+ e = i.toDst, n = yi(i.toCwd, n);
1354
+ const o = sn.dirname(t);
1355
+ return ne.existsSync(o) || ai(o), ne.symlinkSync(e, t, n);
1356
+ }
1357
+ var Si = {
1358
+ createSymlink: ci(di),
1359
+ createSymlinkSync: hi
1360
+ };
1361
+ const { createFile: Et, createFileSync: $t } = Kr, { createLink: gt, createLinkSync: Ft } = Xr, { createSymlink: Ot, createSymlinkSync: kt } = Si;
1362
+ var pi = {
1363
+ createFile: Et,
1364
+ createFileSync: $t,
1365
+ ensureFile: Et,
1366
+ ensureFileSync: $t,
1367
+ createLink: gt,
1368
+ createLinkSync: Ft,
1369
+ ensureLink: gt,
1370
+ ensureLinkSync: Ft,
1371
+ createSymlink: Ot,
1372
+ createSymlinkSync: kt,
1373
+ ensureSymlink: Ot,
1374
+ ensureSymlinkSync: kt
1375
+ }, be, Pt;
1376
+ function vi() {
1377
+ if (Pt)
1378
+ return be;
1379
+ Pt = 1;
1380
+ var e = re, t = process.cwd, n = null, r = process.env.GRACEFUL_FS_PLATFORM || process.platform;
1381
+ process.cwd = function() {
1382
+ return n || (n = t.call(process)), n;
1383
+ };
1384
+ try {
1385
+ process.cwd();
1386
+ } catch {
1387
+ }
1388
+ if (typeof process.chdir == "function") {
1389
+ var i = process.chdir;
1390
+ process.chdir = function(c) {
1391
+ n = null, i.call(process, c);
1392
+ }, Object.setPrototypeOf && Object.setPrototypeOf(process.chdir, i);
1393
+ }
1394
+ be = o;
1395
+ function o(c) {
1396
+ e.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./) && a(c), c.lutimes || s(c), c.chown = m(c.chown), c.fchown = m(c.fchown), c.lchown = m(c.lchown), c.chmod = v(c.chmod), c.fchmod = v(c.fchmod), c.lchmod = v(c.lchmod), c.chownSync = h(c.chownSync), c.fchownSync = h(c.fchownSync), c.lchownSync = h(c.lchownSync), c.chmodSync = f(c.chmodSync), c.fchmodSync = f(c.fchmodSync), c.lchmodSync = f(c.lchmodSync), c.stat = d(c.stat), c.fstat = d(c.fstat), c.lstat = d(c.lstat), c.statSync = E(c.statSync), c.fstatSync = E(c.fstatSync), c.lstatSync = E(c.lstatSync), c.lchmod || (c.lchmod = function(u, l, y) {
1397
+ y && process.nextTick(y);
1398
+ }, c.lchmodSync = function() {
1399
+ }), c.lchown || (c.lchown = function(u, l, y, S) {
1400
+ S && process.nextTick(S);
1401
+ }, c.lchownSync = function() {
1402
+ }), r === "win32" && (c.rename = function(u) {
1403
+ return function(l, y, S) {
1404
+ var w = Date.now(), P = 0;
1405
+ u(l, y, function D(I) {
1406
+ if (I && (I.code === "EACCES" || I.code === "EPERM") && Date.now() - w < 6e4) {
1407
+ setTimeout(function() {
1408
+ c.stat(y, function(p, g) {
1409
+ p && p.code === "ENOENT" ? u(l, y, D) : S(I);
1410
+ });
1411
+ }, P), P < 100 && (P += 10);
1412
+ return;
1413
+ }
1414
+ S && S(I);
1415
+ });
1416
+ };
1417
+ }(c.rename)), c.read = function(u) {
1418
+ function l(y, S, w, P, D, I) {
1419
+ var p;
1420
+ if (I && typeof I == "function") {
1421
+ var g = 0;
1422
+ p = function(O, M, x) {
1423
+ if (O && O.code === "EAGAIN" && g < 10)
1424
+ return g++, u.call(c, y, S, w, P, D, p);
1425
+ I.apply(this, arguments);
1426
+ };
1427
+ }
1428
+ return u.call(c, y, S, w, P, D, p);
1429
+ }
1430
+ return Object.setPrototypeOf && Object.setPrototypeOf(l, u), l;
1431
+ }(c.read), c.readSync = function(u) {
1432
+ return function(l, y, S, w, P) {
1433
+ for (var D = 0; ; )
1434
+ try {
1435
+ return u.call(c, l, y, S, w, P);
1436
+ } catch (I) {
1437
+ if (I.code === "EAGAIN" && D < 10) {
1438
+ D++;
1439
+ continue;
1440
+ }
1441
+ throw I;
1442
+ }
1443
+ };
1444
+ }(c.readSync);
1445
+ function a(u) {
1446
+ u.lchmod = function(l, y, S) {
1447
+ u.open(
1448
+ l,
1449
+ e.O_WRONLY | e.O_SYMLINK,
1450
+ y,
1451
+ function(w, P) {
1452
+ if (w) {
1453
+ S && S(w);
1454
+ return;
1455
+ }
1456
+ u.fchmod(P, y, function(D) {
1457
+ u.close(P, function(I) {
1458
+ S && S(D || I);
1459
+ });
1460
+ });
1461
+ }
1462
+ );
1463
+ }, u.lchmodSync = function(l, y) {
1464
+ var S = u.openSync(l, e.O_WRONLY | e.O_SYMLINK, y), w = !0, P;
1465
+ try {
1466
+ P = u.fchmodSync(S, y), w = !1;
1467
+ } finally {
1468
+ if (w)
1469
+ try {
1470
+ u.closeSync(S);
1471
+ } catch {
1472
+ }
1473
+ else
1474
+ u.closeSync(S);
1475
+ }
1476
+ return P;
1477
+ };
1478
+ }
1479
+ function s(u) {
1480
+ e.hasOwnProperty("O_SYMLINK") ? (u.lutimes = function(l, y, S, w) {
1481
+ u.open(l, e.O_SYMLINK, function(P, D) {
1482
+ if (P) {
1483
+ w && w(P);
1484
+ return;
1485
+ }
1486
+ u.futimes(D, y, S, function(I) {
1487
+ u.close(D, function(p) {
1488
+ w && w(I || p);
1489
+ });
1490
+ });
1491
+ });
1492
+ }, u.lutimesSync = function(l, y, S) {
1493
+ var w = u.openSync(l, e.O_SYMLINK), P, D = !0;
1494
+ try {
1495
+ P = u.futimesSync(w, y, S), D = !1;
1496
+ } finally {
1497
+ if (D)
1498
+ try {
1499
+ u.closeSync(w);
1500
+ } catch {
1501
+ }
1502
+ else
1503
+ u.closeSync(w);
1504
+ }
1505
+ return P;
1506
+ }) : (u.lutimes = function(l, y, S, w) {
1507
+ w && process.nextTick(w);
1508
+ }, u.lutimesSync = function() {
1509
+ });
1510
+ }
1511
+ function v(u) {
1512
+ return u && function(l, y, S) {
1513
+ return u.call(c, l, y, function(w) {
1514
+ F(w) && (w = null), S && S.apply(this, arguments);
1515
+ });
1516
+ };
1517
+ }
1518
+ function f(u) {
1519
+ return u && function(l, y) {
1520
+ try {
1521
+ return u.call(c, l, y);
1522
+ } catch (S) {
1523
+ if (!F(S))
1524
+ throw S;
1525
+ }
1526
+ };
1527
+ }
1528
+ function m(u) {
1529
+ return u && function(l, y, S, w) {
1530
+ return u.call(c, l, y, S, function(P) {
1531
+ F(P) && (P = null), w && w.apply(this, arguments);
1532
+ });
1533
+ };
1534
+ }
1535
+ function h(u) {
1536
+ return u && function(l, y, S) {
1537
+ try {
1538
+ return u.call(c, l, y, S);
1539
+ } catch (w) {
1540
+ if (!F(w))
1541
+ throw w;
1542
+ }
1543
+ };
1544
+ }
1545
+ function d(u) {
1546
+ return u && function(l, y, S) {
1547
+ typeof y == "function" && (S = y, y = null);
1548
+ function w(P, D) {
1549
+ D && (D.uid < 0 && (D.uid += 4294967296), D.gid < 0 && (D.gid += 4294967296)), S && S.apply(this, arguments);
1550
+ }
1551
+ return y ? u.call(c, l, y, w) : u.call(c, l, w);
1552
+ };
1553
+ }
1554
+ function E(u) {
1555
+ return u && function(l, y) {
1556
+ var S = y ? u.call(c, l, y) : u.call(c, l);
1557
+ return S && (S.uid < 0 && (S.uid += 4294967296), S.gid < 0 && (S.gid += 4294967296)), S;
1558
+ };
1559
+ }
1560
+ function F(u) {
1561
+ if (!u || u.code === "ENOSYS")
1562
+ return !0;
1563
+ var l = !process.getuid || process.getuid() !== 0;
1564
+ return !!(l && (u.code === "EINVAL" || u.code === "EPERM"));
1565
+ }
1566
+ }
1567
+ return be;
1568
+ }
1569
+ var Ge, _t;
1570
+ function wi() {
1571
+ if (_t)
1572
+ return Ge;
1573
+ _t = 1;
1574
+ var e = re.Stream;
1575
+ Ge = t;
1576
+ function t(n) {
1577
+ return {
1578
+ ReadStream: r,
1579
+ WriteStream: i
1580
+ };
1581
+ function r(o, c) {
1582
+ if (!(this instanceof r))
1583
+ return new r(o, c);
1584
+ e.call(this);
1585
+ var a = this;
1586
+ this.path = o, this.fd = null, this.readable = !0, this.paused = !1, this.flags = "r", this.mode = 438, this.bufferSize = 64 * 1024, c = c || {};
1587
+ for (var s = Object.keys(c), v = 0, f = s.length; v < f; v++) {
1588
+ var m = s[v];
1589
+ this[m] = c[m];
1590
+ }
1591
+ if (this.encoding && this.setEncoding(this.encoding), this.start !== void 0) {
1592
+ if (typeof this.start != "number")
1593
+ throw TypeError("start must be a Number");
1594
+ if (this.end === void 0)
1595
+ this.end = 1 / 0;
1596
+ else if (typeof this.end != "number")
1597
+ throw TypeError("end must be a Number");
1598
+ if (this.start > this.end)
1599
+ throw new Error("start must be <= end");
1600
+ this.pos = this.start;
1601
+ }
1602
+ if (this.fd !== null) {
1603
+ process.nextTick(function() {
1604
+ a._read();
1605
+ });
1606
+ return;
1607
+ }
1608
+ n.open(this.path, this.flags, this.mode, function(h, d) {
1609
+ if (h) {
1610
+ a.emit("error", h), a.readable = !1;
1611
+ return;
1612
+ }
1613
+ a.fd = d, a.emit("open", d), a._read();
1614
+ });
1615
+ }
1616
+ function i(o, c) {
1617
+ if (!(this instanceof i))
1618
+ return new i(o, c);
1619
+ e.call(this), this.path = o, this.fd = null, this.writable = !0, this.flags = "w", this.encoding = "binary", this.mode = 438, this.bytesWritten = 0, c = c || {};
1620
+ for (var a = Object.keys(c), s = 0, v = a.length; s < v; s++) {
1621
+ var f = a[s];
1622
+ this[f] = c[f];
1623
+ }
1624
+ if (this.start !== void 0) {
1625
+ if (typeof this.start != "number")
1626
+ throw TypeError("start must be a Number");
1627
+ if (this.start < 0)
1628
+ throw new Error("start must be >= zero");
1629
+ this.pos = this.start;
1630
+ }
1631
+ this.busy = !1, this._queue = [], this.fd === null && (this._open = n.open, this._queue.push([this._open, this.path, this.flags, this.mode, void 0]), this.flush());
1632
+ }
1633
+ }
1634
+ return Ge;
1635
+ }
1636
+ var Ue, Dt;
1637
+ function Ei() {
1638
+ if (Dt)
1639
+ return Ue;
1640
+ Dt = 1, Ue = t;
1641
+ var e = Object.getPrototypeOf || function(n) {
1642
+ return n.__proto__;
1643
+ };
1644
+ function t(n) {
1645
+ if (n === null || typeof n != "object")
1646
+ return n;
1647
+ if (n instanceof Object)
1648
+ var r = { __proto__: e(n) };
1649
+ else
1650
+ var r = /* @__PURE__ */ Object.create(null);
1651
+ return Object.getOwnPropertyNames(n).forEach(function(i) {
1652
+ Object.defineProperty(r, i, Object.getOwnPropertyDescriptor(n, i));
1653
+ }), r;
1654
+ }
1655
+ return Ue;
1656
+ }
1657
+ var De, Nt;
1658
+ function $i() {
1659
+ if (Nt)
1660
+ return De;
1661
+ Nt = 1;
1662
+ var e = He, t = vi(), n = wi(), r = Ei(), i = re, o, c;
1663
+ typeof Symbol == "function" && typeof Symbol.for == "function" ? (o = Symbol.for("graceful-fs.queue"), c = Symbol.for("graceful-fs.previous")) : (o = "___graceful-fs.queue", c = "___graceful-fs.previous");
1664
+ function a() {
1665
+ }
1666
+ function s(u, l) {
1667
+ Object.defineProperty(u, o, {
1668
+ get: function() {
1669
+ return l;
1670
+ }
1671
+ });
1672
+ }
1673
+ var v = a;
1674
+ if (i.debuglog ? v = i.debuglog("gfs4") : /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && (v = function() {
1675
+ var u = i.format.apply(i, arguments);
1676
+ u = "GFS4: " + u.split(/\n/).join(`
1677
+ GFS4: `), console.error(u);
1678
+ }), !e[o]) {
1679
+ var f = me[o] || [];
1680
+ s(e, f), e.close = function(u) {
1681
+ function l(y, S) {
1682
+ return u.call(e, y, function(w) {
1683
+ w || E(), typeof S == "function" && S.apply(this, arguments);
1684
+ });
1685
+ }
1686
+ return Object.defineProperty(l, c, {
1687
+ value: u
1688
+ }), l;
1689
+ }(e.close), e.closeSync = function(u) {
1690
+ function l(y) {
1691
+ u.apply(e, arguments), E();
1692
+ }
1693
+ return Object.defineProperty(l, c, {
1694
+ value: u
1695
+ }), l;
1696
+ }(e.closeSync), /\bgfs4\b/i.test(process.env.NODE_DEBUG || "") && process.on("exit", function() {
1697
+ v(e[o]), re.equal(e[o].length, 0);
1698
+ });
1699
+ }
1700
+ me[o] || s(me, e[o]), De = m(r(e)), process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !e.__patched && (De = m(e), e.__patched = !0);
1701
+ function m(u) {
1702
+ t(u), u.gracefulify = m, u.createReadStream = gn, u.createWriteStream = Fn;
1703
+ var l = u.readFile;
1704
+ u.readFile = y;
1705
+ function y($, T, _) {
1706
+ return typeof T == "function" && (_ = T, T = null), J($, T, _);
1707
+ function J(b, G, A, Q) {
1708
+ return l(b, G, function(C) {
1709
+ C && (C.code === "EMFILE" || C.code === "ENFILE") ? h([J, [b, G, A], C, Q || Date.now(), Date.now()]) : typeof A == "function" && A.apply(this, arguments);
1710
+ });
1711
+ }
1712
+ }
1713
+ var S = u.writeFile;
1714
+ u.writeFile = w;
1715
+ function w($, T, _, J) {
1716
+ return typeof _ == "function" && (J = _, _ = null), b($, T, _, J);
1717
+ function b(G, A, Q, C, te) {
1718
+ return S(G, A, Q, function(q) {
1719
+ q && (q.code === "EMFILE" || q.code === "ENFILE") ? h([b, [G, A, Q, C], q, te || Date.now(), Date.now()]) : typeof C == "function" && C.apply(this, arguments);
1720
+ });
1721
+ }
1722
+ }
1723
+ var P = u.appendFile;
1724
+ P && (u.appendFile = D);
1725
+ function D($, T, _, J) {
1726
+ return typeof _ == "function" && (J = _, _ = null), b($, T, _, J);
1727
+ function b(G, A, Q, C, te) {
1728
+ return P(G, A, Q, function(q) {
1729
+ q && (q.code === "EMFILE" || q.code === "ENFILE") ? h([b, [G, A, Q, C], q, te || Date.now(), Date.now()]) : typeof C == "function" && C.apply(this, arguments);
1730
+ });
1731
+ }
1732
+ }
1733
+ var I = u.copyFile;
1734
+ I && (u.copyFile = p);
1735
+ function p($, T, _, J) {
1736
+ return typeof _ == "function" && (J = _, _ = 0), b($, T, _, J);
1737
+ function b(G, A, Q, C, te) {
1738
+ return I(G, A, Q, function(q) {
1739
+ q && (q.code === "EMFILE" || q.code === "ENFILE") ? h([b, [G, A, Q, C], q, te || Date.now(), Date.now()]) : typeof C == "function" && C.apply(this, arguments);
1740
+ });
1741
+ }
1742
+ }
1743
+ var g = u.readdir;
1744
+ u.readdir = O;
1745
+ function O($, T, _) {
1746
+ return typeof T == "function" && (_ = T, T = null), J($, T, _);
1747
+ function J(b, G, A, Q) {
1748
+ return g(b, G, function(C, te) {
1749
+ C && (C.code === "EMFILE" || C.code === "ENFILE") ? h([J, [b, G, A], C, Q || Date.now(), Date.now()]) : (te && te.sort && te.sort(), typeof A == "function" && A.call(this, C, te));
1750
+ });
1751
+ }
1752
+ }
1753
+ if (process.version.substr(0, 4) === "v0.8") {
1754
+ var M = n(u);
1755
+ k = M.ReadStream, N = M.WriteStream;
1756
+ }
1757
+ var x = u.ReadStream;
1758
+ x && (k.prototype = Object.create(x.prototype), k.prototype.open = X);
1759
+ var W = u.WriteStream;
1760
+ W && (N.prototype = Object.create(W.prototype), N.prototype.open = ut), Object.defineProperty(u, "ReadStream", {
1761
+ get: function() {
1762
+ return k;
1763
+ },
1764
+ set: function($) {
1765
+ k = $;
1766
+ },
1767
+ enumerable: !0,
1768
+ configurable: !0
1769
+ }), Object.defineProperty(u, "WriteStream", {
1770
+ get: function() {
1771
+ return N;
1772
+ },
1773
+ set: function($) {
1774
+ N = $;
1775
+ },
1776
+ enumerable: !0,
1777
+ configurable: !0
1778
+ });
1779
+ var R = k;
1780
+ Object.defineProperty(u, "FileReadStream", {
1781
+ get: function() {
1782
+ return R;
1783
+ },
1784
+ set: function($) {
1785
+ R = $;
1786
+ },
1787
+ enumerable: !0,
1788
+ configurable: !0
1789
+ });
1790
+ var B = N;
1791
+ Object.defineProperty(u, "FileWriteStream", {
1792
+ get: function() {
1793
+ return B;
1794
+ },
1795
+ set: function($) {
1796
+ B = $;
1797
+ },
1798
+ enumerable: !0,
1799
+ configurable: !0
1800
+ });
1801
+ function k($, T) {
1802
+ return this instanceof k ? (x.apply(this, arguments), this) : k.apply(Object.create(k.prototype), arguments);
1803
+ }
1804
+ function X() {
1805
+ var $ = this;
1806
+ Be($.path, $.flags, $.mode, function(T, _) {
1807
+ T ? ($.autoClose && $.destroy(), $.emit("error", T)) : ($.fd = _, $.emit("open", _), $.read());
1808
+ });
1809
+ }
1810
+ function N($, T) {
1811
+ return this instanceof N ? (W.apply(this, arguments), this) : N.apply(Object.create(N.prototype), arguments);
1812
+ }
1813
+ function ut() {
1814
+ var $ = this;
1815
+ Be($.path, $.flags, $.mode, function(T, _) {
1816
+ T ? ($.destroy(), $.emit("error", T)) : ($.fd = _, $.emit("open", _));
1817
+ });
1818
+ }
1819
+ function gn($, T) {
1820
+ return new u.ReadStream($, T);
1821
+ }
1822
+ function Fn($, T) {
1823
+ return new u.WriteStream($, T);
1824
+ }
1825
+ var On = u.open;
1826
+ u.open = Be;
1827
+ function Be($, T, _, J) {
1828
+ return typeof _ == "function" && (J = _, _ = null), b($, T, _, J);
1829
+ function b(G, A, Q, C, te) {
1830
+ return On(G, A, Q, function(q, lo) {
1831
+ q && (q.code === "EMFILE" || q.code === "ENFILE") ? h([b, [G, A, Q, C], q, te || Date.now(), Date.now()]) : typeof C == "function" && C.apply(this, arguments);
1832
+ });
1833
+ }
1834
+ }
1835
+ return u;
1836
+ }
1837
+ function h(u) {
1838
+ v("ENQUEUE", u[0].name, u[1]), e[o].push(u), F();
1839
+ }
1840
+ var d;
1841
+ function E() {
1842
+ for (var u = Date.now(), l = 0; l < e[o].length; ++l)
1843
+ e[o][l].length > 2 && (e[o][l][3] = u, e[o][l][4] = u);
1844
+ F();
1845
+ }
1846
+ function F() {
1847
+ if (clearTimeout(d), d = void 0, e[o].length !== 0) {
1848
+ var u = e[o].shift(), l = u[0], y = u[1], S = u[2], w = u[3], P = u[4];
1849
+ if (w === void 0)
1850
+ v("RETRY", l.name, y), l.apply(null, y);
1851
+ else if (Date.now() - w >= 6e4) {
1852
+ v("TIMEOUT", l.name, y);
1853
+ var D = y.pop();
1854
+ typeof D == "function" && D.call(null, S);
1855
+ } else {
1856
+ var I = Date.now() - P, p = Math.max(P - w, 1), g = Math.min(p * 1.2, 100);
1857
+ I >= g ? (v("RETRY", l.name, y), l.apply(null, y.concat([w]))) : e[o].push(u);
1858
+ }
1859
+ d === void 0 && (d = setTimeout(F, 0));
1860
+ }
1861
+ }
1862
+ return De;
1863
+ }
1864
+ function gi(e, { EOL: t = `
1865
+ `, finalEOL: n = !0, replacer: r = null, spaces: i } = {}) {
1866
+ const o = n ? t : "";
1867
+ return JSON.stringify(e, r, i).replace(/\n/g, t) + o;
1868
+ }
1869
+ function Fi(e) {
1870
+ return Buffer.isBuffer(e) && (e = e.toString("utf8")), e.replace(/^\uFEFF/, "");
1871
+ }
1872
+ var ot = { stringify: gi, stripBom: Fi };
1873
+ let Se;
1874
+ try {
1875
+ Se = $i();
1876
+ } catch {
1877
+ Se = He;
1878
+ }
1879
+ const qe = H, { stringify: hn, stripBom: Sn } = ot;
1880
+ async function Oi(e, t = {}) {
1881
+ typeof t == "string" && (t = { encoding: t });
1882
+ const n = t.fs || Se, r = "throws" in t ? t.throws : !0;
1883
+ let i = await qe.fromCallback(n.readFile)(e, t);
1884
+ i = Sn(i);
1885
+ let o;
1886
+ try {
1887
+ o = JSON.parse(i, t ? t.reviver : null);
1888
+ } catch (c) {
1889
+ if (r)
1890
+ throw c.message = `${e}: ${c.message}`, c;
1891
+ return null;
1892
+ }
1893
+ return o;
1894
+ }
1895
+ const ki = qe.fromPromise(Oi);
1896
+ function Pi(e, t = {}) {
1897
+ typeof t == "string" && (t = { encoding: t });
1898
+ const n = t.fs || Se, r = "throws" in t ? t.throws : !0;
1899
+ try {
1900
+ let i = n.readFileSync(e, t);
1901
+ return i = Sn(i), JSON.parse(i, t.reviver);
1902
+ } catch (i) {
1903
+ if (r)
1904
+ throw i.message = `${e}: ${i.message}`, i;
1905
+ return null;
1906
+ }
1907
+ }
1908
+ async function _i(e, t, n = {}) {
1909
+ const r = n.fs || Se, i = hn(t, n);
1910
+ await qe.fromCallback(r.writeFile)(e, i, n);
1911
+ }
1912
+ const Di = qe.fromPromise(_i);
1913
+ function Ni(e, t, n = {}) {
1914
+ const r = n.fs || Se, i = hn(t, n);
1915
+ return r.writeFileSync(e, i, n);
1916
+ }
1917
+ const Ti = {
1918
+ readFile: ki,
1919
+ readFileSync: Pi,
1920
+ writeFile: Di,
1921
+ writeFileSync: Ni
1922
+ };
1923
+ var Li = Ti;
1924
+ const Ne = Li;
1925
+ var Ii = {
1926
+ readJson: Ne.readFile,
1927
+ readJsonSync: Ne.readFileSync,
1928
+ writeJson: Ne.writeFile,
1929
+ writeJsonSync: Ne.writeFileSync
1930
+ };
1931
+ const Ci = H.fromCallback, we = ee, pn = V, vn = ie, ji = le.pathExists;
1932
+ function xi(e, t, n, r) {
1933
+ typeof n == "function" && (r = n, n = "utf8");
1934
+ const i = pn.dirname(e);
1935
+ ji(i, (o, c) => {
1936
+ if (o)
1937
+ return r(o);
1938
+ if (c)
1939
+ return we.writeFile(e, t, n, r);
1940
+ vn.mkdirs(i, (a) => {
1941
+ if (a)
1942
+ return r(a);
1943
+ we.writeFile(e, t, n, r);
1944
+ });
1945
+ });
1946
+ }
1947
+ function Ri(e, ...t) {
1948
+ const n = pn.dirname(e);
1949
+ if (we.existsSync(n))
1950
+ return we.writeFileSync(e, ...t);
1951
+ vn.mkdirsSync(n), we.writeFileSync(e, ...t);
1952
+ }
1953
+ var ct = {
1954
+ outputFile: Ci(xi),
1955
+ outputFileSync: Ri
1956
+ };
1957
+ const { stringify: Mi } = ot, { outputFile: Wi } = ct;
1958
+ async function Ai(e, t, n = {}) {
1959
+ const r = Mi(t, n);
1960
+ await Wi(e, r, n);
1961
+ }
1962
+ var qi = Ai;
1963
+ const { stringify: Bi } = ot, { outputFileSync: Yi } = ct;
1964
+ function Ji(e, t, n) {
1965
+ const r = Bi(t, n);
1966
+ Yi(e, r, n);
1967
+ }
1968
+ var bi = Ji;
1969
+ const Gi = H.fromPromise, z = Ii;
1970
+ z.outputJson = Gi(qi);
1971
+ z.outputJsonSync = bi;
1972
+ z.outputJSON = z.outputJson;
1973
+ z.outputJSONSync = z.outputJsonSync;
1974
+ z.writeJSON = z.writeJson;
1975
+ z.writeJSONSync = z.writeJsonSync;
1976
+ z.readJSON = z.readJson;
1977
+ z.readJSONSync = z.readJsonSync;
1978
+ var Ui = z;
1979
+ const Ki = ee, Ve = V, Qi = rt.copy, wn = Ae.remove, Vi = ie.mkdirp, zi = le.pathExists, Tt = pe;
1980
+ function Hi(e, t, n, r) {
1981
+ typeof n == "function" && (r = n, n = {}), n = n || {};
1982
+ const i = n.overwrite || n.clobber || !1;
1983
+ Tt.checkPaths(e, t, "move", n, (o, c) => {
1984
+ if (o)
1985
+ return r(o);
1986
+ const { srcStat: a, isChangingCase: s = !1 } = c;
1987
+ Tt.checkParentPaths(e, a, t, "move", (v) => {
1988
+ if (v)
1989
+ return r(v);
1990
+ if (Xi(t))
1991
+ return Lt(e, t, i, s, r);
1992
+ Vi(Ve.dirname(t), (f) => f ? r(f) : Lt(e, t, i, s, r));
1993
+ });
1994
+ });
1995
+ }
1996
+ function Xi(e) {
1997
+ const t = Ve.dirname(e);
1998
+ return Ve.parse(t).root === t;
1999
+ }
2000
+ function Lt(e, t, n, r, i) {
2001
+ if (r)
2002
+ return Ke(e, t, n, i);
2003
+ if (n)
2004
+ return wn(t, (o) => o ? i(o) : Ke(e, t, n, i));
2005
+ zi(t, (o, c) => o ? i(o) : c ? i(new Error("dest already exists.")) : Ke(e, t, n, i));
2006
+ }
2007
+ function Ke(e, t, n, r) {
2008
+ Ki.rename(e, t, (i) => i ? i.code !== "EXDEV" ? r(i) : Zi(e, t, n, r) : r());
2009
+ }
2010
+ function Zi(e, t, n, r) {
2011
+ Qi(e, t, {
2012
+ overwrite: n,
2013
+ errorOnExist: !0
2014
+ }, (o) => o ? r(o) : wn(e, r));
2015
+ }
2016
+ var eo = Hi;
2017
+ const En = ee, ze = V, to = rt.copySync, $n = Ae.removeSync, no = ie.mkdirpSync, It = pe;
2018
+ function ro(e, t, n) {
2019
+ n = n || {};
2020
+ const r = n.overwrite || n.clobber || !1, { srcStat: i, isChangingCase: o = !1 } = It.checkPathsSync(e, t, "move", n);
2021
+ return It.checkParentPathsSync(e, i, t, "move"), io(t) || no(ze.dirname(t)), oo(e, t, r, o);
2022
+ }
2023
+ function io(e) {
2024
+ const t = ze.dirname(e);
2025
+ return ze.parse(t).root === t;
2026
+ }
2027
+ function oo(e, t, n, r) {
2028
+ if (r)
2029
+ return Qe(e, t, n);
2030
+ if (n)
2031
+ return $n(t), Qe(e, t, n);
2032
+ if (En.existsSync(t))
2033
+ throw new Error("dest already exists.");
2034
+ return Qe(e, t, n);
2035
+ }
2036
+ function Qe(e, t, n) {
2037
+ try {
2038
+ En.renameSync(e, t);
2039
+ } catch (r) {
2040
+ if (r.code !== "EXDEV")
2041
+ throw r;
2042
+ return co(e, t, n);
2043
+ }
2044
+ }
2045
+ function co(e, t, n) {
2046
+ return to(e, t, {
2047
+ overwrite: n,
2048
+ errorOnExist: !0
2049
+ }), $n(e);
2050
+ }
2051
+ var uo = ro;
2052
+ const ao = H.fromCallback;
2053
+ var fo = {
2054
+ move: ao(eo),
2055
+ moveSync: uo
2056
+ }, so = {
2057
+ ...se,
2058
+ ...rt,
2059
+ ...Jr,
2060
+ ...pi,
2061
+ ...Ui,
2062
+ ...ie,
2063
+ ...fo,
2064
+ ...ct,
2065
+ ...le,
2066
+ ...Ae
2067
+ };
2068
+ const Te = so;
2069
+ function So(e, t) {
2070
+ return {
2071
+ name: "vite-plugin-css-import",
2072
+ apply: "build",
2073
+ enforce: "post",
2074
+ writeBundle: async (n, r) => {
2075
+ const i = Object.keys(r).filter((f) => f.endsWith(".css"));
2076
+ if (!i.length)
2077
+ return;
2078
+ const o = i.reduce((f, m) => `${f}import "./${m}";
2079
+ `, ""), c = V.resolve(
2080
+ process.cwd(),
2081
+ e,
2082
+ `${t}-temp.js`
2083
+ ), a = V.resolve(process.cwd(), e, `${t}.js`), s = Te.createWriteStream(c);
2084
+ s.write(o, "utf8");
2085
+ const v = Te.createReadStream(a);
2086
+ await kn(v, s), await Te.remove(a), await Te.rename(c, a), s.end();
2087
+ }
2088
+ };
2089
+ }
2090
+ export {
2091
+ So as viteCssImportPlugin
2092
+ };
2093
+ //# sourceMappingURL=index.js.map