toolroll 0.9.114 → 0.9.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/agent-state-words.js +1 -1
  3. package/dist/assignment-ui.js +1 -1
  4. package/dist/browser/terminal.css +1 -1
  5. package/dist/browser/terminal.js +1 -1
  6. package/dist/browser/workspace.css +2 -2
  7. package/dist/browser/workspace.js +29 -28
  8. package/dist/chat-controls.js +1 -1
  9. package/dist/chat-quiet.js +2 -2
  10. package/dist/chat-voice.js +3 -3
  11. package/dist/check-levels.js +1 -1
  12. package/dist/claim.js +7 -2
  13. package/dist/cli.js +1 -0
  14. package/dist/code-map-cli.js +2 -1
  15. package/dist/coding-shipping-ui.js +2 -1
  16. package/dist/console-instance.js +21 -1
  17. package/dist/contracts/console-api.js +6 -2
  18. package/dist/contracts/engine-api.js +32 -4
  19. package/dist/demo-chat.js +1 -1
  20. package/dist/design/kit.css +3 -0
  21. package/dist/design/kit.js +1 -1
  22. package/dist/dispatch.js +19 -2
  23. package/dist/easy-start.js +23 -11
  24. package/dist/engine-reads.js +98 -7
  25. package/dist/export.js +16 -4
  26. package/dist/flexible-authority-end.js +94 -0
  27. package/dist/flexible-everyday-schema.js +76 -0
  28. package/dist/flexible-interactive-schema.js +133 -0
  29. package/dist/flexible-interactive.js +94 -0
  30. package/dist/flexible-laptop.js +38 -0
  31. package/dist/flexible-relay.js +9 -3
  32. package/dist/flexible-session.js +430 -10
  33. package/dist/flexible-ship.js +77 -12
  34. package/dist/flexible-sign-in.js +16 -1
  35. package/dist/flexible-start.js +17 -2
  36. package/dist/flexible-thread.js +1 -1
  37. package/dist/flexible-turns.js +9 -0
  38. package/dist/flexible-ui.js +3 -2
  39. package/dist/flexible.js +13 -0
  40. package/dist/flow-card-task.js +1 -1
  41. package/dist/home-groups.js +1 -1
  42. package/dist/lead-status.js +5 -3
  43. package/dist/lead-tools.js +1 -0
  44. package/dist/local-owner-acts.js +44 -1
  45. package/dist/local-owner.js +10 -0
  46. package/dist/needs-you.js +18 -6
  47. package/dist/operate-remote-arguments.js +1 -1
  48. package/dist/operate.js +250 -32
  49. package/dist/plan-problems-schema.js +4 -0
  50. package/dist/planner.js +17 -6
  51. package/dist/release-cli.js +2 -2
  52. package/dist/result-actions.js +1 -2
  53. package/dist/retention-ui.js +1 -1
  54. package/dist/scope.js +18 -7
  55. package/dist/server/chat.js +3 -3
  56. package/dist/server/console.css +15 -10
  57. package/dist/server/engine-api.js +161 -15
  58. package/dist/server/flows.js +4 -3
  59. package/dist/server/home.js +1 -1
  60. package/dist/server/kit.js +2 -2
  61. package/dist/server/render-chat.js +1 -1
  62. package/dist/server/render-pages.js +1 -1
  63. package/dist/server/render-tasks.js +21 -12
  64. package/dist/server/route-table.js +16 -0
  65. package/dist/server/settings-sections.js +6 -2
  66. package/dist/server/settings.js +22 -8
  67. package/dist/server/task-views.js +10 -4
  68. package/dist/server/tasks.js +51 -4
  69. package/dist/settings-kit.js +3 -3
  70. package/dist/skills-ui.js +3 -2
  71. package/dist/spend-report.js +2 -2
  72. package/dist/spend.js +3 -3
  73. package/dist/store.js +202 -7
  74. package/dist/subagent-admin.js +23 -10
  75. package/dist/subagent-backup-schema.js +36 -0
  76. package/dist/subagent-backup.js +92 -0
  77. package/dist/subagent-week.js +2 -2
  78. package/dist/subagent-work.js +70 -47
  79. package/dist/subagents-ui.js +6 -2
  80. package/dist/subagents.js +5 -2
  81. package/dist/subscription-chat.js +4 -0
  82. package/dist/surface.js +8 -1
  83. package/dist/task-status.js +13 -13
  84. package/dist/telegram-status.js +3 -3
  85. package/dist/terminal-safety.js +114 -0
  86. package/dist/toolroll-update.js +2 -1
  87. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  88. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  89. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  90. package/dist/tui/linux-x64/toolroll-tui +0 -0
  91. package/dist/tui-launch.js +20 -1
  92. package/dist/tui.js +1 -1
  93. package/dist/work-index.js +23 -10
  94. package/dist/workspace-ui.js +5 -5
  95. package/dist/youiyoux-intake.js +1 -1
  96. package/package.json +2 -2
@@ -151,7 +151,7 @@ out vec4 outColor;
151
151
 
