llonebot-dist 7.12.2 → 7.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llbot.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import { createRequire } from "node:module";
2
2
  import * as path$4 from "node:path";
3
- import path, { dirname } from "node:path";
4
- import fs, { access, copyFile, mkdir, readFile, stat, unlink, writeFile } from "node:fs/promises";
5
- import fs$1, { createReadStream, existsSync, statSync } from "fs";
6
- import { Readable } from "stream";
7
- import * as fs$6 from "node:fs";
8
- import fs$2, { appendFile, appendFileSync, createReadStream as createReadStream$1, existsSync as existsSync$1, mkdirSync, promises, stat as stat$1, watch } from "node:fs";
3
+ import path, { dirname, join } from "node:path";
4
+ import fsPromise, { access, copyFile, mkdir, readFile, stat, unlink, writeFile } from "node:fs/promises";
5
+ import fs, { existsSync } from "fs";
6
+ import * as fs$5 from "node:fs";
7
+ import fs$1, { appendFile, appendFileSync, createReadStream, existsSync as existsSync$1, mkdirSync, promises, stat as stat$1, statSync, watch } from "node:fs";
9
8
  import os from "node:os";
10
9
  import { Binary, Time, camelize, clone, deduplicate, deepEqual, defineProperty, difference, filterKeys, hyphenate, is, isNonNullable, isNullable, isPlainObject, makeArray, mapValues, noop, omit, pick, remove, valueMap } from "cosmokit";
11
10
  import { Exporter, Factory } from "reggol";
12
- import path$1, { join } from "path";
11
+ import path$1 from "path";
13
12
  import { networkInterfaces } from "os";
14
13
  import { fileURLToPath, pathToFileURL } from "node:url";
15
14
  import { WebSocket as WebSocket$1, WebSocketServer } from "ws";
@@ -17,17 +16,15 @@ import { constants } from "node:buffer";
17
16
  import crypto$1, { createHash, randomBytes, randomInt, randomUUID } from "node:crypto";
18
17
  import * as fileType from "file-type";
19
18
  import { decode, encode, getDuration, getWavFileInfo, isSilk, isWav } from "silk-wasm";
20
- import { createServer } from "http";
21
- import { Http2ServerRequest, constants as constants$1 } from "http2";
22
- import crypto$2 from "crypto";
19
+ import http, { STATUS_CODES, createServer, request } from "node:http";
20
+ import { Http2ServerRequest, constants as constants$1 } from "node:http2";
21
+ import { Readable, Transform } from "node:stream";
23
22
  import { deflateSync, gunzipSync, gzipSync, inflateSync } from "node:zlib";
24
- import fsPromise, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
25
- import http, { STATUS_CODES, request } from "node:http";
23
+ import fsPromise$1, { stat as stat$2, unlink as unlink$1 } from "fs/promises";
26
24
  import { inspect, isDeepStrictEqual } from "node:util";
27
- import { Transform } from "node:stream";
28
25
  import net, { connect } from "node:net";
29
26
  import https from "node:https";
30
- import { versions } from "process";
27
+ import { versions } from "node:process";
31
28
  //#region \0rolldown/runtime.js
32
29
  var __create$2 = Object.create;
33
30
  var __defProp$9 = Object.defineProperty;
@@ -36,7 +33,7 @@ var __getOwnPropNames$2 = Object.getOwnPropertyNames;
36
33
  var __getProtoOf = Object.getPrototypeOf;
37
34
  var __hasOwnProp = Object.prototype.hasOwnProperty;
38
35
  var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
