rm-graphical-computing-node 1.0.33 → 1.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +1599 -25
  2. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -4,7 +4,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
8
14
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
15
  };
10
16
  var __copyProps = (to, from, except, desc) => {
@@ -24,11 +30,1588 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
30
  mod
25
31
  ));
26
32
 
33
+ // node_modules/graceful-fs/polyfills.js
34
+ var require_polyfills = __commonJS({
35
+ "node_modules/graceful-fs/polyfills.js"(exports, module) {
36
+ var constants = __require("constants");
37
+ var origCwd = process.cwd;
38
+ var cwd = null;
39
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
40
+ process.cwd = function() {
41
+ if (!cwd)
42
+ cwd = origCwd.call(process);
43
+ return cwd;
44
+ };
45
+ try {
46
+ process.cwd();
47
+ } catch (er) {
48
+ }
49
+ if (typeof process.chdir === "function") {
50
+ chdir = process.chdir;
51
+ process.chdir = function(d) {
52
+ cwd = null;
53
+ chdir.call(process, d);
54
+ };
55
+ if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
56
+ }
57
+ var chdir;
58
+ module.exports = patch;
59
+ function patch(fs) {
60
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
61
+ patchLchmod(fs);
62
+ }
63
+ if (!fs.lutimes) {
64
+ patchLutimes(fs);
65
+ }
66
+ fs.chown = chownFix(fs.chown);
67
+ fs.fchown = chownFix(fs.fchown);
68
+ fs.lchown = chownFix(fs.lchown);
69
+ fs.chmod = chmodFix(fs.chmod);
70
+ fs.fchmod = chmodFix(fs.fchmod);
71
+ fs.lchmod = chmodFix(fs.lchmod);
72
+ fs.chownSync = chownFixSync(fs.chownSync);
73
+ fs.fchownSync = chownFixSync(fs.fchownSync);
74
+ fs.lchownSync = chownFixSync(fs.lchownSync);
75
+ fs.chmodSync = chmodFixSync(fs.chmodSync);
76
+ fs.fchmodSync = chmodFixSync(fs.fchmodSync);
77
+ fs.lchmodSync = chmodFixSync(fs.lchmodSync);
78
+ fs.stat = statFix(fs.stat);
79
+ fs.fstat = statFix(fs.fstat);
80
+ fs.lstat = statFix(fs.lstat);
81
+ fs.statSync = statFixSync(fs.statSync);
82
+ fs.fstatSync = statFixSync(fs.fstatSync);
83
+ fs.lstatSync = statFixSync(fs.lstatSync);
84
+ if (fs.chmod && !fs.lchmod) {
85
+ fs.lchmod = function(path3, mode, cb) {
86
+ if (cb) process.nextTick(cb);
87
+ };
88
+ fs.lchmodSync = function() {
89
+ };
90
+ }
91
+ if (fs.chown && !fs.lchown) {
92
+ fs.lchown = function(path3, uid, gid, cb) {
93
+ if (cb) process.nextTick(cb);
94
+ };
95
+ fs.lchownSync = function() {
96
+ };
97
+ }
98
+ if (platform === "win32") {
99
+ fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
100
+ function rename(from, to, cb) {
101
+ var start = Date.now();
102
+ var backoff = 0;
103
+ fs$rename(from, to, function CB(er) {
104
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
105
+ setTimeout(function() {
106
+ fs.stat(to, function(stater, st) {
107
+ if (stater && stater.code === "ENOENT")
108
+ fs$rename(from, to, CB);
109
+ else
110
+ cb(er);
111
+ });
112
+ }, backoff);
113
+ if (backoff < 100)
114
+ backoff += 10;
115
+ return;
116
+ }
117
+ if (cb) cb(er);
118
+ });
119
+ }
120
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
121
+ return rename;
122
+ })(fs.rename);
123
+ }
124
+ fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
125
+ function read(fd, buffer, offset, length2, position, callback_) {
126
+ var callback;
127
+ if (callback_ && typeof callback_ === "function") {
128
+ var eagCounter = 0;
129
+ callback = function(er, _, __) {
130
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
131
+ eagCounter++;
132
+ return fs$read.call(fs, fd, buffer, offset, length2, position, callback);
133
+ }
134
+ callback_.apply(this, arguments);
135
+ };
136
+ }
137
+ return fs$read.call(fs, fd, buffer, offset, length2, position, callback);
138
+ }
139
+ if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
140
+ return read;
141
+ })(fs.read);
142
+ fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : /* @__PURE__ */ (function(fs$readSync) {
143
+ return function(fd, buffer, offset, length2, position) {
144
+ var eagCounter = 0;
145
+ while (true) {
146
+ try {
147
+ return fs$readSync.call(fs, fd, buffer, offset, length2, position);
148
+ } catch (er) {
149
+ if (er.code === "EAGAIN" && eagCounter < 10) {
150
+ eagCounter++;
151
+ continue;
152
+ }
153
+ throw er;
154
+ }
155
+ }
156
+ };
157
+ })(fs.readSync);
158
+ function patchLchmod(fs2) {
159
+ fs2.lchmod = function(path3, mode, callback) {
160
+ fs2.open(
161
+ path3,
162
+ constants.O_WRONLY | constants.O_SYMLINK,
163
+ mode,
164
+ function(err, fd) {
165
+ if (err) {
166
+ if (callback) callback(err);
167
+ return;
168
+ }
169
+ fs2.fchmod(fd, mode, function(err2) {
170
+ fs2.close(fd, function(err22) {
171
+ if (callback) callback(err2 || err22);
172
+ });
173
+ });
174
+ }
175
+ );
176
+ };
177
+ fs2.lchmodSync = function(path3, mode) {
178
+ var fd = fs2.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
179
+ var threw = true;
180
+ var ret;
181
+ try {
182
+ ret = fs2.fchmodSync(fd, mode);
183
+ threw = false;
184
+ } finally {
185
+ if (threw) {
186
+ try {
187
+ fs2.closeSync(fd);
188
+ } catch (er) {
189
+ }
190
+ } else {
191
+ fs2.closeSync(fd);
192
+ }
193
+ }
194
+ return ret;
195
+ };
196
+ }
197
+ function patchLutimes(fs2) {
198
+ if (constants.hasOwnProperty("O_SYMLINK") && fs2.futimes) {
199
+ fs2.lutimes = function(path3, at, mt, cb) {
200
+ fs2.open(path3, constants.O_SYMLINK, function(er, fd) {
201
+ if (er) {
202
+ if (cb) cb(er);
203
+ return;
204
+ }
205
+ fs2.futimes(fd, at, mt, function(er2) {
206
+ fs2.close(fd, function(er22) {
207
+ if (cb) cb(er2 || er22);
208
+ });
209
+ });
210
+ });
211
+ };
212
+ fs2.lutimesSync = function(path3, at, mt) {
213
+ var fd = fs2.openSync(path3, constants.O_SYMLINK);
214
+ var ret;
215
+ var threw = true;
216
+ try {
217
+ ret = fs2.futimesSync(fd, at, mt);
218
+ threw = false;
219
+ } finally {
220
+ if (threw) {
221
+ try {
222
+ fs2.closeSync(fd);
223
+ } catch (er) {
224
+ }
225
+ } else {
226
+ fs2.closeSync(fd);
227
+ }
228
+ }
229
+ return ret;
230
+ };
231
+ } else if (fs2.futimes) {
232
+ fs2.lutimes = function(_a, _b, _c, cb) {
233
+ if (cb) process.nextTick(cb);
234
+ };
235
+ fs2.lutimesSync = function() {
236
+ };
237
+ }
238
+ }
239
+ function chmodFix(orig) {
240
+ if (!orig) return orig;
241
+ return function(target, mode, cb) {
242
+ return orig.call(fs, target, mode, function(er) {
243
+ if (chownErOk(er)) er = null;
244
+ if (cb) cb.apply(this, arguments);
245
+ });
246
+ };
247
+ }
248
+ function chmodFixSync(orig) {
249
+ if (!orig) return orig;
250
+ return function(target, mode) {
251
+ try {
252
+ return orig.call(fs, target, mode);
253
+ } catch (er) {
254
+ if (!chownErOk(er)) throw er;
255
+ }
256
+ };
257
+ }
258
+ function chownFix(orig) {
259
+ if (!orig) return orig;
260
+ return function(target, uid, gid, cb) {
261
+ return orig.call(fs, target, uid, gid, function(er) {
262
+ if (chownErOk(er)) er = null;
263
+ if (cb) cb.apply(this, arguments);
264
+ });
265
+ };
266
+ }
267
+ function chownFixSync(orig) {
268
+ if (!orig) return orig;
269
+ return function(target, uid, gid) {
270
+ try {
271
+ return orig.call(fs, target, uid, gid);
272
+ } catch (er) {
273
+ if (!chownErOk(er)) throw er;
274
+ }
275
+ };
276
+ }
277
+ function statFix(orig) {
278
+ if (!orig) return orig;
279
+ return function(target, options, cb) {
280
+ if (typeof options === "function") {
281
+ cb = options;
282
+ options = null;
283
+ }
284
+ function callback(er, stats) {
285
+ if (stats) {
286
+ if (stats.uid < 0) stats.uid += 4294967296;
287
+ if (stats.gid < 0) stats.gid += 4294967296;
288
+ }
289
+ if (cb) cb.apply(this, arguments);
290
+ }
291
+ return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
292
+ };
293
+ }
294
+ function statFixSync(orig) {
295
+ if (!orig) return orig;
296
+ return function(target, options) {
297
+ var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
298
+ if (stats) {
299
+ if (stats.uid < 0) stats.uid += 4294967296;
300
+ if (stats.gid < 0) stats.gid += 4294967296;
301
+ }
302
+ return stats;
303
+ };
304
+ }
305
+ function chownErOk(er) {
306
+ if (!er)
307
+ return true;
308
+ if (er.code === "ENOSYS")
309
+ return true;
310
+ var nonroot = !process.getuid || process.getuid() !== 0;
311
+ if (nonroot) {
312
+ if (er.code === "EINVAL" || er.code === "EPERM")
313
+ return true;
314
+ }
315
+ return false;
316
+ }
317
+ }
318
+ }
319
+ });
320
+
321
+ // node_modules/graceful-fs/legacy-streams.js
322
+ var require_legacy_streams = __commonJS({
323
+ "node_modules/graceful-fs/legacy-streams.js"(exports, module) {
324
+ var Stream = __require("stream").Stream;
325
+ module.exports = legacy;
326
+ function legacy(fs) {
327
+ return {
328
+ ReadStream,
329
+ WriteStream
330
+ };
331
+ function ReadStream(path3, options) {
332
+ if (!(this instanceof ReadStream)) return new ReadStream(path3, options);
333
+ Stream.call(this);
334
+ var self2 = this;
335
+ this.path = path3;
336
+ this.fd = null;
337
+ this.readable = true;
338
+ this.paused = false;
339
+ this.flags = "r";
340
+ this.mode = 438;
341
+ this.bufferSize = 64 * 1024;
342
+ options = options || {};
343
+ var keys = Object.keys(options);
344
+ for (var index = 0, length2 = keys.length; index < length2; index++) {
345
+ var key = keys[index];
346
+ this[key] = options[key];
347
+ }
348
+ if (this.encoding) this.setEncoding(this.encoding);
349
+ if (this.start !== void 0) {
350
+ if ("number" !== typeof this.start) {
351
+ throw TypeError("start must be a Number");
352
+ }
353
+ if (this.end === void 0) {
354
+ this.end = Infinity;
355
+ } else if ("number" !== typeof this.end) {
356
+ throw TypeError("end must be a Number");
357
+ }
358
+ if (this.start > this.end) {
359
+ throw new Error("start must be <= end");
360
+ }
361
+ this.pos = this.start;
362
+ }
363
+ if (this.fd !== null) {
364
+ process.nextTick(function() {
365
+ self2._read();
366
+ });
367
+ return;
368
+ }
369
+ fs.open(this.path, this.flags, this.mode, function(err, fd) {
370
+ if (err) {
371
+ self2.emit("error", err);
372
+ self2.readable = false;
373
+ return;
374
+ }
375
+ self2.fd = fd;
376
+ self2.emit("open", fd);
377
+ self2._read();
378
+ });
379
+ }
380
+ function WriteStream(path3, options) {
381
+ if (!(this instanceof WriteStream)) return new WriteStream(path3, options);
382
+ Stream.call(this);
383
+ this.path = path3;
384
+ this.fd = null;
385
+ this.writable = true;
386
+ this.flags = "w";
387
+ this.encoding = "binary";
388
+ this.mode = 438;
389
+ this.bytesWritten = 0;
390
+ options = options || {};
391
+ var keys = Object.keys(options);
392
+ for (var index = 0, length2 = keys.length; index < length2; index++) {
393
+ var key = keys[index];
394
+ this[key] = options[key];
395
+ }
396
+ if (this.start !== void 0) {
397
+ if ("number" !== typeof this.start) {
398
+ throw TypeError("start must be a Number");
399
+ }
400
+ if (this.start < 0) {
401
+ throw new Error("start must be >= zero");
402
+ }
403
+ this.pos = this.start;
404
+ }
405
+ this.busy = false;
406
+ this._queue = [];
407
+ if (this.fd === null) {
408
+ this._open = fs.open;
409
+ this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
410
+ this.flush();
411
+ }
412
+ }
413
+ }
414
+ }
415
+ });
416
+
417
+ // node_modules/graceful-fs/clone.js
418
+ var require_clone = __commonJS({
419
+ "node_modules/graceful-fs/clone.js"(exports, module) {
420
+ "use strict";
421
+ module.exports = clone2;
422
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
423
+ return obj.__proto__;
424
+ };
425
+ function clone2(obj) {
426
+ if (obj === null || typeof obj !== "object")
427
+ return obj;
428
+ if (obj instanceof Object)
429
+ var copy = { __proto__: getPrototypeOf(obj) };
430
+ else
431
+ var copy = /* @__PURE__ */ Object.create(null);
432
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
433
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
434
+ });
435
+ return copy;
436
+ }
437
+ }
438
+ });
439
+
440
+ // node_modules/graceful-fs/graceful-fs.js
441
+ var require_graceful_fs = __commonJS({
442
+ "node_modules/graceful-fs/graceful-fs.js"(exports, module) {
443
+ var fs = __require("fs");
444
+ var polyfills = require_polyfills();
445
+ var legacy = require_legacy_streams();
446
+ var clone2 = require_clone();
447
+ var util = __require("util");
448
+ var gracefulQueue;
449
+ var previousSymbol;
450
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
451
+ gracefulQueue = /* @__PURE__ */ Symbol.for("graceful-fs.queue");
452
+ previousSymbol = /* @__PURE__ */ Symbol.for("graceful-fs.previous");
453
+ } else {
454
+ gracefulQueue = "___graceful-fs.queue";
455
+ previousSymbol = "___graceful-fs.previous";
456
+ }
457
+ function noop() {
458
+ }
459
+ function publishQueue(context, queue2) {
460
+ Object.defineProperty(context, gracefulQueue, {
461
+ get: function() {
462
+ return queue2;
463
+ }
464
+ });
465
+ }
466
+ var debug = noop;
467
+ if (util.debuglog)
468
+ debug = util.debuglog("gfs4");
469
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
470
+ debug = function() {
471
+ var m = util.format.apply(util, arguments);
472
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
473
+ console.error(m);
474
+ };
475
+ if (!fs[gracefulQueue]) {
476
+ queue = global[gracefulQueue] || [];
477
+ publishQueue(fs, queue);
478
+ fs.close = (function(fs$close) {
479
+ function close(fd, cb) {
480
+ return fs$close.call(fs, fd, function(err) {
481
+ if (!err) {
482
+ resetQueue();
483
+ }
484
+ if (typeof cb === "function")
485
+ cb.apply(this, arguments);
486
+ });
487
+ }
488
+ Object.defineProperty(close, previousSymbol, {
489
+ value: fs$close
490
+ });
491
+ return close;
492
+ })(fs.close);
493
+ fs.closeSync = (function(fs$closeSync) {
494
+ function closeSync(fd) {
495
+ fs$closeSync.apply(fs, arguments);
496
+ resetQueue();
497
+ }
498
+ Object.defineProperty(closeSync, previousSymbol, {
499
+ value: fs$closeSync
500
+ });
501
+ return closeSync;
502
+ })(fs.closeSync);
503
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
504
+ process.on("exit", function() {
505
+ debug(fs[gracefulQueue]);
506
+ __require("assert").equal(fs[gracefulQueue].length, 0);
507
+ });
508
+ }
509
+ }
510
+ var queue;
511
+ if (!global[gracefulQueue]) {
512
+ publishQueue(global, fs[gracefulQueue]);
513
+ }
514
+ module.exports = patch(clone2(fs));
515
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
516
+ module.exports = patch(fs);
517
+ fs.__patched = true;
518
+ }
519
+ function patch(fs2) {
520
+ polyfills(fs2);
521
+ fs2.gracefulify = patch;
522
+ fs2.createReadStream = createReadStream;
523
+ fs2.createWriteStream = createWriteStream;
524
+ var fs$readFile = fs2.readFile;
525
+ fs2.readFile = readFile;
526
+ function readFile(path3, options, cb) {
527
+ if (typeof options === "function")
528
+ cb = options, options = null;
529
+ return go$readFile(path3, options, cb);
530
+ function go$readFile(path4, options2, cb2, startTime) {
531
+ return fs$readFile(path4, options2, function(err) {
532
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
533
+ enqueue([go$readFile, [path4, options2, cb2], err, startTime || Date.now(), Date.now()]);
534
+ else {
535
+ if (typeof cb2 === "function")
536
+ cb2.apply(this, arguments);
537
+ }
538
+ });
539
+ }
540
+ }
541
+ var fs$writeFile = fs2.writeFile;
542
+ fs2.writeFile = writeFile;
543
+ function writeFile(path3, data, options, cb) {
544
+ if (typeof options === "function")
545
+ cb = options, options = null;
546
+ return go$writeFile(path3, data, options, cb);
547
+ function go$writeFile(path4, data2, options2, cb2, startTime) {
548
+ return fs$writeFile(path4, data2, options2, function(err) {
549
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
550
+ enqueue([go$writeFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
551
+ else {
552
+ if (typeof cb2 === "function")
553
+ cb2.apply(this, arguments);
554
+ }
555
+ });
556
+ }
557
+ }
558
+ var fs$appendFile = fs2.appendFile;
559
+ if (fs$appendFile)
560
+ fs2.appendFile = appendFile;
561
+ function appendFile(path3, data, options, cb) {
562
+ if (typeof options === "function")
563
+ cb = options, options = null;
564
+ return go$appendFile(path3, data, options, cb);
565
+ function go$appendFile(path4, data2, options2, cb2, startTime) {
566
+ return fs$appendFile(path4, data2, options2, function(err) {
567
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
568
+ enqueue([go$appendFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
569
+ else {
570
+ if (typeof cb2 === "function")
571
+ cb2.apply(this, arguments);
572
+ }
573
+ });
574
+ }
575
+ }
576
+ var fs$copyFile = fs2.copyFile;
577
+ if (fs$copyFile)
578
+ fs2.copyFile = copyFile;
579
+ function copyFile(src, dest, flags, cb) {
580
+ if (typeof flags === "function") {
581
+ cb = flags;
582
+ flags = 0;
583
+ }
584
+ return go$copyFile(src, dest, flags, cb);
585
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
586
+ return fs$copyFile(src2, dest2, flags2, function(err) {
587
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
588
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
589
+ else {
590
+ if (typeof cb2 === "function")
591
+ cb2.apply(this, arguments);
592
+ }
593
+ });
594
+ }
595
+ }
596
+ var fs$readdir = fs2.readdir;
597
+ fs2.readdir = readdir;
598
+ var noReaddirOptionVersions = /^v[0-5]\./;
599
+ function readdir(path3, options, cb) {
600
+ if (typeof options === "function")
601
+ cb = options, options = null;
602
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
603
+ return fs$readdir(path4, fs$readdirCallback(
604
+ path4,
605
+ options2,
606
+ cb2,
607
+ startTime
608
+ ));
609
+ } : function go$readdir2(path4, options2, cb2, startTime) {
610
+ return fs$readdir(path4, options2, fs$readdirCallback(
611
+ path4,
612
+ options2,
613
+ cb2,
614
+ startTime
615
+ ));
616
+ };
617
+ return go$readdir(path3, options, cb);
618
+ function fs$readdirCallback(path4, options2, cb2, startTime) {
619
+ return function(err, files) {
620
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
621
+ enqueue([
622
+ go$readdir,
623
+ [path4, options2, cb2],
624
+ err,
625
+ startTime || Date.now(),
626
+ Date.now()
627
+ ]);
628
+ else {
629
+ if (files && files.sort)
630
+ files.sort();
631
+ if (typeof cb2 === "function")
632
+ cb2.call(this, err, files);
633
+ }
634
+ };
635
+ }
636
+ }
637
+ if (process.version.substr(0, 4) === "v0.8") {
638
+ var legStreams = legacy(fs2);
639
+ ReadStream = legStreams.ReadStream;
640
+ WriteStream = legStreams.WriteStream;
641
+ }
642
+ var fs$ReadStream = fs2.ReadStream;
643
+ if (fs$ReadStream) {
644
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
645
+ ReadStream.prototype.open = ReadStream$open;
646
+ }
647
+ var fs$WriteStream = fs2.WriteStream;
648
+ if (fs$WriteStream) {
649
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
650
+ WriteStream.prototype.open = WriteStream$open;
651
+ }
652
+ Object.defineProperty(fs2, "ReadStream", {
653
+ get: function() {
654
+ return ReadStream;
655
+ },
656
+ set: function(val) {
657
+ ReadStream = val;
658
+ },
659
+ enumerable: true,
660
+ configurable: true
661
+ });
662
+ Object.defineProperty(fs2, "WriteStream", {
663
+ get: function() {
664
+ return WriteStream;
665
+ },
666
+ set: function(val) {
667
+ WriteStream = val;
668
+ },
669
+ enumerable: true,
670
+ configurable: true
671
+ });
672
+ var FileReadStream = ReadStream;
673
+ Object.defineProperty(fs2, "FileReadStream", {
674
+ get: function() {
675
+ return FileReadStream;
676
+ },
677
+ set: function(val) {
678
+ FileReadStream = val;
679
+ },
680
+ enumerable: true,
681
+ configurable: true
682
+ });
683
+ var FileWriteStream = WriteStream;
684
+ Object.defineProperty(fs2, "FileWriteStream", {
685
+ get: function() {
686
+ return FileWriteStream;
687
+ },
688
+ set: function(val) {
689
+ FileWriteStream = val;
690
+ },
691
+ enumerable: true,
692
+ configurable: true
693
+ });
694
+ function ReadStream(path3, options) {
695
+ if (this instanceof ReadStream)
696
+ return fs$ReadStream.apply(this, arguments), this;
697
+ else
698
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
699
+ }
700
+ function ReadStream$open() {
701
+ var that = this;
702
+ open(that.path, that.flags, that.mode, function(err, fd) {
703
+ if (err) {
704
+ if (that.autoClose)
705
+ that.destroy();
706
+ that.emit("error", err);
707
+ } else {
708
+ that.fd = fd;
709
+ that.emit("open", fd);
710
+ that.read();
711
+ }
712
+ });
713
+ }
714
+ function WriteStream(path3, options) {
715
+ if (this instanceof WriteStream)
716
+ return fs$WriteStream.apply(this, arguments), this;
717
+ else
718
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
719
+ }
720
+ function WriteStream$open() {
721
+ var that = this;
722
+ open(that.path, that.flags, that.mode, function(err, fd) {
723
+ if (err) {
724
+ that.destroy();
725
+ that.emit("error", err);
726
+ } else {
727
+ that.fd = fd;
728
+ that.emit("open", fd);
729
+ }
730
+ });
731
+ }
732
+ function createReadStream(path3, options) {
733
+ return new fs2.ReadStream(path3, options);
734
+ }
735
+ function createWriteStream(path3, options) {
736
+ return new fs2.WriteStream(path3, options);
737
+ }
738
+ var fs$open = fs2.open;
739
+ fs2.open = open;
740
+ function open(path3, flags, mode, cb) {
741
+ if (typeof mode === "function")
742
+ cb = mode, mode = null;
743
+ return go$open(path3, flags, mode, cb);
744
+ function go$open(path4, flags2, mode2, cb2, startTime) {
745
+ return fs$open(path4, flags2, mode2, function(err, fd) {
746
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
747
+ enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
748
+ else {
749
+ if (typeof cb2 === "function")
750
+ cb2.apply(this, arguments);
751
+ }
752
+ });
753
+ }
754
+ }
755
+ return fs2;
756
+ }
757
+ function enqueue(elem) {
758
+ debug("ENQUEUE", elem[0].name, elem[1]);
759
+ fs[gracefulQueue].push(elem);
760
+ retry();
761
+ }
762
+ var retryTimer;
763
+ function resetQueue() {
764
+ var now3 = Date.now();
765
+ for (var i = 0; i < fs[gracefulQueue].length; ++i) {
766
+ if (fs[gracefulQueue][i].length > 2) {
767
+ fs[gracefulQueue][i][3] = now3;
768
+ fs[gracefulQueue][i][4] = now3;
769
+ }
770
+ }
771
+ retry();
772
+ }
773
+ function retry() {
774
+ clearTimeout(retryTimer);
775
+ retryTimer = void 0;
776
+ if (fs[gracefulQueue].length === 0)
777
+ return;
778
+ var elem = fs[gracefulQueue].shift();
779
+ var fn = elem[0];
780
+ var args = elem[1];
781
+ var err = elem[2];
782
+ var startTime = elem[3];
783
+ var lastTime = elem[4];
784
+ if (startTime === void 0) {
785
+ debug("RETRY", fn.name, args);
786
+ fn.apply(null, args);
787
+ } else if (Date.now() - startTime >= 6e4) {
788
+ debug("TIMEOUT", fn.name, args);
789
+ var cb = args.pop();
790
+ if (typeof cb === "function")
791
+ cb.call(null, err);
792
+ } else {
793
+ var sinceAttempt = Date.now() - lastTime;
794
+ var sinceStart = Math.max(lastTime - startTime, 1);
795
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
796
+ if (sinceAttempt >= desiredDelay) {
797
+ debug("RETRY", fn.name, args);
798
+ fn.apply(null, args.concat([startTime]));
799
+ } else {
800
+ fs[gracefulQueue].push(elem);
801
+ }
802
+ }
803
+ if (retryTimer === void 0) {
804
+ retryTimer = setTimeout(retry, 0);
805
+ }
806
+ }
807
+ }
808
+ });
809
+
810
+ // node_modules/retry/lib/retry_operation.js
811
+ var require_retry_operation = __commonJS({
812
+ "node_modules/retry/lib/retry_operation.js"(exports, module) {
813
+ function RetryOperation(timeouts, options) {
814
+ if (typeof options === "boolean") {
815
+ options = { forever: options };
816
+ }
817
+ this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
818
+ this._timeouts = timeouts;
819
+ this._options = options || {};
820
+ this._maxRetryTime = options && options.maxRetryTime || Infinity;
821
+ this._fn = null;
822
+ this._errors = [];
823
+ this._attempts = 1;
824
+ this._operationTimeout = null;
825
+ this._operationTimeoutCb = null;
826
+ this._timeout = null;
827
+ this._operationStart = null;
828
+ if (this._options.forever) {
829
+ this._cachedTimeouts = this._timeouts.slice(0);
830
+ }
831
+ }
832
+ module.exports = RetryOperation;
833
+ RetryOperation.prototype.reset = function() {
834
+ this._attempts = 1;
835
+ this._timeouts = this._originalTimeouts;
836
+ };
837
+ RetryOperation.prototype.stop = function() {
838
+ if (this._timeout) {
839
+ clearTimeout(this._timeout);
840
+ }
841
+ this._timeouts = [];
842
+ this._cachedTimeouts = null;
843
+ };
844
+ RetryOperation.prototype.retry = function(err) {
845
+ if (this._timeout) {
846
+ clearTimeout(this._timeout);
847
+ }
848
+ if (!err) {
849
+ return false;
850
+ }
851
+ var currentTime = (/* @__PURE__ */ new Date()).getTime();
852
+ if (err && currentTime - this._operationStart >= this._maxRetryTime) {
853
+ this._errors.unshift(new Error("RetryOperation timeout occurred"));
854
+ return false;
855
+ }
856
+ this._errors.push(err);
857
+ var timeout = this._timeouts.shift();
858
+ if (timeout === void 0) {
859
+ if (this._cachedTimeouts) {
860
+ this._errors.splice(this._errors.length - 1, this._errors.length);
861
+ this._timeouts = this._cachedTimeouts.slice(0);
862
+ timeout = this._timeouts.shift();
863
+ } else {
864
+ return false;
865
+ }
866
+ }
867
+ var self2 = this;
868
+ var timer = setTimeout(function() {
869
+ self2._attempts++;
870
+ if (self2._operationTimeoutCb) {
871
+ self2._timeout = setTimeout(function() {
872
+ self2._operationTimeoutCb(self2._attempts);
873
+ }, self2._operationTimeout);
874
+ if (self2._options.unref) {
875
+ self2._timeout.unref();
876
+ }
877
+ }
878
+ self2._fn(self2._attempts);
879
+ }, timeout);
880
+ if (this._options.unref) {
881
+ timer.unref();
882
+ }
883
+ return true;
884
+ };
885
+ RetryOperation.prototype.attempt = function(fn, timeoutOps) {
886
+ this._fn = fn;
887
+ if (timeoutOps) {
888
+ if (timeoutOps.timeout) {
889
+ this._operationTimeout = timeoutOps.timeout;
890
+ }
891
+ if (timeoutOps.cb) {
892
+ this._operationTimeoutCb = timeoutOps.cb;
893
+ }
894
+ }
895
+ var self2 = this;
896
+ if (this._operationTimeoutCb) {
897
+ this._timeout = setTimeout(function() {
898
+ self2._operationTimeoutCb();
899
+ }, self2._operationTimeout);
900
+ }
901
+ this._operationStart = (/* @__PURE__ */ new Date()).getTime();
902
+ this._fn(this._attempts);
903
+ };
904
+ RetryOperation.prototype.try = function(fn) {
905
+ console.log("Using RetryOperation.try() is deprecated");
906
+ this.attempt(fn);
907
+ };
908
+ RetryOperation.prototype.start = function(fn) {
909
+ console.log("Using RetryOperation.start() is deprecated");
910
+ this.attempt(fn);
911
+ };
912
+ RetryOperation.prototype.start = RetryOperation.prototype.try;
913
+ RetryOperation.prototype.errors = function() {
914
+ return this._errors;
915
+ };
916
+ RetryOperation.prototype.attempts = function() {
917
+ return this._attempts;
918
+ };
919
+ RetryOperation.prototype.mainError = function() {
920
+ if (this._errors.length === 0) {
921
+ return null;
922
+ }
923
+ var counts = {};
924
+ var mainError = null;
925
+ var mainErrorCount = 0;
926
+ for (var i = 0; i < this._errors.length; i++) {
927
+ var error = this._errors[i];
928
+ var message = error.message;
929
+ var count = (counts[message] || 0) + 1;
930
+ counts[message] = count;
931
+ if (count >= mainErrorCount) {
932
+ mainError = error;
933
+ mainErrorCount = count;
934
+ }
935
+ }
936
+ return mainError;
937
+ };
938
+ }
939
+ });
940
+
941
+ // node_modules/retry/lib/retry.js
942
+ var require_retry = __commonJS({
943
+ "node_modules/retry/lib/retry.js"(exports) {
944
+ var RetryOperation = require_retry_operation();
945
+ exports.operation = function(options) {
946
+ var timeouts = exports.timeouts(options);
947
+ return new RetryOperation(timeouts, {
948
+ forever: options && options.forever,
949
+ unref: options && options.unref,
950
+ maxRetryTime: options && options.maxRetryTime
951
+ });
952
+ };
953
+ exports.timeouts = function(options) {
954
+ if (options instanceof Array) {
955
+ return [].concat(options);
956
+ }
957
+ var opts = {
958
+ retries: 10,
959
+ factor: 2,
960
+ minTimeout: 1 * 1e3,
961
+ maxTimeout: Infinity,
962
+ randomize: false
963
+ };
964
+ for (var key in options) {
965
+ opts[key] = options[key];
966
+ }
967
+ if (opts.minTimeout > opts.maxTimeout) {
968
+ throw new Error("minTimeout is greater than maxTimeout");
969
+ }
970
+ var timeouts = [];
971
+ for (var i = 0; i < opts.retries; i++) {
972
+ timeouts.push(this.createTimeout(i, opts));
973
+ }
974
+ if (options && options.forever && !timeouts.length) {
975
+ timeouts.push(this.createTimeout(i, opts));
976
+ }
977
+ timeouts.sort(function(a, b) {
978
+ return a - b;
979
+ });
980
+ return timeouts;
981
+ };
982
+ exports.createTimeout = function(attempt, opts) {
983
+ var random = opts.randomize ? Math.random() + 1 : 1;
984
+ var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
985
+ timeout = Math.min(timeout, opts.maxTimeout);
986
+ return timeout;
987
+ };
988
+ exports.wrap = function(obj, options, methods) {
989
+ if (options instanceof Array) {
990
+ methods = options;
991
+ options = null;
992
+ }
993
+ if (!methods) {
994
+ methods = [];
995
+ for (var key in obj) {
996
+ if (typeof obj[key] === "function") {
997
+ methods.push(key);
998
+ }
999
+ }
1000
+ }
1001
+ for (var i = 0; i < methods.length; i++) {
1002
+ var method = methods[i];
1003
+ var original = obj[method];
1004
+ obj[method] = function retryWrapper(original2) {
1005
+ var op = exports.operation(options);
1006
+ var args = Array.prototype.slice.call(arguments, 1);
1007
+ var callback = args.pop();
1008
+ args.push(function(err) {
1009
+ if (op.retry(err)) {
1010
+ return;
1011
+ }
1012
+ if (err) {
1013
+ arguments[0] = op.mainError();
1014
+ }
1015
+ callback.apply(this, arguments);
1016
+ });
1017
+ op.attempt(function() {
1018
+ original2.apply(obj, args);
1019
+ });
1020
+ }.bind(obj, original);
1021
+ obj[method].options = options;
1022
+ }
1023
+ };
1024
+ }
1025
+ });
1026
+
1027
+ // node_modules/retry/index.js
1028
+ var require_retry2 = __commonJS({
1029
+ "node_modules/retry/index.js"(exports, module) {
1030
+ module.exports = require_retry();
1031
+ }
1032
+ });
1033
+
1034
+ // node_modules/signal-exit/signals.js
1035
+ var require_signals = __commonJS({
1036
+ "node_modules/signal-exit/signals.js"(exports, module) {
1037
+ module.exports = [
1038
+ "SIGABRT",
1039
+ "SIGALRM",
1040
+ "SIGHUP",
1041
+ "SIGINT",
1042
+ "SIGTERM"
1043
+ ];
1044
+ if (process.platform !== "win32") {
1045
+ module.exports.push(
1046
+ "SIGVTALRM",
1047
+ "SIGXCPU",
1048
+ "SIGXFSZ",
1049
+ "SIGUSR2",
1050
+ "SIGTRAP",
1051
+ "SIGSYS",
1052
+ "SIGQUIT",
1053
+ "SIGIOT"
1054
+ // should detect profiler and enable/disable accordingly.
1055
+ // see #21
1056
+ // 'SIGPROF'
1057
+ );
1058
+ }
1059
+ if (process.platform === "linux") {
1060
+ module.exports.push(
1061
+ "SIGIO",
1062
+ "SIGPOLL",
1063
+ "SIGPWR",
1064
+ "SIGSTKFLT",
1065
+ "SIGUNUSED"
1066
+ );
1067
+ }
1068
+ }
1069
+ });
1070
+
1071
+ // node_modules/signal-exit/index.js
1072
+ var require_signal_exit = __commonJS({
1073
+ "node_modules/signal-exit/index.js"(exports, module) {
1074
+ var process2 = global.process;
1075
+ var processOk = function(process3) {
1076
+ return process3 && typeof process3 === "object" && typeof process3.removeListener === "function" && typeof process3.emit === "function" && typeof process3.reallyExit === "function" && typeof process3.listeners === "function" && typeof process3.kill === "function" && typeof process3.pid === "number" && typeof process3.on === "function";
1077
+ };
1078
+ if (!processOk(process2)) {
1079
+ module.exports = function() {
1080
+ return function() {
1081
+ };
1082
+ };
1083
+ } else {
1084
+ assert = __require("assert");
1085
+ signals = require_signals();
1086
+ isWin = /^win/i.test(process2.platform);
1087
+ EE = __require("events");
1088
+ if (typeof EE !== "function") {
1089
+ EE = EE.EventEmitter;
1090
+ }
1091
+ if (process2.__signal_exit_emitter__) {
1092
+ emitter = process2.__signal_exit_emitter__;
1093
+ } else {
1094
+ emitter = process2.__signal_exit_emitter__ = new EE();
1095
+ emitter.count = 0;
1096
+ emitter.emitted = {};
1097
+ }
1098
+ if (!emitter.infinite) {
1099
+ emitter.setMaxListeners(Infinity);
1100
+ emitter.infinite = true;
1101
+ }
1102
+ module.exports = function(cb, opts) {
1103
+ if (!processOk(global.process)) {
1104
+ return function() {
1105
+ };
1106
+ }
1107
+ assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
1108
+ if (loaded === false) {
1109
+ load();
1110
+ }
1111
+ var ev = "exit";
1112
+ if (opts && opts.alwaysLast) {
1113
+ ev = "afterexit";
1114
+ }
1115
+ var remove = function() {
1116
+ emitter.removeListener(ev, cb);
1117
+ if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1118
+ unload();
1119
+ }
1120
+ };
1121
+ emitter.on(ev, cb);
1122
+ return remove;
1123
+ };
1124
+ unload = function unload2() {
1125
+ if (!loaded || !processOk(global.process)) {
1126
+ return;
1127
+ }
1128
+ loaded = false;
1129
+ signals.forEach(function(sig) {
1130
+ try {
1131
+ process2.removeListener(sig, sigListeners[sig]);
1132
+ } catch (er) {
1133
+ }
1134
+ });
1135
+ process2.emit = originalProcessEmit;
1136
+ process2.reallyExit = originalProcessReallyExit;
1137
+ emitter.count -= 1;
1138
+ };
1139
+ module.exports.unload = unload;
1140
+ emit = function emit2(event, code, signal) {
1141
+ if (emitter.emitted[event]) {
1142
+ return;
1143
+ }
1144
+ emitter.emitted[event] = true;
1145
+ emitter.emit(event, code, signal);
1146
+ };
1147
+ sigListeners = {};
1148
+ signals.forEach(function(sig) {
1149
+ sigListeners[sig] = function listener() {
1150
+ if (!processOk(global.process)) {
1151
+ return;
1152
+ }
1153
+ var listeners = process2.listeners(sig);
1154
+ if (listeners.length === emitter.count) {
1155
+ unload();
1156
+ emit("exit", null, sig);
1157
+ emit("afterexit", null, sig);
1158
+ if (isWin && sig === "SIGHUP") {
1159
+ sig = "SIGINT";
1160
+ }
1161
+ process2.kill(process2.pid, sig);
1162
+ }
1163
+ };
1164
+ });
1165
+ module.exports.signals = function() {
1166
+ return signals;
1167
+ };
1168
+ loaded = false;
1169
+ load = function load2() {
1170
+ if (loaded || !processOk(global.process)) {
1171
+ return;
1172
+ }
1173
+ loaded = true;
1174
+ emitter.count += 1;
1175
+ signals = signals.filter(function(sig) {
1176
+ try {
1177
+ process2.on(sig, sigListeners[sig]);
1178
+ return true;
1179
+ } catch (er) {
1180
+ return false;
1181
+ }
1182
+ });
1183
+ process2.emit = processEmit;
1184
+ process2.reallyExit = processReallyExit;
1185
+ };
1186
+ module.exports.load = load;
1187
+ originalProcessReallyExit = process2.reallyExit;
1188
+ processReallyExit = function processReallyExit2(code) {
1189
+ if (!processOk(global.process)) {
1190
+ return;
1191
+ }
1192
+ process2.exitCode = code || /* istanbul ignore next */
1193
+ 0;
1194
+ emit("exit", process2.exitCode, null);
1195
+ emit("afterexit", process2.exitCode, null);
1196
+ originalProcessReallyExit.call(process2, process2.exitCode);
1197
+ };
1198
+ originalProcessEmit = process2.emit;
1199
+ processEmit = function processEmit2(ev, arg) {
1200
+ if (ev === "exit" && processOk(global.process)) {
1201
+ if (arg !== void 0) {
1202
+ process2.exitCode = arg;
1203
+ }
1204
+ var ret = originalProcessEmit.apply(this, arguments);
1205
+ emit("exit", process2.exitCode, null);
1206
+ emit("afterexit", process2.exitCode, null);
1207
+ return ret;
1208
+ } else {
1209
+ return originalProcessEmit.apply(this, arguments);
1210
+ }
1211
+ };
1212
+ }
1213
+ var assert;
1214
+ var signals;
1215
+ var isWin;
1216
+ var EE;
1217
+ var emitter;
1218
+ var unload;
1219
+ var emit;
1220
+ var sigListeners;
1221
+ var loaded;
1222
+ var load;
1223
+ var originalProcessReallyExit;
1224
+ var processReallyExit;
1225
+ var originalProcessEmit;
1226
+ var processEmit;
1227
+ }
1228
+ });
1229
+
1230
+ // node_modules/proper-lockfile/lib/mtime-precision.js
1231
+ var require_mtime_precision = __commonJS({
1232
+ "node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
1233
+ "use strict";
1234
+ var cacheSymbol = /* @__PURE__ */ Symbol();
1235
+ function probe(file, fs, callback) {
1236
+ const cachedPrecision = fs[cacheSymbol];
1237
+ if (cachedPrecision) {
1238
+ return fs.stat(file, (err, stat) => {
1239
+ if (err) {
1240
+ return callback(err);
1241
+ }
1242
+ callback(null, stat.mtime, cachedPrecision);
1243
+ });
1244
+ }
1245
+ const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1246
+ fs.utimes(file, mtime, mtime, (err) => {
1247
+ if (err) {
1248
+ return callback(err);
1249
+ }
1250
+ fs.stat(file, (err2, stat) => {
1251
+ if (err2) {
1252
+ return callback(err2);
1253
+ }
1254
+ const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1255
+ Object.defineProperty(fs, cacheSymbol, { value: precision });
1256
+ callback(null, stat.mtime, precision);
1257
+ });
1258
+ });
1259
+ }
1260
+ function getMtime(precision) {
1261
+ let now3 = Date.now();
1262
+ if (precision === "s") {
1263
+ now3 = Math.ceil(now3 / 1e3) * 1e3;
1264
+ }
1265
+ return new Date(now3);
1266
+ }
1267
+ module.exports.probe = probe;
1268
+ module.exports.getMtime = getMtime;
1269
+ }
1270
+ });
1271
+
1272
+ // node_modules/proper-lockfile/lib/lockfile.js
1273
+ var require_lockfile = __commonJS({
1274
+ "node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
1275
+ "use strict";
1276
+ var path3 = __require("path");
1277
+ var fs = require_graceful_fs();
1278
+ var retry = require_retry2();
1279
+ var onExit = require_signal_exit();
1280
+ var mtimePrecision = require_mtime_precision();
1281
+ var locks = {};
1282
+ function getLockFile(file, options) {
1283
+ return options.lockfilePath || `${file}.lock`;
1284
+ }
1285
+ function resolveCanonicalPath(file, options, callback) {
1286
+ if (!options.realpath) {
1287
+ return callback(null, path3.resolve(file));
1288
+ }
1289
+ options.fs.realpath(file, callback);
1290
+ }
1291
+ function acquireLock(file, options, callback) {
1292
+ const lockfilePath = getLockFile(file, options);
1293
+ options.fs.mkdir(lockfilePath, (err) => {
1294
+ if (!err) {
1295
+ return mtimePrecision.probe(lockfilePath, options.fs, (err2, mtime, mtimePrecision2) => {
1296
+ if (err2) {
1297
+ options.fs.rmdir(lockfilePath, () => {
1298
+ });
1299
+ return callback(err2);
1300
+ }
1301
+ callback(null, mtime, mtimePrecision2);
1302
+ });
1303
+ }
1304
+ if (err.code !== "EEXIST") {
1305
+ return callback(err);
1306
+ }
1307
+ if (options.stale <= 0) {
1308
+ return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
1309
+ }
1310
+ options.fs.stat(lockfilePath, (err2, stat) => {
1311
+ if (err2) {
1312
+ if (err2.code === "ENOENT") {
1313
+ return acquireLock(file, { ...options, stale: 0 }, callback);
1314
+ }
1315
+ return callback(err2);
1316
+ }
1317
+ if (!isLockStale(stat, options)) {
1318
+ return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file }));
1319
+ }
1320
+ removeLock(file, options, (err3) => {
1321
+ if (err3) {
1322
+ return callback(err3);
1323
+ }
1324
+ acquireLock(file, { ...options, stale: 0 }, callback);
1325
+ });
1326
+ });
1327
+ });
1328
+ }
1329
+ function isLockStale(stat, options) {
1330
+ return stat.mtime.getTime() < Date.now() - options.stale;
1331
+ }
1332
+ function removeLock(file, options, callback) {
1333
+ options.fs.rmdir(getLockFile(file, options), (err) => {
1334
+ if (err && err.code !== "ENOENT") {
1335
+ return callback(err);
1336
+ }
1337
+ callback();
1338
+ });
1339
+ }
1340
+ function updateLock(file, options) {
1341
+ const lock2 = locks[file];
1342
+ if (lock2.updateTimeout) {
1343
+ return;
1344
+ }
1345
+ lock2.updateDelay = lock2.updateDelay || options.update;
1346
+ lock2.updateTimeout = setTimeout(() => {
1347
+ lock2.updateTimeout = null;
1348
+ options.fs.stat(lock2.lockfilePath, (err, stat) => {
1349
+ const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
1350
+ if (err) {
1351
+ if (err.code === "ENOENT" || isOverThreshold) {
1352
+ return setLockAsCompromised(file, lock2, Object.assign(err, { code: "ECOMPROMISED" }));
1353
+ }
1354
+ lock2.updateDelay = 1e3;
1355
+ return updateLock(file, options);
1356
+ }
1357
+ const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
1358
+ if (!isMtimeOurs) {
1359
+ return setLockAsCompromised(
1360
+ file,
1361
+ lock2,
1362
+ Object.assign(
1363
+ new Error("Unable to update lock within the stale threshold"),
1364
+ { code: "ECOMPROMISED" }
1365
+ )
1366
+ );
1367
+ }
1368
+ const mtime = mtimePrecision.getMtime(lock2.mtimePrecision);
1369
+ options.fs.utimes(lock2.lockfilePath, mtime, mtime, (err2) => {
1370
+ const isOverThreshold2 = lock2.lastUpdate + options.stale < Date.now();
1371
+ if (lock2.released) {
1372
+ return;
1373
+ }
1374
+ if (err2) {
1375
+ if (err2.code === "ENOENT" || isOverThreshold2) {
1376
+ return setLockAsCompromised(file, lock2, Object.assign(err2, { code: "ECOMPROMISED" }));
1377
+ }
1378
+ lock2.updateDelay = 1e3;
1379
+ return updateLock(file, options);
1380
+ }
1381
+ lock2.mtime = mtime;
1382
+ lock2.lastUpdate = Date.now();
1383
+ lock2.updateDelay = null;
1384
+ updateLock(file, options);
1385
+ });
1386
+ });
1387
+ }, lock2.updateDelay);
1388
+ if (lock2.updateTimeout.unref) {
1389
+ lock2.updateTimeout.unref();
1390
+ }
1391
+ }
1392
+ function setLockAsCompromised(file, lock2, err) {
1393
+ lock2.released = true;
1394
+ if (lock2.updateTimeout) {
1395
+ clearTimeout(lock2.updateTimeout);
1396
+ }
1397
+ if (locks[file] === lock2) {
1398
+ delete locks[file];
1399
+ }
1400
+ lock2.options.onCompromised(err);
1401
+ }
1402
+ function lock(file, options, callback) {
1403
+ options = {
1404
+ stale: 1e4,
1405
+ update: null,
1406
+ realpath: true,
1407
+ retries: 0,
1408
+ fs,
1409
+ onCompromised: (err) => {
1410
+ throw err;
1411
+ },
1412
+ ...options
1413
+ };
1414
+ options.retries = options.retries || 0;
1415
+ options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
1416
+ options.stale = Math.max(options.stale || 0, 2e3);
1417
+ options.update = options.update == null ? options.stale / 2 : options.update || 0;
1418
+ options.update = Math.max(Math.min(options.update, options.stale / 2), 1e3);
1419
+ resolveCanonicalPath(file, options, (err, file2) => {
1420
+ if (err) {
1421
+ return callback(err);
1422
+ }
1423
+ const operation = retry.operation(options.retries);
1424
+ operation.attempt(() => {
1425
+ acquireLock(file2, options, (err2, mtime, mtimePrecision2) => {
1426
+ if (operation.retry(err2)) {
1427
+ return;
1428
+ }
1429
+ if (err2) {
1430
+ return callback(operation.mainError());
1431
+ }
1432
+ const lock2 = locks[file2] = {
1433
+ lockfilePath: getLockFile(file2, options),
1434
+ mtime,
1435
+ mtimePrecision: mtimePrecision2,
1436
+ options,
1437
+ lastUpdate: Date.now()
1438
+ };
1439
+ updateLock(file2, options);
1440
+ callback(null, (releasedCallback) => {
1441
+ if (lock2.released) {
1442
+ return releasedCallback && releasedCallback(Object.assign(new Error("Lock is already released"), { code: "ERELEASED" }));
1443
+ }
1444
+ unlock(file2, { ...options, realpath: false }, releasedCallback);
1445
+ });
1446
+ });
1447
+ });
1448
+ });
1449
+ }
1450
+ function unlock(file, options, callback) {
1451
+ options = {
1452
+ fs,
1453
+ realpath: true,
1454
+ ...options
1455
+ };
1456
+ resolveCanonicalPath(file, options, (err, file2) => {
1457
+ if (err) {
1458
+ return callback(err);
1459
+ }
1460
+ const lock2 = locks[file2];
1461
+ if (!lock2) {
1462
+ return callback(Object.assign(new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
1463
+ }
1464
+ lock2.updateTimeout && clearTimeout(lock2.updateTimeout);
1465
+ lock2.released = true;
1466
+ delete locks[file2];
1467
+ removeLock(file2, options, callback);
1468
+ });
1469
+ }
1470
+ function check(file, options, callback) {
1471
+ options = {
1472
+ stale: 1e4,
1473
+ realpath: true,
1474
+ fs,
1475
+ ...options
1476
+ };
1477
+ options.stale = Math.max(options.stale || 0, 2e3);
1478
+ resolveCanonicalPath(file, options, (err, file2) => {
1479
+ if (err) {
1480
+ return callback(err);
1481
+ }
1482
+ options.fs.stat(getLockFile(file2, options), (err2, stat) => {
1483
+ if (err2) {
1484
+ return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
1485
+ }
1486
+ return callback(null, !isLockStale(stat, options));
1487
+ });
1488
+ });
1489
+ }
1490
+ function getLocks() {
1491
+ return locks;
1492
+ }
1493
+ onExit(() => {
1494
+ for (const file in locks) {
1495
+ const options = locks[file].options;
1496
+ try {
1497
+ options.fs.rmdirSync(getLockFile(file, options));
1498
+ } catch (e) {
1499
+ }
1500
+ }
1501
+ });
1502
+ module.exports.lock = lock;
1503
+ module.exports.unlock = unlock;
1504
+ module.exports.check = check;
1505
+ module.exports.getLocks = getLocks;
1506
+ }
1507
+ });
1508
+
1509
+ // node_modules/proper-lockfile/lib/adapter.js
1510
+ var require_adapter = __commonJS({
1511
+ "node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
1512
+ "use strict";
1513
+ var fs = require_graceful_fs();
1514
+ function createSyncFs(fs2) {
1515
+ const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
1516
+ const newFs = { ...fs2 };
1517
+ methods.forEach((method) => {
1518
+ newFs[method] = (...args) => {
1519
+ const callback = args.pop();
1520
+ let ret;
1521
+ try {
1522
+ ret = fs2[`${method}Sync`](...args);
1523
+ } catch (err) {
1524
+ return callback(err);
1525
+ }
1526
+ callback(null, ret);
1527
+ };
1528
+ });
1529
+ return newFs;
1530
+ }
1531
+ function toPromise(method) {
1532
+ return (...args) => new Promise((resolve, reject) => {
1533
+ args.push((err, result) => {
1534
+ if (err) {
1535
+ reject(err);
1536
+ } else {
1537
+ resolve(result);
1538
+ }
1539
+ });
1540
+ method(...args);
1541
+ });
1542
+ }
1543
+ function toSync(method) {
1544
+ return (...args) => {
1545
+ let err;
1546
+ let result;
1547
+ args.push((_err, _result) => {
1548
+ err = _err;
1549
+ result = _result;
1550
+ });
1551
+ method(...args);
1552
+ if (err) {
1553
+ throw err;
1554
+ }
1555
+ return result;
1556
+ };
1557
+ }
1558
+ function toSyncOptions(options) {
1559
+ options = { ...options };
1560
+ options.fs = createSyncFs(options.fs || fs);
1561
+ if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
1562
+ throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
1563
+ }
1564
+ return options;
1565
+ }
1566
+ module.exports = {
1567
+ toPromise,
1568
+ toSync,
1569
+ toSyncOptions
1570
+ };
1571
+ }
1572
+ });
1573
+
1574
+ // node_modules/proper-lockfile/index.js
1575
+ var require_proper_lockfile = __commonJS({
1576
+ "node_modules/proper-lockfile/index.js"(exports, module) {
1577
+ "use strict";
1578
+ var lockfile2 = require_lockfile();
1579
+ var { toPromise, toSync, toSyncOptions } = require_adapter();
1580
+ async function lock(file, options) {
1581
+ const release = await toPromise(lockfile2.lock)(file, options);
1582
+ return toPromise(release);
1583
+ }
1584
+ function lockSync(file, options) {
1585
+ const release = toSync(lockfile2.lock)(file, toSyncOptions(options));
1586
+ return toSync(release);
1587
+ }
1588
+ function unlock(file, options) {
1589
+ return toPromise(lockfile2.unlock)(file, options);
1590
+ }
1591
+ function unlockSync(file, options) {
1592
+ return toSync(lockfile2.unlock)(file, toSyncOptions(options));
1593
+ }
1594
+ function check(file, options) {
1595
+ return toPromise(lockfile2.check)(file, options);
1596
+ }
1597
+ function checkSync(file, options) {
1598
+ return toSync(lockfile2.check)(file, toSyncOptions(options));
1599
+ }
1600
+ module.exports = lock;
1601
+ module.exports.lock = lock;
1602
+ module.exports.unlock = unlock;
1603
+ module.exports.lockSync = lockSync;
1604
+ module.exports.unlockSync = unlockSync;
1605
+ module.exports.check = check;
1606
+ module.exports.checkSync = checkSync;
1607
+ }
1608
+ });
1609
+
27
1610
  // node_modules/rbush/rbush.js
