bililive-cli 3.19.0 → 3.20.0

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.
@@ -1,28 +1,28 @@
1
1
  'use strict';
2
2
 
3
3
  var path$3 = require('node:path');
4
- var require$$2$1 = require('node:http');
5
- var require$$0$4 = require('node:url');
6
- var a$1 = require('node:https');
7
- var index$1 = require('./index-CApcEp1I.cjs');
8
- var require$$0$6 = require('tty');
9
- var require$$1$3 = require('util');
10
- var require$$0$c = require('assert');
11
- var require$$0$8 = require('path');
12
- var require$$0$7 = require('buffer');
13
- var require$$0$5 = require('events');
14
- var require$$0$9 = require('fs');
15
- var require$$0$a = require('stream');
4
+ var http$4 = require('node:http');
5
+ var urlLib = require('node:url');
6
+ var https = require('node:https');
7
+ var index$1 = require('./index-RwUbYTSt.cjs');
8
+ var require$$0$5 = require('tty');
9
+ var require$$1$4 = require('util');
10
+ var require$$0$b = require('assert');
11
+ var require$$0$7 = require('path');
12
+ var require$$0$6 = require('buffer');
13
+ var require$$0$4 = require('events');
14
+ var require$$0$8 = require('fs');
15
+ var require$$0$9 = require('stream');
16
16
  var zlib$1 = require('zlib');
17
- var require$$0$b = require('url');
18
- var require$$1$2 = require('crypto');
19
- var require$$3$1 = require('http');
20
- var require$$0$d = require('net');
17
+ var require$$0$a = require('url');
18
+ var require$$1$3 = require('crypto');
19
+ var require$$1$2 = require('http');
20
+ var require$$4$1 = require('net');
21
21
  var require$$5$1 = require('querystring');
22
22
  var require$$17 = require('async_hooks');
23
- var require$$1$4 = require('string_decoder');
23
+ var require$$1$5 = require('string_decoder');
24
24
  var os$1 = require('node:os');
25
- var require$$1$5 = require('os');
25
+ var require$$1$6 = require('os');
26
26
  var require$$1$1 = require('node:child_process');
27
27
  var crypto$3 = require('node:crypto');
28
28
  var fs$6 = require('node:fs');
@@ -32,9 +32,9 @@ require('node:readline');
32
32
  require('@napi-rs/canvas');
33
33
  require('better-sqlite3');
34
34
  var musicSegmentDetector = require('music-segment-detector');
35
- var require$$0$e = require('child_process');
36
- var require$$1$6 = require('https');
37
- var require$$0$f = require('node:stream');
35
+ var require$$0$c = require('child_process');
36
+ var require$$1$7 = require('https');
37
+ var require$$0$d = require('node:stream');
38
38
  var web = require('node:stream/web');
39
39
  var shazamioCore = require('shazamio-core');
40
40
 
@@ -1183,8 +1183,8 @@ class Alist extends index$1.TypedEmitter {
1183
1183
  this.emit("canceled", "上传已取消");
1184
1184
  },
1185
1185
  };
