NeahNew/.next/server/chunks/2461.js
2025-05-06 23:01:34 +02:00

97 lines
267 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

exports.id=2461,exports.ids=[2461],exports.modules={894:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__exportStar||function(e,t){for(var s in e)"default"===s||Object.prototype.hasOwnProperty.call(t,s)||r(t,e,s)};Object.defineProperty(t,"__esModule",{value:!0}),i(s(63858),t)},2894:e=>{"use strict";e.exports={flags:["\\All","\\Archive","\\Drafts","\\Flagged","\\Junk","\\Sent","\\Trash"],names:{"\\Sent":["aika","bidaliak","bidalita","dihantar","e rometsweng","e tindami","elk\xfcld\xf6tt","elk\xfcld\xf6ttek","elementos enviados","\xe9l\xe9ments envoy\xe9s","enviadas","enviadas","enviados","enviats","envoy\xe9s","ethunyelweyo","expediate","ezipuru","gesendete","gesendete elemente","gestuur","g\xf6nderilmiş \xf6ğeler","g\xf6ndərilənlər","iberilen","inviati","išsiųstieji","kuthunyelwe","lasa","l\xe4hetetyt","messages envoy\xe9s","naipadala","nalefa","napadala","nosūtītās ziņas","odeslan\xe9","odeslan\xe1 pošta","padala","poslane","poslano","poslano","poslan\xe9","poslato","saadetud","saadetud kirjad","saadetud \xfcksused","sendt","sendt","sent","sent items","sent messages","s\xe4nda poster","s\xe4nt","terkirim","ti fi ranṣẹ","t\xeb d\xebrguara","verzonden","vilivyotumwa","wysłane","đ\xe3 gửi","σταλθέντα","жиберилген","жіберілгендер","изпратени","илгээсэн","ирсол шуд","испратено","надіслані","отправленные","пасланыя","юборилган","ուղարկված","נשלחו","פריטים שנשלחו","المرسلة","بھیجے گئے","سوزمژہ","لېګل شوی","موارد ارسال شده","पाठविले","पाठविलेले","प्रेषित","भेजा गया","প্রেরিত","প্রেরিত","প্ৰেৰিত","ਭੇਜੇ","મોકલેલા","ପଠାଗଲା","அனுப்பியவை","పంపించబడింది","ಕಳುಹಿಸಲಾದ","അയച്ചു","යැවු පණිවුඩ","ส่งแล้ว","გაგზავნილი","የተላኩ","បាន​ផ្ញើ","寄件備份","寄件備份","已发信息","送信済みメール","발신 메시지","보낸 편지함"],"\\Trash":["articole șterse","bin","borttagna objekt","deleted","deleted items","deleted messages","elementi eliminati","elementos borrados","elementos eliminados","gel\xf6schte objekte","gel\xf6schte elemente","item dipadam","itens apagados","itens exclu\xeddos","kustutatud \xfcksused","mục đ\xe3 x\xf3a","odstraněn\xe9 položky","odstraněn\xe1 pošta","pesan terhapus","poistetut","praht","pr\xfcgikast","silinmiş \xf6ğeler","slettede beskeder","slettede elementer","trash","t\xf6r\xf6lt elemek","t\xf6r\xf6lt","usunięte wiadomości","verwijderde items","vymazan\xe9 spr\xe1vy","\xe9l\xe9ments supprim\xe9s","видалені","жойылғандар","удаленные","פריטים שנמחקו","العناصر المحذوفة","موارد حذف شده","รายการที่ลบ","已删除邮件","已刪除項目","已刪除項目"],"\\Junk":["bulk mail","correo no deseado","courrier ind\xe9sirable","istenmeyen","istenmeyen e-posta","junk","junk e-mail","junk email","junk-e-mail","lev\xe9lszem\xe9t","nevyžiadan\xe1 pošta","nevyž\xe1dan\xe1 pošta","no deseado","posta indesiderata","pourriel","roskaposti","r\xe4mpspost","skr\xe4ppost","spam","spam","spamowanie","s\xf8ppelpost","thư r\xe1c","wiadomości-śmieci","спам","דואר זבל","الرسائل العشوائية","هرزنامه","สแปม","垃圾郵件","垃圾邮件","垃圾電郵"],"\\Drafts":["ba brouillon","borrador","borrador","borradores","bozze","brouillons","bản thảo","ciorne","concepten","draf","draft","drafts","dr\xf6g","entw\xfcrfe","esborranys","garalamalar","ihe edeturu","iidrafti","izinhlaka","juodraščiai","kladd","kladder","koncepty","koncepty","konsep","konsepte","kopie robocze","layihələr","luonnokset","melnraksti","meralo","mesazhe t\xeb pad\xebrguara","mga draft","mustandid","nacrti","nacrti","osnutki","piszkozatok","rascunhos","rasimu","skice","taslaklar","tsararrun saƙonni","utkast","vakiraoka","v\xe1zlatok","zirriborroak","\xe0wọn \xe0kọpamọ́","πρόχειρα","жобалар","нацрти","нооргууд","сиёҳнавис","хомаки хатлар","чарнавікі","чернетки","чернови","черновики","черновиктер","սևագրեր","טיוטות","مسودات","مسودات","موسودې","پیش نویسها","ڈرافٹ/","ड्राफ़्ट","प्रारूप","খসড়া","খসড়া","ড্ৰাফ্ট","ਡ੍ਰਾਫਟ","ડ્રાફ્ટસ","ଡ୍ରାଫ୍ଟ","வரைவுகள்","చిత్తు ప్రతులు","ಕರಡುಗಳು","കരടുകള്‍","කෙටුම් පත්","ฉบับร่าง","მონახაზები","ረቂቆች","សារព្រាង","下書き","草稿","草稿","草稿","임시 보관함"],"\\Archive":["archive"]},specialUse(t,s){let r;if(t&&(r={flag:e.exports.flags.find(e=>s.flags.has(e)),source:"extension"}),!r||!r.flag){let t=s.name.toLowerCase().replace(/\u200e/g,"").trim();r={flag:Object.keys(e.exports.names).find(s=>e.exports.names[s].includes(t)),source:"name"}}return r&&r.flag?r:{flag:null}}}},2934:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i,getStatusCode:o,getErrorText:a}=s(80876);e.exports=async(e,t)=>{if([e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)){t=i(e,t);try{return(await e.exec("SUBSCRIBE",[{type:"ATOM",value:r(e,t)}])).next(),!0}catch(s){let t=o(s.response);return t&&(s.serverResponseCode=t),s.response=await a(s.response),e.log.warn({err:s,cid:e.id}),!1}}}},4179:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i,getStatusCode:o,getErrorText:a}=s(80876);e.exports=async(e,t)=>{if([e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)){t=i(e,t);try{return(await e.exec("UNSUBSCRIBE",[{type:"ATOM",value:r(e,t)}])).next(),!0}catch(s){let t=o(s.response);return t&&(s.serverResponseCode=t),s.response=await a(s.response),e.log.warn({err:s,cid:e.id}),!1}}}},4238:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=s(70360);class i{constructor(e){if(this.length=0,this._encoding="utf8",this._writeOffset=0,this._readOffset=0,i.isSmartBufferOptions(e))if(e.encoding&&(r.checkEncoding(e.encoding),this._encoding=e.encoding),e.size)if(r.isFiniteInteger(e.size)&&e.size>0)this._buff=Buffer.allocUnsafe(e.size);else throw Error(r.ERRORS.INVALID_SMARTBUFFER_SIZE);else if(e.buff)if(Buffer.isBuffer(e.buff))this._buff=e.buff,this.length=e.buff.length;else throw Error(r.ERRORS.INVALID_SMARTBUFFER_BUFFER);else this._buff=Buffer.allocUnsafe(4096);else{if(void 0!==e)throw Error(r.ERRORS.INVALID_SMARTBUFFER_OBJECT);this._buff=Buffer.allocUnsafe(4096)}}static fromSize(e,t){return new this({size:e,encoding:t})}static fromBuffer(e,t){return new this({buff:e,encoding:t})}static fromOptions(e){return new this(e)}static isSmartBufferOptions(e){return e&&(void 0!==e.encoding||void 0!==e.size||void 0!==e.buff)}readInt8(e){return this._readNumberValue(Buffer.prototype.readInt8,1,e)}readInt16BE(e){return this._readNumberValue(Buffer.prototype.readInt16BE,2,e)}readInt16LE(e){return this._readNumberValue(Buffer.prototype.readInt16LE,2,e)}readInt32BE(e){return this._readNumberValue(Buffer.prototype.readInt32BE,4,e)}readInt32LE(e){return this._readNumberValue(Buffer.prototype.readInt32LE,4,e)}readBigInt64BE(e){return r.bigIntAndBufferInt64Check("readBigInt64BE"),this._readNumberValue(Buffer.prototype.readBigInt64BE,8,e)}readBigInt64LE(e){return r.bigIntAndBufferInt64Check("readBigInt64LE"),this._readNumberValue(Buffer.prototype.readBigInt64LE,8,e)}writeInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeInt8,1,e,t),this}insertInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeInt8,1,e,t)}writeInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}insertInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16BE,2,e,t)}writeInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}insertInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt16LE,2,e,t)}writeInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}insertInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32BE,4,e,t)}writeInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}insertInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeInt32LE,4,e,t)}writeBigInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}insertBigInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigInt64BE,8,e,t)}writeBigInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}insertBigInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigInt64LE,8,e,t)}readUInt8(e){return this._readNumberValue(Buffer.prototype.readUInt8,1,e)}readUInt16BE(e){return this._readNumberValue(Buffer.prototype.readUInt16BE,2,e)}readUInt16LE(e){return this._readNumberValue(Buffer.prototype.readUInt16LE,2,e)}readUInt32BE(e){return this._readNumberValue(Buffer.prototype.readUInt32BE,4,e)}readUInt32LE(e){return this._readNumberValue(Buffer.prototype.readUInt32LE,4,e)}readBigUInt64BE(e){return r.bigIntAndBufferInt64Check("readBigUInt64BE"),this._readNumberValue(Buffer.prototype.readBigUInt64BE,8,e)}readBigUInt64LE(e){return r.bigIntAndBufferInt64Check("readBigUInt64LE"),this._readNumberValue(Buffer.prototype.readBigUInt64LE,8,e)}writeUInt8(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt8,1,e,t)}insertUInt8(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt8,1,e,t)}writeUInt16BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}insertUInt16BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16BE,2,e,t)}writeUInt16LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}insertUInt16LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt16LE,2,e,t)}writeUInt32BE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}insertUInt32BE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32BE,4,e,t)}writeUInt32LE(e,t){return this._writeNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}insertUInt32LE(e,t){return this._insertNumberValue(Buffer.prototype.writeUInt32LE,4,e,t)}writeBigUInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}insertBigUInt64BE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64BE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64BE,8,e,t)}writeBigUInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._writeNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}insertBigUInt64LE(e,t){return r.bigIntAndBufferInt64Check("writeBigUInt64LE"),this._insertNumberValue(Buffer.prototype.writeBigUInt64LE,8,e,t)}readFloatBE(e){return this._readNumberValue(Buffer.prototype.readFloatBE,4,e)}readFloatLE(e){return this._readNumberValue(Buffer.prototype.readFloatLE,4,e)}writeFloatBE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}insertFloatBE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatBE,4,e,t)}writeFloatLE(e,t){return this._writeNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}insertFloatLE(e,t){return this._insertNumberValue(Buffer.prototype.writeFloatLE,4,e,t)}readDoubleBE(e){return this._readNumberValue(Buffer.prototype.readDoubleBE,8,e)}readDoubleLE(e){return this._readNumberValue(Buffer.prototype.readDoubleLE,8,e)}writeDoubleBE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}insertDoubleBE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleBE,8,e,t)}writeDoubleLE(e,t){return this._writeNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}insertDoubleLE(e,t){return this._insertNumberValue(Buffer.prototype.writeDoubleLE,8,e,t)}readString(e,t){let s;"number"==typeof e?(r.checkLengthValue(e),s=Math.min(e,this.length-this._readOffset)):(t=e,s=this.length-this._readOffset),void 0!==t&&r.checkEncoding(t);let i=this._buff.slice(this._readOffset,this._readOffset+s).toString(t||this._encoding);return this._readOffset+=s,i}insertString(e,t,s){return r.checkOffsetValue(t),this._handleString(e,!0,t,s)}writeString(e,t,s){return this._handleString(e,!1,t,s)}readStringNT(e){void 0!==e&&r.checkEncoding(e);let t=this.length;for(let e=this._readOffset;e<this.length;e++)if(0===this._buff[e]){t=e;break}let s=this._buff.slice(this._readOffset,t);return this._readOffset=t+1,s.toString(e||this._encoding)}insertStringNT(e,t,s){return r.checkOffsetValue(t),this.insertString(e,t,s),this.insertUInt8(0,t+e.length),this}writeStringNT(e,t,s){return this.writeString(e,t,s),this.writeUInt8(0,"number"==typeof t?t+e.length:this.writeOffset),this}readBuffer(e){void 0!==e&&r.checkLengthValue(e);let t="number"==typeof e?e:this.length,s=Math.min(this.length,this._readOffset+t),i=this._buff.slice(this._readOffset,s);return this._readOffset=s,i}insertBuffer(e,t){return r.checkOffsetValue(t),this._handleBuffer(e,!0,t)}writeBuffer(e,t){return this._handleBuffer(e,!1,t)}readBufferNT(){let e=this.length;for(let t=this._readOffset;t<this.length;t++)if(0===this._buff[t]){e=t;break}let t=this._buff.slice(this._readOffset,e);return this._readOffset=e+1,t}insertBufferNT(e,t){return r.checkOffsetValue(t),this.insertBuffer(e,t),this.insertUInt8(0,t+e.length),this}writeBufferNT(e,t){return void 0!==t&&r.checkOffsetValue(t),this.writeBuffer(e,t),this.writeUInt8(0,"number"==typeof t?t+e.length:this._writeOffset),this}clear(){return this._writeOffset=0,this._readOffset=0,this.length=0,this}remaining(){return this.length-this._readOffset}get readOffset(){return this._readOffset}set readOffset(e){r.checkOffsetValue(e),r.checkTargetOffset(e,this),this._readOffset=e}get writeOffset(){return this._writeOffset}set writeOffset(e){r.checkOffsetValue(e),r.checkTargetOffset(e,this),this._writeOffset=e}get encoding(){return this._encoding}set encoding(e){r.checkEncoding(e),this._encoding=e}get internalBuffer(){return this._buff}toBuffer(){return this._buff.slice(0,this.length)}toString(e){let t="string"==typeof e?e:this._encoding;return r.checkEncoding(t),this._buff.toString(t,0,this.length)}destroy(){return this.clear(),this}_handleString(e,t,s,i){let o=this._writeOffset,a=this._encoding;"number"==typeof s?o=s:"string"==typeof s&&(r.checkEncoding(s),a=s),"string"==typeof i&&(r.checkEncoding(i),a=i);let l=Buffer.byteLength(e,a);return t?this.ensureInsertable(l,o):this._ensureWriteable(l,o),this._buff.write(e,o,l,a),t?this._writeOffset+=l:"number"==typeof s?this._writeOffset=Math.max(this._writeOffset,o+l):this._writeOffset+=l,this}_handleBuffer(e,t,s){let r="number"==typeof s?s:this._writeOffset;return t?this.ensureInsertable(e.length,r):this._ensureWriteable(e.length,r),e.copy(this._buff,r),t?this._writeOffset+=e.length:"number"==typeof s?this._writeOffset=Math.max(this._writeOffset,r+e.length):this._writeOffset+=e.length,this}ensureReadable(e,t){let s=this._readOffset;if(void 0!==t&&(r.checkOffsetValue(t),s=t),s<0||s+e>this.length)throw Error(r.ERRORS.INVALID_READ_BEYOND_BOUNDS)}ensureInsertable(e,t){r.checkOffsetValue(t),this._ensureCapacity(this.length+e),t<this.length&&this._buff.copy(this._buff,t+e,t,this._buff.length),t+e>this.length?this.length=t+e:this.length+=e}_ensureWriteable(e,t){let s="number"==typeof t?t:this._writeOffset;this._ensureCapacity(s+e),s+e>this.length&&(this.length=s+e)}_ensureCapacity(e){let t=this._buff.length;if(e>t){let s=this._buff,r=3*t/2+1;r<e&&(r=e),this._buff=Buffer.allocUnsafe(r),s.copy(this._buff,0,0,t)}}_readNumberValue(e,t,s){this.ensureReadable(t,s);let r=e.call(this._buff,"number"==typeof s?s:this._readOffset);return void 0===s&&(this._readOffset+=t),r}_insertNumberValue(e,t,s,i){return r.checkOffsetValue(i),this.ensureInsertable(t,i),e.call(this._buff,s,i),this._writeOffset+=t,this}_writeNumberValue(e,t,s,i){if("number"==typeof i){if(i<0)throw Error(r.ERRORS.INVALID_WRITE_BEYOND_BOUNDS);r.checkOffsetValue(i)}let o="number"==typeof i?i:this._writeOffset;return this._ensureWriteable(t,o),e.call(this._buff,s,o),"number"==typeof i?this._writeOffset=Math.max(this._writeOffset,o+t):this._writeOffset+=t,this}}t.SmartBuffer=i},5679:(e,t,s)=>{"use strict";let r=s(85389),i=(e,t)=>"string"==typeof e?Buffer.from(e):"number"==typeof e?Buffer.from(e.toString()):Buffer.isBuffer(e)?e:t?null:Buffer.alloc(0);e.exports=async(e,t)=>{let s,o,{asArray:a,isLogging:l,literalPlus:h,literalMinus:u}=t||{},c=[],d=[].concat(i(e.tag,!0)||[]).concat(e.command?i(" "+e.command):[]),p=async(e,t)=>{t=t||{};let f=d.length&&d[d.length-1],g=f&&f.length&&f[f.length-1]||"";if("number"==typeof g&&(g=String.fromCharCode(g)),("LITERAL"===o||!["(","<","["].includes(g)&&d.length)&&(t.subArray||d.push(i(" "))),e&&e.buffer&&!Buffer.isBuffer(e)&&(e=e.buffer),Array.isArray(e)){o="LIST",d.push(i("("));let t=e.length>1&&Array.isArray(e[0]);for(let s of e)t&&!Array.isArray(s)&&(t=!1),await p(s,{subArray:t});d.push(i(")"));return}if(!e&&"string"!=typeof e&&"number"!=typeof e&&!Buffer.isBuffer(e))return void d.push(i("NIL"));if("string"==typeof e||Buffer.isBuffer(e))return void(l&&e.length>100?d.push(i('"(* '+e.length+'B string *)"')):d.push(i(JSON.stringify(e.toString()))));if("number"==typeof e)return void d.push(i(Math.round(e)||0));if(o=e.type,l&&e.sensitive)return void d.push(i('"(* value hidden *)"'));switch(e.type.toUpperCase()){case"LITERAL":if(l)d.push(i('"(* '+e.value.length+'B literal *)"'));else{let t=e.value?Math.max(e.value.length,0):0,s=!a||h||u&&t<=4096;d.push(i(`${e.isLiteral8?"~":""}{${t}${s&&(u||h)?"+":""}}\r
`)),s?e.value&&e.value.length&&d.push(i(e.value)):(c.push(d),d=[].concat(i(e.value,!0)||[]))}break;case"STRING":l&&e.value.length>100?d.push(i('"(* '+e.value.length+'B string *)"')):d.push(i(JSON.stringify((e.value||"").toString())));break;case"TEXT":case"SEQUENCE":e.value&&d.push(i(e.value));break;case"NUMBER":d.push(i(e.value||0));break;case"ATOM":case"SECTION":if(s=(e.value||"").toString(),(!e.section||s)&&((""===e.value||r.verify("\\"===s.charAt(0)?s.substr(1):s,r["ATOM-CHAR"]())>=0)&&(s=JSON.stringify(s)),d.push(i(s))),e.section){for(let t of(d.push(i("[")),e.section))await p(t);d.push(i("]"))}e.partial&&d.push(i(`<${e.partial.join(".")}>`))}};if(e.attributes)for(let t of Array.isArray(e.attributes)?e.attributes:[].concat(e.attributes))await p(t);d.length&&c.push(d);for(let e=0;e<c.length;e++)c[e]=Buffer.concat(c[e]);return a?c:c.flatMap(e=>e)}},5743:(e,t,s)=>{"use strict";let r=s(27910).Transform;class i extends r{constructor(){super({readableObjectMode:!1,writableObjectMode:!0})}_transform(e,t,s){return Buffer.isBuffer(e)?this.push(e):"node"===e.type?this.push(e.getHeaders()):e.value&&this.push(e.value),s()}_flush(e){return e()}}e.exports=i},6241:(e,t,s)=>{"use strict";let{getStatusCode:r,getErrorText:i}=s(80876);async function o(e,t,s){let o,a,l;e.capabilities.has("AUTH=OAUTHBEARER")?(o=`n,a=${t},host=${e.servername}port=993auth=Bearer ${s}`,a="OAUTHBEARER",l="AQ=="):(e.capabilities.has("AUTH=XOAUTH")||e.capabilities.has("AUTH=XOAUTH2"))&&(o=`user=${t}auth=Bearer ${s}`,a="XOAUTH2",l="");let h=!1;try{return(await e.exec("AUTHENTICATE",[{type:"ATOM",value:a},{type:"ATOM",value:Buffer.from(o).toString("base64"),sensitive:!0}],{onPlusTag:async t=>{if(t.attributes&&t.attributes[0]&&"TEXT"===t.attributes[0].type)try{h=JSON.parse(Buffer.from(t.attributes[0].value,"base64").toString())}catch(s){e.log.debug({errorResponse:t.attributes[0].value,err:s})}e.log.debug({src:"c",msg:l,comment:`Error response for ${a}`}),e.write(l)}})).next(),e.authCapabilities.set(`AUTH=${a}`,!0),t}catch(t){let e=r(t.response);throw e&&(t.serverResponseCode=e),t.authenticationFailed=!0,t.response=await i(t.response),h&&(t.oauthError=h),t}}async function a(e,t,s){try{return(await e.exec("AUTHENTICATE",[{type:"ATOM",value:"LOGIN"}],{onPlusTag:async r=>{if(r.attributes&&r.attributes[0]&&"TEXT"===r.attributes[0].type){let i=Buffer.from(r.attributes[0].value,"base64").toString();switch(i.toLowerCase().replace(/[:\x00]*$/,"")){case"username":case"user name":{let s=Buffer.from(t).toString("base64");e.log.debug({src:"c",msg:s,comment:"Encoded username for AUTH=LOGIN"}),e.write(s);break}case"password":e.log.debug({src:"c",msg:"(* value hidden *)",comment:"Encoded password for AUTH=LOGIN"}),e.write(Buffer.from(s).toString("base64"));break;default:throw Error(`Unknown LOGIN question "${i}"`)}}}})).next(),e.authCapabilities.set("AUTH=LOGIN",!0),t}catch(t){let e=r(t.response);throw e&&(t.serverResponseCode=e),t.authenticationFailed=!0,t.response=await i(t.response),t}}async function l(e,t,s){try{return(await e.exec("AUTHENTICATE",[{type:"ATOM",value:"PLAIN"}],{onPlusTag:async()=>{let r=Buffer.from(["",t,s].join("\0")).toString("base64"),i=Buffer.from(["",t,"(* value hidden *)"].join("\0")).toString("base64");e.log.debug({src:"c",msg:i,comment:"Encoded response for AUTH=PLAIN"}),e.write(r)}})).next(),e.authCapabilities.set("AUTH=PLAIN",!0),t}catch(t){let e=r(t.response);throw e&&(t.serverResponseCode=e),t.authenticationFailed=!0,t.response=await i(t.response),t}}e.exports=async(e,t,{accessToken:s,password:r,loginMethod:i})=>{if(e.state===e.states.NOT_AUTHENTICATED){if(s&&(e.capabilities.has("AUTH=OAUTHBEARER")||e.capabilities.has("AUTH=XOAUTH")||e.capabilities.has("AUTH=XOAUTH2")))return await o(e,t,s);if(r){if(!i&&e.capabilities.has("AUTH=PLAIN")||"AUTH=PLAIN"===i)return await l(e,t,r);if(!i&&e.capabilities.has("AUTH=LOGIN")||"AUTH=LOGIN"===i)return await a(e,t,r)}throw Error("Unsupported authentication mechanism")}}},6524:e=>{"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,s,r){var i=r&&r.stringify||t;if("object"==typeof e&&null!==e){var o=s.length+1;if(1===o)return e;var a=Array(o);a[0]=i(e);for(var l=1;l<o;l++)a[l]=i(s[l]);return a.join(" ")}if("string"!=typeof e)return e;var h=s.length;if(0===h)return e;for(var u="",c=0,d=-1,p=e&&e.length||0,f=0;f<p;){if(37===e.charCodeAt(f)&&f+1<p){switch(d=d>-1?d:0,e.charCodeAt(f+1)){case 100:case 102:if(c>=h||null==s[c])break;d<f&&(u+=e.slice(d,f)),u+=Number(s[c]),d=f+2,f++;break;case 105:if(c>=h||null==s[c])break;d<f&&(u+=e.slice(d,f)),u+=Math.floor(Number(s[c])),d=f+2,f++;break;case 79:case 111:case 106:if(c>=h||void 0===s[c])break;d<f&&(u+=e.slice(d,f));var g=typeof s[c];if("string"===g){u+="'"+s[c]+"'",d=f+2,f++;break}if("function"===g){u+=s[c].name||"<anonymous>",d=f+2,f++;break}u+=i(s[c]),d=f+2,f++;break;case 115:if(c>=h)break;d<f&&(u+=e.slice(d,f)),u+=String(s[c]),d=f+2,f++;break;case 37:d<f&&(u+=e.slice(d,f)),u+="%",d=f+2,f++,c--}++c}++f}return -1===d?e:(d<p&&(u+=e.slice(d)),u)}},6696:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isCorrect=t.isInSubnet=void 0,t.isInSubnet=function(e){return!(this.subnetMask<e.subnetMask)&&this.mask(e.subnetMask)===e.mask()},t.isCorrect=function(e){return function(){return this.addressMinusSuffix===this.correctForm()&&(this.subnetMask===e&&!this.parsedSubnet||this.parsedSubnet===String(this.subnetMask))}}},7051:e=>{"use strict";e.exports={version:"9.6.0"}},8683:(e,t,s)=>{"use strict";let{getStatusCode:r,formatFlag:i,canUseFlag:o,getErrorText:a}=s(80876);e.exports=async(e,t,s,l)=>{let h;if(e.state!==e.states.SELECTED||!t||l.useLabels&&!e.capabilities.has("X-GM-EXT-1"))return!1;switch(h="FLAGS",(l=l||{}).useLabels?h="X-GM-LABELS":l.silent&&(h=`${h}.SILENT`),(l.operation||"").toLowerCase()){case"set":break;case"remove":h=`-${h}`;break;default:h=`+${h}`}if(!(s=(Array.isArray(s)?s:[].concat(s||[])).map(t=>(t=i(t),(!!o(e.mailbox,t)||"remove"===h)&&t)).filter(e=>e)).length&&"set"!==l.operation)return!1;let u=[{type:"SEQUENCE",value:t},{type:"ATOM",value:h},s.map(e=>({type:"ATOM",value:e}))];l.unchangedSince&&e.enabled.has("CONDSTORE")&&!e.mailbox.noModseq&&u.push([{type:"ATOM",value:"UNCHANGEDSINCE"},{type:"ATOM",value:l.unchangedSince.toString()}]);try{return(await e.exec(l.uid?"UID STORE":"STORE",u)).next(),!0}catch(s){let t=r(s.response);return t&&(s.serverResponseCode=t),s.response=await a(s.response),e.log.warn({err:s,cid:e.id}),!1}}},9277:(e,t,s)=>{"use strict";let r=s(85389),{TokenParser:i}=s(93941);class o{constructor(e,t){this.input=(e||"").toString(),this.options=t||{},this.remainder=this.input,this.pos=0}async getTag(){return this.tag||(this.tag=await this.getElement(r.tag()+"*+",!0)),this.tag}async getCommand(){if("+"===this.tag)return this.humanReadable=this.remainder.trim(),this.remainder="","";switch(!this.command&&(this.command=await this.getElement(r.command())),(this.command||"").toString().toUpperCase()){case"OK":case"NO":case"BAD":case"PREAUTH":case"BYE":{let e=this.remainder.match(/^\s+\[/);if(e){let t=1;for(let s=e[0].length;s<=this.remainder.length;s++){let e=this.remainder[s];if("["===e?t++:"]"===e&&t--,!t){this.humanReadable=this.remainder.substring(s+1).trim(),this.remainder=this.remainder.substring(0,s+1);break}}}else this.humanReadable=this.remainder.trim(),this.remainder=""}}return this.command}async getElement(e){let t,s,i;if(this.remainder.match(/^\s/)){let e=Error(`Unexpected whitespace at position ${this.pos} [E1]`);throw e.code="ParserError1",e.parserContext={input:this.input,pos:this.pos},e}if(t=this.remainder.match(/^\s*[^\s]+(?=\s|$)/)){if(s=t[0],(i=r.verify(s,e))>=0){if("Server"===this.tag&&"Unavailable."===s){let e=Error(`Server returned an error: ${this.input}`);throw e.code="ParserErrorExchange",e.parserContext={input:this.input,element:s,pos:this.pos,value:{tag:"*",command:"BAD",attributes:[{type:"TEXT",value:this.input}]}},e}let e=Error(`Unexpected char at position ${this.pos+i} [E2: ${JSON.stringify(s.charAt(i))}]`);throw e.code="ParserError2",e.parserContext={input:this.input,element:s,pos:this.pos},e}}else{let e=Error(`Unexpected end of input at position ${this.pos} [E3]`);throw e.code="ParserError3",e.parserContext={input:this.input,pos:this.pos},e}return this.pos+=t[0].length,this.remainder=this.remainder.substr(t[0].length),s}async getSpace(){if(!this.remainder.length){if("+"===this.tag&&1===this.pos)return;let e=Error(`Unexpected end of input at position ${this.pos} [E4]`);throw e.code="ParserError4",e.parserContext={input:this.input,pos:this.pos},e}if(r.verify(this.remainder.charAt(0),r.SP())>=0){let e=Error(`Unexpected char at position ${this.pos} [E5: ${JSON.stringify(this.remainder.charAt(0))}]`);throw e.code="ParserError5",e.parserContext={input:this.input,element:this.remainder,pos:this.pos},e}this.pos++,this.remainder=this.remainder.substr(1)}async getAttributes(){if(!this.remainder.length){let e=Error(`Unexpected end of input at position ${this.pos} [E6]`);throw e.code="ParserError6",e.parserContext={input:this.input,pos:this.pos},e}if(this.remainder.match(/^\s/)){let e=Error(`Unexpected whitespace at position ${this.pos} [E7]`);throw e.code="ParserError7",e.parserContext={input:this.input,element:this.remainder,pos:this.pos},e}let e=new i(this,this.pos,this.remainder,this.options);return await e.getAttributes()}}e.exports.ParserInstance=o},10010:e=>{"use strict";e.exports={wait:function(e,t,s,r,i){let o=Date.now()+r,a=Atomics.load(e,t);if(a===s)return void i(null,"ok");let l=a,h=r=>{Date.now()>o?i(null,"timed-out"):setTimeout(()=>{l=a,(a=Atomics.load(e,t))===l?h(r>=1e3?1e3:2*r):a===s?i(null,"ok"):i(null,"not-equal")},r)};h(1)},waitDiff:function(e,t,s,r,i){let o=Date.now()+r,a=Atomics.load(e,t);if(a!==s)return void i(null,"ok");let l=r=>{Date.now()>o?i(null,"timed-out"):setTimeout(()=>{(a=Atomics.load(e,t))!==s?i(null,"ok"):l(r>=1e3?1e3:2*r)},r)};l(1)}}},10518:(e,t,s)=>{"use strict";let r=s(30208);e.exports=function({secret:e,serialize:t,wcLen:s,strict:i,isCensorFct:o,censorFctTakesPath:a},l){var h,u,c,d,p,f,g,m;let y=Function("o",`
if (typeof o !== 'object' || o == null) {
${(h=i,u=t,!0===h?"throw Error('fast-redact: primitives cannot be redacted')":!1===u?"return o":"return this.serialize(o)")}
}
const { censor, secret } = this
const originalSecret = {}
const secretKeys = Object.keys(secret)
for (var i = 0; i < secretKeys.length; i++) {
originalSecret[secretKeys[i]] = secret[secretKeys[i]]
}
${(c=e,d=o,p=a,Object.keys(c).map(e=>{let{escPath:t,leadingBracket:s,path:i}=c[e],o=+!!s,a=s?"":".",l=[];for(;null!==(h=r.exec(e));){let[,e]=h,{index:t,input:s}=h;t>o&&l.push(s.substring(0,t-!e))}var h,u=l.map(e=>`o${a}${e}`).join(" && ");0===u.length?u+=`o${a}${e} != null`:u+=` && o${a}${e} != null`;let f=`
switch (true) {
${l.reverse().map(e=>`
case o${a}${e} === censor:
secret[${t}].circle = ${JSON.stringify(e)}
break
`).join("\n")}
}
`,g=p?`val, ${JSON.stringify(i)}`:"val";return`
if (${u}) {
const val = o${a}${e}
if (val === censor) {
secret[${t}].precensored = true
} else {
secret[${t}].val = val
o${a}${e} = ${d?`censor(${g})`:"censor"}
${f}
}
}
`}).join("\n"))}
this.compileRestore()
${(f=s>0,g=o,m=a,!0===f?`
{
const { wildcards, wcLen, groupRedact, nestedRedact } = this
for (var i = 0; i < wcLen; i++) {
const { before, beforeStr, after, nested } = wildcards[i]
if (nested === true) {
secret[beforeStr] = secret[beforeStr] || []
nestedRedact(secret[beforeStr], o, before, after, censor, ${g}, ${m})
} else secret[beforeStr] = groupRedact(o, before, censor, ${g}, ${m})
}
}
`:"")}
this.secret = originalSecret
${!1===t?"return o":`
var s = this.serialize(o)
this.restore(o)
return s
`}
`).bind(l);return y.state=l,!1===t&&(y.restore=e=>l.restore(e)),y}},10941:(e,t,s)=>{"use strict";let r=s(85389),{ParserInstance:i}=s(9277);e.exports=async(e,t)=>{t=t||{};let s=0;if(0===e[0]){for(let t=0;t<e.length;t++)if(0!==e[t]){e=e.slice(t),s=t;break}}let o=new i(e,t),a={};try{a.tag=await o.getTag(),await o.getSpace(),a.command=await o.getCommand(),s&&(a.nullBytesRemoved=s),["UID","AUTHENTICATE"].indexOf((a.command||"").toUpperCase())>=0&&(await o.getSpace(),a.command+=" "+await o.getElement(r.command())),o.remainder.trim().length&&(await o.getSpace(),a.attributes=await o.getAttributes()),o.humanReadable&&(a.attributes=(a.attributes||[]).concat({type:"TEXT",value:o.humanReadable}))}catch(e){if("ParserErrorExchange"===e.code&&e.parserContext&&e.parserContext.value)return e.parserContext.value;throw e}return a}},11512:(e,t,s)=>{"use strict";let{Transform:r}=s(27910),i=s(50002);class o extends r{constructor(e){super(),this.charset=e,this.chunks=[],this.chunklen=0}_transform(e,t,s){"string"==typeof e&&(e=Buffer.from(e,t)),this.chunks.push(e),this.chunklen+=e.length,s()}_flush(e){let t=Buffer.concat(this.chunks,this.chunklen);try{let e=i.convert(t,{to:"UNICODE",from:this.charset,type:"string"});"string"==typeof e&&(e=Buffer.from(e)),this.push(e)}catch(e){this.push(t)}e()}}e.exports.JPDecoder=o},11990:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AddressError=void 0;class s extends Error{constructor(e,t){super(e),this.name="AddressError",null!==t&&(this.parseMessage=t)}}t.AddressError=s},12461:(e,t,s)=>{"use strict";let r=s(34631),i=s(91645),o=s(55511),{EventEmitter:a}=s(94735),l=s(24323),h=s(48376),u=s(74075),{Headers:c}=s(49504),{LimitedPassthrough:d}=s(64866),{ImapStream:p}=s(96226),{parser:f,compiler:g}=s(72136),m=s(40509),y=s(31064),b=s(86096),S=s(58118),{PassThrough:E}=s(27910),{proxyConnection:v}=s(35216),{comparePaths:w,updateCapabilities:T,getFolderTree:I,formatMessageResponse:k,getDecoder:C,packMessageRange:A,normalizePath:N,expandRange:O,AuthenticationFailure:B,getColorFlags:_}=s(80876),x=s(73663),R={NOT_AUTHENTICATED:1,AUTHENTICATED:2,SELECTED:3,LOGOUT:4};class L extends a{static version=m.version;constructor(e){super({captureRejections:!0}),this.options=e||{},this.id=this.options.id||this.getRandomId(),this.clientInfo=Object.assign({name:m.name,version:m.version,vendor:"Postal Systems","support-url":"https://github.com/postalsys/imapflow/issues"},this.options.clientInfo||{}),this.serverInfo=null,this.log=this.getLogger(),this.secureConnection=!!this.options.secure,this.port=Number(this.options.port)||(this.secureConnection?993:110),this.host=this.options.host||"localhost",this.servername=this.options.servername?this.options.servername:!i.isIP(this.host)&&this.host,void 0===this.options.secure&&993===this.port&&(this.secureConnection=!0),this.logRaw=this.options.logRaw,this.streamer=new p({logger:this.log,cid:this.id,logRaw:this.logRaw,secureConnection:this.secureConnection}),this.reading=!1,this.socket=!1,this.writeSocket=!1,this.states=R,this.state=this.states.NOT_AUTHENTICATED,this.lockCounter=0,this.currentLock=!1,this.tagCounter=0,this.requestTagMap=new Map,this.requestQueue=[],this.currentRequest=!1,this.writeBytesCounter=0,this.commandParts=[],this.capabilities=new Map,this.authCapabilities=new Map,this.rawCapabilities=null,this.expectCapabilityUpdate=!1,this.enabled=new Set,this.usable=!1,this.authenticated=!1,this.mailbox=!1,this.currentSelectCommand=!1,this.idling=!1,this.emitLogs=!!this.options.emitLogs,this.lo=0,this.untaggedHandlers={},this.sectionHandlers={},this.commands=x,this.folders=new Map,this.currentLock=!1,this.locks=[],this.idRequested=!1,this.maxIdleTime=this.options.maxIdleTime||!1,this.missingIdleCommand=(this.options.missingIdleCommand||"").toString().toUpperCase().trim()||"NOOP",this.disableBinary=!!this.options.disableBinary,this.streamer.on("error",e=>{if(["Z_BUF_ERROR","ECONNRESET","EPIPE","ETIMEDOUT","EHOSTUNREACH"].includes(e.code))return setImmediate(()=>this.close());this.log.error({err:e,cid:this.id}),setImmediate(()=>this.close()),this.emitError(e)}),this._connectCalled=!1}emitError(e){this.emit("error",e)}getRandomId(){let e=BigInt("0x"+o.randomBytes(13).toString("hex")).toString(36);return e.length<20?e="0".repeat(20-e.length)+e:e.length>20&&(e=e.substr(0,20)),e}write(e){if(this.socket.destroyed){let e=Error("Socket is already closed");throw e.code="NoConnection",e}if(this.state===this.states.LOGOUT){let e=Error("Can not send data after logged out");throw e.code="StateLogout",e}if(this.writeSocket.destroyed)return void this.socket.emit("error","Write socket destroyed");let t=!this.commandParts.length;if("string"==typeof e)t&&(e+="\r\n"),e=Buffer.from(e,"binary");else{if(!Buffer.isBuffer(e))return!1;t&&(e=Buffer.concat([e,Buffer.from("\r\n")]))}this.logRaw&&this.log.trace({src:"c",msg:"write to socket",data:e.toString("base64"),compress:!!this._deflate,secure:!!this.secureConnection,cid:this.id}),this.writeBytesCounter+=e.length,this.writeSocket.write(e)}stats(e){let t={sent:this.writeBytesCounter||0,received:this.streamer&&this.streamer.readBytesCounter||0};return e&&(this.writeBytesCounter=0,this.streamer&&(this.streamer.readBytesCounter=0)),t}async send(e){if(this.state===this.states.LOGOUT){if(e.tag){let t=this.requestTagMap.get(e.tag);if(t){this.requestTagMap.delete(t.tag);let e=Error("Connection not available");e.code="NoConnection",t.reject(e)}}return}let t=await g(e,{asArray:!0,literalMinus:this.capabilities.has("LITERAL-")||this.capabilities.has("LITERAL+")});this.commandParts=t;let s=await g(e,{isLogging:!0}),r=e.options||{};this.log.debug({src:"s",msg:s.toString(),cid:this.id,comment:r.comment}),this.write(this.commandParts.shift()),"function"==typeof r.onSend&&r.onSend()}async trySend(){!this.currentRequest&&this.requestQueue.length&&(this.currentRequest=this.requestQueue.shift(),await this.send({tag:this.currentRequest.tag,command:this.currentRequest.command,attributes:this.currentRequest.attributes,options:this.currentRequest.options}))}async exec(e,t,s){if(this.socket.destroyed){let e=Error("Connection closed");throw e.code="EConnectionClosed",e}let r=(++this.tagCounter).toString(16).toUpperCase();return s=s||{},new Promise((i,o)=>{this.requestTagMap.set(r,{command:e,attributes:t,options:s,resolve:i,reject:o}),this.requestQueue.push({tag:r,command:e,attributes:t,options:s}),this.trySend().catch(e=>{this.requestTagMap.delete(r),o(e)})})}getUntaggedHandler(e,t){if(/^[0-9]+$/.test(e)){let s=!!t&&!!t.length&&"string"==typeof t[0].value&&t[0].value.toUpperCase();s&&(e=s)}return(e=e.toUpperCase().trim(),this.currentRequest&&this.currentRequest.options&&this.currentRequest.options.untagged&&this.currentRequest.options.untagged[e])?this.currentRequest.options.untagged[e]:this.untaggedHandlers[e]?this.untaggedHandlers[e]:void 0}getSectionHandler(e){if(this.sectionHandlers[e])return this.sectionHandlers[e]}async reader(){let e;for(;null!==(e=this.streamer.read());){let t;try{if((t=await f(e.payload,{literals:e.literals})).tag&&!["*","+"].includes(t.tag)&&t.command){let e={response:t.command};t.attributes&&t.attributes[0]&&t.attributes[0].section&&t.attributes[0].section[0]&&"ATOM"===t.attributes[0].section[0].type&&(e.code=t.attributes[0].section[0].value),this.emit("response",e)}}catch(t){this.log.error({src:"s",msg:e.payload.toString(),err:t,cid:this.id}),e.next();continue}let s=await g(t,{isLogging:!0});if(/^\d+$/.test(t.command)&&t.attributes&&t.attributes[0]&&"FETCH"===t.attributes[0].value?this.log.trace({src:"s",msg:s.toString(),cid:this.id,nullBytesRemoved:t.nullBytesRemoved}):this.log.debug({src:"s",msg:s.toString(),cid:this.id,nullBytesRemoved:t.nullBytesRemoved}),"+"===t.tag&&this.currentRequest&&this.currentRequest.options&&"function"==typeof this.currentRequest.options.onPlusTag){await this.currentRequest.options.onPlusTag(t),e.next();continue}if("+"===t.tag&&this.commandParts.length){let t=this.commandParts.shift();this.write(t),this.log.debug({src:"c",msg:`(* ${t.length}B continuation *)`,cid:this.id}),e.next();continue}let r=t.attributes&&t.attributes.length&&t.attributes[0]&&!t.attributes[0].value&&t.attributes[0].section;if(r&&r.length&&"ATOM"===r[0].type&&"string"==typeof r[0].value){let e=this.getSectionHandler(r[0].value.toUpperCase().trim());e&&await e(r.slice(1))}if("*"===t.tag&&t.command){let s=this.getUntaggedHandler(t.command,t.attributes);if(s)try{await s(t)}catch(t){this.log.warn({err:t,cid:this.id}),e.next();continue}}if(this.requestTagMap.has(t.tag)){let e=this.requestTagMap.get(t.tag);switch(this.requestTagMap.delete(t.tag),this.currentRequest&&this.currentRequest.tag===t.tag&&(this.currentRequest=!1,await this.trySend()),t.command.toUpperCase()){case"OK":case"BYE":await new Promise(s=>e.resolve({response:t,next:s}));break;case"NO":case"BAD":{let s=t.attributes&&t.attributes.filter(e=>"TEXT"===e.type).map(e=>e.value.trim()).join(" "),r=Error("Command failed");r.response=t,r.responseStatus=t.command.toUpperCase();try{r.executedCommand=t.tag+(await g(e,{isLogging:!0})).toString()}catch(e){}if(s){if(r.responseText=s,"NO"===r.responseStatus&&s.includes("Some of the requested messages no longer exist")){this.log.warn({msg:"Partial FETCH response",cid:this.id,err:r}),await new Promise(s=>e.resolve({response:t,next:s}));break}let i=!1;if(/Request is throttled/i.test(s)&&/Backoff Time/i.test(s)){let e=s.match(/Backoff Time[:=\s]+(\d+)/i);e&&e[1]&&!isNaN(e[1])&&(i=Number(e[1]))}if(i){r.code="ETHROTTLE",r.throttleReset=i;let e=i;e>3e5&&(e=3e5),this.log.warn({msg:"Throttling detected",cid:this.id,throttleDelay:i,delayResponse:e,err:r}),await new Promise(t=>setTimeout(t,e))}}e.reject(r);break}default:{let s=Error("Invalid server response");s.code="InvalidResponse",s.response=t,e.reject(s)}}}e.next()}}setEventHandlers(){this.socketReadable=()=>{this.reading||(this.reading=!0,this.reader().catch(e=>this.log.error({err:e,cid:this.id})).finally(()=>{this.reading=!1}))},this.streamer.on("readable",this.socketReadable)}setSocketHandlers(){this._socketError=this._socketError||(e=>{this.log.error({err:e,cid:this.id}),setImmediate(()=>this.close()),this.emitError(e)}),this._socketClose=this._socketClose||(()=>{this.close()}),this._socketEnd=this._socketEnd||(()=>{this.close()}),this._socketTimeout=this._socketTimeout||(()=>{this.idling?this.run("NOOP").then(()=>this.idle()).catch(this._socketError):(this.log.debug({msg:"Socket timeout",cid:this.id}),this.close())}),this.socket.on("error",this._socketError),this.socket.on("close",this._socketClose),this.socket.on("end",this._socketEnd),this.socket.on("tlsClientError",this._socketError),this.socket.on("timeout",this._socketTimeout),this.writeSocket.on("error",this._socketError)}clearSocketHandlers(){this._socketError&&(this.socket.removeListener("error",this._socketError),this.socket.removeListener("tlsClientError",this._socketError)),this._socketClose&&this.socket.removeListener("close",this._socketClose),this._socketEnd&&this.socket.removeListener("end",this._socketEnd)}async startSession(){await this.run("CAPABILITY"),this.capabilities.has("ID")&&(this.idRequested=await this.run("ID",this.clientInfo)),await this.upgradeToSTARTTLS(),await this.authenticate(),!this.idRequested&&this.capabilities.has("ID")&&(this.idRequested=await this.run("ID",this.clientInfo));let e=await this.run("NAMESPACE");if(e&&e.error&&"BAD"===e.status&&/User is authenticated but not connected/i.test(e.text)){this.authenticated=!1;let t=new B("Authentication failed");throw t.response=e.text,t}if(this.options.verifyOnly)return this.options.includeMailboxes&&(this._mailboxList=await this.list()),await this.logout();this.options.disableCompression||await this.compress(),this.options.disableAutoEnable||await this.run("ENABLE",["CONDSTORE","UTF8=ACCEPT"].concat(this.options.qresync?"QRESYNC":[])),this.usable=!0}async compress(){if(!await this.run("COMPRESS"))return;this._deflate=u.createDeflateRaw({windowBits:15}),this._inflate=u.createInflateRaw(),this.socket.unpipe(this.streamer),this.streamer.compress=!0,this.socket.pipe(this._inflate).pipe(this.streamer),this._inflate.on("error",e=>{this.streamer.emit("error",e)}),this.writeSocket=new E,this.writeSocket.destroySoon=()=>{try{this.socket&&this.socket.destroy(),this.writeSocket.end()}catch(e){throw this.log.error({err:e,info:"Failed to destroy PassThrough socket",cid:this.id}),e}},Object.defineProperty(this.writeSocket,"destroyed",{get:()=>this.socket.destroyed});let e=!1,t=()=>{let s;for(e=!0;null!==(s=this.writeSocket.read());)if(this._deflate&&!1===this._deflate.write(s))return this._deflate.once("drain",t);this._deflate&&this._deflate.flush(),e=!1};this.writeSocket.on("readable",()=>{e||t()}),this.writeSocket.on("error",e=>{this.socket.emit("error",e)}),this._deflate.pipe(this.socket),this._deflate.on("error",e=>{this.socket.emit("error",e)})}_failSTARTTLS(){if(!0!==this.options.doSTARTTLS)return!1;{let e=Error("Server does not support STARTTLS");throw e.tlsFailed=!0,e}}async upgradeToSTARTTLS(){if(!0===this.options.doSTARTTLS&&!0===this.options.secure)throw Error("Misconfiguration: Cannot set both secure=true for TLS and doSTARTTLS=true for STARTTLS.");if(this.secureConnection)return!0;if(!1===this.options.doSTARTTLS)return!1;if(!this.capabilities.has("STARTTLS")||(this.expectCapabilityUpdate=!0,!await this.run("STARTTLS")))return this._failSTARTTLS();this.socket.unpipe(this.streamer);let e=await new Promise((e,t)=>{let s=this.socket,i=Object.assign({socket:this.socket,servername:this.servername,port:this.port},this.options.tls||{});this.clearSocketHandlers(),s.once("error",e=>{clearTimeout(this.connectTimeout),clearTimeout(this.upgradeTimeout),this.upgrading&&(setImmediate(()=>this.close()),this.upgrading=!1,e.tlsFailed=!0,t(e))}),this.upgradeTimeout=setTimeout(()=>{if(!this.upgrading)return;setImmediate(()=>this.close());let e=Error("Failed to upgrade connection in required time");e.tlsFailed=!0,e.code="UPGRADE_TIMEOUT",t(e)},1e4),this.upgrading=!0,this.socket=r.connect(i,()=>(clearTimeout(this.upgradeTimeout),this.isClosed)?this.close():(this.secureConnection=!0,this.upgrading=!1,this.streamer.secureConnection=!0,this.socket.pipe(this.streamer),this.tls="function"==typeof this.socket.getCipher&&this.socket.getCipher(),this.tls&&(this.tls.authorized=this.socket.authorized,this.log.info({src:"tls",msg:"Established TLS session",cid:this.id,authorized:this.tls.authorized,algo:this.tls.standardName||this.tls.name,version:this.tls.version})),e(!0))),this.writeSocket=this.socket,this.setSocketHandlers()});return e&&this.expectCapabilityUpdate&&await this.run("CAPABILITY"),e}async setAuthenticationState(){this.state=this.states.AUTHENTICATED,this.authenticated=!0,this.expectCapabilityUpdate&&await this.run("CAPABILITY")}async authenticate(){if(this.state===this.states.LOGOUT)throw new B("Already logged out");if(this.state!==this.states.NOT_AUTHENTICATED)return!0;if(!this.options.auth)throw new B("Please configure the login");this.expectCapabilityUpdate=!0;let e=(this.options.auth.loginMethod||"").toString().trim().toUpperCase();if(!e&&/\\|\//.test(this.options.auth.user)&&(e="LOGIN"),this.options.auth.accessToken)this.authenticated=await this.run("AUTHENTICATE",this.options.auth.user,{accessToken:this.options.auth.accessToken});else if(this.options.auth.pass)if((this.capabilities.has("AUTH=LOGIN")||this.capabilities.has("AUTH=PLAIN"))&&"LOGIN"!==e)this.authenticated=await this.run("AUTHENTICATE",this.options.auth.user,{password:this.options.auth.pass,loginMethod:e});else{if(this.capabilities.has("LOGINDISABLED"))throw new B("Login is disabled");this.authenticated=await this.run("LOGIN",this.options.auth.user,this.options.auth.pass)}else throw new B("No password configured");if(this.authenticated)return this.log.info({src:"auth",msg:"User authenticated",cid:this.id,user:this.options.auth.user}),await this.setAuthenticationState(),!0;throw new B("No matching authentication method")}async initialOK(e){this.greeting=(e.attributes||[]).filter(e=>"TEXT"===e.type).map(e=>e.value).filter(e=>e).join(""),clearTimeout(this.greetingTimeout),this.untaggedHandlers.OK=null,this.untaggedHandlers.PREAUTH=null,this.isClosed||this.startSession().then(()=>{if("function"==typeof this.initialResolve){let e=this.initialResolve;return this.initialResolve=!1,this.initialReject=!1,e()}}).catch(e=>{if(this.log.error({err:e,cid:this.id}),"function"==typeof this.initialReject){clearTimeout(this.greetingTimeout);let t=this.initialReject;return this.initialResolve=!1,this.initialReject=!1,t(e)}setImmediate(()=>this.close())})}async initialPREAUTH(){clearTimeout(this.greetingTimeout),this.untaggedHandlers.OK=null,this.untaggedHandlers.PREAUTH=null,this.isClosed||(this.state=this.states.AUTHENTICATED,this.startSession().then(()=>{if("function"==typeof this.initialResolve){let e=this.initialResolve;return this.initialResolve=!1,this.initialReject=!1,e()}}).catch(e=>{if(this.log.error({err:e,cid:this.id}),"function"==typeof this.initialReject){clearTimeout(this.greetingTimeout);let t=this.initialReject;return this.initialResolve=!1,this.initialReject=!1,t(e)}setImmediate(()=>this.close())}))}async serverBye(){this.untaggedHandlers.BYE=null,this.state=this.states.LOGOUT}async sectionCapability(e){if(this.rawCapabilities=e,this.capabilities=T(e),this.capabilities)for(let[e]of this.capabilities)/^AUTH=/i.test(e)&&!this.authCapabilities.has(e.toUpperCase())&&this.authCapabilities.set(e.toUpperCase(),!1);this.expectCapabilityUpdate&&(this.expectCapabilityUpdate=!1)}async untaggedCapability(e){if(this.rawCapabilities=e.attributes,this.capabilities=T(e.attributes),this.capabilities)for(let[e]of this.capabilities)/^AUTH=/i.test(e)&&!this.authCapabilities.has(e.toUpperCase())&&this.authCapabilities.set(e.toUpperCase(),!1);this.expectCapabilityUpdate&&(this.expectCapabilityUpdate=!1)}async untaggedExists(e){if(!this.mailbox||!e||!e.command||isNaN(e.command))return;let t=Number(e.command);if(t===this.mailbox.exists)return;let s=this.mailbox.exists;this.mailbox.exists=t,this.emit("exists",{path:this.mailbox.path,count:t,prevCount:s})}async untaggedExpunge(e){if(!this.mailbox||!e||!e.command||isNaN(e.command))return;let t=Number(e.command);if(t&&t<=this.mailbox.exists){this.mailbox.exists--;let e={path:this.mailbox.path,seq:t,vanished:!1};if("function"==typeof this.options.expungeHandler)try{await this.options.expungeHandler(e)}catch(t){this.log.error({msg:"Failed to notify expunge event",payload:e,error:t,cid:this.id})}else this.emit("expunge",e)}}async untaggedVanished(e,t){if(!(t=t||this.mailbox))return;let s=[],r=!1;for(let i of(e.attributes.length>1&&Array.isArray(e.attributes[0])&&(s=e.attributes[0].map(e=>"string"==typeof e.value&&e.value.toUpperCase()).filter(e=>e),e.attributes.shift()),e.attributes[0]&&"string"==typeof e.attributes[0].value&&(r=e.attributes[0].value),O(r))){let e={path:t.path,uid:i,vanished:!0,earlier:s.includes("EARLIER")};if("function"==typeof this.options.expungeHandler)try{await this.options.expungeHandler(e)}catch(t){this.log.error({msg:"Failed to notify expunge event",payload:e,error:t,cid:this.id})}else this.emit("expunge",e)}}async untaggedFetch(e,t){if(!(t=t||this.mailbox))return;let s=await k(e,t);if(s.flags){let e={path:t.path,seq:s.seq};s.uid&&(e.uid=s.uid),s.modseq&&(e.modseq=s.modseq),e.flags=s.flags,s.flagColor&&(e.flagColor=s.flagColor),this.emit("flags",e)}}async ensureSelectedMailbox(e){return!!e&&((!!this.mailbox||!e)&&(!this.mailbox||!e||!!w(this,this.mailbox.path,e))||await this.mailboxOpen(e))}async resolveRange(e,t){if(("number"==typeof e||"bigint"==typeof e)&&(e=e.toString()),"*"===e){if(!this.mailbox.exists)return!1;e=this.mailbox.exists.toString(),t.uid=!1}return e&&"object"==typeof e&&!Array.isArray(e)&&(e.all&&1===Object.keys(e).length?e="1:*":e.uid&&1===Object.keys(e).length?(e=e.uid,t.uid=!0):(t.uid=!0,(e=await this.run("SEARCH",e,t))&&e.length&&(e=A(e)))),Array.isArray(e)&&(e=e.join(",")),!!e&&e}autoidle(){clearTimeout(this.idleStartTimer),this.options.disableAutoIdle||this.state!==this.states.SELECTED||(this.idleStartTimer=setTimeout(()=>{this.idle().catch(e=>this.log.warn({err:e,cid:this.id}))},15e3))}async connect(){if(this._connectCalled)throw Error("Can not re-use ImapFlow instance");this._connectCalled=!0;let e=this.secureConnection?r:i,t=Object.assign({host:this.host,servername:this.servername,port:this.port},this.options.tls||{});this.untaggedHandlers.OK=(...e)=>this.initialOK(...e),this.untaggedHandlers.BYE=(...e)=>this.serverBye(...e),this.untaggedHandlers.PREAUTH=(...e)=>this.initialPREAUTH(...e),this.untaggedHandlers.CAPABILITY=(...e)=>this.untaggedCapability(...e),this.sectionHandlers.CAPABILITY=(...e)=>this.sectionCapability(...e),this.untaggedHandlers.EXISTS=(...e)=>this.untaggedExists(...e),this.untaggedHandlers.EXPUNGE=(...e)=>this.untaggedExpunge(...e),this.untaggedHandlers.FETCH=e=>this.untaggedFetch(e),this.untaggedHandlers.VANISHED=e=>this.untaggedVanished(e);let s=!1;if(this.options.proxy)try{if(!(s=await v(this.log,this.options.proxy,this.host,this.port)))throw Error("Failed to setup proxy connection")}catch(t){let e=Error("Failed to setup proxy connection");throw e.code=t.code||"ProxyError",e._err=t,this.log.error({error:e,cid:this.id}),e}await new Promise((r,i)=>{this.connectTimeout=setTimeout(()=>{let e=Error("Failed to establish connection in required time");e.code="CONNECT_TIMEOUT",e.details={connectionTimeout:this.options.connectionTimeout||9e4},this.log.error({err:e,cid:this.id}),setImmediate(()=>this.close()),i(e)},this.options.connectionTimeout||9e4);let o=()=>{clearTimeout(this.connectTimeout),this.socket.setKeepAlive(!0,5e3),this.socket.setTimeout(this.options.socketTimeout||3e5),this.greetingTimeout=setTimeout(()=>{let e=Error(`Failed to receive greeting from server in required time${!this.secureConnection?". Maybe should use TLS?":""}`);e.code="GREETING_TIMEOUT",e.details={greetingTimeout:this.options.greetingTimeout||16e3},this.log.error({err:e,cid:this.id}),setImmediate(()=>this.close()),i(e)},this.options.greetingTimeout||16e3),this.tls="function"==typeof this.socket.getCipher&&this.socket.getCipher();let e={src:"connection",msg:`Established ${this.tls?"secure ":""}TCP connection`,cid:this.id,secure:!!this.tls,host:this.host,servername:this.servername,port:this.socket.remotePort,address:this.socket.remoteAddress,localAddress:this.socket.localAddress,localPort:this.socket.localPort};this.tls&&(e.authorized=this.tls.authorized=this.socket.authorized,e.algo=this.tls.standardName||this.tls.name,e.version=this.tls.version),this.log.info(e),this.setSocketHandlers(),this.socket.pipe(this.streamer),this.initialResolve=r,this.initialReject=i};s?this.secureConnection?(t.socket=s,this.socket=e.connect(t,o)):(this.socket=s,setImmediate(o)):this.socket=e.connect(t,o),this.writeSocket=this.socket,this.socket.on("error",e=>{clearTimeout(this.connectTimeout),clearTimeout(this.greetingTimeout),setImmediate(()=>this.close()),this.log.error({err:e,cid:this.id}),i(e)}),this.setEventHandlers()})}async logout(){return await this.run("LOGOUT")}close(){if(clearTimeout(this.idleStartTimer),clearTimeout(this.upgradeTimeout),clearTimeout(this.connectTimeout),this.usable=!1,this.idling=!1,"function"==typeof this.initialReject&&!this.options.verifyOnly){clearTimeout(this.greetingTimeout);let e=this.initialReject;this.initialResolve=!1,this.initialReject=!1;let t=Error("Unexpected close");t.code=`ClosedAfterConnect${this.secureConnection?"TLS":"Text"}`,setImmediate(()=>e(t))}if("function"==typeof this.preCheck&&this.preCheck().catch(e=>this.log.warn({err:e,cid:this.id})),this.currentRequest&&this.requestTagMap.has(this.currentRequest.tag)){let e=this.requestTagMap.get(this.currentRequest.tag);if(e){this.requestTagMap.delete(e.tag);let t=Error("Connection not available");t.code="NoConnection",e.reject(t)}this.currentRequest=!1}for(;this.requestQueue.length;){let e=this.requestQueue.shift();if(e&&this.requestTagMap.has(e.tag)){let t=this.requestTagMap.get(e.tag);if(t){this.requestTagMap.delete(t.tag);let e=Error("Connection not available");e.code="NoConnection",t.reject(e)}}}if(this.state=this.states.LOGOUT,!this.isClosed){if(this.isClosed=!0,this.writeSocket&&!this.writeSocket.destroyed)try{this.writeSocket.destroy()}catch(e){this.log.error({err:e,cid:this.id})}if(this.socket&&!this.socket.destroyed&&this.writeSocket!==this.socket)try{this.socket.destroy()}catch(e){this.log.error({err:e,cid:this.id})}this.log.trace({msg:"Connection closed",cid:this.id}),this.emit("close")}}async getQuota(e){return e=e||"INBOX",await this.run("QUOTA",e)}async list(e){e=e||{};let t=await this.run("LIST","","*",e);return this.folders=new Map(t.map(e=>[e.path,e])),t}async listTree(e){e=e||{};let t=await this.run("LIST","","*",e);return this.folders=new Map(t.map(e=>[e.path,e])),I(t)}async noop(){await this.run("NOOP")}async mailboxCreate(e){return await this.run("CREATE",e)}async mailboxRename(e,t){return await this.run("RENAME",e,t)}async mailboxDelete(e){return await this.run("DELETE",e)}async mailboxSubscribe(e){return await this.run("SUBSCRIBE",e)}async mailboxUnsubscribe(e){return await this.run("UNSUBSCRIBE",e)}async mailboxOpen(e,t){return await this.run("SELECT",e,t)}async mailboxClose(){return await this.run("CLOSE")}async status(e,t){return await this.run("STATUS",e,t)}async idle(){if(!this.idling)return await this.run("IDLE",this.maxIdleTime)}async messageFlagsSet(e,t,s){if(s=s||{},!(e=await this.resolveRange(e,s)))return!1;let r=Object.assign({operation:"set"},s);return await this.run("STORE",e,t,r)}async messageFlagsAdd(e,t,s){if(s=s||{},!(e=await this.resolveRange(e,s)))return!1;let r=Object.assign({operation:"add"},s);return await this.run("STORE",e,t,r)}async messageFlagsRemove(e,t,s){if(s=s||{},!(e=await this.resolveRange(e,s)))return!1;let r=Object.assign({operation:"remove"},s);return await this.run("STORE",e,t,r)}async setFlagColor(e,t,s){let r,i;if(s=s||{},!(e=await this.resolveRange(e,s)))return!1;let o=_(t);if(!o)return!1;if(o.add&&o.add.length){let t=Object.assign({operation:"add"},s,{useLabels:!1,silent:o.remove&&o.remove.length});r=await this.run("STORE",e,o.add,t)}if(o.remove&&o.remove.length){let t=Object.assign({operation:"remove"},s,{useLabels:!1});i=await this.run("STORE",e,o.remove,t)}return r||i||!1}async messageDelete(e,t){return t=t||{},!!(e=await this.resolveRange(e,t))&&await this.run("EXPUNGE",e,t)}async append(e,t,s,r){let i=await this.run("APPEND",e,t,s,r);return!!i&&i}async messageCopy(e,t,s){return s=s||{},!!(e=await this.resolveRange(e,s))&&await this.run("COPY",e,t,s)}async messageMove(e,t,s){return s=s||{},!!(e=await this.resolveRange(e,s))&&await this.run("MOVE",e,t,s)}async search(e,t){if(!this.mailbox)return;let s=await this.run("SEARCH",e,t);return!!s&&s}async *fetch(e,t,s){let r;if(s=s||{},!this.mailbox)return;if(!(e=await this.resolveRange(e,s)))return!1;let i=!1,o=!1,a=[],l=()=>new Promise((e,t)=>{let s=()=>{if(a.length){let s=a.shift();return s.err?t(s.err):e(s.value)}if(i)return e(null);o=()=>{o=!1,s()}};s()});for(this.run("FETCH",e,t,{uid:!!s.uid,binary:s.binary,changedSince:s.changedSince,onUntaggedFetch:(e,t)=>{a.push({value:{response:e,next:t}}),"function"==typeof o&&o()}}).then(()=>{i=!0,"function"==typeof o&&o()}).catch(e=>{a.push({err:e}),"function"==typeof o&&o()});r=await l();){if(this.isClosed||this.socket.destroyed){let e=Error("Connection closed");throw e.code="EConnectionClosed",e}null!==r&&(yield r.response,r.next())}if(!i){let e=Error("FETCH did not finish");throw e.code="ENotFinished",e}}async fetchAll(e,t,s){let r=[];for await(let i of this.fetch(e,t,s))r.push(i);return r}async fetchOne(e,t,s){if(!this.mailbox)return;if("*"===e){if(!this.mailbox.exists)return!1;e=this.mailbox.exists.toString(),s=Object.assign({},s||{},{uid:!1})}let r=await this.run("FETCH",(e||"").toString(),t,s);return!!r&&!!r.list&&!!r.list.length&&r.list[0]}async download(e,t,s){let r,i;if(!this.mailbox)return{};s=Object.assign({chunkSize:65536,maxBytes:1/0},s||{});let o=!0,a=0,l=Number(s.chunkSize)||65536,u=Number(s.maxBytes)||1/0,p=!1;if("1"===t){let r=await this.fetchOne(e,{uid:!0,bodyStructure:!0},s);if(!r)return{response:!1,chunk:!1};!p&&r.uid&&(e=p=r.uid,s.uid=!0),r.bodyStructure.childNodes||(t="TEXT")}let f=async r=>{let i;r=r||{},t?(t=t.toString().toLowerCase().trim(),r.bodyParts||(r.bodyParts=[]),r.size&&(/^[\d.]+$/.test(t)?(i=t+".mime",r.bodyParts.push(i)):"text"===t&&(i="header",r.bodyParts.push(i))),r.bodyParts.push({key:t,start:a,maxLength:l})):r.source={start:a,maxLength:l};let h=await this.fetchOne(e,r,s);if(!h)return{response:!1,chunk:!1};!p&&h.uid&&(e=p=h.uid,s.uid=!0);let u=t?h.bodyParts&&h.bodyParts.get(t):h.source;if(!u)return{};a+=u.length,o=u.length>=l;let c={chunk:u};return r.size&&(c.response=h),r.bodyParts&&("header"===i?c.mime=h.headers:c.mime=h.bodyParts.get(i)),c},{response:g,chunk:m,mime:v}=await f({size:!0,uid:!0});if(!g||!m)return{};let w={expectedSize:g.size};if(t){if(v){let e=new c(v),t=h.parseHeaderValue(e.getFirst("Content-Type")),s=h.parseHeaderValue(e.getFirst("Content-Transfer-Encoding")),r=h.parseHeaderValue(e.getFirst("Content-Disposition"));if(t.value.toLowerCase().trim()&&(w.contentType=t.value.toLowerCase().trim()),t.params.charset&&(w.charset=t.params.charset.toLowerCase().trim()),s.value&&(w.encoding=s.value.replace(/\(.*\)/g,"").toLowerCase().trim()),r.value){w.disposition=r.value.toLowerCase().trim()||!1;try{w.disposition=h.decodeWords(w.disposition)}catch(e){}}t.params.format&&"flowed"===t.params.format.toLowerCase().trim()&&(w.flowed=!0,t.params.delsp&&"yes"===t.params.delsp.toLowerCase().trim()&&(w.delSp=!0));let i=r.params.filename||t.params.name||!1;if(i){try{i=h.decodeWords(i)}catch(e){}w.filename=i}}}else w.contentType="message/rfc822";switch(w.encoding){case"base64":i=r=new b.Decoder;break;case"quoted-printable":i=r=new y.Decoder;break;default:i=r=new E}let T=["text/html","text/plain","text/x-amp-html"].includes(w.contentType)||"1"===t&&!w.contentType;if((!w.disposition||"inline"===w.disposition)&&T){if(w.flowed){let e=new S({delSp:w.delSp});i.on("error",t=>{e.emit("error",t)}),i=i.pipe(e)}if(w.charset&&!["ascii","usascii","utf8"].includes(w.charset.toLowerCase().replace(/[^a-z0-9]+/g,"")))try{let e=C(w.charset);i.on("error",t=>{e.emit("error",t)}),i=i.pipe(e),w.charset="utf-8"}catch(e){}}let I=new d({maxBytes:u});i.on("error",e=>{I.emit("error",e)}),i=i.pipe(I);let k=e=>!!I.limited||r.write(e),A=async()=>{for(;o&&!I.limited;){let{chunk:e}=await f();if(!e)break;!1===k(e)&&await new Promise(e=>r.once("drain",e))}};return setImmediate(()=>{k(m),A().catch(e=>r.emit("error",e)).finally(()=>r.end())}),{meta:w,content:i}}async downloadMany(e,t,s){if(!this.mailbox)return{};s=Object.assign({chunkSize:65536,maxBytes:1/0},s||{});let r={bodyParts:[]};for(let e of t)r.bodyParts.push(e+".mime"),r.bodyParts.push(e);let i=await this.fetchOne(e,r,s);if(!i||!i.bodyParts)return{response:!1};let o={};for(let[e,t]of i.bodyParts){let s=e.split(".mime");if(1===s.length){let e=s[0];o[e]?o[e].content=t:o[e]={content:t}}else if(2===s.length){let e=s[0];o[e]||(o[e]={}),o[e].meta||(o[e].meta={});let r=new c(t),i=h.parseHeaderValue(r.getFirst("Content-Type")),a=h.parseHeaderValue(r.getFirst("Content-Transfer-Encoding")),l=h.parseHeaderValue(r.getFirst("Content-Disposition"));if(i.value.toLowerCase().trim()&&(o[e].meta.contentType=i.value.toLowerCase().trim()),i.params.charset&&(o[e].meta.charset=i.params.charset.toLowerCase().trim()),a.value&&(o[e].meta.encoding=a.value.replace(/\(.*\)/g,"").toLowerCase().trim()),l.value){o[e].meta.disposition=l.value.toLowerCase().trim()||!1;try{o[e].meta.disposition=h.decodeWords(o[e].meta.disposition)}catch(e){}}i.params.format&&"flowed"===i.params.format.toLowerCase().trim()&&(o[e].meta.flowed=!0,i.params.delsp&&"yes"===i.params.delsp.toLowerCase().trim()&&(o[e].meta.delSp=!0));let u=l.params.filename||i.params.name||!1;if(u){try{u=h.decodeWords(u)}catch(e){}o[e].meta.filename=u}}}for(let e of Object.keys(o))switch(o[e].meta.encoding){case"base64":o[e].content=o[e].content?b.decode(o[e].content.toString()):null;break;case"quoted-printable":o[e].content=o[e].content?y.decode(o[e].content.toString()):null}return o}async run(e,...t){if(e=e.toUpperCase(),!this.commands.has(e))return!1;if(this.socket.destroyed){let e=Error("Connection not available");throw e.code="NoConnection",e}clearTimeout(this.idleStartTimer),"function"==typeof this.preCheck&&await this.preCheck();let s=this.commands.get(e),r=await s(this,...t);return"IDLE"!==e&&this.autoidle(),r}async processLocks(e){if(!e&&this.processingLock)return void this.log.trace({msg:"Mailbox locking queued",path:this.mailbox&&this.mailbox.path,pending:this.locks.length,idling:this.idling,activeLock:this.currentLock?{lockId:this.currentLock.lockId,...this.currentLock.options?.description&&{description:this.currentLock.options?.description}}:null});if(!this.locks.length){this.processingLock=!1,this.log.trace({msg:"Mailbox locking queue processed",idling:this.idling});return}this.processingLock=!0;let t=()=>{this.currentLock&&(this.log.trace({msg:"Mailbox lock released",lockId:this.currentLock.lockId,path:this.mailbox&&this.mailbox.path,pending:this.locks.length,idling:this.idling}),this.currentLock=!1),this.processLocks(!0).catch(e=>this.log.error({err:e,cid:this.id}))},s=this.locks.shift(),{resolve:r,reject:i,path:o,options:a,lockId:l}=s;if(!this.usable||this.socket.destroyed){this.log.trace({msg:"Failed to acquire mailbox lock",path:o,lockId:l,idling:this.idling});let e=Error("Connection not available");return e.code="NoConnection",i(e),await this.processLocks(!0)}if(this.mailbox&&this.mailbox.path===o&&!!this.mailbox.readOnly==!!a.readOnly)return this.log.trace({msg:"Mailbox lock acquired [existing]",path:o,lockId:l,idling:this.idling,...a.description&&{description:a.description}}),this.currentLock=s,r({path:o,release:t});try{return await this.mailboxOpen(o,a),this.log.trace({msg:"Mailbox lock acquired [selected]",path:o,lockId:l,idling:this.idling,...a.description&&{description:a.description}}),this.currentLock=s,r({path:o,release:t})}catch(e){if("NO"===e.responseStatus)try{let t=await this.run("LIST","",o,{listOnly:!0});t&&t.length||(e.mailboxMissing=!0)}catch(e){this.log.trace({msg:"Failed to verify failed mailbox",path:o,err:e})}this.log.trace({msg:"Failed to acquire mailbox lock",path:o,lockId:l,idling:this.idling,...a.description&&{description:a.description},err:e}),i(e),await this.processLocks(!0)}}async getMailboxLock(e,t){t=t||{},e=N(this,e);let s=++this.lockCounter;return this.log.trace({msg:"Requesting lock",path:e,lockId:s,...t.description&&{description:t.description},activeLock:this.currentLock?{lockId:this.currentLock.lockId,...this.currentLock.options?.description&&{description:this.currentLock.options?.description}}:null}),await new Promise((r,i)=>{this.locks.push({resolve:r,reject:i,path:e,options:t,lockId:s}),this.processLocks().catch(e=>i(e))})}getLogger(){let e=this.options.logger&&"object"==typeof this.options.logger?this.options.logger:l.child({component:"imap-connection",cid:this.id}),t={};for(let s of["trace","debug","info","warn","error","fatal"])t[s]=(...t)=>{if(!1!==this.options.logger&&l&&("function"!=typeof e[s]?("fatal"===s||"error"===s)&&console.log(JSON.stringify(...t)):e[s](...t)),this.emitLogs&&t&&t[0]&&"object"==typeof t[0]){let e=Object.assign({level:s,t:Date.now(),cid:this.id,lo:++this.lo},t[0]);if(e.err&&"object"==typeof e.err){let t=e.err;e.err={stack:t.stack},Object.keys(t).forEach(s=>{e.err[s]=t[s]})}this.emit("log",e)}};return t}unbind(){return this.socket.unpipe(this.streamer),this._inflate&&this._inflate.unpipe(this.streamer),this.socket.removeListener("error",this._socketError),this.socket.removeListener("close",this._socketClose),this.socket.removeListener("end",this._socketEnd),this.socket.removeListener("tlsClientError",this._socketError),this.socket.removeListener("timeout",this._socketTimeout),{readSocket:this._inflate||this.socket,writeSocket:this.writeSocket||this.socket}}}e.exports._=L},13789:e=>{"use strict";e.exports=function(e){let{secret:t,censor:s,compileRestore:r,serialize:i,groupRedact:o,nestedRedact:a,wildcards:l,wcLen:h}=e,u=[{secret:t,censor:s,compileRestore:r}];return!1!==i&&u.push({serialize:i}),h>0&&u.push({groupRedact:o,nestedRedact:a,wildcards:l,wcLen:h}),Object.assign(...u)}},16374:(e,t,s)=>{"use strict";let{EventEmitter:r}=s(78474),{lsCacheSym:i,levelValSym:o,setLevelSym:a,getLevelSym:l,chindingsSym:h,parsedChindingsSym:u,mixinSym:c,asJsonSym:d,writeSym:p,mixinMergeStrategySym:f,timeSym:g,timeSliceIndexSym:m,streamSym:y,serializersSym:b,formattersSym:S,errorKeySym:E,messageKeySym:v,useOnlyCustomLevelsSym:w,needsMetadataGsym:T,redactFmtSym:I,stringifySym:k,formatOptsSym:C,stringifiersSym:A,msgPrefixSym:N,hooksSym:O}=s(69185),{getLevel:B,setLevel:_,isLevelEnabled:x,mappings:R,initialLsCache:L,genLsCache:U,assertNoLevelCollisions:D}=s(95821),{asChindings:M,asJson:P,buildFormatters:H,stringify:j}=s(98895),{version:F}=s(7051),$=s(36937),V={constructor:class{},child:function(e,t){if(!e)throw Error("missing bindings for child Pino");t=t||{};let s=this[b],r=this[S],i=Object.create(this);if(!0===t.hasOwnProperty("serializers")){for(let e in i[b]=Object.create(null),s)i[b][e]=s[e];let e=Object.getOwnPropertySymbols(s);for(var o=0;o<e.length;o++){let t=e[o];i[b][t]=s[t]}for(let e in t.serializers)i[b][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var l=0;l<r.length;l++){let e=r[l];i[b][e]=t.serializers[e]}}else i[b]=s;if(t.hasOwnProperty("formatters")){let{level:e,bindings:s,log:o}=t.formatters;i[S]=H(e||r.level,s||G,o||r.log)}else i[S]=H(r.level,G,r.log);if(!0===t.hasOwnProperty("customLevels")&&(D(this.levels,t.customLevels),i.levels=R(t.customLevels,i[w]),U(i)),"object"==typeof t.redact&&null!==t.redact||Array.isArray(t.redact)){i.redact=t.redact;let e=$(i.redact,j),s={stringify:e[I]};i[k]=j,i[A]=e,i[C]=s}"string"==typeof t.msgPrefix&&(i[N]=(this[N]||"")+t.msgPrefix),i[h]=M(i,e);let u=t.level||this.level;return i[a](u),this.onChild(i),i},bindings:function(){let e=this[h],t=JSON.parse(`{${e.substr(1)}}`);return delete t.pid,delete t.hostname,t},setBindings:function(e){let t=M(this,e);this[h]=t,delete this[u]},flush:function(e){if(null!=e&&"function"!=typeof e)throw Error("callback must be a function");let t=this[y];"function"==typeof t.flush?t.flush(e||z):e&&e()},isLevelEnabled:x,version:F,get level(){return this[l]()},set level(lvl){this[a](lvl)},get levelVal(){return this[o]},set levelVal(n){throw Error("levelVal is read-only")},[i]:L,[p]:function(e,t,s){let r,i=this[g](),o=this[c],a=this[E],l=this[v],h=this[f]||q,u=this[O].streamWrite;null==e?r={}:e instanceof Error?(r={[a]:e},void 0===t&&(t=e.message)):(r=e,void 0===t&&void 0===e[l]&&e[a]&&(t=e[a].message)),o&&(r=h(r,o(r,s,this)));let p=this[d](r,t,s,i),b=this[y];!0===b[T]&&(b.lastLevel=s,b.lastObj=r,b.lastMsg=t,b.lastTime=i.slice(this[m]),b.lastLogger=this),b.write(u?u(p):p)},[d]:P,[l]:B,[a]:_};Object.setPrototypeOf(V,r.prototype),e.exports=function(){return Object.create(V)};let G=e=>e;function q(e,t){return Object.assign(t,e)}function z(){}},17492:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i,getStatusCode:o,getErrorText:a}=s(80876);e.exports=async(e,t)=>{let s;if([e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)){t=i(e,t);try{let i={path:t},o=!!(s=await e.exec("CREATE",[{type:"ATOM",value:r(e,t)}])).response.attributes&&!!s.response.attributes[0]&&!!s.response.attributes[0].section&&!!s.response.attributes[0].section.length&&s.response.attributes[0].section;if(o){let e;o.forEach((t,s)=>{let r;if(s%2==0){e=!!t&&"string"==typeof t.value&&t.value;return}e&&("mailboxid"===e.toLowerCase()&&(e="mailboxId",r=!!Array.isArray(t)&&!!t[0]&&"string"==typeof t[0].value&&t[0].value),e&&r&&(i[e]=r))})}return i.created=!0,s.next(),await e.run("SUBSCRIBE",t),i}catch(r){let s=o(r.response);if(s&&(r.serverResponseCode=s),r.response=await a(r.response),"ALREADYEXISTS"===s)return{path:t,created:!1};throw s&&(r.serverResponseCode=s),e.log.warn({err:r,cid:e.id}),r}}}},17722:(e,t,s)=>{"use strict";let{groupRestore:r,nestedRestore:i}=s(46522);e.exports=function(){return function(){var e;if(this.restore){this.restore.state.secret=this.secret;return}let{secret:t,wcLen:s}=this,o=Object.keys(t),a=(e=t,o.map(t=>{let{circle:s,escPath:r,leadingBracket:i}=e[t],o=s?`o.${s} = secret[${r}].val`:`o${i?"":"."}${t} = secret[${r}].val`,a=`secret[${r}].val = undefined`;return`
if (secret[${r}].val !== undefined) {
try { ${o} } catch (e) {}
${a}
}
`}).join("")),l=s>0,h=l?{secret:t,groupRestore:r,nestedRestore:i}:{secret:t};this.restore=Function("o",function(e,t,s){let r=!0===s?`
const keys = Object.keys(secret)
const len = keys.length
for (var i = len - 1; i >= ${t.length}; i--) {
const k = keys[i]
const o = secret[k]
if (o) {
if (o.flat === true) this.groupRestore(o)
else this.nestedRestore(o)
secret[k] = null
}
}
`:"";return`
const secret = this.secret
${r}
${e}
return o
`}(a,o,l)).bind(h),this.restore.state=h}}},18421:(e,t,s)=>{var r;!function(){"use strict";var i={not_type:/[^T]/,not_primitive:/[^v]/,number:/[diefg]/,numeric_arg:/[bcdiefguxX]/,json:/[j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijostTuvxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[+-]/};function o(e){return function(e,t){var s,r,a,l,h,u,c,d,p,f=1,g=e.length,m="";for(r=0;r<g;r++)if("string"==typeof e[r])m+=e[r];else if("object"==typeof e[r]){if((l=e[r]).keys)for(a=0,s=t[f];a<l.keys.length;a++){if(void 0==s)throw Error(o('[sprintf] Cannot access property "%s" of undefined value "%s"',l.keys[a],l.keys[a-1]));s=s[l.keys[a]]}else s=l.param_no?t[l.param_no]:t[f++];if(i.not_type.test(l.type)&&i.not_primitive.test(l.type)&&s instanceof Function&&(s=s()),i.numeric_arg.test(l.type)&&"number"!=typeof s&&isNaN(s))throw TypeError(o("[sprintf] expecting number but found %T",s));switch(i.number.test(l.type)&&(d=s>=0),l.type){case"b":s=parseInt(s,10).toString(2);break;case"c":s=String.fromCharCode(parseInt(s,10));break;case"d":case"i":s=parseInt(s,10);break;case"j":s=JSON.stringify(s,null,l.width?parseInt(l.width):0);break;case"e":s=l.precision?parseFloat(s).toExponential(l.precision):parseFloat(s).toExponential();break;case"f":s=l.precision?parseFloat(s).toFixed(l.precision):parseFloat(s);break;case"g":s=l.precision?String(Number(s.toPrecision(l.precision))):parseFloat(s);break;case"o":s=(parseInt(s,10)>>>0).toString(8);break;case"s":s=String(s),s=l.precision?s.substring(0,l.precision):s;break;case"t":s=String(!!s),s=l.precision?s.substring(0,l.precision):s;break;case"T":s=Object.prototype.toString.call(s).slice(8,-1).toLowerCase(),s=l.precision?s.substring(0,l.precision):s;break;case"u":s=parseInt(s,10)>>>0;break;case"v":s=s.valueOf(),s=l.precision?s.substring(0,l.precision):s;break;case"x":s=(parseInt(s,10)>>>0).toString(16);break;case"X":s=(parseInt(s,10)>>>0).toString(16).toUpperCase()}i.json.test(l.type)?m+=s:(i.number.test(l.type)&&(!d||l.sign)?(p=d?"+":"-",s=s.toString().replace(i.sign,"")):p="",u=l.pad_char?"0"===l.pad_char?"0":l.pad_char.charAt(1):" ",c=l.width-(p+s).length,h=l.width&&c>0?u.repeat(c):"",m+=l.align?p+s+h:"0"===u?p+h+s:h+p+s)}return m}(function(e){if(l[e])return l[e];for(var t,s=e,r=[],o=0;s;){if(null!==(t=i.text.exec(s)))r.push(t[0]);else if(null!==(t=i.modulo.exec(s)))r.push("%");else if(null!==(t=i.placeholder.exec(s))){if(t[2]){o|=1;var a=[],h=t[2],u=[];if(null!==(u=i.key.exec(h)))for(a.push(u[1]);""!==(h=h.substring(u[0].length));)if(null!==(u=i.key_access.exec(h)))a.push(u[1]);else if(null!==(u=i.index_access.exec(h)))a.push(u[1]);else throw SyntaxError("[sprintf] failed to parse named argument key");else throw SyntaxError("[sprintf] failed to parse named argument key");t[2]=a}else o|=2;if(3===o)throw Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push({placeholder:t[0],param_no:t[1],keys:t[2],sign:t[3],pad_char:t[4],align:t[5],width:t[6],precision:t[7],type:t[8]})}else throw SyntaxError("[sprintf] unexpected placeholder");s=s.substring(t[0].length)}return l[e]=r}(e),arguments)}function a(e,t){return o.apply(null,[e].concat(t||[]))}var l=Object.create(null);t.sprintf=o,t.vsprintf=a,"undefined"!=typeof window&&(window.sprintf=o,window.vsprintf=a,void 0===(r=(function(){return{sprintf:o,vsprintf:a}}).call(t,s,t,e))||(e.exports=r))}()},18498:e=>{"use strict";async function t(e){let t,s=[];try{e.idling=!0;let r=!1,i=!1,o=!1,a=async()=>{if(r=!0,o&&!i)for(e.log.debug({src:"c",msg:"DONE",comment:"breaking IDLE",lockId:e.currentLock?.lockId,path:e.mailbox&&e.mailbox.path}),e.write("DONE"),i=!0,e.idling=!1,e.preCheck=!1;s.length;){let{resolve:e}=s.shift();e()}},l=()=>{let t=new Promise((e,t)=>{s.push({resolve:e,reject:t})});return e.log.trace({msg:"Requesting IDLE break",lockId:e.currentLock?.lockId,path:e.mailbox&&e.mailbox.path,queued:s.length,doneRequested:r,canEnd:o,doneSent:i}),a().catch(t=>e.log.warn({err:t,cid:e.id})),t};if(e.preCheck=l,t=await e.exec("IDLE",!1,{onPlusTag:async()=>{if(e.log.debug({msg:"Initiated IDLE, waiting for server input",lockId:e.currentLock?.lockId,doneRequested:r}),o=!0,r)try{await a()}catch(t){e.log.warn({err:t,cid:e.id})}},onSend:()=>{}}),"function"==typeof e.preCheck&&e.preCheck===l)for(e.log.trace({msg:"Clearing pre-check function",lockId:e.currentLock?.lockId,path:e.mailbox&&e.mailbox.path,queued:s.length,doneRequested:r,canEnd:o,doneSent:i}),e.preCheck=!1;s.length;){let{resolve:e}=s.shift();e()}t.next();return}catch(t){for(e.preCheck=!1,e.idling=!1,e.log.warn({err:t,cid:e.id});s.length;){let{reject:e}=s.shift();e(t)}return!1}}e.exports=async(e,s)=>{let r;if(e.state===e.states.SELECTED){if(e.capabilities.has("IDLE")){let r,i=!1,o=async()=>{s&&(r=setTimeout(()=>{e.idling&&"function"==typeof e.preCheck&&(i=!0,e.log.trace({msg:"Max allowed IDLE time reached",cid:e.id}),e.preCheck().catch(t=>e.log.warn({err:t,cid:e.id})))},s));let a=await t(e);return(clearTimeout(r),i)?(i=!1,o()):a};return o()}return new Promise(t=>{if(!e.currentSelectCommand)return t();e.preCheck=async()=>{e.preCheck=!1,clearTimeout(r),e.log.debug({src:"c",msg:"breaking NOOP loop"}),e.idling=!1,t()};let i=e.currentSelectCommand,o=async()=>{let t;switch(e.missingIdleCommand){case"SELECT":e.log.debug({src:"c",msg:"Running SELECT to detect changes in folder"}),t=await e.exec(i.command,i.arguments);break;case"STATUS":{let s=[i.arguments[0],[]];for(let e of["MESSAGES","UIDNEXT","UIDVALIDITY","UNSEEN"])s[1].push({type:"ATOM",value:e.toUpperCase()});e.log.debug({src:"c",msg:"Running STATUS to detect changes in folder"}),t=await e.exec("STATUS",s)}break;default:t=await e.exec("NOOP",!1,{comment:"IDLE not supported"})}t.next()},a=s?Math.min(12e4,s):12e4,l=()=>{o().then(()=>{clearTimeout(r),r=setTimeout(l,a)}).catch(s=>{clearTimeout(r),e.preCheck=!1,e.log.warn({err:s,cid:e.id}),t()})};e.log.debug({src:"c",msg:"initiated NOOP loop"}),e.idling=!0,l()})}}},18551:function(e,t){(function(){function t(e,t,s){null!=e&&("number"==typeof e?this.fromNumber(e,t,s):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new t(null)}var r="undefined"!=typeof navigator;r&&"Microsoft Internet Explorer"==navigator.appName?(t.prototype.am=function(e,t,s,r,i,o){for(var a=32767&t,l=t>>15;--o>=0;){var h=32767&this[e],u=this[e++]>>15,c=l*h+u*a;i=((h=a*h+((32767&c)<<15)+s[r]+(0x3fffffff&i))>>>30)+(c>>>15)+l*u+(i>>>30),s[r++]=0x3fffffff&h}return i},w=30):r&&"Netscape"!=navigator.appName?(t.prototype.am=function(e,t,s,r,i,o){for(;--o>=0;){var a=t*this[e++]+s[r]+i;i=Math.floor(a/0x4000000),s[r++]=0x3ffffff&a}return i},w=26):(t.prototype.am=function(e,t,s,r,i,o){for(var a=16383&t,l=t>>14;--o>=0;){var h=16383&this[e],u=this[e++]>>14,c=l*h+u*a;i=((h=a*h+((16383&c)<<14)+s[r]+i)>>28)+(c>>14)+l*u,s[r++]=0xfffffff&h}return i},w=28),t.prototype.DB=w,t.prototype.DM=(1<<w)-1,t.prototype.DV=1<<w,t.prototype.FV=0x10000000000000,t.prototype.F1=52-w,t.prototype.F2=2*w-52;var i=[];for(I=0,T=48;I<=9;++I)i[T++]=I;for(I=10,T=97;I<36;++I)i[T++]=I;for(I=10,T=65;I<36;++I)i[T++]=I;function o(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function a(e,t){var s=i[e.charCodeAt(t)];return null==s?-1:s}function l(e){var t=s();return t.fromInt(e),t}function h(e){var t,s=1;return 0!=(t=e>>>16)&&(e=t,s+=16),0!=(t=e>>8)&&(e=t,s+=8),0!=(t=e>>4)&&(e=t,s+=4),0!=(t=e>>2)&&(e=t,s+=2),0!=(t=e>>1)&&(e=t,s+=1),s}function u(e){this.m=e}function c(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function d(e,t){return e&t}function p(e,t){return e|t}function f(e,t){return e^t}function g(e,t){return e&~t}function m(){}function y(e){return e}function b(e){this.r2=s(),this.q3=s(),t.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}u.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},u.prototype.revert=function(e){return e},u.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},u.prototype.mulTo=function(e,t,s){e.multiplyTo(t,s),this.reduce(s)},u.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},c.prototype.convert=function(e){var r=s();return e.abs().dlShiftTo(this.m.t,r),r.divRemTo(this.m,null,r),e.s<0&&r.compareTo(t.ZERO)>0&&this.m.subTo(r,r),r},c.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},c.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var s=32767&e[t],r=s*this.mpl+((s*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(s=t+this.m.t,e[s]+=this.m.am(0,r,e,t,0,this.m.t);e[s]>=e.DV;)e[s]-=e.DV,e[++s]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},c.prototype.mulTo=function(e,t,s){e.multiplyTo(t,s),this.reduce(s)},c.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},t.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},t.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},t.prototype.fromString=function(e,s){if(16==s)r=4;else if(8==s)r=3;else if(256==s)r=8;else if(2==s)r=1;else if(32==s)r=5;else{if(4!=s)return void this.fromRadix(e,s);r=2}this.t=0,this.s=0;for(var r,i=e.length,o=!1,l=0;--i>=0;){var h=8==r?255&e[i]:a(e,i);if(h<0){"-"==e.charAt(i)&&(o=!0);continue}o=!1,0==l?this[this.t++]=h:l+r>this.DB?(this[this.t-1]|=(h&(1<<this.DB-l)-1)<<l,this[this.t++]=h>>this.DB-l):this[this.t-1]|=h<<l,(l+=r)>=this.DB&&(l-=this.DB)}8==r&&(128&e[0])!=0&&(this.s=-1,l>0&&(this[this.t-1]|=(1<<this.DB-l)-1<<l)),this.clamp(),o&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},t.prototype.dlShiftTo=function(e,t){var s;for(s=this.t-1;s>=0;--s)t[s+e]=this[s];for(s=e-1;s>=0;--s)t[s]=0;t.t=this.t+e,t.s=this.s},t.prototype.drShiftTo=function(e,t){for(var s=e;s<this.t;++s)t[s-e]=this[s];t.t=Math.max(this.t-e,0),t.s=this.s},t.prototype.lShiftTo=function(e,t){var s,r=e%this.DB,i=this.DB-r,o=(1<<i)-1,a=Math.floor(e/this.DB),l=this.s<<r&this.DM;for(s=this.t-1;s>=0;--s)t[s+a+1]=this[s]>>i|l,l=(this[s]&o)<<r;for(s=a-1;s>=0;--s)t[s]=0;t[a]=l,t.t=this.t+a+1,t.s=this.s,t.clamp()},t.prototype.rShiftTo=function(e,t){t.s=this.s;var s=Math.floor(e/this.DB);if(s>=this.t){t.t=0;return}var r=e%this.DB,i=this.DB-r,o=(1<<r)-1;t[0]=this[s]>>r;for(var a=s+1;a<this.t;++a)t[a-s-1]|=(this[a]&o)<<i,t[a-s]=this[a]>>r;r>0&&(t[this.t-s-1]|=(this.s&o)<<i),t.t=this.t-s,t.clamp()},t.prototype.subTo=function(e,t){for(var s=0,r=0,i=Math.min(e.t,this.t);s<i;)r+=this[s]-e[s],t[s++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;s<this.t;)r+=this[s],t[s++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;s<e.t;)r-=e[s],t[s++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[s++]=this.DV+r:r>0&&(t[s++]=r),t.t=s,t.clamp()},t.prototype.multiplyTo=function(e,s){var r=this.abs(),i=e.abs(),o=r.t;for(s.t=o+i.t;--o>=0;)s[o]=0;for(o=0;o<i.t;++o)s[o+r.t]=r.am(0,i[o],s,o,0,r.t);s.s=0,s.clamp(),this.s!=e.s&&t.ZERO.subTo(s,s)},t.prototype.squareTo=function(e){for(var t=this.abs(),s=e.t=2*t.t;--s>=0;)e[s]=0;for(s=0;s<t.t-1;++s){var r=t.am(s,t[s],e,2*s,0,1);(e[s+t.t]+=t.am(s+1,2*t[s],e,2*s+1,r,t.t-s-1))>=t.DV&&(e[s+t.t]-=t.DV,e[s+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(s,t[s],e,2*s,0,1)),e.s=0,e.clamp()},t.prototype.divRemTo=function(e,r,i){var o=e.abs();if(!(o.t<=0)){var a=this.abs();if(a.t<o.t){null!=r&&r.fromInt(0),null!=i&&this.copyTo(i);return}null==i&&(i=s());var l=s(),u=this.s,c=e.s,d=this.DB-h(o[o.t-1]);d>0?(o.lShiftTo(d,l),a.lShiftTo(d,i)):(o.copyTo(l),a.copyTo(i));var p=l.t,f=l[p-1];if(0!=f){var g=f*(1<<this.F1)+(p>1?l[p-2]>>this.F2:0),m=this.FV/g,y=(1<<this.F1)/g,b=1<<this.F2,S=i.t,E=S-p,v=null==r?s():r;for(l.dlShiftTo(E,v),i.compareTo(v)>=0&&(i[i.t++]=1,i.subTo(v,i)),t.ONE.dlShiftTo(p,v),v.subTo(l,l);l.t<p;)l[l.t++]=0;for(;--E>=0;){var w=i[--S]==f?this.DM:Math.floor(i[S]*m+(i[S-1]+b)*y);if((i[S]+=l.am(0,w,i,E,0,p))<w)for(l.dlShiftTo(E,v),i.subTo(v,i);i[S]<--w;)i.subTo(v,i)}null!=r&&(i.drShiftTo(p,r),u!=c&&t.ZERO.subTo(r,r)),i.t=p,i.clamp(),d>0&&i.rShiftTo(d,i),u<0&&t.ZERO.subTo(i,i)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if((1&e)==0)return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},t.prototype.isEven=function(){return(this.t>0?1&this[0]:this.s)==0},t.prototype.exp=function(e,r){if(e>0xffffffff||e<1)return t.ONE;var i=s(),o=s(),a=r.convert(this),l=h(e)-1;for(a.copyTo(i);--l>=0;)if(r.sqrTo(i,o),(e&1<<l)>0)r.mulTo(o,a,i);else{var u=i;i=o,o=u}return r.revert(i)},t.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var t,s,r=(1<<t)-1,i=!1,a="",l=this.t,h=this.DB-l*this.DB%t;if(l-- >0)for(h<this.DB&&(s=this[l]>>h)>0&&(i=!0,a=o(s));l>=0;)h<t?s=(this[l]&(1<<h)-1)<<t-h|this[--l]>>(h+=this.DB-t):(s=this[l]>>(h-=t)&r,h<=0&&(h+=this.DB,--l)),s>0&&(i=!0),i&&(a+=o(s));return i?a:"0"},t.prototype.negate=function(){var e=s();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var s=this.t;if(0!=(t=s-e.t))return this.s<0?-t:t;for(;--s>=0;)if(0!=(t=this[s]-e[s]))return t;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+h(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var r=s();return this.abs().divRemTo(e,null,r),this.s<0&&r.compareTo(t.ZERO)>0&&e.subTo(r,r),r},t.prototype.modPowInt=function(e,t){var s;return s=e<256||t.isEven()?new u(t):new c(t),this.exp(e,s)},t.ZERO=l(0),t.ONE=l(1),m.prototype.convert=y,m.prototype.revert=y,m.prototype.mulTo=function(e,t,s){e.multiplyTo(t,s)},m.prototype.sqrTo=function(e,t){e.squareTo(t)},b.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(0>e.compareTo(this.m))return e;var t=s();return e.copyTo(t),this.reduce(t),t},b.prototype.revert=function(e){return e},b.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>e.compareTo(this.r2);)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},b.prototype.mulTo=function(e,t,s){e.multiplyTo(t,s),this.reduce(s)},b.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var S=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],E=0x4000000/S[S.length-1];function v(){var e;e=new Date().getTime(),C[A++]^=255&e,C[A++]^=e>>8&255,C[A++]^=e>>16&255,C[A++]^=e>>24&255,A>=R&&(A-=R)}if(t.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},t.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),i=l(r),o=s(),a=s(),h="";for(this.divRemTo(i,o,a);o.signum()>0;)h=(r+a.intValue()).toString(e).substr(1)+h,o.divRemTo(i,o,a);return a.intValue().toString(e)+h},t.prototype.fromRadix=function(e,s){this.fromInt(0),null==s&&(s=10);for(var r=this.chunkSize(s),i=Math.pow(s,r),o=!1,l=0,h=0,u=0;u<e.length;++u){var c=a(e,u);if(c<0){"-"==e.charAt(u)&&0==this.signum()&&(o=!0);continue}h=s*h+c,++l>=r&&(this.dMultiply(i),this.dAddOffset(h,0),l=0,h=0)}l>0&&(this.dMultiply(Math.pow(s,l)),this.dAddOffset(h,0)),o&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,s,r){if("number"==typeof s)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),p,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(s);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var i=[],o=7&e;i.length=(e>>3)+1,s.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},t.prototype.bitwiseTo=function(e,t,s){var r,i,o=Math.min(e.t,this.t);for(r=0;r<o;++r)s[r]=t(this[r],e[r]);if(e.t<this.t){for(i=e.s&this.DM,r=o;r<this.t;++r)s[r]=t(this[r],i);s.t=this.t}else{for(i=this.s&this.DM,r=o;r<e.t;++r)s[r]=t(i,e[r]);s.t=e.t}s.s=t(this.s,e.s),s.clamp()},t.prototype.changeBit=function(e,s){var r=t.ONE.shiftLeft(e);return this.bitwiseTo(r,s,r),r},t.prototype.addTo=function(e,t){for(var s=0,r=0,i=Math.min(e.t,this.t);s<i;)r+=this[s]+e[s],t[s++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;s<this.t;)r+=this[s],t[s++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;s<e.t;)r+=e[s],t[s++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[s++]=r:r<-1&&(t[s++]=this.DV+r),t.t=s,t.clamp()},t.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},t.prototype.multiplyLowerTo=function(e,t,s){var r,i=Math.min(this.t+e.t,t);for(s.s=0,s.t=i;i>0;)s[--i]=0;for(r=s.t-this.t;i<r;++i)s[i+this.t]=this.am(0,e[i],s,i,0,this.t);for(r=Math.min(e.t,t);i<r;++i)this.am(0,e[i],s,i,0,t-i);s.clamp()},t.prototype.multiplyUpperTo=function(e,t,s){--t;var r=s.t=this.t+e.t-t;for(s.s=0;--r>=0;)s[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)s[this.t+r-t]=this.am(t-r,e[r],s,0,0,this.t+r-t);s.clamp(),s.drShiftTo(1,s)},t.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,s=this.s<0?e-1:0;if(this.t>0)if(0==t)s=this[0]%e;else for(var r=this.t-1;r>=0;--r)s=(t*s+this[r])%e;return s},t.prototype.millerRabin=function(e){var r=this.subtract(t.ONE),i=r.getLowestSetBit();if(i<=0)return!1;var o=r.shiftRight(i);(e=e+1>>1)>S.length&&(e=S.length);for(var a=s(),l=0;l<e;++l){a.fromInt(S[Math.floor(Math.random()*S.length)]);var h=a.modPow(o,this);if(0!=h.compareTo(t.ONE)&&0!=h.compareTo(r)){for(var u=1;u++<i&&0!=h.compareTo(r);)if(0==(h=h.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=h.compareTo(r))return!1}}return!0},t.prototype.clone=function(){var e=s();return this.copyTo(e),e},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;else if(0==this.t)return -1}else if(1==this.t)return this[0];else if(0==this.t)return 0;return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var s,r=this.DB-e*this.DB%8,i=0;if(e-- >0)for(r<this.DB&&(s=this[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=s|this.s<<this.DB-r);e>=0;)r<8?s=(this[e]&(1<<r)-1)<<8-r|this[--e]>>(r+=this.DB-8):(s=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),(128&s)!=0&&(s|=-256),0==i&&(128&this.s)!=(128&s)&&++i,(i>0||s!=this.s)&&(t[i++]=s);return t},t.prototype.equals=function(e){return 0==this.compareTo(e)},t.prototype.min=function(e){return 0>this.compareTo(e)?this:e},t.prototype.max=function(e){return this.compareTo(e)>0?this:e},t.prototype.and=function(e){var t=s();return this.bitwiseTo(e,d,t),t},t.prototype.or=function(e){var t=s();return this.bitwiseTo(e,p,t),t},t.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,f,t),t},t.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,g,t),t},t.prototype.not=function(){for(var e=s(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},t.prototype.shiftLeft=function(e){var t=s();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},t.prototype.shiftRight=function(e){var t=s();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},t.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+function(e){if(0==e)return -1;var t=0;return(65535&e)==0&&(e>>=16,t+=16),(255&e)==0&&(e>>=8,t+=8),(15&e)==0&&(e>>=4,t+=4),(3&e)==0&&(e>>=2,t+=2),(1&e)==0&&++t,t}(this[e]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,s=0;s<this.t;++s)e+=function(e){for(var t=0;0!=e;)e&=e-1,++t;return t}(this[s]^t);return e},t.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:(this[t]&1<<e%this.DB)!=0},t.prototype.setBit=function(e){return this.changeBit(e,p)},t.prototype.clearBit=function(e){return this.changeBit(e,g)},t.prototype.flipBit=function(e){return this.changeBit(e,f)},t.prototype.add=function(e){var t=s();return this.addTo(e,t),t},t.prototype.subtract=function(e){var t=s();return this.subTo(e,t),t},t.prototype.multiply=function(e){var t=s();return this.multiplyTo(e,t),t},t.prototype.divide=function(e){var t=s();return this.divRemTo(e,t,null),t},t.prototype.remainder=function(e){var t=s();return this.divRemTo(e,null,t),t},t.prototype.divideAndRemainder=function(e){var t=s(),r=s();return this.divRemTo(e,t,r),[t,r]},t.prototype.modPow=function(e,t){var r,i,o=e.bitLength(),a=l(1);if(o<=0)return a;r=o<18?1:o<48?3:o<144?4:o<768?5:6,i=o<8?new u(t):t.isEven()?new b(t):new c(t);var d=[],p=3,f=r-1,g=(1<<r)-1;if(d[1]=i.convert(this),r>1){var m=s();for(i.sqrTo(d[1],m);p<=g;)d[p]=s(),i.mulTo(m,d[p-2],d[p]),p+=2}var y,S,E=e.t-1,v=!0,w=s();for(o=h(e[E])-1;E>=0;){for(o>=f?y=e[E]>>o-f&g:(y=(e[E]&(1<<o+1)-1)<<f-o,E>0&&(y|=e[E-1]>>this.DB+o-f)),p=r;(1&y)==0;)y>>=1,--p;if((o-=p)<0&&(o+=this.DB,--E),v)d[y].copyTo(a),v=!1;else{for(;p>1;)i.sqrTo(a,w),i.sqrTo(w,a),p-=2;p>0?i.sqrTo(a,w):(S=a,a=w,w=S),i.mulTo(w,d[y],a)}for(;E>=0&&(e[E]&1<<o)==0;)i.sqrTo(a,w),S=a,a=w,w=S,--o<0&&(o=this.DB-1,--E)}return i.revert(a)},t.prototype.modInverse=function(e){var s=e.isEven();if(this.isEven()&&s||0==e.signum())return t.ZERO;for(var r=e.clone(),i=this.clone(),o=l(1),a=l(0),h=l(0),u=l(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),s?(o.isEven()&&a.isEven()||(o.addTo(this,o),a.subTo(e,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),s?(h.isEven()&&u.isEven()||(h.addTo(this,h),u.subTo(e,u)),h.rShiftTo(1,h)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(i)>=0?(r.subTo(i,r),s&&o.subTo(h,o),a.subTo(u,a)):(i.subTo(r,i),s&&h.subTo(o,h),u.subTo(a,u))}return 0!=i.compareTo(t.ONE)?t.ZERO:u.compareTo(e)>=0?u.subtract(e):0>u.signum()&&(u.addTo(e,u),0>u.signum())?u.add(e):u},t.prototype.pow=function(e){return this.exp(e,new m)},t.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),s=e.s<0?e.negate():e.clone();if(0>t.compareTo(s)){var r=t;t=s,s=r}var i=t.getLowestSetBit(),o=s.getLowestSetBit();if(o<0)return t;for(i<o&&(o=i),o>0&&(t.rShiftTo(o,t),s.rShiftTo(o,s));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=s.getLowestSetBit())>0&&s.rShiftTo(i,s),t.compareTo(s)>=0?(t.subTo(s,t),t.rShiftTo(1,t)):(s.subTo(t,s),s.rShiftTo(1,s));return o>0&&s.lShiftTo(o,s),s},t.prototype.isProbablePrime=function(e){var t,s=this.abs();if(1==s.t&&s[0]<=S[S.length-1]){for(t=0;t<S.length;++t)if(s[0]==S[t])return!0;return!1}if(s.isEven())return!1;for(t=1;t<S.length;){for(var r=S[t],i=t+1;i<S.length&&r<E;)r*=S[i++];for(r=s.modInt(r);t<i;)if(r%S[t++]==0)return!1}return s.millerRabin(e)},t.prototype.square=function(){var e=s();return this.squareTo(e),e},t.prototype.Barrett=b,null==C){if(C=[],A=0,"undefined"!=typeof window&&window.crypto){if(window.crypto.getRandomValues){var w,T,I,k,C,A,N,O=new Uint8Array(32);for(window.crypto.getRandomValues(O),N=0;N<32;++N)C[A++]=O[N]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var B=window.crypto.random(32);for(N=0;N<B.length;++N)C[A++]=255&B.charCodeAt(N)}}for(;A<R;)N=Math.floor(65536*Math.random()),C[A++]=N>>>8,C[A++]=255&N;A=0,v()}function _(){}function x(){this.i=0,this.j=0,this.S=[]}_.prototype.nextBytes=function(e){var t;for(t=0;t<e.length;++t)e[t]=function(){if(null==k){for(v(),(k=new x).init(C),A=0;A<C.length;++A)C[A]=0;A=0}return k.next()}()},x.prototype.init=function(e){var t,s,r;for(t=0;t<256;++t)this.S[t]=t;for(t=0,s=0;t<256;++t)s=s+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[s],this.S[s]=r;this.i=0,this.j=0},x.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]};var R=256;e.exports={default:t,BigInteger:t,SecureRandom:_}}).call(this)},18583:e=>{"use strict";e.exports={WRITE_INDEX:4,READ_INDEX:8}},18616:(e,t,s)=>{"use strict";let r=s(29021),i=s(94735),o=s(28354).inherits,a=s(33873),l=s(80419),h=s(12412),u=Buffer.allocUnsafe(0),c="buffer",d="utf8",[p,f]=(process.versions.node||"0.0").split(".").map(Number),g=p>=22&&f>=7;function m(e,t){function s(s,r){if(s){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount("error")>0&&t.emit("error",s)}):t.emit("error",s);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit("ready")):t.emit("ready"),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit("drain")))}t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;let i=t.append?"a":"w",o=t.mode;if(t.sync)try{t.mkdir&&r.mkdirSync(a.dirname(e),{recursive:!0});let l=r.openSync(e,i,o);s(null,l)}catch(e){throw s(e),e}else t.mkdir?r.mkdir(a.dirname(e),{recursive:!0},t=>{if(t)return s(t);r.open(e,i,o,s)}):r.open(e,i,o,s)}function y(e){let t,s;if(!(this instanceof y))return new y(e);let{fd:i,dest:o,minLength:a,maxLength:h,maxWrite:p,periodicFlush:f,sync:g,append:E=!0,mkdir:T,retryEAGAIN:_,fsync:x,contentMode:R,mode:L}=e||{};if(i=i||o,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(a||0,16387),this.file=null,this.destroyed=!1,this.minLength=a||0,this.maxLength=h||0,this.maxWrite=p||16384,this._periodicFlush=f||0,this._periodicFlushTimer=void 0,this.sync=g||!1,this.writable=!0,this._fsync=x||!1,this.append=E||!1,this.mode=L,this.retryEAGAIN=_||(()=>!0),this.mkdir=T||!1,R===c)this._writingBuf=u,this.write=w,this.flush=k,this.flushSync=A,this._actualWrite=O,t=()=>r.writeSync(this.fd,this._writingBuf),s=()=>r.write(this.fd,this._writingBuf,this.release);else if(void 0===R||R===d)this._writingBuf="",this.write=v,this.flush=I,this.flushSync=C,this._actualWrite=N,t=()=>r.writeSync(this.fd,this._writingBuf,"utf8"),s=()=>r.write(this.fd,this._writingBuf,"utf8",this.release);else throw Error(`SonicBoom supports "${d}" and "${c}", but passed ${R}`);if("number"==typeof i)this.fd=i,process.nextTick(()=>this.emit("ready"));else if("string"==typeof i)m(i,this);else throw Error("SonicBoom supports only file descriptors and files");if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,i)=>{if(e){if(("EAGAIN"===e.code||"EBUSY"===e.code)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{l(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(s,100);else this._writing=!1,this.emit("error",e);return}this.emit("write",i);let o=b(this._writingBuf,this._len,i);if(this._len=o.len,this._writingBuf=o.writingBuf,this._writingBuf.length){if(!this.sync)return void s();try{do{let e=t(),s=b(this._writingBuf,this._len,e);this._len=s.len,this._writingBuf=s.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&r.fsyncSync(this.fd);let a=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):a>this.minLength?this._actualWrite():this._ending?a>0?this._actualWrite():(this._writing=!1,B(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(S,this)):this.emit("drain"))},this.on("newListener",function(e){"drain"===e&&(this._asyncDrainScheduled=!1)}),0!==this._periodicFlush&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function b(e,t,s){return"string"==typeof e&&Buffer.byteLength(e)!==s&&(s=Buffer.from(e).subarray(0,s).toString().length),t=Math.max(t-s,0),{writingBuf:e=e.slice(s),len:t}}function S(e){e.listenerCount("drain")>0&&(e._asyncDrainScheduled=!1,e.emit("drain"))}function E(e,t){return 0===e.length?u:1===e.length?e[0]:Buffer.concat(e,t)}function v(e){if(this.destroyed)throw Error("SonicBoom destroyed");let t=this._len+e.length,s=this._bufs;return this.maxLength&&t>this.maxLength?this.emit("drop",e):(0===s.length||s[s.length-1].length+e.length>this.maxWrite?s.push(""+e):s[s.length-1]+=e,this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite()),this._len<this._hwm}function w(e){if(this.destroyed)throw Error("SonicBoom destroyed");let t=this._len+e.length,s=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?this.emit("drop",e):(0===s.length||r[r.length-1]+e.length>this.maxWrite?(s.push([e]),r.push(e.length)):(s[s.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite()),this._len<this._hwm}function T(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{r.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off("error",s)},s=s=>{this._flushPending=!1,e(s),this.off("drain",t)};this.once("drain",t),this.once("error",s)}function I(e){if(null!=e&&"function"!=typeof e)throw Error("flush cb must be a function");if(this.destroyed){let t=Error("SonicBoom destroyed");if(e)return void e(t);throw t}if(this.minLength<=0)return void e?.();e&&T.call(this,e),this._writing||(0===this._bufs.length&&this._bufs.push(""),this._actualWrite())}function k(e){if(null!=e&&"function"!=typeof e)throw Error("flush cb must be a function");if(this.destroyed){let t=Error("SonicBoom destroyed");if(e)return void e(t);throw t}if(this.minLength<=0)return void e?.();e&&T.call(this,e),this._writing||(0===this._bufs.length&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}function C(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this.fd<0)throw Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf="");let e="";for(;this._bufs.length||e;){e.length<=0&&(e=this._bufs[0]);try{let t=r.writeSync(this.fd,e,"utf8"),s=b(e,this._len,t);e=s.writingBuf,this._len=s.len,e.length<=0&&this._bufs.shift()}catch(t){if(("EAGAIN"===t.code||"EBUSY"===t.code)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;l(100)}}try{r.fsyncSync(this.fd)}catch{}}function A(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this.fd<0)throw Error("sonic boom is not ready yet");!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=u);let e=u;for(;this._bufs.length||e.length;){e.length<=0&&(e=E(this._bufs[0],this._lens[0]));try{let t=r.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if(("EAGAIN"===t.code||"EBUSY"===t.code)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;l(100)}}}function N(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf||this._bufs.shift()||"",this.sync)try{let t=r.writeSync(this.fd,this._writingBuf,"utf8");e(null,t)}catch(t){e(t)}else r.write(this.fd,this._writingBuf,"utf8",e)}function O(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:E(this._bufs.shift(),this._lens.shift()),this.sync)try{let t=r.writeSync(this.fd,this._writingBuf);e(null,t)}catch(t){e(t)}else g&&(this._writingBuf=Buffer.from(this._writingBuf)),r.write(this.fd,this._writingBuf,e)}function B(e){if(-1===e.fd)return void e.once("ready",B.bind(null,e));void 0!==e._periodicFlushTimer&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],h("number"==typeof e.fd,`sonic.fd must be a number, got ${typeof e.fd}`);try{r.fsync(e.fd,function(){1!==e.fd&&2!==e.fd?r.close(e.fd,t):t()})}catch{}function t(t){if(t)return void e.emit("error",t);e._ending&&!e._writing&&e.emit("finish"),e.emit("close")}}o(y,i),y.prototype.reopen=function(e){if(this.destroyed)throw Error("SonicBoom destroyed");if(this._opening)return void this.once("ready",()=>{this.reopen(e)});if(this._ending)return;if(!this.file)throw Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once("ready",()=>{t!==this.fd&&r.close(t,e=>{if(e)return this.emit("error",e)})}),m(this.file,this)},y.prototype.end=function(){if(this.destroyed)throw Error("SonicBoom destroyed");if(this._opening)return void this.once("ready",()=>{this.end()});!this._ending&&(this._ending=!0,this._writing||(this._len>0&&this.fd>=0?this._actualWrite():B(this)))},y.prototype.destroy=function(){this.destroyed||B(this)},y.SonicBoom=y,y.default=y,e.exports=y},20760:(e,t,s)=>{"use strict";let r=s(47595),i=s(32026),o=s(54148),a=s(68658);e.exports={err:r,errWithCause:i,mapHttpRequest:o.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:o.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===r?e:function(t){return e(r(t))}},wrapRequestSerializer:function(e){return e===o.reqSerializer?e:function(t){return e(o.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}},22304:(e,t,s)=>{"use strict";let r=s(71618),i=s(59059),o=s(10518),a=s(17722),{groupRedact:l,nestedRedact:h}=s(46522),u=s(13789),c=s(30208),d=r(),p=e=>e;function f(e={}){let t=Array.from(new Set(e.paths||[])),s="serialize"in e&&(!1===e.serialize||"function"==typeof e.serialize)?e.serialize:JSON.stringify,r=e.remove;if(!0===r&&s!==JSON.stringify)throw Error("fast-redact remove option may only be set when serializer is JSON.stringify");let c=!0===r?void 0:"censor"in e?e.censor:"[REDACTED]",g="function"==typeof c,m=g&&c.length>1;if(0===t.length)return s||p;d({paths:t,serialize:s,censor:c});let{wildcards:y,wcLen:b,secret:S}=i({paths:t,censor:c}),E=a();return o({secret:S,wcLen:b,serialize:s,strict:!("strict"in e)||e.strict,isCensorFct:g,censorFctTakesPath:m},u({secret:S,censor:c,compileRestore:E,serialize:s,groupRedact:l,nestedRedact:h,wildcards:y,wcLen:b}))}p.restore=p,f.rx=c,f.validator=r,e.exports=f},22332:(e,t,s)=>{"use strict";let{getStatusCode:r,getErrorText:i}=s(80876),{searchCompiler:o}=s(63653);e.exports=async(e,t,s)=>{let a;if(e.state!==e.states.SELECTED)return!1;if(s=s||{},t&&!0!==t&&("object"!=typeof t||Object.keys(t).length&&(1!==Object.keys(t).length||!t.all)))if(!t||"object"!=typeof t)return!1;else a=o(e,t);else a=[{type:"ATOM",value:"ALL"}];let l=new Set;try{return(await e.exec(s.uid?"UID SEARCH":"SEARCH",a,{untagged:{SEARCH:async e=>{e&&e.attributes&&e.attributes.length&&e.attributes.forEach(e=>{e&&e.value&&"string"==typeof e.value&&!isNaN(e.value)&&l.add(Number(e.value))})}}})).next(),Array.from(l).sort((e,t)=>e-t)}catch(s){let t=r(s.response);return t&&(s.serverResponseCode=t),s.response=await i(s.response),e.log.warn({err:s,cid:e.id}),!1}}},24238:e=>{"use strict";e.exports=async e=>{let t;if(e.state===e.states.LOGOUT)return!1;if(e.state===e.states.NOT_AUTHENTICATED)return e.state=e.states.LOGOUT,e.close(),!1;try{return t=await e.exec("LOGOUT"),!0}catch(t){if("NoConnection"===t.code)return!0;return e.log.warn({err:t,cid:e.id}),!1}finally{e.state=e.states.LOGOUT,t&&"function"==typeof t.next&&t.next(),e.close()}}},24323:(e,t,s)=>{"use strict";let r=s(72626)();r.level="trace",e.exports=r},25489:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReceiveBuffer=void 0;class s{constructor(e=4096){this.buffer=Buffer.allocUnsafe(e),this.offset=0,this.originalSize=e}get length(){return this.offset}append(e){if(!Buffer.isBuffer(e))throw Error("Attempted to append a non-buffer instance to ReceiveBuffer.");if(this.offset+e.length>=this.buffer.length){let t=this.buffer;this.buffer=Buffer.allocUnsafe(Math.max(this.buffer.length+this.originalSize,this.buffer.length+e.length)),t.copy(this.buffer)}return e.copy(this.buffer,this.offset),this.offset+=e.length}peek(e){if(e>this.offset)throw Error("Attempted to read beyond the bounds of the managed internal data.");return this.buffer.slice(0,e)}get(e){if(e>this.offset)throw Error("Attempted to read beyond the bounds of the managed internal data.");let t=Buffer.allocUnsafe(e);return this.buffer.slice(0,e).copy(t),this.buffer.copyWithin(0,e,e+this.offset-e),this.offset-=e,t}}t.ReceiveBuffer=s},25635:(e,t,s)=>{"use strict";let r=s(81866),i=s(48376),o=s(31064),a=s(86096),l=s(27910).PassThrough,h=s(33873);class u{constructor(e,t){this.type="node",this.root=!e,this.parentNode=e,this._parentBoundary=this.parentNode&&this.parentNode._boundary,this._headersLines=[],this._headerlen=0,this._parsedContentType=!1,this._boundary=!1,this.multipart=!1,this.encoding=!1,this.headers=!1,this.contentType=!1,this.flowed=!1,this.delSp=!1,this.config=t||{},this.libmime=new i.Libmime({Iconv:this.config.Iconv}),this.parentPartNumber=e&&this.partNr||[],this.partNr=!1,this.childPartNumbers=0}getPartNr(e){if(e)return[].concat(this.partNr||[]).filter(e=>!isNaN(e)).concat(e);let t=++this.childPartNumbers;return[].concat(this.partNr||[]).filter(e=>!isNaN(e)).concat(t)}addHeaderChunk(e){e&&(this._headersLines.push(e),this._headerlen+=e.length)}parseHeaders(){let e;if(!this.headers){if(this.headers=new r(Buffer.concat(this._headersLines,this._headerlen),this.config),this._parsedContentDisposition=this.libmime.parseHeaderValue(this.headers.getFirst("Content-Disposition")),this.headers.get("Content-Type").length)e=this.headers.getFirst("Content-Type");else{if(this._parsedContentDisposition.params.filename){let t=h.parse(this._parsedContentDisposition.params.filename).ext.replace(/^\./,"");t&&(e=i.detectMimeType(t))}e||(e=/^attachment$/i.test(this._parsedContentDisposition.value)?"application/octet-stream":"text/plain")}if(this._parsedContentType=this.libmime.parseHeaderValue(e),this.encoding=this.headers.getFirst("Content-Transfer-Encoding").replace(/\(.*\)/g,"").toLowerCase().trim(),this.contentType=(this._parsedContentType.value||"").toLowerCase().trim()||!1,this.charset=this._parsedContentType.params.charset||!1,this.disposition=(this._parsedContentDisposition.value||"").toLowerCase().trim()||!1,this.disposition)try{this.disposition=this.libmime.decodeWords(this.disposition)}catch(e){}if(this.filename=this._parsedContentDisposition.params.filename||this._parsedContentType.params.name||!1,this._parsedContentType.params.format&&"flowed"===this._parsedContentType.params.format.toLowerCase().trim()&&(this.flowed=!0,this._parsedContentType.params.delsp&&"yes"===this._parsedContentType.params.delsp.toLowerCase().trim()&&(this.delSp=!0)),this.filename)try{this.filename=this.libmime.decodeWords(this.filename)}catch(e){}this.multipart=this.contentType&&"multipart"===this.contentType.substr(0,this.contentType.indexOf("/"))&&this.contentType.substr(this.contentType.indexOf("/")+1)||!1,this._boundary=this._parsedContentType.params.boundary&&Buffer.from(this._parsedContentType.params.boundary)||!1,this.rfc822="message/rfc822"===this.contentType,!this.parentNode||this.parentNode.rfc822?this.partNr=this.parentNode?this.parentNode.getPartNr("TEXT"):["TEXT"]:this.partNr=this.parentNode?this.parentNode.getPartNr():[]}}getHeaders(){return this.headers||this.parseHeaders(),this.headers.build()}setContentType(e){this.headers||this.parseHeaders(),(e=(e||"").toLowerCase().trim())&&(this._parsedContentType.value=e),!this.flowed&&this._parsedContentType.params.format&&delete this._parsedContentType.params.format,!this.delSp&&this._parsedContentType.params.delsp&&delete this._parsedContentType.params.delsp,this.headers.update("Content-Type",this.libmime.buildHeaderValue(this._parsedContentType))}setCharset(e){if(this.headers||this.parseHeaders(),"ascii"===(e=(e||"").toLowerCase().trim())&&(e=""),e)this._parsedContentType.params.charset=e;else{if(!this._parsedContentType.value)return;delete this._parsedContentType.params.charset}this._parsedContentType.value||(this._parsedContentType.value="text/plain"),this.headers.update("Content-Type",this.libmime.buildHeaderValue(this._parsedContentType))}setFilename(e){if(this.headers||this.parseHeaders(),this.filename=(e||"").toLowerCase().trim(),this._parsedContentType.params.name&&(delete this._parsedContentType.params.name,this.headers.update("Content-Type",this.libmime.buildHeaderValue(this._parsedContentType))),this.filename)this._parsedContentDisposition.params.filename=this.filename;else{if(!this._parsedContentDisposition.value)return;delete this._parsedContentDisposition.params.filename}this._parsedContentDisposition.value||(this._parsedContentDisposition.value="attachment"),this.headers.update("Content-Disposition",this.libmime.buildHeaderValue(this._parsedContentDisposition))}getDecoder(){switch(!this.headers&&this.parseHeaders(),this.encoding){case"base64":return new a.Decoder;case"quoted-printable":return new o.Decoder;default:return new l}}getEncoder(e){switch(!this.headers&&this.parseHeaders(),(e=(e||"").toString().toLowerCase().trim())&&e!==this.encoding?this.headers.update("Content-Transfer-Encoding",e):e=this.encoding,e){case"base64":return new a.Encoder;case"quoted-printable":return new o.Encoder;default:return new l}}}e.exports=u},30208:e=>{"use strict";e.exports=/[^.[\]]+|\[((?:.)*?)\]/g},31480:(e,t,s)=>{"use strict";let r=s(91645),i=s(34631),o=s(79551);e.exports=function e(t,s,a,l){let h,u,c,d=o.parse(t);h={host:d.hostname,port:Number(d.port)?Number(d.port):"https:"===d.protocol?443:80},"https:"===d.protocol?(h.rejectUnauthorized=!1,u=i.connect.bind(i)):u=r.connect.bind(r);let p=!1,f=e=>{if(!p){p=!0;try{c.destroy()}catch(e){}l(e)}},g=()=>{let e=Error("Proxy socket timed out");e.code="ETIMEDOUT",f(e)};(c=u(h,()=>{if(p)return;let e={Host:a+":"+s,Connection:"close"};d.auth&&(e["Proxy-Authorization"]="Basic "+Buffer.from(d.auth).toString("base64")),c.write("CONNECT "+a+":"+s+" HTTP/1.1\r\n"+Object.keys(e).map(t=>t+": "+e[t]).join("\r\n")+"\r\n\r\n");let t="",r=e=>{let s,i;if(!p&&(t+=e.toString("binary"),s=t.match(/\r\n\r\n/))){if(c.removeListener("data",r),i=t.substr(s.index+s[0].length),t=t.substr(0,s.index),i&&c.unshift(Buffer.from(i,"binary")),p=!0,!(s=t.match(/^HTTP\/\d+\.\d+ (\d+)/i))||"2"!==(s[1]||"").charAt(0)){try{c.destroy()}catch(e){}return l(Error("Invalid response from proxy"+(s&&": "+s[1]||"")))}return c.removeListener("error",f),c.removeListener("timeout",g),c.setTimeout(0),l(null,c)}};c.on("data",r)})).setTimeout(e.timeout||3e4),c.on("timeout",g),c.once("error",f)}},32026:(e,t,s)=>{"use strict";e.exports=function e(t){if(!r(t))return t;t[a]=void 0;let s=Object.create(i);for(let i in s.type="[object Function]"===l.call(t.constructor)?t.constructor.name:t.name,s.message=t.message,s.stack=t.stack,Array.isArray(t.errors)&&(s.aggregateErrors=t.errors.map(t=>e(t))),r(t.cause)&&!Object.prototype.hasOwnProperty.call(t.cause,a)&&(s.cause=e(t.cause)),t)if(void 0===s[i]){let o=t[i];r(o)?Object.prototype.hasOwnProperty.call(o,a)||(s[i]=e(o)):s[i]=o}return delete t[a],s.raw=t,s};let{isErrorLike:r}=s(98539),{pinoErrProto:i,pinoErrorSymbols:o}=s(83360),{seen:a}=o,{toString:l}=Object.prototype},32672:(e,t,s)=>{"use strict";let r=s(27910).Transform,i=s(58118);class o extends r{constructor(e,t){super({readableObjectMode:!0,writableObjectMode:!0}),this.filterFunc=e,this.streamAction=t,this.decoder=!1,this.canContinue=!1,this.continue=!1}_transform(e,t,s){this.processIncoming(e,s)}_flush(e){return this.decoder?this.processIncoming({type:"none"},e):e()}processIncoming(e,t){if(this.decoder&&"body"===e.type)return(this.push(e),this.decoder.write(e.value))?t():this.decoder.once("drain",t);if(this.decoder&&"body"!==e.type){let s=()=>{this.continue=!1,this.decoder=!1,this.canContinue=!1,this.processIncoming(e,t)};return this.canContinue?setImmediate(s):this.continue=()=>s(),this.decoder.end()}"node"===e.type&&this.filterFunc(e)?(this.push(e),this.emit("node",this.createDecoder(e))):this.readable&&"none"!==e.type&&this.push(e),t()}createDecoder(e){this.decoder=e.getDecoder();let t=this.decoder;if(t.$reading=!1,/^text\//.test(e.contentType)&&e.flowed){let s=t;t=new i({delSp:e.delSp}),s.on("error",e=>{t.emit("error",e)}),s.pipe(t)}return{node:e,decoder:t,done:()=>{"function"==typeof this.continue?this.continue():this.canContinue=!0}}}}e.exports=o},33103:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i,getStatusCode:o,getErrorText:a}=s(80876);e.exports=async(e,t)=>{if([e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)){t=i(e,t),e.states.SELECTED&&e.mailbox.path===t&&await e.run("CLOSE");try{let s={path:t};return(await e.exec("DELETE",[{type:"ATOM",value:r(e,t)}])).next(),s}catch(s){let t=o(s.response);throw t&&(s.serverResponseCode=t),s.response=await a(s.response),e.log.warn({err:s,cid:e.id}),s}}}},35216:(e,t,s)=>{"use strict";let r=s(31480),{SocksClient:i}=s(894),o=s(28354).promisify(r),a=s(14985).promises,l=s(91645);e.exports={proxyConnection:async(e,t,s,r)=>{let h=new URL(t),u=h.protocol.replace(/:$/,"").toLowerCase();if(!l.isIP(s)){let e=await a.resolve(s);e&&e.length&&(s=e[0])}switch(u){case"http":case"https":try{let t=await o(h.href,r,s);return t&&(h.password&&(h.password="(hidden)"),e.info({msg:"Established a socket via HTTP proxy",proxyUrl:h.href,port:r,host:s})),t}catch(t){throw h.password&&(h.password="(hidden)"),e.error({msg:"Failed to establish a socket via HTTP proxy",proxyUrl:h.href,port:r,host:s,err:t}),t}case"socks":case"socks5":case"socks4":case"socks4a":{let t=Number(u.replace(/\D/g,""))||5,o=h.hostname;if(!l.isIP(o)){let e=await a.resolve(o);e&&e.length&&(o=e[0])}let c={proxy:{host:o,port:Number(h.port)||1080,type:t},destination:{host:s,port:r},command:"connect",set_tcp_nodelay:!0};(h.username||h.password)&&(c.proxy.userId=h.username,c.proxy.password=h.password);try{let t=await i.createConnection(c);return t&&t.socket&&(h.password&&(h.password="(hidden)"),e.info({msg:"Established a socket via SOCKS proxy",proxyUrl:h.href,port:r,host:s})),t.socket}catch(t){throw h.password&&(h.password="(hidden)"),e.error({msg:"Failed to establish a socket via SOCKS proxy",proxyUrl:h.href,port:r,host:s,err:t}),t}}}}}},36558:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Address4=void 0;let a=o(s(6696)),l=o(s(49877)),h=s(11990),u=s(18551),c=s(18421);class d{constructor(e){this.groups=l.GROUPS,this.parsedAddress=[],this.parsedSubnet="",this.subnet="/32",this.subnetMask=32,this.v4=!0,this.isCorrect=a.isCorrect(l.BITS),this.isInSubnet=a.isInSubnet,this.address=e;let t=l.RE_SUBNET_STRING.exec(e);if(t){if(this.parsedSubnet=t[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,this.subnetMask<0||this.subnetMask>l.BITS)throw new h.AddressError("Invalid subnet mask.");e=e.replace(l.RE_SUBNET_STRING,"")}this.addressMinusSuffix=e,this.parsedAddress=this.parse(e)}static isValid(e){try{return new d(e),!0}catch(e){return!1}}parse(e){let t=e.split(".");if(!e.match(l.RE_ADDRESS))throw new h.AddressError("Invalid IPv4 address.");return t}correctForm(){return this.parsedAddress.map(e=>parseInt(e,10)).join(".")}static fromHex(e){let t,s=e.replace(/:/g,"").padStart(8,"0"),r=[];for(t=0;t<8;t+=2){let e=s.slice(t,t+2);r.push(parseInt(e,16))}return new d(r.join("."))}static fromInteger(e){return d.fromHex(e.toString(16))}static fromArpa(e){return new d(e.replace(/(\.in-addr\.arpa)?\.$/,"").split(".").reverse().join("."))}toHex(){return this.parsedAddress.map(e=>(0,c.sprintf)("%02x",parseInt(e,10))).join(":")}toArray(){return this.parsedAddress.map(e=>parseInt(e,10))}toGroup6(){let e,t=[];for(e=0;e<l.GROUPS;e+=2){let s=(0,c.sprintf)("%02x%02x",parseInt(this.parsedAddress[e],10),parseInt(this.parsedAddress[e+1],10));t.push((0,c.sprintf)("%x",parseInt(s,16)))}return t.join(":")}bigInteger(){return new u.BigInteger(this.parsedAddress.map(e=>(0,c.sprintf)("%02x",parseInt(e,10))).join(""),16)}_startAddress(){return new u.BigInteger(this.mask()+"0".repeat(l.BITS-this.subnetMask),2)}startAddress(){return d.fromBigInteger(this._startAddress())}startAddressExclusive(){let e=new u.BigInteger("1");return d.fromBigInteger(this._startAddress().add(e))}_endAddress(){return new u.BigInteger(this.mask()+"1".repeat(l.BITS-this.subnetMask),2)}endAddress(){return d.fromBigInteger(this._endAddress())}endAddressExclusive(){let e=new u.BigInteger("1");return d.fromBigInteger(this._endAddress().subtract(e))}static fromBigInteger(e){return d.fromInteger(parseInt(e.toString(),10))}mask(e){return void 0===e&&(e=this.subnetMask),this.getBitsBase2(0,e)}getBitsBase2(e,t){return this.binaryZeroPad().slice(e,t)}reverseForm(e){e||(e={});let t=this.correctForm().split(".").reverse().join(".");return e.omitSuffix?t:(0,c.sprintf)("%s.in-addr.arpa.",t)}isMulticast(){return this.isInSubnet(new d("224.0.0.0/4"))}binaryZeroPad(){return this.bigInteger().toString(2).padStart(l.BITS,"0")}groupForV6(){let e=this.parsedAddress;return this.address.replace(l.RE_ADDRESS,(0,c.sprintf)('<span class="hover-group group-v4 group-6">%s</span>.<span class="hover-group group-v4 group-7">%s</span>',e.slice(0,2).join("."),e.slice(2,4).join(".")))}}t.Address4=d},36831:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RE_URL_WITH_PORT=t.RE_URL=t.RE_ZONE_STRING=t.RE_SUBNET_STRING=t.RE_BAD_ADDRESS=t.RE_BAD_CHARACTERS=t.TYPES=t.SCOPES=t.GROUPS=t.BITS=void 0,t.BITS=128,t.GROUPS=8,t.SCOPES={0:"Reserved",1:"Interface local",2:"Link local",4:"Admin local",5:"Site local",8:"Organization local",14:"Global",15:"Reserved"},t.TYPES={"ff01::1/128":"Multicast (All nodes on this interface)","ff01::2/128":"Multicast (All routers on this interface)","ff02::1/128":"Multicast (All nodes on this link)","ff02::2/128":"Multicast (All routers on this link)","ff05::2/128":"Multicast (All routers in this site)","ff02::5/128":"Multicast (OSPFv3 AllSPF routers)","ff02::6/128":"Multicast (OSPFv3 AllDR routers)","ff02::9/128":"Multicast (RIP routers)","ff02::a/128":"Multicast (EIGRP routers)","ff02::d/128":"Multicast (PIM routers)","ff02::16/128":"Multicast (MLDv2 reports)","ff01::fb/128":"Multicast (mDNSv6)","ff02::fb/128":"Multicast (mDNSv6)","ff05::fb/128":"Multicast (mDNSv6)","ff02::1:2/128":"Multicast (All DHCP servers and relay agents on this link)","ff05::1:2/128":"Multicast (All DHCP servers and relay agents in this site)","ff02::1:3/128":"Multicast (All DHCP servers on this link)","ff05::1:3/128":"Multicast (All DHCP servers in this site)","::/128":"Unspecified","::1/128":"Loopback","ff00::/8":"Multicast","fe80::/10":"Link-local unicast"},t.RE_BAD_CHARACTERS=/([^0-9a-f:/%])/gi,t.RE_BAD_ADDRESS=/([0-9a-f]{5,}|:{3,}|[^:]:$|^:[^:]|\/$)/gi,t.RE_SUBNET_STRING=/\/\d{1,3}(?=%|$)/,t.RE_ZONE_STRING=/%.*$/,t.RE_URL=new RegExp(/^\[{0,1}([0-9a-f:]+)\]{0,1}/),t.RE_URL_WITH_PORT=new RegExp(/\[([0-9a-f:]+)\]:([0-9]{1,5})/)},36937:(e,t,s)=>{"use strict";let r=s(22304),{redactFmtSym:i,wildcardFirstSym:o}=s(69185),{rx:a,validator:l}=r,h=l({ERR_PATHS_MUST_BE_STRINGS:()=>"pino redacted paths must be strings",ERR_INVALID_PATH:e=>`pino redact paths array contains an invalid path (${e})`}),u="[Redacted]";e.exports=function(e,t){let{paths:s,censor:l}=function(e){if(Array.isArray(e))return h(e={paths:e,censor:u}),e;let{paths:t,censor:s=u,remove:r}=e;if(!1===Array.isArray(t))throw Error("pino redact must contain an array of strings");return!0===r&&(s=void 0),h({paths:t,censor:s}),{paths:t,censor:s}}(e),c=s.reduce((e,t)=>{a.lastIndex=0;let s=a.exec(t),r=a.exec(t),i=void 0!==s[1]?s[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,"$1"):s[0];if("*"===i&&(i=o),null===r)return e[i]=null,e;if(null===e[i])return e;let{index:l}=r,h=`${t.substr(l,t.length-1)}`;return e[i]=e[i]||[],i!==o&&0===e[i].length&&e[i].push(...e[o]||[]),i===o&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(h)}),e[i].push(h),e},{}),d={[i]:r({paths:s,censor:l,serialize:t,strict:!1})},p=(...e)=>"function"==typeof l?t(l(...e)):t(l);return[...Object.keys(c),...Object.getOwnPropertySymbols(c)].reduce((e,s)=>{if(null===c[s])e[s]=e=>p(e,[s]);else{let i="function"==typeof l?(e,t)=>l(e,[s,...t]):l;e[s]=r({paths:c[s],censor:i,serialize:t,strict:!1})}return e},d)}},38361:(e,t,s)=>{"use strict";let{getStatusCode:r,normalizePath:i,encodePath:o,expandRange:a,getErrorText:l}=s(80876);e.exports=async(e,t,s,h)=>{let u;if(e.state!==e.states.SELECTED||!t||!s)return;h=h||{},s=i(e,s);let c=[{type:"SEQUENCE",value:t},{type:"ATOM",value:o(e,s)}],d={path:e.mailbox.path,destination:s};if(!e.capabilities.has("MOVE")){let r=await e.messageCopy(t,s,h);return await e.messageDelete(t,Object.assign({silent:!0},h)),r}let p=e=>{let t=e.attributes&&e.attributes[0]&&e.attributes[0].section;if((t&&t.length&&t[0]&&"string"==typeof t[0].value?t[0].value:"")==="COPYUID"){let e=!(!t[1]||"string"!=typeof t[1].value||isNaN(t[1].value))&&BigInt(t[1].value);e&&(d.uidValidity=e);let s=!!t[2]&&"string"==typeof t[2].value&&a(t[2].value),r=!!t[3]&&"string"==typeof t[3].value&&a(t[3].value);s&&r&&s.length===r.length&&(d.uidMap=new Map(s.map((e,t)=>[e,r[t]])))}};try{return(u=await e.exec(h.uid?"UID MOVE":"MOVE",c,{untagged:{OK:async e=>{p(e)}}})).next(),p(u.response),d}catch(s){let t=r(s.response);return t&&(s.serverResponseCode=t),s.response=await l(s.response),e.log.warn({err:s,cid:e.id}),!1}}},39093:(e,t,s)=>{"use strict";let r=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:i}=s(89597),o=i.info;function a(e,t){return e.level-t.level}e.exports=function(e,t){let s=0;e=e||[],t=t||{dedupe:!1};let l=Object.create(i);l.silent=1/0,t.levels&&"object"==typeof t.levels&&Object.keys(t.levels).forEach(e=>{l[e]=t.levels[e]});let h={write:u,add:p,emit:c,flushSync:d,end:function(){for(let{stream:e}of this.streams)"function"==typeof e.flushSync&&e.flushSync(),e.end()},minLevel:0,streams:[],clone:function e(t){let s=Array(this.streams.length);for(let e=0;e<s.length;e++)s[e]={level:t,stream:this.streams[e].stream};return{write:u,add:p,minLevel:t,streams:s,clone:e,emit:c,flushSync:d,[r]:!0}},[r]:!0,streamLevels:l};return Array.isArray(e)?e.forEach(p,h):p.call(h,e),e=null,h;function u(e){var s,i,o,a;let l,h,u=this.lastLevel,{streams:c}=this,d=0;for(let p=(s=c.length,t.dedupe?s-1:0);i=p,o=c.length,t.dedupe?i>=0:i<o;a=p,p=t.dedupe?a-1:a+1)if((l=c[p]).level<=u){if(0!==d&&d!==l.level)break;if((h=l.stream)[r]){let{lastTime:e,lastMsg:t,lastObj:s,lastLogger:r}=this;h.lastLevel=u,h.lastTime=e,h.lastMsg=t,h.lastObj=s,h.lastLogger=r}h.write(e),t.dedupe&&(d=l.level)}else if(!t.dedupe)break}function c(...e){for(let{stream:t}of this.streams)"function"==typeof t.emit&&t.emit(...e)}function d(){for(let{stream:e}of this.streams)"function"==typeof e.flushSync&&e.flushSync()}function p(e){let t;if(!e)return h;let r="function"==typeof e.write||e.stream,i=e.write?e:e.stream;if(!r)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:l,streamLevels:u}=this,c={stream:i,level:"number"==typeof e.levelVal?e.levelVal:"string"==typeof e.level?u[e.level]:"number"==typeof e.level?e.level:o,levelVal:void 0,id:s++};return l.unshift(c),l.sort(a),this.minLevel=l[0].level,h}}},40509:e=>{"use strict";e.exports=JSON.parse('{"name":"imapflow","version":"1.0.184","description":"IMAP Client for Node","main":"./lib/imap-flow.js","scripts":{"test":"grunt","prepare":"npm run build","docs":"rm -rf docs && mkdir -p docs && jsdoc lib/imap-flow.js -c jsdoc.json -R README.md --destination docs/ && cp assets/favicon.ico docs","dst":"node types.js","build":"npm run docs && npm run dst","st":"npm run docs && st -d docs -i index.html","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"repository":{"type":"git","url":"git+https://github.com/postalsys/imapflow.git"},"keywords":["imap","email","mail"],"author":"Postal Systems O\xdc","license":"MIT","bugs":{"url":"https://github.com/postalsys/imapflow/issues"},"homepage":"https://imapflow.com/","devDependencies":{"@babel/eslint-parser":"7.26.8","@babel/eslint-plugin":"7.25.9","@babel/plugin-syntax-class-properties":"7.12.13","@babel/preset-env":"7.26.9","@types/node":"22.13.10","eslint":"8.57.0","eslint-config-nodemailer":"1.2.0","eslint-config-prettier":"9.1.0","grunt":"1.6.1","grunt-cli":"1.5.0","grunt-contrib-nodeunit":"5.0.0","grunt-eslint":"24.3.0","imapflow-jsdoc-template":"3.4.0-imapflow.2","jsdoc":"3.6.11","st":"3.0.1","tsd-jsdoc":"2.5.0"},"dependencies":{"encoding-japanese":"2.2.0","iconv-lite":"0.6.3","libbase64":"1.3.0","libmime":"5.3.6","libqp":"2.1.1","mailsplit":"5.4.3","nodemailer":"6.10.0","pino":"9.6.0","socks":"2.8.4"}}')},40547:(e,t)=>{"use strict";var s,r,i,o,a,l;Object.defineProperty(t,"__esModule",{value:!0}),t.SOCKS5_NO_ACCEPTABLE_AUTH=t.SOCKS5_CUSTOM_AUTH_END=t.SOCKS5_CUSTOM_AUTH_START=t.SOCKS_INCOMING_PACKET_SIZES=t.SocksClientState=t.Socks5Response=t.Socks5HostType=t.Socks5Auth=t.Socks4Response=t.SocksCommand=t.ERRORS=t.DEFAULT_TIMEOUT=void 0,t.DEFAULT_TIMEOUT=3e4,t.ERRORS={InvalidSocksCommand:"An invalid SOCKS command was provided. Valid options are connect, bind, and associate.",InvalidSocksCommandForOperation:"An invalid SOCKS command was provided. Only a subset of commands are supported for this operation.",InvalidSocksCommandChain:"An invalid SOCKS command was provided. Chaining currently only supports the connect command.",InvalidSocksClientOptionsDestination:"An invalid destination host was provided.",InvalidSocksClientOptionsExistingSocket:"An invalid existing socket was provided. This should be an instance of stream.Duplex.",InvalidSocksClientOptionsProxy:"Invalid SOCKS proxy details were provided.",InvalidSocksClientOptionsTimeout:"An invalid timeout value was provided. Please enter a value above 0 (in ms).",InvalidSocksClientOptionsProxiesLength:"At least two socks proxies must be provided for chaining.",InvalidSocksClientOptionsCustomAuthRange:"Custom auth must be a value between 0x80 and 0xFE.",InvalidSocksClientOptionsCustomAuthOptions:"When a custom_auth_method is provided, custom_auth_request_handler, custom_auth_response_size, and custom_auth_response_handler must also be provided and valid.",NegotiationError:"Negotiation error",SocketClosed:"Socket closed",ProxyConnectionTimedOut:"Proxy connection timed out",InternalError:"SocksClient internal error (this should not happen)",InvalidSocks4HandshakeResponse:"Received invalid Socks4 handshake response",Socks4ProxyRejectedConnection:"Socks4 Proxy rejected connection",InvalidSocks4IncomingConnectionResponse:"Socks4 invalid incoming connection response",Socks4ProxyRejectedIncomingBoundConnection:"Socks4 Proxy rejected incoming bound connection",InvalidSocks5InitialHandshakeResponse:"Received invalid Socks5 initial handshake response",InvalidSocks5IntiailHandshakeSocksVersion:"Received invalid Socks5 initial handshake (invalid socks version)",InvalidSocks5InitialHandshakeNoAcceptedAuthType:"Received invalid Socks5 initial handshake (no accepted authentication type)",InvalidSocks5InitialHandshakeUnknownAuthType:"Received invalid Socks5 initial handshake (unknown authentication type)",Socks5AuthenticationFailed:"Socks5 Authentication failed",InvalidSocks5FinalHandshake:"Received invalid Socks5 final handshake response",InvalidSocks5FinalHandshakeRejected:"Socks5 proxy rejected connection",InvalidSocks5IncomingConnectionResponse:"Received invalid Socks5 incoming connection response",Socks5ProxyRejectedIncomingBoundConnection:"Socks5 Proxy rejected incoming bound connection"},t.SOCKS_INCOMING_PACKET_SIZES={Socks5InitialHandshakeResponse:2,Socks5UserPassAuthenticationResponse:2,Socks5ResponseHeader:5,Socks5ResponseIPv4:10,Socks5ResponseIPv6:22,Socks5ResponseHostname:e=>e+7,Socks4Response:8},function(e){e[e.connect=1]="connect",e[e.bind=2]="bind",e[e.associate=3]="associate"}(s||(t.SocksCommand=s={})),function(e){e[e.Granted=90]="Granted",e[e.Failed=91]="Failed",e[e.Rejected=92]="Rejected",e[e.RejectedIdent=93]="RejectedIdent"}(r||(t.Socks4Response=r={})),function(e){e[e.NoAuth=0]="NoAuth",e[e.GSSApi=1]="GSSApi",e[e.UserPass=2]="UserPass"}(i||(t.Socks5Auth=i={})),t.SOCKS5_CUSTOM_AUTH_START=128,t.SOCKS5_CUSTOM_AUTH_END=254,t.SOCKS5_NO_ACCEPTABLE_AUTH=255,function(e){e[e.Granted=0]="Granted",e[e.Failure=1]="Failure",e[e.NotAllowed=2]="NotAllowed",e[e.NetworkUnreachable=3]="NetworkUnreachable",e[e.HostUnreachable=4]="HostUnreachable",e[e.ConnectionRefused=5]="ConnectionRefused",e[e.TTLExpired=6]="TTLExpired",e[e.CommandNotSupported=7]="CommandNotSupported",e[e.AddressNotSupported=8]="AddressNotSupported"}(o||(t.Socks5Response=o={})),function(e){e[e.IPv4=1]="IPv4",e[e.Hostname=3]="Hostname",e[e.IPv6=4]="IPv6"}(a||(t.Socks5HostType=a={})),function(e){e[e.Created=0]="Created",e[e.Connecting=1]="Connecting",e[e.Connected=2]="Connected",e[e.SentInitialHandshake=3]="SentInitialHandshake",e[e.ReceivedInitialHandshakeResponse=4]="ReceivedInitialHandshakeResponse",e[e.SentAuthentication=5]="SentAuthentication",e[e.ReceivedAuthenticationResponse=6]="ReceivedAuthenticationResponse",e[e.SentFinalHandshake=7]="SentFinalHandshake",e[e.ReceivedFinalResponse=8]="ReceivedFinalResponse",e[e.BoundWaitingForConnection=9]="BoundWaitingForConnection",e[e.Established=10]="Established",e[e.Disconnected=11]="Disconnected",e[e.Error=99]="Error"}(l||(t.SocksClientState=l={}))},41340:(e,t,s)=>{"use strict";let{decodePath:r,encodePath:i,normalizePath:o}=s(80876),{specialUse:a}=s(2894);e.exports=async(e,t,s,l)=>{let h;l=l||{};let u=["\\Inbox","\\Flagged","\\Sent","\\Drafts","\\All","\\Archive","\\Junk","\\Trash"],c=["user","extension","name"],d=e.capabilities.has("XLIST")&&!e.capabilities.has("SPECIAL-USE")?"XLIST":"LIST";try{let h=[],p=new Map,f=[],g=[];l.statusQuery&&Object.keys(l.statusQuery||{}).forEach(t=>{if(l.statusQuery[t])switch(t.toUpperCase()){case"MESSAGES":case"RECENT":case"UIDNEXT":case"UIDVALIDITY":case"UNSEEN":g.push({type:"ATOM",value:t.toUpperCase()});break;case"HIGHESTMODSEQ":e.capabilities.has("CONDSTORE")&&g.push({type:"ATOM",value:t.toUpperCase()})}}),"LIST"===d&&e.capabilities.has("LIST-STATUS")&&g.length&&(f.push({type:"ATOM",value:"STATUS"},g),e.capabilities.has("SPECIAL-USE")&&f.push({type:"ATOM",value:"SPECIAL-USE"}));let m={},y=(e,t,s)=>{m[t]||(m[t]=[]),m[t].push({entry:e,source:s})},b={};if(l.specialUseHints&&"object"==typeof l.specialUseHints)for(let t of Object.keys(l.specialUseHints))["sent","junk","trash","drafts","archive"].includes(t)&&l.specialUseHints[t]&&"string"==typeof l.specialUseHints[t]&&(b[o(e,l.specialUseHints[t])]=`\\${t.replace(/^./,e=>e.toUpperCase())}`);let S=async(t,s)=>{let l=[i(e,t),i(e,s)];f.length&&l.push({type:"ATOM",value:"RETURN"},f),(await e.exec(d,l,{untagged:{[d]:async t=>{if(!t.attributes||!t.attributes.length)return;let s={path:o(e,r(e,t.attributes[2]&&t.attributes[2].value||"")),pathAsListed:t.attributes[2]&&t.attributes[2].value||"",flags:new Set(t.attributes[0].map(e=>e.value)),delimiter:t.attributes[1]&&t.attributes[1].value,listed:!0};b[s.path]&&y(s,b[s.path],"user"),"XLIST"===d&&s.flags.has("\\Inbox")&&(s.flags.delete("\\Inbox"),"INBOX"!==s.path&&y(s,"\\Inbox","extension")),"INBOX"===s.path.toUpperCase()&&y(s,"\\Inbox","name"),s.delimiter&&s.path.charAt(0)===s.delimiter&&(s.path=s.path.slice(1)),s.parentPath=s.delimiter&&s.path?s.path.substr(0,s.path.lastIndexOf(s.delimiter)):"",s.parent=s.delimiter?s.path.split(s.delimiter):[s.path],s.name=s.parent.pop();let{flag:i,source:l}=a(e.capabilities.has("XLIST")||e.capabilities.has("SPECIAL-USE"),s);i&&y(s,i,l),h.push(s)},STATUS:async t=>{let s,i=o(e,r(e,t.attributes[0]&&t.attributes[0].value||"")),a=!!(t.attributes&&Array.isArray(t.attributes[1]))&&t.attributes[1];if(!a||!i)return;let l={path:i};a.forEach((e,t)=>{if(t%2==0){s=!!e&&"string"==typeof e.value&&e.value;return}if(!s||!e||"string"!=typeof e.value)return;let r=!1;switch(s.toUpperCase()){case"MESSAGES":s="messages",r=!isNaN(e.value)&&Number(e.value);break;case"RECENT":s="recent",r=!isNaN(e.value)&&Number(e.value);break;case"UIDNEXT":s="uidNext",r=!isNaN(e.value)&&Number(e.value);break;case"UIDVALIDITY":s="uidValidity",r=!isNaN(e.value)&&BigInt(e.value);break;case"UNSEEN":s="unseen",r=!isNaN(e.value)&&Number(e.value);break;case"HIGHESTMODSEQ":s="highestModseq",r=!isNaN(e.value)&&BigInt(e.value)}!1!==r&&(l[s]=r)}),p.set(i,l)}}})).next()},E=o(e,t||"");if(await S(E,o(e,s||"",!0)),l.listOnly)return h;if(E&&!m["\\Inbox"]&&await S("","INBOX"),l.statusQuery){for(let t of h)if(!t.flags.has("\\Noselect")&&!t.flags.has("\\NonExistent")){if(p.has(t.path))t.status=p.get(t.path);else if(!p.size)try{t.status=await e.run("STATUS",t.path,l.statusQuery)}catch(e){t.status={error:e}}}}for(let a of((await e.exec("LSUB",[i(e,o(e,t||"")),i(e,o(e,s||"",!0))],{untagged:{LSUB:async t=>{if(!t.attributes||!t.attributes.length)return;let s={path:o(e,r(e,t.attributes[2]&&t.attributes[2].value||"")),pathAsListed:t.attributes[2]&&t.attributes[2].value||"",flags:new Set(t.attributes[0].map(e=>e.value)),delimiter:t.attributes[1]&&t.attributes[1].value,subscribed:!0};"INBOX"===s.path.toUpperCase()&&y(s,"\\Inbox","name"),s.delimiter&&s.path.charAt(0)===s.delimiter&&(s.path=s.path.slice(1)),s.parentPath=s.delimiter&&s.path?s.path.substr(0,s.path.lastIndexOf(s.delimiter)):"",s.parent=s.delimiter?s.path.split(s.delimiter):[s.path],s.name=s.parent.pop();let i=h.find(e=>e.path===s.path);i&&(i.subscribed=!0,s.flags.forEach(e=>i.flags.add(e)))}}})).next(),Object.keys(m))){let e=m[a].sort((e,t)=>{let s=c.indexOf(e.source),r=c.indexOf(t.source);return s===r?e.entry.path.localeCompare(t.entry.path):s-r});e[0].entry.specialUse||(e[0].entry.specialUse=a,e[0].entry.specialUseSource=e[0].source)}let v=h.find(e=>"\\Inbox"===e.specialUse);return v&&!v.subscribed&&(v.subscribed=!0),h.sort((e,t)=>{if(e.specialUse&&!t.specialUse)return -1;if(!e.specialUse&&t.specialUse)return 1;if(e.specialUse&&t.specialUse)return u.indexOf(e.specialUse)-u.indexOf(t.specialUse);let s=[].concat(e.parent).concat(e.name),r=[].concat(t.parent).concat(t.name);for(let e=0;e<s.length;e++){let t=s[e],i=r[e];if(t!==i)return t.localeCompare(i||"")}return e.path.localeCompare(t.path)})}catch(t){throw e.log.warn({msg:"Failed to list folders",err:t,cid:e.id}),t}}},42168:e=>{"use strict";e.exports=async e=>{if(!e.capabilities.has("COMPRESS=DEFLATE")||e._inflate)return!1;try{return(await e.exec("COMPRESS",[{type:"ATOM",value:"DEFLATE"}])).next(),!0}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},45648:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shuffleArray=t.SocksClientError=void 0;class s extends Error{constructor(e,t){super(e),this.options=t}}t.SocksClientError=s,t.shuffleArray=function(e){for(let t=e.length-1;t>0;t--){let s=Math.floor(Math.random()*(t+1));[e[t],e[s]]=[e[s],e[t]]}}},46522:e=>{"use strict";function t(e,t){return null!=e&&("hasOwn"in Object?Object.hasOwn(e,t):Object.prototype.hasOwnProperty.call(e,t))}function s(e,t){for(var s=-1,r=t.length,i=e;null!=i&&++s<r;)i=i[t[s]];return i}function r(e,t,s){if(e.depth===s)return r(e.parent,t,s);var i={parent:e,key:t,depth:s,children:[]};return e.children.push(i),i}function i(e,t,s){let r=e,i=[];do i.push(r.key),r=r.parent;while(null!=r.parent);return{path:i,value:t,target:s}}e.exports={groupRedact:function(e,t,r,i,o){let a=s(e,t);if(null==a||"string"==typeof a)return{keys:null,values:null,target:a,flat:!0};let l=Object.keys(a),h=l.length,u=t.length,c=o?[...t]:void 0,d=Array(h);for(var p=0;p<h;p++){let e=l[p];d[p]=a[e],o?(c[u]=e,a[e]=r(a[e],c)):i?a[e]=r(a[e]):a[e]=r}return{keys:l,values:d,target:a,flat:!0}},groupRestore:function({keys:e,values:t,target:s}){if(null==s||"string"==typeof s)return;let r=e.length;for(var i=0;i<r;i++)s[e[i]]=t[i]},nestedRedact:function(e,o,a,l,h,u,c){let d=s(o,a);if(null==d)return;let p=Object.keys(d),f=p.length;for(var g=0;g<f;g++)!function(e,s,o,a,l,h,u,c){let d=l.length,p=d-1,f=o;var g,m,y,b,S,E=-1,v=null,w=null,T=!1,I=0,k=0,C={parent:null,key:null,children:[],depth:0};if(y=g=s[o],"object"==typeof g){for(;null!=g&&++E<d&&(k+=1,o=l[E],"*"===o||w||"object"==typeof g&&o in g);)if("*"!==o||("*"===w&&(T=!0),w=o,E===p)){if(w){let d=Object.keys(g);for(var A=0;A<d.length;A++){let v=d[A];if(S=g[v],b="*"===o,T)C=r(C,v,k),y=function e(s,o,a,l,h,u,c,d,p,f,g,m,y,b,S,E,v,w,T,I){if(0===o&&(y||"object"==typeof s&&null!==s&&a in s))if(m=y?s:s[a],g=S!==E?m:c?d?u(m,[...l,p,...h]):u(m):u,y){let e=i(v,m,T);w.push(e),f[b]=g}else if(s[a]===g);else if(void 0===g&&void 0!==u||t(s,a)&&g===m);else{let e=i(r(v,a,I+1),m,T);w.push(e),s[a]=g}for(let t in s)"object"==typeof s[t]&&(v=r(v,t,I),e(s[t],o-1,a,l,h,u,c,d,p,f,g,m,y,b,S,E,v,w,T,I+1))}(S,E-1,o,a,l,h,u,c,f,g,m,y,b,v,E,p,C,e,s[f],k+1);else if(b||"object"==typeof S&&null!==S&&o in S)if(y=b?S:S[o],m=E!==p?y:u?c?h(y,[...a,f,...l]):h(y):h,b){let t=i(r(C,v,k),y,s[f]);e.push(t),g[v]=m}else if(S[o]===m);else if(void 0===m&&void 0!==h||t(S,o)&&m===y)C=r(C,v,k);else{C=r(C,v,k);let t=i(r(C,o,k+1),y,s[f]);e.push(t),S[o]=m}}w=null}else{if(y=g[o],C=r(C,o,k),m=E!==p?y:u?c?h(y,[...a,f,...l]):h(y):h,t(g,o)&&m===y||void 0===m&&void 0!==h);else{let t=i(C,y,s[f]);e.push(t),g[o]=m}g=g[o]}if("object"!=typeof g)break}}}(e,d,p[g],a,l,h,u,c);return e},nestedRestore:function(e){for(let t=0;t<e.length;t++){let{target:s,path:r,value:i}=e[t],o=s;for(let e=r.length-1;e>0;e--)o=o[r[e]];o[r[0]]=i}}}},47595:(e,t,s)=>{"use strict";e.exports=function e(t){if(!o(t))return t;t[h]=void 0;let s=Object.create(a);for(let a in s.type="[object Function]"===u.call(t.constructor)?t.constructor.name:t.name,s.message=r(t),s.stack=i(t),Array.isArray(t.errors)&&(s.aggregateErrors=t.errors.map(t=>e(t))),t)if(void 0===s[a]){let r=t[a];o(r)?"cause"===a||Object.prototype.hasOwnProperty.call(r,h)||(s[a]=e(r)):s[a]=r}return delete t[h],s.raw=t,s};let{messageWithCauses:r,stackWithCauses:i,isErrorLike:o}=s(98539),{pinoErrProto:a,pinoErrorSymbols:l}=s(83360),{seen:h}=l,{toString:u}=Object.prototype},48587:(e,t,s)=>{"use strict";let r=s(27910).Transform,i=s(25635);class o extends r{constructor(e){super({readableObjectMode:!0,writableObjectMode:!1}),this.config=e||{},this.maxHeadSize=this.config.maxHeadSize||1048576,this.maxChildNodes=this.config.maxChildNodes||1e3,this.tree=[],this.nodeCounter=0,this.newNode(),this.tree.push(this.node),this.line=!1,this.hasFailed=!1}_transform(e,t,s){let r=0,i=0,o={type:"none"},a=this.line?-this.line.length:0,l=0,h=e=>{"body"===e.type&&e.node.parentNode&&e.value&&e.value.length&&(10===e.value[e.value.length-1]?(a--,l--,r--,e.value.length>1&&13===e.value[e.value.length-2]?(a--,l--,r--,a<0&&!this.line&&(this.line=Buffer.allocUnsafe(1),this.line[0]=13),e.value=e.value.slice(0,e.value.length-2)):e.value=e.value.slice(0,e.value.length-1)):13===e.value[e.value.length-1]&&(a--,l--,r--,e.value=e.value.slice(0,e.value.length-1)))},u=()=>{for(let t=e.length;i<t;i++)if(10===e[i]){let t=Math.max(r,0);return r=++i,this.processLine(e.slice(t,i),!1,(t,r,c)=>t?(this.hasFailed=!0,setImmediate(()=>s(t))):(r&&(c?(o&&"none"!==o.type&&("body"===o.type&&l>=a&&o.node.parentNode&&10===e[l-1]&&--l>=a&&13===e[l-1]&&l--,a!==l&&(o.value=e.slice(a,l),l<i&&(r.value=e.slice(l,i))),this.push(o),o={type:"none"},a=l=i),this.push(r),l=i):r.type===o.type?l=i:("body"===o.type&&l>=a&&o.node.parentNode&&10===e[l-1]&&--l>=a&&13===e[l-1]&&l--,"none"!==o.type&&"node"!==o.type&&a!==l&&(o.value=e.slice(a,l),o.value&&o.value.length&&(this.push(o),o={type:"none"})),"node"===r.type?(this.push(r),a=i,l=i):a<0?(a=i,l=i,h(r),r.value&&r.value.length&&this.push(r)):(o=r,a=l,l=i))),setImmediate(u)))}r>=a+1&&"body"===o.type&&o.node.parentNode&&10===e[r-1]&&--r>=a&&13===e[r-1]&&r--,"none"!==o.type&&"node"!==o.type&&r>a&&(o.value=e.slice(a,r),o.value&&o.value.length&&(this.push(o),o={type:"none"})),r<e.length&&(this.line?this.line=Buffer.concat([this.line,e.slice(r)]):this.line=e.slice(r)),s()};setImmediate(u)}_flush(e){if(this.hasFailed)return e();this.processLine(!1,!0,(t,s)=>{if(t)return setImmediate(()=>e(t));s&&("node"===s.type||s.value&&s.value.length)&&this.push(s),e()})}compareBoundary(e,t,s){if(e.length<s.length+3+t||e.length>s.length+6+t)return!1;for(let r=0;r<s.length;r++)if(e[r+2+t]!==s[r])return!1;let r=0;for(let i=s.length+2+t;i<e.length;i++){let t=e[i];if(0===r&&(13===t||10===t))return 1;if(0===r&&45!==t||1===r&&45!==t||2===r&&13!==t&&10!==t||3===r&&10!==t)return!1;r++}return 2}checkBoundary(e){let t,s=0;return e.length>=1&&(13===e[0]||10===e[0])&&(s++,e.length>=2&&(13===e[0]||10===e[1])&&s++),!(e.length<4)&&45===e[s]&&45===e[s+1]&&(this.node._boundary&&(t=this.compareBoundary(e,s,this.node._boundary))?t:!!(this.node._parentBoundary&&(t=this.compareBoundary(e,s,this.node._parentBoundary)))&&t+2)}processLine(e,t,s){let r=!1;if(this.line&&e?(e=Buffer.concat([this.line,e]),this.line=!1):this.line&&!e&&(e=this.line,this.line=!1),e||(e=Buffer.alloc(0)),this.nodeCounter>this.maxChildNodes){let e=Error("Max allowed child nodes exceeded");return e.code="EMAXLEN",s(e)}let i=this.checkBoundary(e);if(i){switch(i){case 1:this.newNode(this.node),r=!0;break;case 2:break;case 3:{let e=this.node.parentNode;e&&"message/rfc822"===e.contentType&&(e=e.parentNode),this.newNode(e),r=!0;break}case 4:this.node&&this.node._headerlen&&!this.node.headers&&(this.node.parseHeaders(),this.push(this.node)),this.tree.length&&(this.node=this.tree.pop()),this.state=2}return s(null,{node:this.node,type:"data",value:e},r)}switch(this.state){case 1:if(this.node.addHeaderChunk(e),this.node._headerlen>this.maxHeadSize){let e=Error("Max header size for a MIME node exceeded");return e.code="EMAXLEN",s(e)}if(t||1===e.length&&10===e[0]||2===e.length&&13===e[0]&&10===e[1]){let e=this.node;return e.parseHeaders(),"message/rfc822"===e.contentType&&!this.config.ignoreEmbedded&&(!e.encoding||["7bit","8bit","binary"].includes(e.encoding))&&(this.config.defaultInlineEmbedded?"attachment"!==e.disposition:"inline"===e.disposition)?(e.messageNode=!0,this.newNode(e),e.parentNode&&(this.node._parentBoundary=e.parentNode._boundary)):("message/rfc822"===e.contentType&&(e.messageNode=!1),this.state=2,e.multipart&&e._boundary&&this.tree.push(e)),s(null,e,r)}return s();case 2:return s(null,{node:this.node,type:this.node.multipart?"data":"body",value:e},r)}s(null,!1)}newNode(e){this.node=new i(e||!1,this.config),this.state=1,this.nodeCounter++}}e.exports=o},49504:(e,t,s)=>{"use strict";let r=s(48587),i=s(5743),o=s(76013);e.exports={Splitter:r,Joiner:i,Rewriter:o,Streamer:s(32672),Headers:s(81866)}},49877:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RE_SUBNET_STRING=t.RE_ADDRESS=t.GROUPS=t.BITS=void 0,t.BITS=32,t.GROUPS=4,t.RE_ADDRESS=/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/g,t.RE_SUBNET_STRING=/\/\d{1,2}$/},51677:e=>{"use strict";e.exports=async e=>{if(!e.capabilities.has("STARTTLS")||e.secureConnection)return!1;try{return(await e.exec("STARTTLS")).next(),!0}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},53351:(e,t)=>{"use strict";let{hasOwnProperty:s}=Object.prototype,r=p();r.configure=p,r.stringify=r,r.default=r,t.stringify=r,t.configure=p,e.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function a(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let s=e[t],r=t;for(;0!==r&&e[r-1]>s;)e[r]=e[r-1],r--;e[r]=s}return e}let l=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function h(e){return void 0!==l.call(e)&&0!==e.length}function u(e,t,s){e.length<s&&(s=e.length);let r=","===t?"":" ",i=`"0":${r}${e[0]}`;for(let o=1;o<s;o++)i+=`${t}"${o}":${r}${e[o]}`;return i}function c(e,t){let r;if(s.call(e,t)){if("number"!=typeof(r=e[t]))throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return void 0===r?1/0:r}function d(e){return 1===e?"1 item":`${e} items`}function p(e){let t=function(e){if(s.call(e,"strict")){let t=e.strict;if("boolean"!=typeof t)throw TypeError('The "strict" argument must be of type boolean');if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw"function"!=typeof e&&(t+=` (${e.toString()})`),Error(t)}}}(e={...e});t&&(void 0===e.bigint&&(e.bigint=!1),"circularValue"in e||(e.circularValue=Error));let r=function(e){if(s.call(e,"circularValue")){let t=e.circularValue;if("string"==typeof t)return`"${t}"`;if(null==t)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError("Converting circular structure to JSON")}};throw TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}(e),i=function(e,t){let r;if(s.call(e,t)&&"boolean"!=typeof(r=e[t]))throw TypeError(`The "${t}" argument must be of type boolean`);return void 0===r||r}(e,"bigint"),l=function(e){let t;if(s.call(e,"deterministic")&&"boolean"!=typeof(t=e.deterministic)&&"function"!=typeof t)throw TypeError('The "deterministic" argument must be of type boolean or comparator function');return void 0===t||t}(e),p="function"==typeof l?l:void 0,f=c(e,"maximumDepth"),g=c(e,"maximumBreadth");return function(e,s,c){if(arguments.length>1){let m="";if("number"==typeof c?m=" ".repeat(Math.min(c,10)):"string"==typeof c&&(m=c.slice(0,10)),null!=s){if("function"==typeof s)return function e(s,u,c,m,y,b){let S=u[s];switch("object"==typeof S&&null!==S&&"function"==typeof S.toJSON&&(S=S.toJSON(s)),typeof(S=m.call(u,s,S))){case"string":return o(S);case"object":{if(null===S)return"null";if(-1!==c.indexOf(S))return r;let t="",s=",",i=b;if(Array.isArray(S)){if(0===S.length)return"[]";if(f<c.length+1)return'"[Array]"';c.push(S),""!==y&&(b+=y,t+=`
${b}`,s=`,
${b}`);let r=Math.min(S.length,g),o=0;for(;o<r-1;o++){let r=e(String(o),S,c,m,y,b);t+=void 0!==r?r:"null",t+=s}let a=e(String(o),S,c,m,y,b);if(t+=void 0!==a?a:"null",S.length-1>g){let e=S.length-g-1;t+=`${s}"... ${d(e)} not stringified"`}return""!==y&&(t+=`
${i}`),c.pop(),`[${t}]`}let u=Object.keys(S),E=u.length;if(0===E)return"{}";if(f<c.length+1)return'"[Object]"';let v="",w="";""!==y&&(b+=y,s=`,
${b}`,v=" ");let T=Math.min(E,g);l&&!h(S)&&(u=a(u,p)),c.push(S);for(let r=0;r<T;r++){let i=u[r],a=e(i,S,c,m,y,b);void 0!==a&&(t+=`${w}${o(i)}:${v}${a}`,w=s)}return E>g&&(t+=`${w}"...":${v}"${d(E-g)} not stringified"`,w=s),""!==y&&w.length>1&&(t=`
${b}${t}
${i}`),c.pop(),`{${t}}`}case"number":return isFinite(S)?String(S):t?t(S):"null";case"boolean":return!0===S?"true":"false";case"undefined":return;case"bigint":if(i)return String(S);default:return t?t(S):void 0}}("",{"":e},[],s,m,"");if(Array.isArray(s))return function e(s,a,l,h,u,c){switch("object"==typeof a&&null!==a&&"function"==typeof a.toJSON&&(a=a.toJSON(s)),typeof a){case"string":return o(a);case"object":{if(null===a)return"null";if(-1!==l.indexOf(a))return r;let t=c,s="",i=",";if(Array.isArray(a)){if(0===a.length)return"[]";if(f<l.length+1)return'"[Array]"';l.push(a),""!==u&&(c+=u,s+=`
${c}`,i=`,
${c}`);let r=Math.min(a.length,g),o=0;for(;o<r-1;o++){let t=e(String(o),a[o],l,h,u,c);s+=void 0!==t?t:"null",s+=i}let p=e(String(o),a[o],l,h,u,c);if(s+=void 0!==p?p:"null",a.length-1>g){let e=a.length-g-1;s+=`${i}"... ${d(e)} not stringified"`}return""!==u&&(s+=`
${t}`),l.pop(),`[${s}]`}l.push(a);let p="";""!==u&&(c+=u,i=`,
${c}`,p=" ");let m="";for(let t of h){let r=e(t,a[t],l,h,u,c);void 0!==r&&(s+=`${m}${o(t)}:${p}${r}`,m=i)}return""!==u&&m.length>1&&(s=`
${c}${s}
${t}`),l.pop(),`{${s}}`}case"number":return isFinite(a)?String(a):t?t(a):"null";case"boolean":return!0===a?"true":"false";case"undefined":return;case"bigint":if(i)return String(a);default:return t?t(a):void 0}}("",e,[],function(e){let t=new Set;for(let s of e)("string"==typeof s||"number"==typeof s)&&t.add(String(s));return t}(s),m,"")}if(0!==m.length)return function e(s,c,m,y,b){switch(typeof c){case"string":return o(c);case"object":{if(null===c)return"null";if("function"==typeof c.toJSON){if("object"!=typeof(c=c.toJSON(s)))return e(s,c,m,y,b);if(null===c)return"null"}if(-1!==m.indexOf(c))return r;let t=b;if(Array.isArray(c)){if(0===c.length)return"[]";if(f<m.length+1)return'"[Array]"';m.push(c),b+=y;let s=`
${b}`,r=`,
${b}`,i=Math.min(c.length,g),o=0;for(;o<i-1;o++){let t=e(String(o),c[o],m,y,b);s+=void 0!==t?t:"null",s+=r}let a=e(String(o),c[o],m,y,b);if(s+=void 0!==a?a:"null",c.length-1>g){let e=c.length-g-1;s+=`${r}"... ${d(e)} not stringified"`}return s+=`
${t}`,m.pop(),`[${s}]`}let i=Object.keys(c),S=i.length;if(0===S)return"{}";if(f<m.length+1)return'"[Object]"';b+=y;let E=`,
${b}`,v="",w="",T=Math.min(S,g);h(c)&&(v+=u(c,E,g),i=i.slice(c.length),T-=c.length,w=E),l&&(i=a(i,p)),m.push(c);for(let t=0;t<T;t++){let s=i[t],r=e(s,c[s],m,y,b);void 0!==r&&(v+=`${w}${o(s)}: ${r}`,w=E)}return S>g&&(v+=`${w}"...": "${d(S-g)} not stringified"`,w=E),""!==w&&(v=`
${b}${v}
${t}`),m.pop(),`{${v}}`}case"number":return isFinite(c)?String(c):t?t(c):"null";case"boolean":return!0===c?"true":"false";case"undefined":return;case"bigint":if(i)return String(c);default:return t?t(c):void 0}}("",e,[],m,"")}return function e(s,c,m){switch(typeof c){case"string":return o(c);case"object":{if(null===c)return"null";if("function"==typeof c.toJSON){if("object"!=typeof(c=c.toJSON(s)))return e(s,c,m);if(null===c)return"null"}if(-1!==m.indexOf(c))return r;let t="",i=void 0!==c.length;if(i&&Array.isArray(c)){if(0===c.length)return"[]";if(f<m.length+1)return'"[Array]"';m.push(c);let s=Math.min(c.length,g),r=0;for(;r<s-1;r++){let s=e(String(r),c[r],m);t+=void 0!==s?s:"null",t+=","}let i=e(String(r),c[r],m);if(t+=void 0!==i?i:"null",c.length-1>g){let e=c.length-g-1;t+=`,"... ${d(e)} not stringified"`}return m.pop(),`[${t}]`}let y=Object.keys(c),b=y.length;if(0===b)return"{}";if(f<m.length+1)return'"[Object]"';let S="",E=Math.min(b,g);i&&h(c)&&(t+=u(c,",",g),y=y.slice(c.length),E-=c.length,S=","),l&&(y=a(y,p)),m.push(c);for(let s=0;s<E;s++){let r=y[s],i=e(r,c[r],m);void 0!==i&&(t+=`${S}${o(r)}:${i}`,S=",")}return b>g&&(t+=`${S}"...":"${d(b-g)} not stringified"`),m.pop(),`{${t}}`}case"number":return isFinite(c)?String(c):t?t(c):"null";case"boolean":return!0===c?"true":"false";case"undefined":return;case"bigint":if(i)return String(c);default:return t?t(c):void 0}}("",e,[])}}},53767:e=>{"use strict";e.exports={nullTime:()=>"",epochTime:()=>`,"time":${Date.now()}`,unixTime:()=>`,"time":${Math.round(Date.now()/1e3)}`,isoTime:()=>`,"time":"${new Date(Date.now()).toISOString()}"`}},54148:e=>{"use strict";e.exports={mapHttpRequest:function(e){return{req:r(e)}},reqSerializer:r};let t=Symbol("pino-raw-req-ref"),s=Object.create({},{id:{enumerable:!0,writable:!0,value:""},method:{enumerable:!0,writable:!0,value:""},url:{enumerable:!0,writable:!0,value:""},query:{enumerable:!0,writable:!0,value:""},params:{enumerable:!0,writable:!0,value:""},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:""},remotePort:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[t]},set:function(e){this[t]=e}}});function r(e){let t=e.info||e.socket,r=Object.create(s);if(r.id="function"==typeof e.id?e.id():e.id||(e.info?e.info.id:void 0),r.method=e.method,e.originalUrl)r.url=e.originalUrl;else{let t=e.path;r.url="string"==typeof t?t:e.url?e.url.path||e.url:void 0}return e.query&&(r.query=e.query),e.params&&(r.params=e.params),r.headers=e.headers,r.remoteAddress=t&&t.remoteAddress,r.remotePort=t&&t.remotePort,r.raw=e.raw||e,r}Object.defineProperty(s,t,{writable:!0,value:{}})},54406:(e,t,s)=>{"use strict";let{formatMessageResponse:r}=s(80876);e.exports=async(e,t,s,i)=>{if(e.state!==e.states.SELECTED||!t)return;i=i||{};let o=e.mailbox,a=e.capabilities.has("BINARY")&&i.binary&&!e.disableBinary?"BINARY":"BODY",l=0;for(;l<4;){let h={count:0,list:[]};try{let l=[{type:"SEQUENCE",value:(t||"*").toString()}],u=[],c=(e,t)=>{let s={type:"ATOM",value:`${a}.PEEK`,section:[],partial:t};Array.isArray(e)?e.forEach(e=>{s.section.push(e)}):e&&s.section.push(e),u.push(s)};if(["all","fast","full","uid","flags","bodyStructure","envelope","internalDate"].forEach(e=>{s[e]&&u.push({type:"ATOM",value:e.toUpperCase()})}),s.size&&u.push({type:"ATOM",value:"RFC822.SIZE"}),s.source){let e;"object"==typeof s.source&&(s.source.start||s.source.maxLength)&&(e=[Number(s.source.start)||0],s.source.maxLength&&!isNaN(s.source.maxLength)&&e.push(Number(s.source.maxLength))),u.push({type:"ATOM",value:`${a}.PEEK`,section:[],partial:e})}if(e.capabilities.has("OBJECTID")?u.push({type:"ATOM",value:"EMAILID"}):e.capabilities.has("X-GM-EXT-1")&&u.push({type:"ATOM",value:"X-GM-MSGID"}),s.threadId&&(e.capabilities.has("OBJECTID")?u.push({type:"ATOM",value:"THREADID"}):e.capabilities.has("X-GM-EXT-1")&&u.push({type:"ATOM",value:"X-GM-THRID"})),s.labels&&e.capabilities.has("X-GM-EXT-1")&&u.push({type:"ATOM",value:"X-GM-LABELS"}),e.enabled.has("CONDSTORE")&&!o.noModseq&&u.push({type:"ATOM",value:"MODSEQ"}),s.uid||u.push({type:"ATOM",value:"UID"}),s.headers&&(Array.isArray(s.headers)?c([{type:"ATOM",value:"HEADER.FIELDS"},s.headers.map(e=>({type:"ATOM",value:e}))]):c({type:"ATOM",value:"HEADER"})),s.bodyParts&&s.bodyParts.length&&s.bodyParts.forEach(e=>{let t,s;if(e){if("object"==typeof e){if(!e.key||"string"!=typeof e.key)return;t=e.key.toUpperCase(),(e.start||e.maxLength)&&(s=[Number(e.start)||0],e.maxLength&&!isNaN(e.maxLength)&&s.push(Number(e.maxLength)))}else{if("string"!=typeof e)return;t=e.toUpperCase()}c({type:"ATOM",value:t},s)}}),1===u.length&&(u=u.pop()),l.push(u),i.changedSince&&e.enabled.has("CONDSTORE")&&!o.noModseq){let t=[{type:"ATOM",value:"CHANGEDSINCE"},{type:"ATOM",value:i.changedSince.toString()}];i.uid&&e.enabled.has("QRESYNC")&&t.push({type:"ATOM",value:"VANISHED"}),l.push(t)}return(await e.exec(i.uid?"UID FETCH":"FETCH",l,{untagged:{FETCH:async e=>{h.count++;let t=await r(e,o);"function"==typeof i.onUntaggedFetch?await new Promise((e,s)=>{i.onUntaggedFetch(t,t=>{t?s(t):e()})}):h.list.push(t)}}})).next(),h}catch(t){if("ETHROTTLE"===t.code){e.log.warn({msg:"Retrying throttled request",cid:e.id,code:t.code,response:t.responseText,throttleReset:t.throttleReset,retryCount:l}),l++;continue}throw e.log.warn({err:t,cid:e.id}),t}}}},56512:e=>{"use strict";e.exports=async e=>{try{return(await e.exec("NOOP",!1,{comment:"Requested by command"})).next(),!0}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},56640:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.possibleElisions=t.simpleRegularExpression=t.ADDRESS_BOUNDARY=t.padGroup=t.groupPossibilities=void 0;let a=o(s(36831)),l=s(18421);function h(e){return(0,l.sprintf)("(%s)",e.join("|"))}function u(e){return e.length<4?(0,l.sprintf)("0{0,%d}%s",4-e.length,e):e}t.groupPossibilities=h,t.padGroup=u,t.ADDRESS_BOUNDARY="[^A-Fa-f0-9:]",t.simpleRegularExpression=function(e){let t=[];e.forEach((e,s)=>{0===parseInt(e,16)&&t.push(s)});let s=t.map(t=>e.map((e,s)=>{if(s===t){let t=0===s||s===a.GROUPS-1?":":"";return h([u(e),t])}return u(e)}).join(":"));return s.push(e.map(u).join(":")),h(s)},t.possibleElisions=function(e,t,s){let r=[];t||s||r.push("::"),t&&s&&r.push(""),(s&&!t||!s&&t)&&r.push(":"),r.push((0,l.sprintf)("%s(:0{1,4}){1,%d}",t?"":":",e-1)),r.push((0,l.sprintf)("(0{1,4}:){1,%d}%s",e-1,s?"":":")),r.push((0,l.sprintf)("(0{1,4}:){%d}0{1,4}",e-1));for(let t=1;t<e-1;t++)for(let s=1;s<e-t;s++)r.push((0,l.sprintf)("(0{1,4}:){%d}:(0{1,4}:){%d}0{1,4}",s,e-s-t-1));return h(r)}},56687:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simpleGroup=t.spanLeadingZeroes=t.spanAll=t.spanAllZeroes=void 0;let r=s(18421);function i(e){return e.replace(/(0+)/g,'<span class="zero">$1</span>')}function o(e){return e.replace(/^(0+)/,'<span class="zero">$1</span>')}t.spanAllZeroes=i,t.spanAll=function(e,t=0){return e.split("").map((e,s)=>(0,r.sprintf)('<span class="digit value-%s position-%d">%s</span>',e,s+t,i(e))).join("")},t.spanLeadingZeroes=function(e){return e.split(":").map(e=>o(e)).join(":")},t.simpleGroup=function(e,t=0){return e.split(":").map((e,s)=>/group-v4/.test(e)?e:(0,r.sprintf)('<span class="hover-group group-%d">%s</span>',s+t,o(e)))}},58118:(e,t,s)=>{"use strict";let r=s(27910).Transform,i=s(48376);class o extends r{constructor(e){super(),this.config=e||{},this.chunks=[],this.chunklen=0,this.libmime=new i.Libmime({Iconv:e.Iconv})}_transform(e,t,s){if(!e||!e.length)return s();e=Buffer.from(e,t),this.chunks.push(e),this.chunklen+=e.length,s()}_flush(e){if(this.chunklen){let e=Buffer.concat(this.chunks,this.chunklen);"base64"===this.config.encoding&&(e=Buffer.from(e.toString("binary"),"base64"));let t=this.libmime.decodeFlowed(e.toString("binary"),this.config.delSp);this.push(Buffer.from(t,"binary"))}return e()}}e.exports=o},58579:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ipToBuffer=t.int32ToIpv4=t.ipv4ToInt32=t.validateSocksClientChainOptions=t.validateSocksClientOptions=void 0;let r=s(45648),i=s(40547),o=s(27910),a=s(85989),l=s(91645);function h(e,t){if(void 0!==e.custom_auth_method){if(e.custom_auth_method<i.SOCKS5_CUSTOM_AUTH_START||e.custom_auth_method>i.SOCKS5_CUSTOM_AUTH_END)throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsCustomAuthRange,t);if(void 0===e.custom_auth_request_handler||"function"!=typeof e.custom_auth_request_handler||void 0===e.custom_auth_response_size||void 0===e.custom_auth_response_handler||"function"!=typeof e.custom_auth_response_handler)throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsCustomAuthOptions,t)}}function u(e){return e&&"string"==typeof e.host&&"number"==typeof e.port&&e.port>=0&&e.port<=65535}function c(e){return e&&("string"==typeof e.host||"string"==typeof e.ipaddress)&&"number"==typeof e.port&&e.port>=0&&e.port<=65535&&(4===e.type||5===e.type)}function d(e){return"number"==typeof e&&e>0}t.validateSocksClientOptions=function(e,t=["connect","bind","associate"]){if(!i.SocksCommand[e.command])throw new r.SocksClientError(i.ERRORS.InvalidSocksCommand,e);if(-1===t.indexOf(e.command))throw new r.SocksClientError(i.ERRORS.InvalidSocksCommandForOperation,e);if(!u(e.destination))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsDestination,e);if(!c(e.proxy))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsProxy,e);if(h(e.proxy,e),e.timeout&&!d(e.timeout))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsTimeout,e);if(e.existing_socket&&!(e.existing_socket instanceof o.Duplex))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsExistingSocket,e)},t.validateSocksClientChainOptions=function(e){if("connect"!==e.command)throw new r.SocksClientError(i.ERRORS.InvalidSocksCommandChain,e);if(!u(e.destination))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsDestination,e);if(!(e.proxies&&Array.isArray(e.proxies)&&e.proxies.length>=2))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsProxiesLength,e);if(e.proxies.forEach(t=>{if(!c(t))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsProxy,e);h(t,e)}),e.timeout&&!d(e.timeout))throw new r.SocksClientError(i.ERRORS.InvalidSocksClientOptionsTimeout,e)},t.ipv4ToInt32=function(e){return new a.Address4(e).toArray().reduce((e,t)=>(e<<8)+t,0)},t.int32ToIpv4=function(e){return[e>>>24&255,e>>>16&255,e>>>8&255,255&e].join(".")},t.ipToBuffer=function(e){if(l.isIPv4(e)){let t=new a.Address4(e);return Buffer.from(t.toArray())}if(l.isIPv6(e)){let t=new a.Address6(e);return Buffer.from(t.canonicalForm().split(":").map(e=>e.padStart(4,"0")).join(""),"hex")}throw Error("Invalid IP address format")}},59059:(e,t,s)=>{"use strict";let r=s(30208);e.exports=function({paths:e}){let t=[];var s=0;let i=e.reduce(function(e,i,o){var a=i.match(r).map(e=>e.replace(/'|"|`/g,""));let l="["===i[0],h=(a=a.map(e=>"["===e[0]?e.substr(1,e.length-2):e)).indexOf("*");if(h>-1){let e=a.slice(0,h),r=e.join("."),i=a.slice(h+1,a.length),o=i.length>0;s++,t.push({before:e,beforeStr:r,after:i,nested:o})}else e[i]={path:a,val:void 0,precensored:!1,circle:"",escPath:JSON.stringify(i),leadingBracket:l};return e},{});return{wildcards:t,wcLen:s,secret:i}}},60612:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i,getStatusCode:o,getErrorText:a}=s(80876);e.exports=async(e,t,s)=>{let l;if(![e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state))return;if(s=s||{},t=i(e,t),!e.folders.has(t)){let s=await e.run("LIST","",t);if(!s)throw Error("Failed to fetch folders");s.forEach(t=>{e.folders.set(t.path,t)})}let h=!!e.folders.has(t)&&e.folders.get(t);try{let i={path:t};h&&["delimiter","specialUse","subscribed","listed"].forEach(e=>{h[e]&&(i[e]=h[e])});let o=[];e.enabled.has("QRESYNC")&&s.changedSince&&s.uidValidity&&(o.push([{type:"ATOM",value:"QRESYNC"},[{type:"ATOM",value:s.uidValidity?.toString()},{type:"ATOM",value:s.changedSince.toString()}]]),i.qresync=!0);let a=r(e,t),u={command:s.readOnly?"EXAMINE":"SELECT",arguments:[{type:a.indexOf("&")>=0?"STRING":"ATOM",value:a}].concat(o||[])},c=!(l=await e.exec(u.command,u.arguments,{untagged:{OK:async e=>{if(!e.attributes||!e.attributes.length)return;let t=!e.attributes[0].value&&e.attributes[0].section;if(t&&t.length>1&&"ATOM"===t[0].type&&"string"==typeof t[0].value){let e,s=t[0].value.toLowerCase();switch("string"==typeof t[1].value?e=t[1].value:Array.isArray(t[1])&&(e=t[1].map(e=>"string"==typeof e.value&&e.value).filter(e=>e)),s){case"highestmodseq":s="highestModseq",/^[0-9]+$/.test(e)&&(e=BigInt(e));break;case"mailboxid":s="mailboxId",Array.isArray(e)&&e.length&&(e=e[0]);break;case"permanentflags":s="permanentFlags",e=new Set(e);break;case"uidnext":s="uidNext",e=Number(e);break;case"uidvalidity":s="uidValidity",/^[0-9]+$/.test(e)&&(e=BigInt(e))}i[s]=e}if(t&&1===t.length&&"ATOM"===t[0].type&&"string"==typeof t[0].value){let e=t[0].value.toLowerCase();"nomodseq"===e&&(i[e="noModseq"]=!0)}},FLAGS:async e=>{if(!e.attributes||!e.attributes.length&&Array.isArray(e.attributes[0]))return;let t=e.attributes[0].map(e=>"string"==typeof e.value&&e.value).filter(e=>e);i.flags=new Set(t)},EXISTS:async e=>{let t=Number(e.command);if(isNaN(t))return!1;i.exists=t},VANISHED:async s=>{await e.untaggedVanished(s,{path:t,uidNext:!1,uidValidity:!1})},FETCH:async s=>{await e.untaggedFetch(s,{path:t,uidNext:!1,uidValidity:!1})}}})).response.attributes[0].value&&l.response.attributes[0].section;c&&c.length&&"ATOM"===c[0].type&&"string"==typeof c[0].value&&("READ-ONLY"===c[0].value.toUpperCase()?i.readOnly=!0:i.readOnly=!1),i.qresync&&(s.uidValidity!==i.uidValidity||!i.highestModseq||i.noModseq)&&(i.qresync=!1);let d=e.mailbox;return e.mailbox=!1,d&&d.path!==t&&e.emit("mailboxClose",d),e.mailbox=i,e.currentSelectCommand=u,e.state=e.states.SELECTED,d&&d.path===t||e.emit("mailboxOpen",e.mailbox),l.next(),i}catch(s){let t=o(s.response);if(t&&(s.serverResponseCode=t),s.response=await a(s.response),e.state===e.states.SELECTED){let t=e.mailbox;e.mailbox=!1,e.currentSelectCommand=!1,e.state=e.states.AUTHENTICATED,t&&e.emit("mailboxClose",t)}throw e.log.warn({err:s,cid:e.id}),s}}},60798:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i}=s(80876);e.exports=async(e,t,s)=>{if(![e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)||!t)return!1;t=i(e,t);let o=r(e,t),a=[{type:o.indexOf("&")>=0?"STRING":"ATOM",value:o}],l=[];if(Object.keys(s||{}).forEach(t=>{if(s[t])switch(t.toUpperCase()){case"MESSAGES":case"RECENT":case"UIDNEXT":case"UIDVALIDITY":case"UNSEEN":l.push({type:"ATOM",value:t.toUpperCase()});break;case"HIGHESTMODSEQ":e.capabilities.has("CONDSTORE")&&l.push({type:"ATOM",value:t.toUpperCase()})}}),!l.length)return!1;a.push(l);try{let s={path:t};return(await e.exec("STATUS",a,{untagged:{STATUS:async r=>{let i,o=e.state===e.states.SELECTED&&t===e.mailbox.path,a=!!(r.attributes&&Array.isArray(r.attributes[1]))&&r.attributes[1];a&&a.forEach((r,a)=>{if(a%2==0){i=!!r&&"string"==typeof r.value&&r.value;return}if(!i||!r||"string"!=typeof r.value)return;let l=!1;switch(i.toUpperCase()){case"MESSAGES":if(i="messages",l=!isNaN(r.value)&&Number(r.value),o){let s=e.mailbox.exists;s!==l&&(e.mailbox.exists=l,e.emit("exists",{path:t,count:l,prevCount:s}))}break;case"RECENT":i="recent",l=!isNaN(r.value)&&Number(r.value);break;case"UIDNEXT":i="uidNext",l=!isNaN(r.value)&&Number(r.value),o&&(e.mailbox.uidNext=l);break;case"UIDVALIDITY":i="uidValidity",l=!isNaN(r.value)&&BigInt(r.value);break;case"UNSEEN":i="unseen",l=!isNaN(r.value)&&Number(r.value);break;case"HIGHESTMODSEQ":i="highestModseq",l=!isNaN(r.value)&&BigInt(r.value),o&&(e.mailbox.highestModseq=l)}!1!==l&&(s[i]=l)})}}})).next(),s}catch(s){if("NO"===s.responseStatus){let r=await e.run("LIST","",t,{listOnly:!0});if(r&&!r.length){let e=Error(`Mailbox doesn't exist: ${t}`);throw e.code="NotFound",e.response=s,e}}return e.log.warn({err:s,cid:e.id}),!1}}},63653:(e,t,s)=>{"use strict";let{formatDate:r,formatFlag:i,canUseFlag:o}=s(80876),a=(e,t,s)=>{s||(t=/^un/i.test(t)?t.slice(2):"UN"+t),e.push({type:"ATOM",value:t.toUpperCase()})},l=(e,t,s,r)=>{r=r||"ATOM",(!1===s||null===s)&&e.push({type:r,value:"NOT"}),e.push({type:r,value:t.toUpperCase()}),Array.isArray(s)?s.forEach(t=>e.push({type:r,value:(t||"").toString()})):e.push({type:r,value:s.toString()})},h=(e,t,s)=>{let i=r(s);i&&l(e,t,i)},u=e=>!!e&&"string"==typeof e&&Buffer.byteLength(e)!==e.length;e.exports.searchCompiler=(e,t)=>{let s=[],r=!1,c=e.mailbox,d=t=>{Object.keys(t||{}).forEach(p=>{switch(p.toUpperCase()){case"SEQ":{let e=t[p];"number"==typeof e&&(e=e.toString()),"string"==typeof e&&/^\S+$/.test(e)&&s.push({type:"SEQUENCE",value:e})}break;case"ANSWERED":case"DELETED":case"DRAFT":case"FLAGGED":case"SEEN":case"UNANSWERED":case"UNDELETED":case"UNDRAFT":case"UNFLAGGED":case"UNSEEN":a(s,p,!!t[p]);break;case"ALL":case"NEW":case"OLD":case"RECENT":t[p]&&a(s,p,!0);break;case"LARGER":case"SMALLER":case"MODSEQ":t[p]&&l(s,p,t[p]);break;case"BCC":case"BODY":case"CC":case"FROM":case"SUBJECT":case"TEXT":case"TO":u(t[p])&&(r=!0),t[p]&&l(s,p,t[p]);break;case"UID":t[p]&&l(s,p,t[p],"SEQUENCE");break;case"EMAILID":e.capabilities.has("OBJECTID")?l(s,"EMAILID",t[p]):e.capabilities.has("X-GM-EXT-1")&&l(s,"X-GM-MSGID",t[p]);break;case"THREADID":e.capabilities.has("OBJECTID")?l(s,"THREADID",t[p]):e.capabilities.has("X-GM-EXT-1")&&l(s,"X-GM-THRID",t[p]);break;case"GMRAW":case"GMAILRAW":if(e.capabilities.has("X-GM-EXT-1"))u(t[p])&&(r=!0),l(s,"X-GM-RAW",t[p]);else{let e=Error("Server does not support X-GM-EXT-1 extension required for X-GM-RAW");throw e.code="MissingServerExtension",e}break;case"BEFORE":case"ON":case"SINCE":case"SENTBEFORE":case"SENTON":case"SENTSINCE":h(s,p,t[p]);break;case"KEYWORD":case"UNKEYWORD":{let e=i(t[p]);(o(c,e)||c.flags.has(e))&&l(s,p,e)}break;case"HEADER":t[p]&&"object"==typeof t[p]&&Object.keys(t[p]).forEach(e=>{let i=t[p][e];!0===i&&(i=""),"string"==typeof i&&(u(i)&&(r=!0),l(s,p,[e.toUpperCase().trim(),i]))});break;case"OR":{if(!t[p]||!Array.isArray(t[p])||!t[p].length)break;if(1===t[p].length){"object"==typeof t[p][0]&&t[p][0]&&d(t[p][0]);break}let e=t=>{let s=!1,r=[];if(t.forEach((e,t)=>{t%2==0?s=[e]:(s.push(e),r.push(s),s=!1)}),s&&s.length){for(;1===s.length&&Array.isArray(s[0]);)s=s[0];r.push(s)}for(;r.length>2;)r=e(r);for(;1===r.length&&Array.isArray(r[0]);)r=r[0];return r},r=e=>{if(Array.isArray(e)){e.length>1&&s.push({type:"ATOM",value:"OR"}),e.forEach(r);return}e&&"object"==typeof e&&d(e)};r(e(t[p]))}}})};return d(t),r&&!e.enabled.has("UTF8=ACCEPT")&&(s.unshift({type:"ATOM",value:"UTF-8"}),s.unshift({type:"ATOM",value:"CHARSET"})),s}},63858:function(e,t,s){"use strict";var r=this&&this.__awaiter||function(e,t,s,r){return new(s||(s=Promise))(function(i,o){function a(e){try{h(r.next(e))}catch(e){o(e)}}function l(e){try{h(r.throw(e))}catch(e){o(e)}}function h(e){var t;e.done?i(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(a,l)}h((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.SocksClientError=t.SocksClient=void 0;let i=s(94735),o=s(91645),a=s(4238),l=s(40547),h=s(58579),u=s(25489),c=s(45648);Object.defineProperty(t,"SocksClientError",{enumerable:!0,get:function(){return c.SocksClientError}});let d=s(85989);class p extends i.EventEmitter{constructor(e){super(),this.options=Object.assign({},e),(0,h.validateSocksClientOptions)(e),this.setState(l.SocksClientState.Created)}static createConnection(e,t){return new Promise((s,r)=>{try{(0,h.validateSocksClientOptions)(e,["connect"])}catch(e){if("function"==typeof t)return t(e),s(e);return r(e)}let i=new p(e);i.connect(e.existing_socket),i.once("established",e=>{i.removeAllListeners(),"function"==typeof t&&t(null,e),s(e)}),i.once("error",e=>{i.removeAllListeners(),"function"==typeof t?(t(e),s(e)):r(e)})})}static createConnectionChain(e,t){return new Promise((s,i)=>r(this,void 0,void 0,function*(){try{(0,h.validateSocksClientChainOptions)(e)}catch(e){if("function"==typeof t)return t(e),s(e);return i(e)}e.randomizeChain&&(0,c.shuffleArray)(e.proxies);try{let r;for(let t=0;t<e.proxies.length;t++){let s=e.proxies[t],i=t===e.proxies.length-1?e.destination:{host:e.proxies[t+1].host||e.proxies[t+1].ipaddress,port:e.proxies[t+1].port},o=yield p.createConnection({command:"connect",proxy:s,destination:i,existing_socket:r});r=r||o.socket}"function"==typeof t&&t(null,{socket:r}),s({socket:r})}catch(e){"function"==typeof t?(t(e),s(e)):i(e)}}))}static createUDPFrame(e){let t=new a.SmartBuffer;return t.writeUInt16BE(0),t.writeUInt8(e.frameNumber||0),o.isIPv4(e.remoteHost.host)?(t.writeUInt8(l.Socks5HostType.IPv4),t.writeUInt32BE((0,h.ipv4ToInt32)(e.remoteHost.host))):o.isIPv6(e.remoteHost.host)?(t.writeUInt8(l.Socks5HostType.IPv6),t.writeBuffer((0,h.ipToBuffer)(e.remoteHost.host))):(t.writeUInt8(l.Socks5HostType.Hostname),t.writeUInt8(Buffer.byteLength(e.remoteHost.host)),t.writeString(e.remoteHost.host)),t.writeUInt16BE(e.remoteHost.port),t.writeBuffer(e.data),t.toBuffer()}static parseUDPFrame(e){let t=a.SmartBuffer.fromBuffer(e);t.readOffset=2;let s=t.readUInt8(),r=t.readUInt8();return{frameNumber:s,remoteHost:{host:r===l.Socks5HostType.IPv4?(0,h.int32ToIpv4)(t.readUInt32BE()):r===l.Socks5HostType.IPv6?d.Address6.fromByteArray(Array.from(t.readBuffer(16))).canonicalForm():t.readString(t.readUInt8()),port:t.readUInt16BE()},data:t.readBuffer()}}setState(e){this.state!==l.SocksClientState.Error&&(this.state=e)}connect(e){this.onDataReceived=e=>this.onDataReceivedHandler(e),this.onClose=()=>this.onCloseHandler(),this.onError=e=>this.onErrorHandler(e),this.onConnect=()=>this.onConnectHandler();let t=setTimeout(()=>this.onEstablishedTimeout(),this.options.timeout||l.DEFAULT_TIMEOUT);t.unref&&"function"==typeof t.unref&&t.unref(),e?this.socket=e:this.socket=new o.Socket,this.socket.once("close",this.onClose),this.socket.once("error",this.onError),this.socket.once("connect",this.onConnect),this.socket.on("data",this.onDataReceived),this.setState(l.SocksClientState.Connecting),this.receiveBuffer=new u.ReceiveBuffer,e?this.socket.emit("connect"):(this.socket.connect(this.getSocketOptions()),void 0!==this.options.set_tcp_nodelay&&null!==this.options.set_tcp_nodelay&&this.socket.setNoDelay(!!this.options.set_tcp_nodelay)),this.prependOnceListener("established",e=>{setImmediate(()=>{if(this.receiveBuffer.length>0){let t=this.receiveBuffer.get(this.receiveBuffer.length);e.socket.emit("data",t)}e.socket.resume()})})}getSocketOptions(){return Object.assign(Object.assign({},this.options.socket_options),{host:this.options.proxy.host||this.options.proxy.ipaddress,port:this.options.proxy.port})}onEstablishedTimeout(){this.state!==l.SocksClientState.Established&&this.state!==l.SocksClientState.BoundWaitingForConnection&&this.closeSocket(l.ERRORS.ProxyConnectionTimedOut)}onConnectHandler(){this.setState(l.SocksClientState.Connected),4===this.options.proxy.type?this.sendSocks4InitialHandshake():this.sendSocks5InitialHandshake(),this.setState(l.SocksClientState.SentInitialHandshake)}onDataReceivedHandler(e){this.receiveBuffer.append(e),this.processData()}processData(){for(;this.state!==l.SocksClientState.Established&&this.state!==l.SocksClientState.Error&&this.receiveBuffer.length>=this.nextRequiredPacketBufferSize;)if(this.state===l.SocksClientState.SentInitialHandshake)4===this.options.proxy.type?this.handleSocks4FinalHandshakeResponse():this.handleInitialSocks5HandshakeResponse();else if(this.state===l.SocksClientState.SentAuthentication)this.handleInitialSocks5AuthenticationHandshakeResponse();else if(this.state===l.SocksClientState.SentFinalHandshake)this.handleSocks5FinalHandshakeResponse();else if(this.state===l.SocksClientState.BoundWaitingForConnection)4===this.options.proxy.type?this.handleSocks4IncomingConnectionResponse():this.handleSocks5IncomingConnectionResponse();else{this.closeSocket(l.ERRORS.InternalError);break}}onCloseHandler(){this.closeSocket(l.ERRORS.SocketClosed)}onErrorHandler(e){this.closeSocket(e.message)}removeInternalSocketHandlers(){this.socket.pause(),this.socket.removeListener("data",this.onDataReceived),this.socket.removeListener("close",this.onClose),this.socket.removeListener("error",this.onError),this.socket.removeListener("connect",this.onConnect)}closeSocket(e){this.state!==l.SocksClientState.Error&&(this.setState(l.SocksClientState.Error),this.socket.destroy(),this.removeInternalSocketHandlers(),this.emit("error",new c.SocksClientError(e,this.options)))}sendSocks4InitialHandshake(){let e=this.options.proxy.userId||"",t=new a.SmartBuffer;t.writeUInt8(4),t.writeUInt8(l.SocksCommand[this.options.command]),t.writeUInt16BE(this.options.destination.port),o.isIPv4(this.options.destination.host)?(t.writeBuffer((0,h.ipToBuffer)(this.options.destination.host)),t.writeStringNT(e)):(t.writeUInt8(0),t.writeUInt8(0),t.writeUInt8(0),t.writeUInt8(1),t.writeStringNT(e),t.writeStringNT(this.options.destination.host)),this.nextRequiredPacketBufferSize=l.SOCKS_INCOMING_PACKET_SIZES.Socks4Response,this.socket.write(t.toBuffer())}handleSocks4FinalHandshakeResponse(){let e=this.receiveBuffer.get(8);if(e[1]!==l.Socks4Response.Granted)this.closeSocket(`${l.ERRORS.Socks4ProxyRejectedConnection} - (${l.Socks4Response[e[1]]})`);else if(l.SocksCommand[this.options.command]===l.SocksCommand.bind){let t=a.SmartBuffer.fromBuffer(e);t.readOffset=2;let s={port:t.readUInt16BE(),host:(0,h.int32ToIpv4)(t.readUInt32BE())};"0.0.0.0"===s.host&&(s.host=this.options.proxy.ipaddress),this.setState(l.SocksClientState.BoundWaitingForConnection),this.emit("bound",{remoteHost:s,socket:this.socket})}else this.setState(l.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{socket:this.socket})}handleSocks4IncomingConnectionResponse(){let e=this.receiveBuffer.get(8);if(e[1]!==l.Socks4Response.Granted)this.closeSocket(`${l.ERRORS.Socks4ProxyRejectedIncomingBoundConnection} - (${l.Socks4Response[e[1]]})`);else{let t=a.SmartBuffer.fromBuffer(e);t.readOffset=2;let s={port:t.readUInt16BE(),host:(0,h.int32ToIpv4)(t.readUInt32BE())};this.setState(l.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:s,socket:this.socket})}}sendSocks5InitialHandshake(){let e=new a.SmartBuffer,t=[l.Socks5Auth.NoAuth];for(let s of((this.options.proxy.userId||this.options.proxy.password)&&t.push(l.Socks5Auth.UserPass),void 0!==this.options.proxy.custom_auth_method&&t.push(this.options.proxy.custom_auth_method),e.writeUInt8(5),e.writeUInt8(t.length),t))e.writeUInt8(s);this.nextRequiredPacketBufferSize=l.SOCKS_INCOMING_PACKET_SIZES.Socks5InitialHandshakeResponse,this.socket.write(e.toBuffer()),this.setState(l.SocksClientState.SentInitialHandshake)}handleInitialSocks5HandshakeResponse(){let e=this.receiveBuffer.get(2);5!==e[0]?this.closeSocket(l.ERRORS.InvalidSocks5IntiailHandshakeSocksVersion):e[1]===l.SOCKS5_NO_ACCEPTABLE_AUTH?this.closeSocket(l.ERRORS.InvalidSocks5InitialHandshakeNoAcceptedAuthType):e[1]===l.Socks5Auth.NoAuth?(this.socks5ChosenAuthType=l.Socks5Auth.NoAuth,this.sendSocks5CommandRequest()):e[1]===l.Socks5Auth.UserPass?(this.socks5ChosenAuthType=l.Socks5Auth.UserPass,this.sendSocks5UserPassAuthentication()):e[1]===this.options.proxy.custom_auth_method?(this.socks5ChosenAuthType=this.options.proxy.custom_auth_method,this.sendSocks5CustomAuthentication()):this.closeSocket(l.ERRORS.InvalidSocks5InitialHandshakeUnknownAuthType)}sendSocks5UserPassAuthentication(){let e=this.options.proxy.userId||"",t=this.options.proxy.password||"",s=new a.SmartBuffer;s.writeUInt8(1),s.writeUInt8(Buffer.byteLength(e)),s.writeString(e),s.writeUInt8(Buffer.byteLength(t)),s.writeString(t),this.nextRequiredPacketBufferSize=l.SOCKS_INCOMING_PACKET_SIZES.Socks5UserPassAuthenticationResponse,this.socket.write(s.toBuffer()),this.setState(l.SocksClientState.SentAuthentication)}sendSocks5CustomAuthentication(){return r(this,void 0,void 0,function*(){this.nextRequiredPacketBufferSize=this.options.proxy.custom_auth_response_size,this.socket.write((yield this.options.proxy.custom_auth_request_handler())),this.setState(l.SocksClientState.SentAuthentication)})}handleSocks5CustomAuthHandshakeResponse(e){return r(this,void 0,void 0,function*(){return yield this.options.proxy.custom_auth_response_handler(e)})}handleSocks5AuthenticationNoAuthHandshakeResponse(e){return r(this,void 0,void 0,function*(){return 0===e[1]})}handleSocks5AuthenticationUserPassHandshakeResponse(e){return r(this,void 0,void 0,function*(){return 0===e[1]})}handleInitialSocks5AuthenticationHandshakeResponse(){return r(this,void 0,void 0,function*(){this.setState(l.SocksClientState.ReceivedAuthenticationResponse);let e=!1;this.socks5ChosenAuthType===l.Socks5Auth.NoAuth?e=yield this.handleSocks5AuthenticationNoAuthHandshakeResponse(this.receiveBuffer.get(2)):this.socks5ChosenAuthType===l.Socks5Auth.UserPass?e=yield this.handleSocks5AuthenticationUserPassHandshakeResponse(this.receiveBuffer.get(2)):this.socks5ChosenAuthType===this.options.proxy.custom_auth_method&&(e=yield this.handleSocks5CustomAuthHandshakeResponse(this.receiveBuffer.get(this.options.proxy.custom_auth_response_size))),e?this.sendSocks5CommandRequest():this.closeSocket(l.ERRORS.Socks5AuthenticationFailed)})}sendSocks5CommandRequest(){let e=new a.SmartBuffer;e.writeUInt8(5),e.writeUInt8(l.SocksCommand[this.options.command]),e.writeUInt8(0),o.isIPv4(this.options.destination.host)?(e.writeUInt8(l.Socks5HostType.IPv4),e.writeBuffer((0,h.ipToBuffer)(this.options.destination.host))):o.isIPv6(this.options.destination.host)?(e.writeUInt8(l.Socks5HostType.IPv6),e.writeBuffer((0,h.ipToBuffer)(this.options.destination.host))):(e.writeUInt8(l.Socks5HostType.Hostname),e.writeUInt8(this.options.destination.host.length),e.writeString(this.options.destination.host)),e.writeUInt16BE(this.options.destination.port),this.nextRequiredPacketBufferSize=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.socket.write(e.toBuffer()),this.setState(l.SocksClientState.SentFinalHandshake)}handleSocks5FinalHandshakeResponse(){let e=this.receiveBuffer.peek(5);if(5!==e[0]||e[1]!==l.Socks5Response.Granted)this.closeSocket(`${l.ERRORS.InvalidSocks5FinalHandshakeRejected} - ${l.Socks5Response[e[1]]}`);else{let t,s,r=e[3];if(r===l.Socks5HostType.IPv4){let e=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<e){this.nextRequiredPacketBufferSize=e;return}s=a.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),"0.0.0.0"===(t={host:(0,h.int32ToIpv4)(s.readUInt32BE()),port:s.readUInt16BE()}).host&&(t.host=this.options.proxy.ipaddress)}else if(r===l.Socks5HostType.Hostname){let r=e[4],i=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(r);if(this.receiveBuffer.length<i){this.nextRequiredPacketBufferSize=i;return}t={host:(s=a.SmartBuffer.fromBuffer(this.receiveBuffer.get(i).slice(5))).readString(r),port:s.readUInt16BE()}}else if(r===l.Socks5HostType.IPv6){let e=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<e){this.nextRequiredPacketBufferSize=e;return}s=a.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),t={host:d.Address6.fromByteArray(Array.from(s.readBuffer(16))).canonicalForm(),port:s.readUInt16BE()}}this.setState(l.SocksClientState.ReceivedFinalResponse),l.SocksCommand[this.options.command]===l.SocksCommand.connect?(this.setState(l.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:t,socket:this.socket})):l.SocksCommand[this.options.command]===l.SocksCommand.bind?(this.setState(l.SocksClientState.BoundWaitingForConnection),this.nextRequiredPacketBufferSize=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHeader,this.emit("bound",{remoteHost:t,socket:this.socket})):l.SocksCommand[this.options.command]===l.SocksCommand.associate&&(this.setState(l.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:t,socket:this.socket}))}}handleSocks5IncomingConnectionResponse(){let e=this.receiveBuffer.peek(5);if(5!==e[0]||e[1]!==l.Socks5Response.Granted)this.closeSocket(`${l.ERRORS.Socks5ProxyRejectedIncomingBoundConnection} - ${l.Socks5Response[e[1]]}`);else{let t,s,r=e[3];if(r===l.Socks5HostType.IPv4){let e=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv4;if(this.receiveBuffer.length<e){this.nextRequiredPacketBufferSize=e;return}s=a.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),"0.0.0.0"===(t={host:(0,h.int32ToIpv4)(s.readUInt32BE()),port:s.readUInt16BE()}).host&&(t.host=this.options.proxy.ipaddress)}else if(r===l.Socks5HostType.Hostname){let r=e[4],i=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseHostname(r);if(this.receiveBuffer.length<i){this.nextRequiredPacketBufferSize=i;return}t={host:(s=a.SmartBuffer.fromBuffer(this.receiveBuffer.get(i).slice(5))).readString(r),port:s.readUInt16BE()}}else if(r===l.Socks5HostType.IPv6){let e=l.SOCKS_INCOMING_PACKET_SIZES.Socks5ResponseIPv6;if(this.receiveBuffer.length<e){this.nextRequiredPacketBufferSize=e;return}s=a.SmartBuffer.fromBuffer(this.receiveBuffer.get(e).slice(4)),t={host:d.Address6.fromByteArray(Array.from(s.readBuffer(16))).canonicalForm(),port:s.readUInt16BE()}}this.setState(l.SocksClientState.Established),this.removeInternalSocketHandlers(),this.emit("established",{remoteHost:t,socket:this.socket})}}get socksClientOptions(){return Object.assign({},this.options)}}t.SocksClient=p},64866:(e,t,s)=>{"use strict";let{Transform:r}=s(27910);class i extends r{constructor(e){super(),this.options=e||{},this.maxBytes=this.options.maxBytes||1/0,this.processed=0,this.limited=!1}_transform(e,t,s){if(this.limited)return s();if(this.processed+e.length>this.maxBytes){if(this.maxBytes-this.processed<1)return s();e=e.slice(0,this.maxBytes-this.processed)}this.processed+=e.length,this.processed>=this.maxBytes&&(this.limited=!0),this.push(e),s()}}e.exports.LimitedPassthrough=i},65049:e=>{"use strict";let t,s={exit:[],beforeExit:[]},r={exit:function(){o("exit")},beforeExit:function(){o("beforeExit")}};function i(e){s[e].length>0||(process.removeListener(e,r[e]),0===s.exit.length&&0===s.beforeExit.length&&(t=void 0))}function o(e){for(let t of s[e]){let s=t.deref(),r=t.fn;void 0!==s&&r(s,e)}s[e]=[]}function a(e){for(let t of["exit","beforeExit"]){let r=s[t].indexOf(e);s[t].splice(r,r+1),i(t)}}function l(e,i,o){if(void 0===i)throw Error("the object can't be undefined");s[e].length>0||process.on(e,r[e]);let l=new WeakRef(i);l.fn=o,void 0===t&&(t=new FinalizationRegistry(a)),t.register(i,l),s[e].push(l)}e.exports={register:function(e,t){l("exit",e,t)},registerBeforeExit:function(e,t){l("beforeExit",e,t)},unregister:function(e){if(void 0!==t)for(let r of(t.unregister(e),["exit","beforeExit"]))s[r]=s[r].filter(t=>{let s=t.deref();return s&&s!==e}),i(r)}}},68219:e=>{"use strict";e.exports=async(e,t)=>{let s;if(e.capabilities.has("ENABLE")&&e.state===e.states.AUTHENTICATED&&(t=t.filter(t=>e.capabilities.has(t.toUpperCase()))).length)try{let r=new Set;return s=await e.exec("ENABLE",t.map(e=>({type:"ATOM",value:e.toUpperCase()})),{untagged:{ENABLED:async e=>{e.attributes&&e.attributes.length&&e.attributes.forEach(e=>{e.value&&"string"==typeof e.value&&r.add(e.value.toUpperCase().trim())})}}}),e.enabled=r,s.next(),r}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},68658:e=>{"use strict";e.exports={mapHttpResponse:function(e){return{res:r(e)}},resSerializer:r};let t=Symbol("pino-raw-res-ref"),s=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:""},raw:{enumerable:!1,get:function(){return this[t]},set:function(e){this[t]=e}}});function r(e){let t=Object.create(s);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}Object.defineProperty(s,t,{writable:!0,value:{}})},69185:e=>{"use strict";let t=Symbol("pino.setLevel"),s=Symbol("pino.getLevel"),r=Symbol("pino.levelVal"),i=Symbol("pino.levelComp"),o=Symbol("pino.useLevelLabels"),a=Symbol("pino.useOnlyCustomLevels"),l=Symbol("pino.mixin"),h=Symbol("pino.lsCache"),u=Symbol("pino.chindings"),c=Symbol("pino.asJson"),d=Symbol("pino.write"),p=Symbol("pino.redactFmt"),f=Symbol("pino.time"),g=Symbol("pino.timeSliceIndex"),m=Symbol("pino.stream"),y=Symbol("pino.stringify"),b=Symbol("pino.stringifySafe"),S=Symbol("pino.stringifiers"),E=Symbol("pino.end"),v=Symbol("pino.formatOpts"),w=Symbol("pino.messageKey"),T=Symbol("pino.errorKey"),I=Symbol("pino.nestedKey"),k=Symbol("pino.nestedKeyStr"),C=Symbol("pino.mixinMergeStrategy"),A=Symbol("pino.msgPrefix"),N=Symbol("pino.wildcardFirst"),O=Symbol.for("pino.serializers"),B=Symbol.for("pino.formatters"),_=Symbol.for("pino.hooks");e.exports={setLevelSym:t,getLevelSym:s,levelValSym:r,levelCompSym:i,useLevelLabelsSym:o,mixinSym:l,lsCacheSym:h,chindingsSym:u,asJsonSym:c,writeSym:d,serializersSym:O,redactFmtSym:p,timeSym:f,timeSliceIndexSym:g,streamSym:m,stringifySym:y,stringifySafeSym:b,stringifiersSym:S,endSym:E,formatOptsSym:v,messageKeySym:w,errorKeySym:T,nestedKeySym:I,wildcardFirstSym:N,needsMetadataGsym:Symbol.for("pino.metadata"),useOnlyCustomLevelsSym:a,formattersSym:B,hooksSym:_,nestedKeyStrSym:k,mixinMergeStrategySym:C,msgPrefixSym:A}},69503:(e,t,s)=>{"use strict";let{getStatusCode:r,getErrorText:i}=s(80876);e.exports=async(e,t,s)=>{if(e.state===e.states.NOT_AUTHENTICATED)try{return(await e.exec("LOGIN",[{type:"STRING",value:t},{type:"STRING",value:s,sensitive:!0}])).next(),e.authCapabilities.set("LOGIN",!0),t}catch(t){let e=r(t.response);throw e&&(t.serverResponseCode=e),t.authenticationFailed=!0,t.response=await i(t.response),t}}},70360:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});let r=s(79428),i={INVALID_ENCODING:"Invalid encoding provided. Please specify a valid encoding the internal Node.js Buffer supports.",INVALID_SMARTBUFFER_SIZE:"Invalid size provided. Size must be a valid integer greater than zero.",INVALID_SMARTBUFFER_BUFFER:"Invalid Buffer provided in SmartBufferOptions.",INVALID_SMARTBUFFER_OBJECT:"Invalid SmartBufferOptions object supplied to SmartBuffer constructor or factory methods.",INVALID_OFFSET:"An invalid offset value was provided.",INVALID_OFFSET_NON_NUMBER:"An invalid offset value was provided. A numeric value is required.",INVALID_LENGTH:"An invalid length value was provided.",INVALID_LENGTH_NON_NUMBER:"An invalid length value was provived. A numeric value is required.",INVALID_TARGET_OFFSET:"Target offset is beyond the bounds of the internal SmartBuffer data.",INVALID_TARGET_LENGTH:"Specified length value moves cursor beyong the bounds of the internal SmartBuffer data.",INVALID_READ_BEYOND_BOUNDS:"Attempted to read beyond the bounds of the managed data.",INVALID_WRITE_BEYOND_BOUNDS:"Attempted to write beyond the bounds of the managed data."};function o(e){var t;return"number"==typeof e&&isFinite(e)&&"number"==typeof(t=e)&&isFinite(t)&&Math.floor(t)===t}function a(e,t){if("number"==typeof e){if(!o(e)||e<0)throw Error(t?i.INVALID_OFFSET:i.INVALID_LENGTH)}else throw Error(t?i.INVALID_OFFSET_NON_NUMBER:i.INVALID_LENGTH_NON_NUMBER)}t.ERRORS=i,t.checkEncoding=function(e){if(!r.Buffer.isEncoding(e))throw Error(i.INVALID_ENCODING)},t.isFiniteInteger=o,t.checkLengthValue=function(e){a(e,!1)},t.checkOffsetValue=function(e){a(e,!0)},t.checkTargetOffset=function(e,t){if(e<0||e>t.length)throw Error(i.INVALID_TARGET_OFFSET)},t.bigIntAndBufferInt64Check=function(e){if("undefined"==typeof BigInt)throw Error("Platform does not support JS BigInt type.");if(void 0===r.Buffer.prototype[e])throw Error(`Platform does not support Buffer.prototype.${e}.`)}},71618:e=>{"use strict";e.exports=function(e={}){let{ERR_PATHS_MUST_BE_STRINGS:t=()=>"fast-redact - Paths must be (non-empty) strings",ERR_INVALID_PATH:s=e=>`fast-redact Invalid path (${e})`}=e;return function({paths:e}){e.forEach(e=>{if("string"!=typeof e)throw Error(t());try{if(//.test(e))throw Error();let t=("["===e[0]?"":".")+e.replace(/^\*/,"").replace(/\.\*/g,".").replace(/\[\*\]/g,"[]");if(/\n|\r|;/.test(t)||/\/\*/.test(t))throw Error();Function(`
'use strict'
const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
const = null;
o${t}
if ([o${t}].length !== 1) throw Error()`)()}catch(t){throw Error(s(e))}})}}},72136:(e,t,s)=>{"use strict";e.exports={parser:s(10941),compiler:s(5679)}},72626:(e,t,s)=>{"use strict";let r=s(48161),i=s(20760),o=s(96133),a=s(36937),l=s(53767),h=s(16374),u=s(69185),{configure:c}=s(53351),{assertDefaultLevelFound:d,mappings:p,genLsCache:f,genLevelComparison:g,assertLevelComparison:m}=s(95821),{DEFAULT_LEVELS:y,SORTING_ORDER:b}=s(89597),{createArgsNormalizer:S,asChindings:E,buildSafeSonicBoom:v,buildFormatters:w,stringify:T,normalizeDestFileDescriptor:I,noop:k}=s(98895),{version:C}=s(7051),{chindingsSym:A,redactFmtSym:N,serializersSym:O,timeSym:B,timeSliceIndexSym:_,streamSym:x,stringifySym:R,stringifySafeSym:L,stringifiersSym:U,setLevelSym:D,endSym:M,formatOptsSym:P,messageKeySym:H,errorKeySym:j,nestedKeySym:F,mixinSym:$,levelCompSym:V,useOnlyCustomLevelsSym:G,formattersSym:q,hooksSym:z,nestedKeyStrSym:J,mixinMergeStrategySym:K,msgPrefixSym:X}=u,{epochTime:W,nullTime:Y}=l,{pid:Q}=process,Z=r.hostname(),ee=i.err,et=S({level:"info",levelComparison:b.ASC,levels:y,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:Q,hostname:Z},serializers:Object.assign(Object.create(null),{err:ee}),formatters:Object.assign(Object.create(null),{bindings:e=>e,level:(e,t)=>({level:t})}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:W,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),es=Object.assign(Object.create(null),i);function er(...e){let t={},{opts:s,stream:r}=et(t,o(),...e);s.level&&"string"==typeof s.level&&void 0!==y[s.level.toLowerCase()]&&(s.level=s.level.toLowerCase());let{redact:i,crlf:l,serializers:u,timestamp:b,messageKey:S,errorKey:v,nestedKey:I,base:C,name:Q,level:Z,customLevels:ee,levelComparison:es,mixin:ei,mixinMergeStrategy:en,useOnlyCustomLevels:eo,formatters:ea,hooks:el,depthLimit:eh,edgeLimit:eu,onChild:ec,msgPrefix:ed}=s,ep=c({maximumDepth:eh,maximumBreadth:eu}),ef=w(ea.level,ea.bindings,ea.log),eg=T.bind({[L]:ep}),em=i?a(i,eg):{},ey=i?{stringify:em[N]}:{stringify:eg},eb=E.bind(null,{[A]:"",[O]:u,[U]:em,[R]:T,[L]:ep,[q]:ef}),eS="";null!==C&&(eS=eb(void 0===Q?C:Object.assign({},C,{name:Q})));let eE=b instanceof Function?b:b?W:Y,ev=eE().indexOf(":")+1;if(eo&&!ee)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(ei&&"function"!=typeof ei)throw Error(`Unknown mixin type "${typeof ei}" - expected "function"`);if(ed&&"string"!=typeof ed)throw Error(`Unknown msgPrefix type "${typeof ed}" - expected "string"`);d(Z,ee,eo);let ew=p(ee,eo);return"function"==typeof r.emit&&r.emit("message",{code:"PINO_CONFIG",config:{levels:ew,messageKey:S,errorKey:v}}),m(es),Object.assign(t,{levels:ew,[V]:g(es),[G]:eo,[x]:r,[B]:eE,[_]:ev,[R]:T,[L]:ep,[U]:em,[M]:"}"+(l?"\r\n":"\n"),[P]:ey,[H]:S,[j]:v,[F]:I,[J]:I?`,${JSON.stringify(I)}:{`:"",[O]:u,[$]:ei,[K]:en,[A]:eS,[q]:ef,[z]:el,silent:k,onChild:ec,[X]:ed}),Object.setPrototypeOf(t,h()),f(t),t[D](Z),t}e.exports=er,e.exports.destination=(e=process.stdout.fd)=>"object"==typeof e?(e.dest=I(e.dest||process.stdout.fd),v(e)):v({dest:I(e),minLength:0}),e.exports.transport=s(86501),e.exports.multistream=s(39093),e.exports.levels=p(),e.exports.stdSerializers=es,e.exports.stdTimeFunctions=Object.assign({},l),e.exports.symbols=u,e.exports.version=C,e.exports.default=er,e.exports.pino=er},73483:e=>{"use strict";e.exports=JSON.parse('{"name":"thread-stream","version":"3.1.0","description":"A streaming way to send data to a Node.js Worker Thread","main":"index.js","types":"index.d.ts","dependencies":{"real-require":"^0.2.0"},"devDependencies":{"@types/node":"^20.1.0","@types/tap":"^15.0.0","@yao-pkg/pkg":"^5.11.5","desm":"^1.3.0","fastbench":"^1.0.1","husky":"^9.0.6","pino-elasticsearch":"^8.0.0","sonic-boom":"^4.0.1","standard":"^17.0.0","tap":"^16.2.0","ts-node":"^10.8.0","typescript":"^5.3.2","why-is-node-running":"^2.2.2"},"scripts":{"build":"tsc --noEmit","test":"standard && npm run build && npm run transpile && tap \\"test/**/*.test.*js\\" && tap --ts test/*.test.*ts","test:ci":"standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts","test:ci:js":"tap --no-check-coverage --timeout=120 --coverage-report=lcovonly \\"test/**/*.test.*js\\"","test:ci:ts":"tap --ts --no-check-coverage --coverage-report=lcovonly \\"test/**/*.test.*ts\\"","test:yarn":"npm run transpile && tap \\"test/**/*.test.js\\" --no-check-coverage","transpile":"sh ./test/ts/transpile.sh","prepare":"husky install"},"standard":{"ignore":["test/ts/**/*","test/syntax-error.mjs"]},"repository":{"type":"git","url":"git+https://github.com/mcollina/thread-stream.git"},"keywords":["worker","thread","threads","stream"],"author":"Matteo Collina <hello@matteocollina.com>","license":"MIT","bugs":{"url":"https://github.com/mcollina/thread-stream/issues"},"homepage":"https://github.com/mcollina/thread-stream#readme"}')},73663:(e,t,s)=>{"use strict";e.exports=new Map([["ID",s(98333)],["CAPABILITY",s(99142)],["NAMESPACE",s(87005)],["LOGIN",s(69503)],["LOGOUT",s(24238)],["STARTTLS",s(51677)],["LIST",s(41340)],["ENABLE",s(68219)],["SELECT",s(60612)],["FETCH",s(54406)],["CREATE",s(17492)],["DELETE",s(33103)],["RENAME",s(75426)],["CLOSE",s(80882)],["SUBSCRIBE",s(2934)],["UNSUBSCRIBE",s(4179)],["STORE",s(8683)],["SEARCH",s(22332)],["NOOP",s(56512)],["EXPUNGE",s(84822)],["APPEND",s(94884)],["STATUS",s(60798)],["COPY",s(99513)],["MOVE",s(38361)],["COMPRESS",s(42168)],["QUOTA",s(83426)],["IDLE",s(18498)],["AUTHENTICATE",s(6241)]])},75426:(e,t,s)=>{"use strict";let{encodePath:r,normalizePath:i,getStatusCode:o,getErrorText:a}=s(80876);e.exports=async(e,t,s)=>{if([e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)){t=i(e,t),s=i(e,s),e.states.SELECTED&&e.mailbox.path===t&&await e.run("CLOSE");try{let i={path:t,newPath:s};return(await e.exec("RENAME",[{type:"ATOM",value:r(e,t)},{type:"ATOM",value:r(e,s)}])).next(),i}catch(s){let t=o(s.response);throw t&&(s.serverResponseCode=t),s.response=await a(s.response),e.log.warn({err:s,cid:e.id}),s}}}},76013:(e,t,s)=>{"use strict";let r=s(27910).Transform,i=s(58118);class o extends r{constructor(e,t){super({readableObjectMode:!0,writableObjectMode:!0}),this.filterFunc=e,this.rewriteAction=t,this.decoder=!1,this.encoder=!1,this.continue=!1}_transform(e,t,s){this.processIncoming(e,s)}_flush(e){return this.decoder?this.processIncoming({type:"none"},e):e()}processIncoming(e,t){if(this.decoder&&"body"===e.type)if(!this.decoder.write(e.value))return this.decoder.once("drain",t);else return t();if(this.decoder&&"body"!==e.type)return this.continue=()=>{this.continue=!1,this.decoder=!1,this.encoder=!1,this.processIncoming(e,t)},this.decoder.end();"node"===e.type&&this.filterFunc(e)?this.emit("node",this.createDecodePair(e)):this.readable&&"none"!==e.type&&this.push(e),t()}createDecodePair(e){this.decoder=e.getDecoder(),["base64","quoted-printable"].includes(e.encoding)?this.encoder=e.getEncoder():this.encoder=e.getEncoder("quoted-printable");let t=!1,s=this.decoder,r=this.encoder,o=!0;s.$reading=!1;let a=()=>{s.$reading=!0;let i=r.read();if(null===i){s.$reading=!1;return}o&&(o=!1,this.readable&&(this.push(e),"body"===e.type&&(t=e.value&&e.value.length&&e.value[e.value.length-1])));let l=!0;if(this.readable&&(l=this.push({node:e,type:"body",value:i}),t=i&&i.length&&i[i.length-1]),l)return setImmediate(a);r.pause(),setTimeout(()=>{r.resume(),setImmediate(a)},100)};if(r.on("readable",()=>{if(!s.$reading)return a()}),r.on("end",()=>{if(o&&(o=!1,this.readable&&(this.push(e),"body"===e.type&&(t=e.value&&e.value.length&&e.value[e.value.length-1]))),10!==t&&this.push({node:e,type:"body",value:Buffer.from([10])}),this.continue)return this.continue()}),/^text\//.test(e.contentType)&&e.flowed){let t=s;s=new i({delSp:e.delSp,encoding:e.encoding}),t.on("error",e=>{s.emit("error",e)}),t.pipe(s),e.flowed=!1,e.delSp=!1,e.setContentType()}return{node:e,decoder:s,encoder:r}}}e.exports=o},79104:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Address6=void 0;let a=o(s(6696)),l=o(s(49877)),h=o(s(36831)),u=o(s(56687)),c=s(36558),d=s(56640),p=s(11990),f=s(18551),g=s(18421);function m(e){if(!e)throw Error("Assertion failed.")}function y(e){return e=(e=e.replace(/^(0{1,})([1-9]+)$/,'<span class="parse-error">$1</span>$2')).replace(/^(0{1,})(0)$/,'<span class="parse-error">$1</span>$2')}function b(e){return(0,g.sprintf)("%04x",parseInt(e,16))}function S(e){return 255&e}class E{constructor(e,t){this.addressMinusSuffix="",this.parsedSubnet="",this.subnet="/128",this.subnetMask=128,this.v4=!1,this.zone="",this.isInSubnet=a.isInSubnet,this.isCorrect=a.isCorrect(h.BITS),void 0===t?this.groups=h.GROUPS:this.groups=t,this.address=e;let s=h.RE_SUBNET_STRING.exec(e);if(s){if(this.parsedSubnet=s[0].replace("/",""),this.subnetMask=parseInt(this.parsedSubnet,10),this.subnet=`/${this.subnetMask}`,Number.isNaN(this.subnetMask)||this.subnetMask<0||this.subnetMask>h.BITS)throw new p.AddressError("Invalid subnet mask.");e=e.replace(h.RE_SUBNET_STRING,"")}else if(/\//.test(e))throw new p.AddressError("Invalid subnet mask.");let r=h.RE_ZONE_STRING.exec(e);r&&(this.zone=r[0],e=e.replace(h.RE_ZONE_STRING,"")),this.addressMinusSuffix=e,this.parsedAddress=this.parse(this.addressMinusSuffix)}static isValid(e){try{return new E(e),!0}catch(e){return!1}}static fromBigInteger(e){let t,s=e.toString(16).padStart(32,"0"),r=[];for(t=0;t<h.GROUPS;t++)r.push(s.slice(4*t,(t+1)*4));return new E(r.join(":"))}static fromURL(e){let t,s,r=null;if(-1!==e.indexOf("[")&&-1!==e.indexOf("]:")){if(null===(s=h.RE_URL_WITH_PORT.exec(e)))return{error:"failed to parse address with port",address:null,port:null};t=s[1],r=s[2]}else if(-1!==e.indexOf("/")){if(e=e.replace(/^[a-z0-9]+:\/\//,""),null===(s=h.RE_URL.exec(e)))return{error:"failed to parse address from URL",address:null,port:null};t=s[1]}else t=e;return r?((r=parseInt(r,10))<0||r>65536)&&(r=null):r=null,{address:new E(t),port:r}}static fromAddress4(e){let t=new c.Address4(e),s=h.BITS-(l.BITS-t.subnetMask);return new E(`::ffff:${t.correctForm()}/${s}`)}static fromArpa(e){let t=e.replace(/(\.ip6\.arpa)?\.$/,"");if(63!==t.length)throw new p.AddressError("Invalid 'ip6.arpa' form.");let s=t.split(".").reverse();for(let e=7;e>0;e--){let t=4*e;s.splice(t,0,":")}return new E(t=s.join(""))}microsoftTranscription(){return(0,g.sprintf)("%s.ipv6-literal.net",this.correctForm().replace(/:/g,"-"))}mask(e=this.subnetMask){return this.getBitsBase2(0,e)}possibleSubnets(e=128){let t=h.BITS-this.subnetMask-Math.abs(e-h.BITS);if(t<0)return"0";var s=new f.BigInteger("2",10).pow(t).toString(10);let r=/(\d+)(\d{3})/;for(;r.test(s);)s=s.replace(r,"$1,$2");return s}_startAddress(){return new f.BigInteger(this.mask()+"0".repeat(h.BITS-this.subnetMask),2)}startAddress(){return E.fromBigInteger(this._startAddress())}startAddressExclusive(){let e=new f.BigInteger("1");return E.fromBigInteger(this._startAddress().add(e))}_endAddress(){return new f.BigInteger(this.mask()+"1".repeat(h.BITS-this.subnetMask),2)}endAddress(){return E.fromBigInteger(this._endAddress())}endAddressExclusive(){let e=new f.BigInteger("1");return E.fromBigInteger(this._endAddress().subtract(e))}getScope(){let e=h.SCOPES[this.getBits(12,16).intValue()];return"Global unicast"===this.getType()&&"Link local"!==e&&(e="Global"),e||"Unknown"}getType(){for(let e of Object.keys(h.TYPES))if(this.isInSubnet(new E(e)))return h.TYPES[e];return"Global unicast"}getBits(e,t){return new f.BigInteger(this.getBitsBase2(e,t),2)}getBitsBase2(e,t){return this.binaryZeroPad().slice(e,t)}getBitsBase16(e,t){let s=t-e;if(s%4!=0)throw Error("Length of bits to retrieve must be divisible by four");return this.getBits(e,t).toString(16).padStart(s/4,"0")}getBitsPastSubnet(){return this.getBitsBase2(this.subnetMask,h.BITS)}reverseForm(e){e||(e={});let t=Math.floor(this.subnetMask/4),s=this.canonicalForm().replace(/:/g,"").split("").slice(0,t).reverse().join(".");return t>0?e.omitSuffix?s:(0,g.sprintf)("%s.ip6.arpa.",s):e.omitSuffix?"":"ip6.arpa."}correctForm(){let e,t=[],s=0,r=[];for(e=0;e<this.parsedAddress.length;e++){let t=parseInt(this.parsedAddress[e],16);0===t&&s++,0!==t&&s>0&&(s>1&&r.push([e-s,e-1]),s=0)}s>1&&r.push([this.parsedAddress.length-s,this.parsedAddress.length-1]);let i=r.map(e=>e[1]-e[0]+1);if(r.length>0){let e=i.indexOf(Math.max(...i));t=function(e,t){let s,r=[],i=[];for(s=0;s<e.length;s++)s<t[0]?r.push(e[s]):s>t[1]&&i.push(e[s]);return r.concat(["compact"]).concat(i)}(this.parsedAddress,r[e])}else t=this.parsedAddress;for(e=0;e<t.length;e++)"compact"!==t[e]&&(t[e]=parseInt(t[e],16).toString(16));let o=t.join(":");return(o=(o=o.replace(/^compact$/,"::")).replace(/^compact|compact$/,":")).replace(/compact/,"")}binaryZeroPad(){return this.bigInteger().toString(2).padStart(h.BITS,"0")}parse4in6(e){let t=e.split(":"),s=t.slice(-1)[0].match(l.RE_ADDRESS);if(s){this.parsedAddress4=s[0],this.address4=new c.Address4(this.parsedAddress4);for(let t=0;t<this.address4.groups;t++)if(/^0[0-9]+/.test(this.address4.parsedAddress[t]))throw new p.AddressError("IPv4 addresses can't have leading zeroes.",e.replace(l.RE_ADDRESS,this.address4.parsedAddress.map(y).join(".")));this.v4=!0,t[t.length-1]=this.address4.toGroup6(),e=t.join(":")}return e}parse(e){let t=(e=this.parse4in6(e)).match(h.RE_BAD_CHARACTERS);if(t)throw new p.AddressError((0,g.sprintf)("Bad character%s detected in address: %s",t.length>1?"s":"",t.join("")),e.replace(h.RE_BAD_CHARACTERS,'<span class="parse-error">$1</span>'));let s=e.match(h.RE_BAD_ADDRESS);if(s)throw new p.AddressError((0,g.sprintf)("Address failed regex: %s",s.join("")),e.replace(h.RE_BAD_ADDRESS,'<span class="parse-error">$1</span>'));let r=[],i=e.split("::");if(2===i.length){let e=i[0].split(":"),t=i[1].split(":");1===e.length&&""===e[0]&&(e=[]),1===t.length&&""===t[0]&&(t=[]);let s=this.groups-(e.length+t.length);if(!s)throw new p.AddressError("Error parsing groups");this.elidedGroups=s,this.elisionBegin=e.length,this.elisionEnd=e.length+this.elidedGroups,r=r.concat(e);for(let e=0;e<s;e++)r.push("0");r=r.concat(t)}else if(1===i.length)r=e.split(":"),this.elidedGroups=0;else throw new p.AddressError("Too many :: groups found");if((r=r.map(e=>(0,g.sprintf)("%x",parseInt(e,16)))).length!==this.groups)throw new p.AddressError("Incorrect number of groups found");return r}canonicalForm(){return this.parsedAddress.map(b).join(":")}decimal(){return this.parsedAddress.map(e=>(0,g.sprintf)("%05d",parseInt(e,16))).join(":")}bigInteger(){return new f.BigInteger(this.parsedAddress.map(b).join(""),16)}to4(){let e=this.binaryZeroPad().split("");return c.Address4.fromHex(new f.BigInteger(e.slice(96,128).join(""),2).toString(16))}to4in6(){let e=this.to4(),t=new E(this.parsedAddress.slice(0,6).join(":"),6).correctForm(),s="";return/:$/.test(t)||(s=":"),t+s+e.address}inspectTeredo(){let e=this.getBitsBase16(0,32),t=this.getBits(80,96).xor(new f.BigInteger("ffff",16)).toString(),s=c.Address4.fromHex(this.getBitsBase16(32,64)),r=c.Address4.fromHex(this.getBits(96,128).xor(new f.BigInteger("ffffffff",16)).toString(16)),i=this.getBits(64,80),o=this.getBitsBase2(64,80),a=i.testBit(15),l=i.testBit(14),h=i.testBit(8),u=i.testBit(9),d=new f.BigInteger(o.slice(2,6)+o.slice(8,16),2).toString(10);return{prefix:(0,g.sprintf)("%s:%s",e.slice(0,4),e.slice(4,8)),server4:s.address,client4:r.address,flags:o,coneNat:a,microsoft:{reserved:l,universalLocal:u,groupIndividual:h,nonce:d},udpPort:t}}inspect6to4(){let e=this.getBitsBase16(0,16),t=c.Address4.fromHex(this.getBitsBase16(16,48));return{prefix:(0,g.sprintf)("%s",e.slice(0,4)),gateway:t.address}}to6to4(){return this.is4()?new E(["2002",this.getBitsBase16(96,112),this.getBitsBase16(112,128),"","/16"].join(":")):null}toByteArray(){let e=this.bigInteger().toByteArray();return 17===e.length&&0===e[0]?e.slice(1):e}toUnsignedByteArray(){return this.toByteArray().map(S)}static fromByteArray(e){return this.fromUnsignedByteArray(e.map(S))}static fromUnsignedByteArray(e){let t=new f.BigInteger("256",10),s=new f.BigInteger("0",10),r=new f.BigInteger("1",10);for(let i=e.length-1;i>=0;i--)s=s.add(r.multiply(new f.BigInteger(e[i].toString(10),10))),r=r.multiply(t);return E.fromBigInteger(s)}isCanonical(){return this.addressMinusSuffix===this.canonicalForm()}isLinkLocal(){return"1111111010000000000000000000000000000000000000000000000000000000"===this.getBitsBase2(0,64)}isMulticast(){return"Multicast"===this.getType()}is4(){return this.v4}isTeredo(){return this.isInSubnet(new E("2001::/32"))}is6to4(){return this.isInSubnet(new E("2002::/16"))}isLoopback(){return"Loopback"===this.getType()}href(e){return e=void 0===e?"":(0,g.sprintf)(":%s",e),(0,g.sprintf)("http://[%s]%s/",this.correctForm(),e)}link(e){e||(e={}),void 0===e.className&&(e.className=""),void 0===e.prefix&&(e.prefix="/#address="),void 0===e.v4&&(e.v4=!1);let t=this.correctForm;return(e.v4&&(t=this.to4in6),e.className)?(0,g.sprintf)('<a href="%1$s%2$s" class="%3$s">%2$s</a>',e.prefix,t.call(this),e.className):(0,g.sprintf)('<a href="%1$s%2$s">%2$s</a>',e.prefix,t.call(this))}group(){if(0===this.elidedGroups)return u.simpleGroup(this.address).join(":");m("number"==typeof this.elidedGroups),m("number"==typeof this.elisionBegin);let e=[],[t,s]=this.address.split("::");t.length?e.push(...u.simpleGroup(t)):e.push("");let r=["hover-group"];for(let e=this.elisionBegin;e<this.elisionBegin+this.elidedGroups;e++)r.push((0,g.sprintf)("group-%d",e));return e.push((0,g.sprintf)('<span class="%s"></span>',r.join(" "))),s.length?e.push(...u.simpleGroup(s,this.elisionEnd)):e.push(""),this.is4()&&(m(this.address4 instanceof c.Address4),e.pop(),e.push(this.address4.groupForV6())),e.join(":")}regularExpressionString(e=!1){let t=[],s=new E(this.correctForm());if(0===s.elidedGroups)t.push((0,d.simpleRegularExpression)(s.parsedAddress));else if(s.elidedGroups===h.GROUPS)t.push((0,d.possibleElisions)(h.GROUPS));else{let e=s.address.split("::");e[0].length&&t.push((0,d.simpleRegularExpression)(e[0].split(":"))),m("number"==typeof s.elidedGroups),t.push((0,d.possibleElisions)(s.elidedGroups,0!==e[0].length,0!==e[1].length)),e[1].length&&t.push((0,d.simpleRegularExpression)(e[1].split(":"))),t=[t.join(":")]}return e||(t=["(?=^|",d.ADDRESS_BOUNDARY,"|[^\\w\\:])(",...t,")(?=[^\\w\\:]|",d.ADDRESS_BOUNDARY,"|$)"]),t.join("")}regularExpression(e=!1){return RegExp(this.regularExpressionString(e),"i")}}t.Address6=E},79755:(e,t,s)=>{"use strict";let{version:r}=s(73483),{EventEmitter:i}=s(94735),{Worker:o}=s(73566),{join:a}=s(33873),{pathToFileURL:l}=s(79551),{wait:h}=s(10010),{WRITE_INDEX:u,READ_INDEX:c}=s(18583),d=s(79428),p=s(12412),f=Symbol("kImpl"),g=d.constants.MAX_STRING_LENGTH;class m{constructor(e){this._value=e}deref(){return this._value}}class y{register(){}unregister(){}}let b=process.env.NODE_V8_COVERAGE?y:global.FinalizationRegistry||y,S=process.env.NODE_V8_COVERAGE?m:global.WeakRef||m,E=new b(e=>{e.exited||e.terminate()});function v(e){p(!e[f].sync),e[f].needDrain&&(e[f].needDrain=!1,e.emit("drain"))}function w(e){let t=Atomics.load(e[f].state,u),s=e[f].data.length-t;if(s>0){if(0===e[f].buf.length){e[f].flushing=!1,e[f].ending?O(e):e[f].needDrain&&process.nextTick(v,e);return}let t=e[f].buf.slice(0,s),r=Buffer.byteLength(t);r<=s?(e[f].buf=e[f].buf.slice(s),N(e,t,w.bind(null,e))):e.flush(()=>{if(!e.destroyed){for(Atomics.store(e[f].state,c,0),Atomics.store(e[f].state,u,0);r>e[f].data.length;)s/=2,t=e[f].buf.slice(0,s),r=Buffer.byteLength(t);e[f].buf=e[f].buf.slice(s),N(e,t,w.bind(null,e))}})}else if(0===s){if(0===t&&0===e[f].buf.length)return;e.flush(()=>{Atomics.store(e[f].state,c,0),Atomics.store(e[f].state,u,0),w(e)})}else A(e,Error("overwritten"))}function T(e){let t=this.stream.deref();if(void 0===t){this.exited=!0,this.terminate();return}switch(e.code){case"READY":this.stream=new S(t),t.flush(()=>{t[f].ready=!0,t.emit("ready")});break;case"ERROR":A(t,e.err);break;case"EVENT":Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case"WARNING":process.emitWarning(e.err);break;default:A(t,Error("this should not happen: "+e.code))}}function I(e){let t=this.stream.deref();void 0!==t&&(E.unregister(t),t.worker.exited=!0,t.worker.off("exit",I),A(t,0!==e?Error("the worker thread exited"):null))}class k extends i{constructor(e={}){if(super(),e.bufferSize<4)throw Error("bufferSize must at least fit a 4-byte utf-8 char");this[f]={},this[f].stateBuf=new SharedArrayBuffer(128),this[f].state=new Int32Array(this[f].stateBuf),this[f].dataBuf=new SharedArrayBuffer(e.bufferSize||4194304),this[f].data=Buffer.from(this[f].dataBuf),this[f].sync=e.sync||!1,this[f].ending=!1,this[f].ended=!1,this[f].needDrain=!1,this[f].destroyed=!1,this[f].flushing=!1,this[f].ready=!1,this[f].finished=!1,this[f].errored=null,this[f].closed=!1,this[f].buf="",this.worker=function(e,t){let{filename:s,workerData:i}=t,h=new o(("__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{})["thread-stream-worker"]||a(__dirname,"lib","worker.js"),{...t.workerOpts,trackUnmanagedFds:!1,workerData:{filename:0===s.indexOf("file://")?s:l(s).href,dataBuf:e[f].dataBuf,stateBuf:e[f].stateBuf,workerData:{$context:{threadStreamVersion:r},...i}}});return h.stream=new m(e),h.on("message",T),h.on("exit",I),E.register(e,h),h}(this,e),this.on("message",(e,t)=>{this.worker.postMessage(e,t)})}write(e){if(this[f].destroyed)return C(this,Error("the worker has exited")),!1;if(this[f].ending)return C(this,Error("the worker is ending")),!1;if(this[f].flushing&&this[f].buf.length+e.length>=g)try{B(this),this[f].flushing=!0}catch(e){return A(this,e),!1}if(this[f].buf+=e,this[f].sync)try{return B(this),!0}catch(e){return A(this,e),!1}return this[f].flushing||(this[f].flushing=!0,setImmediate(w,this)),this[f].needDrain=this[f].data.length-this[f].buf.length-Atomics.load(this[f].state,u)<=0,!this[f].needDrain}end(){this[f].destroyed||(this[f].ending=!0,O(this))}flush(e){if(this[f].destroyed){"function"==typeof e&&process.nextTick(e,Error("the worker has exited"));return}let t=Atomics.load(this[f].state,u);h(this[f].state,c,t,1/0,(t,s)=>{if(t){A(this,t),process.nextTick(e,t);return}if("not-equal"===s)return void this.flush(e);process.nextTick(e)})}flushSync(){this[f].destroyed||(B(this),_(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[f].ready}get destroyed(){return this[f].destroyed}get closed(){return this[f].closed}get writable(){return!this[f].destroyed&&!this[f].ending}get writableEnded(){return this[f].ending}get writableFinished(){return this[f].finished}get writableNeedDrain(){return this[f].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[f].errored}}function C(e,t){setImmediate(()=>{e.emit("error",t)})}function A(e,t){e[f].destroyed||(e[f].destroyed=!0,t&&(e[f].errored=t,C(e,t)),e.worker.exited?setImmediate(()=>{e[f].closed=!0,e.emit("close")}):e.worker.terminate().catch(()=>{}).then(()=>{e[f].closed=!0,e.emit("close")}))}function N(e,t,s){let r=Atomics.load(e[f].state,u),i=Buffer.byteLength(t);return e[f].data.write(t,r),Atomics.store(e[f].state,u,r+i),Atomics.notify(e[f].state,u),s(),!0}function O(e){if(!e[f].ended&&e[f].ending&&!e[f].flushing){e[f].ended=!0;try{e.flushSync();let t=Atomics.load(e[f].state,c);Atomics.store(e[f].state,u,-1),Atomics.notify(e[f].state,u);let s=0;for(;-1!==t;){if(Atomics.wait(e[f].state,c,t,1e3),t=Atomics.load(e[f].state,c),-2===t)return void A(e,Error("end() failed"));if(10==++s)return void A(e,Error("end() took too long (10s)"))}process.nextTick(()=>{e[f].finished=!0,e.emit("finish")})}catch(t){A(e,t)}}}function B(e){let t=()=>{e[f].ending?O(e):e[f].needDrain&&process.nextTick(v,e)};for(e[f].flushing=!1;0!==e[f].buf.length;){let s=Atomics.load(e[f].state,u),r=e[f].data.length-s;if(0===r){_(e),Atomics.store(e[f].state,c,0),Atomics.store(e[f].state,u,0);continue}if(r<0)throw Error("overwritten");let i=e[f].buf.slice(0,r),o=Buffer.byteLength(i);if(o<=r)e[f].buf=e[f].buf.slice(r),N(e,i,t);else{for(_(e),Atomics.store(e[f].state,c,0),Atomics.store(e[f].state,u,0);o>e[f].buf.length;)r/=2,i=e[f].buf.slice(0,r),o=Buffer.byteLength(i);e[f].buf=e[f].buf.slice(r),N(e,i,t)}}}function _(e){if(e[f].flushing)throw Error("unable to flush while flushing");let t=Atomics.load(e[f].state,u),s=0;for(;;){let r=Atomics.load(e[f].state,c);if(-2===r)throw Error("_flushSync failed");if(r!==t)Atomics.wait(e[f].state,c,r,1e3);else break;if(10==++s)throw Error("_flushSync took too long (10s)")}}e.exports=k},80419:e=>{"use strict";if("undefined"!=typeof SharedArrayBuffer&&"undefined"!=typeof Atomics){let t=new Int32Array(new SharedArrayBuffer(4));e.exports=function(e){if(!1==(e>0&&e<1/0)){if("number"!=typeof e&&"bigint"!=typeof e)throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}Atomics.wait(t,0,0,Number(e))}}else e.exports=function(e){if(!1==(e>0&&e<1/0)){if("number"!=typeof e&&"bigint"!=typeof e)throw TypeError("sleep: ms must be a number");throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity")}let t=Date.now()+Number(e);for(;t>Date.now(););}},80876:(e,t,s)=>{"use strict";let r=s(48376),{resolveCharset:i}=s(94670),{compiler:o}=s(72136),{createHash:a}=s(55511),{JPDecoder:l}=s(11512),h=s(50860),u=["red","orange","yellow","green","blue","purple","grey"];class c extends Error{authenticationFailed=!0}let d={encodePath(e,t){if(t=(t||"").toString(),!e.enabled.has("UTF8=ACCEPT")&&/[&\x00-\x08\x0b-\x0c\x0e-\x1f\u0080-\uffff]/.test(t))try{t=h.encode(t,"utf-7-imap").toString()}catch(e){}return t},decodePath(e,t){if(t=(t||"").toString(),!e.enabled.has("UTF8=ACCEPT")&&/[&]/.test(t))try{t=h.decode(Buffer.from(t),"utf-7-imap").toString()}catch(e){}return t},normalizePath:(e,t,s)=>(Array.isArray(t)&&(t=t.join(e.namespace&&e.namespace.delimiter||"")),"INBOX"===t.toUpperCase())?"INBOX":(!s&&e.namespace&&e.namespace.prefix&&0!==t.indexOf(e.namespace.prefix)&&(t=e.namespace.prefix+t),t),comparePaths:(e,t,s)=>!!t&&!!s&&d.normalizePath(e,t)===d.normalizePath(e,s),updateCapabilities(e){let t=new Map;return e&&Array.isArray(e)&&e.forEach(e=>{if("string"!=typeof e.value)return!1;let s=e.value.toUpperCase().trim();if("IMAP4REV1"===s)return void t.set("IMAP4rev1",!0);if(0===s.indexOf("APPENDLIMIT=")){let e=s.indexOf("="),r=Number(s.substr(e+1))||0;t.set("APPENDLIMIT",r);return}t.set(s,!0)}),t},AuthenticationFailure:c,getStatusCode:e=>!!e&&!!e.attributes&&!!e.attributes[0]&&!!e.attributes[0].section&&!!e.attributes[0].section[0]&&"string"==typeof e.attributes[0].section[0].value&&e.attributes[0].section[0].value.toUpperCase().trim(),getErrorText:async e=>!!e&&(await o(e)).toString(),getFolderTree(e){let t={root:!0,folders:[]},s=e=>{let s=t;if(!e||!e.length)return s;for(let t of e){let e=s.folders&&s.folders.find(e=>e.name===t);e?s=e:e={name:t,folders:[]}}return s};for(let t of e){let e=s(t.parent),r=e.folders&&e.folders.find(e=>e.name===t.name);if(r)r.name=t.name,r.flags=t.flags,r.path=t.path,r.subscribed=!!t.subscribed,r.listed=!!t.listed,r.status=!!t.status,t.specialUse&&(r.specialUse=t.specialUse),t.flags.has("\\Noselect")&&(r.disabled=!0),t.flags.has("\\HasChildren")&&!r.folders&&(r.folders=[]);else{let s={name:t.name,flags:t.flags,path:t.path,subscribed:!!t.subscribed,listed:!!t.listed,status:!!t.status};t.delimiter&&(s.delimiter=t.delimiter),t.specialUse&&(s.specialUse=t.specialUse),t.flags.has("\\Noselect")&&(s.disabled=!0),t.flags.has("\\HasChildren")&&(s.folders=[]),e.folders||(e.folders=[]),e.folders.push(s)}}return t},getFlagColor(e){if(!e.has("\\Flagged"))return null;let t=+!!e.has("$MailFlagBit0"),s=2*!!e.has("$MailFlagBit1");return u[t|s|4*!!e.has("$MailFlagBit2")]||"red"},getColorFlags(e){let t=e?u.indexOf((e||"").toString().toLowerCase().trim()):null;if(t<0&&null!==t)return null;let s=[];s[0]=1&t,s[1]=2&t,s[2]=4&t;let r={add:t?["\\Flagged"]:[],remove:t?[]:["\\Flagged"]};for(let e=0;e<s.length;e++)s[e]?r.add.push(`$MailFlagBit${e}`):r.remove.push(`$MailFlagBit${e}`);return r},async formatMessageResponse(e,t){let s,r={};r.seq=Number(e.command);let i=e.attributes&&e.attributes[1]||[];for(let e=0,a=i.length;e<a;e++){let a=i[e];if(e%2==0){s=(await o({attributes:[a]})).toString().toLowerCase().replace(/<\d+(\.\d+)?>$/,"");continue}if("string"!=typeof s)continue;let l=e=>!!e&&("string"==typeof e.value?e.value:Buffer.isBuffer(e.value)?e.value.toString():void 0),h=e=>!!e&&(Buffer.isBuffer(e.value)?e.value:void 0),u=e=>{if(Array.isArray(e))return e.map(e=>!!e&&"string"==typeof e.value&&e.value).filter(e=>e)};switch(s){case"body[]":case"binary[]":r.source=h(a);break;case"uid":r.uid=Number(l(a)),r.uid&&(!t.uidNext||t.uidNext<=r.uid)&&(t.uidNext=r.uid+1);break;case"modseq":r.modseq=BigInt(u(a)[0]),r.modseq&&(!t.highestModseq||t.highestModseq<r.modseq)&&(t.highestModseq=r.modseq);break;case"emailid":r.emailId=u(a)[0];break;case"x-gm-msgid":r.emailId=l(a);break;case"threadid":r.threadId=u(a)[0];break;case"x-gm-thrid":r.threadId=l(a);break;case"x-gm-labels":r.labels=new Set(u(a));break;case"rfc822.size":r.size=Number(l(a))||0;break;case"flags":r.flags=new Set(u(a));break;case"envelope":r.envelope=d.parseEnvelope(a);break;case"bodystructure":r.bodyStructure=d.parseBodystructure(a);break;case"internaldate":{let e=l(a),t=new Date(e);"Invalid Date"===t.toString()?r.internalDate=e:r.internalDate=t;break}default:if(s.match(/(body|binary)\[/i)){let e=s.replace(/^(body|binary)\[|]$/gi,"");e=e.replace(/\.fields.*$/g,"");let t=h(a);if("header"===e){r.headers=t;break}r.bodyParts||(r.bodyParts=new Map),r.bodyParts.set(e,t)}}}if(r.emailId||r.uid){let e=t.path;if(/[0x80-0xff]/.test(e))try{e=h.encode(e,"utf-7-imap").toString()}catch(e){}r.id=r.emailId||a("md5").update([e,t.uidValidity?.toString()||"",r.uid.toString()].join(":")).digest("hex")}if(r.flags){let e=d.getFlagColor(r.flags);e&&(r.flagColor=e)}return r},processName:e=>((e=(e||"").toString()).length>2&&'"'===e.at(0)&&'"'===e.at(-1)&&(e=e.replace(/^"|"$/g,"")),e),parseEnvelope(e){let t=e=>!!e&&("string"==typeof e.value?e.value:Buffer.isBuffer(e.value)?e.value.toString():e.value),s=function(e){return[].concat(e||[]).map(e=>{let s=(t(e[2])||"")+"@"+(t(e[3])||"");return"@"===s&&(s=""),{name:d.processName(r.decodeWords(t(e[0]))),address:s}}).filter(e=>e.name||e.address)},i={};if(e[0]&&e[0].value){let s=new Date(t(e[0]));"Invalid Date"===s.toString()?i.date=t(e[0]):i.date=s}return e[1]&&e[1].value&&(i.subject=r.decodeWords(t(e[1]))),e[2]&&e[2].length&&(i.from=s(e[2])),e[3]&&e[3].length&&(i.sender=s(e[3])),e[4]&&e[4].length&&(i.replyTo=s(e[4])),e[5]&&e[5].length&&(i.to=s(e[5])),e[6]&&e[6].length&&(i.cc=s(e[6])),e[7]&&e[7].length&&(i.bcc=s(e[7])),e[8]&&e[8].value&&(i.inReplyTo=(t(e[8])||"").toString().trim()),e[9]&&e[9].value&&(i.messageId=(t(e[9])||"").toString().trim()),i},getStructuredParams(e){let t,s={};if([].concat(e||[]).forEach((e,i)=>{i%2?s[t]=r.decodeWords((e&&e.value||"").toString()):t=(e&&e.value||"").toString().toLowerCase()}),s.filename&&!s["filename*"]&&/^[a-z\-_0-9]+'[a-z]*'[^'\x00-\x08\x0b\x0c\x0e-\x1f\u0080-\uFFFF]+/.test(s.filename)){let[e,,t]=s.filename.split("'");i(e)&&(s["filename*"]=`${e}''${t}`)}return Object.keys(s).forEach(e=>{let t,r,i,o=e.match(/\*((\d+)\*?)?$/);o&&(t=e.substr(0,o.index).toLowerCase(),r=Number(o[2])||0,s[t]&&"object"==typeof s[t]||(s[t]={charset:!1,values:[]}),i=s[e],0===r&&"*"===o[0].charAt(o[0].length-1)&&(o=i.match(/^([^']*)'[^']*'(.*)$/))&&(s[t].charset=o[1]||"utf-8",i=o[2]),s[t].values.push({nr:r,value:i}),delete s[e])}),Object.keys(s).forEach(e=>{let t;s[e]&&Array.isArray(s[e].values)&&(t=s[e].values.sort((e,t)=>e.nr-t.nr).map(e=>e&&e.value||"").join(""),s[e].charset?s[e]=r.decodeWords("=?"+s[e].charset+"?Q?"+t.replace(/[=?_\s]/g,e=>{let t=e.charCodeAt(0).toString(16);return" "===e?"_":"%"+(t.length<2?"0":"")+t}).replace(/%/g,"=")+"?="):s[e]=r.decodeWords(t))}),s},parseBodystructure(e){let t=(e,s)=>{let r={},i=0,o=0;if((s=s||[]).length&&(r.part=s.join(".")),Array.isArray(e[0])){for(r.childNodes=[];Array.isArray(e[i]);)r.childNodes.push(t(e[i],s.concat(++o))),i++;r.type="multipart/"+((e[i++]||{}).value||"").toString().toLowerCase(),i<e.length-1&&(e[i]&&(r.parameters=d.getStructuredParams(e[i])),i++)}else r.type=[((e[i++]||{}).value||"").toString().toLowerCase(),((e[i++]||{}).value||"").toString().toLowerCase()].join("/"),e[i]&&(r.parameters=d.getStructuredParams(e[i])),e[++i]&&(r.id=((e[i]||{}).value||"").toString()),e[++i]&&(r.description=((e[i]||{}).value||"").toString()),e[++i]&&(r.encoding=((e[i]||{}).value||"").toString().toLowerCase()),e[++i]&&(r.size=Number((e[i]||{}).value||0)||0),i++,"message/rfc822"===r.type&&(e[i]&&(r.envelope=d.parseEnvelope([].concat(e[i]||[]))),e[++i]&&(r.childNodes=[t(e[i],s)]),e[++i]&&(r.lineCount=Number((e[i]||{}).value||0)||0),i++),/^text\//.test(r.type)&&(11===e.length&&Array.isArray(e[i+1])&&!Array.isArray(e[i+2])||(e[i]&&(r.lineCount=Number((e[i]||{}).value||0)||0),i++)),i<e.length-1&&(e[i]&&(r.md5=((e[i]||{}).value||"").toString().toLowerCase()),i++);return i<e.length-1&&(Array.isArray(e[i])&&e[i].length&&(r.disposition=((e[i][0]||{}).value||"").toString().toLowerCase(),Array.isArray(e[i][1])&&(r.dispositionParameters=d.getStructuredParams(e[i][1]))),i++),i<e.length-1&&(e[i]&&(r.language=[].concat(e[i]||[]).map(e=>(e&&e.value||"").toString().toLowerCase())),i++),i<e.length-1&&(e[i]&&(r.location=((e[i]||{}).value||"").toString()),i++),r};return t(e)},formatDate:e=>("string"==typeof e&&(e=new Date(e)),"[object Object]"!==Object.prototype.toString(e)||"Invalid Date"===e.toString())?void 0:((e=(e=e.toISOString().substr(0,10)).split("-")).reverse(),e[1]=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][Number(e[1])-1],e.join("-")),formatDateTime(e){if(!e||("string"==typeof e&&(e=new Date(e)),"[object Object]"!==Object.prototype.toString(e)||"Invalid Date"===e.toString()))return;let t=d.formatDate(e).replace(/^0/," "),s=e.toISOString().substr(11,8);return`${t} ${s} +0000`},formatFlag(e){switch(e.toLowerCase()){case"\\recent":return!1;case"\\seen":case"\\answered":case"\\flagged":case"\\deleted":case"\\draft":return e.toLowerCase().replace(/^\\./,e=>e.toUpperCase())}return e},canUseFlag:(e,t)=>!e||!e.permanentFlags||e.permanentFlags.has("\\*")||e.permanentFlags.has(t),expandRange:e=>e.split(",").flatMap(e=>{let t=(e=e.trim()).indexOf(":");if(t<0)return Number(e)||0;let s=Number(e.substr(0,t))||0,r=Number(e.substr(t+1))||0;if(s===r)return s;let i=[];if(s<r)for(let e=s;e<=r;e++)i.push(e);else for(let e=s;e>=r;e--)i.push(e);return i}),getDecoder:e=>(e=(e||"ascii").toString().trim().toLowerCase(),/^jis|^iso-?2022-?jp|^EUCJP/i.test(e))?new l(e):h.decodeStream(e),packMessageRange(e){if("string"!=typeof uidList||Array.isArray(e)||(e=[].concat(e||[])),!e.length)return"";e.sort((e,t)=>e-t);let t=[[e[e.length-1]]];for(let s=e.length-2;s>=0;s--){if(e[s]===e[s+1]-1){t[0].unshift(e[s]);continue}t.unshift([e[s]])}return(t=t.map(e=>1===e.length?e[0]:e.shift()+":"+e.pop())).join(",")}};e.exports=d},80882:e=>{"use strict";e.exports=async e=>{if(e.state===e.states.SELECTED)try{(await e.exec("CLOSE")).next();let t=e.mailbox;return e.mailbox=!1,e.currentSelectCommand=!1,e.state=e.states.AUTHENTICATED,t&&e.emit("mailboxClose",t),!0}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},81866:(e,t,s)=>{"use strict";let r=s(48376);class i{constructor(e,t){t=t||{},Array.isArray(e)?(this.changed=!0,this.headers=!1,this.parsed=!0,this.lines=e):(this.changed=!1,this.headers=e,this.parsed=!1,this.lines=!1),this.mbox=!1,this.http=!1,this.libmime=new r.Libmime({Iconv:t.Iconv})}hasHeader(e){return this.parsed||this._parseHeaders(),e=this._normalizeHeader(e),"object"==typeof this.lines.find(t=>t.key===e)}get(e){return this.parsed||this._parseHeaders(),e=this._normalizeHeader(e),this.lines.filter(t=>t.key===e).map(e=>e.line)}getDecoded(e){return this.get(e).map(e=>this.libmime.decodeHeader(e)).filter(e=>e&&e.value)}getFirst(e){this.parsed||this._parseHeaders(),e=this._normalizeHeader(e);let t=this.lines.find(t=>t.key===e);return t?((this.libmime.decodeHeader(t.line)||{}).value||"").toString().trim():""}getList(){return this.parsed||this._parseHeaders(),this.lines}add(e,t,s){void 0!==t&&("number"==typeof t&&(t=t.toString()),"string"==typeof t&&(t=Buffer.from(t)),t=t.toString("binary"),this.addFormatted(e,this.libmime.foldLines(e+": "+t.replace(/\r?\n/g,""),76,!1),s))}addFormatted(e,t,s){if(this.parsed||this._parseHeaders(),s=s||0,this.changed=!0,!t)return;"string"!=typeof t&&(t=t.toString("binary"));let r={key:this._normalizeHeader(e),line:t};s<1?this.lines.unshift(r):s>=this.lines.length?this.lines.push(r):this.lines.splice(s,0,r)}remove(e){this.parsed||this._parseHeaders(),e=this._normalizeHeader(e);for(let t=this.lines.length-1;t>=0;t--)this.lines[t].key===e&&(this.changed=!0,this.lines.splice(t,1))}update(e,t,s){this.parsed||this._parseHeaders();let r=e,i=0;e=this._normalizeHeader(e);let o=0,a=!1;for(let t=this.lines.length-1;t>=0;t--)if(this.lines[t].key===e){if(s&&s!==o){o++;continue}if(i=t,this.changed=!0,this.lines.splice(t,1),s){a=!0;break}}(!s||a)&&this.add(r,t,i)}build(e){if(!this.changed&&!e)return"string"==typeof this.headers?Buffer.from(this.headers,"binary"):this.headers;this.parsed||this._parseHeaders(),e=e||"\r\n";let t=this.lines.map(t=>t.line.replace(/\r?\n/g,e)).join(e)+`${e}${e}`;return this.mbox&&(t=this.mbox+e+t),this.http&&(t=this.http+e+t),Buffer.from(t,"binary")}_normalizeHeader(e){return(e||"").toLowerCase().trim()}_parseHeaders(){if(!this.headers){this.lines=[],this.parsed=!0;return}let e=this.headers.toString("binary").replace(/[\r\n]+$/,"").split(/\r?\n/);for(let t=e.length-1;t>=0;t--){let s=e[t].charAt(0);if(t&&(" "===s||" "===s))e[t-1]+="\r\n"+e[t],e.splice(t,1);else{let s=e[t];if(!t&&/^From /i.test(s)){this.mbox=s,e.splice(t,1);continue}if(!t&&/^POST /i.test(s)){this.http=s,e.splice(t,1);continue}let r=this._normalizeHeader(s.substr(0,s.indexOf(":")));e[t]={key:r,line:s}}}this.lines=e,this.parsed=!0}}e.exports=i},83360:e=>{"use strict";let t=Symbol("circular-ref-tag"),s=Symbol("pino-raw-err-ref"),r=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[s]},set:function(e){this[s]=e}}});Object.defineProperty(r,s,{writable:!0,value:{}}),e.exports={pinoErrProto:r,pinoErrorSymbols:{seen:t,rawSymbol:s}}},83426:(e,t,s)=>{"use strict";let{encodePath:r,getStatusCode:i,normalizePath:o,getErrorText:a}=s(80876);e.exports=async(e,t)=>{let s;if(![e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)||!t)return;if(!e.capabilities.has("QUOTA"))return!1;let l={path:t=o(e,t)},h=e=>{let t=e.attributes&&e.attributes[1];if(!t||!t.length)return!1;let s=!1;t.forEach((e,t)=>{if(t%3==0){s=!!e&&"string"==typeof e.value&&e.value.toLowerCase();return}if(!s)return;let r=!(!e||"string"!=typeof e.value||isNaN(e.value))&&Number(e.value);!1!==r&&(t%3==1&&(l[s]||(l[s]={}),l[s].usage=r*("storage"===s?1024:1)),t%3==2&&(l[s]||(l[s]={}),l[s].limit=r*("storage"===s?1024:1),l[s].limit&&(l[s].status=Math.round((l[s].usage||0)/l[s].limit*100)+"%")))})},u=!1;try{return(await e.exec("GETQUOTAROOT",[{type:"ATOM",value:r(e,t)}],{untagged:{QUOTAROOT:async e=>{let t=!!e.attributes&&!!e.attributes[1]&&"string"==typeof e.attributes[1].value&&e.attributes[1].value;t&&(l.quotaRoot=t)},QUOTA:async e=>{u=!0,h(e)}}})).next(),l.quotaRoot&&!u&&await e.exec("GETQUOTA",[{type:"ATOM",value:l.quotaRoot}],{untagged:{QUOTA:async e=>{h(e)}}}),l}catch(s){let t=i(s.response);return t&&(s.serverResponseCode=t),s.response=await a(s.response),e.log.warn({err:s,cid:e.id}),!1}}},84822:(e,t,s)=>{"use strict";let{getStatusCode:r,getErrorText:i}=s(80876);e.exports=async(e,t,s)=>{let o;if(e.state!==e.states.SELECTED||!t)return;s=s||{},await e.messageFlagsAdd(t,["\\Deleted"],s);let a=s.uid&&e.capabilities.has("UIDPLUS");try{let s=(o=await e.exec(a?"UID EXPUNGE":"EXPUNGE",!!a&&[{type:"SEQUENCE",value:t}])).response.attributes&&o.response.attributes[0]&&o.response.attributes[0].section,r=s&&s.length&&s[0]&&"string"==typeof s[0].value?s[0].value:"";if("HIGHESTMODSEQ"===r.toUpperCase()){let t=!(!s[1]||"string"!=typeof s[1].value||isNaN(s[1].value))&&BigInt(s[1].value);t&&(!e.mailbox.highestModseq||t>e.mailbox.highestModseq)&&(e.mailbox.highestModseq=t)}return o.next(),!0}catch(s){let t=r(s.response);return t&&(s.serverResponseCode=t),s.response=await i(s.response),e.log.warn({err:s,cid:e.id}),!1}}},85389:e=>{"use strict";function t(e,t){let s=[];for(let r=e;r<=t;r++)s.push(r);return String.fromCharCode(...s)}function s(e,t){let s=Array.prototype.slice.call(e);for(let e=s.length-1;e>=0;e--)t.indexOf(s[e])>=0&&s.splice(e,1);return s.join("")}e.exports={CHAR(){let e=t(1,127);return this.CHAR=function(){return e},e},CHAR8(){let e=t(1,255);return this.CHAR8=function(){return e},e},SP:()=>" ",CTL(){let e=t(0,31)+"";return this.CTL=function(){return e},e},DQUOTE:()=>'"',ALPHA(){let e=t(65,90)+t(97,122);return this.ALPHA=function(){return e},e},DIGIT(){let e=t(48,57);return this.DIGIT=function(){return e},e},"ATOM-CHAR"(){let e=s(this.CHAR(),this["atom-specials"]());return this["ATOM-CHAR"]=function(){return e},e},"ASTRING-CHAR"(){let e=this["ATOM-CHAR"]()+this["resp-specials"]();return this["ASTRING-CHAR"]=function(){return e},e},"TEXT-CHAR"(){let e=s(this.CHAR(),"\r\n");return this["TEXT-CHAR"]=function(){return e},e},"atom-specials"(){let e="(){"+this.SP()+this.CTL()+this["list-wildcards"]()+this["quoted-specials"]()+this["resp-specials"]();return this["atom-specials"]=function(){return e},e},"list-wildcards":()=>"%*","quoted-specials"(){let e=this.DQUOTE()+"\\";return this["quoted-specials"]=function(){return e},e},"resp-specials":()=>"]",tag(){let e=s(this["ASTRING-CHAR"](),"+");return this.tag=function(){return e},e},command(){let e=this.ALPHA()+this.DIGIT()+"-";return this.command=function(){return e},e},verify(e,t){for(let s=0,r=e.length;s<r;s++)if(0>t.indexOf(e.charAt(s)))return s;return -1}}},85989:function(e,t,s){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,s,r){void 0===r&&(r=s);var i=Object.getOwnPropertyDescriptor(t,s);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[s]}}),Object.defineProperty(e,r,i)}:function(e,t,s,r){void 0===r&&(r=s),e[r]=t[s]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var s in e)"default"!==s&&Object.prototype.hasOwnProperty.call(e,s)&&r(t,e,s);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.v6=t.AddressError=t.Address6=t.Address4=void 0;let a=s(36558);Object.defineProperty(t,"Address4",{enumerable:!0,get:function(){return a.Address4}});let l=s(79104);Object.defineProperty(t,"Address6",{enumerable:!0,get:function(){return l.Address6}});let h=s(11990);Object.defineProperty(t,"AddressError",{enumerable:!0,get:function(){return h.AddressError}}),t.v6={helpers:o(s(56687))}},86501:(e,t,s)=>{"use strict";let{createRequire:r}=s(8086),i=s(96133),{join:o,isAbsolute:a,sep:l}=s(76760),h=s(80419),u=s(65049),c=s(79755);function d(e){e.ref(),e.flushSync(),e.end(),e.once("close",function(){e.unref()})}function p(e){e.flushSync()}e.exports=function(e){let{pipeline:t,targets:s,levels:f,dedupe:g,worker:m={},caller:y=i(),sync:b=!1}=e,S={...e.options},E="string"==typeof y?[y]:y,v="__bundlerPathsOverrides"in globalThis?globalThis.__bundlerPathsOverrides:{},w=e.target;if(w&&s)throw Error("only one of target or targets can be specified");s?(w=v["pino-worker"]||o(__dirname,"worker.js"),S.targets=s.filter(e=>e.target).map(e=>({...e,target:k(e.target)})),S.pipelines=s.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:k(t.target)})))):t&&(w=v["pino-worker"]||o(__dirname,"worker.js"),S.pipelines=[t.map(e=>({...e,target:k(e.target)}))]),f&&(S.levels=f),g&&(S.dedupe=g),S.pinoWillSendConfig=!0;let T=new c({filename:k(w),workerData:S,workerOpts:m,sync:b});function I(){T.closed||(T.flushSync(),h(100),T.end())}return T.on("ready",function(){process.removeListener("exit",I),T.unref(),!1!==m.autoEnd&&(u.register(T,d),u.registerBeforeExit(T,p),T.on("close",function(){u.unregister(T)}))}),T.on("close",function(){process.removeListener("exit",I)}),process.on("exit",I),T;function k(e){let t;if(a(e=v[e]||e)||0===e.indexOf("file://"))return e;if("pino/file"===e)return o(__dirname,"..","file.js");for(let s of E)try{let i="node:repl"===s?process.cwd()+l:s;t=r(i).resolve(e);break}catch(e){continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}},87005:e=>{"use strict";async function t(e){try{let t={};return(await e.exec("LIST",["",""],{untagged:{LIST:async e=>{e.attributes&&e.attributes.length&&(t.flags=new Set(e.attributes[0].map(e=>e.value)),t.delimiter=e.attributes[1]&&e.attributes[1].value,t.prefix=e.attributes[2]&&e.attributes[2].value||"",t.delimiter&&t.prefix.charAt(0)===t.delimiter&&(t.prefix=t.prefix.slice(1)))}}})).next(),t}catch(t){return e.log.warn({err:t,cid:e.id}),{}}}function s(e){return!!e&&!!e.length&&e.filter(e=>e.length>=2&&"string"==typeof e[0].value&&"string"==typeof e[1].value).map(e=>{let t=e[0].value,s=e[1].value;return s&&t&&t.charAt(t.length-1)!==s&&(t+=s),{prefix:t,delimiter:s}})}e.exports=async e=>{let r;if([e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)){if(!e.capabilities.has("NAMESPACE")){let{prefix:s,delimiter:r}=await t(e);return r&&s&&s.charAt(s.length-1)!==r&&(s+=r),e.namespaces={personal:[{prefix:s||"",delimiter:r}],other:!1,shared:!1},e.namespace=e.namespaces.personal[0],e.namespace}try{let t={};return r=await e.exec("NAMESPACE",!1,{untagged:{NAMESPACE:async e=>{e.attributes&&e.attributes.length&&(t.personal=s(e.attributes[0]),t.other=s(e.attributes[1]),t.shared=s(e.attributes[2]))}}}),e.namespaces=t,e.namespaces.personal[0]||(e.namespaces.personal[0]={prefix:"",delimiter:"."}),e.namespaces.personal[0].prefix=e.namespaces.personal[0].prefix||"",r.next(),e.namespace=e.namespaces.personal[0],e.namespace}catch(t){return e.log.warn({err:t,cid:e.id}),{error:!0,status:t.responseStatus,text:t.responseText}}}}},89597:e=>{e.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:"ASC",DESC:"DESC"}}},93941:(e,t,s)=>{"use strict";let r=s(85389),i=/^\d+$/,o=/^\d$/;class a{constructor(e,t,s,r){this.str=(s||"").toString(),this.options=r||{},this.parent=e,this.tree=this.currentNode=this.createNode(),this.pos=t||0,this.currentNode.type="TREE",this.state=3}async getAttributes(){await this.processString();let e=[],t=e,s=async e=>{let r,i,o=t;if(e.isClosed||"SEQUENCE"!==e.type||"*"!==e.value||(e.isClosed=!0,e.type="ATOM"),!e.isClosed){let e=Error(`Unexpected end of input at position ${this.pos+this.str.length-1} [E9]`);throw e.code="ParserError9",e.parserContext={input:this.str,pos:this.pos+this.str.length-1},e}switch((e.type||"").toString().toUpperCase()){case"LITERAL":case"STRING":case"SEQUENCE":r={type:e.type.toUpperCase(),value:e.value},t.push(r);break;case"ATOM":if("NIL"===e.value.toUpperCase()){t.push(null);break}r={type:e.type.toUpperCase(),value:e.value},t.push(r);break;case"SECTION":t=t[t.length-1].section=[];break;case"LIST":r=[],t.push(r),t=r;break;case"PARTIAL":i=e.value.split(".").map(Number),t[t.length-1].partial=i}for(let t of e.childNodes)await s(t);t=o};return await s(this.tree),e}createNode(e,t){let s={childNodes:[],type:!1,value:"",isClosed:!0};return e&&(s.parentNode=e),"number"==typeof t&&(s.startPos=t),e&&e.childNodes.push(s),s}async processString(){let e,t,s,a=()=>{for(;" "===this.str.charAt(t+1);)t++};for(t=0,s=this.str.length;t<s;t++)switch(e=this.str.charAt(t),this.state){case 3:switch(e){case'"':this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="string",this.state=6,this.currentNode.isClosed=!1;break;case"(":this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="LIST",this.currentNode.isClosed=!1;break;case")":if("LIST"!==this.currentNode.type){let s=Error(`Unexpected list terminator ) at position ${this.pos+t} [E10]`);throw s.code="ParserError10",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.isClosed=!0,this.currentNode.endPos=this.pos+t,this.currentNode=this.currentNode.parentNode,a();break;case"]":if("SECTION"!==this.currentNode.type){let s=Error(`Unexpected section terminator ] at position ${this.pos+t} [E11]`);throw s.code="ParserError11",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.isClosed=!0,this.currentNode.endPos=this.pos+t,this.currentNode=this.currentNode.parentNode,a();break;case"<":"]"!==this.str.charAt(t-1)?(this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="ATOM",this.currentNode.value=e,this.state=1):(this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="PARTIAL",this.state=4,this.currentNode.isClosed=!1);break;case"~":{let s=this.str.charAt(t+1);if("{"!==s){if(r["ATOM-CHAR"]().indexOf(s)>=0){this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="ATOM",this.currentNode.value=e,this.state=1;break}let i=Error(`Unexpected literal8 marker at position ${this.pos+t} [E12]`);throw i.code="ParserError12",i.parserContext={input:this.str,pos:this.pos+t,chr:e},i}this.expectedLiteralType="literal8";break}case"{":this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="LITERAL",this.currentNode.literalType=this.expectedLiteralType||"literal",this.expectedLiteralType=!1,this.state=2,this.currentNode.isClosed=!1;break;case"*":this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="SEQUENCE",this.currentNode.value=e,this.currentNode.isClosed=!1,this.state=5;break;case" ":break;case"[":if(["OK","NO","BAD","BYE","PREAUTH"].includes(this.parent.command.toUpperCase())&&this.currentNode===this.tree){this.currentNode.endPos=this.pos+t,this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="ATOM",this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="SECTION",this.currentNode.isClosed=!1,this.state=3,"REFERRAL "===this.str.substr(t+1,9).toUpperCase()&&(this.currentNode=this.createNode(this.currentNode,this.pos+t+1),this.currentNode.type="ATOM",this.currentNode.endPos=this.pos+t+8,this.currentNode.value="REFERRAL",this.currentNode=this.currentNode.parentNode,this.currentNode=this.createNode(this.currentNode,this.pos+t+10),this.currentNode.type="ATOM",t=this.str.indexOf("]",t+10),this.currentNode.endPos=this.pos+t-1,this.currentNode.value=this.str.substring(this.currentNode.startPos-this.pos,this.currentNode.endPos-this.pos+1),this.currentNode=this.currentNode.parentNode,this.currentNode.isClosed=!0,this.currentNode=this.currentNode.parentNode,a());break}default:if(0>r["ATOM-CHAR"]().indexOf(e)&&"\\"!==e&&"%"!==e&&128>e.charCodeAt(0)){let s=Error(`Unexpected char at position ${this.pos+t} [E13: ${JSON.stringify(e)}]`);throw s.code="ParserError13",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode=this.createNode(this.currentNode,this.pos+t),this.currentNode.type="ATOM",this.currentNode.value=e,this.state=1}break;case 1:if(" "===e){this.currentNode.endPos=this.pos+t-1,this.currentNode=this.currentNode.parentNode,this.state=3;break}if(this.currentNode.parentNode&&(")"===e&&"LIST"===this.currentNode.parentNode.type||"]"===e&&"SECTION"===this.currentNode.parentNode.type)){this.currentNode.endPos=this.pos+t-1,this.currentNode=this.currentNode.parentNode,this.currentNode.isClosed=!0,this.currentNode.endPos=this.pos+t,this.currentNode=this.currentNode.parentNode,this.state=3,a();break}if((","===e||":"===e)&&i.test(this.currentNode.value)&&(this.currentNode.type="SEQUENCE",this.currentNode.isClosed=!0,this.state=5),"["===e){if(0>["BODY","BODY.PEEK","BINARY","BINARY.PEEK"].indexOf(this.currentNode.value.toUpperCase()))if(/[./]/.test(this.currentNode.value)){this.currentNode.value+=e;break}else{let s=Error(`Unexpected section start char [ at position ${this.pos+t} [E14]`);throw s.code="ParserError14",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.endPos=this.pos+t,this.currentNode=this.createNode(this.currentNode.parentNode,this.pos+t),this.currentNode.type="SECTION",this.currentNode.isClosed=!1,this.state=3;break}if("<"===e){let s=Error(`Unexpected start of partial at position ${this.pos+t} [E15]`);throw s.code="ParserError15",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if(0>r["ATOM-CHAR"]().indexOf(e)&&128>e.charCodeAt(0)&&"]"!==e&&("*"!==e||"\\"!==this.currentNode.value)&&(!this.parent||!this.parent.command||!["NO","BAD","OK"].includes(this.parent.command))){let s=Error(`Unexpected char at position ${this.pos+t} [E16: ${JSON.stringify(e)}]`);throw s.code="ParserError16",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if("\\*"===this.currentNode.value){let s=Error(`Unexpected char at position ${this.pos+t} [E17: ${JSON.stringify(e)}]`);throw s.code="ParserError17",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.value+=e;break;case 6:if('"'===e){this.currentNode.endPos=this.pos+t,this.currentNode.isClosed=!0,this.currentNode=this.currentNode.parentNode,this.state=3,a();break}if("\\"===e){if(++t>=s){let e=Error(`Unexpected end of input at position ${this.pos+t} [E18]`);throw e.code="ParserError18",e.parserContext={input:this.str,pos:this.pos+t},e}e=this.str.charAt(t)}this.currentNode.value+=e;break;case 4:if(">"===e){if("."===this.currentNode.value.at(-1)){let s=Error(`Unexpected end of partial at position ${this.pos+t} [E19]`);throw s.code="ParserError19",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.endPos=this.pos+t,this.currentNode.isClosed=!0,this.currentNode=this.currentNode.parentNode,this.state=3,a();break}if("."===e&&(!this.currentNode.value.length||this.currentNode.value.match(/\./))){let s=Error(`Unexpected partial separator . at position ${this.pos+t} [E20]`);throw s.code="ParserError20",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if(0>r.DIGIT().indexOf(e)&&"."!==e){let s=Error(`Unexpected char at position ${this.pos+t} [E21: ${JSON.stringify(e)}]`);throw s.code="ParserError21",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if(this.currentNode.value.match(/^0$|\.0$/)&&"."!==e){let s=Error(`Invalid partial at position ${this.pos+t} [E22: ${JSON.stringify(e)}]`);throw s.code="ParserError22",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.value+=e;break;case 2:if(this.currentNode.started){this.currentNode.chBuffer[this.currentNode.chPos++]=e.charCodeAt(0),this.currentNode.chPos>=this.currentNode.literalLength&&(this.currentNode.endPos=this.pos+t,this.currentNode.isClosed=!0,this.currentNode.value=this.currentNode.chBuffer.toString("binary"),this.currentNode.chBuffer=Buffer.alloc(0),this.currentNode=this.currentNode.parentNode,this.state=3,a());break}if("+"===e&&this.options.literalPlus){this.currentNode.literalPlus=!0;break}if("}"===e){if(!("literalLength"in this.currentNode)){let s=Error(`Unexpected literal prefix end char } at position ${this.pos+t} [E23]`);throw s.code="ParserError23",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if("\n"===this.str.charAt(t+1))t++;else if("\r"===this.str.charAt(t+1)&&"\n"===this.str.charAt(t+2))t+=2;else{let s=Error(`Unexpected char at position ${this.pos+t} [E24: ${JSON.stringify(e)}]`);throw s.code="ParserError24",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.literalLength=Number(this.currentNode.literalLength),this.currentNode.literalLength?this.options.literals?(this.currentNode.value=this.options.literals.shift(),this.currentNode.endPos=this.pos+t+this.currentNode.value.length,this.currentNode.started=!1,this.currentNode.isClosed=!0,this.currentNode=this.currentNode.parentNode,this.state=3,a()):(this.currentNode.started=!0,this.currentNode.chBuffer=Buffer.alloc(this.currentNode.literalLength),this.currentNode.chPos=0):(this.currentNode.endPos=this.pos+t,this.currentNode.isClosed=!0,this.currentNode=this.currentNode.parentNode,this.state=3,a());break}if(0>r.DIGIT().indexOf(e)){let s=Error(`Unexpected char at position ${this.pos+t} [E25: ${JSON.stringify(e)}]`);throw s.code="ParserError25",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if("0"===this.currentNode.literalLength){let s=Error(`Invalid literal at position ${this.pos+t} [E26]`);throw s.code="ParserError26",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.literalLength=(this.currentNode.literalLength||"")+e;break;case 5:if(" "===e){if(!o.test(this.currentNode.value.at(-1))&&"*"!==this.currentNode.value.at(-1)){let s=Error(`Unexpected whitespace at position ${this.pos+t} [E27]`);throw s.code="ParserError27",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if("*"!==this.currentNode.value&&"*"===this.currentNode.value.at(-1)&&":"!==this.currentNode.value.at(-2)){let s=Error(`Unexpected whitespace at position ${this.pos+t} [E28]`);throw s.code="ParserError28",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.isClosed=!0,this.currentNode.endPos=this.pos+t-1,this.currentNode=this.currentNode.parentNode,this.state=3;break}if(this.currentNode.parentNode&&"]"===e&&"SECTION"===this.currentNode.parentNode.type){this.currentNode.endPos=this.pos+t-1,this.currentNode=this.currentNode.parentNode,this.currentNode.isClosed=!0,this.currentNode.endPos=this.pos+t,this.currentNode=this.currentNode.parentNode,this.state=3,a();break}if(":"===e){if(!o.test(this.currentNode.value.at(-1))&&"*"!==this.currentNode.value.at(-1)){let s=Error(`Unexpected range separator : at position ${this.pos+t} [E29]`);throw s.code="ParserError29",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}}else if("*"===e){if(0>[",",":"].indexOf(this.currentNode.value.at(-1))){let s=Error(`Unexpected range wildcard at position ${this.pos+t} [E30]`);throw s.code="ParserError30",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}}else if(","===e){if(!o.test(this.currentNode.value.at(-1))&&"*"!==this.currentNode.value.at(-1)){let s=Error(`Unexpected sequence separator , at position ${this.pos+t} [E31]`);throw s.code="ParserError31",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if("*"===this.currentNode.value.at(-1)&&":"!==this.currentNode.value.at(-2)){let s=Error(`Unexpected sequence separator , at position ${this.pos+t} [E32]`);throw s.code="ParserError32",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}}else if(!o.test(e)){let s=Error(`Unexpected char at position ${this.pos+t} [E33: ${JSON.stringify(e)}]`);throw s.code="ParserError33",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}if(o.test(e)&&"*"===this.currentNode.value.at(-1)){let s=Error(`Unexpected number at position ${this.pos+t} [E34: ${JSON.stringify(e)}]`);throw s.code="ParserError34",s.parserContext={input:this.str,pos:this.pos+t,chr:e},s}this.currentNode.value+=e;break;case 7:this.currentNode.value+=e}}}e.exports.TokenParser=a},94670:e=>{"use strict";let t=new Map;["US-ASCII","ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO_6937-2-add","JIS_X0201","JIS_Encoding","Shift_JIS","EUC-JP","Extended_UNIX_Code_Fixed_Width_for_Japanese","BS_4730","SEN_850200_C","IT","ES","DIN_66003","NS_4551-1","NF_Z_62-010","ISO-10646-UTF-1","ISO_646.basic:1983","INVARIANT","ISO_646.irv:1983","NATS-SEFI","NATS-SEFI-ADD","NATS-DANO","NATS-DANO-ADD","SEN_850200_B","KS_C_5601-1987","ISO-2022-KR","EUC-KR","ISO-2022-JP","ISO-2022-JP-2","JIS_C6220-1969-jp","JIS_C6220-1969-ro","PT","greek7-old","latin-greek","NF_Z_62-010_(1973)","Latin-greek-1","ISO_5427","JIS_C6226-1978","BS_viewdata","INIS","INIS-8","INIS-cyrillic","ISO_5427:1981","ISO_5428:1980","GB_1988-80","GB_2312-80","NS_4551-2","videotex-suppl","PT2","ES2","MSZ_7795.3","JIS_C6226-1983","greek7","ASMO_449","iso-ir-90","JIS_C6229-1984-a","JIS_C6229-1984-b","JIS_C6229-1984-b-add","JIS_C6229-1984-hand","JIS_C6229-1984-hand-add","JIS_C6229-1984-kana","ISO_2033-1983","ANSI_X3.110-1983","T.61-7bit","T.61-8bit","ECMA-cyrillic","CSA_Z243.4-1985-1","CSA_Z243.4-1985-2","CSA_Z243.4-1985-gr","ISO-8859-6-E","ISO-8859-6-I","T.101-G2","ISO-8859-8-E","ISO-8859-8-I","CSN_369103","JUS_I.B1.002","IEC_P27-1","JUS_I.B1.003-serb","JUS_I.B1.003-mac","greek-ccitt","NC_NC00-10:81","ISO_6937-2-25","GOST_19768-74","ISO_8859-supp","ISO_10367-box","latin-lap","JIS_X0212-1990","DS_2089","us-dk","dk-us","KSC5636","UNICODE-1-1-UTF-7","ISO-2022-CN","ISO-2022-CN-EXT","UTF-8","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","GBK","GB18030","OSD_EBCDIC_DF04_15","OSD_EBCDIC_DF03_IRV","OSD_EBCDIC_DF04_1","ISO-11548-1","KZ-1048","ISO-10646-UCS-2","ISO-10646-UCS-4","ISO-10646-UCS-Basic","ISO-10646-Unicode-Latin1","ISO-10646-J-1","ISO-Unicode-IBM-1261","ISO-Unicode-IBM-1268","ISO-Unicode-IBM-1276","ISO-Unicode-IBM-1264","ISO-Unicode-IBM-1265","UNICODE-1-1","SCSU","UTF-7","UTF-16BE","UTF-16LE","UTF-16","CESU-8","UTF-32","UTF-32BE","UTF-32LE","BOCU-1","ISO-8859-1-Windows-3.0-Latin-1","ISO-8859-1-Windows-3.1-Latin-1","ISO-8859-2-Windows-Latin-2","ISO-8859-9-Windows-Latin-5","hp-roman8","Adobe-Standard-Encoding","Ventura-US","Ventura-International","DEC-MCS","IBM850","PC8-Danish-Norwegian","IBM862","PC8-Turkish","IBM-Symbols","IBM-Thai","HP-Legal","HP-Pi-font","HP-Math8","Adobe-Symbol-Encoding","HP-DeskTop","Ventura-Math","Microsoft-Publishing","Windows-31J","GB2312","Big5","macintosh","IBM037","IBM038","IBM273","IBM274","IBM275","IBM277","IBM278","IBM280","IBM281","IBM284","IBM285","IBM290","IBM297","IBM420","IBM423","IBM424","IBM437","IBM500","IBM851","IBM852","IBM855","IBM857","IBM860","IBM861","IBM863","IBM864","IBM865","IBM868","IBM869","IBM870","IBM871","IBM880","IBM891","IBM903","IBM904","IBM905","IBM918","IBM1026","EBCDIC-AT-DE","EBCDIC-AT-DE-A","EBCDIC-CA-FR","EBCDIC-DK-NO","EBCDIC-DK-NO-A","EBCDIC-FI-SE","EBCDIC-FI-SE-A","EBCDIC-FR","EBCDIC-IT","EBCDIC-PT","EBCDIC-ES","EBCDIC-ES-A","EBCDIC-ES-S","EBCDIC-UK","EBCDIC-US","UNKNOWN-8BIT","MNEMONIC","MNEM","VISCII","VIQR","KOI8-R","HZ-GB-2312","IBM866","IBM775","KOI8-U","IBM00858","IBM00924","IBM01140","IBM01141","IBM01142","IBM01143","IBM01144","IBM01145","IBM01146","IBM01147","IBM01148","IBM01149","Big5-HKSCS","IBM1047","PTCP154","Amiga-1251","KOI7-switched","BRF","TSCII","CP51932","windows-874","windows-1250","windows-1251","windows-1252","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-1258","TIS-620","CP50220"].forEach(e=>{let s=e.replace(/[_-\s]/g,"").toLowerCase(),r=s.replace(/^windows/,"win").replace(/^usascii/,"ascii").replace(/^iso8859/,"latin");t.set(s,e),t.has(r)||t.set(r,e)}),e.exports.resolveCharset=e=>{let s=e.replace(/[_-\s]/g,"").toLowerCase();return t.has(s)?t.get(s):null}},94884:(e,t,s)=>{"use strict";let{getStatusCode:r,formatFlag:i,canUseFlag:o,formatDateTime:a,normalizePath:l,encodePath:h,comparePaths:u,getErrorText:c}=s(80876);e.exports=async(e,t,s,d,p)=>{let f;if(![e.states.AUTHENTICATED,e.states.SELECTED].includes(e.state)||!t)return;if(e.capabilities.has("APPENDLIMIT")){let t=e.capabilities.get("APPENDLIMIT");if("number"==typeof t&&t<s.length){let e=Error("Message content too big for APPENDLIMIT="+t);throw e.serverResponseCode="APPENDLIMIT",e}}t=l(e,t);let g=u(e,e.mailbox.path,t);d=(Array.isArray(d)?d:[].concat(d||[])).map(e=>e&&i(e.toString())).filter(t=>t&&o(e.mailbox,t));let m=[{type:"ATOM",value:h(e,t)}];p=!!p&&a(p),(d.length||p)&&m.push(d.map(e=>({type:"ATOM",value:e}))),p&&m.push({type:"STRING",value:p});let y=!1;e.capabilities.has("BINARY")&&!e.disableBinary&&("string"==typeof s&&(s=Buffer.from(s)),y=s.indexOf(Buffer.from([0]))>=0),m.push({type:"LITERAL",value:s,isLiteral8:y});let b={destination:t};e.mailbox&&e.mailbox.path&&(b.path=e.mailbox.path);try{let t=(f=await e.exec("APPEND",m,{untagged:!!g&&{EXISTS:async t=>{if(b.seq=Number(t.command),g){let t=e.mailbox.exists;b.seq!==t&&(e.mailbox.exists=b.seq,e.emit("exists",{path:e.mailbox.path,count:b.seq,prevCount:t}))}}}})).response.attributes&&f.response.attributes[0]&&f.response.attributes[0].section;if(t&&t.length&&"APPENDUID"===(t[0]&&"string"==typeof t[0].value?t[0].value:"").toUpperCase()){let e=!(!t[1]||"string"!=typeof t[1].value||isNaN(t[1].value))&&BigInt(t[1].value),s=!(!t[2]||"string"!=typeof t[2].value||isNaN(t[2].value))&&Number(t[2].value);e&&(b.uidValidity=e),s&&(b.uid=s)}if(f.next(),g&&!b.seq)try{(f=await e.exec("NOOP",!1,{untagged:{EXISTS:async t=>{if(b.seq=Number(t.command),g){let t=e.mailbox.exists;b.seq!==t&&(e.mailbox.exists=b.seq,e.emit("exists",{path:e.mailbox.path,count:b.seq,prevCount:t}))}}},comment:"Sequence not found from APPEND output"})).next()}catch(t){e.log.warn({err:t,cid:e.id})}if(b.seq&&!b.uid){let t=await e.search({seq:b.seq},{uid:!0});t&&t.length&&(b.uid=t[0])}return b}catch(s){let t=r(s.response);throw t&&(s.serverResponseCode=t),s.response=await c(s.response),e.log.warn({err:s,cid:e.id}),s}}},95821:(e,t,s)=>{"use strict";let{lsCacheSym:r,levelValSym:i,useOnlyCustomLevelsSym:o,streamSym:a,formattersSym:l,hooksSym:h,levelCompSym:u}=s(69185),{noop:c,genLog:d}=s(98895),{DEFAULT_LEVELS:p,SORTING_ORDER:f}=s(89597),g={fatal:e=>{let t=d(p.fatal,e);return function(...e){let s=this[a];if(t.call(this,...e),"function"==typeof s.flushSync)try{s.flushSync()}catch(e){}}},error:e=>d(p.error,e),warn:e=>d(p.warn,e),info:e=>d(p.info,e),debug:e=>d(p.debug,e),trace:e=>d(p.trace,e)},m=Object.keys(p).reduce((e,t)=>(e[p[t]]=t,e),{});function y(e,t,s){return e===f.DESC?t<=s:t>=s}e.exports={initialLsCache:Object.keys(m).reduce((e,t)=>(e[t]='{"level":'+Number(t),e),{}),genLsCache:function(e){let t=e[l].level,{labels:s}=e.levels,i={};for(let e in s){let r=t(s[e],Number(e));i[e]=JSON.stringify(r).slice(0,-1)}return e[r]=i,e},levelMethods:g,getLevel:function(e){let{levels:t,levelVal:s}=this;return t&&t.labels?t.labels[s]:""},setLevel:function(e){let{labels:t,values:s}=this.levels;if("number"==typeof e){if(void 0===t[e])throw Error("unknown level value"+e);e=t[e]}if(void 0===s[e])throw Error("unknown level "+e);let r=this[i],a=this[i]=s[e],l=this[o],p=this[u],f=this[h].logMethod;for(let e in s){if(!1===p(s[e],a)){this[e]=c;continue}this[e]=!function(e,t){if(t)return!1;switch(e){case"fatal":case"error":case"warn":case"info":case"debug":case"trace":return!0;default:return!1}}(e,l)?d(s[e],f):g[e](f)}this.emit("level-change",e,a,t[r],r,this)},isLevelEnabled:function(e){let{values:t}=this.levels,s=t[e];return void 0!==s&&this[u](s,this[i])},mappings:function(e=null,t=!1){let s=e?Object.keys(e).reduce((t,s)=>(t[e[s]]=s,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:"silent"}}),t?null:m,s),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:p,e)}},assertNoLevelCollisions:function(e,t){let{labels:s,values:r}=e;for(let e in t){if(e in r)throw Error("levels cannot be overridden");if(t[e]in s)throw Error("pre-existing level values cannot be used for new levels")}},assertDefaultLevelFound:function(e,t,s){if("number"==typeof e){if(![].concat(Object.keys(t||{}).map(e=>t[e]),s?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),s?null:p,t)))throw Error(`default level:${e} must be included in custom levels`)},genLevelComparison:function(e){return"string"==typeof e?y.bind(null,e):e},assertLevelComparison:function(e){if("function"!=typeof e&&!("string"==typeof e&&Object.values(f).includes(e)))throw Error('Levels comparison should be one of "ASC", "DESC" or "function" type')}}},96133:e=>{"use strict";function t(e,t){return t}e.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=t;let s=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(s))return;let r=s.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}},96226:(e,t,s)=>{"use strict";let r=s(27910).Transform,i=s(24323);class o extends r{constructor(e){super({readableObjectMode:!0,writableObjectMode:!1}),this.options=e||{},this.cid=this.options.cid,this.log=this.options.logger&&"object"==typeof this.options.logger?this.options.logger:i.child({component:"imap-connection",cid:this.cid}),this.readBytesCounter=0,this.state=1,this.literalWaiting=0,this.inputBuffer=[],this.lineBuffer=[],this.literalBuffer=[],this.literals=[],this.compress=!1,this.secureConnection=this.options.secureConnection,this.processingInput=!1,this.inputQueue=[]}checkLiteralMarker(e){if(!e||!e.length)return!1;let t=e.length-1;if(10!==e[t]||(--t>=0&&13===e[t]&&t--,t<0||!t||125!==e[t]))return!1;t--;let s=[];for(;t>0;t--){let r=e[t];if(r>=48&&r<=57){s.unshift(r);continue}if(123===r&&s.length)return this.state=2,this.literalWaiting=Number(Buffer.from(s).toString()),!0;break}return!1}async processInputChunk(e,t){if(!((t=t||0)>=e.length))switch(this.state){case 1:{let s=t;for(let r=t,i=e.length;r<i;r++)if(10===e[r]){this.lineBuffer.push(e.slice(s,r+1)),s=r+1;let t=Buffer.concat(this.lineBuffer);if(this.inputBuffer.push(t),this.lineBuffer=[],this.checkLiteralMarker(t))return await this.processInputChunk(e,s);let i=1===this.inputBuffer.length?this.inputBuffer[0]:Buffer.concat(this.inputBuffer),o=this.literals;if(this.inputBuffer=[],this.literals=[],i.length){let e=0;i.length>=1&&10===i[i.length-1]&&(e++,i.length>=2&&13===i[i.length-2]&&e++),e&&(i=i.slice(0,i.length-e)),i.length&&await new Promise(e=>{this.push({payload:i,literals:o,next:e})})}}s<e.length&&this.lineBuffer.push(e.slice(s));break}case 2:if(e.length===t+this.literalWaiting){t?this.literalBuffer.push(e.slice(t)):this.literalBuffer.push(e),this.literalWaiting-=e.length,this.literals.push(Buffer.concat(this.literalBuffer)),this.literalBuffer=[],this.state=1;return}if(e.length>t+this.literalWaiting){let s=e.slice(t,t+this.literalWaiting);return this.literalBuffer.push(s),t+=s.length,this.literalWaiting-=s.length,this.literals.push(Buffer.concat(this.literalBuffer)),this.literalBuffer=[],this.state=1,await this.processInputChunk(e,t)}{let s=e.slice(t);this.literalBuffer.push(s),t+=s.length,this.literalWaiting-=s.length;return}}}async processInput(){let e;for(;e=this.inputQueue.shift();)await this.processInputChunk(e.chunk),e.next()}_transform(e,t,s){if("string"==typeof e&&(e=Buffer.from(e,t)),!e||!e.length)return s();this.readBytesCounter+=e.length,this.options.logRaw&&this.log.trace({src:"s",msg:"read from socket",data:e.toString("base64"),compress:!!this.compress,secure:!!this.secureConnection,cid:this.cid}),e&&e.length&&this.inputQueue.push({chunk:e,next:s}),this.processingInput||(this.processingInput=!0,this.processInput().catch(e=>this.emit("error",e)).finally(()=>this.processingInput=!1))}_flush(e){e()}}e.exports.ImapStream=o},98333:(e,t,s)=>{"use strict";let{formatDateTime:r}=s(80876);e.exports=async(e,t)=>{let s;if(e.capabilities.has("ID"))try{let i={},o=t?Object.keys(t).map(e=>[e,function(e,t){return"date"===e.toLowerCase()?r(t):(t||"").toString().replace(/\s+/g," ")}(e,t[e])]).filter(e=>e[1]).flatMap(e=>e):null;return o&&!o.length&&(o=null),s=await e.exec("ID",[o],{untagged:{ID:async e=>{let t,s=e.attributes&&e.attributes[0];(Array.isArray(s)?s:[].concat(s||[])).forEach((e,s)=>{s%2==0?t=e.value:"string"==typeof t&&"string"==typeof e.value&&(i[t.toLowerCase().trim()]=e.value)})}}}),e.serverInfo=i,s.next(),i}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},98539:e=>{"use strict";let t=e=>e&&"string"==typeof e.message,s=e=>{if(!e)return;let s=e.cause;if("function"!=typeof s)return t(s)?s:void 0;{let s=e.cause();return t(s)?s:void 0}},r=(e,i)=>{if(!t(e))return"";let o=e.stack||"";if(i.has(e))return o+"\ncauses have become circular...";let a=s(e);return a?(i.add(e),o+"\ncaused by: "+r(a,i)):o},i=(e,r,o)=>{if(!t(e))return"";let a=o?"":e.message||"";if(r.has(e))return a+": ...";let l=s(e);if(!l)return a;{r.add(e);let t="function"==typeof e.cause;return a+(t?"":": ")+i(l,r,t)}};e.exports={isErrorLike:t,getErrorCause:s,stackWithCauses:e=>r(e,new Set),messageWithCauses:e=>i(e,new Set)}},98895:(e,t,s)=>{"use strict";let r=s(6524),{mapHttpRequest:i,mapHttpResponse:o}=s(20760),a=s(18616),l=s(65049),{lsCacheSym:h,chindingsSym:u,writeSym:c,serializersSym:d,formatOptsSym:p,endSym:f,stringifiersSym:g,stringifySym:m,stringifySafeSym:y,wildcardFirstSym:b,nestedKeySym:S,formattersSym:E,messageKeySym:v,errorKeySym:w,nestedKeyStrSym:T,msgPrefixSym:I}=s(69185),{isMainThread:k}=s(73566),C=s(86501);function A(){}function N(e){let t="",s=0,r=!1,i=255,o=e.length;if(o>100)return JSON.stringify(e);for(var a=0;a<o&&i>=32;a++)(34===(i=e.charCodeAt(a))||92===i)&&(t+=e.slice(s,a)+"\\",s=a,r=!0);return r?t+=e.slice(s):t=e,i<32?JSON.stringify(e):'"'+t+'"'}let O=process.env.NODE_V8_COVERAGE||process.env.V8_COVERAGE;function B(e){let t=new a(e);return t.on("error",function e(s){if("EPIPE"===s.code){t.write=A,t.end=A,t.flushSync=A,t.destroy=A;return}t.removeListener("error",e),t.emit("error",s)}),O||e.sync||!k||(l.register(t,_),t.on("close",function(){l.unregister(t)})),t}function _(e,t){e.destroyed||("beforeExit"===t?(e.flush(),e.on("drain",function(){e.end()})):e.flushSync())}e.exports={noop:A,buildSafeSonicBoom:B,asChindings:function(e,t){let s,r=e[u],i=e[m],o=e[y],a=e[g],l=a[b],h=e[d];for(let u in t=(0,e[E].bindings)(t))if(s=t[u],!0===("level"!==u&&"serializers"!==u&&"formatters"!==u&&"customLevels"!==u&&t.hasOwnProperty(u)&&void 0!==s)){if(s=h[u]?h[u](s):s,void 0===(s=(a[u]||l||i)(s,o)))continue;r+=',"'+u+'":'+s}return r},asJson:function(e,t,s,r){let i,o=this[m],a=this[y],l=this[g],c=this[f],p=this[u],I=this[d],k=this[E],C=this[v],A=this[w],O=this[h][s]+r;O+=p,k.log&&(e=k.log(e));let B=l[b],_="";for(let t in e)if(i=e[t],Object.prototype.hasOwnProperty.call(e,t)&&void 0!==i){I[t]?i=I[t](i):t===A&&I.err&&(i=I.err(i));let e=l[t]||B;switch(typeof i){case"undefined":case"function":continue;case"number":!1===Number.isFinite(i)&&(i=null);case"boolean":e&&(i=e(i));break;case"string":i=(e||N)(i);break;default:i=(e||o)(i,a)}if(void 0===i)continue;_+=","+N(t)+":"+i}let x="";if(void 0!==t){i=I[C]?I[C](t):t;let e=l[C]||B;switch(typeof i){case"function":break;case"number":!1===Number.isFinite(i)&&(i=null);case"boolean":e&&(i=e(i)),x=',"'+C+'":'+i;break;case"string":x=',"'+C+'":'+(i=(e||N)(i));break;default:x=',"'+C+'":'+(i=(e||o)(i,a))}}return this[S]&&_?O+this[T]+_.slice(1)+"}"+x+c:O+_+x+c},genLog:function(e,t){if(!t)return s;return function(...r){t.call(this,r,s,e)};function s(t,...a){if("object"==typeof t){let s,l=t;null!==t&&(t.method&&t.headers&&t.socket?t=i(t):"function"==typeof t.setHeader&&(t=o(t))),null===l&&0===a.length?s=[null]:(l=a.shift(),s=a),"string"==typeof this[I]&&null!=l&&(l=this[I]+l),this[c](t,r(l,s,this[p]),e)}else{let s=void 0===t?a.shift():t;"string"==typeof this[I]&&null!=s&&(s=this[I]+s),this[c](null,r(s,a,this[p]),e)}}},createArgsNormalizer:function(e){return function(t,s,r={},i){if("string"==typeof r)i=B({dest:r}),r={};else if("string"==typeof i){if(r&&r.transport)throw Error("only one of option.transport or stream can be specified");i=B({dest:i})}else if(r instanceof a||r.writable||r._writableState)i=r,r={};else if(r.transport){let e;if(r.transport instanceof a||r.transport.writable||r.transport._writableState)throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");if(r.transport.targets&&r.transport.targets.length&&r.formatters&&"function"==typeof r.formatters.level)throw Error("option.transport.targets do not allow custom level formatters");r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=C({caller:s,...r.transport,levels:e})}if((r=Object.assign({},e,r)).serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");let{enabled:o,onChild:l}=r;if(!1===o&&(r.level="silent"),l||(r.onChild=A),!i){var h;i=(h=process.stdout).write!==h.constructor.prototype.write?process.stdout:B({fd:process.stdout.fd||1})}return{opts:r,stream:i}}},stringify:function(e,t){try{return JSON.stringify(e)}catch(s){try{return(t||this[y])(e)}catch(e){return'"[unable to serialize, circular reference is too complex to analyze]"'}}},buildFormatters:function(e,t,s){return{level:e,bindings:t,log:s}},normalizeDestFileDescriptor:function(e){let t=Number(e);return"string"==typeof e&&Number.isFinite(t)?t:void 0===e?1:e}}},99142:e=>{"use strict";e.exports=async e=>{if(e.capabilities.size&&!e.expectCapabilityUpdate)return e.capabilities;try{return(await e.exec("CAPABILITY")).next(),e.capabilities}catch(t){return e.log.warn({err:t,cid:e.id}),!1}}},99513:(e,t,s)=>{"use strict";let{getStatusCode:r,normalizePath:i,encodePath:o,expandRange:a,getErrorText:l}=s(80876);e.exports=async(e,t,s,h)=>{let u;if(e.state!==e.states.SELECTED||!t||!s)return;h=h||{},s=i(e,s);let c=[{type:"SEQUENCE",value:t},{type:"ATOM",value:o(e,s)}];try{(u=await e.exec(h.uid?"UID COPY":"COPY",c)).next();let t={path:e.mailbox.path,destination:s},r=u.response.attributes&&u.response.attributes[0]&&u.response.attributes[0].section;if((r&&r.length&&r[0]&&"string"==typeof r[0].value?r[0].value:"")==="COPYUID"){let e=!(!r[1]||"string"!=typeof r[1].value||isNaN(r[1].value))&&BigInt(r[1].value);e&&(t.uidValidity=e);let s=!!r[2]&&"string"==typeof r[2].value&&a(r[2].value),i=!!r[3]&&"string"==typeof r[3].value&&a(r[3].value);s&&i&&s.length===i.length&&(t.uidMap=new Map(s.map((e,t)=>[e,i[t]])))}return t}catch(s){let t=r(s.response);return t&&(s.serverResponseCode=t),s.response=await l(s.response),e.log.warn({err:s,cid:e.id}),!1}}}};