MCPcopy Index your code
hub / github.com/ChinaSiro/claude-code-sourcemap / _M7

Function _M7

package/cli.js:51–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49`))q=g6(q);let z=`${new Date().toISOString()} [${K.toUpperCase()}] ${q.trim()}
50`;if($B()){bc(z);return}k$5().write(z)}function j96(){return QJ7()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??gJ7(c1(),"debug",`${N8()}.txt`)}function OE(q,K){return}var Go8,f$5,FJ7=!1,ST,Z$5,$B,QJ7,To8=!1,J98=null,Zo8,lJ7;var _8=y(()=>{F4();v8();c9();mj7();m8();e7();l8();Go8={verbose:0,debug:1,info:2,warn:3,error:4},f$5=_1(()=>{let q=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(q&&Object.hasOwn(Go8,q))return q;return"debug"}),ST=_1(()=>{return FJ7||i6(process.env.DEBUG)||i6(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||$B()||process.argv.some((q)=>q.startsWith("--debug="))||QJ7()!==null});Z$5=_1(()=>{let q=process.argv.find((_)=>_.startsWith("--debug="));if(!q)return null;let K=q.substring(8);return Ij7(K)}),$B=_1(()=>{return process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")}),QJ7=_1(()=>{for(let q=0;q<process.argv.length;q++){let K=process.argv[q];if(K.startsWith("--debug-file="))return K.substring(13);if(K==="--debug-file"&&q+1<process.argv.length)return process.argv[q+1]}return null});Zo8=Promise.resolve();lJ7=_1(async()=>{try{let q=j96(),K=BJ7(q),_=gJ7(K,"latest");await D$5(_).catch(()=>{}),await W$5(q,_)}catch{}})});function YH(){if(!vo8)vo8=new Intl.Segmenter(void 0,{granularity:"grapheme"});return vo8}function ox6(q){if(!q)return"";return YH().segment(q)[Symbol.iterator]().next().value?.segment??""}function xc(q){if(!q)return"";let K="";for(let{segment:_}of YH().segment(q))K=_;return K}function iJ7(){if(!ko8)ko8=new Intl.Segmenter(void 0,{granularity:"word"});return ko8}function No8(q,K){let _=`${q}:${K}`,z=nJ7.get(_);if(!z)z=new Intl.RelativeTimeFormat("en",{style:q,numeric:K}),nJ7.set(_,z);return z}function yo8(){if(!Vo8)Vo8=Intl.DateTimeFormat().resolvedOptions().timeZone;return Vo8}function rJ7(){if(M98===null)try{let q=Intl.DateTimeFormat().resolvedOptions().locale;M98=new Intl.Locale(q).language}catch{M98=void 0}return M98}var vo8=null,ko8=null,nJ7,Vo8=null,M98=null;var mk=y(()=>{nJ7=new Map});var Eo8=m((T9$,oJ7)=>{oJ7.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});function aJ7(q){return q===161||q===164||q===167||q===168||q===170||q===173||q===174||q>=176&&q<=180||q>=182&&q<=186||q>=188&&q<=191||q===198||q===208||q===215||q===216||q>=222&&q<=225||q===230||q>=232&&q<=234||q===236||q===237||q===240||q===242||q===243||q>=247&&q<=250||q===252||q===254||q===257||q===273||q===275||q===283||q===294||q===295||q===299||q>=305&&q<=307||q===312||q>=319&&q<=322||q===324||q>=328&&q<=331||q===333||q===338||q===339||q===358||q===359||q===363||q===462||q===464||q===466||q===468||q===470||q===472||q===474||q===476||q===593||q===609||q===708||q===711||q>=713&&q<=715||q===717||q===720||q>=728&&q<=731||q===733||q===735||q>=768&&q<=879||q>=913&&q<=929||q>=931&&q<=937||q>=945&&q<=961||q>=963&&q<=969||q===1025||q>=1040&&q<=1103||q===1105||q===8208||q>=8211&&q<=8214||q===8216||q===8217||q===8220||q===8221||q>=8224&&q<=8226||q>=8228&&q<=8231||q===8240||q===8242||q===8243||q===8245||q===8251||q===8254||q===8308||q===8319||q>=8321&&q<=8324||q===8364||q===8451||q===8453||q===8457||q===8467||q===8470||q===8481||q===8482||q===8486||q===8491||q===8531||q===8532||q>=8539&&q<=8542||q>=8544&&q<=8555||q>=8560&&q<=8569||q===8585||q>=8592&&q<=8601||q===8632||q===8633||q===8658||q===8660||q===8679||q===8704||q===8706||q===8707||q===8711||q===8712||q===8715||q===8719||q===8721||q===8725||q===8730||q>=8733&&q<=8736||q===8739||q===8741||q>=8743&&q<=8748||q===8750||q>=8756&&q<=8759||q===8764||q===8765||q===8776||q===8780||q===8786||q===8800||q===8801||q>=8804&&q<=8807||q===8810||q===8811||q===8814||q===8815||q===8834||q===8835||q===8838||q===8839||q===8853||q===8857||q===8869||q===8895||q===8978||q>=9312&&q<=9449||q>=9451&&q<=9547||q>=9552&&q<=9587||q>=9600&&q<=9615||q>=9618&&q<=9621||q===9632||q===9633||q>=9635&&q<=9641||q===9650||q===9651||q===9654||q===9655||q===9660||q===9661||q===9664||q===9665||q>=9670&&q<=9672||q===9675||q>=9678&&q<=9681||q>=9698&&q<=9701||q===9711||q===9733||q===9734||q===9737||q===9742||q===9743||q===9756||q===9758||q===9792||q===9794||q===9824||q===9825||q>=9827&&q<=9829||q>=9831&&q<=9834||q===9836||q===9837||q===9839||q===9886||q===9887||q===9919||q>=9926&&q<=9933||q>=9935&&q<=9939||q>=9941&&q<=9953||q===9955||q===9960||q===9961||q>=9963&&q<=9969||q===9972||q>=9974&&q<=9977||q===9979||q===9980||q===9982||q===9983||q===10045||q>=10102&&q<=10111||q>=11094&&q<=11097||q>=12872&&q<=12879||q>=57344&&q<=63743||q>=65024&&q<=65039||q===65533||q>=127232&&q<=127242||q>=127248&&q<=127277||q>=127280&&q<=127337||q>=127344&&q<=127373||q===127375||q===127376||q>=127387&&q<=127404||q>=917760&&q<=917999||q>=983040&&q<=1048573||q>=1048576&&q<=1114109}function ax6(q){return q===12288||q>=65281&&q<=65376||q>=65504&&q<=65510}function sx6(q){return q>=4352&&q<=4447||q===8986||q===8987||q===9001||q===9002||q>=9193&&q<=9196||q===9200||q===9203||q===9725||q===9726||q===9748||q===9749||q>=9776&&q<=9783||q>=9800&&q<=9811||q===9855||q>=9866&&q<=9871||q===9875||q===9889||q===9898||q===9899||q===9917||q===9918||q===9924||q===9925||q===9934||q===9940||q===9962||q===9970||q===9971||q===9973||q===9978||q===9981||q===9989||q===9994||q===9995||q===10024||q===10060||q===10062||q>=10067&&q<=10069||q===10071||q>=10133&&q<=10135||q===10160||q===10175||q===11035||q===11036||q===11088||q===11093||q>=11904&&q<=11929||q>=11931&&q<=12019||q>=12032&&q<=12245||q>=12272&&q<=12287||q>=12289&&q<=12350||q>=12353&&q<=12438||q>=12441&&q<=12543||q>=12549&&q<=12591||q>=12593&&q<=12686||q>=12688&&q<=12773||q>=12783&&q<=12830||q>=12832&&q<=12871||q>=12880&&q<=42124||q>=42128&&q<=42182||q>=43360&&q<=43388||q>=44032&&q<=55203||q>=63744&&q<=64255||q>=65040&&q<=65049||q>=65072&&q<=65106||q>=65108&&q<=65126||q>=65128&&q<=65131||q>=94176&&q<=94180||q>=94192&&q<=94198||q>=94208&&q<=101589||q>=101631&&q<=101662||q>=101760&&q<=101874||q>=110576&&q<=110579||q>=110581&&q<=110587||q===110589||q===110590||q>=110592&&q<=110882||q===110898||q>=110928&&q<=110930||q===110933||q>=110948&&q<=110951||q>=110960&&q<=111355||q>=119552&&q<=119638||q>=119648&&q<=119670||q===126980||q===127183||q===127374||q>=127377&&q<=127386||q>=127488&&q<=127490||q>=127504&&q<=127547||q>=127552&&q<=127560||q===127568||q===127569||q>=127584&&q<=127589||q>=127744&&q<=127776||q>=127789&&q<=127797||q>=127799&&q<=127868||q>=127870&&q<=127891||q>=127904&&q<=127946||q>=127951&&q<=127955||q>=127968&&q<=127984||q===127988||q>=127992&&q<=128062||q===128064||q>=128066&&q<=128252||q>=128255&&q<=128317||q>=128331&&q<=128334||q>=128336&&q<=128359||q===128378||q===128405||q===128406||q===128420||q>=128507&&q<=128591||q>=128640&&q<=128709||q===128716||q>=128720&&q<=128722||q>=128725&&q<=128728||q>=128732&&q<=128735||q===128747||q===128748||q>=128756&&q<=128764||q>=128992&&q<=129003||q===129008||q>=129292&&q<=129338||q>=129340&&q<=129349||q>=129351&&q<=129535||q>=129648&&q<=129660||q>=129664&&q<=129674||q>=129678&&q<=129734||q===129736||q>=129741&&q<=129756||q>=129759&&q<=129770||q>=129775&&q<=129784||q>=131072&&q<=196605||q>=196608&&q<=262141}var Lo8=()=>{};function V$5(q){if(!Number.isSafeInteger(q))throw TypeError(`Expected a code point, got \`${typeof q}\`.`)}function tx6(q,{ambiguousAsWide:K=!1}={}){if(V$5(q),ax6(q)||sx6(q)||K&&aJ7(q))return 2;return 1}var X98=y(()=>{Lo8();Lo8()});function Ro8({onlyFirst:q=!1}={}){let _=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(_,q?void 0:"g")}function VY(q){if(typeof q!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof q}\``);return q.replace(N$5,"")}var N$5;var CT=y(()=>{N$5=Ro8()});function y$5(q){if(typeof q!=="string"||q.length===0)return 0;let K=!0;for(let z=0;z<q.length;z++){let Y=q.charCodeAt(z);if(Y>=127||Y===27){K=!1;break}}if(K){let z=0;for(let Y=0;Y<q.length;Y++)if(q.charCodeAt(Y)>31)z++;return z}if(q.includes("\x1B")){if(q=VY(q),q.length===0)return 0}if(!E$5(q)){let z=0;for(let Y of q){let $=Y.codePointAt(0);if(!tJ7($))z+=tx6($,{ambiguousAsWide:!1})}return z}let _=0;for(let{segment:z}of YH().segment(q)){if(sJ7.lastIndex=0,sJ7.test(z)){_+=L$5(z);continue}for(let Y of z){let $=Y.codePointAt(0);if(!tJ7($)){_+=tx6($,{ambiguousAsWide:!1});break}}}return _}function E$5(q){for(let K of q){let _=K.codePointAt(0);if(_>=127744&&_<=129791)return!0;if(_>=9728&&_<=10175)return!0;if(_>=127462&&_<=127487)return!0;if(_>=65024&&_<=65039)return!0;if(_===8205)return!0}return!1}function L$5(q){let K=q.codePointAt(0);if(K>=127462&&K<=127487){let _=0;for(let z of q)_++;return _===1?1:2}if(q.length===2){if(q.codePointAt(1)===65039&&(K>=48&&K<=57||K===35||K===42))return 1}return 2}function tJ7(q){if(q>=32&&q<127)return!1;if(q>=160&&q<768)return q===173;if(q<=31||q>=127&&q<=159)return!0;if(q>=8203&&q<=8205||q===65279||q>=8288&&q<=8292)return!0;if(q>=65024&&q<=65039||q>=917760&&q<=917999)return!0;if(q>=768&&q<=879||q>=6832&&q<=6911||q>=7616&&q<=7679||q>=8400&&q<=8447||q>=65056&&q<=65071)return!0;if(q>=2304&&q<=3407){let K=q&127;if(K<=3)return!0;if(K>=58&&K<=79)return!0;if(K>=81&&K<=87)return!0;if(K>=98&&K<=99)return!0}if(q===3633||q>=3636&&q<=3642||q>=3655&&q<=3662||q===3761||q>=3764&&q<=3772||q>=3784&&q<=3789)return!0;if(q>=1536&&q<=1541||q===1757||q===1807||q===2274)return!0;if(q>=55296&&q<=57343)return!0;if(q>=917504&&q<=917631)return!0;return!1}var qM7,sJ7,eJ7,R$5,O1;var Q5=y(()=>{X98();CT();mk();qM7=O6(Eo8(),1),sJ7=qM7.default();eJ7=typeof Bun<"u"&&typeof Bun.stringWidth==="function"?Bun.stringWidth:null,R$5={ambiguousIsNarrow:!0},O1=eJ7?(q)=>eJ7(q,R$5):y$5});function qI6(q,K){if(O1(q)<=K)return q;if(K<=0)return"…";if(K<5)return T4(q,K);let _=q.lastIndexOf("/"),z=_>=0?q.slice(_):q,Y=_>=0?q.slice(0,_):"",$=O1(z);if($>=K-1)return ex6(q,K);let A=K-1-$;if(A<=0)return ex6(z,K);return H96(Y,A)+"…"+z}function T4(q,K){if(O1(q)<=K)return q;if(K<=1)return"…";let _=0,z="";for(let{segment:Y}of YH().segment(q)){let $=O1(Y);if(_+$>K-1)break;z+=Y,_+=$}return z+"…"}function ex6(q,K){if(O1(q)<=K)return q;if(K<=1)return"…";let _=[...YH().segment(q)],z=0,Y=_.length;for(let $=_.length-1;$>=0;$--){let A=O1(_[$].segment);if(z+A>K-1)break;z+=A,Y=$}return"…"+_.slice(Y).map(($)=>$.segment).join("")}function H96(q,K){if(O1(q)<=K)return q;if(K<=0)return"";let _=0,z="";for(let{segment:Y}of YH().segment(q)){let $=O1(Y);if(_+$>K)break;z+=Y,_+=$}return z}function d5(q,K,_=!1){let z=q;if(_){let Y=q.indexOf(`
51`);if(Y!==-1){if(z=q.substring(0,Y),O1(z)+1>K)return T4(z,K);return`${z}…`}}if(O1(z)<=K)return z;return T4(z,K)}var P98=y(()=>{Q5();mk()});function m4(q){let K=q/1024;if(K<1)return`${q} bytes`;if(K<1024)return`${K.toFixed(1).replace(/\.0$/,"")}KB`;let _=K/1024;if(_<1024)return`${_.toFixed(1).replace(/\.0$/,"")}MB`;return`${(_/1024).toFixed(1).replace(/\.0$/,"")}GB`}function D98(q){return`${(q/1000).toFixed(1)}s`}function I5(q,K){if(q<60000){if(q===0)return"0s";if(q<1)return`${(q/1000).toFixed(1)}s`;return`${Math.floor(q/1000).toString()}s`}let _=Math.floor(q/86400000),z=Math.floor(q%86400000/3600000),Y=Math.floor(q%3600000/60000),$=Math.round(q%60000/1000);if($===60)$=0,Y++;if(Y===60)Y=0,z++;if(z===24)z=0,_++;let A=K?.hideTrailingZeros;if(K?.mostSignificantOnly){if(_>0)return`${_}d`;if(z>0)return`${z}h`;if(Y>0)return`${Y}m`;return`${$}s`}if(_>0){if(A&&z===0&&Y===0)return`${_}d`;if(A&&Y===0)return`${_}d ${z}h`;return`${_}d ${z}h ${Y}m`}if(z>0){if(A&&Y===0&&$===0)return`${z}h`;if(A&&$===0)return`${z}h ${Y}m`;return`${z}h ${Y}m ${$}s`}if(Y>0){if(A&&$===0)return`${Y}m`;return`${Y}m ${$}s`}return`${$}s`}function mK(q){let K=q>=1000;return h$5(K).format(q).toLowerCase()}function _Y(q){return mK(q).replace(".0","")}function W98(q,K={}){let{style:_="narrow",numeric:z="always",now:Y=new Date}=K,$=q.getTime()-Y.getTime(),A=Math.trunc($/1000),O=[{unit:"year",seconds:31536000,shortUnit:"y"},{unit:"month",seconds:2592000,shortUnit:"mo"},{unit:"week",seconds:604800,shortUnit:"w"},{unit:"day",seconds:86400,shortUnit:"d"},{unit:"hour",seconds:3600,shortUnit:"h"},{unit:"minute",seconds:60,shortUnit:"m"},{unit:"second",seconds:1,shortUnit:"s"}];for(let{unit:w,seconds:j,shortUnit:H}of O)if(Math.abs(A)>=j){let J=Math.trunc(A/j);if(_==="narrow")return A<0?`${Math.abs(J)}${H} ago`:`in ${J}${H}`;return No8("long",z).format(J,w)}if(_==="narrow")return A<=0?"0s ago":"in 0s";return No8(_,z).format(0,"second")}function Kh(q,K={}){let{now:_=new Date,...z}=K;if(q>_)return W98(q,{...z,now:_});return W98(q,{...z,numeric:"always",now:_})}function KI6(q){let K=q.fileSize!==void 0?m4(q.fileSize):`${q.messageCount} messages`,_=[Kh(q.modified,{style:"short"}),...q.gitBranch?[q.gitBranch]:[],K];if(q.tag)_.push(`#${q.tag}`);if(q.agentSetting)_.push(`@${q.agentSetting}`);if(q.prNumber)_.push(q.prRepository?`${q.prRepository}#${q.prNumber}`:`#${q.prNumber}`);return _.join(" · ")}function zP6(q,K=!1,_=!0){if(!q)return;let z=new Date(q*1000),Y=new Date,$=z.getMinutes();if((z.getTime()-Y.getTime())/3600000>24){let w={month:"short",day:"numeric",hour:_?"numeric":void 0,minute:!_||$===0?void 0:"2-digit",hour12:_?!0:void 0};if(z.getFullYear()!==Y.getFullYear())w.year="numeric";return z.toLocaleString("en-US",w).replace(/ ([AP]M)/i,(H,J)=>J.toLowerCase())+(K?` (${yo8()})`:"")}return z.toLocaleTimeString("en-US",{hour:"numeric",minute:$===0?void 0:"2-digit",hour12:!0}).replace(/ ([AP]M)/i,(w,j)=>j.toLowerCase())+(K?` (${yo8()})`:"")}function KM7(q,K=!1,_=!0){let z=new Date(q);return`${zP6(Math.floor(z.getTime()/1000),K,_)}`}var ho8=null,So8=null,h$5=(q)=>{if(q){if(!ho8)ho8=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:1});return ho8}else{if(!So8)So8=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1,minimumFractionDigits:0});return So8}};var U7=y(()=>{mk();P98()});function wE(){if(!Co8)Co8=U6("perf_hooks").performance;return Co8}function Sx(q){return q.toFixed(3)}function f98(q,K,_,z,Y,$,A=""){let O=z?` | RSS: ${m4(z.rss)}, Heap: ${m4(z.heapUsed)}`:"";return`[+${Sx(q).padStart(Y)}ms] (+${Sx(K).padStart($)}ms) ${_}${A}${O}`}var Co8=null;var Z98=y(()=>{U7()});var jM7={};T8(jM7,{profileReport:()=>zI6,profileCheckpoint:()=>U4,logStartupPerf:()=>wM7,isDetailedProfilingEnabled:()=>I$5,getStartupPerfLogPath:()=>OM7});import{dirname as S$5,join as C$5}from"path";function U4(q){if(!$M7)return;if(wE().mark(q),_I6)AM7.push(process.memoryUsage())}function _M7(){if(!_I6)return"Startup profiling not enabled";let K=wE().getEntriesByType("mark");if(K.length===0)return"No profiling checkpoints recorded";let _=[];_.push("=".repeat(80)),_.push("STARTUP PROFILING REPORT"),_.push("=".repeat(80)),_.push("");let z=0;for(let[$,A]of K.entries())_.push(f98(A.startTime,A.startTime-z,A.name,AM7[$],8,7)),z=A.startTime;let Y=K[K.length-1];return _.push(""),_.push(`Total startup time: ${Sx(Y?.startTime??0)}ms`),_.push("=".repeat(80)),_.join(`
52`)}function zI6(){if(zM7)return;if(zM7=!0,wM7(),_I6){let q=OM7(),K=S$5(q);X8().mkdirSync(K),$j(q,_M7(),{encoding:"utf8",flush:!0}),N("Startup profiling report:"),N(_M7())}}function I$5(){return _I6}function OM7(){return C$5(c1(),"startup-perf",`${N8()}.txt`)}function wM7(){if(!YM7)return;let K=wE().getEntriesByType("mark");if(K.length===0)return;let _=new Map;for(let Y of K)_.set(Y.name,Y.startTime);let z={};for(let[Y,[$,A]]of Object.entries(x$5)){let O=_.get($),w=_.get(A);if(O!==void 0&&w!==void 0)z[`${Y}_ms`]=Math.round(w-O)}z.checkpoint_count=K.length,d("tengu_startup_perf",z)}var _I6,b$5=0.005,YM7,$M7,AM7,x$5,zM7=!1;var Cx=y(()=>{v8();k8();_8();m8();e7();Z98();l8();_I6=i6(process.env.CLAUDE_CODE_PROFILE_STARTUP),YM7=Math.random()<b$5,$M7=_I6||YM7,AM7=[],x$5={import_time:["cli_entry","main_tsx_imports_loaded"],init_time:["init_function_start","init_function_end"],settings_time:["eagerLoadSettings_start","eagerLoadSettings_end"],total_time:["cli_entry","main_after_run"]};if($M7)U4("profiler_initialized")});var Ic=m((a9$,MM7)=>{var HM7=["nodebuffer","arraybuffer","fragments"],JM7=typeof Blob<"u";if(JM7)HM7.push("blob");MM7.exports={BINARY_TYPES:HM7,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:JM7,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var YI6=m((s9$,G98)=>{var{EMPTY_BUFFER:u$5}=Ic(),bo8=Buffer[Symbol.species];function m$5(q,K){if(q.length===0)return u$5;if(q.length===1)return q[0];let _=Buffer.allocUnsafe(K),z=0;for(let Y=0;Y<q.length;Y++){let $=q[Y];_.set($,z),z+=$.length}if(z<K)return new bo8(_.buffer,_.byteOffset,z);return _}function XM7(q,K,_,z,Y){for(let $=0;$<Y;$++)_[z+$]=q[$]^K[$&3]}function PM7(q,K){for(let _=0;_<q.length;_++)q[_]^=K[_&3]}function p$5(q){if(q.length===q.buffer.byteLength)return q.buffer;return q.buffer.slice(q.byteOffset,q.byteOffset+q.length)}function xo8(q){if(xo8.readOnly=!0,Buffer.isBuffer(q))return q;let K;if(q instanceof ArrayBuffer)K=new bo8(q);else if(ArrayBuffer.isView(q))K=new bo8(q.buffer,q.byteOffset,q.byteLength);else K=Buffer.from(q),xo8.readOnly=!1;return K}G98.exports={concat:m$5,mask:XM7,toArrayBuffer:p$5,toBuffer:xo8,unmask:PM7};if(!process.env.WS_NO_BUFFER_UTIL)try{let q=(()=>{throw new Error("Cannot require module "+"bufferutil");})();G98.exports.mask=function(K,_,z,Y,$){if($<48)XM7(K,_,z,Y,$);else q.mask(K,_,z,Y,$)},G98.exports.unmask=function(K,_){if(K.length<32)PM7(K,_);else q.unmask(K,_)}}catch(q){}});var ZM7=m((t9$,fM7)=>{var WM7=Symbol("kDone"),Io8=Symbol("kRun");class DM7{constructor(q){this[WM7]=()=>{this.pending--,this[Io8]()},this.concurrency=q||1/0,this.jobs=[],this.pending=0}add(q){this.jobs.push(q),this[Io8]()}[Io8](){if(this.pending===this.concurrency)return;if(this.jobs.length){let q=this.jobs.shift();this.pending++,q(this[WM7])}}}fM7.exports=DM7});var AI6=m((e9$,VM7)=>{var $I6=U6("zlib"),GM7=YI6(),B$5=ZM7(),{kStatusCode:TM7}=Ic(),g$5=Buffer[Symbol.species],F$5=Buffer.from([0,0,255,255]),v98=Symbol("permessage-deflate"),uc=Symbol("total-length"),YP6=Symbol("callback"),at=Symbol("buffers"),$P6=Symbol("error"),T98;class vM7{constructor(q,K,_){if(this._maxPayload=_|0,this._options=q||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!K,this._deflate=null,this._inflate=null,this.params=null,!T98){let z=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;T98=new B$5(z)}}static get extensionName(){return"permessage-deflate"}offer(){let q={};if(this._options.serverNoContextTakeover)q.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)q.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)q.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)q.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)q.client_max_window_bits=!0;return q}accept(q){return q=this.normalizeParams(q),this.params=this._isServer?this.acceptAsServer(q):this.acceptAsClient(q),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let q=this._deflate[YP6];if(this._deflate.close(),this._deflate=null,q)q(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(q){let K=this._options,_=q.find((z)=>{if(K.serverNoContextTakeover===!1&&z.server_no_context_takeover||z.server_max_window_bits&&(K.serverMaxWindowBits===!1||typeof K.serverMaxWindowBits==="number"&&K.serverMaxWindowBits>z.server_max_window_bits)||typeof K.clientMaxWindowBits==="number"&&!z.client_max_window_bits)return!1;return!0});if(!_)throw Error("None of the extension offers can be accepted");if(K.serverNoContextTakeover)_.server_no_context_takeover=!0;if(K.clientNoContextTakeover)_.client_no_context_takeover=!0;if(typeof K.serverMaxWindowBits==="number")_.server_max_window_bits=K.serverMaxWindowBits;if(typeof K.clientMaxWindowBits==="number")_.client_max_window_bits=K.clientMaxWindowBits;else if(_.client_max_window_bits===!0||K.clientMaxWindowBits===!1)delete _.client_max_window_bits;return _}acceptAsClient(q){let K=q[0];if(this._options.clientNoContextTakeover===!1&&K.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!K.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")K.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&K.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return K}normalizeParams(q){return q.forEach((K)=>{Object.keys(K).forEach((_)=>{let z=K[_];if(z.length>1)throw Error(`Parameter "${_}" must have only a single value`);if(z=z[0],_==="client_max_window_bits"){if(z!==!0){let Y=+z;if(!Number.isInteger(Y)||Y<8||Y>15)throw TypeError(`Invalid value for parameter "${_}": ${z}`);z=Y}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${_}": ${z}`)}else if(_==="server_max_window_bits"){let Y=+z;if(!Number.isInteger(Y)||Y<8||Y>15)throw TypeError(`Invalid value for parameter "${_}": ${z}`);z=Y}else if(_==="client_no_context_takeover"||_==="server_no_context_takeover"){if(z!==!0)throw TypeError(`Invalid value for parameter "${_}": ${z}`)}else throw Error(`Unknown parameter "${_}"`);K[_]=z})}),q}decompress(q,K,_){T98.add((z)=>{this._decompress(q,K,(Y,$)=>{z(),_(Y,$)})})}compress(q,K,_){T98.add((z)=>{this._compress(q,K,(Y,$)=>{z(),_(Y,$)})})}_decompress(q,K,_){let z=this._isServer?"client":"server";if(!this._inflate){let Y=`${z}_max_window_bits`,$=typeof this.params[Y]!=="number"?$I6.Z_DEFAULT_WINDOWBITS:this.params[Y];this._inflate=$I6.createInflateRaw({...this._options.zlibInflateOptions,windowBits:$}),this._inflate[v98]=this,this._inflate[uc]=0,this._inflate[at]=[],this._inflate.on("error",Q$5),this._inflate.on("data",kM7)}if(this._inflate[YP6]=_,this._inflate.write(q),K)this._inflate.write(F$5);this._inflate.flush(()=>{let Y=this._inflate[$P6];if(Y){this._inflate.close(),this._inflate=null,_(Y);return}let $=GM7.concat(this._inflate[at],this._inflate[uc]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[uc]=0,this._inflate[at]=[],K&&this.params[`${z}_no_context_takeover`])this._inflate.reset();_(null,$)})}_compress(q,K,_){let z=this._isServer?"server":"client";if(!this._deflate){let Y=`${z}_max_window_bits`,$=typeof this.params[Y]!=="number"?$I6.Z_DEFAULT_WINDOWBITS:this.params[Y];this._deflate=$I6.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:$}),this._deflate[uc]=0,this._deflate[at]=[],this._deflate.on("data",U$5)}this._deflate[YP6]=_,this._deflate.write(q),this._deflate.flush($I6.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let Y=GM7.concat(this._deflate[at],this._deflate[uc]);if(K)Y=new g$5(Y.buffer,Y.byteOffset,Y.length-4);if(this._deflate[YP6]=null,this._deflate[uc]=0,this._deflate[at]=[],K&&this.params[`${z}_no_context_takeover`])this._deflate.reset();_(null,Y)})}}VM7.exports=vM7;function U$5(q){this[at].push(q),this[uc]+=q.length}function kM7(q){if(this[uc]+=q.length,this[v98]._maxPayload<1||this[uc]<=this[v98]._maxPayload){this[at].push(q);return}this[$P6]=RangeError("Max payload size exceeded"),this[$P6].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[$P6][TM7]=1009,this.removeListener("data",kM7),this.reset()}function Q$5(q){if(this[v98]._inflate=null,this[$P6]){this[YP6](this[$P6]);return}q[TM7]=1007,this[YP6](q)}});var AP6=m((q_$,k98)=>{var{isUtf8:NM7}=U6("buffer"),{hasBlob:d$5}=Ic(),c$5=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function l$5(q){return q>=1000&&q<=1014&&q!==1004&&q!==1005&&q!==1006||q>=3000&&q<=4999}function uo8(q){let K=q.length,_=0;while(_<K)if((q[_]&128)===0)_++;else if((q[_]&224)===192){if(_+1===K||(q[_+1]&192)!==128||(q[_]&254)===192)return!1;_+=2}else if((q[_]&240)===224){if(_+2>=K||(q[_+1]&192)!==128||(q[_+2]&192)!==128||q[_]===224&&(q[_+1]&224)===128||q[_]===237&&(q[_+1]&224)===160)return!1;_+=3}else if((q[_]&248)===240){if(_+3>=K||(q[_+1]&192)!==128||(q[_+2]&192)!==128||(q[_+3]&192)!==128||q[_]===240&&(q[_+1]&240)===128||q[_]===244&&q[_+1]>143||q[_]>244)return!1;_+=4}else return!1;return!0}function n$5(q){return d$5&&typeof q==="object"&&typeof q.arrayBuffer==="function"&&typeof q.type==="string"&&typeof q.stream==="function"&&(q[Symbol.toStringTag]==="Blob"||q[Symbol.toStringTag]==="File")}k98.exports={isBlob:n$5,isValidStatusCode:l$5,isValidUTF8:uo8,tokenChars:c$5};if(NM7)k98.exports.isValidUTF8=function(q){return q.length<24?uo8(q):NM7(q)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let q=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();k98.exports.isValidUTF8=function(K){return K.length<32?uo8(K):q(K)}}catch(q){}});var po8=m((K_$,hM7)=>{var{Writable:i$5}=U6("stream"),yM7=AI6(),{BINARY_TYPES:r$5,EMPTY_BUFFER:EM7,kStatusCode:o$5,kWebSocket:a$5}=Ic(),{concat:mo8,toArrayBuffer:s$5,unmask:t$5}=YI6(),{isValidStatusCode:e$5,isValidUTF8:LM7}=AP6(),V98=Buffer[Symbol.species];class RM7 extends i$5{constructor(q={}){super();this._allowSynchronousEvents=q.allowSynchronousEvents!==void 0?q.allowSynchronousEvents:!0,this._binaryType=q.binaryType||r$5[0],this._extensions=q.extensions||{},this._isServer=!!q.isServer,this._maxPayload=q.maxPayload|0,this._skipUTF8Validation=!!q.skipUTF8Validation,this[a$5]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(q,K,_){if(this._opcode===8&&this._state==0)return _();this._bufferedBytes+=q.length,this._buffers.push(q),this.startLoop(_)}consume(q){if(this._bufferedBytes-=q,q===this._buffers[0].length)return this._buffers.shift();if(q<this._buffers[0].length){let _=this._buffers[0];return this._buffers[0]=new V98(_.buffer,_.byteOffset+q,_.length-q),new V98(_.buffer,_.byteOffset,q)}let K=Buffer.allocUnsafe(q);do{let _=this._buffers[0],z=K.length-q;if(q>=_.length)K.set(this._buffers.shift(),z);else K.set(new Uint8Array(_.buffer,_.byteOffset,q),z),this._buffers[0]=new V98(_.buffer,_.byteOffset+q,_.length-q);q-=_.length}while(q>0);return K}startLoop(q){this._loop=!0;do switch(this._state){case 0:this.getInfo(q);break;case 1:this.getPayloadLength16(q);break;case 2:this.getPayloadLength64(q);break;case 3:this.getMask();break;case 4:this.getData(q);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)q()}getInfo(q){if(this._bufferedBytes<2){this._loop=!1;return}let K=this.consume(2);if((K[0]&48)!==0){let z=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");q(z);return}let _=(K[0]&64)===64;if(_&&!this._extensions[yM7.extensionName]){let z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");q(z);return}if(this._fin=(K[0]&128)===128,this._opcode=K[0]&15,this._payloadLength=K[1]&127,this._opcode===0){if(_){let z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");q(z);return}if(!this._fragmented){let z=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");q(z);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let z=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");q(z);return}this._compressed=_}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let z=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");q(z);return}if(_){let z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");q(z);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let z=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");q(z);return}}else{let z=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");q(z);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(K[1]&128)===128,this._isServer){if(!this._masked){let z=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");q(z);return}}else if(this._masked){let z=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");q(z);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(q)}getPayloadLength16(q){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(q)}getPayloadLength64(q){if(this._bufferedBytes<8){this._loop=!1;return}let K=this.consume(8),_=K.readUInt32BE(0);if(_>Math.pow(2,21)-1){let z=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");q(z);return}this._payloadLength=_*Math.pow(2,32)+K.readUInt32BE(4),this.haveLength(q)}haveLength(q){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let K=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");q(K);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(q){let K=EM7;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(K=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)t$5(K,this._mask)}if(this._opcode>7){this.controlMessage(K,q);return}if(this._compressed){this._state=5,this.decompress(K,q);return}if(K.length)this._messageLength=this._totalPayloadLength,this._fragments.push(K);this.dataMessage(q)}decompress(q,K){this._extensions[yM7.extensionName].decompress(q,this._fin,(z,Y)=>{if(z)return K(z);if(Y.length){if(this._messageLength+=Y.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let $=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");K($);return}this._fragments.push(Y)}if(this.dataMessage(K),this._state===0)this.startLoop(K)})}dataMessage(q){if(!this._fin){this._state=0;return}let K=this._messageLength,_=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let z;if(this._binaryType==="nodebuffer")z=mo8(_,K);else if(this._binaryType==="arraybuffer")z=s$5(mo8(_,K));else if(this._binaryType==="blob")z=new Blob(_);else z=_;if(this._allowSynchronousEvents)this.emit("message",z,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",z,!0),this._state=0,this.startLoop(q)})}else{let z=mo8(_,K);if(!this._skipUTF8Validation&&!LM7(z)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");q(Y);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",z,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",z,!1),this._state=0,this.startLoop(q)})}}controlMessage(q,K){if(this._opcode===8){if(q.length===0)this._loop=!1,this.emit("conclude",1005,EM7),this.end();else{let _=q.readUInt16BE(0);if(!e$5(_)){let Y=this.createError(RangeError,`invalid status code ${_}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");K(Y);return}let z=new V98(q.buffer,q.byteOffset+2,q.length-2);if(!this._skipUTF8Validation&&!LM7(z)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");K(Y);return}this._loop=!1,this.emit("conclude",_,z),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",q),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",q),this._state=0,this.startLoop(K)})}createError(q,K,_,z,Y){this._loop=!1,this._errored=!0;let $=new q(_?`Invalid WebSocket frame: ${K}`:K);return Error.captureStackTrace($,this.createError),$.code=Y,$[o$5]=z,$}}hM7.exports=RM7});var go8=m((z_$,bM7)=>{var{Duplex:__$}=U6("stream"),{randomFillSync:qA5}=U6("crypto"),SM7=AI6(),{EMPTY_BUFFER:KA5,kWebSocket:_A5,NOOP:zA5}=Ic(),{isBlob:OP6,isValidStatusCode:YA5}=AP6(),{mask:CM7,toBuffer:J96}=YI6(),_h=Symbol("kByteLength"),$A5=Buffer.alloc(4),M96,wP6=8192,bx=0,AA5=1,OA5=2;class st{constructor(q,K,_){if(this._extensions=K||{},_)this._generateMask=_,this._maskBuffer=Buffer.alloc(4);this._socket=q,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=bx,this.onerror=zA5,this[_A5]=void 0}static frame(q,K){let _,z=!1,Y=2,$=!1;if(K.mask){if(_=K.maskBuffer||$A5,K.generateMask)K.generateMask(_);else{if(wP6===8192){if(M96===void 0)M96=Buffer.alloc(8192);qA5(M96,0,8192),wP6=0}_[0]=M96[wP6++],_[1]=M96[wP6++],_[2]=M96[wP6++],_[3]=M96[wP6++]}$=(_[0]|_[1]|_[2]|_[3])===0,Y=6}let A;if(typeof q==="string")if((!K.mask||$)&&K[_h]!==void 0)A=K[_h];else q=Buffer.from(q),A=q.length;else A=q.length,z=K.mask&&K.readOnly&&!$;let O=A;if(A>=65536)Y+=8,O=127;else if(A>125)Y+=2,O=126;let w=Buffer.allocUnsafe(z?A+Y:Y);if(w[0]=K.fin?K.opcode|128:K.opcode,K.rsv1)w[0]|=64;if(w[1]=O,O===126)w.writeUInt16BE(A,2);else if(O===127)w[2]=w[3]=0,w.writeUIntBE(A,4,6);if(!K.mask)return[w,q];if(w[1]|=128,w[Y-4]=_[0],w[Y-3]=_[1],w[Y-2]=_[2],w[Y-1]=_[3],$)return[w,q];if(z)return CM7(q,_,w,Y,A),[w];return CM7(q,_,q,0,A),[w,q]}close(q,K,_,z){let Y;if(q===void 0)Y=KA5;else if(typeof q!=="number"||!YA5(q))throw TypeError("First argument must be a valid error code number");else if(K===void 0||!K.length)Y=Buffer.allocUnsafe(2),Y.writeUInt16BE(q,0);else{let A=Buffer.byteLength(K);if(A>123)throw RangeError("The message must not be greater than 123 bytes");if(Y=Buffer.allocUnsafe(2+A),Y.writeUInt16BE(q,0),typeof K==="string")Y.write(K,2);else Y.set(K,2)}let $={[_h]:Y.length,fin:!0,generateMask:this._generateMask,mask:_,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==bx)this.enqueue([this.dispatch,Y,!1,$,z]);else this.sendFrame(st.frame(Y,$),z)}ping(q,K,_){let z,Y;if(typeof q==="string")z=Buffer.byteLength(q),Y=!1;else if(OP6(q))z=q.size,Y=!1;else q=J96(q),z=q.length,Y=J96.readOnly;if(z>125)throw RangeError("The data size must not be greater than 125 bytes");let $={[_h]:z,fin:!0,generateMask:this._generateMask,mask:K,maskBuffer:this._maskBuffer,opcode:9,readOnly:Y,rsv1:!1};if(OP6(q))if(this._state!==bx)this.enqueue([this.getBlobData,q,!1,$,_]);else this.getBlobData(q,!1,$,_);else if(this._state!==bx)this.enqueue([this.dispatch,q,!1,$,_]);else this.sendFrame(st.frame(q,$),_)}pong(q,K,_){let z,Y;if(typeof q==="string")z=Buffer.byteLength(q),Y=!1;else if(OP6(q))z=q.size,Y=!1;else q=J96(q),z=q.length,Y=J96.readOnly;if(z>125)throw RangeError("The data size must not be greater than 125 bytes");let $={[_h]:z,fin:!0,generateMask:this._generateMask,mask:K,maskBuffer:this._maskBuffer,opcode:10,readOnly:Y,rsv1:!1};if(OP6(q))if(this._state!==bx)this.enqueue([this.getBlobData,q,!1,$,_]);else this.getBlobData(q,!1,$,_);else if(this._state!==bx)this.enqueue([this.dispatch,q,!1,$,_]);else this.sendFrame(st.frame(q,$),_)}send(q,K,_){let z=this._extensions[SM7.extensionName],Y=K.binary?2:1,$=K.compress,A,O;if(typeof q==="string")A=Buffer.byteLength(q),O=!1;else if(OP6(q))A=q.size,O=!1;else q=J96(q),A=q.length,O=J96.readOnly;if(this._firstFragment){if(this._firstFragment=!1,$&&z&&z.params[z._isServer?"server_no_context_takeover":"client_no_context_takeover"])$=A>=z._threshold;this._compress=$}else $=!1,Y=0;if(K.fin)this._firstFragment=!0;let w={[_h]:A,fin:K.fin,generateMask:this._generateMask,mask:K.mask,maskBuffer:this._maskBuffer,opcode:Y,readOnly:O,rsv1:$};if(OP6(q))if(this._state!==bx)this.enqueue([this.getBlobData,q,this._compress,w,_]);else this.getBlobData(q,this._compress,w,_);else if(this._state!==bx)this.enqueue([this.dispatch,q,this._compress,w,_]);else this.dispatch(q,this._compress,w,_)}getBlobData(q,K,_,z){this._bufferedBytes+=_[_h],this._state=OA5,q.arrayBuffer().then((Y)=>{if(this._socket.destroyed){let A=Error("The socket was closed while the blob was being read");process.nextTick(Bo8,this,A,z);return}this._bufferedBytes-=_[_h];let $=J96(Y);if(!K)this._state=bx,this.sendFrame(st.frame($,_),z),this.dequeue();else this.dispatch($,K,_,z)}).catch((Y)=>{process.nextTick(wA5,this,Y,z)})}dispatch(q,K,_,z){if(!K){this.sendFrame(st.frame(q,_),z);return}let Y=this._extensions[SM7.extensionName];this._bufferedBytes+=_[_h],this._state=AA5,Y.compress(q,_.fin,($,A)=>{if(this._socket.destroyed){let O=Error("The socket was closed while data was being compressed");Bo8(this,O,z);return}this._bufferedBytes-=_[_h],this._state=bx,_.readOnly=!1,this.sendFrame(st.frame(A,_),z),this.dequeue()})}dequeue(){while(this._state===bx&&this._queue.length){let q=this._queue.shift();this._bufferedBytes-=q[3][_h],Reflect.apply(q[0],this,q.slice(1))}}enqueue(q){this._bufferedBytes+=q[3][_h],this._queue.push(q)}sendFrame(q,K){if(q.length===2)this._socket.cork(),this._socket.write(q[0]),this._socket.write(q[1],K),this._socket.uncork();else this._socket.write(q[0],K)}}bM7.exports=st;function Bo8(q,K,_){if(typeof _==="function")_(K);for(let z=0;z<q._queue.length;z++){let Y=q._queue[z],$=Y[Y.length-1];if(typeof $==="function")$(K)}}function wA5(q,K,_){Bo8(q,K,_),q.onerror(K)}});var UM7=m((Y_$,FM7)=>{var{kForOnEventAttribute:OI6,kListener:Fo8}=Ic(),xM7=Symbol("kCode"),IM7=Symbol("kData"),uM7=Symbol("kError"),mM7=Symbol("kMessage"),pM7=Symbol("kReason"),jP6=Symbol("kTarget"),BM7=Symbol("kType"),gM7=Symbol("kWasClean");class tt{constructor(q){this[jP6]=null,this[BM7]=q}get target(){return this[jP6]}get type(){return this[BM7]}}Object.defineProperty(tt.prototype,"target",{enumerable:!0});Object.defineProperty(tt.prototype,"type",{enumerable:!0});class HP6 extends tt{constructor(q,K={}){super(q);this[xM7]=K.code===void 0?0:K.code,this[pM7]=K.reason===void 0?"":K.reason,this[gM7]=K.wasClean===void 0?!1:K.wasClean}get code(){return this[xM7]}get reason(){return this[pM7]}get wasClean(){return this[gM7]}}Object.defineProperty(HP6.prototype,"code",{enumerable:!0});Object.defineProperty(HP6.prototype,"reason",{enumerable:!0});Object.defineProperty(HP6.prototype,"wasClean",{enumerable:!0});class wI6 extends tt{constructor(q,K={}){super(q);this[uM7]=K.error===void 0?null:K.error,this[mM7]=K.message===void 0?"":K.message}get error(){return this[uM7]}get message(){return this[mM7]}}Object.defineProperty(wI6.prototype,"error",{enumerable:!0});Object.defineProperty(wI6.prototype,"message",{enumerable:!0});class y98 extends tt{constructor(q,K={}){super(q);this[IM7]=K.data===void 0?null:K.data}get data(){return this[IM7]}}Object.defineProperty(y98.prototype,"data",{enumerable:!0});var jA5={addEventListener(q,K,_={}){for(let Y of this.listeners(q))if(!_[OI6]&&Y[Fo8]===K&&!Y[OI6])return;let z;if(q==="message")z=function($,A){let O=new y98("message",{data:A?$:$.toString()});O[jP6]=this,N98(K,this,O)};else if(q==="close")z=function($,A){let O=new HP6("close",{code:$,reason:A.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});O[jP6]=this,N98(K,this,O)};else if(q==="error")z=function($){let A=new wI6("error",{error:$,message:$.message});A[jP6]=this,N98(K,this,A)};else if(q==="open")z=function(){let $=new tt("open");$[jP6]=this,N98(K,this,$)};else return;if(z[OI6]=!!_[OI6],z[Fo8]=K,_.once)this.once(q,z);else this.on(q,z)},removeEventListener(q,K){for(let _ of this.listeners(q))if(_[Fo8]===K&&!_[OI6]){this.removeListener(q,_);break}}};FM7.exports={CloseEvent:HP6,ErrorEvent:wI6,Event:tt,EventTarget:jA5,MessageEvent:y98};function N98(q,K,_){if(typeof q==="object"&&q.handleEvent)q.handleEvent.call(q,_);else q.call(K,_)}});var Uo8=m(($_$,QM7)=>{var{tokenChars:jI6}=AP6();function AB(q,K,_){if(q[K]===void 0)q[K]=[_];else q[K].push(_)}function HA5(q){let K=Object.create(null),_=Object.create(null),z=!1,Y=!1,$=!1,A,O,w=-1,j=-1,H=-1,J=0;for(;J<q.length;J++)if(j=q.charCodeAt(J),A===void 0)if(H===-1&&jI6[j]===1){if(w===-1)w=J}else if(J!==0&&(j===32||j===9)){if(H===-1&&w!==-1)H=J}else if(j===59||j===44){if(w===-1)throw SyntaxError(`Unexpected character at index ${J}`);if(H===-1)H=J;let X=q.slice(w,H);if(j===44)AB(K,X,_),_=Object.create(null);else A=X;w=H=-1}else throw SyntaxError(`Unexpected character at index ${J}`);else if(O===void 0)if(H===-1&&jI6[j]===1){if(w===-1)w=J}else if(j===32||j===9){if(H===-1&&w!==-1)H=J}else if(j===59||j===44){if(w===-1)throw SyntaxError(`Unexpected character at index ${J}`);if(H===-1)H=J;if(AB(_,q.slice(w,H),!0),j===44)AB(K,A,_),_=Object.create(null),A=void 0;w=H=-1}else if(j===61&&w!==-1&&H===-1)O=q.slice(w,J),w=H=-1;else throw SyntaxError(`Unexpected character at index ${J}`);else if(Y){if(jI6[j]!==1)throw SyntaxError(`Unexpected character at index ${J}`);if(w===-1)w=J;else if(!z)z=!0;Y=!1}else if($)if(jI6[j]===1){if(w===-1)w=J}else if(j===34&&w!==-1)$=!1,H=J;else if(j===92)Y=!0;else throw SyntaxError(`Unexpected character at index ${J}`);else if(j===34&&q.charCodeAt(J-1)===61)$=!0;else if(H===-1&&jI6[j]===1){if(w===-1)w=J}else if(w!==-1&&(j===32||j===9)){if(H===-1)H=J}else if(j===59||j===44){if(w===-1)throw SyntaxError(`Unexpected character at index ${J}`);if(H===-1)H=J;let X=q.slice(w,H);if(z)X=X.replace(/\\/g,""),z=!1;if(AB(_,O,X),j===44)AB(K,A,_),_=Object.create(null),A=void 0;O=void 0,w=H=-1}else throw SyntaxError(`Unexpected character at index ${J}`);if(w===-1||$||j===32||j===9)throw SyntaxError("Unexpected end of input");if(H===-1)H=J;let M=q.slice(w,H);if(A===void 0)AB(K,M,_);else{if(O===void 0)AB(_,M,!0);else if(z)AB(_,O,M.replace(/\\/g,""));else AB(_,O,M);AB(K,A,_)}return K}function JA5(q){return Object.keys(q).map((K)=>{let _=q[K];if(!Array.isArray(_))_=[_];return _.map((z)=>{return[K].concat(Object.keys(z).map((Y)=>{let $=z[Y];if(!Array.isArray($))$=[$];return $.map((A)=>A===!0?Y:`${Y}=${A}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}QM7.exports={format:JA5,parse:HA5}});var h98=m((w_$,qX7)=>{var MA5=U6("events"),XA5=U6("https"),PA5=U6("http"),lM7=U6("net"),WA5=U6("tls"),{randomBytes:DA5,createHash:fA5}=U6("crypto"),{Duplex:A_$,Readable:O_$}=U6("stream"),{URL:Qo8}=U6("url"),et=AI6(),ZA5=po8(),GA5=go8(),{isBlob:TA5}=AP6(),{BINARY_TYPES:dM7,EMPTY_BUFFER:E98,GUID:vA5,kForOnEventAttribute:do8,kListener:kA5,kStatusCode:VA5,kWebSocket:TW,NOOP:nM7}=Ic(),{EventTarget:{addEventListener:NA5,removeEventListener:yA5}}=UM7(),{format:EA5,parse:LA5}=Uo8(),{toBuffer:RA5}=YI6(),iM7=Symbol("kAborted"),co8=[8,13],mc=["CONNECTING","OPEN","CLOSING","CLOSED"],hA5=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class Z9 extends MA5{constructor(q,K,_){super();if(this._binaryType=dM7[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=E98,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=Z9.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,q!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,K===void 0)K=[];else if(!Array.isArray(K))if(typeof K==="object"&&K!==null)_=K,K=[];else K=[K];rM7(this,q,K,_)}else this._autoPong=_.autoPong,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(q){if(!dM7.includes(q))return;if(this._binaryType=q,this._receiver)this._receiver._binaryType=q}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(q,K,_){let z=new ZA5({allowSynchronousEvents:_.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:_.maxPayload,skipUTF8Validation:_.skipUTF8Validation}),Y=new GA5(q,this._extensions,_.generateMask);if(this._receiver=z,this._sender=Y,this._socket=q,z[TW]=this,Y[TW]=this,q[TW]=this,z.on("conclude",bA5),z.on("drain",xA5),z.on("error",IA5),z.on("message",uA5),z.on("ping",mA5),z.on("pong",pA5),Y.onerror=BA5,q.setTimeout)q.setTimeout(0);if(q.setNoDelay)q.setNoDelay();if(K.length>0)q.unshift(K);q.on("close",sM7),q.on("data",R98),q.on("end",tM7),q.on("error",eM7),this._readyState=Z9.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=Z9.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[et.extensionName])this._extensions[et.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=Z9.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(q,K){if(this.readyState===Z9.CLOSED)return;if(this.readyState===Z9.CONNECTING){jE(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===Z9.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=Z9.CLOSING,this._sender.close(q,K,!this._isServer,(_)=>{if(_)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),aM7(this)}pause(){if(this.readyState===Z9.CONNECTING||this.readyState===Z9.CLOSED)return;this._paused=!0,this._socket.pause()}ping(q,K,_){if(this.readyState===Z9.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof q==="function")_=q,q=K=void 0;else if(typeof K==="function")_=K,K=void 0;if(typeof q==="number")q=q.toString();if(this.readyState!==Z9.OPEN){lo8(this,q,_);return}if(K===void 0)K=!this._isServer;this._sender.ping(q||E98,K,_)}pong(q,K,_){if(this.readyState===Z9.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof q==="function")_=q,q=K=void 0;else if(typeof K==="function")_=K,K=void 0;if(typeof q==="number")q=q.toString();if(this.readyState!==Z9.OPEN){lo8(this,q,_);return}if(K===void 0)K=!this._isServer;this._sender.pong(q||E98,K,_)}resume(){if(this.readyState===Z9.CONNECTING||this.readyState===Z9.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(q,K,_){if(this.readyState===Z9.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof K==="function")_=K,K={};if(typeof q==="number")q=q.toString();if(this.readyState!==Z9.OPEN){lo8(this,q,_);return}let z={binary:typeof q!=="string",mask:!this._isServer,compress:!0,fin:!0,...K};if(!this._extensions[et.extensionName])z.compress=!1;this._sender.send(q||E98,z,_)}terminate(){if(this.readyState===Z9.CLOSED)return;if(this.readyState===Z9.CONNECTING){jE(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=Z9.CLOSING,this._socket.destroy()}}Object.defineProperty(Z9,"CONNECTING",{enumerable:!0,value:mc.indexOf("CONNECTING")});Object.defineProperty(Z9.prototype,"CONNECTING",{enumerable:!0,value:mc.indexOf("CONNECTING")});Object.defineProperty(Z9,"OPEN",{enumerable:!0,value:mc.indexOf("OPEN")});Object.defineProperty(Z9.prototype,"OPEN",{enumerable:!0,value:mc.indexOf("OPEN")});Object.defineProperty(Z9,"CLOSING",{enumerable:!0,value:mc.indexOf("CLOSING")});Object.defineProperty(Z9.prototype,"CLOSING",{enumerable:!0,value:mc.indexOf("CLOSING")});Object.defineProperty(Z9,"CLOSED",{enumerable:!0,value:mc.indexOf("CLOSED")});Object.defineProperty(Z9.prototype,"CLOSED",{enumerable:!0,value:mc.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((q)=>{Object.defineProperty(Z9.prototype,q,{enumerable:!0})});["open","error","close","message"].forEach((q)=>{Object.defineProperty(Z9.prototype,`on${q}`,{enumerable:!0,get(){for(let K of this.listeners(q))if(K[do8])return K[kA5];return null},set(K){for(let _ of this.listeners(q))if(_[do8]){this.removeListener(q,_);break}if(typeof K!=="function")return;this.addEventListener(q,K,{[do8]:!0})}})});Z9.prototype.addEventListener=NA5;Z9.prototype.removeEventListener=yA5;qX7.exports=Z9;function rM7(q,K,_,z){let Y={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:co8[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...z,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(q._autoPong=Y.autoPong,!co8.includes(Y.protocolVersion))throw RangeError(`Unsupported protocol version: ${Y.protocolVersion} (supported versions: ${co8.join(", ")})`);let $;if(K instanceof Qo8)$=K;else try{$=new Qo8(K)}catch(W){throw SyntaxError(`Invalid URL: ${K}`)}if($.protocol==="http:")$.protocol="ws:";else if($.protocol==="https:")$.protocol="wss:";q._url=$.href;let A=$.protocol==="wss:",O=$.protocol==="ws+unix:",w;if($.protocol!=="ws:"&&!A&&!O)w=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(O&&!$.pathname)w="The URL's pathname is empty";else if($.hash)w="The URL contains a fragment identifier";if(w){let W=SyntaxError(w);if(q._redirects===0)throw W;else{L98(q,W);return}}let j=A?443:80,H=DA5(16).toString("base64"),J=A?XA5.request:PA5.request,M=new Set,X;if(Y.createConnection=Y.createConnection||(A?CA5:SA5),Y.defaultPort=Y.defaultPort||j,Y.port=$.port||j,Y.host=$.hostname.startsWith("[")?$.hostname.slice(1,-1):$.hostname,Y.headers={...Y.headers,"Sec-WebSocket-Version":Y.protocolVersion,"Sec-WebSocket-Key":H,Connection:"Upgrade",Upgrade:"websocket"},Y.path=$.pathname+$.search,Y.timeout=Y.handshakeTimeout,Y.perMessageDeflate)X=new et(Y.perMessageDeflate!==!0?Y.perMessageDeflate:{},!1,Y.maxPayload),Y.headers["Sec-WebSocket-Extensions"]=EA5({[et.extensionName]:X.offer()});if(_.length){for(let W of _){if(typeof W!=="string"||!hA5.test(W)||M.has(W))throw SyntaxError("An invalid or duplicated subprotocol was specified");M.add(W)}Y.headers["Sec-WebSocket-Protocol"]=_.join(",")}if(Y.origin)if(Y.protocolVersion<13)Y.headers["Sec-WebSocket-Origin"]=Y.origin;else Y.headers.Origin=Y.origin;if($.username||$.password)Y.auth=`${$.username}:${$.password}`;if(O){let W=Y.path.split(":");Y.socketPath=W[0],Y.path=W[1]}let P;if(Y.followRedirects){if(q._redirects===0){q._originalIpc=O,q._originalSecure=A,q._originalHostOrSocketPath=O?Y.socketPath:$.host;let W=z&&z.headers;if(z={...z,headers:{}},W)for(let[D,f]of Object.entries(W))z.headers[D.toLowerCase()]=f}else if(q.listenerCount("redirect")===0){let W=O?q._originalIpc?Y.socketPath===q._originalHostOrSocketPath:!1:q._originalIpc?!1:$.host===q._originalHostOrSocketPath;if(!W||q._originalSecure&&!A){if(delete Y.headers.authorization,delete Y.headers.cookie,!W)delete Y.headers.host;Y.auth=void 0}}if(Y.auth&&!z.headers.authorization)z.headers.authorization="Basic "+Buffer.from(Y.auth).toString("base64");if(P=q._req=J(Y),q._redirects)q.emit("redirect",q.url,P)}else P=q._req=J(Y);if(Y.timeout)P.on("timeout",()=>{jE(q,P,"Opening handshake has timed out")});if(P.on("error",(W)=>{if(P===null||P[iM7])return;P=q._req=null,L98(q,W)}),P.on("response",(W)=>{let D=W.headers.location,f=W.statusCode;if(D&&Y.followRedirects&&f>=300&&f<400){if(++q._redirects>Y.maxRedirects){jE(q,P,"Maximum redirects exceeded");return}P.abort();let G;try{G=new Qo8(D,K)}catch(Z){let T=SyntaxError(`Invalid URL: ${D}`);L98(q,T);return}rM7(q,G,_,z)}else if(!q.emit("unexpected-response",P,W))jE(q,P,`Unexpected server response: ${W.statusCode}`)}),P.on("upgrade",(W,D,f)=>{if(q.emit("upgrade",W),q.readyState!==Z9.CONNECTING)return;P=q._req=null;let G=W.headers.upgrade;if(G===void 0||G.toLowerCase()!=="websocket"){jE(q,D,"Invalid Upgrade header");return}let Z=fA5("sha1").update(H+vA5).digest("base64");if(W.headers["sec-websocket-accept"]!==Z){jE(q,D,"Invalid Sec-WebSocket-Accept header");return}let T=W.headers["sec-websocket-protocol"],v;if(T!==void 0){if(!M.size)v="Server sent a subprotocol but none was requested";else if(!M.has(T))v="Server sent an invalid subprotocol"}else if(M.size)v="Server sent no subprotocol";if(v){jE(q,D,v);return}if(T)q._protocol=T;let V=W.headers["sec-websocket-extensions"];if(V!==void 0){if(!X){jE(q,D,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let E;try{E=LA5(V)}catch(R){jE(q,D,"Invalid Sec-WebSocket-Extensions header");return}let S=Object.keys(E);if(S.length!==1||S[0]!==et.extensionName){jE(q,D,"Server indicated an extension that was not requested");return}try{X.accept(E[et.extensionName])}catch(R){jE(q,D,"Invalid Sec-WebSocket-Extensions header");return}q._extensions[et.extensionName]=X}q.setSocket(D,f,{allowSynchronousEvents:Y.allowSynchronousEvents,generateMask:Y.generateMask,maxPayload:Y.maxPayload,skipUTF8Validation:Y.skipUTF8Validation})}),Y.finishRequest)Y.finishRequest(P,q);else P.end()}function L98(q,K){q._readyState=Z9.CLOSING,q._errorEmitted=!0,q.emit("error",K),q.emitClose()}function SA5(q){return q.path=q.socketPath,lM7.connect(q)}function CA5(q){if(q.path=void 0,!q.servername&&q.servername!=="")q.servername=lM7.isIP(q.host)?"":q.host;return WA5.connect(q)}function jE(q,K,_){q._readyState=Z9.CLOSING;let z=Error(_);if(Error.captureStackTrace(z,jE),K.setHeader){if(K[iM7]=!0,K.abort(),K.socket&&!K.socket.destroyed)K.socket.destroy();process.nextTick(L98,q,z)}else K.destroy(z),K.once("error",q.emit.bind(q,"error")),K.once("close",q.emitClose.bind(q))}function lo8(q,K,_){if(K){let z=TA5(K)?K.size:RA5(K).length;if(q._socket)q._sender._bufferedBytes+=z;else q._bufferedAmount+=z}if(_){let z=Error(`WebSocket is not open: readyState ${q.readyState} (${mc[q.readyState]})`);process.nextTick(_,z)}}function bA5(q,K){let _=this[TW];if(_._closeFrameReceived=!0,_._closeMessage=K,_._closeCode=q,_._socket[TW]===void 0)return;if(_._socket.removeListener("data",R98),process.nextTick(oM7,_._socket),q===1005)_.close();else _.close(q,K)}function xA5(){let q=this[TW];if(!q.isPaused)q._socket.resume()}function IA5(q){let K=this[TW];if(K._socket[TW]!==void 0)K._socket.removeListener("data",R98),process.nextTick(oM7,K._socket),K.close(q[VA5]);if(!K._errorEmitted)K._errorEmitted=!0,K.emit("error",q)}function cM7(){this[TW].emitClose()}function uA5(q,K){this[TW].emit("message",q,K)}function mA5(q){let K=this[TW];if(K._autoPong)K.pong(q,!this._isServer,nM7);K.emit("ping",q)}function pA5(q){this[TW].emit("pong",q)}function oM7(q){q.resume()}function BA5(q){let K=this[TW];if(K.readyState===Z9.CLOSED)return;if(K.readyState===Z9.OPEN)K._readyState=Z9.CLOSING,aM7(K);if(this._socket.end(),!K._errorEmitted)K._errorEmitted=!0,K.emit("error",q)}function aM7(q){q._closeTimer=setTimeout(q._socket.destroy.bind(q._socket),30000)}function sM7(){let q=this[TW];this.removeListener("close",sM7),this.removeListener("data",R98),this.removeListener("end",tM7),q._readyState=Z9.CLOSING;let K;if(!this._readableState.endEmitted&&!q._closeFrameReceived&&!q._receiver._writableState.errorEmitted&&(K=q._socket.read())!==null)q._receiver.write(K);if(q._receiver.end(),this[TW]=void 0,clearTimeout(q._closeTimer),q._receiver._writableState.finished||q._receiver._writableState.errorEmitted)q.emitClose();else q._receiver.on("error",cM7),q._receiver.on("finish",cM7)}function R98(q){if(!this[TW]._receiver.write(q))this.pause()}function tM7(){let q=this[TW];q._readyState=Z9.CLOSING,q._receiver.end(),this.end()}function eM7(){let q=this[TW];if(this.removeListener("error",eM7),this.on("error",nM7),q)q._readyState=Z9.CLOSING,this.destroy()}});var YX7=m((H_$,zX7)=>{var j_$=h98(),{Duplex:gA5}=U6("stream");function KX7(q){q.emit("close")}function FA5(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function _X7(q){if(this.removeListener("error",_X7),this.destroy(),this.listenerCount("error")===0)this.emit("error",q)}function UA5(q,K){let _=!0,z=new gA5({...K,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return q.on("message",function($,A){let O=!A&&z._readableState.objectMode?$.toString():$;if(!z.push(O))q.pause()}),q.once("error",function($){if(z.destroyed)return;_=!1,z.destroy($)}),q.once("close",function(){if(z.destroyed)return;z.push(null)}),z._destroy=function(Y,$){if(q.readyState===q.CLOSED){$(Y),process.nextTick(KX7,z);return}let A=!1;if(q.once("error",function(w){A=!0,$(w)}),q.once("close",function(){if(!A)$(Y);process.nextTick(KX7,z)}),_)q.terminate()},z._final=function(Y){if(q.readyState===q.CONNECTING){q.once("open",function(){z._final(Y)});return}if(q._socket===null)return;if(q._socket._writableState.finished){if(Y(),z._readableState.endEmitted)z.destroy()}else q._socket.once("finish",function(){Y()}),q.close()},z._read=function(){if(q.isPaused)q.resume()},z._write=function(Y,$,A){if(q.readyState===q.CONNECTING){q.once("open",function(){z._write(Y,$,A)});return}q.send(Y,A)},z.on("end",FA5),z.on("error",_X7),z}zX7.exports=UA5});var AX7=m((J_$,$X7)=>{var{tokenChars:QA5}=AP6();function dA5(q){let K=new Set,_=-1,z=-1,Y=0;for(Y;Y<q.length;Y++){let A=q.charCodeAt(Y);if(z===-1&&QA5[A]===1){if(_===-1)_=Y}else if(Y!==0&&(A===32||A===9)){if(z===-1&&_!==-1)z=Y}else if(A===44){if(_===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(z===-1)z=Y;let O=q.slice(_,z);if(K.has(O))throw SyntaxError(`The "${O}" subprotocol is duplicated`);K.add(O),_=z=-1}else throw SyntaxError(`Unexpected character at index ${Y}`)}if(_===-1||z!==-1)throw SyntaxError("Unexpected end of input");let $=q.slice(_,Y);if(K.has($))throw SyntaxError(`The "${$}" subprotocol is duplicated`);return K.add($),K}$X7.exports={parse:dA5}});var JX7=m((X_$,HX7)=>{var cA5=U6("events"),S98=U6("http"),{Duplex:M_$}=U6("stream"),{createHash:lA5}=U6("crypto"),OX7=Uo8(),X96=AI6(),nA5=AX7(),iA5=h98(),{GUID:rA5,kWebSocket:oA5}=Ic(),aA5=/^[+/0-9A-Za-z]{22}==$/;class jX7 extends cA5{constructor(q,K){super();if(q={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:iA5,...q},q.port==null&&!q.server&&!q.noServer||q.port!=null&&(q.server||q.noServer)||q.server&&q.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(q.port!=null)this._server=S98.createServer((_,z)=>{let Y=S98.STATUS_CODES[426];z.writeHead(426,{"Content-Length":Y.length,"Content-Type":"text/plain"}),z.end(Y)}),this._server.listen(q.port,q.host,q.backlog,K);else if(q.server)this._server=q.server;if(this._server){let _=this.emit.bind(this,"connection");this._removeListeners=sA5(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(z,Y,$)=>{this.handleUpgrade(z,Y,$,_)}})}if(q.perMessageDeflate===!0)q.perMessageDeflate={};if(q.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=q,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(q){if(this._state===2){if(q)this.once("close",()=>{q(Error("The server is not running"))});process.nextTick(HI6,this);return}if(q)this.once("close",q);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(HI6,this);else this._shouldEmitClose=!0;else process.nextTick(HI6,this)}else{let K=this._server;this._removeListeners(),this._removeListeners=this._server=null,K.close(()=>{HI6(this)})}}shouldHandle(q){if(this.options.path){let K=q.url.indexOf("?");if((K!==-1?q.url.slice(0,K):q.url)!==this.options.path)return!1}return!0}handleUpgrade(q,K,_,z){K.on("error",wX7);let Y=q.headers["sec-websocket-key"],$=q.headers.upgrade,A=+q.headers["sec-websocket-version"];if(q.method!=="GET"){P96(this,q,K,405,"Invalid HTTP method");return}if($===void 0||$.toLowerCase()!=="websocket"){P96(this,q,K,400,"Invalid Upgrade header");return}if(Y===void 0||!aA5.test(Y)){P96(this,q,K,400,"Missing or invalid Sec-WebSocket-Key header");return}if(A!==13&&A!==8){P96(this,q,K,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(q)){JI6(K,400);return}let O=q.headers["sec-websocket-protocol"],w=new Set;if(O!==void 0)try{w=nA5.parse(O)}catch(J){P96(this,q,K,400,"Invalid Sec-WebSocket-Protocol header");return}let j=q.headers["sec-websocket-extensions"],H={};if(this.options.perMessageDeflate&&j!==void 0){let J=new X96(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let M=OX7.parse(j);if(M[X96.extensionName])J.accept(M[X96.extensionName]),H[X96.extensionName]=J}catch(M){P96(this,q,K,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let J={origin:q.headers[`${A===8?"sec-websocket-origin":"origin"}`],secure:!!(q.socket.authorized||q.socket.encrypted),req:q};if(this.options.verifyClient.length===2){this.options.verifyClient(J,(M,X,P,W)=>{if(!M)return JI6(K,X||401,P,W);this.completeUpgrade(H,Y,w,q,K,_,z)});return}if(!this.options.verifyClient(J))return JI6(K,401)}this.completeUpgrade(H,Y,w,q,K,_,z)}completeUpgrade(q,K,_,z,Y,$,A){if(!Y.readable||!Y.writable)return Y.destroy();if(Y[oA5])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return JI6(Y,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${lA5("sha1").update(K+rA5).digest("base64")}`],j=new this.options.WebSocket(null,void 0,this.options);if(_.size){let H=this.options.handleProtocols?this.options.handleProtocols(_,z):_.values().next().value;if(H)w.push(`Sec-WebSocket-Protocol: ${H}`),j._protocol=H}if(q[X96.extensionName]){let H=q[X96.extensionName].params,J=OX7.format({[X96.extensionName]:[H]});w.push(`Sec-WebSocket-Extensions: ${J}`),j._extensions=q}if(this.emit("headers",w,z),Y.write(w.concat(`\r
53`).join(`\r
54`)),Y.removeListener("error",wX7),j.setSocket(Y,$,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(j),j.on("close",()=>{if(this.clients.delete(j),this._shouldEmitClose&&!this.clients.size)process.nextTick(HI6,this)});A(j,z)}}HX7.exports=jX7;function sA5(q,K){for(let _ of Object.keys(K))q.on(_,K[_]);return function(){for(let z of Object.keys(K))q.removeListener(z,K[z])}}function HI6(q){q._state=2,q.emit("close")}function wX7(){this.destroy()}function JI6(q,K,_,z){_=_||S98.STATUS_CODES[K],z={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(_),...z},q.once("finish",q.destroy),q.end(`HTTP/1.1 ${K} ${S98.STATUS_CODES[K]}\r
55`+Object.keys(z).map((Y)=>`${Y}: ${z[Y]}`).join(`\r

Callers 1

zI6Function · 0.85

Calls 6

wEFunction · 0.85
f98Function · 0.85
SxFunction · 0.85
pushMethod · 0.45
entriesMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected