@tui-sandbox/library 11.8.5 → 11.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/browser/assets/{index-I3bAGYav.js → index-BOBslGJV.js} +1 -1
  3. package/dist/browser/index.html +1 -1
  4. package/dist/src/scripts/commands/commandTuiNeovimExec.d.ts +2 -2
  5. package/dist/src/scripts/commands/commandTuiNeovimExec.js +10 -3
  6. package/dist/src/scripts/commands/commandTuiNeovimExec.js.map +1 -1
  7. package/dist/src/scripts/commands/commandTuiNeovimPrepare.d.ts +2 -2
  8. package/dist/src/scripts/commands/commandTuiNeovimPrepare.js +1 -1
  9. package/dist/src/scripts/commands/commandTuiNeovimPrepare.js.map +1 -1
  10. package/dist/src/scripts/commands/commandTuiStart.d.ts +2 -2
  11. package/dist/src/scripts/commands/commandTuiStart.js +2 -2
  12. package/dist/src/scripts/commands/commandTuiStart.js.map +1 -1
  13. package/dist/src/scripts/parseArguments.js +0 -4
  14. package/dist/src/scripts/parseArguments.js.map +1 -1
  15. package/dist/src/scripts/resolveConfig.test.js +6 -3
  16. package/dist/src/scripts/resolveConfig.test.js.map +1 -1
  17. package/dist/src/scripts/resolveTuiConfig.d.ts +2 -2
  18. package/dist/src/scripts/resolveTuiConfig.js +8 -2
  19. package/dist/src/scripts/resolveTuiConfig.js.map +1 -1
  20. package/dist/src/scripts/tui.js.map +1 -1
  21. package/dist/src/server/applications/neovim/NeovimApplication.js +1 -1
  22. package/dist/src/server/applications/neovim/NeovimApplication.js.map +1 -1
  23. package/dist/src/server/applications/terminal/TerminalTestApplication.js +1 -1
  24. package/dist/src/server/applications/terminal/TerminalTestApplication.js.map +1 -1
  25. package/dist/src/server/applications/terminal/runBlockingShellCommand.js +1 -1
  26. package/dist/src/server/applications/terminal/runBlockingShellCommand.js.map +1 -1
  27. package/dist/src/server/updateTestdirectorySchemaFile.d.ts +4 -0
  28. package/dist/src/server/updateTestdirectorySchemaFile.js.map +1 -1
  29. package/dist/tsconfig.tsbuildinfo +1 -1
  30. package/package.json +4 -4
  31. package/src/scripts/commands/commandTuiNeovimExec.ts +18 -5
  32. package/src/scripts/commands/commandTuiNeovimPrepare.ts +3 -3
  33. package/src/scripts/commands/commandTuiStart.ts +4 -4
  34. package/src/scripts/parseArguments.ts +0 -4
  35. package/src/scripts/resolveConfig.test.ts +6 -3
  36. package/src/scripts/resolveTuiConfig.ts +10 -4
  37. package/src/scripts/tui.ts +2 -2
  38. package/src/server/applications/neovim/NeovimApplication.ts +1 -1
  39. package/src/server/applications/terminal/TerminalTestApplication.ts +1 -1
  40. package/src/server/applications/terminal/runBlockingShellCommand.ts +1 -1
  41. package/src/server/updateTestdirectorySchemaFile.ts +5 -0
