toolroll 0.9.94 → 0.9.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/dist/agent-fence.d.ts +6 -0
- package/dist/agent-fence.js +2 -2
- package/dist/assignment-status.d.ts +1 -1
- package/dist/assignment-ui.js +2 -0
- package/dist/attest.d.ts +3 -0
- package/dist/attest.js +10 -0
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +24 -24
- package/dist/browser-crew.js +2 -0
- package/dist/browser-workspace.d.ts +5 -0
- package/dist/build-review.js +2 -0
- package/dist/builder.d.ts +7 -2
- package/dist/builder.js +183 -79
- package/dist/card-catalog.d.ts +209 -0
- package/dist/card-catalog.js +133 -0
- package/dist/card-cli.d.ts +43 -0
- package/dist/card-cli.js +44 -0
- package/dist/card-render.d.ts +43 -0
- package/dist/card-render.js +260 -0
- package/dist/card-sources.d.ts +68 -0
- package/dist/card-sources.js +234 -0
- package/dist/chat-actions.d.ts +95 -8
- package/dist/chat-actions.js +449 -45
- package/dist/chat-approval.d.ts +13 -0
- package/dist/chat-approval.js +39 -9
- package/dist/chat-card-part.d.ts +11 -0
- package/dist/chat-card-part.js +18 -0
- package/dist/chat-card.d.ts +46 -0
- package/dist/chat-card.js +99 -0
- package/dist/chat-channel.d.ts +2 -0
- package/dist/chat-channel.js +26 -14
- package/dist/chat-controls.d.ts +4 -0
- package/dist/chat-controls.js +4 -0
- package/dist/chat-decide.d.ts +3 -14
- package/dist/chat-decide.js +43 -54
- package/dist/chat-delivery.js +13 -4
- package/dist/chat-flow.d.ts +0 -27
- package/dist/chat-flow.js +31 -2
- package/dist/chat-quiet.js +1 -1
- package/dist/chat-task-actions.d.ts +3 -2
- package/dist/chat-task-actions.js +19 -5
- package/dist/chat-terms.d.ts +14 -2
- package/dist/chat-terms.js +35 -0
- package/dist/check-failure.d.ts +2 -0
- package/dist/check-failure.js +34 -2
- package/dist/check-repair.d.ts +47 -0
- package/dist/check-repair.js +240 -0
- package/dist/claim.d.ts +6 -0
- package/dist/claim.js +13 -2
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.js +2 -0
- package/dist/cli.js +4 -0
- package/dist/coding-provider.d.ts +1 -1
- package/dist/coding-provider.js +9 -5
- package/dist/coding-workspace.d.ts +1 -1
- package/dist/coding-workspace.js +4 -4
- package/dist/contracts/chat-actions.d.ts +83 -0
- package/dist/contracts/chat-actions.js +18 -0
- package/dist/contracts/chat-card.d.ts +91 -0
- package/dist/contracts/chat-card.js +54 -0
- package/dist/contracts/chat-content.d.ts +191 -0
- package/dist/contracts/chat-content.js +4 -0
- package/dist/contracts/console-api.d.ts +2 -0
- package/dist/contracts/console-api.js +2 -0
- package/dist/contracts/flow-propose.d.ts +8 -1
- package/dist/contracts/flow-propose.js +3 -1
- package/dist/contracts/flow-send.d.ts +126 -0
- package/dist/contracts/flow-send.js +3 -0
- package/dist/contracts/lead-tools.d.ts +173 -0
- package/dist/contracts/lead-tools.js +15 -0
- package/dist/contracts/store-json.d.ts +16 -0
- package/dist/discord-chat.js +14 -0
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +7 -1
- package/dist/dispose.d.ts +19 -0
- package/dist/dispose.js +47 -7
- package/dist/eval-oracle.js +4 -1
- package/dist/evidence-pair.d.ts +53 -0
- package/dist/evidence-pair.js +128 -0
- package/dist/exhaustion.d.ts +17 -4
- package/dist/exhaustion.js +44 -4
- package/dist/export.js +1 -1
- package/dist/failing-first.d.ts +31 -0
- package/dist/failing-first.js +44 -0
- package/dist/fallback-schema.d.ts +8 -0
- package/dist/fallback-schema.js +40 -0
- package/dist/fallback.d.ts +138 -0
- package/dist/fallback.js +605 -0
- package/dist/findings.d.ts +224 -0
- package/dist/findings.js +449 -0
- package/dist/fleet-schema.d.ts +17 -0
- package/dist/fleet-schema.js +135 -0
- package/dist/flow-browser.js +2 -2
- package/dist/flow-code.d.ts +2 -2
- package/dist/flow-code.js +9 -5
- package/dist/flow-result-card.d.ts +22 -0
- package/dist/flow-result-card.js +55 -0
- package/dist/flow-send.js +12 -9
- package/dist/flow-steps.js +1 -1
- package/dist/flow-triggers.js +1 -1
- package/dist/flow-unattended.d.ts +26 -0
- package/dist/flow-unattended.js +12 -3
- package/dist/flows-ui.js +10 -2
- package/dist/follow-through-brief.d.ts +12 -0
- package/dist/follow-through-brief.js +31 -0
- package/dist/follow-through-cli.d.ts +23 -0
- package/dist/follow-through-cli.js +153 -0
- package/dist/git-incident.d.ts +16 -0
- package/dist/git-incident.js +69 -6
- package/dist/handover-note.d.ts +33 -0
- package/dist/handover-note.js +106 -0
- package/dist/invoke.d.ts +20 -1
- package/dist/invoke.js +108 -44
- package/dist/lead-cli.js +26 -24
- package/dist/lead-contract.js +1 -0
- package/dist/lead-doors.d.ts +4 -0
- package/dist/lead-doors.js +2 -2
- package/dist/lead-progress.js +2 -0
- package/dist/lead-tools.js +111 -32
- package/dist/lead.js +1 -1
- package/dist/local-owner.js +5 -0
- package/dist/modes.d.ts +6 -6
- package/dist/modes.js +3 -1
- package/dist/needs-you.d.ts +5 -2
- package/dist/needs-you.js +14 -2
- package/dist/operate-remote-arguments.js +1 -0
- package/dist/operate-remote.js +1 -1
- package/dist/operate.d.ts +1 -1
- package/dist/operate.js +165 -14
- package/dist/plan-login.d.ts +14 -0
- package/dist/plan-login.js +58 -0
- package/dist/planner.d.ts +1 -1
- package/dist/planner.js +2 -1
- package/dist/project-delete-ui.d.ts +12 -0
- package/dist/project-delete-ui.js +18 -1
- package/dist/project-delete.js +6 -0
- package/dist/project-knowledge.d.ts +6 -6
- package/dist/project-tools.d.ts +4 -4
- package/dist/project-tools.js +23 -7
- package/dist/protected-storage-look.d.ts +1 -0
- package/dist/protected-storage-look.js +13 -0
- package/dist/protected-storage.d.ts +70 -39
- package/dist/protected-storage.js +196 -147
- package/dist/provider-capture.d.ts +34 -0
- package/dist/provider-capture.js +53 -0
- package/dist/release-carry.js +10 -1
- package/dist/release.js +9 -1
- package/dist/scope.d.ts +22 -3
- package/dist/scope.js +71 -20
- package/dist/scout.d.ts +1 -1
- package/dist/scout.js +2 -1
- package/dist/serve.js +2 -0
- package/dist/server/chat.js +2 -2
- package/dist/server/console.css +50 -0
- package/dist/server/render-chat.js +14 -1
- package/dist/server/render-follow-through.d.ts +11 -0
- package/dist/server/render-follow-through.js +68 -0
- package/dist/server/render-results.js +1 -1
- package/dist/server/render-tasks.d.ts +3 -0
- package/dist/server/render-tasks.js +24 -5
- package/dist/server/route-table.js +3 -0
- package/dist/server/settings.js +37 -12
- package/dist/server/task-views.js +5 -0
- package/dist/server/tasks.js +76 -0
- package/dist/settings-groups-ui.d.ts +1 -0
- package/dist/settings-groups-ui.js +3 -1
- package/dist/settings-kit.js +3 -2
- package/dist/settings-proofs.js +3 -1
- package/dist/setup-guide.d.ts +2 -2
- package/dist/slack-chat.js +14 -1
- package/dist/steer-mailbox.d.ts +8 -1
- package/dist/steer-mailbox.js +164 -6
- package/dist/store.d.ts +11 -4
- package/dist/store.js +93 -30
- package/dist/surface.js +24 -4
- package/dist/task-control.d.ts +2 -1
- package/dist/task-status.js +5 -0
- package/dist/teardown-git.d.ts +2 -0
- package/dist/teardown-git.js +75 -19
- package/dist/telegram-lead.js +23 -6
- package/dist/telegram.js +12 -1
- package/dist/toolroll-update.js +2 -0
- package/dist/work-index.js +22 -7
- package/dist/work-summary.d.ts +1 -1
- package/dist/work-summary.js +5 -2
- package/dist/workspace-ui.d.ts +3 -1
- package/dist/workspace-ui.js +10 -1
- package/dist/worktree.js +23 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 0.9.96 — 2026-11-08
|
|
4
|
+
|
|
5
|
+
- **Tables in Telegram are readable on a phone.** Each row is a short list item with its name in full, and anything shared by every row is said once at the top, instead of a squeezed grid of cut-off words.
|
|
6
|
+
- **No more false git alerts while you use Claude Code beside Toolroll.** A Claude Code plugin briefly links a checkout's index while it looks at changes; Toolroll counted that as tampering in other checkouts of the same repository and stopped releases and builds. Real tampering is still caught.
|
|
7
|
+
|
|
8
|
+
## 0.9.95 — 2026-11-07
|
|
9
|
+
|
|
10
|
+
- **Cards in chat, and approving from chat.** Slack, Discord and Telegram show tasks, plans and results as proper cards. Anything that needs approval can be approved there by a person with authority, the same as on the web; long terms link to the review page.
|
|
11
|
+
- **Results keep moving after an agent finishes.** Send a finding to the task that owns the code: the running build gets it, or the next attempt. The owner must accept it, saying what changed, or reject it with a reason that names a file. Reading it closes nothing, and after two rounds it comes to you.
|
|
12
|
+
- **A failed check gets one owner and a limited repair.** The same failure on the same commit never starts a second repair. Sign a mode with repairs on and it runs by itself, up to its limit, inside the plan you approved. Without that, the failure waits for you to start a repair.
|
|
13
|
+
- **Handover note.** Every task has a note built from Toolroll's records: current commit, decisions, rejected approaches, open findings, checks and the next action. A fresh agent starts from it. Read it on the task page or with `toolroll task handover`.
|
|
14
|
+
- **Before and after.** Save a failing result and rerun the same check on the latest commit. If the code moves on, the evidence says it is out of date. A bug fix can also ask for a failing test first.
|
|
15
|
+
- **What a provider said when an attempt failed is saved** (`toolroll captures`), so a real used-up plan can be recognised later. Nothing routes on it.
|
|
16
|
+
- **Pull requests that can affect upgrades now run the upgrade test in CI**, so a broken upgrade shows up before a release.
|
|
17
|
+
- **Fallback agents.** A project can name up to three agents to switch to when the first one runs out of its plan. A plan entry is used only after Toolroll proves that login live; paid entries need your permission in the mode you sign.
|
|
18
|
+
- **Clearer storage permission.** When macOS needs Full Disk Access before a build can start, Toolroll names the program that needs it, holds the work, and shows it under Needs you with Try again.
|
|
19
|
+
- **Git incident alerts are accurate and quiet.** False alerts while Toolroll tidied old checkouts are gone. A real one names what Toolroll was doing, that checkout is left alone for a day, and alerts are limited to a few per checkout per day.
|
|
4
20
|
|
|
5
21
|
## 0.9.94 — 2026-11-07
|
|
6
22
|
|
package/dist/agent-fence.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LoopbackMode } from "./egress.js";
|
|
2
2
|
import type { ExecutionProfile } from "./scope.js";
|
|
3
3
|
import { type SrtTerms } from "./sandbox-runtime.js";
|
|
4
|
+
import { type ProtectedStorage } from "./protected-storage.js";
|
|
4
5
|
/** How a launch was fenced, as recorded on the run and said on the task. */
|
|
5
6
|
export type FenceMethod = "codex-profile" | "macos-sandbox" | "linux-bubblewrap" | "claude-rules" | "none";
|
|
6
7
|
/** Only the plane's recorded repository may supply an own-Git exemption. */
|
|
@@ -58,6 +59,7 @@ export declare function taskBoundary(options: {
|
|
|
58
59
|
home?: string;
|
|
59
60
|
binding?: WorktreeBinding | null;
|
|
60
61
|
policy?: FencePolicy;
|
|
62
|
+
storage?: ProtectedStorage;
|
|
61
63
|
}): TaskBoundary;
|
|
62
64
|
/** Where launches keep their private folders: `root` (the system temp folder) and, on a Mac, `also` the short shared one
|
|
63
65
|
* a check's launch folder is made in (/private/tmp, so its unix sockets fit); `own` is this launch's. */
|
|
@@ -361,6 +363,10 @@ export type FenceKind = "build" | "command" | "check" | "flow" | "tool-server";
|
|
|
361
363
|
* with no checkout), so no caller forgets one; every path comes from Toolroll's own records, never from the checkout.
|
|
362
364
|
*/
|
|
363
365
|
export type FenceContext = {
|
|
366
|
+
/** This launch's storage check, awaited before the fence is made (protected-storage.ts prepareProtectedStorage). Every
|
|
367
|
+
* launch road passes it (an architecture test holds them to it); without one the check runs right here, which only a
|
|
368
|
+
* test does. */
|
|
369
|
+
storage?: ProtectedStorage;
|
|
364
370
|
/** One exact file read back inside the fence (a build's code map), or null. */
|
|
365
371
|
exactFile?: string | null;
|
|
366
372
|
databaseFile: string | null;
|
package/dist/agent-fence.js
CHANGED
|
@@ -306,7 +306,7 @@ export function taskBoundary(options) {
|
|
|
306
306
|
// Policy v2 (docs/plans/sandbox-parity.md §1.2): the home folder, the repositories beside this one and the project's
|
|
307
307
|
// primary checkout are read as Anthropic's sandbox runtime reads them; only writes to the primary checkout stay denied.
|
|
308
308
|
// Protected storage by name, under both policies (protected-storage.ts): never part of the v1-only home configuration.
|
|
309
|
-
const storage = protectedStorageNames(home);
|
|
309
|
+
const storage = options.storage?.names ?? protectedStorageNames(home);
|
|
310
310
|
if ((options.policy ?? 1) === 2)
|
|
311
311
|
return v2Boundary(worktree, main, gitdir, storage);
|
|
312
312
|
const shell = new Set(present(HOME_CONFIGURATION.filter(name => !own.has(name))));
|
|
@@ -1173,7 +1173,7 @@ export function fenceFor(kind, ctx) {
|
|
|
1173
1173
|
const home = ctx.home === undefined ? {} : { home: ctx.home };
|
|
1174
1174
|
// The project's read denies join the fence by name, there or not (the runtime denies a path that isn't there yet).
|
|
1175
1175
|
// Protected storage, resolved once for this launch, from the plane's own environment (protected-storage.ts).
|
|
1176
|
-
const storage = protectedStorageDenies(ctx.home ?? homedir());
|
|
1176
|
+
const storage = ctx.storage?.denies ?? protectedStorageDenies(ctx.home ?? homedir());
|
|
1177
1177
|
const fence = agentFence({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, ...home, boundary: ctx.boundary, binding: ctx.binding, runFolders: ctx.runFolders, extra: [...ctx.extra ?? [], ...ctx.readDeny ?? []], protectedStorage: storage });
|
|
1178
1178
|
const found = fenceGrants({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, boundary: ctx.boundary, runFolders: ctx.runFolders, linked: ctx.linked ?? null, binding: ctx.binding, ...home, poolRoots: ctx.poolRoots });
|
|
1179
1179
|
// Toolroll's own install, the sandbox runtime's package and the Node running them, never written by anything it
|
|
@@ -23,7 +23,7 @@ export declare function assignmentStatusBrief(assignment: AssignmentSnapshot): {
|
|
|
23
23
|
} | null;
|
|
24
24
|
runId: number | null;
|
|
25
25
|
primaryAction: {
|
|
26
|
-
code: "answer-agent" | "inspect-decisions" | "inspect-run" | "inspect-stop" | "inspect-task" | "open-pr" | "recheck-stopped" | "reconcile-run" | "sign-in" | import("./dispatch.js").DispatchAction;
|
|
26
|
+
code: "answer-agent" | "inspect-decisions" | "inspect-findings" | "inspect-run" | "inspect-stop" | "inspect-task" | "open-pr" | "recheck-stopped" | "reconcile-run" | "sign-in" | import("./dispatch.js").DispatchAction;
|
|
27
27
|
label: string;
|
|
28
28
|
target: import("./work-summary.js").WorkTarget;
|
|
29
29
|
} | null;
|
package/dist/assignment-ui.js
CHANGED
|
@@ -24,6 +24,8 @@ export function assignmentActionHref(assignment) {
|
|
|
24
24
|
if (action === null)
|
|
25
25
|
return null;
|
|
26
26
|
const { taskId, runId, decisionId } = action.target;
|
|
27
|
+
if (action.code === 'inspect-findings')
|
|
28
|
+
return `/t/${encodeURIComponent(taskId)}#findings`;
|
|
27
29
|
if (decisionId !== null)
|
|
28
30
|
return `/d/${decisionId}`;
|
|
29
31
|
if (action.code === 'inspect-decisions')
|
package/dist/attest.d.ts
CHANGED
|
@@ -54,3 +54,6 @@ export declare function resetAttestationCache(): void;
|
|
|
54
54
|
* throw, never a silent pass. Returns null for tier-1 providers.
|
|
55
55
|
*/
|
|
56
56
|
export declare function attestProvider(provider: ProviderId, binary: string, probe?: VersionProbe): Promise<AttestOutcome | null>;
|
|
57
|
+
/** What the installed CLI says its version is, with no range attached: a recogniser's own check (exhaustion.ts), asked of
|
|
58
|
+
* the exact executable PATH resolves on this runner, only when a terminal already reads as a plan limit. Null: no answer. */
|
|
59
|
+
export declare function reportedVersion(binary: string, probe?: VersionProbe): Promise<string | null>;
|
package/dist/attest.js
CHANGED
|
@@ -158,3 +158,13 @@ export async function attestProvider(provider, binary, probe = defaultProbe) {
|
|
|
158
158
|
}
|
|
159
159
|
return { ok: true, executable: resolved, version };
|
|
160
160
|
}
|
|
161
|
+
/** What the installed CLI says its version is, with no range attached: a recogniser's own check (exhaustion.ts), asked of
|
|
162
|
+
* the exact executable PATH resolves on this runner, only when a terminal already reads as a plan limit. Null: no answer. */
|
|
163
|
+
export async function reportedVersion(binary, probe = defaultProbe) {
|
|
164
|
+
const resolved = resolveExecutable(binary);
|
|
165
|
+
if (resolved === null)
|
|
166
|
+
return null;
|
|
167
|
+
const answer = await probe(resolved, ["--version"], PROBE_TIMEOUT_MS);
|
|
168
|
+
const raw = answer.stdout.trim().slice(0, 100);
|
|
169
|
+
return answer.code !== 0 || raw === "" ? null : raw;
|
|
170
|
+
}
|
package/dist/browser/terminal.js
CHANGED
|
@@ -151,7 +151,7 @@ out vec4 outColor;
|
|
|
151
151
|
|
|
152
152
|
void main() {
|
|
153
153
|
outColor = v_color;
|
|
154
|
-
}`,Gs=8,gm=Gs*Float32Array.BYTES_PER_ELEMENT,KM=20*Gs,_x=class{constructor(){this.attributes=new Float32Array(KM),this.count=0}},Vs=0,vx=0,yx=0,bx=0,wx=0,Sx=0,xx=0,WM=class extends bi{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new _x,this._verticesCursor=new _x;let r=this._gl;this._program=Ze(l2(r,FM,$M)),this._register(At(()=>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(At(()=>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(At(()=>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(At(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,gm,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,gm,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,gm,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,a2),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=DM(e.attributes,this._terminal.rows*this._terminal.cols*Gs)),vx=r*this._dimensions.device.cell.width,yx=o*this._dimensions.device.cell.height,bx=(Vs>>24&255)/255,wx=(Vs>>16&255)/255,Sx=(Vs>>8&255)/255,xx=1,this._addRectangle(e.attributes,t,vx,yx,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,bx,wx,Sx,xx)}_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])}},VM=class extends bi{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(At(()=>{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=n2(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=jx,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}`}},jM=class extends VM{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&&MM(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,Lm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new xe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new xe,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}};Lm.INSTANCE=new Lm;var c2=Lm;function GM(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var $D=c2.INSTANCE.onDidChangeZoomLevel,KD=c2.INSTANCE.onDidChangeFullscreen,Vo=typeof navigator=="object"?navigator.userAgent:"",WD=Vo.indexOf("Firefox")>=0,mm=Vo.indexOf("AppleWebKit")>=0,YM=Vo.indexOf("Chrome")>=0,XM=!YM&&Vo.indexOf("Safari")>=0,VD=Vo.indexOf("Electron/")>=0,jD=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,GM(Vi,e,({matches:i})=>{mu&&t.matches||(mu=i)})}function ZM(){return mu}var $o="en",Dm=!1,Nm=!1,_u=!1,QM=!1,h2=!1,u2=!1,JM=!1,eR=!1,tR=!1,iR=!1,hu,vu=$o,kx=$o,sR,js,Zs=globalThis,yi;typeof Zs.vscode<"u"&&typeof Zs.vscode.process<"u"?yi=Zs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(yi=process);var d2=typeof yi?.versions?.electron=="string",rR=d2&&yi?.type==="renderer";if(typeof yi=="object"){Dm=yi.platform==="win32",Nm=yi.platform==="darwin",_u=yi.platform==="linux",QM=_u&&!!yi.env.SNAP&&!!yi.env.SNAP_REVISION,JM=d2,tR=!!yi.env.CI||!!yi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hu=$o,vu=$o;let e=yi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);hu=t.userLocale,kx=t.osLocale,vu=t.resolvedLanguage||$o,sR=t.languagePack?.translationsConfigFile}catch{}h2=!0}else typeof navigator=="object"&&!rR?(js=navigator.userAgent,Dm=js.indexOf("Windows")>=0,Nm=js.indexOf("Macintosh")>=0,eR=(js.indexOf("Macintosh")>=0||js.indexOf("iPad")>=0||js.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_u=js.indexOf("Linux")>=0,iR=js?.indexOf("Mobi")>=0,u2=!0,vu=globalThis._VSCODE_NLS_LANGUAGE||$o,hu=navigator.language.toLowerCase(),kx=hu):console.error("Unable to resolve platform.");var _m=0;Nm?_m=1:Dm?_m=3:_u&&(_m=2);var vm=h2,nR=u2&&typeof Zs.importScripts=="function",GD=nR?Zs.origin:void 0,_s=js,Ir=vu,oR;(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})(oR||={});var aR=typeof Zs.postMessage=="function"&&!Zs.importScripts,lR=(()=>{if(aR){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)})(),cR=!!(_s&&_s.indexOf("Chrome")>=0),YD=!!(_s&&_s.indexOf("Firefox")>=0),XD=!!(!cR&&_s&&_s.indexOf("Safari")>=0),ZD=!!(_s&&_s.indexOf("Edg/")>=0),QD=!!(_s&&_s.indexOf("Android")>=0),Fr=typeof navigator=="object"?navigator:{},JD={clipboard:{writeText:vm||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Fr&&Fr.clipboard&&Fr.clipboard.writeText),readText:vm||!!(Fr&&Fr.clipboard&&Fr.clipboard.readText)},keyboard:vm||ZM()?0:Fr.keyboard||XM?1:2,touch:"ontouchstart"in Vi||Fr.maxTouchPoints>0,pointerEvents:Vi.PointerEvent&&("ontouchstart"in Vi||navigator.maxTouchPoints>0)},Um=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}},ym=new Um,Cx=new Um,Ex=new Um,eN=new Array(230),hR;(e=>{function t(a){return ym.keyCodeToStr(a)}e.toString=t;function i(a){return ym.strToKeyCode(a)}e.fromString=i;function s(a){return Cx.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Ex.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Cx.strToKeyCode(a)||Ex.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 ym.keyCodeToStr(a)}e.toElectronAccelerator=o})(hR||={});var f2=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),uR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof dR?!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:f2})})(uR||={});var dR=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?f2:(this._emitter||(this._emitter=new xe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var fR,bm;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?bm=(e,t)=>{lR(()=>{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)}}}:bm=(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))}}},fR=e=>bm(globalThis,e)})();var pR;(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})(pR||={});var Tx=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 xe,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())}};Tx.EMPTY=Tx.fromArray([]);function gR(e){return 55296<=e&&e<=56319}function Ax(e){return 56320<=e&&e<=57343}function mR(e,t){return(e-55296<<10)+(t-56320)+65536}function _R(e){return Pm(e,0)}function Pm(e,t){switch(typeof e){case"object":return e===null?Xs(349,t):Array.isArray(e)?yR(e,t):bR(e,t);case"string":return p2(e,t);case"boolean":return vR(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 vR(e,t){return Xs(e?433:863,t)}function p2(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 yR(e,t){return t=Xs(104579,t),e.reduce((i,s)=>Pm(s,i),t)}function bR(e,t){return t=Xs(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=p2(s,i),Pm(e[s],i)),t)}function wm(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function Mx(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function wR(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(""):wR((e>>>0).toString(16),t/4)}var SR=class g2{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(gR(o))if(a+1<i){let c=t.charCodeAt(a+1);Ax(c)?(a++,l=mR(o,c)):l=65533}else{n=o;break}else Ax(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,Mx(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Mx(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=g2._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,wm(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=wm(s,5)+l+a+c+t.getUint32(u*4,!1)&4294967295,a=o,o=n,n=wm(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}};SR._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:tN,getWindow:xR,getDocument:iN,getWindows:sN,getWindowsCount:rN,getWindowId:Rx,getWindowById:nN,hasWindow:oN,onDidRegisterWindow:aN,onWillUnregisterWindow:lN,onDidUnregisterWindow:cN}=(function(){let e=new Map,t={window:Vi,disposables:new Ko};e.set(Vi.vscodeWindowId,t);let i=new xe,s=new xe,r=new xe;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 bi.None;let a=new Ko,l={window:o,disposables:a.add(new Ko)};return e.set(o.vscodeWindowId,l),a.add(At(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(Bm(o,ER.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 xR(o).document}}})(),kR=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 Bm(e,t,i,s){return new kR(e,t,i,s)}var CR,Lx,Sm=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(Sm.sort),o.shift().execute();s.set(n,!1)};Lx=(n,o,a=0)=>{let l=Rx(n),c=new Sm(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},CR=(n,o,a)=>{let l=Rx(n);if(s.get(l)){let c=new Sm(o,a),h=t.get(l);return h||(h=[],t.set(l,h)),h.push(c),c}else return Lx(n,o,a)}})();var Dx=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}};Dx.None=new Dx(0,0);var hN=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=_R(i),n=s.get(r);if(n)n.users+=1;else{let o=new xe,a=new MutationObserver(c=>o.fire(c));a.observe(e,i);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(At(()=>{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}},ER={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:mm?"webkitAnimationStart":"animationstart",ANIMATION_END:mm?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:mm?"webkitAnimationIteration":"animationiteration"},TR=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function m2(e,t,i,...s){let r=TR.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 AR(e,t,...i){return m2("http://www.w3.org/1999/xhtml",e,t,...i)}AR.SVG=function(e,t,...i){return m2("http://www.w3.org/2000/svg",e,t,...i)};var MR=class extends bi{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 xl,this._charAtlasDisposable=this._register(new xl),this._observerDisposable=this._register(new xl),this._model=new IM,this._workCell=new gx,this._workCell2=new gx,this._rectangleRenderer=this._register(new xl),this._glyphRenderer=this._register(new xl),this._onChangeTextureAtlas=this._register(new xe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new xe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new xe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new xe),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new xe),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 iM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new jM(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=eM(),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(Bm(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(Bm(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,fx(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=px(this._canvas,this._coreBrowserService.window,(h,u)=>this._setCanvasDevicePixelDimensions(h,u)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=px(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(At(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),fx(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 WM(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new HM(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=n2(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=Fx(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 RM(()=>{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=Nx(e,i.rows-1,0),t=Nx(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),K=-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 RR(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},K=B+s.getWidth()-1),v>=B&&v<=K&&(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+pm]===this._cellColorResolver.result.ext)&&(P=!0,b.length>1&&(T|=qM),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+pm]=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,jA,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+pm]=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})}},RR=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 Nx(e,t,i=0){return Math.max(Math.min(e,t),i)}var Bx="di$target",Ox="di$dependencies",xm=new Map;function vs(e){if(xm.has(e))return xm.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");LR(t,i,r)};return t._id=e,xm.set(e,t),t}function LR(e,t,i){t[Bx]===t?t[Ox].push({id:e,index:i}):(t[Ox]=[{id:e,index:i}],t[Bx]=t)}var uN=vs("BufferService"),dN=vs("CoreMouseService"),fN=vs("CoreService"),pN=vs("CharsetService"),gN=vs("InstantiationService"),mN=vs("LogService"),DR=vs("OptionsService"),_N=vs("OscLinkService"),vN=vs("UnicodeService"),yN=vs("DecorationService"),NR={trace:0,debug:1,info:2,warn:3,error:4,off:5},BR="xterm.js: ",zx=class extends bi{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),_2=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=NR[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?"":BR)+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)}};zx=TA([AA(0,DR)],zx);var _2;function OR(e){_2=e}var v2=class extends bi{constructor(e){if(Wx&&VA()<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 xe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new xe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new xe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new xe),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;OR(h),this._renderer=this._register(new MR(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(At(()=>{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 w2=Symbol("html"),Dl=class{#e;constructor(t,i){if(t!==w2)throw new TypeError("Html is made by html`…`");this.#e=i}static markupOf(t){return t.#e}toString(){if(y2)throw new Error("Html coerced to a string: interpolate it with html`…` or hand it to a sink");return this.#e}toJSON(){if(y2)throw new Error("Html serialized as JSON: convert it with htmlString() first");return this.#e}},y2=typeof process<"u"&&process.env.VITEST!==void 0,zR=e=>new Dl(w2,e);var HR={"&":"&","<":"<",">":">",'"':""","'":"'"},UR=e=>e.replace(/[&<>"']/g,t=>HR[t]);function S2(e){if(e==null||typeof e=="boolean")return"";if(e instanceof Dl)return Dl.markupOf(e);if(Array.isArray(e))return e.map(S2).join("");if(typeof e=="string")return UR(e);if(typeof e=="number"||typeof e=="bigint")return String(e);throw new TypeError(`html: cannot interpolate ${typeof e}`)}var b2=new WeakSet,PR=/<form\b[^>]*\bmethod\s*=\s*["']?post\b/i,qR=/\bname\s*=\s*["']?csrf\b/i;function IR(e){if(b2.has(e))return;let t=e.join("\0");if(PR.test(t))throw new Error("html: write POST forms with postForm, which adds the CSRF field");if(qR.test(t))throw new Error("html: postForm adds the CSRF field; don't write one");b2.add(e)}function jo(e,...t){IR(e);let i=e[0];for(let s=0;s<t.length;s++)i+=S2(t[s])+e[s+1];return zR(i)}var G=(e,t,i)=>({never:e,pattern:new RegExp(`(?<![\\w-])(?:${t})(?![\\w-])`,"i"),say:i}),x2=[G("scope","scopes?|scoped","plan"),G("contract","contracts?","plan"),G("signs","signs|signed(?!\\s+(?:in|out|into)\\b)","Approved by …"),G("sealed","seal|seals|sealed|sealing","approved"),G("binds","binds?","approved"),G("digest","digests?","(the plan version, in Details)"),G("worker","workers?","builder"),G("runner","runners?","builder"),G("daemon","daemons?","builder"),G("background service","background service","builder"),G("operator","operators?|instance operator","approver, or owner"),G("coordinator","coordinators?","your lead"),G("mate","mate","your lead"),G("scout","scouts?|scouting|scouted","research"),G("criterion","criterion|criteria","requirement"),G("evidence","evidence","requirement, or the saved files"),G("proof","proofs?","requirement"),G("verdict","verdicts?","requirement"),G("caveat","caveats?","requirement"),G("mark complete","mark(?:ed|s|ing)?\\s+(?:it\\s+|this\\s+|that\\s+|them\\s+|the\\s+result\\s+)?complete","Accept"),G("Accept and finish","accept\\s+and\\s+finish","Accept"),G("Revise","revise","Send back, or Request changes"),G("re-file","re-?file[ds]?|re-?filing","Send back, or Request changes"),G("Draft a repair task","draft\\s+a\\s+repair\\s+task","Send back"),G("put away","put(?:s|ting)?\\s+(?:it\\s+|them\\s+|tasks\\s+|old\\s+tasks\\s+)?away","Archive"),G("tidy","tidy|tidied|tidying","Archive"),G("run #N","(?:run|attempt|result)\\s+#?\\d+","build #N"),G("reconcile","reconcile[ds]?|reconciling|reconciliation","Waiting: Toolroll is …"),G("requeue","requeue[ds]?|requeuing","Waiting: Toolroll is …"),G("claim","claim|claimed","Waiting: Toolroll is …"),G("lease","leases?|leased","Waiting: Toolroll is …"),G("custody","custody","Waiting: Toolroll is …"),G("incident","incidents?","Waiting: Toolroll is …"),G("plane","plane","Toolroll"),G("fence","fences?|fenced","Waiting: Toolroll is …"),G("attested","attest|attested|attestation","Waiting: Toolroll is …"),G("receipt","receipts?","Waiting: Toolroll is …"),G("regate","regate[ds]?","Run checks"),G("carried","carried|carry|carries","Waiting: Toolroll is …"),G("incarnation","incarnations?","Waiting: Toolroll is …"),G("admission","admission","Waiting: Toolroll is …"),G("quiescence","quiescen(?:ce|t)","Waiting: Toolroll is …"),G("witness","witness(?:es|ed)?","Waiting: Toolroll is …"),G("unproven","unproven","Waiting: Toolroll is …"),G("version hex","(?=[0-9a-f]*\\d)(?=[0-9a-f]*[a-f])[0-9a-f]{12,64}","(the plan version, in Details)")],FR=x2.map(e=>e.never);var k2={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"},"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"},"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 vB=Object.fromEntries(Object.entries(k2).flatMap(([e,t])=>t.need===void 0?[]:[[e,t.need]]));var KR="The check result couldn't be read.",RB=`${KR} Run checks on it, or open the result to see why.`;var LB={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 qm(e,t){return e==="way-in"?"password":t.automatic===!0?"automatic":e==="none"||t.passwordless||e==="standard"&&t.remembered?"click":"password"}function C2(e,t){let i=qm(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}],xu={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")]};var M2=U(wi(),1);var Ne=(...e)=>e.filter(Boolean).join(" ");var R2=U(F(),1);function Vt({name:e,small:t=!1}){return(0,R2.jsx)("svg",{className:Ne("k-i",t&&"k-i-sm"),viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:xu[e].map((i,s)=>(0,M2.createElement)(i[0],{key:s,...i[1]}))})}var jt=U(F(),1);function Mt({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:Ne("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)(Vt,{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)(Vt,{name:s,small:!0}),r]})})})}function Im({variant:e="outline",sm:t,label:i,lead:s,className:r,...n}){return(0,jt.jsx)("a",{className:Ne("k-btn",`k-btn-${e}`,t&&"k-btn-sm",r),...n,children:(0,jt.jsxs)("span",{className:"k-face",children:[s&&(0,jt.jsx)(Vt,{name:s,small:!0}),i]})})}var L2=U(F(),1);function Fm({word:e,tone:t="",dot:i=!0}){return(0,L2.jsx)("span",{className:Ne("k-chip",t,!i&&"nodot"),children:e})}var jR=U(F(),1);var D2=U(F(),1);var N2=U(F(),1);var B2=U(wi(),1);var Ln=U(F(),1);function O2({label:e,hint:t,error:i,children:s}){let r=(0,B2.useId)(),n=Ne(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 z2=({className:e,...t})=>(0,Ln.jsx)("input",{className:Ne("k-input",e),...t});var Cu=U(F(),1);function H2({items:e,sm:t,wide:i,className:s,...r}){return(0,Cu.jsx)("span",{className:Ne("k-selw",t&&"sm",i&&"wide",s),children:(0,Cu.jsx)("select",{className:"k-sel",...r,children:e.map(n=>{let[o,a]=typeof n=="string"?[n,n]:n;return(0,Cu.jsx)("option",{value:o,children:a},o)})})})}var U2=U(F(),1);var P2=U(F(),1);var Qs=U(F(),1);function q2({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 I2=U(F(),1),Go=({children:e})=>(0,I2.jsx)("div",{className:"k-acts",children:e});var GR=U(wi(),1),F2=U(F(),1);var Yo=U(F(),1),$m=({children:e})=>(0,Yo.jsxs)("p",{className:"k-notice",role:"alert",children:[(0,Yo.jsx)(Vt,{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=U(F(),1);function Eu({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 $2=U(F(),1);var Km=U(F(),1);var Wm=U(F(),1);var Vm=U(F(),1);var jr=U(wi(),1),dk=U(Yu(),1);var YR="toolroll.key",XR="x-toolroll-key",ZR=/^[0-9a-f]{64}$/;function K2(){try{let e=globalThis.localStorage?.getItem(YR)??null;if(e===null)return null;let t=JSON.parse(e),i=typeof t=="object"&&t!==null?t.key:null;return typeof i=="string"&&ZR.test(i)?i:null}catch{return null}}function Tu(e){let t=K2();return t===null?e:{...e,[XR]:t}}function W2(){let e=K2();return e===null?["toolroll"]:["toolroll",`toolroll.key.${e}`]}var ys="form.k-sform",Hl=e=>HTMLFormElement.prototype.getAttribute.call(e,"id")??"",QR=e=>Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements").get.call(e),V2="http://www.w3.org/2000/svg",Js=e=>e.querySelector("[data-k-proof]"),bs=e=>e.querySelector("[data-k-save]"),Z2=e=>new Set(Array.from(Js(e)?.querySelectorAll("input[name]")??[]).map(t=>t.name));function Mu(e,t=null){let i=Z2(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 Qm(e){let t=new Map;for(let[i,s]of e)t.set(i,[...t.get(i)??[],s]);return t}function Q2(e){let t=Z2(e),i=[];for(let s of Array.from(QR(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 J2(e,t){return e.querySelector(`[name="${CSS.escape(t)}"]`)}function JR(e,t){let i=J2(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 e8(e,t,i){let s=J2(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,gm=Gs*Float32Array.BYTES_PER_ELEMENT,KM=20*Gs,_x=class{constructor(){this.attributes=new Float32Array(KM),this.count=0}},Vs=0,vx=0,yx=0,bx=0,wx=0,Sx=0,xx=0,WM=class extends bi{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new _x,this._verticesCursor=new _x;let r=this._gl;this._program=Ze(l2(r,FM,$M)),this._register(At(()=>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(At(()=>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(At(()=>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(At(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,gm,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,gm,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,gm,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,a2),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=DM(e.attributes,this._terminal.rows*this._terminal.cols*Gs)),vx=r*this._dimensions.device.cell.width,yx=o*this._dimensions.device.cell.height,bx=(Vs>>24&255)/255,wx=(Vs>>16&255)/255,Sx=(Vs>>8&255)/255,xx=1,this._addRectangle(e.attributes,t,vx,yx,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,bx,wx,Sx,xx)}_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])}},VM=class extends bi{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(At(()=>{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=n2(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=jx,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}`}},jM=class extends VM{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&&MM(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,Lm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new xe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new xe,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}};Lm.INSTANCE=new Lm;var c2=Lm;function GM(e,t,i){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",i)}var $D=c2.INSTANCE.onDidChangeZoomLevel,KD=c2.INSTANCE.onDidChangeFullscreen,Vo=typeof navigator=="object"?navigator.userAgent:"",WD=Vo.indexOf("Firefox")>=0,mm=Vo.indexOf("AppleWebKit")>=0,YM=Vo.indexOf("Chrome")>=0,XM=!YM&&Vo.indexOf("Safari")>=0,VD=Vo.indexOf("Electron/")>=0,jD=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,GM(Vi,e,({matches:i})=>{mu&&t.matches||(mu=i)})}function ZM(){return mu}var $o="en",Dm=!1,Nm=!1,_u=!1,QM=!1,h2=!1,u2=!1,JM=!1,eR=!1,tR=!1,iR=!1,hu,vu=$o,kx=$o,sR,js,Zs=globalThis,yi;typeof Zs.vscode<"u"&&typeof Zs.vscode.process<"u"?yi=Zs.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(yi=process);var d2=typeof yi?.versions?.electron=="string",rR=d2&&yi?.type==="renderer";if(typeof yi=="object"){Dm=yi.platform==="win32",Nm=yi.platform==="darwin",_u=yi.platform==="linux",QM=_u&&!!yi.env.SNAP&&!!yi.env.SNAP_REVISION,JM=d2,tR=!!yi.env.CI||!!yi.env.BUILD_ARTIFACTSTAGINGDIRECTORY,hu=$o,vu=$o;let e=yi.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);hu=t.userLocale,kx=t.osLocale,vu=t.resolvedLanguage||$o,sR=t.languagePack?.translationsConfigFile}catch{}h2=!0}else typeof navigator=="object"&&!rR?(js=navigator.userAgent,Dm=js.indexOf("Windows")>=0,Nm=js.indexOf("Macintosh")>=0,eR=(js.indexOf("Macintosh")>=0||js.indexOf("iPad")>=0||js.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,_u=js.indexOf("Linux")>=0,iR=js?.indexOf("Mobi")>=0,u2=!0,vu=globalThis._VSCODE_NLS_LANGUAGE||$o,hu=navigator.language.toLowerCase(),kx=hu):console.error("Unable to resolve platform.");var _m=0;Nm?_m=1:Dm?_m=3:_u&&(_m=2);var vm=h2,nR=u2&&typeof Zs.importScripts=="function",GD=nR?Zs.origin:void 0,_s=js,Ir=vu,oR;(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})(oR||={});var aR=typeof Zs.postMessage=="function"&&!Zs.importScripts,lR=(()=>{if(aR){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)})(),cR=!!(_s&&_s.indexOf("Chrome")>=0),YD=!!(_s&&_s.indexOf("Firefox")>=0),XD=!!(!cR&&_s&&_s.indexOf("Safari")>=0),ZD=!!(_s&&_s.indexOf("Edg/")>=0),QD=!!(_s&&_s.indexOf("Android")>=0),Fr=typeof navigator=="object"?navigator:{},JD={clipboard:{writeText:vm||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(Fr&&Fr.clipboard&&Fr.clipboard.writeText),readText:vm||!!(Fr&&Fr.clipboard&&Fr.clipboard.readText)},keyboard:vm||ZM()?0:Fr.keyboard||XM?1:2,touch:"ontouchstart"in Vi||Fr.maxTouchPoints>0,pointerEvents:Vi.PointerEvent&&("ontouchstart"in Vi||navigator.maxTouchPoints>0)},Um=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}},ym=new Um,Cx=new Um,Ex=new Um,eN=new Array(230),hR;(e=>{function t(a){return ym.keyCodeToStr(a)}e.toString=t;function i(a){return ym.strToKeyCode(a)}e.fromString=i;function s(a){return Cx.keyCodeToStr(a)}e.toUserSettingsUS=s;function r(a){return Ex.keyCodeToStr(a)}e.toUserSettingsGeneral=r;function n(a){return Cx.strToKeyCode(a)||Ex.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 ym.keyCodeToStr(a)}e.toElectronAccelerator=o})(hR||={});var f2=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}}),uR;(e=>{function t(i){return i===e.None||i===e.Cancelled||i instanceof dR?!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:f2})})(uR||={});var dR=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?f2:(this._emitter||(this._emitter=new xe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};var fR,bm;(function(){typeof globalThis.requestIdleCallback!="function"||typeof globalThis.cancelIdleCallback!="function"?bm=(e,t)=>{lR(()=>{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)}}}:bm=(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))}}},fR=e=>bm(globalThis,e)})();var pR;(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})(pR||={});var Tx=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 xe,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())}};Tx.EMPTY=Tx.fromArray([]);function gR(e){return 55296<=e&&e<=56319}function Ax(e){return 56320<=e&&e<=57343}function mR(e,t){return(e-55296<<10)+(t-56320)+65536}function _R(e){return Pm(e,0)}function Pm(e,t){switch(typeof e){case"object":return e===null?Xs(349,t):Array.isArray(e)?yR(e,t):bR(e,t);case"string":return p2(e,t);case"boolean":return vR(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 vR(e,t){return Xs(e?433:863,t)}function p2(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 yR(e,t){return t=Xs(104579,t),e.reduce((i,s)=>Pm(s,i),t)}function bR(e,t){return t=Xs(181387,t),Object.keys(e).sort().reduce((i,s)=>(i=p2(s,i),Pm(e[s],i)),t)}function wm(e,t,i=32){let s=i-t,r=~((1<<s)-1);return(e<<t|(r&e)>>>s)>>>0}function Mx(e,t=0,i=e.byteLength,s=0){for(let r=0;r<i;r++)e[t+r]=s}function wR(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(""):wR((e>>>0).toString(16),t/4)}var SR=class g2{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(gR(o))if(a+1<i){let c=t.charCodeAt(a+1);Ax(c)?(a++,l=mR(o,c)):l=65533}else{n=o;break}else Ax(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,Mx(this._buff,this._buffLen),this._buffLen>56&&(this._step(),Mx(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=g2._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,wm(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=wm(s,5)+l+a+c+t.getUint32(u*4,!1)&4294967295,a=o,o=n,n=wm(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}};SR._bigBlock32=new DataView(new ArrayBuffer(320));var{registerWindow:tN,getWindow:xR,getDocument:iN,getWindows:sN,getWindowsCount:rN,getWindowId:Rx,getWindowById:nN,hasWindow:oN,onDidRegisterWindow:aN,onWillUnregisterWindow:lN,onDidUnregisterWindow:cN}=(function(){let e=new Map,t={window:Vi,disposables:new Ko};e.set(Vi.vscodeWindowId,t);let i=new xe,s=new xe,r=new xe;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 bi.None;let a=new Ko,l={window:o,disposables:a.add(new Ko)};return e.set(o.vscodeWindowId,l),a.add(At(()=>{e.delete(o.vscodeWindowId),s.fire(o)})),a.add(Bm(o,ER.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 xR(o).document}}})(),kR=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 Bm(e,t,i,s){return new kR(e,t,i,s)}var CR,Lx,Sm=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(Sm.sort),o.shift().execute();s.set(n,!1)};Lx=(n,o,a=0)=>{let l=Rx(n),c=new Sm(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},CR=(n,o,a)=>{let l=Rx(n);if(s.get(l)){let c=new Sm(o,a),h=t.get(l);return h||(h=[],t.set(l,h)),h.push(c),c}else return Lx(n,o,a)}})();var Dx=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}};Dx.None=new Dx(0,0);var hN=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=_R(i),n=s.get(r);if(n)n.users+=1;else{let o=new xe,a=new MutationObserver(c=>o.fire(c));a.observe(e,i);let l=n={users:1,observer:a,onDidMutate:o.event};t.add(At(()=>{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}},ER={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:mm?"webkitAnimationStart":"animationstart",ANIMATION_END:mm?"webkitAnimationEnd":"animationend",ANIMATION_ITERATION:mm?"webkitAnimationIteration":"animationiteration"},TR=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;function m2(e,t,i,...s){let r=TR.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 AR(e,t,...i){return m2("http://www.w3.org/1999/xhtml",e,t,...i)}AR.SVG=function(e,t,...i){return m2("http://www.w3.org/2000/svg",e,t,...i)};var MR=class extends bi{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 xl,this._charAtlasDisposable=this._register(new xl),this._observerDisposable=this._register(new xl),this._model=new IM,this._workCell=new gx,this._workCell2=new gx,this._rectangleRenderer=this._register(new xl),this._glyphRenderer=this._register(new xl),this._onChangeTextureAtlas=this._register(new xe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new xe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new xe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new xe),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new xe),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 iM(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new jM(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=eM(),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(Bm(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(Bm(this._canvas,"webglcontextrestored",h=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,fx(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=px(this._canvas,this._coreBrowserService.window,(h,u)=>this._setCanvasDevicePixelDimensions(h,u)),this._register(this._coreBrowserService.onWindowChange(h=>{this._observerDisposable.value=px(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(At(()=>{for(let h of this._renderLayers)h.dispose();this._canvas.parentElement?.removeChild(this._canvas),fx(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 WM(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new HM(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=n2(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=Fx(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 RM(()=>{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=Nx(e,i.rows-1,0),t=Nx(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),K=-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 RR(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},K=B+s.getWidth()-1),v>=B&&v<=K&&(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+pm]===this._cellColorResolver.result.ext)&&(P=!0,b.length>1&&(T|=qM),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+pm]=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,jA,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+pm]=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})}},RR=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 Nx(e,t,i=0){return Math.max(Math.min(e,t),i)}var Bx="di$target",Ox="di$dependencies",xm=new Map;function vs(e){if(xm.has(e))return xm.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");LR(t,i,r)};return t._id=e,xm.set(e,t),t}function LR(e,t,i){t[Bx]===t?t[Ox].push({id:e,index:i}):(t[Ox]=[{id:e,index:i}],t[Bx]=t)}var uN=vs("BufferService"),dN=vs("CoreMouseService"),fN=vs("CoreService"),pN=vs("CharsetService"),gN=vs("InstantiationService"),mN=vs("LogService"),DR=vs("OptionsService"),_N=vs("OscLinkService"),vN=vs("UnicodeService"),yN=vs("DecorationService"),NR={trace:0,debug:1,info:2,warn:3,error:4,off:5},BR="xterm.js: ",zx=class extends bi{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),_2=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=NR[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?"":BR)+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)}};zx=TA([AA(0,DR)],zx);var _2;function OR(e){_2=e}var v2=class extends bi{constructor(e){if(Wx&&VA()<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 xe),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new xe),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new xe),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new xe),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;OR(h),this._renderer=this._register(new MR(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(At(()=>{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 w2=Symbol("html"),Dl=class{#e;constructor(t,i){if(t!==w2)throw new TypeError("Html is made by html`…`");this.#e=i}static markupOf(t){return t.#e}toString(){if(y2)throw new Error("Html coerced to a string: interpolate it with html`…` or hand it to a sink");return this.#e}toJSON(){if(y2)throw new Error("Html serialized as JSON: convert it with htmlString() first");return this.#e}},y2=typeof process<"u"&&process.env.VITEST!==void 0,zR=e=>new Dl(w2,e);var HR={"&":"&","<":"<",">":">",'"':""","'":"'"},UR=e=>e.replace(/[&<>"']/g,t=>HR[t]);function S2(e){if(e==null||typeof e=="boolean")return"";if(e instanceof Dl)return Dl.markupOf(e);if(Array.isArray(e))return e.map(S2).join("");if(typeof e=="string")return UR(e);if(typeof e=="number"||typeof e=="bigint")return String(e);throw new TypeError(`html: cannot interpolate ${typeof e}`)}var b2=new WeakSet,PR=/<form\b[^>]*\bmethod\s*=\s*["']?post\b/i,qR=/\bname\s*=\s*["']?csrf\b/i;function IR(e){if(b2.has(e))return;let t=e.join("\0");if(PR.test(t))throw new Error("html: write POST forms with postForm, which adds the CSRF field");if(qR.test(t))throw new Error("html: postForm adds the CSRF field; don't write one");b2.add(e)}function jo(e,...t){IR(e);let i=e[0];for(let s=0;s<t.length;s++)i+=S2(t[s])+e[s+1];return zR(i)}var G=(e,t,i)=>({never:e,pattern:new RegExp(`(?<![\\w-])(?:${t})(?![\\w-])`,"i"),say:i}),x2=[G("scope","scopes?|scoped","plan"),G("contract","contracts?","plan"),G("signs","signs|signed(?!\\s+(?:in|out|into)\\b)","Approved by …"),G("sealed","seal|seals|sealed|sealing","approved"),G("binds","binds?","approved"),G("digest","digests?","(the plan version, in Details)"),G("worker","workers?","builder"),G("runner","runners?","builder"),G("daemon","daemons?","builder"),G("background service","background service","builder"),G("operator","operators?|instance operator","approver, or owner"),G("coordinator","coordinators?","your lead"),G("mate","mate","your lead"),G("scout","scouts?|scouting|scouted","research"),G("criterion","criterion|criteria","requirement"),G("evidence","evidence","requirement, or the saved files"),G("proof","proofs?","requirement"),G("verdict","verdicts?","requirement"),G("caveat","caveats?","requirement"),G("mark complete","mark(?:ed|s|ing)?\\s+(?:it\\s+|this\\s+|that\\s+|them\\s+|the\\s+result\\s+)?complete","Accept"),G("Accept and finish","accept\\s+and\\s+finish","Accept"),G("Revise","revise","Send back, or Request changes"),G("re-file","re-?file[ds]?|re-?filing","Send back, or Request changes"),G("Draft a repair task","draft\\s+a\\s+repair\\s+task","Send back"),G("put away","put(?:s|ting)?\\s+(?:it\\s+|them\\s+|tasks\\s+|old\\s+tasks\\s+)?away","Archive"),G("tidy","tidy|tidied|tidying","Archive"),G("run #N","(?:run|attempt|result)\\s+#?\\d+","build #N"),G("reconcile","reconcile[ds]?|reconciling|reconciliation","Waiting: Toolroll is …"),G("requeue","requeue[ds]?|requeuing","Waiting: Toolroll is …"),G("claim","claim|claimed","Waiting: Toolroll is …"),G("lease","leases?|leased","Waiting: Toolroll is …"),G("custody","custody","Waiting: Toolroll is …"),G("incident","incidents?","Waiting: Toolroll is …"),G("plane","plane","Toolroll"),G("fence","fences?|fenced","Waiting: Toolroll is …"),G("attested","attest|attested|attestation","Waiting: Toolroll is …"),G("receipt","receipts?","Waiting: Toolroll is …"),G("regate","regate[ds]?","Run checks"),G("carried","carried|carry|carries","Waiting: Toolroll is …"),G("incarnation","incarnations?","Waiting: Toolroll is …"),G("admission","admission","Waiting: Toolroll is …"),G("quiescence","quiescen(?:ce|t)","Waiting: Toolroll is …"),G("witness","witness(?:es|ed)?","Waiting: Toolroll is …"),G("unproven","unproven","Waiting: Toolroll is …"),G("version hex","(?=[0-9a-f]*\\d)(?=[0-9a-f]*[a-f])[0-9a-f]{12,64}","(the plan version, in Details)")],FR=x2.map(e=>e.never);var k2={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 vB=Object.fromEntries(Object.entries(k2).flatMap(([e,t])=>t.need===void 0?[]:[[e,t.need]]));var KR="The check result couldn't be read.",RB=`${KR} Run checks on it, or open the result to see why.`;var LB={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 qm(e,t){return e==="way-in"?"password":t.automatic===!0?"automatic":e==="none"||t.passwordless||e==="standard"&&t.remembered?"click":"password"}function C2(e,t){let i=qm(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}],xu={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")]};var M2=U(wi(),1);var Ne=(...e)=>e.filter(Boolean).join(" ");var R2=U(F(),1);function Vt({name:e,small:t=!1}){return(0,R2.jsx)("svg",{className:Ne("k-i",t&&"k-i-sm"),viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:xu[e].map((i,s)=>(0,M2.createElement)(i[0],{key:s,...i[1]}))})}var jt=U(F(),1);function Mt({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:Ne("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)(Vt,{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)(Vt,{name:s,small:!0}),r]})})})}function Im({variant:e="outline",sm:t,label:i,lead:s,className:r,...n}){return(0,jt.jsx)("a",{className:Ne("k-btn",`k-btn-${e}`,t&&"k-btn-sm",r),...n,children:(0,jt.jsxs)("span",{className:"k-face",children:[s&&(0,jt.jsx)(Vt,{name:s,small:!0}),i]})})}var L2=U(F(),1);function Fm({word:e,tone:t="",dot:i=!0}){return(0,L2.jsx)("span",{className:Ne("k-chip",t,!i&&"nodot"),children:e})}var jR=U(F(),1);var D2=U(F(),1);var N2=U(F(),1);var B2=U(wi(),1);var Ln=U(F(),1);function O2({label:e,hint:t,error:i,children:s}){let r=(0,B2.useId)(),n=Ne(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 z2=({className:e,...t})=>(0,Ln.jsx)("input",{className:Ne("k-input",e),...t});var Cu=U(F(),1);function H2({items:e,sm:t,wide:i,className:s,...r}){return(0,Cu.jsx)("span",{className:Ne("k-selw",t&&"sm",i&&"wide",s),children:(0,Cu.jsx)("select",{className:"k-sel",...r,children:e.map(n=>{let[o,a]=typeof n=="string"?[n,n]:n;return(0,Cu.jsx)("option",{value:o,children:a},o)})})})}var U2=U(F(),1);var P2=U(F(),1);var Qs=U(F(),1);function q2({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 I2=U(F(),1),Go=({children:e})=>(0,I2.jsx)("div",{className:"k-acts",children:e});var GR=U(wi(),1),F2=U(F(),1);var Yo=U(F(),1),$m=({children:e})=>(0,Yo.jsxs)("p",{className:"k-notice",role:"alert",children:[(0,Yo.jsx)(Vt,{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=U(F(),1);function Eu({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 $2=U(F(),1);var Km=U(F(),1);var Wm=U(F(),1);var Vm=U(F(),1);var jr=U(wi(),1),dk=U(Yu(),1);var YR="toolroll.key",XR="x-toolroll-key",ZR=/^[0-9a-f]{64}$/;function K2(){try{let e=globalThis.localStorage?.getItem(YR)??null;if(e===null)return null;let t=JSON.parse(e),i=typeof t=="object"&&t!==null?t.key:null;return typeof i=="string"&&ZR.test(i)?i:null}catch{return null}}function Tu(e){let t=K2();return t===null?e:{...e,[XR]:t}}function W2(){let e=K2();return e===null?["toolroll"]:["toolroll",`toolroll.key.${e}`]}var ys="form.k-sform",Hl=e=>HTMLFormElement.prototype.getAttribute.call(e,"id")??"",QR=e=>Object.getOwnPropertyDescriptor(HTMLFormElement.prototype,"elements").get.call(e),V2="http://www.w3.org/2000/svg",Js=e=>e.querySelector("[data-k-proof]"),bs=e=>e.querySelector("[data-k-save]"),Z2=e=>new Set(Array.from(Js(e)?.querySelectorAll("input[name]")??[]).map(t=>t.name));function Mu(e,t=null){let i=Z2(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 Qm(e){let t=new Map;for(let[i,s]of e)t.set(i,[...t.get(i)??[],s]);return t}function Q2(e){let t=Z2(e),i=[];for(let s of Array.from(QR(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 J2(e,t){return e.querySelector(`[name="${CSS.escape(t)}"]`)}function JR(e,t){let i=J2(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 e8(e,t,i){let s=J2(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 t8=(e,t)=>JSON.stringify(e??[])===JSON.stringify(t??[]);function Jm(e){let t=Qm(Mu(e));return Q2(e).filter(i=>!t8(e.kInit?.get(i),t.get(i)))}function ek(e,t){let i=Qm(t),s=e.hasAttribute("data-k-gate")?Jm(e):Q2(e);return s.length>3?`${s.length} changes`:s.map(r=>`${JR(e,r)}: ${e8(e,r,i.get(r)??[])}`).join(" · ")}function tk(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 Gm=e=>e!==null&&e.querySelector('input[type="password"], a.sso-step-up')!==null;function Au(e){if(e.kPrepped)return;e.kPrepped=!0,e.kInit=Qm(Mu(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 j2(){for(let e of Array.from(document.querySelectorAll(ys)))Au(e)}function i8(e,t){e.classList.remove("k-btn-primary","k-btn-outline","k-btn-danger"),e.classList.add(`k-btn-${t}`)}function s8(e){for(let t of Array.from(document.querySelectorAll(`${ys}[data-k-gate]`))){let i=bs(t);!i||i.dataset.kVariant!=="primary"||i8(i,t===e||e===null?"primary":"outline")}}function r8(e,t){if(!e.hasAttribute("data-k-gate"))return;let i=Jm(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=Mu(e),n=Js(e)!==null&&Gm(Js(e))&&tk(e,r)?" · Asks for your password.":"";s.textContent=`${ek(e,r)}${n}`}t&&s8(i.length>0?e:document.querySelector(`${ys}[data-k-gate][data-dirty]`))}function ik(e){let t=document.createElementNS(V2,"svg");t.setAttribute("class","k-i"),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("aria-hidden","true");for(let i of xu[e]){let s=document.createElementNS(V2,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 sk(e){let t=e.querySelector(".k-ssave-err");t&&t.childElementCount>0&&t.replaceChildren(),bs(e)?.removeAttribute("aria-describedby")}function Ym(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(ik("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 rk=e=>{let t=ji(e);return t===""?t:`${t.charAt(0).toUpperCase()}${t.slice(1)}${/[.!?]$/.test(t)?"":"."}`},Xm=e=>`${rk(e)} Your edits are still here.`;function n8(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,o8=e=>ji(e.closest("section")?.querySelector("h3")?.childNodes[0]?.textContent??e.closest("section")?.querySelector("h3")?.textContent)||"a section",a8=e=>Array.from(document.querySelectorAll(`${ys}[data-k-gate][data-dirty]`)).filter(t=>t!==e);function l8(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 c8=(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 jm(e){Xo=!0,window.location.assign(Hl(e)?l8(e):window.location.href)}async function h8(e,t,i,s){Ul(e,!0);let r=new URLSearchParams;for(let[d,f]of[...t,...i])r.append(d,f);let n=c8(e,s),o;try{o=await fetch(n,{method:"POST",body:r,credentials:"same-origin",redirect:"follow",headers:Tu({accept:"text/html"})})}catch{jm(e);return}let a=new URL(o.url||n,window.location.href);if(a.origin!==window.location.origin||a.pathname==="/login"){jm(e);return}let l=a.searchParams.get("problem");if(l){Ym(e,Xm(l));return}if(!o.redirected&&o.status>=400&&o.status<500){let d=n8(await o.text().catch(()=>""));Ym(e,Xm(d??`Toolroll refused this (${o.status}). Nothing changed`));return}if(!o.ok){jm(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 G2(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 Zm(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?G2(e,s):Ym(e,Xm(o)))};e.dispatchEvent(new CustomEvent("k-prepare",{detail:{done:n}}));return}G2(e,s);return}h8(e,t,i,s)}var nk=e=>Array.from(e?.querySelectorAll("input[name]")??[]).map(t=>[t.name,t.value]);function u8(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(ik("x")),a.append(l,c);let h=document.createElement("p");h.className="k-pop-terms",h.textContent=ek(e,t)||ji(e.dataset.kConfirm);let u=document.createElement("p");u.textContent=[e.dataset.kConfirm,e.dataset.kNote].filter(Boolean).map(g=>rk(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 Y2(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=nk(t);e.kSent=!0,e.kClose?.(),Zm(e,e.kSnapshot??[],s,e.kSubmitter??null)}function d8(e,t){if(e.kPending||(Au(e),e.hasAttribute("data-k-gate")&&Jm(e).length===0&&!(t instanceof HTMLButtonElement&&t.hasAttribute("formaction"))))return;let i=e.hasAttribute("data-k-download")?[]:a8(e);if(i.length>0){f8(e,i,t);return}ok(e,t)}function f8(e,t,i){let s=[...new Set(t.map(o8))],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&&ok(e,i)}});h.addEventListener("click",f=>{f.preventDefault(),u=!0,d()}),h.focus()}function ok(e,t){sk(e);let i=Mu(e,t);if(t instanceof HTMLButtonElement&&t.hasAttribute("formaction")){Zm(e,i,[],t);return}let s=Js(e);if(s!==null&&tk(e,i)&&Gm(s)){u8(e,i,t);return}Zm(e,i,s!==null&&!Gm(s)?nk(s):[],t)}var X2=!1;function ak(){if(X2||typeof document>"u")return;X2=!0,document.documentElement.classList.add("k-js");let e=i=>{let s=i.target?.closest?.(ys);s&&Au(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}Au(r),sk(r),r8(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){Y2(r);return}d8(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(),Y2(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",j2),window.addEventListener("beforeunload",i=>{Xo||document.querySelector(`${ys}[data-k-gate][data-dirty]`)===null||i.preventDefault()}),j2()}var p8="(max-width: 760px)",g8='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',e_=()=>typeof window<"u"&&window.matchMedia(p8).matches,m8=()=>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 lk(){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 Ot=[];function _8(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={}){Ot.length>0&&!e.classList.contains("k-pop")&&uk("close");let r=e.classList.contains("k-pop"),n=e_();e.isConnected||document.body.append(e);let o=document.createElement("div");o.className=`k-scrim${i.dim??(!r||n)?" dim":""}${Ot.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",Ot.length>0),e.classList.toggle("as-sheet",r&&n),r&&!n&&_8(e,t),m8()||(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 v8(),Ot.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=Ot.indexOf(e);if(!(i<0)){for(let s of Ot.slice(i+1).reverse())Nn(s,"removed");Ot.splice(i,1),Ot.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"),y8(e.trigger),e.onClose?.(t)}}function t_(){for(let e of Ot.slice().reverse())e.panel.isConnected||Nn(e,"removed");Ot.length===0&&(Dn?.disconnect(),Dn=null)}var Dn=null;function v8(){Dn!==null||typeof MutationObserver>"u"||(Dn=new MutationObserver(()=>{Ot.some(e=>!e.panel.isConnected)&&t_()}),Dn.observe(document.body,{childList:!0,subtree:!0}))}function uk(e="removed"){for(let t of Ot.slice().reverse())Nn(t,e)}function Ru(e){return e!=null&&e.isConnected&&e.getClientRects().length>0}function y8(e){let t=e?.getAttribute("data-k-open");if(Ru(e)){e.focus();return}((t?Array.from(document.querySelectorAll(`[data-k-open="${CSS.escape(t)}"]`)).find(Ru):void 0)??Array.from(document.querySelectorAll(".k-dock .k-btn")).find(Ru))?.focus()}function b8(e){let t=Ot[Ot.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(g8)).filter(Ru);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=e_(),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 w8(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 S8(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 ck=!1,hk=new WeakMap;function x8(){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 Lu(){if(ck||typeof document>"u")return;ck=!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(S8(i,t)||w8(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=Ot[Ot.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&&(hk.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=hk.get(i);s!==null&&r!==void 0&&s.replaceChildren(...r)}}}),document.addEventListener("keydown",b8,!0),x8();let e=()=>{t_();for(let t of document.querySelectorAll(".k-composer-ta"))Pl(t)};window.addEventListener("standing-orders:workspace-rendered",e),window.visualViewport?.addEventListener("resize",lk),window.visualViewport?.addEventListener("scroll",lk),ak(),e()}var Fe=U(F(),1);function Du({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)(Mt,{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":Ne("k-pop",e==="menu"&&"k-pop-menu");return(0,dk.createPortal)((0,Fe.jsx)("div",{ref:o,className:d,role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,children:u}),document.body)}var fk=U(F(),1);var Gr=U(wi(),1);var vt=U(F(),1);function pk({kind:e,facts:t,label:i,terms:s,text:r,primary:n=!0,docked:o,busy:a="Starting…",onApprove:l,check:c}){let h=qm(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,C2(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,vt.jsxs)(vt.Fragment,{children:[(0,vt.jsx)(Mt,{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=>{_.current||c!==void 0&&!c()||(h==="password"?d(E.currentTarget):v(null))}}),h==="click"&&b&&(0,vt.jsx)($m,{children:b}),u&&(0,vt.jsxs)(Du,{kind:"popover",title:"Confirm with your password",trigger:u,onClose:()=>{d(null),T(null)},children:[r&&(0,vt.jsx)("p",{children:r}),(0,vt.jsx)("p",{className:"k-pop-terms",children:s}),(0,vt.jsxs)("form",{className:"k-field",onSubmit:p,children:[(0,vt.jsx)("label",{className:"k-label",htmlFor:m,children:"Your password"}),(0,vt.jsx)(z2,{id:m,type:"password",name:"token",autoComplete:"current-password",required:!0,autoFocus:!0,"aria-describedby":`${m}-err`,"aria-invalid":b?!0:void 0}),(0,vt.jsx)("span",{className:"k-err",id:`${m}-err`,role:"alert",children:b??""}),(0,vt.jsxs)(Go,{children:[(0,vt.jsx)(Mt,{type:"submit",variant:"primary",label:i,busy:f?a:!1}),(0,vt.jsx)(Mt,{variant:"ghost",label:"Cancel","data-k-close":""})]})]}),(0,vt.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)})]})]})}var gk=U(F(),1);var C8=U(wi(),1);var mk=U(F(),1);var _k=U(F(),1);var E8=U(wi(),1);var vk=U(F(),1);var yk=U(F(),1);var i_=U(F(),1);var s_=U(F(),1);var bk=U(F(),1);var r_=U(wi(),1);var wk=U(F(),1);var H=U(F(),1),Zo={claude:"Claude Code",codex:"Codex",shell:"Shell"},A8={claude:"An agent you drive by hand",codex:"An agent you drive by hand",shell:"A plain terminal"},M8={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"},n_=document.getElementById("so-term-boot"),R8=n_?.dataset.csrf??"",Sk=n_?.dataset.session||null,L8=n_?.dataset.passwordless==="1",xk={passwordless:L8,remembered:!1},D8=()=>window.matchMedia("(max-width: 760px)").matches;async function N8(){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 Ek(e,t){try{return await(await fetch(e,{method:"POST",headers:Tu({accept:"application/json"}),credentials:"same-origin",body:new URLSearchParams({csrf:R8,...t})})).json()}catch{return{ok:!1,error:"The console didn't answer. Nothing changed; try again."}}}function kk(){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 B8({session:e,onLink:t,keys:i}){let s=(0,Be.useRef)(null);return(0,Be.useEffect)(()=>{let r=new LS({fontFamily:'"Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace',fontSize:D8()?12:13,cursorBlink:!0,allowProposedApi:!0,scrollback:5e3,macOptionIsMeta:!0,theme:kk()}),n=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{r.options.theme=kk()};n.addEventListener("change",o);let a=new DS;r.loadAddon(a);let l=new JS;r.loadAddon(l),r.unicode.activeVersion="11",r.open(s.current);let c=null;try{c=new v2,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,W2());h=B,B.binaryType="arraybuffer";let K=!0;B.onmessage=$=>{if(K&&(r.reset(),K=!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,H.jsx)("div",{className:"term-screen",ref:s})}function O8({sendRef:e}){let[t,i]=(0,Be.useState)(!1),s=(n,o)=>(0,H.jsx)(Mt,{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,H.jsxs)("div",{className:"term-keys",role:"toolbar","aria-label":"Terminal keys",children:[s("Esc","\x1B"),s("Tab"," "),(0,H.jsx)(Mt,{sm:!0,className:"term-key",label:"Ctrl","aria-pressed":t,onPointerDown:n=>{n.preventDefault(),i(o=>!o)}}),t?(0,H.jsx)(H.Fragment,{children:["c","d","r","l","z"].map(n=>(0,H.jsx)(Mt,{sm:!0,className:"term-key",label:`^${n.toUpperCase()}`,onPointerDown:o=>{o.preventDefault(),r(n)}},n))}):(0,H.jsxs)(H.Fragment,{children:[s("↑","\x1B[A"),s("↓","\x1B[B"),s("←","\x1B[D"),s("→","\x1B[C"),s("/","/"),s("⏎","\r")]})]})}function z8({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,H.jsx)("div",{className:"term-form",children:(0,H.jsx)(Eu,{title:"No projects yet.",text:"Add a project in the console first, then start a terminal in it.",action:(0,H.jsx)(Im,{sm:!0,href:"/projects",label:"Open Projects"})})});let a=e.projects.find(c=>c.path===s)?.name??"",l=async c=>{let h=await Ek("/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,H.jsxs)("section",{className:"term-form","aria-labelledby":"term-new-title","data-term-new":!0,children:[(0,H.jsx)("h2",{id:"term-new-title",className:"k-sr",children:"New terminal"}),(0,H.jsx)(O2,{label:"Project",children:c=>(0,H.jsx)(H2,{id:c.id,wide:!0,value:s,onChange:h=>r(h.target.value),items:e.projects.map(h=>[h.path,h.name])})}),(0,H.jsxs)("div",{className:"k-field term-radios",children:[(0,H.jsx)("span",{className:"k-label",children:"Program"}),(0,H.jsx)(q2,{name:"program",legend:"Program",current:n,onChange:c=>o(c),items:e.programs.map(c=>({value:c,label:Zo[c],text:A8[c]}))})]}),(0,H.jsxs)("p",{className:"term-terms",children:[Zo[n]," · ",a," · a fresh worktree on its own branch"]}),(0,H.jsxs)(Go,{children:[(0,H.jsx)(pk,{kind:"step-up",facts:xk,label:"Start terminal",terms:`${Zo[n]} in ${a}, a fresh worktree on its own branch.`,onApprove:l}),i!==null&&(0,H.jsx)(Mt,{variant:"ghost",label:"Cancel",onClick:i})]}),(0,H.jsx)(Bl,{children:`${Nl("step-up",xk)} A terminal can do anything you can on this computer. Your default branch is never touched.`})]})}function H8({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 Ek(`/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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Mt,{variant:"ghost",sm:!0,label:l?"Close":"Remove","aria-haspopup":"dialog",onClick:u=>s(u.currentTarget),"data-term-end":c}),i!==null&&(0,H.jsxs)(Du,{kind:"popover",title:l?"Close this terminal?":"Remove this terminal?",trigger:i,onClose:()=>{s(null),a(null)},children:[(0,H.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,H.jsxs)("p",{className:"k-notice",role:"alert",children:[(0,H.jsx)(Vt,{name:"alert",small:!0}),(0,H.jsx)("span",{children:o})]}),(0,H.jsxs)(Go,{children:[(0,H.jsx)(Mt,{variant:"danger",label:l?"Close terminal":"Remove terminal",busy:r?l?"Closing…":"Removing…":!1,onClick:()=>{h()}}),(0,H.jsx)(Mt,{variant:"ghost",label:"Cancel","data-k-close":""})]})]})]})}function U8(){let[e,t]=(0,Be.useState)(null),[i,s]=(0,Be.useState)(Sk),[r,n]=(0,Be.useState)(!1),[o,a]=(0,Be.useState)(Sk===null),[l,c]=(0,Be.useState)("connecting"),h=(0,Be.useRef)(null),u=(0,Be.useCallback)(async()=>{let p=await N8();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,H.jsx)("div",{className:"term-app term-app--loading",children:(0,H.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,H.jsxs)("nav",{className:"term-list","aria-label":"Terminals",children:[e.sessions.length===0?(0,H.jsx)("p",{className:"term-none",children:"No terminals yet."}):null,e.sessions.map(p=>(0,H.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,H.jsxs)("span",{className:"term-item-t",children:[Zo[p.program]," · ",p.project]}),(0,H.jsxs)("span",{className:"term-item-m",children:[p.endedAt===null?(0,H.jsx)(Fm,{word:"Live",tone:"live"}):(0,H.jsx)(Fm,{word:"Ended"}),(0,H.jsx)("span",{className:"k-mono",children:p.branch})]})]},p.id))]}),m=(0,H.jsxs)("header",{className:"term-tb",children:[T?(0,H.jsx)(Mt,{className:"k-phone-only",variant:"ghost",iconOnly:"back",label:"All terminals",onClick:()=>{n(!1),a(!0)}}):(0,H.jsx)("a",{className:"k-btn k-btn-ghost k-btn-icon k-phone-only",href:"/agents","aria-label":"Agents",title:"Agents",children:(0,H.jsx)(Vt,{name:"back"})}),(0,H.jsxs)("a",{className:"term-back k-desk-only",href:"/agents",children:[(0,H.jsx)(Vt,{name:"back",small:!0}),"Agents"]}),(0,H.jsx)("h1",{children:"Terminals"}),(0,H.jsxs)("span",{className:"term-ctx",children:[f," running · up to 8"]}),(0,H.jsx)("span",{className:"k-grow"}),e.available&&!r&&(0,H.jsx)(Mt,{variant:"primary",sm:!0,lead:"plus",label:"New terminal",onClick:b})]}),v;return e.available?r||d===null?v=(0,H.jsx)(z8,{state:e,onCancel:d===null&&e.sessions.length===0?null:()=>n(!1),onStarted:p=>{n(!1),s(p),a(!1),u()}}):v=(0,H.jsxs)("section",{className:"term-pane","aria-label":`${Zo[d.program]} terminal`,children:[(0,H.jsxs)("header",{className:"term-ph",children:[(0,H.jsxs)("div",{children:[(0,H.jsxs)("b",{children:[Zo[d.program]," · ",d.project]}),(0,H.jsxs)("span",{className:"term-ph-m",children:[(0,H.jsx)("span",{className:"k-mono",children:d.branch})," · started ",new Date(d.startedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),(0,H.jsx)("span",{className:`term-link term-link--${l}`,role:"status",children:M8[l]}),(0,H.jsx)(H8,{session:d,onDone:u},d.id)]}),(0,H.jsx)(B8,{session:d,onLink:c,keys:p=>{h.current=p}},d.id),d.endedAt===null?(0,H.jsx)(O8,{sendRef:h}):(0,H.jsx)(Bl,{children:"Ended. Its branch stays; Remove takes it off this list."})]}):v=(0,H.jsx)("div",{className:"term-form",children:(0,H.jsx)(Eu,{title:"Terminals aren't available.",text:e.problem??"This install can't run terminals."})}),(0,H.jsxs)("div",{className:`term-app${T?" term-app--pane":""}`,"data-kit-page":!0,children:[m,(0,H.jsxs)("div",{className:"term-grid",children:[(0,H.jsx)("aside",{className:"term-side",children:_}),(0,H.jsx)("main",{className:"term-main",children:v})]})]})}Lu();(0,Ck.createRoot)(document.getElementById("so-term")).render((0,H.jsx)(U8,{}));
|