yunzai-micro-plugin
Version:
Yunzai开发管理面板
5 lines (4 loc) • 383 kB
JavaScript
import{ae as or,a as Ya,k as ke,q as Tv,l as Mv,B as Za,O as Ov,r as je,o as Xe,c as Ut,b as lt,i as ge,w as me,y as yt,u as Be,H as qa,I as Va,_ as Qa,G as Ga,ab as Iv,af as Pv,ac as Hv,p as _n,v as ja,x as Wi,h as ri,e as si,ag as vn,A as Fv,t as ar,J as Wv,F as Uv,g as Nv,ah as $v,ai as Ei,n as Xa}from"./index-6f2f2fc7.js";import{u as zv,r as Kv,a as qv,b as Vv,c as pn,d as Gv,e as Ja,f as jv,g as Xv,h as Jv,i as Yv,j as Zv,k as Qv,l as ep,m as tp}from"./dev-730c77e3.js";import{E as ip}from"./codeEditor-23ba9fe0.js";import{W as rp}from"./index-4f72cfbc.js";import"./index-499662cc.js";var eh={exports:{}};(function(Nt,Et){(function(k,Ne){Nt.exports=Ne()})(globalThis,()=>(()=>{var k={4567:function(j,a,u){var _=this&&this.__decorate||function(r,n,c,g){var S,C=arguments.length,f=C<3?n:g===null?g=Object.getOwnPropertyDescriptor(n,c):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(r,n,c,g);else for(var y=r.length-1;y>=0;y--)(S=r[y])&&(f=(C<3?S(f):C>3?S(n,c,f):S(n,c))||f);return C>3&&f&&Object.defineProperty(n,c,f),f},p=this&&this.__param||function(r,n){return function(c,g){n(c,g,r)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const l=u(9042),v=u(9924),m=u(844),b=u(4725),d=u(2585),s=u(3656);let o=a.AccessibilityManager=class extends m.Disposable{constructor(r,n,c,g){super(),this._terminal=r,this._coreBrowserService=c,this._renderService=g,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let S=0;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);if(this._topBoundaryFocusListener=S=>this._handleBoundaryFocus(S,0),this._bottomBoundaryFocusListener=S=>this._handleBoundaryFocus(S,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new v.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(S=>this._handleResize(S.rows))),this.register(this._terminal.onRender(S=>this._refreshRows(S.start,S.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(S=>this._handleChar(S))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
`))),this.register(this._terminal.onA11yTab(S=>this._handleTab(S))),this.register(this._terminal.onKey(S=>this._handleKey(S.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,s.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,m.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(r){for(let n=0;n<r;n++)this._handleChar(" ")}_handleChar(r){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==r&&(this._charsToAnnounce+=r):this._charsToAnnounce+=r,r===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=l.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(r){this._clearLiveRegion(),/\p{Control}/u.test(r)||this._charsToConsume.push(r)}_refreshRows(r,n){this._liveRegionDebouncer.refresh(r,n,this._terminal.rows)}_renderRows(r,n){const c=this._terminal.buffer,g=c.lines.length.toString();for(let S=r;S<=n;S++){const C=c.lines.get(c.ydisp+S),f=[],y=(C==null?void 0:C.translateToString(!0,void 0,void 0,f))||"",T=(c.ydisp+S+1).toString(),O=this._rowElements[S];O&&(y.length===0?(O.innerText=" ",this._rowColumns.set(O,[0,1])):(O.textContent=y,this._rowColumns.set(O,f)),O.setAttribute("aria-posinset",T),O.setAttribute("aria-setsize",g))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(r,n){const c=r.target,g=this._rowElements[n===0?1:this._rowElements.length-2];if(c.getAttribute("aria-posinset")===(n===0?"1":`${this._terminal.buffer.lines.length}`)||r.relatedTarget!==g)return;let S,C;if(n===0?(S=c,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(S=this._rowElements.shift(),C=c,this._rowContainer.removeChild(S)),S.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),n===0){const f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{const f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(n===0?-1:1),this._rowElements[n===0?1:this._rowElements.length-2].focus(),r.preventDefault(),r.stopImmediatePropagation()}_handleSelectionChange(){var y;if(this._rowElements.length===0)return;const r=document.getSelection();if(!r)return;if(r.isCollapsed)return void(this._rowContainer.contains(r.anchorNode)&&this._terminal.clearSelection());if(!r.anchorNode||!r.focusNode)return void console.error("anchorNode and/or focusNode are null");let n={node:r.anchorNode,offset:r.anchorOffset},c={node:r.focusNode,offset:r.focusOffset};if((n.node.compareDocumentPosition(c.node)&Node.DOCUMENT_POSITION_PRECEDING||n.node===c.node&&n.offset>c.offset)&&([n,c]=[c,n]),n.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(n={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(n.node))return;const g=this._rowElements.slice(-1)[0];if(c.node.compareDocumentPosition(g)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(c={node:g,offset:((y=g.textContent)==null?void 0:y.length)??0}),!this._rowContainer.contains(c.node))return;const S=({node:T,offset:O})=>{const P=T instanceof Text?T.parentNode:T;let D=parseInt(P==null?void 0:P.getAttribute("aria-posinset"),10)-1;if(isNaN(D))return console.warn("row is invalid. Race condition?"),null;const N=this._rowColumns.get(P);if(!N)return console.warn("columns is null. Race condition?"),null;let X=O<N.length?N[O]:N.slice(-1)[0]+1;return X>=this._terminal.cols&&(++D,X=0),{row:D,column:X}},C=S(n),f=S(c);if(C&&f){if(C.row>f.row||C.row===f.row&&C.column>=f.column)throw new Error("invalid range");this._terminal.select(C.column,C.row,(f.row-C.row)*this._terminal.cols-C.column+f.column)}}_handleResize(r){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let n=this._rowContainer.children.length;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);for(;this._rowElements.length>r;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const r=this._coreBrowserService.mainDocument.createElement("div");return r.setAttribute("role","listitem"),r.tabIndex=-1,this._refreshRowDimensions(r),r}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let r=0;r<this._terminal.rows;r++)this._refreshRowDimensions(this._rowElements[r])}}_refreshRowDimensions(r){r.style.height=`${this._renderService.dimensions.css.cell.height}px`}};a.AccessibilityManager=o=_([p(1,d.IInstantiationService),p(2,b.ICoreBrowserService),p(3,b.IRenderService)],o)},3614:(j,a)=>{function u(v){return v.replace(/\r?\n/g,"\r")}function _(v,m){return m?"\x1B[200~"+v+"\x1B[201~":v}function p(v,m,b,d){v=_(v=u(v),b.decPrivateModes.bracketedPasteMode&&d.rawOptions.ignoreBracketedPasteMode!==!0),b.triggerDataEvent(v,!0),m.value=""}function l(v,m,b){const d=b.getBoundingClientRect(),s=v.clientX-d.left-10,o=v.clientY-d.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${s}px`,m.style.top=`${o}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(a,"__esModule",{value:!0}),a.rightClickHandler=a.moveTextAreaUnderMouseCursor=a.paste=a.handlePasteEvent=a.copyHandler=a.bracketTextForPaste=a.prepareTextForTerminal=void 0,a.prepareTextForTerminal=u,a.bracketTextForPaste=_,a.copyHandler=function(v,m){v.clipboardData&&v.clipboardData.setData("text/plain",m.selectionText),v.preventDefault()},a.handlePasteEvent=function(v,m,b,d){v.stopPropagation(),v.clipboardData&&p(v.clipboardData.getData("text/plain"),m,b,d)},a.paste=p,a.moveTextAreaUnderMouseCursor=l,a.rightClickHandler=function(v,m,b,d,s){l(v,m,b),s&&d.rightClickSelect(v),m.value=d.selectionText,m.select()}},7239:(j,a,u)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorContrastCache=void 0;const _=u(1505);a.ColorContrastCache=class{constructor(){this._color=new _.TwoKeyMap,this._css=new _.TwoKeyMap}setCss(p,l,v){this._css.set(p,l,v)}getCss(p,l){return this._css.get(p,l)}setColor(p,l,v){this._color.set(p,l,v)}getColor(p,l){return this._color.get(p,l)}clear(){this._color.clear(),this._css.clear()}}},3656:(j,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.addDisposableDomListener=void 0,a.addDisposableDomListener=function(u,_,p,l){u.addEventListener(_,p,l);let v=!1;return{dispose:()=>{v||(v=!0,u.removeEventListener(_,p,l))}}}},3551:function(j,a,u){var _=this&&this.__decorate||function(o,r,n,c){var g,S=arguments.length,C=S<3?r:c===null?c=Object.getOwnPropertyDescriptor(r,n):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,r,n,c);else for(var f=o.length-1;f>=0;f--)(g=o[f])&&(C=(S<3?g(C):S>3?g(r,n,C):g(r,n))||C);return S>3&&C&&Object.defineProperty(r,n,C),C},p=this&&this.__param||function(o,r){return function(n,c){r(n,c,o)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Linkifier=void 0;const l=u(3656),v=u(8460),m=u(844),b=u(2585),d=u(4725);let s=a.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(o,r,n,c,g){super(),this._element=o,this._mouseService=r,this._renderService=n,this._bufferService=c,this._linkProviderService=g,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new v.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new v.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)(()=>{var S;this._lastMouseEvent=void 0,(S=this._activeProviderReplies)==null||S.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,l.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,l.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,l.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(o){this._lastMouseEvent=o;const r=this._positionFromMouseEvent(o,this._element,this._mouseService);if(!r)return;this._isMouseOut=!1;const n=o.composedPath();for(let c=0;c<n.length;c++){const g=n[c];if(g.classList.contains("xterm"))break;if(g.classList.contains("xterm-hover"))return}this._lastBufferCell&&r.x===this._lastBufferCell.x&&r.y===this._lastBufferCell.y||(this._handleHover(r),this._lastBufferCell=r)}_handleHover(o){if(this._activeLine!==o.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(o,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,o)||(this._clearCurrentLink(),this._askForLink(o,!0))}_askForLink(o,r){var c,g;this._activeProviderReplies&&r||((c=this._activeProviderReplies)==null||c.forEach(S=>{S==null||S.forEach(C=>{C.link.dispose&&C.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=o.y);let n=!1;for(const[S,C]of this._linkProviderService.linkProviders.entries())r?(g=this._activeProviderReplies)!=null&&g.get(S)&&(n=this._checkLinkProviderResult(S,o,n)):C.provideLinks(o.y,f=>{var T,O;if(this._isMouseOut)return;const y=f==null?void 0:f.map(P=>({link:P}));(T=this._activeProviderReplies)==null||T.set(S,y),n=this._checkLinkProviderResult(S,o,n),((O=this._activeProviderReplies)==null?void 0:O.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(o.y,this._activeProviderReplies)})}_removeIntersectingLinks(o,r){const n=new Set;for(let c=0;c<r.size;c++){const g=r.get(c);if(g)for(let S=0;S<g.length;S++){const C=g[S],f=C.link.range.start.y<o?0:C.link.range.start.x,y=C.link.range.end.y>o?this._bufferService.cols:C.link.range.end.x;for(let T=f;T<=y;T++){if(n.has(T)){g.splice(S--,1);break}n.add(T)}}}}_checkLinkProviderResult(o,r,n){var S;if(!this._activeProviderReplies)return n;const c=this._activeProviderReplies.get(o);let g=!1;for(let C=0;C<o;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(g=!0);if(!g&&c){const C=c.find(f=>this._linkAtPosition(f.link,r));C&&(n=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let C=0;C<this._activeProviderReplies.size;C++){const f=(S=this._activeProviderReplies.get(C))==null?void 0:S.find(y=>this._linkAtPosition(y.link,r));if(f){n=!0,this._handleNewLink(f);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(o){if(!this._currentLink)return;const r=this._positionFromMouseEvent(o,this._element,this._mouseService);r&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,r)&&this._currentLink.link.activate(o,this._currentLink.link.text)}_clearCurrentLink(o,r){this._currentLink&&this._lastMouseEvent&&(!o||!r||this._currentLink.link.range.start.y>=o&&this._currentLink.link.range.end.y<=r)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(o){if(!this._lastMouseEvent)return;const r=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);r&&this._linkAtPosition(o.link,r)&&(this._currentLink=o,this._currentLink.state={decorations:{underline:o.link.decorations===void 0||o.link.decorations.underline,pointerCursor:o.link.decorations===void 0||o.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,o.link,this._lastMouseEvent),o.link.decorations={},Object.defineProperties(o.link.decorations,{pointerCursor:{get:()=>{var n,c;return(c=(n=this._currentLink)==null?void 0:n.state)==null?void 0:c.decorations.pointerCursor},set:n=>{var c;(c=this._currentLink)!=null&&c.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,c;return(c=(n=this._currentLink)==null?void 0:n.state)==null?void 0:c.decorations.underline},set:n=>{var c,g,S;(c=this._currentLink)!=null&&c.state&&((S=(g=this._currentLink)==null?void 0:g.state)==null?void 0:S.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(o.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;const c=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,g=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=c&&this._currentLink.link.range.end.y<=g&&(this._clearCurrentLink(c,g),this._lastMouseEvent)){const S=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);S&&this._askForLink(S,!1)}})))}_linkHover(o,r,n){var c;(c=this._currentLink)!=null&&c.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!0),this._currentLink.state.decorations.pointerCursor&&o.classList.add("xterm-cursor-pointer")),r.hover&&r.hover(n,r.text)}_fireUnderlineEvent(o,r){const n=o.range,c=this._bufferService.buffer.ydisp,g=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-c-1,n.end.x,n.end.y-c-1,void 0);(r?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(g)}_linkLeave(o,r,n){var c;(c=this._currentLink)!=null&&c.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(r,!1),this._currentLink.state.decorations.pointerCursor&&o.classList.remove("xterm-cursor-pointer")),r.leave&&r.leave(n,r.text)}_linkAtPosition(o,r){const n=o.range.start.y*this._bufferService.cols+o.range.start.x,c=o.range.end.y*this._bufferService.cols+o.range.end.x,g=r.y*this._bufferService.cols+r.x;return n<=g&&g<=c}_positionFromMouseEvent(o,r,n){const c=n.getCoords(o,r,this._bufferService.cols,this._bufferService.rows);if(c)return{x:c[0],y:c[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(o,r,n,c,g){return{x1:o,y1:r,x2:n,y2:c,cols:this._bufferService.cols,fg:g}}};a.Linkifier=s=_([p(1,d.IMouseService),p(2,d.IRenderService),p(3,b.IBufferService),p(4,d.ILinkProviderService)],s)},9042:(j,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.tooMuchOutput=a.promptLabel=void 0,a.promptLabel="Terminal input",a.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(j,a,u){var _=this&&this.__decorate||function(d,s,o,r){var n,c=arguments.length,g=c<3?s:r===null?r=Object.getOwnPropertyDescriptor(s,o):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(d,s,o,r);else for(var S=d.length-1;S>=0;S--)(n=d[S])&&(g=(c<3?n(g):c>3?n(s,o,g):n(s,o))||g);return c>3&&g&&Object.defineProperty(s,o,g),g},p=this&&this.__param||function(d,s){return function(o,r){s(o,r,d)}};Object.defineProperty(a,"__esModule",{value:!0}),a.OscLinkProvider=void 0;const l=u(511),v=u(2585);let m=a.OscLinkProvider=class{constructor(d,s,o){this._bufferService=d,this._optionsService=s,this._oscLinkService=o}provideLinks(d,s){var y;const o=this._bufferService.buffer.lines.get(d-1);if(!o)return void s(void 0);const r=[],n=this._optionsService.rawOptions.linkHandler,c=new l.CellData,g=o.getTrimmedLength();let S=-1,C=-1,f=!1;for(let T=0;T<g;T++)if(C!==-1||o.hasContent(T)){if(o.loadCell(T,c),c.hasExtendedAttrs()&&c.extended.urlId){if(C===-1){C=T,S=c.extended.urlId;continue}f=c.extended.urlId!==S}else C!==-1&&(f=!0);if(f||C!==-1&&T===g-1){const O=(y=this._oscLinkService.getLinkData(S))==null?void 0:y.uri;if(O){const P={start:{x:C+1,y:d},end:{x:T+(f||T!==g-1?0:1),y:d}};let D=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{const N=new URL(O);["http:","https:"].includes(N.protocol)||(D=!0)}catch{D=!0}D||r.push({text:O,range:P,activate:(N,X)=>n?n.activate(N,X,P):b(0,X),hover:(N,X)=>{var Z;return(Z=n==null?void 0:n.hover)==null?void 0:Z.call(n,N,X,P)},leave:(N,X)=>{var Z;return(Z=n==null?void 0:n.leave)==null?void 0:Z.call(n,N,X,P)}})}f=!1,c.hasExtendedAttrs()&&c.extended.urlId?(C=T,S=c.extended.urlId):(C=-1,S=-1)}}s(r)}};function b(d,s){if(confirm(`Do you want to navigate to ${s}?
WARNING: This link could potentially be dangerous`)){const o=window.open();if(o){try{o.opener=null}catch{}o.location.href=s}else console.warn("Opening link blocked as opener could not be cleared")}}a.OscLinkProvider=m=_([p(0,v.IBufferService),p(1,v.IOptionsService),p(2,v.IOscLinkService)],m)},6193:(j,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.RenderDebouncer=void 0,a.RenderDebouncer=class{constructor(u,_){this._renderCallback=u,this._coreBrowserService=_,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(u,_,p){this._rowCount=p,u=u!==void 0?u:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const u=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,_),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(j,a,u)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.Terminal=void 0;const _=u(3614),p=u(3656),l=u(3551),v=u(9042),m=u(3730),b=u(1680),d=u(3107),s=u(5744),o=u(2950),r=u(1296),n=u(428),c=u(4269),g=u(5114),S=u(8934),C=u(3230),f=u(9312),y=u(4725),T=u(6731),O=u(8055),P=u(8969),D=u(8460),N=u(844),X=u(6114),Z=u(8437),se=u(2584),ee=u(7399),E=u(5941),A=u(9074),M=u(2585),H=u(5435),Q=u(4567),re=u(779);class le extends P.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(U={}){super(U),this.browser=X,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new N.MutableDisposable),this._onCursorMove=this.register(new D.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new D.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new D.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new D.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new D.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new D.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new D.EventEmitter),this._onBlur=this.register(new D.EventEmitter),this._onA11yCharEmitter=this.register(new D.EventEmitter),this._onA11yTabEmitter=this.register(new D.EventEmitter),this._onWillOpen=this.register(new D.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(A.DecorationService),this._instantiationService.setService(M.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(re.LinkProviderService),this._instantiationService.setService(y.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(m.OscLinkProvider)),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((R,J)=>this.refresh(R,J))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(R=>this._reportWindowsOptions(R))),this.register(this._inputHandler.onColor(R=>this._handleColorEvent(R))),this.register((0,D.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,D.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,D.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(R=>this._afterResize(R.cols,R.rows))),this.register((0,N.toDisposable)(()=>{var R,J;this._customKeyEventHandler=void 0,(J=(R=this.element)==null?void 0:R.parentNode)==null||J.removeChild(this.element)}))}_handleColorEvent(U){if(this._themeService)for(const R of U){let J,z="";switch(R.index){case 256:J="foreground",z="10";break;case 257:J="background",z="11";break;case 258:J="cursor",z="12";break;default:J="ansi",z="4;"+R.index}switch(R.type){case 0:const ne=O.color.toColorRGB(J==="ansi"?this._themeService.colors.ansi[R.index]:this._themeService.colors[J]);this.coreService.triggerDataEvent(`${se.C0.ESC}]${z};${(0,E.toRgbString)(ne)}${se.C1_ESCAPED.ST}`);break;case 1:if(J==="ansi")this._themeService.modifyColors(ie=>ie.ansi[R.index]=O.channels.toColor(...R.color));else{const ie=J;this._themeService.modifyColors(Ee=>Ee[ie]=O.channels.toColor(...R.color))}break;case 2:this._themeService.restoreColor(R.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(U){U?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Q.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(U){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(se.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var U;return(U=this.textarea)==null?void 0:U.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(se.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const U=this.buffer.ybase+this.buffer.y,R=this.buffer.lines.get(U);if(!R)return;const J=Math.min(this.buffer.x,this.cols-1),z=this._renderService.dimensions.css.cell.height,ne=R.getWidth(J),ie=this._renderService.dimensions.css.cell.width*ne,Ee=this.buffer.y*this._renderService.dimensions.css.cell.height,Le=J*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Le+"px",this.textarea.style.top=Ee+"px",this.textarea.style.width=ie+"px",this.textarea.style.height=z+"px",this.textarea.style.lineHeight=z+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",R=>{this.hasSelection()&&(0,_.copyHandler)(R,this._selectionService)}));const U=R=>(0,_.handlePasteEvent)(R,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",U)),this.register((0,p.addDisposableDomListener)(this.element,"paste",U)),X.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",R=>{R.button===2&&(0,_.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",R=>{(0,_.rightClickHandler)(R,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),X.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",R=>{R.button===1&&(0,_.moveTextAreaUnderMouseCursor)(R,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",U=>this._keyUp(U),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",U=>this._keyDown(U),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",U=>this._keyPress(U),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",U=>this._compositionHelper.compositionupdate(U))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,p.addDisposableDomListener)(this.textarea,"input",U=>this._inputEvent(U),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(U){var J;if(!U)throw new Error("Terminal requires a parent element.");if(U.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((J=this.element)==null?void 0:J.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=U.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),U.appendChild(this.element);const R=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),R.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",z=>this.updateCursorStyle(z))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),R.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",v.promptLabel),X.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(g.CoreBrowserService,this.textarea,U.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(y.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",z=>this._handleTextAreaFocus(z))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(n.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(y.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(T.ThemeService),this._instantiationService.setService(y.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(c.CharacterJoinerService),this._instantiationService.setService(y.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(C.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(y.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(z=>this._onRender.fire(z))),this.onResize(z=>this._renderService.resize(z.cols,z.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(S.MouseService),this._instantiationService.setService(y.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(l.Linkifier,this.screenElement)),this.element.appendChild(R);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(b.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(z=>this.scrollLines(z.amount,z.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(f.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(y.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(z=>this.scrollLines(z.amount,z.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(z=>this._renderService.handleSelectionChanged(z.start,z.end,z.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(z=>{this.textarea.value=z,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(z=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.register(this._instantiationService.createInstance(d.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",z=>this._selectionService.handleMouseDown(z))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Q.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",z=>this._handleScreenReaderModeOptionChange(z))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(s.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",z=>{!this._overviewRulerRenderer&&z&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(s.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(r.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const U=this,R=this.element;function J(ie){const Ee=U._mouseService.getMouseReportCoords(ie,U.screenElement);if(!Ee)return!1;let Le,Me;switch(ie.overrideType||ie.type){case"mousemove":Me=32,ie.buttons===void 0?(Le=3,ie.button!==void 0&&(Le=ie.button<3?ie.button:3)):Le=1&ie.buttons?0:4&ie.buttons?1:2&ie.buttons?2:3;break;case"mouseup":Me=0,Le=ie.button<3?ie.button:3;break;case"mousedown":Me=1,Le=ie.button<3?ie.button:3;break;case"wheel":if(U._customWheelEventHandler&&U._customWheelEventHandler(ie)===!1||U.viewport.getLinesScrolled(ie)===0)return!1;Me=ie.deltaY<0?0:1,Le=4;break;default:return!1}return!(Me===void 0||Le===void 0||Le>4)&&U.coreMouseService.triggerMouseEvent({col:Ee.col,row:Ee.row,x:Ee.x,y:Ee.y,button:Le,action:Me,ctrl:ie.ctrlKey,alt:ie.altKey,shift:ie.shiftKey})}const z={mouseup:null,wheel:null,mousedrag:null,mousemove:null},ne={mouseup:ie=>(J(ie),ie.buttons||(this._document.removeEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.removeEventListener("mousemove",z.mousedrag)),this.cancel(ie)),wheel:ie=>(J(ie),this.cancel(ie,!0)),mousedrag:ie=>{ie.buttons&&J(ie)},mousemove:ie=>{ie.buttons||J(ie)}};this.register(this.coreMouseService.onProtocolChange(ie=>{ie?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(ie)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&ie?z.mousemove||(R.addEventListener("mousemove",ne.mousemove),z.mousemove=ne.mousemove):(R.removeEventListener("mousemove",z.mousemove),z.mousemove=null),16&ie?z.wheel||(R.addEventListener("wheel",ne.wheel,{passive:!1}),z.wheel=ne.wheel):(R.removeEventListener("wheel",z.wheel),z.wheel=null),2&ie?z.mouseup||(z.mouseup=ne.mouseup):(this._document.removeEventListener("mouseup",z.mouseup),z.mouseup=null),4&ie?z.mousedrag||(z.mousedrag=ne.mousedrag):(this._document.removeEventListener("mousemove",z.mousedrag),z.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(R,"mousedown",ie=>{if(ie.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(ie))return J(ie),z.mouseup&&this._document.addEventListener("mouseup",z.mouseup),z.mousedrag&&this._document.addEventListener("mousemove",z.mousedrag),this.cancel(ie)})),this.register((0,p.addDisposableDomListener)(R,"wheel",ie=>{if(!z.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(ie)===!1)return!1;if(!this.buffer.hasScrollback){const Ee=this.viewport.getLinesScrolled(ie);if(Ee===0)return;const Le=se.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(ie.deltaY<0?"A":"B");let Me="";for(let Je=0;Je<Math.abs(Ee);Je++)Me+=Le;return this.coreService.triggerDataEvent(Me,!0),this.cancel(ie,!0)}return this.viewport.handleWheel(ie)?this.cancel(ie):void 0}},{passive:!1})),this.register((0,p.addDisposableDomListener)(R,"touchstart",ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(ie),this.cancel(ie)},{passive:!0})),this.register((0,p.addDisposableDomListener)(R,"touchmove",ie=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(ie)?void 0:this.cancel(ie)},{passive:!1}))}refresh(U,R){var J;(J=this._renderService)==null||J.refreshRows(U,R)}updateCursorStyle(U){var R;(R=this._selectionService)!=null&&R.shouldColumnSelect(U)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(U,R,J=0){var z;J===1?(super.scrollLines(U,R,J),this.refresh(0,this.rows-1)):(z=this.viewport)==null||z.scrollLines(U)}paste(U){(0,_.paste)(U,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(U){this._customKeyEventHandler=U}attachCustomWheelEventHandler(U){this._customWheelEventHandler=U}registerLinkProvider(U){return this._linkProviderService.registerLinkProvider(U)}registerCharacterJoiner(U){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const R=this._characterJoinerService.register(U);return this.refresh(0,this.rows-1),R}deregisterCharacterJoiner(U){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(U)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(U){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+U)}registerDecoration(U){return this._decorationService.registerDecoration(U)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(U,R,J){this._selectionService.setSelection(U,R,J)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var U;(U=this._selectionService)==null||U.clearSelection()}selectAll(){var U;(U=this._selectionService)==null||U.selectAll()}selectLines(U,R){var J;(J=this._selectionService)==null||J.selectLines(U,R)}_keyDown(U){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)return!1;const R=this.browser.isMac&&this.options.macOptionIsMeta&&U.altKey;if(!R&&!this._compositionHelper.keydown(U))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;R||U.key!=="Dead"&&U.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const J=(0,ee.evaluateKeyboardEvent)(U,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(U),J.type===3||J.type===2){const z=this.rows-1;return this.scrollLines(J.type===2?-z:z),this.cancel(U,!0)}return J.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,U)||(J.cancel&&this.cancel(U,!0),!J.key||!!(U.key&&!U.ctrlKey&&!U.altKey&&!U.metaKey&&U.key.length===1&&U.key.charCodeAt(0)>=65&&U.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(J.key!==se.C0.ETX&&J.key!==se.C0.CR||(this.textarea.value=""),this._onKey.fire({key:J.key,domEvent:U}),this._showCursor(),this.coreService.triggerDataEvent(J.key,!0),!this.optionsService.rawOptions.screenReaderMode||U.altKey||U.ctrlKey?this.cancel(U,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(U,R){const J=U.isMac&&!this.options.macOptionIsMeta&&R.altKey&&!R.ctrlKey&&!R.metaKey||U.isWindows&&R.altKey&&R.ctrlKey&&!R.metaKey||U.isWindows&&R.getModifierState("AltGraph");return R.type==="keypress"?J:J&&(!R.keyCode||R.keyCode>47)}_keyUp(U){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1||(function(R){return R.keyCode===16||R.keyCode===17||R.keyCode===18}(U)||this.focus(),this.updateCursorStyle(U),this._keyPressHandled=!1)}_keyPress(U){let R;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(U)===!1)return!1;if(this.cancel(U),U.charCode)R=U.charCode;else if(U.which===null||U.which===void 0)R=U.keyCode;else{if(U.which===0||U.charCode===0)return!1;R=U.which}return!(!R||(U.altKey||U.ctrlKey||U.metaKey)&&!this._isThirdLevelShift(this.browser,U)||(R=String.fromCharCode(R),this._onKey.fire({key:R,domEvent:U}),this._showCursor(),this.coreService.triggerDataEvent(R,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(U){if(U.data&&U.inputType==="insertText"&&(!U.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const R=U.data;return this.coreService.triggerDataEvent(R,!0),this.cancel(U),!0}return!1}resize(U,R){U!==this.cols||R!==this.rows?super.resize(U,R):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(U,R){var J,z;(J=this._charSizeService)==null||J.measure(),(z=this.viewport)==null||z.syncScrollArea(!0)}clear(){var U;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(Z.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),(U=this.viewport)==null||U.reset(),this.refresh(0,this.rows-1)}}reset(){var R,J;this.options.rows=this.rows,this.options.cols=this.cols;const U=this._customKeyEventHandler;this._setup(),super.reset(),(R=this._selectionService)==null||R.reset(),this._decorationService.reset(),(J=this.viewport)==null||J.reset(),this._customKeyEventHandler=U,this.refresh(0,this.rows-1)}clearTextureAtlas(){var U;(U=this._renderService)==null||U.clearTextureAtlas()}_reportFocus(){var U;(U=this.element)!=null&&U.classList.contains("focus")?this.coreService.triggerDataEvent(se.C0.ESC+"[I"):this.coreService.triggerDataEvent(se.C0.ESC+"[O")}_reportWindowsOptions(U){if(this._renderService)switch(U){case H.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const R=this._renderService.dimensions.css.canvas.width.toFixed(0),J=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${se.C0.ESC}[4;${J};${R}t`);break;case H.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const z=this._renderService.dimensions.css.cell.width.toFixed(0),ne=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${se.C0.ESC}[6;${ne};${z}t`)}}cancel(U,R){if(this.options.cancelEvents||R)return U.preventDefault(),U.stopPropagation(),!1}}a.Terminal=le},9924:(j,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TimeBasedDebouncer=void 0,a.TimeBasedDebouncer=class{constructor(u,_=1e3){this._renderCallback=u,this._debounceThresholdMS=_,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,_,p){this._rowCount=p,u=u!==void 0?u:0,_=_!==void 0?_:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,_):_;const l=Date.now();if(l-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=l,this._innerRefresh();else if(!this._additionalRefreshRequested){const v=l-this._lastRefreshMs,m=this._debounceThresholdMS-v;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},m)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),_=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,_)}}},1680:function(j,a,u){var _=this&&this.__decorate||function(o,r,n,c){var g,S=arguments.length,C=S<3?r:c===null?c=Object.getOwnPropertyDescriptor(r,n):c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(o,r,n,c);else for(var f=o.length-1;f>=0;f--)(g=o[f])&&(C=(S<3?g(C):S>3?g(r,n,C):g(r,n))||C);return S>3&&C&&Object.defineProperty(r,n,C),C},p=this&&this.__param||function(o,r){return function(n,c){r(n,c,o)}};Object.defineProperty(a,"__esModule",{value:!0}),a.Viewport=void 0;const l=u(3656),v=u(4725),m=u(8460),b=u(844),d=u(2585);let s=a.Viewport=class extends b.Disposable{constructor(o,r,n,c,g,S,C,f){super(),this._viewportElement=o,this._scrollArea=r,this._bufferService=n,this._optionsService=c,this._charSizeService=g,this._renderService=S,this._coreBrowserService=C,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new m.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,l.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(y=>this._activeBuffer=y.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this.