@@ -6,4 +6,4 @@ WARNING: This link could potentially be dangerous`)){const a=window.open();if(a)
6
6
  `:`
7
7
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),a.isLinux&&g&&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(g){const E=this._getMouseBufferCoords(g),P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!!(P&&O&&E)&&this._areCoordsInSelection(E,P,O)}isCellInSelection(g,E){const P=this._model.finalSelectionStart,O=this._model.finalSelectionEnd;return!(!P||!O)&&this._areCoordsInSelection([g,E],P,O)}_areCoordsInSelection(g,E,P){return g[1]>E[1]&&g[1]<P[1]||E[1]===P[1]&&g[1]===E[1]&&g[0]>=E[0]&&g[0]<P[0]||E[1]<P[1]&&g[1]===P[1]&&g[0]<P[0]||E[1]<P[1]&&g[1]===E[1]&&g[0]>=E[0]}_selectWordAtCursor(g,E){const P=this._linkifier.currentLink?.link?.range;if(P)return this._model.selectionStart=[P.start.x-1,P.start.y-1],this._model.selectionStartLength=(0,i.getRangeLength)(P,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const O=this._getMouseBufferCoords(g);return!!O&&(this._selectWordAt(O,E),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,E){this._model.clearSelection(),g=Math.max(g,0),E=Math.min(E,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,E],this.refresh(),this._onSelectionChange.fire()}_handleTrim(g){this._model.handleTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const E=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(E)return E[0]--,E[1]--,E[1]+=this._bufferService.buffer.ydisp,E}_getMouseEventScrollAmount(g){let E=(0,h.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const P=this._renderService.dimensions.css.canvas.height;return E>=0&&E<=P?0:(E>P&&(E-=P),E=Math.min(Math.max(E,-50),50),E/=50,E/Math.abs(E)+Math.round(14*E))}shouldForceSelection(g){return a.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}handleMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._handleIncrementalClick(g):g.detail===1?this._handleSingleClick(g):g.detail===2?this._handleDoubleClick(g):g.detail===3&&this._handleTripleClick(g),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(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_handleSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const E=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);E&&E.length!==this._model.selectionStart[0]&&E.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(g){const E=this._getMouseBufferCoords(g);E&&(this._activeSelectionMode=2,this._selectLineAt(E[1]))}shouldColumnSelect(g){return g.altKey&&!(a.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const E=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!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(g),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const P=this._bufferService.buffer;if(this._model.selectionEnd[1]<P.lines.length){const O=P.lines.get(this._model.selectionEnd[1]);O&&O.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}E&&E[0]===this._model.selectionEnd[0]&&E[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 g=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_handleMouseUp(g){const E=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&E<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const P=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(P&&P[0]!==void 0&&P[1]!==void 0){const O=(0,f.moveToCellSequence)(P[0]-1,P[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(O,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,E=this._model.finalSelectionEnd,P=!(!g||!E||g[0]===E[0]&&g[1]===E[1]);P?g&&E&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&E[0]===this._oldSelectionEnd[0]&&E[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,E,P)):this._oldHasSelection&&this._fireOnSelectionChange(g,E,P)}_fireOnSelectionChange(g,E,P){this._oldSelectionStart=g,this._oldSelectionEnd=E,this._oldHasSelection=P,this._onSelectionChange.fire()}_handleBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim((E=>this._handleTrim(E)))}_convertViewportColToCharacterIndex(g,E){let P=E;for(let O=0;E>=O;O++){const B=g.loadCell(O,this._workCell).getChars().length;this._workCell.getWidth()===0?P--:B>1&&E!==O&&(P+=B-1)}return P}setSelection(g,E,P){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,E],this._model.selectionStartLength=P,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,E,P=!0,O=!0){if(g[0]>=this._bufferService.cols)return;const B=this._bufferService.buffer,R=B.lines.get(g[1]);if(!R)return;const M=B.translateBufferLineToString(g[1],!1);let z=this._convertViewportColToCharacterIndex(R,g[0]),U=z;const K=g[0]-z;let W=0,x=0,L=0,A=0;if(M.charAt(z)===" "){for(;z>0&&M.charAt(z-1)===" ";)z--;for(;U<M.length&&M.charAt(U+1)===" ";)U++}else{let N=g[0],V=g[0];R.getWidth(N)===0&&(W++,N--),R.getWidth(V)===2&&(x++,V++);const G=R.getString(V).length;for(G>1&&(A+=G-1,U+=G-1);N>0&&z>0&&!this._isCharWordSeparator(R.loadCell(N-1,this._workCell));){R.loadCell(N-1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===0?(W++,N--):I>1&&(L+=I-1,z-=I-1),z--,N--}for(;V<R.length&&U+1<M.length&&!this._isCharWordSeparator(R.loadCell(V+1,this._workCell));){R.loadCell(V+1,this._workCell);const I=this._workCell.getChars().length;this._workCell.getWidth()===2?(x++,V++):I>1&&(A+=I-1,U+=I-1),U++,V++}}U++;let T=z+K-W+L,F=Math.min(this._bufferService.cols,U-z+W+x-L-A);if(E||M.slice(z,U).trim()!==""){if(P&&T===0&&R.getCodePoint(0)!==32){const N=B.lines.get(g[1]-1);if(N&&R.isWrapped&&N.getCodePoint(this._bufferService.cols-1)!==32){const V=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(V){const G=this._bufferService.cols-V.start;T-=G,F+=G}}}if(O&&T+F===this._bufferService.cols&&R.getCodePoint(this._bufferService.cols-1)!==32){const N=B.lines.get(g[1]+1);if(N?.isWrapped&&N.getCodePoint(0)!==32){const V=this._getWordAt([0,g[1]+1],!1,!1,!0);V&&(F+=V.length)}}return{start:T,length:F}}}_selectWordAt(g,E){const P=this._getWordAt(g,E);if(P){for(;P.start<0;)P.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[P.start,g[1]],this._model.selectionStartLength=P.length}}_selectToWordAt(g){const E=this._getWordAt(g,!0);if(E){let P=g[1];for(;E.start<0;)E.start+=this._bufferService.cols,P--;if(!this._model.areSelectionValuesReversed())for(;E.start+E.length>this._bufferService.cols;)E.length-=this._bufferService.cols,P++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?E.start:E.start+E.length,P]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const E=this._bufferService.buffer.getWrappedRangeForLine(g),P={start:{x:0,y:E.first},end:{x:this._bufferService.cols-1,y:E.last}};this._model.selectionStart=[0,E.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,i.getRangeLength)(P,this._bufferService.cols)}};r.SelectionService=C=l([_(3,d.IBufferService),_(4,d.ICoreService),_(5,b.IMouseService),_(6,d.IOptionsService),_(7,b.IRenderService),_(8,b.ICoreBrowserService)],C)},4725:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ILinkProviderService=r.IThemeService=r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const l=n(8343);r.ICharSizeService=(0,l.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,l.createDecorator)("CoreBrowserService"),r.IMouseService=(0,l.createDecorator)("MouseService"),r.IRenderService=(0,l.createDecorator)("RenderService"),r.ISelectionService=(0,l.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,l.createDecorator)("CharacterJoinerService"),r.IThemeService=(0,l.createDecorator)("ThemeService"),r.ILinkProviderService=(0,l.createDecorator)("LinkProviderService")},6731:function(w,r,n){var l=this&&this.__decorate||function(C,g,E,P){var O,B=arguments.length,R=B<3?g:P===null?P=Object.getOwnPropertyDescriptor(g,E):P;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(C,g,E,P);else for(var M=C.length-1;M>=0;M--)(O=C[M])&&(R=(B<3?O(R):B>3?O(g,E,R):O(g,E))||R);return B>3&&R&&Object.defineProperty(g,E,R),R},_=this&&this.__param||function(C,g){return function(E,P){g(E,P,C)}};Object.defineProperty(r,"__esModule",{value:!0}),r.ThemeService=r.DEFAULT_ANSI_COLORS=void 0;const h=n(7239),f=n(8055),v=n(8460),b=n(844),u=n(2585),s=f.css.toColor("#ffffff"),a=f.css.toColor("#000000"),i=f.css.toColor("#ffffff"),o=f.css.toColor("#000000"),d={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const C=[f.css.toColor("#2e3436"),f.css.toColor("#cc0000"),f.css.toColor("#4e9a06"),f.css.toColor("#c4a000"),f.css.toColor("#3465a4"),f.css.toColor("#75507b"),f.css.toColor("#06989a"),f.css.toColor("#d3d7cf"),f.css.toColor("#555753"),f.css.toColor("#ef2929"),f.css.toColor("#8ae234"),f.css.toColor("#fce94f"),f.css.toColor("#729fcf"),f.css.toColor("#ad7fa8"),f.css.toColor("#34e2e2"),f.css.toColor("#eeeeec")],g=[0,95,135,175,215,255];for(let E=0;E<216;E++){const P=g[E/36%6|0],O=g[E/6%6|0],B=g[E%6];C.push({css:f.channels.toCss(P,O,B),rgba:f.channels.toRgba(P,O,B)})}for(let E=0;E<24;E++){const P=8+10*E;C.push({css:f.channels.toCss(P,P,P),rgba:f.channels.toRgba(P,P,P)})}return C})());let S=r.ThemeService=class extends b.Disposable{get colors(){return this._colors}constructor(C){super(),this._optionsService=C,this._contrastCache=new h.ColorContrastCache,this._halfContrastCache=new h.ColorContrastCache,this._onChangeColors=this.register(new v.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:s,background:a,cursor:i,cursorAccent:o,selectionForeground:void 0,selectionBackgroundTransparent:d,selectionBackgroundOpaque:f.color.blend(a,d),selectionInactiveBackgroundTransparent:d,selectionInactiveBackgroundOpaque:f.color.blend(a,d),ansi:r.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(C={}){const g=this._colors;if(g.foreground=y(C.foreground,s),g.background=y(C.background,a),g.cursor=y(C.cursor,i),g.cursorAccent=y(C.cursorAccent,o),g.selectionBackgroundTransparent=y(C.selectionBackground,d),g.selectionBackgroundOpaque=f.color.blend(g.background,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundTransparent=y(C.selectionInactiveBackground,g.selectionBackgroundTransparent),g.selectionInactiveBackgroundOpaque=f.color.blend(g.background,g.selectionInactiveBackgroundTransparent),g.selectionForeground=C.selectionForeground?y(C.selectionForeground,f.NULL_COLOR):void 0,g.selectionForeground===f.NULL_COLOR&&(g.selectionForeground=void 0),f.color.isOpaque(g.selectionBackgroundTransparent)&&(g.selectionBackgroundTransparent=f.color.opacity(g.selectionBackgroundTransparent,.3)),f.color.isOpaque(g.selectionInactiveBackgroundTransparent)&&(g.selectionInactiveBackgroundTransparent=f.color.opacity(g.selectionInactiveBackgroundTransparent,.3)),g.ansi=r.DEFAULT_ANSI_COLORS.slice(),g.ansi[0]=y(C.black,r.DEFAULT_ANSI_COLORS[0]),g.ansi[1]=y(C.red,r.DEFAULT_ANSI_COLORS[1]),g.ansi[2]=y(C.green,r.DEFAULT_ANSI_COLORS[2]),g.ansi[3]=y(C.yellow,r.DEFAULT_ANSI_COLORS[3]),g.ansi[4]=y(C.blue,r.DEFAULT_ANSI_COLORS[4]),g.ansi[5]=y(C.magenta,r.DEFAULT_ANSI_COLORS[5]),g.ansi[6]=y(C.cyan,r.DEFAULT_ANSI_COLORS[6]),g.ansi[7]=y(C.white,r.DEFAULT_ANSI_COLORS[7]),g.ansi[8]=y(C.brightBlack,r.DEFAULT_ANSI_COLORS[8]),g.ansi[9]=y(C.brightRed,r.DEFAULT_ANSI_COLORS[9]),g.ansi[10]=y(C.brightGreen,r.DEFAULT_ANSI_COLORS[10]),g.ansi[11]=y(C.brightYellow,r.DEFAULT_ANSI_COLORS[11]),g.ansi[12]=y(C.brightBlue,r.DEFAULT_ANSI_COLORS[12]),g.ansi[13]=y(C.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),g.ansi[14]=y(C.brightCyan,r.DEFAULT_ANSI_COLORS[14]),g.ansi[15]=y(C.brightWhite,r.DEFAULT_ANSI_COLORS[15]),C.extendedAnsi){const E=Math.min(g.ansi.length-16,C.extendedAnsi.length);for(let P=0;P<E;P++)g.ansi[P+16]=y(C.extendedAnsi[P],r.DEFAULT_ANSI_COLORS[P+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(C){this._restoreColor(C),this._onChangeColors.fire(this.colors)}_restoreColor(C){if(C!==void 0)switch(C){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[C]=this._restoreColors.ansi[C]}else for(let g=0;g<this._restoreColors.ansi.length;++g)this._colors.ansi[g]=this._restoreColors.ansi[g]}modifyColors(C){C(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 y(C,g){if(C!==void 0)try{return f.css.toColor(C)}catch{}return g}r.ThemeService=S=l([_(0,u.IOptionsService)],S)},6349:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const l=n(8460),_=n(844);class h extends _.Disposable{constructor(v){super(),this._maxLength=v,this.onDeleteEmitter=this.register(new l.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new l.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new l.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(v){if(this._maxLength===v)return;const b=new Array(v);for(let u=0;u<Math.min(v,this.length);u++)b[u]=this._array[this._getCyclicIndex(u)];this._array=b,this._maxLength=v,this._startIndex=0}get length(){return this._length}set length(v){if(v>this._length)for(let b=this._length;b<v;b++)this._array[b]=void 0;this._length=v}get(v){return this._array[this._getCyclicIndex(v)]}set(v,b){this._array[this._getCyclicIndex(v)]=b}push(v){this._array[this._getCyclicIndex(this._length)]=v,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(v,b,...u){if(b){for(let s=v;s<this._length-b;s++)this._array[this._getCyclicIndex(s)]=this._array[this._getCyclicIndex(s+b)];this._length-=b,this.onDeleteEmitter.fire({index:v,amount:b})}for(let s=this._length-1;s>=v;s--)this._array[this._getCyclicIndex(s+u.length)]=this._array[this._getCyclicIndex(s)];for(let s=0;s<u.length;s++)this._array[this._getCyclicIndex(v+s)]=u[s];if(u.length&&this.onInsertEmitter.fire({index:v,amount:u.length}),this._length+u.length>this._maxLength){const s=this._length+u.length-this._maxLength;this._startIndex+=s,this._length=this._maxLength,this.onTrimEmitter.fire(s)}else this._length+=u.length}trimStart(v){v>this._length&&(v=this._length),this._startIndex+=v,this._length-=v,this.onTrimEmitter.fire(v)}shiftElements(v,b,u){if(!(b<=0)){if(v<0||v>=this._length)throw new Error("start argument out of range");if(v+u<0)throw new Error("Cannot shift elements in list beyond index 0");if(u>0){for(let a=b-1;a>=0;a--)this.set(v+a+u,this.get(v+a));const s=v+b+u-this._length;if(s>0)for(this._length+=s;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let s=0;s<b;s++)this.set(v+s+u,this.get(v+s))}}_getCyclicIndex(v){return(this._startIndex+v)%this._maxLength}}r.CircularList=h},1439:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function n(l,_=5){if(typeof l!="object")return l;const h=Array.isArray(l)?[]:{};for(const f in l)h[f]=_<=1?l[f]:l[f]&&n(l[f],_-1);return h}},8055:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.contrastRatio=r.toPaddedHex=r.rgba=r.rgb=r.css=r.color=r.channels=r.NULL_COLOR=void 0;let n=0,l=0,_=0,h=0;var f,v,b,u,s;function a(o){const d=o.toString(16);return d.length<2?"0"+d:d}function i(o,d){return o<d?(d+.05)/(o+.05):(o+.05)/(d+.05)}r.NULL_COLOR={css:"#00000000",rgba:0},(function(o){o.toCss=function(d,S,y,C){return C!==void 0?`#${a(d)}${a(S)}${a(y)}${a(C)}`:`#${a(d)}${a(S)}${a(y)}`},o.toRgba=function(d,S,y,C=255){return(d<<24|S<<16|y<<8|C)>>>0},o.toColor=function(d,S,y,C){return{css:o.toCss(d,S,y,C),rgba:o.toRgba(d,S,y,C)}}})(f||(r.channels=f={})),(function(o){function d(S,y){return h=Math.round(255*y),[n,l,_]=s.toChannels(S.rgba),{css:f.toCss(n,l,_,h),rgba:f.toRgba(n,l,_,h)}}o.blend=function(S,y){if(h=(255&y.rgba)/255,h===1)return{css:y.css,rgba:y.rgba};const C=y.rgba>>24&255,g=y.rgba>>16&255,E=y.rgba>>8&255,P=S.rgba>>24&255,O=S.rgba>>16&255,B=S.rgba>>8&255;return n=P+Math.round((C-P)*h),l=O+Math.round((g-O)*h),_=B+Math.round((E-B)*h),{css:f.toCss(n,l,_),rgba:f.toRgba(n,l,_)}},o.isOpaque=function(S){return(255&S.rgba)==255},o.ensureContrastRatio=function(S,y,C){const g=s.ensureContrastRatio(S.rgba,y.rgba,C);if(g)return f.toColor(g>>24&255,g>>16&255,g>>8&255)},o.opaque=function(S){const y=(255|S.rgba)>>>0;return[n,l,_]=s.toChannels(y),{css:f.toCss(n,l,_),rgba:y}},o.opacity=d,o.multiplyOpacity=function(S,y){return h=255&S.rgba,d(S,h*y/255)},o.toColorRGB=function(S){return[S.rgba>>24&255,S.rgba>>16&255,S.rgba>>8&255]}})(v||(r.color=v={})),(function(o){let d,S;try{const y=document.createElement("canvas");y.width=1,y.height=1;const C=y.getContext("2d",{willReadFrequently:!0});C&&(d=C,d.globalCompositeOperation="copy",S=d.createLinearGradient(0,0,1,1))}catch{}o.toColor=function(y){if(y.match(/#[\da-f]{3,8}/i))switch(y.length){case 4:return n=parseInt(y.slice(1,2).repeat(2),16),l=parseInt(y.slice(2,3).repeat(2),16),_=parseInt(y.slice(3,4).repeat(2),16),f.toColor(n,l,_);case 5:return n=parseInt(y.slice(1,2).repeat(2),16),l=parseInt(y.slice(2,3).repeat(2),16),_=parseInt(y.slice(3,4).repeat(2),16),h=parseInt(y.slice(4,5).repeat(2),16),f.toColor(n,l,_,h);case 7:return{css:y,rgba:(parseInt(y.slice(1),16)<<8|255)>>>0};case 9:return{css:y,rgba:parseInt(y.slice(1),16)>>>0}}const C=y.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(C)return n=parseInt(C[1]),l=parseInt(C[2]),_=parseInt(C[3]),h=Math.round(255*(C[5]===void 0?1:parseFloat(C[5]))),f.toColor(n,l,_,h);if(!d||!S)throw new Error("css.toColor: Unsupported css format");if(d.fillStyle=S,d.fillStyle=y,typeof d.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(d.fillRect(0,0,1,1),[n,l,_,h]=d.getImageData(0,0,1,1).data,h!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:f.toRgba(n,l,_,h),css:y}}})(b||(r.css=b={})),(function(o){function d(S,y,C){const g=S/255,E=y/255,P=C/255;return .2126*(g<=.03928?g/12.92:Math.pow((g+.055)/1.055,2.4))+.7152*(E<=.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))+.0722*(P<=.03928?P/12.92:Math.pow((P+.055)/1.055,2.4))}o.relativeLuminance=function(S){return d(S>>16&255,S>>8&255,255&S)},o.relativeLuminance2=d})(u||(r.rgb=u={})),(function(o){function d(y,C,g){const E=y>>24&255,P=y>>16&255,O=y>>8&255;let B=C>>24&255,R=C>>16&255,M=C>>8&255,z=i(u.relativeLuminance2(B,R,M),u.relativeLuminance2(E,P,O));for(;z<g&&(B>0||R>0||M>0);)B-=Math.max(0,Math.ceil(.1*B)),R-=Math.max(0,Math.ceil(.1*R)),M-=Math.max(0,Math.ceil(.1*M)),z=i(u.relativeLuminance2(B,R,M),u.relativeLuminance2(E,P,O));return(B<<24|R<<16|M<<8|255)>>>0}function S(y,C,g){const E=y>>24&255,P=y>>16&255,O=y>>8&255;let B=C>>24&255,R=C>>16&255,M=C>>8&255,z=i(u.relativeLuminance2(B,R,M),u.relativeLuminance2(E,P,O));for(;z<g&&(B<255||R<255||M<255);)B=Math.min(255,B+Math.ceil(.1*(255-B))),R=Math.min(255,R+Math.ceil(.1*(255-R))),M=Math.min(255,M+Math.ceil(.1*(255-M))),z=i(u.relativeLuminance2(B,R,M),u.relativeLuminance2(E,P,O));return(B<<24|R<<16|M<<8|255)>>>0}o.blend=function(y,C){if(h=(255&C)/255,h===1)return C;const g=C>>24&255,E=C>>16&255,P=C>>8&255,O=y>>24&255,B=y>>16&255,R=y>>8&255;return n=O+Math.round((g-O)*h),l=B+Math.round((E-B)*h),_=R+Math.round((P-R)*h),f.toRgba(n,l,_)},o.ensureContrastRatio=function(y,C,g){const E=u.relativeLuminance(y>>8),P=u.relativeLuminance(C>>8);if(i(E,P)<g){if(P<E){const R=d(y,C,g),M=i(E,u.relativeLuminance(R>>8));if(M<g){const z=S(y,C,g);return M>i(E,u.relativeLuminance(z>>8))?R:z}return R}const O=S(y,C,g),B=i(E,u.relativeLuminance(O>>8));if(B<g){const R=d(y,C,g);return B>i(E,u.relativeLuminance(R>>8))?O:R}return O}},o.reduceLuminance=d,o.increaseLuminance=S,o.toChannels=function(y){return[y>>24&255,y>>16&255,y>>8&255,255&y]}})(s||(r.rgba=s={})),r.toPaddedHex=a,r.contrastRatio=i},8969:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const l=n(844),_=n(2585),h=n(4348),f=n(7866),v=n(744),b=n(7302),u=n(6975),s=n(8460),a=n(1753),i=n(1480),o=n(7994),d=n(9282),S=n(5435),y=n(5981),C=n(2660);let g=!1;class E extends l.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new s.EventEmitter),this._onScroll.event((O=>{this._onScrollApi?.fire(O.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(O){for(const B in O)this.optionsService.options[B]=O[B]}constructor(O){super(),this._windowsWrappingHeuristics=this.register(new l.MutableDisposable),this._onBinary=this.register(new s.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new s.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new s.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new s.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new s.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new s.EventEmitter),this._instantiationService=new h.InstantiationService,this.optionsService=this.register(new b.OptionsService(O)),this._instantiationService.setService(_.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(v.BufferService)),this._instantiationService.setService(_.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(f.LogService)),this._instantiationService.setService(_.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(u.CoreService)),this._instantiationService.setService(_.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(a.CoreMouseService)),this._instantiationService.setService(_.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(i.UnicodeService)),this._instantiationService.setService(_.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(o.CharsetService),this._instantiationService.setService(_.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(C.OscLinkService),this._instantiationService.setService(_.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new S.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,s.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,s.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,s.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,s.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((B=>{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((B=>{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 y.WriteBuffer(((B,R)=>this._inputHandler.parse(B,R)))),this.register((0,s.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(O,B){this._writeBuffer.write(O,B)}writeSync(O,B){this._logService.logLevel<=_.LogLevelEnum.WARN&&!g&&(this._logService.warn("writeSync is unreliable and will be removed soon."),g=!0),this._writeBuffer.writeSync(O,B)}input(O,B=!0){this.coreService.triggerDataEvent(O,B)}resize(O,B){isNaN(O)||isNaN(B)||(O=Math.max(O,v.MINIMUM_COLS),B=Math.max(B,v.MINIMUM_ROWS),this._bufferService.resize(O,B))}scroll(O,B=!1){this._bufferService.scroll(O,B)}scrollLines(O,B,R){this._bufferService.scrollLines(O,B,R)}scrollPages(O){this.scrollLines(O*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(O){const B=O-this._bufferService.buffer.ydisp;B!==0&&this.scrollLines(B)}registerEscHandler(O,B){return this._inputHandler.registerEscHandler(O,B)}registerDcsHandler(O,B){return this._inputHandler.registerDcsHandler(O,B)}registerCsiHandler(O,B){return this._inputHandler.registerCsiHandler(O,B)}registerOscHandler(O,B){return this._inputHandler.registerOscHandler(O,B)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let O=!1;const B=this.optionsService.rawOptions.windowsPty;B&&B.buildNumber!==void 0&&B.buildNumber!==void 0?O=B.backend==="conpty"&&B.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(O=!0),O?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const O=[];O.push(this.onLineFeed(d.updateWindowsModeWrappedState.bind(null,this._bufferService))),O.push(this.registerCsiHandler({final:"H"},(()=>((0,d.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,l.toDisposable)((()=>{for(const B of O)B.dispose()}))}}}r.CoreTerminal=E},8460:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.runAndSubscribe=r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=n=>(this._listeners.push(n),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===n)return void this._listeners.splice(l,1)}}})),this._event}fire(n,l){const _=[];for(let h=0;h<this._listeners.length;h++)_.push(this._listeners[h]);for(let h=0;h<_.length;h++)_[h].call(void 0,n,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},r.forwardEvent=function(n,l){return n((_=>l.fire(_)))},r.runAndSubscribe=function(n,l){return l(void 0),n((_=>l(_)))}},5435:function(w,r,n){var l=this&&this.__decorate||function(W,x,L,A){var T,F=arguments.length,N=F<3?x:A===null?A=Object.getOwnPropertyDescriptor(x,L):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(W,x,L,A);else for(var V=W.length-1;V>=0;V--)(T=W[V])&&(N=(F<3?T(N):F>3?T(x,L,N):T(x,L))||N);return F>3&&N&&Object.defineProperty(x,L,N),N},_=this&&this.__param||function(W,x){return function(L,A){x(L,A,W)}};Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const h=n(2584),f=n(7116),v=n(2015),b=n(844),u=n(482),s=n(8437),a=n(8460),i=n(643),o=n(511),d=n(3734),S=n(2585),y=n(1480),C=n(6242),g=n(6351),E=n(5941),P={"(":0,")":1,"*":2,"+":3,"-":1,".":2},O=131072;function B(W,x){if(W>24)return x.setWinLines||!1;switch(W){case 1:return!!x.restoreWin;case 2:return!!x.minimizeWin;case 3:return!!x.setWinPosition;case 4:return!!x.setWinSizePixels;case 5:return!!x.raiseWin;case 6:return!!x.lowerWin;case 7:return!!x.refreshWin;case 8:return!!x.setWinSizeChars;case 9:return!!x.maximizeWin;case 10:return!!x.fullscreenWin;case 11:return!!x.getWinState;case 13:return!!x.getWinPosition;case 14:return!!x.getWinSizePixels;case 15:return!!x.getScreenSizePixels;case 16:return!!x.getCellSizePixels;case 18:return!!x.getWinSizeChars;case 19:return!!x.getScreenSizeChars;case 20:return!!x.getIconTitle;case 21:return!!x.getWinTitle;case 22:return!!x.pushTitle;case 23:return!!x.popTitle;case 24:return!!x.setWinLines}return!1}var R;(function(W){W[W.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",W[W.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(R||(r.WindowsOptionsReportType=R={}));let M=0;class z extends b.Disposable{getAttrData(){return this._curAttrData}constructor(x,L,A,T,F,N,V,G,I=new v.EscapeSequenceParser){super(),this._bufferService=x,this._charsetService=L,this._coreService=A,this._logService=T,this._optionsService=F,this._oscLinkService=N,this._coreMouseService=V,this._unicodeService=G,this._parser=I,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new u.StringToUtf32,this._utf8Decoder=new u.Utf8ToUtf32,this._workCell=new o.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new a.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new a.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new a.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new a.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new a.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new a.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new a.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new a.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new a.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new a.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new a.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new a.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new a.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new U(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((D=>this._activeBuffer=D.activeBuffer))),this._parser.setCsiHandlerFallback(((D,H)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(D),params:H.toArray()})})),this._parser.setEscHandlerFallback((D=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(D)})})),this._parser.setExecuteHandlerFallback((D=>{this._logService.debug("Unknown EXECUTE code: ",{code:D})})),this._parser.setOscHandlerFallback(((D,H,$)=>{this._logService.debug("Unknown OSC code: ",{identifier:D,action:H,data:$})})),this._parser.setDcsHandlerFallback(((D,H,$)=>{H==="HOOK"&&($=$.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(D),action:H,payload:$})})),this._parser.setPrintHandler(((D,H,$)=>this.print(D,H,$))),this._parser.registerCsiHandler({final:"@"},(D=>this.insertChars(D))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(D=>this.scrollLeft(D))),this._parser.registerCsiHandler({final:"A"},(D=>this.cursorUp(D))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(D=>this.scrollRight(D))),this._parser.registerCsiHandler({final:"B"},(D=>this.cursorDown(D))),this._parser.registerCsiHandler({final:"C"},(D=>this.cursorForward(D))),this._parser.registerCsiHandler({final:"D"},(D=>this.cursorBackward(D))),this._parser.registerCsiHandler({final:"E"},(D=>this.cursorNextLine(D))),this._parser.registerCsiHandler({final:"F"},(D=>this.cursorPrecedingLine(D))),this._parser.registerCsiHandler({final:"G"},(D=>this.cursorCharAbsolute(D))),this._parser.registerCsiHandler({final:"H"},(D=>this.cursorPosition(D))),this._parser.registerCsiHandler({final:"I"},(D=>this.cursorForwardTab(D))),this._parser.registerCsiHandler({final:"J"},(D=>this.eraseInDisplay(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(D=>this.eraseInDisplay(D,!0))),this._parser.registerCsiHandler({final:"K"},(D=>this.eraseInLine(D,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(D=>this.eraseInLine(D,!0))),this._parser.registerCsiHandler({final:"L"},(D=>this.insertLines(D))),this._parser.registerCsiHandler({final:"M"},(D=>this.deleteLines(D))),this._parser.registerCsiHandler({final:"P"},(D=>this.deleteChars(D))),this._parser.registerCsiHandler({final:"S"},(D=>this.scrollUp(D))),this._parser.registerCsiHandler({final:"T"},(D=>this.scrollDown(D))),this._parser.registerCsiHandler({final:"X"},(D=>this.eraseChars(D))),this._parser.registerCsiHandler({final:"Z"},(D=>this.cursorBackwardTab(D))),this._parser.registerCsiHandler({final:"`"},(D=>this.charPosAbsolute(D))),this._parser.registerCsiHandler({final:"a"},(D=>this.hPositionRelative(D))),this._parser.registerCsiHandler({final:"b"},(D=>this.repeatPrecedingCharacter(D))),this._parser.registerCsiHandler({final:"c"},(D=>this.sendDeviceAttributesPrimary(D))),this._parser.registerCsiHandler({prefix:">",final:"c"},(D=>this.sendDeviceAttributesSecondary(D))),this._parser.registerCsiHandler({final:"d"},(D=>this.linePosAbsolute(D))),this._parser.registerCsiHandler({final:"e"},(D=>this.vPositionRelative(D))),this._parser.registerCsiHandler({final:"f"},(D=>this.hVPosition(D))),this._parser.registerCsiHandler({final:"g"},(D=>this.tabClear(D))),this._parser.registerCsiHandler({final:"h"},(D=>this.setMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(D=>this.setModePrivate(D))),this._parser.registerCsiHandler({final:"l"},(D=>this.resetMode(D))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(D=>this.resetModePrivate(D))),this._parser.registerCsiHandler({final:"m"},(D=>this.charAttributes(D))),this._parser.registerCsiHandler({final:"n"},(D=>this.deviceStatus(D))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(D=>this.deviceStatusPrivate(D))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(D=>this.softReset(D))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(D=>this.setCursorStyle(D))),this._parser.registerCsiHandler({final:"r"},(D=>this.setScrollRegion(D))),this._parser.registerCsiHandler({final:"s"},(D=>this.saveCursor(D))),this._parser.registerCsiHandler({final:"t"},(D=>this.windowOptions(D))),this._parser.registerCsiHandler({final:"u"},(D=>this.restoreCursor(D))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(D=>this.insertColumns(D))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(D=>this.deleteColumns(D))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(D=>this.selectProtected(D))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(D=>this.requestMode(D,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(D=>this.requestMode(D,!1))),this._parser.setExecuteHandler(h.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(h.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(h.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(h.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(h.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(h.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(h.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(h.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(h.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(h.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new C.OscHandler((D=>(this.setTitle(D),this.setIconName(D),!0)))),this._parser.registerOscHandler(1,new C.OscHandler((D=>this.setIconName(D)))),this._parser.registerOscHandler(2,new C.OscHandler((D=>this.setTitle(D)))),this._parser.registerOscHandler(4,new C.OscHandler((D=>this.setOrReportIndexedColor(D)))),this._parser.registerOscHandler(8,new C.OscHandler((D=>this.setHyperlink(D)))),this._parser.registerOscHandler(10,new C.OscHandler((D=>this.setOrReportFgColor(D)))),this._parser.registerOscHandler(11,new C.OscHandler((D=>this.setOrReportBgColor(D)))),this._parser.registerOscHandler(12,new C.OscHandler((D=>this.setOrReportCursorColor(D)))),this._parser.registerOscHandler(104,new C.OscHandler((D=>this.restoreIndexedColor(D)))),this._parser.registerOscHandler(110,new C.OscHandler((D=>this.restoreFgColor(D)))),this._parser.registerOscHandler(111,new C.OscHandler((D=>this.restoreBgColor(D)))),this._parser.registerOscHandler(112,new C.OscHandler((D=>this.restoreCursorColor(D)))),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 D in f.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:D},(()=>this.selectCharset("("+D))),this._parser.registerEscHandler({intermediates:")",final:D},(()=>this.selectCharset(")"+D))),this._parser.registerEscHandler({intermediates:"*",final:D},(()=>this.selectCharset("*"+D))),this._parser.registerEscHandler({intermediates:"+",final:D},(()=>this.selectCharset("+"+D))),this._parser.registerEscHandler({intermediates:"-",final:D},(()=>this.selectCharset("-"+D))),this._parser.registerEscHandler({intermediates:".",final:D},(()=>this.selectCharset("."+D))),this._parser.registerEscHandler({intermediates:"/",final:D},(()=>this.selectCharset("/"+D)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((D=>(this._logService.error("Parsing error: ",D),D))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new g.DcsHandler(((D,H)=>this.requestStatusString(D,H))))}_preserveStack(x,L,A,T){this._parseStack.paused=!0,this._parseStack.cursorStartX=x,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=A,this._parseStack.position=T}_logSlowResolvingAsync(x){this._logService.logLevel<=S.LogLevelEnum.WARN&&Promise.race([x,new Promise(((L,A)=>setTimeout((()=>A("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(x,L){let A,T=this._activeBuffer.x,F=this._activeBuffer.y,N=0;const V=this._parseStack.paused;if(V){if(A=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(A),A;T=this._parseStack.cursorStartX,F=this._parseStack.cursorStartY,this._parseStack.paused=!1,x.length>O&&(N=this._parseStack.position+O)}if(this._logService.logLevel<=S.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof x=="string"?` "${x}"`:` "${Array.prototype.map.call(x,(D=>String.fromCharCode(D))).join("")}"`),typeof x=="string"?x.split("").map((D=>D.charCodeAt(0))):x),this._parseBuffer.length<x.length&&this._parseBuffer.length<O&&(this._parseBuffer=new Uint32Array(Math.min(x.length,O))),V||this._dirtyRowTracker.clearRange(),x.length>O)for(let D=N;D<x.length;D+=O){const H=D+O<x.length?D+O:x.length,$=typeof x=="string"?this._stringDecoder.decode(x.substring(D,H),this._parseBuffer):this._utf8Decoder.decode(x.subarray(D,H),this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,$))return this._preserveStack(T,F,$,D),this._logSlowResolvingAsync(A),A}else if(!V){const D=typeof x=="string"?this._stringDecoder.decode(x,this._parseBuffer):this._utf8Decoder.decode(x,this._parseBuffer);if(A=this._parser.parse(this._parseBuffer,D))return this._preserveStack(T,F,D,0),this._logSlowResolvingAsync(A),A}this._activeBuffer.x===T&&this._activeBuffer.y===F||this._onCursorMove.fire();const G=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),I=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);I<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(I,this._bufferService.rows-1),Math.min(G,this._bufferService.rows-1))}print(x,L,A){let T,F;const N=this._charsetService.charset,V=this._optionsService.rawOptions.screenReaderMode,G=this._bufferService.cols,I=this._coreService.decPrivateModes.wraparound,D=this._coreService.modes.insertMode,H=this._curAttrData;let $=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&A-L>0&&$.getWidth(this._activeBuffer.x-1)===2&&$.setCellFromCodepoint(this._activeBuffer.x-1,0,1,H);let q=this._parser.precedingJoinState;for(let Z=L;Z<A;++Z){if(T=x[Z],T<127&&N){const ce=N[String.fromCharCode(T)];ce&&(T=ce.charCodeAt(0))}const X=this._unicodeService.charProperties(T,q);F=y.UnicodeService.extractWidth(X);const se=y.UnicodeService.extractShouldJoin(X),ne=se?y.UnicodeService.extractWidth(q):0;if(q=X,V&&this._onA11yChar.fire((0,u.stringFromCodePoint)(T)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+F-ne>G){if(I){const ce=$;let J=this._activeBuffer.x-ne;for(this._activeBuffer.x=ne,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),$=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),ne>0&&$ instanceof s.BufferLine&&$.copyCellsFrom(ce,J,0,ne,!1);J<G;)ce.setCellFromCodepoint(J++,0,1,H)}else if(this._activeBuffer.x=G-1,F===2)continue}if(se&&this._activeBuffer.x){const ce=$.getWidth(this._activeBuffer.x-1)?1:2;$.addCodepointToCell(this._activeBuffer.x-ce,T,F);for(let J=F-ne;--J>=0;)$.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}else if(D&&($.insertCells(this._activeBuffer.x,F-ne,this._activeBuffer.getNullCell(H)),$.getWidth(G-1)===2&&$.setCellFromCodepoint(G-1,i.NULL_CELL_CODE,i.NULL_CELL_WIDTH,H)),$.setCellFromCodepoint(this._activeBuffer.x++,T,F,H),F>0)for(;--F;)$.setCellFromCodepoint(this._activeBuffer.x++,0,0,H)}this._parser.precedingJoinState=q,this._activeBuffer.x<G&&A-L>0&&$.getWidth(this._activeBuffer.x)===0&&!$.hasContent(this._activeBuffer.x)&&$.setCellFromCodepoint(this._activeBuffer.x,0,1,H),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(x,L){return x.final!=="t"||x.prefix||x.intermediates?this._parser.registerCsiHandler(x,L):this._parser.registerCsiHandler(x,(A=>!B(A.params[0],this._optionsService.rawOptions.windowOptions)||L(A)))}registerDcsHandler(x,L){return this._parser.registerDcsHandler(x,new g.DcsHandler(L))}registerEscHandler(x,L){return this._parser.registerEscHandler(x,L)}registerOscHandler(x,L){return this._parser.registerOscHandler(x,new C.OscHandler(L))}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 x=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);x.hasWidth(this._activeBuffer.x)&&!x.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const x=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-x),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(x=this._bufferService.cols-1){this._activeBuffer.x=Math.min(x,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(x,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=x,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=x,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(x,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+x,this._activeBuffer.y+L)}cursorUp(x){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,x.params[0]||1)):this._moveCursor(0,-(x.params[0]||1)),!0}cursorDown(x){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,x.params[0]||1)):this._moveCursor(0,x.params[0]||1),!0}cursorForward(x){return this._moveCursor(x.params[0]||1,0),!0}cursorBackward(x){return this._moveCursor(-(x.params[0]||1),0),!0}cursorNextLine(x){return this.cursorDown(x),this._activeBuffer.x=0,!0}cursorPrecedingLine(x){return this.cursorUp(x),this._activeBuffer.x=0,!0}cursorCharAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(x){return this._setCursor(x.length>=2?(x.params[1]||1)-1:0,(x.params[0]||1)-1),!0}charPosAbsolute(x){return this._setCursor((x.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(x){return this._moveCursor(x.params[0]||1,0),!0}linePosAbsolute(x){return this._setCursor(this._activeBuffer.x,(x.params[0]||1)-1),!0}vPositionRelative(x){return this._moveCursor(0,x.params[0]||1),!0}hVPosition(x){return this.cursorPosition(x),!0}tabClear(x){const L=x.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(x){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=x.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(x){const L=x.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(x,L,A,T=!1,F=!1){const N=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);N.replaceCells(L,A,this._activeBuffer.getNullCell(this._eraseAttrData()),F),T&&(N.isWrapped=!1)}_resetBufferLine(x,L=!1){const A=this._activeBuffer.lines.get(this._activeBuffer.ybase+x);A&&(A.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+x),A.isWrapped=!1)}eraseInDisplay(x,L=!1){let A;switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);A<this._bufferService.rows;A++)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(A);break;case 1:for(A=this._activeBuffer.y,this._dirtyRowTracker.markDirty(A),this._eraseInBufferLine(A,0,this._activeBuffer.x+1,!0,L),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(A+1).isWrapped=!1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(A=this._bufferService.rows,this._dirtyRowTracker.markDirty(A-1);A--;)this._resetBufferLine(A,L);this._dirtyRowTracker.markDirty(0);break;case 3:const T=this._activeBuffer.lines.length-this._bufferService.rows;T>0&&(this._activeBuffer.lines.trimStart(T),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-T,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-T,0),this._onScroll.fire(0))}return!0}eraseInLine(x,L=!1){switch(this._restrictCursor(this._bufferService.cols),x.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y,T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,F=this._bufferService.rows-1+this._activeBuffer.ybase-T+1;for(;L--;)this._activeBuffer.lines.splice(F-1,1),this._activeBuffer.lines.splice(A,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(x){this._restrictCursor();let L=x.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const A=this._activeBuffer.ybase+this._activeBuffer.y;let T;for(T=this._bufferService.rows-1-this._activeBuffer.scrollBottom,T=this._bufferService.rows-1+this._activeBuffer.ybase-T;L--;)this._activeBuffer.lines.splice(A,1),this._activeBuffer.lines.splice(T,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.insertCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.deleteCells(this._activeBuffer.x,x.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(x){let L=x.params[0]||1;for(;L--;)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(x){let L=x.params[0]||1;for(;L--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(s.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);T.deleteCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);T.insertCells(0,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);T.insertCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(x){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const L=x.params[0]||1;for(let A=this._activeBuffer.scrollTop;A<=this._activeBuffer.scrollBottom;++A){const T=this._activeBuffer.lines.get(this._activeBuffer.ybase+A);T.deleteCells(this._activeBuffer.x,L,this._activeBuffer.getNullCell(this._eraseAttrData())),T.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(x){this._restrictCursor();const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return L&&(L.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(x.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(x){const L=this._parser.precedingJoinState;if(!L)return!0;const A=x.params[0]||1,T=y.UnicodeService.extractWidth(L),F=this._activeBuffer.x-T,N=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(F),V=new Uint32Array(N.length*A);let G=0;for(let D=0;D<N.length;){const H=N.codePointAt(D)||0;V[G++]=H,D+=H>65535?2:1}let I=G;for(let D=1;D<A;++D)V.copyWithin(I,0,G),I+=G;return this.print(V,0,I),!0}sendDeviceAttributesPrimary(x){return x.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(h.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(h.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(x){return x.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(h.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(h.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(x.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(h.C0.ESC+"[>83;40003;0c")),!0}_is(x){return(this._optionsService.rawOptions.termName+"").indexOf(x)===0}setMode(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,f.DEFAULT_CHARSET),this._charsetService.setgCharset(1,f.DEFAULT_CHARSET),this._charsetService.setgCharset(2,f.DEFAULT_CHARSET),this._charsetService.setgCharset(3,f.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(x){for(let L=0;L<x.length;L++)switch(x.params[L]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(x){for(let L=0;L<x.length;L++)switch(x.params[L]){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(),x.params[L]===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(x,L){const A=this._coreService.decPrivateModes,{activeProtocol:T,activeEncoding:F}=this._coreMouseService,N=this._coreService,{buffers:V,cols:G}=this._bufferService,{active:I,alt:D}=V,H=this._optionsService.rawOptions,$=se=>se?1:2,q=x.params[0];return Z=q,X=L?q===2?4:q===4?$(N.modes.insertMode):q===12?3:q===20?$(H.convertEol):0:q===1?$(A.applicationCursorKeys):q===3?H.windowOptions.setWinLines?G===80?2:G===132?1:0:0:q===6?$(A.origin):q===7?$(A.wraparound):q===8?3:q===9?$(T==="X10"):q===12?$(H.cursorBlink):q===25?$(!N.isCursorHidden):q===45?$(A.reverseWraparound):q===66?$(A.applicationKeypad):q===67?4:q===1e3?$(T==="VT200"):q===1002?$(T==="DRAG"):q===1003?$(T==="ANY"):q===1004?$(A.sendFocus):q===1005?4:q===1006?$(F==="SGR"):q===1015?4:q===1016?$(F==="SGR_PIXELS"):q===1048?1:q===47||q===1047||q===1049?$(I===D):q===2004?$(A.bracketedPasteMode):0,N.triggerDataEvent(`${h.C0.ESC}[${L?"":"?"}${Z};${X}$y`),!0;var Z,X}_updateAttrColor(x,L,A,T,F){return L===2?(x|=50331648,x&=-16777216,x|=d.AttributeData.fromColorRGB([A,T,F])):L===5&&(x&=-50331904,x|=33554432|255&A),x}_extractColor(x,L,A){const T=[0,0,-1,0,0,0];let F=0,N=0;do{if(T[N+F]=x.params[L+N],x.hasSubParams(L+N)){const V=x.getSubParams(L+N);let G=0;do T[1]===5&&(F=1),T[N+G+1+F]=V[G];while(++G<V.length&&G+N+1+F<T.length);break}if(T[1]===5&&N+F>=2||T[1]===2&&N+F>=5)break;T[1]&&(F=1)}while(++N+L<x.length&&N+F<T.length);for(let V=2;V<T.length;++V)T[V]===-1&&(T[V]=0);switch(T[0]){case 38:A.fg=this._updateAttrColor(A.fg,T[1],T[3],T[4],T[5]);break;case 48:A.bg=this._updateAttrColor(A.bg,T[1],T[3],T[4],T[5]);break;case 58:A.extended=A.extended.clone(),A.extended.underlineColor=this._updateAttrColor(A.extended.underlineColor,T[1],T[3],T[4],T[5])}return N}_processUnderline(x,L){L.extended=L.extended.clone(),(!~x||x>5)&&(x=1),L.extended.underlineStyle=x,L.fg|=268435456,x===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(x){x.fg=s.DEFAULT_ATTR_DATA.fg,x.bg=s.DEFAULT_ATTR_DATA.bg,x.extended=x.extended.clone(),x.extended.underlineStyle=0,x.extended.underlineColor&=-67108864,x.updateExtended()}charAttributes(x){if(x.length===1&&x.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=x.length;let A;const T=this._curAttrData;for(let F=0;F<L;F++)A=x.params[F],A>=30&&A<=37?(T.fg&=-50331904,T.fg|=16777216|A-30):A>=40&&A<=47?(T.bg&=-50331904,T.bg|=16777216|A-40):A>=90&&A<=97?(T.fg&=-50331904,T.fg|=16777224|A-90):A>=100&&A<=107?(T.bg&=-50331904,T.bg|=16777224|A-100):A===0?this._processSGR0(T):A===1?T.fg|=134217728:A===3?T.bg|=67108864:A===4?(T.fg|=268435456,this._processUnderline(x.hasSubParams(F)?x.getSubParams(F)[0]:1,T)):A===5?T.fg|=536870912:A===7?T.fg|=67108864:A===8?T.fg|=1073741824:A===9?T.fg|=2147483648:A===2?T.bg|=134217728:A===21?this._processUnderline(2,T):A===22?(T.fg&=-134217729,T.bg&=-134217729):A===23?T.bg&=-67108865:A===24?(T.fg&=-268435457,this._processUnderline(0,T)):A===25?T.fg&=-536870913:A===27?T.fg&=-67108865:A===28?T.fg&=-1073741825:A===29?T.fg&=2147483647:A===39?(T.fg&=-67108864,T.fg|=16777215&s.DEFAULT_ATTR_DATA.fg):A===49?(T.bg&=-67108864,T.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):A===38||A===48||A===58?F+=this._extractColor(x,F,T):A===53?T.bg|=1073741824:A===55?T.bg&=-1073741825:A===59?(T.extended=T.extended.clone(),T.extended.underlineColor=-1,T.updateExtended()):A===100?(T.fg&=-67108864,T.fg|=16777215&s.DEFAULT_ATTR_DATA.fg,T.bg&=-67108864,T.bg|=16777215&s.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",A);return!0}deviceStatus(x){switch(x.params[0]){case 5:this._coreService.triggerDataEvent(`${h.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[${L};${A}R`)}return!0}deviceStatusPrivate(x){if(x.params[0]===6){const L=this._activeBuffer.y+1,A=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${h.C0.ESC}[?${L};${A}R`)}return!0}softReset(x){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=s.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(x){const L=x.params[0]||1;switch(L){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 A=L%2==1;return this._optionsService.options.cursorBlink=A,!0}setScrollRegion(x){const L=x.params[0]||1;let A;return(x.length<2||(A=x.params[1])>this._bufferService.rows||A===0)&&(A=this._bufferService.rows),A>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=A-1,this._setCursor(0,0)),!0}windowOptions(x){if(!B(x.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=x.length>1?x.params[1]:0;switch(x.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(R.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(R.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${h.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(x){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(x){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(x){return this._windowTitle=x,this._onTitleChange.fire(x),!0}setIconName(x){return this._iconName=x,!0}setOrReportIndexedColor(x){const L=[],A=x.split(";");for(;A.length>1;){const T=A.shift(),F=A.shift();if(/^\d+$/.exec(T)){const N=parseInt(T);if(K(N))if(F==="?")L.push({type:0,index:N});else{const V=(0,E.parseColor)(F);V&&L.push({type:1,index:N,color:V})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(x){const L=x.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(x,L){this._getCurrentLinkId()&&this._finishHyperlink();const A=x.split(":");let T;const F=A.findIndex((N=>N.startsWith("id=")));return F!==-1&&(T=A[F].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:T,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(x,L){const A=x.split(";");for(let T=0;T<A.length&&!(L>=this._specialColors.length);++T,++L)if(A[T]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const F=(0,E.parseColor)(A[T]);F&&this._onColor.fire([{type:1,index:this._specialColors[L],color:F}])}return!0}setOrReportFgColor(x){return this._setOrReportSpecialColor(x,0)}setOrReportBgColor(x){return this._setOrReportSpecialColor(x,1)}setOrReportCursorColor(x){return this._setOrReportSpecialColor(x,2)}restoreIndexedColor(x){if(!x)return this._onColor.fire([{type:2}]),!0;const L=[],A=x.split(";");for(let T=0;T<A.length;++T)if(/^\d+$/.exec(A[T])){const F=parseInt(A[T]);K(F)&&L.push({type:2,index:F})}return L.length&&this._onColor.fire(L),!0}restoreFgColor(x){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(x){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(x){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,f.DEFAULT_CHARSET),!0}selectCharset(x){return x.length!==2?(this.selectDefaultCharset(),!0):(x[0]==="/"||this._charsetService.setgCharset(P[x[0]],f.CHARSETS[x[1]]||f.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 x=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,x,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=s.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=s.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(x){return this._charsetService.setgLevel(x),!0}screenAlignmentPattern(){const x=new o.CellData;x.content=4194373,x.fg=this._curAttrData.fg,x.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L<this._bufferService.rows;++L){const A=this._activeBuffer.ybase+this._activeBuffer.y+L,T=this._activeBuffer.lines.get(A);T&&(T.fill(x),T.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(x,L){const A=this._bufferService.buffer,T=this._optionsService.rawOptions;return(F=>(this._coreService.triggerDataEvent(`${h.C0.ESC}${F}${h.C0.ESC}\\`),!0))(x==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:x==='"p'?'P1$r61;1"p':x==="r"?`P1$r${A.scrollTop+1};${A.scrollBottom+1}r`:x==="m"?"P1$r0m":x===" q"?`P1$r${{block:2,underline:4,bar:6}[T.cursorStyle]-(T.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(x,L){this._dirtyRowTracker.markRangeDirty(x,L)}}r.InputHandler=z;let U=class{constructor(W){this._bufferService=W,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(W){W<this.start?this.start=W:W>this.end&&(this.end=W)}markRangeDirty(W,x){W>x&&(M=W,W=x,x=M),W<this.start&&(this.start=W),x>this.end&&(this.end=x)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function K(W){return 0<=W&&W<256}U=l([_(0,S.IBufferService)],U)},844:(w,r)=>{function n(l){for(const _ of l)_.dispose();l.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.MutableDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const l of this._disposables)l.dispose();this._disposables.length=0}register(l){return this._disposables.push(l),l}unregister(l){const _=this._disposables.indexOf(l);_!==-1&&this._disposables.splice(_,1)}},r.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){this._isDisposed||l===this._value||(this._value?.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},r.toDisposable=function(l){return{dispose:l}},r.disposeArray=n,r.getDisposeArrayDisposable=function(l){return{dispose:()=>n(l)}}},1505:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class n{constructor(){this._data={}}set(_,h,f){this._data[_]||(this._data[_]={}),this._data[_][h]=f}get(_,h){return this._data[_]?this._data[_][h]:void 0}clear(){this._data={}}}r.TwoKeyMap=n,r.FourKeyMap=class{constructor(){this._data=new n}set(l,_,h,f,v){this._data.get(l,_)||this._data.set(l,_,new n),this._data.get(l,_).set(h,f,v)}get(l,_,h,f){return this._data.get(l,_)?.get(h,f)}clear(){this._data.clear()}}},6114:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isChromeOS=r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.getSafariVersion=r.isSafari=r.isLegacyEdge=r.isFirefox=r.isNode=void 0,r.isNode=typeof process<"u"&&"title"in process;const n=r.isNode?"node":navigator.userAgent,l=r.isNode?"node":navigator.platform;r.isFirefox=n.includes("Firefox"),r.isLegacyEdge=n.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(n),r.getSafariVersion=function(){if(!r.isSafari)return 0;const _=n.match(/Version\/(\d+)/);return _===null||_.length<2?0:parseInt(_[1])},r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),r.isIpad=l==="iPad",r.isIphone=l==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),r.isLinux=l.indexOf("Linux")>=0,r.isChromeOS=/\bCrOS\b/.test(n)},6106:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let n=0;r.SortedList=class{constructor(l){this._getKey=l,this._array=[]}clear(){this._array.length=0}insert(l){this._array.length!==0?(n=this._search(this._getKey(l)),this._array.splice(n,0,l)):this._array.push(l)}delete(l){if(this._array.length===0)return!1;const _=this._getKey(l);if(_===void 0||(n=this._search(_),n===-1)||this._getKey(this._array[n])!==_)return!1;do if(this._array[n]===l)return this._array.splice(n,1),!0;while(++n<this._array.length&&this._getKey(this._array[n])===_);return!1}*getKeyIterator(l){if(this._array.length!==0&&(n=this._search(l),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===l))do yield this._array[n];while(++n<this._array.length&&this._getKey(this._array[n])===l)}forEachByKey(l,_){if(this._array.length!==0&&(n=this._search(l),!(n<0||n>=this._array.length)&&this._getKey(this._array[n])===l))do _(this._array[n]);while(++n<this._array.length&&this._getKey(this._array[n])===l)}values(){return[...this._array].values()}_search(l){let _=0,h=this._array.length-1;for(;h>=_;){let f=_+h>>1;const v=this._getKey(this._array[f]);if(v>l)h=f-1;else{if(!(v<l)){for(;f>0&&this._getKey(this._array[f-1])===l;)f--;return f}_=f+1}}return _}}},7226:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebouncedIdleTask=r.IdleTaskQueue=r.PriorityTaskQueue=void 0;const l=n(6114);class _{constructor(){this._tasks=[],this._i=0}enqueue(v){this._tasks.push(v),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(v){this._idleCallback=void 0;let b=0,u=0,s=v.timeRemaining(),a=0;for(;this._i<this._tasks.length;){if(b=Date.now(),this._tasks[this._i]()||this._i++,b=Math.max(1,Date.now()-b),u=Math.max(b,u),a=v.timeRemaining(),1.5*u>a)return s-b<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-b))}ms`),void this._start();s=a}this.clear()}}class h extends _{_requestCallback(v){return setTimeout((()=>v(this._createDeadline(16))))}_cancelCallback(v){clearTimeout(v)}_createDeadline(v){const b=Date.now()+v;return{timeRemaining:()=>Math.max(0,b-Date.now())}}}r.PriorityTaskQueue=h,r.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends _{_requestCallback(f){return requestIdleCallback(f)}_cancelCallback(f){cancelIdleCallback(f)}}:h,r.DebouncedIdleTask=class{constructor(){this._queue=new r.IdleTaskQueue}set(f){this._queue.clear(),this._queue.enqueue(f)}flush(){this._queue.flush()}}},9282:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const l=n(643);r.updateWindowsModeWrappedState=function(_){const h=_.buffer.lines.get(_.buffer.ybase+_.buffer.y-1),f=h?.get(_.cols-1),v=_.buffer.lines.get(_.buffer.ybase+_.buffer.y);v&&f&&(v.isWrapped=f[l.CHAR_DATA_CODE_INDEX]!==l.NULL_CELL_CODE&&f[l.CHAR_DATA_CODE_INDEX]!==l.WHITESPACE_CELL_CODE)}},3734:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class n{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(h){return[h>>>16&255,h>>>8&255,255&h]}static fromColorRGB(h){return(255&h[0])<<16|(255&h[1])<<8|255&h[2]}clone(){const h=new n;return h.fg=this.fg,h.bg=this.bg,h.extended=this.extended.clone(),h}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}}r.AttributeData=n;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(h){this._ext=h}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(h){this._ext&=-469762049,this._ext|=h<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(h){this._ext&=-67108864,this._ext|=67108863&h}get urlId(){return this._urlId}set urlId(h){this._urlId=h}get underlineVariantOffset(){const h=(3758096384&this._ext)>>29;return h<0?4294967288^h:h}set underlineVariantOffset(h){this._ext&=536870911,this._ext|=h<<29&3758096384}constructor(h=0,f=0){this._ext=0,this._urlId=0,this._ext=h,this._urlId=f}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=l},9092:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Buffer=r.MAX_BUFFER_SIZE=void 0;const l=n(6349),_=n(7226),h=n(3734),f=n(8437),v=n(4634),b=n(511),u=n(643),s=n(4863),a=n(7116);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(i,o,d){this._hasScrollback=i,this._optionsService=o,this._bufferService=d,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=f.DEFAULT_ATTR_DATA.clone(),this.savedCharset=a.DEFAULT_CHARSET,this.markers=[],this._nullCell=b.CellData.fromCharData([0,u.NULL_CELL_CHAR,u.NULL_CELL_WIDTH,u.NULL_CELL_CODE]),this._whitespaceCell=b.CellData.fromCharData([0,u.WHITESPACE_CELL_CHAR,u.WHITESPACE_CELL_WIDTH,u.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new _.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new h.ExtendedAttrs),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new h.ExtendedAttrs),this._whitespaceCell}getBlankLine(i,o){return new f.BufferLine(this._bufferService.cols,this.getNullCell(i),o)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;const o=i+this._optionsService.rawOptions.scrollback;return o>r.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:o}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=f.DEFAULT_ATTR_DATA);let o=this._rows;for(;o--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new l.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,o){const d=this.getNullCell(f.DEFAULT_ATTR_DATA);let S=0;const y=this._getCorrectBufferLength(o);if(y>this.lines.maxLength&&(this.lines.maxLength=y),this.lines.length>0){if(this._cols<i)for(let g=0;g<this.lines.length;g++)S+=+this.lines.get(g).resize(i,d);let C=0;if(this._rows<o)for(let g=this._rows;g<o;g++)this.lines.length<o+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new f.BufferLine(i,d)):this.ybase>0&&this.lines.length<=this.ybase+this.y+C+1?(this.ybase--,C++,this.ydisp>0&&this.ydisp--):this.lines.push(new f.BufferLine(i,d)));else for(let g=this._rows;g>o;g--)this.lines.length>o+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(y<this.lines.maxLength){const g=this.lines.length-y;g>0&&(this.lines.trimStart(g),this.ybase=Math.max(this.ybase-g,0),this.ydisp=Math.max(this.ydisp-g,0),this.savedY=Math.max(this.savedY-g,0)),this.lines.maxLength=y}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,o-1),C&&(this.y+=C),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=o-1,this._isReflowEnabled&&(this._reflow(i,o),this._cols>i))for(let C=0;C<this.lines.length;C++)S+=+this.lines.get(C).resize(i,d);this._cols=i,this._rows=o,this._memoryCleanupQueue.clear(),S>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let o=0;for(;this._memoryCleanupPosition<this.lines.length;)if(o+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),o>100)return!0;return i}get _isReflowEnabled(){const i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,o){this._cols!==i&&(i>this._cols?this._reflowLarger(i,o):this._reflowSmaller(i,o))}_reflowLarger(i,o){const d=(0,v.reflowLargerGetLinesToRemove)(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(f.DEFAULT_ATTR_DATA));if(d.length>0){const S=(0,v.reflowLargerCreateNewLayout)(this.lines,d);(0,v.reflowLargerApplyNewLayout)(this.lines,S.layout),this._reflowLargerAdjustViewport(i,o,S.countRemoved)}}_reflowLargerAdjustViewport(i,o,d){const S=this.getNullCell(f.DEFAULT_ATTR_DATA);let y=d;for(;y-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<o&&this.lines.push(new f.BufferLine(i,S))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-d,0)}_reflowSmaller(i,o){const d=this.getNullCell(f.DEFAULT_ATTR_DATA),S=[];let y=0;for(let C=this.lines.length-1;C>=0;C--){let g=this.lines.get(C);if(!g||!g.isWrapped&&g.getTrimmedLength()<=i)continue;const E=[g];for(;g.isWrapped&&C>0;)g=this.lines.get(--C),E.unshift(g);const P=this.ybase+this.y;if(P>=C&&P<C+E.length)continue;const O=E[E.length-1].getTrimmedLength(),B=(0,v.reflowSmallerGetNewLineLengths)(E,this._cols,i),R=B.length-E.length;let M;M=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+R):Math.max(0,this.lines.length-this.lines.maxLength+R);const z=[];for(let A=0;A<R;A++){const T=this.getBlankLine(f.DEFAULT_ATTR_DATA,!0);z.push(T)}z.length>0&&(S.push({start:C+E.length+y,newLines:z}),y+=z.length),E.push(...z);let U=B.length-1,K=B[U];K===0&&(U--,K=B[U]);let W=E.length-R-1,x=O;for(;W>=0;){const A=Math.min(x,K);if(E[U]===void 0)break;if(E[U].copyCellsFrom(E[W],x-A,K-A,A,!0),K-=A,K===0&&(U--,K=B[U]),x-=A,x===0){W--;const T=Math.max(W,0);x=(0,v.getWrappedLineTrimmedLength)(E,T,this._cols)}}for(let A=0;A<E.length;A++)B[A]<i&&E[A].setCell(B[A],d);let L=R-M;for(;L-- >0;)this.ybase===0?this.y<o-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+y)-o&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+R,this.ybase+o-1)}if(S.length>0){const C=[],g=[];for(let U=0;U<this.lines.length;U++)g.push(this.lines.get(U));const E=this.lines.length;let P=E-1,O=0,B=S[O];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+y);let R=0;for(let U=Math.min(this.lines.maxLength-1,E+y-1);U>=0;U--)if(B&&B.start>P+R){for(let K=B.newLines.length-1;K>=0;K--)this.lines.set(U--,B.newLines[K]);U++,C.push({index:P+1,amount:B.newLines.length}),R+=B.newLines.length,B=S[++O]}else this.lines.set(U,g[P--]);let M=0;for(let U=C.length-1;U>=0;U--)C[U].index+=M,this.lines.onInsertEmitter.fire(C[U]),M+=C[U].amount;const z=Math.max(0,E+y-this.lines.maxLength);z>0&&this.lines.onTrimEmitter.fire(z)}}translateBufferLineToString(i,o,d=0,S){const y=this.lines.get(i);return y?y.translateToString(o,d,S):""}getWrappedRangeForLine(i){let o=i,d=i;for(;o>0&&this.lines.get(o).isWrapped;)o--;for(;d+1<this.lines.length&&this.lines.get(d+1).isWrapped;)d++;return{first:o,last:d}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let o=0;o<this.markers.length;o++)this.markers[o].line===i&&(this.markers[o].dispose(),this.markers.splice(o--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose(),this.markers.splice(i--,1);this._isClearing=!1}addMarker(i){const o=new s.Marker(i);return this.markers.push(o),o.register(this.lines.onTrim((d=>{o.line-=d,o.line<0&&o.dispose()}))),o.register(this.lines.onInsert((d=>{o.line>=d.index&&(o.line+=d.amount)}))),o.register(this.lines.onDelete((d=>{o.line>=d.index&&o.line<d.index+d.amount&&o.dispose(),o.line>d.index&&(o.line-=d.amount)}))),o.register(o.onDispose((()=>this._removeMarker(o)))),o}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}}},8437:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const l=n(3734),_=n(511),h=n(643),f=n(482);r.DEFAULT_ATTR_DATA=Object.freeze(new l.AttributeData);let v=0;class b{constructor(s,a,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*s);const o=a||_.CellData.fromCharData([0,h.NULL_CELL_CHAR,h.NULL_CELL_WIDTH,h.NULL_CELL_CODE]);for(let d=0;d<s;++d)this.setCell(d,o);this.length=s}get(s){const a=this._data[3*s+0],i=2097151&a;return[this._data[3*s+1],2097152&a?this._combined[s]:i?(0,f.stringFromCodePoint)(i):"",a>>22,2097152&a?this._combined[s].charCodeAt(this._combined[s].length-1):i]}set(s,a){this._data[3*s+1]=a[h.CHAR_DATA_ATTR_INDEX],a[h.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[s]=a[1],this._data[3*s+0]=2097152|s|a[h.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*s+0]=a[h.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|a[h.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(s){return this._data[3*s+0]>>22}hasWidth(s){return 12582912&this._data[3*s+0]}getFg(s){return this._data[3*s+1]}getBg(s){return this._data[3*s+2]}hasContent(s){return 4194303&this._data[3*s+0]}getCodePoint(s){const a=this._data[3*s+0];return 2097152&a?this._combined[s].charCodeAt(this._combined[s].length-1):2097151&a}isCombined(s){return 2097152&this._data[3*s+0]}getString(s){const a=this._data[3*s+0];return 2097152&a?this._combined[s]:2097151&a?(0,f.stringFromCodePoint)(2097151&a):""}isProtected(s){return 536870912&this._data[3*s+2]}loadCell(s,a){return v=3*s,a.content=this._data[v+0],a.fg=this._data[v+1],a.bg=this._data[v+2],2097152&a.content&&(a.combinedData=this._combined[s]),268435456&a.bg&&(a.extended=this._extendedAttrs[s]),a}setCell(s,a){2097152&a.content&&(this._combined[s]=a.combinedData),268435456&a.bg&&(this._extendedAttrs[s]=a.extended),this._data[3*s+0]=a.content,this._data[3*s+1]=a.fg,this._data[3*s+2]=a.bg}setCellFromCodepoint(s,a,i,o){268435456&o.bg&&(this._extendedAttrs[s]=o.extended),this._data[3*s+0]=a|i<<22,this._data[3*s+1]=o.fg,this._data[3*s+2]=o.bg}addCodepointToCell(s,a,i){let o=this._data[3*s+0];2097152&o?this._combined[s]+=(0,f.stringFromCodePoint)(a):2097151&o?(this._combined[s]=(0,f.stringFromCodePoint)(2097151&o)+(0,f.stringFromCodePoint)(a),o&=-2097152,o|=2097152):o=a|4194304,i&&(o&=-12582913,o|=i<<22),this._data[3*s+0]=o}insertCells(s,a,i){if((s%=this.length)&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,i),a<this.length-s){const o=new _.CellData;for(let d=this.length-s-a-1;d>=0;--d)this.setCell(s+a+d,this.loadCell(s+d,o));for(let d=0;d<a;++d)this.setCell(s+d,i)}else for(let o=s;o<this.length;++o)this.setCell(o,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(s,a,i){if(s%=this.length,a<this.length-s){const o=new _.CellData;for(let d=0;d<this.length-s-a;++d)this.setCell(s+d,this.loadCell(s+a+d,o));for(let d=this.length-a;d<this.length;++d)this.setCell(d,i)}else for(let o=s;o<this.length;++o)this.setCell(o,i);s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,i),this.getWidth(s)!==0||this.hasContent(s)||this.setCellFromCodepoint(s,0,1,i)}replaceCells(s,a,i,o=!1){if(o)for(s&&this.getWidth(s-1)===2&&!this.isProtected(s-1)&&this.setCellFromCodepoint(s-1,0,1,i),a<this.length&&this.getWidth(a-1)===2&&!this.isProtected(a)&&this.setCellFromCodepoint(a,0,1,i);s<a&&s<this.length;)this.isProtected(s)||this.setCell(s,i),s++;else for(s&&this.getWidth(s-1)===2&&this.setCellFromCodepoint(s-1,0,1,i),a<this.length&&this.getWidth(a-1)===2&&this.setCellFromCodepoint(a,0,1,i);s<a&&s<this.length;)this.setCell(s++,i)}resize(s,a){if(s===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const i=3*s;if(s>this.length){if(this._data.buffer.byteLength>=4*i)this._data=new Uint32Array(this._data.buffer,0,i);else{const o=new Uint32Array(i);o.set(this._data),this._data=o}for(let o=this.length;o<s;++o)this.setCell(o,a)}else{this._data=this._data.subarray(0,i);const o=Object.keys(this._combined);for(let S=0;S<o.length;S++){const y=parseInt(o[S],10);y>=s&&delete this._combined[y]}const d=Object.keys(this._extendedAttrs);for(let S=0;S<d.length;S++){const y=parseInt(d[S],10);y>=s&&delete this._extendedAttrs[y]}}return this.length=s,4*i*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const s=new Uint32Array(this._data.length);return s.set(this._data),this._data=s,1}return 0}fill(s,a=!1){if(a)for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,s);else{this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,s)}}copyFrom(s){this.length!==s.length?this._data=new Uint32Array(s._data):this._data.set(s._data),this.length=s.length,this._combined={};for(const a in s._combined)this._combined[a]=s._combined[a];this._extendedAttrs={};for(const a in s._extendedAttrs)this._extendedAttrs[a]=s._extendedAttrs[a];this.isWrapped=s.isWrapped}clone(){const s=new b(0);s._data=new Uint32Array(this._data),s.length=this.length;for(const a in this._combined)s._combined[a]=this._combined[a];for(const a in this._extendedAttrs)s._extendedAttrs[a]=this._extendedAttrs[a];return s.isWrapped=this.isWrapped,s}getTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(4194303&this._data[3*s+0])return s+(this._data[3*s+0]>>22);return 0}getNoBgTrimmedLength(){for(let s=this.length-1;s>=0;--s)if(4194303&this._data[3*s+0]||50331648&this._data[3*s+2])return s+(this._data[3*s+0]>>22);return 0}copyCellsFrom(s,a,i,o,d){const S=s._data;if(d)for(let C=o-1;C>=0;C--){for(let g=0;g<3;g++)this._data[3*(i+C)+g]=S[3*(a+C)+g];268435456&S[3*(a+C)+2]&&(this._extendedAttrs[i+C]=s._extendedAttrs[a+C])}else for(let C=0;C<o;C++){for(let g=0;g<3;g++)this._data[3*(i+C)+g]=S[3*(a+C)+g];268435456&S[3*(a+C)+2]&&(this._extendedAttrs[i+C]=s._extendedAttrs[a+C])}const y=Object.keys(s._combined);for(let C=0;C<y.length;C++){const g=parseInt(y[C],10);g>=a&&(this._combined[g-a+i]=s._combined[g])}}translateToString(s,a,i,o){a=a??0,i=i??this.length,s&&(i=Math.min(i,this.getTrimmedLength())),o&&(o.length=0);let d="";for(;a<i;){const S=this._data[3*a+0],y=2097151&S,C=2097152&S?this._combined[a]:y?(0,f.stringFromCodePoint)(y):h.WHITESPACE_CELL_CHAR;if(d+=C,o)for(let g=0;g<C.length;++g)o.push(a);a+=S>>22||1}return o&&o.push(a),d}}r.BufferLine=b},4841:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(n,l){if(n.start.y>n.end.y)throw new Error(`Buffer range end (${n.end.x}, ${n.end.y}) cannot be before start (${n.start.x}, ${n.start.y})`);return l*(n.end.y-n.start.y)+(n.end.x-n.start.x+1)}},4634:(w,r)=>{function n(l,_,h){if(_===l.length-1)return l[_].getTrimmedLength();const f=!l[_].hasContent(h-1)&&l[_].getWidth(h-1)===1,v=l[_+1].getWidth(0)===2;return f&&v?h-1:h}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(l,_,h,f,v){const b=[];for(let u=0;u<l.length-1;u++){let s=u,a=l.get(++s);if(!a.isWrapped)continue;const i=[l.get(u)];for(;s<l.length&&a.isWrapped;)i.push(a),a=l.get(++s);if(f>=u&&f<s){u+=i.length-1;continue}let o=0,d=n(i,o,_),S=1,y=0;for(;S<i.length;){const g=n(i,S,_),E=g-y,P=h-d,O=Math.min(E,P);i[o].copyCellsFrom(i[S],y,d,O,!1),d+=O,d===h&&(o++,d=0),y+=O,y===g&&(S++,y=0),d===0&&o!==0&&i[o-1].getWidth(h-1)===2&&(i[o].copyCellsFrom(i[o-1],h-1,d++,1,!1),i[o-1].setCell(h-1,v))}i[o].replaceCells(d,h,v);let C=0;for(let g=i.length-1;g>0&&(g>o||i[g].getTrimmedLength()===0);g--)C++;C>0&&(b.push(u+i.length-C),b.push(C)),u+=i.length-1}return b},r.reflowLargerCreateNewLayout=function(l,_){const h=[];let f=0,v=_[f],b=0;for(let u=0;u<l.length;u++)if(v===u){const s=_[++f];l.onDeleteEmitter.fire({index:u-b,amount:s}),u+=s-1,b+=s,v=_[++f]}else h.push(u);return{layout:h,countRemoved:b}},r.reflowLargerApplyNewLayout=function(l,_){const h=[];for(let f=0;f<_.length;f++)h.push(l.get(_[f]));for(let f=0;f<h.length;f++)l.set(f,h[f]);l.length=_.length},r.reflowSmallerGetNewLineLengths=function(l,_,h){const f=[],v=l.map(((a,i)=>n(l,i,_))).reduce(((a,i)=>a+i));let b=0,u=0,s=0;for(;s<v;){if(v-s<h){f.push(v-s);break}b+=h;const a=n(l,u,_);b>a&&(b-=a,u++);const i=l[u].getWidth(b-1)===2;i&&b--;const o=i?h-1:h;f.push(o),s+=o}return f},r.getWrappedLineTrimmedLength=n},5295:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const l=n(8460),_=n(844),h=n(9092);class f extends _.Disposable{constructor(b,u){super(),this._optionsService=b,this._bufferService=u,this._onBufferActivate=this.register(new l.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 h.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new h.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(b){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(b),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(b,u){this._normal.resize(b,u),this._alt.resize(b,u),this.setupTabStops(b)}setupTabStops(b){this._normal.setupTabStops(b),this._alt.setupTabStops(b)}}r.BufferSet=f},511:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const l=n(482),_=n(643),h=n(3734);class f extends h.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new h.ExtendedAttrs,this.combinedData=""}static fromCharData(b){const u=new f;return u.setFromCharData(b),u}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,l.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(b){this.fg=b[_.CHAR_DATA_ATTR_INDEX],this.bg=0;let u=!1;if(b[_.CHAR_DATA_CHAR_INDEX].length>2)u=!0;else if(b[_.CHAR_DATA_CHAR_INDEX].length===2){const s=b[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=s&&s<=56319){const a=b[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=a&&a<=57343?this.content=1024*(s-55296)+a-56320+65536|b[_.CHAR_DATA_WIDTH_INDEX]<<22:u=!0}else u=!0}else this.content=b[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[_.CHAR_DATA_WIDTH_INDEX]<<22;u&&(this.combinedData=b[_.CHAR_DATA_CHAR_INDEX],this.content=2097152|b[_.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=f},643:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=0,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const l=n(8460),_=n(844);class h{get id(){return this._id}constructor(v){this.line=v,this.isDisposed=!1,this._disposables=[],this._id=h._nextId++,this._onDispose=this.register(new l.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,_.disposeArray)(this._disposables),this._disposables.length=0)}register(v){return this._disposables.push(v),v}}r.Marker=h,h._nextId=1},7116:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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:"≥","{":"π","|":"≠","}":"£","~":"·"},r.CHARSETS.A={"#":"£"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},r.CHARSETS.C=r.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},r.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},r.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},r.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},r.CHARSETS.E=r.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},r.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},r.CHARSETS.H=r.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},r.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(w,r)=>{var n,l,_;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,(function(h){h.NUL="\0",h.SOH="",h.STX="",h.ETX="",h.EOT="",h.ENQ="",h.ACK="",h.BEL="\x07",h.BS="\b",h.HT=" ",h.LF=`
8
8
  `,h.VT="\v",h.FF="\f",h.CR="\r",h.SO="",h.SI="",h.DLE="",h.DC1="",h.DC2="",h.DC3="",h.DC4="",h.NAK="",h.SYN="",h.ETB="",h.CAN="",h.EM="",h.SUB="",h.ESC="\x1B",h.FS="",h.GS="",h.RS="",h.US="",h.SP=" ",h.DEL=""})(n||(r.C0=n={})),(function(h){h.PAD="€",h.HOP="",h.BPH="‚",h.NBH="ƒ",h.IND="„",h.NEL="…",h.SSA="†",h.ESA="‡",h.HTS="ˆ",h.HTJ="‰",h.VTS="Š",h.PLD="‹",h.PLU="Œ",h.RI="",h.SS2="Ž",h.SS3="",h.DCS="",h.PU1="‘",h.PU2="’",h.STS="“",h.CCH="”",h.MW="•",h.SPA="–",h.EPA="—",h.SOS="˜",h.SGCI="™",h.SCI="š",h.CSI="›",h.ST="œ",h.OSC="",h.PM="ž",h.APC="Ÿ"})(l||(r.C1=l={})),(function(h){h.ST=`${n.ESC}\\`})(_||(r.C1_ESCAPED=_={}))},7399:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const l=n(2584),_={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:["'",'"']};r.evaluateKeyboardEvent=function(h,f,v,b){const u={type:0,cancel:!1,key:void 0},s=(h.shiftKey?1:0)|(h.altKey?2:0)|(h.ctrlKey?4:0)|(h.metaKey?8:0);switch(h.keyCode){case 0:h.key==="UIKeyInputUpArrow"?u.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A":h.key==="UIKeyInputLeftArrow"?u.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D":h.key==="UIKeyInputRightArrow"?u.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C":h.key==="UIKeyInputDownArrow"&&(u.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B");break;case 8:u.key=h.ctrlKey?"\b":l.C0.DEL,h.altKey&&(u.key=l.C0.ESC+u.key);break;case 9:if(h.shiftKey){u.key=l.C0.ESC+"[Z";break}u.key=l.C0.HT,u.cancel=!0;break;case 13:u.key=h.altKey?l.C0.ESC+l.C0.CR:l.C0.CR,u.cancel=!0;break;case 27:u.key=l.C0.ESC,h.altKey&&(u.key=l.C0.ESC+l.C0.ESC),u.cancel=!0;break;case 37:if(h.metaKey)break;s?(u.key=l.C0.ESC+"[1;"+(s+1)+"D",u.key===l.C0.ESC+"[1;3D"&&(u.key=l.C0.ESC+(v?"b":"[1;5D"))):u.key=f?l.C0.ESC+"OD":l.C0.ESC+"[D";break;case 39:if(h.metaKey)break;s?(u.key=l.C0.ESC+"[1;"+(s+1)+"C",u.key===l.C0.ESC+"[1;3C"&&(u.key=l.C0.ESC+(v?"f":"[1;5C"))):u.key=f?l.C0.ESC+"OC":l.C0.ESC+"[C";break;case 38:if(h.metaKey)break;s?(u.key=l.C0.ESC+"[1;"+(s+1)+"A",v||u.key!==l.C0.ESC+"[1;3A"||(u.key=l.C0.ESC+"[1;5A")):u.key=f?l.C0.ESC+"OA":l.C0.ESC+"[A";break;case 40:if(h.metaKey)break;s?(u.key=l.C0.ESC+"[1;"+(s+1)+"B",v||u.key!==l.C0.ESC+"[1;3B"||(u.key=l.C0.ESC+"[1;5B")):u.key=f?l.C0.ESC+"OB":l.C0.ESC+"[B";break;case 45:h.shiftKey||h.ctrlKey||(u.key=l.C0.ESC+"[2~");break;case 46:u.key=s?l.C0.ESC+"[3;"+(s+1)+"~":l.C0.ESC+"[3~";break;case 36:u.key=s?l.C0.ESC+"[1;"+(s+1)+"H":f?l.C0.ESC+"OH":l.C0.ESC+"[H";break;case 35:u.key=s?l.C0.ESC+"[1;"+(s+1)+"F":f?l.C0.ESC+"OF":l.C0.ESC+"[F";break;case 33:h.shiftKey?u.type=2:h.ctrlKey?u.key=l.C0.ESC+"[5;"+(s+1)+"~":u.key=l.C0.ESC+"[5~";break;case 34:h.shiftKey?u.type=3:h.ctrlKey?u.key=l.C0.ESC+"[6;"+(s+1)+"~":u.key=l.C0.ESC+"[6~";break;case 112:u.key=s?l.C0.ESC+"[1;"+(s+1)+"P":l.C0.ESC+"OP";break;case 113:u.key=s?l.C0.ESC+"[1;"+(s+1)+"Q":l.C0.ESC+"OQ";break;case 114:u.key=s?l.C0.ESC+"[1;"+(s+1)+"R":l.C0.ESC+"OR";break;case 115:u.key=s?l.C0.ESC+"[1;"+(s+1)+"S":l.C0.ESC+"OS";break;case 116:u.key=s?l.C0.ESC+"[15;"+(s+1)+"~":l.C0.ESC+"[15~";break;case 117:u.key=s?l.C0.ESC+"[17;"+(s+1)+"~":l.C0.ESC+"[17~";break;case 118:u.key=s?l.C0.ESC+"[18;"+(s+1)+"~":l.C0.ESC+"[18~";break;case 119:u.key=s?l.C0.ESC+"[19;"+(s+1)+"~":l.C0.ESC+"[19~";break;case 120:u.key=s?l.C0.ESC+"[20;"+(s+1)+"~":l.C0.ESC+"[20~";break;case 121:u.key=s?l.C0.ESC+"[21;"+(s+1)+"~":l.C0.ESC+"[21~";break;case 122:u.key=s?l.C0.ESC+"[23;"+(s+1)+"~":l.C0.ESC+"[23~";break;case 123:u.key=s?l.C0.ESC+"[24;"+(s+1)+"~":l.C0.ESC+"[24~";break;default:if(!h.ctrlKey||h.shiftKey||h.altKey||h.metaKey)if(v&&!b||!h.altKey||h.metaKey)!v||h.altKey||h.ctrlKey||h.shiftKey||!h.metaKey?h.key&&!h.ctrlKey&&!h.altKey&&!h.metaKey&&h.keyCode>=48&&h.key.length===1?u.key=h.key:h.key&&h.ctrlKey&&(h.key==="_"&&(u.key=l.C0.US),h.key==="@"&&(u.key=l.C0.NUL)):h.keyCode===65&&(u.type=1);else{const a=_[h.keyCode],i=a?.[h.shiftKey?1:0];if(i)u.key=l.C0.ESC+i;else if(h.keyCode>=65&&h.keyCode<=90){const o=h.ctrlKey?h.keyCode-64:h.keyCode+32;let d=String.fromCharCode(o);h.shiftKey&&(d=d.toUpperCase()),u.key=l.C0.ESC+d}else if(h.keyCode===32)u.key=l.C0.ESC+(h.ctrlKey?l.C0.NUL:" ");else if(h.key==="Dead"&&h.code.startsWith("Key")){let o=h.code.slice(3,4);h.shiftKey||(o=o.toLowerCase()),u.key=l.C0.ESC+o,u.cancel=!0}}else h.keyCode>=65&&h.keyCode<=90?u.key=String.fromCharCode(h.keyCode-64):h.keyCode===32?u.key=l.C0.NUL:h.keyCode>=51&&h.keyCode<=55?u.key=String.fromCharCode(h.keyCode-51+27):h.keyCode===56?u.key=l.C0.DEL:h.keyCode===219?u.key=l.C0.ESC:h.keyCode===220?u.key=l.C0.FS:h.keyCode===221&&(u.key=l.C0.GS)}return u}},482:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(n){return n>65535?(n-=65536,String.fromCharCode(55296+(n>>10))+String.fromCharCode(n%1024+56320)):String.fromCharCode(n)},r.utf32ToString=function(n,l=0,_=n.length){let h="";for(let f=l;f<_;++f){let v=n[f];v>65535?(v-=65536,h+=String.fromCharCode(55296+(v>>10))+String.fromCharCode(v%1024+56320)):h+=String.fromCharCode(v)}return h},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(n,l){const _=n.length;if(!_)return 0;let h=0,f=0;if(this._interim){const v=n.charCodeAt(f++);56320<=v&&v<=57343?l[h++]=1024*(this._interim-55296)+v-56320+65536:(l[h++]=this._interim,l[h++]=v),this._interim=0}for(let v=f;v<_;++v){const b=n.charCodeAt(v);if(55296<=b&&b<=56319){if(++v>=_)return this._interim=b,h;const u=n.charCodeAt(v);56320<=u&&u<=57343?l[h++]=1024*(b-55296)+u-56320+65536:(l[h++]=b,l[h++]=u)}else b!==65279&&(l[h++]=b)}return h}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(n,l){const _=n.length;if(!_)return 0;let h,f,v,b,u=0,s=0,a=0;if(this.interim[0]){let d=!1,S=this.interim[0];S&=(224&S)==192?31:(240&S)==224?15:7;let y,C=0;for(;(y=63&this.interim[++C])&&C<4;)S<<=6,S|=y;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,E=g-C;for(;a<E;){if(a>=_)return 0;if(y=n[a++],(192&y)!=128){a--,d=!0;break}this.interim[C++]=y,S<<=6,S|=63&y}d||(g===2?S<128?a--:l[u++]=S:g===3?S<2048||S>=55296&&S<=57343||S===65279||(l[u++]=S):S<65536||S>1114111||(l[u++]=S)),this.interim.fill(0)}const i=_-4;let o=a;for(;o<_;){for(;!(!(o<i)||128&(h=n[o])||128&(f=n[o+1])||128&(v=n[o+2])||128&(b=n[o+3]));)l[u++]=h,l[u++]=f,l[u++]=v,l[u++]=b,o+=4;if(h=n[o++],h<128)l[u++]=h;else if((224&h)==192){if(o>=_)return this.interim[0]=h,u;if(f=n[o++],(192&f)!=128){o--;continue}if(s=(31&h)<<6|63&f,s<128){o--;continue}l[u++]=s}else if((240&h)==224){if(o>=_)return this.interim[0]=h,u;if(f=n[o++],(192&f)!=128){o--;continue}if(o>=_)return this.interim[0]=h,this.interim[1]=f,u;if(v=n[o++],(192&v)!=128){o--;continue}if(s=(15&h)<<12|(63&f)<<6|63&v,s<2048||s>=55296&&s<=57343||s===65279)continue;l[u++]=s}else if((248&h)==240){if(o>=_)return this.interim[0]=h,u;if(f=n[o++],(192&f)!=128){o--;continue}if(o>=_)return this.interim[0]=h,this.interim[1]=f,u;if(v=n[o++],(192&v)!=128){o--;continue}if(o>=_)return this.interim[0]=h,this.interim[1]=f,this.interim[2]=v,u;if(b=n[o++],(192&b)!=128){o--;continue}if(s=(7&h)<<18|(63&f)<<12|(63&v)<<6|63&b,s<65536||s>1114111)continue;l[u++]=s}}return u}}},225:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const l=n(1480),_=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],h=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let f;r.UnicodeV6=class{constructor(){if(this.version="6",!f){f=new Uint8Array(65536),f.fill(1),f[0]=0,f.fill(0,1,32),f.fill(0,127,160),f.fill(2,4352,4448),f[9001]=2,f[9002]=2,f.fill(2,11904,42192),f[12351]=1,f.fill(2,44032,55204),f.fill(2,63744,64256),f.fill(2,65040,65050),f.fill(2,65072,65136),f.fill(2,65280,65377),f.fill(2,65504,65511);for(let v=0;v<_.length;++v)f.fill(0,_[v][0],_[v][1]+1)}}wcwidth(v){return v<32?0:v<127?1:v<65536?f[v]:(function(b,u){let s,a=0,i=u.length-1;if(b<u[0][0]||b>u[i][1])return!1;for(;i>=a;)if(s=a+i>>1,b>u[s][1])a=s+1;else{if(!(b<u[s][0]))return!0;i=s-1}return!1})(v,h)?0:v>=131072&&v<=196605||v>=196608&&v<=262141?2:1}charProperties(v,b){let u=this.wcwidth(v),s=u===0&&b!==0;if(s){const a=l.UnicodeService.extractWidth(b);a===0?s=!1:a>u&&(u=a)}return l.UnicodeService.createPropertyValue(0,u,s)}}},5981:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const l=n(8460),_=n(844);class h extends _.Disposable{constructor(v){super(),this._action=v,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new l.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(v,b){if(b!==void 0&&this._syncCalls>b)return void(this._syncCalls=0);if(this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let u;for(this._isSyncWriting=!0;u=this._writeBuffer.shift();){this._action(u);const s=this._callbacks.shift();s&&s()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(v,b){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+=v.length,this._writeBuffer.push(v),this._callbacks.push(b),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=v.length,this._writeBuffer.push(v),this._callbacks.push(b)}_innerWrite(v=0,b=!0){const u=v||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const s=this._writeBuffer[this._bufferOffset],a=this._action(s,b);if(a){const o=d=>Date.now()-u>=12?setTimeout((()=>this._innerWrite(0,d))):this._innerWrite(u,d);return void a.catch((d=>(queueMicrotask((()=>{throw d})),Promise.resolve(!1)))).then(o)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=s.length,Date.now()-u>=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()}}r.WriteBuffer=h},5941:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const n=/^([\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})$/,l=/^[\da-f]+$/;function _(h,f){const v=h.toString(16),b=v.length<2?"0"+v:v;switch(f){case 4:return v[0];case 8:return b;case 12:return(b+b).slice(0,3);default:return b+b}}r.parseColor=function(h){if(!h)return;let f=h.toLowerCase();if(f.indexOf("rgb:")===0){f=f.slice(4);const v=n.exec(f);if(v){const b=v[1]?15:v[4]?255:v[7]?4095:65535;return[Math.round(parseInt(v[1]||v[4]||v[7]||v[10],16)/b*255),Math.round(parseInt(v[2]||v[5]||v[8]||v[11],16)/b*255),Math.round(parseInt(v[3]||v[6]||v[9]||v[12],16)/b*255)]}}else if(f.indexOf("#")===0&&(f=f.slice(1),l.exec(f)&&[3,6,9,12].includes(f.length))){const v=f.length/3,b=[0,0,0];for(let u=0;u<3;++u){const s=parseInt(f.slice(v*u,v*u+v),16);b[u]=v===1?s<<4:v===2?s:v===3?s>>4:s>>8}return b}},r.toRgbString=function(h,f=16){const[v,b,u]=h;return`rgb:${_(v,f)}/${_(b,f)}/${_(u,f)}`}},5770:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const l=n(482),_=n(8742),h=n(5770),f=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=f,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}registerHandler(b,u){this._handlers[b]===void 0&&(this._handlers[b]=[]);const s=this._handlers[b];return s.push(u),{dispose:()=>{const a=s.indexOf(u);a!==-1&&s.splice(a,1)}}}clearHandler(b){this._handlers[b]&&delete this._handlers[b]}setHandlerFallback(b){this._handlerFb=b}reset(){if(this._active.length)for(let b=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;b>=0;--b)this._active[b].unhook(!1);this._stack.paused=!1,this._active=f,this._ident=0}hook(b,u){if(this.reset(),this._ident=b,this._active=this._handlers[b]||f,this._active.length)for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(u);else this._handlerFb(this._ident,"HOOK",u)}put(b,u,s){if(this._active.length)for(let a=this._active.length-1;a>=0;a--)this._active[a].put(b,u,s);else this._handlerFb(this._ident,"PUT",(0,l.utf32ToString)(b,u,s))}unhook(b,u=!0){if(this._active.length){let s=!1,a=this._active.length-1,i=!1;if(this._stack.paused&&(a=this._stack.loopPosition-1,s=u,i=this._stack.fallThrough,this._stack.paused=!1),!i&&s===!1){for(;a>=0&&(s=this._active[a].unhook(b),s!==!0);a--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!1,s;a--}for(;a>=0;a--)if(s=this._active[a].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=a,this._stack.fallThrough=!0,s}else this._handlerFb(this._ident,"UNHOOK",b);this._active=f,this._ident=0}};const v=new _.Params;v.addParam(0),r.DcsHandler=class{constructor(b){this._handler=b,this._data="",this._params=v,this._hitLimit=!1}hook(b){this._params=b.length>1||b.params[0]?b.clone():v,this._data="",this._hitLimit=!1}put(b,u,s){this._hitLimit||(this._data+=(0,l.utf32ToString)(b,u,s),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(b){let u=!1;if(this._hitLimit)u=!1;else if(b&&(u=this._handler(this._data,this._params),u instanceof Promise))return u.then((s=>(this._params=v,this._data="",this._hitLimit=!1,s)));return this._params=v,this._data="",this._hitLimit=!1,u}}},2015:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const l=n(844),_=n(8742),h=n(6242),f=n(6351);class v{constructor(a){this.table=new Uint8Array(a)}setDefault(a,i){this.table.fill(a<<4|i)}add(a,i,o,d){this.table[i<<8|a]=o<<4|d}addMany(a,i,o,d){for(let S=0;S<a.length;S++)this.table[i<<8|a[S]]=o<<4|d}}r.TransitionTable=v;const b=160;r.VT500_TRANSITION_TABLE=(function(){const s=new v(4095),a=Array.apply(null,Array(256)).map(((C,g)=>g)),i=(C,g)=>a.slice(C,g),o=i(32,127),d=i(0,24);d.push(25),d.push.apply(d,i(28,32));const S=i(0,14);let y;for(y in s.setDefault(1,0),s.addMany(o,0,2,0),S)s.addMany([24,26,153,154],y,3,0),s.addMany(i(128,144),y,3,0),s.addMany(i(144,152),y,3,0),s.add(156,y,0,0),s.add(27,y,11,1),s.add(157,y,4,8),s.addMany([152,158,159],y,0,7),s.add(155,y,11,3),s.add(144,y,11,9);return s.addMany(d,0,3,0),s.addMany(d,1,3,1),s.add(127,1,0,1),s.addMany(d,8,0,8),s.addMany(d,3,3,3),s.add(127,3,0,3),s.addMany(d,4,3,4),s.add(127,4,0,4),s.addMany(d,6,3,6),s.addMany(d,5,3,5),s.add(127,5,0,5),s.addMany(d,2,3,2),s.add(127,2,0,2),s.add(93,1,4,8),s.addMany(o,8,5,8),s.add(127,8,5,8),s.addMany([156,27,24,26,7],8,6,0),s.addMany(i(28,32),8,0,8),s.addMany([88,94,95],1,0,7),s.addMany(o,7,0,7),s.addMany(d,7,0,7),s.add(156,7,0,0),s.add(127,7,0,7),s.add(91,1,11,3),s.addMany(i(64,127),3,7,0),s.addMany(i(48,60),3,8,4),s.addMany([60,61,62,63],3,9,4),s.addMany(i(48,60),4,8,4),s.addMany(i(64,127),4,7,0),s.addMany([60,61,62,63],4,0,6),s.addMany(i(32,64),6,0,6),s.add(127,6,0,6),s.addMany(i(64,127),6,0,0),s.addMany(i(32,48),3,9,5),s.addMany(i(32,48),5,9,5),s.addMany(i(48,64),5,0,6),s.addMany(i(64,127),5,7,0),s.addMany(i(32,48),4,9,5),s.addMany(i(32,48),1,9,2),s.addMany(i(32,48),2,9,2),s.addMany(i(48,127),2,10,0),s.addMany(i(48,80),1,10,0),s.addMany(i(81,88),1,10,0),s.addMany([89,90,92],1,10,0),s.addMany(i(96,127),1,10,0),s.add(80,1,11,9),s.addMany(d,9,0,9),s.add(127,9,0,9),s.addMany(i(28,32),9,0,9),s.addMany(i(32,48),9,9,12),s.addMany(i(48,60),9,8,10),s.addMany([60,61,62,63],9,9,10),s.addMany(d,11,0,11),s.addMany(i(32,128),11,0,11),s.addMany(i(28,32),11,0,11),s.addMany(d,10,0,10),s.add(127,10,0,10),s.addMany(i(28,32),10,0,10),s.addMany(i(48,60),10,8,10),s.addMany([60,61,62,63],10,0,11),s.addMany(i(32,48),10,9,12),s.addMany(d,12,0,12),s.add(127,12,0,12),s.addMany(i(28,32),12,0,12),s.addMany(i(32,48),12,9,12),s.addMany(i(48,64),12,0,11),s.addMany(i(64,127),12,12,13),s.addMany(i(64,127),10,12,13),s.addMany(i(64,127),9,12,13),s.addMany(d,13,13,13),s.addMany(o,13,13,13),s.add(127,13,0,13),s.addMany([27,156,24,26],13,14,0),s.add(b,0,2,0),s.add(b,8,5,8),s.add(b,6,0,6),s.add(b,11,0,11),s.add(b,13,13,13),s})();class u extends l.Disposable{constructor(a=r.VT500_TRANSITION_TABLE){super(),this._transitions=a,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new _.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(i,o,d)=>{},this._executeHandlerFb=i=>{},this._csiHandlerFb=(i,o)=>{},this._escHandlerFb=i=>{},this._errorHandlerFb=i=>i,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,l.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new h.OscParser),this._dcsParser=this.register(new f.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(a,i=[64,126]){let o=0;if(a.prefix){if(a.prefix.length>1)throw new Error("only one byte as prefix supported");if(o=a.prefix.charCodeAt(0),o&&60>o||o>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(a.intermediates){if(a.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let S=0;S<a.intermediates.length;++S){const y=a.intermediates.charCodeAt(S);if(32>y||y>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");o<<=8,o|=y}}if(a.final.length!==1)throw new Error("final must be a single byte");const d=a.final.charCodeAt(0);if(i[0]>d||d>i[1])throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);return o<<=8,o|=d,o}identToString(a){const i=[];for(;a;)i.push(String.fromCharCode(255&a)),a>>=8;return i.reverse().join("")}setPrintHandler(a){this._printHandler=a}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(a,i){const o=this._identifier(a,[48,126]);this._escHandlers[o]===void 0&&(this._escHandlers[o]=[]);const d=this._escHandlers[o];return d.push(i),{dispose:()=>{const S=d.indexOf(i);S!==-1&&d.splice(S,1)}}}clearEscHandler(a){this._escHandlers[this._identifier(a,[48,126])]&&delete this._escHandlers[this._identifier(a,[48,126])]}setEscHandlerFallback(a){this._escHandlerFb=a}setExecuteHandler(a,i){this._executeHandlers[a.charCodeAt(0)]=i}clearExecuteHandler(a){this._executeHandlers[a.charCodeAt(0)]&&delete this._executeHandlers[a.charCodeAt(0)]}setExecuteHandlerFallback(a){this._executeHandlerFb=a}registerCsiHandler(a,i){const o=this._identifier(a);this._csiHandlers[o]===void 0&&(this._csiHandlers[o]=[]);const d=this._csiHandlers[o];return d.push(i),{dispose:()=>{const S=d.indexOf(i);S!==-1&&d.splice(S,1)}}}clearCsiHandler(a){this._csiHandlers[this._identifier(a)]&&delete this._csiHandlers[this._identifier(a)]}setCsiHandlerFallback(a){this._csiHandlerFb=a}registerDcsHandler(a,i){return this._dcsParser.registerHandler(this._identifier(a),i)}clearDcsHandler(a){this._dcsParser.clearHandler(this._identifier(a))}setDcsHandlerFallback(a){this._dcsParser.setHandlerFallback(a)}registerOscHandler(a,i){return this._oscParser.registerHandler(a,i)}clearOscHandler(a){this._oscParser.clearHandler(a)}setOscHandlerFallback(a){this._oscParser.setHandlerFallback(a)}setErrorHandler(a){this._errorHandler=a}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(a,i,o,d,S){this._parseStack.state=a,this._parseStack.handlers=i,this._parseStack.handlerPos=o,this._parseStack.transition=d,this._parseStack.chunkPos=S}parse(a,i,o){let d,S=0,y=0,C=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,C=this._parseStack.chunkPos+1;else{if(o===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const g=this._parseStack.handlers;let E=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(o===!1&&E>-1){for(;E>=0&&(d=g[E](this._params),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 4:if(o===!1&&E>-1){for(;E>=0&&(d=g[E](),d!==!0);E--)if(d instanceof Promise)return this._parseStack.handlerPos=E,d}this._parseStack.handlers=[];break;case 6:if(S=a[this._parseStack.chunkPos],d=this._dcsParser.unhook(S!==24&&S!==26,o),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(S=a[this._parseStack.chunkPos],d=this._oscParser.end(S!==24&&S!==26,o),d)return d;S===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,C=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let g=C;g<i;++g){switch(S=a[g],y=this._transitions.table[this.currentState<<8|(S<160?S:b)],y>>4){case 2:for(let R=g+1;;++R){if(R>=i||(S=a[R])<32||S>126&&S<b){this._printHandler(a,g,R),g=R-1;break}if(++R>=i||(S=a[R])<32||S>126&&S<b){this._printHandler(a,g,R),g=R-1;break}if(++R>=i||(S=a[R])<32||S>126&&S<b){this._printHandler(a,g,R),g=R-1;break}if(++R>=i||(S=a[R])<32||S>126&&S<b){this._printHandler(a,g,R),g=R-1;break}}break;case 3:this._executeHandlers[S]?this._executeHandlers[S]():this._executeHandlerFb(S),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:g,code:S,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const E=this._csiHandlers[this._collect<<8|S];let P=E?E.length-1:-1;for(;P>=0&&(d=E[P](this._params),d!==!0);P--)if(d instanceof Promise)return this._preserveStack(3,E,P,y,g),d;P<0&&this._csiHandlerFb(this._collect<<8|S,this._params),this.precedingJoinState=0;break;case 8:do switch(S){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(S-48)}while(++g<i&&(S=a[g])>47&&S<60);g--;break;case 9:this._collect<<=8,this._collect|=S;break;case 10:const O=this._escHandlers[this._collect<<8|S];let B=O?O.length-1:-1;for(;B>=0&&(d=O[B](),d!==!0);B--)if(d instanceof Promise)return this._preserveStack(4,O,B,y,g),d;B<0&&this._escHandlerFb(this._collect<<8|S),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|S,this._params);break;case 13:for(let R=g+1;;++R)if(R>=i||(S=a[R])===24||S===26||S===27||S>127&&S<b){this._dcsParser.put(a,g,R),g=R-1;break}break;case 14:if(d=this._dcsParser.unhook(S!==24&&S!==26),d)return this._preserveStack(6,[],0,y,g),d;S===27&&(y|=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 R=g+1;;R++)if(R>=i||(S=a[R])<32||S>127&&S<b){this._oscParser.put(a,g,R),g=R-1;break}break;case 6:if(d=this._oscParser.end(S!==24&&S!==26),d)return this._preserveStack(5,[],0,y,g),d;S===27&&(y|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&y}}}r.EscapeSequenceParser=u},6242:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const l=n(5770),_=n(482),h=[];r.OscParser=class{constructor(){this._state=0,this._active=h,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(f,v){this._handlers[f]===void 0&&(this._handlers[f]=[]);const b=this._handlers[f];return b.push(v),{dispose:()=>{const u=b.indexOf(v);u!==-1&&b.splice(u,1)}}}clearHandler(f){this._handlers[f]&&delete this._handlers[f]}setHandlerFallback(f){this._handlerFb=f}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=h}reset(){if(this._state===2)for(let f=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;f>=0;--f)this._active[f].end(!1);this._stack.paused=!1,this._active=h,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||h,this._active.length)for(let f=this._active.length-1;f>=0;f--)this._active[f].start();else this._handlerFb(this._id,"START")}_put(f,v,b){if(this._active.length)for(let u=this._active.length-1;u>=0;u--)this._active[u].put(f,v,b);else this._handlerFb(this._id,"PUT",(0,_.utf32ToString)(f,v,b))}start(){this.reset(),this._state=1}put(f,v,b){if(this._state!==3){if(this._state===1)for(;v<b;){const u=f[v++];if(u===59){this._state=2,this._start();break}if(u<48||57<u)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+u-48}this._state===2&&b-v>0&&this._put(f,v,b)}}end(f,v=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let b=!1,u=this._active.length-1,s=!1;if(this._stack.paused&&(u=this._stack.loopPosition-1,b=v,s=this._stack.fallThrough,this._stack.paused=!1),!s&&b===!1){for(;u>=0&&(b=this._active[u].end(f),b!==!0);u--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!1,b;u--}for(;u>=0;u--)if(b=this._active[u].end(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=u,this._stack.fallThrough=!0,b}else this._handlerFb(this._id,"END",f);this._active=h,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(f){this._handler=f,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(f,v,b){this._hitLimit||(this._data+=(0,_.utf32ToString)(f,v,b),this._data.length>l.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(f){let v=!1;if(this._hitLimit)v=!1;else if(f&&(v=this._handler(this._data),v instanceof Promise))return v.then((b=>(this._data="",this._hitLimit=!1,b)));return this._data="",this._hitLimit=!1,v}}},8742:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const n=2147483647;class l{static fromArray(h){const f=new l;if(!h.length)return f;for(let v=Array.isArray(h[0])?1:0;v<h.length;++v){const b=h[v];if(Array.isArray(b))for(let u=0;u<b.length;++u)f.addSubParam(b[u]);else f.addParam(b)}return f}constructor(h=32,f=32){if(this.maxLength=h,this.maxSubParamsLength=f,f>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(h),this.length=0,this._subParams=new Int32Array(f),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(h),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const h=new l(this.maxLength,this.maxSubParamsLength);return h.params.set(this.params),h.length=this.length,h._subParams.set(this._subParams),h._subParamsLength=this._subParamsLength,h._subParamsIdx.set(this._subParamsIdx),h._rejectDigits=this._rejectDigits,h._rejectSubDigits=this._rejectSubDigits,h._digitIsSub=this._digitIsSub,h}toArray(){const h=[];for(let f=0;f<this.length;++f){h.push(this.params[f]);const v=this._subParamsIdx[f]>>8,b=255&this._subParamsIdx[f];b-v>0&&h.push(Array.prototype.slice.call(this._subParams,v,b))}return h}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(h){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=h>n?n:h}}addSubParam(h){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(h<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=h>n?n:h,this._subParamsIdx[this.length-1]++}}hasSubParams(h){return(255&this._subParamsIdx[h])-(this._subParamsIdx[h]>>8)>0}getSubParams(h){const f=this._subParamsIdx[h]>>8,v=255&this._subParamsIdx[h];return v-f>0?this._subParams.subarray(f,v):null}getSubParamsAll(){const h={};for(let f=0;f<this.length;++f){const v=this._subParamsIdx[f]>>8,b=255&this._subParamsIdx[f];b-v>0&&(h[f]=this._subParams.slice(v,b))}return h}addDigit(h){let f;if(this._rejectDigits||!(f=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const v=this._digitIsSub?this._subParams:this.params,b=v[f-1];v[f-1]=~b?Math.min(10*b+h,n):h}}r.Params=l},5741:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let n=this._addons.length-1;n>=0;n--)this._addons[n].instance.dispose()}loadAddon(n,l){const _={instance:l,dispose:l.dispose,isDisposed:!1};this._addons.push(_),l.dispose=()=>this._wrappedAddonDispose(_),l.activate(n)}_wrappedAddonDispose(n){if(n.isDisposed)return;let l=-1;for(let _=0;_<this._addons.length;_++)if(this._addons[_]===n){l=_;break}if(l===-1)throw new Error("Could not dispose an addon that has not been loaded");n.isDisposed=!0,n.dispose.apply(n.instance),this._addons.splice(l,1)}}},8771:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const l=n(3785),_=n(511);r.BufferApiView=class{constructor(h,f){this._buffer=h,this.type=f}init(h){return this._buffer=h,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(h){const f=this._buffer.lines.get(h);if(f)return new l.BufferLineApiView(f)}getNullCell(){return new _.CellData}}},3785:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const l=n(511);r.BufferLineApiView=class{constructor(_){this._line=_}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(_,h){if(!(_<0||_>=this._line.length))return h?(this._line.loadCell(_,h),h):this._line.loadCell(_,new l.CellData)}translateToString(_,h,f){return this._line.translateToString(_,h,f)}}},8285:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const l=n(8771),_=n(8460),h=n(844);class f extends h.Disposable{constructor(b){super(),this._core=b,this._onBufferChange=this.register(new _.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new l.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new l.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)}}r.BufferNamespaceApi=f},7975:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(n){this._core=n}registerCsiHandler(n,l){return this._core.registerCsiHandler(n,(_=>l(_.toArray())))}addCsiHandler(n,l){return this.registerCsiHandler(n,l)}registerDcsHandler(n,l){return this._core.registerDcsHandler(n,((_,h)=>l(_,h.toArray())))}addDcsHandler(n,l){return this.registerDcsHandler(n,l)}registerEscHandler(n,l){return this._core.registerEscHandler(n,l)}addEscHandler(n,l){return this.registerEscHandler(n,l)}registerOscHandler(n,l){return this._core.registerOscHandler(n,l)}addOscHandler(n,l){return this.registerOscHandler(n,l)}}},7090:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(n){this._core=n}register(n){this._core.unicodeService.register(n)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(n){this._core.unicodeService.activeVersion=n}}},744:function(w,r,n){var l=this&&this.__decorate||function(s,a,i,o){var d,S=arguments.length,y=S<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,i):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(s,a,i,o);else for(var C=s.length-1;C>=0;C--)(d=s[C])&&(y=(S<3?d(y):S>3?d(a,i,y):d(a,i))||y);return S>3&&y&&Object.defineProperty(a,i,y),y},_=this&&this.__param||function(s,a){return function(i,o){a(i,o,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const h=n(8460),f=n(844),v=n(5295),b=n(2585);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let u=r.BufferService=class extends f.Disposable{get buffer(){return this.buffers.active}constructor(s){super(),this.isUserScrolling=!1,this._onResize=this.register(new h.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new h.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(s.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(s.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=this.register(new v.BufferSet(s,this))}resize(s,a){this.cols=s,this.rows=a,this.buffers.resize(s,a),this._onResize.fire({cols:s,rows:a})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(s,a=!1){const i=this.buffer;let o;o=this._cachedBlankLine,o&&o.length===this.cols&&o.getFg(0)===s.fg&&o.getBg(0)===s.bg||(o=i.getBlankLine(s,a),this._cachedBlankLine=o),o.isWrapped=a;const d=i.ybase+i.scrollTop,S=i.ybase+i.scrollBottom;if(i.scrollTop===0){const y=i.lines.isFull;S===i.lines.length-1?y?i.lines.recycle().copyFrom(o):i.lines.push(o.clone()):i.lines.splice(S+1,0,o.clone()),y?this.isUserScrolling&&(i.ydisp=Math.max(i.ydisp-1,0)):(i.ybase++,this.isUserScrolling||i.ydisp++)}else{const y=S-d+1;i.lines.shiftElements(d+1,y-1,-1),i.lines.set(S,o.clone())}this.isUserScrolling||(i.ydisp=i.ybase),this._onScroll.fire(i.ydisp)}scrollLines(s,a,i){const o=this.buffer;if(s<0){if(o.ydisp===0)return;this.isUserScrolling=!0}else s+o.ydisp>=o.ybase&&(this.isUserScrolling=!1);const d=o.ydisp;o.ydisp=Math.max(Math.min(o.ydisp+s,o.ybase),0),d!==o.ydisp&&(a||this._onScroll.fire(o.ydisp))}};r.BufferService=u=l([_(0,b.IOptionsService)],u)},7994:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(n){this.glevel=n,this.charset=this._charsets[n]}setgCharset(n,l){this._charsets[n]=l,this.glevel===n&&(this.charset=l)}}},1753:function(w,r,n){var l=this&&this.__decorate||function(o,d,S,y){var C,g=arguments.length,E=g<3?d:y===null?y=Object.getOwnPropertyDescriptor(d,S):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(o,d,S,y);else for(var P=o.length-1;P>=0;P--)(C=o[P])&&(E=(g<3?C(E):g>3?C(d,S,E):C(d,S))||E);return g>3&&E&&Object.defineProperty(d,S,E),E},_=this&&this.__param||function(o,d){return function(S,y){d(S,y,o)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const h=n(2585),f=n(8460),v=n(844),b={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:o=>o.button!==4&&o.action===1&&(o.ctrl=!1,o.alt=!1,o.shift=!1,!0)},VT200:{events:19,restrict:o=>o.action!==32},DRAG:{events:23,restrict:o=>o.action!==32||o.button!==3},ANY:{events:31,restrict:o=>!0}};function u(o,d){let S=(o.ctrl?16:0)|(o.shift?4:0)|(o.alt?8:0);return o.button===4?(S|=64,S|=o.action):(S|=3&o.button,4&o.button&&(S|=64),8&o.button&&(S|=128),o.action===32?S|=32:o.action!==0||d||(S|=3)),S}const s=String.fromCharCode,a={DEFAULT:o=>{const d=[u(o,!1)+32,o.col+32,o.row+32];return d[0]>255||d[1]>255||d[2]>255?"":`\x1B[M${s(d[0])}${s(d[1])}${s(d[2])}`},SGR:o=>{const d=o.action===0&&o.button!==4?"m":"M";return`\x1B[<${u(o,!0)};${o.col};${o.row}${d}`},SGR_PIXELS:o=>{const d=o.action===0&&o.button!==4?"m":"M";return`\x1B[<${u(o,!0)};${o.x};${o.y}${d}`}};let i=r.CoreMouseService=class extends v.Disposable{constructor(o,d){super(),this._bufferService=o,this._coreService=d,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new f.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const S of Object.keys(b))this.addProtocol(S,b[S]);for(const S of Object.keys(a))this.addEncoding(S,a[S]);this.reset()}addProtocol(o,d){this._protocols[o]=d}addEncoding(o,d){this._encodings[o]=d}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(o){if(!this._protocols[o])throw new Error(`unknown protocol "${o}"`);this._activeProtocol=o,this._onProtocolChange.fire(this._protocols[o].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(o){if(!this._encodings[o])throw new Error(`unknown encoding "${o}"`);this._activeEncoding=o}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(o){if(o.col<0||o.col>=this._bufferService.cols||o.row<0||o.row>=this._bufferService.rows||o.button===4&&o.action===32||o.button===3&&o.action!==32||o.button!==4&&(o.action===2||o.action===3)||(o.col++,o.row++,o.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,o,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(o))return!1;const d=this._encodings[this._activeEncoding](o);return d&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(d):this._coreService.triggerDataEvent(d,!0)),this._lastEvent=o,!0}explainEvents(o){return{down:!!(1&o),up:!!(2&o),drag:!!(4&o),move:!!(8&o),wheel:!!(16&o)}}_equalEvents(o,d,S){if(S){if(o.x!==d.x||o.y!==d.y)return!1}else if(o.col!==d.col||o.row!==d.row)return!1;return o.button===d.button&&o.action===d.action&&o.ctrl===d.ctrl&&o.alt===d.alt&&o.shift===d.shift}};r.CoreMouseService=i=l([_(0,h.IBufferService),_(1,h.ICoreService)],i)},6975:function(w,r,n){var l=this&&this.__decorate||function(i,o,d,S){var y,C=arguments.length,g=C<3?o:S===null?S=Object.getOwnPropertyDescriptor(o,d):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,o,d,S);else for(var E=i.length-1;E>=0;E--)(y=i[E])&&(g=(C<3?y(g):C>3?y(o,d,g):y(o,d))||g);return C>3&&g&&Object.defineProperty(o,d,g),g},_=this&&this.__param||function(i,o){return function(d,S){o(d,S,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const h=n(1439),f=n(8460),v=n(844),b=n(2585),u=Object.freeze({insertMode:!1}),s=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let a=r.CoreService=class extends v.Disposable{constructor(i,o,d){super(),this._bufferService=i,this._logService=o,this._optionsService=d,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new f.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new f.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new f.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new f.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,h.clone)(u),this.decPrivateModes=(0,h.clone)(s)}reset(){this.modes=(0,h.clone)(u),this.decPrivateModes=(0,h.clone)(s)}triggerDataEvent(i,o=!1){if(this._optionsService.rawOptions.disableStdin)return;const d=this._bufferService.buffer;o&&this._optionsService.rawOptions.scrollOnUserInput&&d.ybase!==d.ydisp&&this._onRequestScrollToBottom.fire(),o&&this._onUserInput.fire(),this._logService.debug(`sending data "${i}"`,(()=>i.split("").map((S=>S.charCodeAt(0))))),this._onData.fire(i)}triggerBinaryEvent(i){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${i}"`,(()=>i.split("").map((o=>o.charCodeAt(0))))),this._onBinary.fire(i))}};r.CoreService=a=l([_(0,b.IBufferService),_(1,b.ILogService),_(2,b.IOptionsService)],a)},9074:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const l=n(8055),_=n(8460),h=n(844),f=n(6106);let v=0,b=0;class u extends h.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new f.SortedList((i=>i?.marker.line)),this._onDecorationRegistered=this.register(new _.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new _.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,h.toDisposable)((()=>this.reset())))}registerDecoration(i){if(i.marker.isDisposed)return;const o=new s(i);if(o){const d=o.marker.onDispose((()=>o.dispose()));o.onDispose((()=>{o&&(this._decorations.delete(o)&&this._onDecorationRemoved.fire(o),d.dispose())})),this._decorations.insert(o),this._onDecorationRegistered.fire(o)}return o}reset(){for(const i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,o,d){let S=0,y=0;for(const C of this._decorations.getKeyIterator(o))S=C.options.x??0,y=S+(C.options.width??1),i>=S&&i<y&&(!d||(C.options.layer??"bottom")===d)&&(yield C)}forEachDecorationAtCell(i,o,d,S){this._decorations.forEachByKey(o,(y=>{v=y.options.x??0,b=v+(y.options.width??1),i>=v&&i<b&&(!d||(y.options.layer??"bottom")===d)&&S(y)}))}}r.DecorationService=u;class s extends h.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=l.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=l.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(i){super(),this.options=i,this.onRenderEmitter=this.register(new _.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new _.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const l=n(2585),_=n(8343);class h{constructor(...v){this._entries=new Map;for(const[b,u]of v)this.set(b,u)}set(v,b){const u=this._entries.get(v);return this._entries.set(v,b),u}forEach(v){for(const[b,u]of this._entries.entries())v(b,u)}has(v){return this._entries.has(v)}get(v){return this._entries.get(v)}}r.ServiceCollection=h,r.InstantiationService=class{constructor(){this._services=new h,this._services.set(l.IInstantiationService,this)}setService(f,v){this._services.set(f,v)}getService(f){return this._services.get(f)}createInstance(f,...v){const b=(0,_.getServiceDependencies)(f).sort(((a,i)=>a.index-i.index)),u=[];for(const a of b){const i=this._services.get(a.id);if(!i)throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${a.id}.`);u.push(i)}const s=b.length>0?b[0].index:v.length;if(v.length!==s)throw new Error(`[createInstance] First service dependency of ${f.name} at position ${s+1} conflicts with ${v.length} static arguments`);return new f(...v,...u)}}},7866:function(w,r,n){var l=this&&this.__decorate||function(s,a,i,o){var d,S=arguments.length,y=S<3?a:o===null?o=Object.getOwnPropertyDescriptor(a,i):o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")y=Reflect.decorate(s,a,i,o);else for(var C=s.length-1;C>=0;C--)(d=s[C])&&(y=(S<3?d(y):S>3?d(a,i,y):d(a,i))||y);return S>3&&y&&Object.defineProperty(a,i,y),y},_=this&&this.__param||function(s,a){return function(i,o){a(i,o,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.traceCall=r.setTraceLogger=r.LogService=void 0;const h=n(844),f=n(2585),v={trace:f.LogLevelEnum.TRACE,debug:f.LogLevelEnum.DEBUG,info:f.LogLevelEnum.INFO,warn:f.LogLevelEnum.WARN,error:f.LogLevelEnum.ERROR,off:f.LogLevelEnum.OFF};let b,u=r.LogService=class extends h.Disposable{get logLevel(){return this._logLevel}constructor(s){super(),this._optionsService=s,this._logLevel=f.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),b=this}_updateLogLevel(){this._logLevel=v[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(s){for(let a=0;a<s.length;a++)typeof s[a]=="function"&&(s[a]=s[a]())}_log(s,a,i){this._evalLazyOptionalParams(i),s.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+a,...i)}trace(s,...a){this._logLevel<=f.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,s,a)}debug(s,...a){this._logLevel<=f.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,s,a)}info(s,...a){this._logLevel<=f.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,s,a)}warn(s,...a){this._logLevel<=f.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,s,a)}error(s,...a){this._logLevel<=f.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,s,a)}};r.LogService=u=l([_(0,f.IOptionsService)],u),r.setTraceLogger=function(s){b=s},r.traceCall=function(s,a,i){if(typeof i.value!="function")throw new Error("not supported");const o=i.value;i.value=function(...d){if(b.logLevel!==f.LogLevelEnum.TRACE)return o.apply(this,d);b.trace(`GlyphRenderer#${o.name}(${d.map((y=>JSON.stringify(y))).join(", ")})`);const S=o.apply(this,d);return b.trace(`GlyphRenderer#${o.name} return`,S),S}}},7302:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const l=n(8460),_=n(844),h=n(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:h.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const f=["normal","bold","100","200","300","400","500","600","700","800","900"];class v extends _.Disposable{constructor(u){super(),this._onOptionChange=this.register(new l.EventEmitter),this.onOptionChange=this._onOptionChange.event;const s={...r.DEFAULT_OPTIONS};for(const a in u)if(a in s)try{const i=u[a];s[a]=this._sanitizeAndValidateOption(a,i)}catch(i){console.error(i)}this.rawOptions=s,this.options={...s},this._setupOptions(),this.register((0,_.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(u,s){return this.onOptionChange((a=>{a===u&&s(this.rawOptions[u])}))}onMultipleOptionChange(u,s){return this.onOptionChange((a=>{u.indexOf(a)!==-1&&s()}))}_setupOptions(){const u=a=>{if(!(a in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${a}"`);return this.rawOptions[a]},s=(a,i)=>{if(!(a in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${a}"`);i=this._sanitizeAndValidateOption(a,i),this.rawOptions[a]!==i&&(this.rawOptions[a]=i,this._onOptionChange.fire(a))};for(const a in this.rawOptions){const i={get:u.bind(this,a),set:s.bind(this,a)};Object.defineProperty(this.options,a,i)}}_sanitizeAndValidateOption(u,s){switch(u){case"cursorStyle":if(s||(s=r.DEFAULT_OPTIONS[u]),!(function(a){return a==="block"||a==="underline"||a==="bar"})(s))throw new Error(`"${s}" is not a valid value for ${u}`);break;case"wordSeparator":s||(s=r.DEFAULT_OPTIONS[u]);break;case"fontWeight":case"fontWeightBold":if(typeof s=="number"&&1<=s&&s<=1e3)break;s=f.includes(s)?s:r.DEFAULT_OPTIONS[u];break;case"cursorWidth":s=Math.floor(s);case"lineHeight":case"tabStopWidth":if(s<1)throw new Error(`${u} cannot be less than 1, value: ${s}`);break;case"minimumContrastRatio":s=Math.max(1,Math.min(21,Math.round(10*s)/10));break;case"scrollback":if((s=Math.min(s,4294967295))<0)throw new Error(`${u} cannot be less than 0, value: ${s}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(s<=0)throw new Error(`${u} cannot be less than or equal to 0, value: ${s}`);break;case"rows":case"cols":if(!s&&s!==0)throw new Error(`${u} must be numeric, value: ${s}`);break;case"windowsPty":s=s??{}}return s}}r.OptionsService=v},2660:function(w,r,n){var l=this&&this.__decorate||function(v,b,u,s){var a,i=arguments.length,o=i<3?b:s===null?s=Object.getOwnPropertyDescriptor(b,u):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(v,b,u,s);else for(var d=v.length-1;d>=0;d--)(a=v[d])&&(o=(i<3?a(o):i>3?a(b,u,o):a(b,u))||o);return i>3&&o&&Object.defineProperty(b,u,o),o},_=this&&this.__param||function(v,b){return function(u,s){b(u,s,v)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const h=n(2585);let f=r.OscLinkService=class{constructor(v){this._bufferService=v,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(v){const b=this._bufferService.buffer;if(v.id===void 0){const d=b.addMarker(b.ybase+b.y),S={data:v,id:this._nextId++,lines:[d]};return d.onDispose((()=>this._removeMarkerFromLink(S,d))),this._dataByLinkId.set(S.id,S),S.id}const u=v,s=this._getEntryIdKey(u),a=this._entriesWithId.get(s);if(a)return this.addLineToLink(a.id,b.ybase+b.y),a.id;const i=b.addMarker(b.ybase+b.y),o={id:this._nextId++,key:this._getEntryIdKey(u),data:u,lines:[i]};return i.onDispose((()=>this._removeMarkerFromLink(o,i))),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(v,b){const u=this._dataByLinkId.get(v);if(u&&u.lines.every((s=>s.line!==b))){const s=this._bufferService.buffer.addMarker(b);u.lines.push(s),s.onDispose((()=>this._removeMarkerFromLink(u,s)))}}getLinkData(v){return this._dataByLinkId.get(v)?.data}_getEntryIdKey(v){return`${v.id};;${v.uri}`}_removeMarkerFromLink(v,b){const u=v.lines.indexOf(b);u!==-1&&(v.lines.splice(u,1),v.lines.length===0&&(v.data.id!==void 0&&this._entriesWithId.delete(v.key),this._dataByLinkId.delete(v.id)))}};r.OscLinkService=f=l([_(0,h.IBufferService)],f)},8343:(w,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0;const n="di$target",l="di$dependencies";r.serviceRegistry=new Map,r.getServiceDependencies=function(_){return _[l]||[]},r.createDecorator=function(_){if(r.serviceRegistry.has(_))return r.serviceRegistry.get(_);const h=function(f,v,b){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(u,s,a){s[n]===s?s[l].push({id:u,index:a}):(s[l]=[{id:u,index:a}],s[n]=s)})(h,f,b)};return h.toString=()=>_,r.serviceRegistry.set(_,h),h}},2585:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const l=n(8343);var _;r.IBufferService=(0,l.createDecorator)("BufferService"),r.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),r.ICoreService=(0,l.createDecorator)("CoreService"),r.ICharsetService=(0,l.createDecorator)("CharsetService"),r.IInstantiationService=(0,l.createDecorator)("InstantiationService"),(function(h){h[h.TRACE=0]="TRACE",h[h.DEBUG=1]="DEBUG",h[h.INFO=2]="INFO",h[h.WARN=3]="WARN",h[h.ERROR=4]="ERROR",h[h.OFF=5]="OFF"})(_||(r.LogLevelEnum=_={})),r.ILogService=(0,l.createDecorator)("LogService"),r.IOptionsService=(0,l.createDecorator)("OptionsService"),r.IOscLinkService=(0,l.createDecorator)("OscLinkService"),r.IUnicodeService=(0,l.createDecorator)("UnicodeService"),r.IDecorationService=(0,l.createDecorator)("DecorationService")},1480:(w,r,n)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const l=n(8460),_=n(225);class h{static extractShouldJoin(v){return(1&v)!=0}static extractWidth(v){return v>>1&3}static extractCharKind(v){return v>>3}static createPropertyValue(v,b,u=!1){return(16777215&v)<<3|(3&b)<<1|(u?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new l.EventEmitter,this.onChange=this._onChange.event;const v=new _.UnicodeV6;this.register(v),this._active=v.version,this._activeProvider=v}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(v){if(!this._providers[v])throw new Error(`unknown Unicode version "${v}"`);this._active=v,this._activeProvider=this._providers[v],this._onChange.fire(v)}register(v){this._providers[v.version]=v}wcwidth(v){return this._activeProvider.wcwidth(v)}getStringCellWidth(v){let b=0,u=0;const s=v.length;for(let a=0;a<s;++a){let i=v.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=s)return b+this.wcwidth(i);const S=v.charCodeAt(a);56320<=S&&S<=57343?i=1024*(i-55296)+S-56320+65536:b+=this.wcwidth(S)}const o=this.charProperties(i,u);let d=h.extractWidth(o);h.extractShouldJoin(o)&&(d-=h.extractWidth(u)),b+=d,u=o}return b}charProperties(v,b){return this._activeProvider.charProperties(v,b)}}r.UnicodeService=h}},p={};function m(w){var r=p[w];if(r!==void 0)return r.exports;var n=p[w]={exports:{}};return c[w].call(n.exports,n,n.exports,m),n.exports}var k={};return(()=>{var w=k;Object.defineProperty(w,"__esModule",{value:!0}),w.Terminal=void 0;const r=m(9042),n=m(3236),l=m(844),_=m(5741),h=m(8285),f=m(7975),v=m(7090),b=["cols","rows"];class u extends l.Disposable{constructor(a){super(),this._core=this.register(new n.Terminal(a)),this._addonManager=this.register(new _.AddonManager),this._publicOptions={...this._core.options};const i=d=>this._core.options[d],o=(d,S)=>{this._checkReadonlyOptions(d),this._core.options[d]=S};for(const d in this._core.options){const S={get:i.bind(this,d),set:o.bind(this,d)};Object.defineProperty(this._publicOptions,d,S)}}_checkReadonlyOptions(a){if(b.includes(a))throw new Error(`Option "${a}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new f.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new v.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new h.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const a=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:a.applicationCursorKeys,applicationKeypadMode:a.applicationKeypad,bracketedPasteMode:a.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:a.origin,reverseWraparoundMode:a.reverseWraparound,sendFocusMode:a.sendFocus,wraparoundMode:a.wraparound}}get options(){return this._publicOptions}set options(a){for(const i in a)this._publicOptions[i]=a[i]}blur(){this._core.blur()}focus(){this._core.focus()}input(a,i=!0){this._core.input(a,i)}resize(a,i){this._verifyIntegers(a,i),this._core.resize(a,i)}open(a){this._core.open(a)}attachCustomKeyEventHandler(a){this._core.attachCustomKeyEventHandler(a)}attachCustomWheelEventHandler(a){this._core.attachCustomWheelEventHandler(a)}registerLinkProvider(a){return this._core.registerLinkProvider(a)}registerCharacterJoiner(a){return this._checkProposedApi(),this._core.registerCharacterJoiner(a)}deregisterCharacterJoiner(a){this._checkProposedApi(),this._core.deregisterCharacterJoiner(a)}registerMarker(a=0){return this._verifyIntegers(a),this._core.registerMarker(a)}registerDecoration(a){return this._checkProposedApi(),this._verifyPositiveIntegers(a.x??0,a.width??0,a.height??0),this._core.registerDecoration(a)}hasSelection(){return this._core.hasSelection()}select(a,i,o){this._verifyIntegers(a,i,o),this._core.select(a,i,o)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(a,i){this._verifyIntegers(a,i),this._core.selectLines(a,i)}dispose(){super.dispose()}scrollLines(a){this._verifyIntegers(a),this._core.scrollLines(a)}scrollPages(a){this._verifyIntegers(a),this._core.scrollPages(a)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(a){this._verifyIntegers(a),this._core.scrollToLine(a)}clear(){this._core.clear()}write(a,i){this._core.write(a,i)}writeln(a,i){this._core.write(a),this._core.write(`\r
9
- `,i)}paste(a){this._core.paste(a)}refresh(a,i){this._verifyIntegers(a,i),this._core.refresh(a,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(a){this._addonManager.loadAddon(this,a)}static get strings(){return r}_verifyIntegers(...a){for(const i of a)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...a){for(const i of a)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}w.Terminal=u})(),k})()))})(_t)),_t.exports}var ys=Ss();function j(e,t,c){function p(r,n){var l;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(l=r._zod).traits??(l.traits=new Set),r._zod.traits.add(e),t(r,n);for(const _ in w.prototype)_ in r||Object.defineProperty(r,_,{value:w.prototype[_].bind(r)});r._zod.constr=w,r._zod.def=n}const m=c?.Parent??Object;class k extends m{}Object.defineProperty(k,"name",{value:e});function w(r){var n;const l=c?.Parent?new k:this;p(l,r),(n=l._zod).deferred??(n.deferred=[]);for(const _ of l._zod.deferred)_();return l}return Object.defineProperty(w,"init",{value:p}),Object.defineProperty(w,Symbol.hasInstance,{value:r=>c?.Parent&&r instanceof c.Parent?!0:r?._zod?.traits?.has(e)}),Object.defineProperty(w,"name",{value:e}),w}class De extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Or extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ws={};function we(e){return ws}function vt(e,t){return typeof t=="bigint"?t.toString():t}function wt(e){return e==null}function Ct(e){const t=e.startsWith("^")?1:0,c=e.endsWith("$")?e.length-1:e.length;return e.slice(t,c)}const Zt=Symbol("evaluating");function ee(e,t,c){let p;Object.defineProperty(e,t,{get(){if(p!==Zt)return p===void 0&&(p=Zt,p=c()),p},set(m){Object.defineProperty(e,t,{value:m})},configurable:!0})}function Cs(...e){const t={};for(const c of e){const p=Object.getOwnPropertyDescriptors(c);Object.assign(t,p)}return Object.defineProperties({},t)}const Tr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function qt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gt(e){if(qt(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const c=t.prototype;return!(qt(c)===!1||Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")===!1)}function Br(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e}function Et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Es(e,t,c){const p=new e._zod.constr(t??e._zod.def);return(!t||c?.parent)&&(p._zod.parent=e),p}function Y(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ke(e,t=0){if(e.aborted===!0)return!0;for(let c=t;c<e.issues.length;c++)if(e.issues[c]?.continue!==!0)return!0;return!1}function xs(e,t){return t.map(c=>{var p;return(p=c).path??(p.path=[]),c.path.unshift(e),c})}function Ge(e){return typeof e=="string"?e:e?.message}function Ce(e,t,c){const p={...e,path:e.path??[]};if(!e.message){const m=Ge(e.inst?._zod.def?.error?.(e))??Ge(t?.error?.(e))??Ge(c.customError?.(e))??Ge(c.localeError?.(e))??"Invalid input";p.message=m}return delete p.inst,delete p.continue,t?.reportInput||delete p.input,p}function xt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function He(...e){const[t,c,p]=e;return typeof t=="string"?{message:t,code:"custom",input:c,inst:p}:{...t}}const Ir=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Mr=j("$ZodError",Ir),Hr=j("$ZodError",Ir,{Parent:Error});function ks(e,t=c=>c.message){const c={},p=[];for(const m of e.issues)m.path.length>0?(c[m.path[0]]=c[m.path[0]]||[],c[m.path[0]].push(t(m))):p.push(t(m));return{formErrors:p,fieldErrors:c}}function Ds(e,t){const c=t||function(k){return k.message},p={_errors:[]},m=k=>{for(const w of k.issues)if(w.code==="invalid_union"&&w.errors.length)w.errors.map(r=>m({issues:r}));else if(w.code==="invalid_key")m({issues:w.issues});else if(w.code==="invalid_element")m({issues:w.issues});else if(w.path.length===0)p._errors.push(c(w));else{let r=p,n=0;for(;n<w.path.length;){const l=w.path[n];n===w.path.length-1?(r[l]=r[l]||{_errors:[]},r[l]._errors.push(c(w))):r[l]=r[l]||{_errors:[]},r=r[l],n++}}};return m(e),p}const kt=e=>(t,c,p,m)=>{const k=p?Object.assign(p,{async:!1}):{async:!1},w=t._zod.run({value:c,issues:[]},k);if(w instanceof Promise)throw new De;if(w.issues.length){const r=new(m?.Err??e)(w.issues.map(n=>Ce(n,k,we())));throw Tr(r,m?.callee),r}return w.value},Dt=e=>async(t,c,p,m)=>{const k=p?Object.assign(p,{async:!0}):{async:!0};let w=t._zod.run({value:c,issues:[]},k);if(w instanceof Promise&&(w=await w),w.issues.length){const r=new(m?.Err??e)(w.issues.map(n=>Ce(n,k,we())));throw Tr(r,m?.callee),r}return w.value},it=e=>(t,c,p)=>{const m=p?{...p,async:!1}:{async:!1},k=t._zod.run({value:c,issues:[]},m);if(k instanceof Promise)throw new De;return k.issues.length?{success:!1,error:new(e??Mr)(k.issues.map(w=>Ce(w,m,we())))}:{success:!0,data:k.value}},Rs=it(Hr),st=e=>async(t,c,p)=>{const m=p?Object.assign(p,{async:!0}):{async:!0};let k=t._zod.run({value:c,issues:[]},m);return k instanceof Promise&&(k=await k),k.issues.length?{success:!1,error:new e(k.issues.map(w=>Ce(w,m,we())))}:{success:!0,data:k.value}},Ls=st(Hr),As=e=>(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return kt(e)(t,c,m)},Ps=e=>(t,c,p)=>kt(e)(t,c,p),Os=e=>async(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return Dt(e)(t,c,m)},Ts=e=>async(t,c,p)=>Dt(e)(t,c,p),Bs=e=>(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return it(e)(t,c,m)},Is=e=>(t,c,p)=>it(e)(t,c,p),Ms=e=>async(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return st(e)(t,c,m)},Hs=e=>async(t,c,p)=>st(e)(t,c,p),Fs=/^[cC][^\s-]{8,}$/,js=/^[0-9a-z]+$/,zs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$s=/^[0-9a-vA-V]{20}$/,Ws=/^[A-Za-z0-9]{27}$/,Us=/^[a-zA-Z0-9_-]{21}$/,Ns=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ks="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Vs(){return new RegExp(Ks,"u")}const Gs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Js=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ys=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Xs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fr=/^[A-Za-z0-9_-]*$/,en=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,tn=/^\+(?:[0-9]){6,14}[0-9]$/,jr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",rn=new RegExp(`^${jr}$`);function zr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sn(e){return new RegExp(`^${zr(e)}$`)}function nn(e){const t=zr({precision:e.precision}),c=["Z"];e.local&&c.push(""),e.offset&&c.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const p=`${t}(?:${c.join("|")})`;return new RegExp(`^${jr}T(?:${p})$`)}const on=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},an=/^[^A-Z]*$/,cn=/^[^a-z]*$/,ve=j("$ZodCheck",(e,t)=>{var c;e._zod??(e._zod={}),e._zod.def=t,(c=e._zod).onattach??(c.onattach=[])}),hn=j("$ZodCheckMaxLength",(e,t)=>{var c;ve.init(e,t),(c=e._zod.def).when??(c.when=p=>{const m=p.value;return!wt(m)&&m.length!==void 0}),e._zod.onattach.push(p=>{const m=p._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<m&&(p._zod.bag.maximum=t.maximum)}),e._zod.check=p=>{const m=p.value;if(m.length<=t.maximum)return;const w=xt(m);p.issues.push({origin:w,code:"too_big",maximum:t.maximum,inclusive:!0,input:m,inst:e,continue:!t.abort})}}),ln=j("$ZodCheckMinLength",(e,t)=>{var c;ve.init(e,t),(c=e._zod.def).when??(c.when=p=>{const m=p.value;return!wt(m)&&m.length!==void 0}),e._zod.onattach.push(p=>{const m=p._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>m&&(p._zod.bag.minimum=t.minimum)}),e._zod.check=p=>{const m=p.value;if(m.length>=t.minimum)return;const w=xt(m);p.issues.push({origin:w,code:"too_small",minimum:t.minimum,inclusive:!0,input:m,inst:e,continue:!t.abort})}}),un=j("$ZodCheckLengthEquals",(e,t)=>{var c;ve.init(e,t),(c=e._zod.def).when??(c.when=p=>{const m=p.value;return!wt(m)&&m.length!==void 0}),e._zod.onattach.push(p=>{const m=p._zod.bag;m.minimum=t.length,m.maximum=t.length,m.length=t.length}),e._zod.check=p=>{const m=p.value,k=m.length;if(k===t.length)return;const w=xt(m),r=k>t.length;p.issues.push({origin:w,...r?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:p.value,inst:e,continue:!t.abort})}}),nt=j("$ZodCheckStringFormat",(e,t)=>{var c,p;ve.init(e,t),e._zod.onattach.push(m=>{const k=m._zod.bag;k.format=t.format,t.pattern&&(k.patterns??(k.patterns=new Set),k.patterns.add(t.pattern))}),t.pattern?(c=e._zod).check??(c.check=m=>{t.pattern.lastIndex=0,!t.pattern.test(m.value)&&m.issues.push({origin:"string",code:"invalid_format",format:t.format,input:m.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(p=e._zod).check??(p.check=()=>{})}),dn=j("$ZodCheckRegex",(e,t)=>{nt.init(e,t),e._zod.check=c=>{t.pattern.lastIndex=0,!t.pattern.test(c.value)&&c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fn=j("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=an),nt.init(e,t)}),_n=j("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cn),nt.init(e,t)}),pn=j("$ZodCheckIncludes",(e,t)=>{ve.init(e,t);const c=Et(t.includes),p=new RegExp(typeof t.position=="number"?`^.{${t.position}}${c}`:c);t.pattern=p,e._zod.onattach.push(m=>{const k=m._zod.bag;k.patterns??(k.patterns=new Set),k.patterns.add(p)}),e._zod.check=m=>{m.value.includes(t.includes,t.position)||m.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:m.value,inst:e,continue:!t.abort})}}),vn=j("$ZodCheckStartsWith",(e,t)=>{ve.init(e,t);const c=new RegExp(`^${Et(t.prefix)}.*`);t.pattern??(t.pattern=c),e._zod.onattach.push(p=>{const m=p._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(c)}),e._zod.check=p=>{p.value.startsWith(t.prefix)||p.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:p.value,inst:e,continue:!t.abort})}}),gn=j("$ZodCheckEndsWith",(e,t)=>{ve.init(e,t);const c=new RegExp(`.*${Et(t.suffix)}$`);t.pattern??(t.pattern=c),e._zod.onattach.push(p=>{const m=p._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(c)}),e._zod.check=p=>{p.value.endsWith(t.suffix)||p.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:p.value,inst:e,continue:!t.abort})}}),mn=j("$ZodCheckOverwrite",(e,t)=>{ve.init(e,t),e._zod.check=c=>{c.value=t.tx(c.value)}}),bn={major:4,minor:1,patch:11},ae=j("$ZodType",(e,t)=>{var c;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bn;const p=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&p.unshift(e);for(const m of p)for(const k of m._zod.onattach)k(e);if(p.length===0)(c=e._zod).deferred??(c.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const m=(w,r,n)=>{let l=ke(w),_;for(const h of r){if(h._zod.def.when){if(!h._zod.def.when(w))continue}else if(l)continue;const f=w.issues.length,v=h._zod.check(w);if(v instanceof Promise&&n?.async===!1)throw new De;if(_||v instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await v,w.issues.length!==f&&(l||(l=ke(w,f)))});else{if(w.issues.length===f)continue;l||(l=ke(w,f))}}return _?_.then(()=>w):w},k=(w,r,n)=>{if(ke(w))return w.aborted=!0,w;const l=m(r,p,n);if(l instanceof Promise){if(n.async===!1)throw new De;return l.then(_=>e._zod.parse(_,n))}return e._zod.parse(l,n)};e._zod.run=(w,r)=>{if(r.skipChecks)return e._zod.parse(w,r);if(r.direction==="backward"){const l=e._zod.parse({value:w.value,issues:[]},{...r,skipChecks:!0});return l instanceof Promise?l.then(_=>k(_,w,r)):k(l,w,r)}const n=e._zod.parse(w,r);if(n instanceof Promise){if(r.async===!1)throw new De;return n.then(l=>m(l,p,r))}return m(n,p,r)}}e["~standard"]={validate:m=>{try{const k=Rs(e,m);return k.success?{value:k.data}:{issues:k.error?.issues}}catch{return Ls(e,m).then(w=>w.success?{value:w.data}:{issues:w.error?.issues})}},vendor:"zod",version:1}}),Rt=j("$ZodString",(e,t)=>{ae.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??on(e._zod.bag),e._zod.parse=(c,p)=>{if(t.coerce)try{c.value=String(c.value)}catch{}return typeof c.value=="string"||c.issues.push({expected:"string",code:"invalid_type",input:c.value,inst:e}),c}}),te=j("$ZodStringFormat",(e,t)=>{nt.init(e,t),Rt.init(e,t)}),Sn=j("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zs),te.init(e,t)}),yn=j("$ZodUUID",(e,t)=>{if(t.version){const p={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(p===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Kt(p))}else t.pattern??(t.pattern=Kt());te.init(e,t)}),wn=j("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qs),te.init(e,t)}),Cn=j("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=c=>{try{const p=c.value.trim(),m=new URL(p);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(m.hostname)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:en.source,input:c.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(m.protocol.endsWith(":")?m.protocol.slice(0,-1):m.protocol)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:c.value,inst:e,continue:!t.abort})),t.normalize?c.value=m.href:c.value=p;return}catch{c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:e,continue:!t.abort})}}}),En=j("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Vs()),te.init(e,t)}),xn=j("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Us),te.init(e,t)}),kn=j("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fs),te.init(e,t)}),Dn=j("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=js),te.init(e,t)}),Rn=j("$ZodULID",(e,t)=>{t.pattern??(t.pattern=zs),te.init(e,t)}),Ln=j("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$s),te.init(e,t)}),An=j("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ws),te.init(e,t)}),Pn=j("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nn(t)),te.init(e,t)}),On=j("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rn),te.init(e,t)}),Tn=j("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sn(t)),te.init(e,t)}),Bn=j("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ns),te.init(e,t)}),In=j("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gs),te.init(e,t),e._zod.onattach.push(c=>{const p=c._zod.bag;p.format="ipv4"})}),Mn=j("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Js),te.init(e,t),e._zod.onattach.push(c=>{const p=c._zod.bag;p.format="ipv6"}),e._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:e,continue:!t.abort})}}}),Hn=j("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ys),te.init(e,t)}),Fn=j("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xs),te.init(e,t),e._zod.check=c=>{const p=c.value.split("/");try{if(p.length!==2)throw new Error;const[m,k]=p;if(!k)throw new Error;const w=Number(k);if(`${w}`!==k)throw new Error;if(w<0||w>128)throw new Error;new URL(`http://[${m}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:e,continue:!t.abort})}}});function $r(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const jn=j("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qs),te.init(e,t),e._zod.onattach.push(c=>{c._zod.bag.contentEncoding="base64"}),e._zod.check=c=>{$r(c.value)||c.issues.push({code:"invalid_format",format:"base64",input:c.value,inst:e,continue:!t.abort})}});function zn(e){if(!Fr.test(e))return!1;const t=e.replace(/[-_]/g,p=>p==="-"?"+":"/"),c=t.padEnd(Math.ceil(t.length/4)*4,"=");return $r(c)}const $n=j("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fr),te.init(e,t),e._zod.onattach.push(c=>{c._zod.bag.contentEncoding="base64url"}),e._zod.check=c=>{zn(c.value)||c.issues.push({code:"invalid_format",format:"base64url",input:c.value,inst:e,continue:!t.abort})}}),Wn=j("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tn),te.init(e,t)});function Un(e,t=null){try{const c=e.split(".");if(c.length!==3)return!1;const[p]=c;if(!p)return!1;const m=JSON.parse(atob(p));return!("typ"in m&&m?.typ!=="JWT"||!m.alg||t&&(!("alg"in m)||m.alg!==t))}catch{return!1}}const Nn=j("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=c=>{Un(c.value,t.alg)||c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:e,continue:!t.abort})}});function Vt(e,t,c){e.issues.length&&t.issues.push(...xs(c,e.issues)),t.value[c]=e.value}const Zn=j("$ZodArray",(e,t)=>{ae.init(e,t),e._zod.parse=(c,p)=>{const m=c.value;if(!Array.isArray(m))return c.issues.push({expected:"array",code:"invalid_type",input:m,inst:e}),c;c.value=Array(m.length);const k=[];for(let w=0;w<m.length;w++){const r=m[w],n=t.element._zod.run({value:r,issues:[]},p);n instanceof Promise?k.push(n.then(l=>Vt(l,c,w))):Vt(n,c,w)}return k.length?Promise.all(k).then(()=>c):c}});function Gt(e,t,c,p){for(const k of e)if(k.issues.length===0)return t.value=k.value,t;const m=e.filter(k=>!ke(k));return m.length===1?(t.value=m[0].value,m[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:c,errors:e.map(k=>k.issues.map(w=>Ce(w,p,we())))}),t)}const qn=j("$ZodUnion",(e,t)=>{ae.init(e,t),ee(e._zod,"optin",()=>t.options.some(m=>m._zod.optin==="optional")?"optional":void 0),ee(e._zod,"optout",()=>t.options.some(m=>m._zod.optout==="optional")?"optional":void 0),ee(e._zod,"values",()=>{if(t.options.every(m=>m._zod.values))return new Set(t.options.flatMap(m=>Array.from(m._zod.values)))}),ee(e._zod,"pattern",()=>{if(t.options.every(m=>m._zod.pattern)){const m=t.options.map(k=>k._zod.pattern);return new RegExp(`^(${m.map(k=>Ct(k.source)).join("|")})$`)}});const c=t.options.length===1,p=t.options[0]._zod.run;e._zod.parse=(m,k)=>{if(c)return p(m,k);let w=!1;const r=[];for(const n of t.options){const l=n._zod.run({value:m.value,issues:[]},k);if(l instanceof Promise)r.push(l),w=!0;else{if(l.issues.length===0)return l;r.push(l)}}return w?Promise.all(r).then(n=>Gt(n,m,e,k)):Gt(r,m,e,k)}}),Kn=j("$ZodIntersection",(e,t)=>{ae.init(e,t),e._zod.parse=(c,p)=>{const m=c.value,k=t.left._zod.run({value:m,issues:[]},p),w=t.right._zod.run({value:m,issues:[]},p);return k instanceof Promise||w instanceof Promise?Promise.all([k,w]).then(([n,l])=>Jt(c,n,l)):Jt(c,k,w)}});function mt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(gt(e)&&gt(t)){const c=Object.keys(t),p=Object.keys(e).filter(k=>c.indexOf(k)!==-1),m={...e,...t};for(const k of p){const w=mt(e[k],t[k]);if(!w.valid)return{valid:!1,mergeErrorPath:[k,...w.mergeErrorPath]};m[k]=w.data}return{valid:!0,data:m}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const c=[];for(let p=0;p<e.length;p++){const m=e[p],k=t[p],w=mt(m,k);if(!w.valid)return{valid:!1,mergeErrorPath:[p,...w.mergeErrorPath]};c.push(w.data)}return{valid:!0,data:c}}return{valid:!1,mergeErrorPath:[]}}function Jt(e,t,c){if(t.issues.length&&e.issues.push(...t.issues),c.issues.length&&e.issues.push(...c.issues),ke(e))return e;const p=mt(t.value,c.value);if(!p.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(p.mergeErrorPath)}`);return e.value=p.data,e}const Vn=j("$ZodTransform",(e,t)=>{ae.init(e,t),e._zod.parse=(c,p)=>{if(p.direction==="backward")throw new Or(e.constructor.name);const m=t.transform(c.value,c);if(p.async)return(m instanceof Promise?m:Promise.resolve(m)).then(w=>(c.value=w,c));if(m instanceof Promise)throw new De;return c.value=m,c}});function Yt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Gn=j("$ZodOptional",(e,t)=>{ae.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(e._zod,"pattern",()=>{const c=t.innerType._zod.pattern;return c?new RegExp(`^(${Ct(c.source)})?$`):void 0}),e._zod.parse=(c,p)=>{if(t.innerType._zod.optin==="optional"){const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>Yt(k,c.value)):Yt(m,c.value)}return c.value===void 0?c:t.innerType._zod.run(c,p)}}),Jn=j("$ZodNullable",(e,t)=>{ae.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"pattern",()=>{const c=t.innerType._zod.pattern;return c?new RegExp(`^(${Ct(c.source)}|null)$`):void 0}),ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(c,p)=>c.value===null?c:t.innerType._zod.run(c,p)}),Yn=j("$ZodDefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(c,p)=>{if(p.direction==="backward")return t.innerType._zod.run(c,p);if(c.value===void 0)return c.value=t.defaultValue,c;const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>Xt(k,t)):Xt(m,t)}});function Xt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xn=j("$ZodPrefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(c,p)=>(p.direction==="backward"||c.value===void 0&&(c.value=t.defaultValue),t.innerType._zod.run(c,p))}),Qn=j("$ZodNonOptional",(e,t)=>{ae.init(e,t),ee(e._zod,"values",()=>{const c=t.innerType._zod.values;return c?new Set([...c].filter(p=>p!==void 0)):void 0}),e._zod.parse=(c,p)=>{const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>Qt(k,e)):Qt(m,e)}});function Qt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const eo=j("$ZodCatch",(e,t)=>{ae.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(c,p)=>{if(p.direction==="backward")return t.innerType._zod.run(c,p);const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>(c.value=k.value,k.issues.length&&(c.value=t.catchValue({...c,error:{issues:k.issues.map(w=>Ce(w,p,we()))},input:c.value}),c.issues=[]),c)):(c.value=m.value,m.issues.length&&(c.value=t.catchValue({...c,error:{issues:m.issues.map(k=>Ce(k,p,we()))},input:c.value}),c.issues=[]),c)}}),to=j("$ZodPipe",(e,t)=>{ae.init(e,t),ee(e._zod,"values",()=>t.in._zod.values),ee(e._zod,"optin",()=>t.in._zod.optin),ee(e._zod,"optout",()=>t.out._zod.optout),ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(c,p)=>{if(p.direction==="backward"){const k=t.out._zod.run(c,p);return k instanceof Promise?k.then(w=>Je(w,t.in,p)):Je(k,t.in,p)}const m=t.in._zod.run(c,p);return m instanceof Promise?m.then(k=>Je(k,t.out,p)):Je(m,t.out,p)}});function Je(e,t,c){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},c)}const ro=j("$ZodReadonly",(e,t)=>{ae.init(e,t),ee(e._zod,"propValues",()=>t.innerType._zod.propValues),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(c,p)=>{if(p.direction==="backward")return t.innerType._zod.run(c,p);const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(er):er(m)}});function er(e){return e.value=Object.freeze(e.value),e}const io=j("$ZodCustom",(e,t)=>{ve.init(e,t),ae.init(e,t),e._zod.parse=(c,p)=>c,e._zod.check=c=>{const p=c.value,m=t.fn(p);if(m instanceof Promise)return m.then(k=>tr(k,c,p,e));tr(m,c,p,e)}});function tr(e,t,c,p){if(!e){const m={code:"custom",input:c,inst:p,path:[...p._zod.def.path??[]],continue:!p._zod.def.abort};p._zod.def.params&&(m.params=p._zod.def.params),t.issues.push(He(m))}}class so{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...c){const p=c[0];if(this._map.set(t,p),p&&typeof p=="object"&&"id"in p){if(this._idmap.has(p.id))throw new Error(`ID ${p.id} already exists in the registry`);this._idmap.set(p.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const c=this._map.get(t);return c&&typeof c=="object"&&"id"in c&&this._idmap.delete(c.id),this._map.delete(t),this}get(t){const c=t._zod.parent;if(c){const p={...this.get(c)??{}};delete p.id;const m={...p,...this._map.get(t)};return Object.keys(m).length?m:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function no(){return new so}const Ye=no();function oo(e,t){return new e({type:"string",...Y(t)})}function ao(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Y(t)})}function rr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Y(t)})}function co(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Y(t)})}function ho(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Y(t)})}function lo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Y(t)})}function uo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Y(t)})}function fo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Y(t)})}function _o(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Y(t)})}function po(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Y(t)})}function vo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Y(t)})}function go(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Y(t)})}function mo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Y(t)})}function bo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Y(t)})}function So(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Y(t)})}function yo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Y(t)})}function wo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Y(t)})}function Co(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Y(t)})}function Eo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Y(t)})}function xo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Y(t)})}function ko(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Y(t)})}function Do(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Y(t)})}function Ro(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Y(t)})}function Lo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Y(t)})}function Ao(e,t){return new e({type:"string",format:"date",check:"string_format",...Y(t)})}function Po(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Y(t)})}function Oo(e,t){return new e({type:"string",format:"duration",check:"string_format",...Y(t)})}function Wr(e,t){return new hn({check:"max_length",...Y(t),maximum:e})}function rt(e,t){return new ln({check:"min_length",...Y(t),minimum:e})}function Ur(e,t){return new un({check:"length_equals",...Y(t),length:e})}function To(e,t){return new dn({check:"string_format",format:"regex",...Y(t),pattern:e})}function Bo(e){return new fn({check:"string_format",format:"lowercase",...Y(e)})}function Io(e){return new _n({check:"string_format",format:"uppercase",...Y(e)})}function Mo(e,t){return new pn({check:"string_format",format:"includes",...Y(t),includes:e})}function Ho(e,t){return new vn({check:"string_format",format:"starts_with",...Y(t),prefix:e})}function Fo(e,t){return new gn({check:"string_format",format:"ends_with",...Y(t),suffix:e})}function $e(e){return new mn({check:"overwrite",tx:e})}function jo(e){return $e(t=>t.normalize(e))}function zo(){return $e(e=>e.trim())}function $o(){return $e(e=>e.toLowerCase())}function Wo(){return $e(e=>e.toUpperCase())}function Uo(e,t,c){return new e({type:"array",element:t,...Y(c)})}function No(e,t,c){return new e({type:"custom",check:"custom",fn:t,...Y(c)})}function Zo(e){const t=qo(c=>(c.addIssue=p=>{if(typeof p=="string")c.issues.push(He(p,c.value,t._zod.def));else{const m=p;m.fatal&&(m.continue=!1),m.code??(m.code="custom"),m.input??(m.input=c.value),m.inst??(m.inst=t),m.continue??(m.continue=!t._zod.def.abort),c.issues.push(He(m))}},e(c.value,c)));return t}function qo(e,t){const c=new ve({check:"custom",...Y(t)});return c._zod.check=e,c}const Ko=j("ZodISODateTime",(e,t)=>{Pn.init(e,t),ie.init(e,t)});function Vo(e){return Lo(Ko,e)}const Go=j("ZodISODate",(e,t)=>{On.init(e,t),ie.init(e,t)});function Jo(e){return Ao(Go,e)}const Yo=j("ZodISOTime",(e,t)=>{Tn.init(e,t),ie.init(e,t)});function Xo(e){return Po(Yo,e)}const Qo=j("ZodISODuration",(e,t)=>{Bn.init(e,t),ie.init(e,t)});function ea(e){return Oo(Qo,e)}const ta=(e,t)=>{Mr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:c=>Ds(e,c)},flatten:{value:c=>ks(e,c)},addIssue:{value:c=>{e.issues.push(c),e.message=JSON.stringify(e.issues,vt,2)}},addIssues:{value:c=>{e.issues.push(...c),e.message=JSON.stringify(e.issues,vt,2)}},isEmpty:{get(){return e.issues.length===0}}})},ue=j("ZodError",ta,{Parent:Error}),ra=kt(ue),ia=Dt(ue),sa=it(ue),na=st(ue),oa=As(ue),aa=Ps(ue),ca=Os(ue),ha=Ts(ue),la=Bs(ue),ua=Is(ue),da=Ms(ue),fa=Hs(ue),he=j("ZodType",(e,t)=>(ae.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...c)=>e.clone(Cs(t,{checks:[...t.checks??[],...c.map(p=>typeof p=="function"?{_zod:{check:p,def:{check:"custom"},onattach:[]}}:p)]})),e.clone=(c,p)=>Es(e,c,p),e.brand=()=>e,e.register=((c,p)=>(c.add(e,p),e)),e.parse=(c,p)=>ra(e,c,p,{callee:e.parse}),e.safeParse=(c,p)=>sa(e,c,p),e.parseAsync=async(c,p)=>ia(e,c,p,{callee:e.parseAsync}),e.safeParseAsync=async(c,p)=>na(e,c,p),e.spa=e.safeParseAsync,e.encode=(c,p)=>oa(e,c,p),e.decode=(c,p)=>aa(e,c,p),e.encodeAsync=async(c,p)=>ca(e,c,p),e.decodeAsync=async(c,p)=>ha(e,c,p),e.safeEncode=(c,p)=>la(e,c,p),e.safeDecode=(c,p)=>ua(e,c,p),e.safeEncodeAsync=async(c,p)=>da(e,c,p),e.safeDecodeAsync=async(c,p)=>fa(e,c,p),e.refine=(c,p)=>e.check(tc(c,p)),e.superRefine=c=>e.check(rc(c)),e.overwrite=c=>e.check($e(c)),e.optional=()=>sr(e),e.nullable=()=>nr(e),e.nullish=()=>sr(nr(e)),e.nonoptional=c=>Va(e,c),e.array=()=>Ba(e),e.or=c=>Ma([e,c]),e.and=c=>Fa(e,c),e.transform=c=>or(e,za(c)),e.default=c=>Na(e,c),e.prefault=c=>qa(e,c),e.catch=c=>Ja(e,c),e.pipe=c=>or(e,c),e.readonly=()=>Qa(e),e.describe=c=>{const p=e.clone();return Ye.add(p,{description:c}),p},Object.defineProperty(e,"description",{get(){return Ye.get(e)?.description},configurable:!0}),e.meta=(...c)=>{if(c.length===0)return Ye.get(e);const p=e.clone();return Ye.add(p,c[0]),p},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Nr=j("_ZodString",(e,t)=>{Rt.init(e,t),he.init(e,t);const c=e._zod.bag;e.format=c.format??null,e.minLength=c.minimum??null,e.maxLength=c.maximum??null,e.regex=(...p)=>e.check(To(...p)),e.includes=(...p)=>e.check(Mo(...p)),e.startsWith=(...p)=>e.check(Ho(...p)),e.endsWith=(...p)=>e.check(Fo(...p)),e.min=(...p)=>e.check(rt(...p)),e.max=(...p)=>e.check(Wr(...p)),e.length=(...p)=>e.check(Ur(...p)),e.nonempty=(...p)=>e.check(rt(1,...p)),e.lowercase=p=>e.check(Bo(p)),e.uppercase=p=>e.check(Io(p)),e.trim=()=>e.check(zo()),e.normalize=(...p)=>e.check(jo(...p)),e.toLowerCase=()=>e.check($o()),e.toUpperCase=()=>e.check(Wo())}),_a=j("ZodString",(e,t)=>{Rt.init(e,t),Nr.init(e,t),e.email=c=>e.check(ao(va,c)),e.url=c=>e.check(fo(ga,c)),e.jwt=c=>e.check(Ro(Oa,c)),e.emoji=c=>e.check(_o(ma,c)),e.guid=c=>e.check(rr(ir,c)),e.uuid=c=>e.check(co(Xe,c)),e.uuidv4=c=>e.check(ho(Xe,c)),e.uuidv6=c=>e.check(lo(Xe,c)),e.uuidv7=c=>e.check(uo(Xe,c)),e.nanoid=c=>e.check(po(ba,c)),e.guid=c=>e.check(rr(ir,c)),e.cuid=c=>e.check(vo(Sa,c)),e.cuid2=c=>e.check(go(ya,c)),e.ulid=c=>e.check(mo(wa,c)),e.base64=c=>e.check(xo(La,c)),e.base64url=c=>e.check(ko(Aa,c)),e.xid=c=>e.check(bo(Ca,c)),e.ksuid=c=>e.check(So(Ea,c)),e.ipv4=c=>e.check(yo(xa,c)),e.ipv6=c=>e.check(wo(ka,c)),e.cidrv4=c=>e.check(Co(Da,c)),e.cidrv6=c=>e.check(Eo(Ra,c)),e.e164=c=>e.check(Do(Pa,c)),e.datetime=c=>e.check(Vo(c)),e.date=c=>e.check(Jo(c)),e.time=c=>e.check(Xo(c)),e.duration=c=>e.check(ea(c))});function pa(e){return oo(_a,e)}const ie=j("ZodStringFormat",(e,t)=>{te.init(e,t),Nr.init(e,t)}),va=j("ZodEmail",(e,t)=>{wn.init(e,t),ie.init(e,t)}),ir=j("ZodGUID",(e,t)=>{Sn.init(e,t),ie.init(e,t)}),Xe=j("ZodUUID",(e,t)=>{yn.init(e,t),ie.init(e,t)}),ga=j("ZodURL",(e,t)=>{Cn.init(e,t),ie.init(e,t)}),ma=j("ZodEmoji",(e,t)=>{En.init(e,t),ie.init(e,t)}),ba=j("ZodNanoID",(e,t)=>{xn.init(e,t),ie.init(e,t)}),Sa=j("ZodCUID",(e,t)=>{kn.init(e,t),ie.init(e,t)}),ya=j("ZodCUID2",(e,t)=>{Dn.init(e,t),ie.init(e,t)}),wa=j("ZodULID",(e,t)=>{Rn.init(e,t),ie.init(e,t)}),Ca=j("ZodXID",(e,t)=>{Ln.init(e,t),ie.init(e,t)}),Ea=j("ZodKSUID",(e,t)=>{An.init(e,t),ie.init(e,t)}),xa=j("ZodIPv4",(e,t)=>{In.init(e,t),ie.init(e,t)}),ka=j("ZodIPv6",(e,t)=>{Mn.init(e,t),ie.init(e,t)}),Da=j("ZodCIDRv4",(e,t)=>{Hn.init(e,t),ie.init(e,t)}),Ra=j("ZodCIDRv6",(e,t)=>{Fn.init(e,t),ie.init(e,t)}),La=j("ZodBase64",(e,t)=>{jn.init(e,t),ie.init(e,t)}),Aa=j("ZodBase64URL",(e,t)=>{$n.init(e,t),ie.init(e,t)}),Pa=j("ZodE164",(e,t)=>{Wn.init(e,t),ie.init(e,t)}),Oa=j("ZodJWT",(e,t)=>{Nn.init(e,t),ie.init(e,t)}),Ta=j("ZodArray",(e,t)=>{Zn.init(e,t),he.init(e,t),e.element=t.element,e.min=(c,p)=>e.check(rt(c,p)),e.nonempty=c=>e.check(rt(1,c)),e.max=(c,p)=>e.check(Wr(c,p)),e.length=(c,p)=>e.check(Ur(c,p)),e.unwrap=()=>e.element});function Ba(e,t){return Uo(Ta,e,t)}const Ia=j("ZodUnion",(e,t)=>{qn.init(e,t),he.init(e,t),e.options=t.options});function Ma(e,t){return new Ia({type:"union",options:e,...Y(t)})}const Ha=j("ZodIntersection",(e,t)=>{Kn.init(e,t),he.init(e,t)});function Fa(e,t){return new Ha({type:"intersection",left:e,right:t})}const ja=j("ZodTransform",(e,t)=>{Vn.init(e,t),he.init(e,t),e._zod.parse=(c,p)=>{if(p.direction==="backward")throw new Or(e.constructor.name);c.addIssue=k=>{if(typeof k=="string")c.issues.push(He(k,c.value,t));else{const w=k;w.fatal&&(w.continue=!1),w.code??(w.code="custom"),w.input??(w.input=c.value),w.inst??(w.inst=e),c.issues.push(He(w))}};const m=t.transform(c.value,c);return m instanceof Promise?m.then(k=>(c.value=k,c)):(c.value=m,c)}});function za(e){return new ja({type:"transform",transform:e})}const $a=j("ZodOptional",(e,t)=>{Gn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sr(e){return new $a({type:"optional",innerType:e})}const Wa=j("ZodNullable",(e,t)=>{Jn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nr(e){return new Wa({type:"nullable",innerType:e})}const Ua=j("ZodDefault",(e,t)=>{Yn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Na(e,t){return new Ua({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Br(t)}})}const Za=j("ZodPrefault",(e,t)=>{Xn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function qa(e,t){return new Za({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Br(t)}})}const Ka=j("ZodNonOptional",(e,t)=>{Qn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Va(e,t){return new Ka({type:"nonoptional",innerType:e,...Y(t)})}const Ga=j("ZodCatch",(e,t)=>{eo.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ja(e,t){return new Ga({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ya=j("ZodPipe",(e,t)=>{to.init(e,t),he.init(e,t),e.in=t.in,e.out=t.out});function or(e,t){return new Ya({type:"pipe",in:e,out:t})}const Xa=j("ZodReadonly",(e,t)=>{ro.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Qa(e){return new Xa({type:"readonly",innerType:e})}const ec=j("ZodCustom",(e,t)=>{io.init(e,t),he.init(e,t)});function tc(e,t={}){return No(ec,e,t)}function rc(e){return Zo(e)}function ic(e){const t=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(e);if(!t)return;if(!t[1]||!t[2]||!t[3]||!t[4])throw new Error(`Mouse event: Invalid match for data ${e}`);const c=parseInt(t[1],10),p=parseInt(t[2],10),m=parseInt(t[3],10),k=t[4]==="m";return console.log(`Mouse event: buttonCode=${c}, column=${p}, row=${m}, isRelease=${k}`),e}function Zr(e,t){const c=new ys.Terminal({allowProposedApi:!0,cursorBlink:!1,convertEol:!0,fontSize:13}),p=Ar.macchiato.colors;c.options.theme={background:p.base.hex,black:p.crust.hex,brightBlack:p.surface2.hex,blue:p.blue.hex,brightBlue:p.blue.hex,brightCyan:p.sky.hex,brightRed:p.maroon.hex,brightYellow:p.yellow.hex,cursor:p.text.hex,cyan:p.sky.hex,foreground:p.text.hex,green:p.green.hex,magenta:p.lavender.hex,red:p.red.hex,white:p.text.hex,yellow:p.yellow.hex};const m=new vs.FitAddon;c.loadAddon(m);const k=new bs.Unicode11Addon;return c.loadAddon(k),c.unicode.activeVersion="11",c.open(e),m.fit(),window.addEventListener("resize",()=>{m.fit()}),c.onData(w=>{if(typeof w!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(w)}'`);const r=ic(w);r&&t.onMouseEvent(r)}),c.onKey(w=>{t.onKeyPress(w)}),c}function qr(){let e=pa().safeParse(sessionStorage.getItem("tabId")).data;return e||(e=Math.random().toString(36),sessionStorage.setItem("tabId",e)),{tabId:e}}class sc{ready;tabId;terminal;trpc;constructor(t){const c=Dr({links:[dr({condition:k=>k.type==="subscription",true:Rr({url:"/trpc"}),false:kr({url:"/trpc"})})]});this.trpc=c,this.tabId=qr();const p=this.tabId,m=Zr(t,{onMouseEvent(k){c.neovim.sendStdin.mutate({tabId:p,data:k}).catch(w=>{console.error("Error sending mouse event",w)})},onKeyPress(k){c.neovim.sendStdin.mutate({tabId:p,data:k.key})}});this.terminal=m,this.ready=new Promise(k=>{console.log("Subscribing to stdout"),c.neovim.initializeStdout.subscribe({client:p},{onStarted(){k()},onData(w){m.write(w)},onError(w){console.error("Error from the application",w)}})})}async startNeovim(t){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:t.filename,additionalEnvironmentVariables:t.additionalEnvironmentVariables,startupScriptModifications:t.startupScriptModifications,NVIM_APPNAME:t.NVIM_APPNAME},terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows},tabId:this.tabId})}async runBlockingShellCommand(t){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}async runLuaCode(t){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...t,tabId:this.tabId})}async doFile(t){return await this.ready,this.trpc.neovim.runExCommand.mutate({...t,tabId:this.tabId,command:`lua dofile("${t.luaFile}")`})}async waitForLuaCode(t){await this.ready;try{return await this.trpc.neovim.waitForLuaCode.mutate({...t,tabId:this.tabId})}catch(c){throw c}}async runExCommand(t){return await this.ready,this.trpc.neovim.runExCommand.mutate({...t,tabId:this.tabId})}}function nc(e,t){e.parser.registerCsiHandler({final:"c"},()=>(t.onKeyPress({key:"\x1B[?1;2c",domEvent:new KeyboardEvent("keydown",{key:"Escape"})}),!0))}class oc{ready;tabId;terminal;trpc;terminalApi;constructor(t){const c=Dr({links:[dr({condition:k=>k.type==="subscription",true:Rr({url:"/trpc"}),false:kr({url:"/trpc"})})]});this.trpc=c,this.tabId=qr();const p=this.tabId;this.terminalApi={onMouseEvent(k){c.terminal.sendStdin.mutate({tabId:p,data:k}).catch(w=>{console.error("Error sending mouse event",w)})},onKeyPress(k){c.terminal.sendStdin.mutate({tabId:p,data:k.key})}};const m=Zr(t,this.terminalApi);this.terminal=m,this.ready=new Promise(k=>{console.log("Subscribing to stdout"),c.terminal.onStdout.subscribe({client:p},{onStarted(){k()},onData(w){m.write(w)},onError(w){console.error("Error from the application",w)}})})}async startTerminalApplication(t){return await this.ready,t.browserSettings.configureTerminal?.({terminal:this.terminal,api:this.terminalApi,recipes:{supportDA1:()=>{nc(this.terminal,this.terminalApi)}}}),await this.trpc.terminal.start.mutate({tabId:this.tabId,startTerminalArguments:{additionalEnvironmentVariables:t.serverSettings.additionalEnvironmentVariables,commandToRun:t.serverSettings.commandToRun,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}}})}async runBlockingShellCommand(t){return await this.ready,this.trpc.terminal.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}}class Kr{constructor(t){this.factory=t}value;get(){return this.value===void 0&&(this.value=this.factory()),this.value}set(t){this.value=t}}const Lt=document.querySelector("#app");if(!Lt)throw new Error("No app element found");const ac=new Kr(()=>new sc(Lt)),cc=new Kr(()=>new oc(Lt));window.startNeovim=async function(e){const t=ac.get(),c=await t.startNeovim({additionalEnvironmentVariables:e?.additionalEnvironmentVariables,filename:e?.filename??"initial-file.txt",startupScriptModifications:e?.startupScriptModifications??[],headlessCmd:void 0,NVIM_APPNAME:e?.NVIM_APPNAME});return{runBlockingShellCommand(m){return t.runBlockingShellCommand(m)},runLuaCode(m){return t.runLuaCode(m)},doFile(m){return t.doFile(m)},waitForLuaCode(m){return t.waitForLuaCode(m)},runExCommand(m){return t.runExCommand(m)},dir:c}};window.startTerminalApplication=async function(e){const t=cc.get();return{dir:await t.startTerminalApplication(e),runBlockingShellCommand(m){return t.runBlockingShellCommand(m)}}};
9
+ `,i)}paste(a){this._core.paste(a)}refresh(a,i){this._verifyIntegers(a,i),this._core.refresh(a,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(a){this._addonManager.loadAddon(this,a)}static get strings(){return r}_verifyIntegers(...a){for(const i of a)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...a){for(const i of a)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}w.Terminal=u})(),k})()))})(_t)),_t.exports}var ys=Ss();function j(e,t,c){function p(r,n){var l;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(l=r._zod).traits??(l.traits=new Set),r._zod.traits.add(e),t(r,n);for(const _ in w.prototype)_ in r||Object.defineProperty(r,_,{value:w.prototype[_].bind(r)});r._zod.constr=w,r._zod.def=n}const m=c?.Parent??Object;class k extends m{}Object.defineProperty(k,"name",{value:e});function w(r){var n;const l=c?.Parent?new k:this;p(l,r),(n=l._zod).deferred??(n.deferred=[]);for(const _ of l._zod.deferred)_();return l}return Object.defineProperty(w,"init",{value:p}),Object.defineProperty(w,Symbol.hasInstance,{value:r=>c?.Parent&&r instanceof c.Parent?!0:r?._zod?.traits?.has(e)}),Object.defineProperty(w,"name",{value:e}),w}class De extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Or extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ws={};function we(e){return ws}function vt(e,t){return typeof t=="bigint"?t.toString():t}function wt(e){return e==null}function Ct(e){const t=e.startsWith("^")?1:0,c=e.endsWith("$")?e.length-1:e.length;return e.slice(t,c)}const Zt=Symbol("evaluating");function ee(e,t,c){let p;Object.defineProperty(e,t,{get(){if(p!==Zt)return p===void 0&&(p=Zt,p=c()),p},set(m){Object.defineProperty(e,t,{value:m})},configurable:!0})}function Cs(...e){const t={};for(const c of e){const p=Object.getOwnPropertyDescriptors(c);Object.assign(t,p)}return Object.defineProperties({},t)}const Tr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function qt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gt(e){if(qt(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const c=t.prototype;return!(qt(c)===!1||Object.prototype.hasOwnProperty.call(c,"isPrototypeOf")===!1)}function Br(e){return gt(e)?{...e}:Array.isArray(e)?[...e]:e}function Et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Es(e,t,c){const p=new e._zod.constr(t??e._zod.def);return(!t||c?.parent)&&(p._zod.parent=e),p}function Y(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ke(e,t=0){if(e.aborted===!0)return!0;for(let c=t;c<e.issues.length;c++)if(e.issues[c]?.continue!==!0)return!0;return!1}function xs(e,t){return t.map(c=>{var p;return(p=c).path??(p.path=[]),c.path.unshift(e),c})}function Ge(e){return typeof e=="string"?e:e?.message}function Ce(e,t,c){const p={...e,path:e.path??[]};if(!e.message){const m=Ge(e.inst?._zod.def?.error?.(e))??Ge(t?.error?.(e))??Ge(c.customError?.(e))??Ge(c.localeError?.(e))??"Invalid input";p.message=m}return delete p.inst,delete p.continue,t?.reportInput||delete p.input,p}function xt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function He(...e){const[t,c,p]=e;return typeof t=="string"?{message:t,code:"custom",input:c,inst:p}:{...t}}const Ir=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Mr=j("$ZodError",Ir),Hr=j("$ZodError",Ir,{Parent:Error});function ks(e,t=c=>c.message){const c={},p=[];for(const m of e.issues)m.path.length>0?(c[m.path[0]]=c[m.path[0]]||[],c[m.path[0]].push(t(m))):p.push(t(m));return{formErrors:p,fieldErrors:c}}function Ds(e,t=c=>c.message){const c={_errors:[]},p=m=>{for(const k of m.issues)if(k.code==="invalid_union"&&k.errors.length)k.errors.map(w=>p({issues:w}));else if(k.code==="invalid_key")p({issues:k.issues});else if(k.code==="invalid_element")p({issues:k.issues});else if(k.path.length===0)c._errors.push(t(k));else{let w=c,r=0;for(;r<k.path.length;){const n=k.path[r];r===k.path.length-1?(w[n]=w[n]||{_errors:[]},w[n]._errors.push(t(k))):w[n]=w[n]||{_errors:[]},w=w[n],r++}}};return p(e),c}const kt=e=>(t,c,p,m)=>{const k=p?Object.assign(p,{async:!1}):{async:!1},w=t._zod.run({value:c,issues:[]},k);if(w instanceof Promise)throw new De;if(w.issues.length){const r=new(m?.Err??e)(w.issues.map(n=>Ce(n,k,we())));throw Tr(r,m?.callee),r}return w.value},Dt=e=>async(t,c,p,m)=>{const k=p?Object.assign(p,{async:!0}):{async:!0};let w=t._zod.run({value:c,issues:[]},k);if(w instanceof Promise&&(w=await w),w.issues.length){const r=new(m?.Err??e)(w.issues.map(n=>Ce(n,k,we())));throw Tr(r,m?.callee),r}return w.value},it=e=>(t,c,p)=>{const m=p?{...p,async:!1}:{async:!1},k=t._zod.run({value:c,issues:[]},m);if(k instanceof Promise)throw new De;return k.issues.length?{success:!1,error:new(e??Mr)(k.issues.map(w=>Ce(w,m,we())))}:{success:!0,data:k.value}},Rs=it(Hr),st=e=>async(t,c,p)=>{const m=p?Object.assign(p,{async:!0}):{async:!0};let k=t._zod.run({value:c,issues:[]},m);return k instanceof Promise&&(k=await k),k.issues.length?{success:!1,error:new e(k.issues.map(w=>Ce(w,m,we())))}:{success:!0,data:k.value}},Ls=st(Hr),As=e=>(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return kt(e)(t,c,m)},Ps=e=>(t,c,p)=>kt(e)(t,c,p),Os=e=>async(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return Dt(e)(t,c,m)},Ts=e=>async(t,c,p)=>Dt(e)(t,c,p),Bs=e=>(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return it(e)(t,c,m)},Is=e=>(t,c,p)=>it(e)(t,c,p),Ms=e=>async(t,c,p)=>{const m=p?Object.assign(p,{direction:"backward"}):{direction:"backward"};return st(e)(t,c,m)},Hs=e=>async(t,c,p)=>st(e)(t,c,p),Fs=/^[cC][^\s-]{8,}$/,js=/^[0-9a-z]+$/,zs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$s=/^[0-9a-vA-V]{20}$/,Ws=/^[A-Za-z0-9]{27}$/,Us=/^[a-zA-Z0-9_-]{21}$/,Ns=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zs=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Kt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,qs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ks="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Vs(){return new RegExp(Ks,"u")}const Gs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Js=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Ys=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Xs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fr=/^[A-Za-z0-9_-]*$/,en=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,tn=/^\+(?:[0-9]){6,14}[0-9]$/,jr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",rn=new RegExp(`^${jr}$`);function zr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sn(e){return new RegExp(`^${zr(e)}$`)}function nn(e){const t=zr({precision:e.precision}),c=["Z"];e.local&&c.push(""),e.offset&&c.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const p=`${t}(?:${c.join("|")})`;return new RegExp(`^${jr}T(?:${p})$`)}const on=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},an=/^[^A-Z]*$/,cn=/^[^a-z]*$/,ve=j("$ZodCheck",(e,t)=>{var c;e._zod??(e._zod={}),e._zod.def=t,(c=e._zod).onattach??(c.onattach=[])}),hn=j("$ZodCheckMaxLength",(e,t)=>{var c;ve.init(e,t),(c=e._zod.def).when??(c.when=p=>{const m=p.value;return!wt(m)&&m.length!==void 0}),e._zod.onattach.push(p=>{const m=p._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<m&&(p._zod.bag.maximum=t.maximum)}),e._zod.check=p=>{const m=p.value;if(m.length<=t.maximum)return;const w=xt(m);p.issues.push({origin:w,code:"too_big",maximum:t.maximum,inclusive:!0,input:m,inst:e,continue:!t.abort})}}),ln=j("$ZodCheckMinLength",(e,t)=>{var c;ve.init(e,t),(c=e._zod.def).when??(c.when=p=>{const m=p.value;return!wt(m)&&m.length!==void 0}),e._zod.onattach.push(p=>{const m=p._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>m&&(p._zod.bag.minimum=t.minimum)}),e._zod.check=p=>{const m=p.value;if(m.length>=t.minimum)return;const w=xt(m);p.issues.push({origin:w,code:"too_small",minimum:t.minimum,inclusive:!0,input:m,inst:e,continue:!t.abort})}}),un=j("$ZodCheckLengthEquals",(e,t)=>{var c;ve.init(e,t),(c=e._zod.def).when??(c.when=p=>{const m=p.value;return!wt(m)&&m.length!==void 0}),e._zod.onattach.push(p=>{const m=p._zod.bag;m.minimum=t.length,m.maximum=t.length,m.length=t.length}),e._zod.check=p=>{const m=p.value,k=m.length;if(k===t.length)return;const w=xt(m),r=k>t.length;p.issues.push({origin:w,...r?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:p.value,inst:e,continue:!t.abort})}}),nt=j("$ZodCheckStringFormat",(e,t)=>{var c,p;ve.init(e,t),e._zod.onattach.push(m=>{const k=m._zod.bag;k.format=t.format,t.pattern&&(k.patterns??(k.patterns=new Set),k.patterns.add(t.pattern))}),t.pattern?(c=e._zod).check??(c.check=m=>{t.pattern.lastIndex=0,!t.pattern.test(m.value)&&m.issues.push({origin:"string",code:"invalid_format",format:t.format,input:m.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(p=e._zod).check??(p.check=()=>{})}),dn=j("$ZodCheckRegex",(e,t)=>{nt.init(e,t),e._zod.check=c=>{t.pattern.lastIndex=0,!t.pattern.test(c.value)&&c.issues.push({origin:"string",code:"invalid_format",format:"regex",input:c.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fn=j("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=an),nt.init(e,t)}),_n=j("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=cn),nt.init(e,t)}),pn=j("$ZodCheckIncludes",(e,t)=>{ve.init(e,t);const c=Et(t.includes),p=new RegExp(typeof t.position=="number"?`^.{${t.position}}${c}`:c);t.pattern=p,e._zod.onattach.push(m=>{const k=m._zod.bag;k.patterns??(k.patterns=new Set),k.patterns.add(p)}),e._zod.check=m=>{m.value.includes(t.includes,t.position)||m.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:m.value,inst:e,continue:!t.abort})}}),vn=j("$ZodCheckStartsWith",(e,t)=>{ve.init(e,t);const c=new RegExp(`^${Et(t.prefix)}.*`);t.pattern??(t.pattern=c),e._zod.onattach.push(p=>{const m=p._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(c)}),e._zod.check=p=>{p.value.startsWith(t.prefix)||p.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:p.value,inst:e,continue:!t.abort})}}),gn=j("$ZodCheckEndsWith",(e,t)=>{ve.init(e,t);const c=new RegExp(`.*${Et(t.suffix)}$`);t.pattern??(t.pattern=c),e._zod.onattach.push(p=>{const m=p._zod.bag;m.patterns??(m.patterns=new Set),m.patterns.add(c)}),e._zod.check=p=>{p.value.endsWith(t.suffix)||p.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:p.value,inst:e,continue:!t.abort})}}),mn=j("$ZodCheckOverwrite",(e,t)=>{ve.init(e,t),e._zod.check=c=>{c.value=t.tx(c.value)}}),bn={major:4,minor:1,patch:12},ae=j("$ZodType",(e,t)=>{var c;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bn;const p=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&p.unshift(e);for(const m of p)for(const k of m._zod.onattach)k(e);if(p.length===0)(c=e._zod).deferred??(c.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const m=(w,r,n)=>{let l=ke(w),_;for(const h of r){if(h._zod.def.when){if(!h._zod.def.when(w))continue}else if(l)continue;const f=w.issues.length,v=h._zod.check(w);if(v instanceof Promise&&n?.async===!1)throw new De;if(_||v instanceof Promise)_=(_??Promise.resolve()).then(async()=>{await v,w.issues.length!==f&&(l||(l=ke(w,f)))});else{if(w.issues.length===f)continue;l||(l=ke(w,f))}}return _?_.then(()=>w):w},k=(w,r,n)=>{if(ke(w))return w.aborted=!0,w;const l=m(r,p,n);if(l instanceof Promise){if(n.async===!1)throw new De;return l.then(_=>e._zod.parse(_,n))}return e._zod.parse(l,n)};e._zod.run=(w,r)=>{if(r.skipChecks)return e._zod.parse(w,r);if(r.direction==="backward"){const l=e._zod.parse({value:w.value,issues:[]},{...r,skipChecks:!0});return l instanceof Promise?l.then(_=>k(_,w,r)):k(l,w,r)}const n=e._zod.parse(w,r);if(n instanceof Promise){if(r.async===!1)throw new De;return n.then(l=>m(l,p,r))}return m(n,p,r)}}e["~standard"]={validate:m=>{try{const k=Rs(e,m);return k.success?{value:k.data}:{issues:k.error?.issues}}catch{return Ls(e,m).then(w=>w.success?{value:w.data}:{issues:w.error?.issues})}},vendor:"zod",version:1}}),Rt=j("$ZodString",(e,t)=>{ae.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??on(e._zod.bag),e._zod.parse=(c,p)=>{if(t.coerce)try{c.value=String(c.value)}catch{}return typeof c.value=="string"||c.issues.push({expected:"string",code:"invalid_type",input:c.value,inst:e}),c}}),te=j("$ZodStringFormat",(e,t)=>{nt.init(e,t),Rt.init(e,t)}),Sn=j("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Zs),te.init(e,t)}),yn=j("$ZodUUID",(e,t)=>{if(t.version){const p={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(p===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Kt(p))}else t.pattern??(t.pattern=Kt());te.init(e,t)}),wn=j("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qs),te.init(e,t)}),Cn=j("$ZodURL",(e,t)=>{te.init(e,t),e._zod.check=c=>{try{const p=c.value.trim(),m=new URL(p);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(m.hostname)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:en.source,input:c.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(m.protocol.endsWith(":")?m.protocol.slice(0,-1):m.protocol)||c.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:c.value,inst:e,continue:!t.abort})),t.normalize?c.value=m.href:c.value=p;return}catch{c.issues.push({code:"invalid_format",format:"url",input:c.value,inst:e,continue:!t.abort})}}}),En=j("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Vs()),te.init(e,t)}),xn=j("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Us),te.init(e,t)}),kn=j("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fs),te.init(e,t)}),Dn=j("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=js),te.init(e,t)}),Rn=j("$ZodULID",(e,t)=>{t.pattern??(t.pattern=zs),te.init(e,t)}),Ln=j("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$s),te.init(e,t)}),An=j("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ws),te.init(e,t)}),Pn=j("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=nn(t)),te.init(e,t)}),On=j("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rn),te.init(e,t)}),Tn=j("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sn(t)),te.init(e,t)}),Bn=j("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ns),te.init(e,t)}),In=j("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gs),te.init(e,t),e._zod.onattach.push(c=>{const p=c._zod.bag;p.format="ipv4"})}),Mn=j("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Js),te.init(e,t),e._zod.onattach.push(c=>{const p=c._zod.bag;p.format="ipv6"}),e._zod.check=c=>{try{new URL(`http://[${c.value}]`)}catch{c.issues.push({code:"invalid_format",format:"ipv6",input:c.value,inst:e,continue:!t.abort})}}}),Hn=j("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ys),te.init(e,t)}),Fn=j("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xs),te.init(e,t),e._zod.check=c=>{const p=c.value.split("/");try{if(p.length!==2)throw new Error;const[m,k]=p;if(!k)throw new Error;const w=Number(k);if(`${w}`!==k)throw new Error;if(w<0||w>128)throw new Error;new URL(`http://[${m}]`)}catch{c.issues.push({code:"invalid_format",format:"cidrv6",input:c.value,inst:e,continue:!t.abort})}}});function $r(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const jn=j("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qs),te.init(e,t),e._zod.onattach.push(c=>{c._zod.bag.contentEncoding="base64"}),e._zod.check=c=>{$r(c.value)||c.issues.push({code:"invalid_format",format:"base64",input:c.value,inst:e,continue:!t.abort})}});function zn(e){if(!Fr.test(e))return!1;const t=e.replace(/[-_]/g,p=>p==="-"?"+":"/"),c=t.padEnd(Math.ceil(t.length/4)*4,"=");return $r(c)}const $n=j("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fr),te.init(e,t),e._zod.onattach.push(c=>{c._zod.bag.contentEncoding="base64url"}),e._zod.check=c=>{zn(c.value)||c.issues.push({code:"invalid_format",format:"base64url",input:c.value,inst:e,continue:!t.abort})}}),Wn=j("$ZodE164",(e,t)=>{t.pattern??(t.pattern=tn),te.init(e,t)});function Un(e,t=null){try{const c=e.split(".");if(c.length!==3)return!1;const[p]=c;if(!p)return!1;const m=JSON.parse(atob(p));return!("typ"in m&&m?.typ!=="JWT"||!m.alg||t&&(!("alg"in m)||m.alg!==t))}catch{return!1}}const Nn=j("$ZodJWT",(e,t)=>{te.init(e,t),e._zod.check=c=>{Un(c.value,t.alg)||c.issues.push({code:"invalid_format",format:"jwt",input:c.value,inst:e,continue:!t.abort})}});function Vt(e,t,c){e.issues.length&&t.issues.push(...xs(c,e.issues)),t.value[c]=e.value}const Zn=j("$ZodArray",(e,t)=>{ae.init(e,t),e._zod.parse=(c,p)=>{const m=c.value;if(!Array.isArray(m))return c.issues.push({expected:"array",code:"invalid_type",input:m,inst:e}),c;c.value=Array(m.length);const k=[];for(let w=0;w<m.length;w++){const r=m[w],n=t.element._zod.run({value:r,issues:[]},p);n instanceof Promise?k.push(n.then(l=>Vt(l,c,w))):Vt(n,c,w)}return k.length?Promise.all(k).then(()=>c):c}});function Gt(e,t,c,p){for(const k of e)if(k.issues.length===0)return t.value=k.value,t;const m=e.filter(k=>!ke(k));return m.length===1?(t.value=m[0].value,m[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:c,errors:e.map(k=>k.issues.map(w=>Ce(w,p,we())))}),t)}const qn=j("$ZodUnion",(e,t)=>{ae.init(e,t),ee(e._zod,"optin",()=>t.options.some(m=>m._zod.optin==="optional")?"optional":void 0),ee(e._zod,"optout",()=>t.options.some(m=>m._zod.optout==="optional")?"optional":void 0),ee(e._zod,"values",()=>{if(t.options.every(m=>m._zod.values))return new Set(t.options.flatMap(m=>Array.from(m._zod.values)))}),ee(e._zod,"pattern",()=>{if(t.options.every(m=>m._zod.pattern)){const m=t.options.map(k=>k._zod.pattern);return new RegExp(`^(${m.map(k=>Ct(k.source)).join("|")})$`)}});const c=t.options.length===1,p=t.options[0]._zod.run;e._zod.parse=(m,k)=>{if(c)return p(m,k);let w=!1;const r=[];for(const n of t.options){const l=n._zod.run({value:m.value,issues:[]},k);if(l instanceof Promise)r.push(l),w=!0;else{if(l.issues.length===0)return l;r.push(l)}}return w?Promise.all(r).then(n=>Gt(n,m,e,k)):Gt(r,m,e,k)}}),Kn=j("$ZodIntersection",(e,t)=>{ae.init(e,t),e._zod.parse=(c,p)=>{const m=c.value,k=t.left._zod.run({value:m,issues:[]},p),w=t.right._zod.run({value:m,issues:[]},p);return k instanceof Promise||w instanceof Promise?Promise.all([k,w]).then(([n,l])=>Jt(c,n,l)):Jt(c,k,w)}});function mt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(gt(e)&&gt(t)){const c=Object.keys(t),p=Object.keys(e).filter(k=>c.indexOf(k)!==-1),m={...e,...t};for(const k of p){const w=mt(e[k],t[k]);if(!w.valid)return{valid:!1,mergeErrorPath:[k,...w.mergeErrorPath]};m[k]=w.data}return{valid:!0,data:m}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const c=[];for(let p=0;p<e.length;p++){const m=e[p],k=t[p],w=mt(m,k);if(!w.valid)return{valid:!1,mergeErrorPath:[p,...w.mergeErrorPath]};c.push(w.data)}return{valid:!0,data:c}}return{valid:!1,mergeErrorPath:[]}}function Jt(e,t,c){if(t.issues.length&&e.issues.push(...t.issues),c.issues.length&&e.issues.push(...c.issues),ke(e))return e;const p=mt(t.value,c.value);if(!p.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(p.mergeErrorPath)}`);return e.value=p.data,e}const Vn=j("$ZodTransform",(e,t)=>{ae.init(e,t),e._zod.parse=(c,p)=>{if(p.direction==="backward")throw new Or(e.constructor.name);const m=t.transform(c.value,c);if(p.async)return(m instanceof Promise?m:Promise.resolve(m)).then(w=>(c.value=w,c));if(m instanceof Promise)throw new De;return c.value=m,c}});function Yt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Gn=j("$ZodOptional",(e,t)=>{ae.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ee(e._zod,"pattern",()=>{const c=t.innerType._zod.pattern;return c?new RegExp(`^(${Ct(c.source)})?$`):void 0}),e._zod.parse=(c,p)=>{if(t.innerType._zod.optin==="optional"){const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>Yt(k,c.value)):Yt(m,c.value)}return c.value===void 0?c:t.innerType._zod.run(c,p)}}),Jn=j("$ZodNullable",(e,t)=>{ae.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"pattern",()=>{const c=t.innerType._zod.pattern;return c?new RegExp(`^(${Ct(c.source)}|null)$`):void 0}),ee(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(c,p)=>c.value===null?c:t.innerType._zod.run(c,p)}),Yn=j("$ZodDefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(c,p)=>{if(p.direction==="backward")return t.innerType._zod.run(c,p);if(c.value===void 0)return c.value=t.defaultValue,c;const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>Xt(k,t)):Xt(m,t)}});function Xt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xn=j("$ZodPrefault",(e,t)=>{ae.init(e,t),e._zod.optin="optional",ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(c,p)=>(p.direction==="backward"||c.value===void 0&&(c.value=t.defaultValue),t.innerType._zod.run(c,p))}),Qn=j("$ZodNonOptional",(e,t)=>{ae.init(e,t),ee(e._zod,"values",()=>{const c=t.innerType._zod.values;return c?new Set([...c].filter(p=>p!==void 0)):void 0}),e._zod.parse=(c,p)=>{const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>Qt(k,e)):Qt(m,e)}});function Qt(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const eo=j("$ZodCatch",(e,t)=>{ae.init(e,t),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),ee(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(c,p)=>{if(p.direction==="backward")return t.innerType._zod.run(c,p);const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(k=>(c.value=k.value,k.issues.length&&(c.value=t.catchValue({...c,error:{issues:k.issues.map(w=>Ce(w,p,we()))},input:c.value}),c.issues=[]),c)):(c.value=m.value,m.issues.length&&(c.value=t.catchValue({...c,error:{issues:m.issues.map(k=>Ce(k,p,we()))},input:c.value}),c.issues=[]),c)}}),to=j("$ZodPipe",(e,t)=>{ae.init(e,t),ee(e._zod,"values",()=>t.in._zod.values),ee(e._zod,"optin",()=>t.in._zod.optin),ee(e._zod,"optout",()=>t.out._zod.optout),ee(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(c,p)=>{if(p.direction==="backward"){const k=t.out._zod.run(c,p);return k instanceof Promise?k.then(w=>Je(w,t.in,p)):Je(k,t.in,p)}const m=t.in._zod.run(c,p);return m instanceof Promise?m.then(k=>Je(k,t.out,p)):Je(m,t.out,p)}});function Je(e,t,c){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},c)}const ro=j("$ZodReadonly",(e,t)=>{ae.init(e,t),ee(e._zod,"propValues",()=>t.innerType._zod.propValues),ee(e._zod,"values",()=>t.innerType._zod.values),ee(e._zod,"optin",()=>t.innerType._zod.optin),ee(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(c,p)=>{if(p.direction==="backward")return t.innerType._zod.run(c,p);const m=t.innerType._zod.run(c,p);return m instanceof Promise?m.then(er):er(m)}});function er(e){return e.value=Object.freeze(e.value),e}const io=j("$ZodCustom",(e,t)=>{ve.init(e,t),ae.init(e,t),e._zod.parse=(c,p)=>c,e._zod.check=c=>{const p=c.value,m=t.fn(p);if(m instanceof Promise)return m.then(k=>tr(k,c,p,e));tr(m,c,p,e)}});function tr(e,t,c,p){if(!e){const m={code:"custom",input:c,inst:p,path:[...p._zod.def.path??[]],continue:!p._zod.def.abort};p._zod.def.params&&(m.params=p._zod.def.params),t.issues.push(He(m))}}class so{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...c){const p=c[0];if(this._map.set(t,p),p&&typeof p=="object"&&"id"in p){if(this._idmap.has(p.id))throw new Error(`ID ${p.id} already exists in the registry`);this._idmap.set(p.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const c=this._map.get(t);return c&&typeof c=="object"&&"id"in c&&this._idmap.delete(c.id),this._map.delete(t),this}get(t){const c=t._zod.parent;if(c){const p={...this.get(c)??{}};delete p.id;const m={...p,...this._map.get(t)};return Object.keys(m).length?m:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function no(){return new so}const Ye=no();function oo(e,t){return new e({type:"string",...Y(t)})}function ao(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Y(t)})}function rr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Y(t)})}function co(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Y(t)})}function ho(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Y(t)})}function lo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Y(t)})}function uo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Y(t)})}function fo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Y(t)})}function _o(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Y(t)})}function po(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Y(t)})}function vo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Y(t)})}function go(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Y(t)})}function mo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Y(t)})}function bo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Y(t)})}function So(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Y(t)})}function yo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Y(t)})}function wo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Y(t)})}function Co(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Y(t)})}function Eo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Y(t)})}function xo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Y(t)})}function ko(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Y(t)})}function Do(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Y(t)})}function Ro(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Y(t)})}function Lo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Y(t)})}function Ao(e,t){return new e({type:"string",format:"date",check:"string_format",...Y(t)})}function Po(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Y(t)})}function Oo(e,t){return new e({type:"string",format:"duration",check:"string_format",...Y(t)})}function Wr(e,t){return new hn({check:"max_length",...Y(t),maximum:e})}function rt(e,t){return new ln({check:"min_length",...Y(t),minimum:e})}function Ur(e,t){return new un({check:"length_equals",...Y(t),length:e})}function To(e,t){return new dn({check:"string_format",format:"regex",...Y(t),pattern:e})}function Bo(e){return new fn({check:"string_format",format:"lowercase",...Y(e)})}function Io(e){return new _n({check:"string_format",format:"uppercase",...Y(e)})}function Mo(e,t){return new pn({check:"string_format",format:"includes",...Y(t),includes:e})}function Ho(e,t){return new vn({check:"string_format",format:"starts_with",...Y(t),prefix:e})}function Fo(e,t){return new gn({check:"string_format",format:"ends_with",...Y(t),suffix:e})}function $e(e){return new mn({check:"overwrite",tx:e})}function jo(e){return $e(t=>t.normalize(e))}function zo(){return $e(e=>e.trim())}function $o(){return $e(e=>e.toLowerCase())}function Wo(){return $e(e=>e.toUpperCase())}function Uo(e,t,c){return new e({type:"array",element:t,...Y(c)})}function No(e,t,c){return new e({type:"custom",check:"custom",fn:t,...Y(c)})}function Zo(e){const t=qo(c=>(c.addIssue=p=>{if(typeof p=="string")c.issues.push(He(p,c.value,t._zod.def));else{const m=p;m.fatal&&(m.continue=!1),m.code??(m.code="custom"),m.input??(m.input=c.value),m.inst??(m.inst=t),m.continue??(m.continue=!t._zod.def.abort),c.issues.push(He(m))}},e(c.value,c)));return t}function qo(e,t){const c=new ve({check:"custom",...Y(t)});return c._zod.check=e,c}const Ko=j("ZodISODateTime",(e,t)=>{Pn.init(e,t),ie.init(e,t)});function Vo(e){return Lo(Ko,e)}const Go=j("ZodISODate",(e,t)=>{On.init(e,t),ie.init(e,t)});function Jo(e){return Ao(Go,e)}const Yo=j("ZodISOTime",(e,t)=>{Tn.init(e,t),ie.init(e,t)});function Xo(e){return Po(Yo,e)}const Qo=j("ZodISODuration",(e,t)=>{Bn.init(e,t),ie.init(e,t)});function ea(e){return Oo(Qo,e)}const ta=(e,t)=>{Mr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:c=>Ds(e,c)},flatten:{value:c=>ks(e,c)},addIssue:{value:c=>{e.issues.push(c),e.message=JSON.stringify(e.issues,vt,2)}},addIssues:{value:c=>{e.issues.push(...c),e.message=JSON.stringify(e.issues,vt,2)}},isEmpty:{get(){return e.issues.length===0}}})},ue=j("ZodError",ta,{Parent:Error}),ra=kt(ue),ia=Dt(ue),sa=it(ue),na=st(ue),oa=As(ue),aa=Ps(ue),ca=Os(ue),ha=Ts(ue),la=Bs(ue),ua=Is(ue),da=Ms(ue),fa=Hs(ue),he=j("ZodType",(e,t)=>(ae.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...c)=>e.clone(Cs(t,{checks:[...t.checks??[],...c.map(p=>typeof p=="function"?{_zod:{check:p,def:{check:"custom"},onattach:[]}}:p)]})),e.clone=(c,p)=>Es(e,c,p),e.brand=()=>e,e.register=((c,p)=>(c.add(e,p),e)),e.parse=(c,p)=>ra(e,c,p,{callee:e.parse}),e.safeParse=(c,p)=>sa(e,c,p),e.parseAsync=async(c,p)=>ia(e,c,p,{callee:e.parseAsync}),e.safeParseAsync=async(c,p)=>na(e,c,p),e.spa=e.safeParseAsync,e.encode=(c,p)=>oa(e,c,p),e.decode=(c,p)=>aa(e,c,p),e.encodeAsync=async(c,p)=>ca(e,c,p),e.decodeAsync=async(c,p)=>ha(e,c,p),e.safeEncode=(c,p)=>la(e,c,p),e.safeDecode=(c,p)=>ua(e,c,p),e.safeEncodeAsync=async(c,p)=>da(e,c,p),e.safeDecodeAsync=async(c,p)=>fa(e,c,p),e.refine=(c,p)=>e.check(tc(c,p)),e.superRefine=c=>e.check(rc(c)),e.overwrite=c=>e.check($e(c)),e.optional=()=>sr(e),e.nullable=()=>nr(e),e.nullish=()=>sr(nr(e)),e.nonoptional=c=>Va(e,c),e.array=()=>Ba(e),e.or=c=>Ma([e,c]),e.and=c=>Fa(e,c),e.transform=c=>or(e,za(c)),e.default=c=>Na(e,c),e.prefault=c=>qa(e,c),e.catch=c=>Ja(e,c),e.pipe=c=>or(e,c),e.readonly=()=>Qa(e),e.describe=c=>{const p=e.clone();return Ye.add(p,{description:c}),p},Object.defineProperty(e,"description",{get(){return Ye.get(e)?.description},configurable:!0}),e.meta=(...c)=>{if(c.length===0)return Ye.get(e);const p=e.clone();return Ye.add(p,c[0]),p},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Nr=j("_ZodString",(e,t)=>{Rt.init(e,t),he.init(e,t);const c=e._zod.bag;e.format=c.format??null,e.minLength=c.minimum??null,e.maxLength=c.maximum??null,e.regex=(...p)=>e.check(To(...p)),e.includes=(...p)=>e.check(Mo(...p)),e.startsWith=(...p)=>e.check(Ho(...p)),e.endsWith=(...p)=>e.check(Fo(...p)),e.min=(...p)=>e.check(rt(...p)),e.max=(...p)=>e.check(Wr(...p)),e.length=(...p)=>e.check(Ur(...p)),e.nonempty=(...p)=>e.check(rt(1,...p)),e.lowercase=p=>e.check(Bo(p)),e.uppercase=p=>e.check(Io(p)),e.trim=()=>e.check(zo()),e.normalize=(...p)=>e.check(jo(...p)),e.toLowerCase=()=>e.check($o()),e.toUpperCase=()=>e.check(Wo())}),_a=j("ZodString",(e,t)=>{Rt.init(e,t),Nr.init(e,t),e.email=c=>e.check(ao(va,c)),e.url=c=>e.check(fo(ga,c)),e.jwt=c=>e.check(Ro(Oa,c)),e.emoji=c=>e.check(_o(ma,c)),e.guid=c=>e.check(rr(ir,c)),e.uuid=c=>e.check(co(Xe,c)),e.uuidv4=c=>e.check(ho(Xe,c)),e.uuidv6=c=>e.check(lo(Xe,c)),e.uuidv7=c=>e.check(uo(Xe,c)),e.nanoid=c=>e.check(po(ba,c)),e.guid=c=>e.check(rr(ir,c)),e.cuid=c=>e.check(vo(Sa,c)),e.cuid2=c=>e.check(go(ya,c)),e.ulid=c=>e.check(mo(wa,c)),e.base64=c=>e.check(xo(La,c)),e.base64url=c=>e.check(ko(Aa,c)),e.xid=c=>e.check(bo(Ca,c)),e.ksuid=c=>e.check(So(Ea,c)),e.ipv4=c=>e.check(yo(xa,c)),e.ipv6=c=>e.check(wo(ka,c)),e.cidrv4=c=>e.check(Co(Da,c)),e.cidrv6=c=>e.check(Eo(Ra,c)),e.e164=c=>e.check(Do(Pa,c)),e.datetime=c=>e.check(Vo(c)),e.date=c=>e.check(Jo(c)),e.time=c=>e.check(Xo(c)),e.duration=c=>e.check(ea(c))});function pa(e){return oo(_a,e)}const ie=j("ZodStringFormat",(e,t)=>{te.init(e,t),Nr.init(e,t)}),va=j("ZodEmail",(e,t)=>{wn.init(e,t),ie.init(e,t)}),ir=j("ZodGUID",(e,t)=>{Sn.init(e,t),ie.init(e,t)}),Xe=j("ZodUUID",(e,t)=>{yn.init(e,t),ie.init(e,t)}),ga=j("ZodURL",(e,t)=>{Cn.init(e,t),ie.init(e,t)}),ma=j("ZodEmoji",(e,t)=>{En.init(e,t),ie.init(e,t)}),ba=j("ZodNanoID",(e,t)=>{xn.init(e,t),ie.init(e,t)}),Sa=j("ZodCUID",(e,t)=>{kn.init(e,t),ie.init(e,t)}),ya=j("ZodCUID2",(e,t)=>{Dn.init(e,t),ie.init(e,t)}),wa=j("ZodULID",(e,t)=>{Rn.init(e,t),ie.init(e,t)}),Ca=j("ZodXID",(e,t)=>{Ln.init(e,t),ie.init(e,t)}),Ea=j("ZodKSUID",(e,t)=>{An.init(e,t),ie.init(e,t)}),xa=j("ZodIPv4",(e,t)=>{In.init(e,t),ie.init(e,t)}),ka=j("ZodIPv6",(e,t)=>{Mn.init(e,t),ie.init(e,t)}),Da=j("ZodCIDRv4",(e,t)=>{Hn.init(e,t),ie.init(e,t)}),Ra=j("ZodCIDRv6",(e,t)=>{Fn.init(e,t),ie.init(e,t)}),La=j("ZodBase64",(e,t)=>{jn.init(e,t),ie.init(e,t)}),Aa=j("ZodBase64URL",(e,t)=>{$n.init(e,t),ie.init(e,t)}),Pa=j("ZodE164",(e,t)=>{Wn.init(e,t),ie.init(e,t)}),Oa=j("ZodJWT",(e,t)=>{Nn.init(e,t),ie.init(e,t)}),Ta=j("ZodArray",(e,t)=>{Zn.init(e,t),he.init(e,t),e.element=t.element,e.min=(c,p)=>e.check(rt(c,p)),e.nonempty=c=>e.check(rt(1,c)),e.max=(c,p)=>e.check(Wr(c,p)),e.length=(c,p)=>e.check(Ur(c,p)),e.unwrap=()=>e.element});function Ba(e,t){return Uo(Ta,e,t)}const Ia=j("ZodUnion",(e,t)=>{qn.init(e,t),he.init(e,t),e.options=t.options});function Ma(e,t){return new Ia({type:"union",options:e,...Y(t)})}const Ha=j("ZodIntersection",(e,t)=>{Kn.init(e,t),he.init(e,t)});function Fa(e,t){return new Ha({type:"intersection",left:e,right:t})}const ja=j("ZodTransform",(e,t)=>{Vn.init(e,t),he.init(e,t),e._zod.parse=(c,p)=>{if(p.direction==="backward")throw new Or(e.constructor.name);c.addIssue=k=>{if(typeof k=="string")c.issues.push(He(k,c.value,t));else{const w=k;w.fatal&&(w.continue=!1),w.code??(w.code="custom"),w.input??(w.input=c.value),w.inst??(w.inst=e),c.issues.push(He(w))}};const m=t.transform(c.value,c);return m instanceof Promise?m.then(k=>(c.value=k,c)):(c.value=m,c)}});function za(e){return new ja({type:"transform",transform:e})}const $a=j("ZodOptional",(e,t)=>{Gn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sr(e){return new $a({type:"optional",innerType:e})}const Wa=j("ZodNullable",(e,t)=>{Jn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nr(e){return new Wa({type:"nullable",innerType:e})}const Ua=j("ZodDefault",(e,t)=>{Yn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Na(e,t){return new Ua({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Br(t)}})}const Za=j("ZodPrefault",(e,t)=>{Xn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function qa(e,t){return new Za({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Br(t)}})}const Ka=j("ZodNonOptional",(e,t)=>{Qn.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Va(e,t){return new Ka({type:"nonoptional",innerType:e,...Y(t)})}const Ga=j("ZodCatch",(e,t)=>{eo.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ja(e,t){return new Ga({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ya=j("ZodPipe",(e,t)=>{to.init(e,t),he.init(e,t),e.in=t.in,e.out=t.out});function or(e,t){return new Ya({type:"pipe",in:e,out:t})}const Xa=j("ZodReadonly",(e,t)=>{ro.init(e,t),he.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Qa(e){return new Xa({type:"readonly",innerType:e})}const ec=j("ZodCustom",(e,t)=>{io.init(e,t),he.init(e,t)});function tc(e,t={}){return No(ec,e,t)}function rc(e){return Zo(e)}function ic(e){const t=/\x1b\[<(\d+);(\d+);(\d+)([mM])/.exec(e);if(!t)return;if(!t[1]||!t[2]||!t[3]||!t[4])throw new Error(`Mouse event: Invalid match for data ${e}`);const c=parseInt(t[1],10),p=parseInt(t[2],10),m=parseInt(t[3],10),k=t[4]==="m";return console.log(`Mouse event: buttonCode=${c}, column=${p}, row=${m}, isRelease=${k}`),e}function Zr(e,t){const c=new ys.Terminal({allowProposedApi:!0,cursorBlink:!1,convertEol:!0,fontSize:13}),p=Ar.macchiato.colors;c.options.theme={background:p.base.hex,black:p.crust.hex,brightBlack:p.surface2.hex,blue:p.blue.hex,brightBlue:p.blue.hex,brightCyan:p.sky.hex,brightRed:p.maroon.hex,brightYellow:p.yellow.hex,cursor:p.text.hex,cyan:p.sky.hex,foreground:p.text.hex,green:p.green.hex,magenta:p.lavender.hex,red:p.red.hex,white:p.text.hex,yellow:p.yellow.hex};const m=new vs.FitAddon;c.loadAddon(m);const k=new bs.Unicode11Addon;return c.loadAddon(k),c.unicode.activeVersion="11",c.open(e),m.fit(),window.addEventListener("resize",()=>{m.fit()}),c.onData(w=>{if(typeof w!="string")throw new Error(`unexpected onData message type: '${JSON.stringify(w)}'`);const r=ic(w);r&&t.onMouseEvent(r)}),c.onKey(w=>{t.onKeyPress(w)}),c}function qr(){let e=pa().safeParse(sessionStorage.getItem("tabId")).data;return e||(e=Math.random().toString(36),sessionStorage.setItem("tabId",e)),{tabId:e}}class sc{ready;tabId;terminal;trpc;constructor(t){const c=Dr({links:[dr({condition:k=>k.type==="subscription",true:Rr({url:"/trpc"}),false:kr({url:"/trpc"})})]});this.trpc=c,this.tabId=qr();const p=this.tabId,m=Zr(t,{onMouseEvent(k){c.neovim.sendStdin.mutate({tabId:p,data:k}).catch(w=>{console.error("Error sending mouse event",w)})},onKeyPress(k){c.neovim.sendStdin.mutate({tabId:p,data:k.key})}});this.terminal=m,this.ready=new Promise(k=>{console.log("Subscribing to stdout"),c.neovim.initializeStdout.subscribe({client:p},{onStarted(){k()},onData(w){m.write(w)},onError(w){console.error("Error from the application",w)}})})}async startNeovim(t){return await this.ready,await this.trpc.neovim.start.mutate({startNeovimArguments:{filename:t.filename,additionalEnvironmentVariables:t.additionalEnvironmentVariables,startupScriptModifications:t.startupScriptModifications,NVIM_APPNAME:t.NVIM_APPNAME},terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows},tabId:this.tabId})}async runBlockingShellCommand(t){return await this.ready,this.trpc.neovim.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}async runLuaCode(t){return await this.ready,this.trpc.neovim.runLuaCode.mutate({...t,tabId:this.tabId})}async doFile(t){return await this.ready,this.trpc.neovim.runExCommand.mutate({...t,tabId:this.tabId,command:`lua dofile("${t.luaFile}")`})}async waitForLuaCode(t){await this.ready;try{return await this.trpc.neovim.waitForLuaCode.mutate({...t,tabId:this.tabId})}catch(c){throw c}}async runExCommand(t){return await this.ready,this.trpc.neovim.runExCommand.mutate({...t,tabId:this.tabId})}}function nc(e,t){e.parser.registerCsiHandler({final:"c"},()=>(t.onKeyPress({key:"\x1B[?1;2c",domEvent:new KeyboardEvent("keydown",{key:"Escape"})}),!0))}class oc{ready;tabId;terminal;trpc;terminalApi;constructor(t){const c=Dr({links:[dr({condition:k=>k.type==="subscription",true:Rr({url:"/trpc"}),false:kr({url:"/trpc"})})]});this.trpc=c,this.tabId=qr();const p=this.tabId;this.terminalApi={onMouseEvent(k){c.terminal.sendStdin.mutate({tabId:p,data:k}).catch(w=>{console.error("Error sending mouse event",w)})},onKeyPress(k){c.terminal.sendStdin.mutate({tabId:p,data:k.key})}};const m=Zr(t,this.terminalApi);this.terminal=m,this.ready=new Promise(k=>{console.log("Subscribing to stdout"),c.terminal.onStdout.subscribe({client:p},{onStarted(){k()},onData(w){m.write(w)},onError(w){console.error("Error from the application",w)}})})}async startTerminalApplication(t){return await this.ready,t.browserSettings.configureTerminal?.({terminal:this.terminal,api:this.terminalApi,recipes:{supportDA1:()=>{nc(this.terminal,this.terminalApi)}}}),await this.trpc.terminal.start.mutate({tabId:this.tabId,startTerminalArguments:{additionalEnvironmentVariables:t.serverSettings.additionalEnvironmentVariables,commandToRun:t.serverSettings.commandToRun,terminalDimensions:{cols:this.terminal.cols,rows:this.terminal.rows}}})}async runBlockingShellCommand(t){return await this.ready,this.trpc.terminal.runBlockingShellCommand.mutate({...t,tabId:this.tabId})}}class Kr{constructor(t){this.factory=t}value;get(){return this.value===void 0&&(this.value=this.factory()),this.value}set(t){this.value=t}}const Lt=document.querySelector("#app");if(!Lt)throw new Error("No app element found");const ac=new Kr(()=>new sc(Lt)),cc=new Kr(()=>new oc(Lt));window.startNeovim=async function(e){const t=ac.get(),c=await t.startNeovim({additionalEnvironmentVariables:e?.additionalEnvironmentVariables,filename:e?.filename??"initial-file.txt",startupScriptModifications:e?.startupScriptModifications??[],headlessCmd:void 0,NVIM_APPNAME:e?.NVIM_APPNAME});return{runBlockingShellCommand(m){return t.runBlockingShellCommand(m)},runLuaCode(m){return t.runLuaCode(m)},doFile(m){return t.doFile(m)},waitForLuaCode(m){return t.waitForLuaCode(m)},runExCommand(m){return t.runExCommand(m)},dir:c}};window.startTerminalApplication=async function(e){const t=cc.get();return{dir:await t.startTerminalApplication(e),runBlockingShellCommand(m){return t.runBlockingShellCommand(m)}}};