vibora 8.5.2 → 8.5.3

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/bin/vibora.js CHANGED
@@ -32635,7 +32635,7 @@ function installUv() {
32635
32635
  var package_default = {
32636
32636
  name: "vibora",
32637
32637
  private: true,
32638
- version: "8.5.2",
32638
+ version: "8.5.3",
32639
32639
  description: "Harness Attention. Orchestrate Agents. Ship.",
32640
32640
  license: "PolyForm-Shield-1.0.0",
32641
32641
  type: "module",
@@ -40,7 +40,7 @@ WARNING: This link could potentially be dangerous`)){const y=window.open();if(y)
40
40
  `:`
41
41
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(O){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),y.isLinux&&O&&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:this._activeSelectionMode===3})}_isClickInSelection(O){const N=this._getMouseBufferCoords(O),D=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!!(D&&L&&N)&&this._areCoordsInSelection(N,D,L)}isCellInSelection(O,N){const D=this._model.finalSelectionStart,L=this._model.finalSelectionEnd;return!(!D||!L)&&this._areCoordsInSelection([O,N],D,L)}_areCoordsInSelection(O,N,D){return O[1]>N[1]&&O[1]<D[1]||N[1]===D[1]&&O[1]===N[1]&&O[0]>=N[0]&&O[0]<D[0]||N[1]<D[1]&&O[1]===D[1]&&O[0]<D[0]||N[1]<D[1]&&O[1]===N[1]&&O[0]>=N[0]}_selectWordAtCursor(O,N){const D=this._linkifier.currentLink?.link?.range;if(D)return this._model.selectionStart=[D.start.x-1,D.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(D,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const L=this._getMouseBufferCoords(O);return!!L&&(this._selectWordAt(L,N),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(O,N){this._model.clearSelection(),O=Math.max(O,0),N=Math.min(N,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,O],this._model.selectionEnd=[this._bufferService.cols,N],this.refresh(),this._onSelectionChange.fire()}_handleTrim(O){this._model.handleTrim(O)&&this.refresh()}_getMouseBufferCoords(O){const N=this._mouseService.getCoords(O,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(N)return N[0]--,N[1]--,N[1]+=this._bufferService.buffer.ydisp,N}_getMouseEventScrollAmount(O){let N=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,O,this._screenElement)[1];const D=this._renderService.dimensions.css.canvas.height;return N>=0&&N<=D?0:(N>D&&(N-=D),N=Math.min(Math.max(N,-50),50),N/=50,N/Math.abs(N)+Math.round(14*N))}shouldForceSelection(O){return y.isMac?O.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:O.shiftKey}handleMouseDown(O){if(this._mouseDownTimeStamp=O.timeStamp,(O.button!==2||!this.hasSelection)&&O.button===0){if(!this._enabled){if(!this.shouldForceSelection(O))return;O.stopPropagation()}O.preventDefault(),this._dragScrollAmount=0,this._enabled&&O.shiftKey?this._handleIncrementalClick(O):O.detail===1?this._handleSingleClick(O):O.detail===2?this._handleDoubleClick(O):O.detail===3&&this._handleTripleClick(O),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(O){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(O))}_handleSingleClick(O){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(O)?3:0,this._model.selectionStart=this._getMouseBufferCoords(O),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const N=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);N&&N.length!==this._model.selectionStart[0]&&N.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(O){this._selectWordAtCursor(O,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(O){const N=this._getMouseBufferCoords(O);N&&(this._activeSelectionMode=2,this._selectLineAt(N[1]))}shouldColumnSelect(O){return O.altKey&&!(y.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(O){if(O.stopImmediatePropagation(),!this._model.selectionStart)return;const N=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(O),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(O),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const D=this._bufferService.buffer;if(this._model.selectionEnd[1]<D.lines.length){const L=D.lines.get(this._model.selectionEnd[1]);L&&L.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}N&&N[0]===this._model.selectionEnd[0]&&N[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});const O=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(O.ydisp+this._bufferService.rows,O.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=O.ydisp),this.refresh()}}_handleMouseUp(O){const N=O.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&N<500&&O.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const D=this._mouseService.getCoords(O,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(D&&D[0]!==void 0&&D[1]!==void 0){const L=(0,m.moveToCellSequence)(D[0]-1,D[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(L,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const O=this._model.finalSelectionStart,N=this._model.finalSelectionEnd,D=!(!O||!N||O[0]===N[0]&&O[1]===N[1]);D?O&&N&&(this._oldSelectionStart&&this._oldSelectionEnd&&O[0]===this._oldSelectionStart[0]&&O[1]===this._oldSelectionStart[1]&&N[0]===this._oldSelectionEnd[0]&&N[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(O,N,D)):this._oldHasSelection&&this._fireOnSelectionChange(O,N,D)}_fireOnSelectionChange(O,N,D){this._oldSelectionStart=O,this._oldSelectionEnd=N,this._oldHasSelection=D,this._onSelectionChange.fire()}_handleBufferActivate(O){this.clearSelection(),this._trimListener.dispose(),this._trimListener=O.activeBuffer.lines.onTrim((N=>this._handleTrim(N)))}_convertViewportColToCharacterIndex(O,N){let D=N;for(let L=0;N>=L;L++){const z=O.loadCell(L,this._workCell).getChars().length;this._workCell.getWidth()===0?D--:z>1&&N!==L&&(D+=z-1)}return D}setSelection(O,N,D){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[O,N],this._model.selectionStartLength=D,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(O){this._isClickInSelection(O)||(this._selectWordAtCursor(O,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(O,N,D=!0,L=!0){if(O[0]>=this._bufferService.cols)return;const z=this._bufferService.buffer,P=z.lines.get(O[1]);if(!P)return;const V=z.translateBufferLineToString(O[1],!1);let H=this._convertViewportColToCharacterIndex(P,O[0]),j=H;const G=O[0]-H;let q=0,B=0,F=0,U=0;if(V.charAt(H)===" "){for(;H>0&&V.charAt(H-1)===" ";)H--;for(;j<V.length&&V.charAt(j+1)===" ";)j++}else{let ee=O[0],oe=O[0];P.getWidth(ee)===0&&(q++,ee--),P.getWidth(oe)===2&&(B++,oe++);const ne=P.getString(oe).length;for(ne>1&&(U+=ne-1,j+=ne-1);ee>0&&H>0&&!this._isCharWordSeparator(P.loadCell(ee-1,this._workCell));){P.loadCell(ee-1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===0?(q++,ee--):Z>1&&(F+=Z-1,H-=Z-1),H--,ee--}for(;oe<P.length&&j+1<V.length&&!this._isCharWordSeparator(P.loadCell(oe+1,this._workCell));){P.loadCell(oe+1,this._workCell);const Z=this._workCell.getChars().length;this._workCell.getWidth()===2?(B++,oe++):Z>1&&(U+=Z-1,j+=Z-1),j++,oe++}}j++;let K=H+G-q+F,W=Math.min(this._bufferService.cols,j-H+q+B-F-U);if(N||V.slice(H,j).trim()!==""){if(D&&K===0&&P.getCodePoint(0)!==32){const ee=z.lines.get(O[1]-1);if(ee&&P.isWrapped&&ee.getCodePoint(this._bufferService.cols-1)!==32){const oe=this._getWordAt([this._bufferService.cols-1,O[1]-1],!1,!0,!1);if(oe){const ne=this._bufferService.cols-oe.start;K-=ne,W+=ne}}}if(L&&K+W===this._bufferService.cols&&P.getCodePoint(this._bufferService.cols-1)!==32){const ee=z.lines.get(O[1]+1);if(ee?.isWrapped&&ee.getCodePoint(0)!==32){const oe=this._getWordAt([0,O[1]+1],!1,!1,!0);oe&&(W+=oe.length)}}return{start:K,length:W}}}_selectWordAt(O,N){const D=this._getWordAt(O,N);if(D){for(;D.start<0;)D.start+=this._bufferService.cols,O[1]--;this._model.selectionStart=[D.start,O[1]],this._model.selectionStartLength=D.length}}_selectToWordAt(O){const N=this._getWordAt(O,!0);if(N){let D=O[1];for(;N.start<0;)N.start+=this._bufferService.cols,D--;if(!this._model.areSelectionValuesReversed())for(;N.start+N.length>this._bufferService.cols;)N.length-=this._bufferService.cols,D++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?N.start:N.start+N.length,D]}}_isCharWordSeparator(O){return O.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(O.getChars())>=0}_selectLineAt(O){const N=this._bufferService.buffer.getWrappedRangeForLine(O),D={start:{x:0,y:N.first},end:{x:this._bufferService.cols-1,y:N.last}};this._model.selectionStart=[0,N.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(D,this._bufferService.cols)}};o.SelectionService=R=u([p(3,C.IBufferService),p(4,C.ICoreService),p(5,x.IMouseService),p(6,C.IOptionsService),p(7,x.IRenderService),p(8,x.ICoreBrowserService)],R)},4725:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const u=l(8343);o.ICharSizeService=(0,u.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),o.IMouseService=(0,u.createDecorator)("MouseService"),o.IRenderService=(0,u.createDecorator)("RenderService"),o.ISelectionService=(0,u.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,u.createDecorator)("ThemeService"),o.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(s,o,l){var u=this&&this.__decorate||function(R,O,N,D){var L,z=arguments.length,P=z<3?O:D===null?D=Object.getOwnPropertyDescriptor(O,N):D;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")P=Reflect.decorate(R,O,N,D);else for(var V=R.length-1;V>=0;V--)(L=R[V])&&(P=(z<3?L(P):z>3?L(O,N,P):L(O,N))||P);return z>3&&P&&Object.defineProperty(O,N,P),P},p=this&&this.__param||function(R,O){return function(N,D){O(N,D,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),m=l(8055),g=l(8460),x=l(844),S=l(2585),b=m.css.toColor("#ffffff"),y=m.css.toColor("#000000"),v=m.css.toColor("#ffffff"),_=m.css.toColor("#000000"),C={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[m.css.toColor("#2e3436"),m.css.toColor("#cc0000"),m.css.toColor("#4e9a06"),m.css.toColor("#c4a000"),m.css.toColor("#3465a4"),m.css.toColor("#75507b"),m.css.toColor("#06989a"),m.css.toColor("#d3d7cf"),m.css.toColor("#555753"),m.css.toColor("#ef2929"),m.css.toColor("#8ae234"),m.css.toColor("#fce94f"),m.css.toColor("#729fcf"),m.css.toColor("#ad7fa8"),m.css.toColor("#34e2e2"),m.css.toColor("#eeeeec")],O=[0,95,135,175,215,255];for(let N=0;N<216;N++){const D=O[N/36%6|0],L=O[N/6%6|0],z=O[N%6];R.push({css:m.channels.toCss(D,L,z),rgba:m.channels.toRgba(D,L,z)})}for(let N=0;N<24;N++){const D=8+10*N;R.push({css:m.channels.toCss(D,D,D),rgba:m.channels.toRgba(D,D,D)})}return R})());let w=o.ThemeService=class extends x.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new g.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:y,cursor:v,cursorAccent:_,selectionForeground:void 0,selectionBackgroundTransparent:C,selectionBackgroundOpaque:m.color.blend(y,C),selectionInactiveBackgroundTransparent:C,selectionInactiveBackgroundOpaque:m.color.blend(y,C),ansi:o.DEFAULT_ANSI_COLORS.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))))}_setTheme(R={}){const O=this._colors;if(O.foreground=A(R.foreground,b),O.background=A(R.background,y),O.cursor=A(R.cursor,v),O.cursorAccent=A(R.cursorAccent,_),O.selectionBackgroundTransparent=A(R.selectionBackground,C),O.selectionBackgroundOpaque=m.color.blend(O.background,O.selectionBackgroundTransparent),O.selectionInactiveBackgroundTransparent=A(R.selectionInactiveBackground,O.selectionBackgroundTransparent),O.selectionInactiveBackgroundOpaque=m.color.blend(O.background,O.selectionInactiveBackgroundTransparent),O.selectionForeground=R.selectionForeground?A(R.selectionForeground,m.NULL_COLOR):void 0,O.selectionForeground===m.NULL_COLOR&&(O.selectionForeground=void 0),m.color.isOpaque(O.selectionBackgroundTransparent)&&(O.selectionBackgroundTransparent=m.color.opacity(O.selectionBackgroundTransparent,.3)),m.color.isOpaque(O.selectionInactiveBackgroundTransparent)&&(O.selectionInactiveBackgroundTransparent=m.color.opacity(O.selectionInactiveBackgroundTransparent,.3)),O.ansi=o.DEFAULT_ANSI_COLORS.slice(),O.ansi[0]=A(R.black,o.DEFAULT_ANSI_COLORS[0]),O.ansi[1]=A(R.red,o.DEFAULT_ANSI_COLORS[1]),O.ansi[2]=A(R.green,o.DEFAULT_ANSI_COLORS[2]),O.ansi[3]=A(R.yellow,o.DEFAULT_ANSI_COLORS[3]),O.ansi[4]=A(R.blue,o.DEFAULT_ANSI_COLORS[4]),O.ansi[5]=A(R.magenta,o.DEFAULT_ANSI_COLORS[5]),O.ansi[6]=A(R.cyan,o.DEFAULT_ANSI_COLORS[6]),O.ansi[7]=A(R.white,o.DEFAULT_ANSI_COLORS[7]),O.ansi[8]=A(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),O.ansi[9]=A(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),O.ansi[10]=A(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),O.ansi[11]=A(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),O.ansi[12]=A(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),O.ansi[13]=A(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),O.ansi[14]=A(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),O.ansi[15]=A(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const N=Math.min(O.ansi.length-16,R.extendedAnsi.length);for(let D=0;D<N;D++)O.ansi[D+16]=A(R.extendedAnsi[D],o.DEFAULT_ANSI_COLORS[D+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){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[R]=this._restoreColors.ansi[R]}else for(let O=0;O<this._restoreColors.ansi.length;++O)this._colors.ansi[O]=this._restoreColors.ansi[O]}modifyColors(R){R(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 A(R,O){if(R!==void 0)try{return m.css.toColor(R)}catch{}return O}o.ThemeService=w=u([p(0,S.IOptionsService)],w)},6349:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=l(8460),p=l(844);class d extends p.Disposable{constructor(g){super(),this._maxLength=g,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(g){if(this._maxLength===g)return;const x=new Array(g);for(let S=0;S<Math.min(g,this.length);S++)x[S]=this._array[this._getCyclicIndex(S)];this._array=x,this._maxLength=g,this._startIndex=0}get length(){return this._length}set length(g){if(g>this._length)for(let x=this._length;x<g;x++)this._array[x]=void 0;this._length=g}get(g){return this._array[this._getCyclicIndex(g)]}set(g,x){this._array[this._getCyclicIndex(g)]=x}push(g){this._array[this._getCyclicIndex(this._length)]=g,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(g,x,...S){if(x){for(let b=g;b<this._length-x;b++)this._array[this._getCyclicIndex(b)]=this._array[this._getCyclicIndex(b+x)];this._length-=x,this.onDeleteEmitter.fire({index:g,amount:x})}for(let b=this._length-1;b>=g;b--)this._array[this._getCyclicIndex(b+S.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;b<S.length;b++)this._array[this._getCyclicIndex(g+b)]=S[b];if(S.length&&this.onInsertEmitter.fire({index:g,amount:S.length}),this._length+S.length>this._maxLength){const b=this._length+S.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=S.length}trimStart(g){g>this._length&&(g=this._length),this._startIndex+=g,this._length-=g,this.onTrimEmitter.fire(g)}shiftElements(g,x,S){if(!(x<=0)){if(g<0||g>=this._length)throw new Error("start argument out of range");if(g+S<0)throw new Error("Cannot shift elements in list beyond index 0");if(S>0){for(let y=x-1;y>=0;y--)this.set(g+y+S,this.get(g+y));const b=g+x+S-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b<x;b++)this.set(g+b+S,this.get(g+b))}}_getCyclicIndex(g){return(this._startIndex+g)%this._maxLength}}o.CircularList=d},1439:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function l(u,p=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const m in u)d[m]=p<=1?u[m]:u[m]&&l(u[m],p-1);return d}},8055:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let l=0,u=0,p=0,d=0;var m,g,x,S,b;function y(_){const C=_.toString(16);return C.length<2?"0"+C:C}function v(_,C){return _<C?(C+.05)/(_+.05):(_+.05)/(C+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(_){_.toCss=function(C,w,A,R){return R!==void 0?`#${y(C)}${y(w)}${y(A)}${y(R)}`:`#${y(C)}${y(w)}${y(A)}`},_.toRgba=function(C,w,A,R=255){return(C<<24|w<<16|A<<8|R)>>>0},_.toColor=function(C,w,A,R){return{css:_.toCss(C,w,A,R),rgba:_.toRgba(C,w,A,R)}}})(m||(o.channels=m={})),(function(_){function C(w,A){return d=Math.round(255*A),[l,u,p]=b.toChannels(w.rgba),{css:m.toCss(l,u,p,d),rgba:m.toRgba(l,u,p,d)}}_.blend=function(w,A){if(d=(255&A.rgba)/255,d===1)return{css:A.css,rgba:A.rgba};const R=A.rgba>>24&255,O=A.rgba>>16&255,N=A.rgba>>8&255,D=w.rgba>>24&255,L=w.rgba>>16&255,z=w.rgba>>8&255;return l=D+Math.round((R-D)*d),u=L+Math.round((O-L)*d),p=z+Math.round((N-z)*d),{css:m.toCss(l,u,p),rgba:m.toRgba(l,u,p)}},_.isOpaque=function(w){return(255&w.rgba)==255},_.ensureContrastRatio=function(w,A,R){const O=b.ensureContrastRatio(w.rgba,A.rgba,R);if(O)return m.toColor(O>>24&255,O>>16&255,O>>8&255)},_.opaque=function(w){const A=(255|w.rgba)>>>0;return[l,u,p]=b.toChannels(A),{css:m.toCss(l,u,p),rgba:A}},_.opacity=C,_.multiplyOpacity=function(w,A){return d=255&w.rgba,C(w,d*A/255)},_.toColorRGB=function(w){return[w.rgba>>24&255,w.rgba>>16&255,w.rgba>>8&255]}})(g||(o.color=g={})),(function(_){let C,w;try{const A=document.createElement("canvas");A.width=1,A.height=1;const R=A.getContext("2d",{willReadFrequently:!0});R&&(C=R,C.globalCompositeOperation="copy",w=C.createLinearGradient(0,0,1,1))}catch{}_.toColor=function(A){if(A.match(/#[\da-f]{3,8}/i))switch(A.length){case 4:return l=parseInt(A.slice(1,2).repeat(2),16),u=parseInt(A.slice(2,3).repeat(2),16),p=parseInt(A.slice(3,4).repeat(2),16),m.toColor(l,u,p);case 5:return l=parseInt(A.slice(1,2).repeat(2),16),u=parseInt(A.slice(2,3).repeat(2),16),p=parseInt(A.slice(3,4).repeat(2),16),d=parseInt(A.slice(4,5).repeat(2),16),m.toColor(l,u,p,d);case 7:return{css:A,rgba:(parseInt(A.slice(1),16)<<8|255)>>>0};case 9:return{css:A,rgba:parseInt(A.slice(1),16)>>>0}}const R=A.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return l=parseInt(R[1]),u=parseInt(R[2]),p=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),m.toColor(l,u,p,d);if(!C||!w)throw new Error("css.toColor: Unsupported css format");if(C.fillStyle=w,C.fillStyle=A,typeof C.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(C.fillRect(0,0,1,1),[l,u,p,d]=C.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:m.toRgba(l,u,p,d),css:A}}})(x||(o.css=x={})),(function(_){function C(w,A,R){const O=w/255,N=A/255,D=R/255;return .2126*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(D<=.03928?D/12.92:Math.pow((D+.055)/1.055,2.4))}_.relativeLuminance=function(w){return C(w>>16&255,w>>8&255,255&w)},_.relativeLuminance2=C})(S||(o.rgb=S={})),(function(_){function C(A,R,O){const N=A>>24&255,D=A>>16&255,L=A>>8&255;let z=R>>24&255,P=R>>16&255,V=R>>8&255,H=v(S.relativeLuminance2(z,P,V),S.relativeLuminance2(N,D,L));for(;H<O&&(z>0||P>0||V>0);)z-=Math.max(0,Math.ceil(.1*z)),P-=Math.max(0,Math.ceil(.1*P)),V-=Math.max(0,Math.ceil(.1*V)),H=v(S.relativeLuminance2(z,P,V),S.relativeLuminance2(N,D,L));return(z<<24|P<<16|V<<8|255)>>>0}function w(A,R,O){const N=A>>24&255,D=A>>16&255,L=A>>8&255;let z=R>>24&255,P=R>>16&255,V=R>>8&255,H=v(S.relativeLuminance2(z,P,V),S.relativeLuminance2(N,D,L));for(;H<O&&(z<255||P<255||V<255);)z=Math.min(255,z+Math.ceil(.1*(255-z))),P=Math.min(255,P+Math.ceil(.1*(255-P))),V=Math.min(255,V+Math.ceil(.1*(255-V))),H=v(S.relativeLuminance2(z,P,V),S.relativeLuminance2(N,D,L));return(z<<24|P<<16|V<<8|255)>>>0}_.blend=function(A,R){if(d=(255&R)/255,d===1)return R;const O=R>>24&255,N=R>>16&255,D=R>>8&255,L=A>>24&255,z=A>>16&255,P=A>>8&255;return l=L+Math.round((O-L)*d),u=z+Math.round((N-z)*d),p=P+Math.round((D-P)*d),m.toRgba(l,u,p)},_.ensureContrastRatio=function(A,R,O){const N=S.relativeLuminance(A>>8),D=S.relativeLuminance(R>>8);if(v(N,D)<O){if(D<N){const P=C(A,R,O),V=v(N,S.relativeLuminance(P>>8));if(V<O){const H=w(A,R,O);return V>v(N,S.relativeLuminance(H>>8))?P:H}return P}const L=w(A,R,O),z=v(N,S.relativeLuminance(L>>8));if(z<O){const P=C(A,R,O);return z>v(N,S.relativeLuminance(P>>8))?L:P}return L}},_.reduceLuminance=C,_.increaseLuminance=w,_.toChannels=function(A){return[A>>24&255,A>>16&255,A>>8&255,255&A]}})(b||(o.rgba=b={})),o.toPaddedHex=y,o.contrastRatio=v},8969:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=l(844),p=l(2585),d=l(4348),m=l(7866),g=l(744),x=l(7302),S=l(6975),b=l(8460),y=l(1753),v=l(1480),_=l(7994),C=l(9282),w=l(5435),A=l(5981),R=l(2660);let O=!1;class N extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((L=>{this._onScrollApi?.fire(L.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(L){for(const z in L)this.optionsService.options[z]=L[z]}constructor(L){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new x.OptionsService(L)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(g.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(m.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(S.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(y.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(_.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new w.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((z=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((z=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new A.WriteBuffer(((z,P)=>this._inputHandler.parse(z,P)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(L,z){this._writeBuffer.write(L,z)}writeSync(L,z){this._logService.logLevel<=p.LogLevelEnum.WARN&&!O&&(this._logService.warn("writeSync is unreliable and will be removed soon."),O=!0),this._writeBuffer.writeSync(L,z)}input(L,z=!0){this.coreService.triggerDataEvent(L,z)}resize(L,z){isNaN(L)||isNaN(z)||(L=Math.max(L,g.MINIMUM_COLS),z=Math.max(z,g.MINIMUM_ROWS),this._bufferService.resize(L,z))}scroll(L,z=!1){this._bufferService.scroll(L,z)}scrollLines(L,z,P){this._bufferService.scrollLines(L,z,P)}scrollPages(L){this.scrollLines(L*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(L){const z=L-this._bufferService.buffer.ydisp;z!==0&&this.scrollLines(z)}registerEscHandler(L,z){return this._inputHandler.registerEscHandler(L,z)}registerDcsHandler(L,z){return this._inputHandler.registerDcsHandler(L,z)}registerCsiHandler(L,z){return this._inputHandler.registerCsiHandler(L,z)}registerOscHandler(L,z){return this._inputHandler.registerOscHandler(L,z)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let L=!1;const z=this.optionsService.rawOptions.windowsPty;z&&z.buildNumber!==void 0&&z.buildNumber!==void 0?L=z.backend==="conpty"&&z.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(L=!0),L?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const L=[];L.push(this.onLineFeed(C.updateWindowsModeWrappedState.bind(null,this._bufferService))),L.push(this.registerCsiHandler({final:"H"},(()=>((0,C.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const z of L)z.dispose()}))}}}o.CoreTerminal=N},8460:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const p=[];for(let d=0;d<this._listeners.length;d++)p.push(this._listeners[d]);for(let d=0;d<p.length;d++)p[d].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(l,u){return l((p=>u.fire(p)))},o.runAndSubscribe=function(l,u){return u(void 0),l((p=>u(p)))}},5435:function(s,o,l){var u=this&&this.__decorate||function(q,B,F,U){var K,W=arguments.length,ee=W<3?B:U===null?U=Object.getOwnPropertyDescriptor(B,F):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ee=Reflect.decorate(q,B,F,U);else for(var oe=q.length-1;oe>=0;oe--)(K=q[oe])&&(ee=(W<3?K(ee):W>3?K(B,F,ee):K(B,F))||ee);return W>3&&ee&&Object.defineProperty(B,F,ee),ee},p=this&&this.__param||function(q,B){return function(F,U){B(F,U,q)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=l(2584),m=l(7116),g=l(2015),x=l(844),S=l(482),b=l(8437),y=l(8460),v=l(643),_=l(511),C=l(3734),w=l(2585),A=l(1480),R=l(6242),O=l(6351),N=l(5941),D={"(":0,")":1,"*":2,"+":3,"-":1,".":2},L=131072;function z(q,B){if(q>24)return B.setWinLines||!1;switch(q){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}var P;(function(q){q[q.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",q[q.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(P||(o.WindowsOptionsReportType=P={}));let V=0;class H extends x.Disposable{getAttrData(){return this._curAttrData}constructor(B,F,U,K,W,ee,oe,ne,Z=new g.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=F,this._coreService=U,this._logService=K,this._optionsService=W,this._oscLinkService=ee,this._coreMouseService=oe,this._unicodeService=ne,this._parser=Z,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new S.StringToUtf32,this._utf8Decoder=new S.Utf8ToUtf32,this._workCell=new _.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new y.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new y.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new y.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new y.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new y.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new y.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new y.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new y.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new y.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new y.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new y.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new y.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new y.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new j(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((Y=>this._activeBuffer=Y.activeBuffer))),this._parser.setCsiHandlerFallback(((Y,Q)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(Y),params:Q.toArray()})})),this._parser.setEscHandlerFallback((Y=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(Y)})})),this._parser.setExecuteHandlerFallback((Y=>{this._logService.debug("Unknown EXECUTE code: ",{code:Y})})),this._parser.setOscHandlerFallback(((Y,Q,re)=>{this._logService.debug("Unknown OSC code: ",{identifier:Y,action:Q,data:re})})),this._parser.setDcsHandlerFallback(((Y,Q,re)=>{Q==="HOOK"&&(re=re.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(Y),action:Q,payload:re})})),this._parser.setPrintHandler(((Y,Q,re)=>this.print(Y,Q,re))),this._parser.registerCsiHandler({final:"@"},(Y=>this.insertChars(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(Y=>this.scrollLeft(Y))),this._parser.registerCsiHandler({final:"A"},(Y=>this.cursorUp(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(Y=>this.scrollRight(Y))),this._parser.registerCsiHandler({final:"B"},(Y=>this.cursorDown(Y))),this._parser.registerCsiHandler({final:"C"},(Y=>this.cursorForward(Y))),this._parser.registerCsiHandler({final:"D"},(Y=>this.cursorBackward(Y))),this._parser.registerCsiHandler({final:"E"},(Y=>this.cursorNextLine(Y))),this._parser.registerCsiHandler({final:"F"},(Y=>this.cursorPrecedingLine(Y))),this._parser.registerCsiHandler({final:"G"},(Y=>this.cursorCharAbsolute(Y))),this._parser.registerCsiHandler({final:"H"},(Y=>this.cursorPosition(Y))),this._parser.registerCsiHandler({final:"I"},(Y=>this.cursorForwardTab(Y))),this._parser.registerCsiHandler({final:"J"},(Y=>this.eraseInDisplay(Y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(Y=>this.eraseInDisplay(Y,!0))),this._parser.registerCsiHandler({final:"K"},(Y=>this.eraseInLine(Y,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(Y=>this.eraseInLine(Y,!0))),this._parser.registerCsiHandler({final:"L"},(Y=>this.insertLines(Y))),this._parser.registerCsiHandler({final:"M"},(Y=>this.deleteLines(Y))),this._parser.registerCsiHandler({final:"P"},(Y=>this.deleteChars(Y))),this._parser.registerCsiHandler({final:"S"},(Y=>this.scrollUp(Y))),this._parser.registerCsiHandler({final:"T"},(Y=>this.scrollDown(Y))),this._parser.registerCsiHandler({final:"X"},(Y=>this.eraseChars(Y))),this._parser.registerCsiHandler({final:"Z"},(Y=>this.cursorBackwardTab(Y))),this._parser.registerCsiHandler({final:"`"},(Y=>this.charPosAbsolute(Y))),this._parser.registerCsiHandler({final:"a"},(Y=>this.hPositionRelative(Y))),this._parser.registerCsiHandler({final:"b"},(Y=>this.repeatPrecedingCharacter(Y))),this._parser.registerCsiHandler({final:"c"},(Y=>this.sendDeviceAttributesPrimary(Y))),this._parser.registerCsiHandler({prefix:">",final:"c"},(Y=>this.sendDeviceAttributesSecondary(Y))),this._parser.registerCsiHandler({final:"d"},(Y=>this.linePosAbsolute(Y))),this._parser.registerCsiHandler({final:"e"},(Y=>this.vPositionRelative(Y))),this._parser.registerCsiHandler({final:"f"},(Y=>this.hVPosition(Y))),this._parser.registerCsiHandler({final:"g"},(Y=>this.tabClear(Y))),this._parser.registerCsiHandler({final:"h"},(Y=>this.setMode(Y))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(Y=>this.setModePrivate(Y))),this._parser.registerCsiHandler({final:"l"},(Y=>this.resetMode(Y))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(Y=>this.resetModePrivate(Y))),this._parser.registerCsiHandler({final:"m"},(Y=>this.charAttributes(Y))),this._parser.registerCsiHandler({final:"n"},(Y=>this.deviceStatus(Y))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(Y=>this.deviceStatusPrivate(Y))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(Y=>this.softReset(Y))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(Y=>this.setCursorStyle(Y))),this._parser.registerCsiHandler({final:"r"},(Y=>this.setScrollRegion(Y))),this._parser.registerCsiHandler({final:"s"},(Y=>this.saveCursor(Y))),this._parser.registerCsiHandler({final:"t"},(Y=>this.windowOptions(Y))),this._parser.registerCsiHandler({final:"u"},(Y=>this.restoreCursor(Y))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(Y=>this.insertColumns(Y))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(Y=>this.deleteColumns(Y))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(Y=>this.selectProtected(Y))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(Y=>this.requestMode(Y,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(Y=>this.requestMode(Y,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((Y=>(this.setTitle(Y),this.setIconName(Y),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((Y=>this.setIconName(Y)))),this._parser.registerOscHandler(2,new R.OscHandler((Y=>this.setTitle(Y)))),this._parser.registerOscHandler(4,new R.OscHandler((Y=>this.setOrReportIndexedColor(Y)))),this._parser.registerOscHandler(8,new R.OscHandler((Y=>this.setHyperlink(Y)))),this._parser.registerOscHandler(10,new R.OscHandler((Y=>this.setOrReportFgColor(Y)))),this._parser.registerOscHandler(11,new R.OscHandler((Y=>this.setOrReportBgColor(Y)))),this._parser.registerOscHandler(12,new R.OscHandler((Y=>this.setOrReportCursorColor(Y)))),this._parser.registerOscHandler(104,new R.OscHandler((Y=>this.restoreIndexedColor(Y)))),this._parser.registerOscHandler(110,new R.OscHandler((Y=>this.restoreFgColor(Y)))),this._parser.registerOscHandler(111,new R.OscHandler((Y=>this.restoreBgColor(Y)))),this._parser.registerOscHandler(112,new R.OscHandler((Y=>this.restoreCursorColor(Y)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const Y in m.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:Y},(()=>this.selectCharset("("+Y))),this._parser.registerEscHandler({intermediates:")",final:Y},(()=>this.selectCharset(")"+Y))),this._parser.registerEscHandler({intermediates:"*",final:Y},(()=>this.selectCharset("*"+Y))),this._parser.registerEscHandler({intermediates:"+",final:Y},(()=>this.selectCharset("+"+Y))),this._parser.registerEscHandler({intermediates:"-",final:Y},(()=>this.selectCharset("-"+Y))),this._parser.registerEscHandler({intermediates:".",final:Y},(()=>this.selectCharset("."+Y))),this._parser.registerEscHandler({intermediates:"/",final:Y},(()=>this.selectCharset("/"+Y)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((Y=>(this._logService.error("Parsing error: ",Y),Y))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new O.DcsHandler(((Y,Q)=>this.requestStatusString(Y,Q))))}_preserveStack(B,F,U,K){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=F,this._parseStack.decodedLength=U,this._parseStack.position=K}_logSlowResolvingAsync(B){this._logService.logLevel<=w.LogLevelEnum.WARN&&Promise.race([B,new Promise(((F,U)=>setTimeout((()=>U("#SLOW_TIMEOUT")),5e3)))]).catch((F=>{if(F!=="#SLOW_TIMEOUT")throw F;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(B,F){let U,K=this._activeBuffer.x,W=this._activeBuffer.y,ee=0;const oe=this._parseStack.paused;if(oe){if(U=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,F))return this._logSlowResolvingAsync(U),U;K=this._parseStack.cursorStartX,W=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>L&&(ee=this._parseStack.position+L)}if(this._logService.logLevel<=w.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(Y=>String.fromCharCode(Y))).join("")}"`),typeof B=="string"?B.split("").map((Y=>Y.charCodeAt(0))):B),this._parseBuffer.length<B.length&&this._parseBuffer.length<L&&(this._parseBuffer=new Uint32Array(Math.min(B.length,L))),oe||this._dirtyRowTracker.clearRange(),B.length>L)for(let Y=ee;Y<B.length;Y+=L){const Q=Y+L<B.length?Y+L:B.length,re=typeof B=="string"?this._stringDecoder.decode(B.substring(Y,Q),this._parseBuffer):this._utf8Decoder.decode(B.subarray(Y,Q),this._parseBuffer);if(U=this._parser.parse(this._parseBuffer,re))return this._preserveStack(K,W,re,Y),this._logSlowResolvingAsync(U),U}else if(!oe){const Y=typeof B=="string"?this._stringDecoder.decode(B,this._parseBuffer):this._utf8Decoder.decode(B,this._parseBuffer);if(U=this._parser.parse(this._parseBuffer,Y))return this._preserveStack(K,W,Y,0),this._logSlowResolvingAsync(U),U}this._activeBuffer.x===K&&this._activeBuffer.y===W||this._onCursorMove.fire();const ne=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Z=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Z<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Z,this._bufferService.rows-1),Math.min(ne,this._bufferService.rows-1))}print(B,F,U){let K,W;const ee=this._charsetService.charset,oe=this._optionsService.rawOptions.screenReaderMode,ne=this._bufferService.cols,Z=this._coreService.decPrivateModes.wraparound,Y=this._coreService.modes.insertMode,Q=this._curAttrData;let re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&U-F>0&&re.getWidth(this._activeBuffer.x-1)===2&&re.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Q);let se=this._parser.precedingJoinState;for(let te=F;te<U;++te){if(K=B[te],K<127&&ee){const ye=ee[String.fromCharCode(K)];ye&&(K=ye.charCodeAt(0))}const xe=this._unicodeService.charProperties(K,se);W=A.UnicodeService.extractWidth(xe);const be=A.UnicodeService.extractShouldJoin(xe),ce=be?A.UnicodeService.extractWidth(se):0;if(se=xe,oe&&this._onA11yChar.fire((0,S.stringFromCodePoint)(K)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+W-ce>ne){if(Z){const ye=re;let me=this._activeBuffer.x-ce;for(this._activeBuffer.x=ce,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),re=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ce>0&&re instanceof b.BufferLine&&re.copyCellsFrom(ye,me,0,ce,!1);me<ne;)ye.setCellFromCodepoint(me++,0,1,Q)}else if(this._activeBuffer.x=ne-1,W===2)continue}if(be&&this._activeBuffer.x){const ye=re.getWidth(this._activeBuffer.x-1)?1:2;re.addCodepointToCell(this._activeBuffer.x-ye,K,W);for(let me=W-ce;--me>=0;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,Q)}else if(Y&&(re.insertCells(this._activeBuffer.x,W-ce,this._activeBuffer.getNullCell(Q)),re.getWidth(ne-1)===2&&re.setCellFromCodepoint(ne-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,Q)),re.setCellFromCodepoint(this._activeBuffer.x++,K,W,Q),W>0)for(;--W;)re.setCellFromCodepoint(this._activeBuffer.x++,0,0,Q)}this._parser.precedingJoinState=se,this._activeBuffer.x<ne&&U-F>0&&re.getWidth(this._activeBuffer.x)===0&&!re.hasContent(this._activeBuffer.x)&&re.setCellFromCodepoint(this._activeBuffer.x,0,1,Q),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,F){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,F):this._parser.registerCsiHandler(B,(U=>!z(U.params[0],this._optionsService.rawOptions.windowOptions)||F(U)))}registerDcsHandler(B,F){return this._parser.registerDcsHandler(B,new O.DcsHandler(F))}registerEscHandler(B,F){return this._parser.registerEscHandler(B,F)}registerOscHandler(B,F){return this._parser.registerOscHandler(B,new R.OscHandler(F))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,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(B,F){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+F):(this._activeBuffer.x=B,this._activeBuffer.y=F),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,F){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+F)}cursorUp(B){const F=this._activeBuffer.y-this._activeBuffer.scrollTop;return F>=0?this._moveCursor(0,-Math.min(F,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const F=this._activeBuffer.scrollBottom-this._activeBuffer.y;return F>=0?this._moveCursor(0,Math.min(F,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const F=B.params[0];return F===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:F===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let F=B.params[0]||1;for(;F--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let F=B.params[0]||1;for(;F--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const F=B.params[0];return F===1&&(this._curAttrData.bg|=536870912),F!==2&&F!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,F,U,K=!1,W=!1){const ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);ee.replaceCells(F,U,this._activeBuffer.getNullCell(this._eraseAttrData()),W),K&&(ee.isWrapped=!1)}_resetBufferLine(B,F=!1){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);U&&(U.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),F),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),U.isWrapped=!1)}eraseInDisplay(B,F=!1){let U;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(U=this._activeBuffer.y,this._dirtyRowTracker.markDirty(U),this._eraseInBufferLine(U++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,F);U<this._bufferService.rows;U++)this._resetBufferLine(U,F);this._dirtyRowTracker.markDirty(U);break;case 1:for(U=this._activeBuffer.y,this._dirtyRowTracker.markDirty(U),this._eraseInBufferLine(U,0,this._activeBuffer.x+1,!0,F),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(U+1).isWrapped=!1);U--;)this._resetBufferLine(U,F);this._dirtyRowTracker.markDirty(0);break;case 2:for(U=this._bufferService.rows,this._dirtyRowTracker.markDirty(U-1);U--;)this._resetBufferLine(U,F);this._dirtyRowTracker.markDirty(0);break;case 3:const K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0}eraseInLine(B,F=!1){switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,F);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,F);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,F)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(B){this._restrictCursor();let F=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=this._activeBuffer.ybase+this._activeBuffer.y,K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,W=this._bufferService.rows-1+this._activeBuffer.ybase-K+1;for(;F--;)this._activeBuffer.lines.splice(W-1,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(B){this._restrictCursor();let F=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=this._activeBuffer.ybase+this._activeBuffer.y;let K;for(K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-K;F--;)this._activeBuffer.lines.splice(U,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(B){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.insertCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(B){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.deleteCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(B){let F=B.params[0]||1;for(;F--;)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(B){let F=B.params[0]||1;for(;F--;)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(b.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.deleteCells(0,F,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.insertCells(0,F,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.insertCells(this._activeBuffer.x,F,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const F=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.deleteCells(this._activeBuffer.x,F,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(B){this._restrictCursor();const F=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return F&&(F.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(B.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(B){const F=this._parser.precedingJoinState;if(!F)return!0;const U=B.params[0]||1,K=A.UnicodeService.extractWidth(F),W=this._activeBuffer.x-K,ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(W),oe=new Uint32Array(ee.length*U);let ne=0;for(let Y=0;Y<ee.length;){const Q=ee.codePointAt(Y)||0;oe[ne++]=Q,Y+=Q>65535?2:1}let Z=ne;for(let Y=1;Y<U;++Y)oe.copyWithin(Z,0,ne),Z+=ne;return this.print(oe,0,Z),!0}sendDeviceAttributesPrimary(B){return B.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(B){return B.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let F=0;F<B.length;F++)switch(B.params[F]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(B){for(let F=0;F<B.length;F++)switch(B.params[F]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,m.DEFAULT_CHARSET),this._charsetService.setgCharset(1,m.DEFAULT_CHARSET),this._charsetService.setgCharset(2,m.DEFAULT_CHARSET),this._charsetService.setgCharset(3,m.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(B){for(let F=0;F<B.length;F++)switch(B.params[F]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(B){for(let F=0;F<B.length;F++)switch(B.params[F]){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(),B.params[F]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(B,F){const U=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:W}=this._coreMouseService,ee=this._coreService,{buffers:oe,cols:ne}=this._bufferService,{active:Z,alt:Y}=oe,Q=this._optionsService.rawOptions,re=be=>be?1:2,se=B.params[0];return te=se,xe=F?se===2?4:se===4?re(ee.modes.insertMode):se===12?3:se===20?re(Q.convertEol):0:se===1?re(U.applicationCursorKeys):se===3?Q.windowOptions.setWinLines?ne===80?2:ne===132?1:0:0:se===6?re(U.origin):se===7?re(U.wraparound):se===8?3:se===9?re(K==="X10"):se===12?re(Q.cursorBlink):se===25?re(!ee.isCursorHidden):se===45?re(U.reverseWraparound):se===66?re(U.applicationKeypad):se===67?4:se===1e3?re(K==="VT200"):se===1002?re(K==="DRAG"):se===1003?re(K==="ANY"):se===1004?re(U.sendFocus):se===1005?4:se===1006?re(W==="SGR"):se===1015?4:se===1016?re(W==="SGR_PIXELS"):se===1048?1:se===47||se===1047||se===1049?re(Z===Y):se===2004?re(U.bracketedPasteMode):0,ee.triggerDataEvent(`${d.C0.ESC}[${F?"":"?"}${te};${xe}$y`),!0;var te,xe}_updateAttrColor(B,F,U,K,W){return F===2?(B|=50331648,B&=-16777216,B|=C.AttributeData.fromColorRGB([U,K,W])):F===5&&(B&=-50331904,B|=33554432|255&U),B}_extractColor(B,F,U){const K=[0,0,-1,0,0,0];let W=0,ee=0;do{if(K[ee+W]=B.params[F+ee],B.hasSubParams(F+ee)){const oe=B.getSubParams(F+ee);let ne=0;do K[1]===5&&(W=1),K[ee+ne+1+W]=oe[ne];while(++ne<oe.length&&ne+ee+1+W<K.length);break}if(K[1]===5&&ee+W>=2||K[1]===2&&ee+W>=5)break;K[1]&&(W=1)}while(++ee+F<B.length&&ee+W<K.length);for(let oe=2;oe<K.length;++oe)K[oe]===-1&&(K[oe]=0);switch(K[0]){case 38:U.fg=this._updateAttrColor(U.fg,K[1],K[3],K[4],K[5]);break;case 48:U.bg=this._updateAttrColor(U.bg,K[1],K[3],K[4],K[5]);break;case 58:U.extended=U.extended.clone(),U.extended.underlineColor=this._updateAttrColor(U.extended.underlineColor,K[1],K[3],K[4],K[5])}return ee}_processUnderline(B,F){F.extended=F.extended.clone(),(!~B||B>5)&&(B=1),F.extended.underlineStyle=B,F.fg|=268435456,B===0&&(F.fg&=-268435457),F.updateExtended()}_processSGR0(B){B.fg=b.DEFAULT_ATTR_DATA.fg,B.bg=b.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const F=B.length;let U;const K=this._curAttrData;for(let W=0;W<F;W++)U=B.params[W],U>=30&&U<=37?(K.fg&=-50331904,K.fg|=16777216|U-30):U>=40&&U<=47?(K.bg&=-50331904,K.bg|=16777216|U-40):U>=90&&U<=97?(K.fg&=-50331904,K.fg|=16777224|U-90):U>=100&&U<=107?(K.bg&=-50331904,K.bg|=16777224|U-100):U===0?this._processSGR0(K):U===1?K.fg|=134217728:U===3?K.bg|=67108864:U===4?(K.fg|=268435456,this._processUnderline(B.hasSubParams(W)?B.getSubParams(W)[0]:1,K)):U===5?K.fg|=536870912:U===7?K.fg|=67108864:U===8?K.fg|=1073741824:U===9?K.fg|=2147483648:U===2?K.bg|=134217728:U===21?this._processUnderline(2,K):U===22?(K.fg&=-134217729,K.bg&=-134217729):U===23?K.bg&=-67108865:U===24?(K.fg&=-268435457,this._processUnderline(0,K)):U===25?K.fg&=-536870913:U===27?K.fg&=-67108865:U===28?K.fg&=-1073741825:U===29?K.fg&=2147483647:U===39?(K.fg&=-67108864,K.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):U===49?(K.bg&=-67108864,K.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):U===38||U===48||U===58?W+=this._extractColor(B,W,K):U===53?K.bg|=1073741824:U===55?K.bg&=-1073741825:U===59?(K.extended=K.extended.clone(),K.extended.underlineColor=-1,K.updateExtended()):U===100?(K.fg&=-67108864,K.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,K.bg&=-67108864,K.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",U);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const F=this._activeBuffer.y+1,U=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${F};${U}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const F=this._activeBuffer.y+1,U=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${F};${U}R`)}return!0}softReset(B){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(B){const F=B.params[0]||1;switch(F){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const U=F%2==1;return this._optionsService.options.cursorBlink=U,!0}setScrollRegion(B){const F=B.params[0]||1;let U;return(B.length<2||(U=B.params[1])>this._bufferService.rows||U===0)&&(U=this._bufferService.rows),U>F&&(this._activeBuffer.scrollTop=F-1,this._activeBuffer.scrollBottom=U-1,this._setCursor(0,0)),!0}windowOptions(B){if(!z(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const F=B.length>1?B.params[1]:0;switch(B.params[0]){case 14:F!==2&&this._onRequestWindowsOptionsReport.fire(P.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(P.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:F!==0&&F!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),F!==0&&F!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:F!==0&&F!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),F!==0&&F!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(B){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(B){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(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const F=[],U=B.split(";");for(;U.length>1;){const K=U.shift(),W=U.shift();if(/^\d+$/.exec(K)){const ee=parseInt(K);if(G(ee))if(W==="?")F.push({type:0,index:ee});else{const oe=(0,N.parseColor)(W);oe&&F.push({type:1,index:ee,color:oe})}}}return F.length&&this._onColor.fire(F),!0}setHyperlink(B){const F=B.split(";");return!(F.length<2)&&(F[1]?this._createHyperlink(F[0],F[1]):!F[0]&&this._finishHyperlink())}_createHyperlink(B,F){this._getCurrentLinkId()&&this._finishHyperlink();const U=B.split(":");let K;const W=U.findIndex((ee=>ee.startsWith("id=")));return W!==-1&&(K=U[W].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:K,uri:F}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(B,F){const U=B.split(";");for(let K=0;K<U.length&&!(F>=this._specialColors.length);++K,++F)if(U[K]==="?")this._onColor.fire([{type:0,index:this._specialColors[F]}]);else{const W=(0,N.parseColor)(U[K]);W&&this._onColor.fire([{type:1,index:this._specialColors[F],color:W}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const F=[],U=B.split(";");for(let K=0;K<U.length;++K)if(/^\d+$/.exec(U[K])){const W=parseInt(U[K]);G(W)&&F.push({type:2,index:W})}return F.length&&this._onColor.fire(F),!0}restoreFgColor(B){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(B){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(B){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,m.DEFAULT_CHARSET),!0}selectCharset(B){return B.length!==2?(this.selectDefaultCharset(),!0):(B[0]==="/"||this._charsetService.setgCharset(D[B[0]],m.CHARSETS[B[1]]||m.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,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=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new _.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let F=0;F<this._bufferService.rows;++F){const U=this._activeBuffer.ybase+this._activeBuffer.y+F,K=this._activeBuffer.lines.get(U);K&&(K.fill(B),K.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(B,F){const U=this._bufferService.buffer,K=this._optionsService.rawOptions;return(W=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${W}${d.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${U.scrollTop+1};${U.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,F){this._dirtyRowTracker.markRangeDirty(B,F)}}o.InputHandler=H;let j=class{constructor(q){this._bufferService=q,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(q){q<this.start?this.start=q:q>this.end&&(this.end=q)}markRangeDirty(q,B){q>B&&(V=q,q=B,B=V),q<this.start&&(this.start=q),B>this.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function G(q){return 0<=q&&q<256}j=u([p(0,w.IBufferService)],j)},844:(s,o)=>{function l(u){for(const p of u)p.dispose();u.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const p=this._disposables.indexOf(u);p!==-1&&this._disposables.splice(p,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){this._isDisposed||u===this._value||(this._value?.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},o.toDisposable=function(u){return{dispose:u}},o.disposeArray=l,o.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(p,d,m){this._data[p]||(this._data[p]={}),this._data[p][d]=m}get(p,d){return this._data[p]?this._data[p][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=l,o.FourKeyMap=class{constructor(){this._data=new l}set(u,p,d,m,g){this._data.get(u,p)||this._data.set(u,p,new l),this._data.get(u,p).set(d,m,g)}get(u,p,d,m){return this._data.get(u,p)?.get(d,m)}clear(){this._data.clear()}}},6114:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const l=o.isNode?"node":navigator.userAgent,u=o.isNode?"node":navigator.platform;o.isFirefox=l.includes("Firefox"),o.isLegacyEdge=l.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(l),o.getSafariVersion=function(){if(!o.isSafari)return 0;const p=l.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),o.isIpad=u==="iPad",o.isIphone=u==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),o.isLinux=u.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(l)},6106:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let l=0;o.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const p=this._getKey(u);if(p===void 0||(l=this._search(p),l===-1)||this._getKey(this._array[l])!==p)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===p);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,p){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do p(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let p=0,d=this._array.length-1;for(;d>=p;){let m=p+d>>1;const g=this._getKey(this._array[m]);if(g>u)d=m-1;else{if(!(g<u)){for(;m>0&&this._getKey(this._array[m-1])===u;)m--;return m}p=m+1}}return p}}},7226:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=l(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(g){this._idleCallback=void 0;let x=0,S=0,b=g.timeRemaining(),y=0;for(;this._i<this._tasks.length;){if(x=Date.now(),this._tasks[this._i]()||this._i++,x=Math.max(1,Date.now()-x),S=Math.max(x,S),y=g.timeRemaining(),1.5*S>y)return b-x<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-x))}ms`),void this._start();b=y}this.clear()}}class d extends p{_requestCallback(g){return setTimeout((()=>g(this._createDeadline(16))))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const x=Date.now()+g;return{timeRemaining:()=>Math.max(0,x-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(m){return requestIdleCallback(m)}_cancelCallback(m){cancelIdleCallback(m)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(m){this._queue.clear(),this._queue.enqueue(m)}flush(){this._queue.flush()}}},9282:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const u=l(643);o.updateWindowsModeWrappedState=function(p){const d=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),m=d?.get(p.cols-1),g=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);g&&m&&(g.isWrapped=m[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&m[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,m=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=m}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=u},9092:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const u=l(6349),p=l(7226),d=l(3734),m=l(8437),g=l(4634),x=l(511),S=l(643),b=l(4863),y=l(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(v,_,C){this._hasScrollback=v,this._optionsService=_,this._bufferService=C,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=m.DEFAULT_ATTR_DATA.clone(),this.savedCharset=y.DEFAULT_CHARSET,this.markers=[],this._nullCell=x.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=x.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,_){return new m.BufferLine(this._bufferService.cols,this.getNullCell(v),_)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const _=v+this._optionsService.rawOptions.scrollback;return _>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:_}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=m.DEFAULT_ATTR_DATA);let _=this._rows;for(;_--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,_){const C=this.getNullCell(m.DEFAULT_ATTR_DATA);let w=0;const A=this._getCorrectBufferLength(_);if(A>this.lines.maxLength&&(this.lines.maxLength=A),this.lines.length>0){if(this._cols<v)for(let O=0;O<this.lines.length;O++)w+=+this.lines.get(O).resize(v,C);let R=0;if(this._rows<_)for(let O=this._rows;O<_;O++)this.lines.length<_+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new m.BufferLine(v,C)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new m.BufferLine(v,C)));else for(let O=this._rows;O>_;O--)this.lines.length>_+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(A<this.lines.maxLength){const O=this.lines.length-A;O>0&&(this.lines.trimStart(O),this.ybase=Math.max(this.ybase-O,0),this.ydisp=Math.max(this.ydisp-O,0),this.savedY=Math.max(this.savedY-O,0)),this.lines.maxLength=A}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,_-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=_-1,this._isReflowEnabled&&(this._reflow(v,_),this._cols>v))for(let R=0;R<this.lines.length;R++)w+=+this.lines.get(R).resize(v,C);this._cols=v,this._rows=_,this._memoryCleanupQueue.clear(),w>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let _=0;for(;this._memoryCleanupPosition<this.lines.length;)if(_+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),_>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,_){this._cols!==v&&(v>this._cols?this._reflowLarger(v,_):this._reflowSmaller(v,_))}_reflowLarger(v,_){const C=(0,g.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(m.DEFAULT_ATTR_DATA));if(C.length>0){const w=(0,g.reflowLargerCreateNewLayout)(this.lines,C);(0,g.reflowLargerApplyNewLayout)(this.lines,w.layout),this._reflowLargerAdjustViewport(v,_,w.countRemoved)}}_reflowLargerAdjustViewport(v,_,C){const w=this.getNullCell(m.DEFAULT_ATTR_DATA);let A=C;for(;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<_&&this.lines.push(new m.BufferLine(v,w))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-C,0)}_reflowSmaller(v,_){const C=this.getNullCell(m.DEFAULT_ATTR_DATA),w=[];let A=0;for(let R=this.lines.length-1;R>=0;R--){let O=this.lines.get(R);if(!O||!O.isWrapped&&O.getTrimmedLength()<=v)continue;const N=[O];for(;O.isWrapped&&R>0;)O=this.lines.get(--R),N.unshift(O);const D=this.ybase+this.y;if(D>=R&&D<R+N.length)continue;const L=N[N.length-1].getTrimmedLength(),z=(0,g.reflowSmallerGetNewLineLengths)(N,this._cols,v),P=z.length-N.length;let V;V=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+P):Math.max(0,this.lines.length-this.lines.maxLength+P);const H=[];for(let U=0;U<P;U++){const K=this.getBlankLine(m.DEFAULT_ATTR_DATA,!0);H.push(K)}H.length>0&&(w.push({start:R+N.length+A,newLines:H}),A+=H.length),N.push(...H);let j=z.length-1,G=z[j];G===0&&(j--,G=z[j]);let q=N.length-P-1,B=L;for(;q>=0;){const U=Math.min(B,G);if(N[j]===void 0)break;if(N[j].copyCellsFrom(N[q],B-U,G-U,U,!0),G-=U,G===0&&(j--,G=z[j]),B-=U,B===0){q--;const K=Math.max(q,0);B=(0,g.getWrappedLineTrimmedLength)(N,K,this._cols)}}for(let U=0;U<N.length;U++)z[U]<v&&N[U].setCell(z[U],C);let F=P-V;for(;F-- >0;)this.ybase===0?this.y<_-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+A)-_&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+P,this.ybase+_-1)}if(w.length>0){const R=[],O=[];for(let j=0;j<this.lines.length;j++)O.push(this.lines.get(j));const N=this.lines.length;let D=N-1,L=0,z=w[L];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+A);let P=0;for(let j=Math.min(this.lines.maxLength-1,N+A-1);j>=0;j--)if(z&&z.start>D+P){for(let G=z.newLines.length-1;G>=0;G--)this.lines.set(j--,z.newLines[G]);j++,R.push({index:D+1,amount:z.newLines.length}),P+=z.newLines.length,z=w[++L]}else this.lines.set(j,O[D--]);let V=0;for(let j=R.length-1;j>=0;j--)R[j].index+=V,this.lines.onInsertEmitter.fire(R[j]),V+=R[j].amount;const H=Math.max(0,N+A-this.lines.maxLength);H>0&&this.lines.onTrimEmitter.fire(H)}}translateBufferLineToString(v,_,C=0,w){const A=this.lines.get(v);return A?A.translateToString(_,C,w):""}getWrappedRangeForLine(v){let _=v,C=v;for(;_>0&&this.lines.get(_).isWrapped;)_--;for(;C+1<this.lines.length&&this.lines.get(C+1).isWrapped;)C++;return{first:_,last:C}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let _=0;_<this.markers.length;_++)this.markers[_].line===v&&(this.markers[_].dispose(),this.markers.splice(_--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const _=new b.Marker(v);return this.markers.push(_),_.register(this.lines.onTrim((C=>{_.line-=C,_.line<0&&_.dispose()}))),_.register(this.lines.onInsert((C=>{_.line>=C.index&&(_.line+=C.amount)}))),_.register(this.lines.onDelete((C=>{_.line>=C.index&&_.line<C.index+C.amount&&_.dispose(),_.line>C.index&&(_.line-=C.amount)}))),_.register(_.onDispose((()=>this._removeMarker(_)))),_}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=l(3734),p=l(511),d=l(643),m=l(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let g=0;class x{constructor(b,y,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const _=y||p.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let C=0;C<b;++C)this.setCell(C,_);this.length=b}get(b){const y=this._data[3*b+0],v=2097151&y;return[this._data[3*b+1],2097152&y?this._combined[b]:v?(0,m.stringFromCodePoint)(v):"",y>>22,2097152&y?this._combined[b].charCodeAt(this._combined[b].length-1):v]}set(b,y){this._data[3*b+1]=y[d.CHAR_DATA_ATTR_INDEX],y[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=y[1],this._data[3*b+0]=2097152|b|y[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=y[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const y=this._data[3*b+0];return 2097152&y?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&y}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const y=this._data[3*b+0];return 2097152&y?this._combined[b]:2097151&y?(0,m.stringFromCodePoint)(2097151&y):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,y){return g=3*b,y.content=this._data[g+0],y.fg=this._data[g+1],y.bg=this._data[g+2],2097152&y.content&&(y.combinedData=this._combined[b]),268435456&y.bg&&(y.extended=this._extendedAttrs[b]),y}setCell(b,y){2097152&y.content&&(this._combined[b]=y.combinedData),268435456&y.bg&&(this._extendedAttrs[b]=y.extended),this._data[3*b+0]=y.content,this._data[3*b+1]=y.fg,this._data[3*b+2]=y.bg}setCellFromCodepoint(b,y,v,_){268435456&_.bg&&(this._extendedAttrs[b]=_.extended),this._data[3*b+0]=y|v<<22,this._data[3*b+1]=_.fg,this._data[3*b+2]=_.bg}addCodepointToCell(b,y,v){let _=this._data[3*b+0];2097152&_?this._combined[b]+=(0,m.stringFromCodePoint)(y):2097151&_?(this._combined[b]=(0,m.stringFromCodePoint)(2097151&_)+(0,m.stringFromCodePoint)(y),_&=-2097152,_|=2097152):_=y|4194304,v&&(_&=-12582913,_|=v<<22),this._data[3*b+0]=_}insertCells(b,y,v){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,v),y<this.length-b){const _=new p.CellData;for(let C=this.length-b-y-1;C>=0;--C)this.setCell(b+y+C,this.loadCell(b+C,_));for(let C=0;C<y;++C)this.setCell(b+C,v)}else for(let _=b;_<this.length;++_)this.setCell(_,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(b,y,v){if(b%=this.length,y<this.length-b){const _=new p.CellData;for(let C=0;C<this.length-b-y;++C)this.setCell(b+C,this.loadCell(b+y+C,_));for(let C=this.length-y;C<this.length;++C)this.setCell(C,v)}else for(let _=b;_<this.length;++_)this.setCell(_,v);b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,v),this.getWidth(b)!==0||this.hasContent(b)||this.setCellFromCodepoint(b,0,1,v)}replaceCells(b,y,v,_=!1){if(_)for(b&&this.getWidth(b-1)===2&&!this.isProtected(b-1)&&this.setCellFromCodepoint(b-1,0,1,v),y<this.length&&this.getWidth(y-1)===2&&!this.isProtected(y)&&this.setCellFromCodepoint(y,0,1,v);b<y&&b<this.length;)this.isProtected(b)||this.setCell(b,v),b++;else for(b&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,v),y<this.length&&this.getWidth(y-1)===2&&this.setCellFromCodepoint(y,0,1,v);b<y&&b<this.length;)this.setCell(b++,v)}resize(b,y){if(b===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*b;if(b>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const _=new Uint32Array(v);_.set(this._data),this._data=_}for(let _=this.length;_<b;++_)this.setCell(_,y)}else{this._data=this._data.subarray(0,v);const _=Object.keys(this._combined);for(let w=0;w<_.length;w++){const A=parseInt(_[w],10);A>=b&&delete this._combined[A]}const C=Object.keys(this._extendedAttrs);for(let w=0;w<C.length;w++){const A=parseInt(C[w],10);A>=b&&delete this._extendedAttrs[A]}}return this.length=b,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const b=new Uint32Array(this._data.length);return b.set(this._data),this._data=b,1}return 0}fill(b,y=!1){if(y)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,b);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,b)}}copyFrom(b){this.length!==b.length?this._data=new Uint32Array(b._data):this._data.set(b._data),this.length=b.length,this._combined={};for(const y in b._combined)this._combined[y]=b._combined[y];this._extendedAttrs={};for(const y in b._extendedAttrs)this._extendedAttrs[y]=b._extendedAttrs[y];this.isWrapped=b.isWrapped}clone(){const b=new x(0);b._data=new Uint32Array(this._data),b.length=this.length;for(const y in this._combined)b._combined[y]=this._combined[y];for(const y in this._extendedAttrs)b._extendedAttrs[y]=this._extendedAttrs[y];return b.isWrapped=this.isWrapped,b}getTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,y,v,_,C){const w=b._data;if(C)for(let R=_-1;R>=0;R--){for(let O=0;O<3;O++)this._data[3*(v+R)+O]=w[3*(y+R)+O];268435456&w[3*(y+R)+2]&&(this._extendedAttrs[v+R]=b._extendedAttrs[y+R])}else for(let R=0;R<_;R++){for(let O=0;O<3;O++)this._data[3*(v+R)+O]=w[3*(y+R)+O];268435456&w[3*(y+R)+2]&&(this._extendedAttrs[v+R]=b._extendedAttrs[y+R])}const A=Object.keys(b._combined);for(let R=0;R<A.length;R++){const O=parseInt(A[R],10);O>=y&&(this._combined[O-y+v]=b._combined[O])}}translateToString(b,y,v,_){y=y??0,v=v??this.length,b&&(v=Math.min(v,this.getTrimmedLength())),_&&(_.length=0);let C="";for(;y<v;){const w=this._data[3*y+0],A=2097151&w,R=2097152&w?this._combined[y]:A?(0,m.stringFromCodePoint)(A):d.WHITESPACE_CELL_CHAR;if(C+=R,_)for(let O=0;O<R.length;++O)_.push(y);y+=w>>22||1}return _&&_.push(y),C}}o.BufferLine=x},4841:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(s,o)=>{function l(u,p,d){if(p===u.length-1)return u[p].getTrimmedLength();const m=!u[p].hasContent(d-1)&&u[p].getWidth(d-1)===1,g=u[p+1].getWidth(0)===2;return m&&g?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(u,p,d,m,g){const x=[];for(let S=0;S<u.length-1;S++){let b=S,y=u.get(++b);if(!y.isWrapped)continue;const v=[u.get(S)];for(;b<u.length&&y.isWrapped;)v.push(y),y=u.get(++b);if(m>=S&&m<b){S+=v.length-1;continue}let _=0,C=l(v,_,p),w=1,A=0;for(;w<v.length;){const O=l(v,w,p),N=O-A,D=d-C,L=Math.min(N,D);v[_].copyCellsFrom(v[w],A,C,L,!1),C+=L,C===d&&(_++,C=0),A+=L,A===O&&(w++,A=0),C===0&&_!==0&&v[_-1].getWidth(d-1)===2&&(v[_].copyCellsFrom(v[_-1],d-1,C++,1,!1),v[_-1].setCell(d-1,g))}v[_].replaceCells(C,d,g);let R=0;for(let O=v.length-1;O>0&&(O>_||v[O].getTrimmedLength()===0);O--)R++;R>0&&(x.push(S+v.length-R),x.push(R)),S+=v.length-1}return x},o.reflowLargerCreateNewLayout=function(u,p){const d=[];let m=0,g=p[m],x=0;for(let S=0;S<u.length;S++)if(g===S){const b=p[++m];u.onDeleteEmitter.fire({index:S-x,amount:b}),S+=b-1,x+=b,g=p[++m]}else d.push(S);return{layout:d,countRemoved:x}},o.reflowLargerApplyNewLayout=function(u,p){const d=[];for(let m=0;m<p.length;m++)d.push(u.get(p[m]));for(let m=0;m<d.length;m++)u.set(m,d[m]);u.length=p.length},o.reflowSmallerGetNewLineLengths=function(u,p,d){const m=[],g=u.map(((y,v)=>l(u,v,p))).reduce(((y,v)=>y+v));let x=0,S=0,b=0;for(;b<g;){if(g-b<d){m.push(g-b);break}x+=d;const y=l(u,S,p);x>y&&(x-=y,S++);const v=u[S].getWidth(x-1)===2;v&&x--;const _=v?d-1:d;m.push(_),b+=_}return m},o.getWrappedLineTrimmedLength=l},5295:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=l(8460),p=l(844),d=l(9092);class m extends p.Disposable{constructor(x,S){super(),this._optionsService=x,this._bufferService=S,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(x){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(x),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(x,S){this._normal.resize(x,S),this._alt.resize(x,S),this.setupTabStops(x)}setupTabStops(x){this._normal.setupTabStops(x),this._alt.setupTabStops(x)}}o.BufferSet=m},511:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=l(482),p=l(643),d=l(3734);class m extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(x){const S=new m;return S.setFromCharData(x),S}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(x){this.fg=x[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let S=!1;if(x[p.CHAR_DATA_CHAR_INDEX].length>2)S=!0;else if(x[p.CHAR_DATA_CHAR_INDEX].length===2){const b=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const y=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=y&&y<=57343?this.content=1024*(b-55296)+y-56320+65536|x[p.CHAR_DATA_WIDTH_INDEX]<<22:S=!0}else S=!0}else this.content=x[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|x[p.CHAR_DATA_WIDTH_INDEX]<<22;S&&(this.combinedData=x[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|x[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=m},643:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const u=l(8460),p=l(844);class d{get id(){return this._id}constructor(g){this.line=g,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(g){return this._disposables.push(g),g}}o.Marker=d,d._nextId=1},7116:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[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:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(s,o)=>{var l,u,p;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
42
42
  `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(o.C0=l={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(u||(o.C1=u={})),(function(d){d.ST=`${l.ESC}\\`})(p||(o.C1_ESCAPED=p={}))},7399:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=l(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(d,m,g,x){const S={type:0,cancel:!1,key:void 0},b=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?S.key=m?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?S.key=m?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?S.key=m?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(S.key=m?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:S.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(S.key=u.C0.ESC+S.key);break;case 9:if(d.shiftKey){S.key=u.C0.ESC+"[Z";break}S.key=u.C0.HT,S.cancel=!0;break;case 13:S.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,S.cancel=!0;break;case 27:S.key=u.C0.ESC,d.altKey&&(S.key=u.C0.ESC+u.C0.ESC),S.cancel=!0;break;case 37:if(d.metaKey)break;b?(S.key=u.C0.ESC+"[1;"+(b+1)+"D",S.key===u.C0.ESC+"[1;3D"&&(S.key=u.C0.ESC+(g?"b":"[1;5D"))):S.key=m?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;b?(S.key=u.C0.ESC+"[1;"+(b+1)+"C",S.key===u.C0.ESC+"[1;3C"&&(S.key=u.C0.ESC+(g?"f":"[1;5C"))):S.key=m?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;b?(S.key=u.C0.ESC+"[1;"+(b+1)+"A",g||S.key!==u.C0.ESC+"[1;3A"||(S.key=u.C0.ESC+"[1;5A")):S.key=m?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;b?(S.key=u.C0.ESC+"[1;"+(b+1)+"B",g||S.key!==u.C0.ESC+"[1;3B"||(S.key=u.C0.ESC+"[1;5B")):S.key=m?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(S.key=u.C0.ESC+"[2~");break;case 46:S.key=b?u.C0.ESC+"[3;"+(b+1)+"~":u.C0.ESC+"[3~";break;case 36:S.key=b?u.C0.ESC+"[1;"+(b+1)+"H":m?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:S.key=b?u.C0.ESC+"[1;"+(b+1)+"F":m?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?S.type=2:d.ctrlKey?S.key=u.C0.ESC+"[5;"+(b+1)+"~":S.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?S.type=3:d.ctrlKey?S.key=u.C0.ESC+"[6;"+(b+1)+"~":S.key=u.C0.ESC+"[6~";break;case 112:S.key=b?u.C0.ESC+"[1;"+(b+1)+"P":u.C0.ESC+"OP";break;case 113:S.key=b?u.C0.ESC+"[1;"+(b+1)+"Q":u.C0.ESC+"OQ";break;case 114:S.key=b?u.C0.ESC+"[1;"+(b+1)+"R":u.C0.ESC+"OR";break;case 115:S.key=b?u.C0.ESC+"[1;"+(b+1)+"S":u.C0.ESC+"OS";break;case 116:S.key=b?u.C0.ESC+"[15;"+(b+1)+"~":u.C0.ESC+"[15~";break;case 117:S.key=b?u.C0.ESC+"[17;"+(b+1)+"~":u.C0.ESC+"[17~";break;case 118:S.key=b?u.C0.ESC+"[18;"+(b+1)+"~":u.C0.ESC+"[18~";break;case 119:S.key=b?u.C0.ESC+"[19;"+(b+1)+"~":u.C0.ESC+"[19~";break;case 120:S.key=b?u.C0.ESC+"[20;"+(b+1)+"~":u.C0.ESC+"[20~";break;case 121:S.key=b?u.C0.ESC+"[21;"+(b+1)+"~":u.C0.ESC+"[21~";break;case 122:S.key=b?u.C0.ESC+"[23;"+(b+1)+"~":u.C0.ESC+"[23~";break;case 123:S.key=b?u.C0.ESC+"[24;"+(b+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(g&&!x||!d.altKey||d.metaKey)!g||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?S.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(S.key=u.C0.US),d.key==="@"&&(S.key=u.C0.NUL)):d.keyCode===65&&(S.type=1);else{const y=p[d.keyCode],v=y?.[d.shiftKey?1:0];if(v)S.key=u.C0.ESC+v;else if(d.keyCode>=65&&d.keyCode<=90){const _=d.ctrlKey?d.keyCode-64:d.keyCode+32;let C=String.fromCharCode(_);d.shiftKey&&(C=C.toUpperCase()),S.key=u.C0.ESC+C}else if(d.keyCode===32)S.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let _=d.code.slice(3,4);d.shiftKey||(_=_.toLowerCase()),S.key=u.C0.ESC+_,S.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?S.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?S.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?S.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?S.key=u.C0.DEL:d.keyCode===219?S.key=u.C0.ESC:d.keyCode===220?S.key=u.C0.FS:d.keyCode===221&&(S.key=u.C0.GS)}return S}},482:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},o.utf32ToString=function(l,u=0,p=l.length){let d="";for(let m=u;m<p;++m){let g=l[m];g>65535?(g-=65536,d+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):d+=String.fromCharCode(g)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const p=l.length;if(!p)return 0;let d=0,m=0;if(this._interim){const g=l.charCodeAt(m++);56320<=g&&g<=57343?u[d++]=1024*(this._interim-55296)+g-56320+65536:(u[d++]=this._interim,u[d++]=g),this._interim=0}for(let g=m;g<p;++g){const x=l.charCodeAt(g);if(55296<=x&&x<=56319){if(++g>=p)return this._interim=x,d;const S=l.charCodeAt(g);56320<=S&&S<=57343?u[d++]=1024*(x-55296)+S-56320+65536:(u[d++]=x,u[d++]=S)}else x!==65279&&(u[d++]=x)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const p=l.length;if(!p)return 0;let d,m,g,x,S=0,b=0,y=0;if(this.interim[0]){let C=!1,w=this.interim[0];w&=(224&w)==192?31:(240&w)==224?15:7;let A,R=0;for(;(A=63&this.interim[++R])&&R<4;)w<<=6,w|=A;const O=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,N=O-R;for(;y<N;){if(y>=p)return 0;if(A=l[y++],(192&A)!=128){y--,C=!0;break}this.interim[R++]=A,w<<=6,w|=63&A}C||(O===2?w<128?y--:u[S++]=w:O===3?w<2048||w>=55296&&w<=57343||w===65279||(u[S++]=w):w<65536||w>1114111||(u[S++]=w)),this.interim.fill(0)}const v=p-4;let _=y;for(;_<p;){for(;!(!(_<v)||128&(d=l[_])||128&(m=l[_+1])||128&(g=l[_+2])||128&(x=l[_+3]));)u[S++]=d,u[S++]=m,u[S++]=g,u[S++]=x,_+=4;if(d=l[_++],d<128)u[S++]=d;else if((224&d)==192){if(_>=p)return this.interim[0]=d,S;if(m=l[_++],(192&m)!=128){_--;continue}if(b=(31&d)<<6|63&m,b<128){_--;continue}u[S++]=b}else if((240&d)==224){if(_>=p)return this.interim[0]=d,S;if(m=l[_++],(192&m)!=128){_--;continue}if(_>=p)return this.interim[0]=d,this.interim[1]=m,S;if(g=l[_++],(192&g)!=128){_--;continue}if(b=(15&d)<<12|(63&m)<<6|63&g,b<2048||b>=55296&&b<=57343||b===65279)continue;u[S++]=b}else if((248&d)==240){if(_>=p)return this.interim[0]=d,S;if(m=l[_++],(192&m)!=128){_--;continue}if(_>=p)return this.interim[0]=d,this.interim[1]=m,S;if(g=l[_++],(192&g)!=128){_--;continue}if(_>=p)return this.interim[0]=d,this.interim[1]=m,this.interim[2]=g,S;if(x=l[_++],(192&x)!=128){_--;continue}if(b=(7&d)<<18|(63&m)<<12|(63&g)<<6|63&x,b<65536||b>1114111)continue;u[S++]=b}}return S}}},225:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=l(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],d=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let m;o.UnicodeV6=class{constructor(){if(this.version="6",!m){m=new Uint8Array(65536),m.fill(1),m[0]=0,m.fill(0,1,32),m.fill(0,127,160),m.fill(2,4352,4448),m[9001]=2,m[9002]=2,m.fill(2,11904,42192),m[12351]=1,m.fill(2,44032,55204),m.fill(2,63744,64256),m.fill(2,65040,65050),m.fill(2,65072,65136),m.fill(2,65280,65377),m.fill(2,65504,65511);for(let g=0;g<p.length;++g)m.fill(0,p[g][0],p[g][1]+1)}}wcwidth(g){return g<32?0:g<127?1:g<65536?m[g]:(function(x,S){let b,y=0,v=S.length-1;if(x<S[0][0]||x>S[v][1])return!1;for(;v>=y;)if(b=y+v>>1,x>S[b][1])y=b+1;else{if(!(x<S[b][0]))return!0;v=b-1}return!1})(g,d)?0:g>=131072&&g<=196605||g>=196608&&g<=262141?2:1}charProperties(g,x){let S=this.wcwidth(g),b=S===0&&x!==0;if(b){const y=u.UnicodeService.extractWidth(x);y===0?b=!1:y>S&&(S=y)}return u.UnicodeService.createPropertyValue(0,S,b)}}},5981:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=l(8460),p=l(844);class d extends p.Disposable{constructor(g){super(),this._action=g,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(g,x){if(x!==void 0&&this._syncCalls>x)return void(this._syncCalls=0);if(this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(g,x){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(x),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=g.length,this._writeBuffer.push(g),this._callbacks.push(x)}_innerWrite(g=0,x=!0){const S=g||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],y=this._action(b,x);if(y){const _=C=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,C))):this._innerWrite(S,C);return void y.catch((C=>(queueMicrotask((()=>{throw C})),Promise.resolve(!1)))).then(_)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=d},5941:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function p(d,m){const g=d.toString(16),x=g.length<2?"0"+g:g;switch(m){case 4:return g[0];case 8:return x;case 12:return(x+x).slice(0,3);default:return x+x}}o.parseColor=function(d){if(!d)return;let m=d.toLowerCase();if(m.indexOf("rgb:")===0){m=m.slice(4);const g=l.exec(m);if(g){const x=g[1]?15:g[4]?255:g[7]?4095:65535;return[Math.round(parseInt(g[1]||g[4]||g[7]||g[10],16)/x*255),Math.round(parseInt(g[2]||g[5]||g[8]||g[11],16)/x*255),Math.round(parseInt(g[3]||g[6]||g[9]||g[12],16)/x*255)]}}else if(m.indexOf("#")===0&&(m=m.slice(1),u.exec(m)&&[3,6,9,12].includes(m.length))){const g=m.length/3,x=[0,0,0];for(let S=0;S<3;++S){const b=parseInt(m.slice(g*S,g*S+g),16);x[S]=g===1?b<<4:g===2?b:g===3?b>>4:b>>8}return x}},o.toRgbString=function(d,m=16){const[g,x,S]=d;return`rgb:${p(g,m)}/${p(x,m)}/${p(S,m)}`}},5770:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const u=l(482),p=l(8742),d=l(5770),m=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=m,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=m}registerHandler(x,S){this._handlers[x]===void 0&&(this._handlers[x]=[]);const b=this._handlers[x];return b.push(S),{dispose:()=>{const y=b.indexOf(S);y!==-1&&b.splice(y,1)}}}clearHandler(x){this._handlers[x]&&delete this._handlers[x]}setHandlerFallback(x){this._handlerFb=x}reset(){if(this._active.length)for(let x=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;x>=0;--x)this._active[x].unhook(!1);this._stack.paused=!1,this._active=m,this._ident=0}hook(x,S){if(this.reset(),this._ident=x,this._active=this._handlers[x]||m,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(x,S,b){if(this._active.length)for(let y=this._active.length-1;y>=0;y--)this._active[y].put(x,S,b);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(x,S,b))}unhook(x,S=!0){if(this._active.length){let b=!1,y=this._active.length-1,v=!1;if(this._stack.paused&&(y=this._stack.loopPosition-1,b=S,v=this._stack.fallThrough,this._stack.paused=!1),!v&&b===!1){for(;y>=0&&(b=this._active[y].unhook(x),b!==!0);y--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!1,b;y--}for(;y>=0;y--)if(b=this._active[y].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=y,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",x);this._active=m,this._ident=0}};const g=new p.Params;g.addParam(0),o.DcsHandler=class{constructor(x){this._handler=x,this._data="",this._params=g,this._hitLimit=!1}hook(x){this._params=x.length>1||x.params[0]?x.clone():g,this._data="",this._hitLimit=!1}put(x,S,b){this._hitLimit||(this._data+=(0,u.utf32ToString)(x,S,b),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(x){let S=!1;if(this._hitLimit)S=!1;else if(x&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((b=>(this._params=g,this._data="",this._hitLimit=!1,b)));return this._params=g,this._data="",this._hitLimit=!1,S}}},2015:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=l(844),p=l(8742),d=l(6242),m=l(6351);class g{constructor(y){this.table=new Uint8Array(y)}setDefault(y,v){this.table.fill(y<<4|v)}add(y,v,_,C){this.table[v<<8|y]=_<<4|C}addMany(y,v,_,C){for(let w=0;w<y.length;w++)this.table[v<<8|y[w]]=_<<4|C}}o.TransitionTable=g;const x=160;o.VT500_TRANSITION_TABLE=(function(){const b=new g(4095),y=Array.apply(null,Array(256)).map(((R,O)=>O)),v=(R,O)=>y.slice(R,O),_=v(32,127),C=v(0,24);C.push(25),C.push.apply(C,v(28,32));const w=v(0,14);let A;for(A in b.setDefault(1,0),b.addMany(_,0,2,0),w)b.addMany([24,26,153,154],A,3,0),b.addMany(v(128,144),A,3,0),b.addMany(v(144,152),A,3,0),b.add(156,A,0,0),b.add(27,A,11,1),b.add(157,A,4,8),b.addMany([152,158,159],A,0,7),b.add(155,A,11,3),b.add(144,A,11,9);return b.addMany(C,0,3,0),b.addMany(C,1,3,1),b.add(127,1,0,1),b.addMany(C,8,0,8),b.addMany(C,3,3,3),b.add(127,3,0,3),b.addMany(C,4,3,4),b.add(127,4,0,4),b.addMany(C,6,3,6),b.addMany(C,5,3,5),b.add(127,5,0,5),b.addMany(C,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(_,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(v(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(_,7,0,7),b.addMany(C,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(v(64,127),3,7,0),b.addMany(v(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(v(48,60),4,8,4),b.addMany(v(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(v(32,64),6,0,6),b.add(127,6,0,6),b.addMany(v(64,127),6,0,0),b.addMany(v(32,48),3,9,5),b.addMany(v(32,48),5,9,5),b.addMany(v(48,64),5,0,6),b.addMany(v(64,127),5,7,0),b.addMany(v(32,48),4,9,5),b.addMany(v(32,48),1,9,2),b.addMany(v(32,48),2,9,2),b.addMany(v(48,127),2,10,0),b.addMany(v(48,80),1,10,0),b.addMany(v(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(v(96,127),1,10,0),b.add(80,1,11,9),b.addMany(C,9,0,9),b.add(127,9,0,9),b.addMany(v(28,32),9,0,9),b.addMany(v(32,48),9,9,12),b.addMany(v(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(C,11,0,11),b.addMany(v(32,128),11,0,11),b.addMany(v(28,32),11,0,11),b.addMany(C,10,0,10),b.add(127,10,0,10),b.addMany(v(28,32),10,0,10),b.addMany(v(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(v(32,48),10,9,12),b.addMany(C,12,0,12),b.add(127,12,0,12),b.addMany(v(28,32),12,0,12),b.addMany(v(32,48),12,9,12),b.addMany(v(48,64),12,0,11),b.addMany(v(64,127),12,12,13),b.addMany(v(64,127),10,12,13),b.addMany(v(64,127),9,12,13),b.addMany(C,13,13,13),b.addMany(_,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(x,0,2,0),b.add(x,8,5,8),b.add(x,6,0,6),b.add(x,11,0,11),b.add(x,13,13,13),b})();class S extends u.Disposable{constructor(y=o.VT500_TRANSITION_TABLE){super(),this._transitions=y,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,_,C)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,_)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new m.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(y,v=[64,126]){let _=0;if(y.prefix){if(y.prefix.length>1)throw new Error("only one byte as prefix supported");if(_=y.prefix.charCodeAt(0),_&&60>_||_>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(y.intermediates){if(y.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let w=0;w<y.intermediates.length;++w){const A=y.intermediates.charCodeAt(w);if(32>A||A>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");_<<=8,_|=A}}if(y.final.length!==1)throw new Error("final must be a single byte");const C=y.final.charCodeAt(0);if(v[0]>C||C>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return _<<=8,_|=C,_}identToString(y){const v=[];for(;y;)v.push(String.fromCharCode(255&y)),y>>=8;return v.reverse().join("")}setPrintHandler(y){this._printHandler=y}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(y,v){const _=this._identifier(y,[48,126]);this._escHandlers[_]===void 0&&(this._escHandlers[_]=[]);const C=this._escHandlers[_];return C.push(v),{dispose:()=>{const w=C.indexOf(v);w!==-1&&C.splice(w,1)}}}clearEscHandler(y){this._escHandlers[this._identifier(y,[48,126])]&&delete this._escHandlers[this._identifier(y,[48,126])]}setEscHandlerFallback(y){this._escHandlerFb=y}setExecuteHandler(y,v){this._executeHandlers[y.charCodeAt(0)]=v}clearExecuteHandler(y){this._executeHandlers[y.charCodeAt(0)]&&delete this._executeHandlers[y.charCodeAt(0)]}setExecuteHandlerFallback(y){this._executeHandlerFb=y}registerCsiHandler(y,v){const _=this._identifier(y);this._csiHandlers[_]===void 0&&(this._csiHandlers[_]=[]);const C=this._csiHandlers[_];return C.push(v),{dispose:()=>{const w=C.indexOf(v);w!==-1&&C.splice(w,1)}}}clearCsiHandler(y){this._csiHandlers[this._identifier(y)]&&delete this._csiHandlers[this._identifier(y)]}setCsiHandlerFallback(y){this._csiHandlerFb=y}registerDcsHandler(y,v){return this._dcsParser.registerHandler(this._identifier(y),v)}clearDcsHandler(y){this._dcsParser.clearHandler(this._identifier(y))}setDcsHandlerFallback(y){this._dcsParser.setHandlerFallback(y)}registerOscHandler(y,v){return this._oscParser.registerHandler(y,v)}clearOscHandler(y){this._oscParser.clearHandler(y)}setOscHandlerFallback(y){this._oscParser.setHandlerFallback(y)}setErrorHandler(y){this._errorHandler=y}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(y,v,_,C,w){this._parseStack.state=y,this._parseStack.handlers=v,this._parseStack.handlerPos=_,this._parseStack.transition=C,this._parseStack.chunkPos=w}parse(y,v,_){let C,w=0,A=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(_===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const O=this._parseStack.handlers;let N=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(_===!1&&N>-1){for(;N>=0&&(C=O[N](this._params),C!==!0);N--)if(C instanceof Promise)return this._parseStack.handlerPos=N,C}this._parseStack.handlers=[];break;case 4:if(_===!1&&N>-1){for(;N>=0&&(C=O[N](),C!==!0);N--)if(C instanceof Promise)return this._parseStack.handlerPos=N,C}this._parseStack.handlers=[];break;case 6:if(w=y[this._parseStack.chunkPos],C=this._dcsParser.unhook(w!==24&&w!==26,_),C)return C;w===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(w=y[this._parseStack.chunkPos],C=this._oscParser.end(w!==24&&w!==26,_),C)return C;w===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let O=R;O<v;++O){switch(w=y[O],A=this._transitions.table[this.currentState<<8|(w<160?w:x)],A>>4){case 2:for(let P=O+1;;++P){if(P>=v||(w=y[P])<32||w>126&&w<x){this._printHandler(y,O,P),O=P-1;break}if(++P>=v||(w=y[P])<32||w>126&&w<x){this._printHandler(y,O,P),O=P-1;break}if(++P>=v||(w=y[P])<32||w>126&&w<x){this._printHandler(y,O,P),O=P-1;break}if(++P>=v||(w=y[P])<32||w>126&&w<x){this._printHandler(y,O,P),O=P-1;break}}break;case 3:this._executeHandlers[w]?this._executeHandlers[w]():this._executeHandlerFb(w),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:O,code:w,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const N=this._csiHandlers[this._collect<<8|w];let D=N?N.length-1:-1;for(;D>=0&&(C=N[D](this._params),C!==!0);D--)if(C instanceof Promise)return this._preserveStack(3,N,D,A,O),C;D<0&&this._csiHandlerFb(this._collect<<8|w,this._params),this.precedingJoinState=0;break;case 8:do switch(w){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(w-48)}while(++O<v&&(w=y[O])>47&&w<60);O--;break;case 9:this._collect<<=8,this._collect|=w;break;case 10:const L=this._escHandlers[this._collect<<8|w];let z=L?L.length-1:-1;for(;z>=0&&(C=L[z](),C!==!0);z--)if(C instanceof Promise)return this._preserveStack(4,L,z,A,O),C;z<0&&this._escHandlerFb(this._collect<<8|w),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|w,this._params);break;case 13:for(let P=O+1;;++P)if(P>=v||(w=y[P])===24||w===26||w===27||w>127&&w<x){this._dcsParser.put(y,O,P),O=P-1;break}break;case 14:if(C=this._dcsParser.unhook(w!==24&&w!==26),C)return this._preserveStack(6,[],0,A,O),C;w===27&&(A|=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 P=O+1;;P++)if(P>=v||(w=y[P])<32||w>127&&w<x){this._oscParser.put(y,O,P),O=P-1;break}break;case 6:if(C=this._oscParser.end(w!==24&&w!==26),C)return this._preserveStack(5,[],0,A,O),C;w===27&&(A|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&A}}}o.EscapeSequenceParser=S},6242:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=l(5770),p=l(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(m,g){this._handlers[m]===void 0&&(this._handlers[m]=[]);const x=this._handlers[m];return x.push(g),{dispose:()=>{const S=x.indexOf(g);S!==-1&&x.splice(S,1)}}}clearHandler(m){this._handlers[m]&&delete this._handlers[m]}setHandlerFallback(m){this._handlerFb=m}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let m=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;m>=0;--m)this._active[m].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let m=this._active.length-1;m>=0;m--)this._active[m].start();else this._handlerFb(this._id,"START")}_put(m,g,x){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(m,g,x);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(m,g,x))}start(){this.reset(),this._state=1}put(m,g,x){if(this._state!==3){if(this._state===1)for(;g<x;){const S=m[g++];if(S===59){this._state=2,this._start();break}if(S<48||57<S)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+S-48}this._state===2&&x-g>0&&this._put(m,g,x)}}end(m,g=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let x=!1,S=this._active.length-1,b=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,x=g,b=this._stack.fallThrough,this._stack.paused=!1),!b&&x===!1){for(;S>=0&&(x=this._active[S].end(m),x!==!0);S--)if(x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,x;S--}for(;S>=0;S--)if(x=this._active[S].end(!1),x instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,x}else this._handlerFb(this._id,"END",m);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(m){this._handler=m,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(m,g,x){this._hitLimit||(this._data+=(0,p.utf32ToString)(m,g,x),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(m){let g=!1;if(this._hitLimit)g=!1;else if(m&&(g=this._handler(this._data),g instanceof Promise))return g.then((x=>(this._data="",this._hitLimit=!1,x)));return this._data="",this._hitLimit=!1,g}}},8742:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const l=2147483647;class u{static fromArray(d){const m=new u;if(!d.length)return m;for(let g=Array.isArray(d[0])?1:0;g<d.length;++g){const x=d[g];if(Array.isArray(x))for(let S=0;S<x.length;++S)m.addSubParam(x[S]);else m.addParam(x)}return m}constructor(d=32,m=32){if(this.maxLength=d,this.maxSubParamsLength=m,m>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(m),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let m=0;m<this.length;++m){d.push(this.params[m]);const g=this._subParamsIdx[m]>>8,x=255&this._subParamsIdx[m];x-g>0&&d.push(Array.prototype.slice.call(this._subParams,g,x))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const m=this._subParamsIdx[d]>>8,g=255&this._subParamsIdx[d];return g-m>0?this._subParams.subarray(m,g):null}getSubParamsAll(){const d={};for(let m=0;m<this.length;++m){const g=this._subParamsIdx[m]>>8,x=255&this._subParamsIdx[m];x-g>0&&(d[m]=this._subParams.slice(g,x))}return d}addDigit(d){let m;if(this._rejectDigits||!(m=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const g=this._digitIsSub?this._subParams:this.params,x=g[m-1];g[m-1]=~x?Math.min(10*x+d,l):d}}o.Params=u},5741:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const p={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(p),u.dispose=()=>this._wrappedAddonDispose(p),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let p=0;p<this._addons.length;p++)if(this._addons[p]===l){u=p;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const u=l(3785),p=l(511);o.BufferApiView=class{constructor(d,m){this._buffer=d,this.type=m}init(d){return this._buffer=d,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(d){const m=this._buffer.lines.get(d);if(m)return new u.BufferLineApiView(m)}getNullCell(){return new p.CellData}}},3785:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=l(511);o.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,d){if(!(p<0||p>=this._line.length))return d?(this._line.loadCell(p,d),d):this._line.loadCell(p,new u.CellData)}translateToString(p,d,m){return this._line.translateToString(p,d,m)}}},8285:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=l(8771),p=l(8460),d=l(844);class m extends d.Disposable{constructor(x){super(),this._core=x,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=m},7975:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(p=>u(p.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((p,d)=>u(p,d.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(s,o,l){var u=this&&this.__decorate||function(b,y,v,_){var C,w=arguments.length,A=w<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,v):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,y,v,_);else for(var R=b.length-1;R>=0;R--)(C=b[R])&&(A=(w<3?C(A):w>3?C(y,v,A):C(y,v))||A);return w>3&&A&&Object.defineProperty(y,v,A),A},p=this&&this.__param||function(b,y){return function(v,_){y(v,_,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=l(8460),m=l(844),g=l(5295),x=l(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let S=o.BufferService=class extends m.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new g.BufferSet(b,this))}resize(b,y){this.cols=b,this.rows=y,this.buffers.resize(b,y),this._onResize.fire({cols:b,rows:y})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,y=!1){const v=this.buffer;let _;_=this._cachedBlankLine,_&&_.length===this.cols&&_.getFg(0)===b.fg&&_.getBg(0)===b.bg||(_=v.getBlankLine(b,y),this._cachedBlankLine=_),_.isWrapped=y;const C=v.ybase+v.scrollTop,w=v.ybase+v.scrollBottom;if(v.scrollTop===0){const A=v.lines.isFull;w===v.lines.length-1?A?v.lines.recycle().copyFrom(_):v.lines.push(_.clone()):v.lines.splice(w+1,0,_.clone()),A?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const A=w-C+1;v.lines.shiftElements(C+1,A-1,-1),v.lines.set(w,_.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(b,y,v){const _=this.buffer;if(b<0){if(_.ydisp===0)return;this.isUserScrolling=!0}else b+_.ydisp>=_.ybase&&(this.isUserScrolling=!1);const C=_.ydisp;_.ydisp=Math.max(Math.min(_.ydisp+b,_.ybase),0),C!==_.ydisp&&(y||this._onScroll.fire(_.ydisp))}};o.BufferService=S=u([p(0,x.IOptionsService)],S)},7994:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(s,o,l){var u=this&&this.__decorate||function(_,C,w,A){var R,O=arguments.length,N=O<3?C:A===null?A=Object.getOwnPropertyDescriptor(C,w):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(_,C,w,A);else for(var D=_.length-1;D>=0;D--)(R=_[D])&&(N=(O<3?R(N):O>3?R(C,w,N):R(C,w))||N);return O>3&&N&&Object.defineProperty(C,w,N),N},p=this&&this.__param||function(_,C){return function(w,A){C(w,A,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=l(2585),m=l(8460),g=l(844),x={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:_=>_.button!==4&&_.action===1&&(_.ctrl=!1,_.alt=!1,_.shift=!1,!0)},VT200:{events:19,restrict:_=>_.action!==32},DRAG:{events:23,restrict:_=>_.action!==32||_.button!==3},ANY:{events:31,restrict:_=>!0}};function S(_,C){let w=(_.ctrl?16:0)|(_.shift?4:0)|(_.alt?8:0);return _.button===4?(w|=64,w|=_.action):(w|=3&_.button,4&_.button&&(w|=64),8&_.button&&(w|=128),_.action===32?w|=32:_.action!==0||C||(w|=3)),w}const b=String.fromCharCode,y={DEFAULT:_=>{const C=[S(_,!1)+32,_.col+32,_.row+32];return C[0]>255||C[1]>255||C[2]>255?"":`\x1B[M${b(C[0])}${b(C[1])}${b(C[2])}`},SGR:_=>{const C=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${S(_,!0)};${_.col};${_.row}${C}`},SGR_PIXELS:_=>{const C=_.action===0&&_.button!==4?"m":"M";return`\x1B[<${S(_,!0)};${_.x};${_.y}${C}`}};let v=o.CoreMouseService=class extends g.Disposable{constructor(_,C){super(),this._bufferService=_,this._coreService=C,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new m.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const w of Object.keys(x))this.addProtocol(w,x[w]);for(const w of Object.keys(y))this.addEncoding(w,y[w]);this.reset()}addProtocol(_,C){this._protocols[_]=C}addEncoding(_,C){this._encodings[_]=C}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(_){if(!this._protocols[_])throw new Error(`unknown protocol "${_}"`);this._activeProtocol=_,this._onProtocolChange.fire(this._protocols[_].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(_){if(!this._encodings[_])throw new Error(`unknown encoding "${_}"`);this._activeEncoding=_}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(_){if(_.col<0||_.col>=this._bufferService.cols||_.row<0||_.row>=this._bufferService.rows||_.button===4&&_.action===32||_.button===3&&_.action!==32||_.button!==4&&(_.action===2||_.action===3)||(_.col++,_.row++,_.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,_,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(_))return!1;const C=this._encodings[this._activeEncoding](_);return C&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(C):this._coreService.triggerDataEvent(C,!0)),this._lastEvent=_,!0}explainEvents(_){return{down:!!(1&_),up:!!(2&_),drag:!!(4&_),move:!!(8&_),wheel:!!(16&_)}}_equalEvents(_,C,w){if(w){if(_.x!==C.x||_.y!==C.y)return!1}else if(_.col!==C.col||_.row!==C.row)return!1;return _.button===C.button&&_.action===C.action&&_.ctrl===C.ctrl&&_.alt===C.alt&&_.shift===C.shift}};o.CoreMouseService=v=u([p(0,d.IBufferService),p(1,d.ICoreService)],v)},6975:function(s,o,l){var u=this&&this.__decorate||function(v,_,C,w){var A,R=arguments.length,O=R<3?_:w===null?w=Object.getOwnPropertyDescriptor(_,C):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,_,C,w);else for(var N=v.length-1;N>=0;N--)(A=v[N])&&(O=(R<3?A(O):R>3?A(_,C,O):A(_,C))||O);return R>3&&O&&Object.defineProperty(_,C,O),O},p=this&&this.__param||function(v,_){return function(C,w){_(C,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=l(1439),m=l(8460),g=l(844),x=l(2585),S=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let y=o.CoreService=class extends g.Disposable{constructor(v,_,C){super(),this._bufferService=v,this._logService=_,this._optionsService=C,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new m.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new m.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new m.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new m.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(b)}reset(){this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(b)}triggerDataEvent(v,_=!1){if(this._optionsService.rawOptions.disableStdin)return;const C=this._bufferService.buffer;_&&this._optionsService.rawOptions.scrollOnUserInput&&C.ybase!==C.ydisp&&this._onRequestScrollToBottom.fire(),_&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((w=>w.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((_=>_.charCodeAt(0))))),this._onBinary.fire(v))}};o.CoreService=y=u([p(0,x.IBufferService),p(1,x.ILogService),p(2,x.IOptionsService)],y)},9074:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=l(8055),p=l(8460),d=l(844),m=l(6106);let g=0,x=0;class S extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new m.SortedList((v=>v?.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const _=new b(v);if(_){const C=_.marker.onDispose((()=>_.dispose()));_.onDispose((()=>{_&&(this._decorations.delete(_)&&this._onDecorationRemoved.fire(_),C.dispose())})),this._decorations.insert(_),this._onDecorationRegistered.fire(_)}return _}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,_,C){let w=0,A=0;for(const R of this._decorations.getKeyIterator(_))w=R.options.x??0,A=w+(R.options.width??1),v>=w&&v<A&&(!C||(R.options.layer??"bottom")===C)&&(yield R)}forEachDecorationAtCell(v,_,C,w){this._decorations.forEachByKey(_,(A=>{g=A.options.x??0,x=g+(A.options.width??1),v>=g&&v<x&&(!C||(A.options.layer??"bottom")===C)&&w(A)}))}}o.DecorationService=S;class b extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new p.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new p.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const u=l(2585),p=l(8343);class d{constructor(...g){this._entries=new Map;for(const[x,S]of g)this.set(x,S)}set(g,x){const S=this._entries.get(g);return this._entries.set(g,x),S}forEach(g){for(const[x,S]of this._entries.entries())g(x,S)}has(g){return this._entries.has(g)}get(g){return this._entries.get(g)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(m,g){this._services.set(m,g)}getService(m){return this._services.get(m)}createInstance(m,...g){const x=(0,p.getServiceDependencies)(m).sort(((y,v)=>y.index-v.index)),S=[];for(const y of x){const v=this._services.get(y.id);if(!v)throw new Error(`[createInstance] ${m.name} depends on UNKNOWN service ${y.id}.`);S.push(v)}const b=x.length>0?x[0].index:g.length;if(g.length!==b)throw new Error(`[createInstance] First service dependency of ${m.name} at position ${b+1} conflicts with ${g.length} static arguments`);return new m(...g,...S)}}},7866:function(s,o,l){var u=this&&this.__decorate||function(b,y,v,_){var C,w=arguments.length,A=w<3?y:_===null?_=Object.getOwnPropertyDescriptor(y,v):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,y,v,_);else for(var R=b.length-1;R>=0;R--)(C=b[R])&&(A=(w<3?C(A):w>3?C(y,v,A):C(y,v))||A);return w>3&&A&&Object.defineProperty(y,v,A),A},p=this&&this.__param||function(b,y){return function(v,_){y(v,_,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=l(844),m=l(2585),g={trace:m.LogLevelEnum.TRACE,debug:m.LogLevelEnum.DEBUG,info:m.LogLevelEnum.INFO,warn:m.LogLevelEnum.WARN,error:m.LogLevelEnum.ERROR,off:m.LogLevelEnum.OFF};let x,S=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=m.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),x=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let y=0;y<b.length;y++)typeof b[y]=="function"&&(b[y]=b[y]())}_log(b,y,v){this._evalLazyOptionalParams(v),b.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+y,...v)}trace(b,...y){this._logLevel<=m.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,b,y)}debug(b,...y){this._logLevel<=m.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,b,y)}info(b,...y){this._logLevel<=m.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,b,y)}warn(b,...y){this._logLevel<=m.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,b,y)}error(b,...y){this._logLevel<=m.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,b,y)}};o.LogService=S=u([p(0,m.IOptionsService)],S),o.setTraceLogger=function(b){x=b},o.traceCall=function(b,y,v){if(typeof v.value!="function")throw new Error("not supported");const _=v.value;v.value=function(...C){if(x.logLevel!==m.LogLevelEnum.TRACE)return _.apply(this,C);x.trace(`GlyphRenderer#${_.name}(${C.map((A=>JSON.stringify(A))).join(", ")})`);const w=_.apply(this,C);return x.trace(`GlyphRenderer#${_.name} return`,w),w}}},7302:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=l(8460),p=l(844),d=l(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const m=["normal","bold","100","200","300","400","500","600","700","800","900"];class g extends p.Disposable{constructor(S){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...o.DEFAULT_OPTIONS};for(const y in S)if(y in b)try{const v=S[y];b[y]=this._sanitizeAndValidateOption(y,v)}catch(v){console.error(v)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,b){return this.onOptionChange((y=>{y===S&&b(this.rawOptions[S])}))}onMultipleOptionChange(S,b){return this.onOptionChange((y=>{S.indexOf(y)!==-1&&b()}))}_setupOptions(){const S=y=>{if(!(y in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);return this.rawOptions[y]},b=(y,v)=>{if(!(y in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${y}"`);v=this._sanitizeAndValidateOption(y,v),this.rawOptions[y]!==v&&(this.rawOptions[y]=v,this._onOptionChange.fire(y))};for(const y in this.rawOptions){const v={get:S.bind(this,y),set:b.bind(this,y)};Object.defineProperty(this.options,y,v)}}_sanitizeAndValidateOption(S,b){switch(S){case"cursorStyle":if(b||(b=o.DEFAULT_OPTIONS[S]),!(function(y){return y==="block"||y==="underline"||y==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${S}`);break;case"wordSeparator":b||(b=o.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=m.includes(b)?b:o.DEFAULT_OPTIONS[S];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${S} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${S} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}o.OptionsService=g},2660:function(s,o,l){var u=this&&this.__decorate||function(g,x,S,b){var y,v=arguments.length,_=v<3?x:b===null?b=Object.getOwnPropertyDescriptor(x,S):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")_=Reflect.decorate(g,x,S,b);else for(var C=g.length-1;C>=0;C--)(y=g[C])&&(_=(v<3?y(_):v>3?y(x,S,_):y(x,S))||_);return v>3&&_&&Object.defineProperty(x,S,_),_},p=this&&this.__param||function(g,x){return function(S,b){x(S,b,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=l(2585);let m=o.OscLinkService=class{constructor(g){this._bufferService=g,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(g){const x=this._bufferService.buffer;if(g.id===void 0){const C=x.addMarker(x.ybase+x.y),w={data:g,id:this._nextId++,lines:[C]};return C.onDispose((()=>this._removeMarkerFromLink(w,C))),this._dataByLinkId.set(w.id,w),w.id}const S=g,b=this._getEntryIdKey(S),y=this._entriesWithId.get(b);if(y)return this.addLineToLink(y.id,x.ybase+x.y),y.id;const v=x.addMarker(x.ybase+x.y),_={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(_,v))),this._entriesWithId.set(_.key,_),this._dataByLinkId.set(_.id,_),_.id}addLineToLink(g,x){const S=this._dataByLinkId.get(g);if(S&&S.lines.every((b=>b.line!==x))){const b=this._bufferService.buffer.addMarker(x);S.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(S,b)))}}getLinkData(g){return this._dataByLinkId.get(g)?.data}_getEntryIdKey(g){return`${g.id};;${g.uri}`}_removeMarkerFromLink(g,x){const S=g.lines.indexOf(x);S!==-1&&(g.lines.splice(S,1),g.lines.length===0&&(g.data.id!==void 0&&this._entriesWithId.delete(g.key),this._dataByLinkId.delete(g.id)))}};o.OscLinkService=m=u([p(0,d.IBufferService)],m)},8343:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const l="di$target",u="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(p){return p[u]||[]},o.createDecorator=function(p){if(o.serviceRegistry.has(p))return o.serviceRegistry.get(p);const d=function(m,g,x){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,b,y){b[l]===b?b[u].push({id:S,index:y}):(b[u]=[{id:S,index:y}],b[l]=b)})(d,m,x)};return d.toString=()=>p,o.serviceRegistry.set(p,d),d}},2585:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const u=l(8343);var p;o.IBufferService=(0,u.createDecorator)("BufferService"),o.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),o.ICoreService=(0,u.createDecorator)("CoreService"),o.ICharsetService=(0,u.createDecorator)("CharsetService"),o.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(p||(o.LogLevelEnum=p={})),o.ILogService=(0,u.createDecorator)("LogService"),o.IOptionsService=(0,u.createDecorator)("OptionsService"),o.IOscLinkService=(0,u.createDecorator)("OscLinkService"),o.IUnicodeService=(0,u.createDecorator)("UnicodeService"),o.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const u=l(8460),p=l(225);class d{static extractShouldJoin(g){return(1&g)!=0}static extractWidth(g){return g>>1&3}static extractCharKind(g){return g>>3}static createPropertyValue(g,x,S=!1){return(16777215&g)<<3|(3&x)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const g=new p.UnicodeV6;this.register(g),this._active=g.version,this._activeProvider=g}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(g){if(!this._providers[g])throw new Error(`unknown Unicode version "${g}"`);this._active=g,this._activeProvider=this._providers[g],this._onChange.fire(g)}register(g){this._providers[g.version]=g}wcwidth(g){return this._activeProvider.wcwidth(g)}getStringCellWidth(g){let x=0,S=0;const b=g.length;for(let y=0;y<b;++y){let v=g.charCodeAt(y);if(55296<=v&&v<=56319){if(++y>=b)return x+this.wcwidth(v);const w=g.charCodeAt(y);56320<=w&&w<=57343?v=1024*(v-55296)+w-56320+65536:x+=this.wcwidth(w)}const _=this.charProperties(v,S);let C=d.extractWidth(_);d.extractShouldJoin(_)&&(C-=d.extractWidth(S)),x+=C,S=_}return x}charProperties(g,x){return this._activeProvider.charProperties(g,x)}}o.UnicodeService=d}},r={};function i(s){var o=r[s];if(o!==void 0)return o.exports;var l=r[s]={exports:{}};return n[s].call(l.exports,l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const o=i(9042),l=i(3236),u=i(844),p=i(5741),d=i(8285),m=i(7975),g=i(7090),x=["cols","rows"];class S extends u.Disposable{constructor(y){super(),this._core=this.register(new l.Terminal(y)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const v=C=>this._core.options[C],_=(C,w)=>{this._checkReadonlyOptions(C),this._core.options[C]=w};for(const C in this._core.options){const w={get:v.bind(this,C),set:_.bind(this,C)};Object.defineProperty(this._publicOptions,C,w)}}_checkReadonlyOptions(y){if(x.includes(y))throw new Error(`Option "${y}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new m.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new g.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const y=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:y.applicationCursorKeys,applicationKeypadMode:y.applicationKeypad,bracketedPasteMode:y.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:y.origin,reverseWraparoundMode:y.reverseWraparound,sendFocusMode:y.sendFocus,wraparoundMode:y.wraparound}}get options(){return this._publicOptions}set options(y){for(const v in y)this._publicOptions[v]=y[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(y,v=!0){this._core.input(y,v)}resize(y,v){this._verifyIntegers(y,v),this._core.resize(y,v)}open(y){this._core.open(y)}attachCustomKeyEventHandler(y){this._core.attachCustomKeyEventHandler(y)}attachCustomWheelEventHandler(y){this._core.attachCustomWheelEventHandler(y)}registerLinkProvider(y){return this._core.registerLinkProvider(y)}registerCharacterJoiner(y){return this._checkProposedApi(),this._core.registerCharacterJoiner(y)}deregisterCharacterJoiner(y){this._checkProposedApi(),this._core.deregisterCharacterJoiner(y)}registerMarker(y=0){return this._verifyIntegers(y),this._core.registerMarker(y)}registerDecoration(y){return this._checkProposedApi(),this._verifyPositiveIntegers(y.x??0,y.width??0,y.height??0),this._core.registerDecoration(y)}hasSelection(){return this._core.hasSelection()}select(y,v,_){this._verifyIntegers(y,v,_),this._core.select(y,v,_)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(y,v){this._verifyIntegers(y,v),this._core.selectLines(y,v)}dispose(){super.dispose()}scrollLines(y){this._verifyIntegers(y),this._core.scrollLines(y)}scrollPages(y){this._verifyIntegers(y),this._core.scrollPages(y)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(y){this._verifyIntegers(y),this._core.scrollToLine(y)}clear(){this._core.clear()}write(y,v){this._core.write(y,v)}writeln(y,v){this._core.write(y),this._core.write(`\r
43
- `,v)}paste(y){this._core.paste(y)}refresh(y,v){this._verifyIntegers(y,v),this._core.refresh(y,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return o}_verifyIntegers(...y){for(const v of y)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const v of y)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}s.Terminal=S})(),a})()))})(f2)),f2.exports}var gse=gLe(),p2={exports:{}},wW;function bLe(){return wW||(wW=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const s=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=l-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),m=u-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-s;return{cols:Math.max(2,Math.floor(m/a.css.cell.width)),rows:Math.max(1,Math.floor(d/a.css.cell.height))}}}})(),n})()))})(p2)),p2.exports}var bse=bLe(),h2={exports:{}},CW;function vLe(){return CW||(CW=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(s,o)=>{function l(p){try{const d=new URL(p),m=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return p.toLocaleLowerCase().startsWith(m.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(p,d,m,g={}){this._terminal=p,this._regex=d,this._handler=m,this._options=g}provideLinks(p,d){const m=u.computeLink(p,this._regex,this._terminal,this._handler);d(this._addCallbacks(m))}_addCallbacks(p){return p.map((d=>(d.leave=this._options.leave,d.hover=(m,g)=>{if(this._options.hover){const{range:x}=d;this._options.hover(m,g,x)}},d)))}};class u{static computeLink(d,m,g,x){const S=new RegExp(m.source,(m.flags||"")+"g"),[b,y]=u._getWindowedLineStrings(d-1,g),v=b.join("");let _;const C=[];for(;_=S.exec(v);){const w=_[0];if(!l(w))continue;const[A,R]=u._mapStrIdx(g,y,0,_.index),[O,N]=u._mapStrIdx(g,A,R,w.length);if(A===-1||R===-1||O===-1||N===-1)continue;const D={start:{x:R+1,y:A+1},end:{x:N,y:O+1}};C.push({range:D,text:w,activate:x})}return C}static _getWindowedLineStrings(d,m){let g,x=d,S=d,b=0,y="";const v=[];if(g=m.buffer.active.getLine(d)){const _=g.translateToString(!0);if(g.isWrapped&&_[0]!==" "){for(b=0;(g=m.buffer.active.getLine(--x))&&b<2048&&(y=g.translateToString(!0),b+=y.length,v.push(y),g.isWrapped&&y.indexOf(" ")===-1););v.reverse()}for(v.push(_),b=0;(g=m.buffer.active.getLine(++S))&&g.isWrapped&&b<2048&&(y=g.translateToString(!0),b+=y.length,v.push(y),y.indexOf(" ")===-1););}return[v,x]}static _mapStrIdx(d,m,g,x){const S=d.buffer.active,b=S.getNullCell();let y=g;for(;x;){const v=S.getLine(m);if(!v)return[-1,-1];for(let _=y;_<v.length;++_){v.getCell(_,b);const C=b.getChars();if(b.getWidth()&&(x-=C.length||1,_===v.length-1&&C==="")){const w=S.getLine(m+1);w&&w.isWrapped&&(w.getCell(0,b),b.getWidth()===2&&(x+=1))}if(x<0)return[m,_]}m++,y=0}return[m,y]}}o.LinkComputer=u}},r={};function i(s){var o=r[s];if(o!==void 0)return o.exports;var l=r[s]={exports:{}};return n[s](l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.WebLinksAddon=void 0;const o=i(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(p,d){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}s.WebLinksAddon=class{constructor(p=u,d={}){this._handler=p,this._options=d}activate(p){this._terminal=p;const d=this._options,m=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,m,this._handler,d))}dispose(){this._linkProvider?.dispose()}}})(),a})()))})(h2)),h2.exports}var vse=vLe();function tC(){const[e,t]=T.useState(!1);return T.useEffect(()=>{const n=window.matchMedia("(max-width: 639px)");t(n.matches);const r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const yLe=[{label:"Esc",icon:Mr,data:"\x1B"},{label:"Up",icon:a3,data:"\x1B[A"},{label:"Down",icon:L0,data:"\x1B[B"},{label:"Tab",icon:null,data:" "},{label:"Enter",icon:null,data:"\r"}];function WE({onSend:e}){return tC()?f.jsx("div",{className:"flex shrink-0 items-center justify-center gap-2 border-t border-border bg-card px-3 py-2",children:yLe.map(n=>f.jsxs(Ae,{variant:"outline",className:"h-11 min-w-11 touch-manipulation",onClick:()=>e(n.data),children:[n.icon?f.jsx(J,{icon:n.icon,size:20,strokeWidth:2}):f.jsx("span",{className:"text-xs font-medium",children:n.label}),f.jsx("span",{className:"sr-only",children:n.label})]},n.label))}):null}const yse={background:"#faf9f5",foreground:"#2a2a27",cursor:"#2a2a27",cursorAccent:"#faf9f5",selectionBackground:"#d1d5db",black:"#2a2a27",red:"#dd403a",green:"#0d5c63",yellow:"#dd403a",blue:"#0d5c63",magenta:"#5c5c59",cyan:"#0d5c63",white:"#5c5c59",brightBlack:"#5c5c59",brightRed:"#dd403a",brightGreen:"#0d5c63",brightYellow:"#dd403a",brightBlue:"#0d5c63",brightMagenta:"#5c5c59",brightCyan:"#0d5c63",brightWhite:"#5c5c59"},xse={background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"};function oL({className:e,onReady:t,onResize:n,onContainerReady:r,terminalId:i,setupImagePaste:a,onSend:s,onFocus:o}){const l=T.useRef(null),u=T.useRef(null),p=T.useRef(null),d=T.useRef(n),m=T.useRef(o),g=T.useRef(t),x=T.useRef(r),{setTerminalFocused:S}=d3(),{resolvedTheme:b}=xp(),y=b==="dark",v=y?xse:yse;T.useEffect(()=>{d.current=n},[n]),T.useEffect(()=>{m.current=o},[o]),T.useEffect(()=>{g.current=t},[t]),T.useEffect(()=>{x.current=r},[r]);const _=T.useCallback(()=>{if(!p.current||!u.current)return;p.current.fit();const{cols:w,rows:A}=u.current;d.current?.(w,A)},[]);T.useEffect(()=>{if(!l.current||u.current)return;const w=new gse.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"monospace",theme:v,scrollback:1e4}),A=new bse.FitAddon,R=new vse.WebLinksAddon;w.loadAddon(A),w.loadAddon(R),w.open(l.current),u.current=w,p.current=A,requestAnimationFrame(()=>{_(),g.current?.(w),l.current&&x.current?.(l.current)});const O=()=>{S(!0),m.current?.()},N=()=>S(!1);w.textarea&&(w.textarea.addEventListener("focus",O),w.textarea.addEventListener("blur",N));const D=setTimeout(()=>{_(),w.refresh(0,w.rows-1)},100),L=()=>{requestAnimationFrame(_)};window.addEventListener("resize",L);const z=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{_(),w.refresh(0,w.rows-1)})};document.addEventListener("visibilitychange",z);const P=new ResizeObserver(L);P.observe(l.current);const V=new IntersectionObserver(H=>{H[0]?.isIntersecting&&requestAnimationFrame(()=>{_(),w.refresh(0,w.rows-1)})},{threshold:.1});return V.observe(l.current),()=>{clearTimeout(D),window.removeEventListener("resize",L),document.removeEventListener("visibilitychange",z),P.disconnect(),V.disconnect(),w.textarea&&(w.textarea.removeEventListener("focus",O),w.textarea.removeEventListener("blur",N)),S(!1),w.dispose(),u.current=null,p.current=null}},[_,S]),T.useEffect(()=>!l.current||!i||!a?void 0:a(l.current,i),[i,a]),T.useEffect(()=>{u.current&&(u.current.options.theme=v)},[v]);const C=T.useCallback(()=>{u.current?.scrollToBottom()},[]);return f.jsxs("div",{className:"flex h-full w-full max-w-full flex-col",children:[f.jsxs("div",{className:"relative min-h-0 flex-1",children:[f.jsx("div",{ref:l,className:Be("h-full w-full max-w-full overflow-hidden p-2 bg-terminal-background",e)}),f.jsx("button",{onClick:C,className:Be("absolute top-2 right-5 p-1 transition-colors",y?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:f.jsx(J,{icon:Cne,size:20,strokeWidth:2})})]}),s&&f.jsx(WE,{onSend:s})]})}function xLe({name:e,status:t,exitCode:n,className:r,onRename:i}){const[a,s]=T.useState(!1),[o,l]=T.useState(e),u=T.useRef(null);T.useEffect(()=>{a&&u.current&&(u.current.focus(),u.current.select())},[a]);const p=()=>{i&&(l(e),s(!0))},d=()=>{const g=o.trim();g&&g!==e&&i&&i(g),s(!1)},m=g=>{g.key==="Enter"?d():g.key==="Escape"&&s(!1)};return f.jsxs("div",{className:Be("flex h-6 items-center gap-2 border-b border-border bg-card px-2 text-xs",r),children:[f.jsx("span",{className:Be("h-2 w-2 shrink-0 rounded-full",{"bg-accent":t==="running","bg-muted-foreground":t==="exited"&&n===0,"bg-destructive":t==="exited"&&n!==0||t==="error"})}),a?f.jsx("input",{ref:u,type:"text",value:o,onChange:g=>l(g.target.value),onBlur:d,onKeyDown:m,className:"h-4 w-24 rounded border border-border bg-background px-1 text-xs font-medium text-foreground outline-none focus:border-primary"}):f.jsx("span",{className:Be("font-medium text-foreground",i&&"cursor-pointer hover:text-primary"),onDoubleClick:p,title:i?"Double-click to rename":void 0,children:e}),t==="exited"&&n!==void 0&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"ml-auto text-muted-foreground",children:"·"}),f.jsxs("span",{className:Be({"text-muted-foreground":n===0,"text-destructive":n!==0}),children:["exit ",n]})]})]})}function am({...e}){return f.jsx($we,{"data-slot":"dropdown-menu",...e})}function sm({...e}){return f.jsx(Hwe,{"data-slot":"dropdown-menu-trigger",...e})}function om({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...a}){return f.jsx(Owe,{children:f.jsx(Rwe,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:f.jsx(Awe,{"data-slot":"dropdown-menu-content",className:Be("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",i),...a})})})}function Tr({className:e,inset:t,variant:n="default",...r}){return f.jsx(Cwe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Be("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function TW({...e}){return f.jsx(Iwe,{"data-slot":"dropdown-menu-radio-group",...e})}function AW({className:e,children:t,...n}){return f.jsxs(Lwe,{"data-slot":"dropdown-menu-radio-item",className:Be("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[f.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-radio-item-indicator",children:f.jsx(Pwe,{children:f.jsx(J,{icon:Dr,strokeWidth:2})})}),t]})}function kW({className:e,...t}){return f.jsx(p3,{"data-slot":"dropdown-menu-separator",className:Be("bg-border/50 -mx-1 my-1 h-px",e),...t})}const SLe="";function tj(){return tn({mutationFn:async e=>{const t=await fetch(`${SLe}/api/git/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync failed")}return t.json()}})}const ELe="";function nj(){return tn({mutationFn:async e=>{const t=await fetch(`${ELe}/api/git/merge-to-main`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Merge failed")}return t.json()}})}const _Le="";function rj(){return tn({mutationFn:async e=>{const t=await fetch(`${_Le}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Push failed")}return t.json()}})}const wLe="";function ij(){return tn({mutationFn:async e=>{const t=await fetch(`${wLe}/api/git/sync-parent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync parent failed")}return t.json()}})}const CLe="";function aj(){return tn({mutationFn:async e=>{const t=await fetch(`${CLe}/api/git/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();if(n.prAlreadyExists&&n.existingPrUrl){const r=new Error(n.error||"PR already exists");throw r.existingPrUrl=n.existingPrUrl,r}throw new Error(n.error||"Failed to create PR")}return t.json()}})}const TLe="";function sj(){return tn({mutationFn:async e=>{const t=await fetch(`${TLe}/api/tasks/${e}/kill-claude`,{method:"POST"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to kill Claude")}return t.json()}})}function ALe({repoPath:e,worktreePath:t,baseBranch:n,taskId:r,title:i,prUrl:a,isMobile:s,terminalId:o,sendInputToTerminal:l}){const{t:u}=wt("common"),p=tj(),d=nj(),m=rj(),g=ij(),x=aj(),S=Bw(),b=sj(),y=N=>{o&&l?(l(o,N),St.info(u("git.sentToClaude"))):St.error(u("git.noTerminal"))},v=async()=>{try{await p.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),St.success(u("git.syncedFromMain"))}catch(N){const D=N instanceof Error?N.message:"Sync failed",L=n||"main";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Rebase this worktree onto the parent repo's ${L} branch. Error: "${D}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${e}) to ensure ${L} is current, 3) git rebase ${L} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},_=async()=>{try{await d.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),St.success(u("git.mergedToMain")),b.mutate(r),S.mutate({taskId:r,updates:{status:"DONE"}})}catch(N){const D=N instanceof Error?N.message:"Merge failed",L=n||"main";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Merge this worktree's branch into the parent repo's ${L}. Error: "${D}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${e}, checkout ${L} and pull latest from origin, 3) Squash merge the worktree branch into ${L} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${L} to origin. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},C=async()=>{try{await m.mutateAsync({worktreePath:t}),St.success(u("git.pushedToOrigin"))}catch(N){const D=N instanceof Error?N.message:"Push failed";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Push this worktree's branch to origin. Error: "${D}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${t}.`)}:void 0})}},w=async()=>{try{await g.mutateAsync({repoPath:e,baseBranch:n}),St.success(u("git.parentSynced"))}catch(N){const D=N instanceof Error?N.message:"Sync parent failed",L=n||"main";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Sync the parent repo's ${L} branch with origin. Error: "${D}". Steps: 1) git fetch origin, 2) git pull origin ${L} --ff-only, 3) If that fails, rebase with git rebase origin/${L}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${L}. Work in the parent repo at ${e}, not the worktree.`)}:void 0})}},A=()=>{o&&l&&l(o,"commit")},R=async()=>{try{const N=await x.mutateAsync({worktreePath:t,title:i,baseBranch:n});S.mutate({taskId:r,updates:{prUrl:N.prUrl}}),St.success(u("git.prCreated"),{action:{label:"View PR",onClick:()=>Al(N.prUrl)}})}catch(N){const D=N instanceof Error?N.message:"Failed to create PR",L=N&&typeof N=="object"&&"existingPrUrl"in N?N.existingPrUrl:void 0;if(L){S.mutate({taskId:r,updates:{prUrl:L}}),St.info(u("git.prExists"),{action:{label:"View PR",onClick:()=>Al(L)}});return}const z=D.split(`
43
+ `,v)}paste(y){this._core.paste(y)}refresh(y,v){this._verifyIntegers(y,v),this._core.refresh(y,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(y){this._addonManager.loadAddon(this,y)}static get strings(){return o}_verifyIntegers(...y){for(const v of y)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...y){for(const v of y)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}s.Terminal=S})(),a})()))})(f2)),f2.exports}var gse=gLe(),p2={exports:{}},wW;function bLe(){return wW||(wW=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const s=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),d=l-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),m=u-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-s;return{cols:Math.max(2,Math.floor(m/a.css.cell.width)),rows:Math.max(1,Math.floor(d/a.css.cell.height))}}}})(),n})()))})(p2)),p2.exports}var bse=bLe(),h2={exports:{}},CW;function vLe(){return CW||(CW=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(s,o)=>{function l(p){try{const d=new URL(p),m=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return p.toLocaleLowerCase().startsWith(m.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(p,d,m,g={}){this._terminal=p,this._regex=d,this._handler=m,this._options=g}provideLinks(p,d){const m=u.computeLink(p,this._regex,this._terminal,this._handler);d(this._addCallbacks(m))}_addCallbacks(p){return p.map((d=>(d.leave=this._options.leave,d.hover=(m,g)=>{if(this._options.hover){const{range:x}=d;this._options.hover(m,g,x)}},d)))}};class u{static computeLink(d,m,g,x){const S=new RegExp(m.source,(m.flags||"")+"g"),[b,y]=u._getWindowedLineStrings(d-1,g),v=b.join("");let _;const C=[];for(;_=S.exec(v);){const w=_[0];if(!l(w))continue;const[A,R]=u._mapStrIdx(g,y,0,_.index),[O,N]=u._mapStrIdx(g,A,R,w.length);if(A===-1||R===-1||O===-1||N===-1)continue;const D={start:{x:R+1,y:A+1},end:{x:N,y:O+1}};C.push({range:D,text:w,activate:x})}return C}static _getWindowedLineStrings(d,m){let g,x=d,S=d,b=0,y="";const v=[];if(g=m.buffer.active.getLine(d)){const _=g.translateToString(!0);if(g.isWrapped&&_[0]!==" "){for(b=0;(g=m.buffer.active.getLine(--x))&&b<2048&&(y=g.translateToString(!0),b+=y.length,v.push(y),g.isWrapped&&y.indexOf(" ")===-1););v.reverse()}for(v.push(_),b=0;(g=m.buffer.active.getLine(++S))&&g.isWrapped&&b<2048&&(y=g.translateToString(!0),b+=y.length,v.push(y),y.indexOf(" ")===-1););}return[v,x]}static _mapStrIdx(d,m,g,x){const S=d.buffer.active,b=S.getNullCell();let y=g;for(;x;){const v=S.getLine(m);if(!v)return[-1,-1];for(let _=y;_<v.length;++_){v.getCell(_,b);const C=b.getChars();if(b.getWidth()&&(x-=C.length||1,_===v.length-1&&C==="")){const w=S.getLine(m+1);w&&w.isWrapped&&(w.getCell(0,b),b.getWidth()===2&&(x+=1))}if(x<0)return[m,_]}m++,y=0}return[m,y]}}o.LinkComputer=u}},r={};function i(s){var o=r[s];if(o!==void 0)return o.exports;var l=r[s]={exports:{}};return n[s](l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.WebLinksAddon=void 0;const o=i(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(p,d){const m=window.open();if(m){try{m.opener=null}catch{}m.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}s.WebLinksAddon=class{constructor(p=u,d={}){this._handler=p,this._options=d}activate(p){this._terminal=p;const d=this._options,m=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,m,this._handler,d))}dispose(){this._linkProvider?.dispose()}}})(),a})()))})(h2)),h2.exports}var vse=vLe();function tC(){const[e,t]=T.useState(!1);return T.useEffect(()=>{const n=window.matchMedia("(max-width: 639px)");t(n.matches);const r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const yLe=[{label:"Esc",icon:Mr,data:"\x1B"},{label:"Up",icon:a3,data:"\x1B[A"},{label:"Down",icon:L0,data:"\x1B[B"},{label:"Tab",icon:null,data:" "},{label:"Enter",icon:null,data:"\r"}];function WE({onSend:e}){return tC()?f.jsx("div",{className:"flex shrink-0 items-center justify-center gap-2 border-t border-border bg-card px-3 py-2",children:yLe.map(n=>f.jsxs(Ae,{variant:"outline",className:"h-11 min-w-11 touch-manipulation",onClick:()=>e(n.data),children:[n.icon?f.jsx(J,{icon:n.icon,size:20,strokeWidth:2}):f.jsx("span",{className:"text-xs font-medium",children:n.label}),f.jsx("span",{className:"sr-only",children:n.label})]},n.label))}):null}const yse={background:"#faf9f5",foreground:"#2a2a27",cursor:"#2a2a27",cursorAccent:"#faf9f5",selectionBackground:"#d1d5db",black:"#2a2a27",red:"#dd403a",green:"#0d5c63",yellow:"#dd403a",blue:"#0d5c63",magenta:"#5c5c59",cyan:"#0d5c63",white:"#5c5c59",brightBlack:"#5c5c59",brightRed:"#dd403a",brightGreen:"#0d5c63",brightYellow:"#dd403a",brightBlue:"#0d5c63",brightMagenta:"#5c5c59",brightCyan:"#0d5c63",brightWhite:"#5c5c59"},xse={background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"};function oL({className:e,onReady:t,onResize:n,onContainerReady:r,terminalId:i,setupImagePaste:a,onSend:s,onFocus:o}){const l=T.useRef(null),u=T.useRef(null),p=T.useRef(null),d=T.useRef(n),m=T.useRef(o),g=T.useRef(t),x=T.useRef(r),{setTerminalFocused:S}=d3(),{resolvedTheme:b}=xp(),y=b==="dark",v=y?xse:yse;T.useEffect(()=>{d.current=n},[n]),T.useEffect(()=>{m.current=o},[o]),T.useEffect(()=>{g.current=t},[t]),T.useEffect(()=>{x.current=r},[r]);const _=T.useCallback(()=>{if(!p.current||!u.current)return;p.current.fit();const{cols:w,rows:A}=u.current;d.current?.(w,A)},[]);T.useEffect(()=>{if(!l.current||u.current)return;const w=new gse.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"monospace",theme:v,scrollback:1e4}),A=new bse.FitAddon,R=new vse.WebLinksAddon;w.loadAddon(A),w.loadAddon(R),w.open(l.current),u.current=w,p.current=A,requestAnimationFrame(()=>{_(),g.current?.(w),l.current&&x.current?.(l.current)});const O=()=>{S(!0),m.current?.()},N=()=>S(!1);w.textarea&&(w.textarea.addEventListener("focus",O),w.textarea.addEventListener("blur",N));const D=setTimeout(()=>{_(),w.refresh(0,w.rows-1)},100),L=()=>{requestAnimationFrame(_)};window.addEventListener("resize",L);const z=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{_(),w.refresh(0,w.rows-1)})};document.addEventListener("visibilitychange",z);const P=new ResizeObserver(L);P.observe(l.current);const V=new IntersectionObserver(H=>{H[0]?.isIntersecting&&requestAnimationFrame(()=>{_(),w.refresh(0,w.rows-1)})},{threshold:.1});return V.observe(l.current),()=>{clearTimeout(D),window.removeEventListener("resize",L),document.removeEventListener("visibilitychange",z),P.disconnect(),V.disconnect(),w.textarea&&(w.textarea.removeEventListener("focus",O),w.textarea.removeEventListener("blur",N)),S(!1),w.dispose(),u.current=null,p.current=null}},[_,S]),T.useEffect(()=>!l.current||!i||!a?void 0:a(l.current,i),[i,a]),T.useEffect(()=>{u.current&&(u.current.options.theme=v)},[v]);const C=T.useCallback(()=>{u.current?.scrollToBottom()},[]);return f.jsxs("div",{className:"flex h-full w-full max-w-full flex-col",children:[f.jsxs("div",{className:"relative min-h-0 flex-1",children:[f.jsx("div",{ref:l,className:Be("h-full w-full max-w-full overflow-hidden p-2 bg-terminal-background",e)}),f.jsx("button",{onClick:C,className:Be("absolute top-2 right-5 p-1 transition-colors",y?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:f.jsx(J,{icon:Cne,size:20,strokeWidth:2})})]}),f.jsx("div",{className:"h-2 shrink-0 bg-terminal-background"}),s&&f.jsx(WE,{onSend:s})]})}function xLe({name:e,status:t,exitCode:n,className:r,onRename:i}){const[a,s]=T.useState(!1),[o,l]=T.useState(e),u=T.useRef(null);T.useEffect(()=>{a&&u.current&&(u.current.focus(),u.current.select())},[a]);const p=()=>{i&&(l(e),s(!0))},d=()=>{const g=o.trim();g&&g!==e&&i&&i(g),s(!1)},m=g=>{g.key==="Enter"?d():g.key==="Escape"&&s(!1)};return f.jsxs("div",{className:Be("flex h-6 items-center gap-2 border-b border-border bg-card px-2 text-xs",r),children:[f.jsx("span",{className:Be("h-2 w-2 shrink-0 rounded-full",{"bg-accent":t==="running","bg-muted-foreground":t==="exited"&&n===0,"bg-destructive":t==="exited"&&n!==0||t==="error"})}),a?f.jsx("input",{ref:u,type:"text",value:o,onChange:g=>l(g.target.value),onBlur:d,onKeyDown:m,className:"h-4 w-24 rounded border border-border bg-background px-1 text-xs font-medium text-foreground outline-none focus:border-primary"}):f.jsx("span",{className:Be("font-medium text-foreground",i&&"cursor-pointer hover:text-primary"),onDoubleClick:p,title:i?"Double-click to rename":void 0,children:e}),t==="exited"&&n!==void 0&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"ml-auto text-muted-foreground",children:"·"}),f.jsxs("span",{className:Be({"text-muted-foreground":n===0,"text-destructive":n!==0}),children:["exit ",n]})]})]})}function am({...e}){return f.jsx($we,{"data-slot":"dropdown-menu",...e})}function sm({...e}){return f.jsx(Hwe,{"data-slot":"dropdown-menu-trigger",...e})}function om({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...a}){return f.jsx(Owe,{children:f.jsx(Rwe,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:f.jsx(Awe,{"data-slot":"dropdown-menu-content",className:Be("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",i),...a})})})}function Tr({className:e,inset:t,variant:n="default",...r}){return f.jsx(Cwe,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Be("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function TW({...e}){return f.jsx(Iwe,{"data-slot":"dropdown-menu-radio-group",...e})}function AW({className:e,children:t,...n}){return f.jsxs(Lwe,{"data-slot":"dropdown-menu-radio-item",className:Be("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[f.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-radio-item-indicator",children:f.jsx(Pwe,{children:f.jsx(J,{icon:Dr,strokeWidth:2})})}),t]})}function kW({className:e,...t}){return f.jsx(p3,{"data-slot":"dropdown-menu-separator",className:Be("bg-border/50 -mx-1 my-1 h-px",e),...t})}const SLe="";function tj(){return tn({mutationFn:async e=>{const t=await fetch(`${SLe}/api/git/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync failed")}return t.json()}})}const ELe="";function nj(){return tn({mutationFn:async e=>{const t=await fetch(`${ELe}/api/git/merge-to-main`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Merge failed")}return t.json()}})}const _Le="";function rj(){return tn({mutationFn:async e=>{const t=await fetch(`${_Le}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Push failed")}return t.json()}})}const wLe="";function ij(){return tn({mutationFn:async e=>{const t=await fetch(`${wLe}/api/git/sync-parent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync parent failed")}return t.json()}})}const CLe="";function aj(){return tn({mutationFn:async e=>{const t=await fetch(`${CLe}/api/git/create-pr`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();if(n.prAlreadyExists&&n.existingPrUrl){const r=new Error(n.error||"PR already exists");throw r.existingPrUrl=n.existingPrUrl,r}throw new Error(n.error||"Failed to create PR")}return t.json()}})}const TLe="";function sj(){return tn({mutationFn:async e=>{const t=await fetch(`${TLe}/api/tasks/${e}/kill-claude`,{method:"POST"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to kill Claude")}return t.json()}})}function ALe({repoPath:e,worktreePath:t,baseBranch:n,taskId:r,title:i,prUrl:a,isMobile:s,terminalId:o,sendInputToTerminal:l}){const{t:u}=wt("common"),p=tj(),d=nj(),m=rj(),g=ij(),x=aj(),S=Bw(),b=sj(),y=N=>{o&&l?(l(o,N),St.info(u("git.sentToClaude"))):St.error(u("git.noTerminal"))},v=async()=>{try{await p.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),St.success(u("git.syncedFromMain"))}catch(N){const D=N instanceof Error?N.message:"Sync failed",L=n||"main";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Rebase this worktree onto the parent repo's ${L} branch. Error: "${D}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${e}) to ensure ${L} is current, 3) git rebase ${L} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},_=async()=>{try{await d.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),St.success(u("git.mergedToMain")),b.mutate(r),S.mutate({taskId:r,updates:{status:"DONE"}})}catch(N){const D=N instanceof Error?N.message:"Merge failed",L=n||"main";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Merge this worktree's branch into the parent repo's ${L}. Error: "${D}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${e}, checkout ${L} and pull latest from origin, 3) Squash merge the worktree branch into ${L} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${L} to origin. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},C=async()=>{try{await m.mutateAsync({worktreePath:t}),St.success(u("git.pushedToOrigin"))}catch(N){const D=N instanceof Error?N.message:"Push failed";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Push this worktree's branch to origin. Error: "${D}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${t}.`)}:void 0})}},w=async()=>{try{await g.mutateAsync({repoPath:e,baseBranch:n}),St.success(u("git.parentSynced"))}catch(N){const D=N instanceof Error?N.message:"Sync parent failed",L=n||"main";St.error(D,{action:o&&l?{label:"Resolve with Claude",onClick:()=>y(`Sync the parent repo's ${L} branch with origin. Error: "${D}". Steps: 1) git fetch origin, 2) git pull origin ${L} --ff-only, 3) If that fails, rebase with git rebase origin/${L}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${L}. Work in the parent repo at ${e}, not the worktree.`)}:void 0})}},A=()=>{o&&l&&l(o,"commit")},R=async()=>{try{const N=await x.mutateAsync({worktreePath:t,title:i,baseBranch:n});S.mutate({taskId:r,updates:{prUrl:N.prUrl}}),St.success(u("git.prCreated"),{action:{label:"View PR",onClick:()=>Al(N.prUrl)}})}catch(N){const D=N instanceof Error?N.message:"Failed to create PR",L=N&&typeof N=="object"&&"existingPrUrl"in N?N.existingPrUrl:void 0;if(L){S.mutate({taskId:r,updates:{prUrl:L}}),St.info(u("git.prExists"),{action:{label:"View PR",onClick:()=>Al(L)}});return}const z=D.split(`
44
44
  `).filter(Boolean).pop()||D;St.error(z,{action:{label:"Resolve with Claude",onClick:()=>y(`Create a PR for this task. Error: "${D}". After creating, link it using: vibora current-task pr <url>. Worktree: ${t}.`)}})}},O=p.isPending||d.isPending||m.isPending||g.isPending||x.isPending;return s?f.jsxs(am,{children:[f.jsx(sm,{className:"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground",children:f.jsx(J,{icon:o3,size:12,strokeWidth:2,className:O?"animate-pulse":""})}),f.jsxs(om,{align:"end",children:[f.jsxs(Tr,{onClick:v,disabled:p.isPending,children:[f.jsx(J,{icon:dy,size:12,strokeWidth:2,className:p.isPending?"animate-spin":""}),"Pull from main"]}),f.jsxs(Tr,{onClick:_,disabled:d.isPending,children:[f.jsx(J,{icon:cy,size:12,strokeWidth:2,className:d.isPending?"animate-pulse":""}),"Merge to main"]}),f.jsxs(Tr,{onClick:C,disabled:m.isPending,children:[f.jsx(J,{icon:fy,size:12,strokeWidth:2,className:m.isPending?"animate-pulse":""}),"Push to origin"]}),f.jsxs(Tr,{onClick:w,disabled:g.isPending,children:[f.jsx(J,{icon:hy,size:12,strokeWidth:2,className:g.isPending?"animate-spin":""}),"Sync parent with origin"]}),o&&l&&f.jsxs(Tr,{onClick:A,children:[f.jsx(J,{icon:py,size:12,strokeWidth:2}),"Commit"]}),!a&&f.jsxs(Tr,{onClick:R,disabled:x.isPending,children:[f.jsx(J,{icon:ju,size:12,strokeWidth:2,className:x.isPending?"animate-pulse":""}),"Create PR"]})]})]}):f.jsxs(f.Fragment,{children:[f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:v,disabled:p.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Pull from main",children:f.jsx(J,{icon:dy,size:12,strokeWidth:2,className:p.isPending?"animate-spin":""})}),f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:_,disabled:d.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Merge to main",children:f.jsx(J,{icon:cy,size:12,strokeWidth:2,className:d.isPending?"animate-pulse":""})}),f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:C,disabled:m.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Push to origin",children:f.jsx(J,{icon:fy,size:12,strokeWidth:2,className:m.isPending?"animate-pulse":""})}),f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:w,disabled:g.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Sync parent with origin",children:f.jsx(J,{icon:hy,size:12,strokeWidth:2,className:g.isPending?"animate-spin":""})}),o&&l&&f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:A,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Commit",children:f.jsx(J,{icon:py,size:12,strokeWidth:2})}),!a&&f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:R,disabled:x.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Create Pull Request",children:f.jsx(J,{icon:ju,size:12,strokeWidth:2,className:x.isPending?"animate-pulse":""})})]})}function kLe({repoPath:e,worktreePath:t,baseBranch:n,taskId:r,title:i,prUrl:a,repoId:s,repoName:o,terminalId:l,sendInputToTerminal:u}){const{t:p}=wt("common"),d=Br(),m=tj(),g=nj(),x=rj(),S=ij(),b=aj(),y=Bw(),v=Uw(),_=sj(),[C,w]=T.useState(!1),A=j=>{l&&u?(u(l,j),St.info(p("git.sentToClaude"))):St.error(p("git.noTerminal"))},R=async()=>{try{await m.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),St.success(p("git.syncedFromMain"))}catch(j){const G=j instanceof Error?j.message:"Sync failed",q=n||"main";St.error(G,{action:l&&u?{label:"Resolve with Claude",onClick:()=>A(`Rebase this worktree onto the parent repo's ${q} branch. Error: "${G}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${e}) to ensure ${q} is current, 3) git rebase ${q} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},O=async()=>{try{await g.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),St.success(p("git.mergedToMain")),_.mutate(r),y.mutate({taskId:r,updates:{status:"DONE"}})}catch(j){const G=j instanceof Error?j.message:"Merge failed",q=n||"main";St.error(G,{action:l&&u?{label:"Resolve with Claude",onClick:()=>A(`Merge this worktree's branch into the parent repo's ${q}. Error: "${G}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${e}, checkout ${q} and pull latest from origin, 3) Squash merge the worktree branch into ${q} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${q} to origin. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},N=async()=>{try{await x.mutateAsync({worktreePath:t}),St.success(p("git.pushedToOrigin"))}catch(j){const G=j instanceof Error?j.message:"Push failed";St.error(G,{action:l&&u?{label:"Resolve with Claude",onClick:()=>A(`Push this worktree's branch to origin. Error: "${G}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${t}.`)}:void 0})}},D=async()=>{try{await S.mutateAsync({repoPath:e,baseBranch:n}),St.success(p("git.parentSynced"))}catch(j){const G=j instanceof Error?j.message:"Sync parent failed",q=n||"main";St.error(G,{action:l&&u?{label:"Resolve with Claude",onClick:()=>A(`Sync the parent repo's ${q} branch with origin. Error: "${G}". Steps: 1) git fetch origin, 2) git pull origin ${q} --ff-only, 3) If that fails, rebase with git rebase origin/${q}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${q}. Work in the parent repo at ${e}, not the worktree.`)}:void 0})}},L=()=>{l&&u&&u(l,"commit")},z=()=>{d(s?{to:"/repositories/$repoId",params:{repoId:s}}:{to:"/repositories"})},P=()=>{v.mutate({taskId:r,deleteLinkedWorktree:!0}),w(!1)},V=async()=>{try{const j=await b.mutateAsync({worktreePath:t,title:i,baseBranch:n});y.mutate({taskId:r,updates:{prUrl:j.prUrl}}),St.success(p("git.prCreated"),{action:{label:"View PR",onClick:()=>Al(j.prUrl)}})}catch(j){const G=j instanceof Error?j.message:"Failed to create PR",q=j&&typeof j=="object"&&"existingPrUrl"in j?j.existingPrUrl:void 0;if(q){y.mutate({taskId:r,updates:{prUrl:q}}),St.info(p("git.prExists"),{action:{label:"View PR",onClick:()=>Al(q)}});return}const B=G.split(`
45
45
  `).filter(Boolean).pop()||G;St.error(B,{action:{label:"Resolve with Claude",onClick:()=>A(`Create a PR for this task. Error: "${G}". After creating, link it using: vibora current-task pr <url>. Worktree: ${t}.`)}})}},H=m.isPending||g.isPending||x.isPending||S.isPending||b.isPending;return f.jsxs(f.Fragment,{children:[f.jsxs(am,{children:[f.jsx(sm,{className:"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground",children:f.jsx(J,{icon:o3,size:12,strokeWidth:2,className:H?"animate-pulse":""})}),f.jsxs(om,{align:"end",children:[f.jsxs(Tr,{onClick:R,disabled:m.isPending,children:[f.jsx(J,{icon:dy,size:12,strokeWidth:2,className:m.isPending?"animate-spin":""}),"Pull from main"]}),f.jsxs(Tr,{onClick:O,disabled:g.isPending,children:[f.jsx(J,{icon:cy,size:12,strokeWidth:2,className:g.isPending?"animate-pulse":""}),"Merge to main"]}),f.jsxs(Tr,{onClick:N,disabled:x.isPending,children:[f.jsx(J,{icon:fy,size:12,strokeWidth:2,className:x.isPending?"animate-pulse":""}),"Push to origin"]}),f.jsxs(Tr,{onClick:D,disabled:S.isPending,children:[f.jsx(J,{icon:hy,size:12,strokeWidth:2,className:S.isPending?"animate-spin":""}),"Sync parent with origin"]}),l&&u&&f.jsxs(Tr,{onClick:L,children:[f.jsx(J,{icon:py,size:12,strokeWidth:2}),"Commit"]}),!a&&f.jsxs(Tr,{onClick:V,disabled:b.isPending,children:[f.jsx(J,{icon:ju,size:12,strokeWidth:2,className:b.isPending?"animate-pulse":""}),"Create PR"]}),f.jsx(kW,{}),f.jsxs(Tr,{onClick:z,children:[f.jsx(J,{icon:Ou,size:12,strokeWidth:2}),o]}),f.jsx(kW,{}),f.jsxs(Tr,{onClick:()=>w(!0),disabled:v.isPending,className:"text-destructive focus:text-destructive",children:[f.jsx(J,{icon:rs,size:12,strokeWidth:2}),"Delete task"]})]})]}),f.jsx(Oa,{open:C,onOpenChange:w,children:f.jsxs(Ra,{children:[f.jsxs(Na,{children:[f.jsx(Da,{children:"Delete Task"}),f.jsx(La,{children:"This will permanently delete this task and its worktree."})]}),f.jsxs(Ia,{children:[f.jsx(Pa,{children:"Cancel"}),f.jsx(ec,{onClick:P,variant:"destructive",disabled:v.isPending,children:v.isPending?"Deleting...":"Delete"})]})]})})]})}function lm({worktreePath:e}){const{data:t,isLoading:n}=QCe(e);if(!e||n||!t)return null;if(t.clean)return f.jsxs(Jr,{className:"bg-accent/20 text-accent border-transparent",children:[f.jsx(J,{icon:Dr,size:12,strokeWidth:2}),"Clean"]});const r=t.files.length;return f.jsxs(Jr,{className:"bg-amber-500/20 text-amber-600 dark:text-amber-400 border-transparent",children:[f.jsx(J,{icon:er,size:12,strokeWidth:2}),r," ",r===1?"change":"changes"]})}const OLe=350,RLe=250;function NLe({taskInfo:e,terminalId:t,terminalCwd:n,isMobile:r,sendInputToTerminal:i}){const a=T.useRef(null),[s,o]=T.useState(1/0),l=Uw();T.useEffect(()=>{const m=a.current;if(!m)return;const g=new ResizeObserver(x=>{for(const S of x)o(S.contentRect.width)});return g.observe(m),()=>g.disconnect()},[]);const u=r||s<OLe,p=s>=RLe,d=()=>{l.mutate({taskId:e.taskId,deleteLinkedWorktree:!0})};return f.jsx("div",{ref:a,className:"flex shrink-0 items-center justify-between border-b border-border bg-card",children:f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-1",children:[f.jsxs(Rn,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"flex shrink-0 items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 max-w-[50%]",children:[f.jsx(J,{icon:l3,size:14,strokeWidth:2,className:"shrink-0"}),f.jsx("span",{className:"truncate",children:e.title})]}),u?f.jsxs(f.Fragment,{children:[p&&f.jsx(lm,{worktreePath:e.worktreePath}),f.jsx("div",{className:"ml-auto flex items-center",children:f.jsx(kLe,{repoPath:e.repoPath,worktreePath:e.worktreePath,baseBranch:e.baseBranch,taskId:e.taskId,title:e.title,prUrl:e.prUrl,repoId:e.repoId,repoName:e.repoName,terminalId:t,sendInputToTerminal:i})})]}):f.jsxs(f.Fragment,{children:[f.jsxs(Rn,{to:e.repoId?"/repositories/$repoId":"/repositories",params:e.repoId?{repoId:e.repoId}:void 0,className:"flex min-w-0 items-center gap-1 text-xs font-medium text-foreground cursor-pointer hover:underline",children:[f.jsx(J,{icon:Ou,size:12,strokeWidth:2,className:"shrink-0"}),f.jsx("span",{className:"truncate",children:e.repoName})]}),n&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs text-muted-foreground",children:[f.jsx(J,{icon:Rw,size:12,strokeWidth:2,className:"shrink-0"}),f.jsx("span",{className:"truncate",children:n.split("/").pop()})]}),f.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[f.jsx(lm,{worktreePath:e.worktreePath}),f.jsx(ALe,{repoPath:e.repoPath,worktreePath:e.worktreePath,baseBranch:e.baseBranch,taskId:e.taskId,title:e.title,prUrl:e.prUrl,isMobile:r,terminalId:t,sendInputToTerminal:i}),f.jsxs(Oa,{children:[f.jsx(Ju,{render:f.jsx(Ae,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 text-muted-foreground hover:text-destructive",title:"Delete task",disabled:l.isPending}),children:f.jsx(J,{icon:rs,size:12,strokeWidth:2})}),f.jsxs(Ra,{children:[f.jsxs(Na,{children:[f.jsx(Da,{children:"Delete Task"}),f.jsx(La,{children:"This will permanently delete this task and its worktree."})]}),f.jsxs(Ia,{children:[f.jsx(Pa,{children:"Cancel"}),f.jsx(ec,{onClick:d,variant:"destructive",disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})]})]})]})]})})}function ILe({terminals:e,activeIndex:t,onSelect:n,taskInfoByCwd:r}){const i=T.useRef(null),a=T.useRef(null);T.useEffect(()=>{a.current&&i.current&&a.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[t]);const s=(o,l)=>{if(o.cwd&&r){const u=r.get(o.cwd);if(u)return u.title}return o.name||`Terminal ${l+1}`};return f.jsx("div",{ref:i,className:"flex shrink-0 gap-1 overflow-x-auto border-b border-border bg-card px-2 py-1.5",style:{WebkitOverflowScrolling:"touch"},children:e.map((o,l)=>{const u=l===t,p=s(o,l);return f.jsx("button",{ref:u?a:null,onClick:()=>n(l),className:Be("shrink-0 rounded-md px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation","max-w-[150px] truncate",u?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"),children:p},o.id)})})}const DLe=Rp(function({terminal:t,taskInfo:n,isMobile:r,onClose:i,onReady:a,onResize:s,onRename:o,onContainerReady:l,setupImagePaste:u,onFocus:p,sendInputToTerminal:d,isMaximized:m,onMaximize:g,onMinimize:x,canMaximize:S}){const b=Op(),{resolvedTheme:y}=xp(),v=y==="dark",_=n?b.terminals.get(t.id):null,C=_?.isStartingUp??!1;return T.useEffect(()=>{n&&jt.terminal.info("TerminalPane isStartingUp check",{terminalId:t.id,hasTaskInfo:!!n,hasTerminalModel:!!_,isStartingUp:_?.isStartingUp,isStartingClaude:C})},[t.id,n,_,C,_?.isStartingUp]),f.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[n?f.jsx(NLe,{taskInfo:n,terminalId:t.id,terminalCwd:t.cwd,isMobile:r,sendInputToTerminal:d}):f.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-card",children:[f.jsx(xLe,{name:t.name,status:t.status,exitCode:t.exitCode,className:"flex-1 border-b-0",onRename:o}),f.jsxs("div",{className:"flex items-center gap-1 mr-1",children:[S&&f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:m?x:g,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:m?"Restore":"Maximize",children:f.jsx(J,{icon:m?xSe:MSe,size:12,strokeWidth:2})}),i&&f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:i,className:"h-5 w-5 text-muted-foreground hover:text-foreground",children:f.jsx(J,{icon:Mr,size:12,strokeWidth:2})})]})]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx(oL,{onReady:a,onResize:s,onContainerReady:l,terminalId:t.id,setupImagePaste:u,onFocus:p}),C&&f.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(J,{icon:Nt,size:24,strokeWidth:2,className:Be("animate-spin",v?"text-white/60":"text-black/60")}),f.jsx("span",{className:Be("font-mono text-sm",v?"text-white/60":"text-black/60"),children:"Starting Claude Code..."})]})})]})]})});function LLe({onAdd:e}){return f.jsx("div",{className:"flex h-full items-center justify-center bg-terminal-background",children:e?f.jsxs(Ae,{variant:"outline",size:"sm",onClick:e,className:"gap-2",children:[f.jsx(J,{icon:Ed,size:14,strokeWidth:2}),"New Terminal"]}):f.jsx("p",{className:"text-xs text-muted-foreground",children:"No terminals"})})}function PLe(e){return e<=1?{rows:1,cols:1}:e<=2?{rows:1,cols:2}:e<=4?{rows:2,cols:2}:e<=6?{rows:2,cols:3}:e<=9?{rows:3,cols:3}:{rows:3,cols:4}}function MLe({terminals:e,onTerminalClose:t,onTerminalAdd:n,onTerminalReady:r,onTerminalResize:i,onTerminalRename:a,onTerminalContainerReady:s,setupImagePaste:o,writeToTerminal:l,sendInputToTerminal:u,taskInfoByCwd:p}){const d=tC(),[m,g]=T.useState(e.length>0?e[0].id:null),[x,S]=T.useState(0),[b,y]=T.useState(null);if(T.useEffect(()=>{x>=e.length&&e.length>0&&S(e.length-1)},[e.length,x]),T.useEffect(()=>{b&&!e.find(O=>O.id===b)&&y(null)},[e,b]),e.length===0)return f.jsx(LLe,{onAdd:n});const{rows:v,cols:_}=PLe(e.length),C=[];for(let O=0;O<v;O++){const N=O*_,D=Math.min(N+_,e.length);N<e.length&&C.push(e.slice(N,D))}const w=O=>{const N=d&&e.length>1?e[x]?.id:m;N&&l&&l(N,O)},A=O=>{const N=O.cwd?p?.get(O.cwd):void 0,D=!N&&e.length>1;return f.jsx(DLe,{terminal:O,taskInfo:N,isMobile:d,onClose:t?()=>t(O.id):void 0,onReady:r?L=>r(O.id,L):void 0,onResize:i?(L,z)=>i(O.id,L,z):void 0,onRename:a?L=>a(O.id,L):void 0,onContainerReady:s?L=>s(O.id,L):void 0,setupImagePaste:o,onFocus:()=>g(O.id),sendInputToTerminal:u,isMaximized:b===O.id,onMaximize:()=>y(O.id),onMinimize:()=>y(null),canMaximize:D})},R=O=>f.jsxs("div",{className:"flex h-full w-full flex-col",children:[f.jsx("div",{className:"min-h-0 flex-1",children:O}),d&&l&&f.jsx(WE,{onSend:w})]});if(d&&e.length>1){const O=e[x]??e[0];return f.jsxs("div",{className:"flex h-full w-full flex-col",children:[f.jsx(ILe,{terminals:e,activeIndex:x,onSelect:S,taskInfoByCwd:p}),f.jsx("div",{className:"min-h-0 flex-1",children:A(O)},O.id),l&&f.jsx(WE,{onSend:w})]})}if(e.length===1)return R(f.jsx("div",{className:"h-full w-full max-w-full min-w-0 overflow-hidden",children:A(e[0])},e[0].id));if(b){const O=e.find(N=>N.id===b);if(O)return R(f.jsx("div",{className:"h-full w-full max-w-full min-w-0 overflow-hidden",children:A(O)},O.id))}return e.length===2?R(f.jsxs(_f,{direction:d?"vertical":"horizontal",className:"h-full max-w-full",children:[f.jsx(no,{defaultSize:50,minSize:15,children:A(e[0])},e[0].id),f.jsx(wf,{}),f.jsx(no,{defaultSize:50,minSize:15,children:A(e[1])},e[1].id)]})):e.length===3?R(f.jsxs(_f,{direction:"horizontal",className:"h-full max-w-full",children:[f.jsx(no,{defaultSize:50,minSize:15,children:A(e[0])},e[0].id),f.jsx(wf,{}),f.jsx(no,{defaultSize:50,minSize:15,children:f.jsxs(_f,{direction:"vertical",className:"h-full max-w-full",children:[f.jsx(no,{defaultSize:50,minSize:15,children:A(e[1])},e[1].id),f.jsx(wf,{}),f.jsx(no,{defaultSize:50,minSize:15,children:A(e[2])},e[2].id)]})})]})):R(f.jsx(_f,{direction:"vertical",className:"h-full max-w-full",children:C.map((O,N)=>f.jsxs(T.Fragment,{children:[N>0&&f.jsx(wf,{}),f.jsx(no,{defaultSize:100/C.length,minSize:15,children:O.length===1?A(O[0]):f.jsx(_f,{direction:"horizontal",className:"h-full max-w-full",children:O.map((D,L)=>f.jsxs(T.Fragment,{children:[L>0&&f.jsx(wf,{}),f.jsx(no,{defaultSize:100/_,minSize:15,children:A(D)})]},D.id))})})]},`row-${N}`))}))}function jLe(e){if(Array.isArray(e))return e}function FLe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(p){u=!0,i=p}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function lL(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Sse(e,t){if(e){if(typeof e=="string")return lL(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?lL(e,t):void 0}}function BLe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
46
46
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ese(e,t){return jLe(e)||FLe(e,t)||Sse(e,t)||BLe()}var m2={},Zb={},OW;function _se(){if(OW)return Zb;OW=1,Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.bind=void 0;function e(t,n){var r=n.type,i=n.listener,a=n.options;return t.addEventListener(r,i,a),function(){t.removeEventListener(r,i,a)}}return Zb.bind=e,Zb}var hf={},RW;function ULe(){if(RW)return hf;RW=1;var e=hf&&hf.__assign||function(){return e=Object.assign||function(a){for(var s,o=1,l=arguments.length;o<l;o++){s=arguments[o];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(a[u]=s[u])}return a},e.apply(this,arguments)};Object.defineProperty(hf,"__esModule",{value:!0}),hf.bindAll=void 0;var t=_se();function n(a){if(!(typeof a>"u"))return typeof a=="boolean"?{capture:a}:a}function r(a,s){if(s==null)return a;var o=e(e({},a),{options:e(e({},n(s)),n(a.options))});return o}function i(a,s,o){var l=s.map(function(u){var p=r(u,o);return(0,t.bind)(a,p)});return function(){l.forEach(function(p){return p()})}}return hf.bindAll=i,hf}var NW;function $Le(){return NW||(NW=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var t=_se();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return t.bind}});var n=ULe();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return n.bindAll}})})(m2)),m2}var jm=$Le(),wse="data-pdnd-honey-pot";function Cse(e){return e instanceof Element&&e.hasAttribute(wse)}function Tse(e){var t=document.elementsFromPoint(e.x,e.y),n=Ese(t,2),r=n[0],i=n[1];return r?Cse(r)?i??null:r:null}function Cy(e){"@babel/helpers - typeof";return Cy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cy(e)}function zLe(e,t){if(Cy(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Cy(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function HLe(e){var t=zLe(e,"string");return Cy(t)=="symbol"?t:t+""}function K0(e,t,n){return(t=HLe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ase=2147483647;function IW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function DW(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?IW(Object(n),!0).forEach(function(r){K0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IW(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ty=2,LW=Ty/2;function WLe(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function VLe(e){return{x:e.x-LW,y:e.y-LW}}function qLe(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function GLe(e){return{x:Math.min(e.x,window.innerWidth-Ty),y:Math.min(e.y,window.innerHeight-Ty)}}function PW(e){var t=e.client,n=GLe(qLe(VLe(WLe(t))));return DOMRect.fromRect({x:n.x,y:n.y,width:Ty,height:Ty})}function MW(e){var t=e.clientRect;return{left:"".concat(t.left,"px"),top:"".concat(t.top,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}function KLe(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function YLe(e){var t=e.initial,n=document.createElement("div");n.setAttribute(wse,"true");var r=PW({client:t});Object.assign(n.style,DW(DW({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},MW({clientRect:r})),{},{pointerEvents:"auto",zIndex:Ase})),document.body.appendChild(n);var i=jm.bind(window,{type:"pointermove",listener:function(s){var o={x:s.clientX,y:s.clientY};r=PW({client:o}),Object.assign(n.style,MW({clientRect:r}))},options:{capture:!0}});return function(s){var o=s.current;if(i(),KLe({client:o,clientRect:r})){n.remove();return}function l(){u(),n.remove()}var u=jm.bindAll(window,[{type:"pointerdown",listener:l},{type:"pointermove",listener:l},{type:"focusin",listener:l},{type:"focusout",listener:l},{type:"dragstart",listener:l},{type:"dragenter",listener:l},{type:"dragover",listener:l}],{capture:!0})}}function XLe(){var e=null;function t(){return e=null,jm.bind(window,{type:"pointermove",listener:function(i){e={x:i.clientX,y:i.clientY}},options:{capture:!0}})}function n(){var r=null;return function(a){var s=a.eventName,o=a.payload;if(s==="onDragStart"){var l=o.location.initial.input,u=e??{x:l.clientX,y:l.clientY};r=YLe({initial:u})}if(s==="onDrop"){var p,d=o.location.current.input;(p=r)===null||p===void 0||p({current:{x:d.clientX,y:d.clientY}}),r=null,e=null}}}return{bindEvents:t,getOnPostDispatch:n}}function ZLe(e){if(Array.isArray(e))return lL(e)}function QLe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function JLe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
@@ -120,7 +120,7 @@ ${n.map(([a,s])=>{const o=s.theme?.[r]||s.color;return o?` --color-${a}: ${o};`
120
120
 
121
121
  ${e}`,l=mm(o);return`opencode --agent ${a} --prompt ${l}${s}`},notFoundPatterns:[/opencode: command not found/,/opencode: not found/,/'opencode' is not recognized/,/command not found: opencode/],processPattern:/\bopencode\b/i},PP={claude:WGe,opencode:VGe};function qGe(e,t){return PP[e].buildCommand(t)}function GGe(e,t){if(t)return PP[t].notFoundPatterns.some(r=>r.test(e))?t:null;for(const[n,r]of Object.entries(PP))if(r.notFoundPatterns.some(i=>i.test(e)))return n;return null}function aQ({taskName:e,cwd:t,className:n,agent:r="claude",aiMode:i,description:a,startupScript:s,agentOptions:o,opencodeModel:l,serverPort:u=7777,autoFocus:p=!1}){const d=T.useRef(null),m=T.useRef(null),g=T.useRef(!1),x=T.useRef(p),S=T.useRef(null),b=T.useRef(!1),y=T.useRef(!1),[v,_]=T.useState(null),[C,w]=T.useState(!1),[A,R]=T.useState(!1),[O,N]=T.useState(!1),[D,L]=T.useState(null),{resolvedTheme:z}=xp(),P=z==="dark",V=P?xse:yse;T.useEffect(()=>{jt.taskTerminal.debug("cwd changed, resetting refs",{cwd:t}),b.current=!1,y.current=!1,g.current=!1,_(null),w(!1)},[t]);const{setTerminalFocused:H}=d3(),{terminals:j,terminalsLoaded:G,connected:q,createTerminal:B,attachXterm:F,resizeTerminal:U,setupImagePaste:K,writeToTerminal:W,consumePendingStartup:ee,clearStartingUp:oe}=y5(),ne=T.useRef(F),Z=T.useRef(K),Y=T.useRef(W),Q=T.useRef(ee),re=T.useRef(oe);T.useEffect(()=>{ne.current=F},[F]),T.useEffect(()=>{Z.current=K},[K]),T.useEffect(()=>{Y.current=W},[W]),T.useEffect(()=>{Q.current=ee},[ee]),T.useEffect(()=>{re.current=oe},[oe]),T.useEffect(()=>{x.current=p},[p]);const se=v?j.find(ce=>ce.id===v):null,te=se?.status;T.useEffect(()=>{if(!d.current||m.current)return;const ce=new gse.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"monospace",theme:V,scrollback:1e4}),ye=new bse.FitAddon,me=new vse.WebLinksAddon;ce.loadAddon(ye),ce.loadAddon(me),ce.open(d.current),m.current=ce,S.current=ye,N(!0),requestAnimationFrame(()=>{ye.fit()});const Pe=setTimeout(()=>{ye.fit(),ce.refresh(0,ce.rows-1)},100),Ie=()=>H(!0),We=()=>H(!1);return ce.textarea&&(ce.textarea.addEventListener("focus",Ie),ce.textarea.addEventListener("blur",We)),()=>{clearTimeout(Pe),ce.textarea&&(ce.textarea.removeEventListener("focus",Ie),ce.textarea.removeEventListener("blur",We)),H(!1),ce.dispose(),m.current=null,S.current=null,N(!1)}},[H]);const xe=T.useCallback(()=>{if(!S.current||!m.current)return;S.current.fit();const{cols:ce,rows:ye}=m.current;v&&U(v,ce,ye)},[v,U]);T.useEffect(()=>{if(!d.current)return;const ce=()=>{requestAnimationFrame(xe)};window.addEventListener("resize",ce);const ye=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{xe(),m.current&&m.current.refresh(0,m.current.rows-1)})};document.addEventListener("visibilitychange",ye);const me=new ResizeObserver(ce);me.observe(d.current);const Pe=new IntersectionObserver(Ie=>{Ie[0]?.isIntersecting&&requestAnimationFrame(()=>{xe(),m.current&&m.current.refresh(0,m.current.rows-1)})},{threshold:.1});return Pe.observe(d.current),()=>{window.removeEventListener("resize",ce),document.removeEventListener("visibilitychange",ye),me.disconnect(),Pe.disconnect()}},[xe]),T.useEffect(()=>{if(!q||!t||!O||!G)return;const ce=j.find(ye=>ye.cwd===t);if(ce){_(ce.id);return}if(!b.current&&m.current){b.current=!0,w(!0);const{cols:ye,rows:me}=m.current;B({name:e,cols:ye,rows:me,cwd:t,startup:{startupScript:s,agent:r,agentOptions:o,opencodeModel:l,aiMode:i,description:a,taskName:e,serverPort:u}})}},[q,t,O,G,j,e,B]),T.useEffect(()=>{if(!t)return;const ce=j.find(me=>me.cwd===t);if(!ce)return;const ye=v&&j.some(me=>me.id===v);(!v||!ye)&&(jt.taskTerminal.debug("setting terminalId",{newId:ce.id,prevId:v,reason:v?"tempId replaced":"initial",cwd:t,terminalCount:j.length}),_(ce.id),w(!1),v&&!ye&&(y.current=!1))},[j,t,v]),T.useEffect(()=>{if(jt.taskTerminal.debug("attach effect",{terminalId:v,hasTermRef:!!m.current,hasContainerRef:!!d.current,attachedRef:y.current}),!v||!m.current||!d.current||y.current)return;jt.taskTerminal.debug("attach effect passed guards, calling attachXterm",{terminalId:v});const ce=Pe=>{requestAnimationFrame(xe);const Ie=Q.current(Pe);if(jt.taskTerminal.debug("onAttached checking pending startup",{terminalId:Pe,hasPendingStartup:!!Ie}),!Ie){if(x.current&&!g.current&&m.current){const Qe=()=>{const Fe=m.current;!g.current&&Fe&&(Fe.focus(),Fe.textarea===document.activeElement&&(g.current=!0))};setTimeout(Qe,50),setTimeout(Qe,200),setTimeout(Qe,500)}return}jt.taskTerminal.info("onAttached: running startup commands",{terminalId:Pe}),R(!0);const{startupScript:We,agent:Te="claude",agentOptions:he,opencodeModel:fe,aiMode:ke,description:Se,taskName:pe,serverPort:Oe}=Ie;We&&setTimeout(()=>{const Qe="VIBORA_STARTUP_"+Date.now(),Fe=`source /dev/stdin <<'${Qe}'
122
122
  ${We}
123
- ${Qe}`;Y.current(Pe,Fe+"\r")},100);const Ee=Oe??7777,Ue=Ee!==7777?` --port=${Ee}`:"",Ge=`You are working in a Vibora task worktree. Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: vibora current-task review${Ue}. When linking a PR: vibora current-task pr <url>${Ue}. When linking a Linear ticket: vibora current-task linear <url-or-ticket>${Ue}. For notifications: vibora notify "Title" "Message"${Ue}.`,ze=Se?`${pe}: ${Se}`:pe,Xe=qGe(Te,{prompt:ze,systemPrompt:Ge,sessionId:Pe,mode:ke==="plan"?"plan":"default",additionalOptions:he??{},opencodeModel:fe});setTimeout(()=>{if(Y.current(Pe,Xe+"\r"),R(!1),re.current(Pe),x.current&&!g.current&&m.current){const Qe=()=>{const Fe=m.current;!g.current&&Fe&&(Fe.focus(),Fe.textarea===document.activeElement&&(g.current=!0))};setTimeout(Qe,50),setTimeout(Qe,200),setTimeout(Qe,500)}},We?5e3:100)},ye=ne.current(v,m.current,{onAttached:ce}),me=Z.current(d.current,v);return y.current=!0,jt.taskTerminal.debug("attachedRef set to true",{terminalId:v}),()=>{jt.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:v}),ye(),me(),y.current=!1}},[v,xe]),T.useEffect(()=>{m.current&&(m.current.options.theme=V)},[V]),T.useEffect(()=>{if(!p||g.current||!m.current||!v||C||A)return;const ce=[0,50,150,300,500],ye=[];return ce.forEach(me=>{const Pe=setTimeout(()=>{const Ie=m.current;!g.current&&Ie&&(Ie.focus(),Ie.textarea===document.activeElement&&(g.current=!0))},me);ye.push(Pe)}),()=>{ye.forEach(clearTimeout)}},[p,C,A,v]),T.useEffect(()=>{if(!m.current||D)return;const ce=m.current,ye=()=>{const Pe=ce.buffer.active;for(let Ie=Math.max(0,Pe.cursorY-3);Ie<=Pe.cursorY;Ie++){const We=Pe.getLine(Ie);if(We){const Te=We.translateToString(),he=GGe(Te,r);if(he){L(he);return}}}},me=ce.onLineFeed(ye);return()=>{me.dispose()}},[D,r]);const be=T.useCallback(ce=>{v&&Y.current(v,ce)},[v]);return t?f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!q&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),te==="error"&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),te==="exited"&&f.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",se?.exitCode,")"]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx("div",{ref:d,className:Be("h-full w-full overflow-hidden p-2 bg-terminal-background",n)}),C&&!v&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(J,{icon:Nt,size:24,strokeWidth:2,className:Be("animate-spin",P?"text-white/50":"text-black/50")}),f.jsx("span",{className:Be("font-mono text-sm",P?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),A&&f.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(J,{icon:Nt,size:24,strokeWidth:2,className:Be("animate-spin",P?"text-white/60":"text-black/60")}),f.jsxs("span",{className:Be("font-mono text-sm",P?"text-white/60":"text-black/60"),children:["Starting ",Pl[r],"..."]})]})}),D&&f.jsx("div",{className:"pointer-events-none absolute bottom-4 left-4 right-4 z-10",children:f.jsxs("div",{className:Be("pointer-events-auto flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[f.jsx(J,{icon:er,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),f.jsxs("div",{className:"flex-1 space-y-2",children:[f.jsxs("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[Pl[D]," CLI not found"]}),f.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",f.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:gTe[D]})]}),f.jsx("a",{href:bTe[D],target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),f.jsx("button",{onClick:()=>L(null),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:f.jsx(J,{icon:Mr,size:14,strokeWidth:2})})]})}),f.jsx("button",{onClick:()=>m.current?.scrollToBottom(),className:Be("absolute top-2 right-5 p-1 transition-colors",P?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:f.jsx(J,{icon:Cne,size:20,strokeWidth:2})})]}),f.jsx(WE,{onSend:be})]}):f.jsx("div",{className:Be("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",n),children:"No worktree path configured for this task"})}function KGe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function YGe(e,t=[]){let n=[];function r(a,s){const o=T.createContext(s),l=n.length;n=[...n,s];const u=d=>{const{scope:m,children:g,...x}=d,S=m?.[e]?.[l]||o,b=T.useMemo(()=>x,Object.values(x));return f.jsx(S.Provider,{value:b,children:g})};u.displayName=a+"Provider";function p(d,m){const g=m?.[e]?.[l]||o,x=T.useContext(g);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,p]}const i=()=>{const a=n.map(s=>T.createContext(s));return function(o){const l=o?.[e]||a;return T.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return i.scopeName=e,[r,XGe(i,...t)]}function XGe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...o,...d}},{});return T.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var d0=globalThis?.document?T.useLayoutEffect:()=>{},ZGe=iw[" useInsertionEffect ".trim().toString()]||d0;function QGe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,s]=JGe({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:i;{const p=T.useRef(e!==void 0);T.useEffect(()=>{const d=p.current;d!==o&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=o},[o,r])}const u=T.useCallback(p=>{if(o){const d=eKe(p)?p(e):p;d!==e&&s.current?.(d)}else a(p)},[o,e,a,s]);return[l,u]}function JGe({defaultProp:e,onChange:t}){const[n,r]=T.useState(e),i=T.useRef(n),a=T.useRef(t);return ZGe(()=>{a.current=t},[t]),T.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function eKe(e){return typeof e=="function"}function sQ(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ace(...e){return t=>{let n=!1;const r=e.map(i=>{const a=sQ(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():sQ(e[i],null)}}}}function kce(...e){return T.useCallback(Ace(...e),e)}function tKe(e){const t=nKe(e),n=T.forwardRef((r,i)=>{const{children:a,...s}=r,o=T.Children.toArray(a),l=o.find(iKe);if(l){const u=l.props.children,p=o.map(d=>d===l?T.Children.count(u)>1?T.Children.only(null):T.isValidElement(u)?u.props.children:null:d);return f.jsx(t,{...s,ref:i,children:T.isValidElement(u)?T.cloneElement(u,void 0,p):null})}return f.jsx(t,{...s,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function nKe(e){const t=T.forwardRef((n,r)=>{const{children:i,...a}=n;if(T.isValidElement(i)){const s=sKe(i),o=aKe(a,i.props);return i.type!==T.Fragment&&(o.ref=r?Ace(r,s):s),T.cloneElement(i,o)}return T.Children.count(i)>1?T.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rKe=Symbol("radix.slottable");function iKe(e){return T.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rKe}function aKe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...o)=>{const l=a(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function sKe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oKe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],x5=oKe.reduce((e,t)=>{const n=tKe(`Primitive.${t}`),r=T.forwardRef((i,a)=>{const{asChild:s,...o}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(l,{...o,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function lKe(e,t){return T.useReducer((n,r)=>t[n][r]??n,e)}var Oce=e=>{const{present:t,children:n}=e,r=uKe(t),i=typeof n=="function"?n({present:r.isPresent}):T.Children.only(n),a=kce(r.ref,cKe(i));return typeof n=="function"||r.isPresent?T.cloneElement(i,{ref:a}):null};Oce.displayName="Presence";function uKe(e){const[t,n]=T.useState(),r=T.useRef(null),i=T.useRef(e),a=T.useRef("none"),s=e?"mounted":"unmounted",[o,l]=lKe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const u=TS(r.current);a.current=o==="mounted"?u:"none"},[o]),d0(()=>{const u=r.current,p=i.current;if(p!==e){const m=a.current,g=TS(u);e?l("MOUNT"):g==="none"||u?.display==="none"?l("UNMOUNT"):l(p&&m!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),d0(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,d=g=>{const S=TS(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&S&&(l("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},m=g=>{g.target===t&&(a.current=TS(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:T.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function TS(e){return e?.animationName||"none"}function cKe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var dKe=iw[" useId ".trim().toString()]||(()=>{}),fKe=0;function pKe(e){const[t,n]=T.useState(dKe());return d0(()=>{n(r=>r??String(fKe++))},[e]),e||(t?`radix-${t}`:"")}var FC="Collapsible",[hKe]=YGe(FC),[mKe,S5]=hKe(FC),Rce=T.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...o}=e,[l,u]=QGe({prop:r,defaultProp:i??!1,onChange:s,caller:FC});return f.jsx(mKe,{scope:n,disabled:a,contentId:pKe(),open:l,onOpenToggle:T.useCallback(()=>u(p=>!p),[u]),children:f.jsx(x5.div,{"data-state":_5(l),"data-disabled":a?"":void 0,...o,ref:t})})});Rce.displayName=FC;var Nce="CollapsibleTrigger",Ice=T.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=S5(Nce,n);return f.jsx(x5.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":_5(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:KGe(e.onClick,i.onOpenToggle)})});Ice.displayName=Nce;var E5="CollapsibleContent",Dce=T.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=S5(E5,e.__scopeCollapsible);return f.jsx(Oce,{present:n||i.open,children:({present:a})=>f.jsx(gKe,{...r,ref:t,present:a})})});Dce.displayName=E5;var gKe=T.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,s=S5(E5,n),[o,l]=T.useState(r),u=T.useRef(null),p=kce(t,u),d=T.useRef(0),m=d.current,g=T.useRef(0),x=g.current,S=s.open||o,b=T.useRef(S),y=T.useRef(void 0);return T.useEffect(()=>{const v=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(v)},[]),d0(()=>{const v=u.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();d.current=_.height,g.current=_.width,b.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),l(r)}},[s.open,r]),f.jsx(x5.div,{"data-state":_5(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!S,...a,ref:p,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:S&&i})});function _5(e){return e?"open":"closed"}var bKe=Rce;const vKe=bKe,yKe=Ice,xKe=Dce;function SKe(e){const{viewState:t,setDiffOptions:n}=v5(e),{collapsedFiles:r}=t.diffOptions,i=T.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(p=>p!==l):[...r,l]})},[r,n]),a=T.useCallback(l=>{n({collapsedFiles:l})},[n]),s=T.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=T.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function EKe(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
123
+ ${Qe}`;Y.current(Pe,Fe+"\r")},100);const Ee=Oe??7777,Ue=Ee!==7777?` --port=${Ee}`:"",Ge=`You are working in a Vibora task worktree. Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: vibora current-task review${Ue}. When linking a PR: vibora current-task pr <url>${Ue}. When linking a Linear ticket: vibora current-task linear <url-or-ticket>${Ue}. For notifications: vibora notify "Title" "Message"${Ue}.`,ze=Se?`${pe}: ${Se}`:pe,Xe=qGe(Te,{prompt:ze,systemPrompt:Ge,sessionId:Pe,mode:ke==="plan"?"plan":"default",additionalOptions:he??{},opencodeModel:fe});setTimeout(()=>{if(Y.current(Pe,Xe+"\r"),R(!1),re.current(Pe),x.current&&!g.current&&m.current){const Qe=()=>{const Fe=m.current;!g.current&&Fe&&(Fe.focus(),Fe.textarea===document.activeElement&&(g.current=!0))};setTimeout(Qe,50),setTimeout(Qe,200),setTimeout(Qe,500)}},We?5e3:100)},ye=ne.current(v,m.current,{onAttached:ce}),me=Z.current(d.current,v);return y.current=!0,jt.taskTerminal.debug("attachedRef set to true",{terminalId:v}),()=>{jt.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:v}),ye(),me(),y.current=!1}},[v,xe]),T.useEffect(()=>{m.current&&(m.current.options.theme=V)},[V]),T.useEffect(()=>{if(!p||g.current||!m.current||!v||C||A)return;const ce=[0,50,150,300,500],ye=[];return ce.forEach(me=>{const Pe=setTimeout(()=>{const Ie=m.current;!g.current&&Ie&&(Ie.focus(),Ie.textarea===document.activeElement&&(g.current=!0))},me);ye.push(Pe)}),()=>{ye.forEach(clearTimeout)}},[p,C,A,v]),T.useEffect(()=>{if(!m.current||D)return;const ce=m.current,ye=()=>{const Pe=ce.buffer.active;for(let Ie=Math.max(0,Pe.cursorY-3);Ie<=Pe.cursorY;Ie++){const We=Pe.getLine(Ie);if(We){const Te=We.translateToString(),he=GGe(Te,r);if(he){L(he);return}}}},me=ce.onLineFeed(ye);return()=>{me.dispose()}},[D,r]);const be=T.useCallback(ce=>{v&&Y.current(v,ce)},[v]);return t?f.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!q&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),te==="error"&&f.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),te==="exited"&&f.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",se?.exitCode,")"]}),f.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[f.jsx("div",{ref:d,className:Be("h-full w-full overflow-hidden p-2 bg-terminal-background",n)}),C&&!v&&f.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(J,{icon:Nt,size:24,strokeWidth:2,className:Be("animate-spin",P?"text-white/50":"text-black/50")}),f.jsx("span",{className:Be("font-mono text-sm",P?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),A&&f.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:f.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f.jsx(J,{icon:Nt,size:24,strokeWidth:2,className:Be("animate-spin",P?"text-white/60":"text-black/60")}),f.jsxs("span",{className:Be("font-mono text-sm",P?"text-white/60":"text-black/60"),children:["Starting ",Pl[r],"..."]})]})}),D&&f.jsx("div",{className:"pointer-events-none absolute bottom-4 left-4 right-4 z-10",children:f.jsxs("div",{className:Be("pointer-events-auto flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[f.jsx(J,{icon:er,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),f.jsxs("div",{className:"flex-1 space-y-2",children:[f.jsxs("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:[Pl[D]," CLI not found"]}),f.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",f.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:gTe[D]})]}),f.jsx("a",{href:bTe[D],target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),f.jsx("button",{onClick:()=>L(null),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:f.jsx(J,{icon:Mr,size:14,strokeWidth:2})})]})}),f.jsx("button",{onClick:()=>m.current?.scrollToBottom(),className:Be("absolute top-2 right-5 p-1 transition-colors",P?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:f.jsx(J,{icon:Cne,size:20,strokeWidth:2})})]}),f.jsx("div",{className:"h-2 shrink-0 bg-terminal-background"}),f.jsx(WE,{onSend:be})]}):f.jsx("div",{className:Be("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",n),children:"No worktree path configured for this task"})}function KGe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function YGe(e,t=[]){let n=[];function r(a,s){const o=T.createContext(s),l=n.length;n=[...n,s];const u=d=>{const{scope:m,children:g,...x}=d,S=m?.[e]?.[l]||o,b=T.useMemo(()=>x,Object.values(x));return f.jsx(S.Provider,{value:b,children:g})};u.displayName=a+"Provider";function p(d,m){const g=m?.[e]?.[l]||o,x=T.useContext(g);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,p]}const i=()=>{const a=n.map(s=>T.createContext(s));return function(o){const l=o?.[e]||a;return T.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return i.scopeName=e,[r,XGe(i,...t)]}function XGe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...o,...d}},{});return T.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var d0=globalThis?.document?T.useLayoutEffect:()=>{},ZGe=iw[" useInsertionEffect ".trim().toString()]||d0;function QGe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,s]=JGe({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:i;{const p=T.useRef(e!==void 0);T.useEffect(()=>{const d=p.current;d!==o&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=o},[o,r])}const u=T.useCallback(p=>{if(o){const d=eKe(p)?p(e):p;d!==e&&s.current?.(d)}else a(p)},[o,e,a,s]);return[l,u]}function JGe({defaultProp:e,onChange:t}){const[n,r]=T.useState(e),i=T.useRef(n),a=T.useRef(t);return ZGe(()=>{a.current=t},[t]),T.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function eKe(e){return typeof e=="function"}function sQ(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ace(...e){return t=>{let n=!1;const r=e.map(i=>{const a=sQ(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():sQ(e[i],null)}}}}function kce(...e){return T.useCallback(Ace(...e),e)}function tKe(e){const t=nKe(e),n=T.forwardRef((r,i)=>{const{children:a,...s}=r,o=T.Children.toArray(a),l=o.find(iKe);if(l){const u=l.props.children,p=o.map(d=>d===l?T.Children.count(u)>1?T.Children.only(null):T.isValidElement(u)?u.props.children:null:d);return f.jsx(t,{...s,ref:i,children:T.isValidElement(u)?T.cloneElement(u,void 0,p):null})}return f.jsx(t,{...s,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function nKe(e){const t=T.forwardRef((n,r)=>{const{children:i,...a}=n;if(T.isValidElement(i)){const s=sKe(i),o=aKe(a,i.props);return i.type!==T.Fragment&&(o.ref=r?Ace(r,s):s),T.cloneElement(i,o)}return T.Children.count(i)>1?T.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rKe=Symbol("radix.slottable");function iKe(e){return T.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rKe}function aKe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...o)=>{const l=a(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function sKe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oKe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],x5=oKe.reduce((e,t)=>{const n=tKe(`Primitive.${t}`),r=T.forwardRef((i,a)=>{const{asChild:s,...o}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(l,{...o,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function lKe(e,t){return T.useReducer((n,r)=>t[n][r]??n,e)}var Oce=e=>{const{present:t,children:n}=e,r=uKe(t),i=typeof n=="function"?n({present:r.isPresent}):T.Children.only(n),a=kce(r.ref,cKe(i));return typeof n=="function"||r.isPresent?T.cloneElement(i,{ref:a}):null};Oce.displayName="Presence";function uKe(e){const[t,n]=T.useState(),r=T.useRef(null),i=T.useRef(e),a=T.useRef("none"),s=e?"mounted":"unmounted",[o,l]=lKe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const u=TS(r.current);a.current=o==="mounted"?u:"none"},[o]),d0(()=>{const u=r.current,p=i.current;if(p!==e){const m=a.current,g=TS(u);e?l("MOUNT"):g==="none"||u?.display==="none"?l("UNMOUNT"):l(p&&m!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),d0(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,d=g=>{const S=TS(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&S&&(l("ANIMATION_END"),!i.current)){const b=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=b)})}},m=g=>{g.target===t&&(a.current=TS(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:T.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function TS(e){return e?.animationName||"none"}function cKe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var dKe=iw[" useId ".trim().toString()]||(()=>{}),fKe=0;function pKe(e){const[t,n]=T.useState(dKe());return d0(()=>{n(r=>r??String(fKe++))},[e]),e||(t?`radix-${t}`:"")}var FC="Collapsible",[hKe]=YGe(FC),[mKe,S5]=hKe(FC),Rce=T.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...o}=e,[l,u]=QGe({prop:r,defaultProp:i??!1,onChange:s,caller:FC});return f.jsx(mKe,{scope:n,disabled:a,contentId:pKe(),open:l,onOpenToggle:T.useCallback(()=>u(p=>!p),[u]),children:f.jsx(x5.div,{"data-state":_5(l),"data-disabled":a?"":void 0,...o,ref:t})})});Rce.displayName=FC;var Nce="CollapsibleTrigger",Ice=T.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=S5(Nce,n);return f.jsx(x5.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":_5(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:KGe(e.onClick,i.onOpenToggle)})});Ice.displayName=Nce;var E5="CollapsibleContent",Dce=T.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=S5(E5,e.__scopeCollapsible);return f.jsx(Oce,{present:n||i.open,children:({present:a})=>f.jsx(gKe,{...r,ref:t,present:a})})});Dce.displayName=E5;var gKe=T.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,s=S5(E5,n),[o,l]=T.useState(r),u=T.useRef(null),p=kce(t,u),d=T.useRef(0),m=d.current,g=T.useRef(0),x=g.current,S=s.open||o,b=T.useRef(S),y=T.useRef(void 0);return T.useEffect(()=>{const v=requestAnimationFrame(()=>b.current=!1);return()=>cancelAnimationFrame(v)},[]),d0(()=>{const v=u.current;if(v){y.current=y.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const _=v.getBoundingClientRect();d.current=_.height,g.current=_.width,b.current||(v.style.transitionDuration=y.current.transitionDuration,v.style.animationName=y.current.animationName),l(r)}},[s.open,r]),f.jsx(x5.div,{"data-state":_5(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!S,...a,ref:p,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:S&&i})});function _5(e){return e?"open":"closed"}var bKe=Rce;const vKe=bKe,yKe=Ice,xKe=Dce;function SKe(e){const{viewState:t,setDiffOptions:n}=v5(e),{collapsedFiles:r}=t.diffOptions,i=T.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(p=>p!==l):[...r,l]})},[r,n]),a=T.useCallback(l=>{n({collapsedFiles:l})},[n]),s=T.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=T.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function EKe(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
124
124
  `))if(a.startsWith("diff --git"))n={path:a.match(/diff --git a\/(.+?) b\//)?.[1]??"unknown",lines:[],additions:0,deletions:0},t.push(n),n.lines.push({type:"header",content:a});else if(a.startsWith("index ")||a.startsWith("---")||a.startsWith("+++"))n?.lines.push({type:"header",content:a});else if(a.startsWith("@@")){const s=a.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);s&&(r=parseInt(s[1],10),i=parseInt(s[2],10)),n?.lines.push({type:"hunk",content:a})}else a.startsWith("+")?n&&(n.additions++,n.lines.push({type:"added",content:a.slice(1),newLineNumber:i++})):a.startsWith("-")?n&&(n.deletions++,n.lines.push({type:"removed",content:a.slice(1),oldLineNumber:r++})):a.startsWith(" ")&&n?.lines.push({type:"context",content:a.slice(1),oldLineNumber:r++,newLineNumber:i++});return t}function _Ke({file:e,wrap:t,isCollapsed:n,onToggle:r}){return f.jsxs(vKe,{open:!n,onOpenChange:()=>r(),children:[f.jsx(yKe,{asChild:!0,children:f.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-card border-b border-border cursor-pointer hover:bg-muted select-none",children:[f.jsx(J,{icon:n?Mu:L0,size:12,strokeWidth:2,className:"text-muted-foreground shrink-0"}),f.jsx("span",{className:"font-mono text-xs text-foreground truncate flex-1",children:e.path}),f.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[e.additions>0&&f.jsxs("span",{className:"text-accent",children:["+",e.additions]}),e.additions>0&&e.deletions>0&&" ",e.deletions>0&&f.jsxs("span",{className:"text-destructive",children:["-",e.deletions]})]})]})}),f.jsx(xKe,{children:f.jsx("div",{className:"font-mono text-xs",children:e.lines.slice(1).map((i,a)=>f.jsxs("div",{className:Be("flex px-2 py-0.5",i.type==="added"&&"bg-accent/10",i.type==="removed"&&"bg-destructive/10",i.type==="header"&&"bg-muted/50 text-muted-foreground",i.type==="hunk"&&"bg-accent/10 text-accent"),children:[(i.type==="added"||i.type==="removed"||i.type==="context")&&f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.oldLineNumber??""}),f.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.newLineNumber??""})]}),f.jsxs("span",{className:Be("w-4 shrink-0 select-none text-center",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:[i.type==="added"&&"+",i.type==="removed"&&"-"]}),f.jsx("span",{className:Be("flex-1",t?"whitespace-pre-wrap break-all":"whitespace-pre",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:i.content})]},a))})})]})}function oQ({taskId:e,worktreePath:t,baseBranch:n}){const{options:r,setOption:i,toggleFileCollapse:a,collapseAll:s,expandAll:o,isFileCollapsed:l}=SKe(e),{wrap:u,ignoreWhitespace:p,includeUntracked:d,collapsedFiles:m}=r,{data:g,isLoading:x,error:S}=ZCe(t,{ignoreWhitespace:p,includeUntracked:d,baseBranch:n}),b=T.useMemo(()=>g?.diff?EKe(g.diff):[],[g?.diff]),y=T.useMemo(()=>b.map(A=>A.path),[b]),v=b.length>0&&m.length===b.length,_=T.useMemo(()=>b.reduce((A,R)=>A+R.additions,0),[b]),C=T.useMemo(()=>b.reduce((A,R)=>A+R.deletions,0),[b]);if(T.useEffect(()=>{const A=R=>{if(R.shiftKey&&R.key==="C"&&!R.ctrlKey&&!R.metaKey&&!R.altKey){const O=R.target;if(O.tagName==="INPUT"||O.tagName==="TEXTAREA"||O.isContentEditable)return;R.preventDefault(),v?o():s(y)}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[v,y,s,o]),!t)return f.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"});if(x)return f.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading diff..."});if(S)return f.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:S.message});const w=g?.files?.some(A=>A.status==="untracked")??!1;return b.length===0?f.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[f.jsx("p",{children:"No changes detected"}),g?.files&&g.files.length>0&&f.jsxs("div",{className:"text-xs",children:[f.jsx("p",{className:"text-center mb-2",children:"Modified files:"}),f.jsxs("div",{className:"flex flex-col gap-1",children:[g.files.map(A=>f.jsxs("div",{className:"flex gap-2",children:[f.jsxs("span",{className:Be("w-4 text-center",A.status==="added"&&"text-accent",A.status==="deleted"&&"text-destructive",A.status==="modified"&&"text-muted-foreground",A.status==="untracked"&&"text-muted-foreground"),children:[A.status==="added"&&"A",A.status==="deleted"&&"D",A.status==="modified"&&"M",A.status==="untracked"&&"?"]}),f.jsx("span",{children:A.path})]},A.path)),w&&f.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-muted-foreground hover:text-foreground mt-1",children:[f.jsx("input",{type:"checkbox",checked:d,onChange:A=>i("includeUntracked",A.target.checked),className:"w-4 h-3"}),f.jsx("span",{children:"Show untracked files"})]})]})]})]}):f.jsxs("div",{className:"flex flex-col h-full bg-background",children:[f.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[g?.branch&&f.jsxs("span",{className:"text-muted-foreground",children:[g.branch,g.isBranchDiff&&g.baseBranch&&f.jsxs("span",{className:"opacity-70",children:[" (vs ",g.baseBranch,")"]})]}),(_>0||C>0)&&f.jsxs("span",{className:"text-muted-foreground",children:[f.jsxs("span",{className:"text-accent",children:["+",_]})," ",f.jsxs("span",{className:"text-destructive",children:["-",C]})]}),f.jsx("div",{className:"flex-1"}),f.jsxs("button",{onClick:()=>v?o():s(y),className:"flex items-center gap-1 px-1.5 py-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:v?"Expand all (Shift+C)":"Collapse all (Shift+C)",children:[f.jsx(J,{icon:v?Mne:Dne,size:12,strokeWidth:2}),f.jsx("span",{className:"hidden sm:inline",children:v?"Expand":"Collapse"})]}),f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[f.jsx("input",{type:"checkbox",checked:u,onChange:A=>i("wrap",A.target.checked),className:"w-3 h-3"}),"Wrap"]}),f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[f.jsx("input",{type:"checkbox",checked:p,onChange:A=>i("ignoreWhitespace",A.target.checked),className:"w-3 h-3"}),"Ignore whitespace"]}),f.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[f.jsx("input",{type:"checkbox",checked:d,onChange:A=>i("includeUntracked",A.target.checked),className:"w-3 h-3"}),"Untracked"]})]}),f.jsx(Cg,{className:"flex-1 min-h-0",children:b.map(A=>f.jsx(_Ke,{file:A,wrap:u,isCollapsed:l(A.path),onToggle:()=>a(A.path)},A.path))})]})}function wKe(e){const{viewState:t,setBrowserUrl:n}=v5(e);return{url:t.browserUrl,setUrl:n}}function lQ({taskId:e}){const{url:t,setUrl:n}=wKe(e),[r,i]=T.useState(t),[a,s]=T.useState(0);T.useEffect(()=>{i(t)},[t]);const o=T.useCallback(()=>{s(u=>u+1)},[]),l=T.useCallback(u=>{u.preventDefault();let p=r.trim();!p.startsWith("http://")&&!p.startsWith("https://")&&(p=`http://${p}`),n(p),s(d=>d+1)},[r,n]);return f.jsxs("div",{className:"flex h-full flex-col bg-background",children:[f.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card px-2 py-1.5",children:[f.jsx(Ae,{variant:"ghost",size:"icon-xs",disabled:!0,children:f.jsx(J,{icon:qu,size:14,strokeWidth:2})}),f.jsx(Ae,{variant:"ghost",size:"icon-xs",disabled:!0,children:f.jsx(J,{icon:Mu,size:14,strokeWidth:2})}),f.jsx(Ae,{variant:"ghost",size:"icon-xs",onClick:o,children:f.jsx(J,{icon:Nw,size:14,strokeWidth:2})}),f.jsx("form",{onSubmit:l,className:"flex-1",children:f.jsx($t,{value:r,onChange:u=>i(u.target.value),className:"h-7 bg-background text-xs",placeholder:"Enter URL..."})})]}),f.jsx("div",{className:"flex-1 overflow-hidden bg-card",children:f.jsx("iframe",{src:t,className:"h-full w-full border-0",title:"Browser Preview",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},a)})]})}function CKe(e){const t=[];function n(r){for(const i of r)i.type==="file"?t.push({name:i.name,path:i.path}):i.children&&n(i.children)}return n(e),t}function Lce(e){const t=e.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","svg","webp","ico"].includes(t)?ISe:["ts","tsx","js","jsx","json","css","html","md","yaml","yml","toml","sh","py","rs","go","sql"].includes(t)?CSe:kSe}function Pce({entry:e,depth:t,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a}){const s=r.includes(e.path),o=n===e.path,l=e.type==="directory",u=T.useCallback(()=>{l?a(e.path):i(e.path)},[l,e.path,i,a]);return f.jsxs("div",{children:[f.jsxs("div",{className:Be("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",o&&"bg-primary/10 text-primary"),style:{paddingLeft:`${t*12+8}px`},onClick:u,children:[f.jsx(J,{icon:l?s?PD:ua:Lce(e.name),size:14,strokeWidth:2,className:Be("shrink-0",l?"text-accent":"text-muted-foreground")}),f.jsx("span",{className:"break-all",children:e.name})]}),l&&s&&e.children&&f.jsx("div",{children:e.children.map(p=>f.jsx(Pce,{entry:p,depth:t+1,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a},p.path))})]})}function TKe({entries:e,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i,onCollapseAll:a}){const[s,o]=T.useState(""),l=T.useMemo(()=>CKe(e),[e]),u=T.useMemo(()=>{if(!s.trim())return null;const d=s.trim();return l.map(m=>({...m,score:Math.max(Ki(m.name,d),Ki(m.path,d))})).filter(m=>m.score>0).sort((m,g)=>g.score-m.score)},[l,s]),p=T.useCallback(()=>{o("")},[]);return e.length===0?f.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No files"}):f.jsxs("div",{className:"flex flex-col h-full bg-background",children:[f.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1 border-b border-border bg-card",children:[f.jsx("span",{className:"text-xs text-muted-foreground",children:"Files"}),f.jsx("button",{onClick:a,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Collapse all folders",children:f.jsx(J,{icon:Dne,size:14,strokeWidth:2})})]}),f.jsx("div",{className:"shrink-0 px-2 py-1.5 border-b border-border bg-card",children:f.jsxs("div",{className:"relative",children:[f.jsx("input",{type:"text",value:s,onChange:d=>o(d.target.value),placeholder:"Search files...",className:"w-full text-sm bg-muted/50 border border-border rounded px-2 py-1 pr-7 placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),s&&f.jsx("button",{onClick:p,className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted",children:f.jsx(J,{icon:Mr,size:12,strokeWidth:2})})]})}),f.jsx("div",{className:"py-1 flex-1 overflow-auto",children:u?u.length>0?u.map(d=>f.jsxs("div",{className:Be("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",t===d.path&&"bg-primary/10 text-primary"),onClick:()=>r(d.path),children:[f.jsx(J,{icon:Lce(d.name),size:14,strokeWidth:2,className:"shrink-0 text-muted-foreground"}),f.jsx("span",{className:"truncate",title:d.path,children:d.name}),f.jsx("span",{className:"text-xs text-muted-foreground truncate ml-auto",children:d.path.split("/").slice(0,-1).join("/")})]},d.path)):f.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No matching files"}):e.map(d=>f.jsx(Pce,{entry:d,depth:0,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i},d.path))})]})}function uQ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function AKe(e){if(Array.isArray(e))return e}function kKe(e,t,n){return(t=PKe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function OKe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(p){u=!0,i=p}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function RKe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
125
125
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?cQ(Object(n),!0).forEach(function(r){kKe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cQ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function NKe(e,t){if(e==null)return{};var n,r,i=IKe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function IKe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function DKe(e,t){return AKe(e)||OKe(e,t)||MKe(e,t)||RKe()}function LKe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function PKe(e){var t=LKe(e,"string");return typeof t=="symbol"?t:t+""}function MKe(e,t){if(e){if(typeof e=="string")return uQ(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?uQ(e,t):void 0}}function jKe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fQ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pQ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?fQ(Object(n),!0).forEach(function(r){jKe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fQ(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function FKe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(i,a){return a(i)},r)}}function wv(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return t.apply(n,[].concat(i,o))}}}function G_(e){return{}.toString.call(e).includes("Object")}function BKe(e){return!Object.keys(e).length}function f0(e){return typeof e=="function"}function UKe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function $Ke(e,t){return G_(t)||xd("changeType"),Object.keys(t).some(function(n){return!UKe(e,n)})&&xd("changeField"),t}function zKe(e){f0(e)||xd("selectorType")}function HKe(e){f0(e)||G_(e)||xd("handlerType"),G_(e)&&Object.values(e).some(function(t){return!f0(t)})&&xd("handlersType")}function WKe(e){e||xd("initialIsRequired"),G_(e)||xd("initialType"),BKe(e)&&xd("initialContent")}function VKe(e,t){throw new Error(e[t]||e.default)}var qKe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},xd=wv(VKe)(qKe),AS={changes:$Ke,selector:zKe,handler:HKe,initial:WKe};function GKe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};AS.initial(e),AS.handler(t);var n={current:e},r=wv(XKe)(n,t),i=wv(YKe)(n),a=wv(AS.changes)(e),s=wv(KKe)(n);function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(p){return p};return AS.selector(u),u(n.current)}function l(u){FKe(r,i,a,s)(u)}return[o,l]}function KKe(e,t){return f0(t)?t(e.current):t}function YKe(e,t){return e.current=pQ(pQ({},e.current),t),t}function XKe(e,t,n){return f0(t)?t(e.current):Object.keys(n).forEach(function(r){var i;return(i=t[r])===null||i===void 0?void 0:i.call(t,e.current[r])}),n}var ZKe={create:GKe},QKe={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function JKe(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return t.apply(n,[].concat(i,o))}}}function eYe(e){return{}.toString.call(e).includes("Object")}function tYe(e){return e||hQ("configIsRequired"),eYe(e)||hQ("configType"),e.urls?(nYe(),{paths:{vs:e.urls.monacoBase}}):e}function nYe(){console.warn(Mce.deprecation)}function rYe(e,t){throw new Error(e[t]||e.default)}var Mce={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
126
126
  You are using deprecated way of configuration.
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/png" href="/logo.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Vibora - Harness Attention. Ship.</title>
8
- <script type="module" crossorigin src="/assets/index-CnXWuHyf.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-BmK-0Oo_.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CfTPmrF1.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibora",
3
- "version": "8.5.2",
3
+ "version": "8.5.3",
4
4
  "description": "Harness Attention. Orchestrate Agents. Ship.",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "repository": {