28
1611
  var require_rbush = __commonJS({
29
1612
  "node_modules/rbush/rbush.js"(exports, module) {
30
- (function(global, factory) {
31
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self, global.RBush = factory());
1613
+ (function(global2, factory) {
1614
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = global2 || self, global2.RBush = factory());
32
1615
  })(exports, function() {
33
1616
  "use strict";
34
1617
  function quickselect(arr, k, left, right, compare) {
@@ -506,8 +2089,8 @@ var require_rbush = __commonJS({
506
2089
  // node_modules/tinyqueue/tinyqueue.js
507
2090
  var require_tinyqueue = __commonJS({
508
2091
  "node_modules/tinyqueue/tinyqueue.js"(exports, module) {
509
- (function(global, factory) {
510
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self, global.TinyQueue = factory());
2092
+ (function(global2, factory) {
2093
+ typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = global2 || self, global2.TinyQueue = factory());
511
2094
  })(exports, function() {
512
2095
  "use strict";
513
2096
  var TinyQueue = function TinyQueue2(data, compare) {
@@ -2542,28 +4125,17 @@ import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js
2542
4125
  import path2 from "path";
2543
4126
  import { fileURLToPath as fileURLToPath2 } from "url";
2544
4127
 
2545
- // src/utils/fileUtils/file_writer_reader_task4.mjs
4128
+ // src/utils/fileUtils/file_writer_reader_task5.mjs
2546
4129
  import path from "path";
4130
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
2547
4131
  import { fileURLToPath } from "url";
2548
4132
  import { Vector3 as Vector36 } from "three";
2549
4133
  var __filename = fileURLToPath(import.meta.url);
2550
4134
  var __dirname = path.dirname(__filename);
2551
- var META_PATH = path.resolve(__dirname, "./data/lines.meta.json");
2552
- var DATA_PATH = path.resolve(__dirname, "./data/lines.bin");
2553
- var CHECK_BIN_PATH = path.resolve(__dirname, "./data/checks.bin");
2554
4135
 
2555
4136
  // src/utils/fileUtils/line_editor5.mjs
2556
4137
  var __filename2 = fileURLToPath2(import.meta.url);
2557
4138
  var __dirname2 = path2.dirname(__filename2);
2558
- var TMP_DATA_PATH = path2.resolve(__dirname2, "./data/lines.tmp.bin");
2559
- var TMP_CHECK_PATH = path2.resolve(__dirname2, "./data/checks.tmp.bin");
2560
- var NEW_POINTS_TMP_PATH = path2.resolve(__dirname2, "./data/lines.new_points.tmp.bin");
2561
- var NEW_POINTS_BIN_PATH = path2.resolve(__dirname2, "./data/lines.new_points.bin");
2562
- var META_PATH2 = path2.resolve(__dirname2, "./data/lines.meta.json");
2563
- var DATA_PATH2 = path2.resolve(__dirname2, "./data/lines.bin");
2564
- var CHECK_BIN_PATH2 = path2.resolve(__dirname2, "./data/checks.bin");
2565
- var EXIST_SEGMENTS_BIN_PATH = path2.resolve(__dirname2, "./data/lines.exist_segments.bin");
2566
- var EXIST_SEGMENTS_TMP_PATH = path2.resolve(__dirname2, "./data/lines.exist_segments.tmp.bin");
2567
4139
 
2568
4140
  // src/utils/fileUtils/globleMath.mjs
2569
4141
  import { Vector3 as Vector37 } from "three";
@@ -3167,16 +4739,16 @@ var removeNoisePoints = (lines, lineReader, lineEditor) => {
3167
4739
  tempLineI.originalPoints = lineReader.getOriginalPointsById(line2.id);
3168
4740
  line2.originalPoints = tempLineI.originalPoints;
3169
4741
  line2.checkResults = tempLineI.checkResults;
3170
- line2.checkResults.allCenterPoints = [];
3171
4742
  tempLineI = null;
4743
+ if (!line2.checkResults || line2.checkResults.length <= 0)
4744
+ continue;
3172
4745
  for (let a = 0; a < line2.checkResults.length; a++) {
4746
+ line2.checkResults[a].allCenterPoints = [];
3173
4747
  for (let b = 0; b < line2.checkResults[a].originalVertices.length; b++) {
3174
4748
  let center = getPointSetCentroid(line2.checkResults[a].originalVertices[b]);
3175
- line2.checkResults.allCenterPoints.push(center);
4749
+ line2.checkResults[a].allCenterPoints.push(center);
3176
4750
  }
3177
4751
  }
3178
- if (!line2.checkResults || line2.checkResults.length <= 0)
3179
- continue;
3180
4752
  if (line2.checkResults[0].originalVertices && line2.checkResults[0].originalVertices.length > 0) {
3181
4753
  const verts = line2.checkResults[0].originalVertices[0];
3182
4754
  let [pt0, pt1, pt2, pt3] = verts;
@@ -3739,7 +5311,8 @@ function getTrendLineEndpoints(points, options = {}) {
3739
5311
  }
3740
5312
 
3741
5313
  // src/geometry/beamLine.mjs
3742
- var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor) => {
5314
+ import { Line as Line2 } from "three";
5315
+ var getBeamLine = async (lines, runDataList, pcdData, lineReader, lineEditor, regionId = "") => {
3743
5316
  removeNoisePoints(lines, lineReader, lineEditor);
3744
5317
  if (lines.length <= 0 || runDataList.length <= 0)
3745
5318
  return lines;
@@ -10763,12 +12336,13 @@ var getFlatSlabData = (lines, runDataList, pointCloudCluster = null) => {
10763
12336
  if (isIntersect) {
10764
12337
  for (let b = 0; b < slabData2.points.length; b++)
10765
12338
  slabData1.points.push(slabData2.points[b]);
10766
- let pathPoints = slabData1.points.map((p) => [p.x, p.y]);
12339
+ let pathPoints = slabData1.contour;
12340
+ for (let b = 0; b < slabData2.contour.length; b++)
12341
+ pathPoints.push(slabData2.contour[b]);
10767
12342
  let path3 = computeContour(pathPoints);
10768
12343
  slabData1.contour = path3;
10769
12344
  delIndex.add(k);
10770
12345
  k = -1;
10771
- break;
10772
12346
  }
10773
12347
  }
10774
12348
  }