152
152
  void main() {
153
153
  outColor = v_color;
154
- }`,Gs=8,_m=Gs*Float32Array.BYTES_PER_ELEMENT,jM=20*Gs,bk=class{constructor(){this.attributes=new Float32Array(jM),this.count=0}},Vs=0,wk=0,Sk=0,kk=0,xk=0,Ck=0,Ek=0,GM=class extends wi{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new bk,this._verticesCursor=new bk;let r=this._gl;this._program=Ze(ux(r,WM,VM)),this._register(Mt(()=>r.deleteProgram(this._program))),this._projectionLocation=Ze(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(Mt(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=r.createBuffer();this._register(Mt(()=>r.deleteBuffer(l))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,l),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=Ze(r.createBuffer()),this._register(Mt(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,_m,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,_m,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,_m,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(c=>{this._updateCachedColors(c),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,hx),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.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(e){let t=this._terminal,i=this._vertices,s=1,r,n,o,a,l,c,h,u,d,f,g;for(r=0;r<t.rows;r++){for(o=-1,a=0,l=0,c=!1,n=0;n<t.cols;n++)h=(r*t.cols+n)*bu,u=e.cells[h+pu],d=e.cells[h+gu],f=!!(d&67108864),(u!==a||d!==l&&(c||f))&&((a!==0||c&&l!==0)&&(g=s++*Gs,this._updateRectangle(i,g,l,a,o,n,r)),o=n,a=u,l=d,c=f);(a!==0||c&&l!==0)&&(g=s++*Gs,this._updateRectangle(i,g,l,a,o,t.cols,r))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,r=0;(i.style==="bar"||i.style==="outline")&&(s=r++*Gs,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=r++*Gs,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=r++*Gs,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=r++*Gs,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,s,r,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Vs=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Vs=(i&16777215)<<8;break;default:Vs=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Vs=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Vs=(s&16777215)<<8;break;default:Vs=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=OM(e.attributes,this._terminal.rows*this._terminal.cols*Gs)),wk=r*this._dimensions.device.cell.width,Sk=o*this._dimensions.device.cell.height,kk=(Vs>>24&255)/255,xk=(Vs>>16&255)/255,Ck=(Vs>>8&255)/255,Ek=1,this._addRectangle(e.attributes,t,wk,Sk,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,kk,xk,Ck,Ek)}_addRectangle(e,t,i,s,r,n,o,a,l,c){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=l,e[t+7]=c}_addRectangleFloat(e,t,i,s,r,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},YM=class extends wi{constructor(e,t,i,s,r,n,o,a){super(),this._container=t,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,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(l=>{this._refreshCharAtlas(e,l),this.reset(e)})),this._register(Mt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ze(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=lx(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+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(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Xk,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},XM=class extends YM{constructor(e,t,i,s,r,n,o){super(i,e,"link",t,!0,r,n,o),this._register(s.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(s.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&DM(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},Vi=typeof window=="object"?window:globalThis,Nm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ke,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ke,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Nm.INSTANCE=new Nm;var dx=Nm;function ZM(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var jD=dx.INSTANCE.onDidChangeZoomLevel,GD=dx.INSTANCE.onDidChangeFullscreen,Vo=typeof navigator=="object"?navigator.userAgent:"",YD=Vo.indexOf("Firefox")>=0,vm=Vo.indexOf("AppleWebKit")>=0,QM=Vo.indexOf("Chrome")>=0,JM=!QM&&Vo.indexOf("Safari")>=0,XD=Vo.indexOf("Electron/")>=0,ZD=Vo.indexOf("Android")>=0,mu=!1;if(typeof Vi.matchMedia=="function"){let e=Vi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Vi.matchMedia("(display-mode: fullscreen)");mu=e.matches,ZM(Vi,e,({matches:i})=>{mu&&t.matches||(mu=i)})}function eR(){return mu}var $o="en",Bm=!1,Om=!1,_u=!1,tR=!1,fx=!1,px=!1,iR=!1,sR=!1,rR=!1,nR=!1,hu,vu=$o,Tk=$o,oR,js,Zs=globalThis,bi;typeof Zs.vscode<"u"&&typeof Zs.vscode.process<"u"?bi=Zs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(bi=process);var gx=typeof bi?.versions?.electron=="string",aR=gx&&bi?.type==="renderer";if(typeof bi=="object"){Bm=bi.platform==="win32",Om=bi.platform==="darwin",_u=bi.platform==="linux",tR=_u&&!!bi.env.SNAP&&!!bi.env.SNAP_REVISION,iR=gx,rR=!!bi.env.CI||!!bi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hu=$o,vu=$o;let e=bi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);hu=t.userLocale,Tk=t.osLocale,vu=t.resolvedLanguage||$o,oR=t.languagePack?.translationsConfigFile}catch{}fx=!0}else typeof navigator=="object"&&!aR?(js=navigator.userAgent,Bm=js.indexOf("Windows")>=0,Om=js.indexOf("Macintosh")>=0,sR=(js.indexOf("Macintosh")>=0||js.indexOf("iPad")>=0||js.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_u=js.indexOf("Linux")>=0,nR=js?.indexOf("Mobi")>=0,px=!0,vu=globalThis._VSCODE_NLS_LANGUAGE||$o,hu=navigator.language.toLowerCase(),Tk=hu):console.error("Unable to resolve platform.");var ym=0;Om?ym=1:Bm?ym=3:_u&&(ym=2);var bm=fx,lR=px&&typeof Zs.importScripts=="function",QD=lR?Zs.origin:void 0,_s=js,Ir=vu,cR;(e=>{function t(){return Ir}e.value=t;function i(){return Ir.length===2?Ir==="en":Ir.length>=3?Ir[0]==="e"&&Ir[1]==="n"&&Ir[2]==="-":!1}e.isDefaultVariant=i;function s(){return Ir==="en"}e.isDefault=s})(cR||={});var hR=typeof Zs.postMessage=="function"&&!Zs.importScripts,uR=(()=>{if(hR){let e=[];Zs.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),Zs.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),dR=!!(_s&&_s.indexOf("Chrome")>=0),JD=!!(_s&&_s.indexOf("Firefox")>=0),eN=!!(!dR&&_s&&_s.indexOf("Safari")>=0),tN=!!(_s&&_s.indexOf("Edg/")>=0),iN=!!(_s&&_s.indexOf("Android")>=0),Fr=typeof navigator=="object"?navigator:{},sN={clipboard:{writeText:bm||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Fr&&Fr.clipboard&&Fr.clipboard.writeText),readText:bm||!!(Fr&&Fr.clipboard&&Fr.clipboard.readText)},keyboard:bm||eR()?0:Fr.keyboard||JM?1:2,touch:"ontouchstart"in Vi||Fr.maxTouchPoints>0,pointerEvents:Vi.PointerEvent&&("ontouchstart"in Vi||navigator.maxTouchPoints>0)},qm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},wm=new qm,Ak=new qm,Mk=new qm,rN=new Array(230),fR;(e=>{function t(a){return wm.keyCodeToStr(a)}e.toString=t;function i(a){return wm.strToKeyCode(a)}e.fromString=i;function s(a){return Ak.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Mk.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Ak.strToKeyCode(a)||Mk.strToKeyCode(a)}e.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return wm.keyCodeToStr(a)}e.toElectronAccelerator=o})(fR||={});var mx=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),pR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof gR?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ys.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:mx})})(pR||={});var gR=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?mx:(this._emitter||(this._emitter=new ke),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var mR,Sm;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Sm=(e,t)=>{uR(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Sm=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},mR=e=>Sm(globalThis,e)})();var _R;(e=>{async function t(s){let r,n=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(_R||={});var Rk=class Hi{static fromArray(t){return new Hi(i=>{i.emitMany(t)})}static fromPromise(t){return new Hi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Hi(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Hi(async i=>{await Promise.all(t.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ke,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ys.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Hi(async s=>{for await(let r of t)s.emitOne(i(r))})}map(t){return Hi.map(this,t)}static filter(t,i){return new Hi(async s=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return Hi.filter(this,t)}static coalesce(t){return Hi.filter(t,i=>!!i)}coalesce(){return Hi.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Hi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Rk.EMPTY=Rk.fromArray([]);function vR(e){return 55296<=e&&e<=56319}function Lk(e){return 56320<=e&&e<=57343}function yR(e,t){return(e-55296<<10)+(t-56320)+65536}function bR(e){return Im(e,0)}function Im(e,t){switch(typeof e){case"object":return e===null?Xs(349,t):Array.isArray(e)?SR(e,t):kR(e,t);case"string":return _x(e,t);case"boolean":return wR(e,t);case"number":return Xs(e,t);case"undefined":return Xs(937,t);default:return Xs(617,t)}}function Xs(e,t){return(t<<5)-t+e|0}function wR(e,t){return Xs(e?433:863,t)}function _x(e,t){t=Xs(149417,t);for(let i=0,s=e.length;i<s;i++)t=Xs(e.charCodeAt(i),t);return t}function SR(e,t){return t=Xs(104579,t),e.reduce((i,s)=>Im(s,i),t)}function kR(e,t){return t=Xs(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=_x(s,i),Im(e[s],i)),t)}function km(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function Dk(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function xR(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function Tl(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):xR((e>>>0).toString(16),t/4)}var CR=class vx{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let s=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let l=o;if(vR(o))if(a+1<i){let c=t.charCodeAt(a+1);Lk(c)?(a++,l=yR(o,c)):l=65533}else{n=o;break}else Lk(o)&&(l=65533);if(r=this._push(s,r,l),a++,a<i)o=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=n}_push(t,i,s){return s<128?t[i++]=s:s<2048?(t[i++]=192|(s&1984)>>>6,t[i++]=128|(s&63)>>>0):s<65536?(t[i++]=224|(s&61440)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0):(t[i++]=240|(s&1835008)>>>18,t[i++]=128|(s&258048)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Tl(this._h0)+Tl(this._h1)+Tl(this._h2)+Tl(this._h3)+Tl(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Dk(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Dk(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=vx._bigBlock32,i=this._buffDV;for(let u=0;u<64;u+=4)t.setUint32(u,i.getUint32(u,!1),!1);for(let u=64;u<320;u+=4)t.setUint32(u,km(t.getUint32(u-12,!1)^t.getUint32(u-32,!1)^t.getUint32(u-56,!1)^t.getUint32(u-64,!1),1),!1);let s=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,l,c,h;for(let u=0;u<80;u++)u<20?(l=r&n|~r&o,c=1518500249):u<40?(l=r^n^o,c=1859775393):u<60?(l=r&n|r&o|n&o,c=2400959708):(l=r^n^o,c=3395469782),h=km(s,5)+l+a+c+t.getUint32(u*4,!1)&4294967295,a=o,o=n,n=km(r,30),r=s,s=h;this._h0=this._h0+s&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};CR._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:nN,getWindow:ER,getDocument:oN,getWindows:aN,getWindowsCount:lN,getWindowId:Nk,getWindowById:cN,hasWindow:hN,onDidRegisterWindow:uN,onWillUnregisterWindow:dN,onDidUnregisterWindow:fN}=(function(){let e=new Map,t={window:Vi,disposables:new Ko};e.set(Vi.vscodeWindowId,t);let i=new ke,s=new ke,r=new ke;function n(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return wi.None;let a=new Ko,l={window:o,disposables:a.add(new Ko)};return e.set(o.vscodeWindowId,l),a.add(Mt(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(zm(o,MR.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:Vi},getDocument(o){return ER(o).document}}})(),TR=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function zm(e,t,i,s){return new TR(e,t,i,s)}var AR,Bk,xm=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){uu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(xm.sort),o.shift().execute();s.set(n,!1)};Bk=(n,o,a=0)=>{let l=Nk(n),c=new xm(o,a),h=e.get(l);return h||(h=[],e.set(l,h)),h.push(c),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>r(l))),c},AR=(n,o,a)=>{let l=Nk(n);if(s.get(l)){let c=new xm(o,a),h=t.get(l);return h||(h=[],t.set(l,h)),h.push(c),c}else return Bk(n,o,a)}})();var Ok=class yu{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new yu(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof yu?t:new yu(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Ok.None=new Ok(0,0);var pN=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=bR(i),n=s.get(r);if(n)n.users+=1;else{let o=new ke,a=new MutationObserver(c=>o.fire(c));a.observe(e,i);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(Mt(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}},MR={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:vm?"webkitAnimationStart":"animationstart",ANIMATION_END:vm?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:vm?"webkitAnimationIteration":"animationiteration"},RR=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function yx(e,t,i,...s){let r=RR.exec(t);if(!r)throw new Error("Bad use of emmet");let n=r[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...s),o}function LR(e,t,...i){return yx("http://www.w3.org/1999/xhtml",e,t,...i)}LR.SVG=function(e,t,...i){return yx("http://www.w3.org/2000/svg",e,t,...i)};var DR=class extends wi{constructor(e,t,i,s,r,n,o,a,l){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new kl,this._charAtlasDisposable=this._register(new kl),this._observerDisposable=this._register(new kl),this._model=new KM,this._workCell=new vk,this._workCell2=new vk,this._rectangleRenderer=this._register(new kl),this._glyphRenderer=this._register(new kl),this._onChangeTextureAtlas=this._register(new ke),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ke),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ke),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ke),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ke),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let c={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",c),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new nM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new XM(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=sM(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(zm(this._canvas,"webglcontextlost",h=>{console.log("webglcontextlost event received"),h.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(h)},3e3)})),this._register(zm(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,mk(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=_k(this._canvas,this._coreBrowserService.window,(h,u)=>this._setCanvasDevicePixelDimensions(h,u)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=_k(this._canvas,h,(u,d)=>this._setCanvasDevicePixelDimensions(u,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Mt(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),mk(this._terminal)}))}get textureAtlas(){return this._charAtlas?.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(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.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`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new GM(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new qM(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=lx(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._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Wk(Ys.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ys.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new NM(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,r,n,o,a,l,c,h=0,u=!0,d,f,g,b,T,_,m,v,p;e=zk(e,i.rows-1,0),t=zk(t,i.rows-1,0);let E=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,L=A-i.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),W=-1,$=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let P=!1;for(n=e;n<=t;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,g=A===o,h=0,l=this._characterJoinerService.getJoinedCharacters(o),v=0;v<i.cols;v++){if(r=this._cellColorResolver.result.bg,a.loadCell(v,s),v===0&&(r=this._cellColorResolver.result.bg),c=!1,u=v>=h,d=v,l.length>0&&v===l[0][0]&&u){f=l.shift();let Rt=this._model.selection.isCellSelected(this._terminal,f[0],o);for(m=f[0]+1;m<f[1];m++)u&&=Rt===this._model.selection.isCellSelected(this._terminal,m,o);u&&=!g||B<f[0]||B>=f[1],u?(c=!0,s=new NR(s,a.translateToString(!0,f[0],f[1]),f[1]-f[0]),d=f[1]-1):h=f[1]}if(b=s.getChars(),T=s.getCode(),m=(n*i.cols+v)*bu,this._cellColorResolver.resolve(s,v,o,this.dimensions.device.cell.width),$&&o===A&&(v===B&&(this._model.cursor={x:B,y:L,width:s.getWidth(),style:this._coreBrowserService.isFocused?E:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},W=B+s.getWidth()-1),v>=B&&v<=W&&(this._coreBrowserService.isFocused&&E==="block"||this._coreBrowserService.isFocused===!1&&i.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)),T!==0&&(this._model.lineLengths[n]=v+1),!(this._model.cells[m]===T&&this._model.cells[m+pu]===this._cellColorResolver.result.bg&&this._model.cells[m+gu]===this._cellColorResolver.result.fg&&this._model.cells[m+mm]===this._cellColorResolver.result.ext)&&(P=!0,b.length>1&&(T|=$M),this._model.cells[m]=T,this._model.cells[m+pu]=this._cellColorResolver.result.bg,this._model.cells[m+gu]=this._cellColorResolver.result.fg,this._model.cells[m+mm]=this._cellColorResolver.result.ext,_=s.getWidth(),this._glyphRenderer.value.updateCell(v,n,T,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,b,_,r),c)){for(s=this._workCell,v++;v<=d;v++)p=(n*i.cols+v)*bu,this._glyphRenderer.value.updateCell(v,n,0,0,0,0,XA,0,0),this._model.cells[p]=0,this._model.cells[p+pu]=this._cellColorResolver.result.bg,this._model.cells[p+gu]=this._cellColorResolver.result.fg,this._model.cells[p+mm]=this._cellColorResolver.result.ext;v--}}P&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},NR=class extends Fo{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function zk(e,t,i=0){return Math.max(Math.min(e,t),i)}var Hk="di$target",Uk="di$dependencies",Cm=new Map;function vs(e){if(Cm.has(e))return Cm.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");BR(t,i,r)};return t._id=e,Cm.set(e,t),t}function BR(e,t,i){t[Hk]===t?t[Uk].push({id:e,index:i}):(t[Uk]=[{id:e,index:i}],t[Hk]=t)}var gN=vs("BufferService"),mN=vs("CoreMouseService"),_N=vs("CoreService"),vN=vs("CharsetService"),yN=vs("InstantiationService"),bN=vs("LogService"),OR=vs("OptionsService"),wN=vs("OscLinkService"),SN=vs("UnicodeService"),kN=vs("DecorationService"),zR={trace:0,debug:1,info:2,warn:3,error:4,off:5},HR="xterm.js: ",Pk=class extends wi{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),bx=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=zR[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":HR)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Pk=RA([LA(0,OR)],Pk);var bx;function UR(e){bx=e}var wx=class extends wi{constructor(e){if(Gk&&YA()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ke),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ke),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ke),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ke),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,s=t.optionsService,r=t,n=r._renderService,o=r._characterJoinerService,a=r._charSizeService,l=r._coreBrowserService,c=r._decorationService,h=r._logService,u=r._themeService;UR(h),this._renderer=this._register(new DR(e,o,a,l,i,c,s,u,this._preserveDrawingBuffer)),this._register(Ys.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ys.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ys.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ys.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(Mt(()=>{if(this._terminal._core._store._isDisposed)return;let d=this._terminal._core._renderService;d.setRenderer(this._terminal._core._createRenderer()),d.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var xx=Symbol("html"),Dl=class{#e;constructor(t,i){if(t!==xx)throw new TypeError("Html is made by html`…`");this.#e=i}static markupOf(t){return t.#e}toString(){if(Sx)throw new Error("Html coerced to a string: interpolate it with html`…` or hand it to a sink");return this.#e}toJSON(){if(Sx)throw new Error("Html serialized as JSON: convert it with htmlString() first");return this.#e}},Sx=typeof process<"u"&&process.env.VITEST!==void 0,PR=e=>new Dl(xx,e);var qR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},IR=e=>e.replace(/[&<>"']/g,t=>qR[t]);function Cx(e){if(e==null||typeof e=="boolean")return"";if(e instanceof Dl)return Dl.markupOf(e);if(Array.isArray(e))return e.map(Cx).join("");if(typeof e=="string")return IR(e);if(typeof e=="number"||typeof e=="bigint")return String(e);throw new TypeError(`html: cannot interpolate ${typeof e}`)}var kx=new WeakSet,FR=/<form\b[^>]*\bmethod\s*=\s*["']?post\b/i,$R=/\bname\s*=\s*["']?csrf\b/i;function KR(e){if(kx.has(e))return;let t=e.join("\0");if(FR.test(t))throw new Error("html: write POST forms with postForm, which adds the CSRF field");if($R.test(t))throw new Error("html: postForm adds the CSRF field; don't write one");kx.add(e)}function jo(e,...t){KR(e);let i=e[0];for(let s=0;s<t.length;s++)i+=Cx(t[s])+e[s+1];return PR(i)}var K=(e,t,i)=>({never:e,pattern:new RegExp(`(?<![\\w-])(?:${t})(?![\\w-])`,"i"),say:i}),Ex=[K("scope","scopes?|scoped","plan"),K("contract","contracts?","plan"),K("signs","signs|signed(?!\\s+(?:in|out|into)\\b)","Approved by …"),K("sealed","seal|seals|sealed|sealing","approved"),K("binds","binds?","approved"),K("digest","digests?","(the plan version, in Details)"),K("worker","workers?","builder"),K("runner","runners?","builder"),K("daemon","daemons?","builder"),K("background service","background service","builder"),K("operator","operators?|instance operator","approver, or owner"),K("coordinator","coordinators?","your lead"),K("mate","mate","your lead"),K("scout","scouts?|scouting|scouted","research"),K("criterion","criterion|criteria","requirement"),K("evidence","evidence","requirement, or the saved files"),K("proof","proofs?","requirement"),K("verdict","verdicts?","requirement"),K("caveat","caveats?","requirement"),K("mark complete","mark(?:ed|s|ing)?\\s+(?:it\\s+|this\\s+|that\\s+|them\\s+|the\\s+result\\s+)?complete","Accept"),K("Accept and finish","accept\\s+and\\s+finish","Accept"),K("Revise","revise","Send back, or Request changes"),K("re-file","re-?file[ds]?|re-?filing","Send back, or Request changes"),K("Draft a repair task","draft\\s+a\\s+repair\\s+task","Send back"),K("put away","put(?:s|ting)?\\s+(?:it\\s+|them\\s+|tasks\\s+|old\\s+tasks\\s+)?away","Archive"),K("tidy","tidy|tidied|tidying","Archive"),K("run #N","(?:run|result)\\s+#?\\d+|attempt\\s+#?\\d+(?!\\s+\\(build\\s+#\\d+\\))","build #N, or attempt N (build #M)"),K("reconcile","reconcile[ds]?|reconciling|reconciliation","Waiting: Toolroll is …"),K("requeue","requeue[ds]?|requeuing","Waiting: Toolroll is …"),K("claim","claim|claimed","Waiting: Toolroll is …"),K("lease","leases?|leased","Waiting: Toolroll is …"),K("custody","custody","Waiting: Toolroll is …"),K("incident","incidents?","Waiting: Toolroll is …"),K("plane","plane","Toolroll"),K("fence","fences?|fenced","Waiting: Toolroll is …"),K("attested","attest|attested|attestation","Waiting: Toolroll is …"),K("receipt","receipts?","Waiting: Toolroll is …"),K("regate","regate[ds]?","Run checks"),K("carried","carried|carry|carries","Waiting: Toolroll is …"),K("incarnation","incarnations?","Waiting: Toolroll is …"),K("admission","admission","Waiting: Toolroll is …"),K("quiescence","quiescen(?:ce|t)","Waiting: Toolroll is …"),K("witness","witness(?:es|ed)?","Waiting: Toolroll is …"),K("unproven","unproven","Waiting: Toolroll is …"),K("version hex","(?=[0-9a-f]*\\d)(?=[0-9a-f]*[a-f])[0-9a-f]{12,64}","(the plan version, in Details)")],WR=Ex.map(e=>e.never);var yB=[K("lead","lead","Toolroll, or Chat"),K("crew","crew","Toolroll"),K("scope","scopes?|scoped","plan"),K("mode","modes?","(Settings)"),K("flow","flows?","(Settings)"),K("fleet","fleet","(Settings)"),K("fallback","fallbacks?","(Settings)"),K("routing","routing|routed","(Settings)"),K("spend","spend|spends|spending|spent","cost"),K("MCP","mcp","(Settings)"),K("password","passwords?|passwordless","(only where one is asked for)"),K("token","tokens?","(Settings)"),K("builder","builders?","taking work")];var Tx={queued:{stage:"queued"},ready:{stage:"queued"},"provider-quota":{stage:"queued"},running:{stage:"building"},reviewing:{stage:"reviewing"},"review-pending":{stage:"building"},"checks-running":{stage:"checking"},"ready-to-check":{stage:"finished",act:"open-result"},"ready-to-review":{stage:"finished"},"report-ready":{stage:"finished"},"no-change":{stage:"finished"},"pr-opened":{stage:"finished"},"merge-observed":{stage:"finished"},"pr-closed":{stage:"finished"},"agent-attested":{stage:"finished"},"accepted-exception":{stage:"finished"},complete:{stage:"complete",act:"open-result"},cancelled:{stage:"stopped",act:"inspect-task"},paused:{stage:"stopped"},stopped:{stage:"stopped",act:"resume-run"},failed:{stage:"failed",act:"retry-task"},"checks-failed":{stage:"failed"},"waiting-incident":{stage:"failed",act:"retry-task"},stopping:{stage:"waiting",wait:"build-stopping"},"build-stopping":{stage:"waiting",wait:"build-stopping"},"other-computer":{stage:"waiting",wait:"other-computer"},"planning-ready":{stage:"waiting",wait:"plan-next"},"scouting-ready":{stage:"waiting",wait:"research-next"},"worker-at-capacity":{stage:"waiting",wait:"builders-busy"},"retry-scheduled":{stage:"waiting",wait:"retry-later"},updating:{stage:"waiting",wait:"app-update"},"waiting-dependency":{stage:"waiting",wait:"other-task"},"history-problem":{stage:"needs-you",need:"history",act:"inspect-task"},"earlier-active":{stage:"needs-you",need:"earlier-version",act:"inspect-task"},"waiting-decision":{stage:"needs-you",need:"answer",act:"answer-decision"},"finding-held":{stage:"needs-you",need:"finding",act:"inspect-findings"},"decision-queue":{stage:"needs-you",need:"questions",act:"inspect-decisions"},"result-needs-attention":{stage:"needs-you",need:"other",act:"inspect-run"},"process-needs-attention":{stage:"needs-you",need:"stop-unproven",act:"inspect-run"},"vanished-run":{stage:"needs-you",need:"vanished",act:"reconcile-run"},held:{stage:"needs-you",need:"hold",act:"inspect-hold"},"storage-blocked":{stage:"needs-you",need:"storage",act:"unhold"},"terminal-dependency":{stage:"needs-you",need:"fix-dependency",act:"repair-dependency"},"needs-project":{stage:"needs-you",need:"choose-project",act:"place-task"},"needs-scope":{stage:"needs-you",need:"define-task",act:"write-scope"},"invalid-scope":{stage:"needs-you",need:"define-task",act:"write-scope"},"planner-source":{stage:"needs-you",need:"fix-request",act:"write-scope"},"needs-agent-profile":{stage:"needs-you",need:"choose-agent",act:"select-agent"},"needs-approval":{stage:"needs-you",need:"approval",act:"approve-scope"},"missing-requirement":{stage:"needs-you",need:"add-requirement",act:"repair-capability"},"no-worker-registered":{stage:"needs-you",need:"connect-builder",act:"start-worker"},"no-worker-online":{stage:"needs-you",need:"start-builder",act:"start-worker"},"signed-out":{stage:"needs-you",need:"sign-in",act:"sign-in"},"needs-verification":{stage:"needs-you",need:"review-result"},"proof-refuted":{stage:"needs-you",need:"review-result"},"no-build-record":{stage:"needs-you",need:"review-result"},"verification-needed":{stage:"needs-you",need:"review-result"},"evidence-mismatch":{stage:"needs-you",need:"review-result"},"record-incomplete":{stage:"needs-you",need:"review-result"},"evidence-damaged":{stage:"needs-you",need:"review-result"}};var kB=Object.fromEntries(Object.entries(Tx).flatMap(([e,t])=>t.need===void 0?[]:[[e,t.need]]));var jR="The check result couldn't be read.",OB=`${jR} Run checks on it, or open the result to see why.`;var zB={ok:jo`<path d="M20 6 9 17l-5-5"/>`,running:jo`<circle cx="12" cy="12" r="4"/>`,none:jo`<circle cx="12" cy="12" r="3"/>`,note:jo`<path d="M12 8v5"/><path d="M12 16.5h.01"/><path d="M10.3 3.9 2.4 18a2 2 0 0 0 1.7 3h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>`,failed:jo`<path d="M18 6 6 18M6 6l12 12"/>`};function Fm(e,t){return e==="way-in"?"password":t.automatic===!0?"automatic":e==="none"||t.passwordless||e==="standard"&&t.remembered?"click":"password"}function Ax(e,t){let i=Fm(e,t);return i==="password"?"password":i==="automatic"?"automatic":e==="none"?"none":t.passwordless?"passwordless":"remembered"}function Nl(e,t){return e==="way-in"?t.passwordless?"Passwordless is on, but this creates a new way in, so it still asks for your password.":t.remembered?"A remembered password doesn’t count here: this creates a new way in.":"This creates a new way in, so it always asks for your password.":t.automatic===!0?"Approved automatically by your rule.":e==="none"?"":t.passwordless?"No password needed: Passwordless is on for your account.":e==="standard"&&t.remembered?t.rememberedUntil?`No password needed: remembered on this computer until ${t.rememberedUntil}.`:"No password needed: remembered on this computer.":"Asks for your password."}var O=e=>["path",{d:e}],Wr=(e,t,i)=>["circle",{cx:e,cy:t,r:i}],ku={home:[O("m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"),O("M9 22V12h6v10")],tasks:[O("m3 17 2 2 4-4"),O("m3 7 2 2 4-4"),O("M13 6h8"),O("M13 12h8"),O("M13 18h8")],flows:[["rect",{x:3,y:3,width:8,height:8,rx:2}],O("M7 11v4a2 2 0 0 0 2 2h4"),["rect",{x:13,y:13,width:8,height:8,rx:2}]],agents:[O("M12 8V4H8"),["rect",{x:4,y:8,width:16,height:12,rx:2}],O("M2 14h2"),O("M20 14h2"),O("M15 13v2"),O("M9 13v2")],projects:[O("M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z")],settings:[O("M21 4h-7"),O("M10 4H3"),O("M21 12h-9"),O("M8 12H3"),O("M21 20h-5"),O("M12 20H3"),O("M14 2v4"),O("M8 10v4"),O("M16 18v4")],pen:[O("M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z")],arrow:[O("M5 12h14"),O("m12 5 7 7-7 7")],plus:[O("M12 5v14"),O("M5 12h14")],send:[O("M12 19V5"),O("m5 12 7-7 7 7")],stop:[["rect",{x:6,y:6,width:12,height:12,rx:2}]],x:[O("M18 6 6 18"),O("m6 6 12 12")],back:[O("m15 18-6-6 6-6")],menu:[O("M4 6h16"),O("M4 12h16"),O("M4 18h16")],search:[Wr(11,11,7),O("m20 20-3.5-3.5")],chevron:[O("m6 9 6 6 6-6")],check:[O("M20 6 9 17l-5-5")],alert:[Wr(12,12,9),O("M12 8v4"),O("M12 16h.01")],more:[Wr(5,12,1),Wr(12,12,1),Wr(19,12,1)],file:[O("M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"),O("M14 3v5h5")],minus:[O("M5 12h14")],fit:[O("M15 3h6v6"),O("M9 21H3v-6"),O("M21 3l-7 7"),O("M3 21l7-7")],bolt:[O("M13 2 4 14h7l-1 8 9-12h-7z")],code:[O("m16 18 6-6-6-6"),O("m8 6-6 6 6 6")],sun:[Wr(12,12,4),O("M12 2v2"),O("M12 20v2"),O("m4.93 4.93 1.41 1.41"),O("m17.66 17.66 1.41 1.41"),O("M2 12h2"),O("M20 12h2"),O("m6.34 17.66-1.41 1.41"),O("m19.07 4.93-1.41 1.41")],cpu:[["rect",{x:4,y:4,width:16,height:16,rx:2}],["rect",{x:9,y:9,width:6,height:6,rx:1}],O("M15 2v2"),O("M15 20v2"),O("M2 15h2"),O("M2 9h2"),O("M20 15h2"),O("M20 9h2"),O("M9 2v2"),O("M9 20v2")],bell:[O("M10.27 21a2 2 0 0 0 3.46 0"),O("M3.26 15.33A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.67C19.41 13.96 18 12.5 18 8A6 6 0 0 0 6 8c0 4.5-1.41 5.96-2.74 7.33")],shield:[O("M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z")],folder:[O("M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z")],people:[O("M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"),Wr(9,7,4),O("M22 21v-2a4 4 0 0 0-3-3.87"),O("M16 3.13a4 4 0 0 1 0 7.75")],coin:[Wr(12,12,10),O("M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"),O("M12 18V6")],monitor:[["rect",{x:2,y:3,width:20,height:14,rx:2}],O("M8 21h8"),O("M12 17v4")],list:[O("M8 6h13"),O("M8 12h13"),O("M8 18h13"),O("M3 6h.01"),O("M3 12h.01"),O("M3 18h.01")],board:[["rect",{x:3,y:3,width:18,height:18,rx:2}],O("M9 3v18"),O("M15 3v18")],panel:[["rect",{x:3,y:3,width:18,height:18,rx:2}],O("M15 3v18")],server:[["rect",{x:2,y:2,width:20,height:8,rx:2}],["rect",{x:2,y:14,width:20,height:8,rx:2}],O("M6 6h.01"),O("M6 18h.01")]};var Dx=H(ri(),1);var Te=(...e)=>e.filter(Boolean).join(" ");var Nx=H(F(),1);function Ot({name:e,small:t=!1}){return(0,Nx.jsx)("svg",{className:Te("k-i",t&&"k-i-sm"),viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:ku[e].map((i,s)=>(0,Dx.createElement)(i[0],{key:s,...i[1]}))})}var jt=H(F(),1);function vt({variant:e="outline",sm:t,iconOnly:i,lead:s,label:r,docked:n,busy:o,className:a,type:l="button",...c}){return(0,jt.jsx)("button",{type:l,className:Te("k-btn",`k-btn-${e}`,t&&"k-btn-sm",i&&"k-btn-icon",n&&"k-docked",o&&"busy",a),"aria-label":i?r:void 0,title:i?r:void 0,"aria-busy":o?!0:void 0,...c,children:i?(0,jt.jsx)(Ot,{name:i}):(0,jt.jsx)("span",{className:"k-face",children:o?(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsx)("span",{className:"k-spin","aria-hidden":"true"}),o]}):(0,jt.jsxs)(jt.Fragment,{children:[s&&(0,jt.jsx)(Ot,{name:s,small:!0}),r]})})})}function $m({variant:e="outline",sm:t,label:i,lead:s,className:r,...n}){return(0,jt.jsx)("a",{className:Te("k-btn",`k-btn-${e}`,t&&"k-btn-sm",r),...n,children:(0,jt.jsxs)("span",{className:"k-face",children:[s&&(0,jt.jsx)(Ot,{name:s,small:!0}),i]})})}var Bx=H(F(),1);function Cu({word:e,tone:t="",dot:i=!0}){return(0,Bx.jsx)("span",{className:Te("k-chip",t,!i&&"nodot"),children:e})}var XR=H(F(),1);var Ox=H(F(),1);var zx=H(F(),1);var Hx=H(ri(),1);var Ln=H(F(),1);function Ux({label:e,hint:t,error:i,children:s}){let r=(0,Hx.useId)(),n=Te(t&&`${r}-hint`,`${r}-err`);return(0,Ln.jsxs)("div",{className:"k-field",children:[(0,Ln.jsx)("label",{className:"k-label",htmlFor:r,children:e}),s({id:r,describedBy:n,invalid:!!i}),t&&(0,Ln.jsx)("p",{className:"k-hint",id:`${r}-hint`,children:t}),(0,Ln.jsx)("span",{className:"k-err",id:`${r}-err`,role:"alert",children:i??""})]})}var Px=({className:e,...t})=>(0,Ln.jsx)("input",{className:Te("k-input",e),...t});var Eu=H(F(),1);function qx({items:e,sm:t,wide:i,className:s,...r}){return(0,Eu.jsx)("span",{className:Te("k-selw",t&&"sm",i&&"wide",s),children:(0,Eu.jsx)("select",{className:"k-sel",...r,children:e.map(n=>{let[o,a]=typeof n=="string"?[n,n]:n;return(0,Eu.jsx)("option",{value:o,children:a},o)})})})}var Ix=H(F(),1);var Fx=H(F(),1);var Qs=H(F(),1);function $x({name:e,legend:t,current:i,items:s,onChange:r}){return(0,Qs.jsxs)("fieldset",{className:"k-radios",children:[(0,Qs.jsx)("legend",{className:"k-sr",children:t}),s.map(n=>(0,Qs.jsxs)("label",{className:"k-opt",children:[(0,Qs.jsx)("input",{type:"radio",name:e,value:n.value,checked:n.value===i,onChange:()=>r(n.value)}),(0,Qs.jsxs)("span",{children:[(0,Qs.jsx)("b",{children:n.label}),n.text&&(0,Qs.jsx)("span",{children:n.text})]}),n.tag]},n.value))]})}var Kx=H(F(),1),Go=({children:e})=>(0,Kx.jsx)("div",{className:"k-acts",children:e});var ZR=H(ri(),1),Wx=H(F(),1);var Yo=H(F(),1),Km=({children:e})=>(0,Yo.jsxs)("p",{className:"k-notice",role:"alert",children:[(0,Yo.jsx)(Ot,{name:"alert",small:!0}),(0,Yo.jsx)("span",{children:e})]});var Bl=({children:e})=>(0,Yo.jsx)("p",{className:"k-note",children:e});var Ol=H(F(),1);function Tu({title:e,text:t,action:i}){return(0,Ol.jsxs)("div",{className:"k-empty",children:[(0,Ol.jsx)("p",{className:"k-empty-t",children:e}),t&&(0,Ol.jsx)("p",{className:"k-empty-x",children:t}),i]})}var Vx=H(F(),1);var Wm=H(F(),1);var Vm=H(F(),1);var jm=H(F(),1);var jr=H(ri(),1),g2=H(Zu(),1);var QR="toolroll.key",JR="x-toolroll-key",e8=/^[0-9a-f]{64}$/;function jx(){try{let e=globalThis.localStorage?.getItem(QR)??null;if(e===null)return null;let t=JSON.parse(e),i=typeof t=="object"&&t!==null?t.key:null;return typeof i=="string"&&e8.test(i)?i:null}catch{return null}}function Au(e){let t=jx();return t===null?e:{...e,[JR]:t}}function Gx(){let e=jx();return e===null?["toolroll"]:["toolroll",`toolroll.key.${e}`]}var ys="form.k-sform",Hl=e=>HTMLFormElement.prototype.getAttribute.call(e,"id")??"",t8=e=>Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements").get.call(e),Yx="http://www.w3.org/2000/svg",Js=e=>e.querySelector("[data-k-proof]"),bs=e=>e.querySelector("[data-k-save]"),e2=e=>new Set(Array.from(Js(e)?.querySelectorAll("input[name]")??[]).map(t=>t.name));function Ru(e,t=null){let i=e2(e),s;try{s=t?new FormData(e,t):new FormData(e)}catch{s=new FormData(e)}let r=[];return s.forEach((n,o)=>{!i.has(o)&&typeof n=="string"&&r.push([o,n])}),r}function Jm(e){let t=new Map;for(let[i,s]of e)t.set(i,[...t.get(i)??[],s]);return t}function t2(e){let t=e2(e),i=[];for(let s of Array.from(t8(e)))!s.name||s.type==="hidden"||s.type==="submit"||s.type==="button"||t.has(s.name)||i.includes(s.name)||i.push(s.name);return i}var ji=e=>(e??"").replace(/\s+/g," ").trim();function i2(e,t){return e.querySelector(`[name="${CSS.escape(t)}"]`)}function i8(e,t){let i=i2(e,t);if(i===null)return t;let s=i.getAttribute("aria-label");if(s)return ji(s);if(i.type==="radio"||i.type==="checkbox"&&i.getAttribute("role")!=="switch"){let o=i.closest("fieldset")?.querySelector("legend");if(o)return ji(o.textContent)}let r=i.closest(".k-frow")?.querySelector(".k-frow-t");if(r)return ji(r.textContent);let n=i.labels?.[0];return n?ji(n.querySelector(".k-sl-t, b")?.textContent??n.textContent):t}function s8(e,t,i){let s=i2(e,t);if(s instanceof HTMLSelectElement)return ji(Array.from(s.options).find(o=>o.value===i[0])?.textContent??i[0]);if(s?.type==="radio"||s?.type==="checkbox"){let o=Array.from(e.querySelectorAll(`[name="${CSS.escape(t)}"]`));if(s.type==="checkbox"&&s.getAttribute("role")==="switch")return i.length>0?"On":"Off";let a=o.filter(l=>i.includes(l.value)).map(l=>ji(l.labels?.[0]?.querySelector("b")?.textContent??l.labels?.[0]?.textContent??l.value));return a.length===0?"none":a.join(", ")}let r=i[0]??"";if(s?.type==="password")return r===""?"unchanged":"a new value";let n=r.split(`
154
+ }`,Gs=8,_m=Gs*Float32Array.BYTES_PER_ELEMENT,jM=20*Gs,bk=class{constructor(){this.attributes=new Float32Array(jM),this.count=0}},Vs=0,wk=0,Sk=0,kk=0,xk=0,Ck=0,Ek=0,GM=class extends wi{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new bk,this._verticesCursor=new bk;let r=this._gl;this._program=Ze(ux(r,WM,VM)),this._register(Mt(()=>r.deleteProgram(this._program))),this._projectionLocation=Ze(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(Mt(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),l=r.createBuffer();this._register(Mt(()=>r.deleteBuffer(l))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,l),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=Ze(r.createBuffer()),this._register(Mt(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,_m,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,_m,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,_m,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(c=>{this._updateCachedColors(c),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,hx),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.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(e){let t=this._terminal,i=this._vertices,s=1,r,n,o,a,l,c,h,u,d,f,g;for(r=0;r<t.rows;r++){for(o=-1,a=0,l=0,c=!1,n=0;n<t.cols;n++)h=(r*t.cols+n)*bu,u=e.cells[h+pu],d=e.cells[h+gu],f=!!(d&67108864),(u!==a||d!==l&&(c||f))&&((a!==0||c&&l!==0)&&(g=s++*Gs,this._updateRectangle(i,g,l,a,o,n,r)),o=n,a=u,l=d,c=f);(a!==0||c&&l!==0)&&(g=s++*Gs,this._updateRectangle(i,g,l,a,o,t.cols,r))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||i.style==="block"){t.count=0;return}let s,r=0;(i.style==="bar"||i.style==="outline")&&(s=r++*Gs,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.style==="bar"?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(i.style==="underline"||i.style==="outline")&&(s=r++*Gs,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),i.style==="outline"&&(s=r++*Gs,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=r++*Gs,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,s,r,n,o){if(i&67108864)switch(i&50331648){case 16777216:case 33554432:Vs=this._themeService.colors.ansi[i&255].rgba;break;case 50331648:Vs=(i&16777215)<<8;break;default:Vs=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Vs=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Vs=(s&16777215)<<8;break;default:Vs=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=OM(e.attributes,this._terminal.rows*this._terminal.cols*Gs)),wk=r*this._dimensions.device.cell.width,Sk=o*this._dimensions.device.cell.height,kk=(Vs>>24&255)/255,xk=(Vs>>16&255)/255,Ck=(Vs>>8&255)/255,Ek=1,this._addRectangle(e.attributes,t,wk,Sk,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,kk,xk,Ck,Ek)}_addRectangle(e,t,i,s,r,n,o,a,l,c){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=l,e[t+7]=c}_addRectangleFloat(e,t,i,s,r,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},YM=class extends wi{constructor(e,t,i,s,r,n,o,a){super(),this._container=t,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,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(l=>{this._refreshCharAtlas(e,l),this.reset(e)})),this._register(Mt(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Ze(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=lx(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+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(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=Xk,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},XM=class extends YM{constructor(e,t,i,s,r,n,o){super(i,e,"link",t,!0,r,n,o),this._register(s.onShowLinkUnderline(a=>this._handleShowLinkUnderline(a))),this._register(s.onHideLinkUnderline(a=>this._handleHideLinkUnderline(a)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&DM(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},Vi=typeof window=="object"?window:globalThis,Nm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ke,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ke,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,i){if(this.getZoomLevel(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,t),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),t)}setFullscreen(t,i){if(this.isFullscreen(i)===t)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,t),this._onDidChangeFullscreen.fire(s)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Nm.INSTANCE=new Nm;var dx=Nm;function ZM(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var jD=dx.INSTANCE.onDidChangeZoomLevel,GD=dx.INSTANCE.onDidChangeFullscreen,Vo=typeof navigator=="object"?navigator.userAgent:"",YD=Vo.indexOf("Firefox")>=0,vm=Vo.indexOf("AppleWebKit")>=0,QM=Vo.indexOf("Chrome")>=0,JM=!QM&&Vo.indexOf("Safari")>=0,XD=Vo.indexOf("Electron/")>=0,ZD=Vo.indexOf("Android")>=0,mu=!1;if(typeof Vi.matchMedia=="function"){let e=Vi.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Vi.matchMedia("(display-mode: fullscreen)");mu=e.matches,ZM(Vi,e,({matches:i})=>{mu&&t.matches||(mu=i)})}function eR(){return mu}var $o="en",Bm=!1,Om=!1,_u=!1,tR=!1,fx=!1,px=!1,iR=!1,sR=!1,rR=!1,nR=!1,hu,vu=$o,Tk=$o,oR,js,Zs=globalThis,bi;typeof Zs.vscode<"u"&&typeof Zs.vscode.process<"u"?bi=Zs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(bi=process);var gx=typeof bi?.versions?.electron=="string",aR=gx&&bi?.type==="renderer";if(typeof bi=="object"){Bm=bi.platform==="win32",Om=bi.platform==="darwin",_u=bi.platform==="linux",tR=_u&&!!bi.env.SNAP&&!!bi.env.SNAP_REVISION,iR=gx,rR=!!bi.env.CI||!!bi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hu=$o,vu=$o;let e=bi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);hu=t.userLocale,Tk=t.osLocale,vu=t.resolvedLanguage||$o,oR=t.languagePack?.translationsConfigFile}catch{}fx=!0}else typeof navigator=="object"&&!aR?(js=navigator.userAgent,Bm=js.indexOf("Windows")>=0,Om=js.indexOf("Macintosh")>=0,sR=(js.indexOf("Macintosh")>=0||js.indexOf("iPad")>=0||js.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_u=js.indexOf("Linux")>=0,nR=js?.indexOf("Mobi")>=0,px=!0,vu=globalThis._VSCODE_NLS_LANGUAGE||$o,hu=navigator.language.toLowerCase(),Tk=hu):console.error("Unable to resolve platform.");var ym=0;Om?ym=1:Bm?ym=3:_u&&(ym=2);var bm=fx,lR=px&&typeof Zs.importScripts=="function",QD=lR?Zs.origin:void 0,_s=js,Ir=vu,cR;(e=>{function t(){return Ir}e.value=t;function i(){return Ir.length===2?Ir==="en":Ir.length>=3?Ir[0]==="e"&&Ir[1]==="n"&&Ir[2]==="-":!1}e.isDefaultVariant=i;function s(){return Ir==="en"}e.isDefault=s})(cR||={});var hR=typeof Zs.postMessage=="function"&&!Zs.importScripts,uR=(()=>{if(hR){let e=[];Zs.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let n=e[s];if(n.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),n.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),Zs.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),dR=!!(_s&&_s.indexOf("Chrome")>=0),JD=!!(_s&&_s.indexOf("Firefox")>=0),eN=!!(!dR&&_s&&_s.indexOf("Safari")>=0),tN=!!(_s&&_s.indexOf("Edg/")>=0),iN=!!(_s&&_s.indexOf("Android")>=0),Fr=typeof navigator=="object"?navigator:{},sN={clipboard:{writeText:bm||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Fr&&Fr.clipboard&&Fr.clipboard.writeText),readText:bm||!!(Fr&&Fr.clipboard&&Fr.clipboard.readText)},keyboard:bm||eR()?0:Fr.keyboard||JM?1:2,touch:"ontouchstart"in Vi||Fr.maxTouchPoints>0,pointerEvents:Vi.PointerEvent&&("ontouchstart"in Vi||navigator.maxTouchPoints>0)},qm=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},wm=new qm,Ak=new qm,Mk=new qm,rN=new Array(230),fR;(e=>{function t(a){return wm.keyCodeToStr(a)}e.toString=t;function i(a){return wm.strToKeyCode(a)}e.fromString=i;function s(a){return Ak.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Mk.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Ak.strToKeyCode(a)||Mk.strToKeyCode(a)}e.fromUserSettings=n;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return wm.keyCodeToStr(a)}e.toElectronAccelerator=o})(fR||={});var mx=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),pR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof gR?!0:!i||typeof i!="object"?!1:typeof i.isCancellationRequested=="boolean"&&typeof i.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Ys.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:mx})})(pR||={});var gR=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?mx:(this._emitter||(this._emitter=new ke),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var mR,Sm;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?Sm=(e,t)=>{uR(()=>{if(i)return;let s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let i=!1;return{dispose(){i||(i=!0)}}}:Sm=(e,t,i)=>{let s=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0),r=!1;return{dispose(){r||(r=!0,e.cancelIdleCallback(s))}}},mR=e=>Sm(globalThis,e)})();var _R;(e=>{async function t(s){let r,n=await Promise.all(s.map(o=>o.then(a=>a,a=>{r||(r=a)})));if(typeof r<"u")throw r;return n}e.settled=t;function i(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}e.withAsyncBody=i})(_R||={});var Rk=class Hi{static fromArray(t){return new Hi(i=>{i.emitMany(t)})}static fromPromise(t){return new Hi(async i=>{i.emitMany(await t)})}static fromPromises(t){return new Hi(async i=>{await Promise.all(t.map(async s=>i.emitOne(await s)))})}static merge(t){return new Hi(async i=>{await Promise.all(t.map(async s=>{for await(let r of s)i.emitOne(r)}))})}constructor(t,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ke,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(t(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await Ys.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new Hi(async s=>{for await(let r of t)s.emitOne(i(r))})}map(t){return Hi.map(this,t)}static filter(t,i){return new Hi(async s=>{for await(let r of t)i(r)&&s.emitOne(r)})}filter(t){return Hi.filter(this,t)}static coalesce(t){return Hi.filter(t,i=>!!i)}coalesce(){return Hi.coalesce(this)}static async toPromise(t){let i=[];for await(let s of t)i.push(s);return i}toPromise(){return Hi.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};Rk.EMPTY=Rk.fromArray([]);function vR(e){return 55296<=e&&e<=56319}function Lk(e){return 56320<=e&&e<=57343}function yR(e,t){return(e-55296<<10)+(t-56320)+65536}function bR(e){return Im(e,0)}function Im(e,t){switch(typeof e){case"object":return e===null?Xs(349,t):Array.isArray(e)?SR(e,t):kR(e,t);case"string":return _x(e,t);case"boolean":return wR(e,t);case"number":return Xs(e,t);case"undefined":return Xs(937,t);default:return Xs(617,t)}}function Xs(e,t){return(t<<5)-t+e|0}function wR(e,t){return Xs(e?433:863,t)}function _x(e,t){t=Xs(149417,t);for(let i=0,s=e.length;i<s;i++)t=Xs(e.charCodeAt(i),t);return t}function SR(e,t){return t=Xs(104579,t),e.reduce((i,s)=>Im(s,i),t)}function kR(e,t){return t=Xs(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=_x(s,i),Im(e[s],i)),t)}function km(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function Dk(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function xR(e,t,i="0"){for(;e.length<t;)e=i+e;return e}function Tl(e,t=32){return e instanceof ArrayBuffer?Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join(""):xR((e>>>0).toString(16),t/4)}var CR=class vx{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(t){let i=t.length;if(i===0)return;let s=this._buff,r=this._buffLen,n=this._leftoverHighSurrogate,o,a;for(n!==0?(o=n,a=-1,n=0):(o=t.charCodeAt(0),a=0);;){let l=o;if(vR(o))if(a+1<i){let c=t.charCodeAt(a+1);Lk(c)?(a++,l=yR(o,c)):l=65533}else{n=o;break}else Lk(o)&&(l=65533);if(r=this._push(s,r,l),a++,a<i)o=t.charCodeAt(a);else break}this._buffLen=r,this._leftoverHighSurrogate=n}_push(t,i,s){return s<128?t[i++]=s:s<2048?(t[i++]=192|(s&1984)>>>6,t[i++]=128|(s&63)>>>0):s<65536?(t[i++]=224|(s&61440)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0):(t[i++]=240|(s&1835008)>>>18,t[i++]=128|(s&258048)>>>12,t[i++]=128|(s&4032)>>>6,t[i++]=128|(s&63)>>>0),i>=64&&(this._step(),i-=64,this._totalLen+=64,t[0]=t[64],t[1]=t[65],t[2]=t[66]),i}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),Tl(this._h0)+Tl(this._h1)+Tl(this._h2)+Tl(this._h3)+Tl(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,Dk(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Dk(this._buff));let t=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(t/4294967296),!1),this._buffDV.setUint32(60,t%4294967296,!1),this._step()}_step(){let t=vx._bigBlock32,i=this._buffDV;for(let u=0;u<64;u+=4)t.setUint32(u,i.getUint32(u,!1),!1);for(let u=64;u<320;u+=4)t.setUint32(u,km(t.getUint32(u-12,!1)^t.getUint32(u-32,!1)^t.getUint32(u-56,!1)^t.getUint32(u-64,!1),1),!1);let s=this._h0,r=this._h1,n=this._h2,o=this._h3,a=this._h4,l,c,h;for(let u=0;u<80;u++)u<20?(l=r&n|~r&o,c=1518500249):u<40?(l=r^n^o,c=1859775393):u<60?(l=r&n|r&o|n&o,c=2400959708):(l=r^n^o,c=3395469782),h=km(s,5)+l+a+c+t.getUint32(u*4,!1)&4294967295,a=o,o=n,n=km(r,30),r=s,s=h;this._h0=this._h0+s&4294967295,this._h1=this._h1+r&4294967295,this._h2=this._h2+n&4294967295,this._h3=this._h3+o&4294967295,this._h4=this._h4+a&4294967295}};CR._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:nN,getWindow:ER,getDocument:oN,getWindows:aN,getWindowsCount:lN,getWindowId:Nk,getWindowById:cN,hasWindow:hN,onDidRegisterWindow:uN,onWillUnregisterWindow:dN,onDidUnregisterWindow:fN}=(function(){let e=new Map,t={window:Vi,disposables:new Ko};e.set(Vi.vscodeWindowId,t);let i=new ke,s=new ke,r=new ke;function n(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:i.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(e.has(o.vscodeWindowId))return wi.None;let a=new Ko,l={window:o,disposables:a.add(new Ko)};return e.set(o.vscodeWindowId,l),a.add(Mt(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(zm(o,MR.BEFORE_UNLOAD,()=>{r.fire(o)})),i.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:n,getWindow(o){let a=o;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l?.view?l.view.window:Vi},getDocument(o){return ER(o).document}}})(),TR=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function zm(e,t,i,s){return new TR(e,t,i,s)}var AR,Bk,xm=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){uu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,i=new Map,s=new Map,r=n=>{i.set(n,!1);let o=e.get(n)??[];for(t.set(n,o),e.set(n,[]),s.set(n,!0);o.length>0;)o.sort(xm.sort),o.shift().execute();s.set(n,!1)};Bk=(n,o,a=0)=>{let l=Nk(n),c=new xm(o,a),h=e.get(l);return h||(h=[],e.set(l,h)),h.push(c),i.get(l)||(i.set(l,!0),n.requestAnimationFrame(()=>r(l))),c},AR=(n,o,a)=>{let l=Nk(n);if(s.get(l)){let c=new xm(o,a),h=t.get(l);return h||(h=[],t.set(l,h)),h.push(c),c}else return Bk(n,o,a)}})();var Ok=class yu{constructor(t,i){this.width=t,this.height=i}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new yu(t,i):this}static is(t){return typeof t=="object"&&typeof t.height=="number"&&typeof t.width=="number"}static lift(t){return t instanceof yu?t:new yu(t.width,t.height)}static equals(t,i){return t===i?!0:!t||!i?!1:t.width===i.width&&t.height===i.height}};Ok.None=new Ok(0,0);var pN=new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=bR(i),n=s.get(r);if(n)n.users+=1;else{let o=new ke,a=new MutationObserver(c=>o.fire(c));a.observe(e,i);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(Mt(()=>{l.users-=1,l.users===0&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}},MR={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",WHEEL:"wheel",KEY_DOWN:"keydown",KEY_PRESS:"keypress",KEY_UP:"keyup",LOAD:"load",BEFORE_UNLOAD:"beforeunload",UNLOAD:"unload",PAGE_SHOW:"pageshow",PAGE_HIDE:"pagehide",PASTE:"paste",ABORT:"abort",ERROR:"error",RESIZE:"resize",SCROLL:"scroll",FULLSCREEN_CHANGE:"fullscreenchange",WK_FULLSCREEN_CHANGE:"webkitfullscreenchange",SELECT:"select",CHANGE:"change",SUBMIT:"submit",RESET:"reset",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",STORAGE:"storage",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend",ANIMATION_START:vm?"webkitAnimationStart":"animationstart",ANIMATION_END:vm?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:vm?"webkitAnimationIteration":"animationiteration"},RR=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function yx(e,t,i,...s){let r=RR.exec(t);if(!r)throw new Error("Bad use of emmet");let n=r[1]||"div",o;return e!=="http://www.w3.org/1999/xhtml"?o=document.createElementNS(e,n):o=document.createElement(n),r[3]&&(o.id=r[3]),r[4]&&(o.className=r[4].replace(/\./g," ").trim()),i&&Object.entries(i).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?o[a]=l:a==="selected"?l&&o.setAttribute(a,"true"):o.setAttribute(a,l))}),o.append(...s),o}function LR(e,t,...i){return yx("http://www.w3.org/1999/xhtml",e,t,...i)}LR.SVG=function(e,t,...i){return yx("http://www.w3.org/2000/svg",e,t,...i)};var DR=class extends wi{constructor(e,t,i,s,r,n,o,a,l){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new kl,this._charAtlasDisposable=this._register(new kl),this._observerDisposable=this._register(new kl),this._model=new KM,this._workCell=new vk,this._workCell2=new vk,this._rectangleRenderer=this._register(new kl),this._glyphRenderer=this._register(new kl),this._onChangeTextureAtlas=this._register(new ke),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ke),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ke),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ke),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ke),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let c={antialias:!1,depth:!1,preserveDrawingBuffer:l};if(this._gl=this._canvas.getContext("webgl2",c),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new nM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new XM(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=sM(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(zm(this._canvas,"webglcontextlost",h=>{console.log("webglcontextlost event received"),h.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(h)},3e3)})),this._register(zm(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,mk(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=_k(this._canvas,this._coreBrowserService.window,(h,u)=>this._setCanvasDevicePixelDimensions(h,u)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=_k(this._canvas,h,(u,d)=>this._setCanvasDevicePixelDimensions(u,d))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(Mt(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),mk(this._terminal)}))}get textureAtlas(){return this._charAtlas?.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(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let i of this._renderLayers)i.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`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new GM(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new qM(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=lx(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._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=Wk(Ys.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Ys.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new NM(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,r,n,o,a,l,c,h=0,u=!0,d,f,g,b,T,_,m,v,p;e=zk(e,i.rows-1,0),t=zk(t,i.rows-1,0);let E=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",A=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,L=A-i.buffer.ydisp,B=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),W=-1,$=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let P=!1;for(n=e;n<=t;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,g=A===o,h=0,l=this._characterJoinerService.getJoinedCharacters(o),v=0;v<i.cols;v++){if(r=this._cellColorResolver.result.bg,a.loadCell(v,s),v===0&&(r=this._cellColorResolver.result.bg),c=!1,u=v>=h,d=v,l.length>0&&v===l[0][0]&&u){f=l.shift();let Rt=this._model.selection.isCellSelected(this._terminal,f[0],o);for(m=f[0]+1;m<f[1];m++)u&&=Rt===this._model.selection.isCellSelected(this._terminal,m,o);u&&=!g||B<f[0]||B>=f[1],u?(c=!0,s=new NR(s,a.translateToString(!0,f[0],f[1]),f[1]-f[0]),d=f[1]-1):h=f[1]}if(b=s.getChars(),T=s.getCode(),m=(n*i.cols+v)*bu,this._cellColorResolver.resolve(s,v,o,this.dimensions.device.cell.width),$&&o===A&&(v===B&&(this._model.cursor={x:B,y:L,width:s.getWidth(),style:this._coreBrowserService.isFocused?E:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},W=B+s.getWidth()-1),v>=B&&v<=W&&(this._coreBrowserService.isFocused&&E==="block"||this._coreBrowserService.isFocused===!1&&i.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)),T!==0&&(this._model.lineLengths[n]=v+1),!(this._model.cells[m]===T&&this._model.cells[m+pu]===this._cellColorResolver.result.bg&&this._model.cells[m+gu]===this._cellColorResolver.result.fg&&this._model.cells[m+mm]===this._cellColorResolver.result.ext)&&(P=!0,b.length>1&&(T|=$M),this._model.cells[m]=T,this._model.cells[m+pu]=this._cellColorResolver.result.bg,this._model.cells[m+gu]=this._cellColorResolver.result.fg,this._model.cells[m+mm]=this._cellColorResolver.result.ext,_=s.getWidth(),this._glyphRenderer.value.updateCell(v,n,T,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,b,_,r),c)){for(s=this._workCell,v++;v<=d;v++)p=(n*i.cols+v)*bu,this._glyphRenderer.value.updateCell(v,n,0,0,0,0,XA,0,0),this._model.cells[p]=0,this._model.cells[p+pu]=this._cellColorResolver.result.bg,this._model.cells[p+gu]=this._cellColorResolver.result.fg,this._model.cells[p+mm]=this._cellColorResolver.result.ext;v--}}P&&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(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},NR=class extends Fo{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function zk(e,t,i=0){return Math.max(Math.min(e,t),i)}var Hk="di$target",Uk="di$dependencies",Cm=new Map;function vs(e){if(Cm.has(e))return Cm.get(e);let t=function(i,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");BR(t,i,r)};return t._id=e,Cm.set(e,t),t}function BR(e,t,i){t[Hk]===t?t[Uk].push({id:e,index:i}):(t[Uk]=[{id:e,index:i}],t[Hk]=t)}var gN=vs("BufferService"),mN=vs("CoreMouseService"),_N=vs("CoreService"),vN=vs("CharsetService"),yN=vs("InstantiationService"),bN=vs("LogService"),OR=vs("OptionsService"),wN=vs("OscLinkService"),SN=vs("UnicodeService"),kN=vs("DecorationService"),zR={trace:0,debug:1,info:2,warn:3,error:4,off:5},HR="xterm.js: ",Pk=class extends wi{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),bx=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=zR[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":HR)+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Pk=RA([LA(0,OR)],Pk);var bx;function UR(e){bx=e}var wx=class extends wi{constructor(e){if(Gk&&YA()<16){let t={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",t))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ke),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ke),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ke),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ke),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let i=t.coreService,s=t.optionsService,r=t,n=r._renderService,o=r._characterJoinerService,a=r._charSizeService,l=r._coreBrowserService,c=r._decorationService,h=r._logService,u=r._themeService;UR(h),this._renderer=this._register(new DR(e,o,a,l,i,c,s,u,this._preserveDrawingBuffer)),this._register(Ys.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Ys.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Ys.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Ys.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(Mt(()=>{if(this._terminal._core._store._isDisposed)return;let d=this._terminal._core._renderService;d.setRenderer(this._terminal._core._createRenderer()),d.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};var xx=Symbol("html"),Dl=class{#e;constructor(t,i){if(t!==xx)throw new TypeError("Html is made by html`…`");this.#e=i}static markupOf(t){return t.#e}toString(){if(Sx)throw new Error("Html coerced to a string: interpolate it with html`…` or hand it to a sink");return this.#e}toJSON(){if(Sx)throw new Error("Html serialized as JSON: convert it with htmlString() first");return this.#e}},Sx=typeof process<"u"&&process.env.VITEST!==void 0,PR=e=>new Dl(xx,e);var qR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},IR=e=>e.replace(/[&<>"']/g,t=>qR[t]);function Cx(e){if(e==null||typeof e=="boolean")return"";if(e instanceof Dl)return Dl.markupOf(e);if(Array.isArray(e))return e.map(Cx).join("");if(typeof e=="string")return IR(e);if(typeof e=="number"||typeof e=="bigint")return String(e);throw new TypeError(`html: cannot interpolate ${typeof e}`)}var kx=new WeakSet,FR=/<form\b[^>]*\bmethod\s*=\s*["']?post\b/i,$R=/\bname\s*=\s*["']?csrf\b/i;function KR(e){if(kx.has(e))return;let t=e.join("\0");if(FR.test(t))throw new Error("html: write POST forms with postForm, which adds the CSRF field");if($R.test(t))throw new Error("html: postForm adds the CSRF field; don't write one");kx.add(e)}function jo(e,...t){KR(e);let i=e[0];for(let s=0;s<t.length;s++)i+=Cx(t[s])+e[s+1];return PR(i)}var K=(e,t,i)=>({never:e,pattern:new RegExp(`(?<![\\w-])(?:${t})(?![\\w-])`,"i"),say:i}),Ex=[K("scope","scopes?|scoped","plan"),K("contract","contracts?","plan"),K("signs","signs|signed(?!\\s+(?:in|out|into)\\b)","Approved by …"),K("sealed","seal|seals|sealed|sealing","approved"),K("binds","binds?","approved"),K("digest","digests?","(the plan version, in Details)"),K("worker","workers?","builder"),K("runner","runners?","builder"),K("daemon","daemons?","builder"),K("background service","background service","builder"),K("operator","operators?|instance operator","approver, or owner"),K("coordinator","coordinators?","your lead"),K("mate","mate","your lead"),K("scout","scouts?|scouting|scouted","research"),K("criterion","criterion|criteria","requirement"),K("evidence","evidence","requirement, or the saved files"),K("proof","proofs?","requirement"),K("verdict","verdicts?","requirement"),K("caveat","caveats?","requirement"),K("mark complete","mark(?:ed|s|ing)?\\s+(?:it\\s+|this\\s+|that\\s+|them\\s+|the\\s+result\\s+)?complete","Accept"),K("Accept and finish","accept\\s+and\\s+finish","Accept"),K("Revise","revise","Send back, or Request changes"),K("re-file","re-?file[ds]?|re-?filing","Send back, or Request changes"),K("Draft a repair task","draft\\s+a\\s+repair\\s+task","Send back"),K("put away","put(?:s|ting)?\\s+(?:it\\s+|them\\s+|tasks\\s+|old\\s+tasks\\s+)?away","Archive"),K("tidy","tidy|tidied|tidying","Archive"),K("run #N","(?:run|result)\\s+#?\\d+|attempt\\s+#?\\d+(?!\\s+\\(build\\s+#\\d+\\))","build #N, or attempt N (build #M)"),K("reconcile","reconcile[ds]?|reconciling|reconciliation","Waiting: Toolroll is …"),K("requeue","requeue[ds]?|requeuing","Waiting: Toolroll is …"),K("claim","claim|claimed","Waiting: Toolroll is …"),K("lease","leases?|leased","Waiting: Toolroll is …"),K("custody","custody","Waiting: Toolroll is …"),K("incident","incidents?","Waiting: Toolroll is …"),K("plane","plane","Toolroll"),K("fence","fences?|fenced","Waiting: Toolroll is …"),K("attested","attest|attested|attestation","Waiting: Toolroll is …"),K("receipt","receipts?","Waiting: Toolroll is …"),K("regate","regate[ds]?","Run checks"),K("carried","carried|carry|carries","Waiting: Toolroll is …"),K("incarnation","incarnations?","Waiting: Toolroll is …"),K("admission","admission","Waiting: Toolroll is …"),K("quiescence","quiescen(?:ce|t)","Waiting: Toolroll is …"),K("witness","witness(?:es|ed)?","Waiting: Toolroll is …"),K("unproven","unproven","Waiting: Toolroll is …"),K("version hex","(?=[0-9a-f]*\\d)(?=[0-9a-f]*[a-f])[0-9a-f]{12,64}","(the plan version, in Details)")],WR=Ex.map(e=>e.never);var yB=[K("lead","lead","Toolroll, or Chat"),K("crew","crew","Toolroll"),K("scope","scopes?|scoped","plan"),K("mode","modes?","(Settings)"),K("flow","flows?","(Settings)"),K("fleet","fleet","(Settings)"),K("fallback","fallbacks?","(Settings)"),K("routing","routing|routed","(Settings)"),K("spend","spend|spends|spending|spent","cost"),K("MCP","mcp","(Settings)"),K("password","passwords?|passwordless","(only where one is asked for)"),K("token","tokens?","(Settings)"),K("builder","builders?","taking work")];var Tx={queued:{stage:"queued"},ready:{stage:"queued"},"provider-quota":{stage:"queued"},running:{stage:"building"},reviewing:{stage:"reviewing"},"review-pending":{stage:"building"},"checks-running":{stage:"checking"},"ready-to-check":{stage:"finished",act:"open-result"},"ready-to-review":{stage:"finished"},"report-ready":{stage:"finished"},"no-change":{stage:"finished"},"pr-opened":{stage:"finished"},"merge-observed":{stage:"finished"},"pr-closed":{stage:"finished"},"agent-attested":{stage:"finished"},"accepted-exception":{stage:"finished"},complete:{stage:"complete",act:"open-result"},cancelled:{stage:"stopped",act:"inspect-task"},paused:{stage:"stopped"},stopped:{stage:"stopped",act:"resume-run"},failed:{stage:"failed",act:"retry-task"},"checks-failed":{stage:"failed"},"waiting-incident":{stage:"failed",act:"retry-task"},"plan-stopped":{stage:"needs-you",need:"plan-again",act:"inspect-task"},"planning-stopped":{stage:"needs-you",need:"planning-stopped",act:"inspect-task"},stopping:{stage:"waiting",wait:"build-stopping"},"build-stopping":{stage:"waiting",wait:"build-stopping"},"other-computer":{stage:"waiting",wait:"other-computer"},"planning-ready":{stage:"waiting",wait:"plan-next"},"scouting-ready":{stage:"waiting",wait:"research-next"},"worker-at-capacity":{stage:"waiting",wait:"builders-busy"},"retry-scheduled":{stage:"waiting",wait:"retry-later"},"plan-retry":{stage:"waiting",wait:"plan-retry-later"},updating:{stage:"waiting",wait:"app-update"},"waiting-dependency":{stage:"waiting",wait:"other-task"},"history-problem":{stage:"needs-you",need:"history",act:"inspect-task"},"earlier-active":{stage:"needs-you",need:"earlier-version",act:"inspect-task"},"waiting-decision":{stage:"needs-you",need:"answer",act:"answer-decision"},"finding-held":{stage:"needs-you",need:"finding",act:"inspect-findings"},"decision-queue":{stage:"needs-you",need:"questions",act:"inspect-decisions"},"result-needs-attention":{stage:"needs-you",need:"other",act:"inspect-run"},"process-needs-attention":{stage:"needs-you",need:"stop-unproven",act:"inspect-run"},"vanished-run":{stage:"needs-you",need:"vanished",act:"reconcile-run"},held:{stage:"needs-you",need:"hold",act:"inspect-hold"},"storage-blocked":{stage:"needs-you",need:"storage",act:"unhold"},"terminal-dependency":{stage:"needs-you",need:"fix-dependency",act:"repair-dependency"},"needs-project":{stage:"needs-you",need:"choose-project",act:"place-task"},"needs-scope":{stage:"needs-you",need:"define-task",act:"write-scope"},"invalid-scope":{stage:"needs-you",need:"define-task",act:"write-scope"},"planner-source":{stage:"needs-you",need:"fix-request",act:"write-scope"},"needs-agent-profile":{stage:"needs-you",need:"choose-agent",act:"select-agent"},"needs-approval":{stage:"needs-you",need:"approval",act:"approve-scope"},"missing-requirement":{stage:"needs-you",need:"add-requirement",act:"repair-capability"},"no-worker-registered":{stage:"needs-you",need:"connect-builder",act:"start-worker"},"no-worker-online":{stage:"needs-you",need:"start-builder",act:"start-worker"},"signed-out":{stage:"needs-you",need:"sign-in",act:"sign-in"},"needs-verification":{stage:"needs-you",need:"review-result"},"proof-refuted":{stage:"needs-you",need:"review-result"},"no-build-record":{stage:"needs-you",need:"review-result"},"verification-needed":{stage:"needs-you",need:"review-result"},"evidence-mismatch":{stage:"needs-you",need:"review-result"},"record-incomplete":{stage:"needs-you",need:"review-result"},"evidence-damaged":{stage:"needs-you",need:"review-result"}};var kB=Object.fromEntries(Object.entries(Tx).flatMap(([e,t])=>t.need===void 0?[]:[[e,t.need]]));var jR="The check result couldn't be read.",OB=`${jR} Run checks on it, or open the result to see why.`;var zB={ok:jo`<path d="M20 6 9 17l-5-5"/>`,running:jo`<circle cx="12" cy="12" r="4"/>`,none:jo`<circle cx="12" cy="12" r="3"/>`,note:jo`<path d="M12 8v5"/><path d="M12 16.5h.01"/><path d="M10.3 3.9 2.4 18a2 2 0 0 0 1.7 3h15.8a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/>`,failed:jo`<path d="M18 6 6 18M6 6l12 12"/>`};function Fm(e,t){return e==="way-in"?"password":t.automatic===!0?"automatic":e==="none"||t.passwordless||e==="standard"&&t.remembered?"click":"password"}function Ax(e,t){let i=Fm(e,t);return i==="password"?"password":i==="automatic"?"automatic":e==="none"?"none":t.passwordless?"passwordless":"remembered"}function Nl(e,t){return e==="way-in"?t.passwordless?"Passwordless is on, but this creates a new way in, so it still asks for your password.":t.remembered?"A remembered password doesn’t count here: this creates a new way in.":"This creates a new way in, so it always asks for your password.":t.automatic===!0?"Approved automatically by your rule.":e==="none"?"":t.passwordless?"No password needed: Passwordless is on for your account.":e==="standard"&&t.remembered?t.rememberedUntil?`No password needed: remembered on this computer until ${t.rememberedUntil}.`:"No password needed: remembered on this computer.":"Asks for your password."}var O=e=>["path",{d:e}],Wr=(e,t,i)=>["circle",{cx:e,cy:t,r:i}],ku={home:[O("m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"),O("M9 22V12h6v10")],tasks:[O("m3 17 2 2 4-4"),O("m3 7 2 2 4-4"),O("M13 6h8"),O("M13 12h8"),O("M13 18h8")],flows:[["rect",{x:3,y:3,width:8,height:8,rx:2}],O("M7 11v4a2 2 0 0 0 2 2h4"),["rect",{x:13,y:13,width:8,height:8,rx:2}]],agents:[O("M12 8V4H8"),["rect",{x:4,y:8,width:16,height:12,rx:2}],O("M2 14h2"),O("M20 14h2"),O("M15 13v2"),O("M9 13v2")],projects:[O("M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z")],settings:[O("M21 4h-7"),O("M10 4H3"),O("M21 12h-9"),O("M8 12H3"),O("M21 20h-5"),O("M12 20H3"),O("M14 2v4"),O("M8 10v4"),O("M16 18v4")],pen:[O("M21.17 6.81a1 1 0 0 0-3.99-3.99L3.84 16.17a2 2 0 0 0-.5.83l-1.32 4.35a.5.5 0 0 0 .62.62l4.35-1.32a2 2 0 0 0 .83-.5z")],arrow:[O("M5 12h14"),O("m12 5 7 7-7 7")],plus:[O("M12 5v14"),O("M5 12h14")],send:[O("M12 19V5"),O("m5 12 7-7 7 7")],stop:[["rect",{x:6,y:6,width:12,height:12,rx:2}]],x:[O("M18 6 6 18"),O("m6 6 12 12")],back:[O("m15 18-6-6 6-6")],menu:[O("M4 6h16"),O("M4 12h16"),O("M4 18h16")],search:[Wr(11,11,7),O("m20 20-3.5-3.5")],chevron:[O("m6 9 6 6 6-6")],check:[O("M20 6 9 17l-5-5")],alert:[Wr(12,12,9),O("M12 8v4"),O("M12 16h.01")],more:[Wr(5,12,1),Wr(12,12,1),Wr(19,12,1)],file:[O("M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z"),O("M14 3v5h5")],minus:[O("M5 12h14")],fit:[O("M15 3h6v6"),O("M9 21H3v-6"),O("M21 3l-7 7"),O("M3 21l7-7")],bolt:[O("M13 2 4 14h7l-1 8 9-12h-7z")],code:[O("m16 18 6-6-6-6"),O("m8 6-6 6 6 6")],sun:[Wr(12,12,4),O("M12 2v2"),O("M12 20v2"),O("m4.93 4.93 1.41 1.41"),O("m17.66 17.66 1.41 1.41"),O("M2 12h2"),O("M20 12h2"),O("m6.34 17.66-1.41 1.41"),O("m19.07 4.93-1.41 1.41")],cpu:[["rect",{x:4,y:4,width:16,height:16,rx:2}],["rect",{x:9,y:9,width:6,height:6,rx:1}],O("M15 2v2"),O("M15 20v2"),O("M2 15h2"),O("M2 9h2"),O("M20 15h2"),O("M20 9h2"),O("M9 2v2"),O("M9 20v2")],bell:[O("M10.27 21a2 2 0 0 0 3.46 0"),O("M3.26 15.33A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.67C19.41 13.96 18 12.5 18 8A6 6 0 0 0 6 8c0 4.5-1.41 5.96-2.74 7.33")],shield:[O("M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z")],folder:[O("M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z")],people:[O("M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"),Wr(9,7,4),O("M22 21v-2a4 4 0 0 0-3-3.87"),O("M16 3.13a4 4 0 0 1 0 7.75")],coin:[Wr(12,12,10),O("M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8"),O("M12 18V6")],monitor:[["rect",{x:2,y:3,width:20,height:14,rx:2}],O("M8 21h8"),O("M12 17v4")],list:[O("M8 6h13"),O("M8 12h13"),O("M8 18h13"),O("M3 6h.01"),O("M3 12h.01"),O("M3 18h.01")],board:[["rect",{x:3,y:3,width:18,height:18,rx:2}],O("M9 3v18"),O("M15 3v18")],panel:[["rect",{x:3,y:3,width:18,height:18,rx:2}],O("M15 3v18")],server:[["rect",{x:2,y:2,width:20,height:8,rx:2}],["rect",{x:2,y:14,width:20,height:8,rx:2}],O("M6 6h.01"),O("M6 18h.01")]};var Dx=H(ri(),1);var Te=(...e)=>e.filter(Boolean).join(" ");var Nx=H(F(),1);function Ot({name:e,small:t=!1}){return(0,Nx.jsx)("svg",{className:Te("k-i",t&&"k-i-sm"),viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:ku[e].map((i,s)=>(0,Dx.createElement)(i[0],{key:s,...i[1]}))})}var jt=H(F(),1);function vt({variant:e="outline",sm:t,iconOnly:i,lead:s,label:r,docked:n,busy:o,className:a,type:l="button",...c}){return(0,jt.jsx)("button",{type:l,className:Te("k-btn",`k-btn-${e}`,t&&"k-btn-sm",i&&"k-btn-icon",n&&"k-docked",o&&"busy",a),"aria-label":i?r:void 0,title:i?r:void 0,"aria-busy":o?!0:void 0,...c,children:i?(0,jt.jsx)(Ot,{name:i}):(0,jt.jsx)("span",{className:"k-face",children:o?(0,jt.jsxs)(jt.Fragment,{children:[(0,jt.jsx)("span",{className:"k-spin","aria-hidden":"true"}),o]}):(0,jt.jsxs)(jt.Fragment,{children:[s&&(0,jt.jsx)(Ot,{name:s,small:!0}),r]})})})}function $m({variant:e="outline",sm:t,label:i,lead:s,className:r,...n}){return(0,jt.jsx)("a",{className:Te("k-btn",`k-btn-${e}`,t&&"k-btn-sm",r),...n,children:(0,jt.jsxs)("span",{className:"k-face",children:[s&&(0,jt.jsx)(Ot,{name:s,small:!0}),i]})})}var Bx=H(F(),1);function Cu({word:e,tone:t="",dot:i=!0}){return(0,Bx.jsx)("span",{className:Te("k-chip",t,!i&&"nodot"),children:e})}var XR=H(F(),1);var Ox=H(F(),1);var zx=H(F(),1);var Hx=H(ri(),1);var Ln=H(F(),1);function Ux({label:e,hint:t,error:i,children:s}){let r=(0,Hx.useId)(),n=Te(t&&`${r}-hint`,`${r}-err`);return(0,Ln.jsxs)("div",{className:"k-field",children:[(0,Ln.jsx)("label",{className:"k-label",htmlFor:r,children:e}),s({id:r,describedBy:n,invalid:!!i}),t&&(0,Ln.jsx)("p",{className:"k-hint",id:`${r}-hint`,children:t}),(0,Ln.jsx)("span",{className:"k-err",id:`${r}-err`,role:"alert",children:i??""})]})}var Px=({className:e,...t})=>(0,Ln.jsx)("input",{className:Te("k-input",e),...t});var Eu=H(F(),1);function qx({items:e,sm:t,wide:i,className:s,...r}){return(0,Eu.jsx)("span",{className:Te("k-selw",t&&"sm",i&&"wide",s),children:(0,Eu.jsx)("select",{className:"k-sel",...r,children:e.map(n=>{let[o,a]=typeof n=="string"?[n,n]:n;return(0,Eu.jsx)("option",{value:o,children:a},o)})})})}var Ix=H(F(),1);var Fx=H(F(),1);var Qs=H(F(),1);function $x({name:e,legend:t,current:i,items:s,onChange:r}){return(0,Qs.jsxs)("fieldset",{className:"k-radios",children:[(0,Qs.jsx)("legend",{className:"k-sr",children:t}),s.map(n=>(0,Qs.jsxs)("label",{className:"k-opt",children:[(0,Qs.jsx)("input",{type:"radio",name:e,value:n.value,checked:n.value===i,onChange:()=>r(n.value)}),(0,Qs.jsxs)("span",{children:[(0,Qs.jsx)("b",{children:n.label}),n.text&&(0,Qs.jsx)("span",{children:n.text})]}),n.tag]},n.value))]})}var Kx=H(F(),1),Go=({children:e})=>(0,Kx.jsx)("div",{className:"k-acts",children:e});var ZR=H(ri(),1),Wx=H(F(),1);var Yo=H(F(),1),Km=({children:e})=>(0,Yo.jsxs)("p",{className:"k-notice",role:"alert",children:[(0,Yo.jsx)(Ot,{name:"alert",small:!0}),(0,Yo.jsx)("span",{children:e})]});var Bl=({children:e})=>(0,Yo.jsx)("p",{className:"k-note",children:e});var Ol=H(F(),1);function Tu({title:e,text:t,action:i}){return(0,Ol.jsxs)("div",{className:"k-empty",children:[(0,Ol.jsx)("p",{className:"k-empty-t",children:e}),t&&(0,Ol.jsx)("p",{className:"k-empty-x",children:t}),i]})}var Vx=H(F(),1);var Wm=H(F(),1);var Vm=H(F(),1);var jm=H(F(),1);var jr=H(ri(),1),g2=H(Zu(),1);var QR="toolroll.key",JR="x-toolroll-key",e8=/^[0-9a-f]{64}$/;function jx(){try{let e=globalThis.localStorage?.getItem(QR)??null;if(e===null)return null;let t=JSON.parse(e),i=typeof t=="object"&&t!==null?t.key:null;return typeof i=="string"&&e8.test(i)?i:null}catch{return null}}function Au(e){let t=jx();return t===null?e:{...e,[JR]:t}}function Gx(){let e=jx();return e===null?["toolroll"]:["toolroll",`toolroll.key.${e}`]}var ys="form.k-sform",Hl=e=>HTMLFormElement.prototype.getAttribute.call(e,"id")??"",t8=e=>Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements").get.call(e),Yx="http://www.w3.org/2000/svg",Js=e=>e.querySelector("[data-k-proof]"),bs=e=>e.querySelector("[data-k-save]"),e2=e=>new Set(Array.from(Js(e)?.querySelectorAll("input[name]")??[]).map(t=>t.name));function Ru(e,t=null){let i=e2(e),s;try{s=t?new FormData(e,t):new FormData(e)}catch{s=new FormData(e)}let r=[];return s.forEach((n,o)=>{!i.has(o)&&typeof n=="string"&&r.push([o,n])}),r}function Jm(e){let t=new Map;for(let[i,s]of e)t.set(i,[...t.get(i)??[],s]);return t}function t2(e){let t=e2(e),i=[];for(let s of Array.from(t8(e)))!s.name||s.type==="hidden"||s.type==="submit"||s.type==="button"||t.has(s.name)||i.includes(s.name)||i.push(s.name);return i}var ji=e=>(e??"").replace(/\s+/g," ").trim();function i2(e,t){return e.querySelector(`[name="${CSS.escape(t)}"]`)}function i8(e,t){let i=i2(e,t);if(i===null)return t;let s=i.getAttribute("aria-label");if(s)return ji(s);if(i.type==="radio"||i.type==="checkbox"&&i.getAttribute("role")!=="switch"){let o=i.closest("fieldset")?.querySelector("legend");if(o)return ji(o.textContent)}let r=i.closest(".k-frow")?.querySelector(".k-frow-t");if(r)return ji(r.textContent);let n=i.labels?.[0];return n?ji(n.querySelector(".k-sl-t, b")?.textContent??n.textContent):t}function s8(e,t,i){let s=i2(e,t);if(s instanceof HTMLSelectElement)return ji(Array.from(s.options).find(o=>o.value===i[0])?.textContent??i[0]);if(s?.type==="radio"||s?.type==="checkbox"){let o=Array.from(e.querySelectorAll(`[name="${CSS.escape(t)}"]`));if(s.type==="checkbox"&&s.getAttribute("role")==="switch")return i.length>0?"On":"Off";let a=o.filter(l=>i.includes(l.value)).map(l=>ji(l.labels?.[0]?.querySelector("b")?.textContent??l.labels?.[0]?.textContent??l.value));return a.length===0?"none":a.join(", ")}let r=i[0]??"";if(s?.type==="password")return r===""?"unchanged":"a new value";let n=r.split(`
155
155
  `)[0].trim();return n===""?"empty":n.length>40?`${n.slice(0,39)}…`:`${n}${r.includes(`
156
156
  `)?"…":""}`}var r8=(e,t)=>JSON.stringify(e??[])===JSON.stringify(t??[]);function e_(e){let t=Jm(Ru(e));return t2(e).filter(i=>!r8(e.kInit?.get(i),t.get(i)))}function s2(e,t){let i=Jm(t),s=e.hasAttribute("data-k-gate")?e_(e):t2(e);return s.length>3?`${s.length} changes`:s.map(r=>`${i8(e,r)}: ${s8(e,r,i.get(r)??[])}`).join(" · ")}function r2(e,t){let i=e.dataset.kProofIf;if(!i)return!0;let s=i.indexOf("=");return t.some(([r,n])=>r===i.slice(0,s)&&n===i.slice(s+1))}var Ym=e=>e!==null&&e.querySelector('input[type="password"], a.sso-step-up')!==null;function Mu(e){if(e.kPrepped)return;e.kPrepped=!0,e.kInit=Jm(Ru(e));for(let i of Array.from(Js(e)?.querySelectorAll("input[required]")??[]))i.removeAttribute("required"),i.dataset.kRequired="";let t=bs(e);t&&(t.dataset.kVariant=t.classList.contains("k-btn-danger")?"danger":t.classList.contains("k-btn-outline")?"outline":"primary")}function Xx(){for(let e of Array.from(document.querySelectorAll(ys)))Mu(e)}function n8(e,t){e.classList.remove("k-btn-primary","k-btn-outline","k-btn-danger"),e.classList.add(`k-btn-${t}`)}function o8(e){for(let t of Array.from(document.querySelectorAll(`${ys}[data-k-gate]`))){let i=bs(t);!i||i.dataset.kVariant!=="primary"||n8(i,t===e||e===null?"primary":"outline")}}function a8(e,t){if(!e.hasAttribute("data-k-gate"))return;let i=e_(e),s=e.querySelector(".k-ssave-said");if(e.toggleAttribute("data-dirty",i.length>0),s)if(s.dataset.kIdle===void 0&&(s.dataset.kIdle=s.textContent??""),i.length===0)s.textContent=s.dataset.kIdle??"";else{let r=Ru(e),n=Js(e)!==null&&Ym(Js(e))&&r2(e,r)?" · Asks for your password.":"";s.textContent=`${s2(e,r)}${n}`}t&&o8(i.length>0?e:document.querySelector(`${ys}[data-k-gate][data-dirty]`))}function n2(e){let t=document.createElementNS(Yx,"svg");t.setAttribute("class","k-i"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true");for(let i of ku[e]){let s=document.createElementNS(Yx,i[0]);for(let[r,n]of Object.entries(i[1]))s.setAttribute(r,String(n));t.append(s)}return t}function zl(e,t,i){let s=document.createElement("button");s.type="button",s.className=`k-btn k-btn-${t}`;for(let[n,o]of Object.entries(i))s.setAttribute(n,o);let r=document.createElement("span");return r.className="k-face",r.textContent=e,s.append(r),s}function Ul(e,t){let i=bs(e);if(!i)return;let s=i.querySelector(".k-face");if(s&&i.dataset.kLabel===void 0&&(i.dataset.kLabel=s.textContent??""),i.classList.toggle("busy",t),i.toggleAttribute("aria-busy",t),s)if(s.replaceChildren(),t){let r=document.createElement("span");r.className="k-spin",r.setAttribute("aria-hidden","true"),s.append(r,i.dataset.kBusy??"Saving…")}else s.textContent=i.dataset.kLabel??"Save"}function o2(e){let t=e.querySelector(".k-ssave-err");t&&t.childElementCount>0&&t.replaceChildren(),bs(e)?.removeAttribute("aria-describedby")}function Xm(e,t){e.kPending=!1,e.kSent=!1,Ul(e,!1);for(let s of Array.from(Js(e)?.querySelectorAll('input[type="password"]')??[]))s.value="";let i=e.querySelector(".k-ssave-err");if(i){let s=document.createElement("p");s.className="k-notice",s.setAttribute("role","alert"),s.append(n2("alert"));let r=document.createElement("span");r.textContent=t,s.append(r),i.replaceChildren(s),i.id||(i.id=`${Hl(e)||"k-sform"}-err`),bs(e)?.setAttribute("aria-describedby",i.id),(e.querySelector(".k-ssave")??i).scrollIntoView({block:"center",behavior:"instant"})}bs(e)?.focus({preventScroll:!0})}var a2=e=>{let t=ji(e);return t===""?t:`${t.charAt(0).toUpperCase()}${t.slice(1)}${/[.!?]$/.test(t)?"":"."}`},Zm=e=>`${a2(e)} Your edits are still here.`;function l8(e){try{let i=new DOMParser().parseFromString(e,"text/html").querySelector(".k-notice[role=alert] span, .problem, .k-notice[role=alert], [role=alert]"),s=ji(i?.textContent);return s===""?null:s.slice(0,400)}catch{return null}}var Xo=!1,c8=e=>ji(e.closest("section")?.querySelector("h3")?.childNodes[0]?.textContent??e.closest("section")?.querySelector("h3")?.textContent)||"a section",h8=e=>Array.from(document.querySelectorAll(`${ys}[data-k-gate][data-dirty]`)).filter(t=>t!==e);function u8(e){let t=new URL(window.location.href);for(let s of["said","problem","unconfirmed"])t.searchParams.delete(s);t.searchParams.set("unconfirmed",Hl(e));let i=e.closest("section[id]")?.id;return`${t.pathname}${t.search}${i?`#${i}`:""}`}var d8=(e,t)=>t instanceof HTMLButtonElement&&t.form===e&&t.hasAttribute("formaction")?t.formAction:new URL(HTMLFormElement.prototype.getAttribute.call(e,"action")??"",window.location.href).href;function Gm(e){Xo=!0,window.location.assign(Hl(e)?u8(e):window.location.href)}async function f8(e,t,i,s){Ul(e,!0);let r=new URLSearchParams;for(let[d,f]of[...t,...i])r.append(d,f);let n=d8(e,s),o;try{o=await fetch(n,{method:"POST",body:r,credentials:"same-origin",redirect:"follow",headers:Au({accept:"text/html"})})}catch{Gm(e);return}let a=new URL(o.url||n,window.location.href);if(a.origin!==window.location.origin||a.pathname==="/login"){Gm(e);return}let l=a.searchParams.get("problem");if(l){Xm(e,Zm(l));return}if(!o.redirected&&o.status>=400&&o.status<500){let d=l8(await o.text().catch(()=>""));Xm(e,Zm(d??`Toolroll refused this (${o.status}). Nothing changed`));return}if(!o.ok){Gm(e);return}let c=a.pathname===window.location.pathname,h=e.closest("section[id]")?.id;Xo=!0;let u=`${a.pathname}${a.search}${c&&h?`#${h}`:""}`;o.redirected&&`${a.pathname}${a.search}`!=`${window.location.pathname}${window.location.search}`?window.location.assign(u):(o.redirected&&window.history.replaceState(window.history.state,"",u),window.location.reload())}function Zx(e,t){let i=e.hasAttribute("data-k-download");i||(Xo=!0),e.kGo=!0;try{t instanceof HTMLButtonElement&&t.form===e?e.requestSubmit(t):e.requestSubmit()}finally{e.kGo=!1}if(i){Xo=!1,e.kPending=!1,e.kSent=!1,Ul(e,!1);for(let s of Array.from(Js(e)?.querySelectorAll('input[type="password"]')??[]))s.value=""}}function Qm(e,t,i,s){if(e.kPending=!0,e.hasAttribute("data-k-native")){if(e.hasAttribute("data-k-download")||Ul(e,!0),e.hasAttribute("data-k-prepare")){let r=!1,n=o=>{r||(r=!0,o===null?Zx(e,s):Xm(e,Zm(o)))};e.dispatchEvent(new CustomEvent("k-prepare",{detail:{done:n}}));return}Zx(e,s);return}f8(e,t,i,s)}var l2=e=>Array.from(e?.querySelectorAll("input[name]")??[]).map(t=>[t.name,t.value]);function p8(e,t,i){let s=Js(e),r=s.nextElementSibling,n=`${Hl(e)||"k-sform"}-pop`,o=document.createElement("div");o.className="k-pop",o.id=n,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","true"),o.setAttribute("aria-labelledby",`${n}-h`),o.tabIndex=-1;let a=document.createElement("div");a.className="k-pop-h";let l=document.createElement("h3");l.id=`${n}-h`,l.textContent="Confirm with your password";let c=zl("","ghost",{"data-k-close":"","aria-label":"Close",title:"Close"});c.classList.add("k-btn-sm","k-btn-icon"),c.replaceChildren(n2("x")),a.append(l,c);let h=document.createElement("p");h.className="k-pop-terms",h.textContent=s2(e,t)||ji(e.dataset.kConfirm);let u=document.createElement("p");u.textContent=[e.dataset.kConfirm,e.dataset.kNote].filter(Boolean).map(g=>a2(g)).join(" ");let d=document.createElement("div");d.className="k-acts";let f=ji(bs(e)?.dataset.kLabel??bs(e)?.textContent)||"Save";d.append(zl(f,"primary",{"data-k-sconfirm":""}),zl("Cancel","ghost",{"data-k-close":""})),o.append(a,h,u,s,d),e.append(o),e.kSnapshot=t,e.kSubmitter=i,e.kPending=!0,e.kSent=!1,e.kClose=Vr(o,i??bs(e),{onClose:()=>{if(r&&r.parentElement===e?r.before(s):e.insertBefore(s,e.querySelector(".k-ssave")),o.remove(),e.kClose=null,!e.kSent){e.kPending=!1;for(let g of Array.from(s.querySelectorAll('input[type="password"]')))g.value="",g.setCustomValidity("")}}})}function Qx(e){let t=Js(e),i=Array.from(t?.querySelectorAll('input[type="password"]')??[]).find(r=>r.value==="");if(i){i.setCustomValidity("Enter your password."),i.reportValidity(),i.focus();return}let s=l2(t);e.kSent=!0,e.kClose?.(),Qm(e,e.kSnapshot??[],s,e.kSubmitter??null)}function g8(e,t){if(e.kPending||(Mu(e),e.hasAttribute("data-k-gate")&&e_(e).length===0&&!(t instanceof HTMLButtonElement&&t.hasAttribute("formaction"))))return;let i=e.hasAttribute("data-k-download")?[]:h8(e);if(i.length>0){m8(e,i,t);return}c2(e,t)}function m8(e,t,i){let s=[...new Set(t.map(c8))],r=`${Hl(e)||"k-sform"}-discard`,n=document.createElement("div");n.className="k-pop",n.id=r,n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${r}-h`),n.tabIndex=-1;let o=document.createElement("div");o.className="k-pop-h";let a=document.createElement("h3");a.id=`${r}-h`,a.textContent="Unsaved changes",o.append(a);let l=document.createElement("p");l.textContent=`You have unsaved changes in ${s.length>1?`${s.slice(0,-1).join(", ")} and ${s.at(-1)}`:s[0]}. Saving this will discard them.`;let c=document.createElement("div");c.className="k-acts";let h=zl("Save this anyway","primary",{"data-k-discard":""});c.append(h,zl("Cancel","ghost",{"data-k-close":""})),n.append(o,l,c),e.append(n),e.kPending=!0;let u=!1,d=Vr(n,i??bs(e),{onClose:()=>{n.remove(),e.kPending=!1,u&&c2(e,i)}});h.addEventListener("click",f=>{f.preventDefault(),u=!0,d()}),h.focus()}function c2(e,t){o2(e);let i=Ru(e,t);if(t instanceof HTMLButtonElement&&t.hasAttribute("formaction")){Qm(e,i,[],t);return}let s=Js(e);if(s!==null&&r2(e,i)&&Ym(s)){p8(e,i,t);return}Qm(e,i,s!==null&&!Ym(s)?l2(s):[],t)}var Jx=!1;function h2(){if(Jx||typeof document>"u")return;Jx=!0,document.documentElement.classList.add("k-js");let e=i=>{let s=i.target?.closest?.(ys);s&&Mu(s)};document.addEventListener("focusin",e,!0),document.addEventListener("pointerdown",e,!0);let t=i=>{let s=i.target,r=s?.form;if(!r||!r.matches(ys)||s.closest("[data-k-proof], .k-pop")){s?.type==="password"&&s.setCustomValidity("");return}Mu(r),o2(r),a8(r,!0)};document.addEventListener("input",t),document.addEventListener("change",t),document.addEventListener("submit",i=>{let s=i.target;if(!(s instanceof HTMLFormElement)||!s.matches(ys))return;let r=s;if(!r.kGo){if(i.preventDefault(),i.stopImmediatePropagation(),r.kClose){Qx(r);return}g8(r,i.submitter??null)}},!0),document.addEventListener("click",i=>{let s=i.target?.closest?.("[data-k-sconfirm]");if(!s)return;let r=s.closest(ys);r&&(i.preventDefault(),Qx(r))}),window.addEventListener("pageshow",()=>{Xo=!1;for(let i of Array.from(document.querySelectorAll(ys)))i.kPending=!1,i.kSent=!1,Ul(i,!1)}),window.addEventListener("standing-orders:workspace-rendered",Xx),window.addEventListener("beforeunload",i=>{Xo||document.querySelector(`${ys}[data-k-gate][data-dirty]`)===null||i.preventDefault()}),Xx()}var _8="(max-width: 760px)",v8='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',t_=()=>typeof window<"u"&&window.matchMedia(_8).matches,y8=()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches;function Pl(e){let t=e.closest(".k-composer");if(t===null)return;let i=getComputedStyle(e),s=parseFloat(i.lineHeight)||21,r=(parseFloat(i.paddingTop)||0)+(parseFloat(i.paddingBottom)||0),n=s*(Number(e.dataset.max)||8)+r,o=s*(Number(e.dataset.min)||1)+r;e.style.height="auto",e.style.height=`${Math.max(o,Math.min(e.scrollHeight,n))}px`,e.style.overflowY=e.scrollHeight>n+1?"auto":"hidden";let a=e.value.trim()!=="";t.classList.toggle("has-text",a);for(let l of t.querySelectorAll(".k-send[data-gate]:not(:disabled)"))l.setAttribute("aria-disabled",String(!a))}function u2(){let e=window.visualViewport;if(!e)return;let t=Math.max(0,Math.round(window.innerHeight-e.height-e.offsetTop));document.documentElement.style.setProperty("--kb",`${t}px`),document.documentElement.classList.toggle("kb-open",t>80)}var zt=[];function b8(e,t){if(t===null||!t.isConnected)return;let i=t.getBoundingClientRect(),s=e.offsetWidth||336,r=e.offsetHeight||200,n=Math.min(Math.max(8,i.right-s),window.innerWidth-s-8),o=i.bottom+6,a=o+r>window.innerHeight-8?Math.max(8,i.top-r-6):o;e.style.left=`${Math.round(n)}px`,e.style.top=`${Math.round(a)}px`,e.style.setProperty("--origin",`${i.right-n}px ${a>=o?0:r}px`)}function Vr(e,t,i={}){zt.length>0&&!e.classList.contains("k-pop")&&p2("close");let r=e.classList.contains("k-pop"),n=t_();e.isConnected||document.body.append(e);let o=document.createElement("div");o.className=`k-scrim${i.dim??(!r||n)?" dim":""}${zt.length>0?" stacked":""}`,e.before(o),e.hidden=!1,e.setAttribute("role",e.getAttribute("role")??"dialog"),e.setAttribute("aria-modal","true"),e.hasAttribute("tabindex")||(e.tabIndex=-1),e.classList.toggle("stacked",zt.length>0),e.classList.toggle("as-sheet",r&&n),r&&!n&&b8(e,t),y8()||(e.classList.remove("k-grow-in"),e.offsetWidth,e.classList.add("k-grow-in"));let a=[];for(let h=e;h&&h!==document.body;h=h.parentElement)h.inert&&(h.inert=!1,a.push(h));let l=[];for(let h=e;h!==document.body&&h.parentElement;h=h.parentElement)for(let u of Array.from(h.parentElement.children))u===h||u===o||u.inert||(u.inert=!0,l.push(u));let c={panel:e,scrim:o,trigger:t,inerted:l,released:a,onClose:i.onClose};return w8(),zt.push(c),o.addEventListener("click",()=>Nn(c,"scrim")),(e.querySelector("[autofocus]")??e.querySelector('input:not([type="hidden"]), textarea, select')??e).focus(),()=>Nn(c,"close")}function Nn(e,t){let i=zt.indexOf(e);if(!(i<0)){for(let s of zt.slice(i+1).reverse())Nn(s,"removed");zt.splice(i,1),zt.length===0&&(Dn?.disconnect(),Dn=null);for(let s of e.inerted)s.inert=!1;for(let s of e.released)s.isConnected&&(s.inert=!0);e.scrim.remove(),e.panel.hidden=!0,e.panel.classList.remove("k-grow-in","as-sheet","stacked"),S8(e.trigger),e.onClose?.(t)}}function i_(){for(let e of zt.slice().reverse())e.panel.isConnected||Nn(e,"removed");zt.length===0&&(Dn?.disconnect(),Dn=null)}var Dn=null;function w8(){Dn!==null||typeof MutationObserver>"u"||(Dn=new MutationObserver(()=>{zt.some(e=>!e.panel.isConnected)&&i_()}),Dn.observe(document.body,{childList:!0,subtree:!0}))}function p2(e="removed"){for(let t of zt.slice().reverse())Nn(t,e)}function Lu(e){return e!=null&&e.isConnected&&e.getClientRects().length>0}function S8(e){let t=e?.getAttribute("data-k-open");if(Lu(e)){e.focus();return}((t?Array.from(document.querySelectorAll(`[data-k-open="${CSS.escape(t)}"]`)).find(Lu):void 0)??Array.from(document.querySelectorAll(".k-dock .k-btn")).find(Lu))?.focus()}function k8(e){let t=zt[zt.length-1];if(!t)return;if(e.key==="Escape"){e.preventDefault(),Nn(t,"escape");return}if(e.key!=="Tab")return;let i=Array.from(t.panel.querySelectorAll(v8)).filter(Lu);if(i.length===0){e.preventDefault(),t.panel.focus();return}let s=i[0],r=i[i.length-1];e.shiftKey&&(document.activeElement===s||document.activeElement===t.panel)?(e.preventDefault(),r.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),s.focus())}function ql(e,t,i){let s=t_(),r=document.createElement("div"),n=`k-menu-${Math.random().toString(36).slice(2,8)}`;r.className=s?"k-sheet":"k-pop k-pop-menu",r.setAttribute("role","dialog"),r.setAttribute("aria-labelledby",n);let o=document.createElement("div");o.className=s?"k-sheet-h":"k-pop-h";let a=document.createElement(s?"h2":"h3");a.id=n,a.textContent=t;let l=document.createElement("button");l.type="button",l.className="k-btn k-btn-ghost k-btn-sm k-btn-icon",l.setAttribute("aria-label","Close"),l.setAttribute("data-k-close",""),l.textContent="×",o.append(a,l);let c=document.createElement("div");c.className="k-menu";let h=()=>{};for(let u of i){let d=document.createElement("button");d.type="button",d.textContent=u.current?`${u.label} · current`:u.label,u.current&&d.setAttribute("aria-current","true"),d.addEventListener("click",()=>{h(),u.act()}),c.append(d)}return r.append(o,c),h=Vr(r,e,{onClose:()=>r.remove()}),h}function x8(e){let t=e.target,i=t?.closest("[data-k-composer-project]"),s=t?.closest("[data-k-composer-plus]"),r=i?.dataset.kComposerProject??s?.dataset.kComposerPlus;if(r===void 0)return!1;e.preventDefault();let n=document.getElementById(`${r}-project`),o=c=>{if(!n)return;let h=[];try{let u=JSON.parse(n.dataset.items??"[]");Array.isArray(u)&&(h=u.filter(d=>typeof d=="string"))}catch{h=[]}ql(c,"Project",h.map(u=>({label:u,current:u===n.value,act:()=>{n.value=u;let d=document.querySelector(`[data-k-composer-project="${CSS.escape(r)}"] [data-k-project-name]`);d&&(d.textContent=u),document.querySelector(`[data-k-composer-project="${CSS.escape(r)}"]`)?.setAttribute("aria-label",`Project: ${u}. Change`),n.dispatchEvent(new Event("change",{bubbles:!0}))}})))};if(i)return o(i),!0;let a=document.querySelector(`input[type="file"][data-k-attach="${CSS.escape(r)}"]`),l=[];return a&&l.push({label:"Attach a file",act:()=>a.click()}),n&&l.push({label:"Choose project",act:()=>o(document.querySelector(`[data-k-composer-project="${CSS.escape(r)}"]`)??s)}),l.length>0&&ql(s,"Add to your message",l),!0}function C8(e,t){let i=e.closest("[data-k-draft]");if(i===null)return!1;let s=document.getElementById(`${i.dataset.kInto??""}-text`);if(!(s instanceof HTMLTextAreaElement)||s.disabled)return!0;t.preventDefault();let r=i.dataset.kDraft??"",n=s.value;return s.value=n.trim()===""?r:n.includes(r)?n:`${n.trimEnd()}
157
157
  ${r}`,Pl(s),s.focus(),!0}var d2=!1,f2=new WeakMap;function E8(){let e=document.documentElement;e.classList.add("k-js"),document.addEventListener("keydown",t=>{(t.key==="Tab"||t.key==="F6")&&e.classList.add("k-kbd")},!0),document.addEventListener("pointerdown",()=>{e.classList.remove("k-kbd")},!0)}function Du(){if(d2||typeof document>"u")return;d2=!0,document.addEventListener("input",t=>{let i=t.target;i instanceof HTMLTextAreaElement&&i.classList.contains("k-composer-ta")&&Pl(i)}),document.addEventListener("click",t=>{let i=t.target;if(i===null)return;if(i.closest('.k-send[data-gate][aria-disabled="true"]')){t.preventDefault();return}if(C8(i,t)||x8(t))return;let r=i.closest("[data-k-open]");if(r){let o=document.getElementById(r.dataset.kOpen??"");o&&(t.preventDefault(),Vr(o,r));return}if(i.closest("[data-k-close]")){let o=zt[zt.length-1];o&&o.panel.contains(i)&&(t.preventDefault(),Nn(o,"close"));return}let n=i.closest("button.k-switch[role=switch][data-k-switch]");if(n){let o=n.getAttribute("aria-checked")!=="true";n.setAttribute("aria-checked",String(o));let[a,l]=(n.dataset.kSwitch||"On|Off").split("|"),c=n.querySelector("[data-k-words]");c&&(c.textContent=(o?a:l)??""),n.dispatchEvent(new CustomEvent("k-switch",{bubbles:!0,detail:{on:o}}));return}i.closest("[data-k-print]")&&(t.preventDefault(),window.print())}),document.addEventListener("submit",t=>{let i=t.target;if(!(i instanceof HTMLFormElement)||t.defaultPrevented)return;let s=(t.submitter instanceof HTMLButtonElement?t.submitter:null)??i.querySelector("button[type=submit][data-k-busy]"),r=s?.dataset.kBusy;if(s==null||r===void 0)return;if(i.getAttribute("aria-busy")==="true"){t.preventDefault();return}i.setAttribute("aria-busy","true");let n=s.querySelector(".k-face");n!==null&&(f2.set(s,Array.from(n.childNodes)),n.replaceChildren(Object.assign(document.createElement("span"),{className:"k-spin"}),document.createTextNode(r)),n.firstElementChild?.setAttribute("aria-hidden","true")),s.classList.add("busy")}),window.addEventListener("pageshow",()=>{for(let t of document.querySelectorAll("form[aria-busy=true]")){t.removeAttribute("aria-busy");for(let i of Array.from(Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements").get.call(t))){if(!(i instanceof HTMLButtonElement)||!i.classList.contains("busy")||i.dataset.kBusy===void 0)continue;i.classList.remove("busy");let s=i.querySelector(".k-face"),r=f2.get(i);s!==null&&r!==void 0&&s.replaceChildren(...r)}}}),document.addEventListener("keydown",k8,!0),E8();let e=()=>{i_();for(let t of document.querySelectorAll(".k-composer-ta"))Pl(t)};window.addEventListener("standing-orders:workspace-rendered",e),window.visualViewport?.addEventListener("resize",u2),window.visualViewport?.addEventListener("scroll",u2),h2(),e()}var Fe=H(F(),1);function Nu({kind:e,title:t,sub:i,trigger:s,onClose:r,children:n}){let o=(0,jr.useRef)(null),a=(0,jr.useRef)(r);a.current=r;let l=(0,jr.useId)();(0,jr.useLayoutEffect)(()=>{let f=o.current;if(!f)return;let g=!1,b=Vr(f,s,{onClose:T=>{g=!0,a.current(T)}});return()=>{g||b()}},[s]);let c=(0,Fe.jsx)(vt,{variant:"ghost",iconOnly:"x",label:"Close",sm:e==="popover"||e==="menu","data-k-close":""}),h=e==="menu"?(0,Fe.jsx)("div",{className:"k-menu",children:n}):n,u=e==="drawer"?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsxs)("header",{className:"k-drawer-h",children:[(0,Fe.jsx)("h2",{id:l,children:t}),c]}),(0,Fe.jsx)("div",{className:"k-drawer-b",children:h})]}):e==="sheet"?(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsxs)("div",{className:"k-sheet-h",children:[(0,Fe.jsxs)("div",{className:"k-sheet-ht",children:[(0,Fe.jsx)("h2",{id:l,children:t}),i&&(0,Fe.jsx)(Bl,{children:i})]}),c]}),(0,Fe.jsx)("div",{className:"k-sheet-b",children:h})]}):(0,Fe.jsxs)(Fe.Fragment,{children:[(0,Fe.jsxs)("div",{className:"k-pop-h",children:[(0,Fe.jsx)("h3",{id:l,children:t}),c]}),h]}),d=e==="drawer"?"k-drawer":e==="sheet"?"k-sheet":Te("k-pop",e==="menu"&&"k-pop-menu");return(0,g2.createPortal)((0,Fe.jsx)("div",{ref:o,className:d,role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,children:u}),document.body)}var m2=H(F(),1);var Gr=H(ri(),1);var yt=H(F(),1);function _2({kind:e,facts:t,label:i,terms:s,text:r,primary:n=!0,docked:o,busy:a="Starting…",onApprove:l,check:c}){let h=Fm(e,t),[u,d]=(0,Gr.useState)(null),[f,g]=(0,Gr.useState)(!1),[b,T]=(0,Gr.useState)(null),_=(0,Gr.useRef)(!1),m=(0,Gr.useId)(),v=async E=>{if(!_.current){_.current=!0,g(!0),T(null);try{let A=await l(E,Ax(e,t));T(A),A===null&&d(null)}finally{_.current=!1,g(!1)}}};if(h==="automatic")return null;let p=E=>{E.preventDefault();let A=new FormData(E.currentTarget).get("token");v(typeof A=="string"?A:"")};return(0,yt.jsxs)(yt.Fragment,{children:[(0,yt.jsx)(vt,{variant:n?"primary":"outline",label:i,docked:o===!0,busy:f&&u===null?a:!1,"aria-haspopup":h==="password"?"dialog":void 0,...n?{"data-ink-approve":""}:{},onClick:E=>{!T8(E)||_.current||c!==void 0&&!c()||(h==="password"?d(E.currentTarget):v(null))}}),h==="click"&&b&&(0,yt.jsx)(Km,{children:b}),u&&(0,yt.jsxs)(Nu,{kind:"popover",title:"Confirm with your password",trigger:u,onClose:()=>{d(null),T(null)},children:[r&&(0,yt.jsx)("p",{children:r}),(0,yt.jsx)("p",{className:"k-pop-terms",children:s}),(0,yt.jsxs)("form",{className:"k-field",onSubmit:p,children:[(0,yt.jsx)("label",{className:"k-label",htmlFor:m,children:"Your password"}),(0,yt.jsx)(Px,{id:m,type:"password",name:"token",autoComplete:"current-password",required:!0,autoFocus:!0,"aria-describedby":`${m}-err`,"aria-invalid":b?!0:void 0}),(0,yt.jsx)("span",{className:"k-err",id:`${m}-err`,role:"alert",children:b??""}),(0,yt.jsxs)(Go,{children:[(0,yt.jsx)(vt,{type:"submit",variant:"primary",label:i,busy:f?a:!1}),(0,yt.jsx)(vt,{variant:"ghost",label:"Cancel","data-k-close":""})]})]}),(0,yt.jsx)("p",{className:"k-pop-foot k-note",children:Nl(e,{...t,remembered:!1,passwordless:!1})==="Asks for your password."&&e==="standard"?"After this, standard approvals on this computer need no password for 15 minutes.":Nl(e,t)})]})]})}function T8(e){return e.nativeEvent.isTrusted!==!1}var v2=H(F(),1);var M8=H(ri(),1);var y2=H(F(),1);var b2=H(F(),1);var s_=H(F(),1);var R8=H(ri(),1);var w2=H(F(),1);var S2=H(F(),1);var r_=H(F(),1);var n_=H(F(),1);var k2=H(F(),1);var o_=H(ri(),1);var x2=H(F(),1);var Bu=H(ri(),1);var a_=H(F(),1);var U=H(F(),1),Zo={claude:"Claude Code",codex:"Codex",shell:"Shell"},D8={claude:"An agent you drive by hand",codex:"An agent you drive by hand",shell:"A plain terminal"},N8={connecting:"Connecting…",live:"Live",ended:"Ended",behind:"Catching up…","signed-out":"Signed out. Sign in again to keep typing",gone:"This terminal is gone",offline:"Reconnecting…",busy:"Not reading input. What you type waits"},l_=document.getElementById("so-term-boot"),B8=l_?.dataset.csrf??"",C2=l_?.dataset.session||null,O8=l_?.dataset.passwordless==="1",E2={passwordless:O8,remembered:!1},z8=()=>window.matchMedia("(max-width: 760px)").matches;async function H8(){let e=await fetch("/term/state",{headers:{accept:"application/json"},credentials:"same-origin"});return e.status===401?(location.href=`/login?next=${encodeURIComponent(location.pathname)}`,null):e.ok?await e.json():null}async function M2(e,t){try{return await(await fetch(e,{method:"POST",headers:Au({accept:"application/json"}),credentials:"same-origin",body:new URLSearchParams({csrf:B8,...t})})).json()}catch{return{ok:!1,error:"The console didn't answer. Nothing changed; try again."}}}function T2(){let e=r=>getComputedStyle(document.documentElement).getPropertyValue(r).trim(),t=e("--so-ink"),i=e("--so-code-bg")||e("--so-paper"),s=e("--so-muted");return{background:i,foreground:t,cursor:t,cursorAccent:i,selectionBackground:e("--so-selection")||e("--so-soft"),black:t,brightBlack:s,white:s,brightWhite:t,blue:e("--so-info"),brightBlue:e("--so-info"),green:e("--so-success"),brightGreen:e("--so-success"),red:e("--so-danger"),brightRed:e("--so-danger"),yellow:e("--so-warning"),brightYellow:e("--so-warning"),cyan:e("--so-info"),brightCyan:e("--so-info"),magenta:e("--so-accent-text"),brightMagenta:e("--so-accent-text")}}function U8({session:e,onLink:t,keys:i}){let s=(0,Be.useRef)(null);return(0,Be.useEffect)(()=>{let r=new BS({fontFamily:'"Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace',fontSize:z8()?12:13,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3,macOptionIsMeta:!0,theme:T2()}),n=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{r.options.theme=T2()};n.addEventListener("change",o);let a=new OS;r.loadAddon(a);let l=new ik;r.loadAddon(l),r.unicode.activeVersion="11",r.open(s.current);let c=null;try{c=new wx,c.onContextLoss(()=>{c?.dispose(),c=null}),r.loadAddon(c)}catch{c=null}let h=null,u=!1,d=!1,f=0,g,b,T=L=>{h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify(L))},_=L=>T({t:"in",d:L});i(_);let m=()=>{try{a.fit()}catch{return}T({t:"resize",cols:r.cols,rows:r.rows})},v=()=>{t(f===0?"connecting":"offline");let L=`${location.protocol==="https:"?"wss":"ws"}://${location.host}/term/${e.id}/socket`,B=new WebSocket(L,Gx());h=B,B.binaryType="arraybuffer";let W=!0;B.onmessage=$=>{if(W&&(r.reset(),W=!1),typeof $.data!="string"){r.write(new Uint8Array($.data));return}let P;try{P=JSON.parse($.data)}catch{return}P.t==="hello"?(f=0,d=P.ended===!0,t(d?"ended":"live"),d||m()):P.t==="exit"?(d=!0,t("ended")):P.t==="input-full"&&(t("busy"),window.clearTimeout(b),b=window.setTimeout(()=>{d||t("live")},2500))},B.onclose=$=>{if(h===B&&(h=null),!u){if($.code===4401)return t("signed-out");if($.code===4404)return t("gone");if(d)return t("ended");t($.code===4008?"behind":"offline"),f+=1,g=window.setTimeout(v,Math.min(8e3,250*2**Math.min(f,5)))}}},p=r.onData(_),E=new ResizeObserver(()=>m());E.observe(s.current);let A=window.visualViewport;return A?.addEventListener("resize",m),v(),r.focus(),()=>{u=!0,window.clearTimeout(g),window.clearTimeout(b),n.removeEventListener("change",o),E.disconnect(),A?.removeEventListener("resize",m),p.dispose(),h?.close(1e3),r.dispose()}},[e.id]),(0,U.jsx)("div",{className:"term-screen",ref:s})}function P8({sendRef:e}){let[t,i]=(0,Be.useState)(!1),s=(n,o)=>(0,U.jsx)(vt,{sm:!0,className:"term-key",label:n,onPointerDown:a=>{a.preventDefault(),e.current?.(o)}},n),r=n=>{e.current?.(String.fromCharCode(n.toUpperCase().charCodeAt(0)-64)),i(!1)};return(0,U.jsxs)("div",{className:"term-keys",role:"toolbar","aria-label":"Terminal keys",children:[s("Esc","\x1B"),s("Tab"," "),(0,U.jsx)(vt,{sm:!0,className:"term-key",label:"Ctrl","aria-pressed":t,onPointerDown:n=>{n.preventDefault(),i(o=>!o)}}),t?(0,U.jsx)(U.Fragment,{children:["c","d","r","l","z"].map(n=>(0,U.jsx)(vt,{sm:!0,className:"term-key",label:`^${n.toUpperCase()}`,onPointerDown:o=>{o.preventDefault(),r(n)}},n))}):(0,U.jsxs)(U.Fragment,{children:[s("↑","\x1B[A"),s("↓","\x1B[B"),s("←","\x1B[D"),s("→","\x1B[C"),s("/","/"),s("⏎","\r")]})]})}function q8({state:e,onStarted:t,onCancel:i}){let[s,r]=(0,Be.useState)(e.projects[0]?.path??""),[n,o]=(0,Be.useState)(e.programs[0]??"claude");if(e.projects.length===0)return(0,U.jsx)("div",{className:"term-form",children:(0,U.jsx)(Tu,{title:"No projects yet.",text:"Add a project in the console first, then start a terminal in it.",action:(0,U.jsx)($m,{sm:!0,href:"/projects",label:"Open Projects"})})});let a=e.projects.find(c=>c.path===s)?.name??"",l=async c=>{let h=await M2("/term/start",{repo:s,program:n,password:c??""});return h.ok&&h.id!==void 0?(t(h.id),null):h.error??"The terminal didn't start. Nothing changed."};return(0,U.jsxs)("section",{className:"term-form","aria-labelledby":"term-new-title","data-term-new":!0,children:[(0,U.jsx)("h2",{id:"term-new-title",className:"k-sr",children:"New terminal"}),(0,U.jsx)(Ux,{label:"Project",children:c=>(0,U.jsx)(qx,{id:c.id,wide:!0,value:s,onChange:h=>r(h.target.value),items:e.projects.map(h=>[h.path,h.name])})}),(0,U.jsxs)("div",{className:"k-field term-radios",children:[(0,U.jsx)("span",{className:"k-label",children:"Program"}),(0,U.jsx)($x,{name:"program",legend:"Program",current:n,onChange:c=>o(c),items:e.programs.map(c=>({value:c,label:Zo[c],text:D8[c]}))})]}),(0,U.jsxs)("p",{className:"term-terms",children:[Zo[n]," · ",a," · a fresh worktree on its own branch"]}),(0,U.jsxs)(Go,{children:[(0,U.jsx)(_2,{kind:"step-up",facts:E2,label:"Start terminal",terms:`${Zo[n]} in ${a}, a fresh worktree on its own branch.`,onApprove:l}),i!==null&&(0,U.jsx)(vt,{variant:"ghost",label:"Cancel",onClick:i})]}),(0,U.jsx)(Bl,{children:`${Nl("step-up",E2)} A terminal can do anything you can on this computer. Your default branch is never touched.`})]})}function I8({session:e,onDone:t}){let[i,s]=(0,Be.useState)(null),[r,n]=(0,Be.useState)(!1),[o,a]=(0,Be.useState)(null),l=e.endedAt===null,c=l?"close":"remove",h=async()=>{n(!0),a(null);let u=await M2(`/term/${e.id}/${c}`,{});if(n(!1),!u.ok){a(u.error??"That didn't work. Nothing changed.");return}s(null),await t()};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(vt,{variant:"ghost",sm:!0,label:l?"Close":"Remove","aria-haspopup":"dialog",onClick:u=>s(u.currentTarget),"data-term-end":c}),i!==null&&(0,U.jsxs)(Nu,{kind:"popover",title:l?"Close this terminal?":"Remove this terminal?",trigger:i,onClose:()=>{s(null),a(null)},children:[(0,U.jsx)("p",{className:"k-pop-terms",children:l?"Everything running in it stops. Its branch stays.":"Its worktree is removed. Its branch stays."}),o!==null&&(0,U.jsxs)("p",{className:"k-notice",role:"alert",children:[(0,U.jsx)(Ot,{name:"alert",small:!0}),(0,U.jsx)("span",{children:o})]}),(0,U.jsxs)(Go,{children:[(0,U.jsx)(vt,{variant:"danger",label:l?"Close terminal":"Remove terminal",busy:r?l?"Closing…":"Removing…":!1,onClick:()=>{h()}}),(0,U.jsx)(vt,{variant:"ghost",label:"Cancel","data-k-close":""})]})]})]})}function F8(){let[e,t]=(0,Be.useState)(null),[i,s]=(0,Be.useState)(C2),[r,n]=(0,Be.useState)(!1),[o,a]=(0,Be.useState)(C2===null),[l,c]=(0,Be.useState)("connecting"),h=(0,Be.useRef)(null),u=(0,Be.useCallback)(async()=>{let p=await H8();p!==null&&t(p)},[]);if((0,Be.useEffect)(()=>{u();let p=window.setInterval(()=>{u()},5e3);return()=>window.clearInterval(p)},[u]),(0,Be.useEffect)(()=>{e!==null&&(i!==null&&!e.sessions.some(p=>p.id===i)&&s(e.sessions[0]?.id??null),i===null&&e.sessions.length>0&&!r&&s(e.sessions[0].id))},[e,i,r]),(0,Be.useEffect)(()=>{let p=i===null?"/term":`/term/${i}`;location.pathname!==p&&history.replaceState(null,"",p)},[i]),(0,Be.useEffect)(()=>{l==="ended"&&u()},[l,u]),e===null)return(0,U.jsx)("div",{className:"term-app term-app--loading",children:(0,U.jsx)("p",{className:"k-note",children:"Loading…"})});let d=e.sessions.find(p=>p.id===i)??null,f=e.sessions.filter(p=>p.endedAt===null).length,g=p=>{s(p),n(!1),a(!1)},b=()=>{n(!0),a(!1)},T=r||!o&&d!==null,_=(0,U.jsxs)("nav",{className:"term-list","aria-label":"Terminals",children:[e.sessions.length===0?(0,U.jsx)("p",{className:"term-none",children:"No terminals yet."}):null,e.sessions.map(p=>(0,U.jsxs)("a",{href:`/term/${p.id}`,className:"term-item","aria-current":p.id===i&&!r?"true":void 0,onClick:E=>{E.preventDefault(),g(p.id)},children:[(0,U.jsxs)("span",{className:"term-item-t",children:[Zo[p.program]," · ",p.project]}),(0,U.jsxs)("span",{className:"term-item-m",children:[p.endedAt===null?(0,U.jsx)(Cu,{word:"Live",tone:"live"}):(0,U.jsx)(Cu,{word:"Ended"}),(0,U.jsx)("span",{className:"k-mono",children:p.branch})]})]},p.id))]}),m=(0,U.jsxs)("header",{className:"term-tb",children:[T?(0,U.jsx)(vt,{className:"k-phone-only",variant:"ghost",iconOnly:"back",label:"All terminals",onClick:()=>{n(!1),a(!0)}}):(0,U.jsx)("a",{className:"k-btn k-btn-ghost k-btn-icon k-phone-only",href:"/agents","aria-label":"Agents",title:"Agents",children:(0,U.jsx)(Ot,{name:"back"})}),(0,U.jsxs)("a",{className:"term-back k-desk-only",href:"/agents",children:[(0,U.jsx)(Ot,{name:"back",small:!0}),"Agents"]}),(0,U.jsx)("h1",{children:"Terminals"}),(0,U.jsxs)("span",{className:"term-ctx",children:[f," running · up to 8"]}),(0,U.jsx)("span",{className:"k-grow"}),e.available&&!r&&(0,U.jsx)(vt,{variant:"primary",sm:!0,lead:"plus",label:"New terminal",onClick:b})]}),v;return e.available?r||d===null?v=(0,U.jsx)(q8,{state:e,onCancel:d===null&&e.sessions.length===0?null:()=>n(!1),onStarted:p=>{n(!1),s(p),a(!1),u()}}):v=(0,U.jsxs)("section",{className:"term-pane","aria-label":`${Zo[d.program]} terminal`,children:[(0,U.jsxs)("header",{className:"term-ph",children:[(0,U.jsxs)("div",{children:[(0,U.jsxs)("b",{children:[Zo[d.program]," · ",d.project]}),(0,U.jsxs)("span",{className:"term-ph-m",children:[(0,U.jsx)("span",{className:"k-mono",children:d.branch})," · started ",new Date(d.startedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),(0,U.jsx)("span",{className:`term-link term-link--${l}`,role:"status",children:N8[l]}),(0,U.jsx)(I8,{session:d,onDone:u},d.id)]}),(0,U.jsx)(U8,{session:d,onLink:c,keys:p=>{h.current=p}},d.id),d.endedAt===null?(0,U.jsx)(P8,{sendRef:h}):(0,U.jsx)(Bl,{children:"Ended. Its branch stays; Remove takes it off this list."})]}):v=(0,U.jsx)("div",{className:"term-form",children:(0,U.jsx)(Tu,{title:"Terminals aren't available.",text:e.problem??"This install can't run terminals."})}),(0,U.jsxs)("div",{className:`term-app${T?" term-app--pane":""}`,"data-kit-page":!0,children:[m,(0,U.jsxs)("div",{className:"term-grid",children:[(0,U.jsx)("aside",{className:"term-side",children:_}),(0,U.jsx)("main",{className:"term-main",children:v})]})]})}Du();(0,A2.createRoot)(document.getElementById("so-term")).render((0,U.jsx)(F8,{}));