39
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
40
37
  var __exportAll = (all, no_symbols) => {
41
38
  let target = {};
42
39
  for (var name in all) __defProp$9(target, name, {
@@ -1623,6 +1620,9 @@ var require_dijkstra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1623
1620
  var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);
1624
1621
  return dijkstra.extract_shortest_path_from_predecessor_list(predecessors, d);
1625
1622
  },
1623
+ /**
1624
+ * A very naive priority queue implementation.
1625
+ */
1626
1626
  PriorityQueue: {
1627
1627
  make: function(opts) {
1628
1628
  var T = dijkstra.PriorityQueue, t = {}, key;
@@ -1635,6 +1635,10 @@ var require_dijkstra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1635
1635
  default_sorter: function(a, b) {
1636
1636
  return a.cost - b.cost;
1637
1637
  },
1638
+ /**
1639
+ * Add a new item to the queue and ensure the highest priority element
1640
+ * is at the front of the queue.
1641
+ */
1638
1642
  push: function(value, cost) {
1639
1643
  var item = {
1640
1644
  value,
@@ -1643,6 +1647,9 @@ var require_dijkstra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1643
1647
  this.queue.push(item);
1644
1648
  this.queue.sort(this.sorter);
1645
1649
  },
1650
+ /**
1651
+ * Return the highest priority element in the queue.
1652
+ */
1646
1653
  pop: function() {
1647
1654
  return this.queue.shift();
1648
1655
  },
@@ -3509,7 +3516,8 @@ var require_packer_async = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3509
3516
  var Packer = require_packer();
3510
3517
  var PackerAsync = module.exports = function(opt) {
3511
3518
  Stream$2.call(this);
3512
- this._packer = new Packer(opt || {});
3519
+ let options = opt || {};
3520
+ this._packer = new Packer(options);
3513
3521
  this._deflate = this._packer.createDeflate();
3514
3522
  this.readable = true;
3515
3523
  };
@@ -3964,7 +3972,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
3964
3972
  //#endregion
3965
3973
  //#region node_modules/qrcode/lib/renderer/png.js
3966
3974
  var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
3967
- var fs$11 = __require("fs");
3975
+ var fs$10 = __require("fs");
3968
3976
  var PNG = require_png$1().PNG;
3969
3977
  var Utils = require_utils$1();
3970
3978
  exports.render = function render(qrData, options) {
@@ -4016,7 +4024,7 @@ var require_png = /* @__PURE__ */ __commonJSMin(((exports) => {
4016
4024
  called = true;
4017
4025
  cb.apply(null, args);
4018
4026
  };
4019
- const stream = fs$11.createWriteStream(path);
4027
+ const stream = fs$10.createWriteStream(path);
4020
4028
  stream.on("error", done);
4021
4029
  stream.on("close", done);
4022
4030
  exports.renderToFileStream(stream, qrData, options);
@@ -6454,7 +6462,8 @@ var FaceIndex = /* @__PURE__ */ function(FaceIndex) {
6454
6462
  return FaceIndex;
6455
6463
  }({});
6456
6464
  var FaceType = /* @__PURE__ */ function(FaceType) {
6457
- FaceType[FaceType["Normal"] = 1] = "Normal";
6465
+ FaceType[FaceType["Old"] = 1] = "Old";
6466
+ FaceType[FaceType["Normal"] = 2] = "Normal";
6458
6467
  FaceType[FaceType["Super"] = 3] = "Super";
6459
6468
  FaceType[FaceType["Poke"] = 5] = "Poke";
6460
6469
  return FaceType;
@@ -6506,20 +6515,20 @@ var MsgType = /* @__PURE__ */ function(MsgType) {
6506
6515
  //#region src/ntqqapi/types/notify.ts
6507
6516
  var GroupNotifyType = /* @__PURE__ */ function(GroupNotifyType) {
6508
6517
  GroupNotifyType[GroupNotifyType["InvitedByMember"] = 1] = "InvitedByMember";
6509
- GroupNotifyType[GroupNotifyType["RefuseInvited"] = 2] = "RefuseInvited";
6510
- GroupNotifyType[GroupNotifyType["RefusedByAdminiStrator"] = 3] = "RefusedByAdminiStrator";
6511
- GroupNotifyType[GroupNotifyType["AgreedTojoinDirect"] = 4] = "AgreedTojoinDirect";
6512
- GroupNotifyType[GroupNotifyType["InvitedNeedAdminiStratorPass"] = 5] = "InvitedNeedAdminiStratorPass";
6513
- GroupNotifyType[GroupNotifyType["AgreedToJoinByAdminiStrator"] = 6] = "AgreedToJoinByAdminiStrator";
6514
- GroupNotifyType[GroupNotifyType["RequestJoinNeedAdminiStratorPass"] = 7] = "RequestJoinNeedAdminiStratorPass";
6515
- GroupNotifyType[GroupNotifyType["SetAdmin"] = 8] = "SetAdmin";
6516
- GroupNotifyType[GroupNotifyType["KickMemberNotifyAdmin"] = 9] = "KickMemberNotifyAdmin";
6517
- GroupNotifyType[GroupNotifyType["KickMemberNotifyKicked"] = 10] = "KickMemberNotifyKicked";
6518
- GroupNotifyType[GroupNotifyType["MemberLeaveNotifyAdmin"] = 11] = "MemberLeaveNotifyAdmin";
6519
- GroupNotifyType[GroupNotifyType["CancelAdminNotifyCanceled"] = 12] = "CancelAdminNotifyCanceled";
6520
- GroupNotifyType[GroupNotifyType["CancelAdminNotifyAdmin"] = 13] = "CancelAdminNotifyAdmin";
6521
- GroupNotifyType[GroupNotifyType["TransferGroupNotifyOldowner"] = 14] = "TransferGroupNotifyOldowner";
6522
- GroupNotifyType[GroupNotifyType["TransferGroupNotifyAdmin"] = 15] = "TransferGroupNotifyAdmin";
6518
+ GroupNotifyType[GroupNotifyType["RefuseInvited"] = 1 + GroupNotifyType["InvitedByMember"]] = "RefuseInvited";
6519
+ GroupNotifyType[GroupNotifyType["RefusedByAdminiStrator"] = 1 + GroupNotifyType["RefuseInvited"]] = "RefusedByAdminiStrator";
6520
+ GroupNotifyType[GroupNotifyType["AgreedTojoinDirect"] = 1 + GroupNotifyType["RefusedByAdminiStrator"]] = "AgreedTojoinDirect";
6521
+ GroupNotifyType[GroupNotifyType["InvitedNeedAdminiStratorPass"] = 1 + GroupNotifyType["AgreedTojoinDirect"]] = "InvitedNeedAdminiStratorPass";
6522
+ GroupNotifyType[GroupNotifyType["AgreedToJoinByAdminiStrator"] = 1 + GroupNotifyType["InvitedNeedAdminiStratorPass"]] = "AgreedToJoinByAdminiStrator";
6523
+ GroupNotifyType[GroupNotifyType["RequestJoinNeedAdminiStratorPass"] = 1 + GroupNotifyType["AgreedToJoinByAdminiStrator"]] = "RequestJoinNeedAdminiStratorPass";
6524
+ GroupNotifyType[GroupNotifyType["SetAdmin"] = 1 + GroupNotifyType["RequestJoinNeedAdminiStratorPass"]] = "SetAdmin";
6525
+ GroupNotifyType[GroupNotifyType["KickMemberNotifyAdmin"] = 1 + GroupNotifyType["SetAdmin"]] = "KickMemberNotifyAdmin";
6526
+ GroupNotifyType[GroupNotifyType["KickMemberNotifyKicked"] = 1 + GroupNotifyType["KickMemberNotifyAdmin"]] = "KickMemberNotifyKicked";
6527
+ GroupNotifyType[GroupNotifyType["MemberLeaveNotifyAdmin"] = 1 + GroupNotifyType["KickMemberNotifyKicked"]] = "MemberLeaveNotifyAdmin";
6528
+ GroupNotifyType[GroupNotifyType["CancelAdminNotifyCanceled"] = 1 + GroupNotifyType["MemberLeaveNotifyAdmin"]] = "CancelAdminNotifyCanceled";
6529
+ GroupNotifyType[GroupNotifyType["CancelAdminNotifyAdmin"] = 1 + GroupNotifyType["CancelAdminNotifyCanceled"]] = "CancelAdminNotifyAdmin";
6530
+ GroupNotifyType[GroupNotifyType["TransferGroupNotifyOldowner"] = 1 + GroupNotifyType["CancelAdminNotifyAdmin"]] = "TransferGroupNotifyOldowner";
6531
+ GroupNotifyType[GroupNotifyType["TransferGroupNotifyAdmin"] = 1 + GroupNotifyType["TransferGroupNotifyOldowner"]] = "TransferGroupNotifyAdmin";
6523
6532
  return GroupNotifyType;
6524
6533
  }({});
6525
6534
  var GroupNotifyStatus = /* @__PURE__ */ function(GroupNotifyStatus) {
@@ -6614,7 +6623,7 @@ async function logSummaryMessage(ctx, message) {
6614
6623
  var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6615
6624
  module.exports = isexe;
6616
6625
  isexe.sync = sync;
6617
- var fs$10 = __require("fs");
6626
+ var fs$9 = __require("fs");
6618
6627
  function checkPathExt(path, options) {
6619
6628
  var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
6620
6629
  if (!pathext) return true;
@@ -6631,12 +6640,12 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6631
6640
  return checkPathExt(path, options);
6632
6641
  }
6633
6642
  function isexe(path, options, cb) {
6634
- fs$10.stat(path, function(er, stat) {
6643
+ fs$9.stat(path, function(er, stat) {
6635
6644
  cb(er, er ? false : checkStat(stat, path, options));
6636
6645
  });
6637
6646
  }
6638
6647
  function sync(path, options) {
6639
- return checkStat(fs$10.statSync(path), path, options);
6648
+ return checkStat(fs$9.statSync(path), path, options);
6640
6649
  }
6641
6650
  }));
6642
6651
  //#endregion
@@ -6644,14 +6653,14 @@ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6644
6653
  var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6645
6654
  module.exports = isexe;
6646
6655
  isexe.sync = sync;
6647
- var fs$9 = __require("fs");
6656
+ var fs$8 = __require("fs");
6648
6657
  function isexe(path, options, cb) {
6649
- fs$9.stat(path, function(er, stat) {
6658
+ fs$8.stat(path, function(er, stat) {
6650
6659
  cb(er, er ? false : checkStat(stat, options));
6651
6660
  });
6652
6661
  }
6653
6662
  function sync(path, options) {
6654
- return checkStat(fs$9.statSync(path), options);
6663
+ return checkStat(fs$8.statSync(path), options);
6655
6664
  }
6656
6665
  function checkStat(stat, options) {
6657
6666
  return stat.isFile() && checkMode(stat, options);
@@ -6832,11 +6841,30 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6832
6841
  var utils = module.exports = {
6833
6842
  isWindows,
6834
6843
  streamRegexp,
6844
+ /**
6845
+ * Copy an object keys into another one
6846
+ *
6847
+ * @param {Object} source source object
6848
+ * @param {Object} dest destination object
6849
+ * @private
6850
+ */
6835
6851
  copy: function(source, dest) {
6836
6852
  Object.keys(source).forEach(function(key) {
6837
6853
  dest[key] = source[key];
6838
6854
  });
6839
6855
  },
6856
+ /**
6857
+ * Create an argument list
6858
+ *
6859
+ * Returns a function that adds new arguments to the list.
6860
+ * It also has the following methods:
6861
+ * - clear() empties the argument list
6862
+ * - get() returns the argument list
6863
+ * - find(arg, count) finds 'arg' in the list and return the following 'count' items, or undefined if not found
6864
+ * - remove(arg, count) remove 'arg' in the list as well as the following 'count' items
6865
+ *
6866
+ * @private
6867
+ */
6840
6868
  args: function() {
6841
6869
  var list = [];
6842
6870
  var argfunc = function() {
@@ -6864,6 +6892,20 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6864
6892
  };
6865
6893
  return argfunc;
6866
6894
  },
6895
+ /**
6896
+ * Generate filter strings
6897
+ *
6898
+ * @param {String[]|Object[]} filters filter specifications. When using objects,
6899
+ * each must have the following properties:
6900
+ * @param {String} filters.filter filter name
6901
+ * @param {String|Array} [filters.inputs] (array of) input stream specifier(s) for the filter,
6902
+ * defaults to ffmpeg automatically choosing the first unused matching streams
6903
+ * @param {String|Array} [filters.outputs] (array of) output stream specifier(s) for the filter,
6904
+ * defaults to ffmpeg automatically assigning the output to the output file
6905
+ * @param {Object|String|Array} [filters.options] filter options, can be omitted to not set any options
6906
+ * @return String[]
6907
+ * @private
6908
+ */
6867
6909
  makeFilterStrings: function(filters) {
6868
6910
  return filters.map(function(filterSpec) {
6869
6911
  if (typeof filterSpec === "string") return filterSpec;
@@ -6892,6 +6934,15 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6892
6934
  return filterString;
6893
6935
  });
6894
6936
  },
6937
+ /**
6938
+ * Search for an executable
6939
+ *
6940
+ * Uses 'which' or 'where' depending on platform
6941
+ *
6942
+ * @param {String} name executable name
6943
+ * @param {Function} callback callback with signature (err, path)
6944
+ * @private
6945
+ */
6895
6946
  which: function(name, callback) {
6896
6947
  if (name in whichCache) return callback(null, whichCache[name]);
6897
6948
  which(name, function(err, result) {
@@ -6899,6 +6950,13 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6899
6950
  callback(null, whichCache[name] = result);
6900
6951
  });
6901
6952
  },
6953
+ /**
6954
+ * Convert a [[hh:]mm:]ss[.xxx] timemark into seconds
6955
+ *
6956
+ * @param {String} timemark timemark string
6957
+ * @return Number
6958
+ * @private
6959
+ */
6902
6960
  timemarkToSeconds: function(timemark) {
6903
6961
  if (typeof timemark === "number") return timemark;
6904
6962
  if (timemark.indexOf(":") === -1 && timemark.indexOf(".") >= 0) return Number(timemark);
@@ -6908,6 +6966,16 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6908
6966
  if (parts.length) secs += Number(parts.pop()) * 3600;
6909
6967
  return secs;
6910
6968
  },
6969
+ /**
6970
+ * Extract codec data from ffmpeg stderr and emit 'codecData' event if appropriate
6971
+ * Call it with an initially empty codec object once with each line of stderr output until it returns true
6972
+ *
6973
+ * @param {FfmpegCommand} command event emitter
6974
+ * @param {String} stderrLine ffmpeg stderr output line
6975
+ * @param {Object} codecObject object used to accumulate codec data between calls
6976
+ * @return {Boolean} true if codec data is complete (and event was emitted), false otherwise
6977
+ * @private
6978
+ */
6911
6979
  extractCodecData: function(command, stderrLine, codecsObject) {
6912
6980
  var inputPattern = /Input #[0-9]+, ([^ ]+),/;
6913
6981
  var durPattern = /Duration\: ([^,]+)/;
@@ -6947,6 +7015,13 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6947
7015
  }
6948
7016
  return false;
6949
7017
  },
7018
+ /**
7019
+ * Extract progress data from ffmpeg stderr and emit 'progress' event if appropriate
7020
+ *
7021
+ * @param {FfmpegCommand} command event emitter
7022
+ * @param {String} stderrLine ffmpeg stderr data
7023
+ * @private
7024
+ */
6950
7025
  extractProgress: function(command, stderrLine) {
6951
7026
  var progress = parseProgressLine(stderrLine);
6952
7027
  if (progress) {
@@ -6964,6 +7039,13 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6964
7039
  command.emit("progress", ret);
6965
7040
  }
6966
7041
  },
7042
+ /**
7043
+ * Extract error message(s) from ffmpeg stderr
7044
+ *
7045
+ * @param {String} stderr ffmpeg stderr data
7046
+ * @return {String}
7047
+ * @private
7048
+ */
6967
7049
  extractError: function(stderr) {
6968
7050
  return stderr.split(nlRegexp).reduce(function(messages, message) {
6969
7051
  if (message.charAt(0) === " " || message.charAt(0) === "[") return [];
@@ -6973,6 +7055,15 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports, module) => {
6973
7055
  }
6974
7056
  }, []).join("\n");
6975
7057
  },
7058
+ /**
7059
+ * Creates a line ring buffer object with the following methods:
7060
+ * - append(str) : appends a string or buffer
7061
+ * - get() : returns the whole string
7062
+ * - close() : prevents further append() calls and does a last call to callbacks
7063
+ * - callback(cb) : calls cb for each line (incl. those already in the ring)
7064
+ *
7065
+ * @param {Number} maxLines maximum number of lines to store (<= 0 for unlimited)
7066
+ */
6976
7067
  linesRing: function(maxLines) {
6977
7068
  var cbs = [];
6978
7069
  var lines = [];
@@ -9061,7 +9152,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9061
9152
  //#endregion
9062
9153
  //#region node_modules/fluent-ffmpeg/lib/capabilities.js
9063
9154
  var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9064
- var fs$8 = __require("fs");
9155
+ var fs$7 = __require("fs");
9065
9156
  var path$7 = __require("path");
9066
9157
  var async = require_async();
9067
9158
  var utils = require_utils();
@@ -9137,7 +9228,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9137
9228
  proto._getFfmpegPath = function(callback) {
9138
9229
  if ("ffmpegPath" in cache) return callback(null, cache.ffmpegPath);
9139
9230
  async.waterfall([function(cb) {
9140
- if (process.env.FFMPEG_PATH) fs$8.exists(process.env.FFMPEG_PATH, function(exists) {
9231
+ if (process.env.FFMPEG_PATH) fs$7.exists(process.env.FFMPEG_PATH, function(exists) {
9141
9232
  if (exists) cb(null, process.env.FFMPEG_PATH);
9142
9233
  else cb(null, "");
9143
9234
  });
@@ -9168,7 +9259,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9168
9259
  if ("ffprobePath" in cache) return callback(null, cache.ffprobePath);
9169
9260
  async.waterfall([
9170
9261
  function(cb) {
9171
- if (process.env.FFPROBE_PATH) fs$8.exists(process.env.FFPROBE_PATH, function(exists) {
9262
+ if (process.env.FFPROBE_PATH) fs$7.exists(process.env.FFPROBE_PATH, function(exists) {
9172
9263
  cb(null, exists ? process.env.FFPROBE_PATH : "");
9173
9264
  });
9174
9265
  else cb(null, "");
@@ -9186,7 +9277,7 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9186
9277
  else if (ffmpeg.length) {
9187
9278
  var name = utils.isWindows ? "ffprobe.exe" : "ffprobe";
9188
9279
  var ffprobe = path$7.join(path$7.dirname(ffmpeg), name);
9189
- fs$8.exists(ffprobe, function(exists) {
9280
+ fs$7.exists(ffprobe, function(exists) {
9190
9281
  cb(null, exists ? ffprobe : "");
9191
9282
  });
9192
9283
  } else cb(null, "");
@@ -9211,14 +9302,14 @@ var require_capabilities = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9211
9302
  if ("flvtoolPath" in cache) return callback(null, cache.flvtoolPath);
9212
9303
  async.waterfall([
9213
9304
  function(cb) {
9214
- if (process.env.FLVMETA_PATH) fs$8.exists(process.env.FLVMETA_PATH, function(exists) {
9305
+ if (process.env.FLVMETA_PATH) fs$7.exists(process.env.FLVMETA_PATH, function(exists) {
9215
9306
  cb(null, exists ? process.env.FLVMETA_PATH : "");
9216
9307
  });
9217
9308
  else cb(null, "");
9218
9309
  },
9219
9310
  function(flvtool, cb) {
9220
9311
  if (flvtool.length) return cb(null, flvtool);
9221
- if (process.env.FLVTOOL2_PATH) fs$8.exists(process.env.FLVTOOL2_PATH, function(exists) {
9312
+ if (process.env.FLVTOOL2_PATH) fs$7.exists(process.env.FLVTOOL2_PATH, function(exists) {
9222
9313
  cb(null, exists ? process.env.FLVTOOL2_PATH : "");
9223
9314
  });
9224
9315
  else cb(null, "");
@@ -9723,7 +9814,7 @@ var require_ffprobe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9723
9814
  //#endregion
9724
9815
  //#region node_modules/fluent-ffmpeg/lib/recipes.js
9725
9816
  var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9726
- var fs$7 = __require("fs");
9817
+ var fs$6 = __require("fs");
9727
9818
  var path$6 = __require("path");
9728
9819
  var PassThrough$4 = __require("stream").PassThrough;
9729
9820
  var async = require_async();
@@ -9929,8 +10020,8 @@ var require_recipes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
9929
10020
  next(null, filenames);
9930
10021
  },
9931
10022
  function createDirectory(filenames, next) {
9932
- fs$7.exists(config.folder, function(exists) {
9933
- if (!exists) fs$7.mkdir(config.folder, function(err) {
10023
+ fs$6.exists(config.folder, function(exists) {
10024
+ if (!exists) fs$6.mkdir(config.folder, function(err) {
9934
10025
  if (err) next(err);
9935
10026
  else next(null, filenames);
9936
10027
  });
@@ -10178,7 +10269,7 @@ function setFFMpegPath(ffmpegPath) {
10178
10269
  path.join(import.meta.dirname, "ffmpeg.exe"),
10179
10270
  process.env["FFMPEG_PATH"] || ""
10180
10271
  ];
10181
- for (const p of paths) if (fs$2.existsSync(p)) {
10272
+ for (const p of paths) if (fs$1.existsSync(p)) {
10182
10273
  import_fluent_ffmpeg.default.setFfmpegPath(p);
10183
10274
  console.log("set ffmpeg successfully", p);
10184
10275
  break;
@@ -11145,10 +11236,11 @@ var OB11Entities;
11145
11236
  async function recallEvent(ctx, msg, shortId) {
11146
11237
  const revokeElement = msg.elements[0].grayTipElement.revokeElement;
11147
11238
  if (msg.chatType === ChatType.Group) {
11148
- const operator = await ctx.ntGroupApi.getGroupMember(msg.peerUid, revokeElement.operatorUid);
11149
- let uin = msg.senderUin;
11150
- if (uin === "0" || !uin) uin = await ctx.ntUserApi.getUinByUid(revokeElement.origMsgSenderUid);
11151
- return new OB11GroupRecallNoticeEvent(Number(msg.peerUid), Number(uin), Number(operator.uin || msg.senderUin), shortId);
11239
+ let operatorUin;
11240
+ if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operatorUin = msg.senderUin;
11241
+ else operatorUin = await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid);
11242
+ if (msg.senderUin === "0" || !msg.senderUin) ctx.logger.warn(`发生异常 senderUin: ${msg.senderUin}`);
11243
+ return new OB11GroupRecallNoticeEvent(Number(msg.peerUid), Number(msg.senderUin), Number(operatorUin), shortId);
11152
11244
  } else return new OB11FriendRecallNoticeEvent(+msg.senderUin, shortId);
11153
11245
  }
11154
11246
  _OB11Entities.recallEvent = recallEvent;
@@ -11292,7 +11384,7 @@ var OB11HeartbeatEvent = class extends OB11BaseMetaEvent {
11292
11384
  };
11293
11385
  //#endregion
11294
11386
  //#region src/version.ts
11295
- var version$2 = "7.12.2";
11387
+ var version$2 = "7.12.4";
11296
11388
  //#endregion
11297
11389
  //#region node_modules/sift/es5m/index.js
11298
11390
  /******************************************************************************
@@ -11726,7 +11818,8 @@ var $In = function(_super) {
11726
11818
  }
11727
11819
  $In.prototype.init = function() {
11728
11820
  var _this = this;
11729
- this._testers = (Array.isArray(this.params) ? this.params : [this.params]).map(function(value) {
11821
+ var params = Array.isArray(this.params) ? this.params : [this.params];
11822
+ this._testers = params.map(function(value) {
11730
11823
  if (containsOperation(value, _this.options)) throw new Error("cannot nest $ under ".concat(_this.name.toLowerCase()));
11731
11824
  return createTester(value, _this.options.compare);
11732
11825
  });
@@ -12035,7 +12128,7 @@ var OB11WebSocket = class {
12035
12128
  if (emitEvent && socket.readyState === WebSocket$1.OPEN) {
12036
12129
  socket.send(JSON.stringify(event));
12037
12130
  const eventName = event.getSummaryEventName();
12038
- this.ctx.logger.info("WebSocket 事件上报", socket.url ?? "", eventName);
12131
+ this.ctx.logger.info("WebSocket 事件上报", eventName);
12039
12132
  }
12040
12133
  });
12041
12134
  }
@@ -12059,7 +12152,7 @@ var OB11WebSocket = class {
12059
12152
  reply(socket, data) {
12060
12153
  if (socket.readyState !== WebSocket$1.OPEN) return;
12061
12154
  socket.send(JSON.stringify(data));
12062
- if ("post_type" in data) this.ctx.logger.info("WebSocket 事件上报", socket.url ?? "", data.post_type);
12155
+ if ("post_type" in data) this.ctx.logger.info("WebSocket 事件上报", data.post_type);
12063
12156
  }
12064
12157
  authorize(socket, req) {
12065
12158
  const url = req.url?.split("?").shift();
@@ -16951,7 +17044,7 @@ var processQueue = async () => {
16951
17044
  const promises = queue.splice(0, concurrency).map(async ({ filePath, resolve, reject }) => {
16952
17045
  let handle;
16953
17046
  try {
16954
- handle = await fs$6.promises.open(path$4.resolve(filePath), "r");
17047
+ handle = await fs$5.promises.open(path$4.resolve(filePath), "r");
16955
17048
  } catch (err) {
16956
17049
  return reject(err);
16957
17050
  }
@@ -16998,7 +17091,7 @@ function checkUriType(uri) {
16998
17091
  if (uri.startsWith("data:")) return { type: FileUriType.DataURL };
16999
17092
  if (uri.startsWith("http://") || uri.startsWith("https://")) return { type: FileUriType.RemoteURL };
17000
17093
  if (uri.startsWith("file://")) return { type: FileUriType.FileURL };
17001
- if (fs$2.existsSync(uri)) return { type: FileUriType.Path };
17094
+ if (fs$1.existsSync(uri)) return { type: FileUriType.Path };
17002
17095
  return { type: FileUriType.Unknown };
17003
17096
  }
17004
17097
  async function fetchFile(url, headersInit) {
@@ -17028,7 +17121,7 @@ async function uri2local(ctx, uri, needExt) {
17028
17121
  const { type } = checkUriType(uri);
17029
17122
  if (type === FileUriType.FileURL) {
17030
17123
  const filePath = fileURLToPath(uri);
17031
- if (!fs$2.existsSync(filePath)) return {
17124
+ if (!fs$1.existsSync(filePath)) return {
17032
17125
  success: false,
17033
17126
  errMsg: "路径不存在",
17034
17127
  fileName: "",
@@ -17054,12 +17147,12 @@ async function uri2local(ctx, uri, needExt) {
17054
17147
  const res = await fetchFile(uri);
17055
17148
  let fileName = randomUUID();
17056
17149
  let filePath = path.join(TEMP_DIR, fileName);
17057
- await fs.writeFile(filePath, res.data);
17150
+ await fsPromise.writeFile(filePath, res.data);
17058
17151
  if (needExt) {
17059
17152
  const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
17060
17153
  fileName += `.${ext}`;
17061
17154
  const newPath = `${filePath}.${ext}`;
17062
- await fs.rename(filePath, newPath);
17155
+ await fsPromise.rename(filePath, newPath);
17063
17156
  filePath = newPath;
17064
17157
  }
17065
17158
  return {
@@ -17082,11 +17175,11 @@ async function uri2local(ctx, uri, needExt) {
17082
17175
  let filename = randomUUID();
17083
17176
  let filePath = path.join(TEMP_DIR, filename);
17084
17177
  const base64 = uri.replace(/^base64:\/\//, "");
17085
- await fs.writeFile(filePath, base64, "base64");
17178
+ await fsPromise.writeFile(filePath, base64, "base64");
17086
17179
  if (needExt) {
17087
17180
  const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
17088
17181
  filename += `.${ext}`;
17089
- await fs.rename(filePath, `${filePath}.${ext}`);
17182
+ await fsPromise.rename(filePath, `${filePath}.${ext}`);
17090
17183
  filePath = `${filePath}.${ext}`;
17091
17184
  }
17092
17185
  return {
@@ -17103,11 +17196,11 @@ async function uri2local(ctx, uri, needExt) {
17103
17196
  let filename = randomUUID();
17104
17197
  const [, _type, base64] = capture;
17105
17198
  let filePath = path.join(TEMP_DIR, filename);
17106
- await fs.writeFile(filePath, base64, "base64");
17199
+ await fsPromise.writeFile(filePath, base64, "base64");
17107
17200
  if (needExt) {
17108
17201
  const ext = (await ctx.ntFileApi.getFileType(filePath)).ext;
17109
17202
  filename += `.${ext}`;
17110
- await fs.rename(filePath, `${filePath}.${ext}`);
17203
+ await fsPromise.rename(filePath, `${filePath}.${ext}`);
17111
17204
  filePath = `${filePath}.${ext}`;
17112
17205
  }
17113
17206
  return {
@@ -17165,13 +17258,13 @@ async function getImageSize(path) {
17165
17258
  }
17166
17259
  async function getMd5HexFromFile(filePath) {
17167
17260
  const hash = createHash("md5");
17168
- const stream = fs$2.createReadStream(filePath);
17261
+ const stream = fs$1.createReadStream(filePath);
17169
17262
  for await (const chunk of stream) hash.update(chunk);
17170
17263
  return hash.digest("hex");
17171
17264
  }
17172
17265
  async function getSha1HexFromFile(filePath) {
17173
17266
  const hash = createHash("sha1");
17174
- const stream = fs$2.createReadStream(filePath);
17267
+ const stream = fs$1.createReadStream(filePath);
17175
17268
  for await (const chunk of stream) hash.update(chunk);
17176
17269
  return hash.digest("hex");
17177
17270
  }
@@ -17180,13 +17273,13 @@ function getMd5BufferFromBuffer(buf) {
17180
17273
  }
17181
17274
  async function getMd5BufferFromFile(filePath) {
17182
17275
  const hash = createHash("md5");
17183
- const stream = fs$2.createReadStream(filePath);
17276
+ const stream = fs$1.createReadStream(filePath);
17184
17277
  for await (const chunk of stream) hash.update(chunk);
17185
17278
  return hash.digest();
17186
17279
  }
17187
17280
  async function getSha1BufferFromFile(filePath) {
17188
17281
  const hash = createHash("sha1");
17189
- const stream = fs$2.createReadStream(filePath);
17282
+ const stream = fs$1.createReadStream(filePath);
17190
17283
  for await (const chunk of stream) hash.update(chunk);
17191
17284
  return hash.digest();
17192
17285
  }
@@ -17422,7 +17515,7 @@ async function calculateSha1StreamBytes(filePath) {
17422
17515
  let bytesRead = 0;
17423
17516
  let nextBlockBoundary = blockSize;
17424
17517
  const byteArrayList = [];
17425
- const readable = fs$2.createReadStream(filePath);
17518
+ const readable = fs$1.createReadStream(filePath);
17426
17519
  for await (const chunk of readable) {
17427
17520
  let buf;
17428
17521
  if (tail.length > 0) {
@@ -17447,7 +17540,7 @@ async function calculateSha1StreamBytes(filePath) {
17447
17540
  }
17448
17541
  async function readAndHash10M(filePath) {
17449
17542
  const maxSize = 10002432;
17450
- const fd = await fs.open(filePath, "r");
17543
+ const fd = await fsPromise.open(filePath, "r");
17451
17544
  const buffer = Buffer.allocUnsafe(maxSize);
17452
17545
  const { bytesRead } = await fd.read(buffer, 0, maxSize, 0);
17453
17546
  await fd.close();
@@ -17489,13 +17582,13 @@ var TriSha1 = class {
17489
17582
  };
17490
17583
  async function calculateTriSha1(filePath, fileSize) {
17491
17584
  const hash = new TriSha1(fileSize);
17492
- const stream = fs$2.createReadStream(filePath);
17585
+ const stream = fs$1.createReadStream(filePath);
17493
17586
  for await (const chunk of stream) hash.update(chunk);
17494
17587
  return hash.finalize();
17495
17588
  }
17496
17589
  var defaultVideoThumb = Buffer.from("/9j/4AAQSkZJRgABAQAAAQABAAD//gAXR2VuZXJhdGVkIGJ5IFNuaXBhc3Rl/9sAhAAKBwcIBwYKCAgICwoKCw4YEA4NDQ4dFRYRGCMfJSQiHyIhJis3LyYpNCkhIjBBMTQ5Oz4+PiUuRElDPEg3PT47AQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAF/APADAREAAhEBAxEB/8QBogAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoLEAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+foBAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKCxEAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDiAayNxwagBwNAC5oAM0xBmgBM0ANJoAjY0AQsaBkTGgCM0DEpAFAC0AFMBaACgAoEJTASgQlACUwCgQ4UAOFADhQA4UAOFADxQIkBqDQUGgBwagBQaBC5pgGaAELUAMLUARs1AETGgBhNAxhoASkAUALQIKYxaBBQAUwEoAQ0CEoASmAUAOoEKKAHCgBwoAeKAHigQ7NZmoZpgLmgBd1Ahd1ABupgNLUAMLUAMY0AMJoAYaAENACUCCgAoAWgAoAWgBKYCUAJQISgApgLQAooEOFACigB4oAeKBDxQAVmaiZpgGaAFzQAbqAE3UAIWpgNJoAYTQIaaAEoAQ0CEoASgBaACgBaACmAUAJQAlAgoAKYC0AKKBCigB4FADgKBDwKAHigBuazNRM0DEzTAM0AJmgAzQAhNAhpNACGmA2gQlACUCEoAKACgBaAFpgFACUAJQAUCCmAUALQIcBQA4CgB4FADgKBDhQA4UAMzWZqNzTGJQAZoATNABmgBKAEoEIaYCUCEoASgQlABQAtABQAtMBKACgAoEFABimAYoEKBQA4CgB4FADwKBDgKAFFADhQBCazNhKAEpgFACUAFACUAFAhDTAbQISgAoEJQAUALQAtMAoAKADFABigQYoAMUALimIUCgBwFAh4FADgKAHUALQAtAENZmwlACUwEoAKAEoAKACgQlMBpoEJQAUCCgBcUAFABTAXFAC4oAMUAGKBBigAxQIKYCigQ8UAOFADhQAtAC0ALQBDWZqJQMSgBKYBQAlABQISgBKYCGgQlAC0CCgBcUAFABTAUCkA7FMAxQAYoEJQAUCCmAooEOFADxQA4UAFAC0ALQBDWZqJQAlACUxhQAlABQIKAEoASmISgBcUCCgBaACgBcUAKBQAuKYC0CEoAQ0AJQISmAooEPFADhQA4UALQAtAC0AQ1maiUAFACUAJTAKAEoAKAEoAMUxBigAxQIWgAoAKAFAoAWgBaYBQIQ0ANNACUCCmIUUAOFADxQA4UALQAtABQBFWZqFACUAFACYpgFACUAFACUAFAgxTEFABQAUALQAooAWgAoAKYDTQIaaAEpiCgQ4UAOFAh4oGOFAC0ALSAKYEdZmglABQAUDDFACUwEoASgAoAKBBQIKYBQAUALQAtAC0AJQAhpgNJoENJoATNMQCgQ8UCHigB4oAWgYtABQAUAMrM0CgAoAKADFACUxiUAJQAlAgoAKYgoAKACgYtAC0AFAhDTAQmgBhNAhpNACZpiFBoEPFAEi0CHigB1ABQAUDEoAbWZoFABQAtABTAQ0ANNAxDQAlAhaAEpiCgAoGFAC0AFABmgBCaYhpNADCaBDSaBBmgABpiJFNAEimgB4NADqAFzQAlACE0AJWZoFAC0AFAC0wEIoAaaAG0AJQAUCCgApjCgAoAKADNABmgBpNMQ0mgBpNAhhNAgzQAoNADwaAHqaAJAaBDgaYC5oATNACZoAWszQKACgBaBDqYCGgBpoAYaBiUCCgBKYBQMKACgAoAM0AITQIaTQA0mmA0mgQ3NAhKAHCgBwNADwaAHg0AOBpiFzQAZoATNAD6zNAoAKAFoEOpgBoAaaAGGmAw0AJmgAzQMM0AGaADNABmgBM0AITQIaTQAhNMQw0AJQIKAFFADhQA4GgBwNADs0xC5oAM0CDNAEtZmoUCCgBaAHUwCgBppgRtQAw0ANzQAZoAM0AGaADNABmgBKAEoAQ0ANNMQhoEJQAlMBaQDgaAFBoAcDTAdmgQuaADNAgzQBPWZqFAgoAWgBaYC0CGmmBG1AyM0ANJoATNACZoAXNABmgAzQAUAJQAhoAQ0xDTQISmAUALQAUgHA0AKDTAdmgQuaBBQAtAFiszQKACgBaAFFMAoEIaYEbUDI2oAYaAEoASgAzQAuaACgAoAKAENMQ00AJTEFAhKACgAoAXNACg0AOBoAWgQtAC0AWazNAoAKACgBaYBQIQ0AMNMYw0AMIoAbQAlMAoAKACgAzSAKYhKAENACUxBQIKACgBKACgBaAHCgQ4UALQAUAWqzNAoAKACgApgFACGgQ00xjTQAwigBCKAG4pgJQAlABQAUCCgBKACgBKYgoEFABQISgAoAWgBRQA4UALQAUCLdZmoUAFABQAlMAoASgBDQA00wENACYoATFMBpFADSKAEoEJQAUAFABQAlMQtAgoASgQUAJQAUAKKAHCgBaBBQBbrM1CgAoAKACmAUAJQAlADaYBQAlACYpgIRQA0igBpFAhtABQAUAFMAoEFABQIKAEoASgQUALQAooAWgQUAW81mbC0CCgApgFACUAIaAEpgJQAUAFABQAhFMBpFADSKAGkUCExQAYoAMUAGKADFMQYoAMUCExSATFABQIKYBQAtABQIt5qDYM0ALmgQtIApgIaAENADaACmAlAC0ALQAUwGkUANIoAaRQAmKBBigAxQAYoAMUAGKBBigBMUAJigQmKAExTAKBC0AFAFnNQaig0AKDQAtAgoASgBDQAlMBKACgAFADhQAtMBCKAGkUAIRQAmKADFABigQmKADFACYoAXFABigQmKAExQAmKBCYpgJigAoAnzUGgZoAcDQAuaBC0AJQAhoASmAlABQAtADhQAtMAoATFACEUAJigAxQAYoATFAhMUAFABQAuKADFABigBpWgBCKBCYpgJigB+ag0DNADgaBDgaAFzQITNACUAJTAKACgBRQAopgOoAWgBKAEoAKACgAoASgBpoEJQAooAWgBaBhigBMUCEIoAQigBMUAJSLCgBQaBDgaQC5oEFACUwCgBKACmAtADhQA4UALQAUAJQAUAJQAUAJQAhoENoAWgBRQAooGLQAUAGKAGkUAIRQIZSKEoGKKBDhQAUCCgAoAKBBQAUwFoGKKAHCgBaACgAoASgAoASgBCaAEoEJmgAoAUGgBQaAHZoGFABQAUANoAjpDEoAWgBaAFoEFACUALQAUCCmAUAOFAxRQAtAC0AJQAUAJQAmaBDSaAEzQAmaYBmgBQaAHA0gFzQAuaBhmgAzQAlAEdIYUALQAtAgoAKAEoEFAC0AFMAoAUUDFFAC0ALQAUAJQAhoENNACE0wEoATNABmgBc0ALmgBc0gDNAC5oATNABmgBKRQlACigB1AgoASgQlABTAWgBKACgBaBi0ALQAZoAM0AFACGgQ00wENACUAJQAUCFzQMM0ALmgAzQAZoAM0AGaQC0igoAUUALQIWgBDQISmAUAFACUAFABQAuaBi5oAM0AGaBBmgBKAEpgIaAG0AJQAUCFoAM0DDNAC5oATNABmgAzQBJUlBQAooAWgQtACGmIaaACgAoASgBKACgBc0DCgQUAGaADNABTASgBDQAlACUAFAgoAKBhQAUAFABQAlAE1SUFAxRQIWgQtMBDQIQ0AJQAlAhKBiUAFABmgBc0AGaADNABTAKACgBKAEoASgQlABQAUAFAC0AFACUAFAE1SaBQAUCHCgQtMBKBCUAJQISgBDQA00DEzQAuaADNMBc0AGaADNABQAUAJQAlABQISgAoAKACgBaACgBKAEoAnqTQSgBRQIcKBC0xCUAJQISgBKAENADDQAmaYwzQAuaADNAC0AFABQAUAFAhKACgBKACgAoAWgAoELQAlAxKAJqk0EoAWgQooELTEFADaBCUABoENNMY00ANNAwzQAZoAXNAC0AFAC0CFoASgAoASgBKACgAoAWgQtABQAUANNAyWpNAoAKBCimIWgQUCEoASmIQ0ANNADTQMaaAEoGLmgAzQAtADhQIWgBaACgQhoASgYlACUALQIWgBaACgBKAENAyWpNBKYBQIcKBC0CEoEJTAKBCUANNADDQMQ0ANoGFAC5oAUGgBwNAhRQIWgBaAENACGgBtAwoAKAFzQIXNABmgAoAQ0DJKRoJQAtAhRQSLQIKYCUCCgBDQA00AMNAxpoGNoAM0AGaAFBoAcDQIcKBDqACgBDQAhoAQ0DEoAKADNAC5oEGaBhmgAoAkpGgUCCgQooELQIKYhKACgBKAGmgBpoGMNAxDQAlAwzQIUUAOFAhwoAcKBC0AJQAhoGNNACUAFABQAZoAXNABQAUAS0ixKACgQoNAhaYgoEFACUABoAaaAGmgYw0DENAxtABQAooEOFADhQIcKAFoASgBDQAhoGJQAUAFACUALQIKBi0CJDSLEoATNAhc0CHZpiCgQUAJQIKBjTQAhoGNNAxpoATFABigBQKAHCgBwoAWgAoAKACgBKAEoASgAoASgBaAAUAOoEONIoaTQAZoAUGmIUGgQtAgzQISgAoAQ0DGmgYlAxKACgAxQAtACigBRQAtAxaACgAoATFABigBCKAG0CEoAWgBRTAUUAf//Z", "base64");
17497
17590
  async function getVideoInfo(filePath) {
17498
- const size = fs$2.statSync(filePath).size;
17591
+ const size = fs$1.statSync(filePath).size;
17499
17592
  return new Promise((resolve, reject) => {
17500
17593
  (0, import_fluent_ffmpeg.default)(filePath).ffprobe((err, metadata) => {
17501
17594
  if (err) reject(err);
@@ -17572,7 +17665,7 @@ function convert(ctx, input, options, outputPath) {
17572
17665
  });
17573
17666
  }
17574
17667
  async function encodeSilk(ctx, filePath) {
17575
- const file = await fs.readFile(filePath);
17668
+ const file = await fsPromise.readFile(filePath);
17576
17669
  if (!isSilk(file)) {
17577
17670
  ctx.logger.info(`语音文件${filePath}需要转换成silk`);
17578
17671
  let result;
@@ -17591,7 +17684,7 @@ async function encodeSilk(ctx, filePath) {
17591
17684
  "-f s16le"
17592
17685
  ] }), 24e3);
17593
17686
  const pttPath = path.join(TEMP_DIR, randomUUID());
17594
- await fs.writeFile(pttPath, result.data);
17687
+ await fsPromise.writeFile(pttPath, result.data);
17595
17688
  ctx.logger.info(`语音文件${filePath}转换成功!`, pttPath, `时长:`, result.duration);
17596
17689
  return {
17597
17690
  converted: true,
@@ -17614,11 +17707,11 @@ async function encodeSilk(ctx, filePath) {
17614
17707
  }
17615
17708
  }
17616
17709
  async function decodeSilk(ctx, inputFilePath, outFormat) {
17617
- const { data } = await decode(await fs.readFile(inputFilePath), 24e3);
17710
+ const { data } = await decode(await fsPromise.readFile(inputFilePath), 24e3);
17618
17711
  const tmpPath = path.join(TEMP_DIR, path.basename(inputFilePath));
17619
17712
  const outFilePath = tmpPath + `.${outFormat}`;
17620
17713
  const pcmFilePath = tmpPath + ".pcm";
17621
- await fs.writeFile(pcmFilePath, data);
17714
+ await fsPromise.writeFile(pcmFilePath, data);
17622
17715
  return convert(ctx, pcmFilePath, { input: [
17623
17716
  "-f s16le",
17624
17717
  "-ar 24000",
@@ -20295,6 +20388,27 @@ var streamSSE = (c, cb, onError) => {
20295
20388
  return c.newResponse(stream.responseReadable);
20296
20389
  };
20297
20390
  //#endregion
20391
+ //#region node_modules/hono/dist/helper/websocket/index.js
20392
+ var defineWebSocketHelper = (handler) => {
20393
+ return ((...args) => {
20394
+ if (typeof args[0] === "function") {
20395
+ const [createEvents, options] = args;
20396
+ return async function upgradeWebSocket(c, next) {
20397
+ const result = await handler(c, await createEvents(c), options);
20398
+ if (result) return result;
20399
+ await next();
20400
+ };
20401
+ } else {
20402
+ const [c, events, options] = args;
20403
+ return (async () => {
20404
+ const upgraded = await handler(c, events, options);
20405
+ if (!upgraded) throw new Error("Failed to upgrade WebSocket");
20406
+ return upgraded;
20407
+ })();
20408
+ }
20409
+ });
20410
+ };
20411
+ //#endregion
20298
20412
  //#region node_modules/@hono/node-server/dist/index.mjs
20299
20413
  var RequestError = class extends Error {
20300
20414
  constructor(message, options) {
@@ -20302,6 +20416,22 @@ var RequestError = class extends Error {
20302
20416
  this.name = "RequestError";
20303
20417
  }
20304
20418
  };
20419
+ var reValidRequestUrl = /^\/[!#$&-;=?-\[\]_a-z~]*$/;
20420
+ var reDotSegment = /\/\.\.?(?:[/?#]|$)/;
20421
+ var reValidHost = /^[a-z0-9._-]+(?::(?:[1-5]\d{3,4}|[6-9]\d{3}))?$/;
20422
+ var buildUrl = (scheme, host, incomingUrl) => {
20423
+ const url = `${scheme}://${host}${incomingUrl}`;
20424
+ if (!reValidHost.test(host)) {
20425
+ const urlObj = new URL(url);
20426
+ if (urlObj.hostname.length !== host.length && urlObj.hostname !== (host.includes(":") ? host.replace(/:\d+$/, "") : host).toLowerCase()) throw new RequestError("Invalid host header");
20427
+ return urlObj.href;
20428
+ } else if (incomingUrl.length === 0) return url + "/";
20429
+ else {
20430
+ if (incomingUrl.charCodeAt(0) !== 47) throw new RequestError("Invalid URL");
20431
+ if (!reValidRequestUrl.test(incomingUrl) || reDotSegment.test(incomingUrl)) return new URL(url).href;
20432
+ return url;
20433
+ }
20434
+ };
20305
20435
  var toRequestError = (e) => {
20306
20436
  if (e instanceof RequestError) return e;
20307
20437
  return new RequestError(e.message, { cause: e });
@@ -20309,17 +20439,21 @@ var toRequestError = (e) => {
20309
20439
  var GlobalRequest = global.Request;
20310
20440
  var Request$1 = class extends GlobalRequest {
20311
20441
  constructor(input, options) {
20312
- if (typeof input === "object" && getRequestCache in input) input = input[getRequestCache]();
20313
- if (typeof options?.body?.getReader !== "undefined") options.duplex ??= "half";
20442
+ if (typeof input === "object" && getRequestCache in input) {
20443
+ const hasReplacementBody = options !== void 0 && "body" in options && options.body != null;
20444
+ if (input[bodyConsumedDirectlyKey] && !hasReplacementBody) throw new TypeError("Cannot construct a Request with a Request object that has already been used.");
20445
+ input = input[getRequestCache]();
20446
+ }
20447
+ if (typeof (options?.body)?.getReader !== "undefined") options.duplex ??= "half";
20314
20448
  super(input, options);
20315
20449
  }
20316
20450
  };
20317
20451
  var newHeadersFromIncoming = (incoming) => {
20318
20452
  const headerRecord = [];
20319
20453
  const rawHeaders = incoming.rawHeaders;
20320
- for (let i = 0; i < rawHeaders.length; i += 2) {
20321
- const { [i]: key, [i + 1]: value } = rawHeaders;
20322
- if (key.charCodeAt(0) !== 58) headerRecord.push([key, value]);
20454
+ for (let i = 0, len = rawHeaders.length; i < len; i += 2) {
20455
+ const key = rawHeaders[i];
20456
+ if (key.charCodeAt(0) !== 58) headerRecord.push([key, rawHeaders[i + 1]]);
20323
20457
  }
20324
20458
  return new Headers(headerRecord);
20325
20459
  };
@@ -20361,11 +20495,158 @@ var getRequestCache = Symbol("getRequestCache");
20361
20495
  var requestCache = Symbol("requestCache");
20362
20496
  var incomingKey = Symbol("incomingKey");
20363
20497
  var urlKey = Symbol("urlKey");
20498
+ var methodKey = Symbol("methodKey");
20364
20499
  var headersKey = Symbol("headersKey");
20365
20500
  var abortControllerKey = Symbol("abortControllerKey");
20501
+ var getAbortController = Symbol("getAbortController");
20502
+ var abortRequest = Symbol("abortRequest");
20503
+ var bodyBufferKey = Symbol("bodyBuffer");
20504
+ var bodyReadPromiseKey = Symbol("bodyReadPromise");
20505
+ var bodyConsumedDirectlyKey = Symbol("bodyConsumedDirectly");
20506
+ var bodyLockReaderKey = Symbol("bodyLockReader");
20507
+ var abortReasonKey = Symbol("abortReason");
20508
+ var newBodyUnusableError = () => {
20509
+ return /* @__PURE__ */ new TypeError("Body is unusable");
20510
+ };
20511
+ var rejectBodyUnusable = () => {
20512
+ return Promise.reject(newBodyUnusableError());
20513
+ };
20514
+ var textDecoder = new TextDecoder();
20515
+ var consumeBodyDirectOnce = (request) => {
20516
+ if (request[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
20517
+ request[bodyConsumedDirectlyKey] = true;
20518
+ };
20519
+ var toArrayBuffer = (buf) => {
20520
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
20521
+ };
20522
+ var contentType = (request) => {
20523
+ return (request[headersKey] ||= newHeadersFromIncoming(request[incomingKey])).get("content-type") || "";
20524
+ };
20525
+ var methodTokenRegExp = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
20526
+ var normalizeIncomingMethod = (method) => {
20527
+ if (typeof method !== "string" || method.length === 0) return "GET";
20528
+ switch (method) {
20529
+ case "DELETE":
20530
+ case "GET":
20531
+ case "HEAD":
20532
+ case "OPTIONS":
20533
+ case "POST":
20534
+ case "PUT": return method;
20535
+ }
20536
+ const upper = method.toUpperCase();
20537
+ switch (upper) {
20538
+ case "DELETE":
20539
+ case "GET":
20540
+ case "HEAD":
20541
+ case "OPTIONS":
20542
+ case "POST":
20543
+ case "PUT": return upper;
20544
+ default: return method;
20545
+ }
20546
+ };
20547
+ var validateDirectReadMethod = (method) => {
20548
+ if (!methodTokenRegExp.test(method)) return /* @__PURE__ */ new TypeError(`'${method}' is not a valid HTTP method.`);
20549
+ const normalized = method.toUpperCase();
20550
+ if (normalized === "CONNECT" || normalized === "TRACK" || normalized === "TRACE" && method !== "TRACE") return /* @__PURE__ */ new TypeError(`'${method}' HTTP method is unsupported.`);
20551
+ };
20552
+ var readBodyWithFastPath = (request, method, fromBuffer) => {
20553
+ if (request[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
20554
+ const methodName = request.method;
20555
+ if (methodName === "GET" || methodName === "HEAD") return request[getRequestCache]()[method]();
20556
+ const methodValidationError = validateDirectReadMethod(methodName);
20557
+ if (methodValidationError) return Promise.reject(methodValidationError);
20558
+ if (request[requestCache]) {
20559
+ if (methodName !== "TRACE") return request[requestCache][method]();
20560
+ }
20561
+ const alreadyUsedError = consumeBodyDirectOnce(request);
20562
+ if (alreadyUsedError) return alreadyUsedError;
20563
+ const raw = readRawBodyIfAvailable(request);
20564
+ if (raw) {
20565
+ const result = Promise.resolve(fromBuffer(raw, request));
20566
+ request[bodyBufferKey] = void 0;
20567
+ return result;
20568
+ }
20569
+ return readBodyDirect(request).then((buf) => {
20570
+ const result = fromBuffer(buf, request);
20571
+ request[bodyBufferKey] = void 0;
20572
+ return result;
20573
+ });
20574
+ };
20575
+ var readRawBodyIfAvailable = (request) => {
20576
+ const incoming = request[incomingKey];
20577
+ if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) return incoming.rawBody;
20578
+ };
20579
+ var readBodyDirect = (request) => {
20580
+ if (request[bodyBufferKey]) return Promise.resolve(request[bodyBufferKey]);
20581
+ if (request[bodyReadPromiseKey]) return request[bodyReadPromiseKey];
20582
+ const incoming = request[incomingKey];
20583
+ if (Readable.isDisturbed(incoming)) return rejectBodyUnusable();
20584
+ const promise = new Promise((resolve, reject) => {
20585
+ const chunks = [];
20586
+ let settled = false;
20587
+ const finish = (callback) => {
20588
+ if (settled) return;
20589
+ settled = true;
20590
+ cleanup();
20591
+ callback();
20592
+ };
20593
+ const onData = (chunk) => {
20594
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
20595
+ };
20596
+ const onEnd = () => {
20597
+ finish(() => {
20598
+ const buffer = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks);
20599
+ request[bodyBufferKey] = buffer;
20600
+ resolve(buffer);
20601
+ });
20602
+ };
20603
+ const onError = (error) => {
20604
+ finish(() => {
20605
+ reject(error);
20606
+ });
20607
+ };
20608
+ const onClose = () => {
20609
+ if (incoming.readableEnded) {
20610
+ onEnd();
20611
+ return;
20612
+ }
20613
+ finish(() => {
20614
+ if (incoming.errored) {
20615
+ reject(incoming.errored);
20616
+ return;
20617
+ }
20618
+ const reason = request[abortReasonKey];
20619
+ if (reason !== void 0) {
20620
+ reject(reason instanceof Error ? reason : new Error(String(reason)));
20621
+ return;
20622
+ }
20623
+ reject(/* @__PURE__ */ new Error("Client connection prematurely closed."));
20624
+ });
20625
+ };
20626
+ const cleanup = () => {
20627
+ incoming.off("data", onData);
20628
+ incoming.off("end", onEnd);
20629
+ incoming.off("error", onError);
20630
+ incoming.off("close", onClose);
20631
+ request[bodyReadPromiseKey] = void 0;
20632
+ };
20633
+ incoming.on("data", onData);
20634
+ incoming.on("end", onEnd);
20635
+ incoming.on("error", onError);
20636
+ incoming.on("close", onClose);
20637
+ queueMicrotask(() => {
20638
+ if (settled) return;
20639
+ if (incoming.readableEnded) onEnd();
20640
+ else if (incoming.errored) onError(incoming.errored);
20641
+ else if (incoming.destroyed) onClose();
20642
+ });
20643
+ });
20644
+ request[bodyReadPromiseKey] = promise;
20645
+ return promise;
20646
+ };
20366
20647
  var requestPrototype = {
20367
20648
  get method() {
20368
- return this[incomingKey].method || "GET";
20649
+ return this[methodKey];
20369
20650
  },
20370
20651
  get url() {
20371
20652
  return this[urlKey];
@@ -20373,18 +20654,57 @@ var requestPrototype = {
20373
20654
  get headers() {
20374
20655
  return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
20375
20656
  },
20376
- [Symbol("getAbortController")]() {
20377
- this[getRequestCache]();
20657
+ [abortRequest](reason) {
20658
+ if (this[abortReasonKey] === void 0) this[abortReasonKey] = reason;
20659
+ const abortController = this[abortControllerKey];
20660
+ if (abortController && !abortController.signal.aborted) abortController.abort(reason);
20661
+ },
20662
+ [getAbortController]() {
20663
+ this[abortControllerKey] ||= new AbortController();
20664
+ if (this[abortReasonKey] !== void 0 && !this[abortControllerKey].signal.aborted) this[abortControllerKey].abort(this[abortReasonKey]);
20378
20665
  return this[abortControllerKey];
20379
20666
  },
20380
20667
  [getRequestCache]() {
20381
- this[abortControllerKey] ||= new AbortController();
20382
- return this[requestCache] ||= newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], this[abortControllerKey]);
20668
+ const abortController = this[getAbortController]();
20669
+ if (this[requestCache]) return this[requestCache];
20670
+ const method = this.method;
20671
+ if (this[bodyConsumedDirectlyKey] && !(method === "GET" || method === "HEAD")) {
20672
+ this[bodyBufferKey] = void 0;
20673
+ const init = {
20674
+ method: method === "TRACE" ? "GET" : method,
20675
+ headers: this.headers,
20676
+ signal: abortController.signal
20677
+ };
20678
+ if (method !== "TRACE") {
20679
+ init.body = new ReadableStream({ start(c) {
20680
+ c.close();
20681
+ } });
20682
+ init.duplex = "half";
20683
+ }
20684
+ const req = new Request$1(this[urlKey], init);
20685
+ if (method === "TRACE") Object.defineProperty(req, "method", { get() {
20686
+ return "TRACE";
20687
+ } });
20688
+ return this[requestCache] = req;
20689
+ }
20690
+ return this[requestCache] = newRequestFromIncoming(this.method, this[urlKey], this.headers, this[incomingKey], abortController);
20691
+ },
20692
+ get body() {
20693
+ if (!this[bodyConsumedDirectlyKey]) return this[getRequestCache]().body;
20694
+ const request = this[getRequestCache]();
20695
+ if (!this[bodyLockReaderKey] && request.body) this[bodyLockReaderKey] = request.body.getReader();
20696
+ return request.body;
20697
+ },
20698
+ get bodyUsed() {
20699
+ if (this[bodyConsumedDirectlyKey]) return true;
20700
+ if (this[requestCache]) return this[requestCache].bodyUsed;
20701
+ return false;
20383
20702
  }
20384
20703
  };
20704
+ Object.defineProperty(requestPrototype, "signal", { get() {
20705
+ return this[getAbortController]().signal;
20706
+ } });
20385
20707
  [
20386
- "body",
20387
- "bodyUsed",
20388
20708
  "cache",
20389
20709
  "credentials",
20390
20710
  "destination",
@@ -20393,25 +20713,37 @@ var requestPrototype = {
20393
20713
  "redirect",
20394
20714
  "referrer",
20395
20715
  "referrerPolicy",
20396
- "signal",
20397
20716
  "keepalive"
20398
20717
  ].forEach((k) => {
20399
20718
  Object.defineProperty(requestPrototype, k, { get() {
20400
20719
  return this[getRequestCache]()[k];
20401
20720
  } });
20402
20721
  });
20403
- [
20404
- "arrayBuffer",
20405
- "blob",
20406
- "clone",
20407
- "formData",
20408
- "json",
20409
- "text"
20410
- ].forEach((k) => {
20722
+ ["clone", "formData"].forEach((k) => {
20411
20723
  Object.defineProperty(requestPrototype, k, { value: function() {
20724
+ if (this[bodyConsumedDirectlyKey]) {
20725
+ if (k === "clone") throw newBodyUnusableError();
20726
+ return rejectBodyUnusable();
20727
+ }
20412
20728
  return this[getRequestCache]()[k]();
20413
20729
  } });
20414
20730
  });
20731
+ Object.defineProperty(requestPrototype, "text", { value: function() {
20732
+ return readBodyWithFastPath(this, "text", (buf) => textDecoder.decode(buf));
20733
+ } });
20734
+ Object.defineProperty(requestPrototype, "arrayBuffer", { value: function() {
20735
+ return readBodyWithFastPath(this, "arrayBuffer", (buf) => toArrayBuffer(buf));
20736
+ } });
20737
+ Object.defineProperty(requestPrototype, "blob", { value: function() {
20738
+ return readBodyWithFastPath(this, "blob", (buf, request) => {
20739
+ const type = contentType(request);
20740
+ return new Response(buf, type ? { headers: { "content-type": type } } : void 0).blob();
20741
+ });
20742
+ } });
20743
+ Object.defineProperty(requestPrototype, "json", { value: function() {
20744
+ if (this[bodyConsumedDirectlyKey]) return rejectBodyUnusable();
20745
+ return this.text().then(JSON.parse);
20746
+ } });
20415
20747
  Object.defineProperty(requestPrototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
20416
20748
  return `Request (lightweight) ${inspectFn({
20417
20749
  method: this.method,
@@ -20427,6 +20759,7 @@ Object.setPrototypeOf(requestPrototype, Request$1.prototype);
20427
20759
  var newRequest = (incoming, defaultHostname) => {
20428
20760
  const req = Object.create(requestPrototype);
20429
20761
  req[incomingKey] = incoming;
20762
+ req[methodKey] = normalizeIncomingMethod(incoming.method);
20430
20763
  const incomingUrl = incoming.url || "";
20431
20764
  if (incomingUrl[0] !== "/" && (incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
20432
20765
  if (incoming instanceof Http2ServerRequest) throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
@@ -20444,16 +20777,20 @@ var newRequest = (incoming, defaultHostname) => {
20444
20777
  scheme = incoming.scheme;
20445
20778
  if (!(scheme === "http" || scheme === "https")) throw new RequestError("Unsupported scheme");
20446
20779
  } else scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
20447
- const url = new URL(`${scheme}://${host}${incomingUrl}`);
20448
- if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) throw new RequestError("Invalid host header");
20449
- req[urlKey] = url.href;
20780
+ try {
20781
+ req[urlKey] = buildUrl(scheme, host, incomingUrl);
20782
+ } catch (e) {
20783
+ if (e instanceof RequestError) throw e;
20784
+ else throw new RequestError("Invalid URL", { cause: e });
20785
+ }
20450
20786
  return req;
20451
20787
  };
20788
+ var defaultContentType = "text/plain; charset=UTF-8";
20452
20789
  var responseCache = Symbol("responseCache");
20453
20790
  var getResponseCache = Symbol("getResponseCache");
20454
20791
  var cacheKey = Symbol("cache");
20455
20792
  var GlobalResponse = global.Response;
20456
- var Response2 = class _Response {
20793
+ var Response$1 = class Response$1 {
20457
20794
  #body;
20458
20795
  #init;
20459
20796
  [getResponseCache]() {
@@ -20463,7 +20800,7 @@ var Response2 = class _Response {
20463
20800
  constructor(body, init) {
20464
20801
  let headers;
20465
20802
  this.#body = body;
20466
- if (init instanceof _Response) {
20803
+ if (init instanceof Response$1) {
20467
20804
  const cachedGlobalResponse = init[responseCache];
20468
20805
  if (cachedGlobalResponse) {
20469
20806
  this.#init = cachedGlobalResponse;
@@ -20474,16 +20811,16 @@ var Response2 = class _Response {
20474
20811
  headers = new Headers(init.#init.headers);
20475
20812
  }
20476
20813
  } else this.#init = init;
20477
- if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
20814
+ if (body == null || typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) this[cacheKey] = [
20478
20815
  init?.status || 200,
20479
- body,
20816
+ body ?? null,
20480
20817
  headers || init?.headers
20481
20818
  ];
20482
20819
  }
20483
20820
  get headers() {
20484
20821
  const cache = this[cacheKey];
20485
20822
  if (cache) {
20486
- if (!(cache[2] instanceof Headers)) cache[2] = new Headers(cache[2] || { "content-type": "text/plain; charset=UTF-8" });
20823
+ if (!(cache[2] instanceof Headers)) cache[2] = new Headers(cache[2] || (cache[1] === null ? void 0 : { "content-type": defaultContentType }));
20487
20824
  return cache[2];
20488
20825
  }
20489
20826
  return this[getResponseCache]().headers;
@@ -20505,7 +20842,7 @@ var Response2 = class _Response {
20505
20842
  "type",
20506
20843
  "url"
20507
20844
  ].forEach((k) => {
20508
- Object.defineProperty(Response2.prototype, k, { get() {
20845
+ Object.defineProperty(Response$1.prototype, k, { get() {
20509
20846
  return this[getResponseCache]()[k];
20510
20847
  } });
20511
20848
  });
@@ -20517,11 +20854,11 @@ var Response2 = class _Response {
20517
20854
  "json",
20518
20855
  "text"
20519
20856
  ].forEach((k) => {
20520
- Object.defineProperty(Response2.prototype, k, { value: function() {
20857
+ Object.defineProperty(Response$1.prototype, k, { value: function() {
20521
20858
  return this[getResponseCache]()[k]();
20522
20859
  } });
20523
20860
  });
20524
- Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
20861
+ Object.defineProperty(Response$1.prototype, Symbol.for("nodejs.util.inspect.custom"), { value: function(depth, options, inspectFn) {
20525
20862
  return `Response (lightweight) ${inspectFn({
20526
20863
  status: this.status,
20527
20864
  headers: this.headers,
@@ -20532,8 +20869,51 @@ Object.defineProperty(Response2.prototype, Symbol.for("nodejs.util.inspect.custo
20532
20869
  depth: depth == null ? null : depth - 1
20533
20870
  })}`;
20534
20871
  } });
20535
- Object.setPrototypeOf(Response2, GlobalResponse);
20536
- Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
20872
+ Object.setPrototypeOf(Response$1, GlobalResponse);
20873
+ Object.setPrototypeOf(Response$1.prototype, GlobalResponse.prototype);
20874
+ var validRedirectUrl = /^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/;
20875
+ var parseRedirectUrl = (url) => {
20876
+ if (url instanceof URL) return url.href;
20877
+ if (validRedirectUrl.test(url)) return url;
20878
+ return new URL(url).href;
20879
+ };
20880
+ var validRedirectStatuses = new Set([
20881
+ 301,
20882
+ 302,
20883
+ 303,
20884
+ 307,
20885
+ 308
20886
+ ]);
20887
+ Object.defineProperty(Response$1, "redirect", {
20888
+ value: function redirect(url, status = 302) {
20889
+ if (!validRedirectStatuses.has(status)) throw new RangeError("Invalid status code");
20890
+ return new Response$1(null, {
20891
+ status,
20892
+ headers: { location: parseRedirectUrl(url) }
20893
+ });
20894
+ },
20895
+ writable: true,
20896
+ configurable: true
20897
+ });
20898
+ Object.defineProperty(Response$1, "json", {
20899
+ value: function json(data, init) {
20900
+ const body = JSON.stringify(data);
20901
+ if (body === void 0) throw new TypeError("The data is not JSON serializable");
20902
+ const initHeaders = init?.headers;
20903
+ let headers;
20904
+ if (initHeaders) {
20905
+ headers = new Headers(initHeaders);
20906
+ if (!headers.has("content-type")) headers.set("content-type", "application/json");
20907
+ } else headers = { "content-type": "application/json" };
20908
+ return new Response$1(body, {
20909
+ status: init?.status ?? 200,
20910
+ statusText: init?.statusText,
20911
+ headers
20912
+ });
20913
+ },
20914
+ writable: true,
20915
+ configurable: true
20916
+ });
20537
20917
  async function readWithoutBlocking(readPromise) {
20538
20918
  return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
20539
20919
  }
@@ -20569,18 +20949,18 @@ function writeFromReadableStream(stream, writable) {
20569
20949
  else if (writable.destroyed) return;
20570
20950
  return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
20571
20951
  }
20572
- var buildOutgoingHttpHeaders = (headers) => {
20952
+ var buildOutgoingHttpHeaders = (headers, defaultContentType) => {
20573
20953
  const res = {};
20574
20954
  if (!(headers instanceof Headers)) headers = new Headers(headers ?? void 0);
20575
- const cookies = [];
20576
- for (const [k, v] of headers) if (k === "set-cookie") cookies.push(v);
20577
- else res[k] = v;
20578
- if (cookies.length > 0) res["set-cookie"] = cookies;
20579
- res["content-type"] ??= "text/plain; charset=UTF-8";
20955
+ if (headers.has("set-cookie")) {
20956
+ const cookies = [];
20957
+ for (const [k, v] of headers) if (k === "set-cookie") cookies.push(v);
20958
+ else res[k] = v;
20959
+ if (cookies.length > 0) res["set-cookie"] = cookies;
20960
+ } else for (const [k, v] of headers) res[k] = v;
20961
+ if (defaultContentType) res["content-type"] ??= defaultContentType;
20580
20962
  return res;
20581
20963
  };
20582
- var X_ALREADY_SENT = "x-hono-already-sent";
20583
- if (typeof global.crypto === "undefined") global.crypto = crypto$2;
20584
20964
  var outgoingEnded = Symbol("outgoingEnded");
20585
20965
  var incomingDraining = Symbol("incomingDraining");
20586
20966
  var DRAIN_TIMEOUT_MS = 500;
@@ -20618,6 +20998,20 @@ var drainIncoming = (incoming) => {
20618
20998
  incoming.on("error", cleanup);
20619
20999
  incoming.resume();
20620
21000
  };
21001
+ var makeCloseHandler = (req, incoming, outgoing, needsBodyCleanup) => () => {
21002
+ if (incoming.errored) req[abortRequest](incoming.errored.toString());
21003
+ else if (!outgoing.writableFinished) req[abortRequest]("Client connection prematurely closed.");
21004
+ if (needsBodyCleanup && !incoming.readableEnded) setTimeout(() => {
21005
+ if (!incoming.readableEnded) setTimeout(() => {
21006
+ drainIncoming(incoming);
21007
+ });
21008
+ });
21009
+ };
21010
+ var isImmediateCacheableResponse = (res) => {
21011
+ if (!(cacheKey in res)) return false;
21012
+ const body = res[cacheKey][1];
21013
+ return body === null || typeof body === "string" || body instanceof Uint8Array;
21014
+ };
20621
21015
  var handleRequestError = () => new Response(null, { status: 400 });
20622
21016
  var handleFetchError = (e) => new Response(null, { status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500 });
20623
21017
  var handleResponseError = (e, outgoing) => {
@@ -20635,15 +21029,44 @@ var flushHeaders = (outgoing) => {
20635
21029
  };
20636
21030
  var responseViaCache = async (res, outgoing) => {
20637
21031
  let [status, body, header] = res[cacheKey];
21032
+ if (!header) {
21033
+ if (body === null) {
21034
+ outgoing.writeHead(status);
21035
+ outgoing.end();
21036
+ } else if (typeof body === "string") {
21037
+ outgoing.writeHead(status, {
21038
+ "Content-Type": defaultContentType,
21039
+ "Content-Length": Buffer.byteLength(body)
21040
+ });
21041
+ outgoing.end(body);
21042
+ } else if (body instanceof Uint8Array) {
21043
+ outgoing.writeHead(status, {
21044
+ "Content-Type": defaultContentType,
21045
+ "Content-Length": body.byteLength
21046
+ });
21047
+ outgoing.end(body);
21048
+ } else if (body instanceof Blob) {
21049
+ outgoing.writeHead(status, {
21050
+ "Content-Type": defaultContentType,
21051
+ "Content-Length": body.size
21052
+ });
21053
+ outgoing.end(new Uint8Array(await body.arrayBuffer()));
21054
+ } else {
21055
+ outgoing.writeHead(status, { "Content-Type": defaultContentType });
21056
+ flushHeaders(outgoing);
21057
+ await writeFromReadableStream(body, outgoing)?.catch((e) => handleResponseError(e, outgoing));
21058
+ }
21059
+ outgoing[outgoingEnded]?.();
21060
+ return;
21061
+ }
20638
21062
  let hasContentLength = false;
20639
- if (!header) header = { "content-type": "text/plain; charset=UTF-8" };
20640
- else if (header instanceof Headers) {
21063
+ if (header instanceof Headers) {
20641
21064
  hasContentLength = header.has("content-length");
20642
- header = buildOutgoingHttpHeaders(header);
21065
+ header = buildOutgoingHttpHeaders(header, body === null ? void 0 : defaultContentType);
20643
21066
  } else if (Array.isArray(header)) {
20644
21067
  const headerObj = new Headers(header);
20645
21068
  hasContentLength = headerObj.has("content-length");
20646
- header = buildOutgoingHttpHeaders(headerObj);
21069
+ header = buildOutgoingHttpHeaders(headerObj, body === null ? void 0 : defaultContentType);
20647
21070
  } else for (const key in header) if (key.length === 14 && key.toLowerCase() === "content-length") {
20648
21071
  hasContentLength = true;
20649
21072
  break;
@@ -20654,7 +21077,8 @@ var responseViaCache = async (res, outgoing) => {
20654
21077
  else if (body instanceof Blob) header["Content-Length"] = body.size;
20655
21078
  }
20656
21079
  outgoing.writeHead(status, header);
20657
- if (typeof body === "string" || body instanceof Uint8Array) outgoing.end(body);
21080
+ if (body == null) outgoing.end();
21081
+ else if (typeof body === "string" || body instanceof Uint8Array) outgoing.end(body);
20658
21082
  else if (body instanceof Blob) outgoing.end(new Uint8Array(await body.arrayBuffer()));
20659
21083
  else {
20660
21084
  flushHeaders(outgoing);
@@ -20673,7 +21097,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
20673
21097
  }
20674
21098
  else res = await res.catch(handleFetchError);
20675
21099
  if (cacheKey in res) return responseViaCache(res, outgoing);
20676
- const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
21100
+ const resHeaderRecord = buildOutgoingHttpHeaders(res.headers, res.body === null ? void 0 : defaultContentType);
20677
21101
  if (res.body) {
20678
21102
  const reader = res.body.getReader();
20679
21103
  const values = [];
@@ -20713,7 +21137,7 @@ var responseViaResponseObject = async (res, outgoing, options = {}) => {
20713
21137
  if (values.length === 0) flushHeaders(outgoing);
20714
21138
  await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
20715
21139
  }
20716
- } else if (resHeaderRecord[X_ALREADY_SENT]) {} else {
21140
+ } else if (resHeaderRecord["x-hono-already-sent"]) {} else {
20717
21141
  outgoing.writeHead(res.status, resHeaderRecord);
20718
21142
  outgoing.end();
20719
21143
  }
@@ -20723,47 +21147,45 @@ var getRequestListener = (fetchCallback, options = {}) => {
20723
21147
  const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
20724
21148
  if (options.overrideGlobalObjects !== false && global.Request !== Request$1) {
20725
21149
  Object.defineProperty(global, "Request", { value: Request$1 });
20726
- Object.defineProperty(global, "Response", { value: Response2 });
21150
+ Object.defineProperty(global, "Response", { value: Response$1 });
20727
21151
  }
20728
21152
  return async (incoming, outgoing) => {
20729
21153
  let res, req;
21154
+ let needsBodyCleanup = false;
21155
+ let closeHandlerAttached = false;
21156
+ const ensureCloseHandler = () => {
21157
+ if (!req || closeHandlerAttached) return;
21158
+ closeHandlerAttached = true;
21159
+ outgoing.on("close", makeCloseHandler(req, incoming, outgoing, needsBodyCleanup));
21160
+ };
20730
21161
  try {
20731
21162
  req = newRequest(incoming, options.hostname);
20732
- let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
20733
- if (!incomingEnded) {
21163
+ needsBodyCleanup = autoCleanupIncoming && !(incoming.method === "GET" || incoming.method === "HEAD");
21164
+ if (needsBodyCleanup) {
20734
21165
  incoming[wrapBodyStream] = true;
20735
- incoming.on("end", () => {
20736
- incomingEnded = true;
20737
- });
20738
21166
  if (incoming instanceof Http2ServerRequest) outgoing[outgoingEnded] = () => {
20739
- if (!incomingEnded) setTimeout(() => {
20740
- if (!incomingEnded) setTimeout(() => {
20741
- drainIncoming(incoming);
21167
+ if (!incoming.readableEnded) setTimeout(() => {
21168
+ if (!incoming.readableEnded) setTimeout(() => {
21169
+ incoming.destroy();
21170
+ outgoing.destroy();
20742
21171
  });
20743
21172
  });
20744
21173
  };
20745
- outgoing.on("finish", () => {
20746
- if (!incomingEnded) drainIncoming(incoming);
20747
- });
20748
21174
  }
20749
- outgoing.on("close", () => {
20750
- if (req[abortControllerKey]) {
20751
- if (incoming.errored) req[abortControllerKey].abort(incoming.errored.toString());
20752
- else if (!outgoing.writableFinished) req[abortControllerKey].abort("Client connection prematurely closed.");
20753
- }
20754
- if (!incomingEnded) setTimeout(() => {
20755
- if (!incomingEnded) setTimeout(() => {
20756
- drainIncoming(incoming);
20757
- });
20758
- });
20759
- });
20760
21175
  res = fetchCallback(req, {
20761
21176
  incoming,
20762
21177
  outgoing
20763
21178
  });
20764
- if (cacheKey in res) return responseViaCache(res, outgoing);
21179
+ if (!isPromise(res) && isImmediateCacheableResponse(res)) {
21180
+ if (needsBodyCleanup && !incoming.readableEnded) outgoing.once("finish", () => {
21181
+ if (!incoming.readableEnded) drainIncoming(incoming);
21182
+ });
21183
+ return responseViaCache(res, outgoing);
21184
+ }
21185
+ ensureCloseHandler();
20765
21186
  } catch (e) {
20766
21187
  if (!res) if (options.errorHandler) {
21188
+ ensureCloseHandler();
20767
21189
  res = await options.errorHandler(req ? e : toRequestError(e));
20768
21190
  if (!res) return;
20769
21191
  } else if (!req) res = handleRequestError();
@@ -20777,6 +21199,160 @@ var getRequestListener = (fetchCallback, options = {}) => {
20777
21199
  }
20778
21200
  };
20779
21201
  };
21202
+ /**
21203
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
21204
+ */
21205
+ var CloseEvent$1 = globalThis.CloseEvent ?? class extends Event {
21206
+ #eventInitDict;
21207
+ constructor(type, eventInitDict = {}) {
21208
+ super(type, eventInitDict);
21209
+ this.#eventInitDict = eventInitDict;
21210
+ }
21211
+ get wasClean() {
21212
+ return this.#eventInitDict.wasClean ?? false;
21213
+ }
21214
+ get code() {
21215
+ return this.#eventInitDict.code ?? 0;
21216
+ }
21217
+ get reason() {
21218
+ return this.#eventInitDict.reason ?? "";
21219
+ }
21220
+ };
21221
+ var generateConnectionSymbol$1 = () => Symbol("connection");
21222
+ var CONNECTION_SYMBOL_KEY$1 = Symbol("CONNECTION_SYMBOL_KEY");
21223
+ var WAIT_FOR_WEBSOCKET_SYMBOL = Symbol("WAIT_FOR_WEBSOCKET_SYMBOL");
21224
+ var rejectUpgradeRequest = (socket, status) => {
21225
+ socket.end(`HTTP/1.1 ${status.toString()} ${STATUS_CODES[status] ?? ""}\r\nConnection: close\r
21226
+ Content-Length: 0\r
21227
+ \r
21228
+ `);
21229
+ };
21230
+ var createUpgradeRequest = (request) => {
21231
+ const protocol = request.socket.encrypted ? "https" : "http";
21232
+ const url = new URL(request.url ?? "/", `${protocol}://${request.headers.host ?? "localhost"}`);
21233
+ const headers = new Headers();
21234
+ for (const key in request.headers) {
21235
+ const value = request.headers[key];
21236
+ if (!value) continue;
21237
+ headers.append(key, Array.isArray(value) ? value[0] : value);
21238
+ }
21239
+ return new Request(url, { headers });
21240
+ };
21241
+ var setupWebSocket = (options) => {
21242
+ const { server, fetchCallback, wss } = options;
21243
+ const waiterMap = /* @__PURE__ */ new Map();
21244
+ wss.on("connection", (ws, request) => {
21245
+ const waiter = waiterMap.get(request);
21246
+ if (waiter) {
21247
+ waiter.resolve(ws);
21248
+ waiterMap.delete(request);
21249
+ }
21250
+ });
21251
+ const waitForWebSocket = (request, connectionSymbol) => {
21252
+ return new Promise((resolve) => {
21253
+ waiterMap.set(request, {
21254
+ resolve,
21255
+ connectionSymbol
21256
+ });
21257
+ });
21258
+ };
21259
+ server.on("upgrade", async (request, socket, head) => {
21260
+ if (request.headers.upgrade?.toLowerCase() !== "websocket") return;
21261
+ const env = {
21262
+ incoming: request,
21263
+ outgoing: void 0,
21264
+ wss,
21265
+ [WAIT_FOR_WEBSOCKET_SYMBOL]: waitForWebSocket
21266
+ };
21267
+ let status = 400;
21268
+ try {
21269
+ const response = await fetchCallback(createUpgradeRequest(request), env);
21270
+ if (response instanceof Response) status = response.status;
21271
+ } catch {
21272
+ if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, 500);
21273
+ return;
21274
+ }
21275
+ const waiter = waiterMap.get(request);
21276
+ if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY$1]) {
21277
+ waiterMap.delete(request);
21278
+ if (server.listenerCount("upgrade") === 1) rejectUpgradeRequest(socket, status);
21279
+ return;
21280
+ }
21281
+ wss.handleUpgrade(request, socket, head, (ws) => {
21282
+ wss.emit("connection", ws, request);
21283
+ });
21284
+ });
21285
+ server.on("close", () => {
21286
+ wss.close();
21287
+ });
21288
+ };
21289
+ defineWebSocketHelper(async (c, events, options) => {
21290
+ if (c.req.header("upgrade")?.toLowerCase() !== "websocket") return;
21291
+ const env = c.env;
21292
+ const waitForWebSocket = env[WAIT_FOR_WEBSOCKET_SYMBOL];
21293
+ if (!waitForWebSocket || !env.incoming) return new Response(null, { status: 500 });
21294
+ const connectionSymbol = generateConnectionSymbol$1();
21295
+ env[CONNECTION_SYMBOL_KEY$1] = connectionSymbol;
21296
+ (async () => {
21297
+ const ws = await waitForWebSocket(env.incoming, connectionSymbol);
21298
+ const messagesReceivedInStarting = [];
21299
+ const bufferMessage = (data, isBinary) => {
21300
+ messagesReceivedInStarting.push([data, isBinary]);
21301
+ };
21302
+ ws.on("message", bufferMessage);
21303
+ const ctx = {
21304
+ binaryType: "arraybuffer",
21305
+ close(code, reason) {
21306
+ ws.close(code, reason);
21307
+ },
21308
+ protocol: ws.protocol,
21309
+ raw: ws,
21310
+ get readyState() {
21311
+ return ws.readyState;
21312
+ },
21313
+ send(source, opts) {
21314
+ ws.send(source, { compress: opts?.compress });
21315
+ },
21316
+ url: new URL(c.req.url)
21317
+ };
21318
+ try {
21319
+ events?.onOpen?.(new Event("open"), ctx);
21320
+ } catch (e) {
21321
+ (options?.onError ?? console.error)(e);
21322
+ }
21323
+ const handleMessage = (data, isBinary) => {
21324
+ const datas = Array.isArray(data) ? data : [data];
21325
+ for (const data of datas) try {
21326
+ events?.onMessage?.(new MessageEvent("message", { data: isBinary ? data instanceof ArrayBuffer ? data : data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength) : data.toString("utf-8") }), ctx);
21327
+ } catch (e) {
21328
+ (options?.onError ?? console.error)(e);
21329
+ }
21330
+ };
21331
+ ws.off("message", bufferMessage);
21332
+ for (const message of messagesReceivedInStarting) handleMessage(...message);
21333
+ ws.on("message", (data, isBinary) => {
21334
+ handleMessage(data, isBinary);
21335
+ });
21336
+ ws.on("close", (code, reason) => {
21337
+ try {
21338
+ events?.onClose?.(new CloseEvent$1("close", {
21339
+ code,
21340
+ reason: reason.toString()
21341
+ }), ctx);
21342
+ } catch (e) {
21343
+ (options?.onError ?? console.error)(e);
21344
+ }
21345
+ });
21346
+ ws.on("error", (error) => {
21347
+ try {
21348
+ events?.onError?.(new ErrorEvent("error", { error }), ctx);
21349
+ } catch (e) {
21350
+ (options?.onError ?? console.error)(e);
21351
+ }
21352
+ });
21353
+ })();
21354
+ return new Response();
21355
+ });
20780
21356
  var createAdaptorServer = (options) => {
20781
21357
  const fetchCallback = options.fetch;
20782
21358
  const requestListener = getRequestListener(fetchCallback, {
@@ -20784,7 +21360,16 @@ var createAdaptorServer = (options) => {
20784
21360
  overrideGlobalObjects: options.overrideGlobalObjects,
20785
21361
  autoCleanupIncoming: options.autoCleanupIncoming
20786
21362
  });
20787
- return (options.createServer || createServer)(options.serverOptions || {}, requestListener);
21363
+ const server = (options.createServer || createServer)(options.serverOptions || {}, requestListener);
21364
+ if (options.websocket && options.websocket.server) {
21365
+ if (options.websocket.server.options.noServer !== true) throw new Error("WebSocket server must be created with { noServer: true } option");
21366
+ setupWebSocket({
21367
+ server,
21368
+ fetchCallback,
21369
+ wss: options.websocket.server
21370
+ });
21371
+ }
21372
+ return server;
20788
21373
  };
20789
21374
  var serve = (options, listeningListener) => {
20790
21375
  const server = createAdaptorServer(options);
@@ -21083,6 +21668,8 @@ var ActionName = /* @__PURE__ */ function(ActionName) {
21083
21668
  ActionName["SetDoubtFriendsAddRequest"] = "set_doubt_friends_add_request";
21084
21669
  ActionName["DeleteGroupNotice"] = "_delete_group_notice";
21085
21670
  ActionName["SendPoke"] = "send_poke";
21671
+ ActionName["SetInputStatus"] = "set_input_status";
21672
+ ActionName["GetGroupAlbumMediaList"] = "get_group_album_media_list";
21086
21673
  ActionName["SendLike"] = "send_like";
21087
21674
  ActionName["GetLoginInfo"] = "get_login_info";
21088
21675
  ActionName["GetFriendList"] = "get_friend_list";
@@ -21159,15 +21746,24 @@ var GetMsg = class extends BaseAction {
21159
21746
  async _handle(payload, config) {
21160
21747
  const msgInfo = await this.ctx.store.getMsgInfoByShortId(+payload.message_id);
21161
21748
  if (!msgInfo) throw new Error("消息不存在");
21162
- let msg = this.ctx.store.getMsgCache(msgInfo.msgId);
21163
- if (!msg) {
21164
- const res = await this.ctx.ntMsgApi.getMsgsByMsgId(msgInfo.peer, [msgInfo.msgId]);
21165
- if (res.msgList.length === 0) throw new Error("无法获取该消息");
21166
- msg = res.msgList[0];
21167
- }
21749
+ let status = "normal";
21750
+ let msg;
21751
+ const res = await this.ctx.ntMsgApi.getMsgsByMsgId(msgInfo.peer, [msgInfo.msgId]);
21752
+ if (res.msgList.length === 0 || res.msgList[0].elements[0].grayTipElement?.revokeElement) {
21753
+ const msgCache = this.ctx.store.getMsgCache(msgInfo.msgId);
21754
+ if (msgCache) {
21755
+ msg = msgCache;
21756
+ status = "deleted";
21757
+ } else if (res.msgList.length === 0) throw new Error("无法获取该消息");
21758
+ else {
21759
+ msg = res.msgList[0];
21760
+ status = "deleted";
21761
+ }
21762
+ } else msg = res.msgList[0];
21168
21763
  const retMsg = await OB11Entities.message(this.ctx, msg, void 0, void 0, config);
21169
21764
  if (!retMsg) throw new Error("消息为空");
21170
21765
  retMsg.real_id = retMsg.message_seq;
21766
+ retMsg.status = status;
21171
21767
  return retMsg;
21172
21768
  }
21173
21769
  };
@@ -23260,7 +23856,9 @@ var MessageEncoder$1 = class MessageEncoder$1 {
23260
23856
  "forward",
23261
23857
  "node",
23262
23858
  "video",
23263
- "file"
23859
+ "file",
23860
+ "at",
23861
+ "reply"
23264
23862
  ];
23265
23863
  results;
23266
23864
  children;
@@ -23291,7 +23889,7 @@ var MessageEncoder$1 = class MessageEncoder$1 {
23291
23889
  }
23292
23890
  async flush() {
23293
23891
  if (this.children.length === 0 && !this.content) return;
23294
- const nick = this.name || selfInfo.nick || "QQ用户";
23892
+ const nick = this.name ?? selfInfo.nick;
23295
23893
  if (this.news.length < 4) this.news.push({ text: `${nick}: ${this.preview}` });
23296
23894
  this.results.push({
23297
23895
  routingHead: {
@@ -23537,7 +24135,7 @@ var MessageEncoder$1 = class MessageEncoder$1 {
23537
24135
  } });
23538
24136
  } else {
23539
24137
  const data = await this.ctx.ntFileApi.uploadC2CFile(this.peer.peerUid, path, fileName);
23540
- this.content = Msg.FileExtra.encode({ file: {
24138
+ const extra = Msg.FileExtra.encode({ file: {
23541
24139
  fileType: 0,
23542
24140
  fileUuid: data.fileId,
23543
24141
  fileMd5: data.file10MMd5,
@@ -23548,8 +24146,47 @@ var MessageEncoder$1 = class MessageEncoder$1 {
23548
24146
  expireTime: Math.floor(Date.now() / 1e3 + 10080 * 60),
23549
24147
  fileIdCrcMedia: data.crcMedia
23550
24148
  } });
24149
+ this.content = extra;
23551
24150
  }
23552
24151
  this.preview += `[文件] ${fileName}`;
24152
+ } else if (type === OB11MessageDataType.At) {
24153
+ if (!this.isGroup) return;
24154
+ let str;
24155
+ if (isNonNullable(data.name)) str = `@${data.name}`;
24156
+ else if (data.qq === "all") str = "@全体成员";
24157
+ else {
24158
+ const uid = await this.ctx.ntUserApi.getUidByUin(data.qq, this.isGroup ? this.peer.peerUid : void 0);
24159
+ try {
24160
+ const info = await this.ctx.ntGroupApi.getGroupMember(this.peer.peerUid, uid, false, 50);
24161
+ str = `@${info.cardName || info.nick}`;
24162
+ } catch (e) {
24163
+ str = `@${(await this.ctx.ntUserApi.getUserSimpleInfo(uid)).coreInfo.nick}`;
24164
+ }
24165
+ }
24166
+ this.children.push({ text: { str } });
24167
+ this.preview += str;
24168
+ } else if (type === OB11MessageDataType.Reply) {
24169
+ const msgInfo = await this.ctx.store.getMsgInfoByShortId(+data.id);
24170
+ if (!msgInfo) throw new Error(`消息 ${data.id} 不存在`);
24171
+ const res = await this.ctx.ntMsgApi.getMsgsByMsgId(msgInfo.peer, [msgInfo.msgId]);
24172
+ if (res.msgList.length === 0) throw new Error(`无法获取消息 ${data.id} 的内容`);
24173
+ const msg = res.msgList[0];
24174
+ const elems = [];
24175
+ for (const element of msg.elements) if (element.elementType === ElementType.Text) elems.push({ text: { str: element.textElement.content } });
24176
+ else if (element.elementType === ElementType.Pic) elems.push({ text: { str: element.picElement.summary } });
24177
+ else if (element.elementType === ElementType.Video) elems.push({ text: { str: "[视频]" } });
24178
+ else if (element.elementType === ElementType.Face) {
24179
+ const { faceType, faceIndex, faceText } = element.faceElement;
24180
+ if (faceType === FaceType.Old || faceType === FaceType.Normal) elems.push({ face: { index: faceIndex } });
24181
+ else elems.push({ text: { str: faceText } });
24182
+ } else if (element.elementType === ElementType.File) elems.push({ text: { str: "[文件]" } });
24183
+ this.children.push({ srcMsg: {
24184
+ origSeqs: [+msg.msgSeq],
24185
+ senderUin: +msg.senderUin,
24186
+ time: +msg.msgTime,
24187
+ elems: elems.map((e) => Msg.Elem.encode(e)),
24188
+ toUin: 0
24189
+ } });
23553
24190
  }
23554
24191
  }
23555
24192
  async render(segments) {
@@ -24237,17 +24874,17 @@ var DownloadFile = class extends BaseAction {
24237
24874
  const isRandomName = !payload.name;
24238
24875
  const name = payload.name ? path.basename(payload.name) : randomUUID();
24239
24876
  const filePath = path.join(TEMP_DIR, name);
24240
- if (payload.base64) await fsPromise.writeFile(filePath, payload.base64, "base64");
24877
+ if (payload.base64) await fsPromise$1.writeFile(filePath, payload.base64, "base64");
24241
24878
  else if (payload.url) {
24242
24879
  const headers = this.getHeaders(payload.headers);
24243
24880
  const res = await fetchFile(payload.url, headers);
24244
- await fsPromise.writeFile(filePath, res.data);
24881
+ await fsPromise$1.writeFile(filePath, res.data);
24245
24882
  } else throw new Error("不存在任何文件, 无法下载");
24246
- if (fs$1.existsSync(filePath)) {
24883
+ if (fs.existsSync(filePath)) {
24247
24884
  if (isRandomName) {
24248
24885
  const md5 = await getMd5HexFromFile(filePath);
24249
24886
  const newPath = path.join(TEMP_DIR, md5);
24250
- await fsPromise.rename(filePath, newPath);
24887
+ await fsPromise$1.rename(filePath, newPath);
24251
24888
  return { file: newPath };
24252
24889
  }
24253
24890
  return { file: filePath };
@@ -25904,6 +26541,43 @@ var SendPoke = class extends BaseAction {
25904
26541
  }
25905
26542
  };
25906
26543
  //#endregion
26544
+ //#region src/onebot11/action/llbot/user/SetInputStatus.ts
26545
+ var SetInputStatus = class extends BaseAction {
26546
+ actionName = ActionName.SetInputStatus;
26547
+ payloadSchema = lib_default$1.object({
26548
+ user_id: lib_default$1.union([Number, String]).required(),
26549
+ event_type: lib_default$1.union([Number, String]).required()
26550
+ });
26551
+ async _handle(payload) {
26552
+ const uin = payload.user_id.toString();
26553
+ const uid = await this.ctx.ntUserApi.getUidByUin(uin);
26554
+ if (!uid) throw new Error("无法获取用户信息");
26555
+ const result = await this.ctx.ntMsgApi.sendShowInputStatusReq(ChatType.C2C, +payload.event_type, uid);
26556
+ if (result.result !== 0) throw new Error(result.errMsg);
26557
+ return null;
26558
+ }
26559
+ };
26560
+ //#endregion
26561
+ //#region src/onebot11/action/llbot/group/GroupAlbum/GetGroupAlbumMediaList.ts
26562
+ var GetGroupAlbumMediaList = class extends BaseAction {
26563
+ actionName = ActionName.GetGroupAlbumMediaList;
26564
+ payloadSchema = lib_default$1.object({
26565
+ group_id: lib_default$1.union([Number, String]).required(),
26566
+ album_id: lib_default$1.string().required(),
26567
+ attach_info: lib_default$1.string()
26568
+ });
26569
+ async _handle(payload) {
26570
+ const res = await this.ctx.ntGroupApi.getGroupAlbumMediaList(payload.group_id.toString(), payload.album_id, payload.attach_info);
26571
+ if (res.response.result !== 0) throw new Error(res.response.errMs);
26572
+ return pick(res.response, [
26573
+ "album",
26574
+ "media_list",
26575
+ "next_attach_info",
26576
+ "next_has_more"
26577
+ ]);
26578
+ }
26579
+ };
26580
+ //#endregion
25907
26581
  //#region src/onebot11/action/index.ts
25908
26582
  function initActionMap(adapter) {
25909
26583
  const actionHandlers = [
@@ -25957,6 +26631,8 @@ function initActionMap(adapter) {
25957
26631
  new SetDoubtFriendsAddRequest(adapter),
25958
26632
  new DeleteGroupNotice(adapter),
25959
26633
  new SendPoke(adapter),
26634
+ new SetInputStatus(adapter),
26635
+ new GetGroupAlbumMediaList(adapter),
25960
26636
  new SendLike(adapter),
25961
26637
  new GetMsg(adapter),
25962
26638
  new GetLoginInfo$1(adapter),
@@ -26203,7 +26879,8 @@ var Onebot11Adapter = class extends Service {
26203
26879
  "app",
26204
26880
  "logger",
26205
26881
  "pmhq",
26206
- "timer"
26882
+ "timer",
26883
+ "config"
26207
26884
  ];
26208
26885
  connect;
26209
26886
  actionMap;
@@ -28215,27 +28892,6 @@ var handlers = {
28215
28892
  deleteFriend
28216
28893
  };
28217
28894
  //#endregion
28218
- //#region node_modules/hono/dist/helper/websocket/index.js
28219
- var defineWebSocketHelper = (handler) => {
28220
- return ((...args) => {
28221
- if (typeof args[0] === "function") {
28222
- const [createEvents, options] = args;
28223
- return async function upgradeWebSocket(c, next) {
28224
- const result = await handler(c, await createEvents(c), options);
28225
- if (result) return result;
28226
- await next();
28227
- };
28228
- } else {
28229
- const [c, events, options] = args;
28230
- return (async () => {
28231
- const upgraded = await handler(c, events, options);
28232
- if (!upgraded) throw new Error("Failed to upgrade WebSocket");
28233
- return upgraded;
28234
- })();
28235
- }
28236
- });
28237
- };
28238
- //#endregion
28239
28895
  //#region node_modules/@hono/node-ws/dist/index.js
28240
28896
  /**
28241
28897
  * @link https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
@@ -28542,8 +29198,10 @@ async function parseMessageDeleted(bot, input) {
28542
29198
  if (!origin) return;
28543
29199
  const message = await decodeMessage(bot.ctx, origin);
28544
29200
  if (!message) return;
28545
- const operatorUid = input.elements[0].grayTipElement.revokeElement.operatorUid;
28546
- const user = await bot.ctx.ntUserApi.getUserSimpleInfo(operatorUid);
29201
+ const revokeElement = input.elements[0].grayTipElement.revokeElement;
29202
+ let operator;
29203
+ if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operator = message.user;
29204
+ else operator = decodeUser((await bot.ctx.ntUserApi.getUserSimpleInfo(revokeElement.operatorUid)).coreInfo);
28547
29205
  return bot.event("message-deleted", {
28548
29206
  message: omit(message, [
28549
29207
  "member",
@@ -28555,7 +29213,7 @@ async function parseMessageDeleted(bot, input) {
28555
29213
  user: message.user,
28556
29214
  channel: message.channel,
28557
29215
  guild: message.guild,
28558
- operator: omit(decodeUser(user.coreInfo), ["is_bot"])
29216
+ operator: omit(operator, ["is_bot"])
28559
29217
  });
28560
29218
  }
28561
29219
  //#endregion
@@ -42901,7 +43559,7 @@ async function download(url, headers) {
42901
43559
  return Buffer.from(bytes);
42902
43560
  }
42903
43561
  async function resolveMilkyUri(uri) {
42904
- if (uri.startsWith("file://")) return await fs.readFile(fileURLToPath(uri));
43562
+ if (uri.startsWith("file://")) return await fsPromise.readFile(fileURLToPath(uri));
42905
43563
  if (uri.startsWith("http://") || uri.startsWith("https://")) return await download(uri);
42906
43564
  if (uri.startsWith("base64://")) return Buffer.from(uri.slice(9), "base64");
42907
43565
  throw new Error(`Unsupported URI scheme: ${uri}`);
@@ -43258,7 +43916,7 @@ var ForwardMessageEncoder = class ForwardMessageEncoder {
43258
43916
  }
43259
43917
  async flush() {
43260
43918
  if (this.children.length === 0) return;
43261
- const nick = this.name || selfInfo.nick || "QQ用户";
43919
+ const nick = this.name ?? selfInfo.nick;
43262
43920
  if (this.news.length < 4) this.news.push({ text: `${nick}: ${this.preview}` });
43263
43921
  this.results.push({
43264
43922
  routingHead: {
@@ -45776,7 +46434,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
45776
46434
  return () => false;
45777
46435
  }
45778
46436
  //#endregion
45779
- //#region node_modules/path-expression-matcher/src/Expression.js
46437
+ //#region node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Expression.js
45780
46438
  /**
45781
46439
  * Expression - Parses and stores a tag pattern expression
45782
46440
  *
@@ -45928,7 +46586,7 @@ var Expression = class {
45928
46586
  }
45929
46587
  };
45930
46588
  //#endregion
45931
- //#region node_modules/path-expression-matcher/src/ExpressionSet.js
46589
+ //#region node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/ExpressionSet.js
45932
46590
  /**
45933
46591
  * ExpressionSet - An indexed collection of Expressions for efficient bulk matching
45934
46592
  *
@@ -46101,7 +46759,7 @@ var ExpressionSet = class {
46101
46759
  }
46102
46760
  };
46103
46761
  //#endregion
46104
- //#region node_modules/path-expression-matcher/src/Matcher.js
46762
+ //#region node_modules/fast-xml-parser/node_modules/path-expression-matcher/src/Matcher.js
46105
46763
  /**
46106
46764
  * MatcherView - A lightweight read-only view over a Matcher's internal state.
46107
46765
  *
@@ -46565,7 +47223,7 @@ function extractNamespace(rawTagName) {
46565
47223
  }
46566
47224
  }
46567
47225
  var OrderedObjParser = class {
46568
- constructor(options) {
47226
+ constructor(options, externalEntities) {
46569
47227
  this.options = options;
46570
47228
  this.currentNode = null;
46571
47229
  this.tagsNodeStack = [];
@@ -46590,7 +47248,10 @@ var OrderedObjParser = class {
46590
47248
  ...CURRENCY
46591
47249
  };
46592
47250
  this.entityDecoder = new EntityDecoder({
46593
- namedEntities,
47251
+ namedEntities: {
47252
+ ...namedEntities,
47253
+ ...externalEntities
47254
+ },
46594
47255
  numericAllowed: this.options.htmlEntities,
46595
47256
  limit: {
46596
47257
  maxTotalExpansions: this.options.processEntities.maxTotalExpansions,
@@ -46694,7 +47355,7 @@ function buildAttributesMap(attrStr, jPath, tagName, force = false) {
46694
47355
  }
46695
47356
  }
46696
47357
  if (!hasAttrs) return;
46697
- if (options.attributesGroupName) {
47358
+ if (options.attributesGroupName && !options.preserveOrder) {
46698
47359
  const attrCollection = {};
46699
47360
  attrCollection[options.attributesGroupName] = attrs;
46700
47361
  return attrCollection;
@@ -46912,29 +47573,35 @@ function isItStopNode() {
46912
47573
  */
46913
47574
  function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
46914
47575
  let attrBoundary = 0;
46915
- const chars = [];
46916
47576
  const len = xmlData.length;
46917
47577
  const closeCode0 = closingChar.charCodeAt(0);
46918
47578
  const closeCode1 = closingChar.length > 1 ? closingChar.charCodeAt(1) : -1;
47579
+ let result = "";
47580
+ let segmentStart = i;
46919
47581
  for (let index = i; index < len; index++) {
46920
47582
  const code = xmlData.charCodeAt(index);
46921
47583
  if (attrBoundary) {
46922
47584
  if (code === attrBoundary) attrBoundary = 0;
46923
47585
  } else if (code === 34 || code === 39) attrBoundary = code;
46924
47586
  else if (code === closeCode0) if (closeCode1 !== -1) {
46925
- if (xmlData.charCodeAt(index + 1) === closeCode1) return {
46926
- data: String.fromCharCode(...chars),
47587
+ if (xmlData.charCodeAt(index + 1) === closeCode1) {
47588
+ result += xmlData.substring(segmentStart, index);
47589
+ return {
47590
+ data: result,
47591
+ index
47592
+ };
47593
+ }
47594
+ } else {
47595
+ result += xmlData.substring(segmentStart, index);
47596
+ return {
47597
+ data: result,
46927
47598
  index
46928
47599
  };
46929
- } else return {
46930
- data: String.fromCharCode(...chars),
46931
- index
46932
- };
46933
- else if (code === 9) {
46934
- chars.push(32);
46935
- continue;
46936
47600
  }
46937
- chars.push(code);
47601
+ else if (code === 9 && !attrBoundary) {
47602
+ result += xmlData.substring(segmentStart, index) + " ";
47603
+ segmentStart = index + 1;
47604
+ }
46938
47605
  }
46939
47606
  }
46940
47607
  function findClosingIndex(xmlData, str, i, errMsg) {
@@ -47154,8 +47821,7 @@ var XMLParser = class {
47154
47821
  const result = validate(xmlData, validationOption);
47155
47822
  if (result !== true) throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
47156
47823
  }
47157
- const orderedObjParser = new OrderedObjParser(this.options);
47158
- orderedObjParser.entityDecoder.setExternalEntities(this.externalEntities);
47824
+ const orderedObjParser = new OrderedObjParser(this.options, this.externalEntities);
47159
47825
  const orderedResult = orderedObjParser.parseXml(xmlData);
47160
47826
  if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
47161
47827
  else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
@@ -47289,11 +47955,7 @@ async function transformIncomingSegments(ctx, message) {
47289
47955
  type: "video",
47290
47956
  data: {
47291
47957
  resource_id: element.videoElement.fileUuid,
47292
- temp_url: await ctx.ntFileApi.getVideoUrl({
47293
- chatType: message.chatType,
47294
- peerUid: message.peerUid,
47295
- guildId: message.guildId
47296
- }, message.msgId, element.elementId),
47958
+ temp_url: await ctx.ntFileApi.getVideoUrlByPacket(element.videoElement.fileUuid, message.chatType === ChatType.Group),
47297
47959
  width: element.videoElement.thumbWidth,
47298
47960
  height: element.videoElement.thumbHeight,
47299
47961
  duration: element.videoElement.fileTime
@@ -48141,6 +48803,25 @@ async function transformTempMessageCreated(ctx, message) {
48141
48803
  }
48142
48804
  }
48143
48805
  /**
48806
+ * Transform NTQQ message-deleted event to Milky message_recall event (temp)
48807
+ */
48808
+ async function transformTempMessageDeleted(ctx, message) {
48809
+ try {
48810
+ const revokeElement = message.elements[0].grayTipElement.revokeElement;
48811
+ return {
48812
+ message_scene: "temp",
48813
+ peer_id: Number(message.peerUin),
48814
+ message_seq: Number(message.msgSeq),
48815
+ sender_id: Number(message.senderUin),
48816
+ operator_id: Number(message.senderUin),
48817
+ display_suffix: revokeElement.wording
48818
+ };
48819
+ } catch (error) {
48820
+ ctx.logger.error("Failed to transform temp message deleted event:", error);
48821
+ return null;
48822
+ }
48823
+ }
48824
+ /**
48144
48825
  * Transform NTQQ message-deleted event to Milky message_recall event (private)
48145
48826
  */
48146
48827
  async function transformPrivateMessageDeleted(ctx, message) {
@@ -48151,7 +48832,7 @@ async function transformPrivateMessageDeleted(ctx, message) {
48151
48832
  peer_id: Number(message.peerUin),
48152
48833
  message_seq: Number(message.msgSeq),
48153
48834
  sender_id: Number(message.senderUin),
48154
- operator_id: Number(await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid)),
48835
+ operator_id: Number(message.senderUin),
48155
48836
  display_suffix: revokeElement.wording
48156
48837
  };
48157
48838
  } catch (error) {
@@ -48165,12 +48846,15 @@ async function transformPrivateMessageDeleted(ctx, message) {
48165
48846
  async function transformGroupMessageDeleted(ctx, message) {
48166
48847
  try {
48167
48848
  const revokeElement = message.elements[0].grayTipElement.revokeElement;
48849
+ let operatorUin;
48850
+ if (revokeElement.operatorUid === revokeElement.origMsgSenderUid) operatorUin = message.senderUin;
48851
+ else operatorUin = await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid);
48168
48852
  return {
48169
48853
  message_scene: "group",
48170
48854
  peer_id: Number(message.peerUin),
48171
48855
  message_seq: Number(message.msgSeq),
48172
48856
  sender_id: Number(message.senderUin),
48173
- operator_id: Number(await ctx.ntUserApi.getUinByUid(revokeElement.operatorUid)),
48857
+ operator_id: Number(operatorUin),
48174
48858
  display_suffix: revokeElement.wording
48175
48859
  };
48176
48860
  } catch (error) {
@@ -48582,6 +49266,9 @@ var MilkyAdapter = class extends Service {
48582
49266
  } else if (message.chatType === ChatType.Group) {
48583
49267
  const eventData = await transformGroupMessageDeleted(this.ctx, message);
48584
49268
  if (eventData) this.emitEvent("message_recall", eventData);
49269
+ } else if (message.chatType === ChatType.TempC2CFromGroup) {
49270
+ const eventData = await transformTempMessageDeleted(this.ctx, message);
49271
+ if (eventData) this.emitEvent("message_recall", eventData);
48585
49272
  }
48586
49273
  });
48587
49274
  this.ctx.on("nt/message-sent", async (message) => {
@@ -52297,7 +52984,7 @@ var NTQQFileApi = class extends Service {
52297
52984
  const trans = {
52298
52985
  uin: selfInfo.uin,
52299
52986
  cmd: 1005,
52300
- readable: createReadStream$1(filePath, { highWaterMark: maxBlockSize }),
52987
+ readable: createReadStream(filePath, { highWaterMark: maxBlockSize }),
52301
52988
  sum: Buffer.from(index.info.md5HexStr, "hex"),
52302
52989
  size: index.info.fileSize,
52303
52990
  ticket: highwaySession.sigSession,
@@ -52317,7 +53004,7 @@ var NTQQFileApi = class extends Service {
52317
53004
  const trans = {
52318
53005
  uin: selfInfo.uin,
52319
53006
  cmd: 1006,
52320
- readable: createReadStream$1(thumbPath, { highWaterMark: maxBlockSize }),
53007
+ readable: createReadStream(thumbPath, { highWaterMark: maxBlockSize }),
52321
53008
  sum: Buffer.from(index.info.md5HexStr, "hex"),
52322
53009
  size: index.info.fileSize,
52323
53010
  ticket: highwaySession.sigSession,
@@ -52346,7 +53033,7 @@ var NTQQFileApi = class extends Service {
52346
53033
  const trans = {
52347
53034
  uin: selfInfo.uin,
52348
53035
  cmd: 1001,
52349
- readable: createReadStream$1(filePath, { highWaterMark: maxBlockSize }),
53036
+ readable: createReadStream(filePath, { highWaterMark: maxBlockSize }),
52350
53037
  sum: Buffer.from(index.info.md5HexStr, "hex"),
52351
53038
  size: index.info.fileSize,
52352
53039
  ticket: highwaySession.sigSession,
@@ -52366,7 +53053,7 @@ var NTQQFileApi = class extends Service {
52366
53053
  const trans = {
52367
53054
  uin: selfInfo.uin,
52368
53055
  cmd: 1002,
52369
- readable: createReadStream$1(thumbPath, { highWaterMark: maxBlockSize }),
53056
+ readable: createReadStream(thumbPath, { highWaterMark: maxBlockSize }),
52370
53057
  sum: Buffer.from(index.info.md5HexStr, "hex"),
52371
53058
  size: index.info.fileSize,
52372
53059
  ticket: highwaySession.sigSession,
@@ -52425,7 +53112,7 @@ var NTQQFileApi = class extends Service {
52425
53112
  const trans = {
52426
53113
  uin: selfInfo.uin,
52427
53114
  cmd: 71,
52428
- readable: createReadStream$1(filePath, { highWaterMark: 1024 * 1024 }),
53115
+ readable: createReadStream(filePath, { highWaterMark: 1024 * 1024 }),
52429
53116
  sum: result.md5,
52430
53117
  size: result.fileSize,
52431
53118
  ticket: highwaySession.sigSession,
@@ -52482,7 +53169,7 @@ var NTQQFileApi = class extends Service {
52482
53169
  const trans = {
52483
53170
  uin: selfInfo.uin,
52484
53171
  cmd: 95,
52485
- readable: createReadStream$1(filePath, { highWaterMark: 1024 * 1024 }),
53172
+ readable: createReadStream(filePath, { highWaterMark: 1024 * 1024 }),
52486
53173
  sum: result.md5CheckSum,
52487
53174
  size: result.fileSize,
52488
53175
  ticket: highwaySession.sigSession,
@@ -52636,7 +53323,7 @@ var NTQQGroupApi = class extends Service {
52636
53323
  async getGroupMembers(groupCode, forceFetch = true) {
52637
53324
  return await this.ctx.pmhq.invoke(NTMethod.GROUP_MEMBERS, [groupCode, forceFetch]);
52638
53325
  }
52639
- async getGroupMember(groupCode, uid, forceUpdate = false) {
53326
+ async getGroupMember(groupCode, uid, forceUpdate = false, timeout = 15e3) {
52640
53327
  return (await this.ctx.pmhq.invoke("nodeIKernelGroupService/getMemberInfo", [
52641
53328
  groupCode,
52642
53329
  [uid],
@@ -52645,7 +53332,8 @@ var NTQQGroupApi = class extends Service {
52645
53332
  resultCmd: "nodeIKernelGroupListener/onMemberInfoChange",
52646
53333
  resultCb: (result) => {
52647
53334
  return result[0] === groupCode && result[2].has(uid);
52648
- }
53335
+ },
53336
+ timeout
52649
53337
  }))[2].get(uid);
52650
53338
  }
52651
53339
  async getSingleScreenNotifies(doubt, number, startSeq = "") {
@@ -52871,7 +53559,7 @@ var NTQQGroupApi = class extends Service {
52871
53559
  async getGroupShutUpMemberList(groupCode) {
52872
53560
  return (await this.ctx.pmhq.invoke("nodeIKernelGroupService/getGroupShutUpMemberList", [groupCode], {
52873
53561
  resultCmd: "nodeIKernelGroupListener/onShutUpMemberListChanged",
52874
- resultCb: (payload) => payload[0] === groupCode
53562
+ resultCb: (payload) => payload[0] === groupCode || payload[0] === "0"
52875
53563
  }))[1];
52876
53564
  }
52877
53565
  async renameGroupFolder(groupId, folderId, newFolderName) {
@@ -52939,6 +53627,17 @@ var NTQQGroupApi = class extends Service {
52939
53627
  }
52940
53628
  });
52941
53629
  }
53630
+ async getGroupAlbumMediaList(groupCode, albumId, attachInfo = "") {
53631
+ return await this.ctx.pmhq.invoke("nodeIKernelAlbumService/getMediaList", [{
53632
+ qun_id: groupCode,
53633
+ attach_info: attachInfo,
53634
+ seq: 0,
53635
+ request_time_line: { request_invoke_time: "0" },
53636
+ album_id: albumId,
53637
+ lloc: "",
53638
+ batch_id: ""
53639
+ }]);
53640
+ }
52942
53641
  };
52943
53642
  //#endregion
52944
53643
  //#region src/ntqqapi/api/login.ts
@@ -53307,6 +54006,13 @@ var NTQQMsgApi = class extends Service {
53307
54006
  async setContactLocalTop(peer, isTop) {
53308
54007
  return await this.ctx.pmhq.invoke("nodeIKernelMsgService/setContactLocalTop", [peer, isTop]);
53309
54008
  }
54009
+ async sendShowInputStatusReq(chatType, eventType, toUid) {
54010
+ return await this.ctx.pmhq.invoke("nodeIKernelMsgService/sendShowInputStatusReq", [
54011
+ chatType,
54012
+ eventType,
54013
+ toUid
54014
+ ]);
54015
+ }
53310
54016
  };
53311
54017
  //#endregion
53312
54018
  //#region src/common/utils/request.ts
@@ -53717,7 +54423,7 @@ var NTQQWebApi = class extends Service {
53717
54423
  const iBatchID = Math.floor(Date.now() / 1e3);
53718
54424
  for (let i = 0; i < filePathList.length; i++) {
53719
54425
  const filePath = filePathList[i];
53720
- const fileBuffer = await fs.readFile(filePath);
54426
+ const fileBuffer = await fsPromise.readFile(filePath);
53721
54427
  const fileSize = fileBuffer.length;
53722
54428
  const checksum = await getMd5HexFromFile(filePath);
53723
54429
  const getSessionUrl = `https://${domain}/webapp/json/sliceUpload/FileBatchControl/${checksum}?g_tk=${gtk}`;
@@ -55190,7 +55896,7 @@ var Config = class extends Service {
55190
55896
  this.logger.info("配置文件位于", this.configPath);
55191
55897
  this.config = this.get();
55192
55898
  if (this.configPath) {
55193
- fs$2.watchFile(this.configPath, {
55899
+ fs$1.watchFile(this.configPath, {
55194
55900
  persistent: true,
55195
55901
  interval: 1e3
55196
55902
  }, () => {
@@ -55208,7 +55914,7 @@ var Config = class extends Service {
55208
55914
  }
55209
55915
  getDefaultConfig() {
55210
55916
  const _defaultConfig = { ...defaultConfig };
55211
- const defaultConfigFromFile = fs$2.readFileSync(this.defaultConfigPath, "utf-8");
55917
+ const defaultConfigFromFile = fs$1.readFileSync(this.defaultConfigPath, "utf-8");
55212
55918
  try {
55213
55919
  const parsedDefaultConfig = import_dist.default.parse(defaultConfigFromFile);
55214
55920
  Object.assign(_defaultConfig, parsedDefaultConfig);
@@ -55219,12 +55925,12 @@ var Config = class extends Service {
55219
55925
  }
55220
55926
  reloadConfig() {
55221
55927
  if (!this.configPath) return this.getDefaultConfig();
55222
- if (!fs$2.existsSync(this.configPath)) {
55928
+ if (!fs$1.existsSync(this.configPath)) {
55223
55929
  this.config = this.getDefaultConfig();
55224
55930
  this.set(this.config);
55225
55931
  return this.config;
55226
55932
  } else {
55227
- const data = fs$2.readFileSync(this.configPath, "utf-8");
55933
+ const data = fs$1.readFileSync(this.configPath, "utf-8");
55228
55934
  let jsonData = defaultConfig;
55229
55935
  try {
55230
55936
  jsonData = import_dist.default.parse(data);
@@ -55250,7 +55956,7 @@ var Config = class extends Service {
55250
55956
  writeConfig(config) {
55251
55957
  if (!this.configPath) return;
55252
55958
  this.watch = false;
55253
- fs$2.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
55959
+ fs$1.writeFileSync(this.configPath, JSON.stringify(config, null, 2), "utf-8");
55254
55960
  setTimeout(() => {
55255
55961
  this.watch = true;
55256
55962
  }, 1500);
@@ -55356,13 +56062,13 @@ var WebUITokenUtil = class {
55356
56062
  }
55357
56063
  getToken() {
55358
56064
  if (!this.token) {
55359
- if (fs$2.existsSync(this.tokenPath)) this.token = fs$2.readFileSync(this.tokenPath, "utf-8").trim();
56065
+ if (fs$1.existsSync(this.tokenPath)) this.token = fs$1.readFileSync(this.tokenPath, "utf-8").trim();
55360
56066
  }
55361
56067
  return this.token;
55362
56068
  }
55363
56069
  setToken(token) {
55364
56070
  this.token = token.trim();
55365
- fs$2.writeFileSync(this.tokenPath, token, "utf-8");
56071
+ fs$1.writeFileSync(this.tokenPath, token, "utf-8");
55366
56072
  }
55367
56073
  };
55368
56074
  var webuiTokenUtil = new WebUITokenUtil(path.join(DATA_DIR, "webui_token.txt"));
@@ -56782,7 +57488,7 @@ var tryDecodeURI = (str) => tryDecode(str, decodeURI);
56782
57488
  var serveStatic = (options = { root: "" }) => {
56783
57489
  const root = options.root || "";
56784
57490
  const optionPath = options.path;
56785
- if (root !== "" && !existsSync(root)) console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`);
57491
+ if (root !== "" && !existsSync$1(root)) console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`);
56786
57492
  return async (c, next) => {
56787
57493
  if (c.finalized) return next();
56788
57494
  let filename;
@@ -57338,7 +58044,7 @@ var package_exports = /* @__PURE__ */ __exportAll({
57338
58044
  var name, version, description, main, scripts, repository, keywords, author, license, bugs, homepage, devDependencies, engines, package_default;
57339
58045
  var init_package = __esmMin((() => {
57340
58046
  name = "nodemailer";
57341
- version = "8.0.5";
58047
+ version = "8.0.6";
57342
58048
  description = "Easy as cake e-mail sending from your Node.js applications";
57343
58049
  main = "lib/nodemailer.js";
57344
58050
  scripts = {
@@ -57638,7 +58344,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
57638
58344
  var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
57639
58345
  var urllib$2 = __require("url");
57640
58346
  var util$1 = __require("util");
57641
- var fs$5 = __require("fs");
58347
+ var fs$4 = __require("fs");
57642
58348
  var nmfetch = require_fetch();
57643
58349
  var dns$1 = __require("dns");
57644
58350
  var net$4 = __require("net");
@@ -57974,7 +58680,7 @@ var require_shared = /* @__PURE__ */ __commonJSMin(((exports, module) => {
57974
58680
  const parsedDataUri = module.exports.parseDataURI(content.path || content.href);
57975
58681
  if (!parsedDataUri || !parsedDataUri.data) return callback(null, Buffer.from(0));
57976
58682
  return callback(null, parsedDataUri.data);
57977
- } else if (content.path) return resolveStream(fs$5.createReadStream(content.path), callback);
58683
+ } else if (content.path) return resolveStream(fs$4.createReadStream(content.path), callback);
57978
58684
  }
57979
58685
  if (typeof data[key].content === "string" && ![
57980
58686
  "utf8",
@@ -60869,7 +61575,19 @@ var require_punycode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60869
61575
  });
60870
61576
  };
60871
61577
  module.exports = {
61578
+ /**
61579
+ * A string representing the current Punycode.js version number.
61580
+ * @memberOf punycode
61581
+ * @type String
61582
+ */
60872
61583
  version: "2.3.1",
61584
+ /**
61585
+ * An object of methods to convert from JavaScript's internal character
61586
+ * representation (UCS-2) to Unicode code points, and back.
61587
+ * @see <https://mathiasbynens.be/notes/javascript-encoding>
61588
+ * @memberOf punycode
61589
+ * @type Object
61590
+ */
60873
61591
  ucs2: {
60874
61592
  decode: ucs2decode,
60875
61593
  encode: ucs2encode
@@ -60910,11 +61628,11 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60910
61628
  const chunkLength = lineLength * 1024;
60911
61629
  const wrapRegex = new RegExp(".{" + lineLength + "}", "g");
60912
61630
  while (pos < str.length) {
60913
- const wrappedLines = str.substr(pos, chunkLength).replace(wrapRegex, "$&\r\n");
61631
+ const wrappedLines = str.substr(pos, chunkLength).replace(wrapRegex, "$&\r\n").trim();
60914
61632
  result.push(wrappedLines);
60915
61633
  pos += chunkLength;
60916
61634
  }
60917
- return result.join("");
61635
+ return result.join("\r\n").trim();
60918
61636
  }
60919
61637
  /**
60920
61638
  * Creates a transform stream for encoding data to base64 encoding
@@ -60952,12 +61670,12 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60952
61670
  if (lastLF < 0) {
60953
61671
  this._curLine = b64;
60954
61672
  b64 = "";
60955
- } else {
61673
+ } else if (lastLF === b64.length - 1) this._curLine = "";
61674
+ else {
60956
61675
  this._curLine = b64.substring(lastLF + 1);
60957
61676
  b64 = b64.substring(0, lastLF + 1);
60958
- if (b64 && !b64.endsWith("\r\n")) b64 += "\r\n";
60959
61677
  }
60960
- } else this._curLine = "";
61678
+ }
60961
61679
  if (b64) {
60962
61680
  this.outputBytes += b64.length;
60963
61681
  this.push(Buffer.from(b64, "ascii"));
@@ -60967,6 +61685,7 @@ var require_base64 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
60967
61685
  _flush(done) {
60968
61686
  if (this._remainingBytes && this._remainingBytes.length) this._curLine += encode(this._remainingBytes);
60969
61687
  if (this._curLine) {
61688
+ this._curLine = wrap(this._curLine, this.options.lineLength);
60970
61689
  this.outputBytes += this._curLine.length;
60971
61690
  this.push(Buffer.from(this._curLine, "ascii"));
60972
61691
  this._curLine = "";
@@ -61142,13 +61861,38 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61142
61861
  var qp = require_qp();
61143
61862
  var mimeTypes = require_mime_types();
61144
61863
  module.exports = {
61864
+ /**
61865
+ * Checks if a value is plaintext string (uses only printable 7bit chars)
61866
+ *
61867
+ * @param {String} value String to be tested
61868
+ * @returns {Boolean} true if it is a plaintext string
61869
+ */
61145
61870
  isPlainText(value, isParam) {
61146
61871
  return typeof value === "string" && !(isParam ? /[\x00-\x08\x0b\x0c\x0e-\x1f"\u0080-\uFFFF]/ : /[\x00-\x08\x0b\x0c\x0e-\x1f\u0080-\uFFFF]/).test(value);
61147
61872
  },
61873
+ /**
61874
+ * Checks if a multi line string containes lines longer than the selected value.
61875
+ *
61876
+ * Useful when detecting if a mail message needs any processing at all –
61877
+ * if only plaintext characters are used and lines are short, then there is
61878
+ * no need to encode the values in any way. If the value is plaintext but has
61879
+ * longer lines then allowed, then use format=flowed
61880
+ *
61881
+ * @param {Number} lineLength Max line length to check for
61882
+ * @returns {Boolean} Returns true if there is at least one line longer than lineLength chars
61883
+ */
61148
61884
  hasLongerLines(str, lineLength) {
61149
61885
  if (str.length > 128 * 1024) return true;
61150
61886
  return new RegExp("^.{" + (lineLength + 1) + ",}", "m").test(str);
61151
61887
  },
61888
+ /**
61889
+ * Encodes a string or an Buffer to an UTF-8 MIME Word (rfc2047)
61890
+ *
61891
+ * @param {String|Buffer} data String to be encoded
61892
+ * @param {String} mimeWordEncoding='Q' Encoding for the mime word, either Q or B
61893
+ * @param {Number} [maxLength=0] If set, split mime words into several chunks if needed
61894
+ * @return {String} Single or several mime words joined together
61895
+ */
61152
61896
  encodeWord(data, mimeWordEncoding, maxLength) {
61153
61897
  mimeWordEncoding = (mimeWordEncoding || "Q").toString().toUpperCase().trim().charAt(0);
61154
61898
  maxLength = maxLength || 0;
@@ -61184,6 +61928,15 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61184
61928
  else if (mimeWordEncoding === "B") encodedStr = base64.encode(data);
61185
61929
  return "=?" + toCharset + "?" + mimeWordEncoding + "?" + encodedStr + (encodedStr.substr(-2) === "?=" ? "" : "?=");
61186
61930
  },
61931
+ /**
61932
+ * Finds word sequences with non ascii text and converts these to mime words
61933
+ *
61934
+ * @param {String} value String to be encoded
61935
+ * @param {String} mimeWordEncoding='Q' Encoding for the mime word, either Q or B
61936
+ * @param {Number} [maxLength=0] If set, split mime words into several chunks if needed
61937
+ * @param {Boolean} [encodeAll=false] If true and the value needs encoding then encodes entire string, not just the smallest match
61938
+ * @return {String} String with possible mime words
61939
+ */
61187
61940
  encodeWords(value, mimeWordEncoding, maxLength, encodeAll) {
61188
61941
  maxLength = maxLength || 0;
61189
61942
  const firstMatch = value.match(/(?:^|\s)([^\s]*["\u0080-\uFFFF])/);
@@ -61195,6 +61948,13 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61195
61948
  const endIndex = lastMatch.index + (lastMatch[1] || "").length;
61196
61949
  return (startIndex ? value.substr(0, startIndex) : "") + this.encodeWord(value.substring(startIndex, endIndex), mimeWordEncoding || "Q", maxLength) + (endIndex < value.length ? value.substr(endIndex) : "");
61197
61950
  },
61951
+ /**
61952
+ * Joins parsed header value together as 'value; param1=value1; param2=value2'
61953
+ * PS: We are following RFC 822 for the list of special characters that we need to keep in quotes.
61954
+ * Refer: https://www.w3.org/Protocols/rfc1341/4_Content-Type.html
61955
+ * @param {Object} structured Parsed header value
61956
+ * @return {String} joined header value
61957
+ */
61198
61958
  buildHeaderValue(structured) {
61199
61959
  const paramsArray = [];
61200
61960
  Object.keys(structured.params || {}).forEach((param) => {
@@ -61208,6 +61968,21 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61208
61968
  });
61209
61969
  return structured.value + (paramsArray.length ? "; " + paramsArray.join("; ") : "");
61210
61970
  },
61971
+ /**
61972
+ * Encodes a string or an Buffer to an UTF-8 Parameter Value Continuation encoding (rfc2231)
61973
+ * Useful for splitting long parameter values.
61974
+ *
61975
+ * For example
61976
+ * title="unicode string"
61977
+ * becomes
61978
+ * title*0*=utf-8''unicode
61979
+ * title*1*=%20string
61980
+ *
61981
+ * @param {String|Buffer} data String to be encoded
61982
+ * @param {Number} [maxLength=50] Max length for generated chunks
61983
+ * @param {String} [fromCharset='UTF-8'] Source sharacter set
61984
+ * @return {Array} A list of encoded keys and headers
61985
+ */
61211
61986
  buildHeaderParam(key, data, maxLength) {
61212
61987
  const list = [];
61213
61988
  let encodedStr = typeof data === "string" ? data : (data || "").toString();
@@ -61284,6 +62059,21 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61284
62059
  value: item.line
61285
62060
  }));
61286
62061
  },
62062
+ /**
62063
+ * Parses a header value with key=value arguments into a structured
62064
+ * object.
62065
+ *
62066
+ * parseHeaderValue('content-type: text/plain; CHARSET='UTF-8'') ->
62067
+ * {
62068
+ * 'value': 'text/plain',
62069
+ * 'params': {
62070
+ * 'charset': 'UTF-8'
62071
+ * }
62072
+ * }
62073
+ *
62074
+ * @param {String} str Header value
62075
+ * @return {Object} Header value as a parsed structure
62076
+ */
61287
62077
  parseHeaderValue(str) {
61288
62078
  const response = {
61289
62079
  value: false,
@@ -61356,8 +62146,31 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61356
62146
  });
61357
62147
  return response;
61358
62148
  },
62149
+ /**
62150
+ * Returns file extension for a content type string. If no suitable extensions
62151
+ * are found, 'bin' is used as the default extension
62152
+ *
62153
+ * @param {String} mimeType Content type to be checked for
62154
+ * @return {String} File extension
62155
+ */
61359
62156
  detectExtension: (mimeType) => mimeTypes.detectExtension(mimeType),
62157
+ /**
62158
+ * Returns content type for a file extension. If no suitable content types
62159
+ * are found, 'application/octet-stream' is used as the default content type
62160
+ *
62161
+ * @param {String} extension Extension to be checked for
62162
+ * @return {String} File extension
62163
+ */
61360
62164
  detectMimeType: (extension) => mimeTypes.detectMimeType(extension),
62165
+ /**
62166
+ * Folds long lines, useful for folding header lines (afterSpace=false) and
62167
+ * flowed text (afterSpace=true)
62168
+ *
62169
+ * @param {String} str String to be folded
62170
+ * @param {Number} [lineLength=76] Maximum length of a line
62171
+ * @param {Boolean} afterSpace If true, leave a space in th end of a line
62172
+ * @return {String} String with folded lines
62173
+ */
61361
62174
  foldLines(str, lineLength, afterSpace) {
61362
62175
  str = (str || "").toString();
61363
62176
  lineLength = lineLength || 76;
@@ -61384,6 +62197,13 @@ var require_mime_funcs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61384
62197
  }
61385
62198
  return result;
61386
62199
  },
62200
+ /**
62201
+ * Splits a mime encoded string. Needed for dividing mime words into smaller chunks
62202
+ *
62203
+ * @param {String} str Mime encoded string to be split up
62204
+ * @param {Number} maxlen Maximum length of characters for one part (minimum 12)
62205
+ * @return {Array} Split string
62206
+ */
61387
62207
  splitMimeEncodedString: (str, maxlen) => {
61388
62208
  const lines = [];
61389
62209
  let curLine, match, chr, done;
@@ -61799,8 +62619,8 @@ var require_le_unix = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61799
62619
  //#endregion
61800
62620
  //#region node_modules/nodemailer/lib/mime-node/index.js
61801
62621
  var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61802
- var crypto$9 = __require("crypto");
61803
- var fs$4 = __require("fs");
62622
+ var crypto$8 = __require("crypto");
62623
+ var fs$3 = __require("fs");
61804
62624
  var punycode = require_punycode();
61805
62625
  var { PassThrough: PassThrough$2 } = __require("stream");
61806
62626
  var shared = require_shared();
@@ -61830,7 +62650,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
61830
62650
  /**
61831
62651
  * shared part of the unique multipart boundary
61832
62652
  */
61833
- this.baseBoundary = options.baseBoundary || crypto$9.randomBytes(8).toString("hex");
62653
+ this.baseBoundary = options.baseBoundary || crypto$8.randomBytes(8).toString("hex");
61834
62654
  this.boundaryPrefix = options.boundaryPrefix || "--_NmP";
61835
62655
  this.disableFileAccess = !!options.disableFileAccess;
61836
62656
  this.disableUrlAccess = !!options.disableUrlAccess;
@@ -62509,7 +63329,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62509
63329
  });
62510
63330
  return contentStream;
62511
63331
  }
62512
- return fs$4.createReadStream(content.path);
63332
+ return fs$3.createReadStream(content.path);
62513
63333
  }
62514
63334
  if (content && typeof content.href === "string") {
62515
63335
  if (this.disableUrlAccess) {
@@ -62717,7 +63537,7 @@ var require_mime_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62717
63537
  2,
62718
63538
  2,
62719
63539
  6
62720
- ].reduce((prev, len) => prev + "-" + crypto$9.randomBytes(len).toString("hex"), crypto$9.randomBytes(4).toString("hex")) + "@" + (this.getEnvelope().from || this.hostname || "localhost").split("@").pop() + ">";
63540
+ ].reduce((prev, len) => prev + "-" + crypto$8.randomBytes(len).toString("hex"), crypto$8.randomBytes(4).toString("hex")) + "@" + (this.getEnvelope().from || this.hostname || "localhost").split("@").pop() + ">";
62721
63541
  }
62722
63542
  };
62723
63543
  }));
@@ -63182,14 +64002,14 @@ var require_message_parser = /* @__PURE__ */ __commonJSMin(((exports, module) =>
63182
64002
  //#region node_modules/nodemailer/lib/dkim/relaxed-body.js
63183
64003
  var require_relaxed_body = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63184
64004
  var { Transform: Transform$2 } = __require("stream");
63185
- var crypto$8 = __require("crypto");
64005
+ var crypto$7 = __require("crypto");
63186
64006
  var RelaxedBody = class extends Transform$2 {
63187
64007
  constructor(options) {
63188
64008
  super();
63189
64009
  options = options || {};
63190
64010
  this.chunkBuffer = [];
63191
64011
  this.chunkBufferLen = 0;
63192
- this.bodyHash = crypto$8.createHash(options.hashAlgo || "sha1");
64012
+ this.bodyHash = crypto$7.createHash(options.hashAlgo || "sha1");
63193
64013
  this.remainder = "";
63194
64014
  this.byteLength = 0;
63195
64015
  this.debug = options.debug;
@@ -63268,7 +64088,7 @@ var require_relaxed_body = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63268
64088
  var require_sign = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63269
64089
  var punycode = require_punycode();
63270
64090
  var mimeFuncs = require_mime_funcs();
63271
- var crypto$7 = __require("crypto");
64091
+ var crypto$6 = __require("crypto");
63272
64092
  /**
63273
64093
  * Returns DKIM signature header line
63274
64094
  *
@@ -63285,7 +64105,7 @@ var require_sign = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63285
64105
  const canonicalizedHeaderData = relaxedHeaders(headers, options.headerFieldNames || "From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive", options.skipFields);
63286
64106
  const dkimHeader = generateDKIMHeader(options.domainName, options.keySelector, canonicalizedHeaderData.fieldNames, hashAlgo, bodyHash);
63287
64107
  canonicalizedHeaderData.headers += "dkim-signature:" + relaxedHeaderLine(dkimHeader);
63288
- const signer = crypto$7.createSign(("rsa-" + hashAlgo).toUpperCase());
64108
+ const signer = crypto$6.createSign(("rsa-" + hashAlgo).toUpperCase());
63289
64109
  signer.update(canonicalizedHeaderData.headers);
63290
64110
  let signature;
63291
64111
  try {
@@ -63347,9 +64167,9 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63347
64167
  var RelaxedBody = require_relaxed_body();
63348
64168
  var sign = require_sign();
63349
64169
  var { PassThrough: PassThrough$1 } = __require("stream");
63350
- var fs$3 = __require("fs");
64170
+ var fs$2 = __require("fs");
63351
64171
  var path$2 = __require("path");
63352
- var crypto$6 = __require("crypto");
64172
+ var crypto$5 = __require("crypto");
63353
64173
  var DKIM_ALGO = "sha256";
63354
64174
  var MAX_MESSAGE_SIZE = 2 * 1024 * 1024;
63355
64175
  var DKIMSigner = class {
@@ -63362,7 +64182,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63362
64182
  this.chunks = [];
63363
64183
  this.chunklen = 0;
63364
64184
  this.readPos = 0;
63365
- this.cachePath = this.cacheDir ? path$2.join(this.cacheDir, "message." + Date.now() + "-" + crypto$6.randomBytes(14).toString("hex")) : false;
64185
+ this.cachePath = this.cacheDir ? path$2.join(this.cacheDir, "message." + Date.now() + "-" + crypto$5.randomBytes(14).toString("hex")) : false;
63366
64186
  this.cache = false;
63367
64187
  this.headers = false;
63368
64188
  this.bodyHash = false;
@@ -63380,10 +64200,10 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63380
64200
  }
63381
64201
  cleanup() {
63382
64202
  if (!this.cache || !this.cachePath) return;
63383
- fs$3.unlink(this.cachePath, () => false);
64203
+ fs$2.unlink(this.cachePath, () => false);
63384
64204
  }
63385
64205
  createReadCache() {
63386
- this.cache = fs$3.createReadStream(this.cachePath);
64206
+ this.cache = fs$2.createReadStream(this.cachePath);
63387
64207
  this.cache.once("error", (err) => {
63388
64208
  this.cleanup();
63389
64209
  this.output.emit("error", err);
@@ -63429,7 +64249,7 @@ var require_dkim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63429
64249
  }
63430
64250
  createWriteCache() {
63431
64251
  this.output.usingCache = true;
63432
- this.cache = fs$3.createWriteStream(this.cachePath);
64252
+ this.cache = fs$2.createWriteStream(this.cachePath);
63433
64253
  this.cache.once("error", (err) => {
63434
64254
  this.cleanup();
63435
64255
  this.relaxedBody.unpipe(this.cache);
@@ -63821,7 +64641,7 @@ var require_mailer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
63821
64641
  var MailMessage = require_mail_message();
63822
64642
  var net$2 = __require("net");
63823
64643
  var dns = __require("dns");
63824
- var crypto$5 = __require("crypto");
64644
+ var crypto$4 = __require("crypto");
63825
64645
  /**
63826
64646
  * Creates an object for exposing the Mail API
63827
64647
  *
@@ -64070,7 +64890,7 @@ var require_mailer = /* @__PURE__ */ __commonJSMin(((exports, module) => {
64070
64890
  if (err) return callback(err);
64071
64891
  let cidCounter = 0;
64072
64892
  html = (html || "").toString().replace(/(<img\b[^<>]{0,1024} src\s{0,20}=[\s"']{0,20})(data:([^;]+);[^"'>\s]+)/gi, (match, prefix, dataUri, mimeType) => {
64073
- const cid = crypto$5.randomBytes(10).toString("hex") + "@localhost";
64893
+ const cid = crypto$4.randomBytes(10).toString("hex") + "@localhost";
64074
64894
  if (!mail.data.attachments) mail.data.attachments = [];
64075
64895
  if (!Array.isArray(mail.data.attachments)) mail.data.attachments = [].concat(mail.data.attachments || []);
64076
64896
  mail.data.attachments.push({
@@ -64179,7 +64999,7 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
64179
64999
  var net$1 = __require("net");
64180
65000
  var tls = __require("tls");
64181
65001
  var os$1 = __require("os");
64182
- var crypto$4 = __require("crypto");
65002
+ var crypto$3 = __require("crypto");
64183
65003
  var DataStream = require_data_stream();
64184
65004
  var { PassThrough } = __require("stream");
64185
65005
  var shared = require_shared();
@@ -64234,7 +65054,7 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
64234
65054
  var SMTPConnection = class extends EventEmitter$4 {
64235
65055
  constructor(options) {
64236
65056
  super(options);
64237
- this.id = crypto$4.randomBytes(8).toString("base64").replace(/\W/g, "");
65057
+ this.id = crypto$3.randomBytes(8).toString("base64").replace(/\W/g, "");
64238
65058
  this.stage = "init";
64239
65059
  this.options = options || {};
64240
65060
  this.secureConnection = !!this.options.secure;
@@ -65182,7 +66002,7 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
65182
66002
  const challengeMatch = str.match(/^334\s+(.+)$/);
65183
66003
  if (!challengeMatch) return callback(this._formatError("Invalid login sequence while waiting for server challenge string", "EAUTH", str, "AUTH CRAM-MD5"));
65184
66004
  const base64decoded = Buffer.from(challengeMatch[1], "base64").toString("ascii");
65185
- const hmacMD5 = crypto$4.createHmac("md5", this._auth.credentials.pass);
66005
+ const hmacMD5 = crypto$3.createHmac("md5", this._auth.credentials.pass);
65186
66006
  hmacMD5.update(base64decoded);
65187
66007
  const prepended = this._auth.credentials.user + " " + hmacMD5.digest("hex");
65188
66008
  this._responseActions.push((str) => {
@@ -65408,7 +66228,7 @@ var require_smtp_connection = /* @__PURE__ */ __commonJSMin(((exports, module) =
65408
66228
  var require_xoauth2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65409
66229
  var { Stream } = __require("stream");
65410
66230
  var nmfetch = require_fetch();
65411
- var crypto$3 = __require("crypto");
66231
+ var crypto$2 = __require("crypto");
65412
66232
  var shared = require_shared();
65413
66233
  var errors = require_errors();
65414
66234
  /**
@@ -65724,7 +66544,7 @@ var require_xoauth2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65724
66544
  */
65725
66545
  jwtSignRS256(payload) {
65726
66546
  payload = ["{\"alg\":\"RS256\",\"typ\":\"JWT\"}", JSON.stringify(payload)].map((val) => this.toBase64URL(val)).join(".");
65727
- const signature = crypto$3.createSign("RSA-SHA256").update(payload).sign(this.options.privateKey);
66547
+ const signature = crypto$2.createSign("RSA-SHA256").update(payload).sign(this.options.privateKey);
65728
66548
  return payload + "." + this.toBase64URL(signature);
65729
66549
  }
65730
66550
  };
@@ -68331,7 +69151,6 @@ var PMHQBase = class extends Service {
68331
69151
  super(ctx, "pmhq");
68332
69152
  this.ctx = ctx;
68333
69153
  this.logger = ctx.logger("pmhq");
68334
- this.logger.info(process.argv);
68335
69154
  const { pmhqHost, pmhqPort } = this.getPMHQHostPort();
68336
69155
  this.httpUrl = `http://${pmhqHost}:${pmhqPort}/`;
68337
69156
  this.wsUrl = `ws://${pmhqHost}:${pmhqPort}/ws`;
@@ -68589,6 +69408,15 @@ var PMHQBase = class extends Service {
68589
69408
  });
68590
69409
  this.call(funcName, args, timeout).then((r) => {
68591
69410
  firstResult = r;
69411
+ if (options.onCallResult) {
69412
+ const result = options.onCallResult(r);
69413
+ if (result !== void 0) {
69414
+ resolve(result);
69415
+ this.removeReceiveHook(hookId);
69416
+ if (timeoutId) clearTimeout(timeoutId);
69417
+ return;
69418
+ }
69419
+ }
68592
69420
  if (r && Object.hasOwn(r, "result") && +r.result !== 0) {
68593
69421
  const displayReq = inspect(args, {
68594
69422
  depth: 10,
@@ -69460,7 +70288,7 @@ function UserMixin(Base) {
69460
70288
  qid: bytes[27394]?.toString() ?? "",
69461
70289
  level: numbers[105],
69462
70290
  regTime: numbers[20026] ?? 0,
69463
- longNick: bytes[102].toString(),
70291
+ longNick: bytes[102]?.toString() ?? "",
69464
70292
  city: bytes[20020]?.toString() ?? "",
69465
70293
  country: bytes[20003]?.toString() ?? "",
69466
70294
  birthdayYear: bytes[20031]?.[0] << 8 | bytes[20031]?.[1],
@@ -69670,7 +70498,7 @@ async function onLoad() {
69670
70498
  ctx.plugin(EmailNotificationService);
69671
70499
  };
69672
70500
  const isDocker = isDockerEnvironment();
69673
- let qrCodeTriggered = false;
70501
+ let lastQrCodeTime = 0;
69674
70502
  const printLoginQrCode = async () => {
69675
70503
  try {
69676
70504
  const data = await ctx.ntLoginApi.getLoginQrCode();
@@ -69702,8 +70530,9 @@ async function onLoad() {
69702
70530
  return;
69703
70531
  }
69704
70532
  if (!pmhqSelfInfo.online) {
69705
- if (isDocker && !qrCodeTriggered) {
69706
- qrCodeTriggered = true;
70533
+ const now = Date.now();
70534
+ if (isDocker && now - lastQrCodeTime > 12e4) {
70535
+ lastQrCodeTime = now;
69707
70536
  printLoginQrCode();
69708
70537
  }
69709
70538
  setTimeout(checkLogin, 1e3);
@@ -69732,6 +70561,7 @@ async function onLoad() {
69732
70561
  ctx.inject(["logger"], (ctx) => {
69733
70562
  ctx.logger.exporter(new Log(ctx, true));
69734
70563
  ctx.logger.info(`LLBot ${version$2}`);
70564
+ ctx.logger.info(process.argv);
69735
70565
  });
69736
70566
  ctx.inject([
69737
70567
  "pmhq",