spexcode 0.2.8 → 0.4.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.
- package/README.md +56 -44
- package/package.json +3 -3
- package/spec-cli/bin/spex.mjs +2 -2
- package/spec-cli/hooks/dispatch.sh +1 -1
- package/spec-cli/hooks/harness.sh +26 -6
- package/spec-cli/src/anchors.ts +300 -0
- package/spec-cli/src/attach.ts +2 -2
- package/spec-cli/src/cli.ts +691 -536
- package/spec-cli/src/client.ts +31 -30
- package/spec-cli/src/contract-filter.ts +1 -1
- package/spec-cli/src/doctor.ts +40 -13
- package/spec-cli/src/gateway.ts +11 -7
- package/spec-cli/src/git.ts +23 -15
- package/spec-cli/src/{board.ts → graph.ts} +44 -14
- package/spec-cli/src/{boardCache.ts → graphCache.ts} +41 -21
- package/spec-cli/src/{boardDelta.ts → graphDelta.ts} +1 -1
- package/spec-cli/src/graphStream.ts +288 -0
- package/spec-cli/src/guide.ts +142 -98
- package/spec-cli/src/harness-select.ts +2 -2
- package/spec-cli/src/harness.ts +30 -14
- package/spec-cli/src/help.ts +300 -385
- package/spec-cli/src/hooks.ts +1 -1
- package/spec-cli/src/index.ts +144 -103
- package/spec-cli/src/init.ts +14 -13
- package/spec-cli/src/issues.ts +89 -33
- package/spec-cli/src/layout.ts +5 -5
- package/spec-cli/src/lint.ts +128 -30
- package/spec-cli/src/localIssues.ts +61 -60
- package/spec-cli/src/materialize.ts +1 -1
- package/spec-cli/src/mentions.ts +15 -15
- package/spec-cli/src/migrate-table.ts +398 -0
- package/spec-cli/src/migrate.ts +386 -0
- package/spec-cli/src/ranker.ts +30 -4
- package/spec-cli/src/reaper.ts +117 -0
- package/spec-cli/src/search.bench.mjs +12 -12
- package/spec-cli/src/search.ts +1 -1
- package/spec-cli/src/sessions.ts +244 -138
- package/spec-cli/src/specs.ts +40 -25
- package/spec-cli/src/supervise.ts +2 -2
- package/spec-cli/src/tree.ts +5 -5
- package/spec-cli/src/uninstall.ts +4 -4
- package/spec-cli/templates/hooks/post-checkout +1 -1
- package/spec-cli/templates/hooks/post-merge +3 -3
- package/spec-cli/templates/hooks/pre-commit +9 -9
- package/spec-cli/templates/hooks/prepare-commit-msg +1 -1
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/idle/idle.sh +2 -2
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/mark-active/mark-active.sh +7 -0
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/mark-active/spec.md +2 -0
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/session-fail/fail.sh +1 -1
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-first/spec-first.sh +1 -1
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-of-file/spec-of-file.sh +2 -2
- package/spec-cli/templates/spec/project/.plugins/core/spec.md +21 -0
- package/spec-cli/templates/spec/project/{.config → .plugins}/core/stop-gate/stop-gate.sh +21 -21
- package/spec-cli/templates/spec/project/{.config → .plugins}/distill/spec.md +2 -2
- package/spec-cli/templates/spec/project/{.config → .plugins}/extract/spec.md +5 -5
- package/spec-cli/templates/spec/project/{.config → .plugins/prompts}/forge-link/spec.md +1 -1
- package/spec-cli/templates/spec/project/{.config → .plugins/prompts}/reproduce-before-fix/spec.md +3 -3
- package/spec-cli/templates/spec/project/.plugins/prompts/spec.md +20 -0
- package/spec-cli/templates/spec/project/{.config → .plugins}/regroup/spec.md +2 -2
- package/spec-cli/templates/spec/project/.plugins/spec.md +18 -0
- package/spec-cli/templates/spec/project/.plugins/supervisor/spec.md +8 -0
- package/spec-cli/templates/spec/project/{.config → .plugins}/tidy/spec.md +1 -1
- package/spec-cli/templates/spec/project/spec.md +1 -1
- package/spec-dashboard/dist/assets/{Dashboard-P0B9ukSG.js → Dashboard-CTcH2eW9.js} +9 -9
- package/spec-dashboard/dist/assets/EvalsPage-CJNKwHLN.js +2 -0
- package/spec-dashboard/dist/assets/{FoldToggle-BuQ0lokE.js → FoldToggle-CVFbBpyW.js} +1 -1
- package/spec-dashboard/dist/assets/{IssuesPage-H-D8aHEl.js → IssuesPage-kULjonqj.js} +1 -1
- package/spec-dashboard/dist/assets/{MobileApp-oZXIeCPb.js → MobileApp-B0ZJju8K.js} +1 -1
- package/spec-dashboard/dist/assets/{SessionInterface-Blr_MEdU.js → SessionInterface-BRKJqU2U.js} +3 -3
- package/spec-dashboard/dist/assets/{SessionWindow-LcCzBMU7.js → SessionWindow-CDhEL7wO.js} +7 -7
- package/spec-dashboard/dist/assets/{Settings-_yOye-In.js → Settings-BL6FV_8S.js} +1 -1
- package/spec-dashboard/dist/assets/{index-uGs9v_9o.css → index-DmQsNYKK.css} +1 -1
- package/spec-dashboard/dist/assets/{index-BhIslAau.js → index-DulGPk6A.js} +8 -8
- package/spec-dashboard/dist/index.html +2 -2
- package/{spec-yatsu → spec-eval}/src/cache.ts +8 -5
- package/{spec-yatsu → spec-eval}/src/cli.ts +212 -96
- package/{spec-yatsu → spec-eval}/src/evaltab.ts +35 -27
- package/{spec-yatsu → spec-eval}/src/filing.ts +7 -5
- package/{spec-yatsu → spec-eval}/src/freshness.ts +44 -22
- package/spec-eval/src/humanok.ts +43 -0
- package/{spec-yatsu → spec-eval}/src/scenariofresh.ts +22 -17
- package/{spec-yatsu/src/yatsu.ts → spec-eval/src/scenarios.ts} +41 -26
- package/{spec-yatsu/src/proof.ts → spec-eval/src/sessioneval.ts} +59 -59
- package/{spec-yatsu → spec-eval}/src/sidecar.ts +42 -10
- package/{spec-yatsu → spec-eval}/src/timeline.ts +1 -1
- package/spec-forge/src/__fixtures__/github-forge.json +9 -9
- package/spec-forge/src/cli.ts +14 -13
- package/spec-forge/src/{needs-yatsu-eval.ts → needs-eval.ts} +6 -6
- package/spec-cli/src/boardStream.ts +0 -179
- package/spec-cli/templates/presets/careful/.config/clarify-before-code/spec.md +0 -11
- package/spec-cli/templates/spec/project/.config/core/spec.md +0 -17
- package/spec-cli/templates/spec/project/.config/spec.md +0 -15
- package/spec-cli/templates/spec/project/.config/supervisor/spec.md +0 -8
- package/spec-dashboard/dist/assets/EvalsPage-BrvAGyc4.js +0 -2
- /package/spec-cli/templates/spec/project/{.config → .plugins}/core/idle/spec.md +0 -0
- /package/spec-cli/templates/spec/project/{.config → .plugins}/core/session-fail/spec.md +0 -0
- /package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-first/spec.md +0 -0
- /package/spec-cli/templates/spec/project/{.config → .plugins}/core/spec-of-file/spec.md +0 -0
- /package/spec-cli/templates/spec/project/{.config → .plugins}/core/stop-gate/spec.md +0 -0
- /package/spec-cli/templates/spec/project/{.config → .plugins}/distill/digest.mjs +0 -0
- /package/spec-cli/templates/spec/project/{.config → .plugins/prompts}/memory-hygiene/spec.md +0 -0
package/spec-dashboard/dist/assets/{SessionInterface-Blr_MEdU.js → SessionInterface-BRKJqU2U.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as K,j as F,u as Ke,b as Qe,c as qt,d as Kt}from"./index-
|
|
1
|
+
import{r as K,j as F,u as Ke,b as Qe,c as qt,d as Kt}from"./index-DulGPk6A.js";import{y as Gt,O as Vt,s as _t,d as Xt,z as Yt,n as He,m as Jt,B as Zt,C as Qt,D as es,F as ft,R as ts,x as ss,l as is,J as rs,M as ns,K as vt,P as os,Q as as,U as hs}from"./SessionWindow-CDhEL7wO.js";import{u as qe,M as et,a as ls}from"./Dashboard-CTcH2eW9.js";import{E as cs,a as ds}from"./EvalsPage-CJNKwHLN.js";import{F as us}from"./FoldToggle-CVFbBpyW.js";var bt={exports:{}};(function(U,ie){(function(ee,G){U.exports=G()})(globalThis,()=>(()=>{var ee={4567:function(O,t,a){var l=this&&this.__decorate||function(s,r,h,v){var u,m=arguments.length,c=m<3?r:v===null?v=Object.getOwnPropertyDescriptor(r,h):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(s,r,h,v);else for(var p=s.length-1;p>=0;p--)(u=s[p])&&(c=(m<3?u(c):m>3?u(r,h,c):u(r,h))||c);return m>3&&c&&Object.defineProperty(r,h,c),c},d=this&&this.__param||function(s,r){return function(h,v){r(h,v,s)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const n=a(9042),_=a(9924),g=a(844),f=a(4725),o=a(2585),e=a(3656);let i=t.AccessibilityManager=class extends g.Disposable{constructor(s,r,h,v){super(),this._terminal=s,this._coreBrowserService=h,this._renderService=v,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 u=0;u<this._terminal.rows;u++)this._rowElements[u]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[u]);if(this._topBoundaryFocusListener=u=>this._handleBoundaryFocus(u,0),this._bottomBoundaryFocusListener=u=>this._handleBoundaryFocus(u,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 _.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(u=>this._handleResize(u.rows))),this.register(this._terminal.onRender(u=>this._refreshRows(u.start,u.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(u=>this._handleChar(u))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
2
2
|
`))),this.register(this._terminal.onA11yTab(u=>this._handleTab(u))),this.register(this._terminal.onKey(u=>this._handleKey(u.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,e.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,g.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(s){for(let r=0;r<s;r++)this._handleChar(" ")}_handleChar(s){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==s&&(this._charsToAnnounce+=s):this._charsToAnnounce+=s,s===`
|
|
3
3
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(s){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(s)||this._charsToConsume.push(s)}_refreshRows(s,r){this._liveRegionDebouncer.refresh(s,r,this._terminal.rows)}_renderRows(s,r){const h=this._terminal.buffer,v=h.lines.length.toString();for(let u=s;u<=r;u++){const m=h.lines.get(h.ydisp+u),c=[],p=(m==null?void 0:m.translateToString(!0,void 0,void 0,c))||"",S=(h.ydisp+u+1).toString(),y=this._rowElements[u];y&&(p.length===0?(y.innerText=" ",this._rowColumns.set(y,[0,1])):(y.textContent=p,this._rowColumns.set(y,c)),y.setAttribute("aria-posinset",S),y.setAttribute("aria-setsize",v))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(s,r){const h=s.target,v=this._rowElements[r===0?1:this._rowElements.length-2];if(h.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||s.relatedTarget!==v)return;let u,m;if(r===0?(u=h,m=this._rowElements.pop(),this._rowContainer.removeChild(m)):(u=this._rowElements.shift(),m=h,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),m.removeEventListener("focus",this._bottomBoundaryFocusListener),r===0){const c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{const c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(r===0?-1:1),this._rowElements[r===0?1:this._rowElements.length-2].focus(),s.preventDefault(),s.stopImmediatePropagation()}_handleSelectionChange(){var p;if(this._rowElements.length===0)return;const s=document.getSelection();if(!s)return;if(s.isCollapsed)return void(this._rowContainer.contains(s.anchorNode)&&this._terminal.clearSelection());if(!s.anchorNode||!s.focusNode)return void console.error("anchorNode and/or focusNode are null");let r={node:s.anchorNode,offset:s.anchorOffset},h={node:s.focusNode,offset:s.focusOffset};if((r.node.compareDocumentPosition(h.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===h.node&&r.offset>h.offset)&&([r,h]=[h,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.node))return;const v=this._rowElements.slice(-1)[0];if(h.node.compareDocumentPosition(v)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(h={node:v,offset:((p=v.textContent)==null?void 0:p.length)??0}),!this._rowContainer.contains(h.node))return;const u=({node:S,offset:y})=>{const b=S instanceof Text?S.parentNode:S;let w=parseInt(b==null?void 0:b.getAttribute("aria-posinset"),10)-1;if(isNaN(w))return console.warn("row is invalid. Race condition?"),null;const L=this._rowColumns.get(b);if(!L)return console.warn("columns is null. Race condition?"),null;let B=y<L.length?L[y]:L.slice(-1)[0]+1;return B>=this._terminal.cols&&(++w,B=0),{row:w,column:B}},m=u(r),c=u(h);if(m&&c){if(m.row>c.row||m.row===c.row&&m.column>=c.column)throw new Error("invalid range");this._terminal.select(m.column,m.row,(c.row-m.row)*this._terminal.cols-m.column+c.column)}}_handleResize(s){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);for(;this._rowElements.length>s;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const s=this._coreBrowserService.mainDocument.createElement("div");return s.setAttribute("role","listitem"),s.tabIndex=-1,this._refreshRowDimensions(s),s}_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 s=0;s<this._terminal.rows;s++)this._refreshRowDimensions(this._rowElements[s])}}_refreshRowDimensions(s){s.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=i=l([d(1,o.IInstantiationService),d(2,f.ICoreBrowserService),d(3,f.IRenderService)],i)},3614:(O,t)=>{function a(_){return _.replace(/\r?\n/g,"\r")}function l(_,g){return g?"\x1B[200~"+_+"\x1B[201~":_}function d(_,g,f,o){_=l(_=a(_),f.decPrivateModes.bracketedPasteMode&&o.rawOptions.ignoreBracketedPasteMode!==!0),f.triggerDataEvent(_,!0),g.value=""}function n(_,g,f){const o=f.getBoundingClientRect(),e=_.clientX-o.left-10,i=_.clientY-o.top-10;g.style.width="20px",g.style.height="20px",g.style.left=`${e}px`,g.style.top=`${i}px`,g.style.zIndex="1000",g.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=a,t.bracketTextForPaste=l,t.copyHandler=function(_,g){_.clipboardData&&_.clipboardData.setData("text/plain",g.selectionText),_.preventDefault()},t.handlePasteEvent=function(_,g,f,o){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),g,f,o)},t.paste=d,t.moveTextAreaUnderMouseCursor=n,t.rightClickHandler=function(_,g,f,o,e){n(_,g,f),e&&o.rightClickSelect(_),g.value=o.selectionText,g.select()}},7239:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const l=a(1505);t.ColorContrastCache=class{constructor(){this._color=new l.TwoKeyMap,this._css=new l.TwoKeyMap}setCss(d,n,_){this._css.set(d,n,_)}getCss(d,n){return this._css.get(d,n)}setColor(d,n,_){this._color.set(d,n,_)}getColor(d,n){return this._color.get(d,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},3551:function(O,t,a){var l=this&&this.__decorate||function(i,s,r,h){var v,u=arguments.length,m=u<3?s:h===null?h=Object.getOwnPropertyDescriptor(s,r):h;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(i,s,r,h);else for(var c=i.length-1;c>=0;c--)(v=i[c])&&(m=(u<3?v(m):u>3?v(s,r,m):v(s,r))||m);return u>3&&m&&Object.defineProperty(s,r,m),m},d=this&&this.__param||function(i,s){return function(r,h){s(r,h,i)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier=void 0;const n=a(3656),_=a(8460),g=a(844),f=a(2585),o=a(4725);let e=t.Linkifier=class extends g.Disposable{get currentLink(){return this._currentLink}constructor(i,s,r,h,v){super(),this._element=i,this._mouseService=s,this._renderService=r,this._bufferService=h,this._linkProviderService=v,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new _.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,g.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,g.toDisposable)(()=>{var u;this._lastMouseEvent=void 0,(u=this._activeProviderReplies)==null||u.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(i){this._lastMouseEvent=i;const s=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!s)return;this._isMouseOut=!1;const r=i.composedPath();for(let h=0;h<r.length;h++){const v=r[h];if(v.classList.contains("xterm"))break;if(v.classList.contains("xterm-hover"))return}this._lastBufferCell&&s.x===this._lastBufferCell.x&&s.y===this._lastBufferCell.y||(this._handleHover(s),this._lastBufferCell=s)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(i,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,s){var h,v;this._activeProviderReplies&&s||((h=this._activeProviderReplies)==null||h.forEach(u=>{u==null||u.forEach(m=>{m.link.dispose&&m.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let r=!1;for(const[u,m]of this._linkProviderService.linkProviders.entries())s?(v=this._activeProviderReplies)!=null&&v.get(u)&&(r=this._checkLinkProviderResult(u,i,r)):m.provideLinks(i.y,c=>{var S,y;if(this._isMouseOut)return;const p=c==null?void 0:c.map(b=>({link:b}));(S=this._activeProviderReplies)==null||S.set(u,p),r=this._checkLinkProviderResult(u,i,r),((y=this._activeProviderReplies)==null?void 0:y.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,s){const r=new Set;for(let h=0;h<s.size;h++){const v=s.get(h);if(v)for(let u=0;u<v.length;u++){const m=v[u],c=m.link.range.start.y<i?0:m.link.range.start.x,p=m.link.range.end.y>i?this._bufferService.cols:m.link.range.end.x;for(let S=c;S<=p;S++){if(r.has(S)){v.splice(u--,1);break}r.add(S)}}}}_checkLinkProviderResult(i,s,r){var u;if(!this._activeProviderReplies)return r;const h=this._activeProviderReplies.get(i);let v=!1;for(let m=0;m<i;m++)this._activeProviderReplies.has(m)&&!this._activeProviderReplies.get(m)||(v=!0);if(!v&&h){const m=h.find(c=>this._linkAtPosition(c.link,s));m&&(r=!0,this._handleNewLink(m))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let m=0;m<this._activeProviderReplies.size;m++){const c=(u=this._activeProviderReplies.get(m))==null?void 0:u.find(p=>this._linkAtPosition(p.link,s));if(c){r=!0,this._handleNewLink(c);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;const s=this._positionFromMouseEvent(i,this._element,this._mouseService);s&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,s)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,s){this._currentLink&&this._lastMouseEvent&&(!i||!s||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,g.disposeArray)(this._linkCacheDisposables))}_handleNewLink(i){if(!this._lastMouseEvent)return;const s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._linkAtPosition(i.link,s)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0||i.link.decorations.underline,pointerCursor:i.link.decorations===void 0||i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>{var r,h;return(h=(r=this._currentLink)==null?void 0:r.state)==null?void 0:h.decorations.pointerCursor},set:r=>{var h;(h=this._currentLink)!=null&&h.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>{var r,h;return(h=(r=this._currentLink)==null?void 0:r.state)==null?void 0:h.decorations.underline},set:r=>{var h,v,u;(h=this._currentLink)!=null&&h.state&&((u=(v=this._currentLink)==null?void 0:v.state)==null?void 0:u.decorations.underline)!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;const h=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,v=this._bufferService.buffer.ydisp+1+r.end;if(this._currentLink.link.range.start.y>=h&&this._currentLink.link.range.end.y<=v&&(this._clearCurrentLink(h,v),this._lastMouseEvent)){const u=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);u&&this._askForLink(u,!1)}})))}_linkHover(i,s,r){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),s.hover&&s.hover(r,s.text)}_fireUnderlineEvent(i,s){const r=i.range,h=this._bufferService.buffer.ydisp,v=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-h-1,r.end.x,r.end.y-h-1,void 0);(s?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(v)}_linkLeave(i,s,r){var h;(h=this._currentLink)!=null&&h.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(s,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),s.leave&&s.leave(r,s.text)}_linkAtPosition(i,s){const r=i.range.start.y*this._bufferService.cols+i.range.start.x,h=i.range.end.y*this._bufferService.cols+i.range.end.x,v=s.y*this._bufferService.cols+s.x;return r<=v&&v<=h}_positionFromMouseEvent(i,s,r){const h=r.getCoords(i,s,this._bufferService.cols,this._bufferService.rows);if(h)return{x:h[0],y:h[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,s,r,h,v){return{x1:i,y1:s,x2:r,y2:h,cols:this._bufferService.cols,fg:v}}};t.Linkifier=e=l([d(1,o.IMouseService),d(2,o.IRenderService),d(3,f.IBufferService),d(4,o.ILinkProviderService)],e)},9042:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(O,t,a){var l=this&&this.__decorate||function(o,e,i,s){var r,h=arguments.length,v=h<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,i):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(o,e,i,s);else for(var u=o.length-1;u>=0;u--)(r=o[u])&&(v=(h<3?r(v):h>3?r(e,i,v):r(e,i))||v);return h>3&&v&&Object.defineProperty(e,i,v),v},d=this&&this.__param||function(o,e){return function(i,s){e(i,s,o)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const n=a(511),_=a(2585);let g=t.OscLinkProvider=class{constructor(o,e,i){this._bufferService=o,this._optionsService=e,this._oscLinkService=i}provideLinks(o,e){var p;const i=this._bufferService.buffer.lines.get(o-1);if(!i)return void e(void 0);const s=[],r=this._optionsService.rawOptions.linkHandler,h=new n.CellData,v=i.getTrimmedLength();let u=-1,m=-1,c=!1;for(let S=0;S<v;S++)if(m!==-1||i.hasContent(S)){if(i.loadCell(S,h),h.hasExtendedAttrs()&&h.extended.urlId){if(m===-1){m=S,u=h.extended.urlId;continue}c=h.extended.urlId!==u}else m!==-1&&(c=!0);if(c||m!==-1&&S===v-1){const y=(p=this._oscLinkService.getLinkData(u))==null?void 0:p.uri;if(y){const b={start:{x:m+1,y:o},end:{x:S+(c||S!==v-1?0:1),y:o}};let w=!1;if(!(r!=null&&r.allowNonHttpProtocols))try{const L=new URL(y);["http:","https:"].includes(L.protocol)||(w=!0)}catch{w=!0}w||s.push({text:y,range:b,activate:(L,B)=>r?r.activate(L,B,b):f(0,B),hover:(L,B)=>{var I;return(I=r==null?void 0:r.hover)==null?void 0:I.call(r,L,B,b)},leave:(L,B)=>{var I;return(I=r==null?void 0:r.leave)==null?void 0:I.call(r,L,B,b)}})}c=!1,h.hasExtendedAttrs()&&h.extended.urlId?(m=S,u=h.extended.urlId):(m=-1,u=-1)}}e(s)}};function f(o,e){if(confirm(`Do you want to navigate to ${e}?
|
|
4
4
|
|
|
@@ -63,9 +63,9 @@ out vec4 outColor;
|
|
|
63
63
|
|
|
64
64
|
void main() {
|
|
65
65
|
outColor = v_color;
|
|
66
|
-
}`)),this.register((0,d.toDisposable)(()=>b.deleteProgram(this._program))),this._projectionLocation=(0,l.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),L=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(L))),b.bindBuffer(b.ARRAY_BUFFER,L),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),I=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(I))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,I),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,l.throwIfFalsy)(b.createBuffer()),this.register((0,d.toDisposable)(()=>b.deleteBuffer(this._attributesBuffer))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,g,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,g,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,g,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors(T=>{this._updateCachedColors(T),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(c){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,c.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,c.count)}handleResize(){this._updateViewportRectangle()}setDimensions(c){this._dimensions=c}_updateCachedColors(c){this._bgFloat=this._colorToFloat32Array(c.background),this._cursorFloat=this._colorToFloat32Array(c.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(c){const p=this._terminal,S=this._vertices;let y,b,w,L,B,I,T,M,C,x,R,D=1;for(y=0;y<p.rows;y++){for(w=-1,L=0,B=0,I=!1,b=0;b<p.cols;b++)T=(y*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,M=c.cells[T+n.RENDER_MODEL_BG_OFFSET],C=c.cells[T+n.RENDER_MODEL_FG_OFFSET],x=!!(67108864&C),(M!==L||C!==B&&(I||x))&&((L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,b,y)),w=b,L=M,B=C,I=x);(L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,p.cols,y))}S.count=D}updateCursor(c){const p=this._verticesCursor,S=c.cursor;if(!S||S.style==="block")return void(p.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(p.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(p.attributes,y,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(y=8*b++,this._addRectangleFloat(p.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),y=8*b++,this._addRectangleFloat(p.attributes,y,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),p.count=b}_updateRectangle(c,p,S,y,b,w,L){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&y){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&y].rgba;break;case 50331648:o=(16777215&y)<<8;break;default:o=this._themeService.colors.background.rgba}c.attributes.length<p+4&&(c.attributes=(0,_.expandFloat32Array)(c.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,i=L*this._dimensions.device.cell.height,s=(o>>24&255)/255,r=(o>>16&255)/255,h=(o>>8&255)/255,v=1,this._addRectangle(c.attributes,p,e,i,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,s,r,h,v)}_addRectangle(c,p,S,y,b,w,L,B,I,T){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L,c[p+5]=B,c[p+6]=I,c[p+7]=T}_addRectangleFloat(c,p,S,y,b,w,L){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L[0],c[p+5]=L[1],c[p+6]=L[2],c[p+7]=L[3]}_colorToFloat32Array(c){return new Float32Array([(c.rgba>>24&255)/255,(c.rgba>>16&255)/255,(c.rgba>>8&255)/255,(255&c.rgba)/255])}}t.RectangleRenderer=u},310:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const l=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,l.createSelectionRenderModel)()}resize(d,n){const _=d*n*t.RENDER_MODEL_INDICIES_PER_CELL;_!==this.cells.length&&(this.cells=new Uint32Array(_),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const l=a(820),d=a(274),n=a(627),_=a(457),g=a(56),f=a(374),o=a(345),e=a(859),i=a(147),s=a(782),r=a(855),h=a(965),v=a(742),u=a(310),m=a(733);class c extends e.Disposable{constructor(b,w,L,B,I,T,M,C,x){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=L,this._coreBrowserService=B,this._coreService=I,this._decorationService=T,this._optionsService=M,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new u.RenderModel,this._workCell=new s.CellData,this._workCell2=new s.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new d.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,M,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(M.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const R={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",R),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextlost",D=>{console.log("webglcontextlost event received"),D.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(D)},3e3)})),this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextrestored",D=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(D,N)=>this._setCanvasDevicePixelDimensions(D,N)),this.register(this._coreBrowserService.onWindowChange(D=>{this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,D,(N,W)=>this._setCanvasDevicePixelDimensions(N,W))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var D;for(const N of this._renderLayers)N.dispose();(D=this._canvas.parentElement)==null||D.removeChild(this._canvas),(0,n.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var b;return(b=this._charAtlas)==null?void 0:b.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(b,w){var L,B,I,T;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const M of this._renderLayers)M.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(L=this._rectangleRenderer.value)==null||L.setDimensions(this.dimensions),(B=this._rectangleRenderer.value)==null||B.handleResize(),(I=this._glyphRenderer.value)==null||I.setDimensions(this.dimensions),(T=this._glyphRenderer.value)==null||T.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var b;for(const w of this._renderLayers)w.handleBlur(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.pause(),this._requestRedrawViewport()}handleFocus(){var b;for(const w of this._renderLayers)w.handleFocus(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.resume(),this._requestRedrawViewport()}handleSelectionChanged(b,w,L){for(const B of this._renderLayers)B.handleSelectionChanged(this._terminal,b,w,L);this._model.selection.update(this._core,b,w,L),this._requestRedrawViewport()}handleCursorMove(){var b;for(const w of this._renderLayers)w.handleCursorMove(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new v.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new h.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,n.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(b){var w;this._model.clear(),b&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var b;(b=this._charAtlas)==null||b.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var b;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const L of this._renderLayers)L.handleGridChanged(this._terminal,b,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(b,w),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new _.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const L=this._core;let B,I,T,M,C,x,R,D,N,W,X,Y,A,E,$=this._workCell;b=S(b,L.rows-1,0),w=S(w,L.rows-1,0);const H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=H-L.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,L.cols-1);let re=-1;const te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ue=!1;for(I=b;I<=w;I++)for(T=I+L.buffer.ydisp,M=L.buffer.lines.get(T),this._model.lineLengths[I]=0,C=this._characterJoinerService.getJoinedCharacters(T),A=0;A<L.cols;A++)if(B=this._cellColorResolver.result.bg,M.loadCell(A,$),A===0&&(B=this._cellColorResolver.result.bg),x=!1,R=A,C.length>0&&A===C[0][0]&&(x=!0,D=C.shift(),$=new p($,M.translateToString(!0,D[0],D[1]),D[1]-D[0]),R=D[1]-1),N=$.getChars(),W=$.getCode(),Y=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve($,A,T,this.dimensions.device.cell.width),te&&T===H&&(A===q&&(this._model.cursor={x:q,y:V,width:$.getWidth(),style:this._coreBrowserService.isFocused?L.options.cursorStyle||"block":L.options.cursorInactiveStyle,cursorWidth:L.options.cursorWidth,dpr:this._devicePixelRatio},re=q+$.getWidth()-1),A>=q&&A<=re&&(this._coreBrowserService.isFocused&&(L.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&L.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),W!==r.NULL_CELL_CODE&&(this._model.lineLengths[I]=A+1),(this._model.cells[Y]!==W||this._model.cells[Y+u.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Y+u.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Y+u.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ue=!0,N.length>1&&(W|=u.COMBINED_CHAR_BIT_MASK),this._model.cells[Y]=W,this._model.cells[Y+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Y+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Y+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=$.getWidth(),this._glyphRenderer.value.updateCell(A,I,W,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,N,X,B),x))for($=this._workCell,A++;A<R;A++)E=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(A,I,r.NULL_CELL_CODE,0,0,0,r.NULL_CELL_CHAR,0,0),this._model.cells[E]=r.NULL_CELL_CODE,this._model.cells[E+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ue&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(b,w){this._canvas.width===b&&this._canvas.height===w||(this._canvas.width=b,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const b=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:b,end:b})}}t.WebglRenderer=c;class p extends i.AttributeData{constructor(b,w,L){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=L}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(y,b,w=0){return Math.max(Math.min(y,b),w)}t.JoinedCellData=p},381:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const l=a(374);function d(n,_,g){const f=(0,l.throwIfFalsy)(n.createShader(_));if(n.shaderSource(f,g),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,_,g){const f=(0,l.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.VERTEX_SHADER,_))),n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.FRAGMENT_SHADER,g))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=d,t.expandFloat32Array=function(n,_){const g=Math.min(2*n.length,_),f=new Float32Array(g);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const l=a(627),d=a(237),n=a(374),_=a(859);class g extends _.Disposable{constructor(o,e,i,s,r,h,v,u){super(),this._container=e,this._alpha=r,this._coreBrowserService=h,this._optionsService=v,this._themeService=u,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,_.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,i){}handleSelectionChanged(o,e,i,s=!1){}_setTransparency(o,e){if(e===this._alpha)return;const i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,l.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,i=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,i,s){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(o,e,i,s){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=d.TEXT_BASELINE,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,i){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,i){return`${i?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=g},733:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const l=a(197),d=a(237),n=a(592);class _ extends n.BaseRenderLayer{constructor(f,o,e,i,s,r,h){super(e,f,"link",o,!0,s,r,h),this.register(i.onShowLinkUnderline(v=>this._handleShowLinkUnderline(v))),this.register(i.onHideLinkUnderline(v=>this._handleHideLinkUnderline(v)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===d.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,l.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=_},820:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},274:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const l=a(855),d=a(160),n=a(374);let _,g=0,f=0,o=!1,e=!1,i=!1,s=0;t.CellColorResolver=class{constructor(r,h,v,u,m,c){this._terminal=r,this._optionService=h,this._selectionRenderModel=v,this._decorationService=u,this._coreBrowserService=m,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(r,h,v,u){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,f=0,g=0,e=!1,o=!1,i=!1,_=this._themeService.colors,s=0,r.getCode()!==l.NULL_CELL_CODE&&r.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));s=h*u%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(h,v,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),i=this._selectionRenderModel.isCellSelected(this._terminal,h,v),i){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=d.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,_.selectionForeground&&(g=_.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))g=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}g=d.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(h,v,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=i?-16777216&r.bg&-134217729|f|50331648:-16777216&r.bg|f|50331648),o&&(g=-16777216&r.fg&-67108865|g|50331648),67108864&this.result.fg&&(e&&!o&&(g=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&_.background.rgba>>8|50331648,o=!0),!e&&o&&(f=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&_.foreground.rgba>>8|50331648,e=!0)),_=void 0,this.result.bg=e?f:this.result.bg,this.result.fg=o?g:this.result.fg,this.result.ext&=536870911,this.result.ext|=s<<29&3758096384}}},627:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const l=a(509),d=a(197),n=[];t.acquireTextureAtlas=function(_,g,f,o,e,i,s,r){const h=(0,d.generateConfig)(o,e,i,s,g,f,r);for(let m=0;m<n.length;m++){const c=n[m],p=c.ownedBy.indexOf(_);if(p>=0){if((0,d.configEquals)(c.config,h))return c.atlas;c.ownedBy.length===1?(c.atlas.dispose(),n.splice(m,1)):c.ownedBy.splice(p,1);break}}for(let m=0;m<n.length;m++){const c=n[m];if((0,d.configEquals)(c.config,h))return c.ownedBy.push(_),c.atlas}const v=_._core,u={atlas:new l.TextureAtlas(document,h,v.unicodeService),config:h,ownedBy:[_]};return n.push(u),u.atlas},t.removeTerminalFromCache=function(_){for(let g=0;g<n.length;g++){const f=n[g].ownedBy.indexOf(_);if(f!==-1){n[g].ownedBy.length===1?(n[g].atlas.dispose(),n.splice(g,1)):n[g].ownedBy.splice(f,1);break}}}},197:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const l=a(160);t.generateConfig=function(d,n,_,g,f,o,e){const i={foreground:o.foreground,background:o.background,cursor:l.NULL_COLOR,cursorAccent:l.NULL_COLOR,selectionForeground:l.NULL_COLOR,selectionBackgroundTransparent:l.NULL_COLOR,selectionBackgroundOpaque:l.NULL_COLOR,selectionInactiveBackgroundTransparent:l.NULL_COLOR,selectionInactiveBackgroundOpaque:l.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:d,deviceCellHeight:n,deviceCharWidth:_,deviceCharHeight:g,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:i}},t.configEquals=function(d,n){for(let _=0;_<d.colors.ansi.length;_++)if(d.colors.ansi[_].rgba!==n.colors.ansi[_].rgba)return!1;return d.devicePixelRatio===n.devicePixelRatio&&d.customGlyphs===n.customGlyphs&&d.lineHeight===n.lineHeight&&d.letterSpacing===n.letterSpacing&&d.fontFamily===n.fontFamily&&d.fontSize===n.fontSize&&d.fontWeight===n.fontWeight&&d.fontWeightBold===n.fontWeightBold&&d.allowTransparency===n.allowTransparency&&d.deviceCharWidth===n.deviceCharWidth&&d.deviceCharHeight===n.deviceCharHeight&&d.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&d.minimumContrastRatio===n.minimumContrastRatio&&d.colors.foreground.rgba===n.colors.foreground.rgba&&d.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(d){return(50331648&d)==16777216||(50331648&d)==33554432}},237:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},457:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const l=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,l>0)return void this._restartInterval(l)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const l=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(l)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const l=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const d={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,i,s,r,h,v,u){const m=t.blockElementDefinitions[e];if(m)return function(y,b,w,L,B,I){for(let T=0;T<b.length;T++){const M=b[T],C=B/8,x=I/8;y.fillRect(w+M.x*C,L+M.y*x,M.w*C,M.h*x)}}(o,m,i,s,r,h),!0;const c=d[e];if(c)return function(y,b,w,L,B,I){let T=n.get(b);T||(T=new Map,n.set(b,T));const M=y.fillStyle;if(typeof M!="string")throw new Error(`Unexpected fillStyle type "${M}"`);let C=T.get(M);if(!C){const x=b[0].length,R=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=x,D.height=R;const N=(0,l.throwIfFalsy)(D.getContext("2d")),W=new ImageData(x,R);let X,Y,A,E;if(M.startsWith("#"))X=parseInt(M.slice(1,3),16),Y=parseInt(M.slice(3,5),16),A=parseInt(M.slice(5,7),16),E=M.length>7&&parseInt(M.slice(7,9),16)||1;else{if(!M.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${M}" when drawing pattern glyph`);[X,Y,A,E]=M.substring(5,M.length-1).split(",").map($=>parseFloat($))}for(let $=0;$<R;$++)for(let H=0;H<x;H++)W.data[4*($*x+H)]=X,W.data[4*($*x+H)+1]=Y,W.data[4*($*x+H)+2]=A,W.data[4*($*x+H)+3]=b[$][H]*(255*E);N.putImageData(W,0,0),C=(0,l.throwIfFalsy)(y.createPattern(D,null)),T.set(M,C)}y.fillStyle=C,y.fillRect(w,L,B,I)}(o,c,i,s,r,h),!0;const p=t.boxDrawingDefinitions[e];if(p)return function(y,b,w,L,B,I,T){y.strokeStyle=y.fillStyle;for(const[M,C]of Object.entries(b)){let x;y.beginPath(),y.lineWidth=T*Number.parseInt(M),x=typeof C=="function"?C(.15,.15/I*B):C;for(const R of x.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!0,T))}y.stroke(),y.closePath()}}(o,p,i,s,r,h,u),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(y,b,w,L,B,I,T,M){const C=new Path2D;C.rect(w,L,B,I),y.clip(C),y.beginPath();const x=T/12;y.lineWidth=M*x;for(const R of b.d.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!1,M,(b.leftPadding??0)*(x/2),(b.rightPadding??0)*(x/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()}(o,S,i,s,r,h,v,u),!0)};const n=new Map;function _(o,e,i=0){return Math.max(Math.min(o,e),i)}const g={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function f(o,e,i,s,r,h,v,u=0,m=0){const c=o.map(p=>parseFloat(p)||parseInt(p));if(c.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<c.length;p+=2)c[p]*=e-u*v-m*v,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,e,0)),c[p]+=s+u*v;for(let p=1;p<c.length;p+=2)c[p]*=i,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,i,0)),c[p]+=r;return c}},56:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const l=a(859);t.observeDevicePixelDimensions=function(d,n,_){let g=new n.ResizeObserver(f=>{const o=f.find(s=>s.target===d);if(!o)return;if(!("devicePixelContentBoxSize"in o))return g==null||g.disconnect(),void(g=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,i=o.devicePixelContentBoxSize[0].blockSize;e>0&&i>0&&_(e,i)});try{g.observe(d,{box:["device-pixel-content-box"]})}catch{g.disconnect(),g=void 0}return(0,l.toDisposable)(()=>g==null?void 0:g.disconnect())}},374:(O,t)=>{function a(d){return 57508<=d&&d<=57558}function l(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},t.isEmoji=l,t.allowRescaling=function(d,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!l(d)&&!a(d)&&!function(f){return 57344<=f&&f<=63743}(d)},t.treatGlyphAsBackgroundColor=function(d){return a(d)||function(n){return 9472<=n&&n<=9631}(d)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(d,n,_=0){return(d-(2*Math.round(n)-_))%(2*Math.round(n))}},296:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(d,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const f=d.buffers.active.ydisp,o=n[1]-f,e=_[1]-f,i=Math.max(o,0),s=Math.min(e,d.rows-1);i>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=s,this.startCol=n[0],this.endCol=_[0])}isCellSelected(d,n,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const l=a(237),d=a(860),n=a(374),_=a(160),g=a(345),f=a(485),o=a(385),e=a(147),i=a(855),s={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let r;class h{get pages(){return this._pages}constructor(p,S,y){this._document=p,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new g.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new g.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(p,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const p of this.pages)p.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const p=new o.IdleTaskQueue;for(let S=33;S<126;S++)p.enqueue(()=>{if(!this._cacheMap.get(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT)){const y=this._drawToCache(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT);this._cacheMap.set(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT,y)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const p of this._pages)p.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(h.maxAtlasPages&&this._pages.length>=Math.max(4,h.maxAtlasPages)){const S=this._pages.filter(T=>2*T.canvas.width<=(h.maxTextureSize||4096)).sort((T,M)=>M.canvas.width!==T.canvas.width?M.canvas.width-T.canvas.width:M.percentageUsed-T.percentageUsed);let y=-1,b=0;for(let T=0;T<S.length;T++)if(S[T].canvas.width!==b)y=T,b=S[T].canvas.width;else if(T-y==3)break;const w=S.slice(y,y+4),L=w.map(T=>T.glyphs[0].texturePage).sort((T,M)=>T>M?1:-1),B=this.pages.length-w.length,I=this._mergePages(w,B);I.version++;for(let T=L.length-1;T>=0;T--)this._deletePage(L[T]);this.pages.push(I),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(I.canvas)}const p=new v(this._document,this._textureSize);return this._pages.push(p),this._activePages.push(p),this._onAddTextureAtlasCanvas.fire(p.canvas),p}_mergePages(p,S){const y=2*p[0].canvas.width,b=new v(this._document,y,p);for(const[w,L]of p.entries()){const B=w*L.canvas.width%y,I=Math.floor(w/2)*L.canvas.height;b.ctx.drawImage(L.canvas,B,I);for(const M of L.glyphs)M.texturePage=S,M.sizeClipSpace.x=M.size.x/y,M.sizeClipSpace.y=M.size.y/y,M.texturePosition.x+=B,M.texturePosition.y+=I,M.texturePositionClipSpace.x=M.texturePosition.x/y,M.texturePositionClipSpace.y=M.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(L.canvas);const T=this._activePages.indexOf(L);T!==-1&&this._activePages.splice(T,1)}return b}_deletePage(p){this._pages.splice(p,1);for(let S=p;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(p,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,p,S,y,b,w)}getRasterizedGlyph(p,S,y,b,w){return this._getFromCacheMap(this._cacheMap,p,S,y,b,w)}_getFromCacheMap(p,S,y,b,w,L=!1){return r=p.get(S,y,b,w),r||(r=this._drawToCache(S,y,b,w,L),p.set(S,y,b,w,r)),r}_getColorFromAnsiIndex(p){if(p>=this._config.colors.ansi.length)throw new Error("No color found for idx "+p);return this._config.colors.ansi[p]}_getBackgroundColor(p,S,y,b){if(this._config.allowTransparency)return _.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const L=e.AttributeData.toColorRGB(S);w=_.channels.toColor(L[0],L[1],L[2]);break;default:w=y?_.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,y,b,w,L,B,I,T,M){const C=this._getMinimumContrastColor(p,S,y,b,w,L,B,T,I,M);if(C)return C;let x;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&T&&L<8&&(L+=8),x=this._getColorFromAnsiIndex(L);break;case 50331648:const R=e.AttributeData.toColorRGB(L);x=_.channels.toColor(R[0],R[1],R[2]);break;default:x=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(x=_.color.opaque(x)),I&&(x=_.color.multiplyOpacity(x,l.DIM_OPACITY)),x}_resolveBackgroundRgba(p,S,y){switch(p){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(p,S,y,b){switch(p){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&b&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(p,S,y,b,w,L,B,I,T,M){if(this._config.minimumContrastRatio===1||M)return;const C=this._getContrastCache(T),x=C.getColor(p,b);if(x!==void 0)return x||void 0;const R=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,L,B,I),N=_.rgba.ensureContrastRatio(R,D,this._config.minimumContrastRatio/(T?2:1));if(!N)return void C.setColor(p,b,null);const W=_.channels.toColor(N>>24&255,N>>16&255,N>>8&255);return C.setColor(p,b,W),W}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,y,b,w=!1){const L=typeof p=="number"?String.fromCharCode(p):p,B=Math.min(this._config.deviceCellWidth*Math.max(L.length,2)+4,this._textureSize);this._tmpCanvas.width<B&&(this._tmpCanvas.width=B);const I=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<I&&(this._tmpCanvas.height=I),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return s;const T=!!this._workAttributeData.isBold(),M=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),R=!!this._workAttributeData.isUnderline(),D=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline();let W=this._workAttributeData.getFgColor(),X=this._workAttributeData.getFgColorMode(),Y=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(M){const J=W;W=Y,Y=J;const le=X;X=A,A=le}const E=this._getBackgroundColor(A,Y,M,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const $=T?this._config.fontWeightBold:this._config.fontWeight,H=x?"italic":"";this._tmpCtx.font=`${H} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=l.TEXT_BASELINE;const V=L.length===1&&(0,n.isPowerlineGlyph)(L.charCodeAt(0)),q=L.length===1&&(0,n.isRestrictedPowerlineGlyph)(L.charCodeAt(0)),re=this._getForegroundColor(S,A,Y,y,X,W,M,C,T,(0,n.treatGlyphAsBackgroundColor)(L.charCodeAt(0)));this._tmpCtx.fillStyle=re.css;const te=q?0:4;let ue=!1;this._config.customGlyphs!==!1&&(ue=(0,d.tryDrawCustomChar)(this._tmpCtx,L,te,te,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Se,se=!V;if(Se=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),R){this._tmpCtx.save();const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),le=J%2==1?.5:0;if(this._tmpCtx.lineWidth=J,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())se=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{se=!1;let Ce=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Ce<8&&(Ce+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Ce).css}this._tmpCtx.beginPath();const ge=te,fe=Math.ceil(te+this._config.deviceCharHeight)-le-(w?2*J:0),Le=fe+J,ye=fe+2*J;let Ee=this._workAttributeData.getUnderlineVariantOffset();for(let Ce=0;Ce<Se;Ce++){this._tmpCtx.save();const ve=ge+Ce*this._config.deviceCellWidth,ae=ge+(Ce+1)*this._config.deviceCellWidth,he=ve+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe),this._tmpCtx.moveTo(ve,ye),this._tmpCtx.lineTo(ae,ye);break;case 3:const Oe=J<=1?ye:Math.ceil(te+this._config.deviceCharHeight-J/2)-le,Pe=J<=1?fe:Math.ceil(te+this._config.deviceCharHeight+J/2)-le,Ne=new Path2D;Ne.rect(ve,fe,this._config.deviceCellWidth,ye-fe),this._tmpCtx.clip(Ne),this._tmpCtx.moveTo(ve-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(ve-this._config.deviceCellWidth/2,Pe,ve,Pe,ve,Le),this._tmpCtx.bezierCurveTo(ve,Oe,he,Oe,he,Le),this._tmpCtx.bezierCurveTo(he,Pe,ae,Pe,ae,Le),this._tmpCtx.bezierCurveTo(ae,Oe,ae+this._config.deviceCellWidth/2,Oe,ae+this._config.deviceCellWidth/2,Le);break;case 4:const ce=Ee===0?0:Ee>=J?2*J-Ee:J-Ee;Ee>=J||ce===0?(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ve+ce,fe),this._tmpCtx.lineTo(ae,fe)):(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ve+ce,fe),this._tmpCtx.moveTo(ve+ce+J,fe),this._tmpCtx.lineTo(ae,fe)),Ee=(0,n.computeNextVariantOffset)(ae-ve,J,Ee);break;case 5:const Me=.6,$e=.3,De=ae-ve,ke=Math.floor(Me*De),Ie=Math.floor($e*De),We=De-ke-Ie;this._tmpCtx.setLineDash([ke,Ie,We]),this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe);break;default:this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ue&&this._config.fontSize>=12&&!this._config.allowTransparency&&L!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Ce=this._tmpCtx.measureText(L);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ce&&Ce.actualBoundingBoxDescent>0){this._tmpCtx.save();const ve=new Path2D;ve.rect(ge,fe-Math.ceil(J/2),this._config.deviceCellWidth*Se,ye-fe+Math.ceil(J/2)),this._tmpCtx.clip(ve),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(L,te,te+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),le=J%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+le),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Se,te+le),this._tmpCtx.stroke()}if(ue||this._tmpCtx.fillText(L,te,te+this._config.deviceCharHeight),L==="_"&&!this._config.allowTransparency){let J=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se);if(J)for(let le=1;le<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(L,te,te+this._config.deviceCharHeight-le),J=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se),J);le++);}if(D){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),le=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+Math.floor(this._config.deviceCharHeight/2)-le),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Se,te+Math.floor(this._config.deviceCharHeight/2)-le),this._tmpCtx.stroke()}this._tmpCtx.restore();const xe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Re;if(Re=this._config.allowTransparency?function(J){for(let le=0;le<J.data.length;le+=4)if(J.data[le+3]>0)return!1;return!0}(xe):u(xe,E,re,se),Re)return s;const de=this._findGlyphBoundingBox(xe,this._workBoundingBox,B,q,ue,te);let oe,ne;for(;;){if(this._activePages.length===0){const J=this._createNewPage();oe=J,ne=J.currentRow,ne.height=de.size.y;break}oe=this._activePages[this._activePages.length-1],ne=oe.currentRow;for(const J of this._activePages)de.size.y<=J.currentRow.height&&(oe=J,ne=J.currentRow);for(let J=this._activePages.length-1;J>=0;J--)for(const le of this._activePages[J].fixedRows)le.height<=ne.height&&de.size.y<=le.height&&(oe=this._activePages[J],ne=le);if(ne.y+de.size.y>=oe.canvas.height||ne.height>de.size.y+2){let J=!1;if(oe.currentRow.y+oe.currentRow.height+de.size.y>=oe.canvas.height){let le;for(const ge of this._activePages)if(ge.currentRow.y+ge.currentRow.height+de.size.y<ge.canvas.height){le=ge;break}if(le)oe=le;else if(h.maxAtlasPages&&this._pages.length>=h.maxAtlasPages&&ne.y+de.size.y<=oe.canvas.height&&ne.height>=de.size.y&&ne.x+de.size.x<=oe.canvas.width)J=!0;else{const ge=this._createNewPage();oe=ge,ne=ge.currentRow,ne.height=de.size.y,J=!0}}J||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),ne={x:0,y:oe.currentRow.y+oe.currentRow.height,height:de.size.y},oe.fixedRows.push(ne),oe.currentRow={x:0,y:ne.y+ne.height,height:0})}if(ne.x+de.size.x<=oe.canvas.width)break;ne===oe.currentRow?(ne.x=0,ne.y+=ne.height,ne.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(ne),1)}return de.texturePage=this._pages.indexOf(oe),de.texturePosition.x=ne.x,de.texturePosition.y=ne.y,de.texturePositionClipSpace.x=ne.x/oe.canvas.width,de.texturePositionClipSpace.y=ne.y/oe.canvas.height,de.sizeClipSpace.x/=oe.canvas.width,de.sizeClipSpace.y/=oe.canvas.height,ne.height=Math.max(ne.height,de.size.y),ne.x+=de.size.x,oe.ctx.putImageData(xe,de.texturePosition.x-this._workBoundingBox.left,de.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,de.size.x,de.size.y),oe.addGlyph(de),oe.version++,de}_findGlyphBoundingBox(p,S,y,b,w,L){S.top=0;const B=b?this._config.deviceCellHeight:this._tmpCanvas.height,I=b?this._config.deviceCellWidth:y;let T=!1;for(let M=0;M<B;M++){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.top=M,T=!0;break}}if(T)break}S.left=0,T=!1;for(let M=0;M<L+I;M++){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.left=M,T=!0;break}}if(T)break}S.right=I,T=!1;for(let M=L+I-1;M>=L;M--){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.right=M,T=!0;break}}if(T)break}S.bottom=B,T=!1;for(let M=B-1;M>=0;M--){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.bottom=M,T=!0;break}}if(T)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+L+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+L+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=h;class v{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(p){this._glyphs.push(p),this._usedPixels+=p.size.x*p.size.y}constructor(p,S,y){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],y)for(const b of y)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=m(p,S,S),this.ctx=(0,n.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function u(c,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,L=p.rgba>>>8&255,B=S.rgba>>>24,I=S.rgba>>>16&255,T=S.rgba>>>8&255,M=Math.floor((Math.abs(b-B)+Math.abs(w-I)+Math.abs(L-T))/12);let C=!0;for(let x=0;x<c.data.length;x+=4)c.data[x]===b&&c.data[x+1]===w&&c.data[x+2]===L||y&&Math.abs(c.data[x]-b)+Math.abs(c.data[x+1]-w)+Math.abs(c.data[x+2]-L)<M?c.data[x+3]=0:C=!1;return C}function m(c,p,S){const y=c.createElement("canvas");return y.width=p,y.height=S,y}},160:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,l=0,d=0,n=0;var _,g,f,o,e;function i(r){const h=r.toString(16);return h.length<2?"0"+h:h}function s(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(h,v,u,m){return m!==void 0?`#${i(h)}${i(v)}${i(u)}${i(m)}`:`#${i(h)}${i(v)}${i(u)}`},r.toRgba=function(h,v,u,m=255){return(h<<24|v<<16|u<<8|m)>>>0},r.toColor=function(h,v,u,m){return{css:r.toCss(h,v,u,m),rgba:r.toRgba(h,v,u,m)}}}(_||(t.channels=_={})),function(r){function h(v,u){return n=Math.round(255*u),[a,l,d]=e.toChannels(v.rgba),{css:_.toCss(a,l,d,n),rgba:_.toRgba(a,l,d,n)}}r.blend=function(v,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,c=u.rgba>>16&255,p=u.rgba>>8&255,S=v.rgba>>24&255,y=v.rgba>>16&255,b=v.rgba>>8&255;return a=S+Math.round((m-S)*n),l=y+Math.round((c-y)*n),d=b+Math.round((p-b)*n),{css:_.toCss(a,l,d),rgba:_.toRgba(a,l,d)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,u,m){const c=e.ensureContrastRatio(v.rgba,u.rgba,m);if(c)return _.toColor(c>>24&255,c>>16&255,c>>8&255)},r.opaque=function(v){const u=(255|v.rgba)>>>0;return[a,l,d]=e.toChannels(u),{css:_.toCss(a,l,d),rgba:u}},r.opacity=h,r.multiplyOpacity=function(v,u){return n=255&v.rgba,h(v,n*u/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}}(g||(t.color=g={})),function(r){let h,v;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(h=m,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),_.toColor(a,l,d);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),_.toColor(a,l,d,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),l=parseInt(m[2]),d=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,l,d,n);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=u,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,l,d,n]=h.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,l,d,n),css:u}}}(f||(t.css=f={})),function(r){function h(v,u,m){const c=v/255,p=u/255,S=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4))+.7152*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}r.relativeLuminance=function(v){return h(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=h}(o||(t.rgb=o={})),function(r){function h(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b>0||w>0||L>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),L-=Math.max(0,Math.ceil(.1*L)),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function v(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b<255||w<255||L<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),L=Math.min(255,L+Math.ceil(.1*(255-L))),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(u,m){if(n=(255&m)/255,n===1)return m;const c=m>>24&255,p=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((c-y)*n),l=b+Math.round((p-b)*n),d=w+Math.round((S-w)*n),_.toRgba(a,l,d)},r.ensureContrastRatio=function(u,m,c){const p=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(s(p,S)<c){if(S<p){const w=h(u,m,c),L=s(p,o.relativeLuminance(w>>8));if(L<c){const B=v(u,m,c);return L>s(p,o.relativeLuminance(B>>8))?w:B}return w}const y=v(u,m,c),b=s(p,o.relativeLuminance(y>>8));if(b<c){const w=h(u,m,c);return b>s(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=h,r.increaseLuminance=v,r.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(e||(t.rgba=e={})),t.toPaddedHex=i,t.contrastRatio=s},345:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const d=[];for(let n=0;n<this._listeners.length;n++)d.push(this._listeners[n]);for(let n=0;n<d.length;n++)d[n].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,l){return a(d=>l.fire(d))},t.runAndSubscribe=function(a,l){return l(void 0),a(d=>l(d))}},859:(O,t)=>{function a(l){for(const d of l)d.dispose();l.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 d=this._disposables.indexOf(l);d!==-1&&this._disposables.splice(d,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var d;this._isDisposed||l===this._value||((d=this._value)==null||d.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=a,t.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},485:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,n,_){this._data[d]||(this._data[d]={}),this._data[d][n]=_}get(d,n){return this._data[d]?this._data[d][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(l,d,n,_,g){this._data.get(l,d)||this._data.set(l,d,new a),this._data.get(l,d).set(n,_,g)}get(l,d,n,_){var g;return(g=this._data.get(l,d))==null?void 0:g.get(n,_)}clear(){this._data.clear()}}},399:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,l=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=a(399);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(g){this._idleCallback=void 0;let f=0,o=0,e=g.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),i=g.timeRemaining(),1.5*o>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const f=Date.now()+g;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},147:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}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}}t.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},782:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=a(133),d=a(855),n=a(147);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new _;return o.setFromCharData(f),o}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(f){this.fg=f[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[d.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[d.CHAR_DATA_CHAR_INDEX].length===2){const e=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[d.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[d.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=_},855:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,l=0,d=a.length){let n="";for(let _=l;_<d;++_){let g=a[_];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const d=a.length;if(!d)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?l[n++]=1024*(this._interim-55296)+g-56320+65536:(l[n++]=this._interim,l[n++]=g),this._interim=0}for(let g=_;g<d;++g){const f=a.charCodeAt(g);if(55296<=f&&f<=56319){if(++g>=d)return this._interim=f,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?l[n++]=1024*(f-55296)+o-56320+65536:(l[n++]=f,l[n++]=o)}else f!==65279&&(l[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const d=a.length;if(!d)return 0;let n,_,g,f,o=0,e=0,i=0;if(this.interim[0]){let h=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,m=0;for(;(u=63&this.interim[++m])&&m<4;)v<<=6,v|=u;const c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=c-m;for(;i<p;){if(i>=d)return 0;if(u=a[i++],(192&u)!=128){i--,h=!0;break}this.interim[m++]=u,v<<=6,v|=63&u}h||(c===2?v<128?i--:l[o++]=v:c===3?v<2048||v>=55296&&v<=57343||v===65279||(l[o++]=v):v<65536||v>1114111||(l[o++]=v)),this.interim.fill(0)}const s=d-4;let r=i;for(;r<d;){for(;!(!(r<s)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(f=a[r+3]));)l[o++]=n,l[o++]=_,l[o++]=g,l[o++]=f,r+=4;if(n=a[r++],n<128)l[o++]=n;else if((224&n)==192){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}l[o++]=e}else if((240&n)==224){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(e=(15&n)<<12|(63&_)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;l[o++]=e}else if((248&n)==240){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&f,e<65536||e>1114111)continue;l[o++]=e}}return o}}},776:function(O,t,a){var l=this&&this.__decorate||function(e,i,s,r){var h,v=arguments.length,u=v<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,s):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,i,s,r);else for(var m=e.length-1;m>=0;m--)(h=e[m])&&(u=(v<3?h(u):v>3?h(i,s,u):h(i,s))||u);return v>3&&u&&Object.defineProperty(i,s,u),u},d=this&&this.__param||function(e,i){return function(s,r){i(s,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),_=a(97),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){var s;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};t.LogService=o=l([d(0,_.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,i,s){if(typeof s.value!="function")throw new Error("not supported");const r=s.value;s.value=function(...h){if(f.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,h);f.trace(`GlyphRenderer#${r.name}(${h.map(u=>JSON.stringify(u)).join(", ")})`);const v=r.apply(this,h);return f.trace(`GlyphRenderer#${r.name} return`,v),v}}},726:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(d){return d[l]||[]},t.createDecorator=function(d){if(t.serviceRegistry.has(d))return t.serviceRegistry.get(d);const n=function(_,g,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,i){e[a]===e?e[l].push({id:o,index:i}):(e[l]=[{id:o,index:i}],e[a]=e)})(n,_,f)};return n.toString=()=>d,t.serviceRegistry.set(d,n),n}},97:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const l=a(726);var d;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(d||(t.LogLevelEnum=d={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")}},G={};function z(O){var t=G[O];if(t!==void 0)return t.exports;var a=G[O]={exports:{}};return ee[O].call(a.exports,a,a.exports,z),a.exports}var Z={};return(()=>{var O=Z;Object.defineProperty(O,"__esModule",{value:!0}),O.WebglAddon=void 0;const t=z(345),a=z(859),l=z(399),d=z(666),n=z(776);class _ extends a.Disposable{constructor(f){if(l.isSafari&&(0,l.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,i=o.optionsService,s=o,r=s._renderService,h=s._characterJoinerService,v=s._charSizeService,u=s._coreBrowserService,m=s._decorationService,c=s._logService,p=s._themeService;(0,n.setTraceLogger)(c),this._renderer=this.register(new d.WebglRenderer(f,h,v,u,e,m,i,p,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}O.WebglAddon=_})(),Z})())})(Et);var vs=Et.exports;const gt=1,gs=[500,1e3,2e3,4e3,8e3],ps=3e3;function ms({url:U,binaryType:ie="arraybuffer",WebSocketImpl:ee=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:G=setTimeout,clearTimeoutImpl:z=clearTimeout,backoff:Z=gs,stableMs:O=ps,onOpen:t=()=>{},onMessage:a=()=>{},onState:l=()=>{}}){let d=null,n=0,_=!1,g=0,f=0;const o=typeof U=="function"?U:()=>U,e=()=>{f&&(z(f),f=0)},i=()=>{l(n===0?"connecting":"reconnecting");let v;try{v=new ee(o())}catch{r();return}d=v;try{v.binaryType=ie}catch{}v.onopen=()=>{v===d&&(l("open"),f=G(()=>{n=0,f=0},O),t(h))},v.onmessage=u=>{v===d&&a(u)},v.onclose=()=>{v===d&&s()},v.onerror=()=>{}},s=()=>{e(),!_&&r()},r=()=>{l("reconnecting");const v=Z[Math.min(n,Z.length-1)];n++,g=G(()=>{g=0,i()},v)},h={send(v){return d&&d.readyState===gt?(d.send(v),!0):!1},isOpen(){return!!d&&d.readyState===gt},close(){if(_=!0,g&&(z(g),g=0),e(),d)try{d.close()}catch{}d=null},get raw(){return d}};return i(),h}function Ss(U){var z;const ie=U.buffer.active;let ee=!1,G=!1;for(let Z=ie.baseY;Z<ie.baseY+U.rows;Z++){const O=((z=ie.getLine(Z))==null?void 0:z.translateToString(!0))||"";/^\s{0,6}❯\s+\S/.test(O)&&(ee=!0),/esc/i.test(O)&&/(enter|↵|↑|↓|select|confirm)/i.test(O)&&(G=!0)}return ee&&G}function Cs(U){var ie;return(ie=navigator.clipboard)!=null&&ie.writeText?navigator.clipboard.writeText(U).then(()=>!0).catch(()=>pt(U)):Promise.resolve(pt(U))}function pt(U){var z;const ie=document.activeElement,ee=document.createElement("textarea");ee.value=U,ee.setAttribute("readonly",""),ee.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(ee);let G=!1;try{ee.select(),ee.setSelectionRange(0,U.length),G=document.execCommand("copy")}catch{G=!1}ee.remove();try{(z=ie==null?void 0:ie.focus)==null||z.call(ie)}catch{}return G||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),G}function bs({sessionId:U,active:ie=!0,onMenu:ee}){const G=K.useRef(null),z=K.useRef(null),Z=K.useRef(null),O=K.useRef({cols:0,rows:0}),t=K.useRef(null),a=K.useRef(!1),l=K.useRef(!1),d=K.useRef(!0),[n,_]=K.useState(!1),[g,f]=K.useState("connecting"),o=K.useRef(ee);return o.current=ee,K.useEffect(()=>{a.current=!1,l.current=!1;const e=new _s.Terminal({fontSize:11,fontFamily:"Menlo, monospace",cursorBlink:!1,disableStdin:!0,scrollback:0,macOptionClickForcesSelection:!0,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#c9d1d9",selectionBackground:"#264f78",selectionForeground:"#f0f6fc",selectionInactiveBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});z.current=e;const i=new fs.FitAddon;e.loadAddon(i),e.open(G.current);try{e._core._selectionService.shouldForceSelection=()=>!0}catch{}try{e._core.focus=()=>{}}catch{}const r=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/sessions/${U}/socket`,h=()=>{try{const T=G.current;if(T&&T.clientWidth>=40&&T.clientHeight>=40){const M=i.proposeDimensions();if(M&&M.cols>0&&M.rows>0&&!(M.cols<20&&T.clientWidth>200))return a.current=!0,`${r}?cols=${M.cols}&rows=${M.rows}`}}catch{}return a.current=!1,r};let v=null;const u=()=>{const T=G.current;if(!T||T.clientWidth<40||T.clientHeight<40)return;try{i.fit()}catch{return}const{cols:M,rows:C}=e;if(!M||!C||M<20&&T.clientWidth>200)return;const x=O.current;if(M===x.cols&&C===x.rows)return;O.current={cols:M,rows:C};const R=d.current;d.current=!1,v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"resize",cols:M,rows:C,full:R}))};t.current=u;let m=[],c=0;const p=()=>{if(c=0,!m.length)return;let T=0;for(const x of m)T+=x.length;const M=new Uint8Array(T);let C=0;for(const x of m)M.set(x,C),C+=x.length;m=[],e.write(M)};v=ms({url:h,onState:f,onOpen:()=>{m=[],c&&(cancelAnimationFrame(c),c=0),e.reset(),d.current=!0,O.current={cols:0,rows:0},u()},onMessage:T=>{T.data instanceof ArrayBuffer&&(m.push(new Uint8Array(T.data)),c||(c=requestAnimationFrame(p)))}}),e.attachCustomWheelEventHandler(T=>{const M=G.current;if(M&&e.cols&&e.rows){const C=M.getBoundingClientRect(),x=(W,X)=>Math.min(X,Math.max(1,W)),R=x(Math.floor((T.clientX-C.left)/(C.width/e.cols))+1,e.cols),D=x(Math.floor((T.clientY-C.top)/(C.height/e.rows))+1,e.rows),N=Math.min(5,Math.max(1,Math.round(Math.abs(T.deltaY)/40)));v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"wheel",up:T.deltaY<0,col:R,row:D,ticks:N}))}return T.preventDefault(),!1});let S;const y=G.current,b=T=>{if(!(T.metaKey||T.ctrlKey)||T.key!=="c"&&T.key!=="C"||!y||y.offsetParent===null)return;const M=e.getSelection();if(!M)return;const C=document.activeElement;C&&(C.tagName==="TEXTAREA"||C.tagName==="INPUT")&&C.selectionStart!==C.selectionEnd||(T.preventDefault(),T.stopPropagation(),Cs(M).then(x=>{x&&(_(!0),clearTimeout(S),S=setTimeout(()=>_(!1),1200))}))};document.addEventListener("keydown",b);const w=requestAnimationFrame(u),L=G.current.closest(".si-term");L&&L.addEventListener("animationend",u);const B=[60,180,320].map(T=>setTimeout(u,T)),I=new ResizeObserver(u);return I.observe(G.current),window.addEventListener("resize",u),()=>{cancelAnimationFrame(w),c&&cancelAnimationFrame(c),clearTimeout(S),document.removeEventListener("keydown",b),B.forEach(clearTimeout),L&&L.removeEventListener("animationend",u),I.disconnect(),window.removeEventListener("resize",u),v.close(),e.dispose(),z.current=null,Z.current=null,t.current=null}},[U]),K.useEffect(()=>{const e=z.current;if(!e||!ie)return;const i=setInterval(()=>{var s;try{(s=o.current)==null||s.call(o,U,Ss(e))}catch{}},700);return()=>{var s;clearInterval(i),(s=o.current)==null||s.call(o,U,!1)}},[U,ie]),K.useEffect(()=>{const e=z.current;if(e){if(ie){if(!Z.current)try{const i=new vs.WebglAddon;i.onContextLoss(()=>{try{i.dispose()}catch{}Z.current=null,O.current={cols:0,rows:0},requestAnimationFrame(()=>{var s;(s=t.current)==null||s.call(t);try{e.refresh(0,e.rows-1)}catch{}})}),e.loadAddon(i),Z.current=i}catch{Z.current=null}l.current||(l.current=!0,a.current||(e.reset(),d.current=!0,O.current={cols:0,rows:0})),requestAnimationFrame(()=>{var i;(i=t.current)==null||i.call(t);try{e.refresh(0,e.rows-1)}catch{}})}else if(Z.current){try{Z.current.dispose()}catch{}Z.current=null}}},[U,ie]),F.jsxs("div",{className:"st-wrap",children:[F.jsx("div",{className:"st-host",ref:G}),n&&F.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!n&&g==="reconnecting"&&F.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const ws=[{id:"claude",label:"Claude Code",Glyph:Gt},{id:"codex",label:"Codex",Glyph:Vt}],mt=Object.fromEntries(ws.map(U=>[U.id,U]));function ys({menu:U,onClose:ie,onChanged:ee,onMultiSelect:G}){const z=Ke(),[Z,O]=K.useState(null),[t,a]=K.useState(null),[l,d]=K.useState(""),[n,_]=K.useState(!1),g=K.useRef(null);K.useEffect(()=>{if(U)return window.addEventListener("click",ie),()=>window.removeEventListener("click",ie)},[U,ie]),qe(!!U,ie),qe(!!Z,()=>O(null)),qe(!!t,()=>a(null)),K.useEffect(()=>{Z&&requestAnimationFrame(()=>{var r;return(r=g.current)==null?void 0:r.select()})},[Z]);const f=r=>{var h;r.stopPropagation(),d((((h=U.session.raw)==null?void 0:h.name)??U.session.name)||""),O(U.session),ie()},o=r=>{r.stopPropagation(),G==null||G(U.session),ie()},e=r=>{r.stopPropagation(),a(U.session),ie()},i=()=>{const{id:r}=t;a(null),Qe(`/api/sessions/${r}/close`,{method:"POST"}).catch(()=>{}).finally(()=>ee==null?void 0:ee())},s=async r=>{if(r.preventDefault(),!n){_(!0);try{await Qe(`/api/sessions/${Z.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})}),ee==null||ee()}catch{}finally{_(!1),O(null)}}};return F.jsxs(F.Fragment,{children:[U&&F.jsxs("div",{className:"sess-menu",style:{left:U.x,top:U.y},onClick:r=>r.stopPropagation(),children:[F.jsx("button",{className:"sess-menu-item",onClick:f,children:z("sessionWindow.rename")}),F.jsx("button",{className:"sess-menu-item",onClick:o,children:z("sessionWindow.select")}),F.jsx("button",{className:"sess-menu-item danger",onClick:e,children:z("sessionWindow.close")})]}),Z&&F.jsx(et,{title:z("sessionWindow.renameTitle",{name:_t(Z)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>O(null),children:F.jsxs("form",{className:"sess-rename",onSubmit:s,children:[F.jsx("input",{ref:g,className:"sess-rename-input",value:l,autoFocus:!0,placeholder:z("sessionWindow.renamePlaceholder"),onChange:r=>d(r.target.value)}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>O(null),children:z("common.cancel")}),F.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:n,children:z("common.save")})]})]})}),t&&F.jsx(et,{title:z("sessionWindow.closeTitle",{name:_t(t)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>a(null),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:z("sessionWindow.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>a(null),children:z("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:i,children:z("sessionWindow.close")})]})]})})]})}function Es({ids:U,onCancel:ie,onClosed:ee}){const G=Ke(),[z,Z]=K.useState(!1),O=U.length;qe(z,()=>Z(!1));const t=()=>{Z(!1),Promise.all(U.map(a=>Qe(`/api/sessions/${a}/close`,{method:"POST"}).catch(()=>{}))).finally(()=>ee==null?void 0:ee())};return F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"si-selbar",children:[F.jsx("span",{className:"si-selcount",children:G("sessionSelect.selected",{n:O})}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",disabled:O===0,onClick:()=>Z(!0),children:G("sessionSelect.close")}),F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:ie,children:G("common.cancel")})]}),z&&F.jsx(et,{"data-tip":G("sessionSelect.closeTitle",{n:O}),closeLabel:G("common.close"),className:"sess-rename-modal",onClose:()=>Z(!1),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:G("sessionSelect.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>Z(!1),children:G("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:t,children:G("sessionSelect.close")})]})]})})]})}function xs({sessionId:U,specs:ie=[],sessions:ee=[],onOpenSession:G}){var r;const z=Ke(),[Z,O]=K.useState(null),[t,a]=K.useState(!1),[l,d]=K.useState(null),n=K.useRef(0),_=K.useCallback(()=>{const h=++n.current;return fetch(`/api/sessions/${encodeURIComponent(U)}/evals`).then(v=>v.ok?v.json():Promise.reject()).then(v=>{h===n.current&&O(v)}).catch(()=>{h===n.current&&O(!1)})},[U]);K.useEffect(()=>{O(null),d(null),a(!1),_()},[U,_]);const g=K.useMemo(()=>Z?Z.nodes.map(h=>{const v=Xt(h.scenarios,h.evals),u=v.filter(c=>!c.reading).map(c=>({blind:!0,scenario:c.name,expected:c.expected,tags:c.tags,node:h.id,hue:h.hue,state:"missing"})),m=v.filter(c=>c.reading).map(c=>({...c.reading,expected:c.expected??c.reading.expected,state:c.state,node:h.id,hue:h.hue})).sort((c,p)=>Number(p.inSession)-Number(c.inSession)||(c.ts<p.ts?1:-1));return{node:h,blind:u,rows:m,sessionN:m.filter(c=>c.inSession).length}}):[],[Z]),f=g.reduce((h,v)=>h+v.sessionN,0),o=K.useMemo(()=>g.flatMap(h=>[...h.blind.map(v=>({kind:"blind",key:`blind:${v.node}·${v.scenario}`,item:v})),...h.rows.filter(v=>!t||v.inSession).map(v=>({kind:"eval",key:Yt(v),item:v}))]),[g,t]),e=l&&o.some(h=>h.key===l)?l:((r=o[0])==null?void 0:r.key)??null,i=o.find(h=>h.key===e);if(Z===null)return F.jsx("div",{className:"fv-note",children:z("common.loading")});if(Z===!1)return F.jsx("div",{className:"fv-note",children:z("sessionEval.none")});const s=(i==null?void 0:i.kind)==="eval"?F.jsx(cs,{entry:i.item,specs:ie,sessions:ee,onOpenSession:G,onWrite:_}):(i==null?void 0:i.kind)==="blind"?F.jsxs("div",{className:"an-detail",children:[F.jsxs("header",{className:"an-head",children:[F.jsx("span",{className:"an-title",children:i.item.scenario}),F.jsx("span",{className:"an-node",children:i.item.node})]}),i.item.expected&&F.jsxs("div",{className:"an-expected",children:[F.jsx("b",{children:z("nodeView.eval.expected")})," ",i.item.expected]}),F.jsx("div",{className:"an-hint",children:z("sessionEval.blindHint")})]}):F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")});return F.jsxs("div",{className:"se-pane",children:[F.jsxs("div",{className:"se-gates",children:[Z.gates.map(h=>F.jsxs("span",{className:`se-gate ${h.ok?"ok":"bad"}`,"data-tip":h.detail,children:[h.ok?"✓":"✗"," ",h.label]},h.label)),f>0&&F.jsx("button",{className:`ef-chip ef-stale ${t?"on":""}`,onClick:()=>a(h=>!h),children:z("sessionEval.sessionN",{n:f})}),F.jsx("a",{className:"se-export",href:`/api/sessions/${encodeURIComponent(U)}/proof`,target:"_blank",rel:"noreferrer","data-tip":z("sessionEval.exportTitle"),"aria-label":z("sessionEval.export"),children:F.jsx(He,{name:"download",size:13})})]}),F.jsx(ds,{rowKeys:o.map(h=>h.key),sel:e,onSel:d,detail:s,children:F.jsxs("div",{className:"fv-scroll",children:[o.length===0&&F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")}),g.map(h=>{const v=o.filter(u=>u.item.node===h.node.id);return!v.length&&!h.node.uncoveredFrontend?null:F.jsxs("section",{className:"fv-group",children:[F.jsxs("header",{className:"fv-group-head",children:[F.jsx("span",{className:"fv-group-title",style:{color:`hsl(${h.node.hue} 60% 60%)`},children:h.node.title}),h.node.uncoveredFrontend&&F.jsx("span",{className:"se-warn",children:z("sessionEval.noYatsu")})]}),v.map((u,m)=>{const c=u.kind==="eval"&&!u.item.inSession&&m>0&&v[m-1].kind==="eval"&&v[m-1].item.inSession,p=u.kind==="blind"?F.jsxs("button",{className:`ef-row se-blind ${e===u.key?"sel":""}`,onClick:()=>d(u.key),children:[F.jsx(Jt,{state:"missing"}),F.jsx("span",{className:"ef-scenario",children:u.item.scenario}),F.jsx("span",{className:"ef-time",children:z("sessionEval.unmeasured")})]},u.key):F.jsx(Zt,{e:u.item,selected:e===u.key,onClick:()=>d(u.key)},u.key);return c?[F.jsx("div",{className:"se-divider",children:z("sessionEval.inherited")},`div:${h.node.id}`),p]:p})]},h.node.id)})]})})]})}const Ls=[{name:"type",color:"yellow",button:!0,when:U=>!!U&&U!=="offline",labelKey:"session.typeBtn",titleKey:"session.typeTitle",descKey:"session.cmd.typeDesc"},{name:"eval",color:"cyan",button:!1,when:U=>!!U&&U!=="offline",labelKey:"sessionEval.btn",titleKey:"sessionEval.btnTitle",descKey:"session.cmd.evalDesc"},{name:"merge",color:"green",button:!0,when:U=>U==="review"||U==="done",labelKey:"session.merge",titleKey:"session.cmd.mergeTitle",descKey:"session.cmd.mergeDesc"},{name:"exit",color:"muted",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.exitTitle",descKey:"session.cmd.exitDesc"},{name:"close",color:"red",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function Rs(U,ie){return Ls.filter(ee=>ee.when(U)).map(ee=>({...ee,run:ie[ee.name]}))}const St=()=>F.jsx(He,{name:"paperclip",size:15}),Ct=()=>F.jsx(He,{name:"loader",size:15,className:"si-attach-busy"}),Ds={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End"," ":"Space"},Ze=U=>{var ie;return U.isComposing||((ie=U.nativeEvent)==null?void 0:ie.isComposing)||U.keyCode===229};function ks(U){const ie=Ds[U.key],ee=U.ctrlKey||U.altKey||U.metaKey;let G=null;if(ie?G=ie:ee?/^Key[A-Z]$/.test(U.code)?G=U.shiftKey?U.code.slice(3):U.code.slice(3).toLowerCase():/^Digit[0-9]$/.test(U.code)?G=U.code.slice(5):U.key.length===1&&(G=U.key):U.key.length===1&&(G=U.key),G==null)return null;let z="";return U.ctrlKey&&(z+="C-"),(U.altKey||U.metaKey)&&(z+="M-"),U.shiftKey&&ie&&(z+="S-"),z+G}function As(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({c:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.c)}const Ms=U=>U&&U[0].toUpperCase()+U.slice(1);function Ts(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({p:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.p)}const Bs={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",board:"[board]"};function Ns({sessions:U,specs:ie=[],focusNode:ee,open:G,searchOpen:z=!1,sel:Z,setSel:O,seed:t,onSeedConsumed:a,onClose:l,onPickSession:d,onOpenSession:n,onOpenSearch:_,reload:g}){const f=Ke(),[o,e]=K.useState(""),[i,s]=K.useState(null),[r,h]=K.useState(null),[v,u]=K.useState(!1),[m,c]=K.useState(()=>new Set),[p,S]=K.useState([]),[y,b]=K.useState([]),[w,L]=K.useState({}),[B,I]=K.useState([]),[T,M]=K.useState(()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}}),C=k=>{M(k);try{localStorage.setItem("si.launcher",k)}catch{}},[x,R]=K.useState(!1),[D,N]=K.useState(null),[W,X]=K.useState(!1),[Y,A]=K.useState({}),[E,$]=K.useState("terminal"),[H,V]=K.useState(!1),q=H&&E==="eval",[re,te]=K.useState(!1),[ue,Se]=K.useState(!1),[se,xe]=K.useState(null),[Re,de]=K.useState(null),oe=K.useRef(null),ne=K.useRef(null),J=K.useRef(null),le=K.useRef(null),ge=K.useRef(null),fe=K.useRef("new"),{expanded:Le,toggle:ye}=Qt(),Ee=K.useMemo(()=>es(U,k=>Le.has(k)),[U,Le]),Ce=K.useMemo(()=>Ee.filter(k=>k.type==="row").map(k=>k.s),[Ee]),ve=K.useMemo(()=>["new",...Ce.map(k=>k.id)],[Ce]),ae=K.useMemo(()=>new Set(["new",...U.map(k=>k.id)]),[U]),he=ae.has(Z)?Z:"new";K.useEffect(()=>{G&&!ae.has(Z)&&O("new")},[G,ae,Z,O]);const[Oe,Pe]=ls("spex.siListWidth",240,{min:180,max:480}),Ne=(ee==null?void 0:ee.id)||null,ce=U.find(k=>k.id===he),Me=(ce==null?void 0:ce.liveness)==="offline",$e=Me&&(ce==null?void 0:ce.status)!=="queued",De=w[he]||"",ke=k=>L(P=>({...P,[he]:k}));K.useEffect(()=>{const k=(ce==null?void 0:ce.harness)||"claude";fetch(`/api/slash-commands?harness=${k}`).then(P=>P.json()).then(P=>{Array.isArray(P)&&S(P)}).catch(()=>{})},[ce==null?void 0:ce.harness]),K.useEffect(()=>{qt().then(k=>{Array.isArray(k)&&b(k)}).catch(()=>{})},[]),K.useEffect(()=>{Kt().then(k=>{const P=k==null?void 0:k.launchers;!Array.isArray(P)||!P.length||(I(P),M(j=>P.some(Q=>Q.name===j)?j:k.default&&P.some(Q=>Q.name===k.default)?k.default:P[0].name))}).catch(()=>{})},[]);const Ie=y;K.useEffect(()=>{X(!1),R(!1),s(null),$("terminal")},[he]),K.useEffect(()=>{V(E==="eval")},[E]),K.useEffect(()=>{E==="terminal"&&he!=="new"&&!W&&ce&&ce.liveness!=="offline"&&requestAnimationFrame(()=>{var k;return(k=ne.current)==null?void 0:k.focus()})},[E]),K.useEffect(()=>{(ce==null?void 0:ce.liveness)==="offline"&&X(!1)},[ce==null?void 0:ce.liveness]),K.useEffect(()=>{N(null)},[he]);const We=K.useRef(!1);K.useEffect(()=>{var k;We.current&&!W&&he!=="new"&&(ce==null?void 0:ce.liveness)!=="offline"&&((k=ne.current)==null||k.focus()),We.current=W},[W]);const Ge=K.useRef(new Map),tt=k=>{const P=Ge.current.get(k);if(!P||P.busy||P.keys.length===0)return;const j=P.keys;P.keys=[],P.busy=!0,fetch(`/api/sessions/${k}/rawkey`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keys:j})}).catch(()=>{}).finally(()=>{P.busy=!1,tt(k)})},xt=k=>{const P=he;let j=Ge.current.get(P);j||(j={keys:[],busy:!1},Ge.current.set(P,j)),j.keys.push(k),tt(P)},Lt=(k,P)=>A(j=>j[k]===P?j:{...j,[k]:P}),[Rt,Dt]=K.useState(()=>new Set);K.useEffect(()=>{Dt(k=>{const P=new Set;for(const j of U)j.liveness!=="offline"&&P.add(j.id);if(P.size!==k.size)return P;for(const j of P)if(!k.has(j))return P;return k})},[U]),K.useEffect(()=>{t!=null&&(O("new"),e(t),s(null),a==null||a(),requestAnimationFrame(()=>{const k=oe.current;k&&(k.focus(),k.setSelectionRange(t.length,t.length))}))},[t]),K.useEffect(()=>{if(!G)return;const k=setTimeout(()=>{var P,j;he==="new"?(P=oe.current)==null||P.focus():ce&&ce.liveness!=="offline"&&((j=ne.current)==null||j.focus())},0);return()=>clearTimeout(k)},[G,he,ce==null?void 0:ce.liveness]),K.useEffect(()=>{const k=oe.current;!k||he!=="new"||!G||ft(k,parseFloat(getComputedStyle(k).maxHeight)||1/0)},[o,he,G]),K.useEffect(()=>{var j;const k=ne.current;if(!k||he==="new"||!G)return;const P=Math.round((((j=le.current)==null?void 0:j.clientHeight)||360)*.5);k.style.maxHeight=`${P}px`,ft(k,P)},[De,he,G,E,W]);const kt=k=>{const P=k.match(/^\/(\S+)\s*([\s\S]*)$/);if(!P)return k;const j=Ie.find(we=>we.name===P[1]);if(!j)return k;const Q=[],_e=P[2].replace(vt,(we,pe)=>(Q.push(pe),"")).trim(),me=Q.length?Q.map(we=>{const pe=ie.find(Be=>Be.id===we);return pe?`- [[${pe.id}]] — ${os(pe.path)}`:`- [[${we}]]`}).join(`
|
|
66
|
+
}`)),this.register((0,d.toDisposable)(()=>b.deleteProgram(this._program))),this._projectionLocation=(0,l.throwIfFalsy)(b.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=b.createVertexArray(),b.bindVertexArray(this._vertexArrayObject);const w=new Float32Array([0,0,1,0,0,1,1,1]),L=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(L))),b.bindBuffer(b.ARRAY_BUFFER,L),b.bufferData(b.ARRAY_BUFFER,w,b.STATIC_DRAW),b.enableVertexAttribArray(3),b.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const B=new Uint8Array([0,1,2,3]),I=b.createBuffer();this.register((0,d.toDisposable)(()=>b.deleteBuffer(I))),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,I),b.bufferData(b.ELEMENT_ARRAY_BUFFER,B,b.STATIC_DRAW),this._attributesBuffer=(0,l.throwIfFalsy)(b.createBuffer()),this.register((0,d.toDisposable)(()=>b.deleteBuffer(this._attributesBuffer))),b.bindBuffer(b.ARRAY_BUFFER,this._attributesBuffer),b.enableVertexAttribArray(0),b.vertexAttribPointer(0,2,b.FLOAT,!1,g,0),b.vertexAttribDivisor(0,1),b.enableVertexAttribArray(1),b.vertexAttribPointer(1,2,b.FLOAT,!1,g,2*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(1,1),b.enableVertexAttribArray(2),b.vertexAttribPointer(2,4,b.FLOAT,!1,g,4*Float32Array.BYTES_PER_ELEMENT),b.vertexAttribDivisor(2,1),this._updateCachedColors(y.colors),this.register(this._themeService.onChangeColors(T=>{this._updateCachedColors(T),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(c){const p=this._gl;p.useProgram(this._program),p.bindVertexArray(this._vertexArrayObject),p.uniformMatrix4fv(this._projectionLocation,!1,_.PROJECTION_MATRIX),p.bindBuffer(p.ARRAY_BUFFER,this._attributesBuffer),p.bufferData(p.ARRAY_BUFFER,c.attributes,p.DYNAMIC_DRAW),p.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,p.UNSIGNED_BYTE,0,c.count)}handleResize(){this._updateViewportRectangle()}setDimensions(c){this._dimensions=c}_updateCachedColors(c){this._bgFloat=this._colorToFloat32Array(c.background),this._cursorFloat=this._colorToFloat32Array(c.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(c){const p=this._terminal,S=this._vertices;let y,b,w,L,B,I,T,M,C,x,R,D=1;for(y=0;y<p.rows;y++){for(w=-1,L=0,B=0,I=!1,b=0;b<p.cols;b++)T=(y*p.cols+b)*n.RENDER_MODEL_INDICIES_PER_CELL,M=c.cells[T+n.RENDER_MODEL_BG_OFFSET],C=c.cells[T+n.RENDER_MODEL_FG_OFFSET],x=!!(67108864&C),(M!==L||C!==B&&(I||x))&&((L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,b,y)),w=b,L=M,B=C,I=x);(L!==0||I&&B!==0)&&(R=8*D++,this._updateRectangle(S,R,B,L,w,p.cols,y))}S.count=D}updateCursor(c){const p=this._verticesCursor,S=c.cursor;if(!S||S.style==="block")return void(p.count=0);let y,b=0;S.style!=="bar"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(p.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.style==="bar"?S.dpr*S.cursorWidth:S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),S.style!=="underline"&&S.style!=="outline"||(y=8*b++,this._addRectangleFloat(p.attributes,y,S.x*this._dimensions.device.cell.width,(S.y+1)*this._dimensions.device.cell.height-S.dpr,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat)),S.style==="outline"&&(y=8*b++,this._addRectangleFloat(p.attributes,y,S.x*this._dimensions.device.cell.width,S.y*this._dimensions.device.cell.height,S.width*this._dimensions.device.cell.width,S.dpr,this._cursorFloat),y=8*b++,this._addRectangleFloat(p.attributes,y,(S.x+S.width)*this._dimensions.device.cell.width-S.dpr,S.y*this._dimensions.device.cell.height,S.dpr,this._dimensions.device.cell.height,this._cursorFloat)),p.count=b}_updateRectangle(c,p,S,y,b,w,L){if(67108864&S)switch(50331648&S){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&S].rgba;break;case 50331648:o=(16777215&S)<<8;break;default:o=this._themeService.colors.foreground.rgba}else switch(50331648&y){case 16777216:case 33554432:o=this._themeService.colors.ansi[255&y].rgba;break;case 50331648:o=(16777215&y)<<8;break;default:o=this._themeService.colors.background.rgba}c.attributes.length<p+4&&(c.attributes=(0,_.expandFloat32Array)(c.attributes,this._terminal.rows*this._terminal.cols*8)),e=b*this._dimensions.device.cell.width,i=L*this._dimensions.device.cell.height,s=(o>>24&255)/255,r=(o>>16&255)/255,h=(o>>8&255)/255,v=1,this._addRectangle(c.attributes,p,e,i,(w-b)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,s,r,h,v)}_addRectangle(c,p,S,y,b,w,L,B,I,T){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L,c[p+5]=B,c[p+6]=I,c[p+7]=T}_addRectangleFloat(c,p,S,y,b,w,L){c[p]=S/this._dimensions.device.canvas.width,c[p+1]=y/this._dimensions.device.canvas.height,c[p+2]=b/this._dimensions.device.canvas.width,c[p+3]=w/this._dimensions.device.canvas.height,c[p+4]=L[0],c[p+5]=L[1],c[p+6]=L[2],c[p+7]=L[3]}_colorToFloat32Array(c){return new Float32Array([(c.rgba>>24&255)/255,(c.rgba>>16&255)/255,(c.rgba>>8&255)/255,(255&c.rgba)/255])}}t.RectangleRenderer=u},310:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderModel=t.COMBINED_CHAR_BIT_MASK=t.RENDER_MODEL_EXT_OFFSET=t.RENDER_MODEL_FG_OFFSET=t.RENDER_MODEL_BG_OFFSET=t.RENDER_MODEL_INDICIES_PER_CELL=void 0;const l=a(296);t.RENDER_MODEL_INDICIES_PER_CELL=4,t.RENDER_MODEL_BG_OFFSET=1,t.RENDER_MODEL_FG_OFFSET=2,t.RENDER_MODEL_EXT_OFFSET=3,t.COMBINED_CHAR_BIT_MASK=2147483648,t.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=(0,l.createSelectionRenderModel)()}resize(d,n){const _=d*n*t.RENDER_MODEL_INDICIES_PER_CELL;_!==this.cells.length&&(this.cells=new Uint32Array(_),this.lineLengths=new Uint32Array(n))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}}},666:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.JoinedCellData=t.WebglRenderer=void 0;const l=a(820),d=a(274),n=a(627),_=a(457),g=a(56),f=a(374),o=a(345),e=a(859),i=a(147),s=a(782),r=a(855),h=a(965),v=a(742),u=a(310),m=a(733);class c extends e.Disposable{constructor(b,w,L,B,I,T,M,C,x){super(),this._terminal=b,this._characterJoinerService=w,this._charSizeService=L,this._coreBrowserService=B,this._coreService=I,this._decorationService=T,this._optionsService=M,this._themeService=C,this._cursorBlinkStateManager=new e.MutableDisposable,this._charAtlasDisposable=this.register(new e.MutableDisposable),this._observerDisposable=this.register(new e.MutableDisposable),this._model=new u.RenderModel,this._workCell=new s.CellData,this._workCell2=new s.CellData,this._rectangleRenderer=this.register(new e.MutableDisposable),this._glyphRenderer=this.register(new e.MutableDisposable),this._onChangeTextureAtlas=this.register(new o.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new o.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new o.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this.register(new o.EventEmitter),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this.register(new o.EventEmitter),this.onContextLoss=this._onContextLoss.event,this.register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new d.CellColorResolver(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new m.LinkRenderLayer(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,M,this._themeService)],this.dimensions=(0,f.createRenderDimensions)(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this.register(M.onOptionChange(()=>this._handleOptionsChanged())),this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");const R={antialias:!1,depth:!1,preserveDrawingBuffer:x};if(this._gl=this._canvas.getContext("webgl2",R),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextlost",D=>{console.log("webglcontextlost event received"),D.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(D)},3e3)})),this.register((0,l.addDisposableDomListener)(this._canvas,"webglcontextrestored",D=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,n.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(D,N)=>this._setCanvasDevicePixelDimensions(D,N)),this.register(this._coreBrowserService.onWindowChange(D=>{this._observerDisposable.value=(0,g.observeDevicePixelDimensions)(this._canvas,D,(N,W)=>this._setCanvasDevicePixelDimensions(N,W))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement),this.register((0,e.toDisposable)(()=>{var D;for(const N of this._renderLayers)N.dispose();(D=this._canvas.parentElement)==null||D.removeChild(this._canvas),(0,n.removeTerminalFromCache)(this._terminal)}))}get textureAtlas(){var b;return(b=this._charAtlas)==null?void 0:b.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(b,w){var L,B,I,T;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const M of this._renderLayers)M.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(L=this._rectangleRenderer.value)==null||L.setDimensions(this.dimensions),(B=this._rectangleRenderer.value)==null||B.handleResize(),(I=this._glyphRenderer.value)==null||I.setDimensions(this.dimensions),(T=this._glyphRenderer.value)==null||T.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var b;for(const w of this._renderLayers)w.handleBlur(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.pause(),this._requestRedrawViewport()}handleFocus(){var b;for(const w of this._renderLayers)w.handleFocus(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.resume(),this._requestRedrawViewport()}handleSelectionChanged(b,w,L){for(const B of this._renderLayers)B.handleSelectionChanged(this._terminal,b,w,L);this._model.selection.update(this._core,b,w,L),this._requestRedrawViewport()}handleCursorMove(){var b;for(const w of this._renderLayers)w.handleCursorMove(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new v.RectangleRenderer(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new h.GlyphRenderer(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var w;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0)return void(this._isAttached=!1);const b=(0,n.acquireTextureAtlas)(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr);this._charAtlas!==b&&(this._onChangeTextureAtlas.fire(b.pages[0].canvas),this._charAtlasDisposable.value=(0,e.getDisposeArrayDisposable)([(0,o.forwardEvent)(b.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),(0,o.forwardEvent)(b.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)])),this._charAtlas=b,this._charAtlas.warmUp(),(w=this._glyphRenderer.value)==null||w.setAtlas(this._charAtlas)}_clearModel(b){var w;this._model.clear(),b&&((w=this._glyphRenderer.value)==null||w.clear())}clearTextureAtlas(){var b;(b=this._charAtlas)==null||b.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var b;this._clearModel(!0);for(const w of this._renderLayers)w.reset(this._terminal);(b=this._cursorBlinkStateManager.value)==null||b.restartBlinkAnimation(),this._updateCursorBlink()}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,w){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._charSizeService.width&&this._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const L of this._renderLayers)L.handleGridChanged(this._terminal,b,w);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(b,w),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),this._cursorBlinkStateManager.value&&!this._cursorBlinkStateManager.value.isCursorVisible||this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new _.CursorBlinkStateManager(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(b,w){const L=this._core;let B,I,T,M,C,x,R,D,N,W,X,Y,A,E,$=this._workCell;b=S(b,L.rows-1,0),w=S(w,L.rows-1,0);const H=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,V=H-L.buffer.ydisp,q=Math.min(this._terminal.buffer.active.cursorX,L.cols-1);let re=-1;const te=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let ue=!1;for(I=b;I<=w;I++)for(T=I+L.buffer.ydisp,M=L.buffer.lines.get(T),this._model.lineLengths[I]=0,C=this._characterJoinerService.getJoinedCharacters(T),A=0;A<L.cols;A++)if(B=this._cellColorResolver.result.bg,M.loadCell(A,$),A===0&&(B=this._cellColorResolver.result.bg),x=!1,R=A,C.length>0&&A===C[0][0]&&(x=!0,D=C.shift(),$=new p($,M.translateToString(!0,D[0],D[1]),D[1]-D[0]),R=D[1]-1),N=$.getChars(),W=$.getCode(),Y=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._cellColorResolver.resolve($,A,T,this.dimensions.device.cell.width),te&&T===H&&(A===q&&(this._model.cursor={x:q,y:V,width:$.getWidth(),style:this._coreBrowserService.isFocused?L.options.cursorStyle||"block":L.options.cursorInactiveStyle,cursorWidth:L.options.cursorWidth,dpr:this._devicePixelRatio},re=q+$.getWidth()-1),A>=q&&A<=re&&(this._coreBrowserService.isFocused&&(L.options.cursorStyle||"block")==="block"||this._coreBrowserService.isFocused===!1&&L.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),W!==r.NULL_CELL_CODE&&(this._model.lineLengths[I]=A+1),(this._model.cells[Y]!==W||this._model.cells[Y+u.RENDER_MODEL_BG_OFFSET]!==this._cellColorResolver.result.bg||this._model.cells[Y+u.RENDER_MODEL_FG_OFFSET]!==this._cellColorResolver.result.fg||this._model.cells[Y+u.RENDER_MODEL_EXT_OFFSET]!==this._cellColorResolver.result.ext)&&(ue=!0,N.length>1&&(W|=u.COMBINED_CHAR_BIT_MASK),this._model.cells[Y]=W,this._model.cells[Y+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[Y+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[Y+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext,X=$.getWidth(),this._glyphRenderer.value.updateCell(A,I,W,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,N,X,B),x))for($=this._workCell,A++;A<R;A++)E=(I*L.cols+A)*u.RENDER_MODEL_INDICIES_PER_CELL,this._glyphRenderer.value.updateCell(A,I,r.NULL_CELL_CODE,0,0,0,r.NULL_CELL_CHAR,0,0),this._model.cells[E]=r.NULL_CELL_CODE,this._model.cells[E+u.RENDER_MODEL_BG_OFFSET]=this._cellColorResolver.result.bg,this._model.cells[E+u.RENDER_MODEL_FG_OFFSET]=this._cellColorResolver.result.fg,this._model.cells[E+u.RENDER_MODEL_EXT_OFFSET]=this._cellColorResolver.result.ext;ue&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(b,w){this._canvas.width===b&&this._canvas.height===w||(this._canvas.width=b,this._canvas.height=w,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){const b=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:b,end:b})}}t.WebglRenderer=c;class p extends i.AttributeData{constructor(b,w,L){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=w,this._width=L}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}function S(y,b,w=0){return Math.max(Math.min(y,b),w)}t.JoinedCellData=p},381:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GLTexture=t.expandFloat32Array=t.createShader=t.createProgram=t.PROJECTION_MATRIX=void 0;const l=a(374);function d(n,_,g){const f=(0,l.throwIfFalsy)(n.createShader(_));if(n.shaderSource(f,g),n.compileShader(f),n.getShaderParameter(f,n.COMPILE_STATUS))return f;console.error(n.getShaderInfoLog(f)),n.deleteShader(f)}t.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),t.createProgram=function(n,_,g){const f=(0,l.throwIfFalsy)(n.createProgram());if(n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.VERTEX_SHADER,_))),n.attachShader(f,(0,l.throwIfFalsy)(d(n,n.FRAGMENT_SHADER,g))),n.linkProgram(f),n.getProgramParameter(f,n.LINK_STATUS))return f;console.error(n.getProgramInfoLog(f)),n.deleteProgram(f)},t.createShader=d,t.expandFloat32Array=function(n,_){const g=Math.min(2*n.length,_),f=new Float32Array(g);for(let o=0;o<n.length;o++)f[o]=n[o];return f},t.GLTexture=class{constructor(n){this.texture=n,this.version=-1}}},592:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;const l=a(627),d=a(237),n=a(374),_=a(859);class g extends _.Disposable{constructor(o,e,i,s,r,h,v,u){super(),this._container=e,this._alpha=r,this._coreBrowserService=h,this._optionsService=v,this._themeService=u,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this.register(this._themeService.onChangeColors(m=>{this._refreshCharAtlas(o,m),this.reset(o)})),this.register((0,_.toDisposable)(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=(0,n.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(o){}handleFocus(o){}handleCursorMove(o){}handleGridChanged(o,e,i){}handleSelectionChanged(o,e,i,s=!1){}_setTransparency(o,e){if(e===this._alpha)return;const i=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(o,this._themeService.colors),this.handleGridChanged(o,0,o.rows-1)}_refreshCharAtlas(o,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=(0,l.acquireTextureAtlas)(o,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(o,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(o,this._themeService.colors)}_fillBottomLineAtCells(o,e,i=1){this._ctx.fillRect(o*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(o,e,i,s){this._alpha?this._ctx.clearRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(o,e,i,s){this._ctx.font=this._getFont(o,!1,!1),this._ctx.textBaseline=d.TEXT_BASELINE,this._clipCell(i,s,e.getWidth()),this._ctx.fillText(e.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(o,e,i){this._ctx.beginPath(),this._ctx.rect(o*this._deviceCellWidth,e*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(o,e,i){return`${i?"italic":""} ${e?o.options.fontWeightBold:o.options.fontWeight} ${o.options.fontSize*this._coreBrowserService.dpr}px ${o.options.fontFamily}`}}t.BaseRenderLayer=g},733:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkRenderLayer=void 0;const l=a(197),d=a(237),n=a(592);class _ extends n.BaseRenderLayer{constructor(f,o,e,i,s,r,h){super(e,f,"link",o,!0,s,r,h),this.register(i.onShowLinkUnderline(v=>this._handleShowLinkUnderline(v))),this.register(i.onHideLinkUnderline(v=>this._handleHideLinkUnderline(v)))}resize(f,o){super.resize(f,o),this._state=void 0}reset(f){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const f=this._state.y2-this._state.y1-1;f>0&&this._clearCells(0,this._state.y1+1,this._state.cols,f),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(f){if(f.fg===d.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._themeService.colors.background.css:f.fg!==void 0&&(0,l.is256Color)(f.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[f.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,f.y1===f.y2)this._fillBottomLineAtCells(f.x1,f.y1,f.x2-f.x1);else{this._fillBottomLineAtCells(f.x1,f.y1,f.cols-f.x1);for(let o=f.y1+1;o<f.y2;o++)this._fillBottomLineAtCells(0,o,f.cols);this._fillBottomLineAtCells(0,f.y2,f.x2)}this._state=f}_handleHideLinkUnderline(f){this._clearCurrentLink()}}t.LinkRenderLayer=_},820:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(a,l,d,n){a.addEventListener(l,d,n);let _=!1;return{dispose:()=>{_||(_=!0,a.removeEventListener(l,d,n))}}}},274:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellColorResolver=void 0;const l=a(855),d=a(160),n=a(374);let _,g=0,f=0,o=!1,e=!1,i=!1,s=0;t.CellColorResolver=class{constructor(r,h,v,u,m,c){this._terminal=r,this._optionService=h,this._selectionRenderModel=v,this._decorationService=u,this._coreBrowserService=m,this._themeService=c,this.result={fg:0,bg:0,ext:0}}resolve(r,h,v,u){if(this.result.bg=r.bg,this.result.fg=r.fg,this.result.ext=268435456&r.bg?r.extended.ext:0,f=0,g=0,e=!1,o=!1,i=!1,_=this._themeService.colors,s=0,r.getCode()!==l.NULL_CELL_CODE&&r.extended.underlineStyle===4){const m=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));s=h*u%(2*Math.round(m))}if(this._decorationService.forEachDecorationAtCell(h,v,"bottom",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),i=this._selectionRenderModel.isCellSelected(this._terminal,h,v),i){if(67108864&this.result.fg||50331648&this.result.bg){if(67108864&this.result.fg)switch(50331648&this.result.fg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:f=(16777215&this.result.fg)<<8|255;break;default:f=this._themeService.colors.foreground.rgba}else switch(50331648&this.result.bg){case 16777216:case 33554432:f=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:f=(16777215&this.result.bg)<<8|255}f=d.rgba.blend(f,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}else f=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(e=!0,_.selectionForeground&&(g=_.selectionForeground.rgba>>8&16777215,o=!0),(0,n.treatGlyphAsBackgroundColor)(r.getCode())){if(67108864&this.result.fg&&!(50331648&this.result.bg))g=(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(67108864&this.result.fg)switch(50331648&this.result.bg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 50331648:g=(16777215&this.result.bg)<<8|255}else switch(50331648&this.result.fg){case 16777216:case 33554432:g=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 50331648:g=(16777215&this.result.fg)<<8|255;break;default:g=this._themeService.colors.foreground.rgba}g=d.rgba.blend(g,4294967040&(this._coreBrowserService.isFocused?_.selectionBackgroundOpaque:_.selectionInactiveBackgroundOpaque).rgba|128)>>8&16777215}o=!0}}this._decorationService.forEachDecorationAtCell(h,v,"top",m=>{m.backgroundColorRGB&&(f=m.backgroundColorRGB.rgba>>8&16777215,e=!0),m.foregroundColorRGB&&(g=m.foregroundColorRGB.rgba>>8&16777215,o=!0)}),e&&(f=i?-16777216&r.bg&-134217729|f|50331648:-16777216&r.bg|f|50331648),o&&(g=-16777216&r.fg&-67108865|g|50331648),67108864&this.result.fg&&(e&&!o&&(g=50331648&this.result.bg?-134217728&this.result.fg|67108863&this.result.bg:-134217728&this.result.fg|16777215&_.background.rgba>>8|50331648,o=!0),!e&&o&&(f=50331648&this.result.fg?-67108864&this.result.bg|67108863&this.result.fg:-67108864&this.result.bg|16777215&_.foreground.rgba>>8|50331648,e=!0)),_=void 0,this.result.bg=e?f:this.result.bg,this.result.fg=o?g:this.result.fg,this.result.ext&=536870911,this.result.ext|=s<<29&3758096384}}},627:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireTextureAtlas=void 0;const l=a(509),d=a(197),n=[];t.acquireTextureAtlas=function(_,g,f,o,e,i,s,r){const h=(0,d.generateConfig)(o,e,i,s,g,f,r);for(let m=0;m<n.length;m++){const c=n[m],p=c.ownedBy.indexOf(_);if(p>=0){if((0,d.configEquals)(c.config,h))return c.atlas;c.ownedBy.length===1?(c.atlas.dispose(),n.splice(m,1)):c.ownedBy.splice(p,1);break}}for(let m=0;m<n.length;m++){const c=n[m];if((0,d.configEquals)(c.config,h))return c.ownedBy.push(_),c.atlas}const v=_._core,u={atlas:new l.TextureAtlas(document,h,v.unicodeService),config:h,ownedBy:[_]};return n.push(u),u.atlas},t.removeTerminalFromCache=function(_){for(let g=0;g<n.length;g++){const f=n[g].ownedBy.indexOf(_);if(f!==-1){n[g].ownedBy.length===1?(n[g].atlas.dispose(),n.splice(g,1)):n[g].ownedBy.splice(f,1);break}}}},197:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.is256Color=t.configEquals=t.generateConfig=void 0;const l=a(160);t.generateConfig=function(d,n,_,g,f,o,e){const i={foreground:o.foreground,background:o.background,cursor:l.NULL_COLOR,cursorAccent:l.NULL_COLOR,selectionForeground:l.NULL_COLOR,selectionBackgroundTransparent:l.NULL_COLOR,selectionBackgroundOpaque:l.NULL_COLOR,selectionInactiveBackgroundTransparent:l.NULL_COLOR,selectionInactiveBackgroundOpaque:l.NULL_COLOR,ansi:o.ansi.slice(),contrastCache:o.contrastCache,halfContrastCache:o.halfContrastCache};return{customGlyphs:f.customGlyphs,devicePixelRatio:e,letterSpacing:f.letterSpacing,lineHeight:f.lineHeight,deviceCellWidth:d,deviceCellHeight:n,deviceCharWidth:_,deviceCharHeight:g,fontFamily:f.fontFamily,fontSize:f.fontSize,fontWeight:f.fontWeight,fontWeightBold:f.fontWeightBold,allowTransparency:f.allowTransparency,drawBoldTextInBrightColors:f.drawBoldTextInBrightColors,minimumContrastRatio:f.minimumContrastRatio,colors:i}},t.configEquals=function(d,n){for(let _=0;_<d.colors.ansi.length;_++)if(d.colors.ansi[_].rgba!==n.colors.ansi[_].rgba)return!1;return d.devicePixelRatio===n.devicePixelRatio&&d.customGlyphs===n.customGlyphs&&d.lineHeight===n.lineHeight&&d.letterSpacing===n.letterSpacing&&d.fontFamily===n.fontFamily&&d.fontSize===n.fontSize&&d.fontWeight===n.fontWeight&&d.fontWeightBold===n.fontWeightBold&&d.allowTransparency===n.allowTransparency&&d.deviceCharWidth===n.deviceCharWidth&&d.deviceCharHeight===n.deviceCharHeight&&d.drawBoldTextInBrightColors===n.drawBoldTextInBrightColors&&d.minimumContrastRatio===n.minimumContrastRatio&&d.colors.foreground.rgba===n.colors.foreground.rgba&&d.colors.background.rgba===n.colors.background.rgba},t.is256Color=function(d){return(50331648&d)==16777216||(50331648&d)==33554432}},237:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const l=a(399);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=l.isFirefox||l.isLegacyEdge?"bottom":"ideographic"},457:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CursorBlinkStateManager=void 0,t.CursorBlinkStateManager=class{constructor(a,l){this._renderCallback=a,this._coreBrowserService=l,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const l=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,l>0)return void this._restartInterval(l)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const l=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(l)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}}},860:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tryDrawCustomChar=t.powerlineDefinitions=t.boxDrawingDefinitions=t.blockElementDefinitions=void 0;const l=a(374);t.blockElementDefinitions={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const d={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]};t.boxDrawingDefinitions={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╒":{1:(o,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(o,e)=>`M${.5-o},1 L${.5-o},.5 L1,.5 M${.5+o},.5 L${.5+o},1`},"╔":{1:(o,e)=>`M1,${.5-e} L${.5-o},${.5-e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╕":{1:(o,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(o,e)=>`M${.5+o},1 L${.5+o},.5 L0,.5 M${.5-o},.5 L${.5-o},1`},"╗":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5+o},${.5-e} L${.5+o},1`},"╘":{1:(o,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(o,e)=>`M1,.5 L${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╚":{1:(o,e)=>`M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0 M1,${.5+e} L${.5-o},${.5+e} L${.5-o},0`},"╛":{1:(o,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(o,e)=>`M0,.5 L${.5+o},.5 L${.5+o},0 M${.5-o},.5 L${.5-o},0`},"╝":{1:(o,e)=>`M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M0,${.5+e} L${.5+o},${.5+e} L${.5+o},0`},"╞":{1:(o,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1 M${.5+o},.5 L1,.5`},"╠":{1:(o,e)=>`M${.5-o},0 L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╡":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(o,e)=>`M0,.5 L${.5-o},.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╣":{1:(o,e)=>`M${.5+o},0 L${.5+o},1 M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0`},"╤":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},1 M${.5+o},.5 L${.5+o},1`},"╦":{1:(o,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1`},"╧":{1:(o,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},.5 L${.5-o},0 M${.5+o},.5 L${.5+o},0`},"╩":{1:(o,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╪":{1:(o,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(o,e)=>`M0,.5 L1,.5 M${.5-o},0 L${.5-o},1 M${.5+o},0 L${.5+o},1`},"╬":{1:(o,e)=>`M0,${.5+e} L${.5-o},${.5+e} L${.5-o},1 M1,${.5+e} L${.5+o},${.5+e} L${.5+o},1 M0,${.5-e} L${.5-o},${.5-e} L${.5-o},0 M1,${.5-e} L${.5+o},${.5-e} L${.5+o},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(o,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(o,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},t.powerlineDefinitions={"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}},t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.powerlineDefinitions[""]=t.powerlineDefinitions[""],t.tryDrawCustomChar=function(o,e,i,s,r,h,v,u){const m=t.blockElementDefinitions[e];if(m)return function(y,b,w,L,B,I){for(let T=0;T<b.length;T++){const M=b[T],C=B/8,x=I/8;y.fillRect(w+M.x*C,L+M.y*x,M.w*C,M.h*x)}}(o,m,i,s,r,h),!0;const c=d[e];if(c)return function(y,b,w,L,B,I){let T=n.get(b);T||(T=new Map,n.set(b,T));const M=y.fillStyle;if(typeof M!="string")throw new Error(`Unexpected fillStyle type "${M}"`);let C=T.get(M);if(!C){const x=b[0].length,R=b.length,D=y.canvas.ownerDocument.createElement("canvas");D.width=x,D.height=R;const N=(0,l.throwIfFalsy)(D.getContext("2d")),W=new ImageData(x,R);let X,Y,A,E;if(M.startsWith("#"))X=parseInt(M.slice(1,3),16),Y=parseInt(M.slice(3,5),16),A=parseInt(M.slice(5,7),16),E=M.length>7&&parseInt(M.slice(7,9),16)||1;else{if(!M.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${M}" when drawing pattern glyph`);[X,Y,A,E]=M.substring(5,M.length-1).split(",").map($=>parseFloat($))}for(let $=0;$<R;$++)for(let H=0;H<x;H++)W.data[4*($*x+H)]=X,W.data[4*($*x+H)+1]=Y,W.data[4*($*x+H)+2]=A,W.data[4*($*x+H)+3]=b[$][H]*(255*E);N.putImageData(W,0,0),C=(0,l.throwIfFalsy)(y.createPattern(D,null)),T.set(M,C)}y.fillStyle=C,y.fillRect(w,L,B,I)}(o,c,i,s,r,h),!0;const p=t.boxDrawingDefinitions[e];if(p)return function(y,b,w,L,B,I,T){y.strokeStyle=y.fillStyle;for(const[M,C]of Object.entries(b)){let x;y.beginPath(),y.lineWidth=T*Number.parseInt(M),x=typeof C=="function"?C(.15,.15/I*B):C;for(const R of x.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!0,T))}y.stroke(),y.closePath()}}(o,p,i,s,r,h,u),!0;const S=t.powerlineDefinitions[e];return!!S&&(function(y,b,w,L,B,I,T,M){const C=new Path2D;C.rect(w,L,B,I),y.clip(C),y.beginPath();const x=T/12;y.lineWidth=M*x;for(const R of b.d.split(" ")){const D=R[0],N=g[D];if(!N){console.error(`Could not find drawing instructions for "${D}"`);continue}const W=R.substring(1).split(",");W[0]&&W[1]&&N(y,f(W,B,I,w,L,!1,M,(b.leftPadding??0)*(x/2),(b.rightPadding??0)*(x/2)))}b.type===1?(y.strokeStyle=y.fillStyle,y.stroke()):y.fill(),y.closePath()}(o,S,i,s,r,h,v,u),!0)};const n=new Map;function _(o,e,i=0){return Math.max(Math.min(o,e),i)}const g={C:(o,e)=>o.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(o,e)=>o.lineTo(e[0],e[1]),M:(o,e)=>o.moveTo(e[0],e[1])};function f(o,e,i,s,r,h,v,u=0,m=0){const c=o.map(p=>parseFloat(p)||parseInt(p));if(c.length<2)throw new Error("Too few arguments for instruction");for(let p=0;p<c.length;p+=2)c[p]*=e-u*v-m*v,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,e,0)),c[p]+=s+u*v;for(let p=1;p<c.length;p+=2)c[p]*=i,h&&c[p]!==0&&(c[p]=_(Math.round(c[p]+.5)-.5,i,0)),c[p]+=r;return c}},56:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.observeDevicePixelDimensions=void 0;const l=a(859);t.observeDevicePixelDimensions=function(d,n,_){let g=new n.ResizeObserver(f=>{const o=f.find(s=>s.target===d);if(!o)return;if(!("devicePixelContentBoxSize"in o))return g==null||g.disconnect(),void(g=void 0);const e=o.devicePixelContentBoxSize[0].inlineSize,i=o.devicePixelContentBoxSize[0].blockSize;e>0&&i>0&&_(e,i)});try{g.observe(d,{box:["device-pixel-content-box"]})}catch{g.disconnect(),g=void 0}return(0,l.toDisposable)(()=>g==null?void 0:g.disconnect())}},374:(O,t)=>{function a(d){return 57508<=d&&d<=57558}function l(d){return d>=128512&&d<=128591||d>=127744&&d<=128511||d>=128640&&d<=128767||d>=9728&&d<=9983||d>=9984&&d<=10175||d>=65024&&d<=65039||d>=129280&&d<=129535||d>=127462&&d<=127487}Object.defineProperty(t,"__esModule",{value:!0}),t.computeNextVariantOffset=t.createRenderDimensions=t.treatGlyphAsBackgroundColor=t.allowRescaling=t.isEmoji=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(d){if(!d)throw new Error("value must not be falsy");return d},t.isPowerlineGlyph=a,t.isRestrictedPowerlineGlyph=function(d){return 57520<=d&&d<=57527},t.isEmoji=l,t.allowRescaling=function(d,n,_,g){return n===1&&_>Math.ceil(1.5*g)&&d!==void 0&&d>255&&!l(d)&&!a(d)&&!function(f){return 57344<=f&&f<=63743}(d)},t.treatGlyphAsBackgroundColor=function(d){return a(d)||function(n){return 9472<=n&&n<=9631}(d)},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},t.computeNextVariantOffset=function(d,n,_=0){return(d-(2*Math.round(n)-_))%(2*Math.round(n))}},296:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSelectionRenderModel=void 0;class a{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(d,n,_,g=!1){if(this.selectionStart=n,this.selectionEnd=_,!n||!_||n[0]===_[0]&&n[1]===_[1])return void this.clear();const f=d.buffers.active.ydisp,o=n[1]-f,e=_[1]-f,i=Math.max(o,0),s=Math.min(e,d.rows-1);i>=d.rows||s<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=g,this.viewportStartRow=o,this.viewportEndRow=e,this.viewportCappedStartRow=i,this.viewportCappedEndRow=s,this.startCol=n[0],this.endCol=_[0])}isCellSelected(d,n,_){return!!this.hasSelection&&(_-=d.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?n>=this.startCol&&_>=this.viewportCappedStartRow&&n<this.endCol&&_<=this.viewportCappedEndRow:n<this.startCol&&_>=this.viewportCappedStartRow&&n>=this.endCol&&_<=this.viewportCappedEndRow:_>this.viewportStartRow&&_<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportEndRow&&n<this.endCol||this.viewportStartRow<this.viewportEndRow&&_===this.viewportStartRow&&n>=this.startCol)}}t.createSelectionRenderModel=function(){return new a}},509:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextureAtlas=void 0;const l=a(237),d=a(860),n=a(374),_=a(160),g=a(345),f=a(485),o=a(385),e=a(147),i=a(855),s={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}};let r;class h{get pages(){return this._pages}constructor(p,S,y){this._document=p,this._config=S,this._unicodeService=y,this._didWarmUp=!1,this._cacheMap=new f.FourKeyMap,this._cacheMapCombined=new f.FourKeyMap,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new e.AttributeData,this._textureSize=512,this._onAddTextureAtlasCanvas=new g.EventEmitter,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new g.EventEmitter,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=m(p,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=(0,n.throwIfFalsy)(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}dispose(){for(const p of this.pages)p.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){const p=new o.IdleTaskQueue;for(let S=33;S<126;S++)p.enqueue(()=>{if(!this._cacheMap.get(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT)){const y=this._drawToCache(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT);this._cacheMap.set(S,i.DEFAULT_COLOR,i.DEFAULT_COLOR,i.DEFAULT_EXT,y)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(this._pages[0].currentRow.x!==0||this._pages[0].currentRow.y!==0){for(const p of this._pages)p.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(h.maxAtlasPages&&this._pages.length>=Math.max(4,h.maxAtlasPages)){const S=this._pages.filter(T=>2*T.canvas.width<=(h.maxTextureSize||4096)).sort((T,M)=>M.canvas.width!==T.canvas.width?M.canvas.width-T.canvas.width:M.percentageUsed-T.percentageUsed);let y=-1,b=0;for(let T=0;T<S.length;T++)if(S[T].canvas.width!==b)y=T,b=S[T].canvas.width;else if(T-y==3)break;const w=S.slice(y,y+4),L=w.map(T=>T.glyphs[0].texturePage).sort((T,M)=>T>M?1:-1),B=this.pages.length-w.length,I=this._mergePages(w,B);I.version++;for(let T=L.length-1;T>=0;T--)this._deletePage(L[T]);this.pages.push(I),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(I.canvas)}const p=new v(this._document,this._textureSize);return this._pages.push(p),this._activePages.push(p),this._onAddTextureAtlasCanvas.fire(p.canvas),p}_mergePages(p,S){const y=2*p[0].canvas.width,b=new v(this._document,y,p);for(const[w,L]of p.entries()){const B=w*L.canvas.width%y,I=Math.floor(w/2)*L.canvas.height;b.ctx.drawImage(L.canvas,B,I);for(const M of L.glyphs)M.texturePage=S,M.sizeClipSpace.x=M.size.x/y,M.sizeClipSpace.y=M.size.y/y,M.texturePosition.x+=B,M.texturePosition.y+=I,M.texturePositionClipSpace.x=M.texturePosition.x/y,M.texturePositionClipSpace.y=M.texturePosition.y/y;this._onRemoveTextureAtlasCanvas.fire(L.canvas);const T=this._activePages.indexOf(L);T!==-1&&this._activePages.splice(T,1)}return b}_deletePage(p){this._pages.splice(p,1);for(let S=p;S<this._pages.length;S++){const y=this._pages[S];for(const b of y.glyphs)b.texturePage--;y.version++}}getRasterizedGlyphCombinedChar(p,S,y,b,w){return this._getFromCacheMap(this._cacheMapCombined,p,S,y,b,w)}getRasterizedGlyph(p,S,y,b,w){return this._getFromCacheMap(this._cacheMap,p,S,y,b,w)}_getFromCacheMap(p,S,y,b,w,L=!1){return r=p.get(S,y,b,w),r||(r=this._drawToCache(S,y,b,w,L),p.set(S,y,b,w,r)),r}_getColorFromAnsiIndex(p){if(p>=this._config.colors.ansi.length)throw new Error("No color found for idx "+p);return this._config.colors.ansi[p]}_getBackgroundColor(p,S,y,b){if(this._config.allowTransparency)return _.NULL_COLOR;let w;switch(p){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(S);break;case 50331648:const L=e.AttributeData.toColorRGB(S);w=_.channels.toColor(L[0],L[1],L[2]);break;default:w=y?_.color.opaque(this._config.colors.foreground):this._config.colors.background}return w}_getForegroundColor(p,S,y,b,w,L,B,I,T,M){const C=this._getMinimumContrastColor(p,S,y,b,w,L,B,T,I,M);if(C)return C;let x;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&T&&L<8&&(L+=8),x=this._getColorFromAnsiIndex(L);break;case 50331648:const R=e.AttributeData.toColorRGB(L);x=_.channels.toColor(R[0],R[1],R[2]);break;default:x=B?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(x=_.color.opaque(x)),I&&(x=_.color.multiplyOpacity(x,l.DIM_OPACITY)),x}_resolveBackgroundRgba(p,S,y){switch(p){case 16777216:case 33554432:return this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(p,S,y,b){switch(p){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&b&&S<8&&(S+=8),this._getColorFromAnsiIndex(S).rgba;case 50331648:return S<<8;default:return y?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(p,S,y,b,w,L,B,I,T,M){if(this._config.minimumContrastRatio===1||M)return;const C=this._getContrastCache(T),x=C.getColor(p,b);if(x!==void 0)return x||void 0;const R=this._resolveBackgroundRgba(S,y,B),D=this._resolveForegroundRgba(w,L,B,I),N=_.rgba.ensureContrastRatio(R,D,this._config.minimumContrastRatio/(T?2:1));if(!N)return void C.setColor(p,b,null);const W=_.channels.toColor(N>>24&255,N>>16&255,N>>8&255);return C.setColor(p,b,W),W}_getContrastCache(p){return p?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(p,S,y,b,w=!1){const L=typeof p=="number"?String.fromCharCode(p):p,B=Math.min(this._config.deviceCellWidth*Math.max(L.length,2)+4,this._textureSize);this._tmpCanvas.width<B&&(this._tmpCanvas.width=B);const I=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<I&&(this._tmpCanvas.height=I),this._tmpCtx.save(),this._workAttributeData.fg=y,this._workAttributeData.bg=S,this._workAttributeData.extended.ext=b,this._workAttributeData.isInvisible())return s;const T=!!this._workAttributeData.isBold(),M=!!this._workAttributeData.isInverse(),C=!!this._workAttributeData.isDim(),x=!!this._workAttributeData.isItalic(),R=!!this._workAttributeData.isUnderline(),D=!!this._workAttributeData.isStrikethrough(),N=!!this._workAttributeData.isOverline();let W=this._workAttributeData.getFgColor(),X=this._workAttributeData.getFgColorMode(),Y=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(M){const J=W;W=Y,Y=J;const le=X;X=A,A=le}const E=this._getBackgroundColor(A,Y,M,C);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";const $=T?this._config.fontWeightBold:this._config.fontWeight,H=x?"italic":"";this._tmpCtx.font=`${H} ${$} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=l.TEXT_BASELINE;const V=L.length===1&&(0,n.isPowerlineGlyph)(L.charCodeAt(0)),q=L.length===1&&(0,n.isRestrictedPowerlineGlyph)(L.charCodeAt(0)),re=this._getForegroundColor(S,A,Y,y,X,W,M,C,T,(0,n.treatGlyphAsBackgroundColor)(L.charCodeAt(0)));this._tmpCtx.fillStyle=re.css;const te=q?0:4;let ue=!1;this._config.customGlyphs!==!1&&(ue=(0,d.tryDrawCustomChar)(this._tmpCtx,L,te,te,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let Se,se=!V;if(Se=typeof p=="number"?this._unicodeService.wcwidth(p):this._unicodeService.getStringCellWidth(p),R){this._tmpCtx.save();const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),le=J%2==1?.5:0;if(this._tmpCtx.lineWidth=J,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())se=!1,this._tmpCtx.strokeStyle=`rgb(${e.AttributeData.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{se=!1;let Ce=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&Ce<8&&(Ce+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(Ce).css}this._tmpCtx.beginPath();const ge=te,fe=Math.ceil(te+this._config.deviceCharHeight)-le-(w?2*J:0),Le=fe+J,ye=fe+2*J;let Ee=this._workAttributeData.getUnderlineVariantOffset();for(let Ce=0;Ce<Se;Ce++){this._tmpCtx.save();const ve=ge+Ce*this._config.deviceCellWidth,ae=ge+(Ce+1)*this._config.deviceCellWidth,he=ve+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe),this._tmpCtx.moveTo(ve,ye),this._tmpCtx.lineTo(ae,ye);break;case 3:const Oe=J<=1?ye:Math.ceil(te+this._config.deviceCharHeight-J/2)-le,Pe=J<=1?fe:Math.ceil(te+this._config.deviceCharHeight+J/2)-le,Ne=new Path2D;Ne.rect(ve,fe,this._config.deviceCellWidth,ye-fe),this._tmpCtx.clip(Ne),this._tmpCtx.moveTo(ve-this._config.deviceCellWidth/2,Le),this._tmpCtx.bezierCurveTo(ve-this._config.deviceCellWidth/2,Pe,ve,Pe,ve,Le),this._tmpCtx.bezierCurveTo(ve,Oe,he,Oe,he,Le),this._tmpCtx.bezierCurveTo(he,Pe,ae,Pe,ae,Le),this._tmpCtx.bezierCurveTo(ae,Oe,ae+this._config.deviceCellWidth/2,Oe,ae+this._config.deviceCellWidth/2,Le);break;case 4:const ce=Ee===0?0:Ee>=J?2*J-Ee:J-Ee;Ee>=J||ce===0?(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ve+ce,fe),this._tmpCtx.lineTo(ae,fe)):(this._tmpCtx.setLineDash([Math.round(J),Math.round(J)]),this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ve+ce,fe),this._tmpCtx.moveTo(ve+ce+J,fe),this._tmpCtx.lineTo(ae,fe)),Ee=(0,n.computeNextVariantOffset)(ae-ve,J,Ee);break;case 5:const Me=.6,$e=.3,De=ae-ve,ke=Math.floor(Me*De),Ie=Math.floor($e*De),We=De-ke-Ie;this._tmpCtx.setLineDash([ke,Ie,We]),this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe);break;default:this._tmpCtx.moveTo(ve,fe),this._tmpCtx.lineTo(ae,fe)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!ue&&this._config.fontSize>=12&&!this._config.allowTransparency&&L!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const Ce=this._tmpCtx.measureText(L);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in Ce&&Ce.actualBoundingBoxDescent>0){this._tmpCtx.save();const ve=new Path2D;ve.rect(ge,fe-Math.ceil(J/2),this._config.deviceCellWidth*Se,ye-fe+Math.ceil(J/2)),this._tmpCtx.clip(ve),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=E.css,this._tmpCtx.strokeText(L,te,te+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(N){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),le=J%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+le),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Se,te+le),this._tmpCtx.stroke()}if(ue||this._tmpCtx.fillText(L,te,te+this._config.deviceCharHeight),L==="_"&&!this._config.allowTransparency){let J=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se);if(J)for(let le=1;le<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=E.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(L,te,te+this._config.deviceCharHeight-le),J=u(this._tmpCtx.getImageData(te,te,this._config.deviceCellWidth,this._config.deviceCellHeight),E,re,se),J);le++);}if(D){const J=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),le=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=J,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(te,te+Math.floor(this._config.deviceCharHeight/2)-le),this._tmpCtx.lineTo(te+this._config.deviceCharWidth*Se,te+Math.floor(this._config.deviceCharHeight/2)-le),this._tmpCtx.stroke()}this._tmpCtx.restore();const xe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let Re;if(Re=this._config.allowTransparency?function(J){for(let le=0;le<J.data.length;le+=4)if(J.data[le+3]>0)return!1;return!0}(xe):u(xe,E,re,se),Re)return s;const de=this._findGlyphBoundingBox(xe,this._workBoundingBox,B,q,ue,te);let oe,ne;for(;;){if(this._activePages.length===0){const J=this._createNewPage();oe=J,ne=J.currentRow,ne.height=de.size.y;break}oe=this._activePages[this._activePages.length-1],ne=oe.currentRow;for(const J of this._activePages)de.size.y<=J.currentRow.height&&(oe=J,ne=J.currentRow);for(let J=this._activePages.length-1;J>=0;J--)for(const le of this._activePages[J].fixedRows)le.height<=ne.height&&de.size.y<=le.height&&(oe=this._activePages[J],ne=le);if(ne.y+de.size.y>=oe.canvas.height||ne.height>de.size.y+2){let J=!1;if(oe.currentRow.y+oe.currentRow.height+de.size.y>=oe.canvas.height){let le;for(const ge of this._activePages)if(ge.currentRow.y+ge.currentRow.height+de.size.y<ge.canvas.height){le=ge;break}if(le)oe=le;else if(h.maxAtlasPages&&this._pages.length>=h.maxAtlasPages&&ne.y+de.size.y<=oe.canvas.height&&ne.height>=de.size.y&&ne.x+de.size.x<=oe.canvas.width)J=!0;else{const ge=this._createNewPage();oe=ge,ne=ge.currentRow,ne.height=de.size.y,J=!0}}J||(oe.currentRow.height>0&&oe.fixedRows.push(oe.currentRow),ne={x:0,y:oe.currentRow.y+oe.currentRow.height,height:de.size.y},oe.fixedRows.push(ne),oe.currentRow={x:0,y:ne.y+ne.height,height:0})}if(ne.x+de.size.x<=oe.canvas.width)break;ne===oe.currentRow?(ne.x=0,ne.y+=ne.height,ne.height=0):oe.fixedRows.splice(oe.fixedRows.indexOf(ne),1)}return de.texturePage=this._pages.indexOf(oe),de.texturePosition.x=ne.x,de.texturePosition.y=ne.y,de.texturePositionClipSpace.x=ne.x/oe.canvas.width,de.texturePositionClipSpace.y=ne.y/oe.canvas.height,de.sizeClipSpace.x/=oe.canvas.width,de.sizeClipSpace.y/=oe.canvas.height,ne.height=Math.max(ne.height,de.size.y),ne.x+=de.size.x,oe.ctx.putImageData(xe,de.texturePosition.x-this._workBoundingBox.left,de.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,de.size.x,de.size.y),oe.addGlyph(de),oe.version++,de}_findGlyphBoundingBox(p,S,y,b,w,L){S.top=0;const B=b?this._config.deviceCellHeight:this._tmpCanvas.height,I=b?this._config.deviceCellWidth:y;let T=!1;for(let M=0;M<B;M++){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.top=M,T=!0;break}}if(T)break}S.left=0,T=!1;for(let M=0;M<L+I;M++){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.left=M,T=!0;break}}if(T)break}S.right=I,T=!1;for(let M=L+I-1;M>=L;M--){for(let C=0;C<B;C++){const x=C*this._tmpCanvas.width*4+4*M+3;if(p.data[x]!==0){S.right=M,T=!0;break}}if(T)break}S.bottom=B,T=!1;for(let M=B-1;M>=0;M--){for(let C=0;C<I;C++){const x=M*this._tmpCanvas.width*4+4*C+3;if(p.data[x]!==0){S.bottom=M,T=!0;break}}if(T)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:S.right-S.left+1,y:S.bottom-S.top+1},sizeClipSpace:{x:S.right-S.left+1,y:S.bottom-S.top+1},offset:{x:-S.left+L+(b||w?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-S.top+L+(b||w?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}}t.TextureAtlas=h;class v{get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(p){this._glyphs.push(p),this._usedPixels+=p.size.x*p.size.y}constructor(p,S,y){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],y)for(const b of y)this._glyphs.push(...b.glyphs),this._usedPixels+=b._usedPixels;this.canvas=m(p,S,S),this.ctx=(0,n.throwIfFalsy)(this.canvas.getContext("2d",{alpha:!0}))}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}}function u(c,p,S,y){const b=p.rgba>>>24,w=p.rgba>>>16&255,L=p.rgba>>>8&255,B=S.rgba>>>24,I=S.rgba>>>16&255,T=S.rgba>>>8&255,M=Math.floor((Math.abs(b-B)+Math.abs(w-I)+Math.abs(L-T))/12);let C=!0;for(let x=0;x<c.data.length;x+=4)c.data[x]===b&&c.data[x+1]===w&&c.data[x+2]===L||y&&Math.abs(c.data[x]-b)+Math.abs(c.data[x+1]-w)+Math.abs(c.data[x+2]-L)<M?c.data[x+3]=0:C=!1;return C}function m(c,p,S){const y=c.createElement("canvas");return y.width=p,y.height=S,y}},160:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;let a=0,l=0,d=0,n=0;var _,g,f,o,e;function i(r){const h=r.toString(16);return h.length<2?"0"+h:h}function s(r,h){return r<h?(h+.05)/(r+.05):(r+.05)/(h+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},function(r){r.toCss=function(h,v,u,m){return m!==void 0?`#${i(h)}${i(v)}${i(u)}${i(m)}`:`#${i(h)}${i(v)}${i(u)}`},r.toRgba=function(h,v,u,m=255){return(h<<24|v<<16|u<<8|m)>>>0},r.toColor=function(h,v,u,m){return{css:r.toCss(h,v,u,m),rgba:r.toRgba(h,v,u,m)}}}(_||(t.channels=_={})),function(r){function h(v,u){return n=Math.round(255*u),[a,l,d]=e.toChannels(v.rgba),{css:_.toCss(a,l,d,n),rgba:_.toRgba(a,l,d,n)}}r.blend=function(v,u){if(n=(255&u.rgba)/255,n===1)return{css:u.css,rgba:u.rgba};const m=u.rgba>>24&255,c=u.rgba>>16&255,p=u.rgba>>8&255,S=v.rgba>>24&255,y=v.rgba>>16&255,b=v.rgba>>8&255;return a=S+Math.round((m-S)*n),l=y+Math.round((c-y)*n),d=b+Math.round((p-b)*n),{css:_.toCss(a,l,d),rgba:_.toRgba(a,l,d)}},r.isOpaque=function(v){return(255&v.rgba)==255},r.ensureContrastRatio=function(v,u,m){const c=e.ensureContrastRatio(v.rgba,u.rgba,m);if(c)return _.toColor(c>>24&255,c>>16&255,c>>8&255)},r.opaque=function(v){const u=(255|v.rgba)>>>0;return[a,l,d]=e.toChannels(u),{css:_.toCss(a,l,d),rgba:u}},r.opacity=h,r.multiplyOpacity=function(v,u){return n=255&v.rgba,h(v,n*u/255)},r.toColorRGB=function(v){return[v.rgba>>24&255,v.rgba>>16&255,v.rgba>>8&255]}}(g||(t.color=g={})),function(r){let h,v;try{const u=document.createElement("canvas");u.width=1,u.height=1;const m=u.getContext("2d",{willReadFrequently:!0});m&&(h=m,h.globalCompositeOperation="copy",v=h.createLinearGradient(0,0,1,1))}catch{}r.toColor=function(u){if(u.match(/#[\da-f]{3,8}/i))switch(u.length){case 4:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),_.toColor(a,l,d);case 5:return a=parseInt(u.slice(1,2).repeat(2),16),l=parseInt(u.slice(2,3).repeat(2),16),d=parseInt(u.slice(3,4).repeat(2),16),n=parseInt(u.slice(4,5).repeat(2),16),_.toColor(a,l,d,n);case 7:return{css:u,rgba:(parseInt(u.slice(1),16)<<8|255)>>>0};case 9:return{css:u,rgba:parseInt(u.slice(1),16)>>>0}}const m=u.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(m)return a=parseInt(m[1]),l=parseInt(m[2]),d=parseInt(m[3]),n=Math.round(255*(m[5]===void 0?1:parseFloat(m[5]))),_.toColor(a,l,d,n);if(!h||!v)throw new Error("css.toColor: Unsupported css format");if(h.fillStyle=v,h.fillStyle=u,typeof h.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(h.fillRect(0,0,1,1),[a,l,d,n]=h.getImageData(0,0,1,1).data,n!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:_.toRgba(a,l,d,n),css:u}}}(f||(t.css=f={})),function(r){function h(v,u,m){const c=v/255,p=u/255,S=m/255;return .2126*(c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4))+.7152*(p<=.03928?p/12.92:Math.pow((p+.055)/1.055,2.4))+.0722*(S<=.03928?S/12.92:Math.pow((S+.055)/1.055,2.4))}r.relativeLuminance=function(v){return h(v>>16&255,v>>8&255,255&v)},r.relativeLuminance2=h}(o||(t.rgb=o={})),function(r){function h(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b>0||w>0||L>0);)b-=Math.max(0,Math.ceil(.1*b)),w-=Math.max(0,Math.ceil(.1*w)),L-=Math.max(0,Math.ceil(.1*L)),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}function v(u,m,c){const p=u>>24&255,S=u>>16&255,y=u>>8&255;let b=m>>24&255,w=m>>16&255,L=m>>8&255,B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));for(;B<c&&(b<255||w<255||L<255);)b=Math.min(255,b+Math.ceil(.1*(255-b))),w=Math.min(255,w+Math.ceil(.1*(255-w))),L=Math.min(255,L+Math.ceil(.1*(255-L))),B=s(o.relativeLuminance2(b,w,L),o.relativeLuminance2(p,S,y));return(b<<24|w<<16|L<<8|255)>>>0}r.blend=function(u,m){if(n=(255&m)/255,n===1)return m;const c=m>>24&255,p=m>>16&255,S=m>>8&255,y=u>>24&255,b=u>>16&255,w=u>>8&255;return a=y+Math.round((c-y)*n),l=b+Math.round((p-b)*n),d=w+Math.round((S-w)*n),_.toRgba(a,l,d)},r.ensureContrastRatio=function(u,m,c){const p=o.relativeLuminance(u>>8),S=o.relativeLuminance(m>>8);if(s(p,S)<c){if(S<p){const w=h(u,m,c),L=s(p,o.relativeLuminance(w>>8));if(L<c){const B=v(u,m,c);return L>s(p,o.relativeLuminance(B>>8))?w:B}return w}const y=v(u,m,c),b=s(p,o.relativeLuminance(y>>8));if(b<c){const w=h(u,m,c);return b>s(p,o.relativeLuminance(w>>8))?y:w}return y}},r.reduceLuminance=h,r.increaseLuminance=v,r.toChannels=function(u){return[u>>24&255,u>>16&255,u>>8&255,255&u]}}(e||(t.rgba=e={})),t.toPaddedHex=i,t.contrastRatio=s},345:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.runAndSubscribe=t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=a=>(this._listeners.push(a),{dispose:()=>{if(!this._disposed){for(let l=0;l<this._listeners.length;l++)if(this._listeners[l]===a)return void this._listeners.splice(l,1)}}})),this._event}fire(a,l){const d=[];for(let n=0;n<this._listeners.length;n++)d.push(this._listeners[n]);for(let n=0;n<d.length;n++)d[n].call(void 0,a,l)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(a,l){return a(d=>l.fire(d))},t.runAndSubscribe=function(a,l){return l(void 0),a(d=>l(d))}},859:(O,t)=>{function a(l){for(const d of l)d.dispose();l.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.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 d=this._disposables.indexOf(l);d!==-1&&this._disposables.splice(d,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(l){var d;this._isDisposed||l===this._value||((d=this._value)==null||d.dispose(),this._value=l)}clear(){this.value=void 0}dispose(){var l;this._isDisposed=!0,(l=this._value)==null||l.dispose(),this._value=void 0}},t.toDisposable=function(l){return{dispose:l}},t.disposeArray=a,t.getDisposeArrayDisposable=function(l){return{dispose:()=>a(l)}}},485:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class a{constructor(){this._data={}}set(d,n,_){this._data[d]||(this._data[d]={}),this._data[d][n]=_}get(d,n){return this._data[d]?this._data[d][n]:void 0}clear(){this._data={}}}t.TwoKeyMap=a,t.FourKeyMap=class{constructor(){this._data=new a}set(l,d,n,_,g){this._data.get(l,d)||this._data.set(l,d,new a),this._data.get(l,d).set(n,_,g)}get(l,d,n,_){var g;return(g=this._data.get(l,d))==null?void 0:g.get(n,_)}clear(){this._data.clear()}}},399:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode=typeof process<"u"&&"title"in process;const a=t.isNode?"node":navigator.userAgent,l=t.isNode?"node":navigator.platform;t.isFirefox=a.includes("Firefox"),t.isLegacyEdge=a.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(a),t.getSafariVersion=function(){if(!t.isSafari)return 0;const d=a.match(/Version\/(\d+)/);return d===null||d.length<2?0:parseInt(d[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(l),t.isIpad=l==="iPad",t.isIphone=l==="iPhone",t.isWindows=["Windows","Win16","Win32","WinCE"].includes(l),t.isLinux=l.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(a)},385:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const l=a(399);class d{constructor(){this._tasks=[],this._i=0}enqueue(g){this._tasks.push(g),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(g){this._idleCallback=void 0;let f=0,o=0,e=g.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(f=Date.now(),this._tasks[this._i]()||this._i++,f=Math.max(1,Date.now()-f),o=Math.max(f,o),i=g.timeRemaining(),1.5*o>i)return e-f<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(e-f))}ms`),void this._start();e=i}this.clear()}}class n extends d{_requestCallback(g){return setTimeout(()=>g(this._createDeadline(16)))}_cancelCallback(g){clearTimeout(g)}_createDeadline(g){const f=Date.now()+g;return{timeRemaining:()=>Math.max(0,f-Date.now())}}}t.PriorityTaskQueue=n,t.IdleTaskQueue=!l.isNode&&"requestIdleCallback"in window?class extends d{_requestCallback(_){return requestIdleCallback(_)}_cancelCallback(_){cancelIdleCallback(_)}}:n,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(_){this._queue.clear(),this._queue.enqueue(_)}flush(){this._queue.flush()}}},147:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class a{constructor(){this.fg=0,this.bg=0,this.extended=new l}static toColorRGB(n){return[n>>>16&255,n>>>8&255,255&n]}static fromColorRGB(n){return(255&n[0])<<16|(255&n[1])<<8|255&n[2]}clone(){const n=new a;return n.fg=this.fg,n.bg=this.bg,n.extended=this.extended.clone(),n}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}}t.AttributeData=a;class l{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(n){this._ext=n}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(n){this._ext&=-469762049,this._ext|=n<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(n){this._ext&=-67108864,this._ext|=67108863&n}get urlId(){return this._urlId}set urlId(n){this._urlId=n}get underlineVariantOffset(){const n=(3758096384&this._ext)>>29;return n<0?4294967288^n:n}set underlineVariantOffset(n){this._ext&=536870911,this._ext|=n<<29&3758096384}constructor(n=0,_=0){this._ext=0,this._urlId=0,this._ext=n,this._urlId=_}clone(){return new l(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}t.ExtendedAttrs=l},782:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const l=a(133),d=a(855),n=a(147);class _ extends n.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new n.ExtendedAttrs,this.combinedData=""}static fromCharData(f){const o=new _;return o.setFromCharData(f),o}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(f){this.fg=f[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let o=!1;if(f[d.CHAR_DATA_CHAR_INDEX].length>2)o=!0;else if(f[d.CHAR_DATA_CHAR_INDEX].length===2){const e=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const i=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=i&&i<=57343?this.content=1024*(e-55296)+i-56320+65536|f[d.CHAR_DATA_WIDTH_INDEX]<<22:o=!0}else o=!0}else this.content=f[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|f[d.CHAR_DATA_WIDTH_INDEX]<<22;o&&(this.combinedData=f[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|f[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=_},855:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},133:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(a){return a>65535?(a-=65536,String.fromCharCode(55296+(a>>10))+String.fromCharCode(a%1024+56320)):String.fromCharCode(a)},t.utf32ToString=function(a,l=0,d=a.length){let n="";for(let _=l;_<d;++_){let g=a[_];g>65535?(g-=65536,n+=String.fromCharCode(55296+(g>>10))+String.fromCharCode(g%1024+56320)):n+=String.fromCharCode(g)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(a,l){const d=a.length;if(!d)return 0;let n=0,_=0;if(this._interim){const g=a.charCodeAt(_++);56320<=g&&g<=57343?l[n++]=1024*(this._interim-55296)+g-56320+65536:(l[n++]=this._interim,l[n++]=g),this._interim=0}for(let g=_;g<d;++g){const f=a.charCodeAt(g);if(55296<=f&&f<=56319){if(++g>=d)return this._interim=f,n;const o=a.charCodeAt(g);56320<=o&&o<=57343?l[n++]=1024*(f-55296)+o-56320+65536:(l[n++]=f,l[n++]=o)}else f!==65279&&(l[n++]=f)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(a,l){const d=a.length;if(!d)return 0;let n,_,g,f,o=0,e=0,i=0;if(this.interim[0]){let h=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,m=0;for(;(u=63&this.interim[++m])&&m<4;)v<<=6,v|=u;const c=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,p=c-m;for(;i<p;){if(i>=d)return 0;if(u=a[i++],(192&u)!=128){i--,h=!0;break}this.interim[m++]=u,v<<=6,v|=63&u}h||(c===2?v<128?i--:l[o++]=v:c===3?v<2048||v>=55296&&v<=57343||v===65279||(l[o++]=v):v<65536||v>1114111||(l[o++]=v)),this.interim.fill(0)}const s=d-4;let r=i;for(;r<d;){for(;!(!(r<s)||128&(n=a[r])||128&(_=a[r+1])||128&(g=a[r+2])||128&(f=a[r+3]));)l[o++]=n,l[o++]=_,l[o++]=g,l[o++]=f,r+=4;if(n=a[r++],n<128)l[o++]=n;else if((224&n)==192){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(e=(31&n)<<6|63&_,e<128){r--;continue}l[o++]=e}else if((240&n)==224){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(e=(15&n)<<12|(63&_)<<6|63&g,e<2048||e>=55296&&e<=57343||e===65279)continue;l[o++]=e}else if((248&n)==240){if(r>=d)return this.interim[0]=n,o;if(_=a[r++],(192&_)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,o;if(g=a[r++],(192&g)!=128){r--;continue}if(r>=d)return this.interim[0]=n,this.interim[1]=_,this.interim[2]=g,o;if(f=a[r++],(192&f)!=128){r--;continue}if(e=(7&n)<<18|(63&_)<<12|(63&g)<<6|63&f,e<65536||e>1114111)continue;l[o++]=e}}return o}}},776:function(O,t,a){var l=this&&this.__decorate||function(e,i,s,r){var h,v=arguments.length,u=v<3?i:r===null?r=Object.getOwnPropertyDescriptor(i,s):r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,i,s,r);else for(var m=e.length-1;m>=0;m--)(h=e[m])&&(u=(v<3?h(u):v>3?h(i,s,u):h(i,s))||u);return v>3&&u&&Object.defineProperty(i,s,u),u},d=this&&this.__param||function(e,i){return function(s,r){i(s,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const n=a(859),_=a(97),g={trace:_.LogLevelEnum.TRACE,debug:_.LogLevelEnum.DEBUG,info:_.LogLevelEnum.INFO,warn:_.LogLevelEnum.WARN,error:_.LogLevelEnum.ERROR,off:_.LogLevelEnum.OFF};let f,o=t.LogService=class extends n.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=_.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),f=this}_updateLogLevel(){this._logLevel=g[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)typeof e[i]=="function"&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){var s;this._logLevel<=_.LogLevelEnum.TRACE&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,i)}debug(e,...i){var s;this._logLevel<=_.LogLevelEnum.DEBUG&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,i)}info(e,...i){var s;this._logLevel<=_.LogLevelEnum.INFO&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,i)}warn(e,...i){var s;this._logLevel<=_.LogLevelEnum.WARN&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,i)}error(e,...i){var s;this._logLevel<=_.LogLevelEnum.ERROR&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,i)}};t.LogService=o=l([d(0,_.IOptionsService)],o),t.setTraceLogger=function(e){f=e},t.traceCall=function(e,i,s){if(typeof s.value!="function")throw new Error("not supported");const r=s.value;s.value=function(...h){if(f.logLevel!==_.LogLevelEnum.TRACE)return r.apply(this,h);f.trace(`GlyphRenderer#${r.name}(${h.map(u=>JSON.stringify(u)).join(", ")})`);const v=r.apply(this,h);return f.trace(`GlyphRenderer#${r.name} return`,v),v}}},726:(O,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const a="di$target",l="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(d){return d[l]||[]},t.createDecorator=function(d){if(t.serviceRegistry.has(d))return t.serviceRegistry.get(d);const n=function(_,g,f){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(o,e,i){e[a]===e?e[l].push({id:o,index:i}):(e[l]=[{id:o,index:i}],e[a]=e)})(n,_,f)};return n.toString=()=>d,t.serviceRegistry.set(d,n),n}},97:(O,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const l=a(726);var d;t.IBufferService=(0,l.createDecorator)("BufferService"),t.ICoreMouseService=(0,l.createDecorator)("CoreMouseService"),t.ICoreService=(0,l.createDecorator)("CoreService"),t.ICharsetService=(0,l.createDecorator)("CharsetService"),t.IInstantiationService=(0,l.createDecorator)("InstantiationService"),function(n){n[n.TRACE=0]="TRACE",n[n.DEBUG=1]="DEBUG",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.OFF=5]="OFF"}(d||(t.LogLevelEnum=d={})),t.ILogService=(0,l.createDecorator)("LogService"),t.IOptionsService=(0,l.createDecorator)("OptionsService"),t.IOscLinkService=(0,l.createDecorator)("OscLinkService"),t.IUnicodeService=(0,l.createDecorator)("UnicodeService"),t.IDecorationService=(0,l.createDecorator)("DecorationService")}},G={};function z(O){var t=G[O];if(t!==void 0)return t.exports;var a=G[O]={exports:{}};return ee[O].call(a.exports,a,a.exports,z),a.exports}var Z={};return(()=>{var O=Z;Object.defineProperty(O,"__esModule",{value:!0}),O.WebglAddon=void 0;const t=z(345),a=z(859),l=z(399),d=z(666),n=z(776);class _ extends a.Disposable{constructor(f){if(l.isSafari&&(0,l.getSafariVersion)()<16){const o={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",o))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=f,this._onChangeTextureAtlas=this.register(new t.EventEmitter),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this.register(new t.EventEmitter),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this.register(new t.EventEmitter),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this.register(new t.EventEmitter),this.onContextLoss=this._onContextLoss.event}activate(f){const o=f._core;if(!f.element)return void this.register(o.onWillOpen(()=>this.activate(f)));this._terminal=f;const e=o.coreService,i=o.optionsService,s=o,r=s._renderService,h=s._characterJoinerService,v=s._charSizeService,u=s._coreBrowserService,m=s._decorationService,c=s._logService,p=s._themeService;(0,n.setTraceLogger)(c),this._renderer=this.register(new d.WebglRenderer(f,h,v,u,e,m,i,p,this._preserveDrawingBuffer)),this.register((0,t.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss)),this.register((0,t.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this.register((0,t.forwardEvent)(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this.register((0,t.forwardEvent)(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this.register((0,a.toDisposable)(()=>{const S=this._terminal._core._renderService;S.setRenderer(this._terminal._core._createRenderer()),S.handleResize(f.cols,f.rows)}))}get textureAtlas(){var f;return(f=this._renderer)==null?void 0:f.textureAtlas}clearTextureAtlas(){var f;(f=this._renderer)==null||f.clearTextureAtlas()}}O.WebglAddon=_})(),Z})())})(Et);var vs=Et.exports;const gt=1,gs=[500,1e3,2e3,4e3,8e3],ps=3e3;function ms({url:U,binaryType:ie="arraybuffer",WebSocketImpl:ee=typeof WebSocket<"u"?WebSocket:void 0,setTimeoutImpl:G=setTimeout,clearTimeoutImpl:z=clearTimeout,backoff:Z=gs,stableMs:O=ps,onOpen:t=()=>{},onMessage:a=()=>{},onState:l=()=>{}}){let d=null,n=0,_=!1,g=0,f=0;const o=typeof U=="function"?U:()=>U,e=()=>{f&&(z(f),f=0)},i=()=>{l(n===0?"connecting":"reconnecting");let v;try{v=new ee(o())}catch{r();return}d=v;try{v.binaryType=ie}catch{}v.onopen=()=>{v===d&&(l("open"),f=G(()=>{n=0,f=0},O),t(h))},v.onmessage=u=>{v===d&&a(u)},v.onclose=()=>{v===d&&s()},v.onerror=()=>{}},s=()=>{e(),!_&&r()},r=()=>{l("reconnecting");const v=Z[Math.min(n,Z.length-1)];n++,g=G(()=>{g=0,i()},v)},h={send(v){return d&&d.readyState===gt?(d.send(v),!0):!1},isOpen(){return!!d&&d.readyState===gt},close(){if(_=!0,g&&(z(g),g=0),e(),d)try{d.close()}catch{}d=null},get raw(){return d}};return i(),h}function Ss(U){var z;const ie=U.buffer.active;let ee=!1,G=!1;for(let Z=ie.baseY;Z<ie.baseY+U.rows;Z++){const O=((z=ie.getLine(Z))==null?void 0:z.translateToString(!0))||"";/^\s{0,6}❯\s+\S/.test(O)&&(ee=!0),/esc/i.test(O)&&/(enter|↵|↑|↓|select|confirm)/i.test(O)&&(G=!0)}return ee&&G}function Cs(U){var ie;return(ie=navigator.clipboard)!=null&&ie.writeText?navigator.clipboard.writeText(U).then(()=>!0).catch(()=>pt(U)):Promise.resolve(pt(U))}function pt(U){var z;const ie=document.activeElement,ee=document.createElement("textarea");ee.value=U,ee.setAttribute("readonly",""),ee.style.cssText="position:fixed;top:0;left:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(ee);let G=!1;try{ee.select(),ee.setSelectionRange(0,U.length),G=document.execCommand("copy")}catch{G=!1}ee.remove();try{(z=ie==null?void 0:ie.focus)==null||z.call(ie)}catch{}return G||console.warn("[SessionTerm] clipboard copy failed — selection left intact for manual copy"),G}function bs({sessionId:U,active:ie=!0,onMenu:ee}){const G=K.useRef(null),z=K.useRef(null),Z=K.useRef(null),O=K.useRef({cols:0,rows:0}),t=K.useRef(null),a=K.useRef(!1),l=K.useRef(!1),d=K.useRef(!0),[n,_]=K.useState(!1),[g,f]=K.useState("connecting"),o=K.useRef(ee);return o.current=ee,K.useEffect(()=>{a.current=!1,l.current=!1;const e=new _s.Terminal({fontSize:11,fontFamily:"Menlo, monospace",cursorBlink:!1,disableStdin:!0,scrollback:0,macOptionClickForcesSelection:!0,theme:{background:"#0d1117",foreground:"#c9d1d9",cursor:"#c9d1d9",selectionBackground:"#264f78",selectionForeground:"#f0f6fc",selectionInactiveBackground:"#264f78",black:"#484f58",red:"#ff7b72",green:"#3fb950",yellow:"#d29922",blue:"#58a6ff",magenta:"#bc8cff",cyan:"#39c5cf",white:"#b1bac4",brightBlack:"#6e7681",brightRed:"#ffa198",brightGreen:"#56d364",brightYellow:"#e3b341",brightBlue:"#79c0ff",brightMagenta:"#d2a8ff",brightCyan:"#56d4dd",brightWhite:"#f0f6fc"}});z.current=e;const i=new fs.FitAddon;e.loadAddon(i),e.open(G.current);try{e._core._selectionService.shouldForceSelection=()=>!0}catch{}try{e._core.focus=()=>{}}catch{}const r=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/api/sessions/${U}/socket`,h=()=>{try{const T=G.current;if(T&&T.clientWidth>=40&&T.clientHeight>=40){const M=i.proposeDimensions();if(M&&M.cols>0&&M.rows>0&&!(M.cols<20&&T.clientWidth>200))return a.current=!0,`${r}?cols=${M.cols}&rows=${M.rows}`}}catch{}return a.current=!1,r};let v=null;const u=()=>{const T=G.current;if(!T||T.clientWidth<40||T.clientHeight<40)return;try{i.fit()}catch{return}const{cols:M,rows:C}=e;if(!M||!C||M<20&&T.clientWidth>200)return;const x=O.current;if(M===x.cols&&C===x.rows)return;O.current={cols:M,rows:C};const R=d.current;d.current=!1,v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"resize",cols:M,rows:C,full:R}))};t.current=u;let m=[],c=0;const p=()=>{if(c=0,!m.length)return;let T=0;for(const x of m)T+=x.length;const M=new Uint8Array(T);let C=0;for(const x of m)M.set(x,C),C+=x.length;m=[],e.write(M)};v=ms({url:h,onState:f,onOpen:()=>{m=[],c&&(cancelAnimationFrame(c),c=0),e.reset(),d.current=!0,O.current={cols:0,rows:0},u()},onMessage:T=>{T.data instanceof ArrayBuffer&&(m.push(new Uint8Array(T.data)),c||(c=requestAnimationFrame(p)))}}),e.attachCustomWheelEventHandler(T=>{const M=G.current;if(M&&e.cols&&e.rows){const C=M.getBoundingClientRect(),x=(W,X)=>Math.min(X,Math.max(1,W)),R=x(Math.floor((T.clientX-C.left)/(C.width/e.cols))+1,e.cols),D=x(Math.floor((T.clientY-C.top)/(C.height/e.rows))+1,e.rows),N=Math.min(5,Math.max(1,Math.round(Math.abs(T.deltaY)/40)));v!=null&&v.isOpen()&&v.send(JSON.stringify({t:"wheel",up:T.deltaY<0,col:R,row:D,ticks:N}))}return T.preventDefault(),!1});let S;const y=G.current,b=T=>{if(!(T.metaKey||T.ctrlKey)||T.key!=="c"&&T.key!=="C"||!y||y.offsetParent===null)return;const M=e.getSelection();if(!M)return;const C=document.activeElement;C&&(C.tagName==="TEXTAREA"||C.tagName==="INPUT")&&C.selectionStart!==C.selectionEnd||(T.preventDefault(),T.stopPropagation(),Cs(M).then(x=>{x&&(_(!0),clearTimeout(S),S=setTimeout(()=>_(!1),1200))}))};document.addEventListener("keydown",b);const w=requestAnimationFrame(u),L=G.current.closest(".si-term");L&&L.addEventListener("animationend",u);const B=[60,180,320].map(T=>setTimeout(u,T)),I=new ResizeObserver(u);return I.observe(G.current),window.addEventListener("resize",u),()=>{cancelAnimationFrame(w),c&&cancelAnimationFrame(c),clearTimeout(S),document.removeEventListener("keydown",b),B.forEach(clearTimeout),L&&L.removeEventListener("animationend",u),I.disconnect(),window.removeEventListener("resize",u),v.close(),e.dispose(),z.current=null,Z.current=null,t.current=null}},[U]),K.useEffect(()=>{const e=z.current;if(!e||!ie)return;const i=setInterval(()=>{var s;try{(s=o.current)==null||s.call(o,U,Ss(e))}catch{}},700);return()=>{var s;clearInterval(i),(s=o.current)==null||s.call(o,U,!1)}},[U,ie]),K.useEffect(()=>{const e=z.current;if(e){if(ie){if(!Z.current)try{const i=new vs.WebglAddon;i.onContextLoss(()=>{try{i.dispose()}catch{}Z.current=null,O.current={cols:0,rows:0},requestAnimationFrame(()=>{var s;(s=t.current)==null||s.call(t);try{e.refresh(0,e.rows-1)}catch{}})}),e.loadAddon(i),Z.current=i}catch{Z.current=null}l.current||(l.current=!0,a.current||(e.reset(),d.current=!0,O.current={cols:0,rows:0})),requestAnimationFrame(()=>{var i;(i=t.current)==null||i.call(t);try{e.refresh(0,e.rows-1)}catch{}})}else if(Z.current){try{Z.current.dispose()}catch{}Z.current=null}}},[U,ie]),F.jsxs("div",{className:"st-wrap",children:[F.jsx("div",{className:"st-host",ref:G}),n&&F.jsx("div",{className:"st-copyhint copied",children:"copied ✓"}),!n&&g==="reconnecting"&&F.jsx("div",{className:"st-copyhint reconnecting",children:"reconnecting…"})]})}const ws=[{id:"claude",label:"Claude Code",Glyph:Gt},{id:"codex",label:"Codex",Glyph:Vt}],mt=Object.fromEntries(ws.map(U=>[U.id,U]));function ys({menu:U,onClose:ie,onChanged:ee,onMultiSelect:G}){const z=Ke(),[Z,O]=K.useState(null),[t,a]=K.useState(null),[l,d]=K.useState(""),[n,_]=K.useState(!1),g=K.useRef(null);K.useEffect(()=>{if(U)return window.addEventListener("click",ie),()=>window.removeEventListener("click",ie)},[U,ie]),qe(!!U,ie),qe(!!Z,()=>O(null)),qe(!!t,()=>a(null)),K.useEffect(()=>{Z&&requestAnimationFrame(()=>{var r;return(r=g.current)==null?void 0:r.select()})},[Z]);const f=r=>{var h;r.stopPropagation(),d((((h=U.session.raw)==null?void 0:h.name)??U.session.name)||""),O(U.session),ie()},o=r=>{r.stopPropagation(),G==null||G(U.session),ie()},e=r=>{r.stopPropagation(),a(U.session),ie()},i=()=>{const{id:r}=t;a(null),Qe(`/api/sessions/${r}/close`,{method:"POST"}).catch(()=>{}).finally(()=>ee==null?void 0:ee())},s=async r=>{if(r.preventDefault(),!n){_(!0);try{await Qe(`/api/sessions/${Z.id}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:l})}),ee==null||ee()}catch{}finally{_(!1),O(null)}}};return F.jsxs(F.Fragment,{children:[U&&F.jsxs("div",{className:"sess-menu",style:{left:U.x,top:U.y},onClick:r=>r.stopPropagation(),children:[F.jsx("button",{className:"sess-menu-item",onClick:f,children:z("sessionWindow.rename")}),F.jsx("button",{className:"sess-menu-item",onClick:o,children:z("sessionWindow.select")}),F.jsx("button",{className:"sess-menu-item danger",onClick:e,children:z("sessionWindow.close")})]}),Z&&F.jsx(et,{title:z("sessionWindow.renameTitle",{name:_t(Z)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>O(null),children:F.jsxs("form",{className:"sess-rename",onSubmit:s,children:[F.jsx("input",{ref:g,className:"sess-rename-input",value:l,autoFocus:!0,placeholder:z("sessionWindow.renamePlaceholder"),onChange:r=>d(r.target.value)}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>O(null),children:z("common.cancel")}),F.jsx("button",{type:"submit",className:"sess-rename-btn sess-rename-save",disabled:n,children:z("common.save")})]})]})}),t&&F.jsx(et,{title:z("sessionWindow.closeTitle",{name:_t(t)}),closeLabel:z("common.close"),className:"sess-rename-modal",onClose:()=>a(null),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:z("sessionWindow.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>a(null),children:z("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:i,children:z("sessionWindow.close")})]})]})})]})}function Es({ids:U,onCancel:ie,onClosed:ee}){const G=Ke(),[z,Z]=K.useState(!1),O=U.length;qe(z,()=>Z(!1));const t=()=>{Z(!1),Promise.all(U.map(a=>Qe(`/api/sessions/${a}/close`,{method:"POST"}).catch(()=>{}))).finally(()=>ee==null?void 0:ee())};return F.jsxs(F.Fragment,{children:[F.jsxs("div",{className:"si-selbar",children:[F.jsx("span",{className:"si-selcount",children:G("sessionSelect.selected",{n:O})}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",disabled:O===0,onClick:()=>Z(!0),children:G("sessionSelect.close")}),F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:ie,children:G("common.cancel")})]}),z&&F.jsx(et,{"data-tip":G("sessionSelect.closeTitle",{n:O}),closeLabel:G("common.close"),className:"sess-rename-modal",onClose:()=>Z(!1),children:F.jsxs("div",{className:"sess-confirm",children:[F.jsx("p",{className:"sess-confirm-msg",children:G("sessionSelect.closeConfirm")}),F.jsxs("div",{className:"sess-rename-actions",children:[F.jsx("button",{type:"button",className:"sess-rename-btn",onClick:()=>Z(!1),children:G("common.cancel")}),F.jsx("button",{type:"button",className:"sess-rename-btn danger",onClick:t,children:G("sessionSelect.close")})]})]})})]})}function xs({sessionId:U,specs:ie=[],sessions:ee=[],onOpenSession:G}){var r;const z=Ke(),[Z,O]=K.useState(null),[t,a]=K.useState(!1),[l,d]=K.useState(null),n=K.useRef(0),_=K.useCallback(()=>{const h=++n.current;return fetch(`/api/sessions/${encodeURIComponent(U)}/evals`).then(v=>v.ok?v.json():Promise.reject()).then(v=>{h===n.current&&O(v)}).catch(()=>{h===n.current&&O(!1)})},[U]);K.useEffect(()=>{O(null),d(null),a(!1),_()},[U,_]);const g=K.useMemo(()=>Z?Z.nodes.map(h=>{const v=Xt(h.scenarios,h.evals),u=v.filter(c=>!c.reading).map(c=>({blind:!0,scenario:c.name,expected:c.expected,tags:c.tags,node:h.id,hue:h.hue,state:"missing"})),m=v.filter(c=>c.reading).map(c=>({...c.reading,expected:c.expected??c.reading.expected,state:c.state,node:h.id,hue:h.hue})).sort((c,p)=>Number(p.inSession)-Number(c.inSession)||(c.ts<p.ts?1:-1));return{node:h,blind:u,rows:m,sessionN:m.filter(c=>c.inSession).length}}):[],[Z]),f=g.reduce((h,v)=>h+v.sessionN,0),o=K.useMemo(()=>g.flatMap(h=>[...h.blind.map(v=>({kind:"blind",key:`blind:${v.node}·${v.scenario}`,item:v})),...h.rows.filter(v=>!t||v.inSession).map(v=>({kind:"eval",key:Yt(v),item:v}))]),[g,t]),e=l&&o.some(h=>h.key===l)?l:((r=o[0])==null?void 0:r.key)??null,i=o.find(h=>h.key===e);if(Z===null)return F.jsx("div",{className:"fv-note",children:z("common.loading")});if(Z===!1)return F.jsx("div",{className:"fv-note",children:z("sessionEval.none")});const s=(i==null?void 0:i.kind)==="eval"?F.jsx(cs,{entry:i.item,specs:ie,sessions:ee,onOpenSession:G,onWrite:_}):(i==null?void 0:i.kind)==="blind"?F.jsxs("div",{className:"an-detail",children:[F.jsxs("header",{className:"an-head",children:[F.jsx("span",{className:"an-title",children:i.item.scenario}),F.jsx("span",{className:"an-node",children:i.item.node})]}),i.item.expected&&F.jsxs("div",{className:"an-expected",children:[F.jsx("b",{children:z("nodeView.eval.expected")})," ",i.item.expected]}),F.jsx("div",{className:"an-hint",children:z("sessionEval.blindHint")})]}):F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")});return F.jsxs("div",{className:"se-pane",children:[F.jsxs("div",{className:"se-gates",children:[Z.gates.map(h=>F.jsxs("span",{className:`se-gate ${h.ok?"ok":"bad"}`,"data-tip":h.detail,children:[h.ok?"✓":"✗"," ",h.label]},h.label)),f>0&&F.jsx("button",{className:`ef-chip ef-stale ${t?"on":""}`,onClick:()=>a(h=>!h),children:z("sessionEval.sessionN",{n:f})}),F.jsx("a",{className:"se-export",href:`/api/sessions/${encodeURIComponent(U)}/evals?format=html`,target:"_blank",rel:"noreferrer","data-tip":z("sessionEval.exportTitle"),"aria-label":z("sessionEval.export"),children:F.jsx(He,{name:"download",size:13})})]}),F.jsx(ds,{rowKeys:o.map(h=>h.key),sel:e,onSel:d,detail:s,children:F.jsxs("div",{className:"fv-scroll",children:[o.length===0&&F.jsx("div",{className:"fv-note",children:z("sessionEval.empty")}),g.map(h=>{const v=o.filter(u=>u.item.node===h.node.id);return!v.length&&!h.node.uncoveredFrontend?null:F.jsxs("section",{className:"fv-group",children:[F.jsxs("header",{className:"fv-group-head",children:[F.jsx("span",{className:"fv-group-title",style:{color:`hsl(${h.node.hue} 60% 60%)`},children:h.node.title}),h.node.uncoveredFrontend&&F.jsx("span",{className:"se-warn",children:z("sessionEval.noEvalFile")})]}),v.map((u,m)=>{const c=u.kind==="eval"&&!u.item.inSession&&m>0&&v[m-1].kind==="eval"&&v[m-1].item.inSession,p=u.kind==="blind"?F.jsxs("button",{className:`ef-row se-blind ${e===u.key?"sel":""}`,onClick:()=>d(u.key),children:[F.jsx(Jt,{state:"missing"}),F.jsx("span",{className:"ef-scenario",children:u.item.scenario}),F.jsx("span",{className:"ef-time",children:z("sessionEval.unmeasured")})]},u.key):F.jsx(Zt,{e:u.item,selected:e===u.key,onClick:()=>d(u.key)},u.key);return c?[F.jsx("div",{className:"se-divider",children:z("sessionEval.inherited")},`div:${h.node.id}`),p]:p})]},h.node.id)})]})})]})}const Ls=[{name:"type",color:"yellow",button:!0,when:U=>!!U&&U!=="offline",labelKey:"session.typeBtn",titleKey:"session.typeTitle",descKey:"session.cmd.typeDesc"},{name:"eval",color:"cyan",button:!1,when:U=>!!U&&U!=="offline",labelKey:"sessionEval.btn",titleKey:"sessionEval.btnTitle",descKey:"session.cmd.evalDesc"},{name:"merge",color:"green",button:!0,when:U=>U==="review"||U==="done",labelKey:"session.merge",titleKey:"session.cmd.mergeTitle",descKey:"session.cmd.mergeDesc"},{name:"stop",color:"muted",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.stopTitle",descKey:"session.cmd.stopDesc"},{name:"close",color:"red",button:!1,when:U=>!!U&&U!=="offline",titleKey:"session.cmd.closeTitle",descKey:"session.cmd.closeDesc"}];function Rs(U,ie){return Ls.filter(ee=>ee.when(U)).map(ee=>({...ee,run:ie[ee.name]}))}const St=()=>F.jsx(He,{name:"paperclip",size:15}),Ct=()=>F.jsx(He,{name:"loader",size:15,className:"si-attach-busy"}),Ds={ArrowUp:"Up",ArrowDown:"Down",ArrowLeft:"Left",ArrowRight:"Right",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End"," ":"Space"},Ze=U=>{var ie;return U.isComposing||((ie=U.nativeEvent)==null?void 0:ie.isComposing)||U.keyCode===229};function ks(U){const ie=Ds[U.key],ee=U.ctrlKey||U.altKey||U.metaKey;let G=null;if(ie?G=ie:ee?/^Key[A-Z]$/.test(U.code)?G=U.shiftKey?U.code.slice(3):U.code.slice(3).toLowerCase():/^Digit[0-9]$/.test(U.code)?G=U.code.slice(5):U.key.length===1&&(G=U.key):U.key.length===1&&(G=U.key),G==null)return null;let z="";return U.ctrlKey&&(z+="C-"),(U.altKey||U.metaKey)&&(z+="M-"),U.shiftKey&&ie&&(z+="S-"),z+G}function As(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({c:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.c)}const Ms=U=>U&&U[0].toUpperCase()+U.slice(1);function Ts(U,ie){const ee=ie.toLowerCase(),G=[];for(const z of U){const Z=z.name.toLowerCase();let O;if(!ee)O=1;else if(Z.startsWith(ee))O=0;else if(Z.includes(ee))O=1;else continue;G.push({p:z,score:O})}return G.sort((z,Z)=>z.score-Z.score),G.slice(0,10).map(z=>z.p)}const Bs={user:"(user)",project:"(project)",skill:"[skill]","built-in":"built-in",ui:"[ui]"};function Ns({sessions:U,specs:ie=[],focusNode:ee,open:G,searchOpen:z=!1,sel:Z,setSel:O,seed:t,onSeedConsumed:a,onClose:l,onPickSession:d,onOpenSession:n,onOpenSearch:_,reload:g}){const f=Ke(),[o,e]=K.useState(""),[i,s]=K.useState(null),[r,h]=K.useState(null),[v,u]=K.useState(!1),[m,c]=K.useState(()=>new Set),[p,S]=K.useState([]),[y,b]=K.useState([]),[w,L]=K.useState({}),[B,I]=K.useState([]),[T,M]=K.useState(()=>{try{return localStorage.getItem("si.launcher")||""}catch{return""}}),C=k=>{M(k);try{localStorage.setItem("si.launcher",k)}catch{}},[x,R]=K.useState(!1),[D,N]=K.useState(null),[W,X]=K.useState(!1),[Y,A]=K.useState({}),[E,$]=K.useState("terminal"),[H,V]=K.useState(!1),q=H&&E==="eval",[re,te]=K.useState(!1),[ue,Se]=K.useState(!1),[se,xe]=K.useState(null),[Re,de]=K.useState(null),oe=K.useRef(null),ne=K.useRef(null),J=K.useRef(null),le=K.useRef(null),ge=K.useRef(null),fe=K.useRef("new"),{expanded:Le,toggle:ye}=Qt(),Ee=K.useMemo(()=>es(U,k=>Le.has(k)),[U,Le]),Ce=K.useMemo(()=>Ee.filter(k=>k.type==="row").map(k=>k.s),[Ee]),ve=K.useMemo(()=>["new",...Ce.map(k=>k.id)],[Ce]),ae=K.useMemo(()=>new Set(["new",...U.map(k=>k.id)]),[U]),he=ae.has(Z)?Z:"new";K.useEffect(()=>{G&&!ae.has(Z)&&O("new")},[G,ae,Z,O]);const[Oe,Pe]=ls("spex.siListWidth",240,{min:180,max:480}),Ne=(ee==null?void 0:ee.id)||null,ce=U.find(k=>k.id===he),Me=(ce==null?void 0:ce.liveness)==="offline",$e=Me&&(ce==null?void 0:ce.status)!=="queued",De=w[he]||"",ke=k=>L(P=>({...P,[he]:k}));K.useEffect(()=>{const k=(ce==null?void 0:ce.harness)||"claude";fetch(`/api/slash-commands?harness=${k}`).then(P=>P.json()).then(P=>{Array.isArray(P)&&S(P)}).catch(()=>{})},[ce==null?void 0:ce.harness]),K.useEffect(()=>{qt().then(k=>{Array.isArray(k)&&b(k)}).catch(()=>{})},[]),K.useEffect(()=>{Kt().then(k=>{const P=k==null?void 0:k.launchers;!Array.isArray(P)||!P.length||(I(P),M(j=>P.some(Q=>Q.name===j)?j:k.default&&P.some(Q=>Q.name===k.default)?k.default:P[0].name))}).catch(()=>{})},[]);const Ie=y;K.useEffect(()=>{X(!1),R(!1),s(null),$("terminal")},[he]),K.useEffect(()=>{V(E==="eval")},[E]),K.useEffect(()=>{E==="terminal"&&he!=="new"&&!W&&ce&&ce.liveness!=="offline"&&requestAnimationFrame(()=>{var k;return(k=ne.current)==null?void 0:k.focus()})},[E]),K.useEffect(()=>{(ce==null?void 0:ce.liveness)==="offline"&&X(!1)},[ce==null?void 0:ce.liveness]),K.useEffect(()=>{N(null)},[he]);const We=K.useRef(!1);K.useEffect(()=>{var k;We.current&&!W&&he!=="new"&&(ce==null?void 0:ce.liveness)!=="offline"&&((k=ne.current)==null||k.focus()),We.current=W},[W]);const Ge=K.useRef(new Map),tt=k=>{const P=Ge.current.get(k);if(!P||P.busy||P.keys.length===0)return;const j=P.keys;P.keys=[],P.busy=!0,fetch(`/api/sessions/${k}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"keys",keys:j})}).catch(()=>{}).finally(()=>{P.busy=!1,tt(k)})},xt=k=>{const P=he;let j=Ge.current.get(P);j||(j={keys:[],busy:!1},Ge.current.set(P,j)),j.keys.push(k),tt(P)},Lt=(k,P)=>A(j=>j[k]===P?j:{...j,[k]:P}),[Rt,Dt]=K.useState(()=>new Set);K.useEffect(()=>{Dt(k=>{const P=new Set;for(const j of U)j.liveness!=="offline"&&P.add(j.id);if(P.size!==k.size)return P;for(const j of P)if(!k.has(j))return P;return k})},[U]),K.useEffect(()=>{t!=null&&(O("new"),e(t),s(null),a==null||a(),requestAnimationFrame(()=>{const k=oe.current;k&&(k.focus(),k.setSelectionRange(t.length,t.length))}))},[t]),K.useEffect(()=>{if(!G)return;const k=setTimeout(()=>{var P,j;he==="new"?(P=oe.current)==null||P.focus():ce&&ce.liveness!=="offline"&&((j=ne.current)==null||j.focus())},0);return()=>clearTimeout(k)},[G,he,ce==null?void 0:ce.liveness]),K.useEffect(()=>{const k=oe.current;!k||he!=="new"||!G||ft(k,parseFloat(getComputedStyle(k).maxHeight)||1/0)},[o,he,G]),K.useEffect(()=>{var j;const k=ne.current;if(!k||he==="new"||!G)return;const P=Math.round((((j=le.current)==null?void 0:j.clientHeight)||360)*.5);k.style.maxHeight=`${P}px`,ft(k,P)},[De,he,G,E,W]);const kt=k=>{const P=k.match(/^\/(\S+)\s*([\s\S]*)$/);if(!P)return k;const j=Ie.find(we=>we.name===P[1]);if(!j)return k;const Q=[],_e=P[2].replace(vt,(we,pe)=>(Q.push(pe),"")).trim(),me=Q.length?Q.map(we=>{const pe=ie.find(Be=>Be.id===we);return pe?`- [[${pe.id}]] — ${os(pe.path)}`:`- [[${we}]]`}).join(`
|
|
67
67
|
`):"(No target was mentioned. If the prompt names the scope, use it; otherwise ask the human to define the scope before proceeding — unless this task needs no scope, in which case proceed.)",be=j.body.includes("{{targets}}")?j.body.replace("{{targets}}",me):`${j.body}
|
|
68
68
|
|
|
69
69
|
${me}`;return _e?`${be}
|
|
70
70
|
|
|
71
|
-
${_e}`:be},At=k=>k.replace(vt,(P,j)=>{const Q=ie.find(_e=>_e.id===j);return Q?`[[${Q.id}]] (${Q.path})`:P}),Mt=()=>{const k=o.trim();if(!k)return;const P=kt(k);e(""),fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T?{prompt:P,launcher:T}:{prompt:P})}).then(Q=>Q.json().catch(()=>null)).then(()=>g==null?void 0:g()).catch(()=>{})},Tt=(k,P)=>{const j=as(k,P,ie,Ne);if(j)return j;const Q=hs(k,P,U);if(Q)return Q;if(he==="new"){const me=k.match(/^\/(\S*)$/);if(me){const be=Ts(Ie,me[1]);return be.length?{kind:"config",items:be,index:0,start:0,end:k.length,query:me[1]}:null}return null}const _e=k.match(/^\/(\S*)$/);if(_e){const me=je.map(pe=>({name:pe.name,description:f(pe.descKey),board:!0,color:pe.color})),be=new Set(me.map(pe=>pe.name)),we=As([...me,...p.filter(pe=>!be.has(pe.name))],_e[1]);return we.length?{kind:"slash",items:we,index:0,start:0,end:k.length,query:_e[1]}:null}return null},Ue=k=>s(k?Tt(k.value,k.selectionStart):null),Bt=k=>s(P=>P&&{...P,index:(P.index+k+P.items.length)%P.items.length}),Ve=k=>{if(!k||!i)return;if(i.kind==="slash"){if(k.board){const Te=je.find(Ye=>Ye.name===k.name);ke(""),s(null),Te==null||Te.run();return}const pe=`/${k.name} `,Be=De.slice(0,i.start);ke(Be+pe+De.slice(i.end)),s(null);const ze=Be.length+pe.length;requestAnimationFrame(()=>{const Te=ne.current;Te&&(Te.focus(),Te.setSelectionRange(ze,ze))});return}const P=i.kind==="config"?`/${k.name} `:i.kind==="actor"?`@${k.id} `:`[[${k.id}]] `,j=(i.kind==="mention"||i.kind==="actor")&&he!=="new",Q=j?ne:oe,_e=j?De:o,me=j?ke:e,be=_e.slice(0,i.start);me(be+P+_e.slice(i.end)),s(null);const we=be.length+P.length;requestAnimationFrame(()=>{const pe=Q.current;pe&&(pe.focus(),pe.setSelectionRange(we,we))})},st=(k,P)=>F.jsxs("ul",{className:k?"mention-menu up":"mention-menu",role:"listbox",children:[F.jsxs("li",{className:"mention-head",children:["// ",P," — ",f("session.menuHint")]}),i.items.map((j,Q)=>{const _e=j.board?"board":j.source??j.kind,me=j.board?` sc-${j.color}`:"";return F.jsxs("li",{role:"option","aria-selected":Q===i.index,className:`${Q===i.index?"mention-item on":"mention-item"}${me}`,onMouseDown:be=>{be.preventDefault(),Ve(j)},onMouseEnter:()=>s(be=>be&&{...be,index:Q}),children:[F.jsxs("span",{className:j.board?"slash-name board":"slash-name",children:["/",rs(j.name,i.query)]}),F.jsx("span",{className:"slash-desc",children:Ms(j.description??j.desc)}),F.jsx("span",{className:`slash-src src-${_e}`,children:Bs[_e]||_e})]},`${_e}:${j.name}`)})]}),it=k=>F.jsx(ns,{menu:i,up:k,onPick:Ve,onHover:P=>s(j=>j&&{...j,index:P})}),Ot=async()=>{const k=De;if(!k.trim()||he==="new")return;const P=je.find(Q=>k.trim()===`/${Q.name}`);if(P){ke(""),s(null),P.run();return}const j=At(k);ke(""),R(!1);try{const Q=await fetch(`/api/sessions/${he}/keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:j,enter:!0})});if(!Q.ok)throw new Error(`keys ${Q.status}`)}catch{ke(k),R(!0)}},Pt=async k=>{const P=new FormData;P.append("file",k,k.name||"pasted");const j=await fetch("/api/uploads",{method:"POST",body:P});if(!j.ok)throw new Error(`upload ${j.status}`);const Q=await j.json().catch(()=>null);if(!(Q!=null&&Q.path))throw new Error("upload: no path");return Q.path},rt=(k,P,j,Q)=>{const _e=k.current,me=_e?_e.selectionStart:P.length,be=_e?_e.selectionEnd:P.length,we=P.slice(0,me),pe=(we&&!/\s$/.test(we)?" ":"")+Q+" ";j(we+pe+P.slice(be)),requestAnimationFrame(()=>{if(!_e)return;_e.focus();const Be=we.length+pe.length;_e.setSelectionRange(Be,Be)})},Xe=async(k,P)=>{const j=[...k||[]];if(!(!j.length||re)){Se(!1),de(P),te(!0);try{const Q=[];for(const _e of j)Q.push(await Pt(_e));P==="new"?rt(oe,o,e,Q.join(" ")):rt(ne,De,ke,Q.join(" "))}catch{Se(!0)}finally{te(!1)}}},nt=(k,P)=>{var Q;const j=(Q=k.clipboardData)==null?void 0:Q.files;j&&j.length&&(k.preventDefault(),Xe(j,P))},ot=(k,P)=>{var j;k.preventDefault(),xe(null),Xe((j=k.dataTransfer)==null?void 0:j.files,P)},at=(k,P)=>{var j;[...((j=k.dataTransfer)==null?void 0:j.types)||[]].includes("Files")&&(k.preventDefault(),xe(P))},ht=k=>{var P;fe.current=k,(P=ge.current)==null||P.click()},Fe=async k=>{N(null);try{const P=await fetch(`/api/sessions/${he}/${k}`,{method:"POST"});if(!P.ok){const j=await P.json().catch(()=>null);j!=null&&j.error&&N(j.error)}}catch{}await(g==null?void 0:g())},It=k=>{u(!0),c(new Set([k.id]))},lt=()=>{u(!1),c(new Set)},Ft=k=>c(P=>{const j=new Set(P);return j.has(k)?j.delete(k):j.add(k),j}),Ht=()=>{lt(),g==null||g()},Nt={type:()=>X(k=>!k),eval:()=>$("eval"),merge:()=>Fe("merge"),exit:()=>Fe("exit"),close:()=>Fe("close")},je=Rs(ce==null?void 0:ce.status,Nt),ct=K.useRef({});ct.current={order:ve,active:he,submit:Mt,menu:i,navMenu:Bt,accept:Ve,setMenu:s,onClose:l,open:G,searchOpen:z,typeMode:W,setTypeMode:X,sendRawKey:xt},K.useEffect(()=>{const k=P=>{var ut;const{order:j,active:Q,submit:_e,menu:me,navMenu:be,accept:we,setMenu:pe,onClose:Be,open:ze,searchOpen:Te,typeMode:Ye,setTypeMode:jt,sendRawKey:dt}=ct.current;if(!ze||Te)return;const zt=P.code==="KeyI"||P.key==="i"||P.key==="I";if(P.altKey!==P.metaKey&&zt&&Q!=="new"){P.preventDefault(),P.stopPropagation(),jt(Ae=>!Ae);return}if(!(P.altKey&&!P.metaKey&&!P.ctrlKey&&["KeyN","KeyF","Digit1","Digit2","Digit3","Digit4"].includes(P.code))){if((P.metaKey||P.altKey||P.ctrlKey)&&(P.key==="ArrowUp"||P.key==="ArrowDown")){P.preventDefault(),P.stopPropagation();let Ae=j.indexOf(Q);Ae<0&&(Ae=0);const Je=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[Je]);return}if(Ye&&Q!=="new"){if(P.preventDefault(),P.stopPropagation(),P.key==="Escape"){dt("Escape");return}const Ae=ks(P);Ae&&dt(Ae);return}if(me){if(P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation(),be(1);return}if(P.key==="ArrowUp"){P.preventDefault(),P.stopPropagation(),be(-1);return}if((P.key==="Enter"||P.key==="Tab")&&!Ze(P)){P.preventDefault(),P.stopPropagation(),we(me.items[me.index]);return}if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),pe(null);return}}if(P.key==="ArrowUp"||P.key==="ArrowDown"){if(((ut=P.target)==null?void 0:ut.tagName)==="TEXTAREA")return;P.preventDefault(),P.stopPropagation();const Ae=j.indexOf(Q),Je=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[Je]);return}P.key==="Enter"&&!P.shiftKey&&!Ze(P)&&Q==="new"&&(P.preventDefault(),P.stopPropagation(),_e())}};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[O]);const $t=k=>k&&(k.tagName==="TEXTAREA"||k.tagName==="INPUT"||k.isContentEditable),Wt=()=>{const k=oe.current||ne.current;k&&requestAnimationFrame(()=>k.focus())},Ut=k=>{if(k.stopPropagation(),k.button!==0)return;const P=k.target;$t(P)||P.closest&&P.closest("select")||P.closest&&P.closest(".si-term-body")||P.closest&&P.closest(".se-pane")||k.preventDefault()};return K.useEffect(()=>{if(!G)return;const k=P=>{var j;(j=J.current)!=null&&j.contains(P.target)&&(P.preventDefault(),Wt())};return window.addEventListener("contextmenu",k,!0),()=>window.removeEventListener("contextmenu",k,!0)},[G]),F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"si-page",style:G?void 0:{display:"none"},children:F.jsxs("div",{className:"si-panel",ref:J,onMouseDown:Ut,children:[F.jsx("input",{ref:ge,type:"file",multiple:!0,style:{display:"none"},onChange:k=>{Xe(k.target.files,fe.current),k.target.value=""}}),q&&F.jsx(us,{className:"si-list-unfold",folded:!0,onToggle:()=>V(!1)}),F.jsxs("aside",{className:"si-list",style:q?{display:"none"}:{flex:`0 0 ${Oe}px`},children:[v?F.jsx(Es,{ids:[...m],onCancel:lt,onClosed:Ht}):F.jsxs("div",{className:"si-toprow",children:[F.jsx("button",{className:he==="new"?"si-pill new on":"si-pill new","data-tip":f("session.newSessionTitle"),"aria-label":f("session.newSessionTitle"),onClick:()=>O("new"),children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(He,{name:"plus",size:15,strokeWidth:2})})}),F.jsx("button",{className:"si-pill search","data-tip":f("session.searchTitle"),"aria-label":f("session.searchTitle"),onClick:_,children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(He,{name:"search",size:15})})})]}),Ee.map(k=>{var _e;if(k.type==="zone")return F.jsx("div",{className:`si-zone si-zone-${k.zone}`,children:f(`sessionZone.${k.zone}`)},`zone-${k.zone}`);const P=k.s,j=k.expandable||k.depth?F.jsx(ts,{guides:k.guides,expandable:k.expandable,expanded:k.expanded,rollup:k.rollup,kin:k.kin,onToggle:()=>ye(P.id)}):null,Q=v&&m.has(P.id);return F.jsxs("button",{"data-sid":P.id,className:`si-item${!v&&he===P.id?" on":""}${Q?" picked":""}`,style:{"--ov":is(P.id)},onClick:()=>v?Ft(P.id):O(P.id),onDoubleClick:()=>{!v&&d&&(d(P,!1),l())},onContextMenu:me=>{me.preventDefault(),me.stopPropagation(),v||h({x:me.clientX,y:me.clientY,session:P})},"data-tip":(_e=P.ops)!=null&&_e.length?f("session.opsTitle"):f("session.lockTitle"),children:[v&&F.jsx("span",{className:`si-check${Q?" on":""}`,"aria-hidden":"true"}),F.jsx(ss,{s:P,locked:!1,showAvatar:!1,compact:!0,lead:j})]},P.id)})]}),!q&&F.jsx("div",{className:"pane-resizer si-resizer",onMouseDown:Pe,role:"separator","aria-orientation":"vertical"}),F.jsxs("section",{className:he==="new"?"si-content is-new":"si-content is-session",children:[he==="new"&&F.jsxs("div",{className:"si-new-center",children:[F.jsx("div",{className:"si-avatar","aria-hidden":"true",children:F.jsxs("svg",{viewBox:"0 0 64 64",width:"52",height:"52",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[F.jsx("path",{d:"M15 35 Q32 44 49 35",strokeWidth:"2.8"}),F.jsx("path",{d:"M32 17 L20 42",strokeWidth:"3.2"}),F.jsx("path",{d:"M32 17 L44 42",strokeWidth:"3.2"}),F.jsxs("g",{fill:"currentColor",stroke:"none",children:[F.jsx("circle",{cx:"32",cy:"16.5",r:"5"}),F.jsx("circle",{cx:"20",cy:"42.6",r:"5"}),F.jsx("circle",{cx:"44",cy:"42.6",r:"5"})]})]})}),F.jsx("div",{className:"si-ask",children:f("session.ask")}),F.jsxs("div",{className:se==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:k=>at(k,"new"),onDragLeave:()=>xe(null),onDrop:k=>ot(k,"new"),children:[F.jsx("textarea",{ref:oe,className:"si-input","data-focus-sink":!0,rows:1,value:o,onChange:k=>{e(k.target.value),Ue(k.target)},onSelect:k=>Ue(k.target),onPaste:k=>nt(k,"new"),onBlur:()=>s(null),placeholder:f("session.inputPlaceholder"),spellCheck:!1}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("new"),disabled:re,children:re&&Re==="new"?F.jsx(Ct,{}):F.jsx(St,{})}),ue&&Re==="new"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),i&&(i.kind==="mention"||i.kind==="actor")&&it(!1),i&&i.kind==="config"&&st(!1,i.query?`/${i.query}`:f("session.menuPresets"))]}),B.length?(()=>{var j;const k=mt[((j=B.find(Q=>Q.name===T))==null?void 0:j.harness)||"claude"]||mt.claude,P=k.Glyph;return F.jsxs("label",{className:"si-launcher-picker","data-tip":f("session.launcherLabel"),children:[F.jsx("span",{className:"si-launcher-label",children:f("session.launcherLabel")}),F.jsx("span",{className:"si-launcher-harness","data-tip":k.label,"aria-hidden":"true",children:F.jsx(P,{})}),F.jsx("select",{className:"si-launcher-select",value:T,onChange:Q=>C(Q.target.value),"aria-label":f("session.launcherLabel"),children:B.map(Q=>F.jsx("option",{value:Q.name,children:Q.name},Q.name))})]})})():null,F.jsxs("div",{className:"si-hint",children:[f("session.hint.before"),F.jsx("code",{children:"[["}),f("session.hint.mid"),F.jsx("code",{children:"/"}),f("session.hint.after")]})]}),F.jsxs("div",{className:"si-session-wrap",style:{display:he==="new"?"none":"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:"relative"},children:[F.jsxs("div",{className:"si-tabbar",children:[F.jsxs("div",{className:"si-tabs",role:"tablist",children:[F.jsx("button",{role:"tab","aria-selected":E==="terminal",className:E==="terminal"?"si-tab on":"si-tab",onClick:()=>$("terminal"),children:f("session.tabTerminal")}),F.jsx("button",{role:"tab","aria-selected":E==="eval",className:E==="eval"?"si-tab on":"si-tab",onClick:()=>$("eval"),children:f("session.tabEval")})]}),F.jsx("div",{className:"si-actions",children:$e?F.jsx("button",{className:"si-act go",onClick:()=>Fe("resume"),children:f("session.relaunch")}):je.filter(k=>k.button).map(k=>{const P=k.name==="type"?W?" on":Y[he]?" suggest":"":"";return F.jsx("button",{className:`si-act board sc-${k.color} ${k.name}${P}`,"data-tip":f(k.titleKey),onClick:k.run,children:f(k.labelKey)},k.name)})})]}),F.jsxs("div",{className:"si-term-body",ref:le,style:{position:"relative",display:E==="terminal"?void 0:"none"},children:[[...Rt].map(k=>F.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,display:k===he?"block":"none"},children:F.jsx(bs,{sessionId:k,active:k===he,onMenu:Lt})},k)),$e&&F.jsxs("div",{className:"si-offline",children:[F.jsx("div",{className:"si-offline-msg",children:f("session.offlineMsg")}),F.jsxs("div",{className:"si-offline-sub",children:[f("session.offlineSubBefore"),F.jsxs("code",{children:[he.slice(0,8),"…"]}),f("session.offlineSubAfter")]}),F.jsx("button",{className:"si-act go big",onClick:()=>Fe("resume"),children:f("session.relaunchResume")}),D&&F.jsx("div",{className:"si-offline-err",role:"alert",children:D})]})]}),E==="terminal"&&(W?F.jsxs("div",{className:"si-bottom type",onClick:()=>X(!1),"data-tip":f("session.typeExit"),children:[F.jsx("span",{className:"si-type-ind",children:f("session.typeInd")}),F.jsx("span",{className:"si-type-help",children:f("session.typeHelp")})]}):F.jsxs("div",{className:`${x?"si-bottom err":"si-bottom"}${se==="msg"?" dragover":""}`,onDragOver:k=>{Me||at(k,"msg")},onDragLeave:()=>xe(null),onDrop:k=>{Me||ot(k,"msg")},children:[F.jsx("span",{className:"si-prompt",children:"❯"}),F.jsx("textarea",{ref:ne,className:"si-input","data-focus-sink":!0,rows:1,value:De,onChange:k=>{ke(k.target.value),x&&R(!1),Ue(k.target)},onSelect:k=>Ue(k.target),onPaste:k=>{Me||nt(k,"msg")},onBlur:()=>s(null),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&!Ze(k)&&(k.preventDefault(),k.stopPropagation(),Ot())},placeholder:f(Me?"session.msgOffline":"session.msgPlaceholder"),spellCheck:!1,disabled:Me}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("msg"),disabled:re||Me,children:re&&Re==="msg"?F.jsx(Ct,{}):F.jsx(St,{})}),ue&&Re==="msg"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),x&&F.jsx("span",{className:"si-send-err",role:"alert",children:f("session.msgError")}),i&&i.kind==="slash"&&st(!0,i.query?`/${i.query}`:f("session.menuCommands")),i&&(i.kind==="mention"||i.kind==="actor")&&it(!0)]})),E==="eval"&&F.jsx(xs,{sessionId:he,specs:ie,sessions:U,onOpenSession:k=>{$("terminal"),k!==he&&(n==null||n(k))}})]})]})]})}),F.jsx(ys,{menu:r,onClose:()=>h(null),onChanged:g,onMultiSelect:It})]})}export{Ns as default};
|
|
71
|
+
${_e}`:be},At=k=>k.replace(vt,(P,j)=>{const Q=ie.find(_e=>_e.id===j);return Q?`[[${Q.id}]] (${Q.path})`:P}),Mt=()=>{const k=o.trim();if(!k)return;const P=kt(k);e(""),fetch("/api/sessions",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T?{prompt:P,launcher:T}:{prompt:P})}).then(Q=>Q.json().catch(()=>null)).then(()=>g==null?void 0:g()).catch(()=>{})},Tt=(k,P)=>{const j=as(k,P,ie,Ne);if(j)return j;const Q=hs(k,P,U);if(Q)return Q;if(he==="new"){const me=k.match(/^\/(\S*)$/);if(me){const be=Ts(Ie,me[1]);return be.length?{kind:"config",items:be,index:0,start:0,end:k.length,query:me[1]}:null}return null}const _e=k.match(/^\/(\S*)$/);if(_e){const me=je.map(pe=>({name:pe.name,description:f(pe.descKey),ui:!0,color:pe.color})),be=new Set(me.map(pe=>pe.name)),we=As([...me,...p.filter(pe=>!be.has(pe.name))],_e[1]);return we.length?{kind:"slash",items:we,index:0,start:0,end:k.length,query:_e[1]}:null}return null},Ue=k=>s(k?Tt(k.value,k.selectionStart):null),Bt=k=>s(P=>P&&{...P,index:(P.index+k+P.items.length)%P.items.length}),Ve=k=>{if(!k||!i)return;if(i.kind==="slash"){if(k.ui){const Te=je.find(Ye=>Ye.name===k.name);ke(""),s(null),Te==null||Te.run();return}const pe=`/${k.name} `,Be=De.slice(0,i.start);ke(Be+pe+De.slice(i.end)),s(null);const ze=Be.length+pe.length;requestAnimationFrame(()=>{const Te=ne.current;Te&&(Te.focus(),Te.setSelectionRange(ze,ze))});return}const P=i.kind==="config"?`/${k.name} `:i.kind==="actor"?`@${k.id} `:`[[${k.id}]] `,j=(i.kind==="mention"||i.kind==="actor")&&he!=="new",Q=j?ne:oe,_e=j?De:o,me=j?ke:e,be=_e.slice(0,i.start);me(be+P+_e.slice(i.end)),s(null);const we=be.length+P.length;requestAnimationFrame(()=>{const pe=Q.current;pe&&(pe.focus(),pe.setSelectionRange(we,we))})},st=(k,P)=>F.jsxs("ul",{className:k?"mention-menu up":"mention-menu",role:"listbox",children:[F.jsxs("li",{className:"mention-head",children:["// ",P," — ",f("session.menuHint")]}),i.items.map((j,Q)=>{const _e=j.ui?"ui":j.source??j.kind,me=j.ui?` sc-${j.color}`:"";return F.jsxs("li",{role:"option","aria-selected":Q===i.index,className:`${Q===i.index?"mention-item on":"mention-item"}${me}`,onMouseDown:be=>{be.preventDefault(),Ve(j)},onMouseEnter:()=>s(be=>be&&{...be,index:Q}),children:[F.jsxs("span",{className:j.ui?"slash-name ui":"slash-name",children:["/",rs(j.name,i.query)]}),F.jsx("span",{className:"slash-desc",children:Ms(j.description??j.desc)}),F.jsx("span",{className:`slash-src src-${_e}`,children:Bs[_e]||_e})]},`${_e}:${j.name}`)})]}),it=k=>F.jsx(ns,{menu:i,up:k,onPick:Ve,onHover:P=>s(j=>j&&{...j,index:P})}),Ot=async()=>{const k=De;if(!k.trim()||he==="new")return;const P=je.find(Q=>k.trim()===`/${Q.name}`);if(P){ke(""),s(null),P.run();return}const j=At(k);ke(""),R(!1);try{const Q=await fetch(`/api/sessions/${he}/input`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:"text",text:j})});if(!Q.ok)throw new Error(`input ${Q.status}`)}catch{ke(k),R(!0)}},Pt=async k=>{const P=new FormData;P.append("file",k,k.name||"pasted");const j=await fetch("/api/uploads",{method:"POST",body:P});if(!j.ok)throw new Error(`upload ${j.status}`);const Q=await j.json().catch(()=>null);if(!(Q!=null&&Q.path))throw new Error("upload: no path");return Q.path},rt=(k,P,j,Q)=>{const _e=k.current,me=_e?_e.selectionStart:P.length,be=_e?_e.selectionEnd:P.length,we=P.slice(0,me),pe=(we&&!/\s$/.test(we)?" ":"")+Q+" ";j(we+pe+P.slice(be)),requestAnimationFrame(()=>{if(!_e)return;_e.focus();const Be=we.length+pe.length;_e.setSelectionRange(Be,Be)})},Xe=async(k,P)=>{const j=[...k||[]];if(!(!j.length||re)){Se(!1),de(P),te(!0);try{const Q=[];for(const _e of j)Q.push(await Pt(_e));P==="new"?rt(oe,o,e,Q.join(" ")):rt(ne,De,ke,Q.join(" "))}catch{Se(!0)}finally{te(!1)}}},nt=(k,P)=>{var Q;const j=(Q=k.clipboardData)==null?void 0:Q.files;j&&j.length&&(k.preventDefault(),Xe(j,P))},ot=(k,P)=>{var j;k.preventDefault(),xe(null),Xe((j=k.dataTransfer)==null?void 0:j.files,P)},at=(k,P)=>{var j;[...((j=k.dataTransfer)==null?void 0:j.types)||[]].includes("Files")&&(k.preventDefault(),xe(P))},ht=k=>{var P;fe.current=k,(P=ge.current)==null||P.click()},Fe=async k=>{N(null);try{const P=await fetch(`/api/sessions/${he}/${k}`,{method:"POST"});if(!P.ok){const j=await P.json().catch(()=>null);j!=null&&j.error&&N(j.error)}}catch{}await(g==null?void 0:g())},It=k=>{u(!0),c(new Set([k.id]))},lt=()=>{u(!1),c(new Set)},Ft=k=>c(P=>{const j=new Set(P);return j.has(k)?j.delete(k):j.add(k),j}),Ht=()=>{lt(),g==null||g()},Nt={type:()=>X(k=>!k),eval:()=>$("eval"),merge:()=>Fe("merge"),stop:()=>Fe("stop"),close:()=>Fe("close")},je=Rs(ce==null?void 0:ce.status,Nt),ct=K.useRef({});ct.current={order:ve,active:he,submit:Mt,menu:i,navMenu:Bt,accept:Ve,setMenu:s,onClose:l,open:G,searchOpen:z,typeMode:W,setTypeMode:X,sendRawKey:xt},K.useEffect(()=>{const k=P=>{var ut;const{order:j,active:Q,submit:_e,menu:me,navMenu:be,accept:we,setMenu:pe,onClose:Be,open:ze,searchOpen:Te,typeMode:Ye,setTypeMode:jt,sendRawKey:dt}=ct.current;if(!ze||Te)return;const zt=P.code==="KeyI"||P.key==="i"||P.key==="I";if(P.altKey!==P.metaKey&&zt&&Q!=="new"){P.preventDefault(),P.stopPropagation(),jt(Ae=>!Ae);return}if(!(P.altKey&&!P.metaKey&&!P.ctrlKey&&["KeyN","KeyF","Digit1","Digit2","Digit3","Digit4"].includes(P.code))){if((P.metaKey||P.altKey||P.ctrlKey)&&(P.key==="ArrowUp"||P.key==="ArrowDown")){P.preventDefault(),P.stopPropagation();let Ae=j.indexOf(Q);Ae<0&&(Ae=0);const Je=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[Je]);return}if(Ye&&Q!=="new"){if(P.preventDefault(),P.stopPropagation(),P.key==="Escape"){dt("Escape");return}const Ae=ks(P);Ae&&dt(Ae);return}if(me){if(P.key==="ArrowDown"){P.preventDefault(),P.stopPropagation(),be(1);return}if(P.key==="ArrowUp"){P.preventDefault(),P.stopPropagation(),be(-1);return}if((P.key==="Enter"||P.key==="Tab")&&!Ze(P)){P.preventDefault(),P.stopPropagation(),we(me.items[me.index]);return}if(P.key==="Escape"){P.preventDefault(),P.stopPropagation(),pe(null);return}}if(P.key==="ArrowUp"||P.key==="ArrowDown"){if(((ut=P.target)==null?void 0:ut.tagName)==="TEXTAREA")return;P.preventDefault(),P.stopPropagation();const Ae=j.indexOf(Q),Je=Math.max(0,Math.min(j.length-1,Ae+(P.key==="ArrowDown"?1:-1)));O(j[Je]);return}P.key==="Enter"&&!P.shiftKey&&!Ze(P)&&Q==="new"&&(P.preventDefault(),P.stopPropagation(),_e())}};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[O]);const $t=k=>k&&(k.tagName==="TEXTAREA"||k.tagName==="INPUT"||k.isContentEditable),Wt=()=>{const k=oe.current||ne.current;k&&requestAnimationFrame(()=>k.focus())},Ut=k=>{if(k.stopPropagation(),k.button!==0)return;const P=k.target;$t(P)||P.closest&&P.closest("select")||P.closest&&P.closest(".si-term-body")||P.closest&&P.closest(".se-pane")||k.preventDefault()};return K.useEffect(()=>{if(!G)return;const k=P=>{var j;(j=J.current)!=null&&j.contains(P.target)&&(P.preventDefault(),Wt())};return window.addEventListener("contextmenu",k,!0),()=>window.removeEventListener("contextmenu",k,!0)},[G]),F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"si-page",style:G?void 0:{display:"none"},children:F.jsxs("div",{className:"si-panel",ref:J,onMouseDown:Ut,children:[F.jsx("input",{ref:ge,type:"file",multiple:!0,style:{display:"none"},onChange:k=>{Xe(k.target.files,fe.current),k.target.value=""}}),q&&F.jsx(us,{className:"si-list-unfold",folded:!0,onToggle:()=>V(!1)}),F.jsxs("aside",{className:"si-list",style:q?{display:"none"}:{flex:`0 0 ${Oe}px`},children:[v?F.jsx(Es,{ids:[...m],onCancel:lt,onClosed:Ht}):F.jsxs("div",{className:"si-toprow",children:[F.jsx("button",{className:he==="new"?"si-pill new on":"si-pill new","data-tip":f("session.newSessionTitle"),"aria-label":f("session.newSessionTitle"),onClick:()=>O("new"),children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(He,{name:"plus",size:15,strokeWidth:2})})}),F.jsx("button",{className:"si-pill search","data-tip":f("session.searchTitle"),"aria-label":f("session.searchTitle"),onClick:_,children:F.jsx("span",{className:"si-pill-glyph",children:F.jsx(He,{name:"search",size:15})})})]}),Ee.map(k=>{var _e;if(k.type==="zone")return F.jsx("div",{className:`si-zone si-zone-${k.zone}`,children:f(`sessionZone.${k.zone}`)},`zone-${k.zone}`);const P=k.s,j=k.expandable||k.depth?F.jsx(ts,{guides:k.guides,expandable:k.expandable,expanded:k.expanded,rollup:k.rollup,kin:k.kin,onToggle:()=>ye(P.id)}):null,Q=v&&m.has(P.id);return F.jsxs("button",{"data-sid":P.id,className:`si-item${!v&&he===P.id?" on":""}${Q?" picked":""}`,style:{"--ov":is(P.id)},onClick:()=>v?Ft(P.id):O(P.id),onDoubleClick:()=>{!v&&d&&(d(P,!1),l())},onContextMenu:me=>{me.preventDefault(),me.stopPropagation(),v||h({x:me.clientX,y:me.clientY,session:P})},"data-tip":(_e=P.ops)!=null&&_e.length?f("session.opsTitle"):f("session.lockTitle"),children:[v&&F.jsx("span",{className:`si-check${Q?" on":""}`,"aria-hidden":"true"}),F.jsx(ss,{s:P,locked:!1,showAvatar:!1,compact:!0,lead:j})]},P.id)})]}),!q&&F.jsx("div",{className:"pane-resizer si-resizer",onMouseDown:Pe,role:"separator","aria-orientation":"vertical"}),F.jsxs("section",{className:he==="new"?"si-content is-new":"si-content is-session",children:[he==="new"&&F.jsxs("div",{className:"si-new-center",children:[F.jsx("div",{className:"si-avatar","aria-hidden":"true",children:F.jsxs("svg",{viewBox:"0 0 64 64",width:"52",height:"52",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[F.jsx("path",{d:"M15 35 Q32 44 49 35",strokeWidth:"2.8"}),F.jsx("path",{d:"M32 17 L20 42",strokeWidth:"3.2"}),F.jsx("path",{d:"M32 17 L44 42",strokeWidth:"3.2"}),F.jsxs("g",{fill:"currentColor",stroke:"none",children:[F.jsx("circle",{cx:"32",cy:"16.5",r:"5"}),F.jsx("circle",{cx:"20",cy:"42.6",r:"5"}),F.jsx("circle",{cx:"44",cy:"42.6",r:"5"})]})]})}),F.jsx("div",{className:"si-ask",children:f("session.ask")}),F.jsxs("div",{className:se==="new"?"si-inputwrap dragover":"si-inputwrap",onDragOver:k=>at(k,"new"),onDragLeave:()=>xe(null),onDrop:k=>ot(k,"new"),children:[F.jsx("textarea",{ref:oe,className:"si-input","data-focus-sink":!0,rows:1,value:o,onChange:k=>{e(k.target.value),Ue(k.target)},onSelect:k=>Ue(k.target),onPaste:k=>nt(k,"new"),onBlur:()=>s(null),placeholder:f("session.inputPlaceholder"),spellCheck:!1}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("new"),disabled:re,children:re&&Re==="new"?F.jsx(Ct,{}):F.jsx(St,{})}),ue&&Re==="new"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),i&&(i.kind==="mention"||i.kind==="actor")&&it(!1),i&&i.kind==="config"&&st(!1,i.query?`/${i.query}`:f("session.menuPresets"))]}),B.length?(()=>{var j;const k=mt[((j=B.find(Q=>Q.name===T))==null?void 0:j.harness)||"claude"]||mt.claude,P=k.Glyph;return F.jsxs("label",{className:"si-launcher-picker","data-tip":f("session.launcherLabel"),children:[F.jsx("span",{className:"si-launcher-label",children:f("session.launcherLabel")}),F.jsx("span",{className:"si-launcher-harness","data-tip":k.label,"aria-hidden":"true",children:F.jsx(P,{})}),F.jsx("select",{className:"si-launcher-select",value:T,onChange:Q=>C(Q.target.value),"aria-label":f("session.launcherLabel"),children:B.map(Q=>F.jsx("option",{value:Q.name,children:Q.name},Q.name))})]})})():null,F.jsxs("div",{className:"si-hint",children:[f("session.hint.before"),F.jsx("code",{children:"[["}),f("session.hint.mid"),F.jsx("code",{children:"/"}),f("session.hint.after")]})]}),F.jsxs("div",{className:"si-session-wrap",style:{display:he==="new"?"none":"flex",flexDirection:"column",flex:1,minWidth:0,minHeight:0,position:"relative"},children:[F.jsxs("div",{className:"si-tabbar",children:[F.jsxs("div",{className:"si-tabs",role:"tablist",children:[F.jsx("button",{role:"tab","aria-selected":E==="terminal",className:E==="terminal"?"si-tab on":"si-tab",onClick:()=>$("terminal"),children:f("session.tabTerminal")}),F.jsx("button",{role:"tab","aria-selected":E==="eval",className:E==="eval"?"si-tab on":"si-tab",onClick:()=>$("eval"),children:f("session.tabEval")})]}),F.jsx("div",{className:"si-actions",children:$e?F.jsx("button",{className:"si-act go",onClick:()=>Fe("resume"),children:f("session.relaunch")}):je.filter(k=>k.button).map(k=>{const P=k.name==="type"?W?" on":Y[he]?" suggest":"":"";return F.jsx("button",{className:`si-act ui sc-${k.color} ${k.name}${P}`,"data-tip":f(k.titleKey),onClick:k.run,children:f(k.labelKey)},k.name)})})]}),F.jsxs("div",{className:"si-term-body",ref:le,style:{position:"relative",display:E==="terminal"?void 0:"none"},children:[[...Rt].map(k=>F.jsx("div",{className:"si-term-layer",style:{position:"absolute",inset:0,display:k===he?"block":"none"},children:F.jsx(bs,{sessionId:k,active:k===he,onMenu:Lt})},k)),$e&&F.jsxs("div",{className:"si-offline",children:[F.jsx("div",{className:"si-offline-msg",children:f("session.offlineMsg")}),F.jsxs("div",{className:"si-offline-sub",children:[f("session.offlineSubBefore"),F.jsxs("code",{children:[he.slice(0,8),"…"]}),f("session.offlineSubAfter")]}),F.jsx("button",{className:"si-act go big",onClick:()=>Fe("resume"),children:f("session.relaunchResume")}),D&&F.jsx("div",{className:"si-offline-err",role:"alert",children:D})]})]}),E==="terminal"&&(W?F.jsxs("div",{className:"si-bottom type",onClick:()=>X(!1),"data-tip":f("session.typeExit"),children:[F.jsx("span",{className:"si-type-ind",children:f("session.typeInd")}),F.jsx("span",{className:"si-type-help",children:f("session.typeHelp")})]}):F.jsxs("div",{className:`${x?"si-bottom err":"si-bottom"}${se==="msg"?" dragover":""}`,onDragOver:k=>{Me||at(k,"msg")},onDragLeave:()=>xe(null),onDrop:k=>{Me||ot(k,"msg")},children:[F.jsx("span",{className:"si-prompt",children:"❯"}),F.jsx("textarea",{ref:ne,className:"si-input","data-focus-sink":!0,rows:1,value:De,onChange:k=>{ke(k.target.value),x&&R(!1),Ue(k.target)},onSelect:k=>Ue(k.target),onPaste:k=>{Me||nt(k,"msg")},onBlur:()=>s(null),onKeyDown:k=>{k.key==="Enter"&&!k.shiftKey&&!Ze(k)&&(k.preventDefault(),k.stopPropagation(),Ot())},placeholder:f(Me?"session.msgOffline":"session.msgPlaceholder"),spellCheck:!1,disabled:Me}),F.jsx("button",{type:"button",className:"si-attach","data-tip":f("session.attachTitle"),onClick:()=>ht("msg"),disabled:re||Me,children:re&&Re==="msg"?F.jsx(Ct,{}):F.jsx(St,{})}),ue&&Re==="msg"&&F.jsx("span",{className:"si-attach-err",role:"alert",children:f("session.attachError")}),x&&F.jsx("span",{className:"si-send-err",role:"alert",children:f("session.msgError")}),i&&i.kind==="slash"&&st(!0,i.query?`/${i.query}`:f("session.menuCommands")),i&&(i.kind==="mention"||i.kind==="actor")&&it(!0)]})),E==="eval"&&F.jsx(xs,{sessionId:he,specs:ie,sessions:U,onOpenSession:k=>{$("terminal"),k!==he&&(n==null||n(k))}})]})]})]})}),F.jsx(ys,{menu:r,onClose:()=>h(null),onChanged:g,onMultiSelect:It})]})}export{Ns as default};
|