@xiaoqiong0v0/opencode-ssh-tool 0.6.15 → 0.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/agent.d.ts +4 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +17 -2
  4. package/dist/agent.js.map +1 -1
  5. package/dist/base-session.d.ts +64 -32
  6. package/dist/base-session.d.ts.map +1 -1
  7. package/dist/base-session.js +235 -106
  8. package/dist/base-session.js.map +1 -1
  9. package/dist/constants.d.ts +7 -1
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/constants.js +7 -1
  12. package/dist/constants.js.map +1 -1
  13. package/dist/i18n.d.ts +20 -0
  14. package/dist/i18n.d.ts.map +1 -1
  15. package/dist/i18n.js +20 -0
  16. package/dist/i18n.js.map +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +28 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/local-session.d.ts +3 -1
  21. package/dist/local-session.d.ts.map +1 -1
  22. package/dist/local-session.js +82 -4
  23. package/dist/local-session.js.map +1 -1
  24. package/dist/log.d.ts +8 -0
  25. package/dist/log.d.ts.map +1 -1
  26. package/dist/log.js +28 -1
  27. package/dist/log.js.map +1 -1
  28. package/dist/parse-check.d.ts +20 -0
  29. package/dist/parse-check.d.ts.map +1 -0
  30. package/dist/parse-check.js +505 -0
  31. package/dist/parse-check.js.map +1 -0
  32. package/dist/precheck.d.ts +32 -0
  33. package/dist/precheck.d.ts.map +1 -0
  34. package/dist/precheck.js +105 -0
  35. package/dist/precheck.js.map +1 -0
  36. package/dist/server.d.ts.map +1 -1
  37. package/dist/server.js +41 -5
  38. package/dist/server.js.map +1 -1
  39. package/dist/session-store.d.ts +33 -0
  40. package/dist/session-store.d.ts.map +1 -1
  41. package/dist/session-store.js +55 -0
  42. package/dist/session-store.js.map +1 -1
  43. package/dist/session.js +1 -1
  44. package/dist/session.js.map +1 -1
  45. package/dist/shell-adapter.d.ts +14 -0
  46. package/dist/shell-adapter.d.ts.map +1 -1
  47. package/dist/shell-adapter.js +58 -10
  48. package/dist/shell-adapter.js.map +1 -1
  49. package/dist/utils.d.ts +8 -34
  50. package/dist/utils.d.ts.map +1 -1
  51. package/dist/utils.js +22 -64
  52. package/dist/utils.js.map +1 -1
  53. package/dist/web/app.js +1 -1
  54. package/package.json +1 -1