1186
- const url = new require$$0$4.URL(combineURLs(this.server, "/api/fs/put"));
1187
- const httpModule = url.protocol === "https:" ? a$1 : require$$2$1;
1186
+ const url = new urlLib.URL(combineURLs(this.server, "/api/fs/put"));
1187
+ const httpModule = url.protocol === "https:" ? https : http$4;
1188
1188
  try {
1189
1189
  await new Promise((resolve, reject) => {
1190
1190
  req = httpModule.request({
@@ -1542,9 +1542,9 @@ var subprotocol$1 = { parse: parse$h };
1542
1542
 
1543
1543
  /* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Duplex$", "caughtErrors": "none" }] */
1544
1544
 
1545
- const EventEmitter$3 = require$$0$5;
1546
- const http$3 = require$$3$1;
1547
- const { createHash } = require$$1$2;
1545
+ const EventEmitter$3 = require$$0$4;
1546
+ const http$3 = require$$1$2;
1547
+ const { createHash } = require$$1$3;
1548
1548
 
1549
1549
  const extension = index$1.extension;
1550
1550
  const PerMessageDeflate = index$1.permessageDeflate;
@@ -2698,8 +2698,8 @@ function requireNode$1 () {
2698
2698
  if (hasRequiredNode$1) return node$1.exports;
2699
2699
  hasRequiredNode$1 = 1;
2700
2700
  (function (module, exports) {
2701
- const tty = require$$0$6;
2702
- const util = require$$1$3;
2701
+ const tty = require$$0$5;
2702
+ const util = require$$1$4;
2703
2703
 
2704
2704
  /**
2705
2705
  * This is the Node.js implementation of `debug()`.
@@ -3315,7 +3315,7 @@ var safeBuffer = {exports: {}};
3315
3315
 
3316
3316
  (function (module, exports) {
3317
3317
  /* eslint-disable node/no-deprecated-api */
3318
- var buffer = require$$0$7;
3318
+ var buffer = require$$0$6;
3319
3319
  var Buffer = buffer.Buffer;
3320
3320
 
3321
3321
  // alternative to using Object.keys for old browsers
@@ -3401,7 +3401,7 @@ contentDisposition$1.exports.parse = parse$g;
3401
3401
  * @private
3402
3402
  */
3403
3403
 
3404
- var basename$2 = require$$0$8.basename;
3404
+ var basename$2 = require$$0$7.basename;
3405
3405
  var Buffer$2 = safeBufferExports.Buffer;
3406
3406
 
3407
3407
  /**
@@ -4776,9 +4776,9 @@ function status$1 (code) {
4776
4776
  * @private
4777
4777
  */
4778
4778
 
4779
- var EventEmitter$2 = require$$0$5.EventEmitter;
4780
- var ReadStream = require$$0$9.ReadStream;
4781
- var Stream$3 = require$$0$a;
4779
+ var EventEmitter$2 = require$$0$4.EventEmitter;
4780
+ var ReadStream = require$$0$8.ReadStream;
4781
+ var Stream$3 = require$$0$9;
4782
4782
  var Zlib = zlib$1;
4783
4783
 
4784
4784
  /**
@@ -5206,14 +5206,14 @@ function encodeUrl (url) {
5206
5206
  const typeis = typeIsExports.is;
5207
5207
  const statuses = statuses$2;
5208
5208
  const destroy = destroy_1$2;
5209
- const assert = require$$0$c;
5210
- const extname = require$$0$8.extname;
5209
+ const assert = require$$0$b;
5210
+ const extname = require$$0$7.extname;
5211
5211
  const vary = varyExports;
5212
5212
  const only = only$1;
5213
- const util = require$$1$3;
5213
+ const util = require$$1$4;
5214
5214
  const encodeUrl = encodeurl;
5215
- const Stream = require$$0$a;
5216
- const URL = require$$0$b.URL;
5215
+ const Stream = require$$0$9;
5216
+ const URL = require$$0$a.URL;
5217
5217
 
5218
5218
  /**
5219
5219
  * Prototype.
@@ -5996,7 +5996,7 @@ function requireEventListenerCount () {
5996
5996
  * @private
5997
5997
  */
5998
5998
 
5999
- var EventEmitter = require$$0$5.EventEmitter;
5999
+ var EventEmitter = require$$0$4.EventEmitter;
6000
6000
 
6001
6001
  /**
6002
6002
  * Module exports.
@@ -6078,7 +6078,7 @@ var compatExports = compat.exports;
6078
6078
 
6079
6079
  var callSiteToString = compatExports.callSiteToString;
6080
6080
  var eventListenerCount = compatExports.eventListenerCount;
6081
- var relative$1 = require$$0$8.relative;
6081
+ var relative$1 = require$$0$7.relative;
6082
6082
 
6083
6083
  /**
6084
6084
  * Module exports.
@@ -7252,7 +7252,7 @@ Delegator.prototype.fluent = function (name) {
7252
7252
  * Module dependencies.
7253
7253
  */
7254
7254
 
7255
- var relative = require$$0$8.relative;
7255
+ var relative = require$$0$7.relative;
7256
7256
 
7257
7257
  /**
7258
7258
  * Module exports.
@@ -7787,7 +7787,7 @@ function DeprecationError (namespace, message, stack) {
7787
7787
  // https://github.com/nodejs/node/issues/3043
7788
7788
  // https://github.com/nodejs/node/pull/3073
7789
7789
 
7790
- var crypto$2 = require$$1$2;
7790
+ var crypto$2 = require$$1$3;
7791
7791
 
7792
7792
  function bufferEqual(a, b) {
7793
7793
  if (a.length !== b.length) {
@@ -7825,7 +7825,7 @@ var lib$8 = timeSafeCompare;
7825
7825
  */
7826
7826
 
7827
7827
  var compare$c = lib$8;
7828
- var crypto$1 = require$$1$2;
7828
+ var crypto$1 = require$$1$3;
7829
7829
 
7830
7830
  function Keygrip$1(keys, algorithm, encoding) {
7831
7831
  if (!algorithm) algorithm = "sha1";
@@ -7877,7 +7877,7 @@ var keygrip = Keygrip$1;
7877
7877
 
7878
7878
  var deprecate$2 = depd_1('cookies');
7879
7879
  var Keygrip = keygrip;
7880
- var http$2 = require$$3$1;
7880
+ var http$2 = require$$1$2;
7881
7881
 
7882
7882
  /**
7883
7883
  * RegExp to match field-content in RFC 7230 sec 3.2
@@ -8163,7 +8163,7 @@ var cookies = Cookies;
8163
8163
  * Module dependencies.
8164
8164
  */
8165
8165
 
8166
- const util = require$$1$3;
8166
+ const util = require$$1$4;
8167
8167
  const createError = httpErrorsExports$1;
8168
8168
  const httpAssert$1 = httpAssert;
8169
8169
  const delegate = delegates;
@@ -9811,7 +9811,7 @@ var parseurl$1 = {exports: {}};
9811
9811
  * @private
9812
9812
  */
9813
9813
 
9814
- var url = require$$0$b;
9814
+ var url = require$$0$a;
9815
9815
  var parse$c = url.parse;
9816
9816
  var Url = url.Url;
9817
9817
 
@@ -10098,17 +10098,17 @@ function parseTokenList (str) {
10098
10098
  * Module dependencies.
10099
10099
  */
10100
10100
 
10101
- const URL = require$$0$b.URL;
10102
- const net = require$$0$d;
10101
+ const URL = require$$0$a.URL;
10102
+ const net = require$$4$1;
10103
10103
  const accepts$1 = accepts;
10104
10104
  const contentType$1 = contentType;
10105
- const stringify = require$$0$b.format;
10105
+ const stringify = require$$0$a.format;
10106
10106
  const parse = parseurlExports;
10107
10107
  const qs = require$$5$1;
10108
10108
  const typeis = typeIsExports;
10109
10109
  const fresh = fresh_1;
10110
10110
  const only = only$1;
10111
- const util = require$$1$3;
10111
+ const util = require$$1$4;
10112
10112
 
10113
10113
  const IP = Symbol('context#ip');
10114
10114
 
@@ -11169,16 +11169,16 @@ convert$1.back = function (mw) {
11169
11169
  const isGeneratorFunction = isGeneratorFunction$2;
11170
11170
  const debug$5 = srcExports('koa:application');
11171
11171
  const onFinished = onFinishedExports;
11172
- const assert = require$$0$c;
11172
+ const assert = require$$0$b;
11173
11173
  const response = responseExports;
11174
11174
  const compose$1 = koaCompose;
11175
11175
  const context = contextExports;
11176
11176
  const request = requestExports;
11177
11177
  const statuses$1 = statuses$2;
11178
- const Emitter = require$$0$5;
11179
- const util$3 = require$$1$3;
11180
- const Stream$2 = require$$0$a;
11181
- const http$1 = require$$3$1;
11178
+ const Emitter = require$$0$4;
11179
+ const util$3 = require$$1$4;
11180
+ const Stream$2 = require$$0$9;
11181
+ const http$1 = require$$1$2;
11182
11182
  const only = only$1;
11183
11183
  const convert = koaConvert;
11184
11184
  const deprecate$1 = depd_1('koa');
@@ -12393,7 +12393,7 @@ function isNextNameSafe(token) {
12393
12393
  return !ID_CONTINUE.test(token.value[0]);
12394
12394
  }
12395
12395
 
12396
- const { parse: parseUrl, format: formatUrl } = require$$0$4;
12396
+ const { parse: parseUrl, format: formatUrl } = urlLib;
12397
12397
 
12398
12398
  const { pathToRegexp: pathToRegexp$1, compile, parse: parse$a } = dist$1;
12399
12399
 
@@ -12663,7 +12663,7 @@ function safeDecodeURIComponent(text) {
12663
12663
  * @link https://github.com/alexmingoia/koa-router
12664
12664
  */
12665
12665
 
12666
- const http = require$$2$1;
12666
+ const http = http$4;
12667
12667
 
12668
12668
  const debug$4 = index$1.srcExports('koa-router');
12669
12669
 
@@ -13844,7 +13844,7 @@ var lib$7 = {exports: {}};
13844
13844
 
13845
13845
  /* eslint-disable node/no-deprecated-api */
13846
13846
 
13847
- var buffer$1 = require$$0$7;
13847
+ var buffer$1 = require$$0$6;
13848
13848
  var Buffer$1 = buffer$1.Buffer;
13849
13849
 
13850
13850
  var safer = {};
@@ -14025,7 +14025,7 @@ function requireInternal () {
14025
14025
  //------------------------------------------------------------------------------
14026
14026
 
14027
14027
  // We use node.js internal decoder. Its signature is the same as ours.
14028
- var StringDecoder = require$$1$4.StringDecoder;
14028
+ var StringDecoder = require$$1$5.StringDecoder;
14029
14029
 
14030
14030
  if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
14031
14031
  StringDecoder.prototype.end = function() {};
@@ -24426,8 +24426,8 @@ function requireStreams () {
24426
24426
  if (hasRequiredStreams) return streams;
24427
24427
  hasRequiredStreams = 1;
24428
24428
 
24429
- var Buffer = require$$0$7.Buffer,
24430
- Transform = require$$0$a.Transform;
24429
+ var Buffer = require$$0$6.Buffer,
24430
+ Transform = require$$0$9.Transform;
24431
24431
 
24432
24432
 
24433
24433
  // == Exports ==================================================================
@@ -24553,7 +24553,7 @@ var hasRequiredExtendNode;
24553
24553
  function requireExtendNode () {
24554
24554
  if (hasRequiredExtendNode) return extendNode;
24555
24555
  hasRequiredExtendNode = 1;
24556
- var Buffer = require$$0$7.Buffer;
24556
+ var Buffer = require$$0$6.Buffer;
24557
24557
  // Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer
24558
24558
 
24559
24559
  // == Extend Node primitives to use iconv-lite =================================
@@ -24586,7 +24586,7 @@ function requireExtendNode () {
24586
24586
  };
24587
24587
 
24588
24588
  // -- SlowBuffer -----------------------------------------------------------
24589
- var SlowBuffer = require$$0$7.SlowBuffer;
24589
+ var SlowBuffer = require$$0$6.SlowBuffer;
24590
24590
 
24591
24591
  original.SlowBufferToString = SlowBuffer.prototype.toString;
24592
24592
  SlowBuffer.prototype.toString = function(encoding, start, end) {
@@ -24726,7 +24726,7 @@ function requireExtendNode () {
24726
24726
 
24727
24727
  // -- Readable -------------------------------------------------------------
24728
24728
  if (iconv.supportsStreams) {
24729
- var Readable = require$$0$a.Readable;
24729
+ var Readable = require$$0$9.Readable;
24730
24730
 
24731
24731
  original.ReadableSetEncoding = Readable.prototype.setEncoding;
24732
24732
  Readable.prototype.setEncoding = function setEncoding(enc, options) {
@@ -24749,7 +24749,7 @@ function requireExtendNode () {
24749
24749
 
24750
24750
  delete Buffer.isNativeEncoding;
24751
24751
 
24752
- var SlowBuffer = require$$0$7.SlowBuffer;
24752
+ var SlowBuffer = require$$0$6.SlowBuffer;
24753
24753
 
24754
24754
  SlowBuffer.prototype.toString = original.SlowBufferToString;
24755
24755
  SlowBuffer.prototype.write = original.SlowBufferWrite;
@@ -24760,7 +24760,7 @@ function requireExtendNode () {
24760
24760
  Buffer.prototype.write = original.BufferWrite;
24761
24761
 
24762
24762
  if (iconv.supportsStreams) {
24763
- var Readable = require$$0$a.Readable;
24763
+ var Readable = require$$0$9.Readable;
24764
24764
 
24765
24765
  Readable.prototype.setEncoding = original.ReadableSetEncoding;
24766
24766
  delete Readable.prototype.collect;
@@ -25707,7 +25707,7 @@ var callBound$1 = function callBoundIntrinsic(name, allowMissing) {
25707
25707
  return intrinsic;
25708
25708
  };
25709
25709
 
25710
- var util_inspect = require$$1$3.inspect;
25710
+ var util_inspect = require$$1$4.inspect;
25711
25711
 
25712
25712
  var hasMap = typeof Map === 'function' && Map.prototype;
25713
25713
  var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
@@ -29914,6 +29914,36 @@ async function batchResolveChannel(urls) {
29914
29914
  failedCount,
29915
29915
  };
29916
29916
  }
29917
+ async function getStreamUrl(id) {
29918
+ const recorderManager = container.resolve("recorderManager");
29919
+ const recorder = recorderManager.manager.recorders.find((item) => item.id === id);
29920
+ if (!recorder)
29921
+ throw new Error("未找到录制器");
29922
+ let url;
29923
+ if (recorder.recordHandle) {
29924
+ if (recorder.providerId === "DouYin") {
29925
+ url = recorder.recordHandle.url;
29926
+ }
29927
+ }
29928
+ if (!url) {
29929
+ // B站的fmp4流不需要referer验证
29930
+ let formatName;
29931
+ let formatPriorities;
29932
+ if (recorder.providerId === "Bilibili") {
29933
+ formatName = "fmp4";
29934
+ }
29935
+ else if (recorder.providerId === "TikTok") {
29936
+ formatName = "hls";
29937
+ formatPriorities = ["hls", "flv"];
29938
+ }
29939
+ const data = await recorder.getStream({
29940
+ formatName: formatName,
29941
+ formatPriorities: formatPriorities,
29942
+ });
29943
+ url = data.url;
29944
+ }
29945
+ return { url };
29946
+ }
29917
29947
  async function getLiveInfo(ids) {
29918
29948
  const recorderManager = container.resolve("recorderManager");
29919
29949
  const recorders = recorderManager.manager.recorders;
@@ -29992,6 +30022,7 @@ var recorderService = {
29992
30022
  batchResolveChannel,
29993
30023
  getBiliStream,
29994
30024
  resolve,
30025
+ getStreamUrl,
29995
30026
  };
29996
30027
 
29997
30028
  const router$h = new Router$1();
@@ -30299,7 +30330,7 @@ var hasRequiredStream$1;
30299
30330
  function requireStream$1 () {
30300
30331
  if (hasRequiredStream$1) return stream$3;
30301
30332
  hasRequiredStream$1 = 1;
30302
- stream$3 = require$$0$a;
30333
+ stream$3 = require$$0$9;
30303
30334
  return stream$3;
30304
30335
  }
30305
30336
 
@@ -30412,7 +30443,7 @@ function requireUtil () {
30412
30443
  }
30413
30444
  util$2.isPrimitive = isPrimitive;
30414
30445
 
30415
- util$2.isBuffer = require$$0$7.Buffer.isBuffer;
30446
+ util$2.isBuffer = require$$0$6.Buffer.isBuffer;
30416
30447
 
30417
30448
  function objectToString(o) {
30418
30449
  return Object.prototype.toString.call(o);
@@ -30432,7 +30463,7 @@ function requireBufferList () {
30432
30463
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
30433
30464
 
30434
30465
  var Buffer = index$1.safeBufferExports.Buffer;
30435
- var util = require$$1$3;
30466
+ var util = require$$1$4;
30436
30467
 
30437
30468
  function copyBuffer(src, target, offset) {
30438
30469
  src.copy(target, offset);
@@ -30611,7 +30642,7 @@ function requireNode () {
30611
30642
  * For Node.js, simply re-export the core `util.deprecate` function.
30612
30643
  */
30613
30644
 
30614
- node = require$$1$3.deprecate;
30645
+ node = require$$1$4.deprecate;
30615
30646
  return node;
30616
30647
  }
30617
30648
 
@@ -31696,7 +31727,7 @@ function require_stream_readable$1 () {
31696
31727
  Readable.ReadableState = ReadableState;
31697
31728
 
31698
31729
  /*<replacement>*/
31699
- require$$0$5.EventEmitter;
31730
+ require$$0$4.EventEmitter;
31700
31731
 
31701
31732
  var EElistenerCount = function (emitter, type) {
31702
31733
  return emitter.listeners(type).length;
@@ -31726,7 +31757,7 @@ function require_stream_readable$1 () {
31726
31757
  /*</replacement>*/
31727
31758
 
31728
31759
  /*<replacement>*/
31729
- var debugUtil = require$$1$3;
31760
+ var debugUtil = require$$1$4;
31730
31761
  var debug = void 0;
31731
31762
  if (debugUtil && debugUtil.debuglog) {
31732
31763
  debug = debugUtil.debuglog('stream');
@@ -32872,7 +32903,7 @@ function requireReadable () {
32872
32903
  if (hasRequiredReadable) return readable$1.exports;
32873
32904
  hasRequiredReadable = 1;
32874
32905
  (function (module, exports) {
32875
- var Stream = require$$0$a;
32906
+ var Stream = require$$0$9;
32876
32907
  if (process.env.READABLE_STREAM === 'disable' && Stream) {
32877
32908
  module.exports = Stream;
32878
32909
  exports = module.exports = Stream.Readable;
@@ -45248,7 +45279,7 @@ function matchNeedle(self, data, pos, len) {
45248
45279
 
45249
45280
  var sbmh = SBMH;
45250
45281
 
45251
- const { Readable: Readable$1, Writable: Writable$2 } = require$$0$a;
45282
+ const { Readable: Readable$1, Writable: Writable$2 } = require$$0$9;
45252
45283
 
45253
45284
  const StreamSearch = sbmh;
45254
45285
 
@@ -45898,7 +45929,7 @@ const FIELD_VCHAR = [
45898
45929
 
45899
45930
  var multipart = Multipart;
45900
45931
 
45901
- const { Writable: Writable$1 } = require$$0$a;
45932
+ const { Writable: Writable$1 } = require$$0$9;
45902
45933
 
45903
45934
  const { getDecoder } = utils;
45904
45935
 
@@ -46455,7 +46486,7 @@ function appendField$1 (store, key, value) {
46455
46486
 
46456
46487
  var appendField_1 = appendField$1;
46457
46488
 
46458
- var EventEmitter$1 = require$$0$5.EventEmitter;
46489
+ var EventEmitter$1 = require$$0$4.EventEmitter;
46459
46490
 
46460
46491
  function Counter$1 () {
46461
46492
  EventEmitter$1.call(this);
@@ -46484,7 +46515,7 @@ Counter$1.prototype.onceZero = function onceZero (fn) {
46484
46515
 
46485
46516
  var counter = Counter$1;
46486
46517
 
46487
- var util$1 = require$$1$3;
46518
+ var util$1 = require$$1$4;
46488
46519
 
46489
46520
  var errorMessages = {
46490
46521
  LIMIT_PART_COUNT: 'Too many parts',
@@ -46869,8 +46900,8 @@ function makeMiddleware$1 (setup) {
46869
46900
 
46870
46901
  var makeMiddleware_1 = makeMiddleware$1;
46871
46902
 
46872
- var path$2 = require$$0$8;
46873
- var fs$5 = require$$0$9;
46903
+ var path$2 = require$$0$7;
46904
+ var fs$5 = require$$0$8;
46874
46905
  var _0777 = parseInt('0777', 8);
46875
46906
 
46876
46907
  var mkdirp$1 = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
@@ -46972,10 +47003,10 @@ mkdirP.sync = function sync (p, opts, made) {
46972
47003
  return made;
46973
47004
  };
46974
47005
 
46975
- var fs$4 = require$$0$9;
46976
- var os = require$$1$5;
46977
- var path$1 = require$$0$8;
46978
- var crypto = require$$1$2;
47006
+ var fs$4 = require$$0$8;
47007
+ var os = require$$1$6;
47008
+ var path$1 = require$$0$7;
47009
+ var crypto = require$$1$3;
46979
47010
  var mkdirp = mkdirp$1;
46980
47011
 
46981
47012
  function getFilename (req, file, cb) {
@@ -49394,8 +49425,8 @@ class Ollama extends Ollama$1 {
49394
49425
  return Buffer.from(image).toString("base64");
49395
49426
  }
49396
49427
  try {
49397
- if (require$$0$9.existsSync(image)) {
49398
- const fileBuffer = await require$$0$9.promises.readFile(require$$0$8.resolve(image));
49428
+ if (require$$0$8.existsSync(image)) {
49429
+ const fileBuffer = await require$$0$8.promises.readFile(require$$0$7.resolve(image));
49399
49430
  return Buffer.from(fileBuffer).toString("base64");
49400
49431
  }
49401
49432
  } catch {
@@ -49434,9 +49465,9 @@ class Ollama extends Ollama$1 {
49434
49465
  */
49435
49466
  resolvePath(inputPath, mfDir) {
49436
49467
  if (inputPath.startsWith("~")) {
49437
- return require$$0$8.join(require$$1$5.homedir(), inputPath.slice(1));
49468
+ return require$$0$7.join(require$$1$6.homedir(), inputPath.slice(1));
49438
49469
  }
49439
- return require$$0$8.resolve(mfDir, inputPath);
49470
+ return require$$0$7.resolve(mfDir, inputPath);
49440
49471
  }
49441
49472
  /**
49442
49473
  * checks if a file exists
@@ -49446,7 +49477,7 @@ class Ollama extends Ollama$1 {
49446
49477
  */
49447
49478
  async fileExists(path) {
49448
49479
  try {
49449
- await require$$0$9.promises.access(path);
49480
+ await require$$0$8.promises.access(path);
49450
49481
  return true;
49451
49482
  } catch {
49452
49483
  return false;
@@ -49456,9 +49487,9 @@ class Ollama extends Ollama$1 {
49456
49487
  if (typeof ReadableStream === "undefined") {
49457
49488
  throw new Error("Streaming uploads are not supported in this environment.");
49458
49489
  }
49459
- const fileStream = require$$0$9.createReadStream(path);
49490
+ const fileStream = require$$0$8.createReadStream(path);
49460
49491
  const sha256sum = await new Promise((resolve2, reject) => {
49461
- const hash = require$$1$2.createHash("sha256");
49492
+ const hash = require$$1$3.createHash("sha256");
49462
49493
  fileStream.on("data", (data) => hash.update(data));
49463
49494
  fileStream.on("end", () => resolve2(hash.digest("hex")));
49464
49495
  fileStream.on("error", reject);
@@ -49495,10 +49526,10 @@ class Ollama extends Ollama$1 {
49495
49526
  async create(request) {
49496
49527
  let modelfileContent = "";
49497
49528
  if (request.path) {
49498
- modelfileContent = await require$$0$9.promises.readFile(request.path, { encoding: "utf8" });
49529
+ modelfileContent = await require$$0$8.promises.readFile(request.path, { encoding: "utf8" });
49499
49530
  modelfileContent = await this.parseModelfile(
49500
49531
  modelfileContent,
49501
- require$$0$8.dirname(request.path)
49532
+ require$$0$7.dirname(request.path)
49502
49533
  );
49503
49534
  } else if (request.modelfile) {
49504
49535
  modelfileContent = await this.parseModelfile(request.modelfile);
@@ -49627,7 +49658,7 @@ var hasRequiredStream;
49627
49658
  function requireStream () {
49628
49659
  if (hasRequiredStream) return stream$1;
49629
49660
  hasRequiredStream = 1;
49630
- stream$1 = require$$0$a;
49661
+ stream$1 = require$$0$9;
49631
49662
  return stream$1;
49632
49663
  }
49633
49664
 
@@ -49646,9 +49677,9 @@ function requireBuffer_list () {
49646
49677
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
49647
49678
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
49648
49679
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
49649
- var _require = require$$0$7,
49680
+ var _require = require$$0$6,
49650
49681
  Buffer = _require.Buffer;
49651
- var _require2 = require$$1$3,
49682
+ var _require2 = require$$1$4,
49652
49683
  inspect = _require2.inspect;
49653
49684
  var custom = inspect && inspect.custom || 'inspect';
49654
49685
  function copyBuffer(src, target, offset) {
@@ -50118,7 +50149,7 @@ function require_stream_writable () {
50118
50149
  var Stream = requireStream();
50119
50150
  /*</replacement>*/
50120
50151
 
50121
- var Buffer = require$$0$7.Buffer;
50152
+ var Buffer = require$$0$6.Buffer;
50122
50153
  var OurUint8Array = (typeof index$1.commonjsGlobal !== 'undefined' ? index$1.commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
50123
50154
  function _uint8ArrayToBuffer(chunk) {
50124
50155
  return Buffer.from(chunk);
@@ -51443,7 +51474,7 @@ function require_stream_readable () {
51443
51474
  Readable.ReadableState = ReadableState;
51444
51475
 
51445
51476
  /*<replacement>*/
51446
- require$$0$5.EventEmitter;
51477
+ require$$0$4.EventEmitter;
51447
51478
  var EElistenerCount = function EElistenerCount(emitter, type) {
51448
51479
  return emitter.listeners(type).length;
51449
51480
  };
@@ -51453,7 +51484,7 @@ function require_stream_readable () {
51453
51484
  var Stream = requireStream();
51454
51485
  /*</replacement>*/
51455
51486
 
51456
- var Buffer = require$$0$7.Buffer;
51487
+ var Buffer = require$$0$6.Buffer;
51457
51488
  var OurUint8Array = (typeof index$1.commonjsGlobal !== 'undefined' ? index$1.commonjsGlobal : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
51458
51489
  function _uint8ArrayToBuffer(chunk) {
51459
51490
  return Buffer.from(chunk);
@@ -51463,7 +51494,7 @@ function require_stream_readable () {
51463
51494
  }
51464
51495
 
51465
51496
  /*<replacement>*/
51466
- var debugUtil = require$$1$3;
51497
+ var debugUtil = require$$1$4;
51467
51498
  var debug;
51468
51499
  if (debugUtil && debugUtil.debuglog) {
51469
51500
  debug = debugUtil.debuglog('stream');
@@ -52688,7 +52719,7 @@ function requirePipeline () {
52688
52719
  }
52689
52720
 
52690
52721
  (function (module, exports) {
52691
- var Stream = require$$0$a;
52722
+ var Stream = require$$0$9;
52692
52723
  if (process.env.READABLE_STREAM === 'disable' && Stream) {
52693
52724
  module.exports = Stream.Readable;
52694
52725
  Object.assign(module.exports, Stream);
@@ -54076,56 +54107,47 @@ const coerce$1 = (version, options) => {
54076
54107
  };
54077
54108
  var coerce_1 = coerce$1;
54078
54109
 
54079
- var lrucache;
54080
- var hasRequiredLrucache;
54081
-
54082
- function requireLrucache () {
54083
- if (hasRequiredLrucache) return lrucache;
54084
- hasRequiredLrucache = 1;
54085
-
54086
- class LRUCache {
54087
- constructor () {
54088
- this.max = 1000;
54089
- this.map = new Map();
54090
- }
54091
-
54092
- get (key) {
54093
- const value = this.map.get(key);
54094
- if (value === undefined) {
54095
- return undefined
54096
- } else {
54097
- // Remove the key from the map and add it to the end
54098
- this.map.delete(key);
54099
- this.map.set(key, value);
54100
- return value
54101
- }
54102
- }
54110
+ class LRUCache {
54111
+ constructor () {
54112
+ this.max = 1000;
54113
+ this.map = new Map();
54114
+ }
54103
54115
 
54104
- delete (key) {
54105
- return this.map.delete(key)
54106
- }
54116
+ get (key) {
54117
+ const value = this.map.get(key);
54118
+ if (value === undefined) {
54119
+ return undefined
54120
+ } else {
54121
+ // Remove the key from the map and add it to the end
54122
+ this.map.delete(key);
54123
+ this.map.set(key, value);
54124
+ return value
54125
+ }
54126
+ }
54107
54127
 
54108
- set (key, value) {
54109
- const deleted = this.delete(key);
54128
+ delete (key) {
54129
+ return this.map.delete(key)
54130
+ }
54110
54131
 
54111
- if (!deleted && value !== undefined) {
54112
- // If cache is full, delete the least recently used item
54113
- if (this.map.size >= this.max) {
54114
- const firstKey = this.map.keys().next().value;
54115
- this.delete(firstKey);
54116
- }
54132
+ set (key, value) {
54133
+ const deleted = this.delete(key);
54117
54134
 
54118
- this.map.set(key, value);
54119
- }
54135
+ if (!deleted && value !== undefined) {
54136
+ // If cache is full, delete the least recently used item
54137
+ if (this.map.size >= this.max) {
54138
+ const firstKey = this.map.keys().next().value;
54139
+ this.delete(firstKey);
54140
+ }
54120
54141
 
54121
- return this
54122
- }
54123
- }
54142
+ this.map.set(key, value);
54143
+ }
54124
54144
 
54125
- lrucache = LRUCache;
54126
- return lrucache;
54145
+ return this
54146
+ }
54127
54147
  }
54128
54148
 
54149
+ var lrucache = LRUCache;
54150
+
54129
54151
  var range;
54130
54152
  var hasRequiredRange;
54131
54153
 
@@ -54347,7 +54369,7 @@ function requireRange () {
54347
54369
 
54348
54370
  range = Range;
54349
54371
 
54350
- const LRU = requireLrucache();
54372
+ const LRU = lrucache;
54351
54373
  const cache = new LRU();
54352
54374
 
54353
54375
  const parseOptions = parseOptions_1;
@@ -56090,7 +56112,7 @@ router$d.post("/get_cookie", async (ctx) => {
56090
56112
  return;
56091
56113
  }
56092
56114
  const secret = "r96gkr8ahc34fsrewr34";
56093
- const hash = require$$1$2.createHmac("sha256", secret).update(`${uid}${timestamp}`).digest("hex");
56115
+ const hash = require$$1$3.createHmac("sha256", secret).update(`${uid}${timestamp}`).digest("hex");
56094
56116
  if (hash !== signature) {
56095
56117
  ctx.status = 400;
56096
56118
  ctx.body = "签名无效";
@@ -56266,10 +56288,10 @@ router$c.put("/subtitle-style/:id", async (ctx) => {
56266
56288
 
56267
56289
  var chokidar = {};
56268
56290
 
56269
- const fs$3 = require$$0$9;
56270
- const { Readable } = require$$0$a;
56271
- const sysPath$3 = require$$0$8;
56272
- const { promisify: promisify$3 } = require$$1$3;
56291
+ const fs$3 = require$$0$8;
56292
+ const { Readable } = require$$0$9;
56293
+ const sysPath$3 = require$$0$7;
56294
+ const { promisify: promisify$3 } = require$$1$4;
56273
56295
  const picomatch$1 = index$1.picomatch;
56274
56296
 
56275
56297
  const readdir$1 = promisify$3(fs$3.readdir);
@@ -56963,7 +56985,7 @@ var require$$0 = [
56963
56985
 
56964
56986
  var binaryExtensions$1 = require$$0;
56965
56987
 
56966
- const path = require$$0$8;
56988
+ const path = require$$0$7;
56967
56989
  const binaryExtensions = binaryExtensions$1;
56968
56990
 
56969
56991
  const extensions = new Set(binaryExtensions);
@@ -56974,9 +56996,9 @@ var constants$1 = {};
56974
56996
 
56975
56997
  (function (exports) {
56976
56998
 
56977
- const {sep} = require$$0$8;
56999
+ const {sep} = require$$0$7;
56978
57000
  const {platform} = process;
56979
- const os = require$$1$5;
57001
+ const os = require$$1$6;
56980
57002
 
56981
57003
  exports.EV_ALL = 'all';
56982
57004
  exports.EV_READY = 'ready';
@@ -57040,9 +57062,9 @@ var constants$1 = {};
57040
57062
  exports.isIBMi = os.type() === 'OS400';
57041
57063
  } (constants$1));
57042
57064
 
57043
- const fs$2 = require$$0$9;
57044
- const sysPath$2 = require$$0$8;
57045
- const { promisify: promisify$2 } = require$$1$3;
57065
+ const fs$2 = require$$0$8;
57066
+ const sysPath$2 = require$$0$7;
57067
+ const { promisify: promisify$2 } = require$$1$4;
57046
57068
  const isBinaryPath = isBinaryPath$1;
57047
57069
  const {
57048
57070
  isWindows: isWindows$1,
@@ -57691,9 +57713,9 @@ var nodefsHandler = NodeFsHandler$1;
57691
57713
 
57692
57714
  var fseventsHandler = {exports: {}};
57693
57715
 
57694
- const fs$1 = require$$0$9;
57695
- const sysPath$1 = require$$0$8;
57696
- const { promisify: promisify$1 } = require$$1$3;
57716
+ const fs$1 = require$$0$8;
57717
+ const sysPath$1 = require$$0$7;
57718
+ const { promisify: promisify$1 } = require$$1$4;
57697
57719
 
57698
57720
  let fsevents;
57699
57721
  try {
@@ -58218,10 +58240,10 @@ fseventsHandler.exports.canUse = canUse;
58218
58240
 
58219
58241
  var fseventsHandlerExports = fseventsHandler.exports;
58220
58242
 
58221
- const { EventEmitter } = require$$0$5;
58222
- const fs = require$$0$9;
58223
- const sysPath = require$$0$8;
58224
- const { promisify } = require$$1$3;
58243
+ const { EventEmitter } = require$$0$4;
58244
+ const fs = require$$0$8;
58245
+ const sysPath = require$$0$7;
58246
+ const { promisify } = require$$1$4;
58225
58247
  const readdirp = readdirp_1;
58226
58248
  const anymatch = anymatchExports.default;
58227
58249
  const globParent = index$1.globParent;
@@ -59190,7 +59212,7 @@ const watch = (paths, options) => {
59190
59212
 
59191
59213
  chokidar.watch = watch;
59192
59214
 
59193
- const stream = require$$0$a;
59215
+ const stream = require$$0$9;
59194
59216
  const Transform = stream.Transform;
59195
59217
 
59196
59218
 
@@ -59310,7 +59332,7 @@ SSETransform.defOpts = {
59310
59332
  var sse$1 = SSETransform;
59311
59333
 
59312
59334
  const SSE = sse$1;
59313
- const Stream$1 = require$$0$a;
59335
+ const Stream$1 = require$$0$9;
59314
59336
  const DEFAULT_OPTS = {
59315
59337
  maxClients: 10000,
59316
59338
  pingInterval: 60000,
@@ -59766,10 +59788,10 @@ class FFmpegWhisperASR {
59766
59788
  throw new Error(`音频文件不存在: ${filePath}`);
59767
59789
  }
59768
59790
  // 创建临时目录存放结果
59769
- const tempDir = require$$0$8.join(require$$1$5.tmpdir(), "whisper-asr");
59791
+ const tempDir = require$$0$7.join(require$$1$6.tmpdir(), "whisper-asr");
59770
59792
  await index$1.fs.ensureDir(tempDir);
59771
59793
  // 生成唯一的输出文件名
59772
- const outputFile = require$$0$8.join(tempDir, `${v4()}.json`);
59794
+ const outputFile = require$$0$7.join(tempDir, `${v4()}.json`);
59773
59795
  try {
59774
59796
  // 执行 ffmpeg 命令
59775
59797
  await this.executeFFmpeg(filePath, outputFile);
@@ -59828,7 +59850,7 @@ class FFmpegWhisperASR {
59828
59850
  ];
59829
59851
  this.options.logger.info(`执行 FFmpeg Whisper 命令: ${this.options.ffmpegPath} ${args.join(" ")}`);
59830
59852
  // 使用 spawn 执行命令
59831
- const process = require$$0$e.spawn(this.options.ffmpegPath, args);
59853
+ const process = require$$0$c.spawn(this.options.ffmpegPath, args);
59832
59854
  let stderr = "";
59833
59855
  // 收集标准错误输出(ffmpeg 的日志)
59834
59856
  process.stderr.on("data", (data) => {
@@ -60784,7 +60806,7 @@ const isFile = (value) => value instanceof File;
60784
60806
 
60785
60807
  const isBlob = (value) => value instanceof Blob$1;
60786
60808
 
60787
- const deprecateConstructorEntries = require$$1$3.deprecate(() => { }, "Constructor \"entries\" argument is not spec-compliant "
60809
+ const deprecateConstructorEntries = require$$1$4.deprecate(() => { }, "Constructor \"entries\" argument is not spec-compliant "
60788
60810
  + "and will be removed in next major release.");
60789
60811
 
60790
60812
  var __classPrivateFieldGet$8 = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
@@ -60921,7 +60943,7 @@ let FormData$1 = class FormData {
60921
60943
  get [Symbol.toStringTag]() {
60922
60944
  return "FormData";
60923
60945
  }
60924
- [require$$1$3.inspect.custom]() {
60946
+ [require$$1$4.inspect.custom]() {
60925
60947
  return this[Symbol.toStringTag];
60926
60948
  }
60927
60949
  };
@@ -60938,7 +60960,7 @@ var agentkeepalive = {exports: {}};
60938
60960
  * Module dependencies.
60939
60961
  */
60940
60962
 
60941
- var util = require$$1$3;
60963
+ var util = require$$1$4;
60942
60964
  var ms$1 = index$1.requireMs();
60943
60965
 
60944
60966
  var humanizeMs = function (t) {
@@ -60964,9 +60986,9 @@ var constants = {
60964
60986
  SOCKET_REQUEST_FINISHED_COUNT: Symbol('agentkeepalive#socketRequestFinishedCount'),
60965
60987
  };
60966
60988
 
60967
- const OriginalAgent = require$$3$1.Agent;
60989
+ const OriginalAgent = require$$1$2.Agent;
60968
60990
  const ms = humanizeMs;
60969
- const debug$1 = require$$1$3.debuglog('agentkeepalive');
60991
+ const debug$1 = require$$1$4.debuglog('agentkeepalive');
60970
60992
  const {
60971
60993
  INIT_SOCKET: INIT_SOCKET$1,
60972
60994
  CURRENT_ID,
@@ -61365,7 +61387,7 @@ function inspect(obj) {
61365
61387
  return res;
61366
61388
  }
61367
61389
 
61368
- const OriginalHttpsAgent = require$$1$6.Agent;
61390
+ const OriginalHttpsAgent = require$$1$7.Agent;
61369
61391
  const HttpAgent$1 = agent;
61370
61392
  const {
61371
61393
  INIT_SOCKET,
@@ -62581,7 +62603,7 @@ class MultipartBody {
62581
62603
  let fileFromPathWarned = false;
62582
62604
  async function fileFromPath(path, ...args) {
62583
62605
  // this import fails in environments that don't handle export maps correctly, like old versions of Jest
62584
- const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-DdVRxbmq.cjs'); });
62606
+ const { fileFromPath: _fileFromPath } = await Promise.resolve().then(function () { return require('./fileFromPath-Cqq5W5LP.cjs'); });
62585
62607
  if (!fileFromPathWarned) {
62586
62608
  console.warn(`fileFromPath is deprecated; use fs.createReadStream(${JSON.stringify(path)}) instead`);
62587
62609
  fileFromPathWarned = true;
@@ -62593,7 +62615,7 @@ const defaultHttpAgent = new KeepAliveAgent({ keepAlive: true, timeout: 5 * 60 *
62593
62615
  const defaultHttpsAgent = new KeepAliveAgent.HttpsAgent({ keepAlive: true, timeout: 5 * 60 * 1000 });
62594
62616
  async function getMultipartRequestOptions(form, opts) {
62595
62617
  const encoder = new FormDataEncoder(form);
62596
- const readable = require$$0$f.Readable.from(encoder);
62618
+ const readable = require$$0$d.Readable.from(encoder);
62597
62619
  const body = new MultipartBody(readable);
62598
62620
  const headers = {
62599
62621
  ...opts.headers,
@@ -68998,7 +69020,7 @@ class DecodedMessage {
68998
69020
  if (!uri.startsWith(DATA_URI_PREFIX)) {
68999
69021
  throw new Error('assert 4');
69000
69022
  }
69001
- return this.decodeFromBinary(require$$0$7.Buffer.from(uri.replace(DATA_URI_PREFIX, ''), 'base64'));
69023
+ return this.decodeFromBinary(require$$0$6.Buffer.from(uri.replace(DATA_URI_PREFIX, ''), 'base64'));
69002
69024
  }
69003
69025
  encodeToBinary() {
69004
69026
  const header = {
@@ -69049,7 +69071,7 @@ class DecodedMessage {
69049
69071
  }
69050
69072
  encodeToUri() {
69051
69073
  const bin = this.encodeToBinary();
69052
- return DATA_URI_PREFIX + require$$0$7.Buffer.from(bin).toString('base64');
69074
+ return DATA_URI_PREFIX + require$$0$6.Buffer.from(bin).toString('base64');
69053
69075
  }
69054
69076
  }
69055
69077
 
@@ -69889,7 +69911,7 @@ class Shazam {
69889
69911
  * @returns {ShazamRoot | null}
69890
69912
  */
69891
69913
  async recognise(path, language = "en-US", minimal = false) {
69892
- const signatures = shazamioCore.recognizeBytes(require$$0$9.readFileSync(path), 0, Number.MAX_SAFE_INTEGER);
69914
+ const signatures = shazamioCore.recognizeBytes(require$$0$8.readFileSync(path), 0, Number.MAX_SAFE_INTEGER);
69893
69915
  try {
69894
69916
  let response;
69895
69917
  for (let i = Math.floor(signatures.length / 2); i < signatures.length; i += 4) {
@@ -74027,6 +74049,19 @@ router$a.get("/:id", (ctx) => {
74027
74049
  const { id } = ctx.params;
74028
74050
  ctx.body = { payload: recorderService.getRecorder({ id }) };
74029
74051
  });
74052
+ /**
74053
+ * 获取直播播放列表
74054
+ * @route GET /recorder/:recorderId/stream
74055
+ * @param recorderId 录制器 ID
74056
+ * @returns 重写分片地址后的 HLS 播放列表
74057
+ */
74058
+ router$a.post("/:id/stream", async (ctx) => {
74059
+ const { id } = ctx.params;
74060
+ const data = await recorderService.getStreamUrl(id);
74061
+ ctx.body = {
74062
+ payload: data,
74063
+ };
74064
+ });
74030
74065
  router$a.put("/:id", (ctx) => {
74031
74066
  const { id } = ctx.params;
74032
74067
  const patch = index$1.pick(ctx.request.body, "remarks", "disableAutoCheck", "quality", "streamPriorities", "sourcePriorities", "noGlobalFollowFields", "line", "disableProvideCommentsWhenRecording", "saveGiftDanma", "saveSCDanma", "saveCover", "segment", "sendToWebhook", "uid", "qualityRetry", "formatName", "useM3U8Proxy", "customHost", "codecName", "titleKeywords", "liveStartNotification", "chargeLiveNotification", "liveEndNotification", "weight", "source", "videoFormat", "recorderType", "cookie", "doubleScreen", "onlyAudio", "useServerTimestamp", "handleTime", "debugLevel", "convert2Mp4", "api");
@@ -75243,8 +75278,8 @@ async function download$1(output, url, options) {
75243
75278
  const mp4Output = index$1.replaceExtName(output, ".mp4");
75244
75279
  if ((await index$1.fs.pathExists(mp4Output)) && !options.override)
75245
75280
  throw new Error(`${mp4Output}已存在`);
75246
- const { dir, name } = require$$0$8.parse(output);
75247
- const tsOutput = require$$0$8.join(dir, `${name}.ts`);
75281
+ const { dir, name } = require$$0$7.parse(output);
75282
+ const tsOutput = require$$0$7.join(dir, `${name}.ts`);
75248
75283
  if (await index$1.fs.pathExists(tsOutput)) {
75249
75284
  throw new Error(`${tsOutput}已存在,您可以直接执行转封装命令,或者删除后重新下载`);
75250
75285
  }
@@ -75252,10 +75287,10 @@ async function download$1(output, url, options) {
75252
75287
  const downloader = new index$1.M3U8Downloader(url, tsOutput, {
75253
75288
  convert2Mp4: false,
75254
75289
  ffmpegPath: ffmpegPath,
75255
- segmentsDir: require$$0$8.join(index$1.getTempPath(), index$1.uuid()),
75290
+ segmentsDir: require$$0$7.join(index$1.getTempPath(), index$1.uuid()),
75256
75291
  });
75257
75292
  const task = new index$1.KuaishouDownloadVideoTask(downloader, {
75258
- name: `下载任务:${require$$0$8.parse(output).name}`,
75293
+ name: `下载任务:${require$$0$7.parse(output).name}`,
75259
75294
  }, {
75260
75295
  onEnd: async () => {
75261
75296
  const outputName = `${name}.mp4`;
@@ -75298,7 +75333,7 @@ var kuaishou = {
75298
75333
  var dist = {};
75299
75334
 
75300
75335
  (function (exports) {
75301
- Object.defineProperty(exports,'__esModule',{value:!0}),exports.DownloaderHelper=exports.DH_STATES=void 0;var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},_createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c);}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_fs=require$$0$9,fs=_interopRequireWildcard(_fs),_url=require$$0$b,_path=require$$0$8,path=_interopRequireWildcard(_path),_http=require$$3$1,http=_interopRequireWildcard(_http),_https=require$$1$6,https=_interopRequireWildcard(_https),_events=require$$0$5;function _interopRequireWildcard(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b);}var DH_STATES=exports.DH_STATES={IDLE:'IDLE',SKIPPED:'SKIPPED',STARTED:'STARTED',DOWNLOADING:'DOWNLOADING',RETRY:'RETRY',PAUSED:'PAUSED',RESUMED:'RESUMED',STOPPED:'STOPPED',FINISHED:'FINISHED',FAILED:'FAILED'};exports.DownloaderHelper=function(a){function b(a,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,b);var e=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,{captureRejections:!0}));return e.__validate(a,c)?(e.url=e.requestURL=a.trim(),e.state=DH_STATES.IDLE,e.__defaultOpts={body:null,retry:!1,method:'GET',headers:{},fileName:'',timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},e.__opts=Object.assign({},e.__defaultOpts),e.__pipes=[],e.__total=0,e.__downloaded=0,e.__progress=0,e.__retryCount=0,e.__retryTimeout=null,e.__resumeRetryCount=0,e.__states=DH_STATES,e.__promise=null,e.__request=null,e.__response=null,e.__isAborted=!1,e.__isResumed=!1,e.__isResumable=!1,e.__isRedirected=!1,e.__destFolder=c,e.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},e.__fileName='',e.__filePath='',e.updateOptions(d),e):_possibleConstructorReturn(e)}return _inherits(b,a),_createClass(b,[{key:'start',value:function c(){var a=this,b=function(){return new Promise(function(b,c){a.__promise={resolve:b,reject:c},a.__start();})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(c){var d=c.name,e=c.total,f=a.__opts.override;if(a.__opts.override=!0,a.__filePath=a.__getFilePath(d),a.__opts.override=f,a.__filePath&&fs.existsSync(a.__filePath)){var g=a.__getFilesizeInBytes(a.__filePath);return g===e?b():a.resumeFromFile(a.__filePath,{total:e,fileName:d})}return b()}):b()}},{key:'pause',value:function b(){var a=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return a.__setState(a.__states.PAUSED),a.emit('pause'),!0}))}},{key:'resume',value:function a(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range='bytes='+this.__downloaded+'-'),this.emit('resume',this.__isResumed),this.__start()):this.start()}},{key:'stop',value:function c(){var a=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var b=function(){return new Promise(function(b,c){fs.access(a.__filePath,function(d){return d?(a.__emitStop(),b(!0)):void fs.unlink(a.__filePath,function(d){return d?(a.__setState(a.__states.FAILED),a.emit('error',d),c(d)):void(a.__emitStop(),b(!0))})});})};return this.__requestAbort(),this.__closeFileStream().then(function(){return a.__opts.removeOnStop?b():(a.__emitStop(),Promise.resolve(!0))})}},{key:'pipe',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.__pipes.push({stream:a,options:b}),a}},{key:'unpipe',value:function d(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=function(b){return a.__response?a.__response.unpipe(b):b.unpipe()};if(b){var e=this.__pipes.find(function(a){return a.stream===b});return void(e&&(c(b),this.__pipes=this.__pipes.filter(function(a){return a.stream!==b})))}this.__pipes.forEach(function(a){return c(a.stream)}),this.__pipes=[];}},{key:'getDownloadPath',value:function a(){return this.__filePath}},{key:'isResumable',value:function a(){return this.__isResumable}},{key:'updateOptions',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'';this.__opts=Object.assign({},this.__opts,a),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),('number'!=typeof this.__opts.progressThrottle||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=b||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url);}},{key:'getOptions',value:function a(){return this.__opts}},{key:'getMetadata',value:function a(){return this.__opts.metadata}},{key:'getStats',value:function a(){return {total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:'getTotalSize',value:function b(){var a=this;return new Promise(function(b,c){var d=function(b){a.__initProtocol(b);var c=Object.assign({},a.__headers);c.hasOwnProperty('range')&&delete c.range;var d=a.__getReqOptions('HEAD',b,c);return Object.assign({},a.__reqOptions,d)},e=0,f=null,g=function(b,c){if(!a.__opts.retry||'object'!==_typeof(a.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));f&&(clearTimeout(f),f=null);var g=a.__opts.retry,i=g.delay,j=void 0===i?0:i,k=g.maxRetries,l=void 0===k?999:k;return e>=l?Promise.reject(b||new Error('reached the maximum retries')):(e++,a.__setState(a.__states.RETRY),a.emit('retry',e,a.__opts.retry,b),new Promise(function(b){f=setTimeout(function(){a.__setState(a.__states.IDLE),h(c,d(c)),b();},j);}))},h=function(e,i){f&&(clearTimeout(f),f=null);var j=a.__protocol.request(i,function(f){if(a.__isRequireRedirect(f)){var i=/^https?:\/\//.test(f.headers.location)?f.headers.location:new _url.URL(f.headers.location,e).href;return a.emit('redirected',i,e),h(i,d(i))}if(200>f.statusCode||400<=f.statusCode){var j=new Error('Response status was '+f.statusCode);return a.__opts.retry&&500<=f.statusCode&&600>f.statusCode?g(j,e).catch(c):c(j)}b({name:a.__getFileNameFromHeaders(f.headers,f),total:parseInt(f.headers['content-length'])||null});});j.on('error',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.on('timeout',function(){return a.__opts.retry?g(new Error('timeout'),e).catch(c):void c(new Error('timeout'))}),j.on('uncaughtException',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.end();};h(a.url,d(a.url));})}},{key:'getResumeState',value:function a(){return {downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:'resumeFromFile',value:function d(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return this.__opts.override=!0,this.__filePath=a,(c.total&&c.fileName?Promise.resolve({name:c.fileName,total:c.total}):this.getTotalSize()).then(function(a){var d=a.name,e=a.total;return b.__total=c.total||e,b.__fileName=c.fileName||d,b.__downloaded=c.downloaded||b.__getFilesizeInBytes(b.__filePath),b.__reqOptions.headers.range='bytes='+b.__downloaded+'-',b.__isResumed=!0,b.__isResumable=!0,b.__setState(b.__states.RESUMED),b.emit('resume',b.__isResumed),new Promise(function(a,c){b.__promise={resolve:a,reject:c},b.__start();})})}},{key:'__start',value:function a(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit('start'),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on('error',this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on('timeout',this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on('uncaughtException',this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end();}},{key:'__resolvePending',value:function b(){if(this.__promise){var a=this.__promise.resolve;return this.__promise=null,a(!0)}}},{key:'__downloadRequest',value:function d(a,b){var c=this;return this.__protocol.request(this.__reqOptions,function(d){if(c.__response=d,c.__isResumed||(c.__total=parseInt(d.headers['content-length'])||null,c.__resetStats()),c.__isRequireRedirect(d)){var e=/^https?:\/\//.test(d.headers.location)?d.headers.location:new _url.URL(d.headers.location,c.url).href;return c.__isRedirected=!0,c.__initProtocol(e),c.emit('redirected',e,c.url),c.__start()}if(200>d.statusCode||400<=d.statusCode){var f=new Error('Response status was '+d.statusCode);return (f.status=d.statusCode||0,f.body=d.body||'',500<=d.statusCode&&600>d.statusCode)?c.__onError(a,b)(f):(c.__setState(c.__states.FAILED),c.emit('error',f),b(f))}c.__opts.forceResume?c.__isResumable=!0:d.headers.hasOwnProperty('accept-ranges')&&'none'!==d.headers['accept-ranges']&&(c.__isResumable=!0),c.__startDownload(d,a,b);})}},{key:'__startDownload',value:function h(a,b,c){var d=this,e=a;if(!this.__isResumed){var i=this.__getFileNameFromHeaders(a.headers);if(this.__filePath=this.__getFilePath(i),this.__fileName=this.__filePath.split(path.sep).pop(),fs.existsSync(this.__filePath)){var f=this.__getFilesizeInBytes(this.__filePath),g=this.__total?this.__total:0;if('object'===_typeof(this.__opts.override)&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||f>=g))return this.emit('skip',{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:f}),this.__setState(this.__states.SKIPPED),b(!0)}this.__fileStream=fs.createWriteStream(this.__filePath,{});}else this.__fileStream=fs.createWriteStream(this.__filePath,{flags:'a'});this.emit('download',{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,e.on('data',function(a){return d.__calculateStats(a.length)}),this.__pipes.forEach(function(a){e.pipe(a.stream,a.options),e=a.stream;}),e.pipe(this.__fileStream),e.on('error',this.__onError(b,c)),this.__fileStream.on('finish',this.__onFinished(b,c)),this.__fileStream.on('error',this.__onError(b,c));}},{key:'__hasFinished',value:function a(){return !this.__isAborted&&-1===[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)}},{key:'__isRequireRedirect',value:function b(a){return 300<a.statusCode&&400>a.statusCode&&a.headers.hasOwnProperty('location')&&a.headers.location}},{key:'__onFinished',value:function d(a,b){var c=this;return function(){c.__fileStream.close(function(d){if(d)return b(d);if(c.__hasFinished()){var e=!!c.__total&&c.__downloaded!==c.__total;if(e&&c.__isResumable&&c.__opts.resumeOnIncomplete&&c.__resumeRetryCount<=c.__opts.resumeOnIncompleteMaxRetry)return c.__resumeRetryCount++,c.emit('warning',new Error('uncomplete download, retrying')),c.resume();c.__setState(c.__states.FINISHED),c.__pipes=[],c.emit('end',{fileName:c.__fileName,filePath:c.__filePath,totalSize:c.__total,incomplete:e,onDiskSize:c.__getFilesizeInBytes(c.__filePath),downloadedSize:c.__downloaded});}return a(c.__downloaded===c.__total)});}}},{key:'__closeFileStream',value:function b(){var a=this;return this.__fileStream?new Promise(function(b,c){a.__fileStream.close(function(a){return a?c(a):b(!0)});}):Promise.resolve(!0)}},{key:'__onError',value:function e(a,b){var c=this,d=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return function(a){return c.__pipes=[],d&&c.__requestAbort(),c.state===c.__states.STOPPED||c.state===c.__states.FAILED?void 0:c.__opts.retry?c.__retry(a).catch(function(d){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',d?d:a),b(d?d:a);});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',a),b(a);})}}},{key:'__retry',value:function h(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(!this.__opts.retry||'object'!==_typeof(this.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));var c=this.__opts.retry,d=c.delay,e=void 0===d?0:d,f=c.maxRetries,g=void 0===f?999:f;return this.__retryCount>=g?Promise.reject(b||new Error('reached the maximum retries')):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit('retry',this.__retryCount,this.__opts.retry,b),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(b){return a.__retryTimeout=setTimeout(function(){return b(0<a.__downloaded?a.resume():a.__start())},e)})}))}},{key:'__onTimeout',value:function d(a,b){var c=this;return function(){return c.__requestAbort(),c.__opts.retry?c.__retry(new Error('timeout')).catch(function(a){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),a?b(a):(c.emit('timeout'),b(new Error('timeout')));});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('timeout'),b(new Error('timeout'));})}}},{key:'__resetStats',value:function a(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0};}},{key:'__getFileNameFromHeaders',value:function k(a,b){var c='',d=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,e=/.*filename="(.*?)";?/i,f=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,g=a.hasOwnProperty('content-disposition'),h=g?a['content-disposition'].match(d):null,i=!g||h?null:a['content-disposition'].match(e),j=!g||h||i?null:a['content-disposition'].match(f);return g&&(h||i||j)?(c=a['content-disposition'],c=c.trim(),h?c=h[1]:i?c=i[1]:j&&(c=j[1]),c=c.replace(/[/\\]/g,'')):0<path.basename(new _url.URL(this.requestURL).pathname).length?c=path.basename(new _url.URL(this.requestURL).pathname):c=new _url.URL(this.requestURL).hostname+'.html',this.__opts.fileName?this.__getFileNameFromOpts(c,b):c.replace(/\.*$/,'')}},{key:'__getFilePath',value:function d(a){var b=path.join(this.__destFolder,a),c=b;return this.__opts.override||this.state===this.__states.RESUMED||(c=this.__uniqFileNameSync(c),b!==c&&this.emit('renamed',{path:c,fileName:c.split(path.sep).pop(),prevPath:b,prevFileName:b.split(path.sep).pop()})),c}},{key:'__getFileNameFromOpts',value:function g(a,b){if(!this.__opts.fileName)return a;if('string'==typeof this.__opts.fileName)return this.__opts.fileName;if('function'==typeof this.__opts.fileName){var h=path.join(this.__destFolder,a);return b&&b.headers||this.__response&&this.__response.headers?this.__opts.fileName(a,h,(b?b:this.__response).headers['content-type']):this.__opts.fileName(a,h)}if('object'===_typeof(this.__opts.fileName)){var c=this.__opts.fileName,d=c.name,e=!!c.hasOwnProperty('ext')&&c.ext;if('string'==typeof e)return d+'.'+e;if('boolean'==typeof e){if(e)return d;var f=a.includes('.')?a.split('.').pop():'';return ''===f?d:d+'.'+f}}return a}},{key:'__calculateStats',value:function f(a){var b=new Date,c=b-this.__statsEstimate.time,d=b-this.__statsEstimate.throttleTime,e=this.__total||0;a&&(this.__downloaded+=a,this.__progress=0===e?0:100*(this.__downloaded/e),(this.__downloaded===e||1e3<c)&&(this.__statsEstimate.time=b,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===e||d>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=b,this.emit('progress.throttled',this.getStats())),this.emit('progress',this.getStats()));}},{key:'__setState',value:function b(a){this.state=a,this.emit('stateChanged',this.state);}},{key:'__getReqOptions',value:function f(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=new _url.URL(b),e={protocol:d.protocol,host:d.hostname,port:d.port,path:d.pathname+d.search,method:a};return c&&(e.headers=c),e}},{key:'__getFilesizeInBytes',value:function d(a){try{var b=fs.statSync(a,{throwIfNoEntry:!1}),c=b.size||0;return c}catch(a){this.emit('warning',a);}return 0}},{key:'__validate',value:function d(a,b){if('string'!=typeof a)throw new Error('URL should be an string');if(''===a.trim())throw new Error('URL couldn\'t be empty');if('string'!=typeof b)throw new Error('Destination Folder should be an string');if(''===b.trim())throw new Error('Destination Folder couldn\'t be empty');if(!fs.existsSync(b))throw new Error('Destination Folder must exist');var c=fs.statSync(b);if(!c.isDirectory())throw new Error('Destination Folder must be a directory');try{fs.accessSync(b,fs.constants.W_OK);}catch(a){throw new Error('Destination Folder must be writable')}return !0}},{key:'__initProtocol',value:function c(a){var b=this.__getReqOptions(this.__opts.method,a,this.__headers);this.requestURL=a,-1<a.indexOf('https://')?(this.__protocol=https,b.agent=new https.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpsRequestOptions)):(this.__protocol=http,b.agent=new http.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpRequestOptions));}},{key:'__uniqFileNameSync',value:function f(a){if('string'!=typeof a||''===a)return a;try{fs.accessSync(a,fs.F_OK);var b=a.match(/(.*)(\([0-9]+\))(\..*)$/),c=b?b[1].trim():a,d=b?parseInt(b[2].replace(/\(|\)/,'')):0,e=a.split('.').pop();return e!==a&&0<e.length?(e='.'+e,c=c.replace(e,'')):e='',this.__uniqFileNameSync(c+' ('+ ++d+')'+e)}catch(b){return a}}},{key:'__removeFile',value:function b(){var a=this;return new Promise(function(b){return a.__fileStream?void a.__fileStream.close(function(c){return c&&a.emit('warning',c),a.__opts.removeOnFail?fs.access(a.__filePath,function(d){return d?b():void fs.unlink(a.__filePath,function(d){d&&a.emit('warning',c),b();})}):void b()}):b()})}},{key:'__requestAbort',value:function a(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort());}},{key:'__emitStop',value:function a(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit('stop');}}]),b}(_events.EventEmitter);
75336
+ Object.defineProperty(exports,'__esModule',{value:!0}),exports.DownloaderHelper=exports.DH_STATES=void 0;var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&'function'==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?'symbol':typeof a},_createClass=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c);}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_fs=require$$0$8,fs=_interopRequireWildcard(_fs),_url=require$$0$a,_path=require$$0$7,path=_interopRequireWildcard(_path),_http=require$$1$2,http=_interopRequireWildcard(_http),_https=require$$1$7,https=_interopRequireWildcard(_https),_events=require$$0$4;function _interopRequireWildcard(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function _inherits(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b);}var DH_STATES=exports.DH_STATES={IDLE:'IDLE',SKIPPED:'SKIPPED',STARTED:'STARTED',DOWNLOADING:'DOWNLOADING',RETRY:'RETRY',PAUSED:'PAUSED',RESUMED:'RESUMED',STOPPED:'STOPPED',FINISHED:'FINISHED',FAILED:'FAILED'};exports.DownloaderHelper=function(a){function b(a,c){var d=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};_classCallCheck(this,b);var e=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,{captureRejections:!0}));return e.__validate(a,c)?(e.url=e.requestURL=a.trim(),e.state=DH_STATES.IDLE,e.__defaultOpts={body:null,retry:!1,method:'GET',headers:{},fileName:'',timeout:-1,metadata:null,override:!1,forceResume:!1,removeOnStop:!0,removeOnFail:!0,progressThrottle:1e3,httpRequestOptions:{},httpsRequestOptions:{},resumeOnIncomplete:!0,resumeIfFileExists:!1,resumeOnIncompleteMaxRetry:5},e.__opts=Object.assign({},e.__defaultOpts),e.__pipes=[],e.__total=0,e.__downloaded=0,e.__progress=0,e.__retryCount=0,e.__retryTimeout=null,e.__resumeRetryCount=0,e.__states=DH_STATES,e.__promise=null,e.__request=null,e.__response=null,e.__isAborted=!1,e.__isResumed=!1,e.__isResumable=!1,e.__isRedirected=!1,e.__destFolder=c,e.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0},e.__fileName='',e.__filePath='',e.updateOptions(d),e):_possibleConstructorReturn(e)}return _inherits(b,a),_createClass(b,[{key:'start',value:function c(){var a=this,b=function(){return new Promise(function(b,c){a.__promise={resolve:b,reject:c},a.__start();})};return this.__opts.resumeIfFileExists&&this.state!==this.__states.RESUMED?this.getTotalSize().then(function(c){var d=c.name,e=c.total,f=a.__opts.override;if(a.__opts.override=!0,a.__filePath=a.__getFilePath(d),a.__opts.override=f,a.__filePath&&fs.existsSync(a.__filePath)){var g=a.__getFilesizeInBytes(a.__filePath);return g===e?b():a.resumeFromFile(a.__filePath,{total:e,fileName:d})}return b()}):b()}},{key:'pause',value:function b(){var a=this;return this.state===this.__states.STOPPED?Promise.resolve(!0):(this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return a.__setState(a.__states.PAUSED),a.emit('pause'),!0}))}},{key:'resume',value:function a(){return this.__promise?this.state===this.__states.STOPPED?Promise.resolve(!1):(this.__setState(this.__states.RESUMED),this.__isResumable&&(this.__isResumed=!0,this.__reqOptions.headers.range='bytes='+this.__downloaded+'-'),this.emit('resume',this.__isResumed),this.__start()):this.start()}},{key:'stop',value:function c(){var a=this;if(this.state===this.__states.STOPPED)return Promise.resolve(!0);var b=function(){return new Promise(function(b,c){fs.access(a.__filePath,function(d){return d?(a.__emitStop(),b(!0)):void fs.unlink(a.__filePath,function(d){return d?(a.__setState(a.__states.FAILED),a.emit('error',d),c(d)):void(a.__emitStop(),b(!0))})});})};return this.__requestAbort(),this.__closeFileStream().then(function(){return a.__opts.removeOnStop?b():(a.__emitStop(),Promise.resolve(!0))})}},{key:'pipe',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;return this.__pipes.push({stream:a,options:b}),a}},{key:'unpipe',value:function d(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,c=function(b){return a.__response?a.__response.unpipe(b):b.unpipe()};if(b){var e=this.__pipes.find(function(a){return a.stream===b});return void(e&&(c(b),this.__pipes=this.__pipes.filter(function(a){return a.stream!==b})))}this.__pipes.forEach(function(a){return c(a.stream)}),this.__pipes=[];}},{key:'getDownloadPath',value:function a(){return this.__filePath}},{key:'isResumable',value:function a(){return this.__isResumable}},{key:'updateOptions',value:function c(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:'';this.__opts=Object.assign({},this.__opts,a),this.__headers=this.__opts.headers,-1<this.__opts.timeout&&(this.__opts.httpRequestOptions.timeout=this.__opts.timeout,this.__opts.httpsRequestOptions.timeout=this.__opts.timeout),('number'!=typeof this.__opts.progressThrottle||0>this.__opts.progressThrottle)&&(this.__opts.progressThrottle=this.__defaultOpts.progressThrottle),this.url=b||this.url,this.__reqOptions=this.__getReqOptions(this.__opts.method,this.url,this.__opts.headers),this.__initProtocol(this.url);}},{key:'getOptions',value:function a(){return this.__opts}},{key:'getMetadata',value:function a(){return this.__opts.metadata}},{key:'getStats',value:function a(){return {total:this.__total,name:this.__fileName,downloaded:this.__downloaded,progress:this.__progress,speed:this.__statsEstimate.bytes}}},{key:'getTotalSize',value:function b(){var a=this;return new Promise(function(b,c){var d=function(b){a.__initProtocol(b);var c=Object.assign({},a.__headers);c.hasOwnProperty('range')&&delete c.range;var d=a.__getReqOptions('HEAD',b,c);return Object.assign({},a.__reqOptions,d)},e=0,f=null,g=function(b,c){if(!a.__opts.retry||'object'!==_typeof(a.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));f&&(clearTimeout(f),f=null);var g=a.__opts.retry,i=g.delay,j=void 0===i?0:i,k=g.maxRetries,l=void 0===k?999:k;return e>=l?Promise.reject(b||new Error('reached the maximum retries')):(e++,a.__setState(a.__states.RETRY),a.emit('retry',e,a.__opts.retry,b),new Promise(function(b){f=setTimeout(function(){a.__setState(a.__states.IDLE),h(c,d(c)),b();},j);}))},h=function(e,i){f&&(clearTimeout(f),f=null);var j=a.__protocol.request(i,function(f){if(a.__isRequireRedirect(f)){var i=/^https?:\/\//.test(f.headers.location)?f.headers.location:new _url.URL(f.headers.location,e).href;return a.emit('redirected',i,e),h(i,d(i))}if(200>f.statusCode||400<=f.statusCode){var j=new Error('Response status was '+f.statusCode);return a.__opts.retry&&500<=f.statusCode&&600>f.statusCode?g(j,e).catch(c):c(j)}b({name:a.__getFileNameFromHeaders(f.headers,f),total:parseInt(f.headers['content-length'])||null});});j.on('error',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.on('timeout',function(){return a.__opts.retry?g(new Error('timeout'),e).catch(c):void c(new Error('timeout'))}),j.on('uncaughtException',function(b){return a.__opts.retry?g(b,e).catch(c):void c(b)}),j.end();};h(a.url,d(a.url));})}},{key:'getResumeState',value:function a(){return {downloaded:this.__downloaded,filePath:this.__filePath,fileName:this.__fileName,total:this.__total}}},{key:'resumeFromFile',value:function d(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return this.__opts.override=!0,this.__filePath=a,(c.total&&c.fileName?Promise.resolve({name:c.fileName,total:c.total}):this.getTotalSize()).then(function(a){var d=a.name,e=a.total;return b.__total=c.total||e,b.__fileName=c.fileName||d,b.__downloaded=c.downloaded||b.__getFilesizeInBytes(b.__filePath),b.__reqOptions.headers.range='bytes='+b.__downloaded+'-',b.__isResumed=!0,b.__isResumable=!0,b.__setState(b.__states.RESUMED),b.emit('resume',b.__isResumed),new Promise(function(a,c){b.__promise={resolve:a,reject:c},b.__start();})})}},{key:'__start',value:function a(){this.__isRedirected||this.state===this.__states.RESUMED||(this.emit('start'),this.__setState(this.__states.STARTED),this.__initProtocol(this.url)),this.__response=null,this.__isAborted=!1,this.__request&&!this.__request.destroyed&&this.__request.destroy(),this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__request=this.__downloadRequest(this.__promise.resolve,this.__promise.reject),this.__request.on('error',this.__onError(this.__promise.resolve,this.__promise.reject)),this.__request.on('timeout',this.__onTimeout(this.__promise.resolve,this.__promise.reject)),this.__request.on('uncaughtException',this.__onError(this.__promise.resolve,this.__promise.reject,!0)),this.__opts.body&&this.__request.write(this.__opts.body),this.__request.end();}},{key:'__resolvePending',value:function b(){if(this.__promise){var a=this.__promise.resolve;return this.__promise=null,a(!0)}}},{key:'__downloadRequest',value:function d(a,b){var c=this;return this.__protocol.request(this.__reqOptions,function(d){if(c.__response=d,c.__isResumed||(c.__total=parseInt(d.headers['content-length'])||null,c.__resetStats()),c.__isRequireRedirect(d)){var e=/^https?:\/\//.test(d.headers.location)?d.headers.location:new _url.URL(d.headers.location,c.url).href;return c.__isRedirected=!0,c.__initProtocol(e),c.emit('redirected',e,c.url),c.__start()}if(200>d.statusCode||400<=d.statusCode){var f=new Error('Response status was '+d.statusCode);return (f.status=d.statusCode||0,f.body=d.body||'',500<=d.statusCode&&600>d.statusCode)?c.__onError(a,b)(f):(c.__setState(c.__states.FAILED),c.emit('error',f),b(f))}c.__opts.forceResume?c.__isResumable=!0:d.headers.hasOwnProperty('accept-ranges')&&'none'!==d.headers['accept-ranges']&&(c.__isResumable=!0),c.__startDownload(d,a,b);})}},{key:'__startDownload',value:function h(a,b,c){var d=this,e=a;if(!this.__isResumed){var i=this.__getFileNameFromHeaders(a.headers);if(this.__filePath=this.__getFilePath(i),this.__fileName=this.__filePath.split(path.sep).pop(),fs.existsSync(this.__filePath)){var f=this.__getFilesizeInBytes(this.__filePath),g=this.__total?this.__total:0;if('object'===_typeof(this.__opts.override)&&this.__opts.override.skip&&(this.__opts.override.skipSmaller||f>=g))return this.emit('skip',{totalSize:this.__total,fileName:this.__fileName,filePath:this.__filePath,downloadedSize:f}),this.__setState(this.__states.SKIPPED),b(!0)}this.__fileStream=fs.createWriteStream(this.__filePath,{});}else this.__fileStream=fs.createWriteStream(this.__filePath,{flags:'a'});this.emit('download',{fileName:this.__fileName,filePath:this.__filePath,totalSize:this.__total,isResumed:this.__isResumed,downloadedSize:this.__downloaded}),this.__retryCount=0,this.__isResumed=!1,this.__isRedirected=!1,this.__setState(this.__states.DOWNLOADING),this.__statsEstimate.time=new Date,this.__statsEstimate.throttleTime=new Date,e.on('data',function(a){return d.__calculateStats(a.length)}),this.__pipes.forEach(function(a){e.pipe(a.stream,a.options),e=a.stream;}),e.pipe(this.__fileStream),e.on('error',this.__onError(b,c)),this.__fileStream.on('finish',this.__onFinished(b,c)),this.__fileStream.on('error',this.__onError(b,c));}},{key:'__hasFinished',value:function a(){return !this.__isAborted&&-1===[this.__states.PAUSED,this.__states.STOPPED,this.__states.RETRY,this.__states.FAILED,this.__states.RESUMED].indexOf(this.state)}},{key:'__isRequireRedirect',value:function b(a){return 300<a.statusCode&&400>a.statusCode&&a.headers.hasOwnProperty('location')&&a.headers.location}},{key:'__onFinished',value:function d(a,b){var c=this;return function(){c.__fileStream.close(function(d){if(d)return b(d);if(c.__hasFinished()){var e=!!c.__total&&c.__downloaded!==c.__total;if(e&&c.__isResumable&&c.__opts.resumeOnIncomplete&&c.__resumeRetryCount<=c.__opts.resumeOnIncompleteMaxRetry)return c.__resumeRetryCount++,c.emit('warning',new Error('uncomplete download, retrying')),c.resume();c.__setState(c.__states.FINISHED),c.__pipes=[],c.emit('end',{fileName:c.__fileName,filePath:c.__filePath,totalSize:c.__total,incomplete:e,onDiskSize:c.__getFilesizeInBytes(c.__filePath),downloadedSize:c.__downloaded});}return a(c.__downloaded===c.__total)});}}},{key:'__closeFileStream',value:function b(){var a=this;return this.__fileStream?new Promise(function(b,c){a.__fileStream.close(function(a){return a?c(a):b(!0)});}):Promise.resolve(!0)}},{key:'__onError',value:function e(a,b){var c=this,d=!!(2<arguments.length&&void 0!==arguments[2])&&arguments[2];return function(a){return c.__pipes=[],d&&c.__requestAbort(),c.state===c.__states.STOPPED||c.state===c.__states.FAILED?void 0:c.__opts.retry?c.__retry(a).catch(function(d){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',d?d:a),b(d?d:a);});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('error',a),b(a);})}}},{key:'__retry',value:function h(){var a=this,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null;if(!this.__opts.retry||'object'!==_typeof(this.__opts.retry))return Promise.reject(b||new Error('wrong retry options'));var c=this.__opts.retry,d=c.delay,e=void 0===d?0:d,f=c.maxRetries,g=void 0===f?999:f;return this.__retryCount>=g?Promise.reject(b||new Error('reached the maximum retries')):(this.__retryCount++,this.__setState(this.__states.RETRY),this.emit('retry',this.__retryCount,this.__opts.retry,b),this.__response&&(this.__response.unpipe(),this.__pipes.forEach(function(a){return a.stream.unpipe()})),this.__fileStream&&this.__fileStream.removeAllListeners(),this.__requestAbort(),this.__closeFileStream().then(function(){return new Promise(function(b){return a.__retryTimeout=setTimeout(function(){return b(0<a.__downloaded?a.resume():a.__start())},e)})}))}},{key:'__onTimeout',value:function d(a,b){var c=this;return function(){return c.__requestAbort(),c.__opts.retry?c.__retry(new Error('timeout')).catch(function(a){c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),a?b(a):(c.emit('timeout'),b(new Error('timeout')));});}):c.__removeFile().finally(function(){c.__setState(c.__states.FAILED),c.emit('timeout'),b(new Error('timeout'));})}}},{key:'__resetStats',value:function a(){this.__retryCount=0,this.__downloaded=0,this.__progress=0,this.__resumeRetryCount=0,this.__statsEstimate={time:0,bytes:0,prevBytes:0,throttleTime:0};}},{key:'__getFileNameFromHeaders',value:function k(a,b){var c='',d=/.*filename\*=.*?'.*?'([^"].+?[^"])(?:(?:;)|$)/i,e=/.*filename="(.*?)";?/i,f=/.*filename=([^"].+?[^"])(?:(?:;)|$)/i,g=a.hasOwnProperty('content-disposition'),h=g?a['content-disposition'].match(d):null,i=!g||h?null:a['content-disposition'].match(e),j=!g||h||i?null:a['content-disposition'].match(f);return g&&(h||i||j)?(c=a['content-disposition'],c=c.trim(),h?c=h[1]:i?c=i[1]:j&&(c=j[1]),c=c.replace(/[/\\]/g,'')):0<path.basename(new _url.URL(this.requestURL).pathname).length?c=path.basename(new _url.URL(this.requestURL).pathname):c=new _url.URL(this.requestURL).hostname+'.html',this.__opts.fileName?this.__getFileNameFromOpts(c,b):c.replace(/\.*$/,'')}},{key:'__getFilePath',value:function d(a){var b=path.join(this.__destFolder,a),c=b;return this.__opts.override||this.state===this.__states.RESUMED||(c=this.__uniqFileNameSync(c),b!==c&&this.emit('renamed',{path:c,fileName:c.split(path.sep).pop(),prevPath:b,prevFileName:b.split(path.sep).pop()})),c}},{key:'__getFileNameFromOpts',value:function g(a,b){if(!this.__opts.fileName)return a;if('string'==typeof this.__opts.fileName)return this.__opts.fileName;if('function'==typeof this.__opts.fileName){var h=path.join(this.__destFolder,a);return b&&b.headers||this.__response&&this.__response.headers?this.__opts.fileName(a,h,(b?b:this.__response).headers['content-type']):this.__opts.fileName(a,h)}if('object'===_typeof(this.__opts.fileName)){var c=this.__opts.fileName,d=c.name,e=!!c.hasOwnProperty('ext')&&c.ext;if('string'==typeof e)return d+'.'+e;if('boolean'==typeof e){if(e)return d;var f=a.includes('.')?a.split('.').pop():'';return ''===f?d:d+'.'+f}}return a}},{key:'__calculateStats',value:function f(a){var b=new Date,c=b-this.__statsEstimate.time,d=b-this.__statsEstimate.throttleTime,e=this.__total||0;a&&(this.__downloaded+=a,this.__progress=0===e?0:100*(this.__downloaded/e),(this.__downloaded===e||1e3<c)&&(this.__statsEstimate.time=b,this.__statsEstimate.bytes=this.__downloaded-this.__statsEstimate.prevBytes,this.__statsEstimate.prevBytes=this.__downloaded),(this.__downloaded===e||d>this.__opts.progressThrottle)&&(this.__statsEstimate.throttleTime=b,this.emit('progress.throttled',this.getStats())),this.emit('progress',this.getStats()));}},{key:'__setState',value:function b(a){this.state=a,this.emit('stateChanged',this.state);}},{key:'__getReqOptions',value:function f(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=new _url.URL(b),e={protocol:d.protocol,host:d.hostname,port:d.port,path:d.pathname+d.search,method:a};return c&&(e.headers=c),e}},{key:'__getFilesizeInBytes',value:function d(a){try{var b=fs.statSync(a,{throwIfNoEntry:!1}),c=b.size||0;return c}catch(a){this.emit('warning',a);}return 0}},{key:'__validate',value:function d(a,b){if('string'!=typeof a)throw new Error('URL should be an string');if(''===a.trim())throw new Error('URL couldn\'t be empty');if('string'!=typeof b)throw new Error('Destination Folder should be an string');if(''===b.trim())throw new Error('Destination Folder couldn\'t be empty');if(!fs.existsSync(b))throw new Error('Destination Folder must exist');var c=fs.statSync(b);if(!c.isDirectory())throw new Error('Destination Folder must be a directory');try{fs.accessSync(b,fs.constants.W_OK);}catch(a){throw new Error('Destination Folder must be writable')}return !0}},{key:'__initProtocol',value:function c(a){var b=this.__getReqOptions(this.__opts.method,a,this.__headers);this.requestURL=a,-1<a.indexOf('https://')?(this.__protocol=https,b.agent=new https.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpsRequestOptions)):(this.__protocol=http,b.agent=new http.Agent({keepAlive:!1}),this.__reqOptions=Object.assign({},b,this.__opts.httpRequestOptions));}},{key:'__uniqFileNameSync',value:function f(a){if('string'!=typeof a||''===a)return a;try{fs.accessSync(a,fs.F_OK);var b=a.match(/(.*)(\([0-9]+\))(\..*)$/),c=b?b[1].trim():a,d=b?parseInt(b[2].replace(/\(|\)/,'')):0,e=a.split('.').pop();return e!==a&&0<e.length?(e='.'+e,c=c.replace(e,'')):e='',this.__uniqFileNameSync(c+' ('+ ++d+')'+e)}catch(b){return a}}},{key:'__removeFile',value:function b(){var a=this;return new Promise(function(b){return a.__fileStream?void a.__fileStream.close(function(c){return c&&a.emit('warning',c),a.__opts.removeOnFail?fs.access(a.__filePath,function(d){return d?b():void fs.unlink(a.__filePath,function(d){d&&a.emit('warning',c),b();})}):void b()}):b()})}},{key:'__requestAbort',value:function a(){this.__isAborted=!0,this.__retryTimeout&&(clearTimeout(this.__retryTimeout),this.__retryTimeout=null),this.__response&&this.__response.destroy(),this.__request&&(this.__request.destroy?this.__request.destroy():this.__request.abort());}},{key:'__emitStop',value:function a(){this.__resolvePending(),this.__setState(this.__states.STOPPED),this.emit('stop');}}]),b}(_events.EventEmitter);
75302
75337
  } (dist));
75303
75338
 
75304
75339
  async function download(output, url, options) {
@@ -79203,7 +79238,7 @@ let handler;
79203
79238
  let appConfig;
79204
79239
  let container;
79205
79240
  const fileCache = createFileCache();
79206
- path$3.dirname(require$$0$4.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-BFO4BeOx.cjs', document.baseURI).href))));
79241
+ path$3.dirname(urlLib.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-DTguSku6.cjs', document.baseURI).href))));
79207
79242
  const authMiddleware = (passKey) => {
79208
79243
  return async (ctx, next) => {
79209
79244
  const authHeader = ctx.headers["authorization"] || ctx.request.query.auth;
@@ -79284,7 +79319,7 @@ async function serverStart(options, axContainer) {
79284
79319
  async function createServer(options) {
79285
79320
  index$1.logObj.info(`开始创建服务器: ${options.host}:${options.port}`);
79286
79321
  {
79287
- const httpServer = require$$2$1.createServer(app.callback());
79322
+ const httpServer = http$4.createServer(app.callback());
79288
79323
  httpServer.on("error", (err) => {
79289
79324
  index$1.logObj.error("HTTP 服务器错误:", err);
79290
79325
  });