9remote 0.1.1 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +83 -68
- package/dist/server.cjs +25 -29
- package/dist/standalone/.next/BUILD_ID +1 -1
- package/dist/standalone/.next/build-manifest.json +2 -2
- package/dist/standalone/.next/prerender-manifest.json +3 -3
- package/dist/standalone/.next/server/app/_global-error.html +2 -2
- package/dist/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.html +2 -2
- package/dist/standalone/.next/server/app/index.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/login/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/login.html +1 -1
- package/dist/standalone/.next/server/app/login.rsc +1 -1
- package/dist/standalone/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/login.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/remote/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/remote/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/remote.html +1 -1
- package/dist/standalone/.next/server/app/remote.rsc +1 -1
- package/dist/standalone/.next/server/app/remote.segments/_full.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/remote.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/remote.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/remote.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/remote.segments/remote/__PAGE__.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/remote.segments/remote.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/terminal/page/react-loadable-manifest.json +1 -1
- package/dist/standalone/.next/server/app/terminal/page.js.nft.json +1 -1
- package/dist/standalone/.next/server/app/terminal/page_client-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/app/terminal.html +1 -1
- package/dist/standalone/.next/server/app/terminal.rsc +2 -2
- package/dist/standalone/.next/server/app/terminal.segments/_full.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/terminal.segments/_index.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +1 -1
- package/dist/standalone/.next/server/app/terminal.segments/terminal/__PAGE__.segment.rsc +2 -2
- package/dist/standalone/.next/server/app/terminal.segments/terminal.segment.rsc +1 -1
- package/dist/standalone/.next/server/chunks/ssr/{[root-of-the-server]__c4510a54._.js → [root-of-the-server]__9ae89159._.js} +3 -3
- package/dist/standalone/.next/server/pages/404.html +1 -1
- package/dist/standalone/.next/server/pages/500.html +2 -2
- package/dist/standalone/.next/server/server-reference-manifest.js +1 -1
- package/dist/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/standalone/.next/static/chunks/{c83ada0dc165c069.js → 6cd6aceb30e3780f.js} +1 -1
- package/dist/standalone/.next/static/chunks/{a5898828bec6764a.js → bcbcbe7624598efe.js} +2 -2
- package/dist/standalone/node_modules/@img/sharp-darwin-arm64/package.json +2 -2
- package/dist/standalone/node_modules/@img/sharp-libvips-darwin-arm64/package.json +1 -1
- package/dist/standalone/node_modules/next/node_modules/@img/sharp-darwin-arm64/package.json +40 -0
- package/dist/standalone/node_modules/next/node_modules/@img/sharp-libvips-darwin-arm64/package.json +36 -0
- package/dist/standalone/node_modules/next/node_modules/sharp/package.json +202 -0
- package/dist/standalone/node_modules/sharp/package.json +77 -57
- package/dist/standalone/package.json +5 -9
- package/package.json +8 -13
- package/scripts/install.js +28 -0
- /package/dist/standalone/.next/static/{iksGdT4UarFPXRZSkS0ex → wLxjscs3VLO0dQbU_cK9R}/_buildManifest.js +0 -0
- /package/dist/standalone/.next/static/{iksGdT4UarFPXRZSkS0ex → wLxjscs3VLO0dQbU_cK9R}/_clientMiddlewareManifest.json +0 -0
- /package/dist/standalone/.next/static/{iksGdT4UarFPXRZSkS0ex → wLxjscs3VLO0dQbU_cK9R}/_ssgManifest.js +0 -0
- /package/dist/standalone/node_modules/{@img → next/node_modules/@img}/sharp-darwin-arm64/lib/sharp-darwin-arm64.node +0 -0
- /package/dist/standalone/node_modules/{@img → next/node_modules/@img}/sharp-libvips-darwin-arm64/README.md +0 -0
- /package/dist/standalone/node_modules/{@img → next/node_modules/@img}/sharp-libvips-darwin-arm64/lib/glib-2.0/include/glibconfig.h +0 -0
- /package/dist/standalone/node_modules/{@img → next/node_modules/@img}/sharp-libvips-darwin-arm64/lib/index.js +0 -0
- /package/dist/standalone/node_modules/{@img → next/node_modules/@img}/sharp-libvips-darwin-arm64/lib/libvips-cpp.8.17.3.dylib +0 -0
- /package/dist/standalone/node_modules/{@img → next/node_modules/@img}/sharp-libvips-darwin-arm64/versions.json +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/classes/comparator.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/classes/range.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/classes/semver.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/cmp.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/coerce.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/compare.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/eq.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/gt.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/gte.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/lt.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/lte.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/neq.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/parse.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/functions/satisfies.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/internal/constants.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/internal/debug.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/internal/identifiers.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/internal/lrucache.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/internal/parse-options.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/internal/re.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next}/node_modules/semver/package.json +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/channel.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/colour.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/composite.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/constructor.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/index.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/input.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/is.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/libvips.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/operation.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/output.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/resize.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/sharp.js +0 -0
- /package/dist/standalone/node_modules/{sharp → next/node_modules/sharp}/lib/utility.js +0 -0
|
@@ -15,6 +15,6 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
15
15
|
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),sc&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){let i=this._getMouseBufferCoords(e),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!s&&!!r&&!!i&&this._areCoordsInSelection(i,s,r)}isCellInSelection(e,i){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!s&&!!r&&this._areCoordsInSelection([e,i],s,r)}_areCoordsInSelection(e,i,s){return e[1]>i[1]&&e[1]<s[1]||i[1]===s[1]&&e[1]===i[1]&&e[0]>=i[0]&&e[0]<s[0]||i[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||i[1]<s[1]&&e[1]===i[1]&&e[0]>=i[0]}_selectWordAtCursor(e,i){let s=this._linkifier.currentLink?.link?.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=sk(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return!!r&&(this._selectWordAt(r,i),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,i){this._model.clearSelection(),e=Math.max(e,0),i=Math.min(i,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,i],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let i=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(i)return i[0]--,i[1]--,i[1]+=this._bufferService.buffer.ydisp,i}_getMouseEventScrollAmount(e){let i=i5(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return i>=0&&i<=s?0:(i>s&&(i-=s),(i=Math.min(Math.max(i,-50),50)/50)/Math.abs(i)+Math.round(14*i))}shouldForceSelection(e){return so?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(2===e.button&&this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=3*!!this.shouldColumnSelect(e),this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let i=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);i&&i.length!==this._model.selectionStart[0]&&0===i.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let i=this._getMouseBufferCoords(e);i&&(this._activeSelectionMode=2,this._selectLineAt(i[1]))}shouldColumnSelect(e){return e.altKey&&!(so&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let i=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let e=s.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}i&&i[0]===this._model.selectionEnd[0]&&i[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let i=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&i<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let i=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(i&&void 0!==i[0]&&void 0!==i[1]){let e=function(e,i,s,r){var n,o,h,a,l,c,d,_,u,f,g,p,v,m,S,b,w,y;let C,x=s.buffer.x,k=s.buffer.y;if(!s.buffer.hasScrollback){let w,y,C;return n=x,h=0,(0===sS(o=k,i,a=s,l=r).length?"":sC(sw(n,o,n,o-sb(o,a),!1,a).length,sy("D",l)))+sS(k,i,s,r)+(c=x,d=k,_=e,w=sS(d,u=i,f=s,g=r).length>0?u-sb(u,f):d,C=(p=c,v=d,y=sS(m=_,S=u,b=f,g).length>0?S-sb(S,b):v,p<m&&y<=S||p>=m&&y<S?"C":"D"),sC(sw(c,w,_,u,"C"===C,f).length,sy(C,g)))}if(k===i)return C=x>e?"D":"C",sC(Math.abs(x-e),sy(C,r));C=k>i?"D":"C";let E=Math.abs(k-i);return sC((w=k>i?e:x,s.cols-w+(E-1)*s.cols+1+(y=0,(k>i?x:e)-1)),sy(C,r))}(i[0]-1,i[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,i=this._model.finalSelectionEnd,s=!!e&&!!i&&(e[0]!==i[0]||e[1]!==i[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,i,s);return}!e||!i||this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&i[0]===this._oldSelectionEnd[0]&&i[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,i,s)}_fireOnSelectionChange(e,i,s){this._oldSelectionStart=e,this._oldSelectionEnd=i,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,i){let s=i;for(let r=0;i>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?s--:n>1&&i!==r&&(s+=n-1)}return s}setSelection(e,i,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,i],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,i,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let h=n.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(o,e[0]),l=a,c=e[0]-a,d=0,_=0,u=0,f=0;if(" "===h.charAt(a)){for(;a>0&&" "===h.charAt(a-1);)a--;for(;l<h.length&&" "===h.charAt(l+1);)l++}else{let i=e[0],s=e[0];0===o.getWidth(i)&&(d++,i--),2===o.getWidth(s)&&(_++,s++);let r=o.getString(s).length;for(r>1&&(f+=r-1,l+=r-1);i>0&&a>0&&!this._isCharWordSeparator(o.loadCell(i-1,this._workCell));){o.loadCell(i-1,this._workCell);let e=this._workCell.getChars().length;0===this._workCell.getWidth()?(d++,i--):e>1&&(u+=e-1,a-=e-1),a--,i--}for(;s<o.length&&l+1<h.length&&!this._isCharWordSeparator(o.loadCell(s+1,this._workCell));){o.loadCell(s+1,this._workCell);let e=this._workCell.getChars().length;2===this._workCell.getWidth()?(_++,s++):e>1&&(f+=e-1,l+=e-1),l++,s++}}l++;let g=a+c-d+u,p=Math.min(this._bufferService.cols,l-a+d+_-u-f);if(!(!i&&""===h.slice(a,l).trim())){if(s&&0===g&&32!==o.getCodePoint(0)){let i=n.lines.get(e[1]-1);if(i&&o.isWrapped&&32!==i.getCodePoint(this._bufferService.cols-1)){let i=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(i){let e=this._bufferService.cols-i.start;g-=e,p+=e}}}if(r&&g+p===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){let i=n.lines.get(e[1]+1);if(i?.isWrapped&&32!==i.getCodePoint(0)){let i=this._getWordAt([0,e[1]+1],!1,!1,!0);i&&(p+=i.length)}}return{start:g,length:p}}}_selectWordAt(e,i){let s=this._getWordAt(e,i);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let i=this._getWordAt(e,!0);if(i){let s=e[1];for(;i.start<0;)i.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;i.start+i.length>this._bufferService.cols;)i.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?i.start:i.start+i.length,s]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let i=this._bufferService.buffer.getWrappedRangeForLine(e),s={start:{x:0,y:i.first},end:{x:this._bufferService.cols-1,y:i.last}};this._model.selectionStart=[0,i.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=sk(s,this._bufferService.cols)}};sB=S([b(3,I),b(4,W),b(5,G),b(6,K),b(7,J),b(8,X)],sB);var sD=class{constructor(){this._data={}}set(e,i,s){this._data[e]||(this._data[e]={}),this._data[e][i]=s}get(e,i){return this._data[e]?this._data[e][i]:void 0}clear(){this._data={}}},sM=class{constructor(){this._color=new sD,this._css=new sD}setCss(e,i,s){this._css.set(e,i,s)}getCss(e,i){return this._css.get(e,i)}setColor(e,i,s){this._color.set(e,i,s)}getColor(e,i){return this._color.get(e,i)}clear(){this._color.clear(),this._css.clear()}},sR=Object.freeze((()=>{let e=[ri.toColor("#2e3436"),ri.toColor("#cc0000"),ri.toColor("#4e9a06"),ri.toColor("#c4a000"),ri.toColor("#3465a4"),ri.toColor("#75507b"),ri.toColor("#06989a"),ri.toColor("#d3d7cf"),ri.toColor("#555753"),ri.toColor("#ef2929"),ri.toColor("#8ae234"),ri.toColor("#fce94f"),ri.toColor("#729fcf"),ri.toColor("#ad7fa8"),ri.toColor("#34e2e2"),ri.toColor("#eeeeec")],i=[0,95,135,175,215,255];for(let s=0;s<216;s++){let r=i[s/36%6|0],n=i[s/6%6|0],o=i[s%6];e.push({css:ib.toCss(r,n,o),rgba:ib.toRgba(r,n,o)})}for(let i=0;i<24;i++){let s=8+10*i;e.push({css:ib.toCss(s,s,s),rgba:ib.toRgba(s,s,s)})}return e})()),sL=ri.toColor("#ffffff"),sP=ri.toColor("#000000"),sT=ri.toColor("#ffffff"),sA={css:"rgba(255, 255, 255, 0.3)",rgba:0xffffff4d},sO=class extends ep{constructor(e){super(),this._optionsService=e,this._contrastCache=new sM,this._halfContrastCache=new sM,this._onChangeColors=this._register(new eO),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:sL,background:sP,cursor:sT,cursorAccent:sP,selectionForeground:void 0,selectionBackgroundTransparent:sA,selectionBackgroundOpaque:rt.blend(sP,sA),selectionInactiveBackgroundTransparent:sA,selectionInactiveBackgroundOpaque:rt.blend(sP,sA),scrollbarSliderBackground:rt.opacity(sL,.2),scrollbarSliderHoverBackground:rt.opacity(sL,.4),scrollbarSliderActiveBackground:rt.opacity(sL,.5),overviewRulerBorder:sL,ansi:sR.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let i=this._colors;if(i.foreground=sN(e.foreground,sL),i.background=sN(e.background,sP),i.cursor=rt.blend(i.background,sN(e.cursor,sT)),i.cursorAccent=rt.blend(i.background,sN(e.cursorAccent,sP)),i.selectionBackgroundTransparent=sN(e.selectionBackground,sA),i.selectionBackgroundOpaque=rt.blend(i.background,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundTransparent=sN(e.selectionInactiveBackground,i.selectionBackgroundTransparent),i.selectionInactiveBackgroundOpaque=rt.blend(i.background,i.selectionInactiveBackgroundTransparent),i.selectionForeground=e.selectionForeground?sN(e.selectionForeground,ik):void 0,i.selectionForeground===ik&&(i.selectionForeground=void 0),rt.isOpaque(i.selectionBackgroundTransparent)&&(i.selectionBackgroundTransparent=rt.opacity(i.selectionBackgroundTransparent,.3)),rt.isOpaque(i.selectionInactiveBackgroundTransparent)&&(i.selectionInactiveBackgroundTransparent=rt.opacity(i.selectionInactiveBackgroundTransparent,.3)),i.scrollbarSliderBackground=sN(e.scrollbarSliderBackground,rt.opacity(i.foreground,.2)),i.scrollbarSliderHoverBackground=sN(e.scrollbarSliderHoverBackground,rt.opacity(i.foreground,.4)),i.scrollbarSliderActiveBackground=sN(e.scrollbarSliderActiveBackground,rt.opacity(i.foreground,.5)),i.overviewRulerBorder=sN(e.overviewRulerBorder,sL),i.ansi=sR.slice(),i.ansi[0]=sN(e.black,sR[0]),i.ansi[1]=sN(e.red,sR[1]),i.ansi[2]=sN(e.green,sR[2]),i.ansi[3]=sN(e.yellow,sR[3]),i.ansi[4]=sN(e.blue,sR[4]),i.ansi[5]=sN(e.magenta,sR[5]),i.ansi[6]=sN(e.cyan,sR[6]),i.ansi[7]=sN(e.white,sR[7]),i.ansi[8]=sN(e.brightBlack,sR[8]),i.ansi[9]=sN(e.brightRed,sR[9]),i.ansi[10]=sN(e.brightGreen,sR[10]),i.ansi[11]=sN(e.brightYellow,sR[11]),i.ansi[12]=sN(e.brightBlue,sR[12]),i.ansi[13]=sN(e.brightMagenta,sR[13]),i.ansi[14]=sN(e.brightCyan,sR[14]),i.ansi[15]=sN(e.brightWhite,sR[15]),e.extendedAnsi){let s=Math.min(i.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)i.ansi[r+16]=sN(e.extendedAnsi[r],sR[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0===e){for(let e=0;e<this._restoreColors.ansi.length;++e)this._colors.ansi[e]=this._restoreColors.ansi[e];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function sN(e,i){if(void 0!==e)try{return ri.toColor(e)}catch{}return i}sO=S([b(0,K)],sO);var sI=class{constructor(...e){for(let[i,s]of(this._entries=new Map,e))this.set(i,s)}set(e,i){let s=this._entries.get(e);return this._entries.set(e,i),s}forEach(e){for(let[i,s]of this._entries.entries())e(i,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},sH=class{constructor(){this._services=new sI,this._services.set(F,this)}setService(e,i){this._services.set(e,i)}getService(e){return this._services.get(e)}createInstance(e,...i){let s=(e[A]||[]).sort((e,i)=>e.index-i.index),r=[];for(let i of s){let s=this._services.get(i.id);if(!s)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id._id}.`);r.push(s)}let n=s.length>0?s[0].index:i.length;if(i.length!==n)throw Error(`[createInstance] First service dependency of ${e.name} at position ${n+1} conflicts with ${i.length} static arguments`);return new e(...i,...r)}},sW={trace:0,debug:1,info:2,warn:3,error:4,off:5},sz=class extends ep{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=sW[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};sz=S([b(0,K)],sz);var sF=class extends ep{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new eO),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new eO),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new eO),this.onTrim=this.onTrimEmitter.event,this._array=Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let i=Array(e);for(let s=0;s<Math.min(e,this.length);s++)i[s]=this._array[this._getCyclicIndex(s)];this._array=i,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let i=this._length;i<e;i++)this._array[i]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,i){this._array[this._getCyclicIndex(e)]=i}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw 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(e,i,...s){if(i){for(let s=e;s<this._length-i;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+i)];this._length-=i,this.onDeleteEmitter.fire({index:e,amount:i})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+s.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<s.length;i++)this._array[this._getCyclicIndex(e+i)]=s[i];if(s.length&&this.onInsertEmitter.fire({index:e,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(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,i,s){if(!(i<=0)){if(e<0||e>=this._length)throw Error("start argument out of range");if(e+s<0)throw Error("Cannot shift elements in list beyond index 0");if(s>0){for(let r=i-1;r>=0;r--)this.set(e+r+s,this.get(e+r));let r=e+i+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<i;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},s$=Object.freeze(new R),sK=0,sU=class e{constructor(e,i,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);let r=i||P.fromCharData([0,"",1,0]);for(let i=0;i<e;++i)this.setCell(i,r);this.length=e}get(e){let i=this._data[3*e+0],s=2097151&i;return[this._data[3*e+1],2097152&i?this._combined[e]:s?E(s):"",i>>22,2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,i){this._data[3*e+1]=i[0],i[1].length>1?(this._combined[e]=i[1],this._data[3*e+0]=2097152|e|i[2]<<22):this._data[3*e+0]=i[1].charCodeAt(0)|i[2]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 0xc00000&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 i=this._data[3*e+0];return 2097152&i?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&i}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){let i=this._data[3*e+0];return 2097152&i?this._combined[e]:2097151&i?E(2097151&i):""}isProtected(e){return 0x20000000&this._data[3*e+2]}loadCell(e,i){return sK=3*e,i.content=this._data[sK+0],i.fg=this._data[sK+1],i.bg=this._data[sK+2],2097152&i.content&&(i.combinedData=this._combined[e]),0x10000000&i.bg&&(i.extended=this._extendedAttrs[e]),i}setCell(e,i){2097152&i.content&&(this._combined[e]=i.combinedData),0x10000000&i.bg&&(this._extendedAttrs[e]=i.extended),this._data[3*e+0]=i.content,this._data[3*e+1]=i.fg,this._data[3*e+2]=i.bg}setCellFromCodepoint(e,i,s,r){0x10000000&r.bg&&(this._extendedAttrs[e]=r.extended),this._data[3*e+0]=i|s<<22,this._data[3*e+1]=r.fg,this._data[3*e+2]=r.bg}addCodepointToCell(e,i,s){let r=this._data[3*e+0];2097152&r?this._combined[e]+=E(i):2097151&r?(this._combined[e]=E(2097151&r)+E(i),r&=-2097152,r|=2097152):r=4194304|i,s&&(r&=-0xc00001,r|=s<<22),this._data[3*e+0]=r}insertCells(e,i,s){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length-e){let r=new P;for(let s=this.length-e-i-1;s>=0;--s)this.setCell(e+i+s,this.loadCell(e+s,r));for(let r=0;r<i;++r)this.setCell(e+r,s)}else for(let i=e;i<this.length;++i)this.setCell(i,s);2===this.getWidth(this.length-1)&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,i,s){if(e%=this.length,i<this.length-e){let r=new P;for(let s=0;s<this.length-e-i;++s)this.setCell(e+s,this.loadCell(e+i+s,r));for(let e=this.length-i;e<this.length;++e)this.setCell(e,s)}else for(let i=e;i<this.length;++i)this.setCell(i,s);e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,i,s,r=!1){if(r){for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&2===this.getWidth(i-1)&&!this.isProtected(i)&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;return}for(e&&2===this.getWidth(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),i<this.length&&2===this.getWidth(i-1)&&this.setCellFromCodepoint(i,0,1,s);e<i&&e<this.length;)this.setCell(e++,s)}resize(e,i){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let s=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*s)this._data=new Uint32Array(this._data.buffer,0,s);else{let e=new Uint32Array(s);e.set(this._data),this._data=e}for(let s=this.length;s<e;++s)this.setCell(s,i)}else{this._data=this._data.subarray(0,s);let i=Object.keys(this._combined);for(let s=0;s<i.length;s++){let r=parseInt(i[s],10);r>=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let i=0;i<r.length;i++){let s=parseInt(r[i],10);s>=e&&delete this._extendedAttrs[s]}}return this.length=e,4*s*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,i=!1){if(i){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,e);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,e)}copyFrom(e){for(let i in this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={},e._combined)this._combined[i]=e._combined[i];for(let i in this._extendedAttrs={},e._extendedAttrs)this._extendedAttrs[i]=e._extendedAttrs[i];this.isWrapped=e.isWrapped}clone(){let i=new e(0);for(let e in i._data=new Uint32Array(this._data),i.length=this.length,this._combined)i._combined[e]=this._combined[e];for(let e in this._extendedAttrs)i._extendedAttrs[e]=this._extendedAttrs[e];return i.isWrapped=this.isWrapped,i}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]||0x3000000&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,i,s,r,n){let o=e._data;if(n)for(let n=r-1;n>=0;n--){for(let e=0;e<3;e++)this._data[(s+n)*3+e]=o[(i+n)*3+e];0x10000000&o[(i+n)*3+2]&&(this._extendedAttrs[s+n]=e._extendedAttrs[i+n])}else for(let n=0;n<r;n++){for(let e=0;e<3;e++)this._data[(s+n)*3+e]=o[(i+n)*3+e];0x10000000&o[(i+n)*3+2]&&(this._extendedAttrs[s+n]=e._extendedAttrs[i+n])}let h=Object.keys(e._combined);for(let r=0;r<h.length;r++){let n=parseInt(h[r],10);n>=i&&(this._combined[n-i+s]=e._combined[n])}}translateToString(e,i,s,r){i=i??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;i<s;){let e=this._data[3*i+0],s=2097151&e,o=2097152&e?this._combined[i]:s?E(s):" ";if(n+=o,r)for(let e=0;e<o.length;++e)r.push(i);i+=e>>22||1}return r&&r.push(i),n}};function sq(e,i,s){if(i===e.length-1)return e[i].getTrimmedLength();let r=!e[i].hasContent(s-1)&&1===e[i].getWidth(s-1),n=2===e[i+1].getWidth(0);return r&&n?s-1:s}var sV=class e{constructor(i){this.line=i,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new eO),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),e_(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};sV._nextId=1;var sj={},sY=sj.B;sj[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},sj.A={"#":"£"},sj.B=void 0,sj[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},sj.C=sj[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},sj.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},sj.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},sj.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},sj.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},sj.E=sj[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},sj.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},sj.H=sj[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},sj["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var sX=class{constructor(e,i,s){this._hasScrollback=e,this._optionsService=i,this._bufferService=s,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=s$.clone(),this.savedCharset=sY,this.markers=[],this._nullCell=P.fromCharData([0,"",1,0]),this._whitespaceCell=P.fromCharData([0," ",1,32]),this._isClearing=!1,this._memoryCleanupQueue=new sg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new sF(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new L),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new L),this._whitespaceCell}getBlankLine(e,i){return new sU(this._bufferService.cols,this.getNullCell(e),i)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let i=e+this._optionsService.rawOptions.scrollback;return i>0xffffffff?0xffffffff:i}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=s$);let i=this._rows;for(;i--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new sF(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,i){let s=this.getNullCell(s$),r=0,n=this._getCorrectBufferLength(i);if(n>this.lines.maxLength&&(this.lines.maxLength=n),this.lines.length>0){if(this._cols<e)for(let i=0;i<this.lines.length;i++)r+=+this.lines.get(i).resize(e,s);let o=0;if(this._rows<i)for(let r=this._rows;r<i;r++)this.lines.length<i+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new sU(e,s)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new sU(e,s)));else for(let e=this._rows;e>i;e--)this.lines.length>i+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(n<this.lines.maxLength){let e=this.lines.length-n;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=n}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,i-1),o&&(this.y+=o),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=i-1,this._isReflowEnabled&&(this._reflow(e,i),this._cols>e))for(let i=0;i<this.lines.length;i++)r+=+this.lines.get(i).resize(e,s);this._cols=e,this._rows=i,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let i=0;for(;this._memoryCleanupPosition<this.lines.length;)if((i+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory())>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,i){this._cols!==e&&(e>this._cols?this._reflowLarger(e,i):this._reflowSmaller(e,i))}_reflowLarger(e,i){let s=this._optionsService.rawOptions.reflowCursorLine,r=function(e,i,s,r,n,o){let h=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let d=[e.get(a)];for(;l<e.length&&c.isWrapped;)d.push(c),c=e.get(++l);if(!o&&r>=a&&r<l){a+=d.length-1;continue}let _=0,u=sq(d,0,i),f=1,g=0;for(;f<d.length;){let e=sq(d,f,i),r=Math.min(e-g,s-u);d[_].copyCellsFrom(d[f],g,u,r,!1),(u+=r)===s&&(_++,u=0),(g+=r)===e&&(f++,g=0),0===u&&0!==_&&2===d[_-1].getWidth(s-1)&&(d[_].copyCellsFrom(d[_-1],s-1,u++,1,!1),d[_-1].setCell(s-1,n))}d[_].replaceCells(u,s,n);let p=0;for(let e=d.length-1;e>0&&(e>_||0===d[e].getTrimmedLength());e--)p++;p>0&&(h.push(a+d.length-p),h.push(p)),a+=d.length-1}return h}(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(s$),s);if(r.length>0){let s=function(e,i){let s=[],r=0,n=i[0],o=0;for(let h=0;h<e.length;h++)if(n===h){let s=i[++r];e.onDeleteEmitter.fire({index:h-o,amount:s}),h+=s-1,o+=s,n=i[++r]}else s.push(h);return{layout:s,countRemoved:o}}(this.lines,r);(function(e,i){let s=[];for(let r=0;r<i.length;r++)s.push(e.get(i[r]));for(let i=0;i<s.length;i++)e.set(i,s[i]);e.length=i.length})(this.lines,s.layout),this._reflowLargerAdjustViewport(e,i,s.countRemoved)}}_reflowLargerAdjustViewport(e,i,s){let r=this.getNullCell(s$),n=s;for(;n-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<i&&this.lines.push(new sU(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-s,0)}_reflowSmaller(e,i){let s=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(s$),n=[],o=0;for(let h=this.lines.length-1;h>=0;h--){let a=this.lines.get(h);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&h>0;)a=this.lines.get(--h),l.unshift(a);if(!s){let e=this.ybase+this.y;if(e>=h&&e<h+l.length)continue}let c=l[l.length-1].getTrimmedLength(),d=function(e,i,s){let r=[],n=e.map((s,r)=>sq(e,r,i)).reduce((e,i)=>e+i),o=0,h=0,a=0;for(;a<n;){if(n-a<s){r.push(n-a);break}o+=s;let l=sq(e,h,i);o>l&&(o-=l,h++);let c=2===e[h].getWidth(o-1);c&&o--;let d=c?s-1:s;r.push(d),a+=d}return r}(l,this._cols,e),_=d.length-l.length,u;u=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+_):Math.max(0,this.lines.length-this.lines.maxLength+_);let f=[];for(let e=0;e<_;e++){let e=this.getBlankLine(s$,!0);f.push(e)}f.length>0&&(n.push({start:h+l.length+o,newLines:f}),o+=f.length),l.push(...f);let g=d.length-1,p=d[g];0===p&&(p=d[--g]);let v=l.length-_-1,m=c;for(;v>=0;){let e=Math.min(m,p);if(void 0===l[g])break;l[g].copyCellsFrom(l[v],m-e,p-e,e,!0),0==(p-=e)&&(p=d[--g]),0==(m-=e)&&(m=sq(l,Math.max(--v,0),this._cols))}for(let i=0;i<l.length;i++)d[i]<e&&l[i].setCell(d[i],r);let S=_-u;for(;S-- >0;)0===this.ybase?this.y<i-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+o)-i&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+_,this.ybase+i-1)}if(n.length>0){let e=[],i=[];for(let e=0;e<this.lines.length;e++)i.push(this.lines.get(e));let s=this.lines.length,r=s-1,h=0,a=n[0];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+o);let l=0;for(let c=Math.min(this.lines.maxLength-1,s+o-1);c>=0;c--)if(a&&a.start>r+l){for(let e=a.newLines.length-1;e>=0;e--)this.lines.set(c--,a.newLines[e]);c++,e.push({index:r+1,amount:a.newLines.length}),l+=a.newLines.length,a=n[++h]}else this.lines.set(c,i[r--]);let c=0;for(let i=e.length-1;i>=0;i--)e[i].index+=c,this.lines.onInsertEmitter.fire(e[i]),c+=e[i].amount;let d=Math.max(0,s+o-this.lines.maxLength);d>0&&this.lines.onTrimEmitter.fire(d)}}translateBufferLineToString(e,i,s=0,r){let n=this.lines.get(e);return n?n.translateToString(i,s,r):""}getWrappedRangeForLine(e){let i=e,s=e;for(;i>0&&this.lines.get(i).isWrapped;)i--;for(;s+1<this.lines.length&&this.lines.get(s+1).isWrapped;)s++;return{first:i,last:s}}setupTabStops(e){for(null!=e?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].line===e&&(this.markers[i].dispose(),this.markers.splice(i--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let i=new sV(e);return this.markers.push(i),i.register(this.lines.onTrim(e=>{i.line-=e,i.line<0&&i.dispose()})),i.register(this.lines.onInsert(e=>{i.line>=e.index&&(i.line+=e.amount)})),i.register(this.lines.onDelete(e=>{i.line>=e.index&&i.line<e.index+e.amount&&i.dispose(),i.line>e.index&&(i.line-=e.amount)})),i.register(i.onDispose(()=>this._removeMarker(i))),i}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},sG=class extends ep{constructor(e,i){super(),this._optionsService=e,this._bufferService=i,this._onBufferActivate=this._register(new eO),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 sX(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new sX(!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(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),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(e,i){this._normal.resize(e,i),this._alt.resize(e,i),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},sJ=class extends ep{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new eO),this.onResize=this._onResize.event,this._onScroll=this._register(new eO),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,2),this.rows=Math.max(e.rawOptions.rows||0,1),this.buffers=this._register(new sG(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,i){let s=this.cols!==e,r=this.rows!==i;this.cols=e,this.rows=i,this.buffers.resize(e,i),this._onResize.fire({cols:e,rows:i,colsChanged:s,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,i=!1){let s=this.buffer,r;(r=this._cachedBlankLine)&&r.length===this.cols&&r.getFg(0)===e.fg&&r.getBg(0)===e.bg||(r=s.getBlankLine(e,i),this._cachedBlankLine=r),r.isWrapped=i;let n=s.ybase+s.scrollTop,o=s.ybase+s.scrollBottom;if(0===s.scrollTop){let e=s.lines.isFull;o===s.lines.length-1?e?s.lines.recycle().copyFrom(r):s.lines.push(r.clone()):s.lines.splice(o+1,0,r.clone()),e?this.isUserScrolling&&(s.ydisp=Math.max(s.ydisp-1,0)):(s.ybase++,this.isUserScrolling||s.ydisp++)}else{let e=o-n+1;s.lines.shiftElements(n+1,e-1,-1),s.lines.set(o,r.clone())}this.isUserScrolling||(s.ydisp=s.ybase),this._onScroll.fire(s.ydisp)}scrollLines(e,i){let s=this.buffer;if(e<0){if(0===s.ydisp)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);let r=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),r!==s.ydisp&&(i||this._onScroll.fire(s.ydisp))}};sJ=S([b(0,K)],sJ);var sZ={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:so,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},sQ=["normal","bold","100","200","300","400","500","600","700","800","900"],s0=class extends ep{constructor(e){super(),this._onOptionChange=this._register(new eO),this.onOptionChange=this._onOptionChange.event;let i={...sZ};for(let s in e)if(s in i)try{let r=e[s];i[s]=this._sanitizeAndValidateOption(s,r)}catch(e){console.error(e)}this.rawOptions=i,this.options={...i},this._setupOptions(),this._register(eu(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,i){return this.onOptionChange(s=>{s===e&&i(this.rawOptions[e])})}onMultipleOptionChange(e,i){return this.onOptionChange(s=>{-1!==e.indexOf(s)&&i()})}_setupOptions(){let e=e=>{if(!(e in sZ))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},i=(e,i)=>{if(!(e in sZ))throw Error(`No option with key "${e}"`);i=this._sanitizeAndValidateOption(e,i),this.rawOptions[e]!==i&&(this.rawOptions[e]=i,this._onOptionChange.fire(e))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:i.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,i){switch(e){case"cursorStyle":var s;if(i||(i=sZ[e]),"block"!==(s=i)&&"underline"!==s&&"bar"!==s)throw Error(`"${i}" is not a valid value for ${e}`);break;case"wordSeparator":i||(i=sZ[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof i&&1<=i&&i<=1e3)break;i=sQ.includes(i)?i:sZ[e];break;case"cursorWidth":i=Math.floor(i);case"lineHeight":case"tabStopWidth":if(i<1)throw Error(`${e} 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,0xffffffff))<0)throw Error(`${e} cannot be less than 0, value: ${i}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(i<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${i}`);break;case"rows":case"cols":if(!i&&0!==i)throw Error(`${e} must be numeric, value: ${i}`);break;case"windowsPty":i=i??{}}return i}};function s1(e,i=5){if("object"!=typeof e)return e;let s=Array.isArray(e)?[]:{};for(let r in e)s[r]=i<=1?e[r]:e[r]&&s1(e[r],i-1);return s}var s2=Object.freeze({insertMode:!1}),s5=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),s3=class extends ep{constructor(e,i,s){super(),this._bufferService=e,this._logService=i,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new eO),this.onData=this._onData.event,this._onUserInput=this._register(new eO),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new eO),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new eO),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=s1(s2),this.decPrivateModes=s1(s5)}reset(){this.modes=s1(s2),this.decPrivateModes=s1(s5)}triggerDataEvent(e,i=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;i&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),i&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};s3=S([b(0,I),b(1,$),b(2,K)],s3);var s6={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function s4(e,i){let s=16*!!e.ctrl|4*!!e.shift|8*!!e.alt;return 4===e.button?(s|=64,s|=e.action):(s|=3&e.button,4&e.button&&(s|=64),8&e.button&&(s|=128),32===e.action?s|=32:0!==e.action||i||(s|=3)),s}var s8=String.fromCharCode,s7={DEFAULT:e=>{let i=[s4(e,!1)+32,e.col+32,e.row+32];return i[0]>255||i[1]>255||i[2]>255?"":`\x1b[M${s8(i[0])}${s8(i[1])}${s8(i[2])}`},SGR:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${s4(e,!0)};${e.col};${e.row}${i}`},SGR_PIXELS:e=>{let i=0===e.action&&4!==e.button?"m":"M";return`\x1b[<${s4(e,!0)};${e.x};${e.y}${i}`}},s9=class extends ep{constructor(e,i,s){for(let r of(super(),this._bufferService=e,this._coreService=i,this._optionsService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new eO),this.onProtocolChange=this._onProtocolChange.event,Object.keys(s6)))this.addProtocol(r,s6[r]);for(let e of Object.keys(s7))this.addEncoding(e,s7[e]);this.reset()}addProtocol(e,i){this._protocols[e]=i}addEncoding(e,i){this._encodings[e]=i}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,i,s){if(0===e.deltaY||e.shiftKey||void 0===i||void 0===s)return 0;let r=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=i/s+0,50>Math.abs(e.deltaY)&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(e,i){return i.altKey||i.ctrlKey||i.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||4===e.button&&32===e.action||3===e.button&&32!==e.action||4!==e.button&&(2===e.action||3===e.action)||(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))||!this._protocols[this._activeProtocol].restrict(e))return!1;let i=this._encodings[this._activeEncoding](e);return i&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(i):this._coreService.triggerDataEvent(i,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,i,s){if(s){if(e.x!==i.x||e.y!==i.y)return!1}else if(e.col!==i.col||e.row!==i.row)return!1;return e.button===i.button&&e.action===i.action&&e.ctrl===i.ctrl&&e.alt===i.alt&&e.shift===i.shift}};s9=S([b(0,I),b(1,W),b(2,K)],s9);var re,rt,ri,rs,rr,rn,ro=[[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]],rh=[[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]],ra=class{constructor(){if(this.version="6",!rn){(rn=new Uint8Array(65536)).fill(1),rn[0]=0,rn.fill(0,1,32),rn.fill(0,127,160),rn.fill(2,4352,4448),rn[9001]=2,rn[9002]=2,rn.fill(2,11904,42192),rn[12351]=1,rn.fill(2,44032,55204),rn.fill(2,63744,64256),rn.fill(2,65040,65050),rn.fill(2,65072,65136),rn.fill(2,65280,65377),rn.fill(2,65504,65511);for(let e=0;e<ro.length;++e)rn.fill(0,ro[e][0],ro[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?rn[e]:!function(e,i){let s=0,r=i.length-1,n;if(e<i[0][0]||e>i[r][1])return!1;for(;r>=s;)if(e>i[n=s+r>>1][1])s=n+1;else{if(!(e<i[n][0]))return!0;r=n-1}return!1}(e,rh)?e>=131072&&e<=196605||e>=196608&&e<=262141?2:1:0}charProperties(e,i){let s=this.wcwidth(e),r=0===s&&0!==i;if(r){let e=rl.extractWidth(i);0===e?r=!1:e>s&&(s=e)}return rl.createPropertyValue(0,s,r)}},rl=class e{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new eO,this.onChange=this._onChange.event;let e=new ra;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(1&e)!=0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,i,s=!1){return(0xffffff&e)<<3|(3&i)<<1|!!s}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(i){let s=0,r=0,n=i.length;for(let o=0;o<n;++o){let h=i.charCodeAt(o);if(55296<=h&&h<=56319){if(++o>=n)return s+this.wcwidth(h);let e=i.charCodeAt(o);56320<=e&&e<=57343?h=(h-55296)*1024+e-56320+65536:s+=this.wcwidth(e)}let a=this.charProperties(h,r),l=e.extractWidth(a);e.extractShouldJoin(a)&&(l-=e.extractWidth(r)),s+=l,r=a}return s}charProperties(e,i){return this._activeProvider.charProperties(e,i)}},rc=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,i){this._charsets[e]=i,this.glevel===e&&(this.charset=i)}};function rd(e){let i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),s=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);s&&i&&(s.isWrapped=0!==i[3]&&32!==i[3])}var r_=class e{constructor(e=32,i=32){if(this.maxLength=e,this.maxSubParamsLength=i,i>256)throw Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(i),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(i){let s=new e;if(!i.length)return s;for(let e=+!!Array.isArray(i[0]);e<i.length;++e){let r=i[e];if(Array.isArray(r))for(let e=0;e<r.length;++e)s.addSubParam(r[e]);else s.addParam(r)}return s}clone(){let i=new e(this.maxLength,this.maxSubParamsLength);return i.params.set(this.params),i.length=this.length,i._subParams.set(this._subParams),i._subParamsLength=this._subParamsLength,i._subParamsIdx.set(this._subParamsIdx),i._rejectDigits=this._rejectDigits,i._rejectSubDigits=this._rejectSubDigits,i._digitIsSub=this._digitIsSub,i}toArray(){let e=[];for(let i=0;i<this.length;++i){e.push(this.params[i]);let s=this._subParamsIdx[i]>>8,r=255&this._subParamsIdx[i];r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>0x7fffffff?0x7fffffff:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>0x7fffffff?0x7fffffff:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let i=this._subParamsIdx[e]>>8,s=255&this._subParamsIdx[e];return s-i>0?this._subParams.subarray(i,s):null}getSubParamsAll(){let e={};for(let i=0;i<this.length;++i){let s=this._subParamsIdx[i]>>8,r=255&this._subParamsIdx[i];r-s>0&&(e[i]=this._subParams.slice(s,r))}return e}addDigit(e){let i;if(this._rejectDigits||!(i=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[i-1];s[i-1]=~r?Math.min(10*r+e,0x7fffffff):e}},ru=[],rf=class{constructor(){this._state=0,this._active=ru,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let e=s.indexOf(i);-1!==e&&s.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=ru}reset(){if(2===this._state)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=ru,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||ru,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,i,s){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s);else this._handlerFb(this._id,"PUT",B(e,i,s))}start(){this.reset(),this._state=1}put(e,i,s){if(3!==this._state){if(1===this._state)for(;i<s;){let s=e[i++];if(59===s){this._state=2,this._start();break}if(s<48||57<s){this._state=3;return}-1===this._id&&(this._id=0),this._id=10*this._id+s-48}2===this._state&&s-i>0&&this._put(e,i,s)}}end(e,i=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;r>=0&&!0!==(s=this._active[r].end(e));r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if((s=this._active[r].end(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}else this._handlerFb(this._id,"END",e);this._active=ru,this._id=-1,this._state=0}}},rg=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,i,s){this._hitLimit||(this._data+=B(e,i,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data))instanceof Promise)return i.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,i}},rp=[],rv=class{constructor(){this._handlers=Object.create(null),this._active=rp,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=rp}registerHandler(e,i){void 0===this._handlers[e]&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(i),{dispose:()=>{let e=s.indexOf(i);-1!==e&&s.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=rp,this._ident=0}hook(e,i){if(this.reset(),this._ident=e,this._active=this._handlers[e]||rp,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(e,i,s){if(this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,i,s);else this._handlerFb(this._ident,"PUT",B(e,i,s))}unhook(e,i=!0){if(this._active.length){let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=i,n=this._stack.fallThrough,this._stack.paused=!1),!n&&!1===s){for(;r>=0&&!0!==(s=this._active[r].unhook(e));r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if((s=this._active[r].unhook(!1))instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"UNHOOK",e);this._active=rp,this._ident=0}},rm=new r_;rm.addParam(0);var rS=class{constructor(e){this._handler=e,this._data="",this._params=rm,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():rm,this._data="",this._hitLimit=!1}put(e,i,s){this._hitLimit||(this._data+=B(e,i,s),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let i=!1;if(this._hitLimit)i=!1;else if(e&&(i=this._handler(this._data,this._params))instanceof Promise)return i.then(e=>(this._params=rm,this._data="",this._hitLimit=!1,e));return this._params=rm,this._data="",this._hitLimit=!1,i}},rb=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,i){this.table.fill(e<<4|i)}add(e,i,s,r){this.table[i<<8|e]=s<<4|r}addMany(e,i,s,r){for(let n=0;n<e.length;n++)this.table[i<<8|e[n]]=s<<4|r}},rw=function(){let e=new rb(4095),i=Array.apply(null,Array(256)).map((e,i)=>i),s=(e,s)=>i.slice(e,s),r=s(32,127),n=s(0,24);n.push(25),n.push.apply(n,s(28,32));let o=s(0,14),h;for(h in e.setDefault(1,0),e.addMany(r,0,2,0),o)e.addMany([24,26,153,154],h,3,0),e.addMany(s(128,144),h,3,0),e.addMany(s(144,152),h,3,0),e.add(156,h,0,0),e.add(27,h,11,1),e.add(157,h,4,8),e.addMany([152,158,159],h,0,7),e.add(155,h,11,3),e.add(144,h,11,9);return e.addMany(n,0,3,0),e.addMany(n,1,3,1),e.add(127,1,0,1),e.addMany(n,8,0,8),e.addMany(n,3,3,3),e.add(127,3,0,3),e.addMany(n,4,3,4),e.add(127,4,0,4),e.addMany(n,6,3,6),e.addMany(n,5,3,5),e.add(127,5,0,5),e.addMany(n,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(s(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(n,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(s(64,127),3,7,0),e.addMany(s(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(s(48,60),4,8,4),e.addMany(s(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(s(32,64),6,0,6),e.add(127,6,0,6),e.addMany(s(64,127),6,0,0),e.addMany(s(32,48),3,9,5),e.addMany(s(32,48),5,9,5),e.addMany(s(48,64),5,0,6),e.addMany(s(64,127),5,7,0),e.addMany(s(32,48),4,9,5),e.addMany(s(32,48),1,9,2),e.addMany(s(32,48),2,9,2),e.addMany(s(48,127),2,10,0),e.addMany(s(48,80),1,10,0),e.addMany(s(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(s(96,127),1,10,0),e.add(80,1,11,9),e.addMany(n,9,0,9),e.add(127,9,0,9),e.addMany(s(28,32),9,0,9),e.addMany(s(32,48),9,9,12),e.addMany(s(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(n,11,0,11),e.addMany(s(32,128),11,0,11),e.addMany(s(28,32),11,0,11),e.addMany(n,10,0,10),e.add(127,10,0,10),e.addMany(s(28,32),10,0,10),e.addMany(s(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(s(32,48),10,9,12),e.addMany(n,12,0,12),e.add(127,12,0,12),e.addMany(s(28,32),12,0,12),e.addMany(s(32,48),12,9,12),e.addMany(s(48,64),12,0,11),e.addMany(s(64,127),12,12,13),e.addMany(s(64,127),10,12,13),e.addMany(s(64,127),9,12,13),e.addMany(n,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(160,0,2,0),e.add(160,8,5,8),e.add(160,6,0,6),e.add(160,11,0,11),e.add(160,13,13,13),e}(),ry=class extends ep{constructor(e=rw){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new r_,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,i,s)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,i)=>{},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(eu(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new rf),this._dcsParser=this._register(new rv),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,i=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw Error("only one byte as prefix supported");if((s=e.prefix.charCodeAt(0))&&60>s||s>63)throw Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let r=e.intermediates.charCodeAt(i);if(32>r||r>47)throw Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=r}}if(1!==e.final.length)throw Error("final must be a single byte");let r=e.final.charCodeAt(0);if(i[0]>r||r>i[1])throw Error(`final must be in range ${i[0]} .. ${i[1]}`);return s<<=8,s|=r}identToString(e){let i=[];for(;e;)i.push(String.fromCharCode(255&e)),e>>=8;return i.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,i){let s=this._identifier(e,[48,126]);void 0===this._escHandlers[s]&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,i){this._executeHandlers[e.charCodeAt(0)]=i}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,i){let s=this._identifier(e);void 0===this._csiHandlers[s]&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(i),{dispose:()=>{let e=r.indexOf(i);-1!==e&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,i){return this._dcsParser.registerHandler(this._identifier(e),i)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,i){return this._oscParser.registerHandler(e,i)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}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,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,i,s,r,n){this._parseStack.state=e,this._parseStack.handlers=i,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,i,s){let r=0,n=0,o=0,h;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(void 0===s||1===this._parseStack.state)throw this._parseStack.state=1,Error("improper continuation due to previous async handler, giving up parsing");let i=this._parseStack.handlers,n=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===s&&n>-1){for(;n>=0&&!0!==(h=i[n](this._params));n--)if(h instanceof Promise)return this._parseStack.handlerPos=n,h}this._parseStack.handlers=[];break;case 4:if(!1===s&&n>-1){for(;n>=0&&!0!==(h=i[n]());n--)if(h instanceof Promise)return this._parseStack.handlerPos=n,h}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],h=this._dcsParser.unhook(24!==r&&26!==r,s))return h;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],h=this._oscParser.end(24!==r&&26!==r,s))return h;27===r&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let s=o;s<i;++s){switch(r=e[s],(n=this._transitions.table[this.currentState<<8|(r<160?r:160)])>>4){case 2:for(let n=s+1;;++n)if(n>=i||(r=e[n])<32||r>126&&r<160||++n>=i||(r=e[n])<32||r>126&&r<160||++n>=i||(r=e[n])<32||r>126&&r<160||++n>=i||(r=e[n])<32||r>126&&r<160){this._printHandler(e,s,n),s=n-1;break}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:s,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let o=this._csiHandlers[this._collect<<8|r],a=o?o.length-1:-1;for(;a>=0&&!0!==(h=o[a](this._params));a--)if(h instanceof Promise)return this._preserveStack(3,o,a,n,s),h;a<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++s<i&&(r=e[s])>47&&r<60)s--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let l=this._escHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&!0!==(h=l[c]());c--)if(h instanceof Promise)return this._preserveStack(4,l,c,n,s),h;c<0&&this._escHandlerFb(this._collect<<8|r),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|r,this._params);break;case 13:for(let n=s+1;;++n)if(n>=i||24===(r=e[n])||26===r||27===r||r>127&&r<160){this._dcsParser.put(e,s,n),s=n-1;break}break;case 14:if(h=this._dcsParser.unhook(24!==r&&26!==r))return this._preserveStack(6,[],0,n,s),h;27===r&&(n|=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 n=s+1;;n++)if(n>=i||(r=e[n])<32||r>127&&r<160){this._oscParser.put(e,s,n),s=n-1;break}break;case 6:if(h=this._oscParser.end(24!==r&&26!==r))return this._preserveStack(5,[],0,n,s),h;27===r&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&n}}},rC=/^([\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})$/,rx=/^[\da-f]+$/;function rk(e){if(!e)return;let i=e.toLowerCase();if(0===i.indexOf("rgb:")){i=i.slice(4);let e=rC.exec(i);if(e){let i=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/i*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/i*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/i*255)]}}else if(0===i.indexOf("#")&&(i=i.slice(1),rx.exec(i)&&[3,6,9,12].includes(i.length))){let e=i.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(i.slice(e*r,e*r+e),16);s[r]=1===e?n<<4:2===e?n:3===e?n>>4:n>>8}return s}}function rE(e,i){let s=e.toString(16),r=s.length<2?"0"+s:s;switch(i){case 4:return s[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}var rB={"(":0,")":1,"*":2,"+":3,"-":1,".":2};function rD(e,i){if(e>24)return i.setWinLines||!1;switch(e){case 1:return!!i.restoreWin;case 2:return!!i.minimizeWin;case 3:return!!i.setWinPosition;case 4:return!!i.setWinSizePixels;case 5:return!!i.raiseWin;case 6:return!!i.lowerWin;case 7:return!!i.refreshWin;case 8:return!!i.setWinSizeChars;case 9:return!!i.maximizeWin;case 10:return!!i.fullscreenWin;case 11:return!!i.getWinState;case 13:return!!i.getWinPosition;case 14:return!!i.getWinSizePixels;case 15:return!!i.getScreenSizePixels;case 16:return!!i.getCellSizePixels;case 18:return!!i.getWinSizeChars;case 19:return!!i.getScreenSizeChars;case 20:return!!i.getIconTitle;case 21:return!!i.getWinTitle;case 22:return!!i.pushTitle;case 23:return!!i.popTitle;case 24:return!!i.setWinLines}return!1}var rM=0,rR=class extends ep{constructor(e,i,s,r,n,o,h,a,l=new ry){for(let c in super(),this._bufferService=e,this._charsetService=i,this._coreService=s,this._logService=r,this._optionsService=n,this._oscLinkService=o,this._coreMouseService=h,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new D,this._utf8Decoder=new M,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=s$.clone(),this._eraseAttrDataInternal=s$.clone(),this._onRequestBell=this._register(new eO),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new eO),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new eO),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new eO),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new eO),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new eO),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new eO),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new eO),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new eO),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new eO),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new eO),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new eO),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new eO),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 rL(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,i)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:i.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,i,s)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:i,data:s})}),this._parser.setDcsHandlerFallback((e,i,s)=>{"HOOK"===i&&(s=s.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:i,payload:s})}),this._parser.setPrintHandler((e,i,s)=>this.print(e,i,s)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(iv.BEL,()=>this.bell()),this._parser.setExecuteHandler(iv.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(iv.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(iv.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(iv.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(iv.BS,()=>this.backspace()),this._parser.setExecuteHandler(iv.HT,()=>this.tab()),this._parser.setExecuteHandler(iv.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(iv.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(im.IND,()=>this.index()),this._parser.setExecuteHandler(im.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(im.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new rg(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new rg(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new rg(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new rg(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new rg(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new rg(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new rg(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new rg(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new rg(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new rg(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new rg(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new rg(e=>this.restoreCursorColor(e))),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()),sj)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new rS((e,i)=>this.requestStatusString(e,i)))}getAttrData(){return this._curAttrData}_preserveStack(e,i,s,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=i,this._parseStack.decodedLength=s,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,i)=>setTimeout(()=>i("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,i){let s,r=this._activeBuffer.x,n=this._activeBuffer.y,o=0,h=this._parseStack.paused;if(h){if(s=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,i))return this._logSlowResolvingAsync(s),s;r=this._parseStack.cursorStartX,n=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>131072&&(o=this._parseStack.position+131072)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${"string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`}`),0===this._logService.logLevel&&this._logService.trace("parsing data (codes)","string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<131072&&(this._parseBuffer=new Uint32Array(Math.min(e.length,131072))),h||this._dirtyRowTracker.clearRange(),e.length>131072)for(let i=o;i<e.length;i+=131072){let o=i+131072<e.length?i+131072:e.length,h="string"==typeof e?this._stringDecoder.decode(e.substring(i,o),this._parseBuffer):this._utf8Decoder.decode(e.subarray(i,o),this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,h))return this._preserveStack(r,n,h,i),this._logSlowResolvingAsync(s),s}else if(!h){let i="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(s=this._parser.parse(this._parseBuffer,i))return this._preserveStack(r,n,i,0),this._logSlowResolvingAsync(s),s}(this._activeBuffer.x!==r||this._activeBuffer.y!==n)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,i,s){let r,n,o=this._charsetService.charset,h=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,d=this._curAttrData,_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&s-i>0&&2===_.getWidth(this._activeBuffer.x-1)&&_.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let u=this._parser.precedingJoinState;for(let f=i;f<s;++f){if((r=e[f])<127&&o){let e=o[String.fromCharCode(r)];e&&(r=e.charCodeAt(0))}let i=this._unicodeService.charProperties(r,u);n=rl.extractWidth(i);let s=rl.extractShouldJoin(i),g=s?rl.extractWidth(u):0;if(u=i,h&&this._onA11yChar.fire(E(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+n-g>a){if(l){let e=_,i=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),_=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),g>0&&_ instanceof sU&&_.copyCellsFrom(e,i,0,g,!1);i<a;)e.setCellFromCodepoint(i++,0,1,d)}else if(this._activeBuffer.x=a-1,2===n)continue}if(s&&this._activeBuffer.x){let e=_.getWidth(this._activeBuffer.x-1)?1:2;_.addCodepointToCell(this._activeBuffer.x-e,r,n);for(let e=n-g;--e>=0;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(c&&(_.insertCells(this._activeBuffer.x,n-g,this._activeBuffer.getNullCell(d)),2===_.getWidth(a-1)&&_.setCellFromCodepoint(a-1,0,1,d)),_.setCellFromCodepoint(this._activeBuffer.x++,r,n,d),n>0)for(;--n;)_.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=u,this._activeBuffer.x<a&&s-i>0&&0===_.getWidth(this._activeBuffer.x)&&!_.hasContent(this._activeBuffer.x)&&_.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,i){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,i):this._parser.registerCsiHandler(e,e=>!rD(e.params[0],this._optionsService.rawOptions.windowOptions)||i(e))}registerDcsHandler(e,i){return this._parser.registerDcsHandler(e,new rS(i))}registerEscHandler(e,i){return this._parser.registerEscHandler(e,i)}registerOscHandler(e,i){return this._parser.registerOscHandler(e,new rg(i))}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(0===this._activeBuffer.x&&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 e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,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(e,i){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+i):(this._activeBuffer.x=e,this._activeBuffer.y=i),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,i){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+i)}cursorUp(e){let i=this._activeBuffer.y-this._activeBuffer.scrollTop;return i>=0?this._moveCursor(0,-Math.min(i,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let i=this._activeBuffer.scrollBottom-this._activeBuffer.y;return i>=0?this._moveCursor(0,Math.min(i,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let i=e.params[0];return 0===i?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===i&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=e.params[0]||1;for(;i--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let i=e.params[0];return 1===i&&(this._curAttrData.bg|=0x20000000),(2===i||0===i)&&(this._curAttrData.bg&=-0x20000001),!0}_eraseInBufferLine(e,i,s,r=!1,n=!1){let o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(i,s,this._activeBuffer.getNullCell(this._eraseAttrData()),n),r&&(o.isWrapped=!1)}_resetBufferLine(e,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s&&(s.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),i),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),s.isWrapped=!1)}eraseInDisplay(e,i=!1){let s;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);s<this._bufferService.rows;s++)this._resetBufferLine(s,i);this._dirtyRowTracker.markDirty(s);break;case 1:for(s=this._activeBuffer.y,this._dirtyRowTracker.markDirty(s),this._eraseInBufferLine(s,0,this._activeBuffer.x+1,!0,i),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(s+1).isWrapped=!1);s--;)this._resetBufferLine(s,i);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(s=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,s-1);s--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+s)?.getTrimmedLength(););for(;s>=0;s--)this._bufferService.scroll(this._eraseAttrData())}else{for(s=this._bufferService.rows,this._dirtyRowTracker.markDirty(s-1);s--;)this._resetBufferLine(s,i);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0))}return!0}eraseInLine(e,i=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,i);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,i);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,i)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;i--;)this._activeBuffer.lines.splice(n-1,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let i=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let s=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;i--;)this._activeBuffer.lines.splice(s,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let i=e.params[0]||1;for(;i--;)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(e){let i=e.params[0]||1;for(;i--;)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(s$));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.deleteCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.insertCells(0,i,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let i=e.params[0]||1;for(let e=this._activeBuffer.scrollTop;e<=this._activeBuffer.scrollBottom;++e){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.deleteCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return i&&(i.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let i=this._parser.precedingJoinState;if(!i)return!0;let s=e.params[0]||1,r=rl.extractWidth(i),n=this._activeBuffer.x-r,o=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(n),h=new Uint32Array(o.length*s),a=0;for(let e=0;e<o.length;){let i=o.codePointAt(e)||0;h[a++]=i,e+=i>65535?2:1}let l=a;for(let e=1;e<s;++e)h.copyWithin(l,0,a),l+=a;return this.print(h,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(iv.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(iv.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(iv.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(iv.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(iv.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,sY),this._charsetService.setgCharset(1,sY),this._charsetService.setgCharset(2,sY),this._charsetService.setgCharset(3,sY);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(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0}return!0}resetMode(e){for(let i=0;i<e.length;i++)switch(e.params[i]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let i=0;i<e.length;i++)switch(e.params[i]){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(),1049===e.params[i]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0)}return!0}requestMode(e,i){let s,r,n,o;(r=s||={})[r.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",r[r.SET=1]="SET",r[r.RESET=2]="RESET",r[r.PERMANENTLY_SET=3]="PERMANENTLY_SET",r[r.PERMANENTLY_RESET=4]="PERMANENTLY_RESET";let h=this._coreService.decPrivateModes,{activeProtocol:a,activeEncoding:l}=this._coreMouseService,c=this._coreService,{buffers:d,cols:_}=this._bufferService,{active:u,alt:f}=d,g=this._optionsService.rawOptions,p=e=>e?1:2,v=e.params[0];return n=v,o=i?2===v?4:4===v?p(c.modes.insertMode):12===v?3:20===v?p(g.convertEol):0:1===v?p(h.applicationCursorKeys):3===v?g.windowOptions.setWinLines?80===_?2:+(132===_):0:6===v?p(h.origin):7===v?p(h.wraparound):8===v?3:9===v?p("X10"===a):12===v?p(g.cursorBlink):25===v?p(!c.isCursorHidden):45===v?p(h.reverseWraparound):66===v?p(h.applicationKeypad):67===v?4:1e3===v?p("VT200"===a):1002===v?p("DRAG"===a):1003===v?p("ANY"===a):1004===v?p(h.sendFocus):1005===v?4:1006===v?p("SGR"===l):1015===v?4:1016===v?p("SGR_PIXELS"===l):1048===v?1:47===v||1047===v||1049===v?p(u===f):2004===v?p(h.bracketedPasteMode):2026===v?p(h.synchronizedOutput):0,c.triggerDataEvent(`${iv.ESC}[${i?"":"?"}${n};${o}$y`),!0}_updateAttrColor(e,i,s,r,n){return 2===i?(e|=0x3000000,e&=-0x1000000,e|=R.fromColorRGB([s,r,n])):5===i&&(e&=-0x3000100,e|=0x2000000|255&s),e}_extractColor(e,i,s){let r=[0,0,-1,0,0,0],n=0,o=0;do{if(r[o+n]=e.params[i+o],e.hasSubParams(i+o)){let s=e.getSubParams(i+o),h=0;do 5===r[1]&&(n=1),r[o+h+1+n]=s[h];while(++h<s.length&&h+o+1+n<r.length)break}if(5===r[1]&&o+n>=2||2===r[1]&&o+n>=5)break;r[1]&&(n=1)}while(++o+i<e.length&&o+n<r.length)for(let e=2;e<r.length;++e)-1===r[e]&&(r[e]=0);switch(r[0]){case 38:s.fg=this._updateAttrColor(s.fg,r[1],r[3],r[4],r[5]);break;case 48:s.bg=this._updateAttrColor(s.bg,r[1],r[3],r[4],r[5]);break;case 58:s.extended=s.extended.clone(),s.extended.underlineColor=this._updateAttrColor(s.extended.underlineColor,r[1],r[3],r[4],r[5])}return o}_processUnderline(e,i){i.extended=i.extended.clone(),(!~e||e>5)&&(e=1),i.extended.underlineStyle=e,i.fg|=0x10000000,0===e&&(i.fg&=-0x10000001),i.updateExtended()}_processSGR0(e){e.fg=s$.fg,e.bg=s$.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-0x4000000,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;let i=e.length,s,r=this._curAttrData;for(let n=0;n<i;n++)(s=e.params[n])>=30&&s<=37?(r.fg&=-0x3000100,r.fg|=0x1000000|s-30):s>=40&&s<=47?(r.bg&=-0x3000100,r.bg|=0x1000000|s-40):s>=90&&s<=97?(r.fg&=-0x3000100,r.fg|=0x1000000|s-90|8):s>=100&&s<=107?(r.bg&=-0x3000100,r.bg|=0x1000000|s-100|8):0===s?this._processSGR0(r):1===s?r.fg|=0x8000000:3===s?r.bg|=0x4000000:4===s?(r.fg|=0x10000000,this._processUnderline(e.hasSubParams(n)?e.getSubParams(n)[0]:1,r)):5===s?r.fg|=0x20000000:7===s?r.fg|=0x4000000:8===s?r.fg|=0x40000000:9===s?r.fg|=0x80000000:2===s?r.bg|=0x8000000:21===s?this._processUnderline(2,r):22===s?(r.fg&=-0x8000001,r.bg&=-0x8000001):23===s?r.bg&=-0x4000001:24===s?(r.fg&=-0x10000001,this._processUnderline(0,r)):25===s?r.fg&=-0x20000001:27===s?r.fg&=-0x4000001:28===s?r.fg&=-0x40000001:29===s?r.fg&=0x7fffffff:39===s?(r.fg&=-0x4000000,r.fg|=0xffffff&s$.fg):49===s?(r.bg&=-0x4000000,r.bg|=0xffffff&s$.bg):38===s||48===s||58===s?n+=this._extractColor(e,n,r):53===s?r.bg|=0x40000000:55===s?r.bg&=-0x40000001:59===s?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===s?(r.fg&=-0x4000000,r.fg|=0xffffff&s$.fg,r.bg&=-0x4000000,r.bg|=0xffffff&s$.bg):this._logService.debug("Unknown SGR attribute: %d.",s);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${iv.ESC}[0n`);break;case 6:let i=this._activeBuffer.y+1,s=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iv.ESC}[${i};${s}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){let e=this._activeBuffer.y+1,i=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${iv.ESC}[?${e};${i}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=s$.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(e){let i=0===e.length?1:e.params[0];if(0===i)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(i){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar"}this._coreService.decPrivateModes.cursorBlink=i%2==1}return!0}setScrollRegion(e){let i=e.params[0]||1,s;return(e.length<2||(s=e.params[1])>this._bufferService.rows||0===s)&&(s=this._bufferService.rows),s>i&&(this._activeBuffer.scrollTop=i-1,this._activeBuffer.scrollBottom=s-1,this._setCursor(0,0)),!0}windowOptions(e){if(!rD(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let i=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==i&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${iv.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(0===i||2===i)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),(0===i||1===i)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:(0===i||2===i)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(0===i||1===i)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){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(e){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(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let i=[],s=e.split(";");for(;s.length>1;){let e=s.shift(),r=s.shift();if(/^\d+$/.exec(e)){let s=parseInt(e);if(rP(s))if("?"===r)i.push({type:0,index:s});else{let e=rk(r);e&&i.push({type:1,index:s,color:e})}}}return i.length&&this._onColor.fire(i),!0}setHyperlink(e){let i=e.indexOf(";");if(-1===i)return!0;let s=e.slice(0,i).trim(),r=e.slice(i+1);return r?this._createHyperlink(s,r):!s.trim()&&this._finishHyperlink()}_createHyperlink(e,i){this._getCurrentLinkId()&&this._finishHyperlink();let s=e.split(":"),r,n=s.findIndex(e=>e.startsWith("id="));return -1!==n&&(r=s[n].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:i}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,i){let s=e.split(";");for(let e=0;e<s.length&&!(i>=this._specialColors.length);++e,++i)if("?"===s[e])this._onColor.fire([{type:0,index:this._specialColors[i]}]);else{let r=rk(s[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[i],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let i=[],s=e.split(";");for(let e=0;e<s.length;++e)if(/^\d+$/.exec(s[e])){let r=parseInt(s[e]);rP(r)&&i.push({type:2,index:r})}return i.length&&this._onColor.fire(i),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){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,sY),!0}selectCharset(e){return 2!==e.length?this.selectDefaultCharset():"/"===e[0]||this._charsetService.setgCharset(rB[e[0]],sj[e[1]]||sY),!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 e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,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=s$.clone(),this._eraseAttrDataInternal=s$.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-0x4000000,this._eraseAttrDataInternal.bg|=0x3ffffff&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new P;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let i=0;i<this._bufferService.rows;++i){let s=this._activeBuffer.ybase+this._activeBuffer.y+i,r=this._activeBuffer.lines.get(s);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,i){let s=e=>(this._coreService.triggerDataEvent(`${iv.ESC}${e}${iv.ESC}\\`),!0),r=this._bufferService.buffer,n=this._optionsService.rawOptions;return s('"q'===e?`P1$r${+!!this._curAttrData.isProtected()}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${({block:2,underline:4,bar:6})[n.cursorStyle]-!!n.cursorBlink} q`:"P0$r")}markRangeDirty(e,i){this._dirtyRowTracker.markRangeDirty(e,i)}},rL=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,i){e>i&&(rM=e,e=i,i=rM),e<this.start&&(this.start=e),i>this.end&&(this.end=i)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function rP(e){return 0<=e&&e<256}rL=S([b(0,I)],rL);var rT=class extends ep{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new eO),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,i){let s;if(void 0!==i&&this._syncCalls>i){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,!this._isSyncWriting){for(this._isSyncWriting=!0;s=this._writeBuffer.shift();){this._action(s);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=0x7fffffff,this._isSyncWriting=!1,this._syncCalls=0}}write(e,i){if(this._pendingData>5e7)throw Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(i)}_innerWrite(e=0,i=!0){let s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,i);if(r){let e=e=>performance.now()-s>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(s,e);r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e);return}let n=this._callbacks[this._bufferOffset];if(n&&n(),this._bufferOffset++,this._pendingData-=e.length,performance.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()}},rA=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let i=this._bufferService.buffer;if(void 0===e.id){let s=i.addMarker(i.ybase+i.y),r={data:e,id:this._nextId++,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(r,s)),this._dataByLinkId.set(r.id,r),r.id}let s=this._getEntryIdKey(e),r=this._entriesWithId.get(s);if(r)return this.addLineToLink(r.id,i.ybase+i.y),r.id;let n=i.addMarker(i.ybase+i.y),o={id:this._nextId++,key:this._getEntryIdKey(e),data:e,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(o,n)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,i){let s=this._dataByLinkId.get(e);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(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,i){let s=e.lines.indexOf(i);-1!==s&&(e.lines.splice(s,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};rA=S([b(0,I)],rA);var rO=!1,rN=class extends ep{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new ev),this._onBinary=this._register(new eO),this.onBinary=this._onBinary.event,this._onData=this._register(new eO),this.onData=this._onData.event,this._onLineFeed=this._register(new eO),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new eO),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new eO),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new eO),this._instantiationService=new sH,this.optionsService=this._register(new s0(e)),this._instantiationService.setService(K,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(sJ)),this._instantiationService.setService(I,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(sz)),this._instantiationService.setService($,this._logService),this.coreService=this._register(this._instantiationService.createInstance(s3)),this._instantiationService.setService(W,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(s9)),this._instantiationService.setService(H,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(rl)),this._instantiationService.setService(q,this.unicodeService),this._charsetService=this._instantiationService.createInstance(rc),this._instantiationService.setService(z,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(rA),this._instantiationService.setService(U,this._oscLinkService),this._inputHandler=this._register(new rR(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(eD.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(eD.forward(this._bufferService.onResize,this._onResize)),this._register(eD.forward(this.coreService.onData,this._onData)),this._register(eD.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new rT((e,i)=>this._inputHandler.parse(e,i))),this._register(eD.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new eO),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 i in e)this.optionsService.options[i]=e[i]}write(e,i){this._writeBuffer.write(e,i)}writeSync(e,i){this._logService.logLevel<=3&&!rO&&(this._logService.warn("writeSync is unreliable and will be removed soon."),rO=!0),this._writeBuffer.writeSync(e,i)}input(e,i=!0){this.coreService.triggerDataEvent(e,i)}resize(e,i){isNaN(e)||isNaN(i)||(e=Math.max(e,2),i=Math.max(i,1),this._bufferService.resize(e,i))}scroll(e,i=!1){this._bufferService.scroll(e,i)}scrollLines(e,i){this._bufferService.scrollLines(e,i)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}registerEscHandler(e,i){return this._inputHandler.registerEscHandler(e,i)}registerDcsHandler(e,i){return this._inputHandler.registerDcsHandler(e,i)}registerCsiHandler(e,i){return this._inputHandler.registerCsiHandler(e,i)}registerOscHandler(e,i){return this._inputHandler.registerOscHandler(e,i)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,i=this.optionsService.rawOptions.windowsPty;i&&void 0!==i.buildNumber&&void 0!==i.buildNumber?e="conpty"===i.backend&&i.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(rd.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(rd(this._bufferService),!1))),this._windowsWrappingHeuristics.value=eu(()=>{for(let i of e)i.dispose()})}}},rI={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:["'",'"']},rH=0,rW=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new sg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new sg,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),0===this._insertedValues.length&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,i)=>this._getKey(e)-this._getKey(i)),i=0,s=0,r=Array(this._array.length+this._insertedValues.length);for(let n=0;n<r.length;n++)s>=this._array.length||this._getKey(e[i])<=this._getKey(this._array[s])?(r[n]=e[i],i++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),0===this._array.length)return!1;let i=this._getKey(e);if(void 0===i||-1===(rH=this._search(i))||this._getKey(this._array[rH])!==i)return!1;do if(this._array[rH]===e)return 0===this._deletedIndices.length&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(rH),!0;while(++rH<this._array.length&&this._getKey(this._array[rH])===i)return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((e,i)=>e-i),i=0,s=Array(this._array.length-e.length),r=0;for(let n=0;n<this._array.length;n++)e[i]===n?i++:s[r++]=this._array[n];this._array=s,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((rH=this._search(e))<0||rH>=this._array.length)&&this._getKey(this._array[rH])===e)do yield this._array[rH];while(++rH<this._array.length&&this._getKey(this._array[rH])===e)}forEachByKey(e,i){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),0!==this._array.length&&!((rH=this._search(e))<0||rH>=this._array.length)&&this._getKey(this._array[rH])===e)do i(this._array[rH]);while(++rH<this._array.length&&this._getKey(this._array[rH])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let i=0,s=this._array.length-1;for(;s>=i;){let r=i+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n<e)i=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return i}},rz=0,rF=0,r$=class extends ep{constructor(){super(),this._decorations=new rW(e=>e?.marker.line),this._onDecorationRegistered=this._register(new eO),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new eO),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(eu(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let i=new rK(e);if(i){let e=i.marker.onDispose(()=>i.dispose()),s=i.onDispose(()=>{s.dispose(),i&&(this._decorations.delete(i)&&this._onDecorationRemoved.fire(i),e.dispose())});this._decorations.insert(i),this._onDecorationRegistered.fire(i)}return i}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,i,s){let r=0,n=0;for(let o of this._decorations.getKeyIterator(i))n=(r=o.options.x??0)+(o.options.width??1),e>=r&&e<n&&(!s||(o.options.layer??"bottom")===s)&&(yield o)}forEachDecorationAtCell(e,i,s,r){this._decorations.forEachByKey(i,i=>{rF=(rz=i.options.x??0)+(i.options.width??1),e>=rz&&e<rF&&(!s||(i.options.layer??"bottom")===s)&&r(i)})}},rK=class extends eg{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new eO),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new eO),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")}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=ri.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=ri.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},rU=class{constructor(e,i=1e3){this._renderCallback=e,this._debounceThresholdMS=i,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,i,s){this._rowCount=s,e=void 0!==e?e:0,i=void 0!==i?i:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,i):i;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,i=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},i)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;let e=Math.max(this._rowStart,0),i=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,i)}},rq=class extends ep{constructor(e,i,s,r){super(),this._terminal=e,this._coreBrowserService=s,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let n=this._coreBrowserService.mainDocument;this._accessibilityContainer=n.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=n.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let e=0;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=n.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new rU(this._renderRows.bind(this))),!this._terminal.element)throw Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
16
16
|
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(tW(n,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(eu(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let i=0;i<e;i++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
17
17
|
`&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=y)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,i){this._liveRegionDebouncer.refresh(e,i,this._terminal.rows)}_renderRows(e,i){let s=this._terminal.buffer,r=s.lines.length.toString();for(let n=e;n<=i;n++){let e=s.lines.get(s.ydisp+n),i=[],o=e?.translateToString(!0,void 0,void 0,i)||"",h=(s.ydisp+n+1).toString(),a=this._rowElements[n];a&&(0===o.length?(a.textContent=" ",this._rowColumns.set(a,[0,1])):(a.textContent=o,this._rowColumns.set(a,i)),a.setAttribute("aria-posinset",h),a.setAttribute("aria-setsize",r),this._alignRowWidth(a))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,i){let s,r,n=e.target,o=this._rowElements[0===i?1:this._rowElements.length-2];if(n.getAttribute("aria-posinset")!==(0===i?"1":`${this._terminal.buffer.lines.length}`)&&e.relatedTarget===o){if(0===i?(s=n,r=this._rowElements.pop(),this._rowContainer.removeChild(r)):(s=this._rowElements.shift(),r=n,this._rowContainer.removeChild(s)),s.removeEventListener("focus",this._topBoundaryFocusListener),r.removeEventListener("focus",this._bottomBoundaryFocusListener),0===i){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===i?-1:1),this._rowElements[0===i?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}}_handleSelectionChange(){if(0===this._rowElements.length)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let i={node:e.anchorNode,offset:e.anchorOffset},s={node:e.focusNode,offset:e.focusOffset};if((i.node.compareDocumentPosition(s.node)&Node.DOCUMENT_POSITION_PRECEDING||i.node===s.node&&i.offset>s.offset)&&([i,s]=[s,i]),i.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(i={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(i.node))return;let r=this._rowElements.slice(-1)[0];if(s.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(s={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(s.node))return;let n=({node:e,offset:i})=>{let s=e instanceof Text?e.parentNode:e,r=parseInt(s?.getAttribute("aria-posinset"),10)-1;if(isNaN(r))return console.warn("row is invalid. Race condition?"),null;let n=this._rowColumns.get(s);if(!n)return console.warn("columns is null. Race condition?"),null;let o=i<n.length?n[i]:n.slice(-1)[0]+1;return o>=this._terminal.cols&&(++r,o=0),{row:r,column:o}},o=n(i),h=n(s);if(!(!o||!h)){if(o.row>h.row||o.row===h.row&&o.column>=h.column)throw Error("invalid range");this._terminal.select(o.column,o.row,(h.row-o.row)*this._terminal.cols-o.column+h.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform="";let i=e.getBoundingClientRect().width,s=this._rowColumns.get(e)?.slice(-1)?.[0];if(!s)return;let r=s*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/i})`}};rq=S([b(1,F),b(2,X),b(3,J)],rq);var rV=class extends ep{constructor(e,i,s,r,n){super(),this._element=e,this._mouseService=i,this._renderService=s,this._bufferService=r,this._linkProviderService=n,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new eO),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new eO),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(eu(()=>{e_(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(tW(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(tW(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(tW(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(tW(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let i=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!i)return;this._isMouseOut=!1;let s=e.composedPath();for(let e=0;e<s.length;e++){let i=s[e];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}this._lastBufferCell&&i.x===this._lastBufferCell.x&&i.y===this._lastBufferCell.y||(this._handleHover(i),this._lastBufferCell=i)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,i){this._activeProviderReplies&&i||(this._activeProviderReplies?.forEach(e=>{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let s=!1;for(let[r,n]of this._linkProviderService.linkProviders.entries())i?this._activeProviderReplies?.get(r)&&(s=this._checkLinkProviderResult(r,e,s)):n.provideLinks(e.y,i=>{if(this._isMouseOut)return;let n=i?.map(e=>({link:e}));this._activeProviderReplies?.set(r,n),s=this._checkLinkProviderResult(r,e,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,i){let s=new Set;for(let r=0;r<i.size;r++){let n=i.get(r);if(n)for(let i=0;i<n.length;i++){let r=n[i],o=r.link.range.start.y<e?0:r.link.range.start.x,h=r.link.range.end.y>e?this._bufferService.cols:r.link.range.end.x;for(let e=o;e<=h;e++){if(s.has(e)){n.splice(i--,1);break}s.add(e)}}}}_checkLinkProviderResult(e,i,s){if(!this._activeProviderReplies)return s;let r=this._activeProviderReplies.get(e),n=!1;for(let i=0;i<e;i++)(!this._activeProviderReplies.has(i)||this._activeProviderReplies.get(i))&&(n=!0);if(!n&&r){let e=r.find(e=>this._linkAtPosition(e.link,i));e&&(s=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let e=0;e<this._activeProviderReplies.size;e++){let r=this._activeProviderReplies.get(e)?.find(e=>this._linkAtPosition(e.link,i));if(r){s=!0,this._handleNewLink(r);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){var i,s;if(!this._currentLink)return;let r=this._positionFromMouseEvent(e,this._element,this._mouseService);r&&this._mouseDownLink&&(i=this._mouseDownLink.link,s=this._currentLink.link,i.text===s.text&&i.range.start.x===s.range.start.x&&i.range.start.y===s.range.start.y&&i.range.end.x===s.range.end.x&&i.range.end.y===s.range.end.y)&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,i){this._currentLink&&this._lastMouseEvent&&(!e||!i||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=i)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,e_(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let i=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);i&&this._linkAtPosition(e.link,i)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:i=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==i&&(this._currentLink.state.decorations.underline=i,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,i))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let i=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,i,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),i.hover&&i.hover(s,i.text)}_fireUnderlineEvent(e,i){let s=e.range,r=this._bufferService.buffer.ydisp,n=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-r-1,s.end.x,s.end.y-r-1,void 0);(i?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(n)}_linkLeave(e,i,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(i,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),i.leave&&i.leave(s,i.text)}_linkAtPosition(e,i){let s=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,n=i.y*this._bufferService.cols+i.x;return s<=n&&n<=r}_positionFromMouseEvent(e,i,s){let r=s.getCoords(e,i,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,i,s,r,n){return{x1:e,y1:i,x2:s,y2:r,cols:this._bufferService.cols,fg:n}}};rV=S([b(1,G),b(2,J),b(3,I),b(4,et)],rV);var rj=class extends rN{constructor(e={}){super(e),this._linkifier=this._register(new ev),this.browser=i4,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new ev),this._onCursorMove=this._register(new eO),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new eO),this.onKey=this._onKey.event,this._onRender=this._register(new eO),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new eO),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new eO),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new eO),this.onBell=this._onBell.event,this._onFocus=this._register(new eO),this._onBlur=this._register(new eO),this._onA11yCharEmitter=this._register(new eO),this._onA11yTabEmitter=this._register(new eO),this._onWillOpen=this._register(new eO),this._setup(),this._decorationService=this._instantiationService.createInstance(r$),this._instantiationService.setService(V,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(i2),this._instantiationService.setService(et,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(j)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(eD.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(eD.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(eD.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(eD.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(eu(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let i of e){let e,s="";switch(i.index){case 256:e="foreground",s="10";break;case 257:e="background",s="11";break;case 258:e="cursor",s="12";break;default:e="ansi",s="4;"+i.index}switch(i.type){case 0:let r=rt.toColorRGB("ansi"===e?this._themeService.colors.ansi[i.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${iv.ESC}]${s};${function(e,i=16){let[s,r,n]=e;return`rgb:${rE(s,i)}/${rE(r,i)}/${rE(n,i)}`}(r)}${iS.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[i.index]=ib.toColor(...i.color));else{let s=e;this._themeService.modifyColors(e=>e[s]=ib.toColor(...i.color))}break;case 2:this._themeService.restoreColor(i.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(rq,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iv.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(iv.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,i=this.buffer.lines.get(e);if(!i)return;let s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=i.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,h=this.buffer.y*this._renderService.dimensions.css.cell.height,a=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=h+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(tW(this.element,"copy",e=>{var i;this.hasSelection()&&(i=this._selectionService,e.clipboardData&&e.clipboardData.setData("text/plain",i.selectionText),e.preventDefault())}));let e=e=>{var i,s,r;return i=this.textarea,s=this.coreService,r=this.optionsService,void(e.stopPropagation(),e.clipboardData&&C(e.clipboardData.getData("text/plain"),i,s,r))};this._register(tW(this.textarea,"paste",e)),this._register(tW(this.element,"paste",e)),si?this._register(tW(this.element,"mousedown",e=>{2===e.button&&k(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(tW(this.element,"contextmenu",e=>{k(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),sc&&this._register(tW(this.element,"auxclick",e=>{1===e.button&&x(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(tW(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(tW(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(tW(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(tW(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(tW(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(tW(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(tW(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let i=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),i.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(tW(this.screenElement,"mousemove",e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),i.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",w),sd||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(i0,this.textarea,e.ownerDocument.defaultView??window,this._document??"u">typeof window?window.document:null)),this._instantiationService.setService(X,this._coreBrowserService),this._register(tW(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this._register(tW(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(iG,this._document,this._helperContainer),this._instantiationService.setService(Y,this._charSizeService),this._themeService=this._instantiationService.createInstance(sO),this._instantiationService.setService(ee,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(iN),this._instantiationService.setService(Q,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sv,this.rows,this.screenElement)),this._instantiationService.setService(J,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(ic,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(i3),this._instantiationService.setService(G,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(rV,this.screenElement));this.element.appendChild(i);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(ii,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(sB,this.element,this.screenElement,r)),this._instantiationService.setService(Z,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(eD.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(is,this.screenElement)),this._register(tW(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(rq,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(il,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(il,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(iX,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,i=this.element;function s(i){let s,r,n=e._mouseService.getMouseReportCoords(i,e.screenElement);if(!n)return!1;switch(i.overrideType||i.type){case"mousemove":r=32,void 0===i.buttons?(s=3,void 0!==i.button&&(s=i.button<3?i.button:3)):s=1&i.buttons?0:4&i.buttons?1:2&i.buttons?2:3;break;case"mouseup":r=0,s=i.button<3?i.button:3;break;case"mousedown":r=1,s=i.button<3?i.button:3;break;case"wheel":if(e._customWheelEventHandler&&!1===e._customWheelEventHandler(i))return!1;let o=i.deltaY;if(0===o||0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return!1;r=o<0?0:1,s=4;break;default:return!1}return void 0!==r&&void 0!==s&&!(s>4)&&e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:s,action:r,ctrl:i.ctrlKey,alt:i.altKey,shift:i.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n=e=>(s(e),e.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(e)),o=e=>(s(e),this.cancel(e,!0)),h=e=>{e.buttons&&s(e)},a=e=>{e.buttons||s(e)};this._register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?r.mousemove||(i.addEventListener("mousemove",a),r.mousemove=a):(i.removeEventListener("mousemove",r.mousemove),r.mousemove=null),16&e?r.wheel||(i.addEventListener("wheel",o,{passive:!1}),r.wheel=o):(i.removeEventListener("wheel",r.wheel),r.wheel=null),2&e?r.mouseup||(r.mouseup=n):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),4&e?r.mousedrag||(r.mousedrag=h):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(tW(i,"mousedown",e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return s(e),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(e)})),this._register(tW(i,"wheel",i=>{if(!r.wheel){if(this._customWheelEventHandler&&!1===this._customWheelEventHandler(i))return!1;if(!this.buffer.hasScrollback){if(0===i.deltaY)return!1;if(0===e.coreMouseService.consumeWheelEvent(i,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr))return this.cancel(i,!0);let s=iv.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(i.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(s,!0),this.cancel(i,!0)}}},{passive:!1}))}refresh(e,i){this._renderService?.refreshRows(e,i)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,i){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,i),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let i=e-this._bufferService.buffer.ydisp;0!==i&&this.scrollLines(i)}paste(e){C(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");let i=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),i}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(e,i,s){this._selectionService.setSelection(e,i,s)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,i){this._selectionService?.selectLines(e,i)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;let i=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!i&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;i||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);let s=function(e,i,s,r){let n={type:0,cancel:!1,key:void 0},o=!!e.shiftKey|2*!!e.altKey|4*!!e.ctrlKey|8*!!e.metaKey;switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?i?n.key=iv.ESC+"OA":n.key=iv.ESC+"[A":"UIKeyInputLeftArrow"===e.key?i?n.key=iv.ESC+"OD":n.key=iv.ESC+"[D":"UIKeyInputRightArrow"===e.key?i?n.key=iv.ESC+"OC":n.key=iv.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(i?n.key=iv.ESC+"OB":n.key=iv.ESC+"[B");break;case 8:n.key=e.ctrlKey?"\b":iv.DEL,e.altKey&&(n.key=iv.ESC+n.key);break;case 9:if(e.shiftKey){n.key=iv.ESC+"[Z";break}n.key=iv.HT,n.cancel=!0;break;case 13:n.key=e.altKey?iv.ESC+iv.CR:iv.CR,n.cancel=!0;break;case 27:n.key=iv.ESC,e.altKey&&(n.key=iv.ESC+iv.ESC),n.cancel=!0;break;case 37:if(e.metaKey)break;o?n.key=iv.ESC+"[1;"+(o+1)+"D":i?n.key=iv.ESC+"OD":n.key=iv.ESC+"[D";break;case 39:if(e.metaKey)break;o?n.key=iv.ESC+"[1;"+(o+1)+"C":i?n.key=iv.ESC+"OC":n.key=iv.ESC+"[C";break;case 38:if(e.metaKey)break;o?n.key=iv.ESC+"[1;"+(o+1)+"A":i?n.key=iv.ESC+"OA":n.key=iv.ESC+"[A";break;case 40:if(e.metaKey)break;o?n.key=iv.ESC+"[1;"+(o+1)+"B":i?n.key=iv.ESC+"OB":n.key=iv.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(n.key=iv.ESC+"[2~");break;case 46:o?n.key=iv.ESC+"[3;"+(o+1)+"~":n.key=iv.ESC+"[3~";break;case 36:o?n.key=iv.ESC+"[1;"+(o+1)+"H":i?n.key=iv.ESC+"OH":n.key=iv.ESC+"[H";break;case 35:o?n.key=iv.ESC+"[1;"+(o+1)+"F":i?n.key=iv.ESC+"OF":n.key=iv.ESC+"[F";break;case 33:e.shiftKey?n.type=2:e.ctrlKey?n.key=iv.ESC+"[5;"+(o+1)+"~":n.key=iv.ESC+"[5~";break;case 34:e.shiftKey?n.type=3:e.ctrlKey?n.key=iv.ESC+"[6;"+(o+1)+"~":n.key=iv.ESC+"[6~";break;case 112:o?n.key=iv.ESC+"[1;"+(o+1)+"P":n.key=iv.ESC+"OP";break;case 113:o?n.key=iv.ESC+"[1;"+(o+1)+"Q":n.key=iv.ESC+"OQ";break;case 114:o?n.key=iv.ESC+"[1;"+(o+1)+"R":n.key=iv.ESC+"OR";break;case 115:o?n.key=iv.ESC+"[1;"+(o+1)+"S":n.key=iv.ESC+"OS";break;case 116:o?n.key=iv.ESC+"[15;"+(o+1)+"~":n.key=iv.ESC+"[15~";break;case 117:o?n.key=iv.ESC+"[17;"+(o+1)+"~":n.key=iv.ESC+"[17~";break;case 118:o?n.key=iv.ESC+"[18;"+(o+1)+"~":n.key=iv.ESC+"[18~";break;case 119:o?n.key=iv.ESC+"[19;"+(o+1)+"~":n.key=iv.ESC+"[19~";break;case 120:o?n.key=iv.ESC+"[20;"+(o+1)+"~":n.key=iv.ESC+"[20~";break;case 121:o?n.key=iv.ESC+"[21;"+(o+1)+"~":n.key=iv.ESC+"[21~";break;case 122:o?n.key=iv.ESC+"[23;"+(o+1)+"~":n.key=iv.ESC+"[23~";break;case 123:o?n.key=iv.ESC+"[24;"+(o+1)+"~":n.key=iv.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if((!s||r)&&e.altKey&&!e.metaKey){let i=rI[e.keyCode]?.[+!!e.shiftKey];if(i)n.key=iv.ESC+i;else if(e.keyCode>=65&&e.keyCode<=90){let i=String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32);e.shiftKey&&(i=i.toUpperCase()),n.key=iv.ESC+i}else if(32===e.keyCode)n.key=iv.ESC+(e.ctrlKey?iv.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let i=e.code.slice(3,4);e.shiftKey||(i=i.toLowerCase()),n.key=iv.ESC+i,n.cancel=!0}}else!s||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?!e.key||e.ctrlKey||e.altKey||e.metaKey||!(e.keyCode>=48)||1!==e.key.length?e.key&&e.ctrlKey&&("_"===e.key&&(n.key=iv.US),"@"===e.key&&(n.key=iv.NUL)):n.key=e.key:65===e.keyCode&&(n.type=1);else e.keyCode>=65&&e.keyCode<=90?n.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?n.key=iv.NUL:e.keyCode>=51&&e.keyCode<=55?n.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?n.key=iv.DEL:219===e.keyCode?n.key=iv.ESC:220===e.keyCode?n.key=iv.FS:221===e.keyCode&&(n.key=iv.GS)}return n}(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===s.type||2===s.type){let i=this.rows-1;return this.scrollLines(2===s.type?-i:i),this.cancel(e,!0)}return 1===s.type&&this.selectAll(),!!(this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&90>=e.key.charCodeAt(0))||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):((s.key===iv.ETX||s.key===iv.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)?this.cancel(e,!0):void(this._keyDownHandled=!0))}_isThirdLevelShift(e,i){let s=e.isMac&&!this.options.macOptionIsMeta&&i.altKey&&!i.ctrlKey&&!i.metaKey||e.isWindows&&i.altKey&&i.ctrlKey&&!i.metaKey||e.isWindows&&i.getModifierState("AltGraph");return"keypress"===i.type?s:s&&(!i.keyCode||i.keyCode>47)}_keyUp(e){var i;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(i=e).keyCode||17===i.keyCode||18===i.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let i;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)i=e.charCode;else if(null===e.which||void 0===e.which)i=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;i=e.which}return!!i&&(!e.altKey&&!e.ctrlKey&&!e.metaKey||!!this._isThirdLevelShift(this.browser,e))&&(i=String.fromCharCode(i),this._onKey.fire({key:i,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(i,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let i=e.data;return this.coreService.triggerDataEvent(i,!0),this.cancel(e),!0}return!1}resize(e,i){if(e===this.cols&&i===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,i)}_afterResize(e,i){this._charSizeService?.measure()}clear(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.clearAllMarkers(),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 e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(s$));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(iv.ESC+"[I"):this.coreService.triggerDataEvent(iv.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let i=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${iv.ESC}[4;${s};${i}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${iv.ESC}[6;${n};${r}t`)}}cancel(e,i){if(!(!this.options.cancelEvents&&!i))return e.preventDefault(),e.stopPropagation(),!1}},rY=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,i){let s={instance:i,dispose:i.dispose,isDisposed:!1};this._addons.push(s),i.dispose=()=>this._wrappedAddonDispose(s),i.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let i=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){i=s;break}if(-1===i)throw Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(i,1)}},rX=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,i){if(!(e<0||e>=this._line.length))return i?(this._line.loadCell(e,i),i):this._line.loadCell(e,new P)}translateToString(e,i,s){return this._line.translateToString(e,i,s)}},rG=class{constructor(e,i){this._buffer=e,this.type=i}init(e){return this._buffer=e,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(e){let i=this._buffer.lines.get(e);if(i)return new rX(i)}getNullCell(){return new P}},rJ=class extends ep{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new eO),this.onBufferChange=this._onBufferChange.event,this._normal=new rG(this._core.buffers.normal,"normal"),this._alternate=new rG(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 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)}},rZ=class{constructor(e){this._core=e}registerCsiHandler(e,i){return this._core.registerCsiHandler(e,e=>i(e.toArray()))}addCsiHandler(e,i){return this.registerCsiHandler(e,i)}registerDcsHandler(e,i){return this._core.registerDcsHandler(e,(e,s)=>i(e,s.toArray()))}addDcsHandler(e,i){return this.registerDcsHandler(e,i)}registerEscHandler(e,i){return this._core.registerEscHandler(e,i)}addEscHandler(e,i){return this.registerEscHandler(e,i)}registerOscHandler(e,i){return this._core.registerOscHandler(e,i)}addOscHandler(e,i){return this.registerOscHandler(e,i)}},rQ=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},r0=["cols","rows"],r1=0,r2=class extends ep{constructor(e){super(),this._core=this._register(new rj(e)),this._addonManager=this._register(new rY),this._publicOptions={...this._core.options};let i=e=>this._core.options[e],s=(e,i)=>{this._checkReadonlyOptions(e),this._core.options[e]=i};for(let e in this._core.options){let r={get:i.bind(this,e),set:s.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(r0.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw 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 rZ(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new rQ(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 rJ(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let i in e)this._publicOptions[i]=e[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,i=!0){this._core.input(e,i)}resize(e,i){this._verifyIntegers(e,i),this._core.resize(e,i)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,i,s){this._verifyIntegers(e,i,s),this._core.select(e,i,s)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,i){this._verifyIntegers(e,i),this._core.selectLines(e,i)}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,i){this._core.write(e,i)}writeln(e,i){this._core.write(e),this._core.write(`\r
|
|
18
|
-
`,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return w},set promptLabel(t){w=t},get tooMuchOutput(){return y},set tooMuchOutput(t){y=t}}}_verifyIntegers(...e){for(r1 of e)if(r1===1/0||isNaN(r1)||r1%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(r1 of e)if(r1&&(r1===1/0||isNaN(r1)||r1%1!=0||r1<0))throw Error("This API only accepts positive integers")}},r5=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),h={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},a=h.top+h.bottom;return{cols:Math.max(2,Math.floor((n-(h.right+h.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((r-a)/e.css.cell.height))}}},r3=e.i(41996);let r6={ArrowUp:"\x1b[A",ArrowDown:"\x1b[B",ArrowRight:"\x1b[C",ArrowLeft:"\x1b[D",Escape:"\x1b",Tab:" ",Enter:"\r",Backspace:"",Delete:"\x1b[3~",Home:"\x1b[H",End:"\x1b[F",PageUp:"\x1b[5~",PageDown:"\x1b[6~",Insert:"\x1b[2~",F1:"\x1bOP",F2:"\x1bOQ",F3:"\x1bOR",F4:"\x1bOS",F5:"\x1b[15~",F6:"\x1b[17~",F7:"\x1b[18~",F8:"\x1b[19~",F9:"\x1b[20~",F10:"\x1b[21~",F11:"\x1b[23~",F12:"\x1b[24~"},r4={ArrowUp:"\x1b[1;5A",ArrowDown:"\x1b[1;5B",ArrowRight:"\x1b[1;5C",ArrowLeft:"\x1b[1;5D"},r8={cursorBlink:!0,fontSize:14,fontSizeMobile:12,fontFamily:'"SF Mono", "Cascadia Code", Menlo, Monaco, "Courier New", monospace',scrollback:1e4,convertEol:!0,allowProposedApi:!0,scrollOnUserInput:!0,fastScrollModifier:"none",smoothScrollDuration:0},r7=[{label:"Esc",key:"Escape"},{label:"↑",key:"ArrowUp",icon:!0},{label:"↓",key:"ArrowDown",icon:!0},{label:"^C",key:"c",ctrl:!0},{label:"Ctrl",key:"Ctrl",modifier:!0},{label:"Opt",key:"Alt",modifier:!0},{label:"Shift",key:"Shift",modifier:!0},{label:"Tab",key:"Tab"}],r9=[{label:"←",key:"ArrowLeft",icon:!0},{label:"→",key:"ArrowRight",icon:!0},{label:"Home",key:"Home"},{label:"End",key:"End"},{label:"PgUp",key:"PageUp"},{label:"PgDn",key:"PageDown"},{label:"^Z",key:"z",ctrl:!0},{label:"^R",key:"r",ctrl:!0},{label:"^L",key:"l",ctrl:!0},{label:"^A",key:"a",ctrl:!0},{label:"^E",key:"e",ctrl:!0},{label:"^W",key:"w",ctrl:!0},{label:"F1",key:"F1"},{label:"F2",key:"F2"},{label:"F3",key:"F3"},{label:"F4",key:"F4"},{label:"F5",key:"F5"},{label:"F10",key:"F10"}],ne="bg-gradient-to-br from-orange-500 to-orange-600 active:from-orange-400 active:to-orange-500 text-white shadow-md ring-1 ring-orange-400",nt={width:"32px",height:"32px"},ni=({socket:e,sessionId:i,onExpandChange:s,onRefocus:r})=>{let[n,o]=(0,g.useState)(!1),[h,a]=(0,g.useState)(!1),[l,c]=(0,g.useState)(""),[d,_]=(0,g.useState)(!1),u=(0,g.useRef)(null);(0,g.useMemo)(()=>navigator.platform.toUpperCase().indexOf("MAC")>=0?"macos":"linux",[]);let[p,v]=(0,g.useState)(!1),[m,S]=(0,g.useState)(!1),[b,w]=(0,g.useState)(!1),[y,C]=(0,g.useState)(!1),x=(0,g.useCallback)((e,i={})=>{let s=i.ctrl||p,r=i.alt||b,n=i.shift||y;i.meta;let o="";if(s&&1===e.length){let i=e.toUpperCase().charCodeAt(0);o=i>=65&&i<=90?String.fromCharCode(i-64):"["===e?"\x1b":"]"===e?"\x1d":"\\"===e?"\x1c":"@"===e?"\0":"?"===e?"":e}else o=r?r6[e]?"\x1b"+r6[e]:1===e.length?"\x1b"+e:r6[e]||e:s&&r6[e]?e.startsWith("Arrow")?r4[e]||r6[e]:"Home"===e?"\x1b[1;5H":"End"===e?"\x1b[1;5F":r6[e]:n&&r6[e]?"Tab"===e?"\x1b[Z":e.startsWith("Arrow")&&({ArrowUp:"\x1b[1;2A",ArrowDown:"\x1b[1;2B",ArrowRight:"\x1b[1;2C",ArrowLeft:"\x1b[1;2D"})[e]||r6[e]:n&&1===e.length?e.toUpperCase():r6[e]||e;return o},[p,b,y,m]);if((0,g.useEffect)(()=>{let e=()=>{_(window.innerWidth<768||"ontouchstart"in window||navigator.maxTouchPoints>0)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,g.useEffect)(()=>{if(!d||!e||!i||!(p||m||b||y))return;let s=s=>{if(!p&&!m&&!b&&!y||["Control","Alt","Shift","Meta"].includes(s.key))return;s.preventDefault(),s.stopPropagation();let r=s.key;"Backspace"===r?r="Backspace":"Enter"===r?r="Enter":"Tab"===r?r="Tab":"Escape"===r?r="Escape":"Delete"===r?r="Delete":r.startsWith("Arrow")?r=s.key:r.startsWith("F")&&r.length<=3&&(r=s.key);let n=x(r,{ctrl:p,alt:b,shift:y,meta:m});e.emit("input",{sessionId:i,data:n}),v(!1),S(!1),w(!1),C(!1)};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[d,e,i,p,m,b,y,x]),!d||!e||!i)return null;let k=(s,r={})=>{let n=x(s,r);e.emit("input",{sessionId:i,data:n}),"Ctrl"!==s&&"Meta"!==s&&"Alt"!==s&&"Shift"!==s&&(v(!1),S(!1),w(!1),C(!1))},E=()=>{l.trim()&&e&&i&&(e.emit("input",{sessionId:i,data:l}),c(""),a(!1),s&&setTimeout(()=>s(!1),320),r&&setTimeout(()=>r(),350))},B=[...r7],D="flex items-center justify-center rounded-md font-semibold text-[11px] transition-all duration-100 shadow-sm",M=`${D} bg-gradient-to-br from-slate-700 to-slate-800 hover:from-slate-600 hover:to-slate-700 active:from-slate-500 active:to-slate-600 text-white border border-slate-600`,R=`${D} bg-gradient-to-br from-slate-700 to-slate-800 hover:from-slate-600 hover:to-slate-700 active:from-slate-500 active:to-slate-600 text-white text-sm border border-slate-600`;return(0,f.jsxs)("div",{className:"flex flex-col",children:[(0,f.jsx)("div",{className:`bg-gradient-to-b from-slate-900 to-slate-950 border-t border-slate-700 transition-all duration-300 overflow-hidden ${n?"max-h-32 opacity-100":"max-h-0 opacity-0"}`,children:(0,f.jsx)("div",{className:"p-2 overflow-y-auto max-h-32",children:(0,f.jsx)("div",{className:"grid grid-cols-6 gap-1 max-w-2xl mx-auto",children:r9.map((e,i)=>(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>k(e.key,{ctrl:e.ctrl}),className:`${M} ${e.ctrl?"text-orange-300":""}`,style:{minHeight:"28px"},children:e.label},i))})})}),(0,f.jsx)("div",{className:`bg-gradient-to-b from-slate-900 to-slate-950 border-t border-slate-700 transition-all duration-300 overflow-hidden ${h?"max-h-16 opacity-100":"max-h-0 opacity-0"}`,children:(0,f.jsxs)("div",{className:"p-2 flex gap-2 items-center",children:[(0,f.jsxs)("div",{className:"flex-1 relative",children:[(0,f.jsx)("input",{ref:u,type:"text",value:l,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&E(),placeholder:"Type command and send...",className:"w-full px-3 py-2 pr-8 bg-slate-700 border border-slate-600 rounded-lg text-white text-base placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),l&&(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{c(""),u.current?.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 w-5 h-5 flex items-center justify-center text-slate-400 hover:text-white transition",children:"×"})]}),(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:E,disabled:!l.trim(),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-slate-600 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition",children:"Send"})]})}),(0,f.jsx)("div",{className:"bg-gradient-to-t from-slate-900 via-slate-900 to-slate-800 border-t-2 border-slate-700 px-1.5 py-2 safe-area-bottom",children:(0,f.jsxs)("div",{className:"flex items-center justify-between gap-0.5 max-w-4xl mx-auto",children:[(0,f.jsx)("div",{className:"flex gap-0.5",children:(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>k("Escape"),className:M,style:nt,children:"Esc"})}),(0,f.jsx)("div",{className:"flex gap-0.5",children:B.slice(1,3).map(e=>(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>k(e.key),className:R,style:nt,children:e.label},e.key))}),(0,f.jsx)("div",{className:"flex gap-0.5 justify-center flex-wrap",children:B.slice(3).map(e=>{var i;let s,r=!0===e.modifier,n=!0===e.ctrl,o=r?(i=e.key,s=!1,("Ctrl"===i?s=p:"Meta"===i?s=m:"Alt"===i||"Opt"===i?s=b:"Shift"===i&&(s=y),s)?`${D} ${ne}`:M):M;return(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{if(r){var i;"Ctrl"===(i=e.key)?v(!p):"Meta"===i?S(!m):"Alt"===i||"Opt"===i?w(!b):"Shift"===i&&C(!y)}else n?k(e.key,{ctrl:!0}):k(e.key)},className:`${o} ${n?"text-orange-300":""}`,style:nt,children:e.label},e.key+e.label)})}),(0,f.jsxs)("div",{className:"flex gap-0.5 justify-center flex-wrap",children:[(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{let e=!h;a(e),o(!1),s&&setTimeout(()=>s(e),320),e?setTimeout(()=>u.current?.focus(),350):r&&setTimeout(()=>r(),350)},className:`${h?`${D} ${ne}`:M} flex-shrink-0`,style:nt,children:"Aa"}),(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{let e=!n;o(e),a(!1),e&&document.activeElement?.blur(),s&&setTimeout(()=>s(e),320)},className:`${M} flex-shrink-0`,style:nt,children:(0,f.jsx)("span",{className:`transition-transform duration-300 inline-block ${n?"rotate-180":""}`,children:n?"×":"⋯"})})]})]})})]})},ns={dracula:{background:"#282a36",foreground:"#f8f8f2",cursor:"#f8f8f2",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"},monokai:{background:"#272822",foreground:"#f8f8f2",cursor:"#f8f8f0",black:"#272822",red:"#f92672",green:"#a6e22e",yellow:"#f4bf75",blue:"#66d9ef",magenta:"#ae81ff",cyan:"#a1efe4",white:"#f8f8f2",brightBlack:"#75715e",brightRed:"#f92672",brightGreen:"#a6e22e",brightYellow:"#f4bf75",brightBlue:"#66d9ef",brightMagenta:"#ae81ff",brightCyan:"#a1efe4",brightWhite:"#f9f8f5"},cobalt2:{background:"#193549",foreground:"#ffffff",cursor:"#f0cc09",black:"#000000",red:"#ff0000",green:"#38de21",yellow:"#ffe50a",blue:"#1460d2",magenta:"#ff005d",cyan:"#00bbbb",white:"#bbbbbb",brightBlack:"#555555",brightRed:"#f40e17",brightGreen:"#3bd01d",brightYellow:"#edc809",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#6ae3fa",brightWhite:"#ffffff"},gruvboxDark:{background:"#282828",foreground:"#ebdbb2",cursor:"#ebdbb2",black:"#282828",red:"#cc241d",green:"#98971a",yellow:"#d79921",blue:"#458588",magenta:"#b16286",cyan:"#689d6a",white:"#a89984",brightBlack:"#928374",brightRed:"#fb4934",brightGreen:"#b8bb26",brightYellow:"#fabd2f",brightBlue:"#83a598",brightMagenta:"#d3869b",brightCyan:"#8ec07c",brightWhite:"#ebdbb2"},solarizedLight:{background:"#fdf6e3",foreground:"#657b83",cursor:"#657b83",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"},githubLight:{background:"#ffffff",foreground:"#24292f",cursor:"#0969da",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#4d2d00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"}};function nr({socket:e,connected:i,sessionId:s,isActive:r=!0,theme:n="dracula",onThemeChange:o,onBack:h,onOpenRemote:a,onSelectSite:l,tunnelUrl:c,apiKey:d}){let _=(0,g.useRef)(null),u=(0,g.useRef)(null),p=(0,g.useRef)(null),v=(0,g.useRef)(null),m=(0,g.useRef)(null),[S,b]=(0,g.useState)(!1),[w,y]=(0,g.useState)(""),[C,x]=(0,g.useState)(!1),k=(0,g.useCallback)(()=>{p.current&&u.current&&e&&(p.current.fit(),e.emit("resize",{sessionId:s,cols:u.current.cols,rows:u.current.rows}))},[e,s]);return(0,g.useEffect)(()=>{if(!_.current||!e||!s||u.current)return;let i=new r2({...r8,fontSize:window.innerWidth<768?r8.fontSizeMobile:r8.fontSize,fontFamily:r8.fontFamily,theme:ns[n]||ns.dracula}),r=new r5;i.loadAddon(r),u.current=i,p.current=r,i.open(_.current),setTimeout(()=>r.fit(),100);let o=_.current,h=0,a=0,l=0,c=null,d=0,f=e=>{1===e.touches.length&&(c&&(cancelAnimationFrame(c),c=null),h=e.touches[0].clientY,d=performance.now(),a=0,l=0)},g=e=>{if(1===e.touches.length){let s=e.touches[0].clientY,r=performance.now(),n=h-s,o=r-d;o>0&&(a=.7*a+n/o*.3),h=s,d=r;let c=Math.trunc(l+=n/16);0!==c&&(i.scrollLines(c),l-=c)}},S=()=>{let e=()=>{if(.005>Math.abs(a)){c=null,a=0,l=0;return}let s=Math.trunc(l+=16*a/16);0!==s&&(i.scrollLines(s),l-=s),a*=.92,c=requestAnimationFrame(e)};Math.abs(a)>.005&&(c=requestAnimationFrame(e))};o.addEventListener("touchstart",f,{passive:!0}),o.addEventListener("touchmove",g,{passive:!0}),o.addEventListener("touchend",S,{passive:!0});let w=new ResizeObserver(()=>{k(),setTimeout(()=>u.current?.scrollToBottom(),500)});w.observe(o),e.emit("joinSession",s,e=>{e.success?(b(!0),y(e.name)):i.write(`\r
|
|
18
|
+
`,i)}paste(e){this._core.paste(e)}refresh(e,i){this._verifyIntegers(e,i),this._core.refresh(e,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return w},set promptLabel(t){w=t},get tooMuchOutput(){return y},set tooMuchOutput(t){y=t}}}_verifyIntegers(...e){for(r1 of e)if(r1===1/0||isNaN(r1)||r1%1!=0)throw Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(r1 of e)if(r1&&(r1===1/0||isNaN(r1)||r1%1!=0||r1<0))throw Error("This API only accepts positive integers")}},r5=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let i=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(i._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(0===e.css.cell.width||0===e.css.cell.height)return;let i=0===this._terminal.options.scrollback?0:this._terminal.options.overviewRuler?.width||14,s=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(s.getPropertyValue("height")),n=Math.max(0,parseInt(s.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),h={top:parseInt(o.getPropertyValue("padding-top")),bottom:parseInt(o.getPropertyValue("padding-bottom")),right:parseInt(o.getPropertyValue("padding-right")),left:parseInt(o.getPropertyValue("padding-left"))},a=h.top+h.bottom;return{cols:Math.max(2,Math.floor((n-(h.right+h.left)-i)/e.css.cell.width)),rows:Math.max(1,Math.floor((r-a)/e.css.cell.height))}}},r3=e.i(41996);let r6={ArrowUp:"\x1b[A",ArrowDown:"\x1b[B",ArrowRight:"\x1b[C",ArrowLeft:"\x1b[D",Escape:"\x1b",Tab:" ",Enter:"\r",Backspace:"",Delete:"\x1b[3~",Home:"\x1b[H",End:"\x1b[F",PageUp:"\x1b[5~",PageDown:"\x1b[6~",Insert:"\x1b[2~",F1:"\x1bOP",F2:"\x1bOQ",F3:"\x1bOR",F4:"\x1bOS",F5:"\x1b[15~",F6:"\x1b[17~",F7:"\x1b[18~",F8:"\x1b[19~",F9:"\x1b[20~",F10:"\x1b[21~",F11:"\x1b[23~",F12:"\x1b[24~"},r4={ArrowUp:"\x1b[1;5A",ArrowDown:"\x1b[1;5B",ArrowRight:"\x1b[1;5C",ArrowLeft:"\x1b[1;5D"},r8={cursorBlink:!0,fontSize:14,fontSizeMobile:12,fontFamily:'"SF Mono", "Cascadia Code", Menlo, Monaco, "Courier New", monospace',scrollback:1e4,convertEol:!0,allowProposedApi:!0,scrollOnUserInput:!0,fastScrollModifier:"none",smoothScrollDuration:0},r7=[{label:"Esc",key:"Escape"},{label:"↑",key:"ArrowUp",icon:!0},{label:"↓",key:"ArrowDown",icon:!0},{label:"^C",key:"c",ctrl:!0},{label:"Ctrl",key:"Ctrl",modifier:!0},{label:"Opt",key:"Alt",modifier:!0},{label:"Shift",key:"Shift",modifier:!0},{label:"Tab",key:"Tab"}],r9=[{label:"←",key:"ArrowLeft",icon:!0},{label:"→",key:"ArrowRight",icon:!0},{label:"Home",key:"Home"},{label:"End",key:"End"},{label:"PgUp",key:"PageUp"},{label:"PgDn",key:"PageDown"},{label:"^Z",key:"z",ctrl:!0},{label:"^R",key:"r",ctrl:!0},{label:"^L",key:"l",ctrl:!0},{label:"^A",key:"a",ctrl:!0},{label:"^E",key:"e",ctrl:!0},{label:"^W",key:"w",ctrl:!0},{label:"F1",key:"F1"},{label:"F2",key:"F2"},{label:"F3",key:"F3"},{label:"F4",key:"F4"},{label:"F5",key:"F5"},{label:"F10",key:"F10"}],ne="bg-gradient-to-br from-orange-500 to-orange-600 active:from-orange-400 active:to-orange-500 text-white shadow-md ring-1 ring-orange-400",nt={width:"32px",height:"32px"},ni=({socket:e,sessionId:i,onExpandChange:s,onRefocus:r})=>{let[n,o]=(0,g.useState)(!1),[h,a]=(0,g.useState)(!1),[l,c]=(0,g.useState)(""),[d,_]=(0,g.useState)(!1),u=(0,g.useRef)(null);(0,g.useMemo)(()=>navigator.platform.toUpperCase().indexOf("MAC")>=0?"macos":"linux",[]);let[p,v]=(0,g.useState)(!1),[m,S]=(0,g.useState)(!1),[b,w]=(0,g.useState)(!1),[y,C]=(0,g.useState)(!1),x=(0,g.useCallback)((e,i={})=>{let s=i.ctrl||p,r=i.alt||b,n=i.shift||y;i.meta;let o="";if(s&&1===e.length){let i=e.toUpperCase().charCodeAt(0);o=i>=65&&i<=90?String.fromCharCode(i-64):"["===e?"\x1b":"]"===e?"\x1d":"\\"===e?"\x1c":"@"===e?"\0":"?"===e?"":e}else o=r?r6[e]?"\x1b"+r6[e]:1===e.length?"\x1b"+e:r6[e]||e:s&&r6[e]?e.startsWith("Arrow")?r4[e]||r6[e]:"Home"===e?"\x1b[1;5H":"End"===e?"\x1b[1;5F":r6[e]:n&&r6[e]?"Tab"===e?"\x1b[Z":e.startsWith("Arrow")&&({ArrowUp:"\x1b[1;2A",ArrowDown:"\x1b[1;2B",ArrowRight:"\x1b[1;2C",ArrowLeft:"\x1b[1;2D"})[e]||r6[e]:n&&1===e.length?e.toUpperCase():r6[e]||e;return o},[p,b,y,m]);if((0,g.useEffect)(()=>{let e=()=>{_(window.innerWidth<768||"ontouchstart"in window||navigator.maxTouchPoints>0)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,g.useEffect)(()=>{if(!d||!e||!i||!(p||m||b||y))return;let s=s=>{if(!p&&!m&&!b&&!y||["Control","Alt","Shift","Meta"].includes(s.key))return;s.preventDefault(),s.stopPropagation();let r=s.key;"Backspace"===r?r="Backspace":"Enter"===r?r="Enter":"Tab"===r?r="Tab":"Escape"===r?r="Escape":"Delete"===r?r="Delete":r.startsWith("Arrow")?r=s.key:r.startsWith("F")&&r.length<=3&&(r=s.key);let n=x(r,{ctrl:p,alt:b,shift:y,meta:m});e.emit("input",{sessionId:i,data:n}),v(!1),S(!1),w(!1),C(!1)};return document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("keydown",s,!0)}},[d,e,i,p,m,b,y,x]),!d||!e||!i)return null;let k=(s,r={})=>{let n=x(s,r);e.emit("input",{sessionId:i,data:n}),"Ctrl"!==s&&"Meta"!==s&&"Alt"!==s&&"Shift"!==s&&(v(!1),S(!1),w(!1),C(!1))},E=()=>{l.trim()&&e&&i&&(e.emit("input",{sessionId:i,data:l}),c(""),a(!1),s&&setTimeout(()=>s(!1),320),r&&setTimeout(()=>r(),350))},B=[...r7],D="flex items-center justify-center rounded-md font-semibold text-[11px] transition-all duration-100 shadow-sm",M=`${D} bg-gradient-to-br from-slate-700 to-slate-800 hover:from-slate-600 hover:to-slate-700 active:from-slate-500 active:to-slate-600 text-white border border-slate-600`,R=`${D} bg-gradient-to-br from-slate-700 to-slate-800 hover:from-slate-600 hover:to-slate-700 active:from-slate-500 active:to-slate-600 text-white text-sm border border-slate-600`;return(0,f.jsxs)("div",{className:"flex flex-col",children:[(0,f.jsx)("div",{className:`bg-gradient-to-b from-slate-900 to-slate-950 border-t border-slate-700 transition-all duration-300 overflow-hidden ${n?"max-h-32 opacity-100":"max-h-0 opacity-0"}`,children:(0,f.jsx)("div",{className:"p-2 overflow-y-auto max-h-32",children:(0,f.jsx)("div",{className:"grid grid-cols-6 gap-1 max-w-2xl mx-auto",children:r9.map((e,i)=>(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>k(e.key,{ctrl:e.ctrl}),className:`${M} ${e.ctrl?"text-orange-300":""}`,style:{minHeight:"28px"},children:e.label},i))})})}),(0,f.jsx)("div",{className:`bg-gradient-to-b from-slate-900 to-slate-950 border-t border-slate-700 transition-all duration-300 overflow-hidden ${h?"max-h-16 opacity-100":"max-h-0 opacity-0"}`,children:(0,f.jsxs)("div",{className:"p-2 flex gap-2 items-center",children:[(0,f.jsxs)("div",{className:"flex-1 relative",children:[(0,f.jsx)("input",{ref:u,type:"text",value:l,onChange:e=>c(e.target.value),onKeyDown:e=>"Enter"===e.key&&E(),placeholder:"Type command and send...",className:"w-full px-3 py-2 pr-8 bg-slate-700 border border-slate-600 rounded-lg text-white text-base placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-blue-500"}),l&&(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{c(""),u.current?.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 w-5 h-5 flex items-center justify-center text-slate-400 hover:text-white transition",children:"×"})]}),(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:E,disabled:!l.trim(),className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-slate-600 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition",children:"Send"})]})}),(0,f.jsx)("div",{className:"bg-gradient-to-t from-slate-900 via-slate-900 to-slate-800 border-t-2 border-slate-700 px-1.5 py-2 safe-area-bottom",children:(0,f.jsxs)("div",{className:"flex items-center justify-between gap-0.5 max-w-4xl mx-auto",children:[(0,f.jsx)("div",{className:"flex gap-0.5",children:(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>k("Escape"),className:M,style:nt,children:"Esc"})}),(0,f.jsx)("div",{className:"flex gap-0.5",children:B.slice(1,3).map(e=>(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>k(e.key),className:R,style:nt,children:e.label},e.key))}),(0,f.jsx)("div",{className:"flex gap-0.5 justify-center flex-wrap",children:B.slice(3).map(e=>{var i;let s,r=!0===e.modifier,n=!0===e.ctrl,o=r?(i=e.key,s=!1,("Ctrl"===i?s=p:"Meta"===i?s=m:"Alt"===i||"Opt"===i?s=b:"Shift"===i&&(s=y),s)?`${D} ${ne}`:M):M;return(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{if(r){var i;"Ctrl"===(i=e.key)?v(!p):"Meta"===i?S(!m):"Alt"===i||"Opt"===i?w(!b):"Shift"===i&&C(!y)}else n?k(e.key,{ctrl:!0}):k(e.key)},className:`${o} ${n?"text-orange-300":""}`,style:nt,children:e.label},e.key+e.label)})}),(0,f.jsxs)("div",{className:"flex gap-0.5 justify-center flex-wrap",children:[(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{let e=!h;a(e),o(!1),s&&setTimeout(()=>s(e),320),e?setTimeout(()=>u.current?.focus(),350):r&&setTimeout(()=>r(),350)},className:`${h?`${D} ${ne}`:M} flex-shrink-0`,style:nt,children:"Aa"}),(0,f.jsx)("button",{onMouseDown:e=>e.preventDefault(),onClick:()=>{let e=!n;o(e),a(!1),e&&document.activeElement?.blur(),s&&setTimeout(()=>s(e),320)},className:`${M} flex-shrink-0`,style:nt,children:(0,f.jsx)("span",{className:`transition-transform duration-300 inline-block ${n?"rotate-180":""}`,children:n?"×":"⋯"})})]})]})})]})},ns={dracula:{background:"#282a36",foreground:"#f8f8f2",cursor:"#f8f8f2",black:"#21222c",red:"#ff5555",green:"#50fa7b",yellow:"#f1fa8c",blue:"#bd93f9",magenta:"#ff79c6",cyan:"#8be9fd",white:"#f8f8f2",brightBlack:"#6272a4",brightRed:"#ff6e6e",brightGreen:"#69ff94",brightYellow:"#ffffa5",brightBlue:"#d6acff",brightMagenta:"#ff92df",brightCyan:"#a4ffff",brightWhite:"#ffffff"},monokai:{background:"#272822",foreground:"#f8f8f2",cursor:"#f8f8f0",black:"#272822",red:"#f92672",green:"#a6e22e",yellow:"#f4bf75",blue:"#66d9ef",magenta:"#ae81ff",cyan:"#a1efe4",white:"#f8f8f2",brightBlack:"#75715e",brightRed:"#f92672",brightGreen:"#a6e22e",brightYellow:"#f4bf75",brightBlue:"#66d9ef",brightMagenta:"#ae81ff",brightCyan:"#a1efe4",brightWhite:"#f9f8f5"},cobalt2:{background:"#193549",foreground:"#ffffff",cursor:"#f0cc09",black:"#000000",red:"#ff0000",green:"#38de21",yellow:"#ffe50a",blue:"#1460d2",magenta:"#ff005d",cyan:"#00bbbb",white:"#bbbbbb",brightBlack:"#555555",brightRed:"#f40e17",brightGreen:"#3bd01d",brightYellow:"#edc809",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#6ae3fa",brightWhite:"#ffffff"},gruvboxDark:{background:"#282828",foreground:"#ebdbb2",cursor:"#ebdbb2",black:"#282828",red:"#cc241d",green:"#98971a",yellow:"#d79921",blue:"#458588",magenta:"#b16286",cyan:"#689d6a",white:"#a89984",brightBlack:"#928374",brightRed:"#fb4934",brightGreen:"#b8bb26",brightYellow:"#fabd2f",brightBlue:"#83a598",brightMagenta:"#d3869b",brightCyan:"#8ec07c",brightWhite:"#ebdbb2"},solarizedLight:{background:"#fdf6e3",foreground:"#657b83",cursor:"#657b83",black:"#073642",red:"#dc322f",green:"#859900",yellow:"#b58900",blue:"#268bd2",magenta:"#d33682",cyan:"#2aa198",white:"#eee8d5",brightBlack:"#002b36",brightRed:"#cb4b16",brightGreen:"#586e75",brightYellow:"#657b83",brightBlue:"#839496",brightMagenta:"#6c71c4",brightCyan:"#93a1a1",brightWhite:"#fdf6e3"},githubLight:{background:"#ffffff",foreground:"#24292f",cursor:"#0969da",black:"#24292f",red:"#cf222e",green:"#116329",yellow:"#4d2d00",blue:"#0969da",magenta:"#8250df",cyan:"#1b7c83",white:"#6e7781",brightBlack:"#57606a",brightRed:"#a40e26",brightGreen:"#1a7f37",brightYellow:"#633c01",brightBlue:"#218bff",brightMagenta:"#a475f9",brightCyan:"#3192aa",brightWhite:"#8c959f"}};function nr({socket:e,connected:i,sessionId:s,isActive:r=!0,theme:n="dracula",onThemeChange:o,onBack:h,onOpenRemote:a,onSelectSite:l,tunnelUrl:c,apiKey:d}){let _=(0,g.useRef)(null),u=(0,g.useRef)(null),p=(0,g.useRef)(null),v=(0,g.useRef)(null),m=(0,g.useRef)(null),[S,b]=(0,g.useState)(!1),[w,y]=(0,g.useState)(""),[C,x]=(0,g.useState)(!1),k=(0,g.useCallback)(()=>{p.current&&u.current&&e&&(p.current.fit(),e.emit("resize",{sessionId:s,cols:u.current.cols,rows:u.current.rows}))},[e,s]);return(0,g.useEffect)(()=>{if(!_.current||!e||!s||u.current)return;let i=new r2({...r8,fontSize:window.innerWidth<768?r8.fontSizeMobile:r8.fontSize,fontFamily:r8.fontFamily,theme:ns[n]||ns.dracula}),r=new r5;i.loadAddon(r),u.current=i,p.current=r,i.open(_.current),setTimeout(()=>r.fit(),100);let o=_.current,h=0,a=0,l=0,c=null,d=0,f=e=>{1===e.touches.length&&(c&&(cancelAnimationFrame(c),c=null),h=e.touches[0].clientY,d=performance.now(),a=0,l=0)},g=e=>{if(1===e.touches.length){let s=e.touches[0].clientY,r=performance.now(),n=h-s,o=r-d;o>0&&(a=.7*a+n/o*.3),h=s,d=r;let c=Math.trunc(l+=n/16);0!==c&&(i.scrollLines(c),l-=c)}},S=()=>{let e=()=>{if(.005>Math.abs(a)){c=null,a=0,l=0;return}let s=Math.trunc(l+=16*a/16);0!==s&&(i.scrollLines(s),l-=s),a*=.92,c=requestAnimationFrame(e)};Math.abs(a)>.005&&(c=requestAnimationFrame(e))};o.addEventListener("touchstart",f,{passive:!0}),o.addEventListener("touchmove",g,{passive:!0}),o.addEventListener("touchend",S,{passive:!0});let w=null,C=new ResizeObserver(()=>{w&&clearTimeout(w),w=setTimeout(()=>{p.current.fit(),u.current?.scrollToBottom()},100)});C.observe(o),e.emit("joinSession",s,e=>{e.success?(b(!0),y(e.name)):i.write(`\r
|
|
19
19
|
\x1b[1;31mError: ${e.error}\x1b[0m\r
|
|
20
|
-
`)});let
|
|
20
|
+
`)});let x=e=>{if(e.sessionId!==s)return;let r=e.data;r instanceof ArrayBuffer||r&&r.buffer?i.write(new Uint8Array(r)):"string"==typeof r?i.write(r):i.write(String(r))};m.current=x,e.on("output",x);let E=()=>setTimeout(k,300);return window.addEventListener("orientationchange",E),()=>{window.removeEventListener("orientationchange",E),o.removeEventListener("touchstart",f),o.removeEventListener("touchmove",g),o.removeEventListener("touchend",S),C.disconnect(),c&&cancelAnimationFrame(c),m.current&&e.off("output",m.current),v.current&&v.current.dispose(),r.dispose(),i.dispose(),u.current=null}},[e,s]),(0,g.useEffect)(()=>{u.current&&e&&s&&(v.current&&(v.current.dispose(),v.current=null),r&&(v.current=u.current.onData(i=>{e.emit("input",{sessionId:s,data:i})})))},[r,e,s]),(0,g.useEffect)(()=>{if(!r||!p.current||!u.current)return;let e=setTimeout(k,100);return()=>clearTimeout(e)},[r,k]),(0,g.useEffect)(()=>{let e=ns[n]||ns.dracula;u.current&&(u.current.options.theme=e)},[n]),(0,f.jsxs)("div",{className:"h-[var(--app-height,100vh)] flex flex-col overflow-hidden",style:{background:(ns[n]||ns.dracula).background},children:[(0,f.jsxs)("div",{className:"bg-slate-800 border-b border-slate-700 px-2 sm:px-6 py-2 sm:py-3 flex items-center justify-between flex-shrink-0",children:[(0,f.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,f.jsx)("button",{onClick:h,className:"p-2 bg-slate-700 hover:bg-slate-600 text-white rounded transition",title:"Back",children:(0,f.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,f.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),(0,f.jsx)("span",{className:`w-2 h-2 rounded-full ${i?"bg-green-500":"bg-red-500 animate-pulse"}`,title:i?"Connected":"Disconnected"}),!i&&(0,f.jsx)("span",{className:"text-red-400 text-xs hidden sm:inline",children:"Reconnecting..."}),(0,f.jsx)("h1",{className:"text-white text-sm sm:text-base font-semibold truncate max-w-[150px] sm:max-w-none",children:w||"Terminal"})]}),(0,f.jsxs)("div",{className:"flex items-center gap-2",children:[a&&(0,f.jsxs)("button",{onClick:a,disabled:!i,className:`px-3 sm:px-4 py-2 text-white text-sm font-medium rounded transition flex items-center gap-2 ${i?"bg-indigo-600 hover:bg-indigo-700":"bg-indigo-600/50 cursor-not-allowed"}`,children:[(0,f.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,f.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),(0,f.jsx)("span",{className:"hidden sm:inline",children:"Remote"})]}),(0,f.jsx)(r3.default,{tunnelUrl:c,apiKey:d,onSelectSite:l}),(0,f.jsxs)("div",{className:"relative",children:[(0,f.jsxs)("button",{onClick:()=>x(!C),className:"px-3 sm:px-4 py-2 bg-slate-700 hover:bg-slate-600 text-white text-sm font-medium rounded transition flex items-center gap-2",children:[(0,f.jsx)("span",{className:"w-4 h-4 rounded-full",style:{background:(ns[n]||ns.dracula).background,border:"2px solid #94a3b8"}}),(0,f.jsx)("span",{className:"hidden sm:inline",children:"Theme"})]}),C&&(0,f.jsx)("div",{className:"absolute right-0 top-full mt-2 bg-slate-800 border border-slate-600 rounded-lg shadow-xl z-50 p-2 min-w-[120px]",children:Object.keys(ns).map(e=>(0,f.jsxs)("button",{onClick:()=>{o(e),x(!1)},className:`w-full px-3 py-2 text-left text-sm rounded flex items-center gap-2 ${n===e?"bg-blue-600 text-white":"text-slate-300 hover:bg-slate-700"}`,children:[(0,f.jsx)("span",{className:"w-3 h-3 rounded-full",style:{background:ns[e].background,border:"2px solid #94a3b8"}}),e.charAt(0).toUpperCase()+e.slice(1)]},e))})]})]})]}),(0,f.jsx)("div",{className:"terminal-wrapper flex-1 min-h-0 overflow-hidden p-2 sm:p-4",children:(0,f.jsx)("div",{ref:_,className:"w-full h-full rounded-lg overflow-hidden shadow-2xl"})}),(0,f.jsx)(ni,{socket:e,sessionId:s,onExpandChange:k,onRefocus:()=>u.current?.focus()})]})}e.s(["default",()=>nr],18054)},11682,e=>{e.n(e.i(18054))}]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@img/sharp-darwin-arm64",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.5",
|
|
4
4
|
"description": "Prebuilt sharp for use with macOS 64-bit ARM",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"preferUnplugged": true,
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@img/sharp-libvips-darwin-arm64": "1.
|
|
18
|
+
"@img/sharp-libvips-darwin-arm64": "1.0.4"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"lib"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@img/sharp-libvips-darwin-arm64",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Prebuilt libvips and dependencies for use with sharp on macOS 64-bit ARM",
|
|
5
5
|
"author": "Lovell Fuller <npm@lovell.info>",
|
|
6
6
|
"homepage": "https://sharp.pixelplumbing.com",
|