package/dist/web/app.js CHANGED
@@ -8,5 +8,5 @@ WARNING: This link could potentially be dangerous`)){let s=window.open();if(s){t
8
8
  `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL="\x7F"})(_||(d.C0=_={})),(function(h){h.PAD="\x80",h.HOP="\x81",h.BPH="\x82",h.NBH="\x83",h.IND="\x84",h.NEL="\x85",h.SSA="\x86",h.ESA="\x87",h.HTS="\x88",h.HTJ="\x89",h.VTS="\x8A",h.PLD="\x8B",h.PLU="\x8C",h.RI="\x8D",h.SS2="\x8E",h.SS3="\x8F",h.DCS="\x90",h.PU1="\x91",h.PU2="\x92",h.STS="\x93",h.CCH="\x94",h.MW="\x95",h.SPA="\x96",h.EPA="\x97",h.SOS="\x98",h.SGCI="\x99",h.SCI="\x9A",h.CSI="\x9B",h.ST="\x9C",h.OSC="\x9D",h.PM="\x9E",h.APC="\x9F"})(n||(d.C1=n={})),(function(h){h.ST=`${_.ESC}\\`})(l||(d.C1_ESCAPED=l={}))},7399:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.evaluateKeyboardEvent=void 0;let n=_(2584),l={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:["'",'"']};d.evaluateKeyboardEvent=function(h,f,c,p){let o={type:0,cancel:!1,key:void 0},i=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?o.key=f?n.C0.ESC+"OA":n.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?o.key=f?n.C0.ESC+"OD":n.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?o.key=f?n.C0.ESC+"OC":n.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(o.key=f?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:o.key=h.ctrlKey?"\b":n.C0.DEL,h.altKey&&(o.key=n.C0.ESC+o.key);break;case 9:if(h.shiftKey){o.key=n.C0.ESC+"[Z";break}o.key=n.C0.HT,o.cancel=!0;break;case 13:o.key=h.altKey?n.C0.ESC+n.C0.CR:n.C0.CR,o.cancel=!0;break;case 27:o.key=n.C0.ESC,h.altKey&&(o.key=n.C0.ESC+n.C0.ESC),o.cancel=!0;break;case 37:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"D",o.key===n.C0.ESC+"[1;3D"&&(o.key=n.C0.ESC+(c?"b":"[1;5D"))):o.key=f?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"C",o.key===n.C0.ESC+"[1;3C"&&(o.key=n.C0.ESC+(c?"f":"[1;5C"))):o.key=f?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"A",c||o.key!==n.C0.ESC+"[1;3A"||(o.key=n.C0.ESC+"[1;5A")):o.key=f?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(h.metaKey)break;i?(o.key=n.C0.ESC+"[1;"+(i+1)+"B",c||o.key!==n.C0.ESC+"[1;3B"||(o.key=n.C0.ESC+"[1;5B")):o.key=f?n.C0.ESC+"OB":n.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(o.key=n.C0.ESC+"[2~");break;case 46:o.key=i?n.C0.ESC+"[3;"+(i+1)+"~":n.C0.ESC+"[3~";break;case 36:o.key=i?n.C0.ESC+"[1;"+(i+1)+"H":f?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:o.key=i?n.C0.ESC+"[1;"+(i+1)+"F":f?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:h.shiftKey?o.type=2:h.ctrlKey?o.key=n.C0.ESC+"[5;"+(i+1)+"~":o.key=n.C0.ESC+"[5~";break;case 34:h.shiftKey?o.type=3:h.ctrlKey?o.key=n.C0.ESC+"[6;"+(i+1)+"~":o.key=n.C0.ESC+"[6~";break;case 112:o.key=i?n.C0.ESC+"[1;"+(i+1)+"P":n.C0.ESC+"OP";break;case 113:o.key=i?n.C0.ESC+"[1;"+(i+1)+"Q":n.C0.ESC+"OQ";break;case 114:o.key=i?n.C0.ESC+"[1;"+(i+1)+"R":n.C0.ESC+"OR";break;case 115:o.key=i?n.C0.ESC+"[1;"+(i+1)+"S":n.C0.ESC+"OS";break;case 116:o.key=i?n.C0.ESC+"[15;"+(i+1)+"~":n.C0.ESC+"[15~";break;case 117:o.key=i?n.C0.ESC+"[17;"+(i+1)+"~":n.C0.ESC+"[17~";break;case 118:o.key=i?n.C0.ESC+"[18;"+(i+1)+"~":n.C0.ESC+"[18~";break;case 119:o.key=i?n.C0.ESC+"[19;"+(i+1)+"~":n.C0.ESC+"[19~";break;case 120:o.key=i?n.C0.ESC+"[20;"+(i+1)+"~":n.C0.ESC+"[20~";break;case 121:o.key=i?n.C0.ESC+"[21;"+(i+1)+"~":n.C0.ESC+"[21~";break;case 122:o.key=i?n.C0.ESC+"[23;"+(i+1)+"~":n.C0.ESC+"[23~";break;case 123:o.key=i?n.C0.ESC+"[24;"+(i+1)+"~":n.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(c&&!p||!h.altKey||h.metaKey)!c||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?o.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(o.key=n.C0.US),h.key==="@"&&(o.key=n.C0.NUL)):h.keyCode===65&&(o.type=1);else{let s=l[h.keyCode],e=s?.[h.shiftKey?1:0];if(e)o.key=n.C0.ESC+e;else if(h.keyCode>=65&&h.keyCode<=90){let t=h.ctrlKey?h.keyCode-64:h.keyCode+32,r=String.fromCharCode(t);h.shiftKey&&(r=r.toUpperCase()),o.key=n.C0.ESC+r}else if(h.keyCode===32)o.key=n.C0.ESC+(h.ctrlKey?n.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let t=h.code.slice(3,4);h.shiftKey||(t=t.toLowerCase()),o.key=n.C0.ESC+t,o.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?o.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?o.key=n.C0.NUL:h.keyCode>=51&&h.keyCode<=55?o.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?o.key=n.C0.DEL:h.keyCode===219?o.key=n.C0.ESC:h.keyCode===220?o.key=n.C0.FS:h.keyCode===221&&(o.key=n.C0.GS)}return o}},482:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Utf8ToUtf32=d.StringToUtf32=d.utf32ToString=d.stringFromCodePoint=void 0,d.stringFromCodePoint=function(_){return _>65535?(_-=65536,String.fromCharCode(55296+(_>>10))+String.fromCharCode(_%1024+56320)):String.fromCharCode(_)},d.utf32ToString=function(_,n=0,l=_.length){let h="";for(let f=n;f<l;++f){let c=_[f];c>65535?(c-=65536,h+=String.fromCharCode(55296+(c>>10))+String.fromCharCode(c%1024+56320)):h+=String.fromCharCode(c)}return h},d.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(_,n){let l=_.length;if(!l)return 0;let h=0,f=0;if(this._interim){let c=_.charCodeAt(f++);56320<=c&&c<=57343?n[h++]=1024*(this._interim-55296)+c-56320+65536:(n[h++]=this._interim,n[h++]=c),this._interim=0}for(let c=f;c<l;++c){let p=_.charCodeAt(c);if(55296<=p&&p<=56319){if(++c>=l)return this._interim=p,h;let o=_.charCodeAt(c);56320<=o&&o<=57343?n[h++]=1024*(p-55296)+o-56320+65536:(n[h++]=p,n[h++]=o)}else p!==65279&&(n[h++]=p)}return h}},d.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(_,n){let l=_.length;if(!l)return 0;let h,f,c,p,o=0,i=0,s=0;if(this.interim[0]){let r=!1,a=this.interim[0];a&=(224&a)==192?31:(240&a)==224?15:7;let u,g=0;for(;(u=63&this.interim[++g])&&g<4;)a<<=6,a|=u;let v=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,S=v-g;for(;s<S;){if(s>=l)return 0;if(u=_[s++],(192&u)!=128){s--,r=!0;break}this.interim[g++]=u,a<<=6,a|=63&u}r||(v===2?a<128?s--:n[o++]=a:v===3?a<2048||a>=55296&&a<=57343||a===65279||(n[o++]=a):a<65536||a>1114111||(n[o++]=a)),this.interim.fill(0)}let e=l-4,t=s;for(;t<l;){for(;!(!(t<e)||128&(h=_[t])||128&(f=_[t+1])||128&(c=_[t+2])||128&(p=_[t+3]));)n[o++]=h,n[o++]=f,n[o++]=c,n[o++]=p,t+=4;if(h=_[t++],h<128)n[o++]=h;else if((224&h)==192){if(t>=l)return this.interim[0]=h,o;if(f=_[t++],(192&f)!=128){t--;continue}if(i=(31&h)<<6|63&f,i<128){t--;continue}n[o++]=i}else if((240&h)==224){if(t>=l)return this.interim[0]=h,o;if(f=_[t++],(192&f)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=f,o;if(c=_[t++],(192&c)!=128){t--;continue}if(i=(15&h)<<12|(63&f)<<6|63&c,i<2048||i>=55296&&i<=57343||i===65279)continue;n[o++]=i}else if((248&h)==240){if(t>=l)return this.interim[0]=h,o;if(f=_[t++],(192&f)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=f,o;if(c=_[t++],(192&c)!=128){t--;continue}if(t>=l)return this.interim[0]=h,this.interim[1]=f,this.interim[2]=c,o;if(p=_[t++],(192&p)!=128){t--;continue}if(i=(7&h)<<18|(63&f)<<12|(63&c)<<6|63&p,i<65536||i>1114111)continue;n[o++]=i}}return o}}},225:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeV6=void 0;let n=_(1480),l=[[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]],h=[[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]],f;d.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let c=0;c<l.length;++c)f.fill(0,l[c][0],l[c][1]+1)}}wcwidth(c){return c<32?0:c<127?1:c<65536?f[c]:(function(p,o){let i,s=0,e=o.length-1;if(p<o[0][0]||p>o[e][1])return!1;for(;e>=s;)if(i=s+e>>1,p>o[i][1])s=i+1;else{if(!(p<o[i][0]))return!0;e=i-1}return!1})(c,h)?0:c>=131072&&c<=196605||c>=196608&&c<=262141?2:1}charProperties(c,p){let o=this.wcwidth(c),i=o===0&&p!==0;if(i){let s=n.UnicodeService.extractWidth(p);s===0?i=!1:s>o&&(o=s)}return n.UnicodeService.createPropertyValue(0,o,i)}}},5981:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.WriteBuffer=void 0;let n=_(8460),l=_(844);class h extends l.Disposable{constructor(c){super(),this._action=c,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(c,p){if(p!==void 0&&this._syncCalls>p)return void(this._syncCalls=0);if(this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let o;for(this._isSyncWriting=!0;o=this._writeBuffer.shift();){this._action(o);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(c,p){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+=c.length,this._writeBuffer.push(c),this._callbacks.push(p),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(p)}_innerWrite(c=0,p=!0){let o=c||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,p);if(s){let t=r=>Date.now()-o>=12?setTimeout((()=>this._innerWrite(0,r))):this._innerWrite(o,r);return void s.catch((r=>(queueMicrotask((()=>{throw r})),Promise.resolve(!1)))).then(t)}let e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=i.length,Date.now()-o>=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()}}d.WriteBuffer=h},5941:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.toRgbString=d.parseColor=void 0;let _=/^([\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})$/,n=/^[\da-f]+$/;function l(h,f){let c=h.toString(16),p=c.length<2?"0"+c:c;switch(f){case 4:return c[0];case 8:return p;case 12:return(p+p).slice(0,3);default:return p+p}}d.parseColor=function(h){if(!h)return;let f=h.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);let c=_.exec(f);if(c){let p=c[1]?15:c[4]?255:c[7]?4095:65535;return[Math.round(parseInt(c[1]||c[4]||c[7]||c[10],16)/p*255),Math.round(parseInt(c[2]||c[5]||c[8]||c[11],16)/p*255),Math.round(parseInt(c[3]||c[6]||c[9]||c[12],16)/p*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),n.exec(f)&&[3,6,9,12].includes(f.length))){let c=f.length/3,p=[0,0,0];for(let o=0;o<3;++o){let i=parseInt(f.slice(c*o,c*o+c),16);p[o]=c===1?i<<4:c===2?i:c===3?i>>4:i>>8}return p}},d.toRgbString=function(h,f=16){let[c,p,o]=h;return`rgb:${l(c,f)}/${l(p,f)}/${l(o,f)}`}},5770:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.PAYLOAD_LIMIT=void 0,d.PAYLOAD_LIMIT=1e7},6351:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DcsHandler=d.DcsParser=void 0;let n=_(482),l=_(8742),h=_(5770),f=[];d.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(o),{dispose:()=>{let s=i.indexOf(o);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}reset(){if(this._active.length)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(p,o){if(this.reset(),this._ident=p,this._active=this._handlers[p]||f,this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].hook(o);else this._handlerFb(this._ident,"HOOK",o)}put(p,o,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,o,i);else this._handlerFb(this._ident,"PUT",(0,n.utf32ToString)(p,o,i))}unhook(p,o=!0){if(this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=o,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].unhook(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].unhook(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._ident,"UNHOOK",p);this._active=f,this._ident=0}};let c=new l.Params;c.addParam(0),d.DcsHandler=class{constructor(p){this._handler=p,this._data="",this._params=c,this._hitLimit=!1}hook(p){this._params=p.length>1||p.params[0]?p.clone():c,this._data="",this._hitLimit=!1}put(p,o,i){this._hitLimit||(this._data+=(0,n.utf32ToString)(p,o,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data,this._params),o instanceof Promise))return o.then((i=>(this._params=c,this._data="",this._hitLimit=!1,i)));return this._params=c,this._data="",this._hitLimit=!1,o}}},2015:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.EscapeSequenceParser=d.VT500_TRANSITION_TABLE=d.TransitionTable=void 0;let n=_(844),l=_(8742),h=_(6242),f=_(6351);class c{constructor(s){this.table=new Uint8Array(s)}setDefault(s,e){this.table.fill(s<<4|e)}add(s,e,t,r){this.table[e<<8|s]=t<<4|r}addMany(s,e,t,r){for(let a=0;a<s.length;a++)this.table[e<<8|s[a]]=t<<4|r}}d.TransitionTable=c;let p=160;d.VT500_TRANSITION_TABLE=(function(){let i=new c(4095),s=Array.apply(null,Array(256)).map(((g,v)=>v)),e=(g,v)=>s.slice(g,v),t=e(32,127),r=e(0,24);r.push(25),r.push.apply(r,e(28,32));let a=e(0,14),u;for(u in i.setDefault(1,0),i.addMany(t,0,2,0),a)i.addMany([24,26,153,154],u,3,0),i.addMany(e(128,144),u,3,0),i.addMany(e(144,152),u,3,0),i.add(156,u,0,0),i.add(27,u,11,1),i.add(157,u,4,8),i.addMany([152,158,159],u,0,7),i.add(155,u,11,3),i.add(144,u,11,9);return i.addMany(r,0,3,0),i.addMany(r,1,3,1),i.add(127,1,0,1),i.addMany(r,8,0,8),i.addMany(r,3,3,3),i.add(127,3,0,3),i.addMany(r,4,3,4),i.add(127,4,0,4),i.addMany(r,6,3,6),i.addMany(r,5,3,5),i.add(127,5,0,5),i.addMany(r,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(t,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(e(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(t,7,0,7),i.addMany(r,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(e(64,127),3,7,0),i.addMany(e(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(e(48,60),4,8,4),i.addMany(e(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(e(32,64),6,0,6),i.add(127,6,0,6),i.addMany(e(64,127),6,0,0),i.addMany(e(32,48),3,9,5),i.addMany(e(32,48),5,9,5),i.addMany(e(48,64),5,0,6),i.addMany(e(64,127),5,7,0),i.addMany(e(32,48),4,9,5),i.addMany(e(32,48),1,9,2),i.addMany(e(32,48),2,9,2),i.addMany(e(48,127),2,10,0),i.addMany(e(48,80),1,10,0),i.addMany(e(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(e(96,127),1,10,0),i.add(80,1,11,9),i.addMany(r,9,0,9),i.add(127,9,0,9),i.addMany(e(28,32),9,0,9),i.addMany(e(32,48),9,9,12),i.addMany(e(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(r,11,0,11),i.addMany(e(32,128),11,0,11),i.addMany(e(28,32),11,0,11),i.addMany(r,10,0,10),i.add(127,10,0,10),i.addMany(e(28,32),10,0,10),i.addMany(e(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(e(32,48),10,9,12),i.addMany(r,12,0,12),i.add(127,12,0,12),i.addMany(e(28,32),12,0,12),i.addMany(e(32,48),12,9,12),i.addMany(e(48,64),12,0,11),i.addMany(e(64,127),12,12,13),i.addMany(e(64,127),10,12,13),i.addMany(e(64,127),9,12,13),i.addMany(r,13,13,13),i.addMany(t,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(p,0,2,0),i.add(p,8,5,8),i.add(p,6,0,6),i.add(p,11,0,11),i.add(p,13,13,13),i})();class o extends n.Disposable{constructor(s=d.VT500_TRANSITION_TABLE){super(),this._transitions=s,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new l.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,n.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(s,e=[64,126]){let t=0;if(s.prefix){if(s.prefix.length>1)throw new Error("only one byte as prefix supported");if(t=s.prefix.charCodeAt(0),t&&60>t||t>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(s.intermediates){if(s.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let a=0;a<s.intermediates.length;++a){let u=s.intermediates.charCodeAt(a);if(32>u||u>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");t<<=8,t|=u}}if(s.final.length!==1)throw new Error("final must be a single byte");let r=s.final.charCodeAt(0);if(e[0]>r||r>e[1])throw new Error(`final must be in range ${e[0]} .. ${e[1]}`);return t<<=8,t|=r,t}identToString(s){let e=[];for(;s;)e.push(String.fromCharCode(255&s)),s>>=8;return e.reverse().join("")}setPrintHandler(s){this._printHandler=s}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(s,e){let t=this._identifier(s,[48,126]);this._escHandlers[t]===void 0&&(this._escHandlers[t]=[]);let r=this._escHandlers[t];return r.push(e),{dispose:()=>{let a=r.indexOf(e);a!==-1&&r.splice(a,1)}}}clearEscHandler(s){this._escHandlers[this._identifier(s,[48,126])]&&delete this._escHandlers[this._identifier(s,[48,126])]}setEscHandlerFallback(s){this._escHandlerFb=s}setExecuteHandler(s,e){this._executeHandlers[s.charCodeAt(0)]=e}clearExecuteHandler(s){this._executeHandlers[s.charCodeAt(0)]&&delete this._executeHandlers[s.charCodeAt(0)]}setExecuteHandlerFallback(s){this._executeHandlerFb=s}registerCsiHandler(s,e){let t=this._identifier(s);this._csiHandlers[t]===void 0&&(this._csiHandlers[t]=[]);let r=this._csiHandlers[t];return r.push(e),{dispose:()=>{let a=r.indexOf(e);a!==-1&&r.splice(a,1)}}}clearCsiHandler(s){this._csiHandlers[this._identifier(s)]&&delete this._csiHandlers[this._identifier(s)]}setCsiHandlerFallback(s){this._csiHandlerFb=s}registerDcsHandler(s,e){return this._dcsParser.registerHandler(this._identifier(s),e)}clearDcsHandler(s){this._dcsParser.clearHandler(this._identifier(s))}setDcsHandlerFallback(s){this._dcsParser.setHandlerFallback(s)}registerOscHandler(s,e){return this._oscParser.registerHandler(s,e)}clearOscHandler(s){this._oscParser.clearHandler(s)}setOscHandlerFallback(s){this._oscParser.setHandlerFallback(s)}setErrorHandler(s){this._errorHandler=s}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(s,e,t,r,a){this._parseStack.state=s,this._parseStack.handlers=e,this._parseStack.handlerPos=t,this._parseStack.transition=r,this._parseStack.chunkPos=a}parse(s,e,t){let r,a=0,u=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(t===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let v=this._parseStack.handlers,S=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(t===!1&&S>-1){for(;S>=0&&(r=v[S](this._params),r!==!0);S--)if(r instanceof Promise)return this._parseStack.handlerPos=S,r}this._parseStack.handlers=[];break;case 4:if(t===!1&&S>-1){for(;S>=0&&(r=v[S](),r!==!0);S--)if(r instanceof Promise)return this._parseStack.handlerPos=S,r}this._parseStack.handlers=[];break;case 6:if(a=s[this._parseStack.chunkPos],r=this._dcsParser.unhook(a!==24&&a!==26,t),r)return r;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(a=s[this._parseStack.chunkPos],r=this._oscParser.end(a!==24&&a!==26,t),r)return r;a===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let v=g;v<e;++v){switch(a=s[v],u=this._transitions.table[this.currentState<<8|(a<160?a:p)],u>>4){case 2:for(let E=v+1;;++E){if(E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}if(++E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}if(++E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}if(++E>=e||(a=s[E])<32||a>126&&a<p){this._printHandler(s,v,E),v=E-1;break}}break;case 3:this._executeHandlers[a]?this._executeHandlers[a]():this._executeHandlerFb(a),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:v,code:a,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let S=this._csiHandlers[this._collect<<8|a],y=S?S.length-1:-1;for(;y>=0&&(r=S[y](this._params),r!==!0);y--)if(r instanceof Promise)return this._preserveStack(3,S,y,u,v),r;y<0&&this._csiHandlerFb(this._collect<<8|a,this._params),this.precedingJoinState=0;break;case 8:do switch(a){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(a-48)}while(++v<e&&(a=s[v])>47&&a<60);v--;break;case 9:this._collect<<=8,this._collect|=a;break;case 10:let B=this._escHandlers[this._collect<<8|a],M=B?B.length-1:-1;for(;M>=0&&(r=B[M](),r!==!0);M--)if(r instanceof Promise)return this._preserveStack(4,B,M,u,v),r;M<0&&this._escHandlerFb(this._collect<<8|a),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|a,this._params);break;case 13:for(let E=v+1;;++E)if(E>=e||(a=s[E])===24||a===26||a===27||a>127&&a<p){this._dcsParser.put(s,v,E),v=E-1;break}break;case 14:if(r=this._dcsParser.unhook(a!==24&&a!==26),r)return this._preserveStack(6,[],0,u,v),r;a===27&&(u|=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 E=v+1;;E++)if(E>=e||(a=s[E])<32||a>127&&a<p){this._oscParser.put(s,v,E),v=E-1;break}break;case 6:if(r=this._oscParser.end(a!==24&&a!==26),r)return this._preserveStack(5,[],0,u,v),r;a===27&&(u|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&u}}}d.EscapeSequenceParser=o},6242:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.OscHandler=d.OscParser=void 0;let n=_(5770),l=_(482),h=[];d.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,c){this._handlers[f]===void 0&&(this._handlers[f]=[]);let p=this._handlers[f];return p.push(c),{dispose:()=>{let o=p.indexOf(c);o!==-1&&p.splice(o,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,c,p){if(this._active.length)for(let o=this._active.length-1;o>=0;o--)this._active[o].put(f,c,p);else this._handlerFb(this._id,"PUT",(0,l.utf32ToString)(f,c,p))}start(){this.reset(),this._state=1}put(f,c,p){if(this._state!==3){if(this._state===1)for(;c<p;){let o=f[c++];if(o===59){this._state=2,this._start();break}if(o<48||57<o)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+o-48}this._state===2&&p-c>0&&this._put(f,c,p)}}end(f,c=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let p=!1,o=this._active.length-1,i=!1;if(this._stack.paused&&(o=this._stack.loopPosition-1,p=c,i=this._stack.fallThrough,this._stack.paused=!1),!i&&p===!1){for(;o>=0&&(p=this._active[o].end(f),p!==!0);o--)if(p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!1,p;o--}for(;o>=0;o--)if(p=this._active[o].end(!1),p instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=o,this._stack.fallThrough=!0,p}else this._handlerFb(this._id,"END",f);this._active=h,this._id=-1,this._state=0}}},d.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,c,p){this._hitLimit||(this._data+=(0,l.utf32ToString)(f,c,p),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let c=!1;if(this._hitLimit)c=!1;else if(f&&(c=this._handler(this._data),c instanceof Promise))return c.then((p=>(this._data="",this._hitLimit=!1,p)));return this._data="",this._hitLimit=!1,c}}},8742:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.Params=void 0;let _=2147483647;class n{static fromArray(h){let f=new n;if(!h.length)return f;for(let c=Array.isArray(h[0])?1:0;c<h.length;++c){let p=h[c];if(Array.isArray(p))for(let o=0;o<p.length;++o)f.addSubParam(p[o]);else f.addParam(p)}return f}constructor(h=32,f=32){if(this.maxLength=h,this.maxSubParamsLength=f,f>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let h=new n(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){let h=[];for(let f=0;f<this.length;++f){h.push(this.params[f]);let c=this._subParamsIdx[f]>>8,p=255&this._subParamsIdx[f];p-c>0&&h.push(Array.prototype.slice.call(this._subParams,c,p))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>_?_:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>_?_:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){let f=this._subParamsIdx[h]>>8,c=255&this._subParamsIdx[h];return c-f>0?this._subParams.subarray(f,c):null}getSubParamsAll(){let h={};for(let f=0;f<this.length;++f){let c=this._subParamsIdx[f]>>8,p=255&this._subParamsIdx[f];p-c>0&&(h[f]=this._subParams.slice(c,p))}return h}addDigit(h){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let c=this._digitIsSub?this._subParams:this.params,p=c[f-1];c[f-1]=~p?Math.min(10*p+h,_):h}}d.Params=n},5741:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.AddonManager=void 0,d.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let _=this._addons.length-1;_>=0;_--)this._addons[_].instance.dispose()}loadAddon(_,n){let l={instance:n,dispose:n.dispose,isDisposed:!1};this._addons.push(l),n.dispose=()=>this._wrappedAddonDispose(l),n.activate(_)}_wrappedAddonDispose(_){if(_.isDisposed)return;let n=-1;for(let l=0;l<this._addons.length;l++)if(this._addons[l]===_){n=l;break}if(n===-1)throw new Error("Could not dispose an addon that has not been loaded");_.isDisposed=!0,_.dispose.apply(_.instance),this._addons.splice(n,1)}}},8771:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferApiView=void 0;let n=_(3785),l=_(511);d.BufferApiView=class{constructor(h,f){this._buffer=h,this.type=f}init(h){return this._buffer=h,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(h){let f=this._buffer.lines.get(h);if(f)return new n.BufferLineApiView(f)}getNullCell(){return new l.CellData}}},3785:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferLineApiView=void 0;let n=_(511);d.BufferLineApiView=class{constructor(l){this._line=l}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(l,h){if(!(l<0||l>=this._line.length))return h?(this._line.loadCell(l,h),h):this._line.loadCell(l,new n.CellData)}translateToString(l,h,f){return this._line.translateToString(l,h,f)}}},8285:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.BufferNamespaceApi=void 0;let n=_(8771),l=_(8460),h=_(844);class f extends h.Disposable{constructor(p){super(),this._core=p,this._onBufferChange=this.register(new l.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new n.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new n.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)}}d.BufferNamespaceApi=f},7975:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.ParserApi=void 0,d.ParserApi=class{constructor(_){this._core=_}registerCsiHandler(_,n){return this._core.registerCsiHandler(_,(l=>n(l.toArray())))}addCsiHandler(_,n){return this.registerCsiHandler(_,n)}registerDcsHandler(_,n){return this._core.registerDcsHandler(_,((l,h)=>n(l,h.toArray())))}addDcsHandler(_,n){return this.registerDcsHandler(_,n)}registerEscHandler(_,n){return this._core.registerEscHandler(_,n)}addEscHandler(_,n){return this.registerEscHandler(_,n)}registerOscHandler(_,n){return this._core.registerOscHandler(_,n)}addOscHandler(_,n){return this.registerOscHandler(_,n)}}},7090:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeApi=void 0,d.UnicodeApi=class{constructor(_){this._core=_}register(_){this._core.unicodeService.register(_)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(_){this._core.unicodeService.activeVersion=_}}},744:function(P,d,_){var n=this&&this.__decorate||function(i,s,e,t){var r,a=arguments.length,u=a<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(r=i[g])&&(u=(a<3?r(u):a>3?r(s,e,u):r(s,e))||u);return a>3&&u&&Object.defineProperty(s,e,u),u},l=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(d,"__esModule",{value:!0}),d.BufferService=d.MINIMUM_ROWS=d.MINIMUM_COLS=void 0;let h=_(8460),f=_(844),c=_(5295),p=_(2585);d.MINIMUM_COLS=2,d.MINIMUM_ROWS=1;let o=d.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(i){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,d.MINIMUM_COLS),this.rows=Math.max(i.rawOptions.rows||0,d.MINIMUM_ROWS),this.buffers=this.register(new c.BufferSet(i,this))}resize(i,s){this.cols=i,this.rows=s,this.buffers.resize(i,s),this._onResize.fire({cols:i,rows:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,s=!1){let e=this.buffer,t;t=this._cachedBlankLine,t&&t.length===this.cols&&t.getFg(0)===i.fg&&t.getBg(0)===i.bg||(t=e.getBlankLine(i,s),this._cachedBlankLine=t),t.isWrapped=s;let r=e.ybase+e.scrollTop,a=e.ybase+e.scrollBottom;if(e.scrollTop===0){let u=e.lines.isFull;a===e.lines.length-1?u?e.lines.recycle().copyFrom(t):e.lines.push(t.clone()):e.lines.splice(a+1,0,t.clone()),u?this.isUserScrolling&&(e.ydisp=Math.max(e.ydisp-1,0)):(e.ybase++,this.isUserScrolling||e.ydisp++)}else{let u=a-r+1;e.lines.shiftElements(r+1,u-1,-1),e.lines.set(a,t.clone())}this.isUserScrolling||(e.ydisp=e.ybase),this._onScroll.fire(e.ydisp)}scrollLines(i,s,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let r=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),r!==t.ydisp&&(s||this._onScroll.fire(t.ydisp))}};d.BufferService=o=n([l(0,p.IOptionsService)],o)},7994:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.CharsetService=void 0,d.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(_){this.glevel=_,this.charset=this._charsets[_]}setgCharset(_,n){this._charsets[_]=n,this.glevel===_&&(this.charset=n)}}},1753:function(P,d,_){var n=this&&this.__decorate||function(t,r,a,u){var g,v=arguments.length,S=v<3?r:u===null?u=Object.getOwnPropertyDescriptor(r,a):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(t,r,a,u);else for(var y=t.length-1;y>=0;y--)(g=t[y])&&(S=(v<3?g(S):v>3?g(r,a,S):g(r,a))||S);return v>3&&S&&Object.defineProperty(r,a,S),S},l=this&&this.__param||function(t,r){return function(a,u){r(a,u,t)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CoreMouseService=void 0;let h=_(2585),f=_(8460),c=_(844),p={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function o(t,r){let a=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(a|=64,a|=t.action):(a|=3&t.button,4&t.button&&(a|=64),8&t.button&&(a|=128),t.action===32?a|=32:t.action!==0||r||(a|=3)),a}let i=String.fromCharCode,s={DEFAULT:t=>{let r=[o(t,!1)+32,t.col+32,t.row+32];return r[0]>255||r[1]>255||r[2]>255?"":`\x1B[M${i(r[0])}${i(r[1])}${i(r[2])}`},SGR:t=>{let r=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${o(t,!0)};${t.col};${t.row}${r}`},SGR_PIXELS:t=>{let r=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${o(t,!0)};${t.x};${t.y}${r}`}},e=d.CoreMouseService=class extends c.Disposable{constructor(t,r){super(),this._bufferService=t,this._coreService=r,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let a of Object.keys(p))this.addProtocol(a,p[a]);for(let a of Object.keys(s))this.addEncoding(a,s[a]);this.reset()}addProtocol(t,r){this._protocols[t]=r}addEncoding(t,r){this._encodings[t]=r}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;let r=this._encodings[this._activeEncoding](t);return r&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(r):this._coreService.triggerDataEvent(r,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,r,a){if(a){if(t.x!==r.x||t.y!==r.y)return!1}else if(t.col!==r.col||t.row!==r.row)return!1;return t.button===r.button&&t.action===r.action&&t.ctrl===r.ctrl&&t.alt===r.alt&&t.shift===r.shift}};d.CoreMouseService=e=n([l(0,h.IBufferService),l(1,h.ICoreService)],e)},6975:function(P,d,_){var n=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},l=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(d,"__esModule",{value:!0}),d.CoreService=void 0;let h=_(1439),f=_(8460),c=_(844),p=_(2585),o=Object.freeze({insertMode:!1}),i=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),s=d.CoreService=class extends c.Disposable{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(o),this.decPrivateModes=(0,h.clone)(i)}reset(){this.modes=(0,h.clone)(o),this.decPrivateModes=(0,h.clone)(i)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,(()=>e.split("").map((a=>a.charCodeAt(0))))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,(()=>e.split("").map((t=>t.charCodeAt(0))))),this._onBinary.fire(e))}};d.CoreService=s=n([l(0,p.IBufferService),l(1,p.ILogService),l(2,p.IOptionsService)],s)},9074:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.DecorationService=void 0;let n=_(8055),l=_(8460),h=_(844),f=_(6106),c=0,p=0;class o extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList((e=>e?.marker.line)),this._onDecorationRegistered=this.register(new l.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new l.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(e){if(e.marker.isDisposed)return;let t=new i(e);if(t){let r=t.marker.onDispose((()=>t.dispose()));t.onDispose((()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),r.dispose())})),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){let a=0,u=0;for(let g of this._decorations.getKeyIterator(t))a=g.options.x??0,u=a+(g.options.width??1),e>=a&&e<u&&(!r||(g.options.layer??"bottom")===r)&&(yield g)}forEachDecorationAtCell(e,t,r,a){this._decorations.forEachByKey(t,(u=>{c=u.options.x??0,p=c+(u.options.width??1),e>=c&&e<p&&(!r||(u.options.layer??"bottom")===r)&&a(u)}))}}d.DecorationService=o;class i extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=n.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=n.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new l.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.InstantiationService=d.ServiceCollection=void 0;let n=_(2585),l=_(8343);class h{constructor(...c){this._entries=new Map;for(let[p,o]of c)this.set(p,o)}set(c,p){let o=this._entries.get(c);return this._entries.set(c,p),o}forEach(c){for(let[p,o]of this._entries.entries())c(p,o)}has(c){return this._entries.has(c)}get(c){return this._entries.get(c)}}d.ServiceCollection=h,d.InstantiationService=class{constructor(){this._services=new h,this._services.set(n.IInstantiationService,this)}setService(f,c){this._services.set(f,c)}getService(f){return this._services.get(f)}createInstance(f,...c){let p=(0,l.getServiceDependencies)(f).sort(((s,e)=>s.index-e.index)),o=[];for(let s of p){let e=this._services.get(s.id);if(!e)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${s.id}.`);o.push(e)}let i=p.length>0?p[0].index:c.length;if(c.length!==i)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${i+1} conflicts with ${c.length} static arguments`);return new f(...c,...o)}}},7866:function(P,d,_){var n=this&&this.__decorate||function(i,s,e,t){var r,a=arguments.length,u=a<3?s:t===null?t=Object.getOwnPropertyDescriptor(s,e):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(i,s,e,t);else for(var g=i.length-1;g>=0;g--)(r=i[g])&&(u=(a<3?r(u):a>3?r(s,e,u):r(s,e))||u);return a>3&&u&&Object.defineProperty(s,e,u),u},l=this&&this.__param||function(i,s){return function(e,t){s(e,t,i)}};Object.defineProperty(d,"__esModule",{value:!0}),d.traceCall=d.setTraceLogger=d.LogService=void 0;let h=_(844),f=_(2585),c={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF},p,o=d.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(i){super(),this._optionsService=i,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),p=this}_updateLogLevel(){this._logLevel=c[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let s=0;s<i.length;s++)typeof i[s]=="function"&&(i[s]=i[s]())}_log(i,s,e){this._evalLazyOptionalParams(e),i.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+s,...e)}trace(i,...s){this._logLevel<=f.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,i,s)}debug(i,...s){this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,i,s)}info(i,...s){this._logLevel<=f.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,i,s)}warn(i,...s){this._logLevel<=f.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,i,s)}error(i,...s){this._logLevel<=f.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,i,s)}};d.LogService=o=n([l(0,f.IOptionsService)],o),d.setTraceLogger=function(i){p=i},d.traceCall=function(i,s,e){if(typeof e.value!="function")throw new Error("not supported");let t=e.value;e.value=function(...r){if(p.logLevel!==f.LogLevelEnum.TRACE)return t.apply(this,r);p.trace(`GlyphRenderer#${t.name}(${r.map((u=>JSON.stringify(u))).join(", ")})`);let a=t.apply(this,r);return p.trace(`GlyphRenderer#${t.name} return`,a),a}}},7302:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.OptionsService=d.DEFAULT_OPTIONS=void 0;let n=_(8460),l=_(844),h=_(6114);d.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:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let f=["normal","bold","100","200","300","400","500","600","700","800","900"];class c extends l.Disposable{constructor(o){super(),this._onOptionChange=this.register(new n.EventEmitter),this.onOptionChange=this._onOptionChange.event;let i={...d.DEFAULT_OPTIONS};for(let s in o)if(s in i)try{let e=o[s];i[s]=this._sanitizeAndValidateOption(s,e)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this.register((0,l.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(o,i){return this.onOptionChange((s=>{s===o&&i(this.rawOptions[o])}))}onMultipleOptionChange(o,i){return this.onOptionChange((s=>{o.indexOf(s)!==-1&&i()}))}_setupOptions(){let o=s=>{if(!(s in d.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},i=(s,e)=>{if(!(s in d.DEFAULT_OPTIONS))throw new Error(`No option with key "${s}"`);e=this._sanitizeAndValidateOption(s,e),this.rawOptions[s]!==e&&(this.rawOptions[s]=e,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let e={get:o.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,e)}}_sanitizeAndValidateOption(o,i){switch(o){case"cursorStyle":if(i||(i=d.DEFAULT_OPTIONS[o]),!(function(s){return s==="block"||s==="underline"||s==="bar"})(i))throw new Error(`"${i}" is not a valid value for ${o}`);break;case"wordSeparator":i||(i=d.DEFAULT_OPTIONS[o]);break;case"fontWeight":case"fontWeightBold":if(typeof i=="number"&&1<=i&&i<=1e3)break;i=f.includes(i)?i:d.DEFAULT_OPTIONS[o];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw new Error(`${o} cannot be less than 1, value: ${i}`);break;case"minimumContrastRatio":i=Math.max(1,Math.min(21,Math.round(10*i)/10));break;case"scrollback":if((i=Math.min(i,4294967295))<0)throw new Error(`${o} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw new Error(`${o} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&i!==0)throw new Error(`${o} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}}d.OptionsService=c},2660:function(P,d,_){var n=this&&this.__decorate||function(c,p,o,i){var s,e=arguments.length,t=e<3?p:i===null?i=Object.getOwnPropertyDescriptor(p,o):i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(c,p,o,i);else for(var r=c.length-1;r>=0;r--)(s=c[r])&&(t=(e<3?s(t):e>3?s(p,o,t):s(p,o))||t);return e>3&&t&&Object.defineProperty(p,o,t),t},l=this&&this.__param||function(c,p){return function(o,i){p(o,i,c)}};Object.defineProperty(d,"__esModule",{value:!0}),d.OscLinkService=void 0;let h=_(2585),f=d.OscLinkService=class{constructor(c){this._bufferService=c,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(c){let p=this._bufferService.buffer;if(c.id===void 0){let r=p.addMarker(p.ybase+p.y),a={data:c,id:this._nextId++,lines:[r]};return r.onDispose((()=>this._removeMarkerFromLink(a,r))),this._dataByLinkId.set(a.id,a),a.id}let o=c,i=this._getEntryIdKey(o),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,p.ybase+p.y),s.id;let e=p.addMarker(p.ybase+p.y),t={id:this._nextId++,key:this._getEntryIdKey(o),data:o,lines:[e]};return e.onDispose((()=>this._removeMarkerFromLink(t,e))),this._entriesWithId.set(t.key,t),this._dataByLinkId.set(t.id,t),t.id}addLineToLink(c,p){let o=this._dataByLinkId.get(c);if(o&&o.lines.every((i=>i.line!==p))){let i=this._bufferService.buffer.addMarker(p);o.lines.push(i),i.onDispose((()=>this._removeMarkerFromLink(o,i)))}}getLinkData(c){return this._dataByLinkId.get(c)?.data}_getEntryIdKey(c){return`${c.id};;${c.uri}`}_removeMarkerFromLink(c,p){let o=c.lines.indexOf(p);o!==-1&&(c.lines.splice(o,1),c.lines.length===0&&(c.data.id!==void 0&&this._entriesWithId.delete(c.key),this._dataByLinkId.delete(c.id)))}};d.OscLinkService=f=n([l(0,h.IBufferService)],f)},8343:(P,d)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.createDecorator=d.getServiceDependencies=d.serviceRegistry=void 0;let _="di$target",n="di$dependencies";d.serviceRegistry=new Map,d.getServiceDependencies=function(l){return l[n]||[]},d.createDecorator=function(l){if(d.serviceRegistry.has(l))return d.serviceRegistry.get(l);let h=function(f,c,p){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,i,s){i[_]===i?i[n].push({id:o,index:s}):(i[n]=[{id:o,index:s}],i[_]=i)})(h,f,p)};return h.toString=()=>l,d.serviceRegistry.set(l,h),h}},2585:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.IDecorationService=d.IUnicodeService=d.IOscLinkService=d.IOptionsService=d.ILogService=d.LogLevelEnum=d.IInstantiationService=d.ICharsetService=d.ICoreService=d.ICoreMouseService=d.IBufferService=void 0;let n=_(8343);var l;d.IBufferService=(0,n.createDecorator)("BufferService"),d.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),d.ICoreService=(0,n.createDecorator)("CoreService"),d.ICharsetService=(0,n.createDecorator)("CharsetService"),d.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(l||(d.LogLevelEnum=l={})),d.ILogService=(0,n.createDecorator)("LogService"),d.IOptionsService=(0,n.createDecorator)("OptionsService"),d.IOscLinkService=(0,n.createDecorator)("OscLinkService"),d.IUnicodeService=(0,n.createDecorator)("UnicodeService"),d.IDecorationService=(0,n.createDecorator)("DecorationService")},1480:(P,d,_)=>{Object.defineProperty(d,"__esModule",{value:!0}),d.UnicodeService=void 0;let n=_(8460),l=_(225);class h{static extractShouldJoin(c){return(1&c)!=0}static extractWidth(c){return c>>1&3}static extractCharKind(c){return c>>3}static createPropertyValue(c,p,o=!1){return(16777215&c)<<3|(3&p)<<1|(o?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter,this.onChange=this._onChange.event;let c=new l.UnicodeV6;this.register(c),this._active=c.version,this._activeProvider=c}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(c){if(!this._providers[c])throw new Error(`unknown Unicode version "${c}"`);this._active=c,this._activeProvider=this._providers[c],this._onChange.fire(c)}register(c){this._providers[c.version]=c}wcwidth(c){return this._activeProvider.wcwidth(c)}getStringCellWidth(c){let p=0,o=0,i=c.length;for(let s=0;s<i;++s){let e=c.charCodeAt(s);if(55296<=e&&e<=56319){if(++s>=i)return p+this.wcwidth(e);let a=c.charCodeAt(s);56320<=a&&a<=57343?e=1024*(e-55296)+a-56320+65536:p+=this.wcwidth(a)}let t=this.charProperties(e,o),r=h.extractWidth(t);h.extractShouldJoin(t)&&(r-=h.extractWidth(o)),p+=r,o=t}return p}charProperties(c,p){return this._activeProvider.charProperties(c,p)}}d.UnicodeService=h}},R={};function W(P){var d=R[P];if(d!==void 0)return d.exports;var _=R[P]={exports:{}};return T[P].call(_.exports,_,_.exports,W),_.exports}var $={};return(()=>{var P=$;Object.defineProperty(P,"__esModule",{value:!0}),P.Terminal=void 0;let d=W(9042),_=W(3236),n=W(844),l=W(5741),h=W(8285),f=W(7975),c=W(7090),p=["cols","rows"];class o extends n.Disposable{constructor(s){super(),this._core=this.register(new _.Terminal(s)),this._addonManager=this.register(new l.AddonManager),this._publicOptions={...this._core.options};let e=r=>this._core.options[r],t=(r,a)=>{this._checkReadonlyOptions(r),this._core.options[r]=a};for(let r in this._core.options){let a={get:e.bind(this,r),set:t.bind(this,r)};Object.defineProperty(this._publicOptions,r,a)}}_checkReadonlyOptions(s){if(p.includes(s))throw new Error(`Option "${s}" 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 f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.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 h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let s=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any"}return{applicationCursorKeysMode:s.applicationCursorKeys,applicationKeypadMode:s.applicationKeypad,bracketedPasteMode:s.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:s.origin,reverseWraparoundMode:s.reverseWraparound,sendFocusMode:s.sendFocus,wraparoundMode:s.wraparound}}get options(){return this._publicOptions}set options(s){for(let e in s)this._publicOptions[e]=s[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(s,e=!0){this._core.input(s,e)}resize(s,e){this._verifyIntegers(s,e),this._core.resize(s,e)}open(s){this._core.open(s)}attachCustomKeyEventHandler(s){this._core.attachCustomKeyEventHandler(s)}attachCustomWheelEventHandler(s){this._core.attachCustomWheelEventHandler(s)}registerLinkProvider(s){return this._core.registerLinkProvider(s)}registerCharacterJoiner(s){return this._checkProposedApi(),this._core.registerCharacterJoiner(s)}deregisterCharacterJoiner(s){this._checkProposedApi(),this._core.deregisterCharacterJoiner(s)}registerMarker(s=0){return this._verifyIntegers(s),this._core.registerMarker(s)}registerDecoration(s){return this._checkProposedApi(),this._verifyPositiveIntegers(s.x??0,s.width??0,s.height??0),this._core.registerDecoration(s)}hasSelection(){return this._core.hasSelection()}select(s,e,t){this._verifyIntegers(s,e,t),this._core.select(s,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(s,e){this._verifyIntegers(s,e),this._core.selectLines(s,e)}dispose(){super.dispose()}scrollLines(s){this._verifyIntegers(s),this._core.scrollLines(s)}scrollPages(s){this._verifyIntegers(s),this._core.scrollPages(s)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(s){this._verifyIntegers(s),this._core.scrollToLine(s)}clear(){this._core.clear()}write(s,e){this._core.write(s,e)}writeln(s,e){this._core.write(s),this._core.write(`\r
9
9
  `,e)}paste(s){this._core.paste(s)}refresh(s,e){this._verifyIntegers(s,e),this._core.refresh(s,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(s){this._addonManager.loadAddon(this,s)}static get strings(){return d}_verifyIntegers(...s){for(let e of s)if(e===1/0||isNaN(e)||e%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...s){for(let e of s)if(e&&(e===1/0||isNaN(e)||e%1!=0||e<0))throw new Error("This API only accepts positive integers")}}P.Terminal=o})(),$})()))});var ft=ct(ut=>{(()=>{"use strict";var T={349:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CircularList=void 0;let h=l(460),f=l(844);class c extends f.Disposable{constructor(o){super(),this._maxLength=o,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(o){if(this._maxLength===o)return;let i=new Array(o);for(let s=0;s<Math.min(o,this.length);s++)i[s]=this._array[this._getCyclicIndex(s)];this._array=i,this._maxLength=o,this._startIndex=0}get length(){return this._length}set length(o){if(o>this._length)for(let i=this._length;i<o;i++)this._array[i]=void 0;this._length=o}get(o){return this._array[this._getCyclicIndex(o)]}set(o,i){this._array[this._getCyclicIndex(o)]=i}push(o){this._array[this._getCyclicIndex(this._length)]=o,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(o,i,...s){if(i){for(let e=o;e<this._length-i;e++)this._array[this._getCyclicIndex(e)]=this._array[this._getCyclicIndex(e+i)];this._length-=i,this.onDeleteEmitter.fire({index:o,amount:i})}for(let e=this._length-1;e>=o;e--)this._array[this._getCyclicIndex(e+s.length)]=this._array[this._getCyclicIndex(e)];for(let e=0;e<s.length;e++)this._array[this._getCyclicIndex(o+e)]=s[e];if(s.length&&this.onInsertEmitter.fire({index:o,amount:s.length}),this._length+s.length>this._maxLength){let e=this._length+s.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=s.length}trimStart(o){o>this._length&&(o=this._length),this._startIndex+=o,this._length-=o,this.onTrimEmitter.fire(o)}shiftElements(o,i,s){if(!(i<=0)){if(o<0||o>=this._length)throw new Error("start argument out of range");if(o+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let t=i-1;t>=0;t--)this.set(o+t+s,this.get(o+t));let e=o+i+s-this._length;if(e>0)for(this._length+=e;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let e=0;e<i;e++)this.set(o+e+s,this.get(o+e))}}_getCyclicIndex(o){return(this._startIndex+o)%this._maxLength}}n.CircularList=c},439:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.clone=void 0,n.clone=function l(h,f=5){if(typeof h!="object")return h;let c=Array.isArray(h)?[]:{};for(let p in h)c[p]=f<=1?h[p]:h[p]&&l(h[p],f-1);return c}},969:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CoreTerminal=void 0;let h=l(844),f=l(585),c=l(348),p=l(866),o=l(744),i=l(302),s=l(83),e=l(460),t=l(753),r=l(480),a=l(994),u=l(282),g=l(435),v=l(981),S=l(660),y=!1;class B extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new e.EventEmitter),this._onScroll.event((E=>{this._onScrollApi?.fire(E.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(E){for(let x in E)this.optionsService.options[x]=E[x]}constructor(E){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new e.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new e.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new e.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new e.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new e.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new e.EventEmitter),this._instantiationService=new c.InstantiationService,this.optionsService=this.register(new i.OptionsService(E)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(o.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(s.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(t.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(r.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(a.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(S.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((x=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((x=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new v.WriteBuffer(((x,O)=>this._inputHandler.parse(x,O)))),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(E,x){this._writeBuffer.write(E,x)}writeSync(E,x){this._logService.logLevel<=f.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(E,x)}input(E,x=!0){this.coreService.triggerDataEvent(E,x)}resize(E,x){isNaN(E)||isNaN(x)||(E=Math.max(E,o.MINIMUM_COLS),x=Math.max(x,o.MINIMUM_ROWS),this._bufferService.resize(E,x))}scroll(E,x=!1){this._bufferService.scroll(E,x)}scrollLines(E,x,O){this._bufferService.scrollLines(E,x,O)}scrollPages(E){this.scrollLines(E*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(E){let x=E-this._bufferService.buffer.ydisp;x!==0&&this.scrollLines(x)}registerEscHandler(E,x){return this._inputHandler.registerEscHandler(E,x)}registerDcsHandler(E,x){return this._inputHandler.registerDcsHandler(E,x)}registerCsiHandler(E,x){return this._inputHandler.registerCsiHandler(E,x)}registerOscHandler(E,x){return this._inputHandler.registerOscHandler(E,x)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let E=!1,x=this.optionsService.rawOptions.windowsPty;x&&x.buildNumber!==void 0&&x.buildNumber!==void 0?E=x.backend==="conpty"&&x.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(E=!0),E?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let E=[];E.push(this.onLineFeed(u.updateWindowsModeWrappedState.bind(null,this._bufferService))),E.push(this.registerCsiHandler({final:"H"},(()=>((0,u.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(let x of E)x.dispose()}))}}}n.CoreTerminal=B},460:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.runAndSubscribe=n.forwardEvent=n.EventEmitter=void 0,n.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let f=0;f<this._listeners.length;f++)if(this._listeners[f]===l)return void this._listeners.splice(f,1)}}})),this._event}fire(l,h){let f=[];for(let c=0;c<this._listeners.length;c++)f.push(this._listeners[c]);for(let c=0;c<f.length;c++)f[c].call(void 0,l,h)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},n.forwardEvent=function(l,h){return l((f=>h.fire(f)))},n.runAndSubscribe=function(l,h){return h(void 0),l((f=>h(f)))}},435:function(_,n,l){var h=this&&this.__decorate||function(D,m,b,k){var A,N=arguments.length,z=N<3?m:k===null?k=Object.getOwnPropertyDescriptor(m,b):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")z=Reflect.decorate(D,m,b,k);else for(var I=D.length-1;I>=0;I--)(A=D[I])&&(z=(N<3?A(z):N>3?A(m,b,z):A(m,b))||z);return N>3&&z&&Object.defineProperty(m,b,z),z},f=this&&this.__param||function(D,m){return function(b,k){m(b,k,D)}};Object.defineProperty(n,"__esModule",{value:!0}),n.InputHandler=n.WindowsOptionsReportType=void 0;let c=l(584),p=l(116),o=l(15),i=l(844),s=l(482),e=l(437),t=l(460),r=l(643),a=l(511),u=l(734),g=l(585),v=l(480),S=l(242),y=l(351),B=l(941),M={"(":0,")":1,"*":2,"+":3,"-":1,".":2},E=131072;function x(D,m){if(D>24)return m.setWinLines||!1;switch(D){case 1:return!!m.restoreWin;case 2:return!!m.minimizeWin;case 3:return!!m.setWinPosition;case 4:return!!m.setWinSizePixels;case 5:return!!m.raiseWin;case 6:return!!m.lowerWin;case 7:return!!m.refreshWin;case 8:return!!m.setWinSizeChars;case 9:return!!m.maximizeWin;case 10:return!!m.fullscreenWin;case 11:return!!m.getWinState;case 13:return!!m.getWinPosition;case 14:return!!m.getWinSizePixels;case 15:return!!m.getScreenSizePixels;case 16:return!!m.getCellSizePixels;case 18:return!!m.getWinSizeChars;case 19:return!!m.getScreenSizeChars;case 20:return!!m.getIconTitle;case 21:return!!m.getWinTitle;case 22:return!!m.pushTitle;case 23:return!!m.popTitle;case 24:return!!m.setWinLines}return!1}var O;(function(D){D[D.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",D[D.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(O||(n.WindowsOptionsReportType=O={}));let q=0;class K extends i.Disposable{getAttrData(){return this._curAttrData}constructor(m,b,k,A,N,z,I,w,F=new o.EscapeSequenceParser){super(),this._bufferService=m,this._charsetService=b,this._coreService=k,this._logService=A,this._optionsService=N,this._oscLinkService=z,this._coreMouseService=I,this._unicodeService=w,this._parser=F,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new s.StringToUtf32,this._utf8Decoder=new s.Utf8ToUtf32,this._workCell=new a.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new t.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new t.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new t.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new t.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new t.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new t.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new t.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new t.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new t.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new t.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new t.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new t.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new t.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((L=>this._activeBuffer=L.activeBuffer))),this._parser.setCsiHandlerFallback(((L,j)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(L),params:j.toArray()})})),this._parser.setEscHandlerFallback((L=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(L)})})),this._parser.setExecuteHandlerFallback((L=>{this._logService.debug("Unknown EXECUTE code: ",{code:L})})),this._parser.setOscHandlerFallback(((L,j,H)=>{this._logService.debug("Unknown OSC code: ",{identifier:L,action:j,data:H})})),this._parser.setDcsHandlerFallback(((L,j,H)=>{j==="HOOK"&&(H=H.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(L),action:j,payload:H})})),this._parser.setPrintHandler(((L,j,H)=>this.print(L,j,H))),this._parser.registerCsiHandler({final:"@"},(L=>this.insertChars(L))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(L=>this.scrollLeft(L))),this._parser.registerCsiHandler({final:"A"},(L=>this.cursorUp(L))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(L=>this.scrollRight(L))),this._parser.registerCsiHandler({final:"B"},(L=>this.cursorDown(L))),this._parser.registerCsiHandler({final:"C"},(L=>this.cursorForward(L))),this._parser.registerCsiHandler({final:"D"},(L=>this.cursorBackward(L))),this._parser.registerCsiHandler({final:"E"},(L=>this.cursorNextLine(L))),this._parser.registerCsiHandler({final:"F"},(L=>this.cursorPrecedingLine(L))),this._parser.registerCsiHandler({final:"G"},(L=>this.cursorCharAbsolute(L))),this._parser.registerCsiHandler({final:"H"},(L=>this.cursorPosition(L))),this._parser.registerCsiHandler({final:"I"},(L=>this.cursorForwardTab(L))),this._parser.registerCsiHandler({final:"J"},(L=>this.eraseInDisplay(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(L=>this.eraseInDisplay(L,!0))),this._parser.registerCsiHandler({final:"K"},(L=>this.eraseInLine(L,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(L=>this.eraseInLine(L,!0))),this._parser.registerCsiHandler({final:"L"},(L=>this.insertLines(L))),this._parser.registerCsiHandler({final:"M"},(L=>this.deleteLines(L))),this._parser.registerCsiHandler({final:"P"},(L=>this.deleteChars(L))),this._parser.registerCsiHandler({final:"S"},(L=>this.scrollUp(L))),this._parser.registerCsiHandler({final:"T"},(L=>this.scrollDown(L))),this._parser.registerCsiHandler({final:"X"},(L=>this.eraseChars(L))),this._parser.registerCsiHandler({final:"Z"},(L=>this.cursorBackwardTab(L))),this._parser.registerCsiHandler({final:"`"},(L=>this.charPosAbsolute(L))),this._parser.registerCsiHandler({final:"a"},(L=>this.hPositionRelative(L))),this._parser.registerCsiHandler({final:"b"},(L=>this.repeatPrecedingCharacter(L))),this._parser.registerCsiHandler({final:"c"},(L=>this.sendDeviceAttributesPrimary(L))),this._parser.registerCsiHandler({prefix:">",final:"c"},(L=>this.sendDeviceAttributesSecondary(L))),this._parser.registerCsiHandler({final:"d"},(L=>this.linePosAbsolute(L))),this._parser.registerCsiHandler({final:"e"},(L=>this.vPositionRelative(L))),this._parser.registerCsiHandler({final:"f"},(L=>this.hVPosition(L))),this._parser.registerCsiHandler({final:"g"},(L=>this.tabClear(L))),this._parser.registerCsiHandler({final:"h"},(L=>this.setMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(L=>this.setModePrivate(L))),this._parser.registerCsiHandler({final:"l"},(L=>this.resetMode(L))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(L=>this.resetModePrivate(L))),this._parser.registerCsiHandler({final:"m"},(L=>this.charAttributes(L))),this._parser.registerCsiHandler({final:"n"},(L=>this.deviceStatus(L))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(L=>this.deviceStatusPrivate(L))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(L=>this.softReset(L))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(L=>this.setCursorStyle(L))),this._parser.registerCsiHandler({final:"r"},(L=>this.setScrollRegion(L))),this._parser.registerCsiHandler({final:"s"},(L=>this.saveCursor(L))),this._parser.registerCsiHandler({final:"t"},(L=>this.windowOptions(L))),this._parser.registerCsiHandler({final:"u"},(L=>this.restoreCursor(L))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(L=>this.insertColumns(L))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(L=>this.deleteColumns(L))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(L=>this.selectProtected(L))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(L=>this.requestMode(L,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(L=>this.requestMode(L,!1))),this._parser.setExecuteHandler(c.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(c.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(c.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(c.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(c.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(c.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(c.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(c.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(c.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(c.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new S.OscHandler((L=>(this.setTitle(L),this.setIconName(L),!0)))),this._parser.registerOscHandler(1,new S.OscHandler((L=>this.setIconName(L)))),this._parser.registerOscHandler(2,new S.OscHandler((L=>this.setTitle(L)))),this._parser.registerOscHandler(4,new S.OscHandler((L=>this.setOrReportIndexedColor(L)))),this._parser.registerOscHandler(8,new S.OscHandler((L=>this.setHyperlink(L)))),this._parser.registerOscHandler(10,new S.OscHandler((L=>this.setOrReportFgColor(L)))),this._parser.registerOscHandler(11,new S.OscHandler((L=>this.setOrReportBgColor(L)))),this._parser.registerOscHandler(12,new S.OscHandler((L=>this.setOrReportCursorColor(L)))),this._parser.registerOscHandler(104,new S.OscHandler((L=>this.restoreIndexedColor(L)))),this._parser.registerOscHandler(110,new S.OscHandler((L=>this.restoreFgColor(L)))),this._parser.registerOscHandler(111,new S.OscHandler((L=>this.restoreBgColor(L)))),this._parser.registerOscHandler(112,new S.OscHandler((L=>this.restoreCursorColor(L)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(let L in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:L},(()=>this.selectCharset("("+L))),this._parser.registerEscHandler({intermediates:")",final:L},(()=>this.selectCharset(")"+L))),this._parser.registerEscHandler({intermediates:"*",final:L},(()=>this.selectCharset("*"+L))),this._parser.registerEscHandler({intermediates:"+",final:L},(()=>this.selectCharset("+"+L))),this._parser.registerEscHandler({intermediates:"-",final:L},(()=>this.selectCharset("-"+L))),this._parser.registerEscHandler({intermediates:".",final:L},(()=>this.selectCharset("."+L))),this._parser.registerEscHandler({intermediates:"/",final:L},(()=>this.selectCharset("/"+L)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((L=>(this._logService.error("Parsing error: ",L),L))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new y.DcsHandler(((L,j)=>this.requestStatusString(L,j))))}_preserveStack(m,b,k,A){this._parseStack.paused=!0,this._parseStack.cursorStartX=m,this._parseStack.cursorStartY=b,this._parseStack.decodedLength=k,this._parseStack.position=A}_logSlowResolvingAsync(m){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([m,new Promise(((b,k)=>setTimeout((()=>k("#SLOW_TIMEOUT")),5e3)))]).catch((b=>{if(b!=="#SLOW_TIMEOUT")throw b;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(m,b){let k,A=this._activeBuffer.x,N=this._activeBuffer.y,z=0,I=this._parseStack.paused;if(I){if(k=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,b))return this._logSlowResolvingAsync(k),k;A=this._parseStack.cursorStartX,N=this._parseStack.cursorStartY,this._parseStack.paused=!1,m.length>E&&(z=this._parseStack.position+E)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof m=="string"?` "${m}"`:` "${Array.prototype.map.call(m,(L=>String.fromCharCode(L))).join("")}"`),typeof m=="string"?m.split("").map((L=>L.charCodeAt(0))):m),this._parseBuffer.length<m.length&&this._parseBuffer.length<E&&(this._parseBuffer=new Uint32Array(Math.min(m.length,E))),I||this._dirtyRowTracker.clearRange(),m.length>E)for(let L=z;L<m.length;L+=E){let j=L+E<m.length?L+E:m.length,H=typeof m=="string"?this._stringDecoder.decode(m.substring(L,j),this._parseBuffer):this._utf8Decoder.decode(m.subarray(L,j),this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,H))return this._preserveStack(A,N,H,L),this._logSlowResolvingAsync(k),k}else if(!I){let L=typeof m=="string"?this._stringDecoder.decode(m,this._parseBuffer):this._utf8Decoder.decode(m,this._parseBuffer);if(k=this._parser.parse(this._parseBuffer,L))return this._preserveStack(A,N,L,0),this._logSlowResolvingAsync(k),k}this._activeBuffer.x===A&&this._activeBuffer.y===N||this._onCursorMove.fire();let w=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),F=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);F<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(F,this._bufferService.rows-1),Math.min(w,this._bufferService.rows-1))}print(m,b,k){let A,N,z=this._charsetService.charset,I=this._optionsService.rawOptions.screenReaderMode,w=this._bufferService.cols,F=this._coreService.decPrivateModes.wraparound,L=this._coreService.modes.insertMode,j=this._curAttrData,H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&k-b>0&&H.getWidth(this._activeBuffer.x-1)===2&&H.setCellFromCodepoint(this._activeBuffer.x-1,0,1,j);let V=this._parser.precedingJoinState;for(let X=b;X<k;++X){if(A=m[X],A<127&&z){let re=z[String.fromCharCode(A)];re&&(A=re.charCodeAt(0))}let J=this._unicodeService.charProperties(A,V);N=v.UnicodeService.extractWidth(J);let ee=v.UnicodeService.extractShouldJoin(J),G=ee?v.UnicodeService.extractWidth(V):0;if(V=J,I&&this._onA11yChar.fire((0,s.stringFromCodePoint)(A)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+N-G>w){if(F){let re=H,he=this._activeBuffer.x-G;for(this._activeBuffer.x=G,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),H=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),G>0&&H instanceof e.BufferLine&&H.copyCellsFrom(re,he,0,G,!1);he<w;)re.setCellFromCodepoint(he++,0,1,j)}else if(this._activeBuffer.x=w-1,N===2)continue}if(ee&&this._activeBuffer.x){let re=H.getWidth(this._activeBuffer.x-1)?1:2;H.addCodepointToCell(this._activeBuffer.x-re,A,N);for(let he=N-G;--he>=0;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}else if(L&&(H.insertCells(this._activeBuffer.x,N-G,this._activeBuffer.getNullCell(j)),H.getWidth(w-1)===2&&H.setCellFromCodepoint(w-1,r.NULL_CELL_CODE,r.NULL_CELL_WIDTH,j)),H.setCellFromCodepoint(this._activeBuffer.x++,A,N,j),N>0)for(;--N;)H.setCellFromCodepoint(this._activeBuffer.x++,0,0,j)}this._parser.precedingJoinState=V,this._activeBuffer.x<w&&k-b>0&&H.getWidth(this._activeBuffer.x)===0&&!H.hasContent(this._activeBuffer.x)&&H.setCellFromCodepoint(this._activeBuffer.x,0,1,j),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(m,b){return m.final!=="t"||m.prefix||m.intermediates?this._parser.registerCsiHandler(m,b):this._parser.registerCsiHandler(m,(k=>!x(k.params[0],this._optionsService.rawOptions.windowOptions)||b(k)))}registerDcsHandler(m,b){return this._parser.registerDcsHandler(m,new y.DcsHandler(b))}registerEscHandler(m,b){return this._parser.registerEscHandler(m,b)}registerOscHandler(m,b){return this._parser.registerOscHandler(m,new S.OscHandler(b))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);m.hasWidth(this._activeBuffer.x)&&!m.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let m=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-m),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(m=this._bufferService.cols-1){this._activeBuffer.x=Math.min(m,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(m,b){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=m,this._activeBuffer.y=this._activeBuffer.scrollTop+b):(this._activeBuffer.x=m,this._activeBuffer.y=b),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(m,b){this._restrictCursor(),this._setCursor(this._activeBuffer.x+m,this._activeBuffer.y+b)}cursorUp(m){let b=this._activeBuffer.y-this._activeBuffer.scrollTop;return b>=0?this._moveCursor(0,-Math.min(b,m.params[0]||1)):this._moveCursor(0,-(m.params[0]||1)),!0}cursorDown(m){let b=this._activeBuffer.scrollBottom-this._activeBuffer.y;return b>=0?this._moveCursor(0,Math.min(b,m.params[0]||1)):this._moveCursor(0,m.params[0]||1),!0}cursorForward(m){return this._moveCursor(m.params[0]||1,0),!0}cursorBackward(m){return this._moveCursor(-(m.params[0]||1),0),!0}cursorNextLine(m){return this.cursorDown(m),this._activeBuffer.x=0,!0}cursorPrecedingLine(m){return this.cursorUp(m),this._activeBuffer.x=0,!0}cursorCharAbsolute(m){return this._setCursor((m.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(m){return this._setCursor(m.length>=2?(m.params[1]||1)-1:0,(m.params[0]||1)-1),!0}charPosAbsolute(m){return this._setCursor((m.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(m){return this._moveCursor(m.params[0]||1,0),!0}linePosAbsolute(m){return this._setCursor(this._activeBuffer.x,(m.params[0]||1)-1),!0}vPositionRelative(m){return this._moveCursor(0,m.params[0]||1),!0}hVPosition(m){return this.cursorPosition(m),!0}tabClear(m){let b=m.params[0];return b===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:b===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(m){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=m.params[0]||1;for(;b--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(m){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let b=m.params[0]||1;for(;b--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(m){let b=m.params[0];return b===1&&(this._curAttrData.bg|=536870912),b!==2&&b!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(m,b,k,A=!1,N=!1){let z=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);z.replaceCells(b,k,this._activeBuffer.getNullCell(this._eraseAttrData()),N),A&&(z.isWrapped=!1)}_resetBufferLine(m,b=!1){let k=this._activeBuffer.lines.get(this._activeBuffer.ybase+m);k&&(k.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),b),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+m),k.isWrapped=!1)}eraseInDisplay(m,b=!1){let k;switch(this._restrictCursor(this._bufferService.cols),m.params[0]){case 0:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,b);k<this._bufferService.rows;k++)this._resetBufferLine(k,b);this._dirtyRowTracker.markDirty(k);break;case 1:for(k=this._activeBuffer.y,this._dirtyRowTracker.markDirty(k),this._eraseInBufferLine(k,0,this._activeBuffer.x+1,!0,b),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(k+1).isWrapped=!1);k--;)this._resetBufferLine(k,b);this._dirtyRowTracker.markDirty(0);break;case 2:for(k=this._bufferService.rows,this._dirtyRowTracker.markDirty(k-1);k--;)this._resetBufferLine(k,b);this._dirtyRowTracker.markDirty(0);break;case 3:let A=this._activeBuffer.lines.length-this._bufferService.rows;A>0&&(this._activeBuffer.lines.trimStart(A),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-A,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-A,0),this._onScroll.fire(0))}return!0}eraseInLine(m,b=!1){switch(this._restrictCursor(this._bufferService.cols),m.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,b);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,b);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,b)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(m){this._restrictCursor();let b=m.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,N=this._bufferService.rows-1+this._activeBuffer.ybase-A+1;for(;b--;)this._activeBuffer.lines.splice(N-1,1),this._activeBuffer.lines.splice(k,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(m){this._restrictCursor();let b=m.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let k=this._activeBuffer.ybase+this._activeBuffer.y,A;for(A=this._bufferService.rows-1-this._activeBuffer.scrollBottom,A=this._bufferService.rows-1+this._activeBuffer.ybase-A;b--;)this._activeBuffer.lines.splice(k,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(m){this._restrictCursor();let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return b&&(b.insertCells(this._activeBuffer.x,m.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(m){this._restrictCursor();let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return b&&(b.deleteCells(this._activeBuffer.x,m.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(m){let b=m.params[0]||1;for(;b--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(m){let b=m.params[0]||1;for(;b--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(e.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(0,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(0,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.insertCells(this._activeBuffer.x,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(m){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let b=m.params[0]||1;for(let k=this._activeBuffer.scrollTop;k<=this._activeBuffer.scrollBottom;++k){let A=this._activeBuffer.lines.get(this._activeBuffer.ybase+k);A.deleteCells(this._activeBuffer.x,b,this._activeBuffer.getNullCell(this._eraseAttrData())),A.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(m){this._restrictCursor();let b=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return b&&(b.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(m.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(m){let b=this._parser.precedingJoinState;if(!b)return!0;let k=m.params[0]||1,A=v.UnicodeService.extractWidth(b),N=this._activeBuffer.x-A,z=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(N),I=new Uint32Array(z.length*k),w=0;for(let L=0;L<z.length;){let j=z.codePointAt(L)||0;I[w++]=j,L+=j>65535?2:1}let F=w;for(let L=1;L<k;++L)I.copyWithin(F,0,w),F+=w;return this.print(I,0,F),!0}sendDeviceAttributesPrimary(m){return m.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(c.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(c.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(m){return m.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(c.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(c.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(m.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(c.C0.ESC+"[>83;40003;0c")),!0}_is(m){return(this._optionsService.rawOptions.termName+"").indexOf(m)===0}setMode(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(m){for(let b=0;b<m.length;b++)switch(m.params[b]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),m.params[b]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(m,b){let k=this._coreService.decPrivateModes,{activeProtocol:A,activeEncoding:N}=this._coreMouseService,z=this._coreService,{buffers:I,cols:w}=this._bufferService,{active:F,alt:L}=I,j=this._optionsService.rawOptions,H=ee=>ee?1:2,V=m.params[0];return X=V,J=b?V===2?4:V===4?H(z.modes.insertMode):V===12?3:V===20?H(j.convertEol):0:V===1?H(k.applicationCursorKeys):V===3?j.windowOptions.setWinLines?w===80?2:w===132?1:0:0:V===6?H(k.origin):V===7?H(k.wraparound):V===8?3:V===9?H(A==="X10"):V===12?H(j.cursorBlink):V===25?H(!z.isCursorHidden):V===45?H(k.reverseWraparound):V===66?H(k.applicationKeypad):V===67?4:V===1e3?H(A==="VT200"):V===1002?H(A==="DRAG"):V===1003?H(A==="ANY"):V===1004?H(k.sendFocus):V===1005?4:V===1006?H(N==="SGR"):V===1015?4:V===1016?H(N==="SGR_PIXELS"):V===1048?1:V===47||V===1047||V===1049?H(F===L):V===2004?H(k.bracketedPasteMode):0,z.triggerDataEvent(`${c.C0.ESC}[${b?"":"?"}${X};${J}$y`),!0;var X,J}_updateAttrColor(m,b,k,A,N){return b===2?(m|=50331648,m&=-16777216,m|=u.AttributeData.fromColorRGB([k,A,N])):b===5&&(m&=-50331904,m|=33554432|255&k),m}_extractColor(m,b,k){let A=[0,0,-1,0,0,0],N=0,z=0;do{if(A[z+N]=m.params[b+z],m.hasSubParams(b+z)){let I=m.getSubParams(b+z),w=0;do A[1]===5&&(N=1),A[z+w+1+N]=I[w];while(++w<I.length&&w+z+1+N<A.length);break}if(A[1]===5&&z+N>=2||A[1]===2&&z+N>=5)break;A[1]&&(N=1)}while(++z+b<m.length&&z+N<A.length);for(let I=2;I<A.length;++I)A[I]===-1&&(A[I]=0);switch(A[0]){case 38:k.fg=this._updateAttrColor(k.fg,A[1],A[3],A[4],A[5]);break;case 48:k.bg=this._updateAttrColor(k.bg,A[1],A[3],A[4],A[5]);break;case 58:k.extended=k.extended.clone(),k.extended.underlineColor=this._updateAttrColor(k.extended.underlineColor,A[1],A[3],A[4],A[5])}return z}_processUnderline(m,b){b.extended=b.extended.clone(),(!~m||m>5)&&(m=1),b.extended.underlineStyle=m,b.fg|=268435456,m===0&&(b.fg&=-268435457),b.updateExtended()}_processSGR0(m){m.fg=e.DEFAULT_ATTR_DATA.fg,m.bg=e.DEFAULT_ATTR_DATA.bg,m.extended=m.extended.clone(),m.extended.underlineStyle=0,m.extended.underlineColor&=-67108864,m.updateExtended()}charAttributes(m){if(m.length===1&&m.params[0]===0)return this._processSGR0(this._curAttrData),!0;let b=m.length,k,A=this._curAttrData;for(let N=0;N<b;N++)k=m.params[N],k>=30&&k<=37?(A.fg&=-50331904,A.fg|=16777216|k-30):k>=40&&k<=47?(A.bg&=-50331904,A.bg|=16777216|k-40):k>=90&&k<=97?(A.fg&=-50331904,A.fg|=16777224|k-90):k>=100&&k<=107?(A.bg&=-50331904,A.bg|=16777224|k-100):k===0?this._processSGR0(A):k===1?A.fg|=134217728:k===3?A.bg|=67108864:k===4?(A.fg|=268435456,this._processUnderline(m.hasSubParams(N)?m.getSubParams(N)[0]:1,A)):k===5?A.fg|=536870912:k===7?A.fg|=67108864:k===8?A.fg|=1073741824:k===9?A.fg|=2147483648:k===2?A.bg|=134217728:k===21?this._processUnderline(2,A):k===22?(A.fg&=-134217729,A.bg&=-134217729):k===23?A.bg&=-67108865:k===24?(A.fg&=-268435457,this._processUnderline(0,A)):k===25?A.fg&=-536870913:k===27?A.fg&=-67108865:k===28?A.fg&=-1073741825:k===29?A.fg&=2147483647:k===39?(A.fg&=-67108864,A.fg|=16777215&e.DEFAULT_ATTR_DATA.fg):k===49?(A.bg&=-67108864,A.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):k===38||k===48||k===58?N+=this._extractColor(m,N,A):k===53?A.bg|=1073741824:k===55?A.bg&=-1073741825:k===59?(A.extended=A.extended.clone(),A.extended.underlineColor=-1,A.updateExtended()):k===100?(A.fg&=-67108864,A.fg|=16777215&e.DEFAULT_ATTR_DATA.fg,A.bg&=-67108864,A.bg|=16777215&e.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",k);return!0}deviceStatus(m){switch(m.params[0]){case 5:this._coreService.triggerDataEvent(`${c.C0.ESC}[0n`);break;case 6:let b=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[${b};${k}R`)}return!0}deviceStatusPrivate(m){if(m.params[0]===6){let b=this._activeBuffer.y+1,k=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${c.C0.ESC}[?${b};${k}R`)}return!0}softReset(m){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(m){let b=m.params[0]||1;switch(b){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let k=b%2==1;return this._optionsService.options.cursorBlink=k,!0}setScrollRegion(m){let b=m.params[0]||1,k;return(m.length<2||(k=m.params[1])>this._bufferService.rows||k===0)&&(k=this._bufferService.rows),k>b&&(this._activeBuffer.scrollTop=b-1,this._activeBuffer.scrollBottom=k-1,this._setCursor(0,0)),!0}windowOptions(m){if(!x(m.params[0],this._optionsService.rawOptions.windowOptions))return!0;let b=m.length>1?m.params[1]:0;switch(m.params[0]){case 14:b!==2&&this._onRequestWindowsOptionsReport.fire(O.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(O.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${c.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:b!==0&&b!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),b!==0&&b!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:b!==0&&b!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),b!==0&&b!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(m){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(m){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(m){return this._windowTitle=m,this._onTitleChange.fire(m),!0}setIconName(m){return this._iconName=m,!0}setOrReportIndexedColor(m){let b=[],k=m.split(";");for(;k.length>1;){let A=k.shift(),N=k.shift();if(/^\d+$/.exec(A)){let z=parseInt(A);if(C(z))if(N==="?")b.push({type:0,index:z});else{let I=(0,B.parseColor)(N);I&&b.push({type:1,index:z,color:I})}}}return b.length&&this._onColor.fire(b),!0}setHyperlink(m){let b=m.split(";");return!(b.length<2)&&(b[1]?this._createHyperlink(b[0],b[1]):!b[0]&&this._finishHyperlink())}_createHyperlink(m,b){this._getCurrentLinkId()&&this._finishHyperlink();let k=m.split(":"),A,N=k.findIndex((z=>z.startsWith("id=")));return N!==-1&&(A=k[N].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:A,uri:b}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(m,b){let k=m.split(";");for(let A=0;A<k.length&&!(b>=this._specialColors.length);++A,++b)if(k[A]==="?")this._onColor.fire([{type:0,index:this._specialColors[b]}]);else{let N=(0,B.parseColor)(k[A]);N&&this._onColor.fire([{type:1,index:this._specialColors[b],color:N}])}return!0}setOrReportFgColor(m){return this._setOrReportSpecialColor(m,0)}setOrReportBgColor(m){return this._setOrReportSpecialColor(m,1)}setOrReportCursorColor(m){return this._setOrReportSpecialColor(m,2)}restoreIndexedColor(m){if(!m)return this._onColor.fire([{type:2}]),!0;let b=[],k=m.split(";");for(let A=0;A<k.length;++A)if(/^\d+$/.exec(k[A])){let N=parseInt(k[A]);C(N)&&b.push({type:2,index:N})}return b.length&&this._onColor.fire(b),!0}restoreFgColor(m){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(m){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(m){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),!0}selectCharset(m){return m.length!==2?(this.selectDefaultCharset(),!0):(m[0]==="/"||this._charsetService.setgCharset(M[m[0]],p.CHARSETS[m[1]]||p.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let m=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,m,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=e.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=e.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(m){return this._charsetService.setgLevel(m),!0}screenAlignmentPattern(){let m=new a.CellData;m.content=4194373,m.fg=this._curAttrData.fg,m.bg=this._curAttrData.bg,this._setCursor(0,0);for(let b=0;b<this._bufferService.rows;++b){let k=this._activeBuffer.ybase+this._activeBuffer.y+b,A=this._activeBuffer.lines.get(k);A&&(A.fill(m),A.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(m,b){let k=this._bufferService.buffer,A=this._optionsService.rawOptions;return(N=>(this._coreService.triggerDataEvent(`${c.C0.ESC}${N}${c.C0.ESC}\\`),!0))(m==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:m==='"p'?'P1$r61;1"p':m==="r"?`P1$r${k.scrollTop+1};${k.scrollBottom+1}r`:m==="m"?"P1$r0m":m===" q"?`P1$r${{block:2,underline:4,bar:6}[A.cursorStyle]-(A.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(m,b){this._dirtyRowTracker.markRangeDirty(m,b)}}n.InputHandler=K;let U=class{constructor(D){this._bufferService=D,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(D){D<this.start?this.start=D:D>this.end&&(this.end=D)}markRangeDirty(D,m){D>m&&(q=D,D=m,m=q),D<this.start&&(this.start=D),m>this.end&&(this.end=m)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function C(D){return 0<=D&&D<256}U=h([f(0,g.IBufferService)],U)},844:(_,n)=>{function l(h){for(let f of h)f.dispose();h.length=0}Object.defineProperty(n,"__esModule",{value:!0}),n.getDisposeArrayDisposable=n.disposeArray=n.toDisposable=n.MutableDisposable=n.Disposable=void 0,n.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){let f=this._disposables.indexOf(h);f!==-1&&this._disposables.splice(f,1)}},n.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){this._isDisposed||h===this._value||(this._value?.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},n.toDisposable=function(h){return{dispose:h}},n.disposeArray=l,n.getDisposeArrayDisposable=function(h){return{dispose:()=>l(h)}}},114:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.isChromeOS=n.isLinux=n.isWindows=n.isIphone=n.isIpad=n.isMac=n.getSafariVersion=n.isSafari=n.isLegacyEdge=n.isFirefox=n.isNode=void 0,n.isNode=typeof process<"u"&&"title"in process;let l=n.isNode?"node":navigator.userAgent,h=n.isNode?"node":navigator.platform;n.isFirefox=l.includes("Firefox"),n.isLegacyEdge=l.includes("Edge"),n.isSafari=/^((?!chrome|android).)*safari/i.test(l),n.getSafariVersion=function(){if(!n.isSafari)return 0;let f=l.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},n.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),n.isIpad=h==="iPad",n.isIphone=h==="iPhone",n.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),n.isLinux=h.indexOf("Linux")>=0,n.isChromeOS=/\bCrOS\b/.test(l)},226:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DebouncedIdleTask=n.IdleTaskQueue=n.PriorityTaskQueue=void 0;let h=l(114);class f{constructor(){this._tasks=[],this._i=0}enqueue(o){this._tasks.push(o),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(o){this._idleCallback=void 0;let i=0,s=0,e=o.timeRemaining(),t=0;for(;this._i<this._tasks.length;){if(i=Date.now(),this._tasks[this._i]()||this._i++,i=Math.max(1,Date.now()-i),s=Math.max(i,s),t=o.timeRemaining(),1.5*s>t)return e-i<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-i))}ms`),void this._start();e=t}this.clear()}}class c extends f{_requestCallback(o){return setTimeout((()=>o(this._createDeadline(16))))}_cancelCallback(o){clearTimeout(o)}_createDeadline(o){let i=Date.now()+o;return{timeRemaining:()=>Math.max(0,i-Date.now())}}}n.PriorityTaskQueue=c,n.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:c,n.DebouncedIdleTask=class{constructor(){this._queue=new n.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},282:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.updateWindowsModeWrappedState=void 0;let h=l(643);n.updateWindowsModeWrappedState=function(f){let c=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),p=c?.get(f.cols-1),o=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);o&&p&&(o.isWrapped=p[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&p[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},734:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ExtendedAttrs=n.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){let c=new l;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}n.AttributeData=l;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}get underlineVariantOffset(){let c=(3758096384&this._ext)>>29;return c<0?4294967288^c:c}set underlineVariantOffset(c){this._ext&=536870911,this._ext|=c<<29&3758096384}constructor(c=0,p=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=p}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}n.ExtendedAttrs=h},92:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Buffer=n.MAX_BUFFER_SIZE=void 0;let h=l(349),f=l(226),c=l(734),p=l(437),o=l(634),i=l(511),s=l(643),e=l(863),t=l(116);n.MAX_BUFFER_SIZE=4294967295,n.Buffer=class{constructor(r,a,u){this._hasScrollback=r,this._optionsService=a,this._bufferService=u,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=t.DEFAULT_CHARSET,this.markers=[],this._nullCell=i.CellData.fromCharData([0,s.NULL_CELL_CHAR,s.NULL_CELL_WIDTH,s.NULL_CELL_CODE]),this._whitespaceCell=i.CellData.fromCharData([0,s.WHITESPACE_CELL_CHAR,s.WHITESPACE_CELL_WIDTH,s.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(r){return r?(this._nullCell.fg=r.fg,this._nullCell.bg=r.bg,this._nullCell.extended=r.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new c.ExtendedAttrs),this._nullCell}getWhitespaceCell(r){return r?(this._whitespaceCell.fg=r.fg,this._whitespaceCell.bg=r.bg,this._whitespaceCell.extended=r.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new c.ExtendedAttrs),this._whitespaceCell}getBlankLine(r,a){return new p.BufferLine(this._bufferService.cols,this.getNullCell(r),a)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let r=this.ybase+this.y-this.ydisp;return r>=0&&r<this._rows}_getCorrectBufferLength(r){if(!this._hasScrollback)return r;let a=r+this._optionsService.rawOptions.scrollback;return a>n.MAX_BUFFER_SIZE?n.MAX_BUFFER_SIZE:a}fillViewportRows(r){if(this.lines.length===0){r===void 0&&(r=p.DEFAULT_ATTR_DATA);let a=this._rows;for(;a--;)this.lines.push(this.getBlankLine(r))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(r,a){let u=this.getNullCell(p.DEFAULT_ATTR_DATA),g=0,v=this._getCorrectBufferLength(a);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols<r)for(let y=0;y<this.lines.length;y++)g+=+this.lines.get(y).resize(r,u);let S=0;if(this._rows<a)for(let y=this._rows;y<a;y++)this.lines.length<a+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(r,u)):this.ybase>0&&this.lines.length<=this.ybase+this.y+S+1?(this.ybase--,S++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(r,u)));else for(let y=this._rows;y>a;y--)this.lines.length>a+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v<this.lines.maxLength){let y=this.lines.length-v;y>0&&(this.lines.trimStart(y),this.ybase=Math.max(this.ybase-y,0),this.ydisp=Math.max(this.ydisp-y,0),this.savedY=Math.max(this.savedY-y,0)),this.lines.maxLength=v}this.x=Math.min(this.x,r-1),this.y=Math.min(this.y,a-1),S&&(this.y+=S),this.savedX=Math.min(this.savedX,r-1),this.scrollTop=0}if(this.scrollBottom=a-1,this._isReflowEnabled&&(this._reflow(r,a),this._cols>r))for(let S=0;S<this.lines.length;S++)g+=+this.lines.get(S).resize(r,u);this._cols=r,this._rows=a,this._memoryCleanupQueue.clear(),g>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let r=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,r=!1);let a=0;for(;this._memoryCleanupPosition<this.lines.length;)if(a+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),a>100)return!0;return r}get _isReflowEnabled(){let r=this._optionsService.rawOptions.windowsPty;return r&&r.buildNumber?this._hasScrollback&&r.backend==="conpty"&&r.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(r,a){this._cols!==r&&(r>this._cols?this._reflowLarger(r,a):this._reflowSmaller(r,a))}_reflowLarger(r,a){let u=(0,o.reflowLargerGetLinesToRemove)(this.lines,this._cols,r,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(u.length>0){let g=(0,o.reflowLargerCreateNewLayout)(this.lines,u);(0,o.reflowLargerApplyNewLayout)(this.lines,g.layout),this._reflowLargerAdjustViewport(r,a,g.countRemoved)}}_reflowLargerAdjustViewport(r,a,u){let g=this.getNullCell(p.DEFAULT_ATTR_DATA),v=u;for(;v-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<a&&this.lines.push(new p.BufferLine(r,g))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-u,0)}_reflowSmaller(r,a){let u=this.getNullCell(p.DEFAULT_ATTR_DATA),g=[],v=0;for(let S=this.lines.length-1;S>=0;S--){let y=this.lines.get(S);if(!y||!y.isWrapped&&y.getTrimmedLength()<=r)continue;let B=[y];for(;y.isWrapped&&S>0;)y=this.lines.get(--S),B.unshift(y);let M=this.ybase+this.y;if(M>=S&&M<S+B.length)continue;let E=B[B.length-1].getTrimmedLength(),x=(0,o.reflowSmallerGetNewLineLengths)(B,this._cols,r),O=x.length-B.length,q;q=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+O):Math.max(0,this.lines.length-this.lines.maxLength+O);let K=[];for(let k=0;k<O;k++){let A=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);K.push(A)}K.length>0&&(g.push({start:S+B.length+v,newLines:K}),v+=K.length),B.push(...K);let U=x.length-1,C=x[U];C===0&&(U--,C=x[U]);let D=B.length-O-1,m=E;for(;D>=0;){let k=Math.min(m,C);if(B[U]===void 0)break;if(B[U].copyCellsFrom(B[D],m-k,C-k,k,!0),C-=k,C===0&&(U--,C=x[U]),m-=k,m===0){D--;let A=Math.max(D,0);m=(0,o.getWrappedLineTrimmedLength)(B,A,this._cols)}}for(let k=0;k<B.length;k++)x[k]<r&&B[k].setCell(x[k],u);let b=O-q;for(;b-- >0;)this.ybase===0?this.y<a-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+v)-a&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+O,this.ybase+a-1)}if(g.length>0){let S=[],y=[];for(let U=0;U<this.lines.length;U++)y.push(this.lines.get(U));let B=this.lines.length,M=B-1,E=0,x=g[E];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+v);let O=0;for(let U=Math.min(this.lines.maxLength-1,B+v-1);U>=0;U--)if(x&&x.start>M+O){for(let C=x.newLines.length-1;C>=0;C--)this.lines.set(U--,x.newLines[C]);U++,S.push({index:M+1,amount:x.newLines.length}),O+=x.newLines.length,x=g[++E]}else this.lines.set(U,y[M--]);let q=0;for(let U=S.length-1;U>=0;U--)S[U].index+=q,this.lines.onInsertEmitter.fire(S[U]),q+=S[U].amount;let K=Math.max(0,B+v-this.lines.maxLength);K>0&&this.lines.onTrimEmitter.fire(K)}}translateBufferLineToString(r,a,u=0,g){let v=this.lines.get(r);return v?v.translateToString(a,u,g):""}getWrappedRangeForLine(r){let a=r,u=r;for(;a>0&&this.lines.get(a).isWrapped;)a--;for(;u+1<this.lines.length&&this.lines.get(u+1).isWrapped;)u++;return{first:a,last:u}}setupTabStops(r){for(r!=null?this.tabs[r]||(r=this.prevStop(r)):(this.tabs={},r=0);r<this._cols;r+=this._optionsService.rawOptions.tabStopWidth)this.tabs[r]=!0}prevStop(r){for(r==null&&(r=this.x);!this.tabs[--r]&&r>0;);return r>=this._cols?this._cols-1:r<0?0:r}nextStop(r){for(r==null&&(r=this.x);!this.tabs[++r]&&r<this._cols;);return r>=this._cols?this._cols-1:r<0?0:r}clearMarkers(r){this._isClearing=!0;for(let a=0;a<this.markers.length;a++)this.markers[a].line===r&&(this.markers[a].dispose(),this.markers.splice(a--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let r=0;r<this.markers.length;r++)this.markers[r].dispose(),this.markers.splice(r--,1);this._isClearing=!1}addMarker(r){let a=new e.Marker(r);return this.markers.push(a),a.register(this.lines.onTrim((u=>{a.line-=u,a.line<0&&a.dispose()}))),a.register(this.lines.onInsert((u=>{a.line>=u.index&&(a.line+=u.amount)}))),a.register(this.lines.onDelete((u=>{a.line>=u.index&&a.line<u.index+u.amount&&a.dispose(),a.line>u.index&&(a.line-=u.amount)}))),a.register(a.onDispose((()=>this._removeMarker(a)))),a}_removeMarker(r){this._isClearing||this.markers.splice(this.markers.indexOf(r),1)}}},437:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLine=n.DEFAULT_ATTR_DATA=void 0;let h=l(734),f=l(511),c=l(643),p=l(482);n.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let o=0;class i{constructor(e,t,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let a=t||f.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]);for(let u=0;u<e;++u)this.setCell(u,a);this.length=e}get(e){let t=this._data[3*e+0],r=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:r?(0,p.stringFromCodePoint)(r):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,t){this._data[3*e+1]=t[c.CHAR_DATA_ATTR_INDEX],t[c.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[c.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[c.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[c.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,p.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return o=3*e,t.content=this._data[o+0],t.fg=this._data[o+1],t.bg=this._data[o+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodepoint(e,t,r,a){268435456&a.bg&&(this._extendedAttrs[e]=a.extended),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=a.fg,this._data[3*e+2]=a.bg}addCodepointToCell(e,t,r){let a=this._data[3*e+0];2097152&a?this._combined[e]+=(0,p.stringFromCodePoint)(t):2097151&a?(this._combined[e]=(0,p.stringFromCodePoint)(2097151&a)+(0,p.stringFromCodePoint)(t),a&=-2097152,a|=2097152):a=t|4194304,r&&(a&=-12582913,a|=r<<22),this._data[3*e+0]=a}insertCells(e,t,r){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length-e){let a=new f.CellData;for(let u=this.length-e-t-1;u>=0;--u)this.setCell(e+t+u,this.loadCell(e+u,a));for(let u=0;u<t;++u)this.setCell(e+u,r)}else for(let a=e;a<this.length;++a)this.setCell(a,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(e,t,r){if(e%=this.length,t<this.length-e){let a=new f.CellData;for(let u=0;u<this.length-e-t;++u)this.setCell(e+u,this.loadCell(e+t+u,a));for(let u=this.length-t;u<this.length;++u)this.setCell(u,r)}else for(let a=e;a<this.length;++a)this.setCell(a,r);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),this.getWidth(e)!==0||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,r)}replaceCells(e,t,r,a=!1){if(a)for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;else for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,r),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,r);e<t&&e<this.length;)this.setCell(e++,r)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{let a=new Uint32Array(r);a.set(this._data),this._data=a}for(let a=this.length;a<e;++a)this.setCell(a,t)}else{this._data=this._data.subarray(0,r);let a=Object.keys(this._combined);for(let g=0;g<a.length;g++){let v=parseInt(a[g],10);v>=e&&delete this._combined[v]}let u=Object.keys(this._extendedAttrs);for(let g=0;g<u.length;g++){let v=parseInt(u[g],10);v>=e&&delete this._extendedAttrs[v]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);else{this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new i(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,r,a,u){let g=e._data;if(u)for(let S=a-1;S>=0;S--){for(let y=0;y<3;y++)this._data[3*(r+S)+y]=g[3*(t+S)+y];268435456&g[3*(t+S)+2]&&(this._extendedAttrs[r+S]=e._extendedAttrs[t+S])}else for(let S=0;S<a;S++){for(let y=0;y<3;y++)this._data[3*(r+S)+y]=g[3*(t+S)+y];268435456&g[3*(t+S)+2]&&(this._extendedAttrs[r+S]=e._extendedAttrs[t+S])}let v=Object.keys(e._combined);for(let S=0;S<v.length;S++){let y=parseInt(v[S],10);y>=t&&(this._combined[y-t+r]=e._combined[y])}}translateToString(e,t,r,a){t=t??0,r=r??this.length,e&&(r=Math.min(r,this.getTrimmedLength())),a&&(a.length=0);let u="";for(;t<r;){let g=this._data[3*t+0],v=2097151&g,S=2097152&g?this._combined[t]:v?(0,p.stringFromCodePoint)(v):c.WHITESPACE_CELL_CHAR;if(u+=S,a)for(let y=0;y<S.length;++y)a.push(t);t+=g>>22||1}return a&&a.push(t),u}}n.BufferLine=i},634:(_,n)=>{function l(h,f,c){if(f===h.length-1)return h[f].getTrimmedLength();let p=!h[f].hasContent(c-1)&&h[f].getWidth(c-1)===1,o=h[f+1].getWidth(0)===2;return p&&o?c-1:c}Object.defineProperty(n,"__esModule",{value:!0}),n.getWrappedLineTrimmedLength=n.reflowSmallerGetNewLineLengths=n.reflowLargerApplyNewLayout=n.reflowLargerCreateNewLayout=n.reflowLargerGetLinesToRemove=void 0,n.reflowLargerGetLinesToRemove=function(h,f,c,p,o){let i=[];for(let s=0;s<h.length-1;s++){let e=s,t=h.get(++e);if(!t.isWrapped)continue;let r=[h.get(s)];for(;e<h.length&&t.isWrapped;)r.push(t),t=h.get(++e);if(p>=s&&p<e){s+=r.length-1;continue}let a=0,u=l(r,a,f),g=1,v=0;for(;g<r.length;){let y=l(r,g,f),B=y-v,M=c-u,E=Math.min(B,M);r[a].copyCellsFrom(r[g],v,u,E,!1),u+=E,u===c&&(a++,u=0),v+=E,v===y&&(g++,v=0),u===0&&a!==0&&r[a-1].getWidth(c-1)===2&&(r[a].copyCellsFrom(r[a-1],c-1,u++,1,!1),r[a-1].setCell(c-1,o))}r[a].replaceCells(u,c,o);let S=0;for(let y=r.length-1;y>0&&(y>a||r[y].getTrimmedLength()===0);y--)S++;S>0&&(i.push(s+r.length-S),i.push(S)),s+=r.length-1}return i},n.reflowLargerCreateNewLayout=function(h,f){let c=[],p=0,o=f[p],i=0;for(let s=0;s<h.length;s++)if(o===s){let e=f[++p];h.onDeleteEmitter.fire({index:s-i,amount:e}),s+=e-1,i+=e,o=f[++p]}else c.push(s);return{layout:c,countRemoved:i}},n.reflowLargerApplyNewLayout=function(h,f){let c=[];for(let p=0;p<f.length;p++)c.push(h.get(f[p]));for(let p=0;p<c.length;p++)h.set(p,c[p]);h.length=f.length},n.reflowSmallerGetNewLineLengths=function(h,f,c){let p=[],o=h.map(((t,r)=>l(h,r,f))).reduce(((t,r)=>t+r)),i=0,s=0,e=0;for(;e<o;){if(o-e<c){p.push(o-e);break}i+=c;let t=l(h,s,f);i>t&&(i-=t,s++);let r=h[s].getWidth(i-1)===2;r&&i--;let a=r?c-1:c;p.push(a),e+=a}return p},n.getWrappedLineTrimmedLength=l},295:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferSet=void 0;let h=l(460),f=l(844),c=l(92);class p extends f.Disposable{constructor(i,s){super(),this._optionsService=i,this._bufferService=s,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new c.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new c.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(i){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(i),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(i,s){this._normal.resize(i,s),this._alt.resize(i,s),this.setupTabStops(i)}setupTabStops(i){this._normal.setupTabStops(i),this._alt.setupTabStops(i)}}n.BufferSet=p},511:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CellData=void 0;let h=l(482),f=l(643),c=l(734);class p extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(i){let s=new p;return s.setFromCharData(i),s}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(i){this.fg=i[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let s=!1;if(i[f.CHAR_DATA_CHAR_INDEX].length>2)s=!0;else if(i[f.CHAR_DATA_CHAR_INDEX].length===2){let e=i[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){let t=i[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=t&&t<=57343?this.content=1024*(e-55296)+t-56320+65536|i[f.CHAR_DATA_WIDTH_INDEX]<<22:s=!0}else s=!0}else this.content=i[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|i[f.CHAR_DATA_WIDTH_INDEX]<<22;s&&(this.combinedData=i[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|i[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}n.CellData=p},643:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WHITESPACE_CELL_CODE=n.WHITESPACE_CELL_WIDTH=n.WHITESPACE_CELL_CHAR=n.NULL_CELL_CODE=n.NULL_CELL_WIDTH=n.NULL_CELL_CHAR=n.CHAR_DATA_CODE_INDEX=n.CHAR_DATA_WIDTH_INDEX=n.CHAR_DATA_CHAR_INDEX=n.CHAR_DATA_ATTR_INDEX=n.DEFAULT_EXT=n.DEFAULT_ATTR=n.DEFAULT_COLOR=void 0,n.DEFAULT_COLOR=0,n.DEFAULT_ATTR=256|n.DEFAULT_COLOR<<9,n.DEFAULT_EXT=0,n.CHAR_DATA_ATTR_INDEX=0,n.CHAR_DATA_CHAR_INDEX=1,n.CHAR_DATA_WIDTH_INDEX=2,n.CHAR_DATA_CODE_INDEX=3,n.NULL_CELL_CHAR="",n.NULL_CELL_WIDTH=1,n.NULL_CELL_CODE=0,n.WHITESPACE_CELL_CHAR=" ",n.WHITESPACE_CELL_WIDTH=1,n.WHITESPACE_CELL_CODE=32},863:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Marker=void 0;let h=l(460),f=l(844);class c{get id(){return this._id}constructor(o){this.line=o,this.isDisposed=!1,this._disposables=[],this._id=c._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(o){return this._disposables.push(o),o}}n.Marker=c,c._nextId=1},116:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DEFAULT_CHARSET=n.CHARSETS=void 0,n.CHARSETS={},n.DEFAULT_CHARSET=n.CHARSETS.B,n.CHARSETS[0]={"`":"\u25C6",a:"\u2592",b:"\u2409",c:"\u240C",d:"\u240D",e:"\u240A",f:"\xB0",g:"\xB1",h:"\u2424",i:"\u240B",j:"\u2518",k:"\u2510",l:"\u250C",m:"\u2514",n:"\u253C",o:"\u23BA",p:"\u23BB",q:"\u2500",r:"\u23BC",s:"\u23BD",t:"\u251C",u:"\u2524",v:"\u2534",w:"\u252C",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03C0","|":"\u2260","}":"\xA3","~":"\xB7"},n.CHARSETS.A={"#":"\xA3"},n.CHARSETS.B=void 0,n.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},n.CHARSETS.C=n.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},n.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},n.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},n.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},n.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},n.CHARSETS.E=n.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},n.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},n.CHARSETS.H=n.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},n.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},584:(_,n)=>{var l,h,f;Object.defineProperty(n,"__esModule",{value:!0}),n.C1_ESCAPED=n.C1=n.C0=void 0,(function(c){c.NUL="\0",c.SOH="",c.STX="",c.ETX="",c.EOT="",c.ENQ="",c.ACK="",c.BEL="\x07",c.BS="\b",c.HT=" ",c.LF=`
10
10
  `,c.VT="\v",c.FF="\f",c.CR="\r",c.SO="",c.SI="",c.DLE="",c.DC1="",c.DC2="",c.DC3="",c.DC4="",c.NAK="",c.SYN="",c.ETB="",c.CAN="",c.EM="",c.SUB="",c.ESC="\x1B",c.FS="",c.GS="",c.RS="",c.US="",c.SP=" ",c.DEL="\x7F"})(l||(n.C0=l={})),(function(c){c.PAD="\x80",c.HOP="\x81",c.BPH="\x82",c.NBH="\x83",c.IND="\x84",c.NEL="\x85",c.SSA="\x86",c.ESA="\x87",c.HTS="\x88",c.HTJ="\x89",c.VTS="\x8A",c.PLD="\x8B",c.PLU="\x8C",c.RI="\x8D",c.SS2="\x8E",c.SS3="\x8F",c.DCS="\x90",c.PU1="\x91",c.PU2="\x92",c.STS="\x93",c.CCH="\x94",c.MW="\x95",c.SPA="\x96",c.EPA="\x97",c.SOS="\x98",c.SGCI="\x99",c.SCI="\x9A",c.CSI="\x9B",c.ST="\x9C",c.OSC="\x9D",c.PM="\x9E",c.APC="\x9F"})(h||(n.C1=h={})),(function(c){c.ST=`${l.ESC}\\`})(f||(n.C1_ESCAPED=f={}))},482:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Utf8ToUtf32=n.StringToUtf32=n.utf32ToString=n.stringFromCodePoint=void 0,n.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},n.utf32ToString=function(l,h=0,f=l.length){let c="";for(let p=h;p<f;++p){let o=l[p];o>65535?(o-=65536,c+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):c+=String.fromCharCode(o)}return c},n.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,h){let f=l.length;if(!f)return 0;let c=0,p=0;if(this._interim){let o=l.charCodeAt(p++);56320<=o&&o<=57343?h[c++]=1024*(this._interim-55296)+o-56320+65536:(h[c++]=this._interim,h[c++]=o),this._interim=0}for(let o=p;o<f;++o){let i=l.charCodeAt(o);if(55296<=i&&i<=56319){if(++o>=f)return this._interim=i,c;let s=l.charCodeAt(o);56320<=s&&s<=57343?h[c++]=1024*(i-55296)+s-56320+65536:(h[c++]=i,h[c++]=s)}else i!==65279&&(h[c++]=i)}return c}},n.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,h){let f=l.length;if(!f)return 0;let c,p,o,i,s=0,e=0,t=0;if(this.interim[0]){let u=!1,g=this.interim[0];g&=(224&g)==192?31:(240&g)==224?15:7;let v,S=0;for(;(v=63&this.interim[++S])&&S<4;)g<<=6,g|=v;let y=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,B=y-S;for(;t<B;){if(t>=f)return 0;if(v=l[t++],(192&v)!=128){t--,u=!0;break}this.interim[S++]=v,g<<=6,g|=63&v}u||(y===2?g<128?t--:h[s++]=g:y===3?g<2048||g>=55296&&g<=57343||g===65279||(h[s++]=g):g<65536||g>1114111||(h[s++]=g)),this.interim.fill(0)}let r=f-4,a=t;for(;a<f;){for(;!(!(a<r)||128&(c=l[a])||128&(p=l[a+1])||128&(o=l[a+2])||128&(i=l[a+3]));)h[s++]=c,h[s++]=p,h[s++]=o,h[s++]=i,a+=4;if(c=l[a++],c<128)h[s++]=c;else if((224&c)==192){if(a>=f)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(e=(31&c)<<6|63&p,e<128){a--;continue}h[s++]=e}else if((240&c)==224){if(a>=f)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(a>=f)return this.interim[0]=c,this.interim[1]=p,s;if(o=l[a++],(192&o)!=128){a--;continue}if(e=(15&c)<<12|(63&p)<<6|63&o,e<2048||e>=55296&&e<=57343||e===65279)continue;h[s++]=e}else if((248&c)==240){if(a>=f)return this.interim[0]=c,s;if(p=l[a++],(192&p)!=128){a--;continue}if(a>=f)return this.interim[0]=c,this.interim[1]=p,s;if(o=l[a++],(192&o)!=128){a--;continue}if(a>=f)return this.interim[0]=c,this.interim[1]=p,this.interim[2]=o,s;if(i=l[a++],(192&i)!=128){a--;continue}if(e=(7&c)<<18|(63&p)<<12|(63&o)<<6|63&i,e<65536||e>1114111)continue;h[s++]=e}}return s}}},225:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeV6=void 0;let h=l(480),f=[[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]],c=[[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]],p;n.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let o=0;o<f.length;++o)p.fill(0,f[o][0],f[o][1]+1)}}wcwidth(o){return o<32?0:o<127?1:o<65536?p[o]:(function(i,s){let e,t=0,r=s.length-1;if(i<s[0][0]||i>s[r][1])return!1;for(;r>=t;)if(e=t+r>>1,i>s[e][1])t=e+1;else{if(!(i<s[e][0]))return!0;r=e-1}return!1})(o,c)?0:o>=131072&&o<=196605||o>=196608&&o<=262141?2:1}charProperties(o,i){let s=this.wcwidth(o),e=s===0&&i!==0;if(e){let t=h.UnicodeService.extractWidth(i);t===0?e=!1:t>s&&(s=t)}return h.UnicodeService.createPropertyValue(0,s,e)}}},981:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.WriteBuffer=void 0;let h=l(460),f=l(844);class c extends f.Disposable{constructor(o){super(),this._action=o,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(o,i){if(i!==void 0&&this._syncCalls>i)return void(this._syncCalls=0);if(this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let s;for(this._isSyncWriting=!0;s=this._writeBuffer.shift();){this._action(s);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(o,i){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+=o.length,this._writeBuffer.push(o),this._callbacks.push(i),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=o.length,this._writeBuffer.push(o),this._callbacks.push(i)}_innerWrite(o=0,i=!0){let s=o||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],t=this._action(e,i);if(t){let a=u=>Date.now()-s>=12?setTimeout((()=>this._innerWrite(0,u))):this._innerWrite(s,u);return void t.catch((u=>(queueMicrotask((()=>{throw u})),Promise.resolve(!1)))).then(a)}let r=this._callbacks[this._bufferOffset];if(r&&r(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-s>=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()}}n.WriteBuffer=c},941:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.toRgbString=n.parseColor=void 0;let l=/^([\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})$/,h=/^[\da-f]+$/;function f(c,p){let o=c.toString(16),i=o.length<2?"0"+o:o;switch(p){case 4:return o[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}n.parseColor=function(c){if(!c)return;let p=c.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);let o=l.exec(p);if(o){let i=o[1]?15:o[4]?255:o[7]?4095:65535;return[Math.round(parseInt(o[1]||o[4]||o[7]||o[10],16)/i*255),Math.round(parseInt(o[2]||o[5]||o[8]||o[11],16)/i*255),Math.round(parseInt(o[3]||o[6]||o[9]||o[12],16)/i*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),h.exec(p)&&[3,6,9,12].includes(p.length))){let o=p.length/3,i=[0,0,0];for(let s=0;s<3;++s){let e=parseInt(p.slice(o*s,o*s+o),16);i[s]=o===1?e<<4:o===2?e:o===3?e>>4:e>>8}return i}},n.toRgbString=function(c,p=16){let[o,i,s]=c;return`rgb:${f(o,p)}/${f(i,p)}/${f(s,p)}`}},770:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.PAYLOAD_LIMIT=void 0,n.PAYLOAD_LIMIT=1e7},351:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.DcsHandler=n.DcsParser=void 0;let h=l(482),f=l(742),c=l(770),p=[];n.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(i,s){this._handlers[i]===void 0&&(this._handlers[i]=[]);let e=this._handlers[i];return e.push(s),{dispose:()=>{let t=e.indexOf(s);t!==-1&&e.splice(t,1)}}}clearHandler(i){this._handlers[i]&&delete this._handlers[i]}setHandlerFallback(i){this._handlerFb=i}reset(){if(this._active.length)for(let i=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;i>=0;--i)this._active[i].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(i,s){if(this.reset(),this._ident=i,this._active=this._handlers[i]||p,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(s);else this._handlerFb(this._ident,"HOOK",s)}put(i,s,e){if(this._active.length)for(let t=this._active.length-1;t>=0;t--)this._active[t].put(i,s,e);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(i,s,e))}unhook(i,s=!0){if(this._active.length){let e=!1,t=this._active.length-1,r=!1;if(this._stack.paused&&(t=this._stack.loopPosition-1,e=s,r=this._stack.fallThrough,this._stack.paused=!1),!r&&e===!1){for(;t>=0&&(e=this._active[t].unhook(i),e!==!0);t--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!1,e;t--}for(;t>=0;t--)if(e=this._active[t].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=t,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",i);this._active=p,this._ident=0}};let o=new f.Params;o.addParam(0),n.DcsHandler=class{constructor(i){this._handler=i,this._data="",this._params=o,this._hitLimit=!1}hook(i){this._params=i.length>1||i.params[0]?i.clone():o,this._data="",this._hitLimit=!1}put(i,s,e){this._hitLimit||(this._data+=(0,h.utf32ToString)(i,s,e),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(i){let s=!1;if(this._hitLimit)s=!1;else if(i&&(s=this._handler(this._data,this._params),s instanceof Promise))return s.then((e=>(this._params=o,this._data="",this._hitLimit=!1,e)));return this._params=o,this._data="",this._hitLimit=!1,s}}},15:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.EscapeSequenceParser=n.VT500_TRANSITION_TABLE=n.TransitionTable=void 0;let h=l(844),f=l(742),c=l(242),p=l(351);class o{constructor(t){this.table=new Uint8Array(t)}setDefault(t,r){this.table.fill(t<<4|r)}add(t,r,a,u){this.table[r<<8|t]=a<<4|u}addMany(t,r,a,u){for(let g=0;g<t.length;g++)this.table[r<<8|t[g]]=a<<4|u}}n.TransitionTable=o;let i=160;n.VT500_TRANSITION_TABLE=(function(){let e=new o(4095),t=Array.apply(null,Array(256)).map(((S,y)=>y)),r=(S,y)=>t.slice(S,y),a=r(32,127),u=r(0,24);u.push(25),u.push.apply(u,r(28,32));let g=r(0,14),v;for(v in e.setDefault(1,0),e.addMany(a,0,2,0),g)e.addMany([24,26,153,154],v,3,0),e.addMany(r(128,144),v,3,0),e.addMany(r(144,152),v,3,0),e.add(156,v,0,0),e.add(27,v,11,1),e.add(157,v,4,8),e.addMany([152,158,159],v,0,7),e.add(155,v,11,3),e.add(144,v,11,9);return e.addMany(u,0,3,0),e.addMany(u,1,3,1),e.add(127,1,0,1),e.addMany(u,8,0,8),e.addMany(u,3,3,3),e.add(127,3,0,3),e.addMany(u,4,3,4),e.add(127,4,0,4),e.addMany(u,6,3,6),e.addMany(u,5,3,5),e.add(127,5,0,5),e.addMany(u,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(a,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(a,7,0,7),e.addMany(u,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(u,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(u,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(u,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(u,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(u,13,13,13),e.addMany(a,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(i,0,2,0),e.add(i,8,5,8),e.add(i,6,0,6),e.add(i,11,0,11),e.add(i,13,13,13),e})();class s extends h.Disposable{constructor(t=n.VT500_TRANSITION_TABLE){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(r,a,u)=>{},this._executeHandlerFb=r=>{},this._csiHandlerFb=(r,a)=>{},this._escHandlerFb=r=>{},this._errorHandlerFb=r=>r,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new c.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(t,r=[64,126]){let a=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(a=t.prefix.charCodeAt(0),a&&60>a||a>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let g=0;g<t.intermediates.length;++g){let v=t.intermediates.charCodeAt(g);if(32>v||v>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");a<<=8,a|=v}}if(t.final.length!==1)throw new Error("final must be a single byte");let u=t.final.charCodeAt(0);if(r[0]>u||u>r[1])throw new Error(`final must be in range ${r[0]} .. ${r[1]}`);return a<<=8,a|=u,a}identToString(t){let r=[];for(;t;)r.push(String.fromCharCode(255&t)),t>>=8;return r.reverse().join("")}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,r){let a=this._identifier(t,[48,126]);this._escHandlers[a]===void 0&&(this._escHandlers[a]=[]);let u=this._escHandlers[a];return u.push(r),{dispose:()=>{let g=u.indexOf(r);g!==-1&&u.splice(g,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,r){this._executeHandlers[t.charCodeAt(0)]=r}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,r){let a=this._identifier(t);this._csiHandlers[a]===void 0&&(this._csiHandlers[a]=[]);let u=this._csiHandlers[a];return u.push(r),{dispose:()=>{let g=u.indexOf(r);g!==-1&&u.splice(g,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,r){return this._dcsParser.registerHandler(this._identifier(t),r)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,r){return this._oscParser.registerHandler(t,r)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}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(t,r,a,u,g){this._parseStack.state=t,this._parseStack.handlers=r,this._parseStack.handlerPos=a,this._parseStack.transition=u,this._parseStack.chunkPos=g}parse(t,r,a){let u,g=0,v=0,S=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,S=this._parseStack.chunkPos+1;else{if(a===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let y=this._parseStack.handlers,B=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(a===!1&&B>-1){for(;B>=0&&(u=y[B](this._params),u!==!0);B--)if(u instanceof Promise)return this._parseStack.handlerPos=B,u}this._parseStack.handlers=[];break;case 4:if(a===!1&&B>-1){for(;B>=0&&(u=y[B](),u!==!0);B--)if(u instanceof Promise)return this._parseStack.handlerPos=B,u}this._parseStack.handlers=[];break;case 6:if(g=t[this._parseStack.chunkPos],u=this._dcsParser.unhook(g!==24&&g!==26,a),u)return u;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(g=t[this._parseStack.chunkPos],u=this._oscParser.end(g!==24&&g!==26,a),u)return u;g===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,S=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let y=S;y<r;++y){switch(g=t[y],v=this._transitions.table[this.currentState<<8|(g<160?g:i)],v>>4){case 2:for(let O=y+1;;++O){if(O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}if(++O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}if(++O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}if(++O>=r||(g=t[O])<32||g>126&&g<i){this._printHandler(t,y,O),y=O-1;break}}break;case 3:this._executeHandlers[g]?this._executeHandlers[g]():this._executeHandlerFb(g),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:y,code:g,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let B=this._csiHandlers[this._collect<<8|g],M=B?B.length-1:-1;for(;M>=0&&(u=B[M](this._params),u!==!0);M--)if(u instanceof Promise)return this._preserveStack(3,B,M,v,y),u;M<0&&this._csiHandlerFb(this._collect<<8|g,this._params),this.precedingJoinState=0;break;case 8:do switch(g){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(g-48)}while(++y<r&&(g=t[y])>47&&g<60);y--;break;case 9:this._collect<<=8,this._collect|=g;break;case 10:let E=this._escHandlers[this._collect<<8|g],x=E?E.length-1:-1;for(;x>=0&&(u=E[x](),u!==!0);x--)if(u instanceof Promise)return this._preserveStack(4,E,x,v,y),u;x<0&&this._escHandlerFb(this._collect<<8|g),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|g,this._params);break;case 13:for(let O=y+1;;++O)if(O>=r||(g=t[O])===24||g===26||g===27||g>127&&g<i){this._dcsParser.put(t,y,O),y=O-1;break}break;case 14:if(u=this._dcsParser.unhook(g!==24&&g!==26),u)return this._preserveStack(6,[],0,v,y),u;g===27&&(v|=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 O=y+1;;O++)if(O>=r||(g=t[O])<32||g>127&&g<i){this._oscParser.put(t,y,O),y=O-1;break}break;case 6:if(u=this._oscParser.end(g!==24&&g!==26),u)return this._preserveStack(5,[],0,v,y),u;g===27&&(v|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&v}}}n.EscapeSequenceParser=s},242:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OscHandler=n.OscParser=void 0;let h=l(770),f=l(482),c=[];n.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,o){this._handlers[p]===void 0&&(this._handlers[p]=[]);let i=this._handlers[p];return i.push(o),{dispose:()=>{let s=i.indexOf(o);s!==-1&&i.splice(s,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,o,i){if(this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].put(p,o,i);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(p,o,i))}start(){this.reset(),this._state=1}put(p,o,i){if(this._state!==3){if(this._state===1)for(;o<i;){let s=p[o++];if(s===59){this._state=2,this._start();break}if(s<48||57<s)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+s-48}this._state===2&&i-o>0&&this._put(p,o,i)}}end(p,o=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let i=!1,s=this._active.length-1,e=!1;if(this._stack.paused&&(s=this._stack.loopPosition-1,i=o,e=this._stack.fallThrough,this._stack.paused=!1),!e&&i===!1){for(;s>=0&&(i=this._active[s].end(p),i!==!0);s--)if(i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!1,i;s--}for(;s>=0;s--)if(i=this._active[s].end(!1),i instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=s,this._stack.fallThrough=!0,i}else this._handlerFb(this._id,"END",p);this._active=c,this._id=-1,this._state=0}}},n.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,o,i){this._hitLimit||(this._data+=(0,f.utf32ToString)(p,o,i),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let o=!1;if(this._hitLimit)o=!1;else if(p&&(o=this._handler(this._data),o instanceof Promise))return o.then((i=>(this._data="",this._hitLimit=!1,i)));return this._data="",this._hitLimit=!1,o}}},742:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Params=void 0;let l=2147483647;class h{static fromArray(c){let p=new h;if(!c.length)return p;for(let o=Array.isArray(c[0])?1:0;o<c.length;++o){let i=c[o];if(Array.isArray(i))for(let s=0;s<i.length;++s)p.addSubParam(i[s]);else p.addParam(i)}return p}constructor(c=32,p=32){if(this.maxLength=c,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let c=new h(this.maxLength,this.maxSubParamsLength);return c.params.set(this.params),c.length=this.length,c._subParams.set(this._subParams),c._subParamsLength=this._subParamsLength,c._subParamsIdx.set(this._subParamsIdx),c._rejectDigits=this._rejectDigits,c._rejectSubDigits=this._rejectSubDigits,c._digitIsSub=this._digitIsSub,c}toArray(){let c=[];for(let p=0;p<this.length;++p){c.push(this.params[p]);let o=this._subParamsIdx[p]>>8,i=255&this._subParamsIdx[p];i-o>0&&c.push(Array.prototype.slice.call(this._subParams,o,i))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>l?l:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>l?l:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){let p=this._subParamsIdx[c]>>8,o=255&this._subParamsIdx[c];return o-p>0?this._subParams.subarray(p,o):null}getSubParamsAll(){let c={};for(let p=0;p<this.length;++p){let o=this._subParamsIdx[p]>>8,i=255&this._subParamsIdx[p];i-o>0&&(c[p]=this._subParams.slice(o,i))}return c}addDigit(c){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let o=this._digitIsSub?this._subParams:this.params,i=o[p-1];o[p-1]=~i?Math.min(10*i+c,l):c}}n.Params=h},741:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.AddonManager=void 0,n.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,h){let f={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(f),h.dispose=()=>this._wrappedAddonDispose(f),h.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let h=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===l){h=f;break}if(h===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(h,1)}}},771:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferApiView=void 0;let h=l(785),f=l(511);n.BufferApiView=class{constructor(c,p){this._buffer=c,this.type=p}init(c){return this._buffer=c,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(c){let p=this._buffer.lines.get(c);if(p)return new h.BufferLineApiView(p)}getNullCell(){return new f.CellData}}},785:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferLineApiView=void 0;let h=l(511);n.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,c){if(!(f<0||f>=this._line.length))return c?(this._line.loadCell(f,c),c):this._line.loadCell(f,new h.CellData)}translateToString(f,c,p){return this._line.translateToString(f,c,p)}}},285:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.BufferNamespaceApi=void 0;let h=l(771),f=l(460),c=l(844);class p extends c.Disposable{constructor(i){super(),this._core=i,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.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)}}n.BufferNamespaceApi=p},975:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ParserApi=void 0,n.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,h){return this._core.registerCsiHandler(l,(f=>h(f.toArray())))}addCsiHandler(l,h){return this.registerCsiHandler(l,h)}registerDcsHandler(l,h){return this._core.registerDcsHandler(l,((f,c)=>h(f,c.toArray())))}addDcsHandler(l,h){return this.registerDcsHandler(l,h)}registerEscHandler(l,h){return this._core.registerEscHandler(l,h)}addEscHandler(l,h){return this.registerEscHandler(l,h)}registerOscHandler(l,h){return this._core.registerOscHandler(l,h)}addOscHandler(l,h){return this.registerOscHandler(l,h)}}},90:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeApi=void 0,n.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(_,n,l){var h=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},f=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.BufferService=n.MINIMUM_ROWS=n.MINIMUM_COLS=void 0;let c=l(460),p=l(844),o=l(295),i=l(585);n.MINIMUM_COLS=2,n.MINIMUM_ROWS=1;let s=n.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new c.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new c.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,n.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,n.MINIMUM_ROWS),this.buffers=this.register(new o.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let r=this.buffer,a;a=this._cachedBlankLine,a&&a.length===this.cols&&a.getFg(0)===e.fg&&a.getBg(0)===e.bg||(a=r.getBlankLine(e,t),this._cachedBlankLine=a),a.isWrapped=t;let u=r.ybase+r.scrollTop,g=r.ybase+r.scrollBottom;if(r.scrollTop===0){let v=r.lines.isFull;g===r.lines.length-1?v?r.lines.recycle().copyFrom(a):r.lines.push(a.clone()):r.lines.splice(g+1,0,a.clone()),v?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{let v=g-u+1;r.lines.shiftElements(u+1,v-1,-1),r.lines.set(g,a.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t,r){let a=this.buffer;if(e<0){if(a.ydisp===0)return;this.isUserScrolling=!0}else e+a.ydisp>=a.ybase&&(this.isUserScrolling=!1);let u=a.ydisp;a.ydisp=Math.max(Math.min(a.ydisp+e,a.ybase),0),u!==a.ydisp&&(t||this._onScroll.fire(a.ydisp))}};n.BufferService=s=h([f(0,i.IOptionsService)],s)},994:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.CharsetService=void 0,n.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,h){this._charsets[l]=h,this.glevel===l&&(this.charset=h)}}},753:function(_,n,l){var h=this&&this.__decorate||function(a,u,g,v){var S,y=arguments.length,B=y<3?u:v===null?v=Object.getOwnPropertyDescriptor(u,g):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(a,u,g,v);else for(var M=a.length-1;M>=0;M--)(S=a[M])&&(B=(y<3?S(B):y>3?S(u,g,B):S(u,g))||B);return y>3&&B&&Object.defineProperty(u,g,B),B},f=this&&this.__param||function(a,u){return function(g,v){u(g,v,a)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreMouseService=void 0;let c=l(585),p=l(460),o=l(844),i={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:a=>a.button!==4&&a.action===1&&(a.ctrl=!1,a.alt=!1,a.shift=!1,!0)},VT200:{events:19,restrict:a=>a.action!==32},DRAG:{events:23,restrict:a=>a.action!==32||a.button!==3},ANY:{events:31,restrict:a=>!0}};function s(a,u){let g=(a.ctrl?16:0)|(a.shift?4:0)|(a.alt?8:0);return a.button===4?(g|=64,g|=a.action):(g|=3&a.button,4&a.button&&(g|=64),8&a.button&&(g|=128),a.action===32?g|=32:a.action!==0||u||(g|=3)),g}let e=String.fromCharCode,t={DEFAULT:a=>{let u=[s(a,!1)+32,a.col+32,a.row+32];return u[0]>255||u[1]>255||u[2]>255?"":`\x1B[M${e(u[0])}${e(u[1])}${e(u[2])}`},SGR:a=>{let u=a.action===0&&a.button!==4?"m":"M";return`\x1B[<${s(a,!0)};${a.col};${a.row}${u}`},SGR_PIXELS:a=>{let u=a.action===0&&a.button!==4?"m":"M";return`\x1B[<${s(a,!0)};${a.x};${a.y}${u}`}},r=n.CoreMouseService=class extends o.Disposable{constructor(a,u){super(),this._bufferService=a,this._coreService=u,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let g of Object.keys(i))this.addProtocol(g,i[g]);for(let g of Object.keys(t))this.addEncoding(g,t[g]);this.reset()}addProtocol(a,u){this._protocols[a]=u}addEncoding(a,u){this._encodings[a]=u}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(a){if(!this._protocols[a])throw new Error(`unknown protocol "${a}"`);this._activeProtocol=a,this._onProtocolChange.fire(this._protocols[a].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(a){if(!this._encodings[a])throw new Error(`unknown encoding "${a}"`);this._activeEncoding=a}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(a){if(a.col<0||a.col>=this._bufferService.cols||a.row<0||a.row>=this._bufferService.rows||a.button===4&&a.action===32||a.button===3&&a.action!==32||a.button!==4&&(a.action===2||a.action===3)||(a.col++,a.row++,a.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,a,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(a))return!1;let u=this._encodings[this._activeEncoding](a);return u&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(u):this._coreService.triggerDataEvent(u,!0)),this._lastEvent=a,!0}explainEvents(a){return{down:!!(1&a),up:!!(2&a),drag:!!(4&a),move:!!(8&a),wheel:!!(16&a)}}_equalEvents(a,u,g){if(g){if(a.x!==u.x||a.y!==u.y)return!1}else if(a.col!==u.col||a.row!==u.row)return!1;return a.button===u.button&&a.action===u.action&&a.ctrl===u.ctrl&&a.alt===u.alt&&a.shift===u.shift}};n.CoreMouseService=r=h([f(0,c.IBufferService),f(1,c.ICoreService)],r)},83:function(_,n,l){var h=this&&this.__decorate||function(r,a,u,g){var v,S=arguments.length,y=S<3?a:g===null?g=Object.getOwnPropertyDescriptor(a,u):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(r,a,u,g);else for(var B=r.length-1;B>=0;B--)(v=r[B])&&(y=(S<3?v(y):S>3?v(a,u,y):v(a,u))||y);return S>3&&y&&Object.defineProperty(a,u,y),y},f=this&&this.__param||function(r,a){return function(u,g){a(u,g,r)}};Object.defineProperty(n,"__esModule",{value:!0}),n.CoreService=void 0;let c=l(439),p=l(460),o=l(844),i=l(585),s=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),t=n.CoreService=class extends o.Disposable{constructor(r,a,u){super(),this._bufferService=r,this._logService=a,this._optionsService=u,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,c.clone)(s),this.decPrivateModes=(0,c.clone)(e)}reset(){this.modes=(0,c.clone)(s),this.decPrivateModes=(0,c.clone)(e)}triggerDataEvent(r,a=!1){if(this._optionsService.rawOptions.disableStdin)return;let u=this._bufferService.buffer;a&&this._optionsService.rawOptions.scrollOnUserInput&&u.ybase!==u.ydisp&&this._onRequestScrollToBottom.fire(),a&&this._onUserInput.fire(),this._logService.debug(`sending data "${r}"`,(()=>r.split("").map((g=>g.charCodeAt(0))))),this._onData.fire(r)}triggerBinaryEvent(r){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${r}"`,(()=>r.split("").map((a=>a.charCodeAt(0))))),this._onBinary.fire(r))}};n.CoreService=t=h([f(0,i.IBufferService),f(1,i.ILogService),f(2,i.IOptionsService)],t)},348:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.InstantiationService=n.ServiceCollection=void 0;let h=l(585),f=l(343);class c{constructor(...o){this._entries=new Map;for(let[i,s]of o)this.set(i,s)}set(o,i){let s=this._entries.get(o);return this._entries.set(o,i),s}forEach(o){for(let[i,s]of this._entries.entries())o(i,s)}has(o){return this._entries.has(o)}get(o){return this._entries.get(o)}}n.ServiceCollection=c,n.InstantiationService=class{constructor(){this._services=new c,this._services.set(h.IInstantiationService,this)}setService(p,o){this._services.set(p,o)}getService(p){return this._services.get(p)}createInstance(p,...o){let i=(0,f.getServiceDependencies)(p).sort(((t,r)=>t.index-r.index)),s=[];for(let t of i){let r=this._services.get(t.id);if(!r)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${t.id}.`);s.push(r)}let e=i.length>0?i[0].index:o.length;if(o.length!==e)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${e+1} conflicts with ${o.length} static arguments`);return new p(...o,...s)}}},866:function(_,n,l){var h=this&&this.__decorate||function(e,t,r,a){var u,g=arguments.length,v=g<3?t:a===null?a=Object.getOwnPropertyDescriptor(t,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(e,t,r,a);else for(var S=e.length-1;S>=0;S--)(u=e[S])&&(v=(g<3?u(v):g>3?u(t,r,v):u(t,r))||v);return g>3&&v&&Object.defineProperty(t,r,v),v},f=this&&this.__param||function(e,t){return function(r,a){t(r,a,e)}};Object.defineProperty(n,"__esModule",{value:!0}),n.traceCall=n.setTraceLogger=n.LogService=void 0;let c=l(844),p=l(585),o={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF},i,s=n.LogService=class extends c.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),i=this}_updateLogLevel(){this._logLevel=o[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...r)}trace(e,...t){this._logLevel<=p.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=p.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=p.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=p.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};n.LogService=s=h([f(0,p.IOptionsService)],s),n.setTraceLogger=function(e){i=e},n.traceCall=function(e,t,r){if(typeof r.value!="function")throw new Error("not supported");let a=r.value;r.value=function(...u){if(i.logLevel!==p.LogLevelEnum.TRACE)return a.apply(this,u);i.trace(`GlyphRenderer#${a.name}(${u.map((v=>JSON.stringify(v))).join(", ")})`);let g=a.apply(this,u);return i.trace(`GlyphRenderer#${a.name} return`,g),g}}},302:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.OptionsService=n.DEFAULT_OPTIONS=void 0;let h=l(460),f=l(844),c=l(114);n.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:c.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let p=["normal","bold","100","200","300","400","500","600","700","800","900"];class o extends f.Disposable{constructor(s){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;let e={...n.DEFAULT_OPTIONS};for(let t in s)if(t in e)try{let r=s[t];e[t]=this._sanitizeAndValidateOption(t,r)}catch(r){console.error(r)}this.rawOptions=e,this.options={...e},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(s,e){return this.onOptionChange((t=>{t===s&&e(this.rawOptions[s])}))}onMultipleOptionChange(s,e){return this.onOptionChange((t=>{s.indexOf(t)!==-1&&e()}))}_setupOptions(){let s=t=>{if(!(t in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);return this.rawOptions[t]},e=(t,r)=>{if(!(t in n.DEFAULT_OPTIONS))throw new Error(`No option with key "${t}"`);r=this._sanitizeAndValidateOption(t,r),this.rawOptions[t]!==r&&(this.rawOptions[t]=r,this._onOptionChange.fire(t))};for(let t in this.rawOptions){let r={get:s.bind(this,t),set:e.bind(this,t)};Object.defineProperty(this.options,t,r)}}_sanitizeAndValidateOption(s,e){switch(s){case"cursorStyle":if(e||(e=n.DEFAULT_OPTIONS[s]),!(function(t){return t==="block"||t==="underline"||t==="bar"})(e))throw new Error(`"${e}" is not a valid value for ${s}`);break;case"wordSeparator":e||(e=n.DEFAULT_OPTIONS[s]);break;case"fontWeight":case"fontWeightBold":if(typeof e=="number"&&1<=e&&e<=1e3)break;e=p.includes(e)?e:n.DEFAULT_OPTIONS[s];break;case"cursorWidth":e=Math.floor(e);case"lineHeight":case"tabStopWidth":if(e<1)throw new Error(`${s} cannot be less than 1, value: ${e}`);break;case"minimumContrastRatio":e=Math.max(1,Math.min(21,Math.round(10*e)/10));break;case"scrollback":if((e=Math.min(e,4294967295))<0)throw new Error(`${s} cannot be less than 0, value: ${e}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(e<=0)throw new Error(`${s} cannot be less than or equal to 0, value: ${e}`);break;case"rows":case"cols":if(!e&&e!==0)throw new Error(`${s} must be numeric, value: ${e}`);break;case"windowsPty":e=e??{}}return e}}n.OptionsService=o},660:function(_,n,l){var h=this&&this.__decorate||function(o,i,s,e){var t,r=arguments.length,a=r<3?i:e===null?e=Object.getOwnPropertyDescriptor(i,s):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(o,i,s,e);else for(var u=o.length-1;u>=0;u--)(t=o[u])&&(a=(r<3?t(a):r>3?t(i,s,a):t(i,s))||a);return r>3&&a&&Object.defineProperty(i,s,a),a},f=this&&this.__param||function(o,i){return function(s,e){i(s,e,o)}};Object.defineProperty(n,"__esModule",{value:!0}),n.OscLinkService=void 0;let c=l(585),p=n.OscLinkService=class{constructor(o){this._bufferService=o,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(o){let i=this._bufferService.buffer;if(o.id===void 0){let u=i.addMarker(i.ybase+i.y),g={data:o,id:this._nextId++,lines:[u]};return u.onDispose((()=>this._removeMarkerFromLink(g,u))),this._dataByLinkId.set(g.id,g),g.id}let s=o,e=this._getEntryIdKey(s),t=this._entriesWithId.get(e);if(t)return this.addLineToLink(t.id,i.ybase+i.y),t.id;let r=i.addMarker(i.ybase+i.y),a={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[r]};return r.onDispose((()=>this._removeMarkerFromLink(a,r))),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(o,i){let s=this._dataByLinkId.get(o);if(s&&s.lines.every((e=>e.line!==i))){let e=this._bufferService.buffer.addMarker(i);s.lines.push(e),e.onDispose((()=>this._removeMarkerFromLink(s,e)))}}getLinkData(o){return this._dataByLinkId.get(o)?.data}_getEntryIdKey(o){return`${o.id};;${o.uri}`}_removeMarkerFromLink(o,i){let s=o.lines.indexOf(i);s!==-1&&(o.lines.splice(s,1),o.lines.length===0&&(o.data.id!==void 0&&this._entriesWithId.delete(o.key),this._dataByLinkId.delete(o.id)))}};n.OscLinkService=p=h([f(0,c.IBufferService)],p)},343:(_,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.createDecorator=n.getServiceDependencies=n.serviceRegistry=void 0;let l="di$target",h="di$dependencies";n.serviceRegistry=new Map,n.getServiceDependencies=function(f){return f[h]||[]},n.createDecorator=function(f){if(n.serviceRegistry.has(f))return n.serviceRegistry.get(f);let c=function(p,o,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(s,e,t){e[l]===e?e[h].push({id:s,index:t}):(e[h]=[{id:s,index:t}],e[l]=e)})(c,p,i)};return c.toString=()=>f,n.serviceRegistry.set(f,c),c}},585:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.IDecorationService=n.IUnicodeService=n.IOscLinkService=n.IOptionsService=n.ILogService=n.LogLevelEnum=n.IInstantiationService=n.ICharsetService=n.ICoreService=n.ICoreMouseService=n.IBufferService=void 0;let h=l(343);var f;n.IBufferService=(0,h.createDecorator)("BufferService"),n.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),n.ICoreService=(0,h.createDecorator)("CoreService"),n.ICharsetService=(0,h.createDecorator)("CharsetService"),n.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(c){c[c.TRACE=0]="TRACE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARN=3]="WARN",c[c.ERROR=4]="ERROR",c[c.OFF=5]="OFF"})(f||(n.LogLevelEnum=f={})),n.ILogService=(0,h.createDecorator)("LogService"),n.IOptionsService=(0,h.createDecorator)("OptionsService"),n.IOscLinkService=(0,h.createDecorator)("OscLinkService"),n.IUnicodeService=(0,h.createDecorator)("UnicodeService"),n.IDecorationService=(0,h.createDecorator)("DecorationService")},480:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.UnicodeService=void 0;let h=l(460),f=l(225);class c{static extractShouldJoin(o){return(1&o)!=0}static extractWidth(o){return o>>1&3}static extractCharKind(o){return o>>3}static createPropertyValue(o,i,s=!1){return(16777215&o)<<3|(3&i)<<1|(s?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;let o=new f.UnicodeV6;this.register(o),this._active=o.version,this._activeProvider=o}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(o){if(!this._providers[o])throw new Error(`unknown Unicode version "${o}"`);this._active=o,this._activeProvider=this._providers[o],this._onChange.fire(o)}register(o){this._providers[o.version]=o}wcwidth(o){return this._activeProvider.wcwidth(o)}getStringCellWidth(o){let i=0,s=0,e=o.length;for(let t=0;t<e;++t){let r=o.charCodeAt(t);if(55296<=r&&r<=56319){if(++t>=e)return i+this.wcwidth(r);let g=o.charCodeAt(t);56320<=g&&g<=57343?r=1024*(r-55296)+g-56320+65536:i+=this.wcwidth(g)}let a=this.charProperties(r,s),u=c.extractWidth(a);c.extractShouldJoin(a)&&(u-=c.extractWidth(s)),i+=u,s=a}return i}charProperties(o,i){return this._activeProvider.charProperties(o,i)}}n.UnicodeService=c},781:(_,n,l)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.Terminal=void 0;let h=l(437),f=l(969),c=l(460);class p extends f.CoreTerminal{constructor(i={}){super(i),this._onBell=this.register(new c.EventEmitter),this.onBell=this._onBell.event,this._onCursorMove=this.register(new c.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this.register(new c.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this.register(new c.EventEmitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this.register(new c.EventEmitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this.register(this._inputHandler.onRequestBell((()=>this.bell()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register((0,c.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,c.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,c.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,c.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(i){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+i)}bell(){this._onBell.fire()}input(i,s=!0){this.coreService.triggerDataEvent(i,s)}resize(i,s){i===this.cols&&s===this.rows||super.resize(i,s)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let i=1;i<this.rows;i++)this.buffer.lines.push(this.buffer.getBlankLine(h.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}n.Terminal=p}},R={};function W(_){var n=R[_];if(n!==void 0)return n.exports;var l=R[_]={exports:{}};return T[_].call(l.exports,l,l.exports,W),l.exports}var $={};(()=>{var _=$;Object.defineProperty(_,"__esModule",{value:!0}),_.Terminal=void 0;let n=W(285),l=W(975),h=W(90),f=W(781),c=W(741),p=W(844),o=["cols","rows"];class i extends p.Disposable{constructor(e){super(),this._core=this.register(new f.Terminal(e)),this._addonManager=this.register(new c.AddonManager),this._publicOptions={...this._core.options};let t=a=>this._core.options[a],r=(a,u)=>{this._checkReadonlyOptions(a),this._core.options[a]=u};for(let a in this._core.options){Object.defineProperty(this._publicOptions,a,{get:()=>this._core.options[a],set:g=>{this._checkReadonlyOptions(a),this._core.options[a]=g}});let u={get:t.bind(this,a),set:r.bind(this,a)};Object.defineProperty(this._publicOptions,a,u)}}_checkReadonlyOptions(e){if(o.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.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 onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new h.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this.register(new n.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}registerMarker(e=0){return this._checkProposedApi(),this._verifyIntegers(e),this._core.addMarker(e)}addMarker(e){return this.registerMarker(e)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
11
- `,t)}reset(){this._core.reset()}loadAddon(e){this._addonManager.loadAddon(this,e)}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}}_.Terminal=i})();var P=ut;for(var d in $)P[d]=$[d];$.__esModule&&Object.defineProperty(P,"__esModule",{value:!0})})()});var Ct=lt(_t(),1),yt=lt(ft(),1);var Xt={Enter:"\r",Escape:"\x1B",Backspace:"\x7F",Tab:" "," ":" ",Spacebar:" ",Delete:"\x1B[3~",Insert:"\x1B[2~",ArrowUp:"\x1B[A",ArrowDown:"\x1B[B",ArrowRight:"\x1B[C",ArrowLeft:"\x1B[D",Home:"\x1B[H",End:"\x1B[F",PageUp:"\x1B[5~",PageDown:"\x1B[6~",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~"},pt={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},vt={Insert:2,Delete:3,PageUp:5,PageDown:6},gt={"@":0,"[":27,"\\":28,"]":29,"^":30,_:31};function Jt(T){if(T.key==="F5"||T.key==="F11"||T.key==="F12")return!0;if(!(T.ctrlKey||T.metaKey))return!1;let R=T.key.toLowerCase();return R==="r"||T.shiftKey&&(R==="i"||R==="j"||R==="c")?!0:R==="w"||R==="t"||R==="n"}function mt(T){if(Jt(T)||T.metaKey)return null;let R=T.key;if(T.ctrlKey&&!T.altKey&&R.length===1){let $=R.toLowerCase();return $>="a"&&$<="z"?String.fromCharCode($.charCodeAt(0)-96):$ in gt?String.fromCharCode(gt[$]):null}if((T.ctrlKey||T.altKey)&&!T.shiftKey){let $=1+(T.altKey?2:0)+(T.ctrlKey?4:0);return R in pt?"\x1B[1;"+$+pt[R]:R in vt?"\x1B["+vt[R]+";"+$+"~":null}if(T.altKey)return null;if(R==="Tab"&&T.shiftKey)return"\x1B[Z";let W=Xt[R];return W!==void 0?W:R.length===1?R:null}function Yt(T){let R=T.match(it);if(R&&R.length>0){let W=R[R.length-1].match(/(-?\d+)>$/),$=W?parseInt(W[1],10):NaN;return{text:T.replace(it,""),exitCode:isNaN($)?void 0:$}}return{text:T}}var St={en:{commands:"commands",sessionGone:"Session missing or disconnected",noSession:"No terminal. Use term_cli connect (SSH) or term_cli local first.",terminals:"terminals",local:"local",cmdPlaceholder:"Enter command (Shift+Enter new line)",directInput:"Direct input (type here for interactive prompts)",inputOn:"Direct input: ON \u2014 keys go to terminal",inputOff:"Direct input: OFF \u2014 keys stay in browser",inputDisconnected:"Disconnected \u2014 input will not be sent",inputOffline:"Terminal offline \u2014 input will not be sent",deleteBlocked:"Cannot delete this terminal (still active or owned by another instance).",deleteFailed:"Delete failed."},zh:{commands:"\u6761\u547D\u4EE4",sessionGone:"\u4F1A\u8BDD\u4E0D\u5B58\u5728\u6216\u5DF2\u65AD\u5F00",noSession:"\u65E0\u7EC8\u7AEF\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u7528 term_cli connect\uFF08SSH\uFF09\u6216 term_cli local \u5EFA\u7ACB\u3002",terminals:"\u7EC8\u7AEF",local:"\u672C\u5730",cmdPlaceholder:"\u8F93\u5165\u547D\u4EE4\uFF08Shift+Enter \u6362\u884C\uFF09",directInput:"\u76F4\u63A5\u8F93\u5165\uFF08\u4EA4\u4E92\u8F93\u5165\u8BF7\u76F4\u63A5\u5728\u6B64\u8F93\u5165\uFF09",inputOn:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u542F\u7528\uFF08\u6309\u952E\u53D1\u5F80\u7EC8\u7AEF\uFF09",inputOff:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u5173\u95ED\uFF08\u6309\u952E\u7559\u5728\u6D4F\u89C8\u5668\uFF09",inputDisconnected:"\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",inputOffline:"\u7EC8\u7AEF\u672A\u8FDE\u63A5\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",deleteBlocked:"\u65E0\u6CD5\u5220\u9664\u8BE5\u7EC8\u7AEF\uFF08\u4ECD\u5728\u6D3B\u52A8\u6216\u5C5E\u4E8E\u5176\u4ED6\u5B9E\u4F8B\uFF09\u3002",deleteFailed:"\u5220\u9664\u5931\u8D25\u3002"}},Zt=document.documentElement.lang==="zh"?"zh":"en";function Qt(T,R){let W={...St[R]};for(let $ of Object.keys(St[R])){let P=T?.[$];typeof P=="string"&&P.length>0&&(W[$]=P)}return W}var te=Qt(window.__I18N__,Zt),De=window.__PTY_COLS__||120,wt=window.__PTY_ROWS__||40,bt=window.__HEARTBEAT_INTERVAL_MS__||0,ei=window.__HEARTBEAT_CLIENT_TIMEOUT_MS__||0,ti=["#010101","#de382b","#39b54a","#ffc005","#006fb8","#762671","#2cb3e9","#c9d1d9"],ii=["#666666","#ff7b72","#3fb950","#d29922","#58a6ff","#bc8cff","#39c5cf","#f0f6fc"],Et=2e3,si=1e4,Ye=[0,95,135,175,215,255];function We(T,R,W){let $=P=>P.toString(16).padStart(2,"0");return"#"+$(T)+$(R)+$(W)}function kt(T){if(T>=0&&T<8)return ti[T];if(T>=8&&T<16)return ii[T-8];if(T>=16&&T<232){let R=T-16;return We(Ye[Math.floor(R/36)],Ye[Math.floor(R%36/6)],Ye[R%6])}if(T>=232&&T<256){let R=8+(T-232)*10;return We(R,R,R)}return null}function ri(T){if(T.isFgDefault())return null;let R=T.getFgColor();return T.isFgPalette()?kt(R):We(R>>16&255,R>>8&255,R&255)}function ni(T){if(T.isBgDefault())return null;let R=T.getBgColor();return T.isBgPalette()?kt(R):We(R>>16&255,R>>8&255,R&255)}var be=class{constructor(R){Re(this,"term");Re(this,"queue",Promise.resolve());Re(this,"disposed",!1);this.term=new yt.Terminal({cols:R,rows:wt,scrollback:Et,allowProposedApi:!0})}write(R){return this.queue=this.queue.then(()=>this.writeOnce(R)),this.queue}writeOnce(R){return this.disposed?Promise.resolve():new Promise(W=>{let $=!1,P=()=>{$||($=!0,W())},d=setTimeout(P,si);this.term.write(R,()=>{clearTimeout(d),P()})})}render(){if(this.disposed)return[];let R=P=>P.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),W=this.term.buffer.active,$=[];for(let P=0;P<W.length;P++){let d=W.getLine(P);if(!d)continue;let _=d.length;for(;_>0;){let f=d.getCell(_-1)?.getChars()??"";if(f!==""&&f!==" ")break;_--}if(_===0)continue;let n="",l=null;for(let h=0;h<_;h++){let f=d.getCell(h);if(!f||f.getWidth()===0)continue;let c=[];f.isBold()&&c.push("font-weight:bold");let p=ri(f);p&&c.push("color:"+p);let o=ni(f);o&&c.push("background-color:"+o);let i=c.join(";");i!==l&&(l&&(n+="</span>"),l=i,i&&(n+='<span style="'+i+'">')),n+=R(f.getChars()||" ")}l&&(n+="</span>"),$.push(n)}return $}dispose(){this.disposed||(this.disposed=!0,this.term.dispose())}},Y=null,He=!1,Ze=null,Qe=0,ke=null,Ne=!1,oi="directInput",pe=!1,se=[],Ce=!0,fe=null,ge=null,oe=!1,je=localStorage.getItem("debugMode")==="1",Lt="";function Dt(){return je}function Be(){fe&&fe.dispose(),fe=null}var ai=2e3;function Bt(){He=!1,Fe(),Y=new WebSocket("ws://"+window.location.host+"/ws"),Y.onopen=()=>{He=!0,ce="",le="",Y.send(JSON.stringify({type:"list"})),Rt(),Fe(),hi()},Y.onmessage=T=>{let R;try{R=JSON.parse(T.data)}catch{return}switch(R.type){case"ping":Qe=Date.now(),Y.send(JSON.stringify({type:"pong"}));break;case"sessions":di(R);break;case"snapshot":ui(R);break;case"meta":pi(R);break;case"diff":fi(R);break;case"raw":vi(R);break;case"deleteResult":wi(R);break}},Y.onclose=()=>{ci(),He=!1,Fe(),li()}}function hi(){bt<=0||(Qe=Date.now(),ke===null&&(ke=window.setInterval(()=>{!Y||Y.readyState!==WebSocket.OPEN||Date.now()-Qe>ei&&Y.close()},bt)))}function ci(){ke!==null&&(window.clearInterval(ke),ke=null)}function li(){Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,Bt()},ai))}function Tt(){let T=document.getElementById("session"),R=document.getElementById("terminal"),W=document.getElementById("term");T.innerHTML="",R.innerHTML="",W.innerHTML='<div class="row"><span class="c">'+(te.noSession||"")+"</span></div>",document.getElementById("meta").textContent="",ie=[],Be(),ce="",le="",je=!1,oe=!1,localStorage.removeItem("debugMode");let $=document.getElementById("debugMode");$.checked=!1,ze(),At()}function di(T){let R=T.sessions||[],W=document.getElementById("session");if(se=R,R.length===0){Tt();return}let $=R.map(_=>_.sessionID+"|"+_.terminals.length).join(","),P=W.value,d=document.getElementById("terminal").value;W.innerHTML="";for(let _ of se){let n=document.createElement("option");n.value=_.sessionID,n.textContent=Pt(_)+" ("+_.terminals.length+" "+te.terminals+")",W.appendChild(n)}P&&[...W.options].some(_=>_.value===P)?W.value=P:W.selectedIndex=se.length?0:-1,$e(d)}function At(){let T=document.getElementById("debugMode"),R=document.getElementById("rawToggle");T.disabled=!1,R&&R.classList.remove("disabled"),T.checked=je,oe=Dt(),oe?ot():ze(),Fe()}function _i(){if(!He)return{enabled:!1,reason:te.inputDisconnected};let T=document.getElementById("session").value,R=document.getElementById("terminal").value,W=se.find($=>$.sessionID===T)?.terminals.find($=>($.name||"default")===R);return!T||!R||!W?.connected?{enabled:!1,reason:te.inputOffline}:{enabled:!0,reason:""}}function Fe(){let T=_i(),R=Ne;Ne=T.enabled;let W=document.getElementById("cmdInput");W.disabled=!T.enabled,W.placeholder=T.enabled?te.cmdPlaceholder||"":T.reason,W.title=T.reason,T.enabled&&!R&&(qe(!1),W.focus()),ht();let $=document.getElementById("connStatus");$&&($.textContent=T.enabled?"":T.reason,$.classList.toggle("show",!T.enabled))}function $e(T,R=!1){let W=document.getElementById("session"),$=document.getElementById("terminal"),P=document.getElementById("delTerm"),d=W.value,_=se.find(p=>p.sessionID===d),n=$.value;$.innerHTML="";for(let p of _?_.terminals:[]){let o=document.createElement("option");o.value=p.name||"default",o.textContent=(p.name||"default")+(p.kind==="local"?" ["+te.local+"]":"")+" "+(p.connected?"\u25CF":"\u25CB")+(p.busy?" \u23F3":""),$.appendChild(o)}T&&[...$.options].some(p=>p.value===T)?$.value=T:$.selectedIndex=$.options.length?0:-1;let l=_?.terminals.find(p=>(p.name||"default")===$.value),h=!!(l&&!l.connected);P.classList.toggle("show",h);let f=!!(l&&l.canDelete);P.disabled=!f,P.title=h&&!f?l?.deleteReason||te.deleteBlocked:Lt,At(),rt();let c=$.value;(R||c!==n)&&(ce="",le="",Rt())}var ce="",le="",ie=[];function Rt(){let T=document.getElementById("session").value,R=document.getElementById("terminal").value;!T||!R||!Y||Y.readyState!==WebSocket.OPEN||T===ce&&R===le||(ce=T,le=R,Be(),Y.send(JSON.stringify({type:"subscribe",sessionID:T,name:R,mode:oe?"raw":"transcript"})))}async function ui(T){let R=document.getElementById("term"),W=document.getElementById("toBottom");if(T.notFound){R.innerHTML='<div class="row"><span class="t"></span><span class="c">'+te.sessionGone+"</span></div>",document.getElementById("meta").textContent="",mi(T.sessionID,T.name);return}let $=T.pairs||[],P=!oe&&document.getElementById("showTime").checked;document.body.classList.toggle("show-time",P);let d=$.filter(n=>n.type==="cmd").length;if(rt(d),ie=$,oe)return;Be(),ge=null;let _=await gi($,P);T.sessionID!==ce||T.name!==le||(R.innerHTML=_,et(R,W))}function rt(T){let R=document.getElementById("session").value,W=document.getElementById("terminal").value;if(!R){document.getElementById("meta").textContent="";return}let P=se.find(h=>h.sessionID===R)?.terminals.find(h=>(h.name||"default")===W),d=P?P.host?P.host+(P.port?":"+P.port:""):P.program||"":"",_=d?" ["+d+"]":"",l=" \xB7 "+(T??ie.filter(h=>h.type==="cmd").length)+" "+te.commands;document.getElementById("meta").textContent=R+"/"+W+_+l}function et(T,R){Ce?(T.scrollTop=T.scrollHeight,R.style.display="none"):R.style.display=T.scrollHeight>T.clientHeight?"inline-block":"none"}async function fi(T){if(oe)return;let R=document.getElementById("term"),W=document.getElementById("toBottom"),$=document.getElementById("showTime").checked;if(T.event==="cmd"){if(!T.command)return;let P=ge;P&&P.dataset.finalized!=="1"&&P.remove(),ge=null,Be();let d=$?Ot(Date.now()):"",_=document.createElement("div");_.className="row cmdline",_.innerHTML='<span class="t">'+d+'</span><span class="c">'+Mt(T.command)+"</span>",R.appendChild(_),ie.push({type:"cmd",ts:typeof T.ts=="number"?T.ts:Date.now(),text:T.command})}else if(T.event==="out"){if(!T.data)return;let P=ge;if((!P||P.parentNode!==R)&&(P=document.createElement("div"),P.className="runBlock",R.appendChild(P),ge=P),T.final){Be(),fe=new be(De);let c=ie[ie.length-1];c&&c.type==="out"?c.text=T.data:ie.push({type:"out",text:T.data})}else{fe||(fe=new be(De));let c=ie[ie.length-1];c&&c.type==="out"?c.text+=T.data:ie.push({type:"out",text:T.data})}let d=fe;if(!d||(await d.write(It(T.data)),fe!==d))return;let _=ie[ie.length-1],n=[...ie].reverse().find(c=>c.type==="cmd"),l=$&&_?.type==="out"&&(_.endTs!==void 0||_.exitCode!==void 0)?st({ts:n?.ts,endTs:_.endTs},_.exitCode):"",h=d.render(),f=h.map((c,p)=>'<div class="row"><span class="t">'+(p===h.length-1?l:"")+'</span><span class="c">'+c+"</span></div>").join("");P.innerHTML=f,et(R,W)}else if(T.event==="done"){let P=[...ie].reverse().find(n=>n.type==="cmd"),d=ge;if((!d||d.parentNode!==R)&&P&&(d=document.createElement("div"),d.className="runBlock",R.appendChild(d),ge=d),d&&d.parentNode===R){let n=$?st({ts:P?.ts,endTs:T.endTs},T.exitCode):"";if(d.childElementCount===0&&P){let l=document.createElement("div");l.className="row",l.innerHTML='<span class="t">'+n+'</span><span class="c">&nbsp;</span>',d.appendChild(l)}else{let l=d.lastElementChild;if(l){let h=l.querySelector(".t");h&&(h.innerHTML=n)}}}let _=ie[ie.length-1];_&&_.type==="out"&&(_.endTs=T.endTs,_.exitCode=T.exitCode),d&&d.parentNode===R&&(d.dataset.finalized="1"),et(R,W)}}function pi(T){typeof T.commands=="number"&&rt(T.commands)}var Se=null,Ue=!0,tt=!0,Le=null;function nt(){let T=document.getElementById("xt");!T||!tt||T.scrollHeight>T.clientHeight&&(T.scrollTop=T.scrollHeight)}function xt(){if(Se)return Se;let T=document.getElementById("xt");if(!T){T=document.createElement("div"),T.id="xt";let W=document.getElementById("term");(W?.parentNode??document.body).insertBefore(T,W?.nextSibling??null)}let R=new Ct.Terminal({cols:De,rows:wt,scrollback:Et,fontFamily:'"CaskaydiaCove Nerd Font Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "Noto Sans Mono", "Hack", Consolas, "Courier New", monospace',fontSize:13,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",selectionBackground:"#30363d",black:"#010409",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#c9d1d9",brightBlack:"#666666",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});return R.open(T),T.addEventListener("scroll",()=>{tt=T.scrollTop+T.clientHeight>=T.scrollHeight-2}),Le=()=>{tt=!0,nt(),Ue&&R.scrollToBottom()},window.addEventListener("resize",Le),R.onScroll(()=>{Ue=R.buffer.active.viewportY>=R.buffer.active.baseY}),Se=R,R}function ot(){document.body.classList.add("debug");let T=xt(),R=document.getElementById("toBottom");R.style.display="none",Ue&&T.scrollToBottom(),nt()}function ze(){document.body.classList.remove("debug"),Le&&(window.removeEventListener("resize",Le),Le=null),Se&&(Se.dispose(),Se=null)}function vi(T){if(!oe)return;let R=xt();T.reset?(R.reset(),R.write(T.data||"")):T.data&&R.write(T.data),Ue&&R.scrollToBottom(),nt()}function Mt(T){return T.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var it=/<SSH_DONE:(?:[0-9A-Za-z]+:)?(?:\d+:)?(-?\d+)>/g;function It(T){return T.replace(it,"")}async function gi(T,R){let W=[],$=null;for(let P of T){if(P.type==="sep"){W.push('<div class="sep"><hr></div>');continue}if(P.type==="cmd"){$={ts:P.ts,endTs:P.endTs};let d=P.ts?Ot(P.ts):"";W.push('<div class="row cmdline"><span class="t">'+d+'</span><span class="c">'+Mt(P.text)+"</span></div>")}else if(P.type==="run"){let d=new be(De);await d.write(It(P.text));let _=d.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");d.dispose(),W.push('<div class="runBlock">'+_+"</div>")}else{let d=Yt(P.text),_=new be(De);await _.write(d.text);let n=_.render();_.dispose();let l=R?st($,d.exitCode??P.exitCode):"",h=(f,c)=>'<div class="row"><span class="t">'+f+'</span><span class="c">'+c+"</span></div>";n.length===0?W.push(h(l,"&nbsp;")):n.forEach((f,c)=>W.push(h(c===n.length-1?l:"",f))),$=null}}return W.join("")}function st(T,R){let W=[];if(T&&T.ts&&T.endTs&&W.push("+"+((T.endTs-T.ts)/1e3).toFixed(3)+"s"),R!==void 0){let $=R===0?"#3fb950":"#ff7b72";W.push('<span style="color:'+$+'">'+(R===0?"\u2713":"\u2717 "+R)+"</span>")}return W.join(" ")}function Pt(T){if(T.title&&T.title.trim())return T.title;let R=T.terminals&&T.terminals[0];return R&&R.host?(R.user?R.user+"@":"")+R.host:T.sessionID.slice(0,8)+"\u2026"}function Ot(T){let R=new Date(T),W=$=>String($).padStart(2,"0");return R.getFullYear()+"-"+W(R.getMonth()+1)+"-"+W(R.getDate())+" "+W(R.getHours())+":"+W(R.getMinutes())+":"+W(R.getSeconds())}function mi(T,R){let W=se.find(_=>_.sessionID===T);W&&(W.terminals=W.terminals.filter(_=>(_.name||"default")!==R),W.terminals.length===0&&(se=se.filter(_=>_.sessionID!==T)));let $=document.getElementById("session"),P=$.value;$.innerHTML="";for(let _ of se){let n=document.createElement("option");n.value=_.sessionID,n.textContent=Pt(_)+" ("+_.terminals.length+" "+te.terminals+")",$.appendChild(n)}P&&[...$.options].some(_=>_.value===P)?$.value=P:$.selectedIndex=se.length?0:-1;let d=document.getElementById("terminal").value;$e(d)}function Si(T){T&&(Ce=!0);let R=document.getElementById("terminal").value;$e(R,!0)}function bi(){let T=document.getElementById("showTime");localStorage.setItem("showTime",T.checked?"1":"0"),document.body.classList.toggle("show-time",T.checked)}function Ci(){let T=document.getElementById("debugMode");je=T.checked,localStorage.setItem("debugMode",T.checked?"1":"0");let R=Dt();oe=R,R?ot():ze(),Y&&Y.readyState===WebSocket.OPEN&&ce&&le&&Y.send(JSON.stringify({type:"setMode",mode:R?"raw":"transcript"}))}function yi(){let T=document.getElementById("session").value,R=document.getElementById("terminal").value;if(!R||!Y||Y.readyState!==WebSocket.OPEN)return;let $=se.find(P=>P.sessionID===T)?.terminals.find(P=>(P.name||"default")===R);if(!(!$||$.connected)){if(!$.canDelete){Ht($.deleteReason||te.deleteBlocked);return}Y.send(JSON.stringify({type:"deleteTerminal",sessionID:T,name:R}))}}function wi(T){if(T.ok){Ei(T.sessionID,T.name);return}Ht(T.reason||te.deleteFailed)}function Ei(T,R){let W=se.find(P=>P.sessionID===T);if(W&&(W.terminals=W.terminals.filter(P=>(P.name||"default")!==R),W.terminals.length===0&&(se=se.filter(P=>P.sessionID!==T))),se.length===0){Tt();return}let $=document.getElementById("terminal").value;$e($!==R?$:void 0)}var Me=null;function Ht(T){let R=document.getElementById("notice");R&&(R.textContent=T,R.classList.add("show"),Me!==null&&window.clearTimeout(Me),Me=window.setTimeout(()=>{R.classList.remove("show"),Me=null},5e3))}function ki(){let T=document.getElementById("term"),R=document.getElementById("toBottom");T.scrollTop=T.scrollHeight,Ce=!0,R.style.display="none"}var Ft=document.getElementById("showTime");Ft.checked=localStorage.getItem("showTime")==="1";document.body.classList.toggle("show-time",Ft.checked);var Li=document.getElementById("debugMode");oe=localStorage.getItem("debugMode")==="1";Li.checked=oe;oe?ot():ze();var Ie=document.getElementById("term"),Di=document.getElementById("toBottom");Lt=document.getElementById("delTerm")?.getAttribute("title")||"";Ie.addEventListener("scroll",()=>{Ie.scrollTop+Ie.clientHeight>=Ie.scrollHeight-30?(Ce=!0,Di.style.display="none"):Ce=!1});var ve=[],ue=-1,Pe=-1,Oe="",Q=document.getElementById("cmdInput");Q.placeholder=te.cmdPlaceholder||"";Q.addEventListener("keydown",T=>{if(T.key==="Tab"){T.preventDefault();let d=Q.value.trim();if(!d)return;Oe!==d&&(Pe=-1,Oe=d);let _=ve.filter(n=>n.startsWith(Oe));if(_.length===0)return;Pe=(Pe+1)%_.length,Q.value=_[Pe],me();return}if(Oe="",T.key==="ArrowUp"){T.preventDefault(),ue>0&&(ue--,Q.value=ve[ue],me());return}if(T.key==="ArrowDown"){T.preventDefault(),ue<ve.length-1?(ue++,Q.value=ve[ue],me()):(ue=ve.length,Q.value="",me());return}if(T.key!=="Enter")return;if(T.preventDefault(),T.shiftKey){let d=Q.selectionStart??Q.value.length,_=Q.selectionEnd??Q.value.length;Q.value=Q.value.slice(0,d)+`
11
+ `,t)}reset(){this._core.reset()}loadAddon(e){this._addonManager.loadAddon(this,e)}_verifyIntegers(...e){for(let t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}}_.Terminal=i})();var P=ut;for(var d in $)P[d]=$[d];$.__esModule&&Object.defineProperty(P,"__esModule",{value:!0})})()});var Ct=lt(_t(),1),yt=lt(ft(),1);var Xt={Enter:"\r",Escape:"\x1B",Backspace:"\x7F",Tab:" "," ":" ",Spacebar:" ",Delete:"\x1B[3~",Insert:"\x1B[2~",ArrowUp:"\x1B[A",ArrowDown:"\x1B[B",ArrowRight:"\x1B[C",ArrowLeft:"\x1B[D",Home:"\x1B[H",End:"\x1B[F",PageUp:"\x1B[5~",PageDown:"\x1B[6~",F1:"\x1BOP",F2:"\x1BOQ",F3:"\x1BOR",F4:"\x1BOS",F6:"\x1B[17~",F7:"\x1B[18~",F8:"\x1B[19~",F9:"\x1B[20~",F10:"\x1B[21~"},pt={ArrowUp:"A",ArrowDown:"B",ArrowRight:"C",ArrowLeft:"D",Home:"H",End:"F"},vt={Insert:2,Delete:3,PageUp:5,PageDown:6},gt={"@":0,"[":27,"\\":28,"]":29,"^":30,_:31};function Jt(T){if(T.key==="F5"||T.key==="F11"||T.key==="F12")return!0;if(!(T.ctrlKey||T.metaKey))return!1;let R=T.key.toLowerCase();return R==="r"||T.shiftKey&&(R==="i"||R==="j"||R==="c")?!0:R==="w"||R==="t"||R==="n"}function mt(T){if(Jt(T)||T.metaKey)return null;let R=T.key;if(T.ctrlKey&&!T.altKey&&R.length===1){let $=R.toLowerCase();return $>="a"&&$<="z"?String.fromCharCode($.charCodeAt(0)-96):$ in gt?String.fromCharCode(gt[$]):null}if((T.ctrlKey||T.altKey)&&!T.shiftKey){let $=1+(T.altKey?2:0)+(T.ctrlKey?4:0);return R in pt?"\x1B[1;"+$+pt[R]:R in vt?"\x1B["+vt[R]+";"+$+"~":null}if(T.altKey)return null;if(R==="Tab"&&T.shiftKey)return"\x1B[Z";let W=Xt[R];return W!==void 0?W:R.length===1?R:null}function Yt(T){let R=T.match(it);if(R&&R.length>0){let W=R[R.length-1].match(/(-?\d+)>$/),$=W?parseInt(W[1],10):NaN;return{text:T.replace(it,""),exitCode:isNaN($)?void 0:$}}return{text:T}}var St={en:{commands:"commands",sessionGone:"Session missing or disconnected",noSession:"No terminal. Use term_cli connect (SSH) or term_cli local first.",terminals:"terminals",local:"local",cmdPlaceholder:"Enter command (Shift+Enter new line)",directInput:"Direct input (type here for interactive prompts)",inputOn:"Direct input: ON \u2014 keys go to terminal",inputOff:"Direct input: OFF \u2014 keys stay in browser",inputDisconnected:"Disconnected \u2014 input will not be sent",inputOffline:"Terminal offline \u2014 input will not be sent",deleteBlocked:"Cannot delete this terminal (still active or owned by another instance).",deleteFailed:"Delete failed."},zh:{commands:"\u6761\u547D\u4EE4",sessionGone:"\u4F1A\u8BDD\u4E0D\u5B58\u5728\u6216\u5DF2\u65AD\u5F00",noSession:"\u65E0\u7EC8\u7AEF\u4F1A\u8BDD\uFF0C\u8BF7\u5148\u7528 term_cli connect\uFF08SSH\uFF09\u6216 term_cli local \u5EFA\u7ACB\u3002",terminals:"\u7EC8\u7AEF",local:"\u672C\u5730",cmdPlaceholder:"\u8F93\u5165\u547D\u4EE4\uFF08Shift+Enter \u6362\u884C\uFF09",directInput:"\u76F4\u63A5\u8F93\u5165\uFF08\u4EA4\u4E92\u8F93\u5165\u8BF7\u76F4\u63A5\u5728\u6B64\u8F93\u5165\uFF09",inputOn:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u542F\u7528\uFF08\u6309\u952E\u53D1\u5F80\u7EC8\u7AEF\uFF09",inputOff:"\u76F4\u63A5\u8F93\u5165\uFF1A\u5DF2\u5173\u95ED\uFF08\u6309\u952E\u7559\u5728\u6D4F\u89C8\u5668\uFF09",inputDisconnected:"\u8FDE\u63A5\u5DF2\u65AD\u5F00\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",inputOffline:"\u7EC8\u7AEF\u672A\u8FDE\u63A5\uFF0C\u8F93\u5165\u4E0D\u4F1A\u88AB\u9001\u8FBE",deleteBlocked:"\u65E0\u6CD5\u5220\u9664\u8BE5\u7EC8\u7AEF\uFF08\u4ECD\u5728\u6D3B\u52A8\u6216\u5C5E\u4E8E\u5176\u4ED6\u5B9E\u4F8B\uFF09\u3002",deleteFailed:"\u5220\u9664\u5931\u8D25\u3002"}},Zt=document.documentElement.lang==="zh"?"zh":"en";function Qt(T,R){let W={...St[R]};for(let $ of Object.keys(St[R])){let P=T?.[$];typeof P=="string"&&P.length>0&&(W[$]=P)}return W}var te=Qt(window.__I18N__,Zt),De=window.__PTY_COLS__||120,wt=window.__PTY_ROWS__||40,bt=window.__HEARTBEAT_INTERVAL_MS__||0,ei=window.__HEARTBEAT_CLIENT_TIMEOUT_MS__||0,ti=["#010101","#de382b","#39b54a","#ffc005","#006fb8","#762671","#2cb3e9","#c9d1d9"],ii=["#666666","#ff7b72","#3fb950","#d29922","#58a6ff","#bc8cff","#39c5cf","#f0f6fc"],Et=2e3,si=1e4,Ye=[0,95,135,175,215,255];function We(T,R,W){let $=P=>P.toString(16).padStart(2,"0");return"#"+$(T)+$(R)+$(W)}function kt(T){if(T>=0&&T<8)return ti[T];if(T>=8&&T<16)return ii[T-8];if(T>=16&&T<232){let R=T-16;return We(Ye[Math.floor(R/36)],Ye[Math.floor(R%36/6)],Ye[R%6])}if(T>=232&&T<256){let R=8+(T-232)*10;return We(R,R,R)}return null}function ri(T){if(T.isFgDefault())return null;let R=T.getFgColor();return T.isFgPalette()?kt(R):We(R>>16&255,R>>8&255,R&255)}function ni(T){if(T.isBgDefault())return null;let R=T.getBgColor();return T.isBgPalette()?kt(R):We(R>>16&255,R>>8&255,R&255)}var be=class{constructor(R){Re(this,"term");Re(this,"queue",Promise.resolve());Re(this,"disposed",!1);this.term=new yt.Terminal({cols:R,rows:wt,scrollback:Et,allowProposedApi:!0})}write(R){return this.queue=this.queue.then(()=>this.writeOnce(R)),this.queue}writeOnce(R){return this.disposed?Promise.resolve():new Promise(W=>{let $=!1,P=()=>{$||($=!0,W())},d=setTimeout(P,si);this.term.write(R,()=>{clearTimeout(d),P()})})}render(){if(this.disposed)return[];let R=P=>P.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),W=this.term.buffer.active,$=[];for(let P=0;P<W.length;P++){let d=W.getLine(P);if(!d)continue;let _=d.length;for(;_>0;){let f=d.getCell(_-1)?.getChars()??"";if(f!==""&&f!==" ")break;_--}if(_===0)continue;let n="",l=null;for(let h=0;h<_;h++){let f=d.getCell(h);if(!f||f.getWidth()===0)continue;let c=[];f.isBold()&&c.push("font-weight:bold");let p=ri(f);p&&c.push("color:"+p);let o=ni(f);o&&c.push("background-color:"+o);let i=c.join(";");i!==l&&(l&&(n+="</span>"),l=i,i&&(n+='<span style="'+i+'">')),n+=R(f.getChars()||" ")}l&&(n+="</span>"),$.push(n)}return $}dispose(){this.disposed||(this.disposed=!0,this.term.dispose())}},Y=null,He=!1,Ze=null,Qe=0,ke=null,Ne=!1,oi="directInput",pe=!1,se=[],Ce=!0,fe=null,ge=null,oe=!1,je=localStorage.getItem("debugMode")==="1",Lt="";function Dt(){return je}function Be(){fe&&fe.dispose(),fe=null}var ai=2e3;function Bt(){He=!1,Fe(),Y=new WebSocket("ws://"+window.location.host+"/ws"),Y.onopen=()=>{He=!0,ce="",le="",Y.send(JSON.stringify({type:"list"})),Rt(),Fe(),hi()},Y.onmessage=T=>{let R;try{R=JSON.parse(T.data)}catch{return}switch(R.type){case"ping":Qe=Date.now(),Y.send(JSON.stringify({type:"pong"}));break;case"sessions":di(R);break;case"snapshot":ui(R);break;case"meta":pi(R);break;case"diff":fi(R);break;case"raw":vi(R);break;case"deleteResult":wi(R);break}},Y.onclose=()=>{ci(),He=!1,Fe(),li()}}function hi(){bt<=0||(Qe=Date.now(),ke===null&&(ke=window.setInterval(()=>{!Y||Y.readyState!==WebSocket.OPEN||Date.now()-Qe>ei&&Y.close()},bt)))}function ci(){ke!==null&&(window.clearInterval(ke),ke=null)}function li(){Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,Bt()},ai))}function Tt(){let T=document.getElementById("session"),R=document.getElementById("terminal"),W=document.getElementById("term");T.innerHTML="",R.innerHTML="",W.innerHTML='<div class="row"><span class="c">'+(te.noSession||"")+"</span></div>",document.getElementById("meta").textContent="",ie=[],Be(),ce="",le="",je=!1,oe=!1,localStorage.removeItem("debugMode");let $=document.getElementById("debugMode");$.checked=!1,ze(),At()}function di(T){let R=T.sessions||[],W=document.getElementById("session");if(se=R,R.length===0){Tt();return}let $=R.map(_=>_.sessionID+"|"+_.terminals.length).join(","),P=W.value,d=document.getElementById("terminal").value;W.innerHTML="";for(let _ of se){let n=document.createElement("option");n.value=_.sessionID,n.textContent=Pt(_)+" ("+_.terminals.length+" "+te.terminals+")",W.appendChild(n)}P&&[...W.options].some(_=>_.value===P)?W.value=P:W.selectedIndex=se.length?0:-1,$e(d)}function At(){let T=document.getElementById("debugMode"),R=document.getElementById("rawToggle");T.disabled=!1,R&&R.classList.remove("disabled"),T.checked=je,oe=Dt(),oe?ot():ze(),Fe()}function _i(){if(!He)return{enabled:!1,reason:te.inputDisconnected};let T=document.getElementById("session").value,R=document.getElementById("terminal").value,W=se.find($=>$.sessionID===T)?.terminals.find($=>($.name||"default")===R);return!T||!R||!W?.connected?{enabled:!1,reason:te.inputOffline}:{enabled:!0,reason:""}}function Fe(){let T=_i(),R=Ne;Ne=T.enabled;let W=document.getElementById("cmdInput");W.disabled=!T.enabled,W.placeholder=T.enabled?te.cmdPlaceholder||"":T.reason,W.title=T.reason,T.enabled&&!R&&(qe(!1),W.focus()),ht();let $=document.getElementById("connStatus");$&&($.textContent=T.enabled?"":T.reason,$.classList.toggle("show",!T.enabled))}function $e(T,R=!1){let W=document.getElementById("session"),$=document.getElementById("terminal"),P=document.getElementById("delTerm"),d=W.value,_=se.find(p=>p.sessionID===d),n=$.value;$.innerHTML="";for(let p of _?_.terminals:[]){let o=document.createElement("option");o.value=p.name||"default",o.textContent=(p.name||"default")+(p.kind==="local"?" ["+te.local+"]":"")+" "+(p.connected?"\u25CF":"\u25CB")+(p.busy?" \u23F3":""),$.appendChild(o)}T&&[...$.options].some(p=>p.value===T)?$.value=T:$.selectedIndex=$.options.length?0:-1;let l=_?.terminals.find(p=>(p.name||"default")===$.value),h=!!(l&&!l.connected);P.classList.toggle("show",h);let f=!!(l&&l.canDelete);P.disabled=!f,P.title=h&&!f?l?.deleteReason||te.deleteBlocked:Lt,At(),rt();let c=$.value;(R||c!==n)&&(ce="",le="",Rt())}var ce="",le="",ie=[];function Rt(){let T=document.getElementById("session").value,R=document.getElementById("terminal").value;!T||!R||!Y||Y.readyState!==WebSocket.OPEN||T===ce&&R===le||(ce=T,le=R,Be(),Y.send(JSON.stringify({type:"subscribe",sessionID:T,name:R,mode:oe?"raw":"transcript"})))}async function ui(T){let R=document.getElementById("term"),W=document.getElementById("toBottom");if(T.notFound){R.innerHTML='<div class="row"><span class="t"></span><span class="c">'+te.sessionGone+"</span></div>",document.getElementById("meta").textContent="",mi(T.sessionID,T.name);return}let $=T.pairs||[],P=!oe&&document.getElementById("showTime").checked;document.body.classList.toggle("show-time",P);let d=$.filter(n=>n.type==="cmd").length;if(rt(d),ie=$,oe)return;Be(),ge=null;let _=await gi($,P);T.sessionID!==ce||T.name!==le||(R.innerHTML=_,et(R,W))}function rt(T){let R=document.getElementById("session").value,W=document.getElementById("terminal").value;if(!R){document.getElementById("meta").textContent="";return}let P=se.find(h=>h.sessionID===R)?.terminals.find(h=>(h.name||"default")===W),d=P?P.host?P.host+(P.port?":"+P.port:""):P.program||"":"",_=d?" ["+d+"]":"",l=" \xB7 "+(T??ie.filter(h=>h.type==="cmd").length)+" "+te.commands;document.getElementById("meta").textContent=R+"/"+W+_+l}function et(T,R){Ce?(T.scrollTop=T.scrollHeight,R.style.display="none"):R.style.display=T.scrollHeight>T.clientHeight?"inline-block":"none"}async function fi(T){if(oe)return;let R=document.getElementById("term"),W=document.getElementById("toBottom"),$=document.getElementById("showTime").checked;if(T.event==="cmd"){if(!T.command)return;let P=ge;P&&P.dataset.finalized!=="1"&&P.remove(),ge=null,Be();let d=$?Ot(Date.now()):"",_=document.createElement("div");_.className="row cmdline",_.innerHTML='<span class="t">'+d+'</span><span class="c">'+Mt(T.command)+"</span>",R.appendChild(_),ie.push({type:"cmd",ts:typeof T.ts=="number"?T.ts:Date.now(),text:T.command})}else if(T.event==="out"){if(!T.data)return;let P=ge;if((!P||P.parentNode!==R)&&(P=document.createElement("div"),P.className="runBlock",R.appendChild(P),ge=P),T.final){Be(),fe=new be(De);let c=ie[ie.length-1];c&&c.type==="out"?c.text=T.data:ie.push({type:"out",text:T.data})}else{fe||(fe=new be(De));let c=ie[ie.length-1];c&&c.type==="out"?c.text+=T.data:ie.push({type:"out",text:T.data})}let d=fe;if(!d||(await d.write(It(T.data)),fe!==d))return;let _=ie[ie.length-1],n=[...ie].reverse().find(c=>c.type==="cmd"),l=$&&_?.type==="out"&&(_.endTs!==void 0||_.exitCode!==void 0)?st({ts:n?.ts,endTs:_.endTs},_.exitCode):"",h=d.render(),f=h.map((c,p)=>'<div class="row"><span class="t">'+(p===h.length-1?l:"")+'</span><span class="c">'+c+"</span></div>").join("");P.innerHTML=f,et(R,W)}else if(T.event==="done"){let P=[...ie].reverse().find(n=>n.type==="cmd"),d=ge;if((!d||d.parentNode!==R)&&P&&(d=document.createElement("div"),d.className="runBlock",R.appendChild(d),ge=d),d&&d.parentNode===R){let n=$?st({ts:P?.ts,endTs:T.endTs},T.exitCode):"";if(d.childElementCount===0&&P){let l=document.createElement("div");l.className="row",l.innerHTML='<span class="t">'+n+'</span><span class="c">&nbsp;</span>',d.appendChild(l)}else{let l=d.lastElementChild;if(l){let h=l.querySelector(".t");h&&(h.innerHTML=n)}}}let _=ie[ie.length-1];_&&_.type==="out"&&(_.endTs=T.endTs,_.exitCode=T.exitCode),d&&d.parentNode===R&&(d.dataset.finalized="1"),et(R,W)}}function pi(T){typeof T.commands=="number"&&rt(T.commands)}var Se=null,Ue=!0,tt=!0,Le=null;function nt(){let T=document.getElementById("xt");!T||!tt||T.scrollHeight>T.clientHeight&&(T.scrollTop=T.scrollHeight)}function xt(){if(Se)return Se;let T=document.getElementById("xt");if(!T){T=document.createElement("div"),T.id="xt";let W=document.getElementById("term");(W?.parentNode??document.body).insertBefore(T,W?.nextSibling??null)}let R=new Ct.Terminal({cols:De,rows:wt,scrollback:Et,fontFamily:'"CaskaydiaCove Nerd Font Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "Noto Sans Mono", "Hack", Consolas, "Courier New", monospace',fontSize:13,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#58a6ff",selectionBackground:"#30363d",black:"#010409",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#c9d1d9",brightBlack:"#666666",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});return R.open(T),T.addEventListener("scroll",()=>{tt=T.scrollTop+T.clientHeight>=T.scrollHeight-2}),Le=()=>{tt=!0,nt(),Ue&&R.scrollToBottom()},window.addEventListener("resize",Le),R.onScroll(()=>{Ue=R.buffer.active.viewportY>=R.buffer.active.baseY}),Se=R,R}function ot(){document.body.classList.add("debug");let T=xt(),R=document.getElementById("toBottom");R.style.display="none",Ue&&T.scrollToBottom(),nt()}function ze(){document.body.classList.remove("debug"),Le&&(window.removeEventListener("resize",Le),Le=null),Se&&(Se.dispose(),Se=null)}function vi(T){if(!oe)return;let R=xt();T.reset?(R.reset(),R.write(T.data||"")):T.data&&R.write(T.data),Ue&&R.scrollToBottom(),nt()}function Mt(T){return T.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}var it=/<SSH_DONE:(?:[0-9A-Za-z]+:)?(?:\d+:)?(-?\d+)>/g;function It(T){return T.replace(it,"")}async function gi(T,R){let W=[],$=null;for(let P of T){if(P.type==="sep"){W.push('<div class="sep"><hr></div>');continue}if(P.type==="cmd"){$={ts:P.ts,endTs:P.endTs};let d=P.ts?Ot(P.ts):"";W.push('<div class="row cmdline"><span class="t">'+d+'</span><span class="c">'+Mt(P.text)+"</span></div>")}else if(P.type==="run"){let d=new be(De);await d.write(It(P.text));let _=d.render().map(n=>'<div class="row"><span class="t"></span><span class="c">'+n+"</span></div>").join("");d.dispose(),W.push('<div class="runBlock">'+_+"</div>")}else{let d=Yt(P.text),_=new be(De);await _.write(d.text);let n=_.render();_.dispose();let l=R?st($,d.exitCode??P.exitCode):"",h=(f,c)=>'<div class="row"><span class="t">'+f+'</span><span class="c">'+c+"</span></div>";n.length===0?W.push(h(l,"&nbsp;")):n.forEach((f,c)=>W.push(h(c===n.length-1?l:"",f))),$=null}}return W.join("")}function st(T,R){let W=[];if(T&&T.ts&&T.endTs&&W.push("+"+((T.endTs-T.ts)/1e3).toFixed(3)+"s"),R!==void 0){let $=R===0?"#3fb950":"#ff7b72";W.push('<span style="color:'+$+'">'+(R===0?"\u2713":"\u2717 "+R)+"</span>")}return W.join(" ")}function Pt(T){if(T.title&&T.title.trim())return T.title;let R=T.terminals&&T.terminals[0];return R&&R.host?(R.user?R.user+"@":"")+R.host:R&&R.name&&R.name!=="default"?R.name:R&&R.program?R.program:T.sessionID.slice(0,8)+"\u2026"}function Ot(T){let R=new Date(T),W=$=>String($).padStart(2,"0");return R.getFullYear()+"-"+W(R.getMonth()+1)+"-"+W(R.getDate())+" "+W(R.getHours())+":"+W(R.getMinutes())+":"+W(R.getSeconds())}function mi(T,R){let W=se.find(_=>_.sessionID===T);W&&(W.terminals=W.terminals.filter(_=>(_.name||"default")!==R),W.terminals.length===0&&(se=se.filter(_=>_.sessionID!==T)));let $=document.getElementById("session"),P=$.value;$.innerHTML="";for(let _ of se){let n=document.createElement("option");n.value=_.sessionID,n.textContent=Pt(_)+" ("+_.terminals.length+" "+te.terminals+")",$.appendChild(n)}P&&[...$.options].some(_=>_.value===P)?$.value=P:$.selectedIndex=se.length?0:-1;let d=document.getElementById("terminal").value;$e(d)}function Si(T){T&&(Ce=!0);let R=document.getElementById("terminal").value;$e(R,!0)}function bi(){let T=document.getElementById("showTime");localStorage.setItem("showTime",T.checked?"1":"0"),document.body.classList.toggle("show-time",T.checked)}function Ci(){let T=document.getElementById("debugMode");je=T.checked,localStorage.setItem("debugMode",T.checked?"1":"0");let R=Dt();oe=R,R?ot():ze(),Y&&Y.readyState===WebSocket.OPEN&&ce&&le&&Y.send(JSON.stringify({type:"setMode",mode:R?"raw":"transcript"}))}function yi(){let T=document.getElementById("session").value,R=document.getElementById("terminal").value;if(!R||!Y||Y.readyState!==WebSocket.OPEN)return;let $=se.find(P=>P.sessionID===T)?.terminals.find(P=>(P.name||"default")===R);if(!(!$||$.connected)){if(!$.canDelete){Ht($.deleteReason||te.deleteBlocked);return}Y.send(JSON.stringify({type:"deleteTerminal",sessionID:T,name:R}))}}function wi(T){if(T.ok){Ei(T.sessionID,T.name);return}Ht(T.reason||te.deleteFailed)}function Ei(T,R){let W=se.find(P=>P.sessionID===T);if(W&&(W.terminals=W.terminals.filter(P=>(P.name||"default")!==R),W.terminals.length===0&&(se=se.filter(P=>P.sessionID!==T))),se.length===0){Tt();return}let $=document.getElementById("terminal").value;$e($!==R?$:void 0)}var Me=null;function Ht(T){let R=document.getElementById("notice");R&&(R.textContent=T,R.classList.add("show"),Me!==null&&window.clearTimeout(Me),Me=window.setTimeout(()=>{R.classList.remove("show"),Me=null},5e3))}function ki(){let T=document.getElementById("term"),R=document.getElementById("toBottom");T.scrollTop=T.scrollHeight,Ce=!0,R.style.display="none"}var Ft=document.getElementById("showTime");Ft.checked=localStorage.getItem("showTime")==="1";document.body.classList.toggle("show-time",Ft.checked);var Li=document.getElementById("debugMode");oe=localStorage.getItem("debugMode")==="1";Li.checked=oe;oe?ot():ze();var Ie=document.getElementById("term"),Di=document.getElementById("toBottom");Lt=document.getElementById("delTerm")?.getAttribute("title")||"";Ie.addEventListener("scroll",()=>{Ie.scrollTop+Ie.clientHeight>=Ie.scrollHeight-30?(Ce=!0,Di.style.display="none"):Ce=!1});var ve=[],ue=-1,Pe=-1,Oe="",Q=document.getElementById("cmdInput");Q.placeholder=te.cmdPlaceholder||"";Q.addEventListener("keydown",T=>{if(T.key==="Tab"){T.preventDefault();let d=Q.value.trim();if(!d)return;Oe!==d&&(Pe=-1,Oe=d);let _=ve.filter(n=>n.startsWith(Oe));if(_.length===0)return;Pe=(Pe+1)%_.length,Q.value=_[Pe],me();return}if(Oe="",T.key==="ArrowUp"){T.preventDefault(),ue>0&&(ue--,Q.value=ve[ue],me());return}if(T.key==="ArrowDown"){T.preventDefault(),ue<ve.length-1?(ue++,Q.value=ve[ue],me()):(ue=ve.length,Q.value="",me());return}if(T.key!=="Enter")return;if(T.preventDefault(),T.shiftKey){let d=Q.selectionStart??Q.value.length,_=Q.selectionEnd??Q.value.length;Q.value=Q.value.slice(0,d)+`
12
12
  `+Q.value.slice(_),Q.selectionStart=Q.selectionEnd=d+1,me();return}let R=document.getElementById("session").value,W=document.getElementById("terminal").value;if(!R||!Y||Y.readyState!==WebSocket.OPEN)return;let $=Q.value;if(Q.value="",me(),!$.trim())return;(ce!==R||le!==W)&&(ce=R,le=W,Y.send(JSON.stringify({type:"subscribe",sessionID:R,name:W})));let P=$.trim();ve.push(P),ue=ve.length,Y.send(JSON.stringify({type:"exec",sessionID:R,name:W,command:P})),Ce=!0});function me(){Q.style.height="auto",Q.style.height=Math.min(Q.scrollHeight,120)+"px"}Q.addEventListener("input",me);function Wt(T){let R=T;if(!R||!R.tagName)return!1;let W=R.tagName.toUpperCase();return W==="INPUT"||W==="TEXTAREA"||W==="SELECT"||W==="BUTTON"||R.isContentEditable}function at(T){let R=T;return!!R&&typeof R.closest=="function"&&!!R.closest("#term, #xt")}function Bi(T){let R=document.getElementById("session").value,W=document.getElementById("terminal").value;!R||!Y||Y.readyState!==WebSocket.OPEN||Y.send(JSON.stringify({type:"send",sessionID:R,name:W,text:T}))}function ht(){let T=document.getElementById("cmdKey");T&&(T.textContent=pe?te.inputOn||te.directInput:te.inputOff||te.directInput,T.classList.toggle("on",pe),T.classList.toggle("off",!pe),T.classList.toggle("disabled",!Ne),T.title=te.directInput||"",T.setAttribute("aria-pressed",pe?"true":"false"))}function qe(T){pe!==T&&(pe=T,ht())}var Nt=document.getElementById("cmdKey");Nt.setAttribute("role","switch");Nt.addEventListener("click",()=>qe(!pe));document.addEventListener("click",T=>{at(T.target)&&qe(!0)});document.addEventListener("focusin",T=>{Wt(T.target)&&!at(T.target)&&qe(!1)});function Ti(T){if(!pe||Wt(T.target)&&!at(T.target)||!Ne)return;let R=mt(T);R!==null&&(T.preventDefault(),Bi(R))}document.addEventListener("keydown",Ti,!0);localStorage.removeItem(oi);ht();Object.assign(window,{onSessionChange:Si,onShowTimeChange:bi,onDebugModeChange:Ci,deleteTerminal:yi,scrollToNewest:ki});Bt();})();