apple-mail-mcp 2.10.4 → 2.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/index.js +2275 -735
  2. package/package.json +1 -1
package/build/index.js CHANGED
@@ -23224,9 +23224,9 @@ var require_pino = __commonJS({
23224
23224
  }
23225
23225
  });
23226
23226
 
23227
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/logger.js
23227
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/logger.js
23228
23228
  var require_logger = __commonJS({
23229
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/logger.js"(exports, module) {
23229
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/logger.js"(exports, module) {
23230
23230
  "use strict";
23231
23231
  var logger = require_pino()();
23232
23232
  logger.level = "trace";
@@ -48419,9 +48419,9 @@ var require_mailsplit = __commonJS({
48419
48419
  }
48420
48420
  });
48421
48421
 
48422
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/limited-passthrough.js
48422
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/limited-passthrough.js
48423
48423
  var require_limited_passthrough = __commonJS({
48424
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/limited-passthrough.js"(exports, module) {
48424
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/limited-passthrough.js"(exports, module) {
48425
48425
  "use strict";
48426
48426
  var { Transform } = __require("stream");
48427
48427
  var LimitedPassthrough = class extends Transform {
@@ -48455,12 +48455,31 @@ var require_limited_passthrough = __commonJS({
48455
48455
  }
48456
48456
  });
48457
48457
 
48458
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-stream.js
48458
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/limits.js
48459
+ var require_limits = __commonJS({
48460
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/limits.js"(exports, module) {
48461
+ "use strict";
48462
+ var MAX_LITERAL_SIZE = 1024 * 1024 * 1024;
48463
+ var MAX_LINE_SIZE = MAX_LITERAL_SIZE;
48464
+ var normalizeLimit = (value, defaultValue) => Number.isInteger(value) && value >= 0 ? value : defaultValue;
48465
+ var createLiteralTooLargeError = (literalSize, maxSize, reason) => {
48466
+ const err = new Error(`Literal size ${literalSize} exceeds ${reason || `maximum allowed size of ${maxSize} bytes`}`);
48467
+ err.code = "LiteralTooLarge";
48468
+ err.literalSize = literalSize;
48469
+ err.maxSize = maxSize;
48470
+ return err;
48471
+ };
48472
+ module.exports = { MAX_LITERAL_SIZE, MAX_LINE_SIZE, normalizeLimit, createLiteralTooLargeError };
48473
+ }
48474
+ });
48475
+
48476
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-stream.js
48459
48477
  var require_imap_stream = __commonJS({
48460
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-stream.js"(exports, module) {
48478
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-stream.js"(exports, module) {
48461
48479
  "use strict";
48462
48480
  var Transform = __require("stream").Transform;
48463
48481
  var logger = require_logger();
48482
+ var { MAX_LITERAL_SIZE, MAX_LINE_SIZE, normalizeLimit, createLiteralTooLargeError } = require_limits();
48464
48483
  var LINE = 1;
48465
48484
  var LITERAL = 2;
48466
48485
  var LF = 10;
@@ -48469,8 +48488,6 @@ var require_imap_stream = __commonJS({
48469
48488
  var NUM_9 = 57;
48470
48489
  var CURLY_OPEN = 123;
48471
48490
  var CURLY_CLOSE = 125;
48472
- var MAX_LITERAL_SIZE = 1024 * 1024 * 1024;
48473
- var MAX_LINE_SIZE = MAX_LITERAL_SIZE;
48474
48491
  var ImapStream = class extends Transform {
48475
48492
  /**
48476
48493
  * Creates a new ImapStream instance.
@@ -48483,10 +48500,15 @@ var require_imap_stream = __commonJS({
48483
48500
  * @param {number} [options.maxLineLength] - Maximum allowed length (in bytes) of a single
48484
48501
  * line (a response without a literal). Defaults to MAX_LITERAL_SIZE (1GB). Guards against a
48485
48502
  * malicious or broken server that never sends a line terminator, which would otherwise grow
48486
- * the internal line buffer without bound.
48503
+ * the internal line buffer without bound. The line terminator counts toward the limit, and a
48504
+ * line exactly at the limit is accepted. Exceeding it is terminal: the stream is destroyed
48505
+ * with a `LineTooLarge` error and no further input is parsed.
48487
48506
  * @param {number} [options.maxLiteralSize] - Maximum allowed size (in bytes) of a single
48488
48507
  * literal block. Defaults to MAX_LITERAL_SIZE (1GB). Lower it to bound peak memory
48489
- * allocation against a malicious or broken server announcing an oversized literal.
48508
+ * allocation against a malicious or broken server announcing an oversized literal. A literal
48509
+ * exactly at the limit is accepted. Exceeding it is terminal: the stream is destroyed with a
48510
+ * `LiteralTooLarge` error, the marker line is not emitted, and no byte of the rejected
48511
+ * literal body is parsed as protocol.
48490
48512
  */
48491
48513
  constructor(options) {
48492
48514
  super({
@@ -48501,8 +48523,8 @@ var require_imap_stream = __commonJS({
48501
48523
  cid: this.cid
48502
48524
  });
48503
48525
  this.readBytesCounter = 0;
48504
- this.maxLineLength = Number.isInteger(this.options.maxLineLength) && this.options.maxLineLength >= 0 ? this.options.maxLineLength : MAX_LINE_SIZE;
48505
- this.maxLiteralSize = Number.isInteger(this.options.maxLiteralSize) && this.options.maxLiteralSize >= 0 ? this.options.maxLiteralSize : MAX_LITERAL_SIZE;
48526
+ this.maxLineLength = normalizeLimit(this.options.maxLineLength, MAX_LINE_SIZE);
48527
+ this.maxLiteralSize = normalizeLimit(this.options.maxLiteralSize, MAX_LITERAL_SIZE);
48506
48528
  this.state = LINE;
48507
48529
  this.literalWaiting = 0;
48508
48530
  this.inputBuffer = [];
@@ -48514,6 +48536,47 @@ var require_imap_stream = __commonJS({
48514
48536
  this.secureConnection = this.options.secureConnection;
48515
48537
  this.processingInput = false;
48516
48538
  this.inputQueue = [];
48539
+ this.activeInput = null;
48540
+ this.pendingPush = null;
48541
+ }
48542
+ /**
48543
+ * Terminally fails the stream. Used for response limit violations and for any other
48544
+ * error raised while parsing.
48545
+ *
48546
+ * The stream is destroyed instead of only emitting `error`: emitting on a Transform leaves
48547
+ * it running, so the caller would keep scanning the rejected payload and could emit it as
48548
+ * protocol (an oversized literal body contains attacker-chosen CRLF delimited lines).
48549
+ * Destroying stops all parsing, drops the offending line, and releases every queued
48550
+ * transform callback exactly once (see `_destroy()`).
48551
+ *
48552
+ * `destroyed` (set synchronously by destroy()) is the single liveness flag every other path
48553
+ * checks, so a second failure attempt is a no-op and nothing is parsed after the first.
48554
+ *
48555
+ * @param {Error} err - The error to destroy the stream with.
48556
+ * @returns {boolean} Always false, so callers can `return this.failStream(err)`.
48557
+ */
48558
+ failStream(err) {
48559
+ if (this.destroyed) {
48560
+ return false;
48561
+ }
48562
+ this.destroy(err);
48563
+ return false;
48564
+ }
48565
+ /**
48566
+ * Releases a queued input chunk's transform callback exactly once, signalling the writable
48567
+ * side that the chunk was consumed. The mirror image of ImapFlow's releaseStreamData(), which
48568
+ * releases the readable items this stream pushes downstream.
48569
+ *
48570
+ * @param {Object} item - Queue entry holding the chunk and its transform callback.
48571
+ */
48572
+ releaseInput(item) {
48573
+ if (!item || item.released) {
48574
+ return;
48575
+ }
48576
+ item.released = true;
48577
+ if (typeof item.next === "function") {
48578
+ item.next();
48579
+ }
48517
48580
  }
48518
48581
  /**
48519
48582
  * Checks whether the given line buffer ends with an IMAP literal size marker
@@ -48550,12 +48613,7 @@ var require_imap_stream = __commonJS({
48550
48613
  if (c === CURLY_OPEN && numBytes.length) {
48551
48614
  const literalSize = Number(Buffer.from(numBytes).toString());
48552
48615
  if (literalSize > this.maxLiteralSize) {
48553
- const err = new Error(`Literal size ${literalSize} exceeds maximum allowed size of ${this.maxLiteralSize} bytes`);
48554
- err.code = "LiteralTooLarge";
48555
- err.literalSize = literalSize;
48556
- err.maxSize = this.maxLiteralSize;
48557
- this.emit("error", err);
48558
- return false;
48616
+ return this.failStream(createLiteralTooLargeError(literalSize, this.maxLiteralSize));
48559
48617
  }
48560
48618
  this.state = LITERAL;
48561
48619
  this.literalWaiting = literalSize;
@@ -48565,6 +48623,24 @@ var require_imap_stream = __commonJS({
48565
48623
  }
48566
48624
  return false;
48567
48625
  }
48626
+ /**
48627
+ * Enforces the configured line-length cap for a projected line length. The projected length
48628
+ * covers every byte of the line, the line terminator included, whether or not the line was
48629
+ * split across input chunks. A line exactly at the limit is accepted.
48630
+ *
48631
+ * @param {number} lineLength - Total length the current line would reach.
48632
+ * @returns {boolean} True if the line is within the limit, false if the stream was failed.
48633
+ */
48634
+ checkLineLength(lineLength) {
48635
+ if (lineLength <= this.maxLineLength) {
48636
+ return true;
48637
+ }
48638
+ const err = new Error(`Line length ${lineLength} exceeds maximum allowed size of ${this.maxLineLength} bytes`);
48639
+ err.code = "LineTooLarge";
48640
+ err.lineLength = lineLength;
48641
+ err.maxSize = this.maxLineLength;
48642
+ return this.failStream(err);
48643
+ }
48568
48644
  /**
48569
48645
  * Processes a single input chunk of raw data. In LINE state, scans for LF-terminated
48570
48646
  * lines and checks for literal markers. In LITERAL state, collects the expected number
@@ -48577,7 +48653,7 @@ var require_imap_stream = __commonJS({
48577
48653
  */
48578
48654
  async processInputChunk(chunk, startPos) {
48579
48655
  startPos = startPos || 0;
48580
- if (startPos >= chunk.length) {
48656
+ if (this.destroyed || startPos >= chunk.length) {
48581
48657
  return;
48582
48658
  }
48583
48659
  switch (this.state) {
@@ -48585,13 +48661,21 @@ var require_imap_stream = __commonJS({
48585
48661
  let lineStart = startPos;
48586
48662
  for (let i = startPos, len = chunk.length; i < len; i++) {
48587
48663
  if (chunk[i] === LF) {
48588
- this.lineBuffer.push(chunk.slice(lineStart, i + 1));
48664
+ let segment = chunk.slice(lineStart, i + 1);
48665
+ if (!this.checkLineLength(this.lineBytes + segment.length)) {
48666
+ return;
48667
+ }
48668
+ this.lineBuffer.push(segment);
48589
48669
  lineStart = i + 1;
48590
- let line = Buffer.concat(this.lineBuffer);
48591
- this.inputBuffer.push(line);
48670
+ let line = this.lineBuffer.length === 1 ? this.lineBuffer[0] : Buffer.concat(this.lineBuffer);
48592
48671
  this.lineBuffer = [];
48593
48672
  this.lineBytes = 0;
48594
- if (this.checkLiteralMarker(line)) {
48673
+ let isLiteralMarker = this.checkLiteralMarker(line);
48674
+ if (this.destroyed) {
48675
+ return;
48676
+ }
48677
+ this.inputBuffer.push(line);
48678
+ if (isLiteralMarker) {
48595
48679
  return await this.processInputChunk(chunk, lineStart);
48596
48680
  }
48597
48681
  let payload = this.inputBuffer.length === 1 ? this.inputBuffer[0] : Buffer.concat(this.inputBuffer);
@@ -48609,24 +48693,23 @@ var require_imap_stream = __commonJS({
48609
48693
  if (payload.length) {
48610
48694
  let trailingAfterLine = lineStart < chunk.length || this.inputQueue.length > 0;
48611
48695
  await new Promise((resolve2) => {
48696
+ this.pendingPush = resolve2;
48612
48697
  this.push({ payload, literals, next: resolve2, trailingAfterLine });
48613
48698
  });
48699
+ this.pendingPush = null;
48700
+ if (this.destroyed) {
48701
+ return;
48702
+ }
48614
48703
  }
48615
48704
  }
48616
48705
  }
48617
48706
  }
48618
48707
  if (lineStart < chunk.length) {
48619
48708
  let tail = chunk.slice(lineStart);
48620
- let lineLength = this.lineBytes + tail.length;
48621
- if (lineLength > this.maxLineLength) {
48622
- const err = new Error(`Line length ${lineLength} exceeds maximum allowed size of ${this.maxLineLength} bytes`);
48623
- err.code = "LineTooLarge";
48624
- err.lineLength = lineLength;
48625
- err.maxSize = this.maxLineLength;
48626
- this.emit("error", err);
48709
+ if (!this.checkLineLength(this.lineBytes + tail.length)) {
48627
48710
  return;
48628
48711
  }
48629
- this.lineBytes = lineLength;
48712
+ this.lineBytes += tail.length;
48630
48713
  this.lineBuffer.push(tail);
48631
48714
  }
48632
48715
  break;
@@ -48659,9 +48742,11 @@ var require_imap_stream = __commonJS({
48659
48742
  async processInput() {
48660
48743
  let data;
48661
48744
  let processedCount = 0;
48662
- while (data = this.inputQueue.shift()) {
48745
+ while (!this.destroyed && (data = this.inputQueue.shift())) {
48746
+ this.activeInput = data;
48663
48747
  await this.processInputChunk(data.chunk);
48664
- data.next();
48748
+ this.activeInput = null;
48749
+ this.releaseInput(data);
48665
48750
  processedCount++;
48666
48751
  if (processedCount % 10 === 0) {
48667
48752
  await new Promise((resolve2) => setImmediate(resolve2));
@@ -48695,10 +48780,13 @@ var require_imap_stream = __commonJS({
48695
48780
  cid: this.cid
48696
48781
  });
48697
48782
  }
48783
+ if (this.destroyed) {
48784
+ return next();
48785
+ }
48698
48786
  this.inputQueue.push({ chunk, next });
48699
48787
  if (!this.processingInput) {
48700
48788
  this.processingInput = true;
48701
- this.processInput().catch((err) => this.emit("error", err)).finally(() => this.processingInput = false);
48789
+ this.processInput().catch((err) => this.failStream(err)).finally(() => this.processingInput = false);
48702
48790
  }
48703
48791
  }
48704
48792
  /**
@@ -48722,11 +48810,15 @@ var require_imap_stream = __commonJS({
48722
48810
  this.lineBytes = 0;
48723
48811
  this.literalBuffer = [];
48724
48812
  this.literals = [];
48813
+ if (typeof this.pendingPush === "function") {
48814
+ const resolve2 = this.pendingPush;
48815
+ this.pendingPush = null;
48816
+ resolve2();
48817
+ }
48818
+ this.releaseInput(this.activeInput);
48819
+ this.activeInput = null;
48725
48820
  while (this.inputQueue.length) {
48726
- const item = this.inputQueue.shift();
48727
- if (typeof item.next === "function") {
48728
- item.next();
48729
- }
48821
+ this.releaseInput(this.inputQueue.shift());
48730
48822
  }
48731
48823
  callback(err);
48732
48824
  }
@@ -48735,9 +48827,9 @@ var require_imap_stream = __commonJS({
48735
48827
  }
48736
48828
  });
48737
48829
 
48738
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-formal-syntax.js
48830
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-formal-syntax.js
48739
48831
  var require_imap_formal_syntax = __commonJS({
48740
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-formal-syntax.js"(exports, module) {
48832
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-formal-syntax.js"(exports, module) {
48741
48833
  "use strict";
48742
48834
  function expandRange(start, end) {
48743
48835
  let chars = [];
@@ -48881,11 +48973,12 @@ var require_imap_formal_syntax = __commonJS({
48881
48973
  }
48882
48974
  });
48883
48975
 
48884
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/token-parser.js
48976
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/token-parser.js
48885
48977
  var require_token_parser = __commonJS({
48886
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/token-parser.js"(exports, module) {
48978
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/token-parser.js"(exports, module) {
48887
48979
  "use strict";
48888
48980
  var imapFormalSyntax = require_imap_formal_syntax();
48981
+ var { MAX_LITERAL_SIZE, normalizeLimit, createLiteralTooLargeError } = require_limits();
48889
48982
  var STATE_ATOM = 1;
48890
48983
  var STATE_LITERAL = 2;
48891
48984
  var STATE_NORMAL = 3;
@@ -48905,11 +48998,14 @@ var require_token_parser = __commonJS({
48905
48998
  * @param {Object} [options] - Parser options.
48906
48999
  * @param {boolean} [options.literalPlus] - Whether the LITERAL+ extension is in use.
48907
49000
  * @param {Array<Buffer>} [options.literals] - Pre-parsed literal values from the input stream.
49001
+ * @param {number} [options.maxLiteralSize] - Maximum size (in bytes) of a literal parsed inline
49002
+ * from the input, i.e. when no pre-parsed literal buffers were supplied. Defaults to 1GB.
48908
49003
  */
48909
49004
  constructor(parent, startPos, str2, options) {
48910
49005
  this.str = (str2 || "").toString();
48911
49006
  this.options = options || {};
48912
49007
  this.parent = parent;
49008
+ this.maxLiteralSize = normalizeLimit(this.options.maxLiteralSize, MAX_LITERAL_SIZE);
48913
49009
  this.tree = this.currentNode = this.createNode();
48914
49010
  this.pos = startPos || 0;
48915
49011
  this.currentNode.type = "TREE";
@@ -49319,6 +49415,9 @@ var require_token_parser = __commonJS({
49319
49415
  }
49320
49416
  this.currentNode.literalLength = Number(this.currentNode.literalLength);
49321
49417
  if (!this.currentNode.literalLength) {
49418
+ if (this.options.literals && this.options.literals.length) {
49419
+ this.currentNode.value = this.options.literals.shift();
49420
+ }
49322
49421
  this.currentNode.endPos = this.pos + i;
49323
49422
  this.currentNode.isClosed = true;
49324
49423
  this.currentNode = this.currentNode.parentNode;
@@ -49333,6 +49432,18 @@ var require_token_parser = __commonJS({
49333
49432
  this.state = STATE_NORMAL;
49334
49433
  checkSP();
49335
49434
  } else {
49435
+ let available = this.str.length - i - 1;
49436
+ let literalLength = this.currentNode.literalLength;
49437
+ if (literalLength > this.maxLiteralSize || literalLength > available) {
49438
+ let overMax = literalLength > this.maxLiteralSize;
49439
+ let error2 = createLiteralTooLargeError(
49440
+ literalLength,
49441
+ overMax ? this.maxLiteralSize : available,
49442
+ overMax ? null : `the ${available} bytes available in the input`
49443
+ );
49444
+ error2.parserContext = { input: this.str, pos: this.pos + i, chr };
49445
+ throw error2;
49446
+ }
49336
49447
  this.currentNode.started = true;
49337
49448
  this.currentNode.chBuffer = Buffer.alloc(this.currentNode.literalLength);
49338
49449
  this.currentNode.chPos = 0;
@@ -49431,9 +49542,9 @@ var require_token_parser = __commonJS({
49431
49542
  }
49432
49543
  });
49433
49544
 
49434
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/parser-instance.js
49545
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/parser-instance.js
49435
49546
  var require_parser_instance = __commonJS({
49436
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/parser-instance.js"(exports, module) {
49547
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/parser-instance.js"(exports, module) {
49437
49548
  "use strict";
49438
49549
  var imapFormalSyntax = require_imap_formal_syntax();
49439
49550
  var { TokenParser } = require_token_parser();
@@ -49620,9 +49731,9 @@ var require_parser_instance = __commonJS({
49620
49731
  }
49621
49732
  });
49622
49733
 
49623
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-parser.js
49734
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-parser.js
49624
49735
  var require_imap_parser = __commonJS({
49625
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-parser.js"(exports, module) {
49736
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-parser.js"(exports, module) {
49626
49737
  "use strict";
49627
49738
  var imapFormalSyntax = require_imap_formal_syntax();
49628
49739
  var { ParserInstance } = require_parser_instance();
@@ -49677,9 +49788,9 @@ var require_imap_parser = __commonJS({
49677
49788
  }
49678
49789
  });
49679
49790
 
49680
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-compiler.js
49791
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-compiler.js
49681
49792
  var require_imap_compiler = __commonJS({
49682
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-compiler.js"(exports, module) {
49793
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-compiler.js"(exports, module) {
49683
49794
  "use strict";
49684
49795
  var imapFormalSyntax = require_imap_formal_syntax();
49685
49796
  var formatRespEntry = (entry, returnEmpty) => {
@@ -49757,9 +49868,9 @@ var require_imap_compiler = __commonJS({
49757
49868
  if (isLogging) {
49758
49869
  resp.push(formatRespEntry('"(* ' + node.value.length + 'B literal *)"'));
49759
49870
  } else {
49760
- let literalLength = !node.value ? 0 : Math.max(node.value.length, 0);
49761
- let canAppend = !asArray || literalPlus || literalMinus && literalLength <= 4096;
49762
- let usePlus = canAppend && (literalMinus || literalPlus);
49871
+ let literalLength = !node.value ? 0 : Buffer.isBuffer(node.value) ? node.value.length : Buffer.byteLength(node.value.toString());
49872
+ let usePlus = literalPlus || literalMinus && literalLength <= 4096;
49873
+ let canAppend = !asArray || usePlus;
49763
49874
  resp.push(formatRespEntry(`${node.isLiteral8 ? "~" : ""}{${literalLength}${usePlus ? "+" : ""}}\r
49764
49875
  `));
49765
49876
  if (canAppend) {
@@ -49827,9 +49938,9 @@ var require_imap_compiler = __commonJS({
49827
49938
  }
49828
49939
  });
49829
49940
 
49830
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-handler.js
49941
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-handler.js
49831
49942
  var require_imap_handler = __commonJS({
49832
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/handler/imap-handler.js"(exports, module) {
49943
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/handler/imap-handler.js"(exports, module) {
49833
49944
  "use strict";
49834
49945
  var parser = require_imap_parser();
49835
49946
  var compiler = require_imap_compiler();
@@ -49840,20 +49951,22 @@ var require_imap_handler = __commonJS({
49840
49951
  }
49841
49952
  });
49842
49953
 
49843
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/package.json
49954
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/package.json
49844
49955
  var require_package4 = __commonJS({
49845
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/package.json"(exports, module) {
49956
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/package.json"(exports, module) {
49846
49957
  module.exports = {
49847
49958
  name: "imapflow",
49848
- version: "1.4.8",
49959
+ version: "1.6.3",
49849
49960
  description: "IMAP Client for Node",
49850
49961
  main: "lib/imap-flow.js",
49851
49962
  types: "lib/imap-flow.d.ts",
49852
49963
  scripts: {
49853
49964
  test: "grunt",
49854
49965
  coverage: "c8 --reporter=text --reporter=html npx nodeunit test/*-test.js",
49966
+ "test:rev2": "bash test/integration/run-rev2-tests.sh",
49855
49967
  update: "rm -rf node_modules package-lock.json && ncu -u && npm install",
49856
49968
  format: 'prettier --write "**/*.{js,json,md,yml,yaml}" --ignore-path .prettierignore',
49969
+ "format:check": 'prettier --check "**/*.{js,json,md,yml,yaml}" --ignore-path .prettierignore',
49857
49970
  lint: "eslint ."
49858
49971
  },
49859
49972
  repository: {
@@ -49873,16 +49986,16 @@ var require_package4 = __commonJS({
49873
49986
  homepage: "https://imapflow.com/",
49874
49987
  devDependencies: {
49875
49988
  "@eslint/js": "10.0.1",
49876
- "@types/node": "26.1.1",
49989
+ "@types/node": "26.1.2",
49877
49990
  c8: "12.0.0",
49878
- eslint: "10.7.0",
49991
+ eslint: "10.8.0",
49879
49992
  "eslint-config-nodemailer": "1.2.0",
49880
49993
  "eslint-config-prettier": "10.1.8",
49881
49994
  grunt: "1.6.2",
49882
49995
  "grunt-cli": "1.5.0",
49883
49996
  "grunt-contrib-nodeunit": "5.0.0",
49884
49997
  "grunt-eslint": "26.0.0",
49885
- prettier: "3.9.5",
49998
+ prettier: "3.9.6",
49886
49999
  proxyquire: "^2.1.3",
49887
50000
  typescript: "7.0.2"
49888
50001
  },
@@ -49893,7 +50006,6 @@ var require_package4 = __commonJS({
49893
50006
  libbase64: "1.3.0",
49894
50007
  libmime: "5.4.1",
49895
50008
  libqp: "2.1.1",
49896
- nodemailer: "9.0.3",
49897
50009
  pino: "10.3.1",
49898
50010
  socks: "2.8.9"
49899
50011
  }
@@ -51268,9 +51380,9 @@ var require_util3 = __commonJS({
51268
51380
  }
51269
51381
  });
51270
51382
 
51271
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/address-error.js
51383
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/address-error.js
51272
51384
  var require_address_error = __commonJS({
51273
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/address-error.js"(exports) {
51385
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/address-error.js"(exports) {
51274
51386
  "use strict";
51275
51387
  Object.defineProperty(exports, "__esModule", { value: true });
51276
51388
  exports.AddressError = void 0;
@@ -51285,15 +51397,16 @@ var require_address_error = __commonJS({
51285
51397
  }
51286
51398
  });
51287
51399
 
51288
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/common.js
51400
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/common.js
51289
51401
  var require_common = __commonJS({
51290
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/common.js"(exports) {
51402
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/common.js"(exports) {
51291
51403
  "use strict";
51292
51404
  Object.defineProperty(exports, "__esModule", { value: true });
51293
51405
  exports.isInSubnet = isInSubnet;
51294
51406
  exports.isHostInSubnet = isHostInSubnet;
51295
51407
  exports.isCorrect = isCorrect;
51296
51408
  exports.prefixLengthFromMask = prefixLengthFromMask;
51409
+ exports.assertByteArray = assertByteArray;
51297
51410
  exports.numberToPaddedHex = numberToPaddedHex;
51298
51411
  exports.stringToPaddedHex = stringToPaddedHex;
51299
51412
  exports.testBit = testBit;
@@ -51308,7 +51421,7 @@ var require_common = __commonJS({
51308
51421
  return this.mask(address.subnetMask) === address.mask();
51309
51422
  }
51310
51423
  function isCorrect(defaultBits) {
51311
- return function() {
51424
+ return function isCorrectForm() {
51312
51425
  if (this.addressMinusSuffix !== this.correctForm()) {
51313
51426
  return false;
51314
51427
  }
@@ -51332,6 +51445,16 @@ var require_common = __commonJS({
51332
51445
  }
51333
51446
  return firstZero;
51334
51447
  }
51448
+ function assertByteArray(bytes, byteCount, family, minimum) {
51449
+ if (bytes.length !== byteCount) {
51450
+ throw new address_error_1.AddressError(`${family} addresses require exactly ${byteCount} bytes`);
51451
+ }
51452
+ for (let i = 0; i < bytes.length; i++) {
51453
+ if (!Number.isInteger(bytes[i]) || bytes[i] < minimum || bytes[i] > 255) {
51454
+ throw new address_error_1.AddressError(`All bytes must be integers between ${minimum} and 255`);
51455
+ }
51456
+ }
51457
+ }
51335
51458
  function numberToPaddedHex(number3) {
51336
51459
  return number3.toString(16).padStart(2, "0");
51337
51460
  }
@@ -51349,9 +51472,9 @@ var require_common = __commonJS({
51349
51472
  }
51350
51473
  });
51351
51474
 
51352
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v4/constants.js
51475
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v4/constants.js
51353
51476
  var require_constants3 = __commonJS({
51354
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v4/constants.js"(exports) {
51477
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v4/constants.js"(exports) {
51355
51478
  "use strict";
51356
51479
  Object.defineProperty(exports, "__esModule", { value: true });
51357
51480
  exports.RE_SUBNET_STRING = exports.RE_ADDRESS = exports.GROUPS = exports.BITS = void 0;
@@ -51362,9 +51485,9 @@ var require_constants3 = __commonJS({
51362
51485
  }
51363
51486
  });
51364
51487
 
51365
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/ipv4.js
51488
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/ipv4.js
51366
51489
  var require_ipv4 = __commonJS({
51367
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/ipv4.js"(exports) {
51490
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/ipv4.js"(exports) {
51368
51491
  "use strict";
51369
51492
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
51370
51493
  if (k2 === void 0) k2 = k;
@@ -51436,7 +51559,7 @@ var require_ipv4 = __commonJS({
51436
51559
  try {
51437
51560
  new _Address4(address);
51438
51561
  return true;
51439
- } catch (e) {
51562
+ } catch {
51440
51563
  return false;
51441
51564
  }
51442
51565
  }
@@ -51686,7 +51809,7 @@ var require_ipv4 = __commonJS({
51686
51809
  * @returns {Address4}
51687
51810
  */
51688
51811
  static fromBigInt(bigInt) {
51689
- if (bigInt < 0n || bigInt > 0xffffffffn) {
51812
+ if (bigInt < BigInt(0) || bigInt > BigInt(4294967295)) {
51690
51813
  throw new address_error_1.AddressError("IPv4 BigInt must be in the range 0 to 2**32 - 1");
51691
51814
  }
51692
51815
  return _Address4.fromHex(bigInt.toString(16).padStart(8, "0"));
@@ -51699,14 +51822,7 @@ var require_ipv4 = __commonJS({
51699
51822
  * @returns {Address4}
51700
51823
  */
51701
51824
  static fromByteArray(bytes) {
51702
- if (bytes.length !== 4) {
51703
- throw new address_error_1.AddressError("IPv4 addresses require exactly 4 bytes");
51704
- }
51705
- for (let i = 0; i < bytes.length; i++) {
51706
- if (!Number.isInteger(bytes[i]) || bytes[i] < 0 || bytes[i] > 255) {
51707
- throw new address_error_1.AddressError("All bytes must be integers between 0 and 255");
51708
- }
51709
- }
51825
+ common.assertByteArray(bytes, 4, "IPv4", 0);
51710
51826
  return this.fromUnsignedByteArray(bytes);
51711
51827
  }
51712
51828
  /**
@@ -51838,9 +51954,9 @@ var require_ipv4 = __commonJS({
51838
51954
  }
51839
51955
  });
51840
51956
 
51841
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v6/constants.js
51957
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v6/constants.js
51842
51958
  var require_constants4 = __commonJS({
51843
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v6/constants.js"(exports) {
51959
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v6/constants.js"(exports) {
51844
51960
  "use strict";
51845
51961
  Object.defineProperty(exports, "__esModule", { value: true });
51846
51962
  exports.RE_URL_WITH_PORT = exports.RE_URL = exports.RE_ZONE_STRING = exports.RE_SUBNET_STRING = exports.RE_BAD_ADDRESS = exports.RE_BAD_CHARACTERS = exports.TYPES = exports.SCOPES = exports.GROUPS = exports.BITS = void 0;
@@ -51895,9 +52011,9 @@ var require_constants4 = __commonJS({
51895
52011
  }
51896
52012
  });
51897
52013
 
51898
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v6/helpers.js
52014
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v6/helpers.js
51899
52015
  var require_helpers = __commonJS({
51900
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v6/helpers.js"(exports) {
52016
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v6/helpers.js"(exports) {
51901
52017
  "use strict";
51902
52018
  Object.defineProperty(exports, "__esModule", { value: true });
51903
52019
  exports.escapeHtml = escapeHtml;
@@ -51934,9 +52050,9 @@ var require_helpers = __commonJS({
51934
52050
  }
51935
52051
  });
51936
52052
 
51937
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v6/regular-expressions.js
52053
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v6/regular-expressions.js
51938
52054
  var require_regular_expressions = __commonJS({
51939
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/v6/regular-expressions.js"(exports) {
52055
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/v6/regular-expressions.js"(exports) {
51940
52056
  "use strict";
51941
52057
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
51942
52058
  if (k2 === void 0) k2 = k;
@@ -52026,9 +52142,9 @@ var require_regular_expressions = __commonJS({
52026
52142
  }
52027
52143
  });
52028
52144
 
52029
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/ipv6.js
52145
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/ipv6.js
52030
52146
  var require_ipv6 = __commonJS({
52031
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/ipv6.js"(exports) {
52147
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/ipv6.js"(exports) {
52032
52148
  "use strict";
52033
52149
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
52034
52150
  if (k2 === void 0) k2 = k;
@@ -52153,7 +52269,7 @@ var require_ipv6 = __commonJS({
52153
52269
  try {
52154
52270
  new _Address6(address);
52155
52271
  return true;
52156
- } catch (e) {
52272
+ } catch {
52157
52273
  return false;
52158
52274
  }
52159
52275
  }
@@ -52168,7 +52284,7 @@ var require_ipv6 = __commonJS({
52168
52284
  * address.correctForm(); // '::e8:d4a5:1000'
52169
52285
  */
52170
52286
  static fromBigInt(bigInt) {
52171
- if (bigInt < 0n || bigInt > (1n << BigInt(constants6.BITS)) - 1n) {
52287
+ if (bigInt < BigInt(0) || bigInt > (BigInt(1) << BigInt(constants6.BITS)) - BigInt(1)) {
52172
52288
  throw new address_error_1.AddressError("IPv6 BigInt must be in the range 0 to 2**128 - 1");
52173
52289
  }
52174
52290
  const hex = bigInt.toString(16).padStart(32, "0");
@@ -52189,6 +52305,7 @@ var require_ipv6 = __commonJS({
52189
52305
  * addressAndPort.port; // 8080
52190
52306
  */
52191
52307
  static fromURL(url) {
52308
+ var _a;
52192
52309
  let host;
52193
52310
  let port = null;
52194
52311
  let result;
@@ -52213,7 +52330,7 @@ var require_ipv6 = __commonJS({
52213
52330
  port: null
52214
52331
  };
52215
52332
  }
52216
- host = result[1] ?? result[2];
52333
+ host = (_a = result[1]) !== null && _a !== void 0 ? _a : result[2];
52217
52334
  }
52218
52335
  if (port) {
52219
52336
  port = parseInt(port, 10);
@@ -52834,7 +52951,14 @@ var require_ipv6 = __commonJS({
52834
52951
  bits = prefixBits.slice(0, 96) + v4Bits;
52835
52952
  } else {
52836
52953
  const beforeU = 64 - pl;
52837
- bits = prefixBits.slice(0, pl) + v4Bits.slice(0, beforeU) + "00000000" + v4Bits.slice(beforeU) + "0".repeat(128 - 72 - (32 - beforeU));
52954
+ bits = [
52955
+ prefixBits.slice(0, pl),
52956
+ v4Bits.slice(0, beforeU),
52957
+ // Bits 64 to 71 are the reserved u octet and are always zero.
52958
+ "00000000",
52959
+ v4Bits.slice(beforeU),
52960
+ "0".repeat(128 - 72 - (32 - beforeU))
52961
+ ].join("");
52838
52962
  }
52839
52963
  const hex = BigInt(`0b${bits}`).toString(16).padStart(32, "0");
52840
52964
  const groups = [];
@@ -52900,19 +53024,28 @@ var require_ipv6 = __commonJS({
52900
53024
  /**
52901
53025
  * Convert a byte array to an Address6 object.
52902
53026
  *
53027
+ * Accepts unsigned bytes (0 to 255) or signed bytes (-128 to 127, as an
53028
+ * `Int8Array` or a Java `byte[]` holds them), folding signed values to their
53029
+ * unsigned equivalent. Throws `AddressError` unless given exactly 16
53030
+ * integers from -128 to 255.
53031
+ *
52903
53032
  * To convert from a Node.js `Buffer`, spread it: `Address6.fromByteArray([...buf])`.
52904
53033
  * @returns {Address6}
52905
53034
  */
52906
53035
  static fromByteArray(bytes) {
53036
+ common.assertByteArray(bytes, 16, "IPv6", -128);
52907
53037
  return this.fromUnsignedByteArray(bytes.map(unsignByte));
52908
53038
  }
52909
53039
  /**
52910
53040
  * Convert an unsigned byte array to an Address6 object.
52911
53041
  *
53042
+ * Throws `AddressError` unless given exactly 16 integers from 0 to 255.
53043
+ *
52912
53044
  * To convert from a Node.js `Buffer`, spread it: `Address6.fromUnsignedByteArray([...buf])`.
52913
53045
  * @returns {Address6}
52914
53046
  */
52915
53047
  static fromUnsignedByteArray(bytes) {
53048
+ common.assertByteArray(bytes, 16, "IPv6", 0);
52916
53049
  const BYTE_MAX = BigInt("256");
52917
53050
  let result = BigInt("0");
52918
53051
  let multiplier = BigInt("1");
@@ -53243,9 +53376,9 @@ var require_ipv6 = __commonJS({
53243
53376
  }
53244
53377
  });
53245
53378
 
53246
- // node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/ip-address.js
53379
+ // node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/ip-address.js
53247
53380
  var require_ip_address = __commonJS({
53248
- "node_modules/.pnpm/ip-address@10.3.1/node_modules/ip-address/dist/ip-address.js"(exports) {
53381
+ "node_modules/.pnpm/ip-address@10.4.0/node_modules/ip-address/dist/ip-address.js"(exports) {
53249
53382
  "use strict";
53250
53383
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
53251
53384
  if (k2 === void 0) k2 = k;
@@ -54152,21 +54285,130 @@ var require_build = __commonJS({
54152
54285
  }
54153
54286
  });
54154
54287
 
54155
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/proxy-connection.js
54288
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/connection-deadline.js
54289
+ var require_connection_deadline = __commonJS({
54290
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/connection-deadline.js"(exports, module) {
54291
+ "use strict";
54292
+ var CONNECT_TIMEOUT = 90 * 1e3;
54293
+ var ConnectionDeadline = class {
54294
+ /**
54295
+ * @param {Number} [timeout] Configured connection timeout in milliseconds. Normalized once
54296
+ * here; 0 and any other falsy or invalid value fall back to the 90 second default.
54297
+ */
54298
+ constructor(timeout) {
54299
+ this.timeout = Number(timeout) || CONNECT_TIMEOUT;
54300
+ this.startedAt = Date.now();
54301
+ }
54302
+ /**
54303
+ * @returns {Number} Milliseconds left in the budget, never negative.
54304
+ */
54305
+ remaining() {
54306
+ return Math.max(0, this.timeout - (Date.now() - this.startedAt));
54307
+ }
54308
+ /**
54309
+ * @returns {Error} The shared `CONNECT_TIMEOUT` error.
54310
+ */
54311
+ error() {
54312
+ let err = new Error("Failed to establish connection in required time");
54313
+ err.code = "CONNECT_TIMEOUT";
54314
+ err.details = { connectionTimeout: this.timeout };
54315
+ return err;
54316
+ }
54317
+ /**
54318
+ * Maps a dependency's own expiry onto the shared `CONNECT_TIMEOUT` shape, so callers see one
54319
+ * timeout error whichever layer noticed first. The original error is kept as `_err`. Anything
54320
+ * that is not a timeout is returned unchanged.
54321
+ *
54322
+ * @param {Error} err Error raised by a dependency during a connection phase.
54323
+ * @returns {Error} Either the normalized timeout error or the original error.
54324
+ */
54325
+ normalize(err) {
54326
+ if (!err || err.code === "CONNECT_TIMEOUT") {
54327
+ return err;
54328
+ }
54329
+ if (err.code !== "ETIMEDOUT" && !/timed out/i.test(err.message || "")) {
54330
+ return err;
54331
+ }
54332
+ let normalized = this.error();
54333
+ normalized._err = err;
54334
+ return normalized;
54335
+ }
54336
+ /**
54337
+ * Throws before a phase is started if the budget is already used up, so no work is begun
54338
+ * that could only ever time out.
54339
+ */
54340
+ check() {
54341
+ if (!this.remaining()) {
54342
+ throw this.error();
54343
+ }
54344
+ }
54345
+ /**
54346
+ * Races a phase against the remaining budget. The timer is always cleared, so a completed
54347
+ * phase never leaves a pending timer behind.
54348
+ *
54349
+ * @param {Promise} promise Phase to run under the deadline.
54350
+ * @returns {Promise<*>} Resolves with the phase result, rejects with `CONNECT_TIMEOUT`.
54351
+ */
54352
+ async race(promise) {
54353
+ this.check();
54354
+ let timer = null;
54355
+ try {
54356
+ return await Promise.race([
54357
+ promise,
54358
+ new Promise((resolve2, reject) => {
54359
+ timer = setTimeout(() => reject(this.error()), this.remaining());
54360
+ })
54361
+ ]);
54362
+ } finally {
54363
+ clearTimeout(timer);
54364
+ }
54365
+ }
54366
+ };
54367
+ module.exports = { ConnectionDeadline, CONNECT_TIMEOUT };
54368
+ }
54369
+ });
54370
+
54371
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/proxy-connection.js
54156
54372
  var require_proxy_connection = __commonJS({
54157
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/proxy-connection.js"(exports, module) {
54373
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/proxy-connection.js"(exports, module) {
54158
54374
  "use strict";
54159
- var httpProxyClient = require_http_proxy_client();
54160
54375
  var { SocksClient } = require_build();
54161
- var util2 = __require("util");
54162
- var httpProxyClientAsync = util2.promisify(httpProxyClient);
54163
54376
  var dns = __require("dns").promises;
54164
54377
  var net = __require("net");
54165
- var hidePassword = (proxyUrl) => {
54166
- if (proxyUrl.password) {
54167
- proxyUrl.password = "(hidden)";
54378
+ var tls = __require("tls");
54379
+ var { ConnectionDeadline } = require_connection_deadline();
54380
+ var MAX_RESPONSE_HEADER_BYTES = 64 * 1024;
54381
+ var DEFAULT_SOCKS_PORT = 1080;
54382
+ var unbracketAddress = (host) => typeof host === "string" && host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
54383
+ var formatAuthority = (host, port) => {
54384
+ let address = unbracketAddress(host);
54385
+ return net.isIPv6(address) ? `[${address}]:${port}` : `${address}:${port}`;
54386
+ };
54387
+ var redactUrl = (proxyUrl) => {
54388
+ let redacted = new URL(proxyUrl.href);
54389
+ if (redacted.password) {
54390
+ redacted.password = "(hidden)";
54391
+ }
54392
+ return redacted.href;
54393
+ };
54394
+ var proxyError = (message, code) => {
54395
+ let err = new Error(message);
54396
+ err.code = code || "ProxyError";
54397
+ return err;
54398
+ };
54399
+ var decodeUserInfo = (value) => {
54400
+ try {
54401
+ return decodeURIComponent(value);
54402
+ } catch {
54403
+ return value;
54168
54404
  }
54169
54405
  };
54406
+ var stripProxyCredentials = (err) => {
54407
+ if (err && typeof err === "object" && err.options) {
54408
+ delete err.options;
54409
+ }
54410
+ return err;
54411
+ };
54170
54412
  var attachEarlyErrorHandler = (logger, socket) => {
54171
54413
  if (!socket || typeof socket.on !== "function") {
54172
54414
  return;
@@ -54182,108 +54424,232 @@ var require_proxy_connection = __commonJS({
54182
54424
  socket._earlyErrorHandler = null;
54183
54425
  }
54184
54426
  };
54185
- var proxyConnection = async (logger, connectionUrl, host, port) => {
54186
- let proxyUrl = new URL(connectionUrl);
54187
- let protocol = proxyUrl.protocol.replace(/:$/, "").toLowerCase();
54188
- if (!net.isIP(host)) {
54189
- let resolveResult = await dns.resolve(host);
54190
- if (resolveResult && resolveResult.length) {
54191
- host = resolveResult[0];
54427
+ var httpConnect = async ({ logger, proxyUrl, secureProxy, proxyHost, proxyPort, host, port, deadline }) => {
54428
+ let destinationPort = Number(port) || 0;
54429
+ if (!destinationPort || /[\r\n]/.test(host)) {
54430
+ throw proxyError("Invalid proxy destination", "EPROXY");
54431
+ }
54432
+ let authority = formatAuthority(host, destinationPort);
54433
+ let remaining = deadline.remaining();
54434
+ if (!remaining) {
54435
+ throw deadline.error();
54436
+ }
54437
+ let socket = null;
54438
+ return await new Promise((resolve2, reject) => {
54439
+ let settled = false;
54440
+ let timer = null;
54441
+ let headers = "";
54442
+ const onSocketData = (chunk) => {
54443
+ let searchFrom = Math.max(0, headers.length - 3);
54444
+ headers += chunk.toString("binary");
54445
+ let terminator = headers.indexOf("\r\n\r\n", searchFrom);
54446
+ if (terminator < 0) {
54447
+ if (headers.length > MAX_RESPONSE_HEADER_BYTES) {
54448
+ fail(proxyError("Proxy response headers too large", "EPROXY"));
54449
+ }
54450
+ return;
54451
+ }
54452
+ socket.removeListener("data", onSocketData);
54453
+ socket.pause();
54454
+ let headerBytes = terminator + 4;
54455
+ let consumedFromChunk = chunk.length - (headers.length - headerBytes);
54456
+ if (consumedFromChunk < chunk.length) {
54457
+ socket.unshift(chunk.subarray(consumedFromChunk));
54458
+ }
54459
+ headers = headers.slice(0, terminator);
54460
+ let status = headers.match(/^HTTP\/\d+\.\d+ (\d+)/i);
54461
+ if (!status || (status[1] || "").charAt(0) !== "2") {
54462
+ return fail(proxyError(`Invalid response from proxy${status ? `: ${status[1]}` : ""}`, "EPROXY"));
54463
+ }
54464
+ succeed();
54465
+ };
54466
+ const cleanup = () => {
54467
+ clearTimeout(timer);
54468
+ timer = null;
54469
+ if (socket) {
54470
+ socket.removeListener("connect", onConnected);
54471
+ socket.removeListener("data", onSocketData);
54472
+ socket.removeListener("error", fail);
54473
+ socket.removeListener("close", onEarlyClose);
54474
+ }
54475
+ };
54476
+ function fail(err) {
54477
+ if (settled) {
54478
+ return;
54479
+ }
54480
+ settled = true;
54481
+ cleanup();
54482
+ if (socket) {
54483
+ socket.destroy();
54484
+ }
54485
+ reject(err);
54192
54486
  }
54487
+ function succeed() {
54488
+ settled = true;
54489
+ cleanup();
54490
+ resolve2(socket);
54491
+ }
54492
+ function onEarlyClose() {
54493
+ fail(proxyError("Proxy closed the connection before the tunnel was established", "EPROXY"));
54494
+ }
54495
+ timer = setTimeout(() => fail(deadline.error()), remaining);
54496
+ let connectOptions = { host: proxyHost, port: proxyPort };
54497
+ if (secureProxy) {
54498
+ if (!net.isIP(proxyHost)) {
54499
+ connectOptions.servername = proxyHost;
54500
+ }
54501
+ }
54502
+ function onConnected() {
54503
+ let requestHeaders = {
54504
+ Host: authority,
54505
+ Connection: "close"
54506
+ };
54507
+ if (proxyUrl.username || proxyUrl.password) {
54508
+ let credentials = `${decodeUserInfo(proxyUrl.username)}:${decodeUserInfo(proxyUrl.password)}`;
54509
+ requestHeaders["Proxy-Authorization"] = `Basic ${Buffer.from(credentials).toString("base64")}`;
54510
+ }
54511
+ socket.write(
54512
+ `CONNECT ${authority} HTTP/1.1\r
54513
+ ` + Object.keys(requestHeaders).map((key) => `${key}: ${requestHeaders[key]}`).join("\r\n") + "\r\n\r\n"
54514
+ );
54515
+ socket.on("data", onSocketData);
54516
+ }
54517
+ socket = secureProxy ? tls.connect(connectOptions, onConnected) : net.connect(connectOptions, onConnected);
54518
+ socket.once("error", fail);
54519
+ socket.once("close", onEarlyClose);
54520
+ }).then((established) => {
54521
+ logger.info({
54522
+ msg: `Established a socket via HTTP proxy`,
54523
+ proxyUrl: redactUrl(proxyUrl),
54524
+ port,
54525
+ host
54526
+ });
54527
+ attachEarlyErrorHandler(logger, established);
54528
+ return established;
54529
+ }).catch((err) => {
54530
+ logger.error({
54531
+ msg: "Failed to establish a socket via HTTP proxy",
54532
+ proxyUrl: redactUrl(proxyUrl),
54533
+ port,
54534
+ host,
54535
+ err
54536
+ });
54537
+ throw err;
54538
+ });
54539
+ };
54540
+ var resolveIPv4 = async (hostname2, deadline) => {
54541
+ let addresses = await deadline.race(dns.resolve4(hostname2));
54542
+ if (!addresses || !addresses.length) {
54543
+ throw proxyError(`Could not resolve an IPv4 address for ${hostname2}`, "EPROXY");
54193
54544
  }
54545
+ return addresses[0];
54546
+ };
54547
+ var socksConnect = async ({ logger, proxyUrl, protocol, proxyHost, proxyPort, host, port, deadline }) => {
54548
+ let proxyType = protocol === "socks4" || protocol === "socks4a" ? 4 : 5;
54549
+ let destinationHost = unbracketAddress(host);
54550
+ try {
54551
+ if (proxyType === 4) {
54552
+ if (net.isIPv6(destinationHost)) {
54553
+ throw proxyError(`SOCKS4 and SOCKS4a cannot address IPv6 destinations (${destinationHost})`, "UnsupportedProxyAddress");
54554
+ }
54555
+ if (protocol === "socks4" && !net.isIP(destinationHost)) {
54556
+ destinationHost = await resolveIPv4(destinationHost, deadline);
54557
+ }
54558
+ }
54559
+ let connectionOpts = {
54560
+ proxy: {
54561
+ // The endpoint is handed to net.Socket.connect() by the dependency, so a hostname
54562
+ // is left unresolved and gets Node's normal lookup and connection behavior.
54563
+ host: proxyHost,
54564
+ port: proxyPort,
54565
+ type: proxyType
54566
+ },
54567
+ destination: {
54568
+ host: destinationHost,
54569
+ port
54570
+ },
54571
+ command: "connect",
54572
+ set_tcp_nodelay: true
54573
+ };
54574
+ if (proxyUrl.username || proxyUrl.password) {
54575
+ connectionOpts.proxy.userId = proxyUrl.username;
54576
+ connectionOpts.proxy.password = proxyUrl.password;
54577
+ }
54578
+ let remaining = deadline.remaining();
54579
+ if (!remaining) {
54580
+ throw deadline.error();
54581
+ }
54582
+ connectionOpts.timeout = remaining;
54583
+ const info = await deadline.race(SocksClient.createConnection(connectionOpts));
54584
+ if (!info || !info.socket) {
54585
+ throw proxyError("SOCKS proxy did not return a socket", "EPROXY");
54586
+ }
54587
+ logger.info({
54588
+ msg: "Established a socket via SOCKS proxy",
54589
+ proxyUrl: redactUrl(proxyUrl),
54590
+ port,
54591
+ host
54592
+ });
54593
+ attachEarlyErrorHandler(logger, info.socket);
54594
+ return info.socket;
54595
+ } catch (caught) {
54596
+ let err = deadline.normalize(stripProxyCredentials(caught));
54597
+ stripProxyCredentials(err._err);
54598
+ logger.error({
54599
+ msg: "Failed to establish a socket via SOCKS proxy",
54600
+ proxyUrl: redactUrl(proxyUrl),
54601
+ port,
54602
+ host,
54603
+ err
54604
+ });
54605
+ throw err;
54606
+ }
54607
+ };
54608
+ var proxyConnection = async (logger, connectionUrl, host, port, options) => {
54609
+ options = options || {};
54610
+ let deadline = options.deadline || new ConnectionDeadline(options.connectionTimeout);
54611
+ deadline.check();
54612
+ let proxyUrl = new URL(connectionUrl);
54613
+ let protocol = proxyUrl.protocol.replace(/:$/, "").toLowerCase();
54614
+ let proxyHost = unbracketAddress(proxyUrl.hostname);
54194
54615
  switch (protocol) {
54195
54616
  // Connect using a HTTP CONNECT method
54196
54617
  case "http":
54197
- case "https": {
54198
- try {
54199
- let socket = await httpProxyClientAsync(proxyUrl.href, port, host);
54200
- if (socket) {
54201
- hidePassword(proxyUrl);
54202
- logger.info({
54203
- msg: "Established a socket via HTTP proxy",
54204
- proxyUrl: proxyUrl.href,
54205
- port,
54206
- host
54207
- });
54208
- attachEarlyErrorHandler(logger, socket);
54209
- }
54210
- return socket;
54211
- } catch (err) {
54212
- hidePassword(proxyUrl);
54213
- logger.error({
54214
- msg: "Failed to establish a socket via HTTP proxy",
54215
- proxyUrl: proxyUrl.href,
54216
- port,
54217
- host,
54218
- err
54219
- });
54220
- throw err;
54221
- }
54222
- }
54618
+ case "https":
54619
+ return await httpConnect({
54620
+ logger,
54621
+ proxyUrl,
54622
+ secureProxy: protocol === "https",
54623
+ proxyHost,
54624
+ proxyPort: Number(proxyUrl.port) || (protocol === "https" ? 443 : 80),
54625
+ host,
54626
+ port,
54627
+ deadline
54628
+ });
54223
54629
  // SOCKS proxy
54224
54630
  case "socks":
54225
54631
  case "socks5":
54226
54632
  case "socks4":
54227
- case "socks4a": {
54228
- let proxyType = Number(protocol.replace(/\D/g, "")) || 5;
54229
- let targetHost = proxyUrl.hostname;
54230
- if (!net.isIP(targetHost)) {
54231
- let resolveResult = await dns.resolve(targetHost);
54232
- if (resolveResult && resolveResult.length) {
54233
- targetHost = resolveResult[0];
54234
- }
54235
- }
54236
- let connectionOpts = {
54237
- proxy: {
54238
- host: targetHost,
54239
- port: Number(proxyUrl.port) || 1080,
54240
- type: proxyType
54241
- },
54242
- destination: {
54243
- host,
54244
- port
54245
- },
54246
- command: "connect",
54247
- set_tcp_nodelay: true
54248
- };
54249
- if (proxyUrl.username || proxyUrl.password) {
54250
- connectionOpts.proxy.userId = proxyUrl.username;
54251
- connectionOpts.proxy.password = proxyUrl.password;
54252
- }
54253
- try {
54254
- const info = await SocksClient.createConnection(connectionOpts);
54255
- if (info && info.socket) {
54256
- hidePassword(proxyUrl);
54257
- logger.info({
54258
- msg: "Established a socket via SOCKS proxy",
54259
- proxyUrl: proxyUrl.href,
54260
- port,
54261
- host
54262
- });
54263
- attachEarlyErrorHandler(logger, info.socket);
54264
- }
54265
- return info.socket;
54266
- } catch (err) {
54267
- hidePassword(proxyUrl);
54268
- logger.error({
54269
- msg: "Failed to establish a socket via SOCKS proxy",
54270
- proxyUrl: proxyUrl.href,
54271
- port,
54272
- host,
54273
- err
54274
- });
54275
- throw err;
54276
- }
54277
- }
54633
+ case "socks4a":
54634
+ return await socksConnect({
54635
+ logger,
54636
+ proxyUrl,
54637
+ protocol,
54638
+ proxyHost,
54639
+ proxyPort: Number(proxyUrl.port) || DEFAULT_SOCKS_PORT,
54640
+ host,
54641
+ port,
54642
+ deadline
54643
+ });
54278
54644
  }
54279
54645
  };
54280
54646
  module.exports = { proxyConnection, detachEarlyErrorHandler };
54281
54647
  }
54282
54648
  });
54283
54649
 
54284
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/charsets.js
54650
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/charsets.js
54285
54651
  var require_charsets2 = __commonJS({
54286
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/charsets.js"(exports, module) {
54652
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/charsets.js"(exports, module) {
54287
54653
  "use strict";
54288
54654
  var CHARACTER_SETS = [
54289
54655
  "US-ASCII",
@@ -54560,9 +54926,9 @@ var require_charsets2 = __commonJS({
54560
54926
  }
54561
54927
  });
54562
54928
 
54563
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/jp-decoder.js
54929
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/jp-decoder.js
54564
54930
  var require_jp_decoder = __commonJS({
54565
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/jp-decoder.js"(exports, module) {
54931
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/jp-decoder.js"(exports, module) {
54566
54932
  "use strict";
54567
54933
  var { Transform } = __require("stream");
54568
54934
  var encodingJapanese = require_src();
@@ -54615,9 +54981,9 @@ var require_jp_decoder = __commonJS({
54615
54981
  }
54616
54982
  });
54617
54983
 
54618
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/tools.js
54984
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/tools.js
54619
54985
  var require_tools2 = __commonJS({
54620
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/tools.js"(exports, module) {
54986
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/tools.js"(exports, module) {
54621
54987
  "use strict";
54622
54988
  var libmime = require_libmime();
54623
54989
  var { resolveCharset } = require_charsets2();
@@ -54626,10 +54992,116 @@ var require_tools2 = __commonJS({
54626
54992
  var { JPDecoder } = require_jp_decoder();
54627
54993
  var iconv = require_lib();
54628
54994
  var FLAG_COLORS = ["red", "orange", "yellow", "green", "blue", "purple", "grey"];
54995
+ var EXPANDED_RANGE_LIMIT = 16777216;
54996
+ var IMAP4REV2_FOLDED_CAPABILITIES = /* @__PURE__ */ new Set([
54997
+ "ENABLE",
54998
+ "ESEARCH",
54999
+ "IDLE",
55000
+ "LIST-EXTENDED",
55001
+ "LIST-STATUS",
55002
+ "LITERAL-",
55003
+ "MOVE",
55004
+ "NAMESPACE",
55005
+ "SASL-IR",
55006
+ "SEARCHRES",
55007
+ "SPECIAL-USE",
55008
+ "STATUS=SIZE",
55009
+ "UIDPLUS",
55010
+ "UNSELECT"
55011
+ ]);
54629
55012
  var AuthenticationFailure = class extends Error {
54630
55013
  authenticationFailed = true;
54631
55014
  };
54632
55015
  var tools = {
55016
+ /**
55017
+ * Detaches a background timer from the event loop, so it cannot keep the process alive on its
55018
+ * own. Applied to every background timer (auto-IDLE, IDLE restart, fallback polling, throttle
55019
+ * back-off, held-lock diagnostics); connection and greeting deadlines are deliberately left
55020
+ * attached, because a caller is waiting for connect() to settle.
55021
+ *
55022
+ * @param {Object} timer - Timer handle returned by setTimeout
55023
+ * @returns {Object} The same timer handle
55024
+ */
55025
+ unrefTimer(timer) {
55026
+ if (timer && typeof timer.unref === "function") {
55027
+ timer.unref();
55028
+ }
55029
+ return timer;
55030
+ },
55031
+ /**
55032
+ * Checks whether IMAP4rev2 semantics are active for the connection: either the
55033
+ * client enabled IMAP4rev2 explicitly, or the server is rev2-only (advertises
55034
+ * IMAP4rev2 without IMAP4rev1), in which case rev2 is the base protocol without
55035
+ * any ENABLE (RFC 9051 Appendix A). UTF-8 mailbox names apply in both cases.
55036
+ *
55037
+ * @param {Object} connection - IMAP connection instance
55038
+ * @returns {Boolean} True if IMAP4rev2 semantics apply to this session
55039
+ */
55040
+ isRev2Active(connection) {
55041
+ return connection.enabled.has("IMAP4REV2") || connection.capabilities.has("IMAP4rev2") && !connection.capabilities.has("IMAP4rev1");
55042
+ },
55043
+ /**
55044
+ * Checks a capability, accounting for extensions that RFC 9051 folds into base
55045
+ * IMAP4rev2. Falls back to the plain capability lookup on IMAP4rev1 sessions,
55046
+ * so behavior against rev1 servers is unchanged.
55047
+ *
55048
+ * @param {Object} connection - IMAP connection instance
55049
+ * @param {String} capability - Capability name, e.g. 'UIDPLUS'
55050
+ * @returns {Boolean} True if the capability (or its rev2-folded equivalent) is available
55051
+ */
55052
+ hasCapability(connection, capability) {
55053
+ if (connection.capabilities.has(capability)) {
55054
+ return true;
55055
+ }
55056
+ return IMAP4REV2_FOLDED_CAPABILITIES.has(capability) && tools.isRev2Active(connection);
55057
+ },
55058
+ /**
55059
+ * Builds the attribute list for a STATUS request - the standalone STATUS command
55060
+ * or the LIST-STATUS return option - from a status query object. Items the current
55061
+ * session cannot request (RECENT under IMAP4rev2, HIGHESTMODSEQ without CONDSTORE)
55062
+ * are silently dropped.
55063
+ *
55064
+ * @param {Object} connection - IMAP connection instance
55065
+ * @param {Object} statusQuery - Status data items to request, e.g. {messages: true}
55066
+ * @returns {Object[]} Attribute token list for the command compiler
55067
+ */
55068
+ buildStatusQueryAttributes(connection, statusQuery) {
55069
+ let attributes = [];
55070
+ Object.keys(statusQuery || {}).forEach((key) => {
55071
+ if (!statusQuery[key]) {
55072
+ return;
55073
+ }
55074
+ switch (key.toUpperCase()) {
55075
+ case "MESSAGES":
55076
+ case "UIDNEXT":
55077
+ case "UIDVALIDITY":
55078
+ case "UNSEEN":
55079
+ attributes.push({ type: "ATOM", value: key.toUpperCase() });
55080
+ break;
55081
+ case "RECENT":
55082
+ if (!tools.isRev2Active(connection)) {
55083
+ attributes.push({ type: "ATOM", value: key.toUpperCase() });
55084
+ }
55085
+ break;
55086
+ case "HIGHESTMODSEQ":
55087
+ if (connection.capabilities.has("CONDSTORE")) {
55088
+ attributes.push({ type: "ATOM", value: key.toUpperCase() });
55089
+ }
55090
+ break;
55091
+ case "SIZE":
55092
+ if (tools.hasCapability(connection, "STATUS=SIZE")) {
55093
+ attributes.push({ type: "ATOM", value: key.toUpperCase() });
55094
+ }
55095
+ break;
55096
+ case "DELETED":
55097
+ if (tools.isRev2Active(connection) || connection.capabilities.has("QUOTA=RES-MESSAGE")) {
55098
+ attributes.push({ type: "ATOM", value: key.toUpperCase() });
55099
+ }
55100
+ break;
55101
+ }
55102
+ });
55103
+ return attributes;
55104
+ },
54633
55105
  /**
54634
55106
  * Encodes a mailbox path to modified UTF-7 if the server does not support UTF8=ACCEPT.
54635
55107
  *
@@ -54639,7 +55111,7 @@ var require_tools2 = __commonJS({
54639
55111
  */
54640
55112
  encodePath(connection, path) {
54641
55113
  path = (path || "").toString();
54642
- if (!connection.enabled.has("UTF8=ACCEPT") && /[&\x00-\x08\x0b-\x0c\x0e-\x1f\u0080-\uffff]/.test(path)) {
55114
+ if (!connection.enabled.has("UTF8=ACCEPT") && !tools.isRev2Active(connection) && /[&\x00-\x08\x0b-\x0c\x0e-\x1f\u0080-\uffff]/.test(path)) {
54643
55115
  try {
54644
55116
  path = iconv.encode(path, "utf-7-imap").toString();
54645
55117
  } catch {
@@ -54656,7 +55128,7 @@ var require_tools2 = __commonJS({
54656
55128
  */
54657
55129
  decodePath(connection, path) {
54658
55130
  path = (path || "").toString();
54659
- if (!connection.enabled.has("UTF8=ACCEPT") && /[&]/.test(path)) {
55131
+ if (!connection.enabled.has("UTF8=ACCEPT") && !tools.isRev2Active(connection) && /[&]/.test(path)) {
54660
55132
  try {
54661
55133
  path = iconv.decode(Buffer.from(path), "utf-7-imap").toString();
54662
55134
  } catch {
@@ -54717,6 +55189,10 @@ var require_tools2 = __commonJS({
54717
55189
  map.set("IMAP4rev1", true);
54718
55190
  return;
54719
55191
  }
55192
+ if (capability === "IMAP4REV2") {
55193
+ map.set("IMAP4rev2", true);
55194
+ return;
55195
+ }
54720
55196
  if (capability.startsWith("APPENDLIMIT=")) {
54721
55197
  let splitPos = capability.indexOf("=");
54722
55198
  let appendLimit = Number(capability.substr(splitPos + 1)) || 0;
@@ -54798,7 +55274,7 @@ var require_tools2 = __commonJS({
54798
55274
  existing.path = folder.path;
54799
55275
  existing.subscribed = !!folder.subscribed;
54800
55276
  existing.listed = !!folder.listed;
54801
- existing.status = !!folder.status;
55277
+ existing.status = folder.status;
54802
55278
  if (folder.specialUse) {
54803
55279
  existing.specialUse = folder.specialUse;
54804
55280
  }
@@ -54815,7 +55291,7 @@ var require_tools2 = __commonJS({
54815
55291
  path: folder.path,
54816
55292
  subscribed: !!folder.subscribed,
54817
55293
  listed: !!folder.listed,
54818
- status: !!folder.status
55294
+ status: folder.status
54819
55295
  };
54820
55296
  if (folder.delimiter) {
54821
55297
  data.delimiter = folder.delimiter;
@@ -54993,6 +55469,12 @@ var require_tools2 = __commonJS({
54993
55469
  map.bodyParts = /* @__PURE__ */ new Map();
54994
55470
  }
54995
55471
  map.bodyParts.set(partKey, value);
55472
+ if (match[1].toLowerCase() === "binary") {
55473
+ if (!map.binaryParts) {
55474
+ map.binaryParts = /* @__PURE__ */ new Set();
55475
+ }
55476
+ map.binaryParts.add(partKey);
55477
+ }
54996
55478
  break;
54997
55479
  }
54998
55480
  break;
@@ -55363,9 +55845,27 @@ var require_tools2 = __commonJS({
55363
55845
  canUseFlag(mailbox, flag) {
55364
55846
  return !mailbox || !mailbox.permanentFlags || mailbox.permanentFlags.has("\\*") || mailbox.permanentFlags.has(flag);
55365
55847
  },
55848
+ /**
55849
+ * Checks that a value is a valid IMAP sequence number or UID: a non-zero
55850
+ * 32-bit unsigned integer (nz-number in the RFC 9051 grammar). Guards range
55851
+ * expansion against untrusted server input such as 'Infinity' or '0:*'.
55852
+ *
55853
+ * @param {Number} value - Value to check
55854
+ * @returns {Boolean} True if the value is a valid sequence number/UID
55855
+ */
55856
+ isValidSequenceValue(value) {
55857
+ return Number.isSafeInteger(value) && value > 0 && value <= 4294967295;
55858
+ },
55366
55859
  /**
55367
55860
  * Expands an IMAP sequence range string (e.g. "1:3,5,7:9") into an array of numbers.
55368
55861
  *
55862
+ * Entries with endpoints that are not valid nz-numbers are skipped - the input
55863
+ * may come from an untrusted server, and 'Infinity' or similar garbage would
55864
+ * otherwise loop without bound. A single range is expanded to at most
55865
+ * EXPANDED_RANGE_LIMIT entries: legitimate responses never reach the limit
55866
+ * (the mailbox would need that many messages), while a hostile range like
55867
+ * 1:4294967295 is cut off instead of exhausting memory.
55868
+ *
55369
55869
  * @param {String} range - IMAP sequence range string
55370
55870
  * @returns {Number[]} Array of expanded sequence numbers
55371
55871
  */
@@ -55374,20 +55874,26 @@ var require_tools2 = __commonJS({
55374
55874
  entry = entry.trim();
55375
55875
  let colon = entry.indexOf(":");
55376
55876
  if (colon < 0) {
55377
- return Number(entry) || 0;
55877
+ let value = Number(entry);
55878
+ return tools.isValidSequenceValue(value) ? value : [];
55879
+ }
55880
+ let first = Number(entry.substr(0, colon));
55881
+ let second = Number(entry.substr(colon + 1));
55882
+ if (!tools.isValidSequenceValue(first) || !tools.isValidSequenceValue(second)) {
55883
+ return [];
55378
55884
  }
55379
- let first = Number(entry.substr(0, colon)) || 0;
55380
- let second = Number(entry.substr(colon + 1)) || 0;
55381
55885
  if (first === second) {
55382
55886
  return first;
55383
55887
  }
55384
55888
  let list = [];
55385
55889
  if (first < second) {
55386
- for (let i = first; i <= second; i++) {
55890
+ let last = Math.min(second, first + EXPANDED_RANGE_LIMIT - 1);
55891
+ for (let i = first; i <= last; i++) {
55387
55892
  list.push(i);
55388
55893
  }
55389
55894
  } else {
55390
- for (let i = first; i >= second; i--) {
55895
+ let last = Math.max(second, first - EXPANDED_RANGE_LIMIT + 1);
55896
+ for (let i = first; i >= last; i--) {
55391
55897
  list.push(i);
55392
55898
  }
55393
55899
  }
@@ -55445,9 +55951,9 @@ var require_tools2 = __commonJS({
55445
55951
  }
55446
55952
  });
55447
55953
 
55448
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/id.js
55954
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/id.js
55449
55955
  var require_id2 = __commonJS({
55450
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/id.js"(exports, module) {
55956
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/id.js"(exports, module) {
55451
55957
  "use strict";
55452
55958
  var { formatDateTime } = require_tools2();
55453
55959
  module.exports = async (connection, clientInfo) => {
@@ -55497,9 +56003,9 @@ var require_id2 = __commonJS({
55497
56003
  }
55498
56004
  });
55499
56005
 
55500
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/capability.js
56006
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/capability.js
55501
56007
  var require_capability = __commonJS({
55502
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/capability.js"(exports, module) {
56008
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/capability.js"(exports, module) {
55503
56009
  "use strict";
55504
56010
  module.exports = async (connection) => {
55505
56011
  if (connection.capabilities.size && !connection.expectCapabilityUpdate) {
@@ -55518,15 +56024,16 @@ var require_capability = __commonJS({
55518
56024
  }
55519
56025
  });
55520
56026
 
55521
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/namespace.js
56027
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/namespace.js
55522
56028
  var require_namespace = __commonJS({
55523
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/namespace.js"(exports, module) {
56029
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/namespace.js"(exports, module) {
55524
56030
  "use strict";
56031
+ var { hasCapability } = require_tools2();
55525
56032
  module.exports = async (connection) => {
55526
56033
  if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state)) {
55527
56034
  return;
55528
56035
  }
55529
- if (!connection.capabilities.has("NAMESPACE")) {
56036
+ if (!hasCapability(connection, "NAMESPACE")) {
55530
56037
  let { prefix, delimiter } = await getListPrefix(connection);
55531
56038
  if (delimiter && prefix && prefix.charAt(prefix.length - 1) !== delimiter) {
55532
56039
  prefix += delimiter;
@@ -55625,9 +56132,9 @@ var require_namespace = __commonJS({
55625
56132
  }
55626
56133
  });
55627
56134
 
55628
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/login.js
56135
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/login.js
55629
56136
  var require_login = __commonJS({
55630
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/login.js"(exports, module) {
56137
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/login.js"(exports, module) {
55631
56138
  "use strict";
55632
56139
  var { getStatusCode, getErrorText } = require_tools2();
55633
56140
  module.exports = async (connection, username, password) => {
@@ -55656,9 +56163,9 @@ var require_login = __commonJS({
55656
56163
  }
55657
56164
  });
55658
56165
 
55659
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/logout.js
56166
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/logout.js
55660
56167
  var require_logout = __commonJS({
55661
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/logout.js"(exports, module) {
56168
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/logout.js"(exports, module) {
55662
56169
  "use strict";
55663
56170
  module.exports = async (connection) => {
55664
56171
  if (connection.state === connection.states.LOGOUT) {
@@ -55690,9 +56197,9 @@ var require_logout = __commonJS({
55690
56197
  }
55691
56198
  });
55692
56199
 
55693
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/starttls.js
56200
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/starttls.js
55694
56201
  var require_starttls = __commonJS({
55695
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/starttls.js"(exports, module) {
56202
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/starttls.js"(exports, module) {
55696
56203
  "use strict";
55697
56204
  module.exports = async (connection) => {
55698
56205
  if (!connection.capabilities.has("STARTTLS") || connection.secureConnection) {
@@ -55712,351 +56219,926 @@ var require_starttls = __commonJS({
55712
56219
  }
55713
56220
  });
55714
56221
 
55715
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/special-use.js
56222
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/special-use.js
55716
56223
  var require_special_use = __commonJS({
55717
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/special-use.js"(exports, module) {
56224
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/special-use.js"(exports, module) {
55718
56225
  "use strict";
56226
+ var GENERIC_TOKENS = new Set(
56227
+ [
56228
+ // English. "e" is here because TOKEN_SPLIT breaks on the hyphen, so the
56229
+ // "e-mail" / "e-posta" / "e-kirjad" family arrives as a bare "e" token.
56230
+ "e",
56231
+ "mail",
56232
+ "mails",
56233
+ "email",
56234
+ "emails",
56235
+ "message",
56236
+ "messages",
56237
+ "item",
56238
+ "items",
56239
+ "folder",
56240
+ "my",
56241
+ // German, Dutch, Nordic
56242
+ "objekt",
56243
+ "objekte",
56244
+ "objekten",
56245
+ "objekter",
56246
+ "elemente",
56247
+ "elementen",
56248
+ "elementer",
56249
+ "nachrichten",
56250
+ "berichten",
56251
+ "post",
56252
+ "poster",
56253
+ "viestit",
56254
+ "kirjad",
56255
+ "meldinger",
56256
+ "beskeder",
56257
+ // Romance
56258
+ "correo",
56259
+ "posta",
56260
+ "courrier",
56261
+ "elementos",
56262
+ "elementi",
56263
+ "\xE9l\xE9ments",
56264
+ "mensajes",
56265
+ "messaggi",
56266
+ "mensagens",
56267
+ "itens",
56268
+ // Slavic
56269
+ "poczta",
56270
+ "po\u0161ta",
56271
+ "elementy",
56272
+ "wiadomo\u015Bci",
56273
+ "polo\u017Eky",
56274
+ "spr\xE1vy",
56275
+ "\u043F\u0438\u0441\u044C\u043C\u0430",
56276
+ "\u043F\u0438\u0441\u044C\u043C\u043E",
56277
+ "\u044D\u043B\u0435\u043C\u0435\u043D\u0442\u044B",
56278
+ "\u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u044F",
56279
+ "\u043F\u043E\u0448\u0442\u0430",
56280
+ // Other
56281
+ "\xF6\u011Feler",
56282
+ "mesajlar",
56283
+ "\u03BC\u03B7\u03BD\u03CD\u03BC\u03B1\u03C4\u03B1",
56284
+ "\u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03AF\u03B1"
56285
+ ].map((token) => token.toLowerCase().normalize("NFKC"))
56286
+ );
56287
+ var TOKEN_SPLIT = /[\s\-_/.,()[\]]+/;
55719
56288
  module.exports = {
55720
56289
  flags: ["\\All", "\\Archive", "\\Drafts", "\\Flagged", "\\Junk", "\\Sent", "\\Trash"],
55721
56290
  names: {
55722
56291
  "\\Sent": [
55723
56292
  "aika",
56293
+ "air a chur",
56294
+ "am post cuirte",
56295
+ "anfonwyd",
56296
+ "bidalia",
55724
56297
  "bidaliak",
55725
56298
  "bidalita",
56299
+ "bidalitakoak",
56300
+ "currieru mandatu",
56301
+ "danfonwyd",
55726
56302
  "dihantar",
55727
56303
  "e rometsweng",
55728
56304
  "e tindami",
56305
+ "elementos enviados",
55729
56306
  "elk\xFCld\xF6tt",
56307
+ "elk\xFCld\xF6tt elemek",
56308
+ "elk\xFCld\xF6tt \xFCzenetek",
55730
56309
  "elk\xFCld\xF6ttek",
55731
- "elementos enviados",
55732
- "\xE9l\xE9ments envoy\xE9s",
55733
- "enviadas",
55734
56310
  "enviadas",
55735
56311
  "enviados",
56312
+ "enviat",
55736
56313
  "enviats",
55737
56314
  "envoy\xE9s",
55738
56315
  "ethunyelweyo",
55739
56316
  "expediate",
55740
56317
  "ezipuru",
56318
+ "ferstjoerd",
56319
+ "gesendet",
55741
56320
  "gesendete",
55742
56321
  "gesendete elemente",
55743
56322
  "gestuur",
56323
+ "g\xF6nderilmi\u015F",
55744
56324
  "g\xF6nderilmi\u015F \xF6\u011Feler",
55745
56325
  "g\xF6nd\u0259ril\u0259nl\u0259r",
56326
+ "hantar",
55746
56327
  "iberilen",
56328
+ "inviata",
56329
+ "inviate",
55747
56330
  "inviati",
56331
+ "i\u0161si\u0173sti",
56332
+ "i\u0161si\u0173sti lai\u0161kai",
55748
56333
  "i\u0161si\u0173stieji",
56334
+ "jo`natilgan xatlar",
56335
+ "jo\u2018natilgan",
56336
+ "kaset",
55749
56337
  "kuthunyelwe",
56338
+ "k\xFCld\xF6ttek",
55750
56339
  "lasa",
55751
56340
  "l\xE4hetetyt",
56341
+ "mesaje trimise",
55752
56342
  "messages envoy\xE9s",
55753
56343
  "naipadala",
55754
56344
  "nalefa",
55755
56345
  "napadala",
56346
+ "nos\u016Bt\u012Bts",
56347
+ "nos\u016Bt\u012Bt\u0101s",
55756
56348
  "nos\u016Bt\u012Bt\u0101s zi\u0146as",
55757
- "odeslan\xE9",
55758
56349
  "odeslan\xE1 po\u0161ta",
56350
+ "odeslan\xE9",
56351
+ "odoslan\xE1",
56352
+ "odoslan\xE1 po\u0161ta",
56353
+ "odoslan\xE9",
55759
56354
  "padala",
56355
+ "poslana po\u0161ta",
55760
56356
  "poslane",
55761
56357
  "poslano",
55762
- "poslano",
55763
56358
  "poslan\xE9",
55764
56359
  "poslato",
56360
+ "posta inviata",
56361
+ "p\xF3s\u0142ane",
56362
+ "p\xF3s\u0142any",
55765
56363
  "saadetud",
55766
56364
  "saadetud kirjad",
55767
56365
  "saadetud \xFCksused",
56366
+ "senditujo",
55768
56367
  "sendt",
55769
- "sendt",
56368
+ "sendt post",
56369
+ "sendte",
56370
+ "sendte beskeder",
55770
56371
  "sent",
55771
56372
  "sent items",
55772
56373
  "sent messages",
56374
+ "seolta",
56375
+ "si\u016Bsti",
56376
+ "skickat",
55773
56377
  "s\xE4nda poster",
55774
56378
  "s\xE4nt",
56379
+ "s\u016Bt\u012Bt",
55775
56380
  "terkirim",
56381
+ "th\u01B0 \u0111\xE3 g\u1EEDi",
55776
56382
  "ti fi ran\u1E63\u1EB9",
56383
+ "titaq",
56384
+ "tramess",
56385
+ "trimis",
56386
+ "trimise",
56387
+ "ttwaznen",
56388
+ "t\xEB d\xEBrguar",
55777
56389
  "t\xEB d\xEBrguara",
56390
+ "unviaos",
56391
+ "unvios fechos",
56392
+ "versch\xE9ckt",
55778
56393
  "verzonden",
56394
+ "verzonden berichten",
55779
56395
  "vilivyotumwa",
55780
56396
  "wys\u0142ane",
56397
+ "\xE9l\xE9ments envoy\xE9s",
55781
56398
  "\u0111\xE3 g\u1EEDi",
56399
+ "\u015Fand\xEE",
56400
+ "\u03B1\u03C0\u03B5\u03C3\u03C4\u03B1\u03BB\u03BC\u03AD\u03BD\u03B1",
55782
56401
  "\u03C3\u03C4\u03B1\u03BB\u03B8\u03AD\u03BD\u03C4\u03B1",
56402
+ "\u0430\u0434\u043F\u0440\u0430\u045E\u043B\u0435\u043D\u0430",
55783
56403
  "\u0436\u0438\u0431\u0435\u0440\u0438\u043B\u0433\u0435\u043D",
56404
+ "\u0436\u0456\u0431\u0435\u0440\u0456\u043B\u0433\u0435\u043D",
56405
+ "\u0436\u0456\u0431\u0435\u0440\u0456\u043B\u0433\u0435\u043D \u0445\u0430\u0442\u0442\u0430\u0440",
55784
56406
  "\u0436\u0456\u0431\u0435\u0440\u0456\u043B\u0433\u0435\u043D\u0434\u0435\u0440",
55785
56407
  "\u0438\u0437\u043F\u0440\u0430\u0442\u0435\u043D\u0438",
56408
+ "\u0438\u0437\u043F\u0440\u0430\u0442\u0435\u043D\u0438 \u043F\u0438\u0441\u043C\u0430",
55786
56409
  "\u0438\u043B\u0433\u044D\u044D\u0441\u044D\u043D",
55787
56410
  "\u0438\u0440\u0441\u043E\u043B \u0448\u0443\u0434",
56411
+ "\u0438\u0441\u043F\u0440\u0430\u0442\u0435\u043D\u0438",
55788
56412
  "\u0438\u0441\u043F\u0440\u0430\u0442\u0435\u043D\u043E",
55789
56413
  "\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u043D\u0456",
55790
56414
  "\u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u043D\u044B\u0435",
55791
56415
  "\u043F\u0430\u0441\u043B\u0430\u043D\u044B\u044F",
56416
+ "\u043F\u043E\u0441\u043B\u0430\u0442\u0435",
56417
+ "\u043F\u043E\u0441\u043B\u0430\u0442\u043E",
56418
+ "\u043F\u0440\u0430\u0442\u0435\u043D\u0438",
55792
56419
  "\u044E\u0431\u043E\u0440\u0438\u043B\u0433\u0430\u043D",
56420
+ "\u0578\u0582\u0572\u0561\u0580\u056F\u0578\u0582\u0561\u056E",
55793
56421
  "\u0578\u0582\u0572\u0561\u0580\u056F\u057E\u0561\u056E",
56422
+ "\u05E0\u05E9\u05DC\u05D7",
55794
56423
  "\u05E0\u05E9\u05DC\u05D7\u05D5",
55795
56424
  "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD \u05E9\u05E0\u05E9\u05DC\u05D7\u05D5",
56425
+ "\u0626\u06D5\u06CB\u06D5\u062A\u0649\u0644\u06AF\u06D5\u0646",
56426
+ "\u0627\u0631\u0633\u0627\u0644 \u0634\u062F\u0647",
56427
+ "\u0627\u0631\u0633\u0627\u0644\u06CC",
56428
+ "\u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0645\u0631\u0633\u0644",
56429
+ "\u0627\u0644\u0645\u0631\u0633\u0644",
55796
56430
  "\u0627\u0644\u0645\u0631\u0633\u0644\u0629",
56431
+ "\u0627\u0644\u0645\u064F\u0631\u0633\u064E\u0644",
56432
+ "\u0628\u06BE\u06CC\u062C\u0627 \u06C1\u0648\u0627 \u0645\u06CC\u0644",
55797
56433
  "\u0628\u06BE\u06CC\u062C\u06D2 \u06AF\u0626\u06D2",
55798
56434
  "\u0633\u0648\u0632\u0645\u0698\u06C1",
56435
+ "\u0644\u06D0\u0696\u0644 \u0634\u0648\u064A \u0644\u064A\u06A9\u0648\u0646\u0647",
55799
56436
  "\u0644\u06D0\u06AB\u0644 \u0634\u0648\u06CC",
55800
56437
  "\u0645\u0648\u0627\u0631\u062F \u0627\u0631\u0633\u0627\u0644 \u0634\u062F\u0647",
56438
+ "\u0645\u064F\u0631\u0633\u064E\u0644",
56439
+ "\u0646\u06CE\u0631\u062F\u0631\u0627\u0648",
56440
+ "\u092A\u0920\u0908\u090F\u0915\u093E \u092E\u0947\u0932\u0939\u0930\u0941",
56441
+ "\u092A\u093E\u0920\u0935\u0932\u0947\u0932\u0947",
55801
56442
  "\u092A\u093E\u0920\u0935\u093F\u0932\u0947",
55802
56443
  "\u092A\u093E\u0920\u0935\u093F\u0932\u0947\u0932\u0947",
55803
56444
  "\u092A\u094D\u0930\u0947\u0937\u093F\u0924",
55804
56445
  "\u092D\u0947\u091C\u093E \u0917\u092F\u093E",
56446
+ "\u092D\u0947\u091C\u0947 \u0917\u090F",
56447
+ "\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u09AF\u09BC\u09C7\u099B\u09C7",
55805
56448
  "\u09AA\u09CD\u09B0\u09C7\u09B0\u09BF\u09A4",
55806
- "\u09AA\u09CD\u09B0\u09C7\u09B0\u09BF\u09A4",
56449
+ "\u09AA\u09CD\u09B0\u09C7\u09B0\u09BF\u09A4(\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AE\u09C7\u0987\u09B2)",
55807
56450
  "\u09AA\u09CD\u09F0\u09C7\u09F0\u09BF\u09A4",
55808
56451
  "\u0A2D\u0A47\u0A1C\u0A47",
55809
56452
  "\u0AAE\u0ACB\u0A95\u0AB2\u0AC7\u0AB2\u0ABE",
56453
+ "\u0AAE\u0ACB\u0A95\u0AB2\u0AC7\u0AB2\u0ACD\u0AAF\u0ABE",
55810
56454
  "\u0B2A\u0B20\u0B3E\u0B17\u0B32\u0B3E",
56455
+ "\u0B85\u0BA9\u0BC1\u0BAA\u0BCD\u0BAA\u0BBF\u0BAF \u0B85\u0B9E\u0BCD\u0B9A\u0BB2\u0BCD",
55811
56456
  "\u0B85\u0BA9\u0BC1\u0BAA\u0BCD\u0BAA\u0BBF\u0BAF\u0BB5\u0BC8",
55812
56457
  "\u0C2A\u0C02\u0C2A\u0C3F\u0C02\u0C1A\u0C2C\u0C21\u0C3F\u0C02\u0C26\u0C3F",
55813
56458
  "\u0C95\u0CB3\u0CC1\u0CB9\u0CBF\u0CB8\u0CB2\u0CBE\u0CA6",
56459
+ "\u0D05\u0D2F\u0D1A\u0D4D\u0D1A\u0D35",
55814
56460
  "\u0D05\u0D2F\u0D1A\u0D4D\u0D1A\u0D41",
55815
56461
  "\u0DBA\u0DD0\u0DC0\u0DD4 \u0DB4\u0DAB\u0DD2\u0DC0\u0DD4\u0DA9",
56462
+ "\u0DBA\u0DD0\u0DC0\u0DD6",
56463
+ "\u0E17\u0E35\u0E48\u0E2A\u0E48\u0E07\u0E41\u0E25\u0E49\u0E27",
56464
+ "\u0E2A\u0E48\u0E07",
55816
56465
  "\u0E2A\u0E48\u0E07\u0E41\u0E25\u0E49\u0E27",
55817
56466
  "\u10D2\u10D0\u10D2\u10D6\u10D0\u10D5\u10DC\u10D8\u10DA\u10D8",
56467
+ "\u12DD\u1270\u1208\u12A3\u12B8",
55818
56468
  "\u12E8\u1270\u120B\u12A9",
55819
56469
  "\u1794\u17B6\u1793\u200B\u1795\u17D2\u1789\u17BE",
55820
- "\u5BC4\u4EF6\u5099\u4EFD",
56470
+ "\u179F\u17C6\u1794\u17BB\u178F\u17D2\u179A\u178A\u17C2\u179B\u1794\u17B6\u1793\u1794\u1789\u17D2\u1787\u17BC\u1793",
55821
56471
  "\u5BC4\u4EF6\u5099\u4EFD",
55822
56472
  "\u5DF2\u53D1\u4FE1\u606F",
55823
- "\u9001\u4FE1\u6E08\u307F\uFF92\uFF70\uFF99",
56473
+ "\u5DF2\u53D1\u9001",
56474
+ "\u5DF2\u53D1\u9001\u6D88\u606F",
56475
+ "\u5DF2\u53D1\u9001\u90AE\u4EF6",
56476
+ "\u9001\u4FE1\u6E08\u307F",
56477
+ "\u9001\u4FE1\u6E08\u307F\u30A2\u30A4\u30C6\u30E0",
56478
+ "\u9001\u4FE1\u6E08\u307F\u30C8\u30EC\u30A4",
56479
+ "\u9001\u4FE1\u6E08\u307F\u30E1\u30FC\u30EB",
55824
56480
  "\uBC1C\uC2E0 \uBA54\uC2DC\uC9C0",
55825
- "\uBCF4\uB0B8 \uD3B8\uC9C0\uD568"
56481
+ "\uBCF4\uB0B8 \uD3B8\uC9C0\uD568",
56482
+ "\uBCF4\uB0C4"
55826
56483
  ],
55827
56484
  "\\Trash": [
56485
+ "an sgudal",
55828
56486
  "articole \u0219terse",
56487
+ "atkritne",
55829
56488
  "bin",
56489
+ "borttaget",
55830
56490
  "borttagna objekt",
56491
+ "bosca bruscair",
56492
+ "bruscar",
56493
+ "cestino",
56494
+ "chanaster da palpiri",
56495
+ "chiqitdon",
56496
+ "corbe a papiro",
56497
+ "corbeille",
56498
+ "co\u0219 de gunoi",
56499
+ "curbella",
55831
56500
  "deleted",
55832
56501
  "deleted items",
55833
56502
  "deleted messages",
56503
+ "dz\u0113stie vienumi",
55834
56504
  "elementi eliminati",
55835
56505
  "elementos borrados",
55836
56506
  "elementos eliminados",
55837
- "gel\xF6schte objekte",
56507
+ "elements suprimits",
56508
+ "eliminata",
56509
+ "gel\xF6scht",
55838
56510
  "gel\xF6schte elemente",
56511
+ "gel\xF6schte objekte",
56512
+ "gunoi",
56513
+ "hedhurina",
55839
56514
  "item dipadam",
55840
56515
  "itens apagados",
56516
+ "itens eliminados",
55841
56517
  "itens exclu\xEDdos",
56518
+ "i\u0161trinti",
56519
+ "i\u1E0Duman",
56520
+ "jiskefet",
56521
+ "j\xEAbirdank",
56522
+ "kanta",
56523
+ "kest",
56524
+ "kosz",
56525
+ "ko\u0161",
56526
+ "kuka",
56527
+ "kustutatud",
55842
56528
  "kustutatud \xFCksused",
56529
+ "k\xF4\u0161",
56530
+ "lixeira",
56531
+ "lixo",
56532
+ "lomt\xE1r",
56533
+ "molwuj",
55843
56534
  "m\u1EE5c \u0111\xE3 x\xF3a",
55844
- "odstran\u011Bn\xE9 polo\u017Eky",
56535
+ "obrisane stavke",
56536
+ "odpadkov\xFD k\xF4\u0161",
55845
56537
  "odstran\u011Bn\xE1 po\u0161ta",
56538
+ "odstran\u011Bn\xE9 polo\u017Eky",
56539
+ "papeleira",
56540
+ "papelera",
56541
+ "paperera",
56542
+ "papierkorb",
56543
+ "papirkorg",
56544
+ "papirkurv",
56545
+ "papjernik",
56546
+ "papperskorg",
56547
+ "papperskorgen",
56548
+ "pap\u012Brgrozs",
56549
+ "pap\u012Brkurvis",
55846
56550
  "pesan terhapus",
56551
+ "pod-lastez",
55847
56552
  "poistetut",
56553
+ "poubelle",
55848
56554
  "praht",
56555
+ "prullenbak",
55849
56556
  "pr\xFCgikast",
56557
+ "reciclagem",
56558
+ "roskakori",
56559
+ "rubujo",
56560
+ "rusl",
56561
+ "savat",
56562
+ "sbwriel",
56563
+ "sgudal",
55850
56564
  "silinmi\u015F \xF6\u011Feler",
56565
+ "skrell",
56566
+ "sletta",
55851
56567
  "slettede beskeder",
55852
56568
  "slettede elementer",
56569
+ "slettet",
56570
+ "smeti",
56571
+ "sme\u0107e",
56572
+ "snippermandjie",
56573
+ "surat terhapus",
56574
+ "s\u0259b\u0259t",
56575
+ "th\xF9ng r\xE1c",
56576
+ "tong sampah",
55853
56577
  "trash",
55854
- "t\xF6r\xF6lt elemek",
55855
56578
  "t\xF6r\xF6lt",
56579
+ "t\xF6r\xF6lt elemek",
56580
+ "usuni\u0119te",
55856
56581
  "usuni\u0119te wiadomo\u015Bci",
55857
56582
  "verwijderde items",
55858
56583
  "vymazan\xE9 spr\xE1vy",
56584
+ "zakarrontzia",
56585
+ "\xE7\xF6p",
56586
+ "\xE7\xF6p kutusu",
55859
56587
  "\xE9l\xE9ments supprim\xE9s",
56588
+ "\u0161iuk\u0161liad\u0117\u017E\u0117",
56589
+ "\u0161iuk\u0161lin\u0117",
56590
+ "\u0161iuk\u0161li\u0173 d\u0117\u017E\u0117",
56591
+ "\u0219terse",
56592
+ "\u03B1\u03C0\u03BF\u03C1\u03C1\u03AF\u03BC\u03BC\u03B1\u03C4\u03B1",
56593
+ "\u03B4\u03B9\u03B1\u03B3\u03C1\u03B1\u03BC\u03BC\u03AD\u03BD\u03B1",
56594
+ "\u03BA\u03AC\u03B4\u03BF\u03C2 \u03B1\u03C0\u03BF\u03C1\u03C1\u03B9\u03BC\u03AC\u03C4\u03C9\u03BD",
56595
+ "\u03BA\u03AC\u03B4\u03BF\u03C2 \u03B1\u03C0\u03BF\u03C1\u03C1\u03B9\u03BC\u03BC\u03AC\u03C4\u03C9\u03BD",
55860
56596
  "\u0432\u0438\u0434\u0430\u043B\u0435\u043D\u0456",
56597
+ "\u0432\u044B\u0434\u0430\u043B\u0435\u043D\u044B\u044F",
55861
56598
  "\u0436\u043E\u0439\u044B\u043B\u0493\u0430\u043D\u0434\u0430\u0440",
56599
+ "\u0438\u0437\u0431\u0440\u0438\u0448\u0430\u043D\u0438",
56600
+ "\u0438\u0437\u0442\u0440\u0438\u0442\u0438",
56601
+ "\u043A\u0430\u043D\u0442\u0430",
56602
+ "\u043A\u043E\u0440\u0437\u0438\u043D\u0430",
56603
+ "\u043A\u043E\u0440\u043F\u0430",
56604
+ "\u043A\u043E\u0448\u0438\u043A",
56605
+ "\u043A\u043E\u0448\u0447\u0435",
56606
+ "\u043E\u0431\u0440\u0438\u0441\u0430\u043D\u0435 \u0441\u0442\u0430\u0432\u043A\u0435",
56607
+ "\u0441\u0435\u0431\u0435\u0442",
56608
+ "\u0441\u043C\u0435\u0442\u043D\u0456\u0446\u0430",
56609
+ "\u0441\u043C\u0435\u045B\u0435",
56610
+ "\u0441\u043C\u0456\u0442\u043D\u0438\u043A",
55862
56611
  "\u0443\u0434\u0430\u043B\u0435\u043D\u043D\u044B\u0435",
56612
+ "\u0443\u0434\u0430\u043B\u0451\u043D\u043D\u044B\u0435",
56613
+ "\u0445\u043E\u0433\u0438\u0439\u043D \u0441\u0430\u0432",
56614
+ "\u049B\u043E\u049B\u044B\u0441 \u0448\u0435\u043B\u0435\u0433\u0456",
56615
+ "\u0561\u0572\u0562\u0561\u0580\u056F\u0572",
56616
+ "\u05D0\u05E9\u05E4\u05D4",
55863
56617
  "\u05E4\u05E8\u05D9\u05D8\u05D9\u05DD \u05E9\u05E0\u05DE\u05D7\u05E7\u05D5",
56618
+ "\u0627\u0634\u063A\u0627\u0644 \u062F\u0627\u0646\u06CC",
55864
56619
  "\u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0627\u0644\u0645\u062D\u0630\u0648\u0641\u0629",
56620
+ "\u0627\u0644\u0645\u0647\u0645\u0644\u0627\u062A",
56621
+ "\u0631\u062F\u06CC \u06A9\u06CC \u0679\u0648\u06A9\u0631\u06CC",
56622
+ "\u0632\u0628\u0627\u0644\u0647\u200C\u062F\u0627\u0646",
56623
+ "\u0632\u0628\u06B5\u062F\u0627\u0646",
55865
56624
  "\u0645\u0648\u0627\u0631\u062F \u062D\u0630\u0641 \u0634\u062F\u0647",
56625
+ "\u0645\u064F\u0647\u0645\u0644\u0627\u062A",
56626
+ "\u06A9\u062B\u0627\u0641\u062A \u062F\u0627\u0646\u06CD",
56627
+ "\u0915\u091A\u0930\u093E",
56628
+ "\u0915\u091A\u0930\u093E \u092A\u0947\u091F\u0940",
56629
+ "\u0930\u0926\u094D\u0926\u0940",
56630
+ "\u0930\u0926\u094D\u0926\u0940 \u091F\u094B\u0915\u0930\u0940",
56631
+ "\u099D\u09C1\u09A1\u09BC\u09BF",
56632
+ "\u09A1\u09BE\u09B8\u09CD\u099F\u09AC\u09BF\u09A8",
56633
+ "\u0A95\u0A9A\u0AB0\u0ACB",
56634
+ "\u0B95\u0BC1\u0BAA\u0BCD\u0BAA\u0BC8",
56635
+ "\u0D1A\u0D35\u0D31\u0D4D\u0D31\u0D41\u0D15\u0D41\u0D1F\u0D4D\u0D1F",
56636
+ "\u0D89\u0DC0\u0DAD\u0DBD\u0DB1 \u0DB6\u0DB3\u0DD4\u0DB1",
56637
+ "\u0E16\u0E31\u0E07\u0E02\u0E22\u0E30",
55866
56638
  "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E25\u0E1A",
56639
+ "\u10DC\u10D0\u10D2\u10D0\u10D5\u10D8",
56640
+ "\u10E3\u10E0\u10DC\u10D0",
56641
+ "\u10EC\u10D0\u10E8\u10DA\u10D8\u10DA\u10D8",
56642
+ "\u12A5\u1295\u12F3\u1309\u1213\u134D",
56643
+ "\u1792\u17BB\u1784\u179F\u17C6\u179A\u17B6\u1798",
56644
+ "\u3054\u307F\u7BB1",
56645
+ "\u30B4\u30DF\u7BB1",
56646
+ "\u524A\u9664\u6E08\u307F\u30A2\u30A4\u30C6\u30E0",
56647
+ "\u56DE\u6536\u7AD9",
56648
+ "\u5783\u573E\u6876",
55867
56649
  "\u5DF2\u5220\u9664\u90AE\u4EF6",
55868
56650
  "\u5DF2\u522A\u9664\u9805\u76EE",
55869
- "\u5DF2\u522A\u9664\u9805\u76EE"
56651
+ "\u5E9F\u4EF6\u7BB1",
56652
+ "\uC9C0\uC6B4 \uD3B8\uC9C0\uD568",
56653
+ "\uD734\uC9C0\uD1B5"
55870
56654
  ],
55871
56655
  "\\Junk": [
56656
+ "aspam",
56657
+ "basura",
56658
+ "brukalas",
55872
56659
  "bulk mail",
56660
+ "cajk",
56661
+ "correo basura",
56662
+ "correo lixo",
55873
56663
  "correo no deseado",
56664
+ "correu brossa",
56665
+ "corr\xE9u puxarra",
55874
56666
  "courrier ind\xE9sirable",
56667
+ "dramha\xEDl",
56668
+ "dramhphost",
56669
+ "gemors",
56670
+ "gemorspos",
56671
+ "gereksiz",
56672
+ "indesiderata",
56673
+ "indesirate",
56674
+ "ind\xE9sirables",
55875
56675
  "istenmeyen",
55876
56676
  "istenmeyen e-posta",
56677
+ "i\u0307stenmeyen",
55877
56678
  "junk",
55878
56679
  "junk e-mail",
55879
56680
  "junk email",
56681
+ "junk mail",
55880
56682
  "junk-e-mail",
56683
+ "k\xE9retlen",
56684
+ "lastez",
55881
56685
  "lev\xE9lszem\xE9t",
56686
+ "lixo electr\xF3nico",
56687
+ "lixo eletr\xF3nico",
56688
+ "lixo eletr\xF4nico",
56689
+ "mel remeh",
56690
+ "mesaje nedorite",
56691
+ "m\xF8sn",
56692
+ "m\u0113stule",
56693
+ "m\u0113stules",
56694
+ "nepo\u017Eeljne",
56695
+ "nesolicitate",
56696
+ "net-winske",
55882
56697
  "nevy\u017Eiadan\xE1 po\u0161ta",
56698
+ "nevy\u017E\xE1dan\xE1",
55883
56699
  "nevy\u017E\xE1dan\xE1 po\u0161ta",
56700
+ "nev\u0113lams",
56701
+ "neza\u017Eeleno",
56702
+ "ne\u017Eelena po\u0161ta",
56703
+ "ne\u017Eelena sporo\u010Dila",
56704
+ "ne\u017Eeljena po\u0161ta",
56705
+ "niechciane",
55884
56706
  "no deseado",
56707
+ "nungiavisch\xE0",
56708
+ "ongewenst",
56709
+ "ongewenste e-mail",
55885
56710
  "posta indesiderata",
56711
+ "posta indesirate",
55886
56712
  "pourriel",
56713
+ "pourriels",
56714
+ "puxarra",
56715
+ "roskaa",
55887
56716
  "roskaposti",
56717
+ "roskapostit",
56718
+ "ruslp\xF3stur",
56719
+ "r\xE4mps",
55888
56720
  "r\xE4mpspost",
56721
+ "sbam",
56722
+ "seq'",
56723
+ "skr\xE4p",
55889
56724
  "skr\xE4ppost",
55890
- "spam",
56725
+ "sothach",
55891
56726
  "spam",
55892
56727
  "spamowanie",
56728
+ "spamujo",
56729
+ "strobo\xF9",
56730
+ "szem\xE9t",
55893
56731
  "s\xF8ppelpost",
55894
56732
  "th\u01B0 r\xE1c",
56733
+ "truilleis",
56734
+ "t\xEB pavlera",
56735
+ "t\xEB pavler\xEB",
56736
+ "u\xF8nsket",
56737
+ "u\xF8nsket e-mail",
56738
+ "u\xF8nsket e-post",
56739
+ "u\xF8nsket post",
56740
+ "u\xF8nskt",
55895
56741
  "wiadomo\u015Bci-\u015Bmieci",
56742
+ "zabor-posta",
56743
+ "zaborra",
56744
+ "\xF6nemsiz",
56745
+ "\u010Dapor",
56746
+ "\u0161iuk\u0161l\u0117s",
56747
+ "\u0161lam\u0161tas",
56748
+ "\u03B1\u03BD\u03B5\u03C0\u03B9\u03B8\u03CD\u03BC\u03B7\u03C4\u03B1",
56749
+ "\u03B1\u03BD\u03B5\u03C0\u03B9\u03B8\u03CD\u03BC\u03B7\u03C4\u03B7 \u03B1\u03BB\u03BB\u03B7\u03BB\u03BF\u03B3\u03C1\u03B1\u03C6\u03AF\u03B1",
56750
+ "\u043D\u0435\u0431\u0430\u0436\u0430\u043D\u0430 \u043F\u043E\u0448\u0442\u0430",
56751
+ "\u043D\u0435\u0436\u0435\u043B\u0430\u043D\u0430 \u043F\u043E\u0449\u0430",
56752
+ "\u043D\u0435\u0436\u0435\u043B\u0430\u0442\u0435\u043B\u044C\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430",
56753
+ "\u043D\u0435\u043F\u0430\u0436\u0430\u0434\u0430\u043D\u0430\u044F \u043F\u043E\u0448\u0442\u0430",
56754
+ "\u043D\u0435\u043F\u043E\u0436\u0435\u0459\u043D\u0430 \u043F\u043E\u0448\u0442\u0430",
56755
+ "\u043D\u0435\u043F\u043E\u0436\u0435\u0459\u043D\u0435",
56756
+ "\u043D\u0435\u043F\u043E\u0436\u0435\u0459\u043D\u043E",
56757
+ "\u043D\u0435\u043F\u043E\u0441\u0430\u043A\u0443\u0432\u0430\u043D\u0430 \u043F\u043E\u0448\u0442\u0430",
55896
56758
  "\u0441\u043F\u0430\u043C",
56759
+ "\u049B\u0430\u043B\u0430\u0443\u0441\u044B\u0437 \u043F\u043E\u0448\u0442\u0430",
56760
+ "\u0561\u0576\u057A\u056B\u057F\u0561\u0576",
56761
+ "\u0569\u0561\u0583\u0578\u0576",
56762
+ "\u057D\u057A\u0561\u0574",
55897
56763
  "\u05D3\u05D5\u05D0\u05E8 \u05D6\u05D1\u05DC",
56764
+ "\u05D6\u05D1\u05DC",
55898
56765
  "\u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0639\u0634\u0648\u0627\u0626\u064A\u0629",
56766
+ "\u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u063A\u064A\u0631 \u0627\u0644\u0645\u0631\u063A\u0648\u0628 \u0641\u064A\u0647\u0627",
56767
+ "\u0628\u0646\u062C\u0644",
56768
+ "\u0628\u06CC\u06A9\u0627\u0631\u0647",
56769
+ "\u0628\u06CE\u06A9\u0647\u200C\u06B5\u06A9",
56770
+ "\u062C\u0646\u06A9",
56771
+ "\u062C\u0646\u06A9 \u0645\u06CC\u0644",
56772
+ "\u0633\u064F\u062E\u0627\u0645",
56773
+ "\u063A\u064A\u0631 \u0627\u0644\u0645\u0631\u063A\u0648\u0628",
55899
56774
  "\u0647\u0631\u0632\u0646\u0627\u0645\u0647",
56775
+ "\u0928\u0915\u094B \u0905\u0938\u0932\u0947\u0932\u0947 \u0915\u091A\u0930\u093E \u0938\u0902\u0926\u0947\u0936",
56776
+ "\u0938\u094D\u092A\u093E\u092E",
56777
+ "\u0938\u094D\u092A\u0948\u092E",
56778
+ "\u0986\u099C\u09C7\u09AC\u09BE\u099C\u09C7 \u09AE\u09C7\u0987\u09B2",
56779
+ "\u0B8E\u0BB0\u0BBF\u0BA4\u0BAE\u0BCD",
56780
+ "\u0D06\u0D35\u0D36\u0D4D\u0D2F\u0D2E\u0D3F\u0D32\u0D4D\u0D32\u0D3E\u0D24\u0D4D\u0D24\u0D35",
56781
+ "\u0DC3\u0DD4\u0DB1\u0DCA\u0DB6\u0DD4\u0DB1\u0DCA",
56782
+ "\u0E01\u0E25\u0E48\u0E2D\u0E07\u0E08\u0E14\u0E2B\u0E21\u0E32\u0E22\u0E02\u0E22\u0E30",
56783
+ "\u0E02\u0E22\u0E30",
55900
56784
  "\u0E2A\u0E41\u0E1B\u0E21",
55901
- "\u5783\u573E\u90F5\u4EF6",
56785
+ "\u0E2D\u0E35\u0E40\u0E21\u0E25\u0E02\u0E22\u0E30",
56786
+ "\u10E1\u10DE\u10D0\u10DB\u10D8",
56787
+ "\u10EF\u10D0\u10E0\u10D7\u10D8",
56788
+ "\u12A5\u1295\u12F3\u1245\u1295\u1320\u1218\u1295\u1322",
56789
+ "\u179F\u17C6\u1794\u17BB\u178F\u17D2\u179A\u1798\u17B7\u1793\u179B\u17D2\u17A2",
56790
+ "\u17A5\u178F\u200B\u1794\u17B6\u1793\u200B\u1780\u17B6\u179A",
56791
+ "\u5783\u573E",
56792
+ "\u5783\u573E\u4FE1\u4EF6",
55902
56793
  "\u5783\u573E\u90AE\u4EF6",
55903
- "\u5783\u573E\u96FB\u90F5"
56794
+ "\u5783\u573E\u90F5\u4EF6",
56795
+ "\u5783\u573E\u96FB\u90F5",
56796
+ "\u8FF7\u60D1\u30E1\u30FC\u30EB",
56797
+ "\uC2A4\uD338",
56798
+ "\uC2A4\uD338 \uD3B8\uC9C0\uD568",
56799
+ "\uC815\uD06C",
56800
+ "\uC815\uD06C \uBA54\uC77C"
55904
56801
  ],
55905
56802
  "\\Drafts": [
56803
+ "arewway",
55906
56804
  "ba brouillon",
55907
56805
  "borrador",
55908
- "borrador",
55909
56806
  "borradores",
55910
56807
  "bozze",
56808
+ "brouilhedo\xF9",
56809
+ "brouillonen",
55911
56810
  "brouillons",
56811
+ "bruttacopie",
55912
56812
  "b\u1EA3n th\u1EA3o",
55913
56813
  "ciorne",
55914
56814
  "concepten",
55915
56815
  "draf",
56816
+ "drafftiau",
55916
56817
  "draft",
55917
56818
  "drafts",
56819
+ "dreachdan",
56820
+ "dr\xE9achta\xED",
55918
56821
  "dr\xF6g",
55919
56822
  "entw\xFCrfe",
55920
56823
  "esborranys",
56824
+ "esbossos",
55921
56825
  "garalamalar",
55922
56826
  "ihe edeturu",
55923
56827
  "iidrafti",
55924
56828
  "izinhlaka",
55925
56829
  "juodra\u0161\u010Diai",
56830
+ "jusamaj",
55926
56831
  "kladd",
56832
+ "kladdar",
55927
56833
  "kladder",
55928
56834
  "koncepty",
55929
- "koncepty",
55930
56835
  "konsep",
55931
56836
  "konsepte",
56837
+ "konsepten",
55932
56838
  "kopie robocze",
55933
56839
  "layih\u0259l\u0259r",
55934
56840
  "luonnokset",
56841
+ "malnetujo",
55935
56842
  "melnraksti",
55936
56843
  "meralo",
56844
+ "mesaje nefinalizate",
55937
56845
  "mesazhe t\xEB pad\xEBrguara",
55938
56846
  "mga draft",
55939
56847
  "mustandid",
56848
+ "nacerjenja",
55940
56849
  "nacrti",
55941
- "nacrti",
56850
+ "na\u0107iski",
56851
+ "nedovr\u0161ene",
56852
+ "nedovr\u0161eno",
56853
+ "onvoltooid",
55942
56854
  "osnutki",
55943
56855
  "piszkozatok",
56856
+ "qaralamalar",
56857
+ "qoralama xatlar",
56858
+ "qoralamalar",
55944
56859
  "rascunhos",
55945
56860
  "rasimu",
56861
+ "re\u015Fniv\xEEs",
56862
+ "rozepsan\xE9",
56863
+ "sbozs",
56864
+ "skica",
55946
56865
  "skice",
56866
+ "skitsur",
56867
+ "szkice",
56868
+ "taslak",
55947
56869
  "taslaklar",
56870
+ "th\u01B0 nh\xE1p",
55948
56871
  "tsararrun sa\u0199onni",
55949
56872
  "utkast",
56873
+ "uzmetumi",
55950
56874
  "vakiraoka",
56875
+ "versiones provisori",
55951
56876
  "v\xE1zlatok",
56877
+ "wersje robocze",
55952
56878
  "zirriborroak",
55953
56879
  "\xE0w\u1ECDn \xE0k\u1ECDpam\u1ECD\u0301",
56880
+ "\u03C0\u03C1\u03BF\u03C3\u03C7\u03AD\u03B4\u03B9\u03B1",
55954
56881
  "\u03C0\u03C1\u03CC\u03C7\u03B5\u03B9\u03C1\u03B1",
56882
+ "\u0434\u0440\u0430\u0444\u0442\u043E\u0432\u0438",
56883
+ "\u0436\u043E\u0431\u0430 \u0436\u0430\u0437\u0431\u0430\u043B\u0430\u0440",
55955
56884
  "\u0436\u043E\u0431\u0430\u043B\u0430\u0440",
55956
56885
  "\u043D\u0430\u0446\u0440\u0442\u0438",
56886
+ "\u043D\u0435\u0434\u043E\u0432\u0440\u0448\u0435\u043D\u0435",
56887
+ "\u043D\u0435\u0434\u043E\u0432\u0440\u0448\u0435\u043D\u043E",
56888
+ "\u043D\u0435\u043F\u0440\u0430\u0442\u0435\u043D\u0438",
55957
56889
  "\u043D\u043E\u043E\u0440\u0433\u0443\u0443\u0434",
56890
+ "\u043D\u043E\u043E\u0440\u043E\u0433",
55958
56891
  "\u0441\u0438\u0451\u04B3\u043D\u0430\u0432\u0438\u0441",
56892
+ "\u0441\u043A\u0438\u0446\u0438",
55959
56893
  "\u0445\u043E\u043C\u0430\u043A\u0438 \u0445\u0430\u0442\u043B\u0430\u0440",
55960
56894
  "\u0447\u0430\u0440\u043D\u0430\u0432\u0456\u043A\u0456",
55961
56895
  "\u0447\u0435\u0440\u043D\u0435\u0442\u043A\u0438",
55962
56896
  "\u0447\u0435\u0440\u043D\u043E\u0432\u0438",
55963
56897
  "\u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u0438",
55964
56898
  "\u0447\u0435\u0440\u043D\u043E\u0432\u0438\u043A\u0442\u0435\u0440",
55965
- "\u057D\u0587\u0561\u0563\u0580\u0565\u0580",
56899
+ "\u0448\u0438\u043C\u0430\u0439 \u049B\u0430\u0493\u0430\u0437",
56900
+ "\u057D\u0565\u0582\u0561\u0563\u0580\u0565\u0580",
55966
56901
  "\u05D8\u05D9\u05D5\u05D8\u05D5\u05EA",
56902
+ "\u0627\u0644\u0645\u0633\u0648\u062F\u0627\u062A",
56903
+ "\u0628\u0627\u0631\u0644\u064A\u06A9",
56904
+ "\u0642\u0648\u0644\u064A\u0627\u0632\u0645\u0649\u0644\u0627\u0631",
55967
56905
  "\u0645\u0633\u0648\u062F\u0627\u062A",
55968
- "\u0645\u0633\u0648\u062F\u0627\u062A",
56906
+ "\u0645\u0633\u0648\u0651\u062F\u0627\u062A",
55969
56907
  "\u0645\u0648\u0633\u0648\u062F\u06D0",
56908
+ "\u0646\u0627\u0645\u0647 \u0647\u0627\u06CC \u0646\u0627\u062A\u06A9\u0645\u06CC\u0644",
55970
56909
  "\u067E\u06CC\u0634 \u0646\u0648\u06CC\u0633\u0647\u0627",
56910
+ "\u067E\u06CC\u0634\u200C\u0646\u0648\u06CC\u0633\u200C\u0647\u0627",
56911
+ "\u0688\u0631\u0627\u0641\u0679",
55971
56912
  "\u0688\u0631\u0627\u0641\u0679/",
55972
- "\u0921\u094D\u0930\u093E\u095E\u094D\u091F",
56913
+ "\u0695\u0647\u200C\u0634\u0646\u0648\u0648\u0633\u06D5\u06A9\u0627\u0646",
56914
+ "\u0921\u094D\u0930\u093E\u092B\u093C\u091F",
56915
+ "\u0921\u094D\u0930\u093E\u092B\u093C\u094D\u091F",
56916
+ "\u0921\u094D\u0930\u093E\u092B\u094D\u091F",
56917
+ "\u0921\u094D\u0930\u093E\u092B\u094D\u091F\u0939\u0930\u0942",
55973
56918
  "\u092A\u094D\u0930\u093E\u0930\u0942\u092A",
55974
- "\u0996\u09B8\u09DC\u09BE",
55975
- "\u0996\u09B8\u09DC\u09BE",
56919
+ "\u092E\u0938\u0941\u0926\u093E",
56920
+ "\u0996\u09B8\u09A1\u09BC\u09BE",
55976
56921
  "\u09A1\u09CD\u09F0\u09BE\u09AB\u09CD\u099F",
55977
56922
  "\u0A21\u0A4D\u0A30\u0A3E\u0A2B\u0A1F",
56923
+ "\u0AA1\u0ACD\u0AB0\u0ABE\u0AAB\u0ACD\u0A9F",
55978
56924
  "\u0AA1\u0ACD\u0AB0\u0ABE\u0AAB\u0ACD\u0A9F\u0AB8",
55979
56925
  "\u0B21\u0B4D\u0B30\u0B3E\u0B2B\u0B4D\u0B1F",
55980
56926
  "\u0BB5\u0BB0\u0BC8\u0BB5\u0BC1\u0B95\u0BB3\u0BCD",
55981
56927
  "\u0C1A\u0C3F\u0C24\u0C4D\u0C24\u0C41 \u0C2A\u0C4D\u0C30\u0C24\u0C41\u0C32\u0C41",
55982
56928
  "\u0C95\u0CB0\u0CA1\u0CC1\u0C97\u0CB3\u0CC1",
55983
56929
  "\u0D15\u0D30\u0D1F\u0D41\u0D15\u0D33\u0D4D\u200D",
56930
+ "\u0D21\u0D4D\u0D30\u0D3E\u0D2B\u0D4D\u0D31\u0D4D\u0D31\u0D41\u0D15\u0D7E",
56931
+ "\u0D2A\u0D42\u0D30\u0D4D\u200D\u0D24\u0D4D\u0D24\u0D3F\u0D2F\u0D3E\u0D15\u0D3E\u0D24\u0D4D\u0D24\u0D35",
56932
+ "\u0D9A\u0DA7\u0DD4 \u0DC3\u0DA7\u0DC4\u0DB1\u0DCA",
55984
56933
  "\u0D9A\u0DD9\u0DA7\u0DD4\u0DB8\u0DCA \u0DB4\u0DAD\u0DCA",
56934
+ "\u0E01\u0E25\u0E48\u0E2D\u0E07\u0E08\u0E14\u0E2B\u0E21\u0E32\u0E22\u0E23\u0E48\u0E32\u0E07",
55985
56935
  "\u0E09\u0E1A\u0E31\u0E1A\u0E23\u0E48\u0E32\u0E07",
56936
+ "\u0E23\u0E48\u0E32\u0E07",
56937
+ "\u101C\u102D\u1000\u103A\u1021\u1015\u103C\u1031\u102C\u1036",
56938
+ "\u10D3\u10E0\u10DD\u10D4\u10D1\u10D8\u10D7\u10D8",
55986
56939
  "\u10DB\u10DD\u10DC\u10D0\u10EE\u10D0\u10D6\u10D4\u10D1\u10D8",
56940
+ "\u10EC\u10D8\u10DC\u10D0\u10E1\u10EC\u10D0\u10E0\u10D8",
55987
56941
  "\u1228\u1242\u1246\u127D",
56942
+ "\u12C8\u1321\u1295 \u133D\u1211\u134D",
55988
56943
  "\u179F\u17B6\u179A\u1796\u17D2\u179A\u17B6\u1784",
56944
+ "\u179F\u17C1\u1785\u1780\u17D2\u178A\u17B8\u200B\u1796\u17D2\u179A\u17B6\u1784\u200B",
56945
+ "\u179F\u17C6\u1794\u17BB\u178F\u17D2\u179A\u1796\u1784\u17D2\u179A\u17C0\u1784",
55989
56946
  "\u4E0B\u66F8\u304D",
55990
56947
  "\u8349\u7A3F",
55991
- "\u8349\u7A3F",
55992
- "\u8349\u7A3F",
55993
- "\uC784\uC2DC \uBCF4\uAD00\uD568"
56948
+ "\u8349\u7A3F\u5323",
56949
+ "\u8349\u7A3F\u7BB1",
56950
+ "\uC784\uC2DC \uBCF4\uAD00\uD568",
56951
+ "\uCD08\uC548"
55994
56952
  ],
55995
- "\\Archive": ["archive"]
55996
- },
55997
- specialUse(hasSpecialUseExtension, folder) {
55998
- if (hasSpecialUseExtension) {
55999
- const flag2 = module.exports.flags.find((flag3) => folder.flags.has(flag3));
56000
- if (flag2) {
56001
- return { flag: flag2, source: "extension" };
56002
- }
56953
+ "\\Archive": [
56954
+ "an chartlann",
56955
+ "archief",
56956
+ "archieven",
56957
+ "archif",
56958
+ "archifau",
56959
+ "archiv",
56960
+ "archivados",
56961
+ "archivar",
56962
+ "archive",
56963
+ "archives",
56964
+ "archivi",
56965
+ "archivio",
56966
+ "archivo",
56967
+ "archivos",
56968
+ "archivova\u0165",
56969
+ "archivs",
56970
+ "archivu",
56971
+ "archiv\xE1l\xE1s",
56972
+ "archiwum",
56973
+ "archiwy",
56974
+ "archyvas",
56975
+ "archyvuoti",
56976
+ "arch\xEDv",
56977
+ "arch\xEDvum",
56978
+ "arch\xEDvy",
56979
+ "argief",
56980
+ "argiven",
56981
+ "argyf",
56982
+ "arhiiv",
56983
+ "arhiv",
56984
+ "arhiva",
56985
+ "arhive",
56986
+ "arhivi",
56987
+ "arhiv\u0103",
56988
+ "arh\u012Bvi",
56989
+ "arh\u012Bvs",
56990
+ "arkib",
56991
+ "arkisto",
56992
+ "arkiv",
56993
+ "arkiva",
56994
+ "arkiver",
56995
+ "arkivo",
56996
+ "arkivoje",
56997
+ "arquivamento",
56998
+ "arquivo",
56999
+ "arquivo morto",
57000
+ "arquivos",
57001
+ "arsip",
57002
+ "artxibatu",
57003
+ "artxiboa",
57004
+ "artxiboak",
57005
+ "arxiu",
57006
+ "arxiv",
57007
+ "arxivlar",
57008
+ "ar\u015Fiv",
57009
+ "ar\u015Fivler",
57010
+ "a\u1E25raz",
57011
+ "cartlanna",
57012
+ "diell",
57013
+ "diello\xF9",
57014
+ "er\u015F\xEEv",
57015
+ "geymsla",
57016
+ "goym \xED skjalasavni",
57017
+ "i\u0263baren",
57018
+ "l\u01B0u tr\u1EEF",
57019
+ "skjalageymsla",
57020
+ "taq yakb'\xE4l",
57021
+ "tasg-lannan",
57022
+ "\u03B1\u03C1\u03C7\u03B5\u03B9\u03BF\u03B8\u03AD\u03C4\u03B7\u03C3\u03B7",
57023
+ "\u03B1\u03C1\u03C7\u03B5\u03B9\u03BF\u03B8\u03AE\u03BA\u03B7",
57024
+ "\u0430\u0440\u0445\u0438\u0432",
57025
+ "\u0430\u0440\u0445\u0438\u0432\u0430",
57026
+ "\u0430\u0440\u0445\u0438\u0432\u0435",
57027
+ "\u0430\u0440\u0445\u0438\u0432\u0438",
57028
+ "\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0430\u0439",
57029
+ "\u0430\u0440\u0445\u0438\u0432\u0442\u0435\u0440",
57030
+ "\u0430\u0440\u0445\u0438\u0432\u044B",
57031
+ "\u0430\u0440\u0445\u0456\u0432",
57032
+ "\u0430\u0440\u0445\u0456\u0432\u0438",
57033
+ "\u0430\u0440\u0445\u0456\u0432\u044B",
57034
+ "\u0430\u0440\u0445\u0456\u045E",
57035
+ "\u043C\u04B1\u0440\u0430\u0493\u0430\u0442",
57036
+ "\u0561\u0580\u056D\u056B\u057E",
57037
+ "\u0561\u0580\u056D\u056B\u0582\u0576\u0565\u0580",
57038
+ "\u05D0\u05E8\u05DB\u05D9\u05D5\u05DF",
57039
+ "\u0623\u0631\u0634\u0641\u0629",
57040
+ "\u0623\u0631\u0634\u064A\u0641",
57041
+ "\u0626\u0627\u0631\u062E\u0649\u067E",
57042
+ "\u0626\u06D5\u0631\u0634\u06CC\u0641",
57043
+ "\u0627\u0631\u0634\u06CC\u0648",
57044
+ "\u0627\u0644\u0623\u0631\u0634\u064A\u0641",
57045
+ "\u0628\u0627\u06CC\u06AF\u0627\u0646\u06CC",
57046
+ "\u091C\u0924\u0928 \u0915\u0947\u0932\u0947\u0932\u093E",
57047
+ "\u0938\u0902\u0917\u094D\u0930\u0939",
57048
+ "\u0D36\u0D47\u0D16\u0D30\u0D02",
57049
+ "\u0DC3\u0D82\u0DBB\u0D9A\u0DCA\u200D\u0DC2\u0DAB\u0DBA",
57050
+ "\u0E01\u0E32\u0E23\u0E40\u0E01\u0E47\u0E1A\u0E16\u0E32\u0E27\u0E23",
57051
+ "\u0E17\u0E35\u0E48\u0E40\u0E01\u0E47\u0E1A\u0E16\u0E32\u0E27\u0E23",
57052
+ "\u10D0\u10E0\u10E5\u10D8\u10D5\u10D4\u10D1\u10D8",
57053
+ "\u10D0\u10E0\u10E5\u10D8\u10D5\u10D8",
57054
+ "\u1794\u17D0\u178E\u17D2\u178E\u179F\u17B6\u179A",
57055
+ "\u1794\u17D0\u178E\u17D2\u178E\u179F\u17B6\u179A\u200B",
57056
+ "\u30A2\u30FC\u30AB\u30A4\u30D6",
57057
+ "\u5099\u5B58",
57058
+ "\u5B58\u6863",
57059
+ "\u5B58\u6A94",
57060
+ "\u5C01\u5B58",
57061
+ "\u5F52\u6863",
57062
+ "\uBCF4\uAD00 \uD3B8\uC9C0\uD568",
57063
+ "\uBCF4\uAD00\uD568",
57064
+ "\uC800\uC7A5 \uD3B8\uC9C0\uD568"
57065
+ ]
57066
+ }
57067
+ };
57068
+ var NAME_INDEX = /* @__PURE__ */ new Map();
57069
+ for (let flag of Object.keys(module.exports.names)) {
57070
+ for (let entry of module.exports.names[flag]) {
57071
+ NAME_INDEX.set(entry, flag);
57072
+ }
57073
+ }
57074
+ function normalizeName(name) {
57075
+ return name.toLowerCase().replace(/\u200e/g, "").trim().normalize("NFKC");
57076
+ }
57077
+ module.exports.specialUse = (hasSpecialUseExtension, folder) => {
57078
+ if (hasSpecialUseExtension) {
57079
+ const flag2 = module.exports.flags.find((flag3) => folder.flags.has(flag3));
57080
+ if (flag2) {
57081
+ return { flag: flag2, source: "extension" };
56003
57082
  }
56004
- let name = folder.name.toLowerCase().replace(/\u200e/g, "").trim();
56005
- const flag = Object.keys(module.exports.names).find((flag2) => module.exports.names[flag2].includes(name));
57083
+ }
57084
+ let name = normalizeName(folder.name);
57085
+ let flag = NAME_INDEX.get(name);
57086
+ if (flag) {
57087
+ return { flag, source: "name" };
57088
+ }
57089
+ let core = name.split(TOKEN_SPLIT).filter((token) => token && !GENERIC_TOKENS.has(token));
57090
+ if (core.length === 1 && core[0] !== name) {
57091
+ flag = NAME_INDEX.get(core[0]);
56006
57092
  if (flag) {
56007
- return { flag, source: "name" };
57093
+ return { flag, source: "name-guess" };
56008
57094
  }
56009
- return { flag: null };
56010
57095
  }
57096
+ return { flag: null };
56011
57097
  };
56012
57098
  }
56013
57099
  });
56014
57100
 
56015
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/list.js
57101
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/list.js
56016
57102
  var require_list = __commonJS({
56017
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/list.js"(exports, module) {
57103
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/list.js"(exports, module) {
56018
57104
  "use strict";
56019
- var { decodePath, encodePath, normalizePath } = require_tools2();
57105
+ var { decodePath, encodePath, normalizePath, enhanceCommandError, hasCapability, isRev2Active, buildStatusQueryAttributes } = require_tools2();
56020
57106
  var { specialUse } = require_special_use();
56021
57107
  module.exports = async (connection, reference, mailbox, options) => {
56022
57108
  options = options || {};
56023
57109
  const FLAG_SORT_ORDER = ["\\Inbox", "\\Flagged", "\\Sent", "\\Drafts", "\\All", "\\Archive", "\\Junk", "\\Trash"];
56024
- const SOURCE_SORT_ORDER = ["user", "extension", "name"];
56025
- let listCommand = connection.capabilities.has("XLIST") && !connection.capabilities.has("SPECIAL-USE") ? "XLIST" : "LIST";
56026
- let response;
57110
+ const SOURCE_SORT_ORDER = ["user", "extension", "name", "name-guess"];
57111
+ const PUBLIC_SOURCE = { "name-guess": "name" };
57112
+ const isNameSource = (source) => source === "name" || source === "name-guess";
57113
+ let listCommand = connection.capabilities.has("XLIST") && !hasCapability(connection, "SPECIAL-USE") ? "XLIST" : "LIST";
56027
57114
  try {
56028
- let entries = [];
56029
- let statusMap = /* @__PURE__ */ new Map();
56030
- let returnArgs = [];
56031
- let statusQueryAttributes = [];
56032
- if (options.statusQuery) {
56033
- Object.keys(options.statusQuery).forEach((key) => {
56034
- if (!options.statusQuery[key]) {
56035
- return;
56036
- }
56037
- switch (key.toUpperCase()) {
56038
- case "MESSAGES":
56039
- case "RECENT":
56040
- case "UIDNEXT":
56041
- case "UIDVALIDITY":
56042
- case "UNSEEN":
56043
- statusQueryAttributes.push({ type: "ATOM", value: key.toUpperCase() });
56044
- break;
56045
- case "HIGHESTMODSEQ":
56046
- if (connection.capabilities.has("CONDSTORE")) {
56047
- statusQueryAttributes.push({ type: "ATOM", value: key.toUpperCase() });
56048
- }
56049
- break;
56050
- }
56051
- });
56052
- }
56053
- if (listCommand === "LIST" && connection.capabilities.has("LIST-STATUS") && statusQueryAttributes.length) {
56054
- returnArgs.push({ type: "ATOM", value: "STATUS" }, statusQueryAttributes);
56055
- if (connection.capabilities.has("SPECIAL-USE")) {
56056
- returnArgs.push({ type: "ATOM", value: "SPECIAL-USE" });
56057
- }
56058
- }
56059
- let specialUseMatches = {};
57115
+ let entries;
57116
+ let statusMap;
57117
+ let specialUseMatches;
57118
+ let statusQueryAttributes = buildStatusQueryAttributes(connection, options.statusQuery);
57119
+ let supportsExtendedList = connection.capabilities.has("LIST-EXTENDED") || connection.capabilities.has("IMAP4rev2");
57120
+ let canRequestStatus = listCommand === "LIST" && !connection.skipListStatusArgs && hasCapability(connection, "LIST-STATUS") && !!statusQueryAttributes.length;
57121
+ let canRequestSubscribed = listCommand === "LIST" && !options.listOnly && !connection.skipListSubscribedArg && supportsExtendedList;
57122
+ let auxArgsAvailable = hasCapability(connection, "SPECIAL-USE") || connection.capabilities.has("CHILDREN") || supportsExtendedList;
57123
+ let stageHasAuxArgs = (stage) => (stage.status || stage.subscribed) && stage.aux !== false && !connection.skipListAuxArgs && auxArgsAvailable;
57124
+ let buildListArgs = (stage) => {
57125
+ let args = [];
57126
+ if (stage.status) {
57127
+ args.push({ type: "ATOM", value: "STATUS" }, statusQueryAttributes);
57128
+ }
57129
+ if (stageHasAuxArgs(stage)) {
57130
+ if (hasCapability(connection, "SPECIAL-USE")) {
57131
+ args.push({ type: "ATOM", value: "SPECIAL-USE" });
57132
+ }
57133
+ if (connection.capabilities.has("CHILDREN") || supportsExtendedList) {
57134
+ args.push({ type: "ATOM", value: "CHILDREN" });
57135
+ }
57136
+ }
57137
+ if (stage.subscribed) {
57138
+ args.push({ type: "ATOM", value: "SUBSCRIBED" });
57139
+ }
57140
+ return args;
57141
+ };
56060
57142
  let addSpecialUseMatch = (entry, type, source) => {
56061
57143
  if (!specialUseMatches[type]) {
56062
57144
  specialUseMatches[type] = [];
@@ -56067,6 +57149,10 @@ var require_list = __commonJS({
56067
57149
  if (entry.flags.has("\\NonExistent")) {
56068
57150
  entry.flags.add("\\Noselect");
56069
57151
  }
57152
+ if (entry.flags.has("\\Subscribed")) {
57153
+ entry.flags.delete("\\Subscribed");
57154
+ entry.subscribed = true;
57155
+ }
56070
57156
  };
56071
57157
  let specialUseHints = {};
56072
57158
  if (options.specialUseHints && typeof options.specialUseHints === "object") {
@@ -56076,12 +57162,12 @@ var require_list = __commonJS({
56076
57162
  }
56077
57163
  }
56078
57164
  }
56079
- let runList = async (reference2, mailbox2) => {
57165
+ let runList = async (reference2, mailbox2, returnArgs) => {
56080
57166
  const cmdArgs = [encodePath(connection, reference2), encodePath(connection, mailbox2)];
56081
57167
  if (returnArgs.length) {
56082
57168
  cmdArgs.push({ type: "ATOM", value: "RETURN" }, returnArgs);
56083
57169
  }
56084
- response = await connection.exec(listCommand, cmdArgs, {
57170
+ let response = await connection.exec(listCommand, cmdArgs, {
56085
57171
  untagged: {
56086
57172
  // Each untagged LIST response: * LIST (<flags>) "<delimiter>" "<mailbox name>"
56087
57173
  // attributes[0] = flags array, attributes[1] = delimiter, attributes[2] = mailbox name
@@ -56107,7 +57193,7 @@ var require_list = __commonJS({
56107
57193
  addSpecialUseMatch(entry, "\\Inbox", "extension");
56108
57194
  }
56109
57195
  }
56110
- if (entry.path.toUpperCase() === "INBOX") {
57196
+ if (entry.path.toUpperCase() === "INBOX" && !entry.flags.has("\\NonExistent")) {
56111
57197
  addSpecialUseMatch(entry, "\\Inbox", "name");
56112
57198
  }
56113
57199
  if (entry.delimiter && entry.path.charAt(0) === entry.delimiter) {
@@ -56117,10 +57203,10 @@ var require_list = __commonJS({
56117
57203
  entry.parent = entry.delimiter ? entry.path.split(entry.delimiter) : [entry.path];
56118
57204
  entry.name = entry.parent.pop();
56119
57205
  let { flag: specialUseFlag, source: flagSource } = specialUse(
56120
- connection.capabilities.has("XLIST") || connection.capabilities.has("SPECIAL-USE"),
57206
+ connection.capabilities.has("XLIST") || hasCapability(connection, "SPECIAL-USE"),
56121
57207
  entry
56122
57208
  );
56123
- if (specialUseFlag) {
57209
+ if (specialUseFlag && (!isNameSource(flagSource) || !entry.flags.has("\\NonExistent"))) {
56124
57210
  addSpecialUseMatch(entry, specialUseFlag, flagSource);
56125
57211
  }
56126
57212
  entries.push(entry);
@@ -56139,7 +57225,10 @@ var require_list = __commonJS({
56139
57225
  UIDNEXT: { key: "uidNext", parser: Number },
56140
57226
  UIDVALIDITY: { key: "uidValidity", parser: BigInt },
56141
57227
  UNSEEN: { key: "unseen", parser: Number },
56142
- HIGHESTMODSEQ: { key: "highestModseq", parser: BigInt }
57228
+ HIGHESTMODSEQ: { key: "highestModseq", parser: BigInt },
57229
+ // IMAP4rev2 additions (RFC 9051): mailbox size and \Deleted count
57230
+ SIZE: { key: "size", parser: Number },
57231
+ DELETED: { key: "deleted", parser: Number }
56143
57232
  };
56144
57233
  let key;
56145
57234
  let map = { path: statusPath };
@@ -56168,18 +57257,94 @@ var require_list = __commonJS({
56168
57257
  response.next();
56169
57258
  };
56170
57259
  let normalizedReference = normalizePath(connection, reference || "");
56171
- await runList(normalizedReference, normalizePath(connection, mailbox || "", true));
57260
+ let normalizedMailbox = normalizePath(connection, mailbox || "", true);
57261
+ let stages = [];
57262
+ if (canRequestStatus && canRequestSubscribed) {
57263
+ stages.push({ status: true, subscribed: true });
57264
+ }
57265
+ if (canRequestStatus) {
57266
+ stages.push({ status: true, subscribed: false });
57267
+ } else if (canRequestSubscribed) {
57268
+ stages.push({ status: false, subscribed: true });
57269
+ }
57270
+ stages.push({ status: false, subscribed: false });
57271
+ let isRejectedCommand = (err) => err.responseStatus === "BAD" && err.code !== "ETHROTTLE";
57272
+ let successStage = null;
57273
+ let subscriptionStateKnown = false;
57274
+ let anyEntrySubscribed = () => entries.some((entry) => entry.subscribed);
57275
+ let lastRejectedStage = null;
57276
+ let auxRetryInserted = false;
57277
+ for (let i = 0; i < stages.length; i++) {
57278
+ let stage = stages[i];
57279
+ let stageArgs = buildListArgs(stage);
57280
+ entries = [];
57281
+ statusMap = /* @__PURE__ */ new Map();
57282
+ specialUseMatches = {};
57283
+ try {
57284
+ await runList(normalizedReference, normalizedMailbox, stageArgs);
57285
+ if (lastRejectedStage) {
57286
+ if (lastRejectedStage.subscribed && !stage.subscribed) {
57287
+ connection.skipListSubscribedArg = true;
57288
+ }
57289
+ if (lastRejectedStage.status && !stage.status) {
57290
+ connection.skipListStatusArgs = true;
57291
+ }
57292
+ if (stageHasAuxArgs(lastRejectedStage) && stage.aux === false && lastRejectedStage.status === stage.status && lastRejectedStage.subscribed === stage.subscribed) {
57293
+ connection.skipListAuxArgs = true;
57294
+ }
57295
+ }
57296
+ successStage = stage;
57297
+ subscriptionStateKnown = !!stage.subscribed;
57298
+ break;
57299
+ } catch (err) {
57300
+ if (i === stages.length - 1 || !isRejectedCommand(err)) {
57301
+ throw err;
57302
+ }
57303
+ lastRejectedStage = stage;
57304
+ if (!auxRetryInserted && stageHasAuxArgs(stage)) {
57305
+ stages.splice(i + 1, 0, { ...stage, aux: false });
57306
+ auxRetryInserted = true;
57307
+ }
57308
+ connection.log.warn({ msg: "LIST RETURN options rejected, retrying with reduced options", err, cid: connection.id });
57309
+ }
57310
+ }
56172
57311
  if (options.listOnly) {
56173
57312
  return entries;
56174
57313
  }
56175
57314
  if (normalizedReference && !specialUseMatches["\\Inbox"]) {
56176
- await runList("", "INBOX");
57315
+ let returnArgs = buildListArgs(successStage);
57316
+ let entryCountBefore = entries.length;
57317
+ let specialUseCountsBefore = {};
57318
+ for (let type of Object.keys(specialUseMatches)) {
57319
+ specialUseCountsBefore[type] = specialUseMatches[type].length;
57320
+ }
57321
+ try {
57322
+ await runList("", "INBOX", returnArgs);
57323
+ } catch (err) {
57324
+ if (!returnArgs.length || !isRejectedCommand(err)) {
57325
+ throw err;
57326
+ }
57327
+ entries.length = entryCountBefore;
57328
+ for (let type of Object.keys(specialUseMatches)) {
57329
+ if (!(type in specialUseCountsBefore)) {
57330
+ delete specialUseMatches[type];
57331
+ } else {
57332
+ specialUseMatches[type].length = specialUseCountsBefore[type];
57333
+ }
57334
+ }
57335
+ connection.log.warn({ msg: "INBOX LIST with RETURN options failed, retrying plain", err, cid: connection.id });
57336
+ await runList("", "INBOX", []);
57337
+ }
56177
57338
  }
56178
57339
  if (options.statusQuery) {
57340
+ let syntheticRecent = options.statusQuery.recent && isRev2Active(connection);
56179
57341
  for (let entry of entries) {
56180
57342
  if (!entry.flags.has("\\Noselect") && !entry.flags.has("\\NonExistent")) {
56181
57343
  if (statusMap.has(entry.path)) {
56182
57344
  entry.status = statusMap.get(entry.path);
57345
+ if (syntheticRecent) {
57346
+ entry.status.recent = 0;
57347
+ }
56183
57348
  } else if (!statusMap.size) {
56184
57349
  try {
56185
57350
  entry.status = await connection.run("STATUS", entry.path, options.statusQuery);
@@ -56190,10 +57355,8 @@ var require_list = __commonJS({
56190
57355
  }
56191
57356
  }
56192
57357
  }
56193
- response = await connection.exec(
56194
- "LSUB",
56195
- [encodePath(connection, normalizePath(connection, reference || "")), encodePath(connection, normalizePath(connection, mailbox || "", true))],
56196
- {
57358
+ let runLsub = async () => {
57359
+ let response = await connection.exec("LSUB", [encodePath(connection, normalizedReference), encodePath(connection, normalizedMailbox)], {
56197
57360
  untagged: {
56198
57361
  LSUB: async (untagged) => {
56199
57362
  if (!untagged.attributes || !untagged.attributes.length) {
@@ -56223,9 +57386,26 @@ var require_list = __commonJS({
56223
57386
  }
56224
57387
  }
56225
57388
  }
57389
+ });
57390
+ response.next();
57391
+ };
57392
+ let needsLsub = !isRev2Active(connection) && (!successStage.subscribed || !anyEntrySubscribed());
57393
+ if (needsLsub) {
57394
+ subscriptionStateKnown = false;
57395
+ }
57396
+ if (needsLsub && !connection.skipLsub) {
57397
+ try {
57398
+ await runLsub();
57399
+ subscriptionStateKnown = true;
57400
+ } catch (err) {
57401
+ if (isRejectedCommand(err)) {
57402
+ connection.skipLsub = true;
57403
+ } else if (err.responseStatus !== "NO" || err.code === "ETHROTTLE") {
57404
+ throw err;
57405
+ }
57406
+ connection.log.warn({ msg: "Failed to request subscription info", err, cid: connection.id });
56226
57407
  }
56227
- );
56228
- response.next();
57408
+ }
56229
57409
  for (let type of Object.keys(specialUseMatches)) {
56230
57410
  let sortedEntries = specialUseMatches[type].sort((a, b) => {
56231
57411
  let aSource = SOURCE_SORT_ORDER.indexOf(a.source);
@@ -56236,8 +57416,16 @@ var require_list = __commonJS({
56236
57416
  return aSource - bSource;
56237
57417
  });
56238
57418
  if (!sortedEntries[0].entry.specialUse) {
57419
+ let source = sortedEntries[0].source;
56239
57420
  sortedEntries[0].entry.specialUse = type;
56240
- sortedEntries[0].entry.specialUseSource = sortedEntries[0].source;
57421
+ sortedEntries[0].entry.specialUseSource = PUBLIC_SOURCE[source] || source;
57422
+ }
57423
+ }
57424
+ if (!subscriptionStateKnown && !anyEntrySubscribed()) {
57425
+ for (let entry of entries) {
57426
+ if (!entry.flags.has("\\NonExistent")) {
57427
+ entry.subscribed = true;
57428
+ }
56241
57429
  }
56242
57430
  }
56243
57431
  let inboxEntry = entries.find((entry) => entry.specialUse === "\\Inbox");
@@ -56266,6 +57454,7 @@ var require_list = __commonJS({
56266
57454
  return a.path.localeCompare(b.path);
56267
57455
  });
56268
57456
  } catch (err) {
57457
+ await enhanceCommandError(err);
56269
57458
  connection.log.warn({ msg: "Failed to list folders", err, cid: connection.id });
56270
57459
  throw err;
56271
57460
  }
@@ -56273,15 +57462,17 @@ var require_list = __commonJS({
56273
57462
  }
56274
57463
  });
56275
57464
 
56276
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/enable.js
57465
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/enable.js
56277
57466
  var require_enable = __commonJS({
56278
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/enable.js"(exports, module) {
57467
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/enable.js"(exports, module) {
56279
57468
  "use strict";
57469
+ var { hasCapability } = require_tools2();
56280
57470
  module.exports = async (connection, extensionList) => {
56281
- if (!connection.capabilities.has("ENABLE") || connection.state !== connection.states.AUTHENTICATED) {
57471
+ if (!hasCapability(connection, "ENABLE") || connection.state !== connection.states.AUTHENTICATED) {
56282
57472
  return;
56283
57473
  }
56284
- extensionList = extensionList.filter((extension) => connection.capabilities.has(extension.toUpperCase()));
57474
+ let advertised = new Set([...connection.capabilities.keys()].map((capability) => capability.toUpperCase()));
57475
+ extensionList = extensionList.filter((extension) => advertised.has(extension.toUpperCase()));
56285
57476
  if (!extensionList.length) {
56286
57477
  return;
56287
57478
  }
@@ -56309,9 +57500,9 @@ var require_enable = __commonJS({
56309
57500
  }
56310
57501
  }
56311
57502
  );
56312
- connection.enabled = enabled;
57503
+ connection.enabled = /* @__PURE__ */ new Set([...connection.enabled, ...enabled]);
56313
57504
  response.next();
56314
- return enabled;
57505
+ return connection.enabled;
56315
57506
  } catch (err) {
56316
57507
  connection.log.warn({ err, cid: connection.id });
56317
57508
  return false;
@@ -56320,9 +57511,9 @@ var require_enable = __commonJS({
56320
57511
  }
56321
57512
  });
56322
57513
 
56323
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/select.js
57514
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/select.js
56324
57515
  var require_select = __commonJS({
56325
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/select.js"(exports, module) {
57516
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/select.js"(exports, module) {
56326
57517
  "use strict";
56327
57518
  var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
56328
57519
  module.exports = async (connection, path, options) => {
@@ -56514,18 +57705,19 @@ var require_select = __commonJS({
56514
57705
  }
56515
57706
  });
56516
57707
 
56517
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/fetch.js
57708
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/fetch.js
56518
57709
  var require_fetch2 = __commonJS({
56519
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/fetch.js"(exports, module) {
57710
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/fetch.js"(exports, module) {
56520
57711
  "use strict";
56521
- var { formatMessageResponse } = require_tools2();
57712
+ var { formatMessageResponse, isRev2Active } = require_tools2();
56522
57713
  module.exports = async (connection, range, query, options) => {
56523
57714
  if (connection.state !== connection.states.SELECTED || !range) {
56524
57715
  return;
56525
57716
  }
56526
57717
  options = options || {};
56527
57718
  let mailbox = connection.mailbox;
56528
- const commandKey = connection.capabilities.has("BINARY") && options.binary && !connection.disableBinary ? "BINARY" : "BODY";
57719
+ const canUseBinary = connection.capabilities.has("BINARY") || isRev2Active(connection);
57720
+ const commandKey = canUseBinary && options.binary && !connection.disableBinary ? "BINARY" : "BODY";
56529
57721
  let retryCount = 0;
56530
57722
  const maxRetries = 4;
56531
57723
  const baseDelay = 1e3;
@@ -56539,19 +57731,14 @@ var require_fetch2 = __commonJS({
56539
57731
  let attributes = [{ type: "SEQUENCE", value: (range || "*").toString() }];
56540
57732
  let queryStructure = [];
56541
57733
  let setBodyPeek = (attributes2, partial2) => {
57734
+ let section = [].concat(attributes2 || []);
57735
+ let binaryAddressable = !section.length || section.length === 1 && typeof section[0].value === "string" && /^\d+(\.\d+)*$/.test(section[0].value);
56542
57736
  let bodyPeek = {
56543
57737
  type: "ATOM",
56544
- value: `${commandKey}.PEEK`,
56545
- section: [],
57738
+ value: `${binaryAddressable ? commandKey : "BODY"}.PEEK`,
57739
+ section,
56546
57740
  partial: partial2
56547
57741
  };
56548
- if (Array.isArray(attributes2)) {
56549
- attributes2.forEach((attribute) => {
56550
- bodyPeek.section.push(attribute);
56551
- });
56552
- } else if (attributes2) {
56553
- bodyPeek.section.push(attributes2);
56554
- }
56555
57742
  queryStructure.push(bodyPeek);
56556
57743
  };
56557
57744
  ["all", "fast", "full", "uid", "flags", "bodyStructure", "envelope", "internalDate"].forEach((key) => {
@@ -56570,7 +57757,7 @@ var require_fetch2 = __commonJS({
56570
57757
  partial2.push(Number(query.source.maxLength));
56571
57758
  }
56572
57759
  }
56573
- queryStructure.push({ type: "ATOM", value: `${commandKey}.PEEK`, section: [], partial: partial2 });
57760
+ setBodyPeek(null, partial2);
56574
57761
  }
56575
57762
  if (connection.capabilities.has("OBJECTID")) {
56576
57763
  queryStructure.push({ type: "ATOM", value: "EMAILID" });
@@ -56702,9 +57889,9 @@ var require_fetch2 = __commonJS({
56702
57889
  }
56703
57890
  });
56704
57891
 
56705
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/create.js
57892
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/create.js
56706
57893
  var require_create = __commonJS({
56707
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/create.js"(exports, module) {
57894
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/create.js"(exports, module) {
56708
57895
  "use strict";
56709
57896
  var { encodePath, normalizePath, getStatusCode, enhanceCommandError } = require_tools2();
56710
57897
  module.exports = async (connection, path) => {
@@ -56761,9 +57948,9 @@ var require_create = __commonJS({
56761
57948
  }
56762
57949
  });
56763
57950
 
56764
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/delete.js
57951
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/delete.js
56765
57952
  var require_delete = __commonJS({
56766
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/delete.js"(exports, module) {
57953
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/delete.js"(exports, module) {
56767
57954
  "use strict";
56768
57955
  var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
56769
57956
  module.exports = async (connection, path) => {
@@ -56791,9 +57978,9 @@ var require_delete = __commonJS({
56791
57978
  }
56792
57979
  });
56793
57980
 
56794
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/rename.js
57981
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/rename.js
56795
57982
  var require_rename = __commonJS({
56796
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/rename.js"(exports, module) {
57983
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/rename.js"(exports, module) {
56797
57984
  "use strict";
56798
57985
  var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
56799
57986
  module.exports = async (connection, path, newPath) => {
@@ -56826,9 +58013,9 @@ var require_rename = __commonJS({
56826
58013
  }
56827
58014
  });
56828
58015
 
56829
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/close.js
58016
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/close.js
56830
58017
  var require_close = __commonJS({
56831
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/close.js"(exports, module) {
58018
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/close.js"(exports, module) {
56832
58019
  "use strict";
56833
58020
  module.exports = async (connection) => {
56834
58021
  if (connection.state !== connection.states.SELECTED) {
@@ -56854,9 +58041,9 @@ var require_close = __commonJS({
56854
58041
  }
56855
58042
  });
56856
58043
 
56857
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/subscribe.js
58044
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/subscribe.js
56858
58045
  var require_subscribe = __commonJS({
56859
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/subscribe.js"(exports, module) {
58046
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/subscribe.js"(exports, module) {
56860
58047
  "use strict";
56861
58048
  var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
56862
58049
  module.exports = async (connection, path) => {
@@ -56878,9 +58065,9 @@ var require_subscribe = __commonJS({
56878
58065
  }
56879
58066
  });
56880
58067
 
56881
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/unsubscribe.js
58068
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/unsubscribe.js
56882
58069
  var require_unsubscribe = __commonJS({
56883
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/unsubscribe.js"(exports, module) {
58070
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/unsubscribe.js"(exports, module) {
56884
58071
  "use strict";
56885
58072
  var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
56886
58073
  module.exports = async (connection, path) => {
@@ -56902,9 +58089,9 @@ var require_unsubscribe = __commonJS({
56902
58089
  }
56903
58090
  });
56904
58091
 
56905
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/store.js
58092
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/store.js
56906
58093
  var require_store = __commonJS({
56907
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/store.js"(exports, module) {
58094
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/store.js"(exports, module) {
56908
58095
  "use strict";
56909
58096
  var { formatFlag, canUseFlag, enhanceCommandError } = require_tools2();
56910
58097
  module.exports = async (connection, range, flags, options) => {
@@ -56966,11 +58153,11 @@ var require_store = __commonJS({
56966
58153
  }
56967
58154
  });
56968
58155
 
56969
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/search-compiler.js
58156
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/search-compiler.js
56970
58157
  var require_search_compiler = __commonJS({
56971
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/search-compiler.js"(exports, module) {
58158
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/search-compiler.js"(exports, module) {
56972
58159
  "use strict";
56973
- var { formatDate, formatFlag, canUseFlag, isDate } = require_tools2();
58160
+ var { formatDate, formatFlag, canUseFlag, isDate, isRev2Active } = require_tools2();
56974
58161
  var setBoolOpt = (attributes, term, value) => {
56975
58162
  if (!value) {
56976
58163
  if (/^un/i.test(term)) {
@@ -57050,10 +58237,19 @@ var require_search_compiler = __commonJS({
57050
58237
  break;
57051
58238
  // Simple boolean flags without UN- support
57052
58239
  case "ALL":
58240
+ if (params[term]) {
58241
+ setBoolOpt(attributes, term, true);
58242
+ }
58243
+ break;
57053
58244
  case "NEW":
57054
58245
  case "OLD":
57055
58246
  case "RECENT":
57056
58247
  if (params[term]) {
58248
+ if (isRev2Active(connection)) {
58249
+ let error2 = new Error(`The "${term.toLowerCase()}" search key does not exist in IMAP4rev2`);
58250
+ error2.code = "MissingServerExtension";
58251
+ throw error2;
58252
+ }
57057
58253
  setBoolOpt(attributes, term, true);
57058
58254
  }
57059
58255
  break;
@@ -57283,12 +58479,18 @@ var require_search_compiler = __commonJS({
57283
58479
  }
57284
58480
  });
57285
58481
 
57286
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/search.js
58482
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/search.js
57287
58483
  var require_search = __commonJS({
57288
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/search.js"(exports, module) {
58484
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/search.js"(exports, module) {
57289
58485
  "use strict";
57290
- var { enhanceCommandError } = require_tools2();
58486
+ var { enhanceCommandError, hasCapability, isValidSequenceValue } = require_tools2();
57291
58487
  var { searchCompiler } = require_search_compiler();
58488
+ var stripEsearchPrefix = (attrs) => {
58489
+ let start = 0;
58490
+ if (attrs[start] && Array.isArray(attrs[start])) start++;
58491
+ if (attrs[start] && typeof attrs[start].value === "string" && attrs[start].value.toUpperCase() === "UID") start++;
58492
+ return attrs.slice(start);
58493
+ };
57292
58494
  function parseEsearchResponse(attrs) {
57293
58495
  const result = {};
57294
58496
  let i = 0;
@@ -57328,7 +58530,7 @@ var require_search = __commonJS({
57328
58530
  }
57329
58531
  case "PARTIAL": {
57330
58532
  const listToken = attrs[++i];
57331
- const items = Array.isArray(listToken) ? listToken : listToken && Array.isArray(listToken.attributes) ? listToken.attributes : null;
58533
+ const items = Array.isArray(listToken) ? listToken : null;
57332
58534
  if (!items || items.length < 2) break;
57333
58535
  result.partial = {
57334
58536
  range: items[0].value,
@@ -57357,7 +58559,7 @@ var require_search = __commonJS({
57357
58559
  } else {
57358
58560
  return false;
57359
58561
  }
57360
- const useEsearch = options.returnOptions && options.returnOptions.length > 0 && connection.capabilities.has("ESEARCH");
58562
+ const useEsearch = options.returnOptions && options.returnOptions.length > 0 && hasCapability(connection, "ESEARCH");
57361
58563
  if (useEsearch) {
57362
58564
  const returnItems = [];
57363
58565
  for (const opt of options.returnOptions) {
@@ -57377,11 +58579,7 @@ var require_search = __commonJS({
57377
58579
  untagged: {
57378
58580
  ESEARCH: async (untagged) => {
57379
58581
  if (!untagged || !untagged.attributes) return;
57380
- let attrs = untagged.attributes;
57381
- let start = 0;
57382
- if (attrs[start] && (Array.isArray(attrs[start]) || attrs[start].type === "LIST")) start++;
57383
- if (attrs[start] && typeof attrs[start].value === "string" && attrs[start].value.toUpperCase() === "UID") start++;
57384
- esearchResult = parseEsearchResponse(attrs.slice(start));
58582
+ esearchResult = parseEsearchResponse(stripEsearchPrefix(untagged.attributes));
57385
58583
  }
57386
58584
  }
57387
58585
  });
@@ -57407,6 +58605,60 @@ var require_search = __commonJS({
57407
58605
  }
57408
58606
  });
57409
58607
  }
58608
+ },
58609
+ // IMAP4rev2 servers answer even a plain SEARCH with an untagged
58610
+ // ESEARCH response (RFC 9051 deprecated the SEARCH response), so
58611
+ // both forms are collected into the same result set
58612
+ ESEARCH: async (untagged) => {
58613
+ if (!untagged || !untagged.attributes) {
58614
+ return;
58615
+ }
58616
+ let parsed = parseEsearchResponse(stripEsearchPrefix(untagged.attributes));
58617
+ if (parsed.all) {
58618
+ let existsCount = () => connection.mailbox && connection.mailbox.exists || 0;
58619
+ let overBudget = () => results.size >= existsCount();
58620
+ let resolveId = (part) => part === "*" ? options.uid ? 0 : existsCount() : Number(part);
58621
+ let truncated = false;
58622
+ let discarded = false;
58623
+ sequenceSetLoop: for (let part of parsed.all.split(",")) {
58624
+ part = part.trim();
58625
+ let colon = part.indexOf(":");
58626
+ if (colon < 0) {
58627
+ let value = resolveId(part);
58628
+ if (!isValidSequenceValue(value)) {
58629
+ discarded = true;
58630
+ continue;
58631
+ }
58632
+ if (overBudget()) {
58633
+ truncated = true;
58634
+ break;
58635
+ }
58636
+ results.add(value);
58637
+ continue;
58638
+ }
58639
+ let first = resolveId(part.substr(0, colon));
58640
+ let second = resolveId(part.substr(colon + 1));
58641
+ if (!isValidSequenceValue(first) || !isValidSequenceValue(second)) {
58642
+ discarded = true;
58643
+ continue;
58644
+ }
58645
+ for (let id = Math.min(first, second); id <= Math.max(first, second); id++) {
58646
+ if (overBudget()) {
58647
+ truncated = true;
58648
+ break sequenceSetLoop;
58649
+ }
58650
+ results.add(id);
58651
+ }
58652
+ }
58653
+ if (truncated || discarded) {
58654
+ connection.log.warn({
58655
+ msg: "Invalid entries in the ESEARCH ALL result",
58656
+ truncated,
58657
+ discarded,
58658
+ cid: connection.id
58659
+ });
58660
+ }
58661
+ }
57410
58662
  }
57411
58663
  }
57412
58664
  });
@@ -57422,9 +58674,9 @@ var require_search = __commonJS({
57422
58674
  }
57423
58675
  });
57424
58676
 
57425
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/noop.js
58677
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/noop.js
57426
58678
  var require_noop = __commonJS({
57427
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/noop.js"(exports, module) {
58679
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/noop.js"(exports, module) {
57428
58680
  "use strict";
57429
58681
  module.exports = async (connection) => {
57430
58682
  try {
@@ -57439,18 +58691,18 @@ var require_noop = __commonJS({
57439
58691
  }
57440
58692
  });
57441
58693
 
57442
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/expunge.js
58694
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/expunge.js
57443
58695
  var require_expunge = __commonJS({
57444
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/expunge.js"(exports, module) {
58696
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/expunge.js"(exports, module) {
57445
58697
  "use strict";
57446
- var { enhanceCommandError } = require_tools2();
58698
+ var { enhanceCommandError, hasCapability } = require_tools2();
57447
58699
  module.exports = async (connection, range, options) => {
57448
58700
  if (connection.state !== connection.states.SELECTED || !range) {
57449
58701
  return;
57450
58702
  }
57451
58703
  options = options || {};
57452
58704
  await connection.messageFlagsAdd(range, ["\\Deleted"], options);
57453
- let byUid = options.uid && connection.capabilities.has("UIDPLUS");
58705
+ let byUid = options.uid && hasCapability(connection, "UIDPLUS");
57454
58706
  let command = byUid ? "UID EXPUNGE" : "EXPUNGE";
57455
58707
  let attributes = byUid ? [{ type: "SEQUENCE", value: range }] : false;
57456
58708
  let response;
@@ -57475,9 +58727,9 @@ var require_expunge = __commonJS({
57475
58727
  }
57476
58728
  });
57477
58729
 
57478
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/append.js
58730
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/append.js
57479
58731
  var require_append = __commonJS({
57480
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/append.js"(exports, module) {
58732
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/append.js"(exports, module) {
57481
58733
  "use strict";
57482
58734
  var { formatFlag, canUseFlag, formatDateTime, normalizePath, encodePath, comparePaths, enhanceCommandError } = require_tools2();
57483
58735
  module.exports = async (connection, destination, content, flags, idate) => {
@@ -57577,11 +58829,11 @@ var require_append = __commonJS({
57577
58829
  }
57578
58830
  });
57579
58831
 
57580
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/status.js
58832
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/status.js
57581
58833
  var require_status = __commonJS({
57582
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/status.js"(exports, module) {
58834
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/status.js"(exports, module) {
57583
58835
  "use strict";
57584
- var { encodePath, normalizePath } = require_tools2();
58836
+ var { encodePath, normalizePath, buildStatusQueryAttributes, isRev2Active } = require_tools2();
57585
58837
  module.exports = async (connection, path, query) => {
57586
58838
  if (![connection.states.AUTHENTICATED, connection.states.SELECTED].includes(connection.state) || !path) {
57587
58839
  return false;
@@ -57589,28 +58841,10 @@ var require_status = __commonJS({
57589
58841
  path = normalizePath(connection, path);
57590
58842
  let encodedPath = encodePath(connection, path);
57591
58843
  let attributes = [{ type: encodedPath.indexOf("&") >= 0 ? "STRING" : "ATOM", value: encodedPath }];
57592
- let queryAttributes = [];
57593
- Object.keys(query || {}).forEach((key) => {
57594
- if (!query[key]) {
57595
- return;
57596
- }
57597
- switch (key.toUpperCase()) {
57598
- case "MESSAGES":
57599
- case "RECENT":
57600
- case "UIDNEXT":
57601
- case "UIDVALIDITY":
57602
- case "UNSEEN":
57603
- queryAttributes.push({ type: "ATOM", value: key.toUpperCase() });
57604
- break;
57605
- case "HIGHESTMODSEQ":
57606
- if (connection.capabilities.has("CONDSTORE")) {
57607
- queryAttributes.push({ type: "ATOM", value: key.toUpperCase() });
57608
- }
57609
- break;
57610
- }
57611
- });
58844
+ let queryAttributes = buildStatusQueryAttributes(connection, query);
58845
+ let syntheticRecent = query && query.recent && isRev2Active(connection);
57612
58846
  if (!queryAttributes.length) {
57613
- return false;
58847
+ return syntheticRecent ? { path, recent: 0 } : false;
57614
58848
  }
57615
58849
  attributes.push(queryAttributes);
57616
58850
  let response;
@@ -57654,7 +58888,12 @@ var require_status = __commonJS({
57654
58888
  updateMailbox: (val, conn) => {
57655
58889
  conn.mailbox.highestModseq = val;
57656
58890
  }
57657
- }
58891
+ },
58892
+ // IMAP4rev2 additions (RFC 9051): total mailbox size in octets
58893
+ // (number64, exact as a JS number up to 2^53-1) and count of
58894
+ // messages with the \Deleted flag
58895
+ SIZE: { key: "size", parser: Number },
58896
+ DELETED: { key: "deleted", parser: Number }
57658
58897
  };
57659
58898
  let key;
57660
58899
  list.forEach((entry, i) => {
@@ -57682,6 +58921,9 @@ var require_status = __commonJS({
57682
58921
  }
57683
58922
  });
57684
58923
  response.next();
58924
+ if (syntheticRecent) {
58925
+ map.recent = 0;
58926
+ }
57685
58927
  return map;
57686
58928
  } catch (err) {
57687
58929
  if (err.responseStatus === "NO") {
@@ -57700,9 +58942,9 @@ var require_status = __commonJS({
57700
58942
  }
57701
58943
  });
57702
58944
 
57703
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/copyuid-parser.js
58945
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/copyuid-parser.js
57704
58946
  var require_copyuid_parser = __commonJS({
57705
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/copyuid-parser.js"(exports, module) {
58947
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/copyuid-parser.js"(exports, module) {
57706
58948
  "use strict";
57707
58949
  var { expandRange } = require_tools2();
57708
58950
  function parseCopyUid(response, map) {
@@ -57725,9 +58967,9 @@ var require_copyuid_parser = __commonJS({
57725
58967
  }
57726
58968
  });
57727
58969
 
57728
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/copy.js
58970
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/copy.js
57729
58971
  var require_copy = __commonJS({
57730
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/copy.js"(exports, module) {
58972
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/copy.js"(exports, module) {
57731
58973
  "use strict";
57732
58974
  var { normalizePath, encodePath, enhanceCommandError } = require_tools2();
57733
58975
  var { parseCopyUid } = require_copyuid_parser();
@@ -57757,11 +58999,11 @@ var require_copy = __commonJS({
57757
58999
  }
57758
59000
  });
57759
59001
 
57760
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/move.js
59002
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/move.js
57761
59003
  var require_move = __commonJS({
57762
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/move.js"(exports, module) {
59004
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/move.js"(exports, module) {
57763
59005
  "use strict";
57764
- var { normalizePath, encodePath, enhanceCommandError } = require_tools2();
59006
+ var { normalizePath, encodePath, enhanceCommandError, hasCapability } = require_tools2();
57765
59007
  var { parseCopyUid } = require_copyuid_parser();
57766
59008
  module.exports = async (connection, range, destination, options) => {
57767
59009
  if (connection.state !== connection.states.SELECTED || !range || !destination) {
@@ -57774,7 +59016,7 @@ var require_move = __commonJS({
57774
59016
  { type: "ATOM", value: encodePath(connection, destination) }
57775
59017
  ];
57776
59018
  let map = { path: connection.mailbox.path, destination };
57777
- if (!connection.capabilities.has("MOVE")) {
59019
+ if (!hasCapability(connection, "MOVE")) {
57778
59020
  let result = await connection.messageCopy(range, destination, options);
57779
59021
  await connection.messageDelete(range, Object.assign({ silent: true }, options));
57780
59022
  return result;
@@ -57800,9 +59042,9 @@ var require_move = __commonJS({
57800
59042
  }
57801
59043
  });
57802
59044
 
57803
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/compress.js
59045
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/compress.js
57804
59046
  var require_compress = __commonJS({
57805
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/compress.js"(exports, module) {
59047
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/compress.js"(exports, module) {
57806
59048
  "use strict";
57807
59049
  module.exports = async (connection) => {
57808
59050
  if (!connection.capabilities.has("COMPRESS=DEFLATE") || connection._inflate) {
@@ -57821,9 +59063,9 @@ var require_compress = __commonJS({
57821
59063
  }
57822
59064
  });
57823
59065
 
57824
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/quota.js
59066
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/quota.js
57825
59067
  var require_quota = __commonJS({
57826
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/quota.js"(exports, module) {
59068
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/quota.js"(exports, module) {
57827
59069
  "use strict";
57828
59070
  var { encodePath, normalizePath, enhanceCommandError } = require_tools2();
57829
59071
  module.exports = async (connection, path) => {
@@ -57897,6 +59139,7 @@ var require_quota = __commonJS({
57897
59139
  }
57898
59140
  }
57899
59141
  });
59142
+ response.next();
57900
59143
  }
57901
59144
  return map;
57902
59145
  } catch (err) {
@@ -57908,16 +59151,29 @@ var require_quota = __commonJS({
57908
59151
  }
57909
59152
  });
57910
59153
 
57911
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/idle.js
59154
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/idle.js
57912
59155
  var require_idle = __commonJS({
57913
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/idle.js"(exports, module) {
59156
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/idle.js"(exports, module) {
57914
59157
  "use strict";
59158
+ var { hasCapability, unrefTimer } = require_tools2();
57915
59159
  var NOOP_INTERVAL = 2 * 60 * 1e3;
59160
+ function claimIdling(connection) {
59161
+ let token = {};
59162
+ connection._idleSession = token;
59163
+ connection.idling = true;
59164
+ return () => {
59165
+ if (connection._idleSession === token) {
59166
+ connection._idleSession = null;
59167
+ connection.idling = false;
59168
+ }
59169
+ };
59170
+ }
57916
59171
  async function runIdle(connection) {
57917
59172
  let response;
57918
59173
  let preCheckWaitQueue = [];
59174
+ let ownPreCheck = null;
59175
+ let releaseIdling = claimIdling(connection);
57919
59176
  try {
57920
- connection.idling = true;
57921
59177
  let doneRequested = false;
57922
59178
  let doneSent = false;
57923
59179
  let canEnd = false;
@@ -57933,8 +59189,10 @@ var require_idle = __commonJS({
57933
59189
  });
57934
59190
  connection.write("DONE");
57935
59191
  doneSent = true;
57936
- connection.idling = false;
57937
- connection.preCheck = false;
59192
+ releaseIdling();
59193
+ if (connection.preCheck === ownPreCheck) {
59194
+ connection.preCheck = false;
59195
+ }
57938
59196
  while (preCheckWaitQueue.length) {
57939
59197
  let { resolve: resolve2 } = preCheckWaitQueue.shift();
57940
59198
  resolve2();
@@ -57957,6 +59215,7 @@ var require_idle = __commonJS({
57957
59215
  preCheck().catch((err) => connection.log.warn({ err, cid: connection.id }));
57958
59216
  return handler;
57959
59217
  };
59218
+ ownPreCheck = connectionPreCheck;
57960
59219
  connection.preCheck = connectionPreCheck;
57961
59220
  response = await connection.exec("IDLE", false, {
57962
59221
  // Server responds with "+" continuation to acknowledge IDLE mode.
@@ -57976,45 +59235,126 @@ var require_idle = __commonJS({
57976
59235
  onSend: () => {
57977
59236
  }
57978
59237
  });
57979
- if (typeof connection.preCheck === "function" && connection.preCheck === connectionPreCheck) {
57980
- connection.log.trace({
57981
- msg: "Clearing pre-check function",
57982
- lockId: connection.currentLock?.lockId,
57983
- path: connection.mailbox && connection.mailbox.path,
57984
- queued: preCheckWaitQueue.length,
57985
- doneRequested,
57986
- canEnd,
57987
- doneSent
57988
- });
57989
- connection.preCheck = false;
57990
- while (preCheckWaitQueue.length) {
57991
- let { resolve: resolve2 } = preCheckWaitQueue.shift();
57992
- resolve2();
57993
- }
57994
- }
57995
59238
  response.next();
57996
59239
  return;
57997
59240
  } catch (err) {
57998
- connection.preCheck = false;
57999
- connection.idling = false;
58000
59241
  connection.log.warn({ err, cid: connection.id });
58001
59242
  while (preCheckWaitQueue.length) {
58002
59243
  let { reject } = preCheckWaitQueue.shift();
58003
59244
  reject(err);
58004
59245
  }
58005
59246
  return false;
59247
+ } finally {
59248
+ releaseIdling();
59249
+ if (connection.preCheck === ownPreCheck) {
59250
+ connection.preCheck = false;
59251
+ }
59252
+ while (preCheckWaitQueue.length) {
59253
+ let { resolve: resolve2 } = preCheckWaitQueue.shift();
59254
+ resolve2();
59255
+ }
59256
+ }
59257
+ }
59258
+ async function pollOnce(connection, session) {
59259
+ let path = connection.mailbox && connection.mailbox.path;
59260
+ switch (connection.missingIdleCommand) {
59261
+ case "SELECT":
59262
+ connection.log.debug({ src: "c", msg: `Running SELECT to detect changes in folder`, cid: connection.id });
59263
+ await connection.runInternal("SELECT", path, { readOnly: session.selectCommand.command === "EXAMINE" });
59264
+ break;
59265
+ case "STATUS": {
59266
+ connection.log.debug({ src: "c", msg: `Running STATUS to detect changes in folder`, cid: connection.id });
59267
+ let status = await connection.runInternal("STATUS", path, {
59268
+ messages: true,
59269
+ uidNext: true,
59270
+ uidValidity: true,
59271
+ unseen: true,
59272
+ highestModseq: true
59273
+ });
59274
+ if (!status) {
59275
+ let err = new Error("STATUS poll failed");
59276
+ err.code = "PollFailed";
59277
+ throw err;
59278
+ }
59279
+ break;
59280
+ }
59281
+ case "NOOP":
59282
+ default: {
59283
+ let response = await connection.exec("NOOP", false, { comment: "IDLE not supported" });
59284
+ response.next();
59285
+ break;
59286
+ }
59287
+ }
59288
+ }
59289
+ async function runPollingFallback(connection, maxIdleTime) {
59290
+ if (!connection.currentSelectCommand) {
59291
+ return;
59292
+ }
59293
+ let session = {
59294
+ cancelled: false,
59295
+ timer: null,
59296
+ preCheck: null,
59297
+ selectCommand: connection.currentSelectCommand
59298
+ };
59299
+ let interval = maxIdleTime ? Math.min(NOOP_INTERVAL, maxIdleTime) : NOOP_INTERVAL;
59300
+ let releaseIdling = claimIdling(connection);
59301
+ try {
59302
+ await new Promise((resolve2) => {
59303
+ const cancel = () => {
59304
+ if (session.cancelled) {
59305
+ return;
59306
+ }
59307
+ session.cancelled = true;
59308
+ clearTimeout(session.timer);
59309
+ session.timer = null;
59310
+ resolve2();
59311
+ };
59312
+ session.preCheck = async () => {
59313
+ connection.log.debug({ src: "c", msg: `breaking NOOP loop`, cid: connection.id });
59314
+ cancel();
59315
+ };
59316
+ connection.preCheck = session.preCheck;
59317
+ const runPoll = () => {
59318
+ if (session.cancelled) {
59319
+ return;
59320
+ }
59321
+ if (!connection.socket || connection.socket.destroyed || connection.state !== connection.states.SELECTED || !connection.mailbox) {
59322
+ return cancel();
59323
+ }
59324
+ pollOnce(connection, session).then(() => {
59325
+ if (session.cancelled) {
59326
+ return;
59327
+ }
59328
+ session.timer = setTimeout(runPoll, interval);
59329
+ unrefTimer(session.timer);
59330
+ }).catch((err) => {
59331
+ connection.log.warn({ err, cid: connection.id });
59332
+ cancel();
59333
+ });
59334
+ };
59335
+ connection.log.debug({ src: "c", msg: `initiated NOOP loop`, cid: connection.id });
59336
+ runPoll();
59337
+ });
59338
+ } finally {
59339
+ session.cancelled = true;
59340
+ clearTimeout(session.timer);
59341
+ session.timer = null;
59342
+ releaseIdling();
59343
+ if (connection.preCheck === session.preCheck) {
59344
+ connection.preCheck = false;
59345
+ }
58006
59346
  }
58007
59347
  }
58008
59348
  module.exports = async (connection, maxIdleTime) => {
58009
59349
  if (connection.state !== connection.states.SELECTED) {
58010
59350
  return;
58011
59351
  }
58012
- if (connection.capabilities.has("IDLE")) {
58013
- let idleTimer2;
59352
+ if (hasCapability(connection, "IDLE")) {
59353
+ let idleTimer;
58014
59354
  let stillIdling = false;
58015
- let runIdleLoop = async () => {
59355
+ for (; ; ) {
58016
59356
  if (maxIdleTime) {
58017
- idleTimer2 = setTimeout(() => {
59357
+ idleTimer = setTimeout(() => {
58018
59358
  if (connection.idling) {
58019
59359
  if (typeof connection.preCheck === "function") {
58020
59360
  stillIdling = true;
@@ -58023,77 +59363,24 @@ var require_idle = __commonJS({
58023
59363
  }
58024
59364
  }
58025
59365
  }, maxIdleTime);
59366
+ unrefTimer(idleTimer);
58026
59367
  }
58027
59368
  let resp = await runIdle(connection);
58028
- clearTimeout(idleTimer2);
58029
- if (stillIdling) {
58030
- stillIdling = false;
58031
- return runIdleLoop();
58032
- }
58033
- return resp;
58034
- };
58035
- return runIdleLoop();
58036
- }
58037
- let idleTimer;
58038
- return new Promise((resolve2) => {
58039
- if (!connection.currentSelectCommand) {
58040
- return resolve2();
58041
- }
58042
- connection.preCheck = async () => {
58043
- connection.preCheck = false;
58044
59369
  clearTimeout(idleTimer);
58045
- connection.log.debug({ src: "c", msg: `breaking NOOP loop` });
58046
- connection.idling = false;
58047
- resolve2();
58048
- };
58049
- let selectCommand = connection.currentSelectCommand;
58050
- let idleCheck = async () => {
58051
- let response;
58052
- switch (connection.missingIdleCommand) {
58053
- case "SELECT":
58054
- connection.log.debug({ src: "c", msg: `Running SELECT to detect changes in folder` });
58055
- response = await connection.exec(selectCommand.command, selectCommand.arguments);
58056
- break;
58057
- case "STATUS":
58058
- {
58059
- let statusArgs = [
58060
- selectCommand.arguments[0],
58061
- ["MESSAGES", "UIDNEXT", "UIDVALIDITY", "UNSEEN"].map((key) => ({ type: "ATOM", value: key }))
58062
- ];
58063
- connection.log.debug({ src: "c", msg: `Running STATUS to detect changes in folder` });
58064
- response = await connection.exec("STATUS", statusArgs);
58065
- }
58066
- break;
58067
- case "NOOP":
58068
- default:
58069
- response = await connection.exec("NOOP", false, { comment: "IDLE not supported" });
58070
- break;
59370
+ if (!stillIdling) {
59371
+ return resp;
58071
59372
  }
58072
- response.next();
58073
- };
58074
- let noopInterval = maxIdleTime ? Math.min(NOOP_INTERVAL, maxIdleTime) : NOOP_INTERVAL;
58075
- let runLoop = () => {
58076
- idleCheck().then(() => {
58077
- clearTimeout(idleTimer);
58078
- idleTimer = setTimeout(runLoop, noopInterval);
58079
- }).catch((err) => {
58080
- clearTimeout(idleTimer);
58081
- connection.preCheck = false;
58082
- connection.log.warn({ err, cid: connection.id });
58083
- resolve2();
58084
- });
58085
- };
58086
- connection.log.debug({ src: "c", msg: `initiated NOOP loop` });
58087
- connection.idling = true;
58088
- runLoop();
58089
- });
59373
+ stillIdling = false;
59374
+ }
59375
+ }
59376
+ return runPollingFallback(connection, maxIdleTime);
58090
59377
  };
58091
59378
  }
58092
59379
  });
58093
59380
 
58094
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/authenticate.js
59381
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/authenticate.js
58095
59382
  var require_authenticate = __commonJS({
58096
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/commands/authenticate.js"(exports, module) {
59383
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/commands/authenticate.js"(exports, module) {
58097
59384
  "use strict";
58098
59385
  var { getStatusCode, getErrorText } = require_tools2();
58099
59386
  async function handleAuthError(err, errorResponse2) {
@@ -58113,9 +59400,14 @@ var require_authenticate = __commonJS({
58113
59400
  let command;
58114
59401
  let breaker;
58115
59402
  if (connection.capabilities.has("AUTH=OAUTHBEARER")) {
58116
- oauthbearer = [`n,a=${username},`, `host=${connection.servername || connection.host}`, `port=${connection.port}`, `auth=Bearer ${accessToken}`, "", ""].join(
58117
- ""
58118
- );
59403
+ oauthbearer = [
59404
+ `n,a=${username},`,
59405
+ `host=${connection.servername || connection.host}`,
59406
+ `port=${connection.port}`,
59407
+ `auth=Bearer ${accessToken}`,
59408
+ "",
59409
+ ""
59410
+ ].join("");
58119
59411
  command = "OAUTHBEARER";
58120
59412
  breaker = "AQ==";
58121
59413
  } else if (connection.capabilities.has("AUTH=XOAUTH") || connection.capabilities.has("AUTH=XOAUTH2")) {
@@ -58222,9 +59514,9 @@ var require_authenticate = __commonJS({
58222
59514
  }
58223
59515
  });
58224
59516
 
58225
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/imap-commands.js
59517
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/imap-commands.js
58226
59518
  var require_imap_commands = __commonJS({
58227
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/imap-commands.js"(exports, module) {
59519
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/imap-commands.js"(exports, module) {
58228
59520
  "use strict";
58229
59521
  module.exports = /* @__PURE__ */ new Map([
58230
59522
  ["ID", require_id2()],
@@ -58259,9 +59551,9 @@ var require_imap_commands = __commonJS({
58259
59551
  }
58260
59552
  });
58261
59553
 
58262
- // node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/imap-flow.js
59554
+ // node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/imap-flow.js
58263
59555
  var require_imap_flow = __commonJS({
58264
- "node_modules/.pnpm/imapflow@1.4.8/node_modules/imapflow/lib/imap-flow.js"(exports, module) {
59556
+ "node_modules/.pnpm/imapflow@1.6.3/node_modules/imapflow/lib/imap-flow.js"(exports, module) {
58265
59557
  "use strict";
58266
59558
  var tls = __require("tls");
58267
59559
  var net = __require("net");
@@ -58280,6 +59572,7 @@ var require_imap_flow = __commonJS({
58280
59572
  var FlowedDecoder = require_flowed_decoder();
58281
59573
  var { PassThrough } = __require("stream");
58282
59574
  var { proxyConnection, detachEarlyErrorHandler } = require_proxy_connection();
59575
+ var { ConnectionDeadline } = require_connection_deadline();
58283
59576
  var {
58284
59577
  comparePaths,
58285
59578
  updateCapabilities,
@@ -58290,12 +59583,13 @@ var require_imap_flow = __commonJS({
58290
59583
  normalizePath,
58291
59584
  expandRange,
58292
59585
  AuthenticationFailure,
58293
- getColorFlags
59586
+ getColorFlags,
59587
+ hasCapability,
59588
+ unrefTimer
58294
59589
  } = require_tools2();
58295
59590
  var imapCommands = require_imap_commands();
58296
59591
  var noop = () => {
58297
59592
  };
58298
- var CONNECT_TIMEOUT = 90 * 1e3;
58299
59593
  var GREETING_TIMEOUT = 16 * 1e3;
58300
59594
  var UPGRADE_TIMEOUT = 10 * 1e3;
58301
59595
  var SOCKET_TIMEOUT = 5 * 60 * 1e3;
@@ -58397,7 +59691,21 @@ var require_imap_flow = __commonJS({
58397
59691
  * If `true`, disconnects after successful authentication without performing other actions.
58398
59692
  *
58399
59693
  * @property {String} [proxy]
58400
- * Proxy URL. Supports HTTP CONNECT (`http://`, `https://`) and SOCKS (`socks://`, `socks4://`, `socks5://`).
59694
+ * Proxy URL. Supports HTTP CONNECT (`http://`, `https://`) and SOCKS (`socks://`, `socks4://`, `socks4a://`, `socks5://`).
59695
+ * IPv6 proxy endpoints use the URL form, e.g. `socks5://[2001:db8::1]:1080`.
59696
+ *
59697
+ * DNS behaviour depends on the proxy protocol:
59698
+ * - `http`/`https`: the destination hostname is sent to the proxy unresolved.
59699
+ * - `socks4`: destination hostnames are resolved locally to IPv4, because SOCKS4 carries
59700
+ * only IPv4 destination addresses and a hostname would silently become a SOCKS4a
59701
+ * request. IPv6 destinations are rejected.
59702
+ * - `socks4a`: destination hostnames are sent to the proxy for remote DNS. IPv6
59703
+ * destinations are rejected.
59704
+ * - `socks`/`socks5`: destination hostnames are sent to the proxy for remote DNS, and
59705
+ * IPv4/IPv6 literals are passed through unchanged.
59706
+ *
59707
+ * The proxy endpoint itself is never resolved by ImapFlow - a hostname endpoint is handed
59708
+ * to Node as-is, keeping its normal lookup and connection behaviour.
58401
59709
  *
58402
59710
  * @property {Boolean} [qresync=false]
58403
59711
  * If `true`, enables QRESYNC support so that EXPUNGE notifications include `uid` instead of `seq`.
@@ -58414,8 +59722,15 @@ var require_imap_flow = __commonJS({
58414
59722
  * @property {Boolean} [disableAutoEnable=false]
58415
59723
  * If `true`, do not automatically enable supported IMAP extensions.
58416
59724
  *
59725
+ * @property {Boolean} [disableIMAP4rev2=false]
59726
+ * If `true`, do not enable IMAP4rev2 mode even if the server supports it.
59727
+ * Use as a targeted opt-out for servers with broken IMAP4rev2 implementations
59728
+ * without losing the other auto-enabled extensions.
59729
+ *
58417
59730
  * @property {Number} [connectionTimeout=90000]
58418
- * Maximum time (in milliseconds) to wait for the connection to establish. Defaults to 90 seconds.
59731
+ * Maximum time (in milliseconds) to wait for a usable transport. Covers DNS resolution,
59732
+ * proxy negotiation and the TCP/TLS handshake as a single budget, so an expiry in any of
59733
+ * those phases rejects with error code `CONNECT_TIMEOUT`. Defaults to 90 seconds.
58419
59734
  *
58420
59735
  * @property {Number} [greetingTimeout=16000]
58421
59736
  * Maximum time (in milliseconds) to wait for the server greeting after a connection is established. Defaults to 16 seconds.
@@ -58450,6 +59765,7 @@ var require_imap_flow = __commonJS({
58450
59765
  if (typeof this.options.secure === "undefined" && this.port === 993) {
58451
59766
  this.secureConnection = true;
58452
59767
  }
59768
+ this.socketTimeout = Number(this.options.socketTimeout) || SOCKET_TIMEOUT;
58453
59769
  this.logRaw = this.options.logRaw;
58454
59770
  this.streamer = new ImapStream({
58455
59771
  logger: this.log,
@@ -58473,6 +59789,8 @@ var require_imap_flow = __commonJS({
58473
59789
  this.requestTagMap = /* @__PURE__ */ new Map();
58474
59790
  this.requestQueue = [];
58475
59791
  this.currentRequest = false;
59792
+ this._unknownTagCount = 0;
59793
+ this._nextUnknownTagWarn = 1;
58476
59794
  this.writeBytesCounter = 0;
58477
59795
  this.commandParts = [];
58478
59796
  this.capabilities = /* @__PURE__ */ new Map();
@@ -58498,6 +59816,10 @@ var require_imap_flow = __commonJS({
58498
59816
  this.maxIdleTime = this.options.maxIdleTime || false;
58499
59817
  this.missingIdleCommand = (this.options.missingIdleCommand || "").toString().toUpperCase().trim() || "NOOP";
58500
59818
  this.disableBinary = !!this.options.disableBinary;
59819
+ this.skipListSubscribedArg = false;
59820
+ this.skipListStatusArgs = false;
59821
+ this.skipListAuxArgs = false;
59822
+ this.skipLsub = false;
58501
59823
  this._streamerErrorHandler = (err) => {
58502
59824
  if (["Z_BUF_ERROR", "ECONNRESET", "EPIPE", "ETIMEDOUT", "EHOSTUNREACH"].includes(err.code)) {
58503
59825
  this.closeAfter();
@@ -58515,13 +59837,14 @@ var require_imap_flow = __commonJS({
58515
59837
  }
58516
59838
  err._connId = err._connId || this.id;
58517
59839
  if (this.upgrading) {
58518
- this.upgrading = false;
58519
- this.closeAfter();
58520
- if (typeof this._upgradeReject === "function") {
58521
- let reject = this._upgradeReject;
58522
- this._upgradeReject = null;
59840
+ let reject = this._upgradeReject;
59841
+ this._upgradeReject = null;
59842
+ if (typeof reject === "function") {
58523
59843
  reject(err);
59844
+ return;
58524
59845
  }
59846
+ this.upgrading = false;
59847
+ this.closeAfter();
58525
59848
  return;
58526
59849
  }
58527
59850
  if (typeof this.initialReject === "function") {
@@ -58628,7 +59951,8 @@ var require_imap_flow = __commonJS({
58628
59951
  }
58629
59952
  let compiled = await compiler(data, {
58630
59953
  asArray: true,
58631
- literalMinus: this.capabilities.has("LITERAL-") || this.capabilities.has("LITERAL+")
59954
+ // LITERAL- is part of base IMAP4rev2
59955
+ literalMinus: hasCapability(this, "LITERAL-") || this.capabilities.has("LITERAL+")
58632
59956
  });
58633
59957
  this.commandParts = compiled;
58634
59958
  let logCompiled = await compiler(data, {
@@ -58637,6 +59961,9 @@ var require_imap_flow = __commonJS({
58637
59961
  let options = data.options || {};
58638
59962
  this.log.debug({ src: "c", msg: logCompiled.toString(), cid: this.id, comment: options.comment });
58639
59963
  this.write(this.commandParts.shift());
59964
+ if (this.currentRequest && this.currentRequest.tag === data.tag) {
59965
+ this.currentRequest.sent = true;
59966
+ }
58640
59967
  if (typeof options.onSend === "function") {
58641
59968
  options.onSend();
58642
59969
  }
@@ -58709,157 +60036,267 @@ var require_imap_flow = __commonJS({
58709
60036
  return this.sectionHandlers[key];
58710
60037
  }
58711
60038
  }
60039
+ // Releases a readable stream item exactly once. The item's `next` callback is the parser's
60040
+ // backpressure token: until it is called, ImapStream stops feeding the connection. Every
60041
+ // path out of response handling - success, handled error, or unexpected throw - has to go
60042
+ // through here, otherwise the parser stalls permanently.
60043
+ releaseStreamData(data) {
60044
+ if (!data || data.released) {
60045
+ return;
60046
+ }
60047
+ data.released = true;
60048
+ if (typeof data.next === "function") {
60049
+ data.next();
60050
+ }
60051
+ }
60052
+ // Records a tagged response whose tag was never issued by this connection. ImapFlow talks
60053
+ // to a wide range of non-conforming servers, so this is tolerated rather than terminal, but
60054
+ // it must not pass silently. Warnings are emitted for the first occurrence and then at
60055
+ // powers of two so a server spraying stray tagged lines cannot flood the log, while the
60056
+ // counter itself stays exact and is reported when the connection closes.
60057
+ countUnknownTag(tag) {
60058
+ if (this.isClosed) {
60059
+ return;
60060
+ }
60061
+ this._unknownTagCount++;
60062
+ if (this._unknownTagCount === this._nextUnknownTagWarn) {
60063
+ this._nextUnknownTagWarn *= 2;
60064
+ this.log.warn({
60065
+ msg: "Tagged response for an unknown tag",
60066
+ tag,
60067
+ unknownTagCount: this._unknownTagCount,
60068
+ cid: this.id
60069
+ });
60070
+ }
60071
+ }
60072
+ // Terminally fails the connection on a protocol violation: stop parsing, then report. Both
60073
+ // steps are explicit here rather than destroying the parser *with* the error and relying on
60074
+ // its error listener to report, so the reporting path does not depend on teardown ordering or
60075
+ // on the streamer error handler's suppression list.
60076
+ failProtocol(err) {
60077
+ if (this.streamer && !this.streamer.destroyed) {
60078
+ this.streamer.destroy();
60079
+ }
60080
+ this.emitError(err);
60081
+ }
60082
+ // Rejects the in-flight request, if any, exactly once. Used when response handling fails in
60083
+ // a way that leaves the command's outcome unknown.
60084
+ rejectCurrentRequest(err) {
60085
+ if (!this.currentRequest) {
60086
+ return;
60087
+ }
60088
+ let tag = this.currentRequest.tag;
60089
+ this.currentRequest = false;
60090
+ let request = this.requestTagMap.get(tag);
60091
+ if (request) {
60092
+ this.requestTagMap.delete(tag);
60093
+ request.reject(err);
60094
+ }
60095
+ }
58712
60096
  async reader() {
58713
60097
  let data;
58714
60098
  let processedCount = 0;
58715
60099
  while ((data = this.streamer.read()) !== null) {
58716
- let parsed;
60100
+ let keepReading;
58717
60101
  try {
58718
- parsed = await parser(data.payload, { literals: data.literals });
58719
- if (parsed.tag && !["*", "+"].includes(parsed.tag) && parsed.command) {
58720
- let payload = { response: parsed.command };
58721
- if (parsed.attributes && parsed.attributes[0] && parsed.attributes[0].section && parsed.attributes[0].section[0] && parsed.attributes[0].section[0].type === "ATOM") {
58722
- payload.code = parsed.attributes[0].section[0].value;
58723
- }
58724
- this.emit("response", payload);
60102
+ keepReading = await this.handleResponse(data);
60103
+ } catch (err) {
60104
+ keepReading = false;
60105
+ let error2 = new Error("Failed to process server response");
60106
+ error2.code = "ResponseProcessingFailed";
60107
+ error2._err = err;
60108
+ this.log.error({ msg: "Failed to process server response", err, cid: this.id });
60109
+ this.rejectCurrentRequest(error2);
60110
+ this.failProtocol(error2);
60111
+ } finally {
60112
+ this.releaseStreamData(data);
60113
+ }
60114
+ if (!keepReading) {
60115
+ return;
60116
+ }
60117
+ processedCount++;
60118
+ if (processedCount % 10 === 0) {
60119
+ await new Promise((resolve2) => setImmediate(resolve2));
60120
+ }
60121
+ }
60122
+ }
60123
+ /**
60124
+ * Handles a single parsed server response: telemetry, continuation requests, response-code
60125
+ * section handlers, untagged handlers and tagged command completion.
60126
+ *
60127
+ * @param {Object} data - Readable item from the parser stream.
60128
+ * @returns {Promise<Boolean>} `true` to keep reading, `false` to stop (connection is failing).
60129
+ */
60130
+ async handleResponse(data) {
60131
+ let parsed;
60132
+ try {
60133
+ parsed = await parser(data.payload, { literals: data.literals });
60134
+ if (parsed.tag && !["*", "+"].includes(parsed.tag) && parsed.command) {
60135
+ let payload = { response: parsed.command };
60136
+ if (parsed.attributes && parsed.attributes[0] && parsed.attributes[0].section && parsed.attributes[0].section[0] && parsed.attributes[0].section[0].type === "ATOM") {
60137
+ payload.code = parsed.attributes[0].section[0].value;
58725
60138
  }
60139
+ this.emit("response", payload);
60140
+ }
60141
+ } catch (err) {
60142
+ this.log.error({ src: "s", msg: data.payload.toString(), err, cid: this.id });
60143
+ return true;
60144
+ }
60145
+ let logCompiled = await compiler(parsed, {
60146
+ isLogging: true
60147
+ });
60148
+ if (/^\d+$/.test(parsed.command) && parsed.attributes && parsed.attributes[0] && parsed.attributes[0].value === "FETCH") {
60149
+ this.log.trace({ src: "s", msg: logCompiled.toString(), cid: this.id, nullBytesRemoved: parsed.nullBytesRemoved });
60150
+ } else {
60151
+ this.log.debug({ src: "s", msg: logCompiled.toString(), cid: this.id, nullBytesRemoved: parsed.nullBytesRemoved });
60152
+ }
60153
+ if (parsed.tag === "+" && this.currentRequest && this.currentRequest.options && typeof this.currentRequest.options.onPlusTag === "function") {
60154
+ try {
60155
+ await this.currentRequest.options.onPlusTag(parsed);
58726
60156
  } catch (err) {
58727
- this.log.error({ src: "s", msg: data.payload.toString(), err, cid: this.id });
58728
- data.next();
58729
- continue;
60157
+ this.log.warn({ err, cid: this.id });
58730
60158
  }
58731
- let logCompiled = await compiler(parsed, {
58732
- isLogging: true
58733
- });
58734
- if (/^\d+$/.test(parsed.command) && parsed.attributes && parsed.attributes[0] && parsed.attributes[0].value === "FETCH") {
58735
- this.log.trace({ src: "s", msg: logCompiled.toString(), cid: this.id, nullBytesRemoved: parsed.nullBytesRemoved });
58736
- } else {
58737
- this.log.debug({ src: "s", msg: logCompiled.toString(), cid: this.id, nullBytesRemoved: parsed.nullBytesRemoved });
60159
+ return true;
60160
+ }
60161
+ if (parsed.tag === "+" && this.commandParts.length) {
60162
+ let content = this.commandParts.shift();
60163
+ try {
60164
+ this.write(content);
60165
+ this.log.debug({ src: "c", msg: `(* ${content.length}B continuation *)`, cid: this.id });
60166
+ } catch (err) {
60167
+ this.log.warn({ err, cid: this.id });
58738
60168
  }
58739
- if (parsed.tag === "+" && this.currentRequest && this.currentRequest.options && typeof this.currentRequest.options.onPlusTag === "function") {
60169
+ return true;
60170
+ }
60171
+ let section = parsed.attributes && parsed.attributes.length && parsed.attributes[0] && !parsed.attributes[0].value && parsed.attributes[0].section;
60172
+ if (section && section.length && section[0].type === "ATOM" && typeof section[0].value === "string") {
60173
+ let sectionHandler = this.getSectionHandler(section[0].value.toUpperCase().trim());
60174
+ if (sectionHandler) {
58740
60175
  try {
58741
- await this.currentRequest.options.onPlusTag(parsed);
60176
+ await sectionHandler(section.slice(1));
58742
60177
  } catch (err) {
58743
60178
  this.log.warn({ err, cid: this.id });
58744
60179
  }
58745
- data.next();
58746
- continue;
58747
60180
  }
58748
- if (parsed.tag === "+" && this.commandParts.length) {
58749
- let content = this.commandParts.shift();
60181
+ }
60182
+ if (parsed.tag === "*" && parsed.command) {
60183
+ let untaggedHandler = this.getUntaggedHandler(parsed.command, parsed.attributes);
60184
+ if (untaggedHandler) {
58750
60185
  try {
58751
- this.write(content);
58752
- this.log.debug({ src: "c", msg: `(* ${content.length}B continuation *)`, cid: this.id });
60186
+ await untaggedHandler(parsed);
58753
60187
  } catch (err) {
58754
60188
  this.log.warn({ err, cid: this.id });
60189
+ return true;
58755
60190
  }
58756
- data.next();
58757
- continue;
58758
60191
  }
58759
- let section = parsed.attributes && parsed.attributes.length && parsed.attributes[0] && !parsed.attributes[0].value && parsed.attributes[0].section;
58760
- if (section && section.length && section[0].type === "ATOM" && typeof section[0].value === "string") {
58761
- let sectionHandler = this.getSectionHandler(section[0].value.toUpperCase().trim());
58762
- if (sectionHandler) {
58763
- try {
58764
- await sectionHandler(section.slice(1));
58765
- } catch (err) {
58766
- this.log.warn({ err, cid: this.id });
58767
- }
60192
+ }
60193
+ if (parsed.tag && !["*", "+"].includes(parsed.tag)) {
60194
+ if (this.currentRequest && this.currentRequest.tag === parsed.tag && this.currentRequest.sent) {
60195
+ let request = this.requestTagMap.get(parsed.tag);
60196
+ this.requestTagMap.delete(parsed.tag);
60197
+ this.currentRequest = false;
60198
+ if (request) {
60199
+ await this.settleRequest(request, parsed, !!data.trailingAfterLine);
58768
60200
  }
58769
- }
58770
- if (parsed.tag === "*" && parsed.command) {
58771
- let untaggedHandler = this.getUntaggedHandler(parsed.command, parsed.attributes);
58772
- if (untaggedHandler) {
58773
- try {
58774
- await untaggedHandler(parsed);
58775
- } catch (err) {
58776
- this.log.warn({ err, cid: this.id });
58777
- data.next();
58778
- continue;
58779
- }
60201
+ try {
60202
+ await this.trySend();
60203
+ } catch (err) {
60204
+ this.log.warn({ err, cid: this.id });
58780
60205
  }
58781
- }
58782
- if (this.requestTagMap.has(parsed.tag)) {
60206
+ } else if (this.requestTagMap.has(parsed.tag)) {
58783
60207
  let request = this.requestTagMap.get(parsed.tag);
58784
60208
  this.requestTagMap.delete(parsed.tag);
58785
- if (this.currentRequest && this.currentRequest.tag === parsed.tag) {
58786
- this.currentRequest = false;
58787
- try {
58788
- await this.trySend();
58789
- } catch (err) {
58790
- this.log.warn({ err, cid: this.id });
58791
- }
60209
+ let err = new Error("Server sent a tagged response for a command that was not in flight");
60210
+ err.code = "UnexpectedTag";
60211
+ err.details = {
60212
+ received: parsed.tag,
60213
+ expected: this.currentRequest ? this.currentRequest.tag : null
60214
+ };
60215
+ this.log.error({ msg: "Protocol desynchronization", err, cid: this.id });
60216
+ request.reject(err);
60217
+ this.failProtocol(err);
60218
+ return false;
60219
+ } else {
60220
+ this.countUnknownTag(parsed.tag);
60221
+ }
60222
+ }
60223
+ return true;
60224
+ }
60225
+ /**
60226
+ * Settles a request with its tagged completion response.
60227
+ *
60228
+ * On success the returned promise stays pending until the command handler calls `next()` on
60229
+ * the response, which is what orders state application before the next queued command is
60230
+ * dispatched. A command handler must therefore always release its own response before
60231
+ * awaiting another command on the same connection.
60232
+ *
60233
+ * @param {Object} request - Pending request entry (resolve/reject and the compiled command).
60234
+ * @param {Object} parsed - Parsed tagged response.
60235
+ * @param {Boolean} hasTrailingData - Whether more input was already buffered after this line.
60236
+ * @returns {Promise<void>}
60237
+ */
60238
+ async settleRequest(request, parsed, hasTrailingData) {
60239
+ switch ((parsed.command || "").toUpperCase()) {
60240
+ case "OK":
60241
+ case "BYE":
60242
+ await new Promise((resolve2) => request.resolve({ response: parsed, next: resolve2, hasTrailingData }));
60243
+ break;
60244
+ case "NO":
60245
+ case "BAD": {
60246
+ let txt = parsed.attributes && parsed.attributes.filter((val) => val.type === "TEXT").map((val) => val.value.trim()).join(" ");
60247
+ let err = new Error("Command failed");
60248
+ err.response = parsed;
60249
+ err.responseStatus = parsed.command.toUpperCase();
60250
+ try {
60251
+ err.executedCommand = parsed.tag + (await compiler(request, {
60252
+ isLogging: true
60253
+ })).toString();
60254
+ } catch {
58792
60255
  }
58793
- switch (parsed.command.toUpperCase()) {
58794
- case "OK":
58795
- case "BYE":
58796
- await new Promise((resolve2) => request.resolve({ response: parsed, next: resolve2, hasTrailingData: !!data.trailingAfterLine }));
60256
+ if (txt) {
60257
+ err.responseText = txt;
60258
+ if (err.responseStatus === "NO" && txt.includes("Some of the requested messages no longer exist")) {
60259
+ this.log.warn({ msg: "Partial FETCH response", cid: this.id, err });
60260
+ await new Promise((resolve2) => request.resolve({ response: parsed, next: resolve2 }));
58797
60261
  break;
58798
- case "NO":
58799
- case "BAD": {
58800
- let txt = parsed.attributes && parsed.attributes.filter((val) => val.type === "TEXT").map((val) => val.value.trim()).join(" ");
58801
- let err = new Error("Command failed");
58802
- err.response = parsed;
58803
- err.responseStatus = parsed.command.toUpperCase();
58804
- try {
58805
- err.executedCommand = parsed.tag + (await compiler(request, {
58806
- isLogging: true
58807
- })).toString();
58808
- } catch {
58809
- }
58810
- if (txt) {
58811
- err.responseText = txt;
58812
- if (err.responseStatus === "NO" && txt.includes("Some of the requested messages no longer exist")) {
58813
- this.log.warn({ msg: "Partial FETCH response", cid: this.id, err });
58814
- await new Promise((resolve2) => request.resolve({ response: parsed, next: resolve2 }));
58815
- break;
58816
- }
58817
- let throttleDelay = false;
58818
- if (/Request is throttled/i.test(txt) && /Backoff Time/i.test(txt)) {
58819
- let throttlingMatch = txt.match(/Backoff Time[:=\s]+(\d+)/i);
58820
- if (throttlingMatch && throttlingMatch[1] && !isNaN(throttlingMatch[1])) {
58821
- throttleDelay = Number(throttlingMatch[1]);
58822
- }
58823
- }
58824
- if (throttleDelay) {
58825
- err.code = "ETHROTTLE";
58826
- err.throttleReset = throttleDelay;
58827
- let delayResponse = throttleDelay;
58828
- if (delayResponse > 5 * 60 * 1e3) {
58829
- delayResponse = 5 * 60 * 1e3;
58830
- }
58831
- this.log.warn({ msg: "Throttling detected", cid: this.id, throttleDelay, delayResponse, err });
58832
- let aborted2 = await new Promise((resolve2) => {
58833
- this._throttleAbort = resolve2;
58834
- this._throttleTimer = setTimeout(() => resolve2(false), delayResponse);
58835
- if (typeof this._throttleTimer.unref === "function") {
58836
- this._throttleTimer.unref();
58837
- }
58838
- });
58839
- this._throttleTimer = null;
58840
- this._throttleAbort = null;
58841
- if (aborted2) {
58842
- request.reject(this.createNoConnectionError(this.byeReason));
58843
- break;
58844
- }
58845
- }
60262
+ }
60263
+ let throttleDelay = false;
60264
+ if (/Request is throttled/i.test(txt) && /Backoff Time/i.test(txt)) {
60265
+ let throttlingMatch = txt.match(/Backoff Time[:=\s]+(\d+)/i);
60266
+ if (throttlingMatch && throttlingMatch[1] && !isNaN(throttlingMatch[1])) {
60267
+ throttleDelay = Number(throttlingMatch[1]);
58846
60268
  }
58847
- request.reject(err);
58848
- break;
58849
60269
  }
58850
- default: {
58851
- let err = new Error("Invalid server response");
58852
- err.code = "InvalidResponse";
58853
- err.response = parsed;
58854
- request.reject(err);
58855
- break;
60270
+ if (throttleDelay) {
60271
+ err.code = "ETHROTTLE";
60272
+ err.throttleReset = throttleDelay;
60273
+ let delayResponse = throttleDelay;
60274
+ if (delayResponse > 5 * 60 * 1e3) {
60275
+ delayResponse = 5 * 60 * 1e3;
60276
+ }
60277
+ this.log.warn({ msg: "Throttling detected", cid: this.id, throttleDelay, delayResponse, err });
60278
+ let aborted2 = await new Promise((resolve2) => {
60279
+ this._throttleAbort = resolve2;
60280
+ this._throttleTimer = setTimeout(() => resolve2(false), delayResponse);
60281
+ unrefTimer(this._throttleTimer);
60282
+ });
60283
+ this._throttleTimer = null;
60284
+ this._throttleAbort = null;
60285
+ if (aborted2) {
60286
+ request.reject(this.createNoConnectionError(this.byeReason));
60287
+ break;
60288
+ }
58856
60289
  }
58857
60290
  }
60291
+ request.reject(err);
60292
+ break;
58858
60293
  }
58859
- data.next();
58860
- processedCount++;
58861
- if (processedCount % 10 === 0) {
58862
- await new Promise((resolve2) => setImmediate(resolve2));
60294
+ default: {
60295
+ let err = new Error("Invalid server response");
60296
+ err.code = "InvalidResponse";
60297
+ err.response = parsed;
60298
+ request.reject(err);
60299
+ break;
58863
60300
  }
58864
60301
  }
58865
60302
  }
@@ -58874,6 +60311,25 @@ var require_imap_flow = __commonJS({
58874
60311
  };
58875
60312
  this.streamer.on("readable", this.socketReadable);
58876
60313
  }
60314
+ /**
60315
+ * Applies the transport options every established application socket needs: TCP keepalive and
60316
+ * the inactivity watchdog. Called for direct TLS, cleartext, proxied and STARTTLS-upgraded
60317
+ * sockets, so the watchdog cannot silently differ between transports (a STARTTLS session used
60318
+ * to end up with no armed timer at all).
60319
+ *
60320
+ * @param {Object} socket - The socket that now carries the IMAP session.
60321
+ */
60322
+ configureSocket(socket) {
60323
+ if (!socket) {
60324
+ return;
60325
+ }
60326
+ if (typeof socket.setKeepAlive === "function") {
60327
+ socket.setKeepAlive(true, 5 * 1e3);
60328
+ }
60329
+ if (typeof socket.setTimeout === "function") {
60330
+ socket.setTimeout(this.socketTimeout);
60331
+ }
60332
+ }
58877
60333
  setSocketHandlers() {
58878
60334
  this.clearSocketHandlers();
58879
60335
  this._socketError = this._socketError || ((err) => {
@@ -58962,10 +60418,23 @@ var require_imap_flow = __commonJS({
58962
60418
  await this.compress();
58963
60419
  }
58964
60420
  if (!this.options.disableAutoEnable) {
58965
- await this.run("ENABLE", ["CONDSTORE", "UTF8=ACCEPT"].concat(this.options.qresync ? "QRESYNC" : []));
60421
+ await this.autoEnable();
58966
60422
  }
58967
60423
  this.usable = true;
58968
60424
  }
60425
+ // Enable extensions if possible. IMAP4rev2 must be enabled explicitly on
60426
+ // servers that advertise both rev1 and rev2 (RFC 9051 Appendix A); a single
60427
+ // ENABLE call is used so the enabled set is built in one round trip.
60428
+ async autoEnable() {
60429
+ let enableList = ["CONDSTORE", "UTF8=ACCEPT"].concat(this.options.qresync ? "QRESYNC" : []).concat(this.options.disableIMAP4rev2 ? [] : "IMAP4rev2");
60430
+ let enableResult = await this.run("ENABLE", enableList);
60431
+ if (enableResult === false && enableList.includes("IMAP4rev2")) {
60432
+ await this.run(
60433
+ "ENABLE",
60434
+ enableList.filter((extension) => extension !== "IMAP4rev2")
60435
+ );
60436
+ }
60437
+ }
58969
60438
  async compress() {
58970
60439
  if (!await this.run("COMPRESS")) {
58971
60440
  return;
@@ -59007,9 +60476,6 @@ var require_imap_flow = __commonJS({
59007
60476
  throw err;
59008
60477
  }
59009
60478
  };
59010
- Object.defineProperty(this.writeSocket, "destroyed", {
59011
- get: () => !this.socket || this.socket.destroyed
59012
- });
59013
60479
  let reading = false;
59014
60480
  let processedChunks = 0;
59015
60481
  let readNext = async () => {
@@ -59101,7 +60567,6 @@ var require_imap_flow = __commonJS({
59101
60567
  throw failSTARTTLSInjection();
59102
60568
  }
59103
60569
  let upgraded = await new Promise((resolve2, reject) => {
59104
- this._upgradeReject = reject;
59105
60570
  let socketPlain = this.socket;
59106
60571
  let opts = Object.assign(
59107
60572
  {
@@ -59112,49 +60577,44 @@ var require_imap_flow = __commonJS({
59112
60577
  this.options.tls || {}
59113
60578
  );
59114
60579
  this.clearSocketHandlers();
59115
- const socketPlainErrorHandler = (err) => {
59116
- clearTimeout(this.connectTimeout);
59117
- clearTimeout(this.upgradeTimeout);
59118
- if (!this.upgrading) {
60580
+ let settled = false;
60581
+ const settle2 = (err, result) => {
60582
+ if (settled) {
59119
60583
  return;
59120
60584
  }
59121
- this.closeAfter();
60585
+ settled = true;
60586
+ clearTimeout(this.upgradeTimeout);
60587
+ this.upgradeTimeout = null;
59122
60588
  this.upgrading = false;
59123
- err.tlsFailed = true;
59124
- reject(err);
60589
+ this._upgradeReject = null;
60590
+ socketPlain.removeListener("error", settle2);
60591
+ if (this.socket && this.socket !== socketPlain) {
60592
+ this.socket.removeListener("error", settle2);
60593
+ }
60594
+ if (err) {
60595
+ clearTimeout(this.connectTimeout);
60596
+ err.tlsFailed = true;
60597
+ this.closeAfter();
60598
+ return reject(err);
60599
+ }
60600
+ resolve2(result);
59125
60601
  };
59126
- socketPlain.once("error", socketPlainErrorHandler);
60602
+ this._upgradeReject = settle2;
60603
+ socketPlain.once("error", settle2);
59127
60604
  this.upgradeTimeout = setTimeout(() => {
59128
- if (!this.upgrading) {
59129
- return;
59130
- }
59131
- this.closeAfter();
59132
60605
  let err = new Error("Failed to upgrade connection in required time");
59133
- err.tlsFailed = true;
59134
60606
  err.code = "UPGRADE_TIMEOUT";
59135
- reject(err);
60607
+ settle2(err);
59136
60608
  }, UPGRADE_TIMEOUT);
59137
- const tlsSocketErrorHandler = (err) => {
59138
- clearTimeout(this.connectTimeout);
59139
- clearTimeout(this.upgradeTimeout);
59140
- if (!this.upgrading) {
59141
- return;
59142
- }
59143
- this.upgrading = false;
59144
- err.tlsFailed = true;
59145
- this.clearSocketHandlers();
59146
- this.closeAfter();
59147
- reject(err);
59148
- };
59149
60609
  this.upgrading = true;
59150
60610
  this.socket = tls.connect(opts, () => {
59151
60611
  try {
59152
- clearTimeout(this.upgradeTimeout);
59153
60612
  if (this.isClosed) {
59154
- return this.close();
60613
+ let err = new Error("Connection closed during TLS upgrade");
60614
+ err.code = "NoConnection";
60615
+ return settle2(err);
59155
60616
  }
59156
60617
  this.secureConnection = true;
59157
- this.upgrading = false;
59158
60618
  this.streamer.secureConnection = true;
59159
60619
  this.socket.pipe(this.streamer);
59160
60620
  this.tls = typeof this.socket.getCipher === "function" ? this.socket.getCipher() : false;
@@ -59171,16 +60631,17 @@ var require_imap_flow = __commonJS({
59171
60631
  version: this.tls.version
59172
60632
  });
59173
60633
  }
59174
- socketPlain.removeListener("error", socketPlainErrorHandler);
59175
- this.socket.removeListener("error", tlsSocketErrorHandler);
60634
+ if (typeof socketPlain.setTimeout === "function") {
60635
+ socketPlain.setTimeout(0);
60636
+ }
59176
60637
  this.setSocketHandlers();
59177
- this._upgradeReject = null;
59178
- return resolve2(true);
60638
+ this.configureSocket(this.socket);
60639
+ settle2(null, true);
59179
60640
  } catch (ex) {
59180
60641
  this.emitError(ex);
59181
60642
  }
59182
60643
  });
59183
- this.socket.once("error", tlsSocketErrorHandler);
60644
+ this.socket.once("error", settle2);
59184
60645
  this.writeSocket = this.socket;
59185
60646
  });
59186
60647
  if (upgraded && this.expectCapabilityUpdate) {
@@ -59277,6 +60738,7 @@ var require_imap_flow = __commonJS({
59277
60738
  return;
59278
60739
  }
59279
60740
  this.state = this.states.AUTHENTICATED;
60741
+ this.authenticated = true;
59280
60742
  this.beginSession((err) => {
59281
60743
  this.log.error({ err, cid: this.id });
59282
60744
  this.closeAfter();
@@ -59455,6 +60917,11 @@ var require_imap_flow = __commonJS({
59455
60917
  }
59456
60918
  return range;
59457
60919
  }
60920
+ // Timer process-liveness policy: connection establishment and greeting deadlines keep the
60921
+ // process alive, because a caller is waiting on connect() to settle. Background timers
60922
+ // (auto-IDLE, IDLE restart, fallback polling, throttle back-off, the held-lock diagnostic) are
60923
+ // unref'd, so an otherwise idle process is not held open by them. Every timer is still cleared
60924
+ // explicitly on close().
59458
60925
  autoidle() {
59459
60926
  clearTimeout(this.idleStartTimer);
59460
60927
  if (this.options.disableAutoIdle || this.state !== this.states.SELECTED) {
@@ -59463,6 +60930,7 @@ var require_imap_flow = __commonJS({
59463
60930
  this.idleStartTimer = setTimeout(() => {
59464
60931
  this.idle().catch((err) => this.log.warn({ err, cid: this.id }));
59465
60932
  }, 15 * 1e3);
60933
+ unrefTimer(this.idleStartTimer);
59466
60934
  }
59467
60935
  // PUBLIC API METHODS
59468
60936
  /**
@@ -59479,6 +60947,7 @@ var require_imap_flow = __commonJS({
59479
60947
  throw new Error("Can not re-use ImapFlow instance");
59480
60948
  }
59481
60949
  this._connectCalled = true;
60950
+ let deadline = new ConnectionDeadline(this.options.connectionTimeout);
59482
60951
  let connector = this.secureConnection ? tls : net;
59483
60952
  let opts = Object.assign(
59484
60953
  {
@@ -59500,11 +60969,15 @@ var require_imap_flow = __commonJS({
59500
60969
  let socket = false;
59501
60970
  if (this.options.proxy) {
59502
60971
  try {
59503
- socket = await proxyConnection(this.log, this.options.proxy, this.host, this.port);
60972
+ socket = await proxyConnection(this.log, this.options.proxy, this.host, this.port, { deadline });
59504
60973
  if (!socket) {
59505
60974
  throw new Error("Failed to setup proxy connection");
59506
60975
  }
59507
60976
  } catch (err) {
60977
+ if (err.code === "CONNECT_TIMEOUT") {
60978
+ this.log.error({ err, cid: this.id });
60979
+ throw err;
60980
+ }
59508
60981
  let error2 = new Error("Failed to setup proxy connection");
59509
60982
  error2.code = err.code || "ProxyError";
59510
60983
  error2._err = err;
@@ -59514,23 +60987,16 @@ var require_imap_flow = __commonJS({
59514
60987
  }
59515
60988
  let connectPromise = new Promise((resolve2, reject) => {
59516
60989
  this.connectTimeout = setTimeout(() => {
59517
- let err = new Error("Failed to establish connection in required time");
59518
- err.code = "CONNECT_TIMEOUT";
59519
- err.details = {
59520
- /* c8 ignore next */
59521
- // firing the timeout with the default (large) value would hang the suite, so only the explicit-option path is tested
59522
- connectionTimeout: this.options.connectionTimeout || CONNECT_TIMEOUT
59523
- };
60990
+ let err = deadline.error();
59524
60991
  this.log.error({ err, cid: this.id });
59525
60992
  this.closeAfter();
59526
60993
  reject(err);
59527
- }, this.options.connectionTimeout || CONNECT_TIMEOUT);
60994
+ }, deadline.remaining());
59528
60995
  let onConnect = () => {
59529
60996
  try {
59530
60997
  clearTimeout(this.connectTimeout);
59531
60998
  detachEarlyErrorHandler(socket);
59532
- this.socket.setKeepAlive(true, 5 * 1e3);
59533
- this.socket.setTimeout(this.options.socketTimeout || SOCKET_TIMEOUT);
60999
+ this.configureSocket(this.socket);
59534
61000
  this.greetingTimeout = setTimeout(() => {
59535
61001
  let err = new Error(
59536
61002
  /* c8 ignore next */
@@ -59652,7 +61118,15 @@ var require_imap_flow = __commonJS({
59652
61118
  this._throttleAbort = null;
59653
61119
  }
59654
61120
  this.usable = false;
61121
+ this._idleSession = null;
59655
61122
  this.idling = false;
61123
+ if (typeof this._upgradeReject === "function") {
61124
+ let reject = this._upgradeReject;
61125
+ this._upgradeReject = null;
61126
+ let err = new Error("Connection closed during TLS upgrade");
61127
+ err.code = "NoConnection";
61128
+ reject(err);
61129
+ }
59656
61130
  if (typeof this.initialReject === "function" && !this.options.verifyOnly) {
59657
61131
  clearTimeout(this.greetingTimeout);
59658
61132
  let reject = this.initialReject;
@@ -59668,6 +61142,16 @@ var require_imap_flow = __commonJS({
59668
61142
  if (typeof this.preCheck === "function") {
59669
61143
  this.preCheck().catch((err) => this.log.warn({ err, cid: this.id }));
59670
61144
  }
61145
+ let closedMailbox = false;
61146
+ if (!this.isClosed) {
61147
+ closedMailbox = this.mailbox;
61148
+ this.mailbox = false;
61149
+ this.currentSelectCommand = false;
61150
+ if (!this.options.verifyOnly) {
61151
+ this.authenticated = false;
61152
+ }
61153
+ this.preCheck = false;
61154
+ }
59671
61155
  let pendingRequests = [];
59672
61156
  if (this.currentRequest && this.requestTagMap.has(this.currentRequest.tag)) {
59673
61157
  let tag = this.currentRequest.tag;
@@ -59750,22 +61234,15 @@ var require_imap_flow = __commonJS({
59750
61234
  if (this.isClosed) {
59751
61235
  return;
59752
61236
  }
59753
- if (this.socket && !this.socket.destroyed && this.writeSocket !== this.socket) {
59754
- try {
59755
- this.socket.destroy();
59756
- } catch (err) {
59757
- this.log.error({ err, cid: this.id });
59758
- }
59759
- }
59760
61237
  this.isClosed = true;
59761
- if (this.writeSocket && !this.writeSocket.destroyed) {
61238
+ if (this.writeSocket && this.writeSocket !== this.socket && !this.writeSocket.destroyed) {
59762
61239
  try {
59763
61240
  this.writeSocket.destroy();
59764
61241
  } catch (err) {
59765
61242
  this.log.error({ err, cid: this.id });
59766
61243
  }
59767
61244
  }
59768
- if (this.socket && !this.socket.destroyed && this.writeSocket !== this.socket) {
61245
+ if (this.socket && !this.socket.destroyed) {
59769
61246
  try {
59770
61247
  this.socket.destroy();
59771
61248
  } catch (err) {
@@ -59782,7 +61259,14 @@ var require_imap_flow = __commonJS({
59782
61259
  this._socketClose = null;
59783
61260
  this._socketEnd = null;
59784
61261
  this._socketTimeout = null;
59785
- this.log.trace({ msg: "Connection closed", cid: this.id });
61262
+ this.log.trace({
61263
+ msg: "Connection closed",
61264
+ cid: this.id,
61265
+ ...this._unknownTagCount ? { unknownTagCount: this._unknownTagCount } : {}
61266
+ });
61267
+ if (closedMailbox) {
61268
+ this.emit("mailboxClose", closedMailbox);
61269
+ }
59786
61270
  this.emit("close");
59787
61271
  } catch (ex) {
59788
61272
  this.log.error(ex);
@@ -59824,8 +61308,9 @@ var require_imap_flow = __commonJS({
59824
61308
  * @property {String} parentPath Same as `parent`, but as a complete string path (unicode string)
59825
61309
  * @property {Set<string>} flags a set of flags for this mailbox
59826
61310
  * @property {String} specialUse one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set
61311
+ * @property {String} [specialUseSource] how `specialUse` was determined: `"user"` (from `specialUseHints`), `"extension"` (SPECIAL-USE or XLIST flag reported by the server) or `"name"` (matched against known localized folder names)
59827
61312
  * @property {Boolean} listed `true` if mailbox was found from the output of LIST command
59828
- * @property {Boolean} subscribed `true` if mailbox was found from the output of LSUB command
61313
+ * @property {Boolean} subscribed `true` if the mailbox is subscribed - reported by LSUB or by LIST RETURN (SUBSCRIBED) on LIST-EXTENDED/IMAP4rev2 servers. Servers that answer neither report no subscription state at all, and every mailbox is then assumed to be subscribed
59829
61314
  * @property {StatusObject} [status] If `statusQuery` was used, then this value includes the status response
59830
61315
  */
59831
61316
  /**
@@ -59838,11 +61323,14 @@ var require_imap_flow = __commonJS({
59838
61323
  * @property {Boolean} [statusQuery.uidValidity] if `true` request mailbox `UIDVALIDITY` value
59839
61324
  * @property {Boolean} [statusQuery.unseen] if `true` request count of unseen messages
59840
61325
  * @property {Boolean} [statusQuery.highestModseq] if `true` request last known modseq value
61326
+ * @property {Boolean} [statusQuery.size] if `true` request total mailbox size in octets (requires STATUS=SIZE or IMAP4rev2)
61327
+ * @property {Boolean} [statusQuery.deleted] if `true` request count of messages with \\Deleted flag (requires IMAP4rev2)
59841
61328
  * @property {Object} [specialUseHints] set specific paths as special use folders, this would override special use flags provided from the server
59842
61329
  * @property {String} [specialUseHints.sent] Path to "Sent Mail" folder
59843
61330
  * @property {String} [specialUseHints.trash] Path to "Trash" folder
59844
61331
  * @property {String} [specialUseHints.junk] Path to "Junk Mail" folder
59845
61332
  * @property {String} [specialUseHints.drafts] Path to "Drafts" folder
61333
+ * @property {String} [specialUseHints.archive] Path to "Archive" folder
59846
61334
  */
59847
61335
  /**
59848
61336
  * Lists available mailboxes as an Array
@@ -59870,9 +61358,10 @@ var require_imap_flow = __commonJS({
59870
61358
  * @property {Set<string>} flags list of flags for this mailbox
59871
61359
  * @property {String} specialUse one of special-use flags (if applicable): "\All", "\Archive", "\Drafts", "\Flagged", "\Junk", "\Sent", "\Trash". Additionally INBOX has non-standard "\Inbox" flag set
59872
61360
  * @property {Boolean} listed `true` if mailbox was found from the output of LIST command
59873
- * @property {Boolean} subscribed `true` if mailbox was found from the output of LSUB command
61361
+ * @property {Boolean} subscribed `true` if the mailbox is subscribed - reported by LSUB or by LIST RETURN (SUBSCRIBED) on LIST-EXTENDED/IMAP4rev2 servers. Servers that answer neither report no subscription state at all, and every mailbox is then assumed to be subscribed
59874
61362
  * @property {Boolean} disabled If `true` then this mailbox can not be selected in the UI
59875
61363
  * @property {ListTreeResponse[]} folders An array of subfolders
61364
+ * @property {StatusObject} [status] If `statusQuery` was used, then this value includes the status response
59876
61365
  */
59877
61366
  /**
59878
61367
  * Lists available mailboxes as a tree structured object
@@ -60026,6 +61515,8 @@ var require_imap_flow = __commonJS({
60026
61515
  * @property {BigInt} [uidValidity] Mailbox `UIDVALIDITY` value
60027
61516
  * @property {Number} [unseen] Count of unseen messages
60028
61517
  * @property {BigInt} [highestModseq] Last known modseq value (if CONDSTORE extension is enabled)
61518
+ * @property {Number} [size] Total size of the mailbox in octets (only if requested and the server supports STATUS=SIZE or IMAP4rev2)
61519
+ * @property {Number} [deleted] Count of messages with \\Deleted flag (only if requested and IMAP4rev2 is active)
60029
61520
  */
60030
61521
  /**
60031
61522
  * Requests the status of the indicated mailbox. Only requested status values will be returned.
@@ -60038,6 +61529,8 @@ var require_imap_flow = __commonJS({
60038
61529
  * @param {Boolean} query.uidValidity if `true` request mailbox `UIDVALIDITY` value
60039
61530
  * @param {Boolean} query.unseen if `true` request count of unseen messages
60040
61531
  * @param {Boolean} query.highestModseq if `true` request last known modseq value
61532
+ * @param {Boolean} query.size if `true` request total mailbox size in octets (requires STATUS=SIZE or IMAP4rev2)
61533
+ * @param {Boolean} query.deleted if `true` request count of messages with \\Deleted flag (requires IMAP4rev2)
60041
61534
  * @returns {Promise<StatusObject>} status of the indicated mailbox
60042
61535
  *
60043
61536
  * @example
@@ -60485,6 +61978,7 @@ var require_imap_flow = __commonJS({
60485
61978
  * @property {MessageStructureObject} [bodyStructure] message body structure
60486
61979
  * @property {Date} [internalDate] message internal date
60487
61980
  * @property {Map<string, Buffer>} [bodyParts] a Map of message body parts where key is requested part identifier and value is a Buffer
61981
+ * @property {Set<string>} [binaryParts] part identifiers from `bodyParts` that arrived via FETCH BINARY, i.e. with the content-transfer-encoding already decoded by the server
60488
61982
  * @property {Buffer} [headers] Requested header lines as Buffer
60489
61983
  */
60490
61984
  /**
@@ -60826,7 +62320,8 @@ var require_imap_flow = __commonJS({
60826
62320
  let stream;
60827
62321
  let output;
60828
62322
  let fetchAborted = false;
60829
- switch (meta.encoding) {
62323
+ let clientEncoding = response.binaryParts && response.binaryParts.has(part) ? false : meta.encoding;
62324
+ switch (clientEncoding) {
60830
62325
  case "base64":
60831
62326
  output = stream = new libbase64.Decoder();
60832
62327
  break;
@@ -61055,7 +62550,8 @@ var require_imap_flow = __commonJS({
61055
62550
  }
61056
62551
  for (let part of Object.keys(data)) {
61057
62552
  let meta = data[part].meta;
61058
- switch (meta.encoding) {
62553
+ let clientEncoding = response.binaryParts && response.binaryParts.has(part) ? false : meta.encoding;
62554
+ switch (clientEncoding) {
61059
62555
  case "base64":
61060
62556
  data[part].content = data[part].content ? libbase64.decode(data[part].content.toString()) : null;
61061
62557
  break;
@@ -61073,21 +62569,42 @@ var require_imap_flow = __commonJS({
61073
62569
  return false;
61074
62570
  }
61075
62571
  if (!this.socket || this.socket.destroyed) {
61076
- const error2 = new Error("Connection not available");
61077
- error2.code = "NoConnection";
61078
- throw error2;
62572
+ throw this.createNoConnectionError();
61079
62573
  }
61080
62574
  clearTimeout(this.idleStartTimer);
61081
62575
  if (typeof this.preCheck === "function") {
61082
62576
  await this.preCheck();
61083
62577
  }
61084
- let handler = this.commands.get(command);
61085
- let result = await handler(this, ...args);
62578
+ let result = await this.runInternal(command, ...args);
61086
62579
  if (command !== "IDLE") {
61087
62580
  this.autoidle();
61088
62581
  }
61089
62582
  return result;
61090
62583
  }
62584
+ /**
62585
+ * Dispatches a command without the IDLE handshake that `run()` performs.
62586
+ *
62587
+ * Used by callers that already own the connection's idle state - fallback polling issues its
62588
+ * commands through here, because `run()` would await `preCheck()`, and the preCheck it would
62589
+ * await belongs to the very polling session making the call, so the session would cancel
62590
+ * itself. Auto-IDLE is not restarted either, for the same reason: the caller is the idle loop.
62591
+ *
62592
+ * @param {String} command Command name, as registered in the command registry.
62593
+ * @param {...*} args Arguments forwarded to the command implementation.
62594
+ * @returns {Promise<*>} Whatever the command implementation returns, or `false` for an
62595
+ * unknown command.
62596
+ */
62597
+ async runInternal(command, ...args) {
62598
+ command = command.toUpperCase();
62599
+ if (!this.commands.has(command)) {
62600
+ return false;
62601
+ }
62602
+ if (!this.socket || this.socket.destroyed) {
62603
+ throw this.createNoConnectionError();
62604
+ }
62605
+ let handler = this.commands.get(command);
62606
+ return await handler(this, ...args);
62607
+ }
61091
62608
  // Mailbox lock queue processor. Implements a mutex pattern: only one lock
61092
62609
  // is active at a time. When the active lock is released, the next queued
61093
62610
  // lock is processed. The `processingLock` flag prevents concurrent runs
@@ -61143,6 +62660,7 @@ var require_imap_flow = __commonJS({
61143
62660
  cid: this.id
61144
62661
  });
61145
62662
  }, threshold);
62663
+ unrefTimer(lock.heldWarnTimer);
61146
62664
  };
61147
62665
  const release = () => {
61148
62666
  if (this.currentLock === lock) {
@@ -69250,7 +70768,7 @@ function object(shape, params) {
69250
70768
  return new ZodMiniObject(def);
69251
70769
  }
69252
70770
 
69253
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
70771
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
69254
70772
  function isZ4Schema(s) {
69255
70773
  const schema = s;
69256
70774
  return !!schema._zod;
@@ -69334,17 +70852,33 @@ function normalizeObjectSchema(schema) {
69334
70852
  }
69335
70853
  return void 0;
69336
70854
  }
70855
+ function getDotPath(path) {
70856
+ if (path.length === 0) {
70857
+ return "object root";
70858
+ }
70859
+ return path.reduce((acc, seg, index) => {
70860
+ if (index === 0) {
70861
+ return String(seg);
70862
+ }
70863
+ if (typeof seg === "number") {
70864
+ return `${acc}[${seg}]`;
70865
+ }
70866
+ return `${acc}.${seg}`;
70867
+ }, "");
70868
+ }
69337
70869
  function getParseErrorMessage(error2) {
69338
70870
  if (error2 && typeof error2 === "object") {
70871
+ if ("issues" in error2 && Array.isArray(error2.issues) && error2.issues.length > 0) {
70872
+ return error2.issues.map((i) => {
70873
+ if (!i.path?.length) {
70874
+ return i.message;
70875
+ }
70876
+ return `${i.message} at ${getDotPath(i.path)}`;
70877
+ }).join("\n");
70878
+ }
69339
70879
  if ("message" in error2 && typeof error2.message === "string") {
69340
70880
  return error2.message;
69341
70881
  }
69342
- if ("issues" in error2 && Array.isArray(error2.issues) && error2.issues.length > 0) {
69343
- const firstIssue = error2.issues[0];
69344
- if (firstIssue && typeof firstIssue === "object" && "message" in firstIssue) {
69345
- return String(firstIssue.message);
69346
- }
69347
- }
69348
70882
  try {
69349
70883
  return JSON.stringify(error2);
69350
70884
  } catch {
@@ -70089,7 +71623,7 @@ function preprocess(fn, schema) {
70089
71623
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/external.js
70090
71624
  config(en_default2());
70091
71625
 
70092
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
71626
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
70093
71627
  var LATEST_PROTOCOL_VERSION = "2025-11-25";
70094
71628
  var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
70095
71629
  var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
@@ -71620,7 +73154,7 @@ var UrlElicitationRequiredError = class extends McpError {
71620
73154
  }
71621
73155
  };
71622
73156
 
71623
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
73157
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
71624
73158
  function isTerminal(status) {
71625
73159
  return status === "completed" || status === "failed" || status === "cancelled";
71626
73160
  }
@@ -72909,7 +74443,7 @@ var zodToJsonSchema = (schema, options) => {
72909
74443
  return combined;
72910
74444
  };
72911
74445
 
72912
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
74446
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
72913
74447
  function mapMiniTarget(t) {
72914
74448
  if (!t)
72915
74449
  return "draft-7";
@@ -72951,7 +74485,7 @@ function parseWithCompat(schema, data) {
72951
74485
  return result.data;
72952
74486
  }
72953
74487
 
72954
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
74488
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
72955
74489
  var DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
72956
74490
  var Protocol = class {
72957
74491
  constructor(_options) {
@@ -73905,7 +75439,7 @@ function mergeCapabilities(base, additional) {
73905
75439
  return result;
73906
75440
  }
73907
75441
 
73908
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
75442
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
73909
75443
  var import_ajv = __toESM(require_ajv(), 1);
73910
75444
  var import_ajv_formats = __toESM(require_dist(), 1);
73911
75445
  function createDefaultAjvInstance() {
@@ -73973,7 +75507,7 @@ var AjvJsonSchemaValidator = class {
73973
75507
  }
73974
75508
  };
73975
75509
 
73976
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
75510
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
73977
75511
  var ExperimentalServerTasks = class {
73978
75512
  constructor(_server) {
73979
75513
  this._server = _server;
@@ -74186,7 +75720,7 @@ var ExperimentalServerTasks = class {
74186
75720
  }
74187
75721
  };
74188
75722
 
74189
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
75723
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
74190
75724
  function assertToolsCallTaskCapability(requests, method, entityName) {
74191
75725
  if (!requests) {
74192
75726
  throw new Error(`${entityName} does not support task creation (required for ${method})`);
@@ -74221,7 +75755,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
74221
75755
  }
74222
75756
  }
74223
75757
 
74224
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
75758
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
74225
75759
  var Server = class extends Protocol {
74226
75760
  /**
74227
75761
  * Initializes this server with the given name and version information.
@@ -74287,16 +75821,7 @@ var Server = class extends Protocol {
74287
75821
  if (!methodSchema) {
74288
75822
  throw new Error("Schema is missing a method literal");
74289
75823
  }
74290
- let methodValue;
74291
- if (isZ4Schema(methodSchema)) {
74292
- const v4Schema = methodSchema;
74293
- const v4Def = v4Schema._zod?.def;
74294
- methodValue = v4Def?.value ?? v4Schema.value;
74295
- } else {
74296
- const v3Schema = methodSchema;
74297
- const legacyDef = v3Schema._def;
74298
- methodValue = legacyDef?.value ?? v3Schema.value;
74299
- }
75824
+ const methodValue = getLiteralValue(methodSchema);
74300
75825
  if (typeof methodValue !== "string") {
74301
75826
  throw new Error("Schema method literal must be a string");
74302
75827
  }
@@ -74601,7 +76126,7 @@ var Server = class extends Protocol {
74601
76126
  }
74602
76127
  };
74603
76128
 
74604
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
76129
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
74605
76130
  var COMPLETABLE_SYMBOL = /* @__PURE__ */ Symbol.for("mcp.completable");
74606
76131
  function isCompletable(schema) {
74607
76132
  return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
@@ -74615,7 +76140,7 @@ var McpZodTypeKind;
74615
76140
  McpZodTypeKind2["Completable"] = "McpCompletable";
74616
76141
  })(McpZodTypeKind || (McpZodTypeKind = {}));
74617
76142
 
74618
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
76143
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js
74619
76144
  var MAX_TEMPLATE_LENGTH = 1e6;
74620
76145
  var MAX_VARIABLE_LENGTH = 1e6;
74621
76146
  var MAX_TEMPLATE_EXPRESSIONS = 1e4;
@@ -74837,7 +76362,7 @@ var UriTemplate = class _UriTemplate {
74837
76362
  }
74838
76363
  };
74839
76364
 
74840
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
76365
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
74841
76366
  var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
74842
76367
  function validateToolName(name) {
74843
76368
  const warnings = [];
@@ -74895,7 +76420,7 @@ function validateAndWarnToolName(name) {
74895
76420
  return result.isValid;
74896
76421
  }
74897
76422
 
74898
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
76423
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
74899
76424
  var ExperimentalMcpServerTasks = class {
74900
76425
  constructor(_mcpServer) {
74901
76426
  this._mcpServer = _mcpServer;
@@ -74910,7 +76435,7 @@ var ExperimentalMcpServerTasks = class {
74910
76435
  }
74911
76436
  };
74912
76437
 
74913
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
76438
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
74914
76439
  var McpServer = class {
74915
76440
  constructor(serverInfo, options) {
74916
76441
  this._registeredResources = {};
@@ -75726,12 +77251,21 @@ var EMPTY_COMPLETION_RESULT = {
75726
77251
  }
75727
77252
  };
75728
77253
 
75729
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
77254
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
75730
77255
  import process2 from "node:process";
75731
77256
 
75732
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
77257
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
77258
+ var STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024;
75733
77259
  var ReadBuffer = class {
77260
+ constructor(options) {
77261
+ this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE;
77262
+ }
75734
77263
  append(chunk) {
77264
+ const newSize = (this._buffer?.length ?? 0) + chunk.length;
77265
+ if (newSize > this._maxBufferSize) {
77266
+ this.clear();
77267
+ throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);
77268
+ }
75735
77269
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
75736
77270
  }
75737
77271
  readMessage() {
@@ -75757,20 +77291,26 @@ function serializeMessage(message) {
75757
77291
  return JSON.stringify(message) + "\n";
75758
77292
  }
75759
77293
 
75760
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
77294
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.30.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
75761
77295
  var StdioServerTransport = class {
75762
- constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
77296
+ constructor(_stdin = process2.stdin, _stdout = process2.stdout, options) {
75763
77297
  this._stdin = _stdin;
75764
77298
  this._stdout = _stdout;
75765
- this._readBuffer = new ReadBuffer();
75766
77299
  this._started = false;
75767
77300
  this._ondata = (chunk) => {
75768
- this._readBuffer.append(chunk);
75769
- this.processReadBuffer();
77301
+ try {
77302
+ this._readBuffer.append(chunk);
77303
+ this.processReadBuffer();
77304
+ } catch (error2) {
77305
+ this.onerror?.(error2);
77306
+ this.close().catch(() => {
77307
+ });
77308
+ }
75770
77309
  };
75771
77310
  this._onerror = (error2) => {
75772
77311
  this.onerror?.(error2);
75773
77312
  };
77313
+ this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize });
75774
77314
  }
75775
77315
  /**
75776
77316
  * Starts listening for messages on stdin.