@chfischerx/puttry 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -104,6 +104,10 @@ Install PuTTrY globally using npm:
104
104
  npm install -g @chfischerx/puttry
105
105
  ```
106
106
 
107
+ > **Note:** The `-g` flag is required. The install snippet shown on the npmjs.com package
108
+ > page omits it — using `npm i @chfischerx/puttry` without `-g` installs the package
109
+ > locally and the `puttry` command will not be available in your shell.
110
+
107
111
  ### Step 2: Configure (Recommended)
108
112
 
109
113
  Run the interactive configuration wizard to set up PuTTrY for your environment:
@@ -192,4 +192,4 @@ WARNING: This link could potentially be dangerous`)){const c=window.open();if(c)
192
192
  `,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(h||(u.C0=h={})),(function(f){f.PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ"})(d||(u.C1=d={})),(function(f){f.ST=`${h.ESC}\\`})(p||(u.C1_ESCAPED=p={}))},7399:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.evaluateKeyboardEvent=void 0;const d=h(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};u.evaluateKeyboardEvent=function(f,g,y,D){const v={type:0,cancel:!1,key:void 0},o=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?v.key=g?d.C0.ESC+"OA":d.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?v.key=g?d.C0.ESC+"OD":d.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?v.key=g?d.C0.ESC+"OC":d.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(v.key=g?d.C0.ESC+"OB":d.C0.ESC+"[B");break;case 8:v.key=f.ctrlKey?"\b":d.C0.DEL,f.altKey&&(v.key=d.C0.ESC+v.key);break;case 9:if(f.shiftKey){v.key=d.C0.ESC+"[Z";break}v.key=d.C0.HT,v.cancel=!0;break;case 13:v.key=f.altKey?d.C0.ESC+d.C0.CR:d.C0.CR,v.cancel=!0;break;case 27:v.key=d.C0.ESC,f.altKey&&(v.key=d.C0.ESC+d.C0.ESC),v.cancel=!0;break;case 37:if(f.metaKey)break;o?(v.key=d.C0.ESC+"[1;"+(o+1)+"D",v.key===d.C0.ESC+"[1;3D"&&(v.key=d.C0.ESC+(y?"b":"[1;5D"))):v.key=g?d.C0.ESC+"OD":d.C0.ESC+"[D";break;case 39:if(f.metaKey)break;o?(v.key=d.C0.ESC+"[1;"+(o+1)+"C",v.key===d.C0.ESC+"[1;3C"&&(v.key=d.C0.ESC+(y?"f":"[1;5C"))):v.key=g?d.C0.ESC+"OC":d.C0.ESC+"[C";break;case 38:if(f.metaKey)break;o?(v.key=d.C0.ESC+"[1;"+(o+1)+"A",y||v.key!==d.C0.ESC+"[1;3A"||(v.key=d.C0.ESC+"[1;5A")):v.key=g?d.C0.ESC+"OA":d.C0.ESC+"[A";break;case 40:if(f.metaKey)break;o?(v.key=d.C0.ESC+"[1;"+(o+1)+"B",y||v.key!==d.C0.ESC+"[1;3B"||(v.key=d.C0.ESC+"[1;5B")):v.key=g?d.C0.ESC+"OB":d.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(v.key=d.C0.ESC+"[2~");break;case 46:v.key=o?d.C0.ESC+"[3;"+(o+1)+"~":d.C0.ESC+"[3~";break;case 36:v.key=o?d.C0.ESC+"[1;"+(o+1)+"H":g?d.C0.ESC+"OH":d.C0.ESC+"[H";break;case 35:v.key=o?d.C0.ESC+"[1;"+(o+1)+"F":g?d.C0.ESC+"OF":d.C0.ESC+"[F";break;case 33:f.shiftKey?v.type=2:f.ctrlKey?v.key=d.C0.ESC+"[5;"+(o+1)+"~":v.key=d.C0.ESC+"[5~";break;case 34:f.shiftKey?v.type=3:f.ctrlKey?v.key=d.C0.ESC+"[6;"+(o+1)+"~":v.key=d.C0.ESC+"[6~";break;case 112:v.key=o?d.C0.ESC+"[1;"+(o+1)+"P":d.C0.ESC+"OP";break;case 113:v.key=o?d.C0.ESC+"[1;"+(o+1)+"Q":d.C0.ESC+"OQ";break;case 114:v.key=o?d.C0.ESC+"[1;"+(o+1)+"R":d.C0.ESC+"OR";break;case 115:v.key=o?d.C0.ESC+"[1;"+(o+1)+"S":d.C0.ESC+"OS";break;case 116:v.key=o?d.C0.ESC+"[15;"+(o+1)+"~":d.C0.ESC+"[15~";break;case 117:v.key=o?d.C0.ESC+"[17;"+(o+1)+"~":d.C0.ESC+"[17~";break;case 118:v.key=o?d.C0.ESC+"[18;"+(o+1)+"~":d.C0.ESC+"[18~";break;case 119:v.key=o?d.C0.ESC+"[19;"+(o+1)+"~":d.C0.ESC+"[19~";break;case 120:v.key=o?d.C0.ESC+"[20;"+(o+1)+"~":d.C0.ESC+"[20~";break;case 121:v.key=o?d.C0.ESC+"[21;"+(o+1)+"~":d.C0.ESC+"[21~";break;case 122:v.key=o?d.C0.ESC+"[23;"+(o+1)+"~":d.C0.ESC+"[23~";break;case 123:v.key=o?d.C0.ESC+"[24;"+(o+1)+"~":d.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(y&&!D||!f.altKey||f.metaKey)!y||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?v.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(v.key=d.C0.US),f.key==="@"&&(v.key=d.C0.NUL)):f.keyCode===65&&(v.type=1);else{const c=p[f.keyCode],a=c?.[f.shiftKey?1:0];if(a)v.key=d.C0.ESC+a;else if(f.keyCode>=65&&f.keyCode<=90){const l=f.ctrlKey?f.keyCode-64:f.keyCode+32;let _=String.fromCharCode(l);f.shiftKey&&(_=_.toUpperCase()),v.key=d.C0.ESC+_}else if(f.keyCode===32)v.key=d.C0.ESC+(f.ctrlKey?d.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let l=f.code.slice(3,4);f.shiftKey||(l=l.toLowerCase()),v.key=d.C0.ESC+l,v.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?v.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?v.key=d.C0.NUL:f.keyCode>=51&&f.keyCode<=55?v.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?v.key=d.C0.DEL:f.keyCode===219?v.key=d.C0.ESC:f.keyCode===220?v.key=d.C0.FS:f.keyCode===221&&(v.key=d.C0.GS)}return v}},482:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.Utf8ToUtf32=u.StringToUtf32=u.utf32ToString=u.stringFromCodePoint=void 0,u.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},u.utf32ToString=function(h,d=0,p=h.length){let f="";for(let g=d;g<p;++g){let y=h[g];y>65535?(y-=65536,f+=String.fromCharCode(55296+(y>>10))+String.fromCharCode(y%1024+56320)):f+=String.fromCharCode(y)}return f},u.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,d){const p=h.length;if(!p)return 0;let f=0,g=0;if(this._interim){const y=h.charCodeAt(g++);56320<=y&&y<=57343?d[f++]=1024*(this._interim-55296)+y-56320+65536:(d[f++]=this._interim,d[f++]=y),this._interim=0}for(let y=g;y<p;++y){const D=h.charCodeAt(y);if(55296<=D&&D<=56319){if(++y>=p)return this._interim=D,f;const v=h.charCodeAt(y);56320<=v&&v<=57343?d[f++]=1024*(D-55296)+v-56320+65536:(d[f++]=D,d[f++]=v)}else D!==65279&&(d[f++]=D)}return f}},u.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,d){const p=h.length;if(!p)return 0;let f,g,y,D,v=0,o=0,c=0;if(this.interim[0]){let _=!1,C=this.interim[0];C&=(224&C)==192?31:(240&C)==224?15:7;let w,A=0;for(;(w=63&this.interim[++A])&&A<4;)C<<=6,C|=w;const m=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=m-A;for(;c<R;){if(c>=p)return 0;if(w=h[c++],(192&w)!=128){c--,_=!0;break}this.interim[A++]=w,C<<=6,C|=63&w}_||(m===2?C<128?c--:d[v++]=C:m===3?C<2048||C>=55296&&C<=57343||C===65279||(d[v++]=C):C<65536||C>1114111||(d[v++]=C)),this.interim.fill(0)}const a=p-4;let l=c;for(;l<p;){for(;!(!(l<a)||128&(f=h[l])||128&(g=h[l+1])||128&(y=h[l+2])||128&(D=h[l+3]));)d[v++]=f,d[v++]=g,d[v++]=y,d[v++]=D,l+=4;if(f=h[l++],f<128)d[v++]=f;else if((224&f)==192){if(l>=p)return this.interim[0]=f,v;if(g=h[l++],(192&g)!=128){l--;continue}if(o=(31&f)<<6|63&g,o<128){l--;continue}d[v++]=o}else if((240&f)==224){if(l>=p)return this.interim[0]=f,v;if(g=h[l++],(192&g)!=128){l--;continue}if(l>=p)return this.interim[0]=f,this.interim[1]=g,v;if(y=h[l++],(192&y)!=128){l--;continue}if(o=(15&f)<<12|(63&g)<<6|63&y,o<2048||o>=55296&&o<=57343||o===65279)continue;d[v++]=o}else if((248&f)==240){if(l>=p)return this.interim[0]=f,v;if(g=h[l++],(192&g)!=128){l--;continue}if(l>=p)return this.interim[0]=f,this.interim[1]=g,v;if(y=h[l++],(192&y)!=128){l--;continue}if(l>=p)return this.interim[0]=f,this.interim[1]=g,this.interim[2]=y,v;if(D=h[l++],(192&D)!=128){l--;continue}if(o=(7&f)<<18|(63&g)<<12|(63&y)<<6|63&D,o<65536||o>1114111)continue;d[v++]=o}}return v}}},225:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.UnicodeV6=void 0;const d=h(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],f=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let g;u.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let y=0;y<p.length;++y)g.fill(0,p[y][0],p[y][1]+1)}}wcwidth(y){return y<32?0:y<127?1:y<65536?g[y]:(function(D,v){let o,c=0,a=v.length-1;if(D<v[0][0]||D>v[a][1])return!1;for(;a>=c;)if(o=c+a>>1,D>v[o][1])c=o+1;else{if(!(D<v[o][0]))return!0;a=o-1}return!1})(y,f)?0:y>=131072&&y<=196605||y>=196608&&y<=262141?2:1}charProperties(y,D){let v=this.wcwidth(y),o=v===0&&D!==0;if(o){const c=d.UnicodeService.extractWidth(D);c===0?o=!1:c>v&&(v=c)}return d.UnicodeService.createPropertyValue(0,v,o)}}},5981:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.WriteBuffer=void 0;const d=h(8460),p=h(844);class f extends p.Disposable{constructor(y){super(),this._action=y,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new d.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(y,D){if(D!==void 0&&this._syncCalls>D)return void(this._syncCalls=0);if(this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let v;for(this._isSyncWriting=!0;v=this._writeBuffer.shift();){this._action(v);const o=this._callbacks.shift();o&&o()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(y,D){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(D),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(D)}_innerWrite(y=0,D=!0){const v=y||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const o=this._writeBuffer[this._bufferOffset],c=this._action(o,D);if(c){const l=_=>Date.now()-v>=12?setTimeout((()=>this._innerWrite(0,_))):this._innerWrite(v,_);return void c.catch((_=>(queueMicrotask((()=>{throw _})),Promise.resolve(!1)))).then(l)}const a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=o.length,Date.now()-v>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}u.WriteBuffer=f},5941:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.toRgbString=u.parseColor=void 0;const h=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,d=/^[\da-f]+$/;function p(f,g){const y=f.toString(16),D=y.length<2?"0"+y:y;switch(g){case 4:return y[0];case 8:return D;case 12:return(D+D).slice(0,3);default:return D+D}}u.parseColor=function(f){if(!f)return;let g=f.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const y=h.exec(g);if(y){const D=y[1]?15:y[4]?255:y[7]?4095:65535;return[Math.round(parseInt(y[1]||y[4]||y[7]||y[10],16)/D*255),Math.round(parseInt(y[2]||y[5]||y[8]||y[11],16)/D*255),Math.round(parseInt(y[3]||y[6]||y[9]||y[12],16)/D*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),d.exec(g)&&[3,6,9,12].includes(g.length))){const y=g.length/3,D=[0,0,0];for(let v=0;v<3;++v){const o=parseInt(g.slice(y*v,y*v+y),16);D[v]=y===1?o<<4:y===2?o:y===3?o>>4:o>>8}return D}},u.toRgbString=function(f,g=16){const[y,D,v]=f;return`rgb:${p(y,g)}/${p(D,g)}/${p(v,g)}`}},5770:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.PAYLOAD_LIMIT=void 0,u.PAYLOAD_LIMIT=1e7},6351:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.DcsHandler=u.DcsParser=void 0;const d=h(482),p=h(8742),f=h(5770),g=[];u.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(D,v){this._handlers[D]===void 0&&(this._handlers[D]=[]);const o=this._handlers[D];return o.push(v),{dispose:()=>{const c=o.indexOf(v);c!==-1&&o.splice(c,1)}}}clearHandler(D){this._handlers[D]&&delete this._handlers[D]}setHandlerFallback(D){this._handlerFb=D}reset(){if(this._active.length)for(let D=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;D>=0;--D)this._active[D].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(D,v){if(this.reset(),this._ident=D,this._active=this._handlers[D]||g,this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].hook(v);else this._handlerFb(this._ident,"HOOK",v)}put(D,v,o){if(this._active.length)for(let c=this._active.length-1;c>=0;c--)this._active[c].put(D,v,o);else this._handlerFb(this._ident,"PUT",(0,d.utf32ToString)(D,v,o))}unhook(D,v=!0){if(this._active.length){let o=!1,c=this._active.length-1,a=!1;if(this._stack.paused&&(c=this._stack.loopPosition-1,o=v,a=this._stack.fallThrough,this._stack.paused=!1),!a&&o===!1){for(;c>=0&&(o=this._active[c].unhook(D),o!==!0);c--)if(o instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!1,o;c--}for(;c>=0;c--)if(o=this._active[c].unhook(!1),o instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=c,this._stack.fallThrough=!0,o}else this._handlerFb(this._ident,"UNHOOK",D);this._active=g,this._ident=0}};const y=new p.Params;y.addParam(0),u.DcsHandler=class{constructor(D){this._handler=D,this._data="",this._params=y,this._hitLimit=!1}hook(D){this._params=D.length>1||D.params[0]?D.clone():y,this._data="",this._hitLimit=!1}put(D,v,o){this._hitLimit||(this._data+=(0,d.utf32ToString)(D,v,o),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(D){let v=!1;if(this._hitLimit)v=!1;else if(D&&(v=this._handler(this._data,this._params),v instanceof Promise))return v.then((o=>(this._params=y,this._data="",this._hitLimit=!1,o)));return this._params=y,this._data="",this._hitLimit=!1,v}}},2015:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.EscapeSequenceParser=u.VT500_TRANSITION_TABLE=u.TransitionTable=void 0;const d=h(844),p=h(8742),f=h(6242),g=h(6351);class y{constructor(c){this.table=new Uint8Array(c)}setDefault(c,a){this.table.fill(c<<4|a)}add(c,a,l,_){this.table[a<<8|c]=l<<4|_}addMany(c,a,l,_){for(let C=0;C<c.length;C++)this.table[a<<8|c[C]]=l<<4|_}}u.TransitionTable=y;const D=160;u.VT500_TRANSITION_TABLE=(function(){const o=new y(4095),c=Array.apply(null,Array(256)).map(((A,m)=>m)),a=(A,m)=>c.slice(A,m),l=a(32,127),_=a(0,24);_.push(25),_.push.apply(_,a(28,32));const C=a(0,14);let w;for(w in o.setDefault(1,0),o.addMany(l,0,2,0),C)o.addMany([24,26,153,154],w,3,0),o.addMany(a(128,144),w,3,0),o.addMany(a(144,152),w,3,0),o.add(156,w,0,0),o.add(27,w,11,1),o.add(157,w,4,8),o.addMany([152,158,159],w,0,7),o.add(155,w,11,3),o.add(144,w,11,9);return o.addMany(_,0,3,0),o.addMany(_,1,3,1),o.add(127,1,0,1),o.addMany(_,8,0,8),o.addMany(_,3,3,3),o.add(127,3,0,3),o.addMany(_,4,3,4),o.add(127,4,0,4),o.addMany(_,6,3,6),o.addMany(_,5,3,5),o.add(127,5,0,5),o.addMany(_,2,3,2),o.add(127,2,0,2),o.add(93,1,4,8),o.addMany(l,8,5,8),o.add(127,8,5,8),o.addMany([156,27,24,26,7],8,6,0),o.addMany(a(28,32),8,0,8),o.addMany([88,94,95],1,0,7),o.addMany(l,7,0,7),o.addMany(_,7,0,7),o.add(156,7,0,0),o.add(127,7,0,7),o.add(91,1,11,3),o.addMany(a(64,127),3,7,0),o.addMany(a(48,60),3,8,4),o.addMany([60,61,62,63],3,9,4),o.addMany(a(48,60),4,8,4),o.addMany(a(64,127),4,7,0),o.addMany([60,61,62,63],4,0,6),o.addMany(a(32,64),6,0,6),o.add(127,6,0,6),o.addMany(a(64,127),6,0,0),o.addMany(a(32,48),3,9,5),o.addMany(a(32,48),5,9,5),o.addMany(a(48,64),5,0,6),o.addMany(a(64,127),5,7,0),o.addMany(a(32,48),4,9,5),o.addMany(a(32,48),1,9,2),o.addMany(a(32,48),2,9,2),o.addMany(a(48,127),2,10,0),o.addMany(a(48,80),1,10,0),o.addMany(a(81,88),1,10,0),o.addMany([89,90,92],1,10,0),o.addMany(a(96,127),1,10,0),o.add(80,1,11,9),o.addMany(_,9,0,9),o.add(127,9,0,9),o.addMany(a(28,32),9,0,9),o.addMany(a(32,48),9,9,12),o.addMany(a(48,60),9,8,10),o.addMany([60,61,62,63],9,9,10),o.addMany(_,11,0,11),o.addMany(a(32,128),11,0,11),o.addMany(a(28,32),11,0,11),o.addMany(_,10,0,10),o.add(127,10,0,10),o.addMany(a(28,32),10,0,10),o.addMany(a(48,60),10,8,10),o.addMany([60,61,62,63],10,0,11),o.addMany(a(32,48),10,9,12),o.addMany(_,12,0,12),o.add(127,12,0,12),o.addMany(a(28,32),12,0,12),o.addMany(a(32,48),12,9,12),o.addMany(a(48,64),12,0,11),o.addMany(a(64,127),12,12,13),o.addMany(a(64,127),10,12,13),o.addMany(a(64,127),9,12,13),o.addMany(_,13,13,13),o.addMany(l,13,13,13),o.add(127,13,0,13),o.addMany([27,156,24,26],13,14,0),o.add(D,0,2,0),o.add(D,8,5,8),o.add(D,6,0,6),o.add(D,11,0,11),o.add(D,13,13,13),o})();class v extends d.Disposable{constructor(c=u.VT500_TRANSITION_TABLE){super(),this._transitions=c,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(a,l,_)=>{},this._executeHandlerFb=a=>{},this._csiHandlerFb=(a,l)=>{},this._escHandlerFb=a=>{},this._errorHandlerFb=a=>a,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,d.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(c,a=[64,126]){let l=0;if(c.prefix){if(c.prefix.length>1)throw new Error("only one byte as prefix supported");if(l=c.prefix.charCodeAt(0),l&&60>l||l>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(c.intermediates){if(c.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let C=0;C<c.intermediates.length;++C){const w=c.intermediates.charCodeAt(C);if(32>w||w>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");l<<=8,l|=w}}if(c.final.length!==1)throw new Error("final must be a single byte");const _=c.final.charCodeAt(0);if(a[0]>_||_>a[1])throw new Error(`final must be in range ${a[0]} .. ${a[1]}`);return l<<=8,l|=_,l}identToString(c){const a=[];for(;c;)a.push(String.fromCharCode(255&c)),c>>=8;return a.reverse().join("")}setPrintHandler(c){this._printHandler=c}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(c,a){const l=this._identifier(c,[48,126]);this._escHandlers[l]===void 0&&(this._escHandlers[l]=[]);const _=this._escHandlers[l];return _.push(a),{dispose:()=>{const C=_.indexOf(a);C!==-1&&_.splice(C,1)}}}clearEscHandler(c){this._escHandlers[this._identifier(c,[48,126])]&&delete this._escHandlers[this._identifier(c,[48,126])]}setEscHandlerFallback(c){this._escHandlerFb=c}setExecuteHandler(c,a){this._executeHandlers[c.charCodeAt(0)]=a}clearExecuteHandler(c){this._executeHandlers[c.charCodeAt(0)]&&delete this._executeHandlers[c.charCodeAt(0)]}setExecuteHandlerFallback(c){this._executeHandlerFb=c}registerCsiHandler(c,a){const l=this._identifier(c);this._csiHandlers[l]===void 0&&(this._csiHandlers[l]=[]);const _=this._csiHandlers[l];return _.push(a),{dispose:()=>{const C=_.indexOf(a);C!==-1&&_.splice(C,1)}}}clearCsiHandler(c){this._csiHandlers[this._identifier(c)]&&delete this._csiHandlers[this._identifier(c)]}setCsiHandlerFallback(c){this._csiHandlerFb=c}registerDcsHandler(c,a){return this._dcsParser.registerHandler(this._identifier(c),a)}clearDcsHandler(c){this._dcsParser.clearHandler(this._identifier(c))}setDcsHandlerFallback(c){this._dcsParser.setHandlerFallback(c)}registerOscHandler(c,a){return this._oscParser.registerHandler(c,a)}clearOscHandler(c){this._oscParser.clearHandler(c)}setOscHandlerFallback(c){this._oscParser.setHandlerFallback(c)}setErrorHandler(c){this._errorHandler=c}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(c,a,l,_,C){this._parseStack.state=c,this._parseStack.handlers=a,this._parseStack.handlerPos=l,this._parseStack.transition=_,this._parseStack.chunkPos=C}parse(c,a,l){let _,C=0,w=0,A=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,A=this._parseStack.chunkPos+1;else{if(l===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const m=this._parseStack.handlers;let R=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(l===!1&&R>-1){for(;R>=0&&(_=m[R](this._params),_!==!0);R--)if(_ instanceof Promise)return this._parseStack.handlerPos=R,_}this._parseStack.handlers=[];break;case 4:if(l===!1&&R>-1){for(;R>=0&&(_=m[R](),_!==!0);R--)if(_ instanceof Promise)return this._parseStack.handlerPos=R,_}this._parseStack.handlers=[];break;case 6:if(C=c[this._parseStack.chunkPos],_=this._dcsParser.unhook(C!==24&&C!==26,l),_)return _;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(C=c[this._parseStack.chunkPos],_=this._oscParser.end(C!==24&&C!==26,l),_)return _;C===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,A=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let m=A;m<a;++m){switch(C=c[m],w=this._transitions.table[this.currentState<<8|(C<160?C:D)],w>>4){case 2:for(let j=m+1;;++j){if(j>=a||(C=c[j])<32||C>126&&C<D){this._printHandler(c,m,j),m=j-1;break}if(++j>=a||(C=c[j])<32||C>126&&C<D){this._printHandler(c,m,j),m=j-1;break}if(++j>=a||(C=c[j])<32||C>126&&C<D){this._printHandler(c,m,j),m=j-1;break}if(++j>=a||(C=c[j])<32||C>126&&C<D){this._printHandler(c,m,j),m=j-1;break}}break;case 3:this._executeHandlers[C]?this._executeHandlers[C]():this._executeHandlerFb(C),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:m,code:C,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const R=this._csiHandlers[this._collect<<8|C];let G=R?R.length-1:-1;for(;G>=0&&(_=R[G](this._params),_!==!0);G--)if(_ instanceof Promise)return this._preserveStack(3,R,G,w,m),_;G<0&&this._csiHandlerFb(this._collect<<8|C,this._params),this.precedingJoinState=0;break;case 8:do switch(C){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(C-48)}while(++m<a&&(C=c[m])>47&&C<60);m--;break;case 9:this._collect<<=8,this._collect|=C;break;case 10:const q=this._escHandlers[this._collect<<8|C];let Y=q?q.length-1:-1;for(;Y>=0&&(_=q[Y](),_!==!0);Y--)if(_ instanceof Promise)return this._preserveStack(4,q,Y,w,m),_;Y<0&&this._escHandlerFb(this._collect<<8|C),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|C,this._params);break;case 13:for(let j=m+1;;++j)if(j>=a||(C=c[j])===24||C===26||C===27||C>127&&C<D){this._dcsParser.put(c,m,j),m=j-1;break}break;case 14:if(_=this._dcsParser.unhook(C!==24&&C!==26),_)return this._preserveStack(6,[],0,w,m),_;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let j=m+1;;j++)if(j>=a||(C=c[j])<32||C>127&&C<D){this._oscParser.put(c,m,j),m=j-1;break}break;case 6:if(_=this._oscParser.end(C!==24&&C!==26),_)return this._preserveStack(5,[],0,w,m),_;C===27&&(w|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&w}}}u.EscapeSequenceParser=v},6242:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.OscHandler=u.OscParser=void 0;const d=h(5770),p=h(482),f=[];u.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,y){this._handlers[g]===void 0&&(this._handlers[g]=[]);const D=this._handlers[g];return D.push(y),{dispose:()=>{const v=D.indexOf(y);v!==-1&&D.splice(v,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,y,D){if(this._active.length)for(let v=this._active.length-1;v>=0;v--)this._active[v].put(g,y,D);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,y,D))}start(){this.reset(),this._state=1}put(g,y,D){if(this._state!==3){if(this._state===1)for(;y<D;){const v=g[y++];if(v===59){this._state=2,this._start();break}if(v<48||57<v)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+v-48}this._state===2&&D-y>0&&this._put(g,y,D)}}end(g,y=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let D=!1,v=this._active.length-1,o=!1;if(this._stack.paused&&(v=this._stack.loopPosition-1,D=y,o=this._stack.fallThrough,this._stack.paused=!1),!o&&D===!1){for(;v>=0&&(D=this._active[v].end(g),D!==!0);v--)if(D instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!1,D;v--}for(;v>=0;v--)if(D=this._active[v].end(!1),D instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=v,this._stack.fallThrough=!0,D}else this._handlerFb(this._id,"END",g);this._active=f,this._id=-1,this._state=0}}},u.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,y,D){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,y,D),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let y=!1;if(this._hitLimit)y=!1;else if(g&&(y=this._handler(this._data),y instanceof Promise))return y.then((D=>(this._data="",this._hitLimit=!1,D)));return this._data="",this._hitLimit=!1,y}}},8742:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.Params=void 0;const h=2147483647;class d{static fromArray(f){const g=new d;if(!f.length)return g;for(let y=Array.isArray(f[0])?1:0;y<f.length;++y){const D=f[y];if(Array.isArray(D))for(let v=0;v<D.length;++v)g.addSubParam(D[v]);else g.addParam(D)}return g}constructor(f=32,g=32){if(this.maxLength=f,this.maxSubParamsLength=g,g>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new d(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let g=0;g<this.length;++g){f.push(this.params[g]);const y=this._subParamsIdx[g]>>8,D=255&this._subParamsIdx[g];D-y>0&&f.push(Array.prototype.slice.call(this._subParams,y,D))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>h?h:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>h?h:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const g=this._subParamsIdx[f]>>8,y=255&this._subParamsIdx[f];return y-g>0?this._subParams.subarray(g,y):null}getSubParamsAll(){const f={};for(let g=0;g<this.length;++g){const y=this._subParamsIdx[g]>>8,D=255&this._subParamsIdx[g];D-y>0&&(f[g]=this._subParams.slice(y,D))}return f}addDigit(f){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const y=this._digitIsSub?this._subParams:this.params,D=y[g-1];y[g-1]=~D?Math.min(10*D+f,h):f}}u.Params=d},5741:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.AddonManager=void 0,u.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,d){const p={instance:d,dispose:d.dispose,isDisposed:!1};this._addons.push(p),d.dispose=()=>this._wrappedAddonDispose(p),d.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let d=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===h){d=p;break}if(d===-1)throw new Error("Could not dispose an addon that has not been loaded");h.isDisposed=!0,h.dispose.apply(h.instance),this._addons.splice(d,1)}}},8771:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.BufferApiView=void 0;const d=h(3785),p=h(511);u.BufferApiView=class{constructor(f,g){this._buffer=f,this.type=g}init(f){return this._buffer=f,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(f){const g=this._buffer.lines.get(f);if(g)return new d.BufferLineApiView(g)}getNullCell(){return new p.CellData}}},3785:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.BufferLineApiView=void 0;const d=h(511);u.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,f){if(!(p<0||p>=this._line.length))return f?(this._line.loadCell(p,f),f):this._line.loadCell(p,new d.CellData)}translateToString(p,f,g){return this._line.translateToString(p,f,g)}}},8285:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.BufferNamespaceApi=void 0;const d=h(8771),p=h(8460),f=h(844);class g extends f.Disposable{constructor(D){super(),this._core=D,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new d.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new d.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}u.BufferNamespaceApi=g},7975:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.ParserApi=void 0,u.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,d){return this._core.registerCsiHandler(h,(p=>d(p.toArray())))}addCsiHandler(h,d){return this.registerCsiHandler(h,d)}registerDcsHandler(h,d){return this._core.registerDcsHandler(h,((p,f)=>d(p,f.toArray())))}addDcsHandler(h,d){return this.registerDcsHandler(h,d)}registerEscHandler(h,d){return this._core.registerEscHandler(h,d)}addEscHandler(h,d){return this.registerEscHandler(h,d)}registerOscHandler(h,d){return this._core.registerOscHandler(h,d)}addOscHandler(h,d){return this.registerOscHandler(h,d)}}},7090:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.UnicodeApi=void 0,u.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(H,u,h){var d=this&&this.__decorate||function(o,c,a,l){var _,C=arguments.length,w=C<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,a):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(o,c,a,l);else for(var A=o.length-1;A>=0;A--)(_=o[A])&&(w=(C<3?_(w):C>3?_(c,a,w):_(c,a))||w);return C>3&&w&&Object.defineProperty(c,a,w),w},p=this&&this.__param||function(o,c){return function(a,l){c(a,l,o)}};Object.defineProperty(u,"__esModule",{value:!0}),u.BufferService=u.MINIMUM_ROWS=u.MINIMUM_COLS=void 0;const f=h(8460),g=h(844),y=h(5295),D=h(2585);u.MINIMUM_COLS=2,u.MINIMUM_ROWS=1;let v=u.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(o){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(o.rawOptions.cols||0,u.MINIMUM_COLS),this.rows=Math.max(o.rawOptions.rows||0,u.MINIMUM_ROWS),this.buffers=this.register(new y.BufferSet(o,this))}resize(o,c){this.cols=o,this.rows=c,this.buffers.resize(o,c),this._onResize.fire({cols:o,rows:c})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(o,c=!1){const a=this.buffer;let l;l=this._cachedBlankLine,l&&l.length===this.cols&&l.getFg(0)===o.fg&&l.getBg(0)===o.bg||(l=a.getBlankLine(o,c),this._cachedBlankLine=l),l.isWrapped=c;const _=a.ybase+a.scrollTop,C=a.ybase+a.scrollBottom;if(a.scrollTop===0){const w=a.lines.isFull;C===a.lines.length-1?w?a.lines.recycle().copyFrom(l):a.lines.push(l.clone()):a.lines.splice(C+1,0,l.clone()),w?this.isUserScrolling&&(a.ydisp=Math.max(a.ydisp-1,0)):(a.ybase++,this.isUserScrolling||a.ydisp++)}else{const w=C-_+1;a.lines.shiftElements(_+1,w-1,-1),a.lines.set(C,l.clone())}this.isUserScrolling||(a.ydisp=a.ybase),this._onScroll.fire(a.ydisp)}scrollLines(o,c,a){const l=this.buffer;if(o<0){if(l.ydisp===0)return;this.isUserScrolling=!0}else o+l.ydisp>=l.ybase&&(this.isUserScrolling=!1);const _=l.ydisp;l.ydisp=Math.max(Math.min(l.ydisp+o,l.ybase),0),_!==l.ydisp&&(c||this._onScroll.fire(l.ydisp))}};u.BufferService=v=d([p(0,D.IOptionsService)],v)},7994:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.CharsetService=void 0,u.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,d){this._charsets[h]=d,this.glevel===h&&(this.charset=d)}}},1753:function(H,u,h){var d=this&&this.__decorate||function(l,_,C,w){var A,m=arguments.length,R=m<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(l,_,C,w);else for(var G=l.length-1;G>=0;G--)(A=l[G])&&(R=(m<3?A(R):m>3?A(_,C,R):A(_,C))||R);return m>3&&R&&Object.defineProperty(_,C,R),R},p=this&&this.__param||function(l,_){return function(C,w){_(C,w,l)}};Object.defineProperty(u,"__esModule",{value:!0}),u.CoreMouseService=void 0;const f=h(2585),g=h(8460),y=h(844),D={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:l=>l.button!==4&&l.action===1&&(l.ctrl=!1,l.alt=!1,l.shift=!1,!0)},VT200:{events:19,restrict:l=>l.action!==32},DRAG:{events:23,restrict:l=>l.action!==32||l.button!==3},ANY:{events:31,restrict:l=>!0}};function v(l,_){let C=(l.ctrl?16:0)|(l.shift?4:0)|(l.alt?8:0);return l.button===4?(C|=64,C|=l.action):(C|=3&l.button,4&l.button&&(C|=64),8&l.button&&(C|=128),l.action===32?C|=32:l.action!==0||_||(C|=3)),C}const o=String.fromCharCode,c={DEFAULT:l=>{const _=[v(l,!1)+32,l.col+32,l.row+32];return _[0]>255||_[1]>255||_[2]>255?"":`\x1B[M${o(_[0])}${o(_[1])}${o(_[2])}`},SGR:l=>{const _=l.action===0&&l.button!==4?"m":"M";return`\x1B[<${v(l,!0)};${l.col};${l.row}${_}`},SGR_PIXELS:l=>{const _=l.action===0&&l.button!==4?"m":"M";return`\x1B[<${v(l,!0)};${l.x};${l.y}${_}`}};let a=u.CoreMouseService=class extends y.Disposable{constructor(l,_){super(),this._bufferService=l,this._coreService=_,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const C of Object.keys(D))this.addProtocol(C,D[C]);for(const C of Object.keys(c))this.addEncoding(C,c[C]);this.reset()}addProtocol(l,_){this._protocols[l]=_}addEncoding(l,_){this._encodings[l]=_}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(l){if(!this._protocols[l])throw new Error(`unknown protocol "${l}"`);this._activeProtocol=l,this._onProtocolChange.fire(this._protocols[l].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(l){if(!this._encodings[l])throw new Error(`unknown encoding "${l}"`);this._activeEncoding=l}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(l){if(l.col<0||l.col>=this._bufferService.cols||l.row<0||l.row>=this._bufferService.rows||l.button===4&&l.action===32||l.button===3&&l.action!==32||l.button!==4&&(l.action===2||l.action===3)||(l.col++,l.row++,l.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,l,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(l))return!1;const _=this._encodings[this._activeEncoding](l);return _&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(_):this._coreService.triggerDataEvent(_,!0)),this._lastEvent=l,!0}explainEvents(l){return{down:!!(1&l),up:!!(2&l),drag:!!(4&l),move:!!(8&l),wheel:!!(16&l)}}_equalEvents(l,_,C){if(C){if(l.x!==_.x||l.y!==_.y)return!1}else if(l.col!==_.col||l.row!==_.row)return!1;return l.button===_.button&&l.action===_.action&&l.ctrl===_.ctrl&&l.alt===_.alt&&l.shift===_.shift}};u.CoreMouseService=a=d([p(0,f.IBufferService),p(1,f.ICoreService)],a)},6975:function(H,u,h){var d=this&&this.__decorate||function(a,l,_,C){var w,A=arguments.length,m=A<3?l:C===null?C=Object.getOwnPropertyDescriptor(l,_):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(a,l,_,C);else for(var R=a.length-1;R>=0;R--)(w=a[R])&&(m=(A<3?w(m):A>3?w(l,_,m):w(l,_))||m);return A>3&&m&&Object.defineProperty(l,_,m),m},p=this&&this.__param||function(a,l){return function(_,C){l(_,C,a)}};Object.defineProperty(u,"__esModule",{value:!0}),u.CoreService=void 0;const f=h(1439),g=h(8460),y=h(844),D=h(2585),v=Object.freeze({insertMode:!1}),o=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let c=u.CoreService=class extends y.Disposable{constructor(a,l,_){super(),this._bufferService=a,this._logService=l,this._optionsService=_,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(v),this.decPrivateModes=(0,f.clone)(o)}reset(){this.modes=(0,f.clone)(v),this.decPrivateModes=(0,f.clone)(o)}triggerDataEvent(a,l=!1){if(this._optionsService.rawOptions.disableStdin)return;const _=this._bufferService.buffer;l&&this._optionsService.rawOptions.scrollOnUserInput&&_.ybase!==_.ydisp&&this._onRequestScrollToBottom.fire(),l&&this._onUserInput.fire(),this._logService.debug(`sending data "${a}"`,(()=>a.split("").map((C=>C.charCodeAt(0))))),this._onData.fire(a)}triggerBinaryEvent(a){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${a}"`,(()=>a.split("").map((l=>l.charCodeAt(0))))),this._onBinary.fire(a))}};u.CoreService=c=d([p(0,D.IBufferService),p(1,D.ILogService),p(2,D.IOptionsService)],c)},9074:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.DecorationService=void 0;const d=h(8055),p=h(8460),f=h(844),g=h(6106);let y=0,D=0;class v extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((a=>a?.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(a){if(a.marker.isDisposed)return;const l=new o(a);if(l){const _=l.marker.onDispose((()=>l.dispose()));l.onDispose((()=>{l&&(this._decorations.delete(l)&&this._onDecorationRemoved.fire(l),_.dispose())})),this._decorations.insert(l),this._onDecorationRegistered.fire(l)}return l}reset(){for(const a of this._decorations.values())a.dispose();this._decorations.clear()}*getDecorationsAtCell(a,l,_){let C=0,w=0;for(const A of this._decorations.getKeyIterator(l))C=A.options.x??0,w=C+(A.options.width??1),a>=C&&a<w&&(!_||(A.options.layer??"bottom")===_)&&(yield A)}forEachDecorationAtCell(a,l,_,C){this._decorations.forEachByKey(l,(w=>{y=w.options.x??0,D=y+(w.options.width??1),a>=y&&a<D&&(!_||(w.options.layer??"bottom")===_)&&C(w)}))}}u.DecorationService=v;class o extends f.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=d.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=d.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(a){super(),this.options=a,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=a.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.InstantiationService=u.ServiceCollection=void 0;const d=h(2585),p=h(8343);class f{constructor(...y){this._entries=new Map;for(const[D,v]of y)this.set(D,v)}set(y,D){const v=this._entries.get(y);return this._entries.set(y,D),v}forEach(y){for(const[D,v]of this._entries.entries())y(D,v)}has(y){return this._entries.has(y)}get(y){return this._entries.get(y)}}u.ServiceCollection=f,u.InstantiationService=class{constructor(){this._services=new f,this._services.set(d.IInstantiationService,this)}setService(g,y){this._services.set(g,y)}getService(g){return this._services.get(g)}createInstance(g,...y){const D=(0,p.getServiceDependencies)(g).sort(((c,a)=>c.index-a.index)),v=[];for(const c of D){const a=this._services.get(c.id);if(!a)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${c.id}.`);v.push(a)}const o=D.length>0?D[0].index:y.length;if(y.length!==o)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${o+1} conflicts with ${y.length} static arguments`);return new g(...y,...v)}}},7866:function(H,u,h){var d=this&&this.__decorate||function(o,c,a,l){var _,C=arguments.length,w=C<3?c:l===null?l=Object.getOwnPropertyDescriptor(c,a):l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(o,c,a,l);else for(var A=o.length-1;A>=0;A--)(_=o[A])&&(w=(C<3?_(w):C>3?_(c,a,w):_(c,a))||w);return C>3&&w&&Object.defineProperty(c,a,w),w},p=this&&this.__param||function(o,c){return function(a,l){c(a,l,o)}};Object.defineProperty(u,"__esModule",{value:!0}),u.traceCall=u.setTraceLogger=u.LogService=void 0;const f=h(844),g=h(2585),y={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let D,v=u.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(o){super(),this._optionsService=o,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),D=this}_updateLogLevel(){this._logLevel=y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(o){for(let c=0;c<o.length;c++)typeof o[c]=="function"&&(o[c]=o[c]())}_log(o,c,a){this._evalLazyOptionalParams(a),o.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+c,...a)}trace(o,...c){this._logLevel<=g.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,o,c)}debug(o,...c){this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,o,c)}info(o,...c){this._logLevel<=g.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,o,c)}warn(o,...c){this._logLevel<=g.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,o,c)}error(o,...c){this._logLevel<=g.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,o,c)}};u.LogService=v=d([p(0,g.IOptionsService)],v),u.setTraceLogger=function(o){D=o},u.traceCall=function(o,c,a){if(typeof a.value!="function")throw new Error("not supported");const l=a.value;a.value=function(..._){if(D.logLevel!==g.LogLevelEnum.TRACE)return l.apply(this,_);D.trace(`GlyphRenderer#${l.name}(${_.map((w=>JSON.stringify(w))).join(", ")})`);const C=l.apply(this,_);return D.trace(`GlyphRenderer#${l.name} return`,C),C}}},7302:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.OptionsService=u.DEFAULT_OPTIONS=void 0;const d=h(8460),p=h(844),f=h(6114);u.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class y extends p.Disposable{constructor(v){super(),this._onOptionChange=this.register(new d.EventEmitter),this.onOptionChange=this._onOptionChange.event;const o={...u.DEFAULT_OPTIONS};for(const c in v)if(c in o)try{const a=v[c];o[c]=this._sanitizeAndValidateOption(c,a)}catch(a){console.error(a)}this.rawOptions=o,this.options={...o},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(v,o){return this.onOptionChange((c=>{c===v&&o(this.rawOptions[v])}))}onMultipleOptionChange(v,o){return this.onOptionChange((c=>{v.indexOf(c)!==-1&&o()}))}_setupOptions(){const v=c=>{if(!(c in u.DEFAULT_OPTIONS))throw new Error(`No option with key "${c}"`);return this.rawOptions[c]},o=(c,a)=>{if(!(c in u.DEFAULT_OPTIONS))throw new Error(`No option with key "${c}"`);a=this._sanitizeAndValidateOption(c,a),this.rawOptions[c]!==a&&(this.rawOptions[c]=a,this._onOptionChange.fire(c))};for(const c in this.rawOptions){const a={get:v.bind(this,c),set:o.bind(this,c)};Object.defineProperty(this.options,c,a)}}_sanitizeAndValidateOption(v,o){switch(v){case"cursorStyle":if(o||(o=u.DEFAULT_OPTIONS[v]),!(function(c){return c==="block"||c==="underline"||c==="bar"})(o))throw new Error(`"${o}" is not a valid value for ${v}`);break;case"wordSeparator":o||(o=u.DEFAULT_OPTIONS[v]);break;case"fontWeight":case"fontWeightBold":if(typeof o=="number"&&1<=o&&o<=1e3)break;o=g.includes(o)?o:u.DEFAULT_OPTIONS[v];break;case"cursorWidth":o=Math.floor(o);case"lineHeight":case"tabStopWidth":if(o<1)throw new Error(`${v} cannot be less than 1, value: ${o}`);break;case"minimumContrastRatio":o=Math.max(1,Math.min(21,Math.round(10*o)/10));break;case"scrollback":if((o=Math.min(o,4294967295))<0)throw new Error(`${v} cannot be less than 0, value: ${o}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(o<=0)throw new Error(`${v} cannot be less than or equal to 0, value: ${o}`);break;case"rows":case"cols":if(!o&&o!==0)throw new Error(`${v} must be numeric, value: ${o}`);break;case"windowsPty":o=o??{}}return o}}u.OptionsService=y},2660:function(H,u,h){var d=this&&this.__decorate||function(y,D,v,o){var c,a=arguments.length,l=a<3?D:o===null?o=Object.getOwnPropertyDescriptor(D,v):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(y,D,v,o);else for(var _=y.length-1;_>=0;_--)(c=y[_])&&(l=(a<3?c(l):a>3?c(D,v,l):c(D,v))||l);return a>3&&l&&Object.defineProperty(D,v,l),l},p=this&&this.__param||function(y,D){return function(v,o){D(v,o,y)}};Object.defineProperty(u,"__esModule",{value:!0}),u.OscLinkService=void 0;const f=h(2585);let g=u.OscLinkService=class{constructor(y){this._bufferService=y,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(y){const D=this._bufferService.buffer;if(y.id===void 0){const _=D.addMarker(D.ybase+D.y),C={data:y,id:this._nextId++,lines:[_]};return _.onDispose((()=>this._removeMarkerFromLink(C,_))),this._dataByLinkId.set(C.id,C),C.id}const v=y,o=this._getEntryIdKey(v),c=this._entriesWithId.get(o);if(c)return this.addLineToLink(c.id,D.ybase+D.y),c.id;const a=D.addMarker(D.ybase+D.y),l={id:this._nextId++,key:this._getEntryIdKey(v),data:v,lines:[a]};return a.onDispose((()=>this._removeMarkerFromLink(l,a))),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(y,D){const v=this._dataByLinkId.get(y);if(v&&v.lines.every((o=>o.line!==D))){const o=this._bufferService.buffer.addMarker(D);v.lines.push(o),o.onDispose((()=>this._removeMarkerFromLink(v,o)))}}getLinkData(y){return this._dataByLinkId.get(y)?.data}_getEntryIdKey(y){return`${y.id};;${y.uri}`}_removeMarkerFromLink(y,D){const v=y.lines.indexOf(D);v!==-1&&(y.lines.splice(v,1),y.lines.length===0&&(y.data.id!==void 0&&this._entriesWithId.delete(y.key),this._dataByLinkId.delete(y.id)))}};u.OscLinkService=g=d([p(0,f.IBufferService)],g)},8343:(H,u)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.createDecorator=u.getServiceDependencies=u.serviceRegistry=void 0;const h="di$target",d="di$dependencies";u.serviceRegistry=new Map,u.getServiceDependencies=function(p){return p[d]||[]},u.createDecorator=function(p){if(u.serviceRegistry.has(p))return u.serviceRegistry.get(p);const f=function(g,y,D){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(v,o,c){o[h]===o?o[d].push({id:v,index:c}):(o[d]=[{id:v,index:c}],o[h]=o)})(f,g,D)};return f.toString=()=>p,u.serviceRegistry.set(p,f),f}},2585:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.IDecorationService=u.IUnicodeService=u.IOscLinkService=u.IOptionsService=u.ILogService=u.LogLevelEnum=u.IInstantiationService=u.ICharsetService=u.ICoreService=u.ICoreMouseService=u.IBufferService=void 0;const d=h(8343);var p;u.IBufferService=(0,d.createDecorator)("BufferService"),u.ICoreMouseService=(0,d.createDecorator)("CoreMouseService"),u.ICoreService=(0,d.createDecorator)("CoreService"),u.ICharsetService=(0,d.createDecorator)("CharsetService"),u.IInstantiationService=(0,d.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(p||(u.LogLevelEnum=p={})),u.ILogService=(0,d.createDecorator)("LogService"),u.IOptionsService=(0,d.createDecorator)("OptionsService"),u.IOscLinkService=(0,d.createDecorator)("OscLinkService"),u.IUnicodeService=(0,d.createDecorator)("UnicodeService"),u.IDecorationService=(0,d.createDecorator)("DecorationService")},1480:(H,u,h)=>{Object.defineProperty(u,"__esModule",{value:!0}),u.UnicodeService=void 0;const d=h(8460),p=h(225);class f{static extractShouldJoin(y){return(1&y)!=0}static extractWidth(y){return y>>1&3}static extractCharKind(y){return y>>3}static createPropertyValue(y,D,v=!1){return(16777215&y)<<3|(3&D)<<1|(v?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new d.EventEmitter,this.onChange=this._onChange.event;const y=new p.UnicodeV6;this.register(y),this._active=y.version,this._activeProvider=y}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(y){if(!this._providers[y])throw new Error(`unknown Unicode version "${y}"`);this._active=y,this._activeProvider=this._providers[y],this._onChange.fire(y)}register(y){this._providers[y.version]=y}wcwidth(y){return this._activeProvider.wcwidth(y)}getStringCellWidth(y){let D=0,v=0;const o=y.length;for(let c=0;c<o;++c){let a=y.charCodeAt(c);if(55296<=a&&a<=56319){if(++c>=o)return D+this.wcwidth(a);const C=y.charCodeAt(c);56320<=C&&C<=57343?a=1024*(a-55296)+C-56320+65536:D+=this.wcwidth(C)}const l=this.charProperties(a,v);let _=f.extractWidth(l);f.extractShouldJoin(l)&&(_-=f.extractWidth(v)),D+=_,v=l}return D}charProperties(y,D){return this._activeProvider.charProperties(y,D)}}u.UnicodeService=f}},k={};function U(H){var u=k[H];if(u!==void 0)return u.exports;var h=k[H]={exports:{}};return z[H].call(h.exports,h,h.exports,U),h.exports}var K={};return(()=>{var H=K;Object.defineProperty(H,"__esModule",{value:!0}),H.Terminal=void 0;const u=U(9042),h=U(3236),d=U(844),p=U(5741),f=U(8285),g=U(7975),y=U(7090),D=["cols","rows"];class v extends d.Disposable{constructor(c){super(),this._core=this.register(new h.Terminal(c)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const a=_=>this._core.options[_],l=(_,C)=>{this._checkReadonlyOptions(_),this._core.options[_]=C};for(const _ in this._core.options){const C={get:a.bind(this,_),set:l.bind(this,_)};Object.defineProperty(this._publicOptions,_,C)}}_checkReadonlyOptions(c){if(D.includes(c))throw new Error(`Option "${c}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new y.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const c=this._core.coreService.decPrivateModes;let a="none";switch(this._core.coreMouseService.activeProtocol){case"X10":a="x10";break;case"VT200":a="vt200";break;case"DRAG":a="drag";break;case"ANY":a="any"}return{applicationCursorKeysMode:c.applicationCursorKeys,applicationKeypadMode:c.applicationKeypad,bracketedPasteMode:c.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:a,originMode:c.origin,reverseWraparoundMode:c.reverseWraparound,sendFocusMode:c.sendFocus,wraparoundMode:c.wraparound}}get options(){return this._publicOptions}set options(c){for(const a in c)this._publicOptions[a]=c[a]}blur(){this._core.blur()}focus(){this._core.focus()}input(c,a=!0){this._core.input(c,a)}resize(c,a){this._verifyIntegers(c,a),this._core.resize(c,a)}open(c){this._core.open(c)}attachCustomKeyEventHandler(c){this._core.attachCustomKeyEventHandler(c)}attachCustomWheelEventHandler(c){this._core.attachCustomWheelEventHandler(c)}registerLinkProvider(c){return this._core.registerLinkProvider(c)}registerCharacterJoiner(c){return this._checkProposedApi(),this._core.registerCharacterJoiner(c)}deregisterCharacterJoiner(c){this._checkProposedApi(),this._core.deregisterCharacterJoiner(c)}registerMarker(c=0){return this._verifyIntegers(c),this._core.registerMarker(c)}registerDecoration(c){return this._checkProposedApi(),this._verifyPositiveIntegers(c.x??0,c.width??0,c.height??0),this._core.registerDecoration(c)}hasSelection(){return this._core.hasSelection()}select(c,a,l){this._verifyIntegers(c,a,l),this._core.select(c,a,l)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(c,a){this._verifyIntegers(c,a),this._core.selectLines(c,a)}dispose(){super.dispose()}scrollLines(c){this._verifyIntegers(c),this._core.scrollLines(c)}scrollPages(c){this._verifyIntegers(c),this._core.scrollPages(c)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(c){this._verifyIntegers(c),this._core.scrollToLine(c)}clear(){this._core.clear()}write(c,a){this._core.write(c,a)}writeln(c,a){this._core.write(c),this._core.write(`\r
193
193
  `,a)}paste(c){this._core.paste(c)}refresh(c,a){this._verifyIntegers(c,a),this._core.refresh(c,a)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(c){this._addonManager.loadAddon(this,c)}static get strings(){return u}_verifyIntegers(...c){for(const a of c)if(a===1/0||isNaN(a)||a%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...c){for(const a of c)if(a&&(a===1/0||isNaN(a)||a%1!=0||a<0))throw new Error("This API only accepts positive integers")}}H.Terminal=v})(),K})()))})(hc)),hc.exports}var g0=v0(),fc={exports:{}},$d;function p0(){return $d||($d=1,(function(b,B){(function(z,k){b.exports=k()})(self,(()=>(()=>{var z={};return(()=>{var k=z;Object.defineProperty(k,"__esModule",{value:!0}),k.FitAddon=void 0,k.FitAddon=class{activate(U){this._terminal=U}dispose(){}fit(){const U=this.proposeDimensions();if(!U||!this._terminal||isNaN(U.cols)||isNaN(U.rows))return;const K=this._terminal._core;this._terminal.rows===U.rows&&this._terminal.cols===U.cols||(K._renderService.clear(),this._terminal.resize(U.cols,U.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const U=this._terminal._core,K=U._renderService.dimensions;if(K.css.cell.width===0||K.css.cell.height===0)return;const H=this._terminal.options.scrollback===0?0:U.viewport.scrollBarWidth,u=window.getComputedStyle(this._terminal.element.parentElement),h=parseInt(u.getPropertyValue("height")),d=Math.max(0,parseInt(u.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),f=h-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),g=d-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-H;return{cols:Math.max(2,Math.floor(g/K.css.cell.width)),rows:Math.max(1,Math.floor(f/K.css.cell.height))}}}})(),z})()))})(fc)),fc.exports}var S0=p0();const Na=new Map;function b0({sessionId:b,isActive:B,clientId:z,lockHeldBy:k,scrollbackLines:U=1e4,onReadOnlyInput:K}){const H=ne.useRef(null),u=ne.useRef(null),h=ne.useRef(null),d=ne.useRef(null),p=ne.useRef(null),f=ne.useRef(null),[g,y]=ne.useState(!1),D=g||k===z;return ne.useEffect(()=>{if(!H.current)return;let v=Na.get(b),o=v?.terminal,c=v?.fitAddon;return(!o||!c)&&(o=new g0.Terminal({cursorBlink:!0,fontSize:14,theme:{background:"#1a1a1a",foreground:"#d4d4d4"},scrollback:U}),c=new S0.FitAddon,o.loadAddon(c),Na.set(b,{terminal:o,fitAddon:c})),u.current=o,h.current=c,()=>{}},[b,U]),ne.useEffect(()=>{const v=u.current,o=h.current;if(!v||!o)return;if(H.current&&(H.current.style.display=B?"block":"none"),B&&!v.element&&H.current){if(v.open(H.current),v.element){const C=v.element;C.style.padding="8px",C.style.boxSizing="border-box"}requestAnimationFrame(()=>{setTimeout(()=>{try{o.fit()}catch(C){console.error("Fit error on activation:",C)}},0)})}else B&&v.element&&requestAnimationFrame(()=>{setTimeout(()=>{try{o.fit()}catch(C){console.error("Refit error:",C)}},0)});if(!B){d.current&&d.current.readyState===WebSocket.OPEN&&d.current.close();return}const a=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/terminal/${b}?clientId=${encodeURIComponent(z)}`,l=new WebSocket(a);d.current=l,l.binaryType="arraybuffer",l.onopen=()=>{l.send(JSON.stringify({type:"resize",cols:v.cols,rows:v.rows})),(!k||k===z)&&(y(!0),l.send(JSON.stringify({type:"acquire-lock"})))},l.onmessage=C=>{if(typeof C.data=="string")try{JSON.parse(C.data).type==="exit"&&v.write(`\r
194
194
  [Process exited]`)}catch{v.write(C.data)}else{const w=new Uint8Array(C.data);v.write(new TextDecoder().decode(w))}},l.onclose=()=>{y(!1)},l.onerror=C=>{console.error("WebSocket error:",C),v.write(`\r
195
- [Connection error]`)};const _=new ResizeObserver(()=>{try{H.current&&H.current.offsetWidth>0&&H.current.offsetHeight>0&&(o.fit(),l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"resize",cols:v.cols,rows:v.rows})))}catch(C){console.error("Resize error:",C)}});return p.current=_,H.current&&_.observe(H.current),()=>{f.current&&(f.current.dispose(),f.current=null),p.current&&p.current.disconnect(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.close()}},[b,B,z]),ne.useEffect(()=>{const v=u.current;if(!v)return;v.options.cursorBlink=D,f.current&&f.current.dispose();const o=d.current;return f.current=v.onData(c=>{D&&o&&o.readyState===WebSocket.OPEN?o.send(c):!D&&K&&K(k)}),()=>{}},[D,g,k,K]),ne.useEffect(()=>{k!==null&&k!==z&&y(!1)},[k,z]),ne.useEffect(()=>{B&&!D&&!k&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"acquire-lock"}))},[k,B,D]),ne.useEffect(()=>()=>{const v=Na.get(b);v&&(v.terminal.dispose(),Na.delete(b))},[b]),M.jsx("div",{ref:H,style:{display:B?"block":"none",width:"100%",height:"100%",overflow:"hidden"}})}function mn({size:b="md"}={}){const B=b==="sm"?"h-8":"h-12";return M.jsxs("svg",{className:`w-auto ${B}`,viewBox:"0 0 320 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[M.jsx("rect",{x:"4",y:"8",width:"48",height:"48",rx:"2",className:"stroke-primary",strokeWidth:"1.5"}),M.jsx("polyline",{points:"16,24 28,32 16,40",className:"stroke-primary",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"miter",fill:"none"}),M.jsx("line",{x1:"32",y1:"40",x2:"40",y2:"40",className:"stroke-primary",strokeWidth:"2.5",strokeLinecap:"round"}),M.jsx("text",{x:"68",y:"41",fontFamily:"monospace",fontSize:"28",fontWeight:"600",className:"fill-primary",children:"PuTTrY"})]})}function y0(){let b=localStorage.getItem("wt_client_id");return b||(b=crypto.randomUUID(),localStorage.setItem("wt_client_id",b)),b}function C0(){const[b,B]=ne.useState("loading"),[z,k]=ne.useState(!1),[U,K]=ne.useState(""),[H,u]=ne.useState(""),[h,d]=ne.useState(!1),[p,f]=ne.useState(["","","","","",""]),[g,y]=ne.useState(""),[D,v]=ne.useState(""),[o,c]=ne.useState(!1),[a,l]=ne.useState(!1),_=ne.useRef([]),C=()=>p.join(""),[w,A]=ne.useState(!1),[m,R]=ne.useState(!1),[G,q]=ne.useState(""),[Y,j]=ne.useState([]),[Q,ae]=ne.useState(null),[P,J]=ne.useState(!1),[ie,E]=ne.useState(192),[T,x]=ne.useState(!1),[L,W]=ne.useState(1e4),Z=ne.useRef(y0()),[oe,he]=ne.useState({}),F=ne.useRef(0),N=ne.useRef({}),[se,fe]=ne.useState(new Set),_e=ne.useRef({}),me=de=>{const ve=Date.now(),ye=3e3;ve-F.current<ye||(pn.error(de,{position:"bottom-right",duration:ye,style:{fontSize:"12px",padding:"8px 12px"}}),F.current=ve)},De=de=>{const ve=new WebSocket(`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/terminal/${de}?clientId=${encodeURIComponent(Z.current)}`);ve.onopen=()=>{ve.send(JSON.stringify({type:"acquire-lock",force:!0}))},setTimeout(()=>{ve.readyState===WebSocket.OPEN&&ve.close()},500)},[Oe,Pe]=ne.useState(!1),[nt,Ee]=ne.useState(!1),[Et,_i]=ne.useState(null),[mi,ni]=ne.useState(!1),Ui=ne.useRef(null),mt=ne.useRef(null),Ge=ne.useRef(null),[Ct,ti]=ne.useState(!1);ne.useEffect(()=>{if(!Ct)return;const de=setTimeout(()=>ti(!1),4e3);return()=>clearTimeout(de)},[Ct]),ne.useEffect(()=>{At()},[]);const ai=ne.useCallback(()=>{const de=window.location.protocol==="https:"?"wss":"ws",ve=new WebSocket(`${de}://${window.location.host}/sync?clientId=${encodeURIComponent(Z.current)}`);mt.current=ve,ve.onmessage=ye=>{const we=JSON.parse(ye.data);if(we.type==="snapshot"){j(we.sessions);const He={};for(const Ke of we.sessions)He[Ke.id]=Ke.inputLockClientId??null;he(He),Ge.current&&we.sessions.find(Ke=>Ke.id===Ge.current)&&(ae(Ge.current),Ge.current=null)}else we.type==="session-created"?(j(He=>He.find(Ke=>Ke.id===we.session.id)?He:[...He,we.session]),Ge.current===we.session.id&&(ae(we.session.id),Ge.current=null)):we.type==="session-deleted"?(j(He=>He.filter(Ke=>Ke.id!==we.sessionId)),ae(He=>He===we.sessionId?null:He),he(He=>{const Ke={...He};return delete Ke[we.sessionId],Ke})):we.type==="session-renamed"?j(He=>He.map(Ke=>Ke.id===we.sessionId?{...Ke,label:we.label}:Ke)):we.type==="input-lock-acquired"?he(He=>({...He,[we.sessionId]:we.clientId})):we.type==="input-lock-released"?he(He=>({...He,[we.sessionId]:null})):we.type==="data-activity"&&(fe(He=>{const Ke=new Set(He);return Ke.add(we.sessionId),Ke}),_e.current[we.sessionId]&&clearTimeout(_e.current[we.sessionId]),_e.current[we.sessionId]=setTimeout(()=>{fe(He=>{const Ke=new Set(He);return Ke.delete(we.sessionId),Ke}),delete _e.current[we.sessionId]},500))},ve.onclose=()=>{setTimeout(ai,2e3)}},[]);ne.useEffect(()=>{if(b==="authenticated")return ai(),()=>{mt.current?.close()}},[b,ai]),ne.useEffect(()=>{if(b!=="authenticated")return;async function de(){try{const ve=await fetch("/api/config");if(ve.ok){const ye=await ve.json();W(ye.scrollbackLines)}}catch(ve){console.error("Failed to fetch config:",ve)}}de()},[b]),ne.useEffect(()=>{for(const[de,ve]of Object.entries(oe))N.current[de]===Z.current&&ve!==Z.current&&ve!==null&&me(`Session control lost to another browser with Session ID: ${ve.split("-").pop()}`);N.current={...oe}},[oe]),ne.useEffect(()=>()=>{Object.values(_e.current).forEach(de=>clearTimeout(de))},[]),ne.useEffect(()=>{Y.length>0&&!Q&&ae(Y[0].id)},[Y,Q]);async function At(){try{const ve=await(await fetch("/api/auth-status")).json();console.log("[Auth] Status response:",ve),k(ve.authDisabled),ve.authDisabled&&ve.showAuthDisabledWarning&&(console.log("[Auth] Setting showAuthDisabledWarning to true"),ti(!0)),ve.authenticated?B("authenticated"):B("unauthenticated")}catch(de){console.error("Auth check failed:",de),B("unauthenticated")}}async function qi(){x(!0);try{const de=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:Z.current})});if(de.ok){const ve=await de.json();Ge.current=ve.id,setTimeout(()=>{Ge.current===ve.id&&(ae(ve.id),Ge.current=null)},500)}}catch(de){console.error("Failed to create session:",de)}finally{x(!1)}}async function Rt(de){de.preventDefault(),K(""),x(!0);try{const ve=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:H})}),ye=await ve.json();if(!ve.ok){K("Invalid password");return}ye.authenticated?(u(""),B("authenticated")):ye.requiresPasskey&&!ye.requiresTOTP?(u(""),A(!1),B("passkey-verify")):ye.canChoose?(u(""),A(!0),B("totp-verify")):ye.requiresTOTP&&(u(""),A(!1),ye.totpMode==="setup"?(B("totp-setup"),await vi()):ye.totpMode==="verify"&&B("totp-verify"))}catch(ve){K("Login failed"),console.error("Login error:",ve)}finally{x(!1)}}async function vi(){try{const de=await fetch("/api/auth/2fa/qr",{credentials:"include"});if(de.ok){const ve=await de.json();y(ve.dataUrl),v(ve.manualEntryKey)}else K("Failed to generate QR code")}catch(de){K("Failed to fetch QR code"),console.error("QR fetch error:",de)}}function Ye(de,ve){const ye=ve.replace(/\D/g,"").slice(0,1),we=[...p];if(we[de]=ye,f(we),ye&&de<5&&_.current[de+1]?.focus(),ye&&we.every(He=>He!=="")){const He=we.join("");b==="totp-setup"?Dt(He):b==="totp-verify"&&oi(He)}}function li(de,ve){ve.key==="Backspace"&&!p[de]&&de>0&&_.current[de-1]?.focus()}async function Dt(de){const ve=typeof de=="string"?de:C();de?.preventDefault?.(),K(""),l(!0);try{console.log("[TOTP] Setting up with code:",ve);const ye=await fetch("/api/auth/2fa/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:D,code:ve})}),we=await ye.json();if(console.log("[TOTP] Setup response status:",ye.status,"data:",we),!ye.ok){console.log("[TOTP] Setup failed:",we.error),K(we.error||"Failed to setup 2FA"),f(["","","","","",""]),_.current[0]?.focus(),l(!1);return}console.log("[TOTP] Setup successful, redirecting to authenticated"),f(["","","","","",""]),y(""),v(""),B("authenticated")}catch(ye){console.error("[TOTP] Setup error:",ye),K("Setup failed"),l(!1)}}async function oi(de){const ve=typeof de=="string"?de:C();de?.preventDefault?.(),K(""),l(!0);try{console.log("[TOTP] Verifying code:",ve);const ye=await fetch("/api/auth/2fa/verify",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:ve})}),we=await ye.json();if(console.log("[TOTP] Response status:",ye.status,"data:",we),!ye.ok){console.log("[TOTP] Response not ok, error:",we.error),K(we.error||"Invalid code"),f(["","","","","",""]),_.current[0]?.focus(),l(!1);return}console.log("[TOTP] Verification successful, redirecting to authenticated"),f(["","","","","",""]),B("authenticated")}catch(ye){console.error("[TOTP] Verify error:",ye),K("Verification failed"),l(!1)}}async function wt(){q(""),R(!0);try{const{startAuthentication:de}=await e_(async()=>{const{startAuthentication:Ke}=await import("./index-BDkarAkX.js");return{startAuthentication:Ke}},[]),ve=await fetch("/api/auth/passkey/auth/options",{method:"POST",credentials:"include"});if(!ve.ok){q("Failed to start authentication");return}const ye=await ve.json(),we=await de({optionsJSON:ye}),He=await fetch("/api/auth/passkey/auth/verify",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:we})});if(!He.ok){const Ke=await He.json();q(Ke.error||"Authentication failed");return}B("authenticated")}catch(de){de.name==="NotAllowedError"?q("Authentication cancelled"):(q("Authentication failed"),console.error("[Passkey] Auth error:",de))}finally{R(!1)}}async function Pa(){if(Q){ni(!0);try{const de=await fetch(`/api/sessions/${Q}/info`);if(de.ok){const ve=await de.json();_i(ve),Ee(!0)}}catch(de){console.error("Failed to fetch process info:",de)}finally{ni(!1)}}}async function Ga(){try{await fetch("/api/auth",{method:"DELETE"}),B("unauthenticated"),j([]),ae(null)}catch(de){console.error("Logout failed:",de)}}async function Va(de,ve){try{await fetch(`/api/sessions/${de}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:ve})}),j(ye=>ye.map(we=>we.id===de?{...we,label:ve}:we))}catch(ye){console.error("Failed to rename session:",ye)}}async function Ns(de){try{await fetch(`/api/sessions/${de}`,{method:"DELETE"}),j(ve=>ve.filter(ye=>ye.id!==de)),Q===de&&ae(Y.find(ve=>ve.id!==de)?.id??null)}catch(ve){console.error("Failed to close session:",ve)}}async function zs(){try{await Promise.all(Y.map(de=>fetch(`/api/sessions/${de.id}`,{method:"DELETE"}))),j([]),ae(null)}catch(de){console.error("Failed to close all sessions:",de)}}return b==="loading"?M.jsx("div",{className:"flex items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"text-center",children:[M.jsx("div",{className:"mb-4 inline-block",children:M.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-border border-t-primary"})}),M.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):b==="unauthenticated"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your session password to continue"}),M.jsxs("div",{className:"relative",children:[M.jsx("input",{type:h?"text":"password",value:H,onChange:de=>u(de.target.value),onKeyDown:de=>{de.key==="Enter"&&Rt(de)},placeholder:"Enter password...",className:"w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-sm outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-ring/50 focus:ring-[3px]",disabled:T,autoFocus:!0}),M.jsx("button",{type:"button",onClick:()=>d(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:h?M.jsx(dc,{className:"h-4 w-4"}):M.jsx(_c,{className:"h-4 w-4"})})]}),U&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3",children:M.jsx("p",{className:"text-xs text-destructive",children:U})}),M.jsx(Ie,{className:"w-full",disabled:!H.trim()||T,onClick:Rt,children:T?M.jsxs(M.Fragment,{children:[M.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}),"Verifying..."]}):"Continue"})]})})]})}):b==="totp-setup"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm font-medium",children:"Setup Two-Factor Authentication"}),M.jsx("p",{className:"text-xs text-muted-foreground",children:"Scan the QR code with your authenticator app"}),g&&M.jsx("div",{className:"flex justify-center",children:M.jsx("img",{src:g,alt:"TOTP QR Code",className:"border border-border rounded-md p-2 bg-white dark:bg-slate-900"})}),D&&M.jsxs("div",{className:"space-y-1",children:[M.jsx("button",{type:"button",onClick:()=>c(!o),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:o?"Hide":"Or enter manually"}),o&&M.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/50 font-mono text-sm break-all text-center",children:D})]}),M.jsxs("div",{className:"space-y-3 pt-2",children:[M.jsx("label",{className:"text-xs font-medium block",children:"Enter 6-digit code"}),M.jsx("div",{className:"flex justify-center gap-2",children:p.map((de,ve)=>M.jsx("input",{ref:ye=>{_.current[ve]=ye},type:"text",inputMode:"numeric",value:de,onChange:ye=>Ye(ve,ye.target.value),onKeyDown:ye=>li(ve,ye),maxLength:1,className:"w-10 h-10 rounded-md border border-input bg-background text-sm font-semibold text-center outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-ring/50 focus:ring-[2px]",disabled:a,autoFocus:ve===0},ve))})]}),U&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3 mt-3",children:M.jsx("p",{className:"text-xs text-destructive",children:U})}),a&&M.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground mt-3",children:[M.jsx(ei,{className:"h-4 w-4 animate-spin"}),"Verifying..."]})]})})]})}):b==="totp-verify"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm font-medium",children:"Enter Verification Code"}),M.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the 6-digit code from your authenticator app"}),M.jsx("div",{className:"space-y-3 pt-4",children:M.jsx("div",{className:"flex justify-center gap-2",children:p.map((de,ve)=>M.jsx("input",{ref:ye=>{_.current[ve]=ye},type:"text",inputMode:"numeric",value:de,onChange:ye=>Ye(ve,ye.target.value),onKeyDown:ye=>li(ve,ye),maxLength:1,className:"w-10 h-10 rounded-md border border-input bg-background text-sm font-semibold text-center outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-ring/50 focus:ring-[2px]",disabled:a,autoFocus:ve===0},ve))})}),U&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3 mt-3",children:M.jsx("p",{className:"text-xs text-destructive",children:U})}),a&&M.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground mt-3",children:[M.jsx(ei,{className:"h-4 w-4 animate-spin"}),"Verifying..."]}),w&&M.jsxs("div",{className:"pt-2 border-t border-border/50",children:[M.jsx("p",{className:"text-xs text-muted-foreground text-center mb-3",children:"or"}),M.jsx(Ie,{className:"w-full",disabled:m,onClick:wt,children:m?M.jsxs(M.Fragment,{children:[M.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}),"Waiting..."]}):M.jsxs(M.Fragment,{children:[M.jsx(Nd,{className:"h-4 w-4 mr-2"}),"Use Passkey"]})}),G&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3 mt-3",children:M.jsx("p",{className:"text-xs text-destructive",children:G})})]})]})})]})}):b==="passkey-verify"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm font-medium",children:"Verify with Passkey"}),M.jsx("p",{className:"text-xs text-muted-foreground",children:"Use your fingerprint, face, or security key to continue"}),M.jsx(Ie,{className:"w-full",disabled:m,onClick:wt,children:m?M.jsxs(M.Fragment,{children:[M.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}),"Waiting..."]}):M.jsxs(M.Fragment,{children:[M.jsx(Nd,{className:"h-4 w-4 mr-2"}),"Continue with Passkey"]})}),G&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3",children:M.jsx("p",{className:"text-xs text-destructive",children:G})}),w&&M.jsxs("div",{className:"pt-2 border-t border-border/50",children:[M.jsx("p",{className:"text-xs text-muted-foreground text-center mb-3",children:"or"}),M.jsx(Ie,{className:"w-full",onClick:()=>B("totp-verify"),children:"Use Authenticator App"})]})]})})]})}):M.jsxs("div",{className:"flex flex-col h-screen w-full bg-background text-foreground",children:[Ct&&M.jsx("div",{className:"px-4 py-2 bg-amber-400/40 border-b border-amber-600/50 text-sm text-black dark:text-black text-center animate-pulse",children:"⚠️ Authentication is disabled"}),M.jsx(_0,{position:"bottom-right"}),M.jsxs("div",{className:"flex flex-1 w-full overflow-hidden",children:[M.jsx(Ep,{sessions:Y,activeSessionId:Q,onSelectSession:ae,onNewSession:qi,onCloseSession:Ns,onRenameSession:Va,onCloseAllSessions:zs,loading:T,collapsed:P,onToggleCollapse:()=>{J(!P),P&&E(192)},width:ie,onWidthChange:E,inputLocks:oe,clientId:Z.current,onTakeControl:De,dataReceivedSessions:se}),M.jsxs("div",{className:"flex-1 flex flex-col",children:[M.jsxs("div",{className:"border-b border-border bg-card px-4 py-2 flex items-center justify-between",children:[M.jsx(mn,{size:"sm"}),M.jsxs("div",{className:"flex items-center gap-2",children:[b==="authenticated"&&Q&&M.jsxs("div",{className:"relative",ref:Ui,children:[M.jsx(Ie,{variant:"ghost",size:"sm",onClick:Pa,disabled:mi,className:"[&_svg]:size-4",title:"Session info",children:M.jsx(cg,{className:"h-4 w-4"})}),nt&&Et&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(!1)}),M.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-card border border-border rounded-lg shadow-lg w-80",onClick:de=>de.stopPropagation(),children:M.jsxs("div",{className:"p-3 space-y-2",children:[M.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border/50",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"PID"}),M.jsx("span",{className:"text-xs font-mono font-bold",children:Et.pid})]}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"Memory"}),M.jsx("span",{className:"text-xs font-mono font-bold",children:Et.memory})]}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"CPU"}),M.jsxs("span",{className:"text-xs font-mono font-bold",children:[Et.cpu.toFixed(1),"%"]})]}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"Uptime"}),M.jsx("span",{className:"text-xs font-mono font-bold",children:Et.uptime})]}),M.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-border/50",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"Started"}),M.jsx("span",{className:"text-xs font-mono font-bold text-right",children:new Date(Et.startedAt).toLocaleString()})]})]})})]})]}),!z&&M.jsx(Ie,{variant:"ghost",size:"sm",onClick:()=>Pe(!0),className:"[&_svg]:size-4",title:"Settings",children:M.jsx(yg,{className:"h-4 w-4"})}),M.jsx(m0,{open:Oe,onOpenChange:Pe}),!z&&M.jsxs(Ie,{variant:"ghost",size:"sm",onClick:Ga,className:"[&_svg]:size-4",children:[M.jsx(fg,{className:"mr-2"}),"Logout"]})]})]}),M.jsx("div",{className:"flex-1 relative overflow-hidden",children:Y.map(de=>M.jsx(b0,{sessionId:de.id,isActive:Q===de.id,clientId:Z.current,lockHeldBy:oe[de.id]??null,scrollbackLines:L,onReadOnlyInput:ve=>{const ye=ve?`Terminal locked by another browser with Session ID: ${ve.split("-").pop()}`:"Terminal locked by another browser";me(ye)}},de.id))})]})]})]})}Xv.createRoot(document.getElementById("root")).render(M.jsx(ne.StrictMode,{children:M.jsx(C0,{})}));
195
+ [Connection error]`)};const _=new ResizeObserver(()=>{try{H.current&&H.current.offsetWidth>0&&H.current.offsetHeight>0&&(o.fit(),l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"resize",cols:v.cols,rows:v.rows})))}catch(C){console.error("Resize error:",C)}});return p.current=_,H.current&&_.observe(H.current),()=>{f.current&&(f.current.dispose(),f.current=null),p.current&&p.current.disconnect(),d.current&&d.current.readyState===WebSocket.OPEN&&d.current.close()}},[b,B,z]),ne.useEffect(()=>{const v=u.current;if(!v)return;v.options.cursorBlink=D,f.current&&f.current.dispose();const o=d.current;return f.current=v.onData(c=>{D&&o&&o.readyState===WebSocket.OPEN?o.send(c):!D&&K&&K(k)}),()=>{}},[D,g,k,K]),ne.useEffect(()=>{k!==null&&k!==z&&y(!1)},[k,z]),ne.useEffect(()=>{B&&!D&&!k&&d.current&&d.current.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify({type:"acquire-lock"}))},[k,B,D]),ne.useEffect(()=>()=>{const v=Na.get(b);v&&(v.terminal.dispose(),Na.delete(b))},[b]),M.jsx("div",{ref:H,style:{display:B?"block":"none",width:"100%",height:"100%",overflow:"hidden"}})}function mn({size:b="md"}={}){const B=b==="sm"?"h-8":"h-12";return M.jsxs("svg",{className:`w-auto ${B}`,viewBox:"0 0 320 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[M.jsx("rect",{x:"4",y:"8",width:"48",height:"48",rx:"2",className:"stroke-primary",strokeWidth:"1.5"}),M.jsx("polyline",{points:"16,24 28,32 16,40",className:"stroke-primary",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"miter",fill:"none"}),M.jsx("line",{x1:"32",y1:"40",x2:"40",y2:"40",className:"stroke-primary",strokeWidth:"2.5",strokeLinecap:"round"}),M.jsx("text",{x:"68",y:"41",fontFamily:"monospace",fontSize:"28",fontWeight:"600",className:"fill-primary",children:"PuTTrY"})]})}function y0(){return crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(b){const B=Math.random()*16|0;return(b==="x"?B:B&3|8).toString(16)})}function C0(){let b=localStorage.getItem("wt_client_id");return b||(b=y0(),localStorage.setItem("wt_client_id",b)),b}function w0(){const[b,B]=ne.useState("loading"),[z,k]=ne.useState(!1),[U,K]=ne.useState(""),[H,u]=ne.useState(""),[h,d]=ne.useState(!1),[p,f]=ne.useState(["","","","","",""]),[g,y]=ne.useState(""),[D,v]=ne.useState(""),[o,c]=ne.useState(!1),[a,l]=ne.useState(!1),_=ne.useRef([]),C=()=>p.join(""),[w,A]=ne.useState(!1),[m,R]=ne.useState(!1),[G,q]=ne.useState(""),[Y,j]=ne.useState([]),[Q,ae]=ne.useState(null),[P,J]=ne.useState(!1),[ie,E]=ne.useState(192),[T,x]=ne.useState(!1),[L,W]=ne.useState(1e4),Z=ne.useRef(C0()),[oe,he]=ne.useState({}),F=ne.useRef(0),N=ne.useRef({}),[se,fe]=ne.useState(new Set),_e=ne.useRef({}),me=de=>{const ve=Date.now(),ye=3e3;ve-F.current<ye||(pn.error(de,{position:"bottom-right",duration:ye,style:{fontSize:"12px",padding:"8px 12px"}}),F.current=ve)},De=de=>{const ve=new WebSocket(`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}/terminal/${de}?clientId=${encodeURIComponent(Z.current)}`);ve.onopen=()=>{ve.send(JSON.stringify({type:"acquire-lock",force:!0}))},setTimeout(()=>{ve.readyState===WebSocket.OPEN&&ve.close()},500)},[Oe,Pe]=ne.useState(!1),[nt,Ee]=ne.useState(!1),[Et,_i]=ne.useState(null),[mi,ni]=ne.useState(!1),Ui=ne.useRef(null),mt=ne.useRef(null),Ge=ne.useRef(null),[Ct,ti]=ne.useState(!1);ne.useEffect(()=>{if(!Ct)return;const de=setTimeout(()=>ti(!1),4e3);return()=>clearTimeout(de)},[Ct]),ne.useEffect(()=>{At()},[]);const ai=ne.useCallback(()=>{const de=window.location.protocol==="https:"?"wss":"ws",ve=new WebSocket(`${de}://${window.location.host}/sync?clientId=${encodeURIComponent(Z.current)}`);mt.current=ve,ve.onmessage=ye=>{const we=JSON.parse(ye.data);if(we.type==="snapshot"){j(we.sessions);const He={};for(const Ke of we.sessions)He[Ke.id]=Ke.inputLockClientId??null;he(He),Ge.current&&we.sessions.find(Ke=>Ke.id===Ge.current)&&(ae(Ge.current),Ge.current=null)}else we.type==="session-created"?(j(He=>He.find(Ke=>Ke.id===we.session.id)?He:[...He,we.session]),Ge.current===we.session.id&&(ae(we.session.id),Ge.current=null)):we.type==="session-deleted"?(j(He=>He.filter(Ke=>Ke.id!==we.sessionId)),ae(He=>He===we.sessionId?null:He),he(He=>{const Ke={...He};return delete Ke[we.sessionId],Ke})):we.type==="session-renamed"?j(He=>He.map(Ke=>Ke.id===we.sessionId?{...Ke,label:we.label}:Ke)):we.type==="input-lock-acquired"?he(He=>({...He,[we.sessionId]:we.clientId})):we.type==="input-lock-released"?he(He=>({...He,[we.sessionId]:null})):we.type==="data-activity"&&(fe(He=>{const Ke=new Set(He);return Ke.add(we.sessionId),Ke}),_e.current[we.sessionId]&&clearTimeout(_e.current[we.sessionId]),_e.current[we.sessionId]=setTimeout(()=>{fe(He=>{const Ke=new Set(He);return Ke.delete(we.sessionId),Ke}),delete _e.current[we.sessionId]},500))},ve.onclose=()=>{setTimeout(ai,2e3)}},[]);ne.useEffect(()=>{if(b==="authenticated")return ai(),()=>{mt.current?.close()}},[b,ai]),ne.useEffect(()=>{if(b!=="authenticated")return;async function de(){try{const ve=await fetch("/api/config");if(ve.ok){const ye=await ve.json();W(ye.scrollbackLines)}}catch(ve){console.error("Failed to fetch config:",ve)}}de()},[b]),ne.useEffect(()=>{for(const[de,ve]of Object.entries(oe))N.current[de]===Z.current&&ve!==Z.current&&ve!==null&&me(`Session control lost to another browser with Session ID: ${ve.split("-").pop()}`);N.current={...oe}},[oe]),ne.useEffect(()=>()=>{Object.values(_e.current).forEach(de=>clearTimeout(de))},[]),ne.useEffect(()=>{Y.length>0&&!Q&&ae(Y[0].id)},[Y,Q]);async function At(){try{const ve=await(await fetch("/api/auth-status")).json();console.log("[Auth] Status response:",ve),k(ve.authDisabled),ve.authDisabled&&ve.showAuthDisabledWarning&&(console.log("[Auth] Setting showAuthDisabledWarning to true"),ti(!0)),ve.authenticated?B("authenticated"):B("unauthenticated")}catch(de){console.error("Auth check failed:",de),B("unauthenticated")}}async function qi(){x(!0);try{const de=await fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clientId:Z.current})});if(de.ok){const ve=await de.json();Ge.current=ve.id,setTimeout(()=>{Ge.current===ve.id&&(ae(ve.id),Ge.current=null)},500)}}catch(de){console.error("Failed to create session:",de)}finally{x(!1)}}async function Rt(de){de.preventDefault(),K(""),x(!0);try{const ve=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:H})}),ye=await ve.json();if(!ve.ok){K("Invalid password");return}ye.authenticated?(u(""),B("authenticated")):ye.requiresPasskey&&!ye.requiresTOTP?(u(""),A(!1),B("passkey-verify")):ye.canChoose?(u(""),A(!0),B("totp-verify")):ye.requiresTOTP&&(u(""),A(!1),ye.totpMode==="setup"?(B("totp-setup"),await vi()):ye.totpMode==="verify"&&B("totp-verify"))}catch(ve){K("Login failed"),console.error("Login error:",ve)}finally{x(!1)}}async function vi(){try{const de=await fetch("/api/auth/2fa/qr",{credentials:"include"});if(de.ok){const ve=await de.json();y(ve.dataUrl),v(ve.manualEntryKey)}else K("Failed to generate QR code")}catch(de){K("Failed to fetch QR code"),console.error("QR fetch error:",de)}}function Ye(de,ve){const ye=ve.replace(/\D/g,"").slice(0,1),we=[...p];if(we[de]=ye,f(we),ye&&de<5&&_.current[de+1]?.focus(),ye&&we.every(He=>He!=="")){const He=we.join("");b==="totp-setup"?Dt(He):b==="totp-verify"&&oi(He)}}function li(de,ve){ve.key==="Backspace"&&!p[de]&&de>0&&_.current[de-1]?.focus()}async function Dt(de){const ve=typeof de=="string"?de:C();de?.preventDefault?.(),K(""),l(!0);try{console.log("[TOTP] Setting up with code:",ve);const ye=await fetch("/api/auth/2fa/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:D,code:ve})}),we=await ye.json();if(console.log("[TOTP] Setup response status:",ye.status,"data:",we),!ye.ok){console.log("[TOTP] Setup failed:",we.error),K(we.error||"Failed to setup 2FA"),f(["","","","","",""]),_.current[0]?.focus(),l(!1);return}console.log("[TOTP] Setup successful, redirecting to authenticated"),f(["","","","","",""]),y(""),v(""),B("authenticated")}catch(ye){console.error("[TOTP] Setup error:",ye),K("Setup failed"),l(!1)}}async function oi(de){const ve=typeof de=="string"?de:C();de?.preventDefault?.(),K(""),l(!0);try{console.log("[TOTP] Verifying code:",ve);const ye=await fetch("/api/auth/2fa/verify",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:ve})}),we=await ye.json();if(console.log("[TOTP] Response status:",ye.status,"data:",we),!ye.ok){console.log("[TOTP] Response not ok, error:",we.error),K(we.error||"Invalid code"),f(["","","","","",""]),_.current[0]?.focus(),l(!1);return}console.log("[TOTP] Verification successful, redirecting to authenticated"),f(["","","","","",""]),B("authenticated")}catch(ye){console.error("[TOTP] Verify error:",ye),K("Verification failed"),l(!1)}}async function wt(){q(""),R(!0);try{const{startAuthentication:de}=await e_(async()=>{const{startAuthentication:Ke}=await import("./index-BDkarAkX.js");return{startAuthentication:Ke}},[]),ve=await fetch("/api/auth/passkey/auth/options",{method:"POST",credentials:"include"});if(!ve.ok){q("Failed to start authentication");return}const ye=await ve.json(),we=await de({optionsJSON:ye}),He=await fetch("/api/auth/passkey/auth/verify",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({response:we})});if(!He.ok){const Ke=await He.json();q(Ke.error||"Authentication failed");return}B("authenticated")}catch(de){de.name==="NotAllowedError"?q("Authentication cancelled"):(q("Authentication failed"),console.error("[Passkey] Auth error:",de))}finally{R(!1)}}async function Pa(){if(Q){ni(!0);try{const de=await fetch(`/api/sessions/${Q}/info`);if(de.ok){const ve=await de.json();_i(ve),Ee(!0)}}catch(de){console.error("Failed to fetch process info:",de)}finally{ni(!1)}}}async function Ga(){try{await fetch("/api/auth",{method:"DELETE"}),B("unauthenticated"),j([]),ae(null)}catch(de){console.error("Logout failed:",de)}}async function Va(de,ve){try{await fetch(`/api/sessions/${de}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:ve})}),j(ye=>ye.map(we=>we.id===de?{...we,label:ve}:we))}catch(ye){console.error("Failed to rename session:",ye)}}async function Ns(de){try{await fetch(`/api/sessions/${de}`,{method:"DELETE"}),j(ve=>ve.filter(ye=>ye.id!==de)),Q===de&&ae(Y.find(ve=>ve.id!==de)?.id??null)}catch(ve){console.error("Failed to close session:",ve)}}async function zs(){try{await Promise.all(Y.map(de=>fetch(`/api/sessions/${de.id}`,{method:"DELETE"}))),j([]),ae(null)}catch(de){console.error("Failed to close all sessions:",de)}}return b==="loading"?M.jsx("div",{className:"flex items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"text-center",children:[M.jsx("div",{className:"mb-4 inline-block",children:M.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-border border-t-primary"})}),M.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]})}):b==="unauthenticated"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your session password to continue"}),M.jsxs("div",{className:"relative",children:[M.jsx("input",{type:h?"text":"password",value:H,onChange:de=>u(de.target.value),onKeyDown:de=>{de.key==="Enter"&&Rt(de)},placeholder:"Enter password...",className:"w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-sm outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-ring/50 focus:ring-[3px]",disabled:T,autoFocus:!0}),M.jsx("button",{type:"button",onClick:()=>d(!h),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:h?M.jsx(dc,{className:"h-4 w-4"}):M.jsx(_c,{className:"h-4 w-4"})})]}),U&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3",children:M.jsx("p",{className:"text-xs text-destructive",children:U})}),M.jsx(Ie,{className:"w-full",disabled:!H.trim()||T,onClick:Rt,children:T?M.jsxs(M.Fragment,{children:[M.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}),"Verifying..."]}):"Continue"})]})})]})}):b==="totp-setup"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm font-medium",children:"Setup Two-Factor Authentication"}),M.jsx("p",{className:"text-xs text-muted-foreground",children:"Scan the QR code with your authenticator app"}),g&&M.jsx("div",{className:"flex justify-center",children:M.jsx("img",{src:g,alt:"TOTP QR Code",className:"border border-border rounded-md p-2 bg-white dark:bg-slate-900"})}),D&&M.jsxs("div",{className:"space-y-1",children:[M.jsx("button",{type:"button",onClick:()=>c(!o),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline",children:o?"Hide":"Or enter manually"}),o&&M.jsx("div",{className:"px-3 py-2 rounded border border-border bg-muted/50 font-mono text-sm break-all text-center",children:D})]}),M.jsxs("div",{className:"space-y-3 pt-2",children:[M.jsx("label",{className:"text-xs font-medium block",children:"Enter 6-digit code"}),M.jsx("div",{className:"flex justify-center gap-2",children:p.map((de,ve)=>M.jsx("input",{ref:ye=>{_.current[ve]=ye},type:"text",inputMode:"numeric",value:de,onChange:ye=>Ye(ve,ye.target.value),onKeyDown:ye=>li(ve,ye),maxLength:1,className:"w-10 h-10 rounded-md border border-input bg-background text-sm font-semibold text-center outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-ring/50 focus:ring-[2px]",disabled:a,autoFocus:ve===0},ve))})]}),U&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3 mt-3",children:M.jsx("p",{className:"text-xs text-destructive",children:U})}),a&&M.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground mt-3",children:[M.jsx(ei,{className:"h-4 w-4 animate-spin"}),"Verifying..."]})]})})]})}):b==="totp-verify"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm font-medium",children:"Enter Verification Code"}),M.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter the 6-digit code from your authenticator app"}),M.jsx("div",{className:"space-y-3 pt-4",children:M.jsx("div",{className:"flex justify-center gap-2",children:p.map((de,ve)=>M.jsx("input",{ref:ye=>{_.current[ve]=ye},type:"text",inputMode:"numeric",value:de,onChange:ye=>Ye(ve,ye.target.value),onKeyDown:ye=>li(ve,ye),maxLength:1,className:"w-10 h-10 rounded-md border border-input bg-background text-sm font-semibold text-center outline-none placeholder:text-muted-foreground focus:border-ring focus:ring-ring/50 focus:ring-[2px]",disabled:a,autoFocus:ve===0},ve))})}),U&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3 mt-3",children:M.jsx("p",{className:"text-xs text-destructive",children:U})}),a&&M.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm text-muted-foreground mt-3",children:[M.jsx(ei,{className:"h-4 w-4 animate-spin"}),"Verifying..."]}),w&&M.jsxs("div",{className:"pt-2 border-t border-border/50",children:[M.jsx("p",{className:"text-xs text-muted-foreground text-center mb-3",children:"or"}),M.jsx(Ie,{className:"w-full",disabled:m,onClick:wt,children:m?M.jsxs(M.Fragment,{children:[M.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}),"Waiting..."]}):M.jsxs(M.Fragment,{children:[M.jsx(Nd,{className:"h-4 w-4 mr-2"}),"Use Passkey"]})}),G&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3 mt-3",children:M.jsx("p",{className:"text-xs text-destructive",children:G})})]})]})})]})}):b==="passkey-verify"?M.jsx("div",{className:"flex flex-col items-center justify-center w-full h-screen bg-background text-foreground",children:M.jsxs("div",{className:"w-full max-w-sm px-6 -mt-24",children:[M.jsx("div",{className:"flex flex-col items-center mb-4",children:M.jsx(mn,{})}),M.jsx("div",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:M.jsxs("div",{className:"space-y-3",children:[M.jsx("p",{className:"text-sm font-medium",children:"Verify with Passkey"}),M.jsx("p",{className:"text-xs text-muted-foreground",children:"Use your fingerprint, face, or security key to continue"}),M.jsx(Ie,{className:"w-full",disabled:m,onClick:wt,children:m?M.jsxs(M.Fragment,{children:[M.jsx(ei,{className:"h-4 w-4 animate-spin mr-2"}),"Waiting..."]}):M.jsxs(M.Fragment,{children:[M.jsx(Nd,{className:"h-4 w-4 mr-2"}),"Continue with Passkey"]})}),G&&M.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/30 p-3",children:M.jsx("p",{className:"text-xs text-destructive",children:G})}),w&&M.jsxs("div",{className:"pt-2 border-t border-border/50",children:[M.jsx("p",{className:"text-xs text-muted-foreground text-center mb-3",children:"or"}),M.jsx(Ie,{className:"w-full",onClick:()=>B("totp-verify"),children:"Use Authenticator App"})]})]})})]})}):M.jsxs("div",{className:"flex flex-col h-screen w-full bg-background text-foreground",children:[Ct&&M.jsx("div",{className:"px-4 py-2 bg-amber-400/40 border-b border-amber-600/50 text-sm text-black dark:text-black text-center animate-pulse",children:"⚠️ Authentication is disabled"}),M.jsx(_0,{position:"bottom-right"}),M.jsxs("div",{className:"flex flex-1 w-full overflow-hidden",children:[M.jsx(Ep,{sessions:Y,activeSessionId:Q,onSelectSession:ae,onNewSession:qi,onCloseSession:Ns,onRenameSession:Va,onCloseAllSessions:zs,loading:T,collapsed:P,onToggleCollapse:()=>{J(!P),P&&E(192)},width:ie,onWidthChange:E,inputLocks:oe,clientId:Z.current,onTakeControl:De,dataReceivedSessions:se}),M.jsxs("div",{className:"flex-1 flex flex-col",children:[M.jsxs("div",{className:"border-b border-border bg-card px-4 py-2 flex items-center justify-between",children:[M.jsx(mn,{size:"sm"}),M.jsxs("div",{className:"flex items-center gap-2",children:[b==="authenticated"&&Q&&M.jsxs("div",{className:"relative",ref:Ui,children:[M.jsx(Ie,{variant:"ghost",size:"sm",onClick:Pa,disabled:mi,className:"[&_svg]:size-4",title:"Session info",children:M.jsx(cg,{className:"h-4 w-4"})}),nt&&Et&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(!1)}),M.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-card border border-border rounded-lg shadow-lg w-80",onClick:de=>de.stopPropagation(),children:M.jsxs("div",{className:"p-3 space-y-2",children:[M.jsxs("div",{className:"flex justify-between items-center pb-2 border-b border-border/50",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"PID"}),M.jsx("span",{className:"text-xs font-mono font-bold",children:Et.pid})]}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"Memory"}),M.jsx("span",{className:"text-xs font-mono font-bold",children:Et.memory})]}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"CPU"}),M.jsxs("span",{className:"text-xs font-mono font-bold",children:[Et.cpu.toFixed(1),"%"]})]}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"Uptime"}),M.jsx("span",{className:"text-xs font-mono font-bold",children:Et.uptime})]}),M.jsxs("div",{className:"flex justify-between items-center pt-2 border-t border-border/50",children:[M.jsx("span",{className:"text-xs font-medium font-mono text-muted-foreground",children:"Started"}),M.jsx("span",{className:"text-xs font-mono font-bold text-right",children:new Date(Et.startedAt).toLocaleString()})]})]})})]})]}),!z&&M.jsx(Ie,{variant:"ghost",size:"sm",onClick:()=>Pe(!0),className:"[&_svg]:size-4",title:"Settings",children:M.jsx(yg,{className:"h-4 w-4"})}),M.jsx(m0,{open:Oe,onOpenChange:Pe}),!z&&M.jsxs(Ie,{variant:"ghost",size:"sm",onClick:Ga,className:"[&_svg]:size-4",children:[M.jsx(fg,{className:"mr-2"}),"Logout"]})]})]}),M.jsx("div",{className:"flex-1 relative overflow-hidden",children:Y.map(de=>M.jsx(b0,{sessionId:de.id,isActive:Q===de.id,clientId:Z.current,lockHeldBy:oe[de.id]??null,scrollbackLines:L,onReadOnlyInput:ve=>{const ye=ve?`Terminal locked by another browser with Session ID: ${ve.split("-").pop()}`:"Terminal locked by another browser";me(ye)}},de.id))})]})]})]})}Xv.createRoot(document.getElementById("root")).render(M.jsx(ne.StrictMode,{children:M.jsx(w0,{})}));
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/assets/favicon-B8wORTBw.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>PuTTrY</title>
8
- <script type="module" crossorigin src="/assets/index-BxEvXsu0.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BZVmb4_k.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-C_m8-Z45.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chfischerx/puttry",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "PuTTrY - Web-based terminal with real PTY, WebSocket I/O, and xterm.js frontend",
5
5
  "type": "module",
6
6
  "author": "Christian Fischer <christian@fischerx.com>",