bililive-cli 3.22.0 → 3.22.2

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.
@@ -17,7 +17,7 @@ var path$z = require('node:path');
17
17
  var process$2 = require('node:process');
18
18
  var require$$3$1 = require('node:util');
19
19
  var EventEmitter$k = require('node:events');
20
- var fs$D = require('node:fs');
20
+ var fs$F = require('node:fs');
21
21
  var require$$0$b = require('node:stream');
22
22
  var Database = require('better-sqlite3');
23
23
  var require$$1$4 = require('http');
@@ -40,7 +40,7 @@ var require$$0$e = require('punycode');
40
40
  var canvas = require('@napi-rs/canvas');
41
41
  var require$$0$f = require('vm');
42
42
  var promises = require('node:stream/promises');
43
- var fs$E = require('fs/promises');
43
+ var fs$G = require('fs/promises');
44
44
  var require$$0$g = require('node:assert');
45
45
  var require$$1$7 = require('node:net');
46
46
  var require$$5 = require('node:querystring');
@@ -112,7 +112,7 @@ function getAugmentedNamespace(n) {
112
112
  return a;
113
113
  }
114
114
 
115
- var fs$C = {};
115
+ var fs$E = {};
116
116
 
117
117
  var universalify$1 = {};
118
118
 
@@ -636,7 +636,7 @@ function clone$2 (obj) {
636
636
  return copy
637
637
  }
638
638
 
639
- var fs$B = require$$0$6;
639
+ var fs$D = require$$0$6;
640
640
  var polyfills = polyfills$1;
641
641
  var legacy = legacyStreams;
642
642
  var clone$1 = clone_1;
@@ -678,18 +678,18 @@ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ''))
678
678
  };
679
679
 
680
680
  // Once time initialization
681
- if (!fs$B[gracefulQueue]) {
681
+ if (!fs$D[gracefulQueue]) {
682
682
  // This queue can be shared by multiple loaded instances
683
683
  var queue$2 = commonjsGlobal[gracefulQueue] || [];
684
- publishQueue(fs$B, queue$2);
684
+ publishQueue(fs$D, queue$2);
685
685
 
686
686
  // Patch fs.close/closeSync to shared queue version, because we need
687
687
  // to retry() whenever a close happens *anywhere* in the program.
688
688
  // This is essential when multiple graceful-fs instances are
689
689
  // in play at the same time.
690
- fs$B.close = (function (fs$close) {
690
+ fs$D.close = (function (fs$close) {
691
691
  function close (fd, cb) {
692
- return fs$close.call(fs$B, fd, function (err) {
692
+ return fs$close.call(fs$D, fd, function (err) {
693
693
  // This function uses the graceful-fs shared queue
694
694
  if (!err) {
695
695
  resetQueue();
@@ -704,12 +704,12 @@ if (!fs$B[gracefulQueue]) {
704
704
  value: fs$close
705
705
  });
706
706
  return close
707
- })(fs$B.close);
707
+ })(fs$D.close);
708
708
 
709
- fs$B.closeSync = (function (fs$closeSync) {
709
+ fs$D.closeSync = (function (fs$closeSync) {
710
710
  function closeSync (fd) {
711
711
  // This function uses the graceful-fs shared queue
712
- fs$closeSync.apply(fs$B, arguments);
712
+ fs$closeSync.apply(fs$D, arguments);
713
713
  resetQueue();
714
714
  }
715
715
 
@@ -717,24 +717,24 @@ if (!fs$B[gracefulQueue]) {
717
717
  value: fs$closeSync
718
718
  });
719
719
  return closeSync
720
- })(fs$B.closeSync);
720
+ })(fs$D.closeSync);
721
721
 
722
722
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) {
723
723
  process.on('exit', function() {
724
- debug$7(fs$B[gracefulQueue]);
725
- require$$0$5.equal(fs$B[gracefulQueue].length, 0);
724
+ debug$7(fs$D[gracefulQueue]);
725
+ require$$0$5.equal(fs$D[gracefulQueue].length, 0);
726
726
  });
727
727
  }
728
728
  }
729
729
 
730
730
  if (!commonjsGlobal[gracefulQueue]) {
731
- publishQueue(commonjsGlobal, fs$B[gracefulQueue]);
731
+ publishQueue(commonjsGlobal, fs$D[gracefulQueue]);
732
732
  }
733
733
 
734
- var gracefulFs = patch(clone$1(fs$B));
735
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$B.__patched) {
736
- gracefulFs = patch(fs$B);
737
- fs$B.__patched = true;
734
+ var gracefulFs = patch(clone$1(fs$D));
735
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$D.__patched) {
736
+ gracefulFs = patch(fs$D);
737
+ fs$D.__patched = true;
738
738
  }
739
739
 
740
740
  function patch (fs) {
@@ -1008,7 +1008,7 @@ function patch (fs) {
1008
1008
 
1009
1009
  function enqueue (elem) {
1010
1010
  debug$7('ENQUEUE', elem[0].name, elem[1]);
1011
- fs$B[gracefulQueue].push(elem);
1011
+ fs$D[gracefulQueue].push(elem);
1012
1012
  retry$4();
1013
1013
  }
1014
1014
 
@@ -1020,12 +1020,12 @@ var retryTimer;
1020
1020
  // delay between attempts so that we'll retry these jobs sooner
1021
1021
  function resetQueue () {
1022
1022
  var now = Date.now();
1023
- for (var i = 0; i < fs$B[gracefulQueue].length; ++i) {
1023
+ for (var i = 0; i < fs$D[gracefulQueue].length; ++i) {
1024
1024
  // entries that are only a length of 2 are from an older version, don't
1025
1025
  // bother modifying those since they'll be retried anyway.
1026
- if (fs$B[gracefulQueue][i].length > 2) {
1027
- fs$B[gracefulQueue][i][3] = now; // startTime
1028
- fs$B[gracefulQueue][i][4] = now; // lastTime
1026
+ if (fs$D[gracefulQueue][i].length > 2) {
1027
+ fs$D[gracefulQueue][i][3] = now; // startTime
1028
+ fs$D[gracefulQueue][i][4] = now; // lastTime
1029
1029
  }
1030
1030
  }
1031
1031
  // call retry to make sure we're actively processing the queue
@@ -1037,10 +1037,10 @@ function retry$4 () {
1037
1037
  clearTimeout(retryTimer);
1038
1038
  retryTimer = undefined;
1039
1039
 
1040
- if (fs$B[gracefulQueue].length === 0)
1040
+ if (fs$D[gracefulQueue].length === 0)
1041
1041
  return
1042
1042
 
1043
- var elem = fs$B[gracefulQueue].shift();
1043
+ var elem = fs$D[gracefulQueue].shift();
1044
1044
  var fn = elem[0];
1045
1045
  var args = elem[1];
1046
1046
  // these items may be unset if they were added by an older graceful-fs
@@ -1075,7 +1075,7 @@ function retry$4 () {
1075
1075
  } else {
1076
1076
  // if we can't do this job yet, push it to the end of the queue
1077
1077
  // and let the next iteration check again
1078
- fs$B[gracefulQueue].push(elem);
1078
+ fs$D[gracefulQueue].push(elem);
1079
1079
  }
1080
1080
  }
1081
1081
 
@@ -1225,7 +1225,7 @@ function retry$4 () {
1225
1225
  'Warning', 'fs-extra-WARN0003'
1226
1226
  );
1227
1227
  }
1228
- } (fs$C));
1228
+ } (fs$E));
1229
1229
 
1230
1230
  var makeDir$1 = {};
1231
1231
 
@@ -1247,7 +1247,7 @@ utils$y.checkPath = function checkPath (pth) {
1247
1247
  }
1248
1248
  };
1249
1249
 
1250
- const fs$A = fs$C;
1250
+ const fs$C = fs$E;
1251
1251
  const { checkPath } = utils$y;
1252
1252
 
1253
1253
  const getMode = options => {
@@ -1259,7 +1259,7 @@ const getMode = options => {
1259
1259
  makeDir$1.makeDir = async (dir, options) => {
1260
1260
  checkPath(dir);
1261
1261
 
1262
- return fs$A.mkdir(dir, {
1262
+ return fs$C.mkdir(dir, {
1263
1263
  mode: getMode(options),
1264
1264
  recursive: true
1265
1265
  })
@@ -1268,7 +1268,7 @@ makeDir$1.makeDir = async (dir, options) => {
1268
1268
  makeDir$1.makeDirSync = (dir, options) => {
1269
1269
  checkPath(dir);
1270
1270
 
1271
- return fs$A.mkdirSync(dir, {
1271
+ return fs$C.mkdirSync(dir, {
1272
1272
  mode: getMode(options),
1273
1273
  recursive: true
1274
1274
  })
@@ -1289,31 +1289,31 @@ var mkdirs$2 = {
1289
1289
  };
1290
1290
 
1291
1291
  const u$f = universalify$1.fromPromise;
1292
- const fs$z = fs$C;
1292
+ const fs$B = fs$E;
1293
1293
 
1294
1294
  function pathExists$7 (path) {
1295
- return fs$z.access(path).then(() => true).catch(() => false)
1295
+ return fs$B.access(path).then(() => true).catch(() => false)
1296
1296
  }
1297
1297
 
1298
1298
  var pathExists_1 = {
1299
1299
  pathExists: u$f(pathExists$7),
1300
- pathExistsSync: fs$z.existsSync
1300
+ pathExistsSync: fs$B.existsSync
1301
1301
  };
1302
1302
 
1303
- const fs$y = fs$C;
1303
+ const fs$A = fs$E;
1304
1304
  const u$e = universalify$1.fromPromise;
1305
1305
 
1306
1306
  async function utimesMillis$1 (path, atime, mtime) {
1307
1307
  // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)
1308
- const fd = await fs$y.open(path, 'r+');
1308
+ const fd = await fs$A.open(path, 'r+');
1309
1309
 
1310
1310
  let closeErr = null;
1311
1311
 
1312
1312
  try {
1313
- await fs$y.futimes(fd, atime, mtime);
1313
+ await fs$A.futimes(fd, atime, mtime);
1314
1314
  } finally {
1315
1315
  try {
1316
- await fs$y.close(fd);
1316
+ await fs$A.close(fd);
1317
1317
  } catch (e) {
1318
1318
  closeErr = e;
1319
1319
  }
@@ -1325,9 +1325,9 @@ async function utimesMillis$1 (path, atime, mtime) {
1325
1325
  }
1326
1326
 
1327
1327
  function utimesMillisSync$1 (path, atime, mtime) {
1328
- const fd = fs$y.openSync(path, 'r+');
1329
- fs$y.futimesSync(fd, atime, mtime);
1330
- return fs$y.closeSync(fd)
1328
+ const fd = fs$A.openSync(path, 'r+');
1329
+ fs$A.futimesSync(fd, atime, mtime);
1330
+ return fs$A.closeSync(fd)
1331
1331
  }
1332
1332
 
1333
1333
  var utimes = {
@@ -1335,14 +1335,14 @@ var utimes = {
1335
1335
  utimesMillisSync: utimesMillisSync$1
1336
1336
  };
1337
1337
 
1338
- const fs$x = fs$C;
1338
+ const fs$z = fs$E;
1339
1339
  const path$x = require$$0$7;
1340
1340
  const u$d = universalify$1.fromPromise;
1341
1341
 
1342
1342
  function getStats$1 (src, dest, opts) {
1343
1343
  const statFunc = opts.dereference
1344
- ? (file) => fs$x.stat(file, { bigint: true })
1345
- : (file) => fs$x.lstat(file, { bigint: true });
1344
+ ? (file) => fs$z.stat(file, { bigint: true })
1345
+ : (file) => fs$z.lstat(file, { bigint: true });
1346
1346
  return Promise.all([
1347
1347
  statFunc(src),
1348
1348
  statFunc(dest).catch(err => {
@@ -1355,8 +1355,8 @@ function getStats$1 (src, dest, opts) {
1355
1355
  function getStatsSync (src, dest, opts) {
1356
1356
  let destStat;
1357
1357
  const statFunc = opts.dereference
1358
- ? (file) => fs$x.statSync(file, { bigint: true })
1359
- : (file) => fs$x.lstatSync(file, { bigint: true });
1358
+ ? (file) => fs$z.statSync(file, { bigint: true })
1359
+ : (file) => fs$z.lstatSync(file, { bigint: true });
1360
1360
  const srcStat = statFunc(src);
1361
1361
  try {
1362
1362
  destStat = statFunc(dest);
@@ -1434,7 +1434,7 @@ async function checkParentPaths (src, srcStat, dest, funcName) {
1434
1434
 
1435
1435
  let destStat;
1436
1436
  try {
1437
- destStat = await fs$x.stat(destParent, { bigint: true });
1437
+ destStat = await fs$z.stat(destParent, { bigint: true });
1438
1438
  } catch (err) {
1439
1439
  if (err.code === 'ENOENT') return
1440
1440
  throw err
@@ -1453,7 +1453,7 @@ function checkParentPathsSync (src, srcStat, dest, funcName) {
1453
1453
  if (destParent === srcParent || destParent === path$x.parse(destParent).root) return
1454
1454
  let destStat;
1455
1455
  try {
1456
- destStat = fs$x.statSync(destParent, { bigint: true });
1456
+ destStat = fs$z.statSync(destParent, { bigint: true });
1457
1457
  } catch (err) {
1458
1458
  if (err.code === 'ENOENT') return
1459
1459
  throw err
@@ -1492,7 +1492,7 @@ var stat$5 = {
1492
1492
  areIdentical: areIdentical$2
1493
1493
  };
1494
1494
 
1495
- const fs$w = fs$C;
1495
+ const fs$y = fs$E;
1496
1496
  const path$w = require$$0$7;
1497
1497
  const { mkdirs: mkdirs$1 } = mkdirs$2;
1498
1498
  const { pathExists: pathExists$6 } = pathExists_1;
@@ -1540,7 +1540,7 @@ async function runFilter (src, dest, opts) {
1540
1540
  }
1541
1541
 
1542
1542
  async function getStatsAndPerformCopy (destStat, src, dest, opts) {
1543
- const statFn = opts.dereference ? fs$w.stat : fs$w.lstat;
1543
+ const statFn = opts.dereference ? fs$y.stat : fs$y.lstat;
1544
1544
  const srcStat = await statFn(src);
1545
1545
 
1546
1546
  if (srcStat.isDirectory()) return onDir$1(srcStat, destStat, src, dest, opts)
@@ -1561,7 +1561,7 @@ async function onFile$1 (srcStat, destStat, src, dest, opts) {
1561
1561
  if (!destStat) return copyFile$1(srcStat, src, dest, opts)
1562
1562
 
1563
1563
  if (opts.overwrite) {
1564
- await fs$w.unlink(dest);
1564
+ await fs$y.unlink(dest);
1565
1565
  return copyFile$1(srcStat, src, dest, opts)
1566
1566
  }
1567
1567
  if (opts.errorOnExist) {
@@ -1570,7 +1570,7 @@ async function onFile$1 (srcStat, destStat, src, dest, opts) {
1570
1570
  }
1571
1571
 
1572
1572
  async function copyFile$1 (srcStat, src, dest, opts) {
1573
- await fs$w.copyFile(src, dest);
1573
+ await fs$y.copyFile(src, dest);
1574
1574
  if (opts.preserveTimestamps) {
1575
1575
  // Make sure the file is writable before setting the timestamp
1576
1576
  // otherwise open fails with EPERM when invoked with 'r+'
@@ -1584,11 +1584,11 @@ async function copyFile$1 (srcStat, src, dest, opts) {
1584
1584
  // Note that The initial srcStat.atime cannot be trusted
1585
1585
  // because it is modified by the read(2) system call
1586
1586
  // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
1587
- const updatedSrcStat = await fs$w.stat(src);
1587
+ const updatedSrcStat = await fs$y.stat(src);
1588
1588
  await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1589
1589
  }
1590
1590
 
1591
- return fs$w.chmod(dest, srcStat.mode)
1591
+ return fs$y.chmod(dest, srcStat.mode)
1592
1592
  }
1593
1593
 
1594
1594
  function fileIsNotWritable$1 (srcMode) {
@@ -1596,16 +1596,16 @@ function fileIsNotWritable$1 (srcMode) {
1596
1596
  }
1597
1597
 
1598
1598
  function makeFileWritable$1 (dest, srcMode) {
1599
- return fs$w.chmod(dest, srcMode | 0o200)
1599
+ return fs$y.chmod(dest, srcMode | 0o200)
1600
1600
  }
1601
1601
 
1602
1602
  async function onDir$1 (srcStat, destStat, src, dest, opts) {
1603
1603
  // the dest directory might not exist, create it
1604
1604
  if (!destStat) {
1605
- await fs$w.mkdir(dest);
1605
+ await fs$y.mkdir(dest);
1606
1606
  }
1607
1607
 
1608
- const items = await fs$w.readdir(src);
1608
+ const items = await fs$y.readdir(src);
1609
1609
 
1610
1610
  // loop through the files in the current directory to copy everything
1611
1611
  await Promise.all(items.map(async item => {
@@ -1624,27 +1624,27 @@ async function onDir$1 (srcStat, destStat, src, dest, opts) {
1624
1624
  }));
1625
1625
 
1626
1626
  if (!destStat) {
1627
- await fs$w.chmod(dest, srcStat.mode);
1627
+ await fs$y.chmod(dest, srcStat.mode);
1628
1628
  }
1629
1629
  }
1630
1630
 
1631
1631
  async function onLink$1 (destStat, src, dest, opts) {
1632
- let resolvedSrc = await fs$w.readlink(src);
1632
+ let resolvedSrc = await fs$y.readlink(src);
1633
1633
  if (opts.dereference) {
1634
1634
  resolvedSrc = path$w.resolve(process.cwd(), resolvedSrc);
1635
1635
  }
1636
1636
  if (!destStat) {
1637
- return fs$w.symlink(resolvedSrc, dest)
1637
+ return fs$y.symlink(resolvedSrc, dest)
1638
1638
  }
1639
1639
 
1640
1640
  let resolvedDest = null;
1641
1641
  try {
1642
- resolvedDest = await fs$w.readlink(dest);
1642
+ resolvedDest = await fs$y.readlink(dest);
1643
1643
  } catch (e) {
1644
1644
  // dest exists and is a regular file or directory,
1645
1645
  // Windows may throw UNKNOWN error. If dest already exists,
1646
1646
  // fs throws error anyway, so no need to guard against it here.
1647
- if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs$w.symlink(resolvedSrc, dest)
1647
+ if (e.code === 'EINVAL' || e.code === 'UNKNOWN') return fs$y.symlink(resolvedSrc, dest)
1648
1648
  throw e
1649
1649
  }
1650
1650
  if (opts.dereference) {
@@ -1662,13 +1662,13 @@ async function onLink$1 (destStat, src, dest, opts) {
1662
1662
  }
1663
1663
 
1664
1664
  // copy the link
1665
- await fs$w.unlink(dest);
1666
- return fs$w.symlink(resolvedSrc, dest)
1665
+ await fs$y.unlink(dest);
1666
+ return fs$y.symlink(resolvedSrc, dest)
1667
1667
  }
1668
1668
 
1669
1669
  var copy_1 = copy$2;
1670
1670
 
1671
- const fs$v = gracefulFs;
1671
+ const fs$x = gracefulFs;
1672
1672
  const path$v = require$$0$7;
1673
1673
  const mkdirsSync$1 = mkdirs$2.mkdirsSync;
1674
1674
  const utimesMillisSync = utimes.utimesMillisSync;
@@ -1696,12 +1696,12 @@ function copySync$1 (src, dest, opts) {
1696
1696
  stat$3.checkParentPathsSync(src, srcStat, dest, 'copy');
1697
1697
  if (opts.filter && !opts.filter(src, dest)) return
1698
1698
  const destParent = path$v.dirname(dest);
1699
- if (!fs$v.existsSync(destParent)) mkdirsSync$1(destParent);
1699
+ if (!fs$x.existsSync(destParent)) mkdirsSync$1(destParent);
1700
1700
  return getStats(destStat, src, dest, opts)
1701
1701
  }
1702
1702
 
1703
1703
  function getStats (destStat, src, dest, opts) {
1704
- const statSync = opts.dereference ? fs$v.statSync : fs$v.lstatSync;
1704
+ const statSync = opts.dereference ? fs$x.statSync : fs$x.lstatSync;
1705
1705
  const srcStat = statSync(src);
1706
1706
 
1707
1707
  if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
@@ -1721,7 +1721,7 @@ function onFile (srcStat, destStat, src, dest, opts) {
1721
1721
 
1722
1722
  function mayCopyFile (srcStat, src, dest, opts) {
1723
1723
  if (opts.overwrite) {
1724
- fs$v.unlinkSync(dest);
1724
+ fs$x.unlinkSync(dest);
1725
1725
  return copyFile(srcStat, src, dest, opts)
1726
1726
  } else if (opts.errorOnExist) {
1727
1727
  throw new Error(`'${dest}' already exists`)
@@ -1729,7 +1729,7 @@ function mayCopyFile (srcStat, src, dest, opts) {
1729
1729
  }
1730
1730
 
1731
1731
  function copyFile (srcStat, src, dest, opts) {
1732
- fs$v.copyFileSync(src, dest);
1732
+ fs$x.copyFileSync(src, dest);
1733
1733
  if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
1734
1734
  return setDestMode(dest, srcStat.mode)
1735
1735
  }
@@ -1751,14 +1751,14 @@ function makeFileWritable (dest, srcMode) {
1751
1751
  }
1752
1752
 
1753
1753
  function setDestMode (dest, srcMode) {
1754
- return fs$v.chmodSync(dest, srcMode)
1754
+ return fs$x.chmodSync(dest, srcMode)
1755
1755
  }
1756
1756
 
1757
1757
  function setDestTimestamps (src, dest) {
1758
1758
  // The initial srcStat.atime cannot be trusted
1759
1759
  // because it is modified by the read(2) system call
1760
1760
  // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
1761
- const updatedSrcStat = fs$v.statSync(src);
1761
+ const updatedSrcStat = fs$x.statSync(src);
1762
1762
  return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
1763
1763
  }
1764
1764
 
@@ -1768,13 +1768,13 @@ function onDir (srcStat, destStat, src, dest, opts) {
1768
1768
  }
1769
1769
 
1770
1770
  function mkDirAndCopy (srcMode, src, dest, opts) {
1771
- fs$v.mkdirSync(dest);
1771
+ fs$x.mkdirSync(dest);
1772
1772
  copyDir(src, dest, opts);
1773
1773
  return setDestMode(dest, srcMode)
1774
1774
  }
1775
1775
 
1776
1776
  function copyDir (src, dest, opts) {
1777
- fs$v.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts));
1777
+ fs$x.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts));
1778
1778
  }
1779
1779
 
1780
1780
  function copyDirItem (item, src, dest, opts) {
@@ -1786,22 +1786,22 @@ function copyDirItem (item, src, dest, opts) {
1786
1786
  }
1787
1787
 
1788
1788
  function onLink (destStat, src, dest, opts) {
1789
- let resolvedSrc = fs$v.readlinkSync(src);
1789
+ let resolvedSrc = fs$x.readlinkSync(src);
1790
1790
  if (opts.dereference) {
1791
1791
  resolvedSrc = path$v.resolve(process.cwd(), resolvedSrc);
1792
1792
  }
1793
1793
 
1794
1794
  if (!destStat) {
1795
- return fs$v.symlinkSync(resolvedSrc, dest)
1795
+ return fs$x.symlinkSync(resolvedSrc, dest)
1796
1796
  } else {
1797
1797
  let resolvedDest;
1798
1798
  try {
1799
- resolvedDest = fs$v.readlinkSync(dest);
1799
+ resolvedDest = fs$x.readlinkSync(dest);
1800
1800
  } catch (err) {
1801
1801
  // dest exists and is a regular file or directory,
1802
1802
  // Windows may throw UNKNOWN error. If dest already exists,
1803
1803
  // fs throws error anyway, so no need to guard against it here.
1804
- if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$v.symlinkSync(resolvedSrc, dest)
1804
+ if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs$x.symlinkSync(resolvedSrc, dest)
1805
1805
  throw err
1806
1806
  }
1807
1807
  if (opts.dereference) {
@@ -1822,8 +1822,8 @@ function onLink (destStat, src, dest, opts) {
1822
1822
  }
1823
1823
 
1824
1824
  function copyLink (resolvedSrc, dest) {
1825
- fs$v.unlinkSync(dest);
1826
- return fs$v.symlinkSync(resolvedSrc, dest)
1825
+ fs$x.unlinkSync(dest);
1826
+ return fs$x.symlinkSync(resolvedSrc, dest)
1827
1827
  }
1828
1828
 
1829
1829
  var copySync_1 = copySync$1;
@@ -1834,15 +1834,15 @@ var copy$1 = {
1834
1834
  copySync: copySync_1
1835
1835
  };
1836
1836
 
1837
- const fs$u = gracefulFs;
1837
+ const fs$w = gracefulFs;
1838
1838
  const u$b = universalify$1.fromCallback;
1839
1839
 
1840
1840
  function remove$3 (path, callback) {
1841
- fs$u.rm(path, { recursive: true, force: true }, callback);
1841
+ fs$w.rm(path, { recursive: true, force: true }, callback);
1842
1842
  }
1843
1843
 
1844
1844
  function removeSync$1 (path) {
1845
- fs$u.rmSync(path, { recursive: true, force: true });
1845
+ fs$w.rmSync(path, { recursive: true, force: true });
1846
1846
  }
1847
1847
 
1848
1848
  var remove_1 = {
@@ -1851,7 +1851,7 @@ var remove_1 = {
1851
1851
  };
1852
1852
 
1853
1853
  const u$a = universalify$1.fromPromise;
1854
- const fs$t = fs$C;
1854
+ const fs$v = fs$E;
1855
1855
  const path$u = require$$0$7;
1856
1856
  const mkdir$4 = mkdirs$2;
1857
1857
  const remove$2 = remove_1;
@@ -1859,7 +1859,7 @@ const remove$2 = remove_1;
1859
1859
  const emptyDir = u$a(async function emptyDir (dir) {
1860
1860
  let items;
1861
1861
  try {
1862
- items = await fs$t.readdir(dir);
1862
+ items = await fs$v.readdir(dir);
1863
1863
  } catch {
1864
1864
  return mkdir$4.mkdirs(dir)
1865
1865
  }
@@ -1870,7 +1870,7 @@ const emptyDir = u$a(async function emptyDir (dir) {
1870
1870
  function emptyDirSync (dir) {
1871
1871
  let items;
1872
1872
  try {
1873
- items = fs$t.readdirSync(dir);
1873
+ items = fs$v.readdirSync(dir);
1874
1874
  } catch {
1875
1875
  return mkdir$4.mkdirsSync(dir)
1876
1876
  }
@@ -1890,13 +1890,13 @@ var empty = {
1890
1890
 
1891
1891
  const u$9 = universalify$1.fromPromise;
1892
1892
  const path$t = require$$0$7;
1893
- const fs$s = fs$C;
1893
+ const fs$u = fs$E;
1894
1894
  const mkdir$3 = mkdirs$2;
1895
1895
 
1896
1896
  async function createFile$1 (file) {
1897
1897
  let stats;
1898
1898
  try {
1899
- stats = await fs$s.stat(file);
1899
+ stats = await fs$u.stat(file);
1900
1900
  } catch { }
1901
1901
  if (stats && stats.isFile()) return
1902
1902
 
@@ -1904,12 +1904,12 @@ async function createFile$1 (file) {
1904
1904
 
1905
1905
  let dirStats = null;
1906
1906
  try {
1907
- dirStats = await fs$s.stat(dir);
1907
+ dirStats = await fs$u.stat(dir);
1908
1908
  } catch (err) {
1909
1909
  // if the directory doesn't exist, make it
1910
1910
  if (err.code === 'ENOENT') {
1911
1911
  await mkdir$3.mkdirs(dir);
1912
- await fs$s.writeFile(file, '');
1912
+ await fs$u.writeFile(file, '');
1913
1913
  return
1914
1914
  } else {
1915
1915
  throw err
@@ -1917,27 +1917,27 @@ async function createFile$1 (file) {
1917
1917
  }
1918
1918
 
1919
1919
  if (dirStats.isDirectory()) {
1920
- await fs$s.writeFile(file, '');
1920
+ await fs$u.writeFile(file, '');
1921
1921
  } else {
1922
1922
  // parent is not a directory
1923
1923
  // This is just to cause an internal ENOTDIR error to be thrown
1924
- await fs$s.readdir(dir);
1924
+ await fs$u.readdir(dir);
1925
1925
  }
1926
1926
  }
1927
1927
 
1928
1928
  function createFileSync$1 (file) {
1929
1929
  let stats;
1930
1930
  try {
1931
- stats = fs$s.statSync(file);
1931
+ stats = fs$u.statSync(file);
1932
1932
  } catch { }
1933
1933
  if (stats && stats.isFile()) return
1934
1934
 
1935
1935
  const dir = path$t.dirname(file);
1936
1936
  try {
1937
- if (!fs$s.statSync(dir).isDirectory()) {
1937
+ if (!fs$u.statSync(dir).isDirectory()) {
1938
1938
  // parent is not a directory
1939
1939
  // This is just to cause an internal ENOTDIR error to be thrown
1940
- fs$s.readdirSync(dir);
1940
+ fs$u.readdirSync(dir);
1941
1941
  }
1942
1942
  } catch (err) {
1943
1943
  // If the stat call above failed because the directory doesn't exist, create it
@@ -1945,7 +1945,7 @@ function createFileSync$1 (file) {
1945
1945
  else throw err
1946
1946
  }
1947
1947
 
1948
- fs$s.writeFileSync(file, '');
1948
+ fs$u.writeFileSync(file, '');
1949
1949
  }
1950
1950
 
1951
1951
  var file$1 = {
@@ -1955,7 +1955,7 @@ var file$1 = {
1955
1955
 
1956
1956
  const u$8 = universalify$1.fromPromise;
1957
1957
  const path$s = require$$0$7;
1958
- const fs$r = fs$C;
1958
+ const fs$t = fs$E;
1959
1959
  const mkdir$2 = mkdirs$2;
1960
1960
  const { pathExists: pathExists$5 } = pathExists_1;
1961
1961
  const { areIdentical: areIdentical$1 } = stat$5;
@@ -1963,14 +1963,14 @@ const { areIdentical: areIdentical$1 } = stat$5;
1963
1963
  async function createLink$1 (srcpath, dstpath) {
1964
1964
  let dstStat;
1965
1965
  try {
1966
- dstStat = await fs$r.lstat(dstpath);
1966
+ dstStat = await fs$t.lstat(dstpath);
1967
1967
  } catch {
1968
1968
  // ignore error
1969
1969
  }
1970
1970
 
1971
1971
  let srcStat;
1972
1972
  try {
1973
- srcStat = await fs$r.lstat(srcpath);
1973
+ srcStat = await fs$t.lstat(srcpath);
1974
1974
  } catch (err) {
1975
1975
  err.message = err.message.replace('lstat', 'ensureLink');
1976
1976
  throw err
@@ -1986,17 +1986,17 @@ async function createLink$1 (srcpath, dstpath) {
1986
1986
  await mkdir$2.mkdirs(dir);
1987
1987
  }
1988
1988
 
1989
- await fs$r.link(srcpath, dstpath);
1989
+ await fs$t.link(srcpath, dstpath);
1990
1990
  }
1991
1991
 
1992
1992
  function createLinkSync$1 (srcpath, dstpath) {
1993
1993
  let dstStat;
1994
1994
  try {
1995
- dstStat = fs$r.lstatSync(dstpath);
1995
+ dstStat = fs$t.lstatSync(dstpath);
1996
1996
  } catch {}
1997
1997
 
1998
1998
  try {
1999
- const srcStat = fs$r.lstatSync(srcpath);
1999
+ const srcStat = fs$t.lstatSync(srcpath);
2000
2000
  if (dstStat && areIdentical$1(srcStat, dstStat)) return
2001
2001
  } catch (err) {
2002
2002
  err.message = err.message.replace('lstat', 'ensureLink');
@@ -2004,11 +2004,11 @@ function createLinkSync$1 (srcpath, dstpath) {
2004
2004
  }
2005
2005
 
2006
2006
  const dir = path$s.dirname(dstpath);
2007
- const dirExists = fs$r.existsSync(dir);
2008
- if (dirExists) return fs$r.linkSync(srcpath, dstpath)
2007
+ const dirExists = fs$t.existsSync(dir);
2008
+ if (dirExists) return fs$t.linkSync(srcpath, dstpath)
2009
2009
  mkdir$2.mkdirsSync(dir);
2010
2010
 
2011
- return fs$r.linkSync(srcpath, dstpath)
2011
+ return fs$t.linkSync(srcpath, dstpath)
2012
2012
  }
2013
2013
 
2014
2014
  var link = {
@@ -2017,7 +2017,7 @@ var link = {
2017
2017
  };
2018
2018
 
2019
2019
  const path$r = require$$0$7;
2020
- const fs$q = fs$C;
2020
+ const fs$s = fs$E;
2021
2021
  const { pathExists: pathExists$4 } = pathExists_1;
2022
2022
 
2023
2023
  const u$7 = universalify$1.fromPromise;
@@ -2047,7 +2047,7 @@ const u$7 = universalify$1.fromPromise;
2047
2047
  async function symlinkPaths$1 (srcpath, dstpath) {
2048
2048
  if (path$r.isAbsolute(srcpath)) {
2049
2049
  try {
2050
- await fs$q.lstat(srcpath);
2050
+ await fs$s.lstat(srcpath);
2051
2051
  } catch (err) {
2052
2052
  err.message = err.message.replace('lstat', 'ensureSymlink');
2053
2053
  throw err
@@ -2071,7 +2071,7 @@ async function symlinkPaths$1 (srcpath, dstpath) {
2071
2071
  }
2072
2072
 
2073
2073
  try {
2074
- await fs$q.lstat(srcpath);
2074
+ await fs$s.lstat(srcpath);
2075
2075
  } catch (err) {
2076
2076
  err.message = err.message.replace('lstat', 'ensureSymlink');
2077
2077
  throw err
@@ -2085,7 +2085,7 @@ async function symlinkPaths$1 (srcpath, dstpath) {
2085
2085
 
2086
2086
  function symlinkPathsSync$1 (srcpath, dstpath) {
2087
2087
  if (path$r.isAbsolute(srcpath)) {
2088
- const exists = fs$q.existsSync(srcpath);
2088
+ const exists = fs$s.existsSync(srcpath);
2089
2089
  if (!exists) throw new Error('absolute srcpath does not exist')
2090
2090
  return {
2091
2091
  toCwd: srcpath,
@@ -2095,7 +2095,7 @@ function symlinkPathsSync$1 (srcpath, dstpath) {
2095
2095
 
2096
2096
  const dstdir = path$r.dirname(dstpath);
2097
2097
  const relativeToDst = path$r.join(dstdir, srcpath);
2098
- const exists = fs$q.existsSync(relativeToDst);
2098
+ const exists = fs$s.existsSync(relativeToDst);
2099
2099
  if (exists) {
2100
2100
  return {
2101
2101
  toCwd: relativeToDst,
@@ -2103,7 +2103,7 @@ function symlinkPathsSync$1 (srcpath, dstpath) {
2103
2103
  }
2104
2104
  }
2105
2105
 
2106
- const srcExists = fs$q.existsSync(srcpath);
2106
+ const srcExists = fs$s.existsSync(srcpath);
2107
2107
  if (!srcExists) throw new Error('relative srcpath does not exist')
2108
2108
  return {
2109
2109
  toCwd: srcpath,
@@ -2116,7 +2116,7 @@ var symlinkPaths_1 = {
2116
2116
  symlinkPathsSync: symlinkPathsSync$1
2117
2117
  };
2118
2118
 
2119
- const fs$p = fs$C;
2119
+ const fs$r = fs$E;
2120
2120
  const u$6 = universalify$1.fromPromise;
2121
2121
 
2122
2122
  async function symlinkType$1 (srcpath, type) {
@@ -2124,7 +2124,7 @@ async function symlinkType$1 (srcpath, type) {
2124
2124
 
2125
2125
  let stats;
2126
2126
  try {
2127
- stats = await fs$p.lstat(srcpath);
2127
+ stats = await fs$r.lstat(srcpath);
2128
2128
  } catch {
2129
2129
  return 'file'
2130
2130
  }
@@ -2137,7 +2137,7 @@ function symlinkTypeSync$1 (srcpath, type) {
2137
2137
 
2138
2138
  let stats;
2139
2139
  try {
2140
- stats = fs$p.lstatSync(srcpath);
2140
+ stats = fs$r.lstatSync(srcpath);
2141
2141
  } catch {
2142
2142
  return 'file'
2143
2143
  }
@@ -2151,7 +2151,7 @@ var symlinkType_1 = {
2151
2151
 
2152
2152
  const u$5 = universalify$1.fromPromise;
2153
2153
  const path$q = require$$0$7;
2154
- const fs$o = fs$C;
2154
+ const fs$q = fs$E;
2155
2155
 
2156
2156
  const { mkdirs, mkdirsSync } = mkdirs$2;
2157
2157
 
@@ -2165,13 +2165,13 @@ const { areIdentical } = stat$5;
2165
2165
  async function createSymlink$1 (srcpath, dstpath, type) {
2166
2166
  let stats;
2167
2167
  try {
2168
- stats = await fs$o.lstat(dstpath);
2168
+ stats = await fs$q.lstat(dstpath);
2169
2169
  } catch { }
2170
2170
 
2171
2171
  if (stats && stats.isSymbolicLink()) {
2172
2172
  const [srcStat, dstStat] = await Promise.all([
2173
- fs$o.stat(srcpath),
2174
- fs$o.stat(dstpath)
2173
+ fs$q.stat(srcpath),
2174
+ fs$q.stat(dstpath)
2175
2175
  ]);
2176
2176
 
2177
2177
  if (areIdentical(srcStat, dstStat)) return
@@ -2186,17 +2186,17 @@ async function createSymlink$1 (srcpath, dstpath, type) {
2186
2186
  await mkdirs(dir);
2187
2187
  }
2188
2188
 
2189
- return fs$o.symlink(srcpath, dstpath, toType)
2189
+ return fs$q.symlink(srcpath, dstpath, toType)
2190
2190
  }
2191
2191
 
2192
2192
  function createSymlinkSync$1 (srcpath, dstpath, type) {
2193
2193
  let stats;
2194
2194
  try {
2195
- stats = fs$o.lstatSync(dstpath);
2195
+ stats = fs$q.lstatSync(dstpath);
2196
2196
  } catch { }
2197
2197
  if (stats && stats.isSymbolicLink()) {
2198
- const srcStat = fs$o.statSync(srcpath);
2199
- const dstStat = fs$o.statSync(dstpath);
2198
+ const srcStat = fs$q.statSync(srcpath);
2199
+ const dstStat = fs$q.statSync(dstpath);
2200
2200
  if (areIdentical(srcStat, dstStat)) return
2201
2201
  }
2202
2202
 
@@ -2204,10 +2204,10 @@ function createSymlinkSync$1 (srcpath, dstpath, type) {
2204
2204
  srcpath = relative.toDst;
2205
2205
  type = symlinkTypeSync(relative.toCwd, type);
2206
2206
  const dir = path$q.dirname(dstpath);
2207
- const exists = fs$o.existsSync(dir);
2208
- if (exists) return fs$o.symlinkSync(srcpath, dstpath, type)
2207
+ const exists = fs$q.existsSync(dir);
2208
+ if (exists) return fs$q.symlinkSync(srcpath, dstpath, type)
2209
2209
  mkdirsSync(dir);
2210
- return fs$o.symlinkSync(srcpath, dstpath, type)
2210
+ return fs$q.symlinkSync(srcpath, dstpath, type)
2211
2211
  }
2212
2212
 
2213
2213
  var symlink = {
@@ -2352,7 +2352,7 @@ var jsonfile = {
2352
2352
  };
2353
2353
 
2354
2354
  const u$4 = universalify$1.fromPromise;
2355
- const fs$n = fs$C;
2355
+ const fs$p = fs$E;
2356
2356
  const path$p = require$$0$7;
2357
2357
  const mkdir$1 = mkdirs$2;
2358
2358
  const pathExists$2 = pathExists_1.pathExists;
@@ -2364,16 +2364,16 @@ async function outputFile$1 (file, data, encoding = 'utf-8') {
2364
2364
  await mkdir$1.mkdirs(dir);
2365
2365
  }
2366
2366
 
2367
- return fs$n.writeFile(file, data, encoding)
2367
+ return fs$p.writeFile(file, data, encoding)
2368
2368
  }
2369
2369
 
2370
2370
  function outputFileSync$1 (file, ...args) {
2371
2371
  const dir = path$p.dirname(file);
2372
- if (!fs$n.existsSync(dir)) {
2372
+ if (!fs$p.existsSync(dir)) {
2373
2373
  mkdir$1.mkdirsSync(dir);
2374
2374
  }
2375
2375
 
2376
- fs$n.writeFileSync(file, ...args);
2376
+ fs$p.writeFileSync(file, ...args);
2377
2377
  }
2378
2378
 
2379
2379
  var outputFile_1 = {
@@ -2418,7 +2418,7 @@ jsonFile.readJSONSync = jsonFile.readJsonSync;
2418
2418
 
2419
2419
  var json$3 = jsonFile;
2420
2420
 
2421
- const fs$m = fs$C;
2421
+ const fs$o = fs$E;
2422
2422
  const path$o = require$$0$7;
2423
2423
  const { copy } = copy$1;
2424
2424
  const { remove: remove$1 } = remove_1;
@@ -2454,7 +2454,7 @@ async function doRename$1 (src, dest, overwrite, isChangingCase) {
2454
2454
 
2455
2455
  try {
2456
2456
  // Try w/ rename first, and try copy + remove if EXDEV
2457
- await fs$m.rename(src, dest);
2457
+ await fs$o.rename(src, dest);
2458
2458
  } catch (err) {
2459
2459
  if (err.code !== 'EXDEV') {
2460
2460
  throw err
@@ -2476,7 +2476,7 @@ async function moveAcrossDevice$1 (src, dest, overwrite) {
2476
2476
 
2477
2477
  var move_1 = move$1;
2478
2478
 
2479
- const fs$l = gracefulFs;
2479
+ const fs$n = gracefulFs;
2480
2480
  const path$n = require$$0$7;
2481
2481
  const copySync = copy$1.copySync;
2482
2482
  const removeSync = remove_1.removeSync;
@@ -2505,13 +2505,13 @@ function doRename (src, dest, overwrite, isChangingCase) {
2505
2505
  removeSync(dest);
2506
2506
  return rename(src, dest, overwrite)
2507
2507
  }
2508
- if (fs$l.existsSync(dest)) throw new Error('dest already exists.')
2508
+ if (fs$n.existsSync(dest)) throw new Error('dest already exists.')
2509
2509
  return rename(src, dest, overwrite)
2510
2510
  }
2511
2511
 
2512
2512
  function rename (src, dest, overwrite) {
2513
2513
  try {
2514
- fs$l.renameSync(src, dest);
2514
+ fs$n.renameSync(src, dest);
2515
2515
  } catch (err) {
2516
2516
  if (err.code !== 'EXDEV') throw err
2517
2517
  return moveAcrossDevice(src, dest, overwrite)
@@ -2538,7 +2538,7 @@ var move = {
2538
2538
 
2539
2539
  var lib$3 = {
2540
2540
  // Export promiseified graceful-fs:
2541
- ...fs$C,
2541
+ ...fs$E,
2542
2542
  // Export extra methods:
2543
2543
  ...copy$1,
2544
2544
  ...empty,
@@ -2551,7 +2551,7 @@ var lib$3 = {
2551
2551
  ...remove_1
2552
2552
  };
2553
2553
 
2554
- var fs$k = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
2554
+ var fs$m = /*@__PURE__*/getDefaultExportFromCjs(lib$3);
2555
2555
 
2556
2556
  var tasks = {};
2557
2557
 
@@ -2590,10 +2590,10 @@ function isEnoentCodeError(error) {
2590
2590
  }
2591
2591
  errno$1.isEnoentCodeError = isEnoentCodeError;
2592
2592
 
2593
- var fs$j = {};
2593
+ var fs$l = {};
2594
2594
 
2595
- Object.defineProperty(fs$j, "__esModule", { value: true });
2596
- fs$j.createDirentFromStats = void 0;
2595
+ Object.defineProperty(fs$l, "__esModule", { value: true });
2596
+ fs$l.createDirentFromStats = void 0;
2597
2597
  let DirentFromStats$1 = class DirentFromStats {
2598
2598
  constructor(name, stats) {
2599
2599
  this.name = name;
@@ -2609,7 +2609,7 @@ let DirentFromStats$1 = class DirentFromStats {
2609
2609
  function createDirentFromStats$1(name, stats) {
2610
2610
  return new DirentFromStats$1(name, stats);
2611
2611
  }
2612
- fs$j.createDirentFromStats = createDirentFromStats$1;
2612
+ fs$l.createDirentFromStats = createDirentFromStats$1;
2613
2613
 
2614
2614
  var path$m = {};
2615
2615
 
@@ -7241,8 +7241,8 @@ const array = array$1;
7241
7241
  utils$w.array = array;
7242
7242
  const errno = errno$1;
7243
7243
  utils$w.errno = errno;
7244
- const fs$i = fs$j;
7245
- utils$w.fs = fs$i;
7244
+ const fs$k = fs$l;
7245
+ utils$w.fs = fs$k;
7246
7246
  const path$h = path$m;
7247
7247
  utils$w.path = path$h;
7248
7248
  const pattern = pattern$1;
@@ -7443,7 +7443,7 @@ sync$9.read = read$2;
7443
7443
 
7444
7444
  var settings$3 = {};
7445
7445
 
7446
- var fs$h = {};
7446
+ var fs$j = {};
7447
7447
 
7448
7448
  (function (exports) {
7449
7449
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -7462,15 +7462,15 @@ var fs$h = {};
7462
7462
  return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
7463
7463
  }
7464
7464
  exports.createFileSystemAdapter = createFileSystemAdapter;
7465
- } (fs$h));
7465
+ } (fs$j));
7466
7466
 
7467
7467
  Object.defineProperty(settings$3, "__esModule", { value: true });
7468
- const fs$g = fs$h;
7468
+ const fs$i = fs$j;
7469
7469
  let Settings$2 = class Settings {
7470
7470
  constructor(_options = {}) {
7471
7471
  this._options = _options;
7472
7472
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
7473
- this.fs = fs$g.createFileSystemAdapter(this._options.fs);
7473
+ this.fs = fs$i.createFileSystemAdapter(this._options.fs);
7474
7474
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
7475
7475
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
7476
7476
  }
@@ -7591,10 +7591,10 @@ constants$h.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCH
7591
7591
 
7592
7592
  var utils$l = {};
7593
7593
 
7594
- var fs$f = {};
7594
+ var fs$h = {};
7595
7595
 
7596
- Object.defineProperty(fs$f, "__esModule", { value: true });
7597
- fs$f.createDirentFromStats = void 0;
7596
+ Object.defineProperty(fs$h, "__esModule", { value: true });
7597
+ fs$h.createDirentFromStats = void 0;
7598
7598
  class DirentFromStats {
7599
7599
  constructor(name, stats) {
7600
7600
  this.name = name;
@@ -7610,12 +7610,12 @@ class DirentFromStats {
7610
7610
  function createDirentFromStats(name, stats) {
7611
7611
  return new DirentFromStats(name, stats);
7612
7612
  }
7613
- fs$f.createDirentFromStats = createDirentFromStats;
7613
+ fs$h.createDirentFromStats = createDirentFromStats;
7614
7614
 
7615
7615
  Object.defineProperty(utils$l, "__esModule", { value: true });
7616
7616
  utils$l.fs = void 0;
7617
- const fs$e = fs$f;
7618
- utils$l.fs = fs$e;
7617
+ const fs$g = fs$h;
7618
+ utils$l.fs = fs$g;
7619
7619
 
7620
7620
  var common$c = {};
7621
7621
 
@@ -7794,7 +7794,7 @@ sync$7.readdir = readdir;
7794
7794
 
7795
7795
  var settings$2 = {};
7796
7796
 
7797
- var fs$d = {};
7797
+ var fs$f = {};
7798
7798
 
7799
7799
  (function (exports) {
7800
7800
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -7815,17 +7815,17 @@ var fs$d = {};
7815
7815
  return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
7816
7816
  }
7817
7817
  exports.createFileSystemAdapter = createFileSystemAdapter;
7818
- } (fs$d));
7818
+ } (fs$f));
7819
7819
 
7820
7820
  Object.defineProperty(settings$2, "__esModule", { value: true });
7821
7821
  const path$g = require$$0$7;
7822
7822
  const fsStat$3 = out$1;
7823
- const fs$c = fs$d;
7823
+ const fs$e = fs$f;
7824
7824
  let Settings$1 = class Settings {
7825
7825
  constructor(_options = {}) {
7826
7826
  this._options = _options;
7827
7827
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
7828
- this.fs = fs$c.createFileSystemAdapter(this._options.fs);
7828
+ this.fs = fs$e.createFileSystemAdapter(this._options.fs);
7829
7829
  this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$g.sep);
7830
7830
  this.stats = this._getValue(this._options.stats, false);
7831
7831
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
@@ -11351,44 +11351,44 @@ const RETRYIFY_OPTIONS = {
11351
11351
  const FS = {
11352
11352
  attempt: {
11353
11353
  /* ASYNC */
11354
- chmod: attemptifyAsync(require$$3$1.promisify(fs$D.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11355
- chown: attemptifyAsync(require$$3$1.promisify(fs$D.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11356
- close: attemptifyAsync(require$$3$1.promisify(fs$D.close), ATTEMPTIFY_NOOP_OPTIONS),
11357
- fsync: attemptifyAsync(require$$3$1.promisify(fs$D.fsync), ATTEMPTIFY_NOOP_OPTIONS),
11358
- mkdir: attemptifyAsync(require$$3$1.promisify(fs$D.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
11359
- realpath: attemptifyAsync(require$$3$1.promisify(fs$D.realpath), ATTEMPTIFY_NOOP_OPTIONS),
11360
- stat: attemptifyAsync(require$$3$1.promisify(fs$D.stat), ATTEMPTIFY_NOOP_OPTIONS),
11361
- unlink: attemptifyAsync(require$$3$1.promisify(fs$D.unlink), ATTEMPTIFY_NOOP_OPTIONS),
11354
+ chmod: attemptifyAsync(require$$3$1.promisify(fs$F.chmod), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11355
+ chown: attemptifyAsync(require$$3$1.promisify(fs$F.chown), ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11356
+ close: attemptifyAsync(require$$3$1.promisify(fs$F.close), ATTEMPTIFY_NOOP_OPTIONS),
11357
+ fsync: attemptifyAsync(require$$3$1.promisify(fs$F.fsync), ATTEMPTIFY_NOOP_OPTIONS),
11358
+ mkdir: attemptifyAsync(require$$3$1.promisify(fs$F.mkdir), ATTEMPTIFY_NOOP_OPTIONS),
11359
+ realpath: attemptifyAsync(require$$3$1.promisify(fs$F.realpath), ATTEMPTIFY_NOOP_OPTIONS),
11360
+ stat: attemptifyAsync(require$$3$1.promisify(fs$F.stat), ATTEMPTIFY_NOOP_OPTIONS),
11361
+ unlink: attemptifyAsync(require$$3$1.promisify(fs$F.unlink), ATTEMPTIFY_NOOP_OPTIONS),
11362
11362
  /* SYNC */
11363
- chmodSync: attemptifySync(fs$D.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11364
- chownSync: attemptifySync(fs$D.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11365
- closeSync: attemptifySync(fs$D.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
11366
- existsSync: attemptifySync(fs$D.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
11367
- fsyncSync: attemptifySync(fs$D.fsync, ATTEMPTIFY_NOOP_OPTIONS),
11368
- mkdirSync: attemptifySync(fs$D.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
11369
- realpathSync: attemptifySync(fs$D.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
11370
- statSync: attemptifySync(fs$D.statSync, ATTEMPTIFY_NOOP_OPTIONS),
11371
- unlinkSync: attemptifySync(fs$D.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
11363
+ chmodSync: attemptifySync(fs$F.chmodSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11364
+ chownSync: attemptifySync(fs$F.chownSync, ATTEMPTIFY_CHANGE_ERROR_OPTIONS),
11365
+ closeSync: attemptifySync(fs$F.closeSync, ATTEMPTIFY_NOOP_OPTIONS),
11366
+ existsSync: attemptifySync(fs$F.existsSync, ATTEMPTIFY_NOOP_OPTIONS),
11367
+ fsyncSync: attemptifySync(fs$F.fsync, ATTEMPTIFY_NOOP_OPTIONS),
11368
+ mkdirSync: attemptifySync(fs$F.mkdirSync, ATTEMPTIFY_NOOP_OPTIONS),
11369
+ realpathSync: attemptifySync(fs$F.realpathSync, ATTEMPTIFY_NOOP_OPTIONS),
11370
+ statSync: attemptifySync(fs$F.statSync, ATTEMPTIFY_NOOP_OPTIONS),
11371
+ unlinkSync: attemptifySync(fs$F.unlinkSync, ATTEMPTIFY_NOOP_OPTIONS)
11372
11372
  },
11373
11373
  retry: {
11374
11374
  /* ASYNC */
11375
- close: retryifyAsync(require$$3$1.promisify(fs$D.close), RETRYIFY_OPTIONS),
11376
- fsync: retryifyAsync(require$$3$1.promisify(fs$D.fsync), RETRYIFY_OPTIONS),
11377
- open: retryifyAsync(require$$3$1.promisify(fs$D.open), RETRYIFY_OPTIONS),
11378
- readFile: retryifyAsync(require$$3$1.promisify(fs$D.readFile), RETRYIFY_OPTIONS),
11379
- rename: retryifyAsync(require$$3$1.promisify(fs$D.rename), RETRYIFY_OPTIONS),
11380
- stat: retryifyAsync(require$$3$1.promisify(fs$D.stat), RETRYIFY_OPTIONS),
11381
- write: retryifyAsync(require$$3$1.promisify(fs$D.write), RETRYIFY_OPTIONS),
11382
- writeFile: retryifyAsync(require$$3$1.promisify(fs$D.writeFile), RETRYIFY_OPTIONS),
11375
+ close: retryifyAsync(require$$3$1.promisify(fs$F.close), RETRYIFY_OPTIONS),
11376
+ fsync: retryifyAsync(require$$3$1.promisify(fs$F.fsync), RETRYIFY_OPTIONS),
11377
+ open: retryifyAsync(require$$3$1.promisify(fs$F.open), RETRYIFY_OPTIONS),
11378
+ readFile: retryifyAsync(require$$3$1.promisify(fs$F.readFile), RETRYIFY_OPTIONS),
11379
+ rename: retryifyAsync(require$$3$1.promisify(fs$F.rename), RETRYIFY_OPTIONS),
11380
+ stat: retryifyAsync(require$$3$1.promisify(fs$F.stat), RETRYIFY_OPTIONS),
11381
+ write: retryifyAsync(require$$3$1.promisify(fs$F.write), RETRYIFY_OPTIONS),
11382
+ writeFile: retryifyAsync(require$$3$1.promisify(fs$F.writeFile), RETRYIFY_OPTIONS),
11383
11383
  /* SYNC */
11384
- closeSync: retryifySync(fs$D.closeSync, RETRYIFY_OPTIONS),
11385
- fsyncSync: retryifySync(fs$D.fsyncSync, RETRYIFY_OPTIONS),
11386
- openSync: retryifySync(fs$D.openSync, RETRYIFY_OPTIONS),
11387
- readFileSync: retryifySync(fs$D.readFileSync, RETRYIFY_OPTIONS),
11388
- renameSync: retryifySync(fs$D.renameSync, RETRYIFY_OPTIONS),
11389
- statSync: retryifySync(fs$D.statSync, RETRYIFY_OPTIONS),
11390
- writeSync: retryifySync(fs$D.writeSync, RETRYIFY_OPTIONS),
11391
- writeFileSync: retryifySync(fs$D.writeFileSync, RETRYIFY_OPTIONS)
11384
+ closeSync: retryifySync(fs$F.closeSync, RETRYIFY_OPTIONS),
11385
+ fsyncSync: retryifySync(fs$F.fsyncSync, RETRYIFY_OPTIONS),
11386
+ openSync: retryifySync(fs$F.openSync, RETRYIFY_OPTIONS),
11387
+ readFileSync: retryifySync(fs$F.readFileSync, RETRYIFY_OPTIONS),
11388
+ renameSync: retryifySync(fs$F.renameSync, RETRYIFY_OPTIONS),
11389
+ statSync: retryifySync(fs$F.statSync, RETRYIFY_OPTIONS),
11390
+ writeSync: retryifySync(fs$F.writeSync, RETRYIFY_OPTIONS),
11391
+ writeFileSync: retryifySync(fs$F.writeFileSync, RETRYIFY_OPTIONS)
11392
11392
  }
11393
11393
  };
11394
11394
 
@@ -11625,7 +11625,7 @@ async function writeFileAsync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
11625
11625
  await FS.retry.write(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
11626
11626
  }
11627
11627
  else if (data instanceof require$$0$b.Readable) {
11628
- const writeStream = fs$D.createWriteStream(tempPath, { fd, autoClose: false });
11628
+ const writeStream = fs$F.createWriteStream(tempPath, { fd, autoClose: false });
11629
11629
  const finishPromise = EventEmitter$k.once(writeStream, 'finish');
11630
11630
  data.pipe(writeStream);
11631
11631
  await finishPromise;
@@ -11744,8 +11744,8 @@ class CommonPreset {
11744
11744
  // 读取所有预设
11745
11745
  async list() {
11746
11746
  const presetsPath = this.filepath;
11747
- if (await fs$k.pathExists(presetsPath)) {
11748
- const presets = await fs$k.readJSON(presetsPath);
11747
+ if (await fs$m.pathExists(presetsPath)) {
11748
+ const presets = await fs$m.readJSON(presetsPath);
11749
11749
  presets.map((preset) => {
11750
11750
  preset.config = { ...this.defaultConfig, ...preset.config };
11751
11751
  return preset;
@@ -11850,6 +11850,7 @@ const APP_DEFAULT_CONFIG = {
11850
11850
  biliUploadFileNameType: "ask",
11851
11851
  cutPageInNewWindow: false,
11852
11852
  bilibiliUser: {},
11853
+ douyuUser: {},
11853
11854
  tool: {
11854
11855
  home: {
11855
11856
  uploadPresetId: "default",
@@ -11951,6 +11952,7 @@ const APP_DEFAULT_CONFIG = {
11951
11952
  threshold: 10,
11952
11953
  },
11953
11954
  sync: [],
11955
+ douyuAccountExpiry: false,
11954
11956
  },
11955
11957
  setting: {
11956
11958
  type: undefined,
@@ -11988,6 +11990,7 @@ const APP_DEFAULT_CONFIG = {
11988
11990
  taskNotificationType: {
11989
11991
  liveStart: "system",
11990
11992
  chargeLive: "system",
11993
+ douyuAccountExpiry: null,
11991
11994
  },
11992
11995
  },
11993
11996
  sync: {
@@ -12142,6 +12145,7 @@ const APP_DEFAULT_CONFIG = {
12142
12145
  waitTime: undefined,
12143
12146
  },
12144
12147
  douyu: {
12148
+ uid: undefined,
12145
12149
  quality: 0,
12146
12150
  source: "auto",
12147
12151
  checkInterval: undefined,
@@ -40040,7 +40044,7 @@ var path$c = require$$0$7;
40040
40044
  var http$e = require$$1$4;
40041
40045
  var https$b = require$$1$5;
40042
40046
  var parseUrl$2 = require$$0$9.parse;
40043
- var fs$b = require$$0$6;
40047
+ var fs$d = require$$0$6;
40044
40048
  var Stream$2 = require$$0$4.Stream;
40045
40049
  var crypto$c = require$$1$6;
40046
40050
  var mime = mimeTypes$3;
@@ -40167,7 +40171,7 @@ FormData$1.prototype._lengthRetriever = function (value, callback) {
40167
40171
  // not that fast snoopy
40168
40172
  } else {
40169
40173
  // still need to fetch file size from fs
40170
- fs$b.stat(value.path, function (err, stat) {
40174
+ fs$d.stat(value.path, function (err, stat) {
40171
40175
  if (err) {
40172
40176
  callback(err);
40173
40177
  return;
@@ -47297,7 +47301,7 @@ const {
47297
47301
  mergeConfig,
47298
47302
  } = axios;
47299
47303
 
47300
- const fs$a = require$$0$6;
47304
+ const fs$c = require$$0$6;
47301
47305
  const path$b = require$$0$7;
47302
47306
 
47303
47307
  var packageJson$1 = {
@@ -47333,7 +47337,7 @@ function tryReadJsonAt(...searchPaths) {
47333
47337
  return undefined;
47334
47338
  }
47335
47339
 
47336
- const json = JSON.parse(fs$a.readFileSync(fileName, 'utf8'));
47340
+ const json = JSON.parse(fs$c.readFileSync(fileName, 'utf8'));
47337
47341
  const name = json?.productName || json?.name;
47338
47342
  if (!name || name.toLowerCase() === 'electron') {
47339
47343
  return undefined;
@@ -47362,7 +47366,7 @@ function findUp(fileName, cwd) {
47362
47366
  const root = parsedPath.root;
47363
47367
  const dir = parsedPath.dir;
47364
47368
 
47365
- if (fs$a.existsSync(path$b.join(currentPath, fileName))) {
47369
+ if (fs$c.existsSync(path$b.join(currentPath, fileName))) {
47366
47370
  return path$b.resolve(path$b.join(currentPath, fileName));
47367
47371
  }
47368
47372
 
@@ -48714,7 +48718,7 @@ function levelToStyle(level) {
48714
48718
  }
48715
48719
 
48716
48720
  const EventEmitter$j = require$$0$8;
48717
- const fs$9 = require$$0$6;
48721
+ const fs$b = require$$0$6;
48718
48722
  const os$2 = require$$1$2;
48719
48723
 
48720
48724
  let File$3 = class File extends EventEmitter$j {
@@ -48744,7 +48748,7 @@ let File$3 = class File extends EventEmitter$j {
48744
48748
 
48745
48749
  clear() {
48746
48750
  try {
48747
- fs$9.writeFileSync(this.path, '', {
48751
+ fs$b.writeFileSync(this.path, '', {
48748
48752
  mode: this.writeOptions.mode,
48749
48753
  flag: 'w',
48750
48754
  });
@@ -48777,7 +48781,7 @@ let File$3 = class File extends EventEmitter$j {
48777
48781
  getSize() {
48778
48782
  if (this.initialSize === undefined) {
48779
48783
  try {
48780
- const stats = fs$9.statSync(this.path);
48784
+ const stats = fs$b.statSync(this.path);
48781
48785
  this.initialSize = stats.size;
48782
48786
  } catch (e) {
48783
48787
  this.initialSize = 0;
@@ -48806,7 +48810,7 @@ let File$3 = class File extends EventEmitter$j {
48806
48810
  this.asyncWriteQueue = [];
48807
48811
  this.hasActiveAsyncWriting = true;
48808
48812
 
48809
- fs$9.writeFile(this.path, text, this.writeOptions, (e) => {
48813
+ fs$b.writeFile(this.path, text, this.writeOptions, (e) => {
48810
48814
  file.hasActiveAsyncWriting = false;
48811
48815
 
48812
48816
  if (e) {
@@ -48842,7 +48846,7 @@ let File$3 = class File extends EventEmitter$j {
48842
48846
  }
48843
48847
 
48844
48848
  try {
48845
- fs$9.writeFileSync(this.path, text, this.writeOptions);
48849
+ fs$b.writeFileSync(this.path, text, this.writeOptions);
48846
48850
  this.increaseBytesWrittenCounter(text);
48847
48851
  } catch (e) {
48848
48852
  this.emit(
@@ -48858,14 +48862,14 @@ var File_1 = File$3;
48858
48862
 
48859
48863
  function readFileSyncFromEnd(filePath, bytesCount) {
48860
48864
  const buffer = Buffer.alloc(bytesCount);
48861
- const stats = fs$9.statSync(filePath);
48865
+ const stats = fs$b.statSync(filePath);
48862
48866
 
48863
48867
  const readLength = Math.min(stats.size, bytesCount);
48864
48868
  const offset = Math.max(0, stats.size - bytesCount);
48865
48869
 
48866
- const fd = fs$9.openSync(filePath, 'r');
48867
- const totalBytes = fs$9.readSync(fd, buffer, 0, readLength, offset);
48868
- fs$9.closeSync(fd);
48870
+ const fd = fs$b.openSync(filePath, 'r');
48871
+ const totalBytes = fs$b.readSync(fd, buffer, 0, readLength, offset);
48872
+ fs$b.closeSync(fd);
48869
48873
 
48870
48874
  return buffer.toString('utf8', 0, totalBytes);
48871
48875
  }
@@ -48897,7 +48901,7 @@ let NullFile$1 = class NullFile extends File$2 {
48897
48901
  var NullFile_1 = NullFile$1;
48898
48902
 
48899
48903
  const EventEmitter$i = require$$0$8;
48900
- const fs$8 = require$$0$6;
48904
+ const fs$a = require$$0$6;
48901
48905
  const path$9 = require$$0$7;
48902
48906
  const File$1 = File_1;
48903
48907
  const NullFile = NullFile_1;
@@ -48964,14 +48968,14 @@ let FileRegistry$1 = class FileRegistry extends EventEmitter$i {
48964
48968
  * @private
48965
48969
  */
48966
48970
  testFileWriting({ filePath, writeOptions }) {
48967
- fs$8.mkdirSync(path$9.dirname(filePath), { recursive: true });
48968
- fs$8.writeFileSync(filePath, '', { flag: 'a', mode: writeOptions.mode });
48971
+ fs$a.mkdirSync(path$9.dirname(filePath), { recursive: true });
48972
+ fs$a.writeFileSync(filePath, '', { flag: 'a', mode: writeOptions.mode });
48969
48973
  }
48970
48974
  };
48971
48975
 
48972
48976
  var FileRegistry_1 = FileRegistry$1;
48973
48977
 
48974
- const fs$7 = require$$0$6;
48978
+ const fs$9 = require$$0$6;
48975
48979
  const os$1 = require$$1$2;
48976
48980
  const path$8 = require$$0$7;
48977
48981
  const FileRegistry = FileRegistry_1;
@@ -49017,7 +49021,7 @@ function fileTransportFactory(
49017
49021
  const oldPath = file.toString();
49018
49022
  const inf = path$8.parse(oldPath);
49019
49023
  try {
49020
- fs$7.renameSync(oldPath, path$8.join(inf.dir, `${inf.name}.old${inf.ext}`));
49024
+ fs$9.renameSync(oldPath, path$8.join(inf.dir, `${inf.name}.old${inf.ext}`));
49021
49025
  } catch (e) {
49022
49026
  logConsole('Could not rotate log', e);
49023
49027
  const quarterOfMaxSize = Math.round(transport.maxSize / 4);
@@ -49106,18 +49110,18 @@ function fileTransportFactory(
49106
49110
  initializeOnFirstAccess();
49107
49111
  const logsPath = path$8.dirname(transport.resolvePathFn(pathVariables));
49108
49112
 
49109
- if (!fs$7.existsSync(logsPath)) {
49113
+ if (!fs$9.existsSync(logsPath)) {
49110
49114
  return [];
49111
49115
  }
49112
49116
 
49113
- return fs$7.readdirSync(logsPath)
49117
+ return fs$9.readdirSync(logsPath)
49114
49118
  .map((fileName) => path$8.join(logsPath, fileName))
49115
49119
  .filter(fileFilter)
49116
49120
  .map((logPath) => {
49117
49121
  try {
49118
49122
  return {
49119
49123
  path: logPath,
49120
- lines: fs$7.readFileSync(logPath, 'utf8').split(os$1.EOL),
49124
+ lines: fs$9.readFileSync(logPath, 'utf8').split(os$1.EOL),
49121
49125
  };
49122
49126
  } catch {
49123
49127
  return null;
@@ -50724,7 +50728,7 @@ var old$1 = {};
50724
50728
 
50725
50729
  var pathModule = require$$0$7;
50726
50730
  var isWindows$2 = process.platform === 'win32';
50727
- var fs$6 = require$$0$6;
50731
+ var fs$8 = require$$0$6;
50728
50732
 
50729
50733
  // JavaScript implementation of realpath, ported from node pre-v6
50730
50734
 
@@ -50819,7 +50823,7 @@ old$1.realpathSync = function realpathSync(p, cache) {
50819
50823
 
50820
50824
  // On windows, check that the root exists. On unix there is no need.
50821
50825
  if (isWindows$2 && !knownHard[base]) {
50822
- fs$6.lstatSync(base);
50826
+ fs$8.lstatSync(base);
50823
50827
  knownHard[base] = true;
50824
50828
  }
50825
50829
  }
@@ -50846,7 +50850,7 @@ old$1.realpathSync = function realpathSync(p, cache) {
50846
50850
  // some known symbolic link. no need to stat again.
50847
50851
  resolvedLink = cache[base];
50848
50852
  } else {
50849
- var stat = fs$6.lstatSync(base);
50853
+ var stat = fs$8.lstatSync(base);
50850
50854
  if (!stat.isSymbolicLink()) {
50851
50855
  knownHard[base] = true;
50852
50856
  if (cache) cache[base] = base;
@@ -50863,8 +50867,8 @@ old$1.realpathSync = function realpathSync(p, cache) {
50863
50867
  }
50864
50868
  }
50865
50869
  if (linkTarget === null) {
50866
- fs$6.statSync(base);
50867
- linkTarget = fs$6.readlinkSync(base);
50870
+ fs$8.statSync(base);
50871
+ linkTarget = fs$8.readlinkSync(base);
50868
50872
  }
50869
50873
  resolvedLink = pathModule.resolve(previous, linkTarget);
50870
50874
  // track this, if given a cache.
@@ -50921,7 +50925,7 @@ old$1.realpath = function realpath(p, cache, cb) {
50921
50925
 
50922
50926
  // On windows, check that the root exists. On unix there is no need.
50923
50927
  if (isWindows$2 && !knownHard[base]) {
50924
- fs$6.lstat(base, function(err) {
50928
+ fs$8.lstat(base, function(err) {
50925
50929
  if (err) return cb(err);
50926
50930
  knownHard[base] = true;
50927
50931
  LOOP();
@@ -50958,7 +50962,7 @@ old$1.realpath = function realpath(p, cache, cb) {
50958
50962
  return gotResolvedLink(cache[base]);
50959
50963
  }
50960
50964
 
50961
- return fs$6.lstat(base, gotStat);
50965
+ return fs$8.lstat(base, gotStat);
50962
50966
  }
50963
50967
 
50964
50968
  function gotStat(err, stat) {
@@ -50980,10 +50984,10 @@ old$1.realpath = function realpath(p, cache, cb) {
50980
50984
  return gotTarget(null, seenLinks[id], base);
50981
50985
  }
50982
50986
  }
50983
- fs$6.stat(base, function(err) {
50987
+ fs$8.stat(base, function(err) {
50984
50988
  if (err) return cb(err);
50985
50989
 
50986
- fs$6.readlink(base, function(err, target) {
50990
+ fs$8.readlink(base, function(err, target) {
50987
50991
  if (!isWindows$2) seenLinks[id] = target;
50988
50992
  gotTarget(err, target);
50989
50993
  });
@@ -51012,9 +51016,9 @@ realpath.realpathSync = realpathSync;
51012
51016
  realpath.monkeypatch = monkeypatch;
51013
51017
  realpath.unmonkeypatch = unmonkeypatch;
51014
51018
 
51015
- var fs$5 = require$$0$6;
51016
- var origRealpath = fs$5.realpath;
51017
- var origRealpathSync = fs$5.realpathSync;
51019
+ var fs$7 = require$$0$6;
51020
+ var origRealpath = fs$7.realpath;
51021
+ var origRealpathSync = fs$7.realpathSync;
51018
51022
 
51019
51023
  var version$2 = process.version;
51020
51024
  var ok = /^v[0-5]\./.test(version$2);
@@ -51063,13 +51067,13 @@ function realpathSync (p, cache) {
51063
51067
  }
51064
51068
 
51065
51069
  function monkeypatch () {
51066
- fs$5.realpath = realpath;
51067
- fs$5.realpathSync = realpathSync;
51070
+ fs$7.realpath = realpath;
51071
+ fs$7.realpathSync = realpathSync;
51068
51072
  }
51069
51073
 
51070
51074
  function unmonkeypatch () {
51071
- fs$5.realpath = origRealpath;
51072
- fs$5.realpathSync = origRealpathSync;
51075
+ fs$7.realpath = origRealpath;
51076
+ fs$7.realpathSync = origRealpathSync;
51073
51077
  }
51074
51078
 
51075
51079
  var concatMap$1 = function (xs, fn) {
@@ -52381,7 +52385,7 @@ function ownProp (obj, field) {
52381
52385
  return Object.prototype.hasOwnProperty.call(obj, field)
52382
52386
  }
52383
52387
 
52384
- var fs$4 = require$$0$6;
52388
+ var fs$6 = require$$0$6;
52385
52389
  var path$6 = require$$0$7;
52386
52390
  var minimatch = minimatch_1;
52387
52391
  var isAbsolute = pathIsAbsoluteExports;
@@ -52447,7 +52451,7 @@ function setopts (self, pattern, options) {
52447
52451
  self.stat = !!options.stat;
52448
52452
  self.noprocess = !!options.noprocess;
52449
52453
  self.absolute = !!options.absolute;
52450
- self.fs = options.fs || fs$4;
52454
+ self.fs = options.fs || fs$6;
52451
52455
 
52452
52456
  self.maxLength = options.maxLength || Infinity;
52453
52457
  self.cache = options.cache || Object.create(null);
@@ -54116,7 +54120,7 @@ var dirGlob$1 = {exports: {}};
54116
54120
 
54117
54121
  var pathType$1 = {};
54118
54122
 
54119
- const fs$3 = require$$0$6;
54123
+ const fs$5 = require$$0$6;
54120
54124
  const pify$2 = pify$3;
54121
54125
 
54122
54126
  function type$1(fn, fn2, fp) {
@@ -54124,7 +54128,7 @@ function type$1(fn, fn2, fp) {
54124
54128
  return Promise.reject(new TypeError(`Expected a string, got ${typeof fp}`));
54125
54129
  }
54126
54130
 
54127
- return pify$2(fs$3[fn])(fp)
54131
+ return pify$2(fs$5[fn])(fp)
54128
54132
  .then(stats => stats[fn2]())
54129
54133
  .catch(err => {
54130
54134
  if (err.code === 'ENOENT') {
@@ -54141,7 +54145,7 @@ function typeSync(fn, fn2, fp) {
54141
54145
  }
54142
54146
 
54143
54147
  try {
54144
- return fs$3[fn](fp)[fn2]();
54148
+ return fs$5[fn](fp)[fn2]();
54145
54149
  } catch (err) {
54146
54150
  if (err.code === 'ENOENT') {
54147
54151
  return false;
@@ -54662,7 +54666,7 @@ var slash$1 = function (str) {
54662
54666
  return str.replace(/\\/g, '/');
54663
54667
  };
54664
54668
 
54665
- const fs$2 = require$$0$6;
54669
+ const fs$4 = require$$0$6;
54666
54670
  const path$4 = require$$0$7;
54667
54671
  const glob$1 = requireGlob();
54668
54672
  const gitIgnore = ignore;
@@ -54670,7 +54674,7 @@ const pify$1 = pify$3;
54670
54674
  const slash = slash$1;
54671
54675
 
54672
54676
  const globP$1 = pify$1(glob$1);
54673
- const readFileP = pify$1(fs$2.readFile);
54677
+ const readFileP = pify$1(fs$4.readFile);
54674
54678
 
54675
54679
  const mapGitIgnorePatternTo = base => ignore => {
54676
54680
  if (ignore.startsWith('!')) {
@@ -54716,7 +54720,7 @@ const getFile = (file, cwd) => {
54716
54720
 
54717
54721
  const getFileSync = (file, cwd) => {
54718
54722
  const filePath = path$4.join(cwd, file);
54719
- const content = fs$2.readFileSync(filePath, 'utf8');
54723
+ const content = fs$4.readFileSync(filePath, 'utf8');
54720
54724
 
54721
54725
  return {
54722
54726
  content,
@@ -54923,7 +54927,7 @@ async function trash(paths, options) {
54923
54927
  }
54924
54928
 
54925
54929
  try {
54926
- await fs$D.promises.lstat(filePath);
54930
+ await fs$F.promises.lstat(filePath);
54927
54931
  } catch (error) {
54928
54932
  if (error.code === 'ENOENT') {
54929
54933
  return;
@@ -54947,7 +54951,7 @@ async function trash(paths, options) {
54947
54951
  } else if (process$2.platform === 'win32') {
54948
54952
  module = await Promise.resolve().then(function () { return require('./windows-C30k1cv-.cjs'); });
54949
54953
  } else {
54950
- module = await Promise.resolve().then(function () { return require('./linux-C-4qLKcq.cjs'); });
54954
+ module = await Promise.resolve().then(function () { return require('./linux-Cy2IwLL8.cjs'); });
54951
54955
  }
54952
54956
 
54953
54957
  return module.default(paths);
@@ -60210,14 +60214,14 @@ class Config extends TypedEmitter {
60210
60214
  }
60211
60215
  save() {
60212
60216
  // 保存文件
60213
- fs$D.writeFileSync(this.filepath, JSON.stringify(this.data));
60217
+ fs$F.writeFileSync(this.filepath, JSON.stringify(this.data));
60214
60218
  }
60215
60219
  load(filepath) {
60216
60220
  this.filepath = filepath;
60217
60221
  }
60218
60222
  init(filepath, initData = {}) {
60219
60223
  this.filepath = filepath;
60220
- if (!fs$D.existsSync(this.filepath)) {
60224
+ if (!fs$F.existsSync(this.filepath)) {
60221
60225
  this.data = initData;
60222
60226
  }
60223
60227
  else {
@@ -60240,7 +60244,7 @@ class Config extends TypedEmitter {
60240
60244
  }
60241
60245
  read() {
60242
60246
  // 读取文件
60243
- this.data = JSON.parse(fs$D.readFileSync(this.filepath, "utf-8"));
60247
+ this.data = JSON.parse(fs$F.readFileSync(this.filepath, "utf-8"));
60244
60248
  return this.data;
60245
60249
  }
60246
60250
  }
@@ -61910,11 +61914,11 @@ const uuid$4 = () => {
61910
61914
  return crypto$d.randomUUID();
61911
61915
  };
61912
61916
  const pathExists = async (path) => {
61913
- return await fs$k.pathExists(path);
61917
+ return await fs$m.pathExists(path);
61914
61918
  };
61915
61919
  const deleteFile = async (path) => {
61916
61920
  try {
61917
- await fs$k.unlink(path);
61921
+ await fs$m.unlink(path);
61918
61922
  }
61919
61923
  catch (error) {
61920
61924
  console.error(error);
@@ -61934,7 +61938,7 @@ const trashItem = async (path) => {
61934
61938
  };
61935
61939
  const isWin32 = process.platform === "win32";
61936
61940
  async function getFileSize$1(filePath) {
61937
- const stats = await fs$k.promises.stat(filePath);
61941
+ const stats = await fs$m.promises.stat(filePath);
61938
61942
  const fileSizeInBytes = stats.size;
61939
61943
  return fileSizeInBytes;
61940
61944
  }
@@ -61975,18 +61979,18 @@ function getTempPath() {
61975
61979
  }
61976
61980
  if (cacheFolder) {
61977
61981
  try {
61978
- fs$k.ensureDirSync(cacheFolder);
61982
+ fs$m.ensureDirSync(cacheFolder);
61979
61983
  return cacheFolder;
61980
61984
  }
61981
61985
  catch (e) {
61982
61986
  console.error("缓存文件夹创建失败,使用系统临时文件夹", e);
61983
61987
  }
61984
61988
  }
61985
- fs$k.ensureDirSync(cacheFolder);
61989
+ fs$m.ensureDirSync(cacheFolder);
61986
61990
  return cacheFolder;
61987
61991
  }
61988
61992
  async function readLines(filePath, startLine, endLine) {
61989
- const fileStream = fs$k.createReadStream(filePath);
61993
+ const fileStream = fs$m.createReadStream(filePath);
61990
61994
  const rl = readline.createInterface({
61991
61995
  input: fileStream,
61992
61996
  crlfDelay: Infinity,
@@ -62064,7 +62068,7 @@ const parseSavePath = async (input, options, createDir = true) => {
62064
62068
  throw new Error("没有找到保存路径");
62065
62069
  }
62066
62070
  if (createDir && !(await pathExists(savePath))) {
62067
- await fs$k.ensureDir(savePath);
62071
+ await fs$m.ensureDir(savePath);
62068
62072
  }
62069
62073
  return savePath;
62070
62074
  };
@@ -62107,7 +62111,7 @@ async function getUnusedFileName(filePath) {
62107
62111
  const baseName = path$z.basename(filePath, ext);
62108
62112
  let newFilePath = filePath;
62109
62113
  let counter = 1;
62110
- while (await fs$k.pathExists(newFilePath)) {
62114
+ while (await fs$m.pathExists(newFilePath)) {
62111
62115
  newFilePath = path$z.join(dir, `${baseName}(${counter})${ext}`);
62112
62116
  counter++;
62113
62117
  if (counter > 100) {
@@ -62131,7 +62135,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
62131
62135
  // 如果文件小于等于头部大小,直接读取整个文件
62132
62136
  if (fileSize <= headSize) {
62133
62137
  return new Promise((resolve, reject) => {
62134
- const stream = fs$D.createReadStream(filePath);
62138
+ const stream = fs$F.createReadStream(filePath);
62135
62139
  stream.on("data", (chunk) => {
62136
62140
  hash.update(chunk);
62137
62141
  });
@@ -62143,7 +62147,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
62143
62147
  }
62144
62148
  // 读取头部
62145
62149
  await new Promise((resolve, reject) => {
62146
- const headStream = fs$D.createReadStream(filePath, {
62150
+ const headStream = fs$F.createReadStream(filePath, {
62147
62151
  start: 0,
62148
62152
  end: headSize - 1,
62149
62153
  highWaterMark: 64 * 1024,
@@ -62159,7 +62163,7 @@ async function calculateFileQuickHash(filePath, headSize = 1 * 1024 * 1024, tail
62159
62163
  // 读取尾部
62160
62164
  await new Promise((resolve, reject) => {
62161
62165
  const tailStart = Math.max(headSize, fileSize - tailSize);
62162
- const tailStream = fs$D.createReadStream(filePath, {
62166
+ const tailStream = fs$F.createReadStream(filePath, {
62163
62167
  start: tailStart,
62164
62168
  end: fileSize - 1,
62165
62169
  highWaterMark: 64 * 1024,
@@ -62258,7 +62262,7 @@ function RGB2BGR(color, reverseAlpha = true) {
62258
62262
 
62259
62263
  async function getFileSize(filePath) {
62260
62264
  try {
62261
- const stats = await fs$D.promises.stat(filePath);
62265
+ const stats = await fs$F.promises.stat(filePath);
62262
62266
  const fileSizeInBytes = stats.size;
62263
62267
  return fileSizeInBytes;
62264
62268
  }
@@ -62269,11 +62273,11 @@ async function getFileSize(filePath) {
62269
62273
  let isString$1 = (value) => typeof value === "string";
62270
62274
  function createReadStream(filePath, start, numBytes, totalBytes) {
62271
62275
  const endByte = Math.min(start + numBytes - 1, totalBytes - 1);
62272
- const readStream = fs$D.createReadStream(filePath, { start, end: endByte });
62276
+ const readStream = fs$F.createReadStream(filePath, { start, end: endByte });
62273
62277
  return [readStream, endByte - start + 1];
62274
62278
  }
62275
62279
  async function readFileAsBase64(filePath) {
62276
- return fs$D.promises
62280
+ return fs$F.promises
62277
62281
  .readFile(filePath)
62278
62282
  .then(data => {
62279
62283
  // 获取文件扩展名
@@ -62996,7 +63000,7 @@ class Auth {
62996
63000
  * @param path cookie文件路径
62997
63001
  */
62998
63002
  async loadCookieFile(path) {
62999
- const cookie = await fs$D.promises.readFile(path, "utf-8");
63003
+ const cookie = await fs$F.promises.readFile(path, "utf-8");
63000
63004
  const cookieObj = JSON.parse(cookie);
63001
63005
  const cookieStr = cookieObj.cookie_info.cookies
63002
63006
  .map((item) => `${item.name}=${item.value}`)
@@ -65319,7 +65323,7 @@ class WebVideoUploader extends BaseRequest {
65319
65323
  }
65320
65324
  }
65321
65325
  getFileSizeSync(filePath) {
65322
- const stats = fs$D.statSync(filePath);
65326
+ const stats = fs$F.statSync(filePath);
65323
65327
  const fileSizeInBytes = stats.size;
65324
65328
  return fileSizeInBytes;
65325
65329
  }
@@ -67061,7 +67065,7 @@ class RangeDownloader {
67061
67065
  return;
67062
67066
  if (this.status === "pending") {
67063
67067
  try {
67064
- await fs$D.promises.unlink(this.filePath);
67068
+ await fs$F.promises.unlink(this.filePath);
67065
67069
  }
67066
67070
  catch (error) { }
67067
67071
  }
@@ -67115,7 +67119,7 @@ class RangeDownloader {
67115
67119
  _self.totalSize = isNaN(_self.totalSize)
67116
67120
  ? parseInt(response.headers["content-length"] || "0", 10)
67117
67121
  : _self.totalSize;
67118
- const writableStream = fs$D.createWriteStream(this.filePath, {
67122
+ const writableStream = fs$F.createWriteStream(this.filePath, {
67119
67123
  flags: "a",
67120
67124
  });
67121
67125
  response.data.pipe(writableStream);
@@ -67526,7 +67530,7 @@ class Video extends BaseRequest {
67526
67530
  });
67527
67531
  const jsonData = (await res.json());
67528
67532
  const srtData = subtitleJsonToSrt(jsonData);
67529
- fs$D.writeFileSync(options.output, srtData);
67533
+ fs$F.writeFileSync(options.output, srtData);
67530
67534
  return options.output;
67531
67535
  }
67532
67536
  authAid() {
@@ -67710,8 +67714,8 @@ class Video extends BaseRequest {
67710
67714
  }
67711
67715
  const clean = () => {
67712
67716
  try {
67713
- fs$D.promises.unlink(videoDownloader.filePath);
67714
- fs$D.promises.unlink(audioDownloader.filePath);
67717
+ fs$F.promises.unlink(videoDownloader.filePath);
67718
+ fs$F.promises.unlink(audioDownloader.filePath);
67715
67719
  }
67716
67720
  catch (error) {
67717
67721
  console.warn(error);
@@ -67825,7 +67829,7 @@ class Video extends BaseRequest {
67825
67829
  });
67826
67830
  const clean = () => {
67827
67831
  try {
67828
- fs$D.promises.unlink(videoDownloader.filePath);
67832
+ fs$F.promises.unlink(videoDownloader.filePath);
67829
67833
  }
67830
67834
  catch (error) {
67831
67835
  console.warn(error);
@@ -75939,7 +75943,7 @@ class BcutASR {
75939
75943
  * 从文件设置数据
75940
75944
  */
75941
75945
  setDataFromFile(file) {
75942
- this.soundBin = fs$D.readFileSync(file);
75946
+ this.soundBin = fs$F.readFileSync(file);
75943
75947
  const suffix = file.split(".").pop()?.toLowerCase();
75944
75948
  if (!this.isSupportFormat(suffix)) {
75945
75949
  throw new TypeError(`Format ${suffix} is not supported`);
@@ -78336,7 +78340,7 @@ class M3U8Downloader extends TypedEmitter {
78336
78340
  this.totalSegments = 0;
78337
78341
  this.downloadedSegments = 0;
78338
78342
  this.downloadedFiles = [];
78339
- fs$k.ensureDirSync(this.segmentsDir);
78343
+ fs$m.ensureDirSync(this.segmentsDir);
78340
78344
  console.log("Temporary segments directory:", this.segmentsDir);
78341
78345
  // axios 统一实例化,方便增加axios功能,比如拦截器
78342
78346
  this.http = axios.create({
@@ -78367,10 +78371,10 @@ class M3U8Downloader extends TypedEmitter {
78367
78371
  try {
78368
78372
  this.emit("start");
78369
78373
  this.status = "running";
78370
- if (!(await fs$k.pathExists(this.segmentsDir))) {
78371
- await fs$k.mkdir(this.segmentsDir, { recursive: true });
78374
+ if (!(await fs$m.pathExists(this.segmentsDir))) {
78375
+ await fs$m.mkdir(this.segmentsDir, { recursive: true });
78372
78376
  }
78373
- if (!(await fs$k.pathExists(path$z.dirname(this.output)))) {
78377
+ if (!(await fs$m.pathExists(path$z.dirname(this.output)))) {
78374
78378
  throw new Error("Output directory does not exist");
78375
78379
  }
78376
78380
  const m3u8Content = await this.getM3U8();
@@ -78490,7 +78494,7 @@ class M3U8Downloader extends TypedEmitter {
78490
78494
  return;
78491
78495
  const formattedIndex = String(index).padStart(5, "0");
78492
78496
  const segmentPath = path$z.resolve(this.segmentsDir, `segment${formattedIndex}.${this.options.suffix}`);
78493
- if (this.options.skipExistSegments && (await fs$k.pathExists(segmentPath))) {
78497
+ if (this.options.skipExistSegments && (await fs$m.pathExists(segmentPath))) {
78494
78498
  this.downloadedSegments++;
78495
78499
  const progress = {
78496
78500
  downloadedFile: segmentPath,
@@ -78503,7 +78507,7 @@ class M3U8Downloader extends TypedEmitter {
78503
78507
  const response = await this.http.get(tsUrl, {
78504
78508
  responseType: "arraybuffer",
78505
78509
  });
78506
- await fs$k.writeFile(segmentPath, response.data);
78510
+ await fs$m.writeFile(segmentPath, response.data);
78507
78511
  this.downloadedFiles.push(segmentPath);
78508
78512
  this.downloadedSegments++;
78509
78513
  const progress = {
@@ -78539,7 +78543,7 @@ class M3U8Downloader extends TypedEmitter {
78539
78543
  if (!this.options.convert2Mp4) {
78540
78544
  mergedFilePath = this.output;
78541
78545
  }
78542
- const writeStream = fs$k.createWriteStream(mergedFilePath, {
78546
+ const writeStream = fs$m.createWriteStream(mergedFilePath, {
78543
78547
  highWaterMark: 1024 * 1024,
78544
78548
  });
78545
78549
  writeStream.on("error", error => {
@@ -78570,10 +78574,10 @@ class M3U8Downloader extends TypedEmitter {
78570
78574
  const formattedIndex = String(index).padStart(5, "0");
78571
78575
  const segmentPath = path$z.resolve(this.segmentsDir, `segment${formattedIndex}.${this.options.suffix}`);
78572
78576
  // 读取并安全写入
78573
- const segmentData = await fs$k.promises.readFile(segmentPath);
78577
+ const segmentData = await fs$m.promises.readFile(segmentPath);
78574
78578
  await safeWrite(segmentData);
78575
78579
  if (deleteSource)
78576
- await fs$k.promises.unlink(segmentPath);
78580
+ await fs$m.promises.unlink(segmentPath);
78577
78581
  }
78578
78582
  // 关键:等待流完全关闭
78579
78583
  await new Promise((resolve, reject) => {
@@ -78593,14 +78597,14 @@ class M3U8Downloader extends TypedEmitter {
78593
78597
  return;
78594
78598
  await Promise.all(this.downloadedFiles.map(async (file) => {
78595
78599
  try {
78596
- await fs$k.unlink(file);
78600
+ await fs$m.unlink(file);
78597
78601
  }
78598
78602
  catch (error) { }
78599
78603
  }));
78600
78604
  if (this.options.convert2Mp4) {
78601
78605
  let mergedFilePath = path$z.resolve(this.segmentsDir, `output.${this.options.suffix}`);
78602
- if (await fs$k.pathExists(mergedFilePath)) {
78603
- await fs$k.unlink(mergedFilePath);
78606
+ if (await fs$m.pathExists(mergedFilePath)) {
78607
+ await fs$m.unlink(mergedFilePath);
78604
78608
  }
78605
78609
  }
78606
78610
  }
@@ -78634,7 +78638,7 @@ class M3U8Downloader extends TypedEmitter {
78634
78638
  }
78635
78639
  // remove merged TS file with retry
78636
78640
  try {
78637
- await retry$2(() => fs$k.unlink(inputFilePath), 5, 1000);
78641
+ await retry$2(() => fs$m.unlink(inputFilePath), 5, 1000);
78638
78642
  }
78639
78643
  catch (error) {
78640
78644
  console.error(`Failed to delete temporary TS file: ${error}`);
@@ -78653,7 +78657,7 @@ var nodemailer = {};
78653
78657
 
78654
78658
  var shared$c = {exports: {}};
78655
78659
 
78656
- var fetch$2 = {exports: {}};
78660
+ var fetch$3 = {exports: {}};
78657
78661
 
78658
78662
  // module to handle cookies
78659
78663
 
@@ -79003,11 +79007,11 @@ const net$b = require$$4;
79003
79007
 
79004
79008
  const MAX_REDIRECTS = 5;
79005
79009
 
79006
- fetch$2.exports = function (url, options) {
79010
+ fetch$3.exports = function (url, options) {
79007
79011
  return nmfetch$3(url, options);
79008
79012
  };
79009
79013
 
79010
- fetch$2.exports.Cookies = Cookies;
79014
+ fetch$3.exports.Cookies = Cookies;
79011
79015
 
79012
79016
  function nmfetch$3(url, options) {
79013
79017
  options = options || {};
@@ -79265,7 +79269,7 @@ function nmfetch$3(url, options) {
79265
79269
  return fetchRes;
79266
79270
  }
79267
79271
 
79268
- var fetchExports = fetch$2.exports;
79272
+ var fetchExports = fetch$3.exports;
79269
79273
 
79270
79274
  /* eslint no-console: 0 */
79271
79275
 
@@ -83955,7 +83959,7 @@ var leUnix = LeWindows$2;
83955
83959
  /* eslint no-undefined: 0, prefer-spread: 0, no-control-regex: 0 */
83956
83960
 
83957
83961
  const crypto$b = require$$1$6;
83958
- const fs$1 = require$$0$6;
83962
+ const fs$3 = require$$0$6;
83959
83963
  const punycode$2 = punycode_1;
83960
83964
  const PassThrough$4 = require$$0$4.PassThrough;
83961
83965
  const shared$b = sharedExports;
@@ -84931,7 +84935,7 @@ let MimeNode$2 = class MimeNode {
84931
84935
  return contentStream;
84932
84936
  }
84933
84937
  // read file
84934
- return fs$1.createReadStream(content.path);
84938
+ return fs$3.createReadStream(content.path);
84935
84939
  } else if (content && typeof content.href === 'string') {
84936
84940
  if (this.disableUrlAccess) {
84937
84941
  contentStream = new PassThrough$4();
@@ -86259,7 +86263,7 @@ const MessageParser = messageParser;
86259
86263
  const RelaxedBody = relaxedBody;
86260
86264
  const sign$2 = signExports;
86261
86265
  const PassThrough$3 = require$$0$4.PassThrough;
86262
- const fs = require$$0$6;
86266
+ const fs$2 = require$$0$6;
86263
86267
  const path$2 = require$$0$7;
86264
86268
  const crypto$8 = require$$1$6;
86265
86269
 
@@ -86319,12 +86323,12 @@ class DKIMSigner {
86319
86323
  if (!this.cache || !this.cachePath) {
86320
86324
  return;
86321
86325
  }
86322
- fs.unlink(this.cachePath, () => false);
86326
+ fs$2.unlink(this.cachePath, () => false);
86323
86327
  }
86324
86328
 
86325
86329
  createReadCache() {
86326
86330
  // pipe remainings to cache file
86327
- this.cache = fs.createReadStream(this.cachePath);
86331
+ this.cache = fs$2.createReadStream(this.cachePath);
86328
86332
  this.cache.once('error', err => {
86329
86333
  this.cleanup();
86330
86334
  this.output.emit('error', err);
@@ -86387,7 +86391,7 @@ class DKIMSigner {
86387
86391
  createWriteCache() {
86388
86392
  this.output.usingCache = true;
86389
86393
  // pipe remainings to cache file
86390
- this.cache = fs.createWriteStream(this.cachePath);
86394
+ this.cache = fs$2.createWriteStream(this.cachePath);
86391
86395
  this.cache.once('error', err => {
86392
86396
  this.cleanup();
86393
86397
  // drain input
@@ -173589,17 +173593,17 @@ const isSameProtocol = function isSameProtocol(destination, original) {
173589
173593
  * @param Object opts Fetch options
173590
173594
  * @return Promise
173591
173595
  */
173592
- function fetch$1(url, opts) {
173596
+ function fetch$2(url, opts) {
173593
173597
 
173594
173598
  // allow custom promise
173595
- if (!fetch$1.Promise) {
173599
+ if (!fetch$2.Promise) {
173596
173600
  throw new Error('native promise missing, set fetch.Promise to your favorite alternative');
173597
173601
  }
173598
173602
 
173599
- Body.Promise = fetch$1.Promise;
173603
+ Body.Promise = fetch$2.Promise;
173600
173604
 
173601
173605
  // wrap http.request into fetch
173602
- return new fetch$1.Promise(function (resolve, reject) {
173606
+ return new fetch$2.Promise(function (resolve, reject) {
173603
173607
  // build request object
173604
173608
  const request = new Request$4(url, opts);
173605
173609
  const options = getNodeRequestOptions(request);
@@ -173697,7 +173701,7 @@ function fetch$1(url, opts) {
173697
173701
  const headers = createHeadersLenient(res.headers);
173698
173702
 
173699
173703
  // HTTP fetch step 5
173700
- if (fetch$1.isRedirect(res.statusCode)) {
173704
+ if (fetch$2.isRedirect(res.statusCode)) {
173701
173705
  // HTTP fetch step 5.2
173702
173706
  const location = headers.get('Location');
173703
173707
 
@@ -173783,7 +173787,7 @@ function fetch$1(url, opts) {
173783
173787
  }
173784
173788
 
173785
173789
  // HTTP-redirect fetch step 15
173786
- resolve(fetch$1(new Request$4(locationURL, requestOpts)));
173790
+ resolve(fetch$2(new Request$4(locationURL, requestOpts)));
173787
173791
  finalize();
173788
173792
  return;
173789
173793
  }
@@ -173925,12 +173929,12 @@ function destroyStream(stream, err) {
173925
173929
  * @param Number code Status code
173926
173930
  * @return Boolean
173927
173931
  */
173928
- fetch$1.isRedirect = function (code) {
173932
+ fetch$2.isRedirect = function (code) {
173929
173933
  return code === 301 || code === 302 || code === 303 || code === 307 || code === 308;
173930
173934
  };
173931
173935
 
173932
173936
  // expose Promise
173933
- fetch$1.Promise = global.Promise;
173937
+ fetch$2.Promise = global.Promise;
173934
173938
 
173935
173939
  var lib = /*#__PURE__*/Object.freeze({
173936
173940
  __proto__: null,
@@ -173939,7 +173943,7 @@ var lib = /*#__PURE__*/Object.freeze({
173939
173943
  Headers: Headers$1,
173940
173944
  Request: Request$4,
173941
173945
  Response: Response$2,
173942
- default: fetch$1
173946
+ default: fetch$2
173943
173947
  });
173944
173948
 
173945
173949
  var require$$0 = /*@__PURE__*/getAugmentedNamespace(lib);
@@ -179745,7 +179749,7 @@ class DanmakuFactory {
179745
179749
  return params.filter((item) => item !== "");
179746
179750
  };
179747
179751
  convertXml2Ass = async (input, output, argsObj) => {
179748
- if (!(await fs$k.pathExists(input))) {
179752
+ if (!(await fs$m.pathExists(input))) {
179749
179753
  throw new Error("input not exists");
179750
179754
  }
179751
179755
  const requiredArgs = [`-i "${input}"`, `-o "${output}"`, "--ignore-warnings", "--force"];
@@ -187065,7 +187069,7 @@ const traversalObject = (obj, callback) => {
187065
187069
  }
187066
187070
  };
187067
187071
  async function processRawStream(inputFilePath) {
187068
- const readStream = fs$k.createReadStream(inputFilePath, { encoding: "utf8" });
187072
+ const readStream = fs$m.createReadStream(inputFilePath, { encoding: "utf8" });
187069
187073
  const rl = readline.createInterface({
187070
187074
  input: readStream,
187071
187075
  crlfDelay: Infinity,
@@ -187082,13 +187086,13 @@ async function processRawStream(inputFilePath) {
187082
187086
  */
187083
187087
  const parseXmlFile = async (input, parseRaw = false) => {
187084
187088
  let XMLdata;
187085
- const stat = await fs$k.stat(input);
187089
+ const stat = await fs$m.stat(input);
187086
187090
  // 如果文件大于400M,且未开启parseRaw,使用processRawStream
187087
187091
  if (stat.size > 400 * 1024 * 1024 && !parseRaw) {
187088
187092
  XMLdata = await processRawStream(input);
187089
187093
  }
187090
187094
  else {
187091
- XMLdata = await fs$k.promises.readFile(input, "utf8");
187095
+ XMLdata = await fs$m.promises.readFile(input, "utf8");
187092
187096
  if (!parseRaw) {
187093
187097
  XMLdata = XMLdata.replace(/raw=".*?"/g, "");
187094
187098
  }
@@ -187316,7 +187320,7 @@ const genTimeData = async (input) => {
187316
187320
  });
187317
187321
  }
187318
187322
  else if (ext === ".ass") {
187319
- const content = await fs$k.readFile(input, "utf-8");
187323
+ const content = await fs$m.readFile(input, "utf-8");
187320
187324
  const assData = compile(content, {});
187321
187325
  return assData["dialogues"].map((item) => Math.floor(item.start));
187322
187326
  }
@@ -187345,7 +187349,7 @@ const generateDanmakuImage = async (input, output, iOptions) => {
187345
187349
  };
187346
187350
  const options = Object.assign(defaultOptins, iOptions);
187347
187351
  const data = await generateDanmakuData(input, options);
187348
- await fs$k.ensureDir(output);
187352
+ await fs$m.ensureDir(output);
187349
187353
  const canvas$1 = canvas.createCanvas(options.width, options.height);
187350
187354
  const ctx = canvas$1.getContext("2d");
187351
187355
  const points = createChartPoints(data, options.width, options.height);
@@ -187356,7 +187360,7 @@ const generateDanmakuImage = async (input, output, iOptions) => {
187356
187360
  drawSmoothCurve(ctx, points);
187357
187361
  const outputPath = path$z.join(output, `${String(i).padStart(4, "0")}.png`);
187358
187362
  const png = await canvas$1.encode("png");
187359
- await fs$k.promises.writeFile(outputPath, png);
187363
+ await fs$m.promises.writeFile(outputPath, png);
187360
187364
  }
187361
187365
  return data;
187362
187366
  };
@@ -187513,7 +187517,7 @@ const genProcessedXml = async (input, output, filterFunction) => {
187513
187517
  ];
187514
187518
  const processedBuckets = processXmlItems(events, filterFunction);
187515
187519
  const xmlData = generateMergedXmlContent(processedBuckets.danmu, processedBuckets.gift, processedBuckets.sc, processedBuckets.guard, jObj.i?.metadata || {});
187516
- await fs$k.writeFile(output, xmlData);
187520
+ await fs$m.writeFile(output, xmlData);
187517
187521
  return output;
187518
187522
  };
187519
187523
  /**
@@ -187551,7 +187555,7 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
187551
187555
  .split(",")
187552
187556
  .filter((value) => value)
187553
187557
  .join("\n");
187554
- await fs$k.writeFile(fileTxtPath, fileTxtContent);
187558
+ await fs$m.writeFile(fileTxtPath, fileTxtContent);
187555
187559
  opts.blacklist = fileTxtPath;
187556
187560
  }
187557
187561
  const input = filteredOutput || originInput;
@@ -187566,10 +187570,10 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
187566
187570
  await trashItem(originInput);
187567
187571
  }
187568
187572
  if (opts.blacklist) {
187569
- fs$k.unlink(opts.blacklist);
187573
+ fs$m.unlink(opts.blacklist);
187570
187574
  }
187571
187575
  if (filteredOutput) {
187572
- fs$k.unlink(filteredOutput);
187576
+ fs$m.unlink(filteredOutput);
187573
187577
  }
187574
187578
  },
187575
187579
  onError: async (error) => {
@@ -187580,10 +187584,10 @@ const addConvertDanmu2AssTask = async (originInput, output, danmuOptions, option
187580
187584
  output: output,
187581
187585
  });
187582
187586
  if (opts.blacklist) {
187583
- fs$k.unlink(opts.blacklist);
187587
+ fs$m.unlink(opts.blacklist);
187584
187588
  }
187585
187589
  if (filteredOutput) {
187586
- fs$k.unlink(filteredOutput);
187590
+ fs$m.unlink(filteredOutput);
187587
187591
  }
187588
187592
  },
187589
187593
  });
@@ -187621,7 +187625,7 @@ const convertXml2Ass = async (file, danmuOptions, options) => {
187621
187625
  *
187622
187626
  */
187623
187627
  const isEmptyDanmu = async (filepath) => {
187624
- const readStream = fs$k.createReadStream(filepath, { encoding: "utf8" });
187628
+ const readStream = fs$m.createReadStream(filepath, { encoding: "utf8" });
187625
187629
  const rl = readline.createInterface({
187626
187630
  input: readStream,
187627
187631
  crlfDelay: Infinity,
@@ -187786,7 +187790,7 @@ const mergeXml = async (inputFiles, options = {}) => {
187786
187790
  // 生成XML内容
187787
187791
  const xmlContent = generateMergedXmlContent(mergedDanmuku, mergedGift, mergedSc, mergedGuard, metadata);
187788
187792
  // 写入合并后的XML文件
187789
- await fs$k.writeFile(outputPath, xmlContent);
187793
+ await fs$m.writeFile(outputPath, xmlContent);
187790
187794
  logObj.info("mergeXml", {
187791
187795
  status: "success",
187792
187796
  text: `合并完成,共处理了${inputFiles.length}个文件`,
@@ -187913,7 +187917,7 @@ const convertImage2Video = async (inputDir, output, options) => {
187913
187917
  onEnd: async () => {
187914
187918
  if ((await pathExists(inputDir))) {
187915
187919
  logObj.info("convertImage2Video, remove origin file", inputDir);
187916
- fs$k.rm(inputDir, { recursive: true, force: true });
187920
+ fs$m.rm(inputDir, { recursive: true, force: true });
187917
187921
  }
187918
187922
  },
187919
187923
  });
@@ -188347,10 +188351,10 @@ async function parseMeta(files) {
188347
188351
  duration: 0,
188348
188352
  };
188349
188353
  let content = "";
188350
- if (files.danmaFilePath && (await fs$k.pathExists(files.danmaFilePath))) {
188354
+ if (files.danmaFilePath && (await fs$m.pathExists(files.danmaFilePath))) {
188351
188355
  content += (await readLines(files.danmaFilePath, 0, 30)).join("\n");
188352
188356
  }
188353
- if (files.videoFilePath && (await fs$k.pathExists(files.videoFilePath))) {
188357
+ if (files.videoFilePath && (await fs$m.pathExists(files.videoFilePath))) {
188354
188358
  try {
188355
188359
  const meta = await readVideoMeta(files.videoFilePath, {
188356
188360
  json: true,
@@ -188637,17 +188641,17 @@ const mergeAssMp4 = async (files, options = {
188637
188641
  }
188638
188642
  if (files.hotProgressFilePath) {
188639
188643
  logObj.info("mergrAssMp4, remove hot progress origin file", assFile);
188640
- await fs$k.unlink(files.hotProgressFilePath);
188644
+ await fs$m.unlink(files.hotProgressFilePath);
188641
188645
  }
188642
188646
  if (files.subtitlePath && options.removeSubtitle) {
188643
188647
  logObj.info("mergrAssMp4, remove subtitle origin file", files.subtitlePath);
188644
- await fs$k.unlink(files.subtitlePath);
188648
+ await fs$m.unlink(files.subtitlePath);
188645
188649
  }
188646
188650
  },
188647
188651
  onError: async () => {
188648
188652
  if (files.hotProgressFilePath) {
188649
188653
  logObj.info("mergrAssMp4, remove hot progress origin file", assFile);
188650
- await fs$k.unlink(files.hotProgressFilePath);
188654
+ await fs$m.unlink(files.hotProgressFilePath);
188651
188655
  }
188652
188656
  },
188653
188657
  });
@@ -188785,7 +188789,7 @@ const mergeVideos = async (inputFiles, options = {
188785
188789
  await setFfmpegPath();
188786
188790
  const fileTxtPath = path$z.join(getTempPath(), `${uuid$4()}.txt`);
188787
188791
  const fileTxtContent = inputFiles.map((videoFile) => `file '${videoFile}'`).join("\n");
188788
- await fs$k.writeFile(fileTxtPath, fileTxtContent);
188792
+ await fs$m.writeFile(fileTxtPath, fileTxtContent);
188789
188793
  const command = ffmpeg(fileTxtPath).inputOptions("-f concat").inputOptions("-safe 0");
188790
188794
  if (options.keepFirstVideoMeta) {
188791
188795
  command.input(inputFiles[0]).outputOptions("-map 0").outputOptions(`-map_metadata 1`);
@@ -188814,13 +188818,13 @@ const mergeVideos = async (inputFiles, options = {
188814
188818
  return { ...progress, percentage: Math.round((currentTime / duration) * 100) };
188815
188819
  },
188816
188820
  onEnd: async () => {
188817
- fs$k.remove(fileTxtPath);
188821
+ fs$m.remove(fileTxtPath);
188818
188822
  if (options.removeOrigin) {
188819
188823
  await Promise.all(inputFiles.map((videoInput) => trashItem(videoInput)));
188820
188824
  }
188821
188825
  },
188822
188826
  onError: async () => {
188823
- fs$k.remove(fileTxtPath);
188827
+ fs$m.remove(fileTxtPath);
188824
188828
  },
188825
188829
  });
188826
188830
  taskQueue.addTask(task, false);
@@ -189077,7 +189081,7 @@ async function getPlayUrl(bvid, cid, uid) {
189077
189081
  * 直播回放下载
189078
189082
  */
189079
189083
  async function sliceDownload(output, url, options) {
189080
- if ((await fs$k.pathExists(output)) && !options.override)
189084
+ if ((await fs$m.pathExists(output)) && !options.override)
189081
189085
  throw new Error(`${output}已存在`);
189082
189086
  const { ffmpegPath } = getBinPath();
189083
189087
  const downloader = new M3U8Downloader(url, output, {
@@ -189095,7 +189099,7 @@ async function sliceDownload(output, url, options) {
189095
189099
  }
189096
189100
  // 下载视频
189097
189101
  async function download$2(options, uid) {
189098
- if ((await fs$k.pathExists(options.output)) && !options.override)
189102
+ if ((await fs$m.pathExists(options.output)) && !options.override)
189099
189103
  throw new Error(`${options.output}已存在`);
189100
189104
  const client = createClient(uid);
189101
189105
  const { ffmpegPath } = getBinPath();
@@ -189111,7 +189115,7 @@ async function download$2(options, uid) {
189111
189115
  if (options.danmu !== "none") {
189112
189116
  const data = await client.video.getAllDm({ bvid: options.bvid, cid: options.cid });
189113
189117
  const xmlContent = await utils$8.protoBufToXml(data);
189114
- fs$k.writeFile(path$z.join(path$z.dirname(options.output), `${path$z.parse(options.output).name}.xml`), xmlContent);
189118
+ fs$m.writeFile(path$z.join(path$z.dirname(options.output), `${path$z.parse(options.output).name}.xml`), xmlContent);
189115
189119
  }
189116
189120
  },
189117
189121
  });
@@ -189177,7 +189181,7 @@ function formatOptions(options, coverDir = undefined) {
189177
189181
  else {
189178
189182
  cover = undefined;
189179
189183
  }
189180
- if (cover && !fs$k.pathExistsSync(cover)) {
189184
+ if (cover && !fs$m.pathExistsSync(cover)) {
189181
189185
  console.warn("封面不存在", cover);
189182
189186
  cover = undefined;
189183
189187
  }
@@ -189763,7 +189767,7 @@ const validateBiliupConfig = (config) => {
189763
189767
  }
189764
189768
  return [true, null];
189765
189769
  };
189766
- function getPassKey() {
189770
+ function getPassKey$1() {
189767
189771
  if (process.env.BILILIVE_TOOLS_BILIKEY) {
189768
189772
  return process.env.BILILIVE_TOOLS_BILIKEY;
189769
189773
  }
@@ -189790,13 +189794,13 @@ const deleteUser = async (uid) => {
189790
189794
  // 写入用户数据
189791
189795
  const writeUser = async (data) => {
189792
189796
  const users = appConfig.getAll().bilibiliUser || {};
189793
- const passKey = getPassKey();
189797
+ const passKey = getPassKey$1();
189794
189798
  users[data.mid] = encrypt(JSON.stringify(data), passKey);
189795
189799
  appConfig.set("bilibiliUser", users);
189796
189800
  };
189797
189801
  // 解码用户数据并增加expires参数
189798
189802
  const decodeUser = (data) => {
189799
- const passKey = getPassKey();
189803
+ const passKey = getPassKey$1();
189800
189804
  const user = JSON.parse(decrypt(data, passKey));
189801
189805
  let expires = 0;
189802
189806
  try {
@@ -189879,7 +189883,7 @@ const getCookie$2 = (uid) => {
189879
189883
  return user.cookie;
189880
189884
  };
189881
189885
  // 检查b站账号有效期
189882
- const checkAccountLoop = () => {
189886
+ const checkBiliAccountLoop = () => {
189883
189887
  const canAutoCheck = appConfig.get("biliUpload")?.accountAutoCheck ?? false;
189884
189888
  let interval = 24 * 60 * 60 * 1000;
189885
189889
  try {
@@ -189909,7 +189913,7 @@ const checkAccountLoop = () => {
189909
189913
  }
189910
189914
  finally {
189911
189915
  // 24小时检查一次
189912
- setTimeout(checkAccountLoop, interval);
189916
+ setTimeout(checkBiliAccountLoop, interval);
189913
189917
  }
189914
189918
  };
189915
189919
  async function getBuvidConf$1() {
@@ -190279,7 +190283,7 @@ async function post(url, data, config) {
190279
190283
  function md5File(path) {
190280
190284
  return new Promise((resolve, reject) => {
190281
190285
  const output = crypto$d.createHash("md5");
190282
- const input = fs$D.createReadStream(path);
190286
+ const input = fs$F.createReadStream(path);
190283
190287
  input.on("error", err => {
190284
190288
  reject(err);
190285
190289
  });
@@ -190379,7 +190383,7 @@ class Uploader {
190379
190383
  * @returns 文件大小(字节)
190380
190384
  */
190381
190385
  getFileSizeSync(filePath) {
190382
- const stats = fs$D.statSync(filePath);
190386
+ const stats = fs$F.statSync(filePath);
190383
190387
  return stats.size;
190384
190388
  }
190385
190389
  /**
@@ -190635,7 +190639,7 @@ class Uploader {
190635
190639
  */
190636
190640
  createChunkStream(filePath, start, chunkSize) {
190637
190641
  const endByte = start + chunkSize - 1;
190638
- return fs$D.createReadStream(filePath, {
190642
+ return fs$F.createReadStream(filePath, {
190639
190643
  start,
190640
190644
  end: endByte,
190641
190645
  highWaterMark: 64 * 1024, // 64KB 块大小
@@ -191129,7 +191133,7 @@ class Pan123 extends TypedEmitter {
191129
191133
  * @returns Promise<void> 上传成功时resolve,失败时reject
191130
191134
  */
191131
191135
  async uploadFile(localFilePath, remoteDir = "", options) {
191132
- if (!(await fs$k.pathExists(localFilePath))) {
191136
+ if (!(await fs$m.pathExists(localFilePath))) {
191133
191137
  const error = new Error(`文件不存在: ${localFilePath}`);
191134
191138
  this.logger.error(error.message);
191135
191139
  console.log(remoteDir);
@@ -191137,7 +191141,7 @@ class Pan123 extends TypedEmitter {
191137
191141
  throw error;
191138
191142
  }
191139
191143
  // 检查文件大小是否超过10GB
191140
- const stats = await fs$k.stat(localFilePath);
191144
+ const stats = await fs$m.stat(localFilePath);
191141
191145
  const fileSize = stats.size;
191142
191146
  const maxSize = 10 * 1024 * 1024 * 1024; // 10GB
191143
191147
  if (fileSize > maxSize) {
@@ -191874,7 +191878,7 @@ const handleRestartTask = (taskId) => {
191874
191878
 
191875
191879
  let ntsuspend;
191876
191880
  function getNtSuspend() {
191877
- ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-ByKMHGR7.cjs', document.baseURI).href)))("ntsuspend");
191881
+ ntsuspend ??= node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-Bqpkb00O.cjs', document.baseURI).href)))("ntsuspend");
191878
191882
  return ntsuspend;
191879
191883
  }
191880
191884
  class DanmuTask extends AbstractTask {
@@ -192141,7 +192145,7 @@ class BiliPartVideoTask extends AbstractTask {
192141
192145
  if (this.useUploadPartPersistence) {
192142
192146
  try {
192143
192147
  const fileHash = await calculateFileQuickHash(command.filePath);
192144
- const fileSize = await fs$k.stat(command.filePath).then((stat) => stat.size);
192148
+ const fileSize = await fs$m.stat(command.filePath).then((stat) => stat.size);
192145
192149
  uploadPartService.addOrUpdate({
192146
192150
  file_hash: fileHash,
192147
192151
  file_size: fileSize,
@@ -192207,7 +192211,7 @@ class BiliPartVideoTask extends AbstractTask {
192207
192211
  if (this.useUploadPartPersistence) {
192208
192212
  try {
192209
192213
  const fileHash = await calculateFileQuickHash(command.filePath);
192210
- const fileSize = await fs$k.stat(command.filePath).then((stat) => stat.size);
192214
+ const fileSize = await fs$m.stat(command.filePath).then((stat) => stat.size);
192211
192215
  const part = uploadPartService.findValidPartByHash(fileHash, fileSize, String(this.uid));
192212
192216
  if (part) {
192213
192217
  this.status = "completed";
@@ -192237,7 +192241,7 @@ class BiliPartVideoTask extends AbstractTask {
192237
192241
  this.scheduleStalledProgressTimer();
192238
192242
  command.upload();
192239
192243
  try {
192240
- const fileSize = await fs$k.stat(command.filePath).then((stat) => stat.size);
192244
+ const fileSize = await fs$m.stat(command.filePath).then((stat) => stat.size);
192241
192245
  this.extra = { ...this.extra, fileSize };
192242
192246
  }
192243
192247
  catch (error) {
@@ -193094,6 +193098,390 @@ class FlvRepairTask extends AbstractTask {
193094
193098
  }
193095
193099
  }
193096
193100
 
193101
+ const USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36 Edg/115.0.1901.188";
193102
+ const QR_GENERATE_URL = "https://passport.douyu.com/scan/generateCode";
193103
+ const QR_AUTH_URL = "https://passport.douyu.com/japi/scan/auth";
193104
+ const LOGIN_REFERER = "https://passport.douyu.com/index/login?type=login&client_id=1";
193105
+ const MAIN_ORIGIN = "https://www.douyu.com";
193106
+ const MAIN_LOGIN_PATH = "/api/passport/login";
193107
+ const getPassKey = () => process.env.BILILIVE_TOOLS_BILIKEY ||
193108
+ "7d628cb145deba521d5b0195924c466cae6559289cf5a335624ad8e6d7ef0085";
193109
+ const parseCookie$1 = (cookie) => cookie.split(";").reduce((result, chunk) => {
193110
+ const [name, ...rest] = chunk.trim().split("=");
193111
+ if (name)
193112
+ result[name] = rest.join("=").trim();
193113
+ return result;
193114
+ }, {});
193115
+ const buildCookie = (cookies) => Object.entries(cookies)
193116
+ .filter(([, value]) => value !== "")
193117
+ .map(([name, value]) => `${name}=${value}`)
193118
+ .join("; ");
193119
+ const getSetCookieHeaders = (headers) => typeof headers.getSetCookie === "function"
193120
+ ? headers.getSetCookie()
193121
+ : headers.get("set-cookie")
193122
+ ? [headers.get("set-cookie")]
193123
+ : [];
193124
+ const parseSetCookiePair = (header) => {
193125
+ const pair = header.split(";", 1)[0];
193126
+ const index = pair.indexOf("=");
193127
+ return index > 0 ? [pair.slice(0, index).trim(), pair.slice(index + 1)] : null;
193128
+ };
193129
+ const mergeCookies = (currentCookie, headers) => {
193130
+ const cookies = parseCookie$1(currentCookie);
193131
+ for (const header of getSetCookieHeaders(headers)) {
193132
+ const pair = parseSetCookiePair(header);
193133
+ if (pair)
193134
+ cookies[pair[0]] = pair[1];
193135
+ }
193136
+ return buildCookie(cookies);
193137
+ };
193138
+ const decodeCookieValue = (value) => {
193139
+ if (!value)
193140
+ return "";
193141
+ try {
193142
+ return decodeURIComponent(value);
193143
+ }
193144
+ catch {
193145
+ return value;
193146
+ }
193147
+ };
193148
+ const createDeviceCookie = () => {
193149
+ const alphabet = "0123456789abcdefghijklmnopqrstuvwxyz";
193150
+ const suffix = [...crypto$d.randomBytes(31)].map((byte) => alphabet[byte % alphabet.length]).join("");
193151
+ const deviceId = `b${suffix}`;
193152
+ return `dy_did=${deviceId}; acf_did=${deviceId}; game_did=${deviceId}`;
193153
+ };
193154
+ const normalizeMainLoginUrl = (value) => {
193155
+ const url = new URL(value);
193156
+ if (url.origin !== MAIN_ORIGIN || url.pathname !== MAIN_LOGIN_PATH) {
193157
+ throw new Error("扫码登录主站地址无效");
193158
+ }
193159
+ if (!url.searchParams.has("callback"))
193160
+ url.searchParams.set("callback", "appClient_json_callback");
193161
+ if (!url.searchParams.has("_"))
193162
+ url.searchParams.set("_", String(Date.now()));
193163
+ return url.toString();
193164
+ };
193165
+ const parseJsonp = (text) => {
193166
+ const start = text.indexOf("{");
193167
+ const end = text.lastIndexOf("}");
193168
+ if (start < 0 || end <= start)
193169
+ return undefined;
193170
+ return JSON.parse(text.slice(start, end + 1));
193171
+ };
193172
+ class DouyuQrcodeLogin {
193173
+ code;
193174
+ url;
193175
+ expiresAt;
193176
+ passportCookie;
193177
+ cancelled = false;
193178
+ controller = null;
193179
+ pollPromise = null;
193180
+ constructor(code, url, expiresAt, passportCookie) {
193181
+ this.code = code;
193182
+ this.url = url;
193183
+ this.expiresAt = expiresAt;
193184
+ this.passportCookie = passportCookie;
193185
+ }
193186
+ static async create() {
193187
+ const passportCookie = createDeviceCookie();
193188
+ const body = new URLSearchParams({ client_id: "1", isMultiAccount: "0" });
193189
+ const response = await fetch(QR_GENERATE_URL, {
193190
+ method: "POST",
193191
+ body,
193192
+ headers: {
193193
+ "content-type": "application/x-www-form-urlencoded; charset=UTF-8",
193194
+ "x-requested-with": "XMLHttpRequest",
193195
+ "user-agent": USER_AGENT,
193196
+ referer: LOGIN_REFERER,
193197
+ cookie: passportCookie,
193198
+ },
193199
+ });
193200
+ if (!response.ok)
193201
+ throw new Error(`斗鱼接口请求失败(${response.status})`);
193202
+ const data = (await response.json());
193203
+ const expiresIn = data.data?.expire || 300;
193204
+ if (data.error !== 0 || !data.data?.code || !data.data.url) {
193205
+ throw new Error(data.msg || "获取斗鱼登录二维码失败");
193206
+ }
193207
+ return new DouyuQrcodeLogin(data.data.code, data.data.url, Date.now() + expiresIn * 1000, mergeCookies(passportCookie, response.headers));
193208
+ }
193209
+ cancel() {
193210
+ this.cancelled = true;
193211
+ this.controller?.abort();
193212
+ }
193213
+ poll() {
193214
+ if (!this.pollPromise) {
193215
+ this.pollPromise = this.pollInternal().finally(() => {
193216
+ this.pollPromise = null;
193217
+ });
193218
+ }
193219
+ return this.pollPromise;
193220
+ }
193221
+ async pollInternal() {
193222
+ if (this.cancelled)
193223
+ return { status: "error", failReason: "登录已取消" };
193224
+ if (Date.now() >= this.expiresAt)
193225
+ return { status: "error", failReason: "二维码已过期" };
193226
+ try {
193227
+ const checkUrl = new URL(QR_AUTH_URL);
193228
+ checkUrl.searchParams.set("time", String(Date.now()));
193229
+ checkUrl.searchParams.set("code", this.code);
193230
+ const response = await this.request(checkUrl.toString(), {
193231
+ headers: { cookie: this.passportCookie, "x-requested-with": "XMLHttpRequest" },
193232
+ });
193233
+ const result = (await response.json());
193234
+ if (result.error === -2 || result.error === 1)
193235
+ return { status: "scan" };
193236
+ if (result.error !== 0) {
193237
+ const fallback = result.error === -3 || result.error === 2 ? "二维码已过期" : "斗鱼登录失败";
193238
+ return { status: "error", failReason: result.msg || result.message || fallback };
193239
+ }
193240
+ if (!result.data?.url)
193241
+ throw new Error("扫码登录已确认,但斗鱼未返回主站登录地址");
193242
+ this.passportCookie = mergeCookies(this.passportCookie, response.headers);
193243
+ const { mainCookie, profile } = await this.fetchMainCookie(result.data.url);
193244
+ const mainCookies = parseCookie$1(mainCookie);
193245
+ const uid = Number(mainCookies.acf_uid);
193246
+ if (!Number.isSafeInteger(uid) || uid <= 0)
193247
+ throw new Error("登录成功但未获取到斗鱼 UID");
193248
+ const user = {
193249
+ uid,
193250
+ name: decodeCookieValue(profile.name) ||
193251
+ decodeCookieValue(mainCookies.acf_nickname) ||
193252
+ String(uid),
193253
+ avatar: decodeCookieValue(mainCookies.acf_avatar) || undefined,
193254
+ loginCookies: { passport: this.passportCookie, main: mainCookie },
193255
+ };
193256
+ return { status: "completed", user };
193257
+ }
193258
+ catch (error) {
193259
+ if (this.cancelled)
193260
+ return { status: "error", failReason: "登录已取消" };
193261
+ return {
193262
+ status: "error",
193263
+ failReason: error instanceof Error ? error.message : "斗鱼登录失败",
193264
+ };
193265
+ }
193266
+ }
193267
+ async fetchMainCookie(loginUrl) {
193268
+ const response = await this.request(normalizeMainLoginUrl(loginUrl), {
193269
+ headers: { cookie: this.passportCookie, referer: `${MAIN_ORIGIN}/` },
193270
+ });
193271
+ const body = parseJsonp(await response.text());
193272
+ if (body && Number(body.error) !== 0) {
193273
+ throw new Error(`扫码登录主站失败: ${String(body.msg || body.message || body.error)}`);
193274
+ }
193275
+ const passportCookies = parseCookie$1(this.passportCookie);
193276
+ const baseCookie = passportCookies.dy_did ? `dy_did=${passportCookies.dy_did}` : "";
193277
+ const mainCookie = mergeCookies(baseCookie, response.headers);
193278
+ const data = body?.data && typeof body.data === "object" ? body.data : {};
193279
+ return {
193280
+ mainCookie,
193281
+ profile: {
193282
+ name: typeof data.nickname === "string" ? data.nickname : undefined,
193283
+ avatar: typeof data.avatar === "string" ? data.avatar : undefined,
193284
+ },
193285
+ };
193286
+ }
193287
+ async request(url, init = {}) {
193288
+ if (this.cancelled)
193289
+ throw new Error("登录已取消");
193290
+ this.controller = new AbortController();
193291
+ const headers = new Headers(init.headers);
193292
+ headers.set("user-agent", USER_AGENT);
193293
+ if (!headers.has("referer"))
193294
+ headers.set("referer", LOGIN_REFERER);
193295
+ const response = await fetch(url, { ...init, headers, signal: this.controller.signal });
193296
+ if (!response.ok)
193297
+ throw new Error(`斗鱼接口请求失败(${response.status})`);
193298
+ return response;
193299
+ }
193300
+ }
193301
+ const writeDouyuUser = (user) => {
193302
+ const now = Date.now();
193303
+ const users = appConfig.get("douyuUser") || {};
193304
+ const storedUser = {
193305
+ uid: user.uid,
193306
+ name: user.name,
193307
+ avatar: user.avatar,
193308
+ createdAt: now,
193309
+ updatedAt: now,
193310
+ loginCookies: {
193311
+ passport: user.loginCookies.passport,
193312
+ main: user.loginCookies.main,
193313
+ },
193314
+ };
193315
+ users[user.uid] = encrypt(JSON.stringify(storedUser), getPassKey());
193316
+ appConfig.set("douyuUser", users);
193317
+ };
193318
+ const readDouyuUser = (uid) => {
193319
+ const value = (appConfig.get("douyuUser") || {})[uid];
193320
+ if (!value)
193321
+ return undefined;
193322
+ const storedUser = JSON.parse(decrypt(value, getPassKey()));
193323
+ const user = {
193324
+ uid: storedUser.uid,
193325
+ name: storedUser.name,
193326
+ avatar: storedUser.avatar,
193327
+ createdAt: storedUser.createdAt,
193328
+ updatedAt: storedUser.updatedAt,
193329
+ loginCookies: {
193330
+ passport: storedUser.loginCookies?.passport || "",
193331
+ main: storedUser.loginCookies?.main || storedUser.cookie || "",
193332
+ },
193333
+ };
193334
+ return user;
193335
+ };
193336
+ const readDouyuUserList = () => {
193337
+ const users = appConfig.get("douyuUser") || {};
193338
+ return Object.keys(users)
193339
+ .map((uid) => readDouyuUser(Number(uid)))
193340
+ .filter((user) => Boolean(user));
193341
+ };
193342
+ const deleteDouyuUser = (uid) => {
193343
+ const users = appConfig.get("douyuUser") || {};
193344
+ delete users[uid];
193345
+ appConfig.set("douyuUser", users);
193346
+ };
193347
+ /** 使用主站登录后可访问的粉丝牌接口校验 Cookie,不修改账号数据。 */
193348
+ const validateDouyuUser = async (uid) => {
193349
+ const user = readDouyuUser(uid);
193350
+ if (!user)
193351
+ throw new Error("斗鱼账号不存在");
193352
+ const cookie = user.loginCookies.main;
193353
+ if (!cookie)
193354
+ return false;
193355
+ const response = await fetch(`${MAIN_ORIGIN}/member/cp/getFansBadgeList`, {
193356
+ headers: {
193357
+ Cookie: cookie,
193358
+ "User-Agent": USER_AGENT,
193359
+ Referer: `${MAIN_ORIGIN}/`,
193360
+ },
193361
+ signal: AbortSignal.timeout(30_000),
193362
+ });
193363
+ if (response.status === 401 || response.status === 403)
193364
+ return false;
193365
+ if (!response.ok)
193366
+ throw new Error(`斗鱼校验请求失败(${response.status})`);
193367
+ const body = await response.text();
193368
+ return /fans-badge-list"\s*>[\s\S]*?<\/table>/.test(body);
193369
+ };
193370
+ const refreshRequests = new Map();
193371
+ /** 刷新主站 Cookie,保留本次登录记录的创建时间。 */
193372
+ const refreshDouyuUser = (uid) => {
193373
+ const pending = refreshRequests.get(uid);
193374
+ if (pending)
193375
+ return pending;
193376
+ const request = refreshDouyuUserInternal(uid).finally(() => refreshRequests.delete(uid));
193377
+ refreshRequests.set(uid, request);
193378
+ return request;
193379
+ };
193380
+ const refreshDouyuUserInternal = async (uid) => {
193381
+ const user = readDouyuUser(uid);
193382
+ if (!user)
193383
+ return;
193384
+ const passport = parseCookie$1(user.loginCookies.passport);
193385
+ const main = parseCookie$1(user.loginCookies.main);
193386
+ const did = passport.dy_did || main.dy_did;
193387
+ if (!did || !passport.LTP0)
193388
+ throw new Error("斗鱼刷新缺少 dy_did 或 LTP0");
193389
+ const timestamp = String(Date.now());
193390
+ const url = new URL("https://passport.douyu.com/lapi/passport/iframe/safeAuth");
193391
+ url.search = new URLSearchParams({
193392
+ client_id: "1",
193393
+ t: timestamp,
193394
+ _: timestamp,
193395
+ callback: "axiosJsonpCallback",
193396
+ }).toString();
193397
+ const response = await fetch(url.toString(), {
193398
+ headers: {
193399
+ Cookie: `dy_did=${did}; LTP0=${passport.LTP0}`,
193400
+ "User-Agent": USER_AGENT,
193401
+ Referer: `${MAIN_ORIGIN}/`,
193402
+ Origin: MAIN_ORIGIN,
193403
+ },
193404
+ signal: AbortSignal.timeout(30_000),
193405
+ });
193406
+ if (!response.ok)
193407
+ throw new Error(`斗鱼刷新请求失败(${response.status})`);
193408
+ const body = parseJsonp(await response.text());
193409
+ if (body?.error !== undefined && Number(body.error) !== 0) {
193410
+ throw new Error("斗鱼刷新登录态失败");
193411
+ }
193412
+ if (!getSetCookieHeaders(response.headers).some((header) => parseSetCookiePair(header))) {
193413
+ throw new Error("斗鱼刷新未返回 Cookie");
193414
+ }
193415
+ const cookie = mergeCookies(user.loginCookies.main, response.headers);
193416
+ if (Number(parseCookie$1(cookie).acf_uid) !== uid)
193417
+ throw new Error("斗鱼刷新账号 UID 不匹配");
193418
+ const users = appConfig.get("douyuUser") || {};
193419
+ users[uid] = encrypt(JSON.stringify({
193420
+ ...user,
193421
+ loginCookies: { ...user.loginCookies, main: cookie },
193422
+ updatedAt: Date.now(),
193423
+ }), getPassKey());
193424
+ appConfig.set("douyuUser", users);
193425
+ };
193426
+ const checkDouyuAccounts = async () => {
193427
+ const now = Date.now();
193428
+ for (const uid of Object.keys(appConfig.get("douyuUser") || {})) {
193429
+ try {
193430
+ const user = readDouyuUser(Number(uid));
193431
+ if (user && now - (user.updatedAt ?? 0) > 4 * 24 * 60 * 60 * 1000) {
193432
+ await refreshDouyuUser(user.uid);
193433
+ }
193434
+ }
193435
+ catch {
193436
+ // 不输出响应、请求头或 Cookie。
193437
+ logObj.warn(`斗鱼账号 ${uid} Cookie 刷新失败,将在下次检查时重试`);
193438
+ }
193439
+ }
193440
+ };
193441
+ const DAY_MS = 24 * 60 * 60 * 1000;
193442
+ const DOUYU_EXPIRY_MS = 60 * DAY_MS;
193443
+ const DOUYU_EXPIRY_NOTICE_MS = 5 * DAY_MS;
193444
+ /** 每日检查预计过期的斗鱼账号;单个账号失败不影响其他账号。 */
193445
+ const checkDouyuAccountExpiry = async () => {
193446
+ if (!appConfig.get("notification")?.task?.douyuAccountExpiry)
193447
+ return;
193448
+ const now = Date.now();
193449
+ for (const uid of Object.keys(appConfig.get("douyuUser") || {})) {
193450
+ try {
193451
+ const user = readDouyuUser(Number(uid));
193452
+ if (!user || !Number.isFinite(user.createdAt) || user.createdAt <= 0)
193453
+ continue;
193454
+ const expiresAt = user.createdAt + DOUYU_EXPIRY_MS;
193455
+ const remaining = expiresAt - now;
193456
+ if (remaining >= DOUYU_EXPIRY_NOTICE_MS)
193457
+ continue;
193458
+ const status = remaining <= 0 ? "预计已过期" : `预计还剩 ${Math.ceil(remaining / DAY_MS)} 天过期`;
193459
+ await send(remaining <= 0 ? "斗鱼账号预计已过期" : "斗鱼账号即将过期", `斗鱼账号 ${user.name || user.uid}(UID:${user.uid})${status},请重新扫码登录。`, { type: "douyuAccountExpiry", context: { uid: user.uid, name: user.name, expiresAt } });
193460
+ }
193461
+ catch {
193462
+ logObj.warn(`斗鱼账号 ${uid} 过期通知失败,将在下次检查时重试`);
193463
+ }
193464
+ }
193465
+ };
193466
+ // 斗鱼账号cookie刷新检查,每天一次
193467
+ const checkDouyuAccountLoop = async () => {
193468
+ try {
193469
+ await checkDouyuAccounts();
193470
+ }
193471
+ catch {
193472
+ logObj.warn("斗鱼账号检查失败,将在下次检查时重试");
193473
+ }
193474
+ finally {
193475
+ try {
193476
+ await checkDouyuAccountExpiry();
193477
+ }
193478
+ catch {
193479
+ logObj.warn("斗鱼账号过期检查失败,将在下次检查时重试");
193480
+ }
193481
+ setTimeout(checkDouyuAccountLoop, 24 * 60 * 60 * 1000);
193482
+ }
193483
+ };
193484
+
193097
193485
  class BiliCheckQueue extends TypedEmitter {
193098
193486
  list = [];
193099
193487
  appConfig;
@@ -193665,8 +194053,8 @@ function getValuesFromArrayLikeFlexSpaceBetween(array, columnCount) {
193665
194053
  }
193666
194054
  function ensureFolderExist(fileOrFolderPath) {
193667
194055
  const folder = path$z.dirname(fileOrFolderPath);
193668
- if (!fs$D.existsSync(folder)) {
193669
- fs$D.mkdirSync(folder, { recursive: true });
194056
+ if (!fs$F.existsSync(folder)) {
194057
+ fs$F.mkdirSync(folder, { recursive: true });
193670
194058
  }
193671
194059
  }
193672
194060
  function assert$p(assertion, msg) {
@@ -193820,7 +194208,7 @@ async function downloadImage(imageUrl, savePath) {
193820
194208
  if (!res.body) {
193821
194209
  throw new Error("No body in response");
193822
194210
  }
193823
- const fileStream = fs$D.createWriteStream(savePath, { flags: "wx" });
194211
+ const fileStream = fs$F.createWriteStream(savePath, { flags: "wx" });
193824
194212
  // @ts-ignore
193825
194213
  await promises.finished(require$$0$b.Readable.fromWeb(res.body).pipe(fileStream));
193826
194214
  }
@@ -194279,7 +194667,7 @@ function createRecordExtraDataController(savePath) {
194279
194667
  const initializeFile = async (content) => {
194280
194668
  // 这里有个假设,那就是第一次保存必然存在metatdata信息
194281
194669
  const initialContent = data.header.replace(METADATA_PLACEHOLDER, generateMetadataXml(data.meta));
194282
- await fs$D.promises.writeFile(savePath, initialContent + content);
194670
+ await fs$F.promises.writeFile(savePath, initialContent + content);
194283
194671
  hasPersistedHeader = true;
194284
194672
  };
194285
194673
  const writeToFile = async (force = false) => {
@@ -194456,7 +194844,7 @@ function generateXmlContent(metadata, messages) {
194456
194844
  async function appendToXmlFile(filePath, content) {
194457
194845
  try {
194458
194846
  // 直接追加内容
194459
- await fs$D.promises.appendFile(filePath, content);
194847
+ await fs$F.promises.appendFile(filePath, content);
194460
194848
  }
194461
194849
  catch (error) {
194462
194850
  console.error(`写入XML文件失败: ${filePath}`, error);
@@ -194520,7 +194908,7 @@ class Segment extends EventEmitter$k {
194520
194908
  text: `Renaming segment file: ${this.rawRecordingVideoPath} -> ${this.outputFilePath}`,
194521
194909
  });
194522
194910
  await Promise.all([
194523
- retry$1(() => fs$E.rename(this.rawRecordingVideoPath, this.outputFilePath), 20, 1000),
194911
+ retry$1(() => fs$G.rename(this.rawRecordingVideoPath, this.outputFilePath), 20, 1000),
194524
194912
  this.extraDataController?.flush(),
194525
194913
  ]);
194526
194914
  this.emit("videoFileCompleted", data);
@@ -224273,11 +224661,11 @@ function requireSubresourceIntegrity () {
224273
224661
  }
224274
224662
 
224275
224663
  var fetch_1$1;
224276
- var hasRequiredFetch$1;
224664
+ var hasRequiredFetch;
224277
224665
 
224278
- function requireFetch$1 () {
224279
- if (hasRequiredFetch$1) return fetch_1$1;
224280
- hasRequiredFetch$1 = 1;
224666
+ function requireFetch () {
224667
+ if (hasRequiredFetch) return fetch_1$1;
224668
+ hasRequiredFetch = 1;
224281
224669
 
224282
224670
  const {
224283
224671
  makeNetworkError,
@@ -226707,7 +227095,7 @@ function requireCache () {
226707
227095
  const { webidl } = requireWebidl();
226708
227096
  const { cloneResponse, fromInnerResponse, getResponseState } = requireResponse();
226709
227097
  const { Request, fromInnerRequest, getRequestState } = requireRequest();
226710
- const { fetching } = requireFetch$1();
227098
+ const { fetching } = requireFetch();
226711
227099
  const { urlIsHttpHttpsScheme, readAllBytes } = requireUtil$5();
226712
227100
  /**
226713
227101
  * @see https://w3c.github.io/ServiceWorker/#dfn-cache-batch-operation
@@ -229534,7 +229922,7 @@ function requireConnection () {
229534
229922
  const { uid, states, sentCloseFrameState, emptyBuffer, opcodes } = requireConstants();
229535
229923
  const { parseExtensions, isClosed, isClosing, isEstablished, isConnecting, validateCloseCodeAndReason } = requireUtil$2();
229536
229924
  const { makeRequest } = requireRequest();
229537
- const { fetching } = requireFetch$1();
229925
+ const { fetching } = requireFetch();
229538
229926
  const { Headers, getHeadersList } = requireHeaders();
229539
229927
  const { getDecodeSplit } = requireUtil$5();
229540
229928
  const { WebsocketFrameSend } = requireFrame();
@@ -232561,7 +232949,7 @@ function requireEventsource () {
232561
232949
  hasRequiredEventsource = 1;
232562
232950
 
232563
232951
  const { pipeline } = require$$0$b;
232564
- const { fetching } = requireFetch$1();
232952
+ const { fetching } = requireFetch();
232565
232953
  const { webidl } = requireWebidl();
232566
232954
  const { EventSourceStream } = requireEventsourceStream();
232567
232955
  const { parseMIMEType } = requireDataUrl();
@@ -233178,7 +233566,7 @@ undici.exports;
233178
233566
  module.exports.setGlobalDispatcher = setGlobalDispatcher;
233179
233567
  module.exports.getGlobalDispatcher = getGlobalDispatcher;
233180
233568
 
233181
- const fetchImpl = requireFetch$1().fetch;
233569
+ const fetchImpl = requireFetch().fetch;
233182
233570
 
233183
233571
  // Capture __filename at module load time for stack trace augmentation.
233184
233572
  // This may be undefined when bundled in environments like Node.js internals.
@@ -233369,6 +233757,7 @@ class HttpClient {
233369
233757
  method: mergedOpts.method || "GET",
233370
233758
  headers: {
233371
233759
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233760
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233372
233761
  ...mergedOpts.headers,
233373
233762
  },
233374
233763
  body: mergedOpts.body,
@@ -233394,6 +233783,7 @@ class HttpClient {
233394
233783
  method: "GET",
233395
233784
  headers: {
233396
233785
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233786
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233397
233787
  ...mergedOpts?.headers,
233398
233788
  },
233399
233789
  dispatcher: agent,
@@ -233435,6 +233825,7 @@ class HttpClient {
233435
233825
  headers: {
233436
233826
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233437
233827
  "Content-Type": contentType,
233828
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233438
233829
  ...mergedOpts?.headers,
233439
233830
  },
233440
233831
  body: requestBody,
@@ -233461,6 +233852,7 @@ class HttpClient {
233461
233852
  headers: {
233462
233853
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
233463
233854
  Accept: "*/*",
233855
+ ...(mergedOpts.cookie ? { Cookie: mergedOpts.cookie } : {}),
233464
233856
  ...mergedOpts?.headers,
233465
233857
  },
233466
233858
  dispatcher: agent,
@@ -233808,6 +234200,357 @@ async function getH5Play(http, opts) {
233808
234200
  }
233809
234201
  }
233810
234202
 
234203
+ var dist$2 = {};
234204
+
234205
+ Object.defineProperty(dist$2, "__esModule", { value: true });
234206
+ dist$2.parseCookie = parseCookie;
234207
+ dist$2.parse = parseCookie;
234208
+ dist$2.stringifyCookie = stringifyCookie;
234209
+ dist$2.stringifySetCookie = stringifySetCookie;
234210
+ dist$2.serialize = stringifySetCookie;
234211
+ dist$2.parseSetCookie = parseSetCookie;
234212
+ dist$2.stringifySetCookie = stringifySetCookie;
234213
+ dist$2.serialize = stringifySetCookie;
234214
+ /**
234215
+ * RegExp to match cookie-name in RFC 6265 sec 4.1.1
234216
+ * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
234217
+ * which has been replaced by the token definition in RFC 7230 appendix B.
234218
+ *
234219
+ * cookie-name = token
234220
+ * token = 1*tchar
234221
+ * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
234222
+ * "*" / "+" / "-" / "." / "^" / "_" /
234223
+ * "`" / "|" / "~" / DIGIT / ALPHA
234224
+ *
234225
+ * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
234226
+ * Allow same range as cookie value, except `=`, which delimits end of name.
234227
+ */
234228
+ const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
234229
+ /**
234230
+ * RegExp to match cookie-value in RFC 6265 sec 4.1.1
234231
+ *
234232
+ * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
234233
+ * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
234234
+ * ; US-ASCII characters excluding CTLs,
234235
+ * ; whitespace DQUOTE, comma, semicolon,
234236
+ * ; and backslash
234237
+ *
234238
+ * Allowing more characters: https://github.com/jshttp/cookie/issues/191
234239
+ * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
234240
+ */
234241
+ const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
234242
+ /**
234243
+ * RegExp to match domain-value in RFC 6265 sec 4.1.1
234244
+ *
234245
+ * domain-value = <subdomain>
234246
+ * ; defined in [RFC1034], Section 3.5, as
234247
+ * ; enhanced by [RFC1123], Section 2.1
234248
+ * <subdomain> = <label> | <subdomain> "." <label>
234249
+ * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
234250
+ * Labels must be 63 characters or less.
234251
+ * 'let-dig' not 'letter' in the first char, per RFC1123
234252
+ * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
234253
+ * <let-dig-hyp> = <let-dig> | "-"
234254
+ * <let-dig> = <letter> | <digit>
234255
+ * <letter> = any one of the 52 alphabetic characters A through Z in
234256
+ * upper case and a through z in lower case
234257
+ * <digit> = any one of the ten digits 0 through 9
234258
+ *
234259
+ * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
234260
+ *
234261
+ * > (Note that a leading %x2E ("."), if present, is ignored even though that
234262
+ * character is not permitted, but a trailing %x2E ("."), if present, will
234263
+ * cause the user agent to ignore the attribute.)
234264
+ */
234265
+ const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
234266
+ /**
234267
+ * RegExp to match path-value in RFC 6265 sec 4.1.1
234268
+ *
234269
+ * path-value = <any CHAR except CTLs or ";">
234270
+ * CHAR = %x01-7F
234271
+ * ; defined in RFC 5234 appendix B.1
234272
+ */
234273
+ const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
234274
+ /**
234275
+ * RegExp to match max-age-value in RFC 6265 sec 5.6.2
234276
+ */
234277
+ const maxAgeRegExp = /^-?\d+$/;
234278
+ const __toString = Object.prototype.toString;
234279
+ const NullObject = /* @__PURE__ */ (() => {
234280
+ const C = function () { };
234281
+ C.prototype = Object.create(null);
234282
+ return C;
234283
+ })();
234284
+ /**
234285
+ * Parse a `Cookie` header.
234286
+ *
234287
+ * Parse the given cookie header string into an object
234288
+ * The object has the various cookies as keys(names) => values
234289
+ */
234290
+ function parseCookie(str, options) {
234291
+ const obj = new NullObject();
234292
+ const len = str.length;
234293
+ // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
234294
+ if (len < 2)
234295
+ return obj;
234296
+ const dec = options?.decode || decode$1;
234297
+ let index = 0;
234298
+ do {
234299
+ const eqIdx = eqIndex(str, index, len);
234300
+ if (eqIdx === -1)
234301
+ break; // No more cookie pairs.
234302
+ const endIdx = endIndex(str, index, len);
234303
+ if (eqIdx > endIdx) {
234304
+ // backtrack on prior semicolon
234305
+ index = str.lastIndexOf(";", eqIdx - 1) + 1;
234306
+ continue;
234307
+ }
234308
+ const key = valueSlice(str, index, eqIdx);
234309
+ // only assign once
234310
+ if (obj[key] === undefined) {
234311
+ obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
234312
+ }
234313
+ index = endIdx + 1;
234314
+ } while (index < len);
234315
+ return obj;
234316
+ }
234317
+ /**
234318
+ * Stringifies an object into an HTTP `Cookie` header.
234319
+ */
234320
+ function stringifyCookie(cookie, options) {
234321
+ const enc = options?.encode || encodeURIComponent;
234322
+ const cookieStrings = [];
234323
+ for (const name of Object.keys(cookie)) {
234324
+ const val = cookie[name];
234325
+ if (val === undefined)
234326
+ continue;
234327
+ if (!cookieNameRegExp.test(name)) {
234328
+ throw new TypeError(`cookie name is invalid: ${name}`);
234329
+ }
234330
+ const value = enc(val);
234331
+ if (!cookieValueRegExp.test(value)) {
234332
+ throw new TypeError(`cookie val is invalid: ${val}`);
234333
+ }
234334
+ cookieStrings.push(`${name}=${value}`);
234335
+ }
234336
+ return cookieStrings.join("; ");
234337
+ }
234338
+ function stringifySetCookie(_name, _val, _opts) {
234339
+ const cookie = typeof _name === "object"
234340
+ ? _name
234341
+ : { ..._opts, name: _name, value: String(_val) };
234342
+ const options = typeof _val === "object" ? _val : _opts;
234343
+ const enc = options?.encode || encodeURIComponent;
234344
+ if (!cookieNameRegExp.test(cookie.name)) {
234345
+ throw new TypeError(`argument name is invalid: ${cookie.name}`);
234346
+ }
234347
+ const value = cookie.value ? enc(cookie.value) : "";
234348
+ if (!cookieValueRegExp.test(value)) {
234349
+ throw new TypeError(`argument val is invalid: ${cookie.value}`);
234350
+ }
234351
+ let str = cookie.name + "=" + value;
234352
+ if (cookie.maxAge !== undefined) {
234353
+ if (!Number.isInteger(cookie.maxAge)) {
234354
+ throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
234355
+ }
234356
+ str += "; Max-Age=" + cookie.maxAge;
234357
+ }
234358
+ if (cookie.domain) {
234359
+ if (!domainValueRegExp.test(cookie.domain)) {
234360
+ throw new TypeError(`option domain is invalid: ${cookie.domain}`);
234361
+ }
234362
+ str += "; Domain=" + cookie.domain;
234363
+ }
234364
+ if (cookie.path) {
234365
+ if (!pathValueRegExp.test(cookie.path)) {
234366
+ throw new TypeError(`option path is invalid: ${cookie.path}`);
234367
+ }
234368
+ str += "; Path=" + cookie.path;
234369
+ }
234370
+ if (cookie.expires) {
234371
+ if (!isDate$1(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
234372
+ throw new TypeError(`option expires is invalid: ${cookie.expires}`);
234373
+ }
234374
+ str += "; Expires=" + cookie.expires.toUTCString();
234375
+ }
234376
+ if (cookie.httpOnly) {
234377
+ str += "; HttpOnly";
234378
+ }
234379
+ if (cookie.secure) {
234380
+ str += "; Secure";
234381
+ }
234382
+ if (cookie.partitioned) {
234383
+ str += "; Partitioned";
234384
+ }
234385
+ if (cookie.priority) {
234386
+ const priority = typeof cookie.priority === "string"
234387
+ ? cookie.priority.toLowerCase()
234388
+ : undefined;
234389
+ switch (priority) {
234390
+ case "low":
234391
+ str += "; Priority=Low";
234392
+ break;
234393
+ case "medium":
234394
+ str += "; Priority=Medium";
234395
+ break;
234396
+ case "high":
234397
+ str += "; Priority=High";
234398
+ break;
234399
+ default:
234400
+ throw new TypeError(`option priority is invalid: ${cookie.priority}`);
234401
+ }
234402
+ }
234403
+ if (cookie.sameSite) {
234404
+ const sameSite = typeof cookie.sameSite === "string"
234405
+ ? cookie.sameSite.toLowerCase()
234406
+ : cookie.sameSite;
234407
+ switch (sameSite) {
234408
+ case true:
234409
+ case "strict":
234410
+ str += "; SameSite=Strict";
234411
+ break;
234412
+ case "lax":
234413
+ str += "; SameSite=Lax";
234414
+ break;
234415
+ case "none":
234416
+ str += "; SameSite=None";
234417
+ break;
234418
+ default:
234419
+ throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
234420
+ }
234421
+ }
234422
+ return str;
234423
+ }
234424
+ /**
234425
+ * Deserialize a `Set-Cookie` header into an object.
234426
+ *
234427
+ * deserialize('foo=bar; httpOnly')
234428
+ * => { name: 'foo', value: 'bar', httpOnly: true }
234429
+ */
234430
+ function parseSetCookie(str, options) {
234431
+ const dec = options?.decode || decode$1;
234432
+ const len = str.length;
234433
+ const endIdx = endIndex(str, 0, len);
234434
+ const eqIdx = eqIndex(str, 0, endIdx);
234435
+ const setCookie = eqIdx === -1
234436
+ ? { name: "", value: dec(valueSlice(str, 0, endIdx)) }
234437
+ : {
234438
+ name: valueSlice(str, 0, eqIdx),
234439
+ value: dec(valueSlice(str, eqIdx + 1, endIdx)),
234440
+ };
234441
+ let index = endIdx + 1;
234442
+ while (index < len) {
234443
+ const endIdx = endIndex(str, index, len);
234444
+ const eqIdx = eqIndex(str, index, endIdx);
234445
+ const attr = eqIdx === -1
234446
+ ? valueSlice(str, index, endIdx)
234447
+ : valueSlice(str, index, eqIdx);
234448
+ const val = eqIdx === -1 ? undefined : valueSlice(str, eqIdx + 1, endIdx);
234449
+ switch (attr.toLowerCase()) {
234450
+ case "httponly":
234451
+ setCookie.httpOnly = true;
234452
+ break;
234453
+ case "secure":
234454
+ setCookie.secure = true;
234455
+ break;
234456
+ case "partitioned":
234457
+ setCookie.partitioned = true;
234458
+ break;
234459
+ case "domain":
234460
+ setCookie.domain = val;
234461
+ break;
234462
+ case "path":
234463
+ setCookie.path = val;
234464
+ break;
234465
+ case "max-age":
234466
+ if (val && maxAgeRegExp.test(val))
234467
+ setCookie.maxAge = Number(val);
234468
+ break;
234469
+ case "expires":
234470
+ if (!val)
234471
+ break;
234472
+ const date = new Date(val);
234473
+ if (Number.isFinite(date.valueOf()))
234474
+ setCookie.expires = date;
234475
+ break;
234476
+ case "priority":
234477
+ if (!val)
234478
+ break;
234479
+ const priority = val.toLowerCase();
234480
+ if (priority === "low" ||
234481
+ priority === "medium" ||
234482
+ priority === "high") {
234483
+ setCookie.priority = priority;
234484
+ }
234485
+ break;
234486
+ case "samesite":
234487
+ if (!val)
234488
+ break;
234489
+ const sameSite = val.toLowerCase();
234490
+ if (sameSite === "lax" ||
234491
+ sameSite === "strict" ||
234492
+ sameSite === "none") {
234493
+ setCookie.sameSite = sameSite;
234494
+ }
234495
+ break;
234496
+ }
234497
+ index = endIdx + 1;
234498
+ }
234499
+ return setCookie;
234500
+ }
234501
+ /**
234502
+ * Find the `;` character between `min` and `len` in str.
234503
+ */
234504
+ function endIndex(str, min, len) {
234505
+ const index = str.indexOf(";", min);
234506
+ return index === -1 ? len : index;
234507
+ }
234508
+ /**
234509
+ * Find the `=` character between `min` and `max` in str.
234510
+ */
234511
+ function eqIndex(str, min, max) {
234512
+ const index = str.indexOf("=", min);
234513
+ return index < max ? index : -1;
234514
+ }
234515
+ /**
234516
+ * Slice out a value between startPod to max.
234517
+ */
234518
+ function valueSlice(str, min, max) {
234519
+ let start = min;
234520
+ let end = max;
234521
+ do {
234522
+ const code = str.charCodeAt(start);
234523
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
234524
+ break;
234525
+ } while (++start < end);
234526
+ while (end > start) {
234527
+ const code = str.charCodeAt(end - 1);
234528
+ if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
234529
+ break;
234530
+ end--;
234531
+ }
234532
+ return str.slice(start, end);
234533
+ }
234534
+ /**
234535
+ * URL-decode string value. Optimized to skip native call when no %.
234536
+ */
234537
+ function decode$1(str) {
234538
+ if (str.indexOf("%") === -1)
234539
+ return str;
234540
+ try {
234541
+ return decodeURIComponent(str);
234542
+ }
234543
+ catch (e) {
234544
+ return str;
234545
+ }
234546
+ }
234547
+ /**
234548
+ * Determine if value is a Date.
234549
+ */
234550
+ function isDate$1(val) {
234551
+ return __toString.call(val) === "[object Date]";
234552
+ }
234553
+
233811
234554
  const DEFAULT_DID = "10000000000000000000000000001501";
233812
234555
  const ENCRYPTION_CACHE_TTL = 5 * 60 * 1000;
233813
234556
  const encryptionCache = new Map();
@@ -233859,7 +234602,13 @@ async function getEncryption(http, did) {
233859
234602
  }
233860
234603
  }
233861
234604
  async function getH5PlayV1(http, opts) {
233862
- const did = DEFAULT_DID;
234605
+ let did = DEFAULT_DID;
234606
+ if (http?.defaultOptions?.cookie) {
234607
+ const cookies = dist$2.parse(http.defaultOptions.cookie);
234608
+ if (cookies.dy_did) {
234609
+ did = cookies.dy_did;
234610
+ }
234611
+ }
233863
234612
  const timestamp = Math.round(Date.now() / 1000);
233864
234613
  const encryptionData = await getEncryption(http, did);
233865
234614
  const auth = buildAuth(opts.channelId, timestamp, encryptionData);
@@ -237670,357 +238419,6 @@ var Client = class {
237670
238419
  }
237671
238420
  };
237672
238421
 
237673
- var dist$2 = {};
237674
-
237675
- Object.defineProperty(dist$2, "__esModule", { value: true });
237676
- dist$2.parseCookie = parseCookie;
237677
- dist$2.parse = parseCookie;
237678
- dist$2.stringifyCookie = stringifyCookie;
237679
- dist$2.stringifySetCookie = stringifySetCookie;
237680
- dist$2.serialize = stringifySetCookie;
237681
- dist$2.parseSetCookie = parseSetCookie;
237682
- dist$2.stringifySetCookie = stringifySetCookie;
237683
- dist$2.serialize = stringifySetCookie;
237684
- /**
237685
- * RegExp to match cookie-name in RFC 6265 sec 4.1.1
237686
- * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
237687
- * which has been replaced by the token definition in RFC 7230 appendix B.
237688
- *
237689
- * cookie-name = token
237690
- * token = 1*tchar
237691
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
237692
- * "*" / "+" / "-" / "." / "^" / "_" /
237693
- * "`" / "|" / "~" / DIGIT / ALPHA
237694
- *
237695
- * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
237696
- * Allow same range as cookie value, except `=`, which delimits end of name.
237697
- */
237698
- const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
237699
- /**
237700
- * RegExp to match cookie-value in RFC 6265 sec 4.1.1
237701
- *
237702
- * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
237703
- * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
237704
- * ; US-ASCII characters excluding CTLs,
237705
- * ; whitespace DQUOTE, comma, semicolon,
237706
- * ; and backslash
237707
- *
237708
- * Allowing more characters: https://github.com/jshttp/cookie/issues/191
237709
- * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
237710
- */
237711
- const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
237712
- /**
237713
- * RegExp to match domain-value in RFC 6265 sec 4.1.1
237714
- *
237715
- * domain-value = <subdomain>
237716
- * ; defined in [RFC1034], Section 3.5, as
237717
- * ; enhanced by [RFC1123], Section 2.1
237718
- * <subdomain> = <label> | <subdomain> "." <label>
237719
- * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
237720
- * Labels must be 63 characters or less.
237721
- * 'let-dig' not 'letter' in the first char, per RFC1123
237722
- * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
237723
- * <let-dig-hyp> = <let-dig> | "-"
237724
- * <let-dig> = <letter> | <digit>
237725
- * <letter> = any one of the 52 alphabetic characters A through Z in
237726
- * upper case and a through z in lower case
237727
- * <digit> = any one of the ten digits 0 through 9
237728
- *
237729
- * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
237730
- *
237731
- * > (Note that a leading %x2E ("."), if present, is ignored even though that
237732
- * character is not permitted, but a trailing %x2E ("."), if present, will
237733
- * cause the user agent to ignore the attribute.)
237734
- */
237735
- const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
237736
- /**
237737
- * RegExp to match path-value in RFC 6265 sec 4.1.1
237738
- *
237739
- * path-value = <any CHAR except CTLs or ";">
237740
- * CHAR = %x01-7F
237741
- * ; defined in RFC 5234 appendix B.1
237742
- */
237743
- const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
237744
- /**
237745
- * RegExp to match max-age-value in RFC 6265 sec 5.6.2
237746
- */
237747
- const maxAgeRegExp = /^-?\d+$/;
237748
- const __toString = Object.prototype.toString;
237749
- const NullObject = /* @__PURE__ */ (() => {
237750
- const C = function () { };
237751
- C.prototype = Object.create(null);
237752
- return C;
237753
- })();
237754
- /**
237755
- * Parse a `Cookie` header.
237756
- *
237757
- * Parse the given cookie header string into an object
237758
- * The object has the various cookies as keys(names) => values
237759
- */
237760
- function parseCookie(str, options) {
237761
- const obj = new NullObject();
237762
- const len = str.length;
237763
- // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
237764
- if (len < 2)
237765
- return obj;
237766
- const dec = options?.decode || decode$1;
237767
- let index = 0;
237768
- do {
237769
- const eqIdx = eqIndex(str, index, len);
237770
- if (eqIdx === -1)
237771
- break; // No more cookie pairs.
237772
- const endIdx = endIndex(str, index, len);
237773
- if (eqIdx > endIdx) {
237774
- // backtrack on prior semicolon
237775
- index = str.lastIndexOf(";", eqIdx - 1) + 1;
237776
- continue;
237777
- }
237778
- const key = valueSlice(str, index, eqIdx);
237779
- // only assign once
237780
- if (obj[key] === undefined) {
237781
- obj[key] = dec(valueSlice(str, eqIdx + 1, endIdx));
237782
- }
237783
- index = endIdx + 1;
237784
- } while (index < len);
237785
- return obj;
237786
- }
237787
- /**
237788
- * Stringifies an object into an HTTP `Cookie` header.
237789
- */
237790
- function stringifyCookie(cookie, options) {
237791
- const enc = options?.encode || encodeURIComponent;
237792
- const cookieStrings = [];
237793
- for (const name of Object.keys(cookie)) {
237794
- const val = cookie[name];
237795
- if (val === undefined)
237796
- continue;
237797
- if (!cookieNameRegExp.test(name)) {
237798
- throw new TypeError(`cookie name is invalid: ${name}`);
237799
- }
237800
- const value = enc(val);
237801
- if (!cookieValueRegExp.test(value)) {
237802
- throw new TypeError(`cookie val is invalid: ${val}`);
237803
- }
237804
- cookieStrings.push(`${name}=${value}`);
237805
- }
237806
- return cookieStrings.join("; ");
237807
- }
237808
- function stringifySetCookie(_name, _val, _opts) {
237809
- const cookie = typeof _name === "object"
237810
- ? _name
237811
- : { ..._opts, name: _name, value: String(_val) };
237812
- const options = typeof _val === "object" ? _val : _opts;
237813
- const enc = options?.encode || encodeURIComponent;
237814
- if (!cookieNameRegExp.test(cookie.name)) {
237815
- throw new TypeError(`argument name is invalid: ${cookie.name}`);
237816
- }
237817
- const value = cookie.value ? enc(cookie.value) : "";
237818
- if (!cookieValueRegExp.test(value)) {
237819
- throw new TypeError(`argument val is invalid: ${cookie.value}`);
237820
- }
237821
- let str = cookie.name + "=" + value;
237822
- if (cookie.maxAge !== undefined) {
237823
- if (!Number.isInteger(cookie.maxAge)) {
237824
- throw new TypeError(`option maxAge is invalid: ${cookie.maxAge}`);
237825
- }
237826
- str += "; Max-Age=" + cookie.maxAge;
237827
- }
237828
- if (cookie.domain) {
237829
- if (!domainValueRegExp.test(cookie.domain)) {
237830
- throw new TypeError(`option domain is invalid: ${cookie.domain}`);
237831
- }
237832
- str += "; Domain=" + cookie.domain;
237833
- }
237834
- if (cookie.path) {
237835
- if (!pathValueRegExp.test(cookie.path)) {
237836
- throw new TypeError(`option path is invalid: ${cookie.path}`);
237837
- }
237838
- str += "; Path=" + cookie.path;
237839
- }
237840
- if (cookie.expires) {
237841
- if (!isDate$1(cookie.expires) || !Number.isFinite(cookie.expires.valueOf())) {
237842
- throw new TypeError(`option expires is invalid: ${cookie.expires}`);
237843
- }
237844
- str += "; Expires=" + cookie.expires.toUTCString();
237845
- }
237846
- if (cookie.httpOnly) {
237847
- str += "; HttpOnly";
237848
- }
237849
- if (cookie.secure) {
237850
- str += "; Secure";
237851
- }
237852
- if (cookie.partitioned) {
237853
- str += "; Partitioned";
237854
- }
237855
- if (cookie.priority) {
237856
- const priority = typeof cookie.priority === "string"
237857
- ? cookie.priority.toLowerCase()
237858
- : undefined;
237859
- switch (priority) {
237860
- case "low":
237861
- str += "; Priority=Low";
237862
- break;
237863
- case "medium":
237864
- str += "; Priority=Medium";
237865
- break;
237866
- case "high":
237867
- str += "; Priority=High";
237868
- break;
237869
- default:
237870
- throw new TypeError(`option priority is invalid: ${cookie.priority}`);
237871
- }
237872
- }
237873
- if (cookie.sameSite) {
237874
- const sameSite = typeof cookie.sameSite === "string"
237875
- ? cookie.sameSite.toLowerCase()
237876
- : cookie.sameSite;
237877
- switch (sameSite) {
237878
- case true:
237879
- case "strict":
237880
- str += "; SameSite=Strict";
237881
- break;
237882
- case "lax":
237883
- str += "; SameSite=Lax";
237884
- break;
237885
- case "none":
237886
- str += "; SameSite=None";
237887
- break;
237888
- default:
237889
- throw new TypeError(`option sameSite is invalid: ${cookie.sameSite}`);
237890
- }
237891
- }
237892
- return str;
237893
- }
237894
- /**
237895
- * Deserialize a `Set-Cookie` header into an object.
237896
- *
237897
- * deserialize('foo=bar; httpOnly')
237898
- * => { name: 'foo', value: 'bar', httpOnly: true }
237899
- */
237900
- function parseSetCookie(str, options) {
237901
- const dec = options?.decode || decode$1;
237902
- const len = str.length;
237903
- const endIdx = endIndex(str, 0, len);
237904
- const eqIdx = eqIndex(str, 0, endIdx);
237905
- const setCookie = eqIdx === -1
237906
- ? { name: "", value: dec(valueSlice(str, 0, endIdx)) }
237907
- : {
237908
- name: valueSlice(str, 0, eqIdx),
237909
- value: dec(valueSlice(str, eqIdx + 1, endIdx)),
237910
- };
237911
- let index = endIdx + 1;
237912
- while (index < len) {
237913
- const endIdx = endIndex(str, index, len);
237914
- const eqIdx = eqIndex(str, index, endIdx);
237915
- const attr = eqIdx === -1
237916
- ? valueSlice(str, index, endIdx)
237917
- : valueSlice(str, index, eqIdx);
237918
- const val = eqIdx === -1 ? undefined : valueSlice(str, eqIdx + 1, endIdx);
237919
- switch (attr.toLowerCase()) {
237920
- case "httponly":
237921
- setCookie.httpOnly = true;
237922
- break;
237923
- case "secure":
237924
- setCookie.secure = true;
237925
- break;
237926
- case "partitioned":
237927
- setCookie.partitioned = true;
237928
- break;
237929
- case "domain":
237930
- setCookie.domain = val;
237931
- break;
237932
- case "path":
237933
- setCookie.path = val;
237934
- break;
237935
- case "max-age":
237936
- if (val && maxAgeRegExp.test(val))
237937
- setCookie.maxAge = Number(val);
237938
- break;
237939
- case "expires":
237940
- if (!val)
237941
- break;
237942
- const date = new Date(val);
237943
- if (Number.isFinite(date.valueOf()))
237944
- setCookie.expires = date;
237945
- break;
237946
- case "priority":
237947
- if (!val)
237948
- break;
237949
- const priority = val.toLowerCase();
237950
- if (priority === "low" ||
237951
- priority === "medium" ||
237952
- priority === "high") {
237953
- setCookie.priority = priority;
237954
- }
237955
- break;
237956
- case "samesite":
237957
- if (!val)
237958
- break;
237959
- const sameSite = val.toLowerCase();
237960
- if (sameSite === "lax" ||
237961
- sameSite === "strict" ||
237962
- sameSite === "none") {
237963
- setCookie.sameSite = sameSite;
237964
- }
237965
- break;
237966
- }
237967
- index = endIdx + 1;
237968
- }
237969
- return setCookie;
237970
- }
237971
- /**
237972
- * Find the `;` character between `min` and `len` in str.
237973
- */
237974
- function endIndex(str, min, len) {
237975
- const index = str.indexOf(";", min);
237976
- return index === -1 ? len : index;
237977
- }
237978
- /**
237979
- * Find the `=` character between `min` and `max` in str.
237980
- */
237981
- function eqIndex(str, min, max) {
237982
- const index = str.indexOf("=", min);
237983
- return index < max ? index : -1;
237984
- }
237985
- /**
237986
- * Slice out a value between startPod to max.
237987
- */
237988
- function valueSlice(str, min, max) {
237989
- let start = min;
237990
- let end = max;
237991
- do {
237992
- const code = str.charCodeAt(start);
237993
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
237994
- break;
237995
- } while (++start < end);
237996
- while (end > start) {
237997
- const code = str.charCodeAt(end - 1);
237998
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
237999
- break;
238000
- end--;
238001
- }
238002
- return str.slice(start, end);
238003
- }
238004
- /**
238005
- * URL-decode string value. Optimized to skip native call when no %.
238006
- */
238007
- function decode$1(str) {
238008
- if (str.indexOf("%") === -1)
238009
- return str;
238010
- try {
238011
- return decodeURIComponent(str);
238012
- }
238013
- catch (e) {
238014
- return str;
238015
- }
238016
- }
238017
- /**
238018
- * Determine if value is a Date.
238019
- */
238020
- function isDate$1(val) {
238021
- return __toString.call(val) === "[object Date]";
238022
- }
238023
-
238024
238422
  /**
238025
238423
  * 小红书 API 层
238026
238424
  */
@@ -238592,8 +238990,8 @@ registry.register("xhs", (opts) => new XhsParser(opts));
238592
238990
  registry.register("xiaohongshu", (opts) => new XhsParser(opts));
238593
238991
  registry.register("tiktok", (opts) => new TikTokParser(opts));
238594
238992
 
238595
- async function getInfo$5(channelId) {
238596
- const parser = new DouyuParser();
238993
+ async function getInfo$5(channelId, auth) {
238994
+ const parser = new DouyuParser({ cookie: auth });
238597
238995
  const data = await parser.getRoomInfo(channelId);
238598
238996
  const startTime = data.liveStartTime || new Date();
238599
238997
  const recordStartTime = new Date();
@@ -238615,7 +239013,7 @@ async function getStream$7(opts) {
238615
239013
  if (opts.source === "auto" && opts.avoidEdgeCDN) {
238616
239014
  cdn = "hw-h5";
238617
239015
  }
238618
- const parser = new DouyuParser();
239016
+ const parser = new DouyuParser({ cookie: opts.auth });
238619
239017
  const shouldHevc = opts.codecName === "hevc";
238620
239018
  const isOldApi = opts.api === "old";
238621
239019
  let liveInfo = await parser.getLiveInfo(opts.channelId, {
@@ -238649,20 +239047,18 @@ async function getStream$7(opts) {
238649
239047
  throw new Error("Source list is empty");
238650
239048
  }
238651
239049
  // 是否存在画质下没有source的情况,可能需要切换画质
238652
- if (liveInfo.currentStream.rate !== qn) {
238653
- if (liveInfo.streams.length === 0) {
238654
- throw new Error("Can not get expect quality because of no available stream");
238655
- }
238656
- else {
238657
- liveInfo = await parser.getLiveInfo(opts.channelId, {
238658
- rate: liveInfo.streams[0].rate,
238659
- onlyAudio: opts.onlyAudio,
238660
- hevc: shouldHevc,
238661
- });
238662
- if (!liveInfo.living)
238663
- throw new Error("It must be called getStream when living");
238664
- }
238665
- }
239050
+ // if (liveInfo.currentStream.rate !== qn) {
239051
+ // if (liveInfo.streams.length === 0) {
239052
+ // throw new Error("Can not get expect quality because of no available stream");
239053
+ // } else {
239054
+ // liveInfo = await parser.getLiveInfo(opts.channelId, {
239055
+ // rate: liveInfo.streams[0].rate,
239056
+ // onlyAudio: opts.onlyAudio,
239057
+ // hevc: shouldHevc,
239058
+ // });
239059
+ // if (!liveInfo.living) throw new Error("It must be called getStream when living");
239060
+ // }
239061
+ // }
238666
239062
  return liveInfo;
238667
239063
  }
238668
239064
 
@@ -245069,6 +245465,7 @@ function createRecorder$5(opts) {
245069
245465
  avoidEdgeCDN: true,
245070
245466
  codecName: this.codecName,
245071
245467
  api: this.api,
245468
+ auth: this.auth,
245072
245469
  });
245073
245470
  return res.currentStream;
245074
245471
  },
@@ -245136,6 +245533,7 @@ const checkLiveStatusAndRecord$5 = async function ({ getSavePath, banLiveId, isM
245136
245533
  avoidEdgeCDN: true,
245137
245534
  codecName: this.codecName,
245138
245535
  api: this.api,
245536
+ auth: this.auth || "",
245139
245537
  });
245140
245538
  }
245141
245539
  catch (err) {
@@ -245479,13 +245877,13 @@ const getStream$6 = async (data, resoltion) => {
245479
245877
  */
245480
245878
  async function download$1(output, decodeData, options) {
245481
245879
  const mp4Output = replaceExtName$1(output, ".mp4");
245482
- if ((await fs$k.pathExists(mp4Output)) && !options.override)
245880
+ if ((await fs$m.pathExists(mp4Output)) && !options.override)
245483
245881
  throw new Error(`${mp4Output}已存在`);
245484
245882
  if (options.danmu !== "none" && !options.vid)
245485
245883
  throw new Error("下载弹幕时vid不能为空");
245486
245884
  const { dir, name } = path$z.parse(output);
245487
245885
  const tsOutput = path$z.join(dir, `${name}.ts`);
245488
- if (await fs$k.pathExists(tsOutput)) {
245886
+ if (await fs$m.pathExists(tsOutput)) {
245489
245887
  throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
245490
245888
  }
245491
245889
  let m3u8Url = await getStream$6(decodeData, options.resoltion);
@@ -245508,7 +245906,7 @@ async function download$1(output, decodeData, options) {
245508
245906
  if (options.danmu !== "none" && options.vid) {
245509
245907
  const danmu = await getVideoDanmu(options.vid);
245510
245908
  const xml = convert2Xml(danmu, options.danmuMeta || {});
245511
- fs$k.writeFile(path$z.join(path$z.dirname(output), `${path$z.parse(output).name}.xml`), xml);
245909
+ fs$m.writeFile(path$z.join(path$z.dirname(output), `${path$z.parse(output).name}.xml`), xml);
245512
245910
  }
245513
245911
  const outputName = `${name}.mp4`;
245514
245912
  await sleep$1(2000);
@@ -245548,11 +245946,11 @@ const parseVideo$1 = async (url) => {
245548
245946
  return videoList;
245549
245947
  };
245550
245948
  const downloadDanmu = async (vid, output, override, meta) => {
245551
- if ((await fs$k.pathExists(output)) && !override)
245949
+ if ((await fs$m.pathExists(output)) && !override)
245552
245950
  throw new Error(`${output}已存在`);
245553
245951
  const danmu = await getVideoDanmu(vid);
245554
245952
  const xml = convert2Xml(danmu, meta || {});
245555
- await fs$k.writeFile(output, xml);
245953
+ await fs$m.writeFile(output, xml);
245556
245954
  return output;
245557
245955
  };
245558
245956
  async function getReplayList(subId, opts) {
@@ -245567,11 +245965,11 @@ var douyu = { download: download$1, parseVideo: parseVideo$1, getAvailableStream
245567
245965
 
245568
245966
  async function download(output, url, options) {
245569
245967
  const mp4Output = replaceExtName$1(output, ".mp4");
245570
- if ((await fs$k.pathExists(mp4Output)) && !options.override)
245968
+ if ((await fs$m.pathExists(mp4Output)) && !options.override)
245571
245969
  throw new Error(`${mp4Output}已存在`);
245572
245970
  const { dir, name } = path$z.parse(output);
245573
245971
  const tsOutput = path$z.join(dir, `${name}.ts`);
245574
- if (await fs$k.pathExists(tsOutput)) {
245972
+ if (await fs$m.pathExists(tsOutput)) {
245575
245973
  throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
245576
245974
  }
245577
245975
  const { ffmpegPath } = getBinPath();
@@ -245947,7 +246345,7 @@ async function checkAll() {
245947
246345
  if (!savePath) {
245948
246346
  throw new Error("请先设置下载路径");
245949
246347
  }
245950
- await fs$k.ensureDir(savePath);
246348
+ await fs$m.ensureDir(savePath);
245951
246349
  }
245952
246350
  for (const item of needCheckItems) {
245953
246351
  try {
@@ -246043,13 +246441,13 @@ const extractStartTimeFromFilename = (filename, startTimeAutoMatch, fileBirthtim
246043
246441
  */
246044
246442
  const getMatchingFiles = async (config, folderPath, startTime) => {
246045
246443
  // 检查监听文件夹是否存在
246046
- const exists = await fs$k.pathExists(folderPath);
246444
+ const exists = await fs$m.pathExists(folderPath);
246047
246445
  if (!exists) {
246048
246446
  logObj.warn(`文件夹不存在: ${folderPath}`);
246049
246447
  return [];
246050
246448
  }
246051
246449
  // 筛选出符合条件的文件
246052
- const files = await fs$k.readdir(folderPath);
246450
+ const files = await fs$m.readdir(folderPath);
246053
246451
  const videoFiles = files
246054
246452
  .filter((file) => {
246055
246453
  // 使用配置的文件匹配规则,如果未配置则使用默认规则
@@ -246093,7 +246491,7 @@ const getMatchingFiles = async (config, folderPath, startTime) => {
246093
246491
  if (unprocessedFiles.length === 0) {
246094
246492
  return [];
246095
246493
  }
246096
- const stats = await Promise.allSettled(unprocessedFiles.map((file) => fs$k.stat(file)));
246494
+ const stats = await Promise.allSettled(unprocessedFiles.map((file) => fs$m.stat(file)));
246097
246495
  const newRecords = stats
246098
246496
  .map((item, index) => {
246099
246497
  return {
@@ -265162,7 +265560,7 @@ var indexMinimal$1 = {};
265162
265560
 
265163
265561
  var minimal$2 = {};
265164
265562
 
265165
- var aspromise$1 = asPromise$2;
265563
+ var aspromise$1 = asPromise$3;
265166
265564
 
265167
265565
  /**
265168
265566
  * Callback as used by {@link util.asPromise}.
@@ -265181,7 +265579,7 @@ var aspromise$1 = asPromise$2;
265181
265579
  * @param {...*} params Function arguments
265182
265580
  * @returns {Promise<*>} Promisified function
265183
265581
  */
265184
- function asPromise$2(fn, ctx/*, varargs */) {
265582
+ function asPromise$3(fn, ctx/*, varargs */) {
265185
265583
  var params = new Array(arguments.length - 1),
265186
265584
  offset = 0,
265187
265585
  index = 2,
@@ -269570,367 +269968,328 @@ var types$1 = {};
269570
269968
 
269571
269969
  var util$7 = {exports: {}};
269572
269970
 
269573
- var patterns = {};
269971
+ var patterns$1 = {};
269574
269972
 
269575
- var hasRequiredPatterns;
269973
+ (function (exports) {
269576
269974
 
269577
- function requirePatterns () {
269578
- if (hasRequiredPatterns) return patterns;
269579
- hasRequiredPatterns = 1;
269580
- (function (exports) {
269975
+ var patterns = exports;
269581
269976
 
269582
- var patterns = exports;
269977
+ patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
269978
+ patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
269979
+ patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
269980
+ patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
269981
+ } (patterns$1));
269583
269982
 
269584
- patterns.numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;
269585
- patterns.typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;
269586
- patterns.reservedRe = /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;
269587
- patterns.unsafePropertyRe = /^(?:__proto__|prototype|constructor)$/;
269588
- } (patterns));
269589
- return patterns;
269590
- }
269983
+ var codegen_1 = codegen;
269591
269984
 
269592
- var codegen_1;
269593
- var hasRequiredCodegen;
269985
+ var patterns = patterns$1;
269986
+ var reservedRe = patterns.reservedRe;
269594
269987
 
269595
- function requireCodegen () {
269596
- if (hasRequiredCodegen) return codegen_1;
269597
- hasRequiredCodegen = 1;
269598
- codegen_1 = codegen;
269988
+ /**
269989
+ * Begins generating a function.
269990
+ * @memberof util
269991
+ * @param {string[]} functionParams Function parameter names
269992
+ * @param {string} [functionName] Function name if not anonymous
269993
+ * @returns {Codegen} Appender that appends code to the function's body
269994
+ */
269995
+ function codegen(functionParams, functionName) {
269599
269996
 
269600
- var patterns = requirePatterns();
269601
- var reservedRe = patterns.reservedRe;
269997
+ /* istanbul ignore if */
269998
+ if (typeof functionParams === "string") {
269999
+ functionName = functionParams;
270000
+ functionParams = undefined;
270001
+ }
269602
270002
 
269603
- /**
269604
- * Begins generating a function.
269605
- * @memberof util
269606
- * @param {string[]} functionParams Function parameter names
269607
- * @param {string} [functionName] Function name if not anonymous
269608
- * @returns {Codegen} Appender that appends code to the function's body
269609
- */
269610
- function codegen(functionParams, functionName) {
270003
+ var body = [];
269611
270004
 
269612
- /* istanbul ignore if */
269613
- if (typeof functionParams === "string") {
269614
- functionName = functionParams;
269615
- functionParams = undefined;
269616
- }
270005
+ /**
270006
+ * Appends code to the function's body or finishes generation.
270007
+ * @typedef Codegen
270008
+ * @type {function}
270009
+ * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
270010
+ * @param {...*} [formatParams] Format parameters
270011
+ * @returns {Codegen|Function} Itself or the generated function if finished
270012
+ * @throws {Error} If format parameter counts do not match
270013
+ */
269617
270014
 
269618
- var body = [];
270015
+ function Codegen(formatStringOrScope) {
270016
+ // note that explicit array handling below makes this ~50% faster
270017
+
270018
+ // finish the function
270019
+ if (typeof formatStringOrScope !== "string") {
270020
+ var source = toString();
270021
+ if (codegen.verbose)
270022
+ console.log("codegen: " + source); // eslint-disable-line no-console
270023
+ source = "return " + source;
270024
+ if (formatStringOrScope) {
270025
+ var scopeKeys = Object.keys(formatStringOrScope),
270026
+ scopeParams = new Array(scopeKeys.length + 1),
270027
+ scopeValues = new Array(scopeKeys.length),
270028
+ scopeOffset = 0;
270029
+ while (scopeOffset < scopeKeys.length) {
270030
+ scopeParams[scopeOffset] = scopeKeys[scopeOffset];
270031
+ scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
270032
+ }
270033
+ scopeParams[scopeOffset] = source;
270034
+ return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
270035
+ }
270036
+ return Function(source)(); // eslint-disable-line no-new-func
270037
+ }
270038
+
270039
+ // otherwise append to body
270040
+ var formatParams = new Array(arguments.length - 1),
270041
+ formatOffset = 0;
270042
+ while (formatOffset < formatParams.length)
270043
+ formatParams[formatOffset] = arguments[++formatOffset];
270044
+ formatOffset = 0;
270045
+ formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
270046
+ var value = formatParams[formatOffset++];
270047
+ switch ($1) {
270048
+ case "d": case "f": return String(Number(value));
270049
+ case "i": return String(Math.floor(value));
270050
+ case "j": return JSON.stringify(value);
270051
+ case "s": return String(value);
270052
+ }
270053
+ return "%";
270054
+ });
270055
+ if (formatOffset !== formatParams.length)
270056
+ throw Error("parameter count mismatch");
270057
+ body.push(formatStringOrScope);
270058
+ return Codegen;
270059
+ }
269619
270060
 
269620
- /**
269621
- * Appends code to the function's body or finishes generation.
269622
- * @typedef Codegen
269623
- * @type {function}
269624
- * @param {string|Object.<string,*>} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any
269625
- * @param {...*} [formatParams] Format parameters
269626
- * @returns {Codegen|Function} Itself or the generated function if finished
269627
- * @throws {Error} If format parameter counts do not match
269628
- */
270061
+ function toString(functionNameOverride) {
270062
+ return "function " + safeFunctionName(functionNameOverride || functionName) + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
270063
+ }
269629
270064
 
269630
- function Codegen(formatStringOrScope) {
269631
- // note that explicit array handling below makes this ~50% faster
269632
-
269633
- // finish the function
269634
- if (typeof formatStringOrScope !== "string") {
269635
- var source = toString();
269636
- if (codegen.verbose)
269637
- console.log("codegen: " + source); // eslint-disable-line no-console
269638
- source = "return " + source;
269639
- if (formatStringOrScope) {
269640
- var scopeKeys = Object.keys(formatStringOrScope),
269641
- scopeParams = new Array(scopeKeys.length + 1),
269642
- scopeValues = new Array(scopeKeys.length),
269643
- scopeOffset = 0;
269644
- while (scopeOffset < scopeKeys.length) {
269645
- scopeParams[scopeOffset] = scopeKeys[scopeOffset];
269646
- scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]];
269647
- }
269648
- scopeParams[scopeOffset] = source;
269649
- return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func
269650
- }
269651
- return Function(source)(); // eslint-disable-line no-new-func
269652
- }
270065
+ Codegen.toString = toString;
270066
+ return Codegen;
270067
+ }
269653
270068
 
269654
- // otherwise append to body
269655
- var formatParams = new Array(arguments.length - 1),
269656
- formatOffset = 0;
269657
- while (formatOffset < formatParams.length)
269658
- formatParams[formatOffset] = arguments[++formatOffset];
269659
- formatOffset = 0;
269660
- formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) {
269661
- var value = formatParams[formatOffset++];
269662
- switch ($1) {
269663
- case "d": case "f": return String(Number(value));
269664
- case "i": return String(Math.floor(value));
269665
- case "j": return JSON.stringify(value);
269666
- case "s": return String(value);
269667
- }
269668
- return "%";
269669
- });
269670
- if (formatOffset !== formatParams.length)
269671
- throw Error("parameter count mismatch");
269672
- body.push(formatStringOrScope);
269673
- return Codegen;
269674
- }
270069
+ /**
270070
+ * Begins generating a function.
270071
+ * @memberof util
270072
+ * @function codegen
270073
+ * @param {string} [functionName] Function name if not anonymous
270074
+ * @returns {Codegen} Appender that appends code to the function's body
270075
+ * @variation 2
270076
+ */
269675
270077
 
269676
- function toString(functionNameOverride) {
269677
- return "function " + safeFunctionName(functionNameOverride || functionName) + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}";
269678
- }
270078
+ /**
270079
+ * When set to `true`, codegen will log generated code to console. Useful for debugging.
270080
+ * @name util.codegen.verbose
270081
+ * @type {boolean}
270082
+ */
270083
+ codegen.verbose = false;
269679
270084
 
269680
- Codegen.toString = toString;
269681
- return Codegen;
269682
- }
270085
+ function safeFunctionName(name) {
270086
+ if (!name)
270087
+ return "";
270088
+ name = String(name).replace(/[^\w$]/g, "");
270089
+ if (!name)
270090
+ return "";
270091
+ if (/^\d/.test(name))
270092
+ name = "_" + name;
270093
+ return reservedRe.test(name) ? name + "_" : name;
270094
+ }
269683
270095
 
269684
- /**
269685
- * Begins generating a function.
269686
- * @memberof util
269687
- * @function codegen
269688
- * @param {string} [functionName] Function name if not anonymous
269689
- * @returns {Codegen} Appender that appends code to the function's body
269690
- * @variation 2
269691
- */
270096
+ var fs$1 = null;
270097
+ try {
270098
+ fs$1 = require(/* webpackIgnore: true */ "fs");
270099
+ if (!fs$1 || !fs$1.readFile || !fs$1.readFileSync)
270100
+ fs$1 = null;
270101
+ } catch (e) {
270102
+ // `fs` is unavailable in browsers and browser-like bundles.
270103
+ }
270104
+ var fs_1 = fs$1;
269692
270105
 
269693
- /**
269694
- * When set to `true`, codegen will log generated code to console. Useful for debugging.
269695
- * @name util.codegen.verbose
269696
- * @type {boolean}
269697
- */
269698
- codegen.verbose = false;
270106
+ var fetch_1 = fetch$1;
269699
270107
 
269700
- function safeFunctionName(name) {
269701
- if (!name)
269702
- return "";
269703
- name = String(name).replace(/[^\w$]/g, "");
269704
- if (!name)
269705
- return "";
269706
- if (/^\d/.test(name))
269707
- name = "_" + name;
269708
- return reservedRe.test(name) ? name + "_" : name;
269709
- }
269710
- return codegen_1;
269711
- }
270108
+ var asPromise$2 = aspromise$1,
270109
+ fs = fs_1;
270110
+
270111
+ /**
270112
+ * Node-style callback as used by {@link util.fetch}.
270113
+ * @typedef FetchCallback
270114
+ * @type {function}
270115
+ * @param {?Error} error Error, if any, otherwise `null`
270116
+ * @param {string} [contents] File contents, if there hasn't been an error
270117
+ * @returns {undefined}
270118
+ */
269712
270119
 
269713
- var fs_1;
269714
- var hasRequiredFs;
270120
+ /**
270121
+ * Options as used by {@link util.fetch}.
270122
+ * @interface IFetchOptions
270123
+ * @property {boolean} [binary=false] Whether expecting a binary response
270124
+ * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
270125
+ */
269715
270126
 
269716
- function requireFs () {
269717
- if (hasRequiredFs) return fs_1;
269718
- hasRequiredFs = 1;
270127
+ /**
270128
+ * Fetches the contents of a file.
270129
+ * @memberof util
270130
+ * @param {string} filename File path or url
270131
+ * @param {IFetchOptions} options Fetch options
270132
+ * @param {FetchCallback} callback Callback function
270133
+ * @returns {undefined}
270134
+ */
270135
+ function fetch$1(filename, options, callback) {
270136
+ if (typeof options === "function") {
270137
+ callback = options;
270138
+ options = {};
270139
+ } else if (!options)
270140
+ options = {};
269719
270141
 
269720
- var fs = null;
269721
- try {
269722
- fs = require(/* webpackIgnore: true */ "fs");
269723
- if (!fs || !fs.readFile || !fs.readFileSync)
269724
- fs = null;
269725
- } catch (e) {
269726
- // `fs` is unavailable in browsers and browser-like bundles.
269727
- }
269728
- fs_1 = fs;
269729
- return fs_1;
270142
+ if (!callback)
270143
+ return asPromise$2(fetch$1, this, filename, options); // eslint-disable-line no-invalid-this
270144
+
270145
+ // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
270146
+ if (!options.xhr && fs && fs.readFile)
270147
+ return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
270148
+ return err && typeof XMLHttpRequest !== "undefined"
270149
+ ? fetch$1.xhr(filename, options, callback)
270150
+ : err
270151
+ ? callback(err)
270152
+ : callback(null, options.binary ? contents : contents.toString("utf8"));
270153
+ });
270154
+
270155
+ // use the XHR version otherwise.
270156
+ return fetch$1.xhr(filename, options, callback);
269730
270157
  }
269731
270158
 
269732
- var fetch_1;
269733
- var hasRequiredFetch;
270159
+ /**
270160
+ * Fetches the contents of a file.
270161
+ * @name util.fetch
270162
+ * @function
270163
+ * @param {string} path File path or url
270164
+ * @param {FetchCallback} callback Callback function
270165
+ * @returns {undefined}
270166
+ * @variation 2
270167
+ */
269734
270168
 
269735
- function requireFetch () {
269736
- if (hasRequiredFetch) return fetch_1;
269737
- hasRequiredFetch = 1;
269738
- fetch_1 = fetch;
270169
+ /**
270170
+ * Fetches the contents of a file.
270171
+ * @name util.fetch
270172
+ * @function
270173
+ * @param {string} path File path or url
270174
+ * @param {IFetchOptions} [options] Fetch options
270175
+ * @returns {Promise<string|Uint8Array>} Promise
270176
+ * @variation 3
270177
+ */
269739
270178
 
269740
- var asPromise = aspromise$1,
269741
- fs = requireFs();
270179
+ /**/
270180
+ fetch$1.xhr = function fetch_xhr(filename, options, callback) {
270181
+ var xhr = new XMLHttpRequest();
270182
+ xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
269742
270183
 
269743
- /**
269744
- * Node-style callback as used by {@link util.fetch}.
269745
- * @typedef FetchCallback
269746
- * @type {function}
269747
- * @param {?Error} error Error, if any, otherwise `null`
269748
- * @param {string} [contents] File contents, if there hasn't been an error
269749
- * @returns {undefined}
269750
- */
270184
+ if (xhr.readyState !== 4)
270185
+ return undefined;
269751
270186
 
269752
- /**
269753
- * Options as used by {@link util.fetch}.
269754
- * @interface IFetchOptions
269755
- * @property {boolean} [binary=false] Whether expecting a binary response
269756
- * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest
269757
- */
270187
+ // local cors security errors return status 0 / empty string, too. afaik this cannot be
270188
+ // reliably distinguished from an actually empty file for security reasons. feel free
270189
+ // to send a pull request if you are aware of a solution.
270190
+ if (xhr.status !== 0 && xhr.status !== 200)
270191
+ return callback(Error("status " + xhr.status));
270192
+
270193
+ // if binary data is expected, make sure that some sort of array is returned, even if
270194
+ // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
270195
+ if (options.binary) {
270196
+ var buffer = xhr.response;
270197
+ if (!buffer) {
270198
+ buffer = [];
270199
+ for (var i = 0; i < xhr.responseText.length; ++i)
270200
+ buffer.push(xhr.responseText.charCodeAt(i) & 255);
270201
+ }
270202
+ return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
270203
+ }
270204
+ return callback(null, xhr.responseText);
270205
+ };
270206
+
270207
+ if (options.binary) {
270208
+ // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
270209
+ if ("overrideMimeType" in xhr)
270210
+ xhr.overrideMimeType("text/plain; charset=x-user-defined");
270211
+ xhr.responseType = "arraybuffer";
270212
+ }
270213
+
270214
+ xhr.open("GET", filename);
270215
+ xhr.send();
270216
+ };
270217
+
270218
+ var path = {};
270219
+
270220
+ (function (exports) {
269758
270221
 
269759
270222
  /**
269760
- * Fetches the contents of a file.
270223
+ * A minimal path module to resolve Unix, Windows and URL paths alike.
269761
270224
  * @memberof util
269762
- * @param {string} filename File path or url
269763
- * @param {IFetchOptions} options Fetch options
269764
- * @param {FetchCallback} callback Callback function
269765
- * @returns {undefined}
270225
+ * @namespace
269766
270226
  */
269767
- function fetch(filename, options, callback) {
269768
- if (typeof options === "function") {
269769
- callback = options;
269770
- options = {};
269771
- } else if (!options)
269772
- options = {};
269773
-
269774
- if (!callback)
269775
- return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this
269776
-
269777
- // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found.
269778
- if (!options.xhr && fs && fs.readFile)
269779
- return fs.readFile(filename, function fetchReadFileCallback(err, contents) {
269780
- return err && typeof XMLHttpRequest !== "undefined"
269781
- ? fetch.xhr(filename, options, callback)
269782
- : err
269783
- ? callback(err)
269784
- : callback(null, options.binary ? contents : contents.toString("utf8"));
269785
- });
269786
-
269787
- // use the XHR version otherwise.
269788
- return fetch.xhr(filename, options, callback);
269789
- }
270227
+ var path = exports;
269790
270228
 
270229
+ var isAbsolute =
269791
270230
  /**
269792
- * Fetches the contents of a file.
269793
- * @name util.fetch
269794
- * @function
269795
- * @param {string} path File path or url
269796
- * @param {FetchCallback} callback Callback function
269797
- * @returns {undefined}
269798
- * @variation 2
270231
+ * Tests if the specified path is absolute.
270232
+ * @param {string} path Path to test
270233
+ * @returns {boolean} `true` if path is absolute
269799
270234
  */
270235
+ path.isAbsolute = function isAbsolute(path) {
270236
+ return /^(?:\/|\w+:|\\\\\w+)/.test(path);
270237
+ };
269800
270238
 
270239
+ var normalize =
269801
270240
  /**
269802
- * Fetches the contents of a file.
269803
- * @name util.fetch
269804
- * @function
269805
- * @param {string} path File path or url
269806
- * @param {IFetchOptions} [options] Fetch options
269807
- * @returns {Promise<string|Uint8Array>} Promise
269808
- * @variation 3
270241
+ * Normalizes the specified path.
270242
+ * @param {string} path Path to normalize
270243
+ * @returns {string} Normalized path
269809
270244
  */
269810
-
269811
- /**/
269812
- fetch.xhr = function fetch_xhr(filename, options, callback) {
269813
- var xhr = new XMLHttpRequest();
269814
- xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() {
269815
-
269816
- if (xhr.readyState !== 4)
269817
- return undefined;
269818
-
269819
- // local cors security errors return status 0 / empty string, too. afaik this cannot be
269820
- // reliably distinguished from an actually empty file for security reasons. feel free
269821
- // to send a pull request if you are aware of a solution.
269822
- if (xhr.status !== 0 && xhr.status !== 200)
269823
- return callback(Error("status " + xhr.status));
269824
-
269825
- // if binary data is expected, make sure that some sort of array is returned, even if
269826
- // ArrayBuffers are not supported. the binary string fallback, however, is unsafe.
269827
- if (options.binary) {
269828
- var buffer = xhr.response;
269829
- if (!buffer) {
269830
- buffer = [];
269831
- for (var i = 0; i < xhr.responseText.length; ++i)
269832
- buffer.push(xhr.responseText.charCodeAt(i) & 255);
269833
- }
269834
- return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer);
269835
- }
269836
- return callback(null, xhr.responseText);
269837
- };
269838
-
269839
- if (options.binary) {
269840
- // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers
269841
- if ("overrideMimeType" in xhr)
269842
- xhr.overrideMimeType("text/plain; charset=x-user-defined");
269843
- xhr.responseType = "arraybuffer";
270245
+ path.normalize = function normalize(path) {
270246
+ var firstTwoCharacters = path.substring(0,2);
270247
+ var uncPrefix = "";
270248
+ if (firstTwoCharacters === "\\\\") {
270249
+ uncPrefix = firstTwoCharacters;
270250
+ path = path.substring(2);
269844
270251
  }
269845
270252
 
269846
- xhr.open("GET", filename);
269847
- xhr.send();
270253
+ path = path.replace(/\\/g, "/")
270254
+ .replace(/\/{2,}/g, "/");
270255
+ var parts = path.split("/"),
270256
+ absolute = isAbsolute(path),
270257
+ prefix = "";
270258
+ if (absolute)
270259
+ prefix = parts.shift() + "/";
270260
+ for (var i = 0; i < parts.length;) {
270261
+ if (parts[i] === "..") {
270262
+ if (i > 0 && parts[i - 1] !== "..")
270263
+ parts.splice(--i, 2);
270264
+ else if (absolute)
270265
+ parts.splice(i, 1);
270266
+ else
270267
+ ++i;
270268
+ } else if (parts[i] === ".")
270269
+ parts.splice(i, 1);
270270
+ else
270271
+ ++i;
270272
+ }
270273
+ return uncPrefix + prefix + parts.join("/");
269848
270274
  };
269849
- return fetch_1;
269850
- }
269851
-
269852
- var path = {};
269853
-
269854
- var hasRequiredPath;
269855
-
269856
- function requirePath () {
269857
- if (hasRequiredPath) return path;
269858
- hasRequiredPath = 1;
269859
- (function (exports) {
269860
-
269861
- /**
269862
- * A minimal path module to resolve Unix, Windows and URL paths alike.
269863
- * @memberof util
269864
- * @namespace
269865
- */
269866
- var path = exports;
269867
-
269868
- var isAbsolute =
269869
- /**
269870
- * Tests if the specified path is absolute.
269871
- * @param {string} path Path to test
269872
- * @returns {boolean} `true` if path is absolute
269873
- */
269874
- path.isAbsolute = function isAbsolute(path) {
269875
- return /^(?:\/|\w+:|\\\\\w+)/.test(path);
269876
- };
269877
-
269878
- var normalize =
269879
- /**
269880
- * Normalizes the specified path.
269881
- * @param {string} path Path to normalize
269882
- * @returns {string} Normalized path
269883
- */
269884
- path.normalize = function normalize(path) {
269885
- var firstTwoCharacters = path.substring(0,2);
269886
- var uncPrefix = "";
269887
- if (firstTwoCharacters === "\\\\") {
269888
- uncPrefix = firstTwoCharacters;
269889
- path = path.substring(2);
269890
- }
269891
270275
 
269892
- path = path.replace(/\\/g, "/")
269893
- .replace(/\/{2,}/g, "/");
269894
- var parts = path.split("/"),
269895
- absolute = isAbsolute(path),
269896
- prefix = "";
269897
- if (absolute)
269898
- prefix = parts.shift() + "/";
269899
- for (var i = 0; i < parts.length;) {
269900
- if (parts[i] === "..") {
269901
- if (i > 0 && parts[i - 1] !== "..")
269902
- parts.splice(--i, 2);
269903
- else if (absolute)
269904
- parts.splice(i, 1);
269905
- else
269906
- ++i;
269907
- } else if (parts[i] === ".")
269908
- parts.splice(i, 1);
269909
- else
269910
- ++i;
269911
- }
269912
- return uncPrefix + prefix + parts.join("/");
269913
- };
269914
-
269915
- /**
269916
- * Resolves the specified include path against the specified origin path.
269917
- * @param {string} originPath Path to the origin file
269918
- * @param {string} includePath Include path relative to origin path
269919
- * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
269920
- * @returns {string} Path to the include file
269921
- */
269922
- path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
269923
- if (!alreadyNormalized)
269924
- includePath = normalize(includePath);
269925
- if (isAbsolute(includePath))
269926
- return includePath;
269927
- if (!alreadyNormalized)
269928
- originPath = normalize(originPath);
269929
- return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
269930
- };
269931
- } (path));
269932
- return path;
269933
- }
270276
+ /**
270277
+ * Resolves the specified include path against the specified origin path.
270278
+ * @param {string} originPath Path to the origin file
270279
+ * @param {string} includePath Include path relative to origin path
270280
+ * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized
270281
+ * @returns {string} Path to the include file
270282
+ */
270283
+ path.resolve = function resolve(originPath, includePath, alreadyNormalized) {
270284
+ if (!alreadyNormalized)
270285
+ includePath = normalize(includePath);
270286
+ if (isAbsolute(includePath))
270287
+ return includePath;
270288
+ if (!alreadyNormalized)
270289
+ originPath = normalize(originPath);
270290
+ return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath;
270291
+ };
270292
+ } (path));
269934
270293
 
269935
270294
  var namespace;
269936
270295
  var hasRequiredNamespace;
@@ -273098,10 +273457,10 @@ function requireUtil () {
273098
273457
  var Type, // cyclic
273099
273458
  Enum;
273100
273459
 
273101
- util.codegen = requireCodegen();
273102
- util.fetch = requireFetch();
273103
- util.path = requirePath();
273104
- util.patterns = requirePatterns();
273460
+ util.codegen = codegen_1;
273461
+ util.fetch = fetch_1;
273462
+ util.path = path;
273463
+ util.patterns = patterns$1;
273105
273464
 
273106
273465
  var reservedRe = util.patterns.reservedRe,
273107
273466
  unsafePropertyRe = util.patterns.unsafePropertyRe;
@@ -273110,7 +273469,7 @@ function requireUtil () {
273110
273469
  * Node's fs module if available.
273111
273470
  * @type {Object.<string,*>}
273112
273471
  */
273113
- util.fs = requireFs();
273472
+ util.fs = fs_1;
273114
273473
 
273115
273474
  /**
273116
273475
  * Converts an object's values to an array.
@@ -381200,7 +381559,13 @@ class RecorderConfig {
381200
381559
  }
381201
381560
  else {
381202
381561
  if (key === "uid") {
381203
- return get$1(globalConfig, "bilibili.uid");
381562
+ if (setting.providerId === "Bilibili") {
381563
+ return get$1(globalConfig, "bilibili.uid");
381564
+ }
381565
+ else if (setting.providerId === "DouYu") {
381566
+ return get$1(globalConfig, "douyu.uid");
381567
+ }
381568
+ return setting?.uid;
381204
381569
  }
381205
381570
  else if (key === "useM3U8Proxy") {
381206
381571
  return get$1(globalConfig, "bilibili.useM3U8Proxy");
@@ -381362,6 +381727,18 @@ class RecorderConfig {
381362
381727
  }
381363
381728
  }
381364
381729
  }
381730
+ else if (setting.providerId === "DouYu") {
381731
+ uid = getValue("uid");
381732
+ if (uid) {
381733
+ try {
381734
+ auth = readDouyuUser(Number(uid))?.loginCookies.main;
381735
+ // console.log("pp", readDouyuUser(Number(uid)));
381736
+ }
381737
+ catch (error) {
381738
+ console.error(error);
381739
+ }
381740
+ }
381741
+ }
381365
381742
  else if (setting.providerId === "DouYin") {
381366
381743
  auth = getValue("cookie");
381367
381744
  uid = setting?.uid;
@@ -381588,7 +381965,7 @@ async function sendEndLiveNotification(appConfig, recorder, config) {
381588
381965
  }
381589
381966
  async function convert2Mp4(videoFile) {
381590
381967
  const output = replaceExtName$1(videoFile, ".mp4");
381591
- if (await fs$k.pathExists(output)) {
381968
+ if (await fs$m.pathExists(output)) {
381592
381969
  throw new Error(`目标文件已存在: ${output}`);
381593
381970
  }
381594
381971
  const name = path$z.basename(output);
@@ -381742,7 +382119,7 @@ async function createRecorderManager(appConfig) {
381742
382119
  return;
381743
382120
  if (recorder.recordHandle) {
381744
382121
  const logFilePath = utils$3.replaceExtName(`${recorder.recordHandle.savePath}_${recorder.id}`, ".recorder.log");
381745
- fs$k.appendFile(logFilePath, log.text + "\n").catch(() => { });
382122
+ fs$m.appendFile(logFilePath, log.text + "\n").catch(() => { });
381746
382123
  return;
381747
382124
  }
381748
382125
  else {
@@ -381891,7 +382268,7 @@ async function createRecorderManager(appConfig) {
381891
382268
  interact_num: stats.uniqMember,
381892
382269
  });
381893
382270
  }
381894
- else if (xmlFile && (await fs$k.pathExists(xmlFile))) {
382271
+ else if (xmlFile && (await fs$m.pathExists(xmlFile))) {
381895
382272
  const { uniqMember, danmaNum } = await danmaReport(xmlFile);
381896
382273
  recordHistory.upadteLive({
381897
382274
  video_file: filename,
@@ -381904,7 +382281,7 @@ async function createRecorderManager(appConfig) {
381904
382281
  if (data?.convert2Mp4) {
381905
382282
  try {
381906
382283
  await convert2Mp4(filename);
381907
- await fs$k.unlink(filename);
382284
+ await fs$m.unlink(filename);
381908
382285
  logObj.info("转换 mp4 成功,已删除原文件", { filename });
381909
382286
  }
381910
382287
  catch (error) {
@@ -381976,7 +382353,7 @@ async function createRecorderManager(appConfig) {
381976
382353
  }
381977
382354
  }
381978
382355
  const xmlFile = replaceExtName$1(filename, ".xml");
381979
- if (config.recorder.saveDanma2DB && xmlFile && (await fs$k.pathExists(xmlFile))) {
382356
+ if (config.recorder.saveDanma2DB && xmlFile && (await fs$m.pathExists(xmlFile))) {
381980
382357
  const history = recordHistory.getRecord({
381981
382358
  file: filename,
381982
382359
  live_id: liveId,
@@ -382158,7 +382535,8 @@ const init = async (config) => {
382158
382535
  try {
382159
382536
  const commentQueue = container.resolve("commentQueue");
382160
382537
  commentQueue.checkLoop();
382161
- checkAccountLoop();
382538
+ checkBiliAccountLoop();
382539
+ void checkDouyuAccountLoop();
382162
382540
  checkDiskSpaceLoop();
382163
382541
  createInterval();
382164
382542
  check$1();
@@ -382183,7 +382561,7 @@ const checkDiskSpaceLoop = async () => {
382183
382561
  const threshold = config?.notification?.task?.diskSpaceCheck?.threshold ?? 10;
382184
382562
  if (config?.notification?.task?.diskSpaceCheck?.values?.includes("bilirecorder")) {
382185
382563
  if (config?.webhook?.recoderFolder &&
382186
- (await fs$k.pathExists(config?.webhook?.recoderFolder))) {
382564
+ (await fs$m.pathExists(config?.webhook?.recoderFolder))) {
382187
382565
  // @ts-ignore
382188
382566
  const diskInfo = await checkDiskSpace(config?.webhook?.recoderFolder);
382189
382567
  if (diskInfo.free < threshold * 1024 * 1024 * 1024) {
@@ -382202,7 +382580,7 @@ const checkDiskSpaceLoop = async () => {
382202
382580
  }
382203
382581
  }
382204
382582
  if (config?.notification?.task?.diskSpaceCheck?.values?.includes("bililiveTools")) {
382205
- if (config?.recorder?.savePath && (await fs$k.pathExists(config?.recorder?.savePath))) {
382583
+ if (config?.recorder?.savePath && (await fs$m.pathExists(config?.recorder?.savePath))) {
382206
382584
  // @ts-ignore
382207
382585
  const diskInfo = await checkDiskSpace(config?.recorder?.savePath);
382208
382586
  if (diskInfo.free < threshold * 1024 * 1024 * 1024) {
@@ -382244,6 +382622,7 @@ exports.Client = Client$9;
382244
382622
  exports.DEFAULT_BILIUP_CONFIG = DEFAULT_BILIUP_CONFIG;
382245
382623
  exports.DanmuPreset = DanmuPreset;
382246
382624
  exports.DouyinDownloadVideoTask = DouyinDownloadVideoTask;
382625
+ exports.DouyuQrcodeLogin = DouyuQrcodeLogin;
382247
382626
  exports.FFmpegPreset = FFmpegPreset;
382248
382627
  exports.FlvRepairTask = FlvRepairTask;
382249
382628
  exports.FormData = FormData$2;
@@ -382280,16 +382659,17 @@ exports.constants = constants$a;
382280
382659
  exports.convertXml2Ass = convertXml2Ass;
382281
382660
  exports.cut = cut;
382282
382661
  exports.defaultRecordConfig = defaultRecordConfig;
382662
+ exports.deleteDouyuUser = deleteDouyuUser;
382283
382663
  exports.douyu = douyu;
382284
382664
  exports.esDefineProperty = esDefineProperty;
382285
382665
  exports.escaped = escaped;
382286
382666
  exports.executeVirtualRecordConfig = executeVirtualRecordConfig;
382287
382667
  exports.extension = extension$4;
382288
- exports.fetch = fetch$1;
382668
+ exports.fetch = fetch$2;
382289
382669
  exports.formatDesc = formatDesc;
382290
382670
  exports.formatPartTitle = formatPartTitle;
382291
382671
  exports.formatTitle = formatTitle;
382292
- exports.fs = fs$k;
382672
+ exports.fs = fs$m;
382293
382673
  exports.functionBind = functionBind;
382294
382674
  exports.genTimeData = genTimeData;
382295
382675
  exports.getBinPath = getBinPath;
@@ -382331,10 +382711,12 @@ exports.parseSavePath = parseSavePath;
382331
382711
  exports.permessageDeflate = permessageDeflate$2;
382332
382712
  exports.pick = pick;
382333
382713
  exports.picomatch = picomatch$1;
382714
+ exports.readDouyuUserList = readDouyuUserList;
382334
382715
  exports.readVideoMeta = readVideoMeta;
382335
382716
  exports.readXmlTimestamp = readXmlTimestamp;
382336
382717
  exports.reconnectDB = reconnectDB;
382337
382718
  exports.recordHistory = recordHistory;
382719
+ exports.refreshDouyuUser = refreshDouyuUser;
382338
382720
  exports.replaceExtName = replaceExtName$1;
382339
382721
  exports.replaceFourByteUnicode = replaceFourByteUnicode$1;
382340
382722
  exports.requireMs = requireMs$1;
@@ -382352,6 +382734,8 @@ exports.transcode = transcode;
382352
382734
  exports.trashItem = trashItem;
382353
382735
  exports.uuid = uuid$4;
382354
382736
  exports.validateBiliupConfig = validateBiliupConfig;
382737
+ exports.validateDouyuUser = validateDouyuUser;
382355
382738
  exports.validationExports = validationExports$1;
382356
382739
  exports.videoSub = videoSub;
382357
382740
  exports.websocket = websocket$2;
382741
+ exports.writeDouyuUser = writeDouyuUser;