kaizen-agent 1.41.2 → 1.41.3

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/cli/conpty.ts ADDED
@@ -0,0 +1,99 @@
1
+ // Windows has no Bun.Terminal, so the in-card terminal there runs through a small
2
+ // ConPTY host: PowerShell compiles the C# below with Add-Type, starts the command in
3
+ // a pseudo console, and bridges it to plain pipes. Its stdout is the screen, its
4
+ // stdin the keys. A resize travels in-band on stdin as ESC ] kzr;<cols>;<rows> BEL,
5
+ // a sequence no key produces, and is taken out before the rest reaches the console.
6
+ const HOST = String.raw`
7
+ using System; using System.IO; using System.Threading; using System.Runtime.InteropServices;
8
+ public static class KzPty {
9
+ [StructLayout(LayoutKind.Sequential)] struct COORD { public short X, Y; }
10
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] struct STARTUPINFO {
11
+ public int cb; public string r, d, t; public int x, y, w, h, cx, cy, fa, fl; public short sw, r2; public IntPtr r3, i, o, e; }
12
+ [StructLayout(LayoutKind.Sequential)] struct STARTUPINFOEX { public STARTUPINFO si; public IntPtr attrs; }
13
+ [StructLayout(LayoutKind.Sequential)] struct PI { public IntPtr hp, ht; public int pid, tid; }
14
+ [DllImport("kernel32.dll", SetLastError = true)] static extern bool CreatePipe(out IntPtr r, out IntPtr w, IntPtr a, int s);
15
+ [DllImport("kernel32.dll")] static extern int CreatePseudoConsole(COORD c, IntPtr i, IntPtr o, uint f, out IntPtr h);
16
+ [DllImport("kernel32.dll")] static extern int ResizePseudoConsole(IntPtr h, COORD c);
17
+ [DllImport("kernel32.dll")] static extern void ClosePseudoConsole(IntPtr h);
18
+ [DllImport("kernel32.dll", SetLastError = true)] static extern bool InitializeProcThreadAttributeList(IntPtr l, int n, int f, ref IntPtr s);
19
+ [DllImport("kernel32.dll", SetLastError = true)] static extern bool UpdateProcThreadAttribute(IntPtr l, uint f, IntPtr a, IntPtr v, IntPtr s, IntPtr p, IntPtr r);
20
+ [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] static extern bool CreateProcessW(string app, string cmd, IntPtr pa, IntPtr ta, bool inh, uint f, IntPtr env, string cwd, ref STARTUPINFOEX si, out PI pi);
21
+ [DllImport("kernel32.dll")] static extern uint WaitForSingleObject(IntPtr h, uint ms);
22
+ [DllImport("kernel32.dll")] static extern bool GetExitCodeProcess(IntPtr h, out int c);
23
+ [DllImport("kernel32.dll")] static extern bool CloseHandle(IntPtr h);
24
+ static COORD Size(int c, int r) { COORD s; s.X = (short)c; s.Y = (short)r; return s; }
25
+ static FileStream Of(IntPtr h, FileAccess a) { return new FileStream(new Microsoft.Win32.SafeHandles.SafeFileHandle(h, true), a); }
26
+ public static int Run(string cmd, int cols, int rows) {
27
+ IntPtr inR, inW, outR, outW, hpc;
28
+ if (!CreatePipe(out inR, out inW, IntPtr.Zero, 0) || !CreatePipe(out outR, out outW, IntPtr.Zero, 0)) return 1;
29
+ int hr = CreatePseudoConsole(Size(cols, rows), inR, outW, 0, out hpc);
30
+ if (hr != 0) { Console.Error.WriteLine("CreatePseudoConsole failed: " + hr); return 1; }
31
+ IntPtr sz = IntPtr.Zero;
32
+ InitializeProcThreadAttributeList(IntPtr.Zero, 1, 0, ref sz);
33
+ var si = new STARTUPINFOEX(); si.si.cb = Marshal.SizeOf(typeof(STARTUPINFOEX));
34
+ // STARTF_USESTDHANDLES with none: otherwise the child takes this host's piped stdio, not the console.
35
+ si.si.fl = 0x100;
36
+ si.attrs = Marshal.AllocHGlobal(sz);
37
+ if (!InitializeProcThreadAttributeList(si.attrs, 1, 0, ref sz)
38
+ || !UpdateProcThreadAttribute(si.attrs, 0, (IntPtr)0x20016, hpc, (IntPtr)IntPtr.Size, IntPtr.Zero, IntPtr.Zero)) return 1;
39
+ PI pi;
40
+ if (!CreateProcessW(null, cmd, IntPtr.Zero, IntPtr.Zero, false, 0x80000, IntPtr.Zero, null, ref si, out pi)) {
41
+ Console.Error.WriteLine("CreateProcess failed: " + Marshal.GetLastWin32Error()); return 1; }
42
+ // The console holds its own copies; ours would keep the pipes open past its end.
43
+ CloseHandle(inR); CloseHandle(outW);
44
+ var input = Of(inW, FileAccess.Write); var output = Of(outR, FileAccess.Read);
45
+ var stdout = Console.OpenStandardOutput();
46
+ var pump = new Thread(() => {
47
+ var b = new byte[16384]; int n;
48
+ try { while ((n = output.Read(b, 0, b.Length)) > 0) { stdout.Write(b, 0, n); stdout.Flush(); } } catch { }
49
+ });
50
+ pump.IsBackground = true; pump.Start();
51
+ var keys = new Thread(() => {
52
+ var stdin = Console.OpenStandardInput(); var b = new byte[4096]; int n;
53
+ var held = new MemoryStream();
54
+ try {
55
+ while ((n = stdin.Read(b, 0, b.Length)) > 0) {
56
+ // ponytail: a UTF-8 character split across two reads decodes as U+FFFD; hold incomplete tails if that shows up.
57
+ held.Write(b, 0, n);
58
+ var s = System.Text.Encoding.UTF8.GetString(held.ToArray());
59
+ // A resize cut in half by the pipe waits for its other half.
60
+ int keep = s.LastIndexOf("\x1b]kzr;");
61
+ if (keep >= 0 && s.IndexOf('\x07', keep) < 0) { held = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(s.Substring(keep))); s = s.Substring(0, keep); }
62
+ else held = new MemoryStream();
63
+ s = System.Text.RegularExpressions.Regex.Replace(s, "\x1b]kzr;(\\d+);(\\d+)\x07", m => {
64
+ ResizePseudoConsole(hpc, Size(int.Parse(m.Groups[1].Value), int.Parse(m.Groups[2].Value))); return ""; });
65
+ var o = System.Text.Encoding.UTF8.GetBytes(s);
66
+ if (o.Length > 0) { input.Write(o, 0, o.Length); input.Flush(); }
67
+ }
68
+ } catch { }
69
+ });
70
+ keys.IsBackground = true; keys.Start();
71
+ WaitForSingleObject(pi.hp, 0xFFFFFFFF);
72
+ int code; GetExitCodeProcess(pi.hp, out code);
73
+ // Closing the console flushes its last frame into the pump, then ends it.
74
+ ClosePseudoConsole(hpc);
75
+ pump.Join(2000);
76
+ return code;
77
+ }
78
+ }`;
79
+
80
+ // The PowerShell that hosts it: the child's command line, size and directory come in
81
+ // through the environment, so nothing the agent is given passes through a quoting layer.
82
+ const SCRIPT = `Add-Type -TypeDefinition @'
83
+ ${HOST}
84
+ '@
85
+ Set-Location -LiteralPath $env:KZ_PTY_CWD
86
+ exit [KzPty]::Run($env:KZ_PTY_CMD, [int]$env:KZ_PTY_COLS, [int]$env:KZ_PTY_ROWS)`;
87
+
88
+ export const conptyHost = () => Buffer.from(SCRIPT, "utf16le").toString("base64");
89
+
90
+ export const resizeSeq = (cols: number, rows: number) => `\x1b]kzr;${cols};${rows}\x07`;
91
+
92
+ // The command line the pseudo console starts: PowerShell running cmd. It finds .cmd
93
+ // shims (npm installs claude as one), which CreateProcess alone does not, and takes
94
+ // the arguments as -EncodedCommand, as findTerminal does, so newlines survive.
95
+ export function innerCommand(shell: string, cmd: string[]): string {
96
+ const q = (a: string) => `'${a.replace(/'/g, "''")}'`;
97
+ const enc = Buffer.from(`& ${cmd.map(q).join(" ")}`, "utf16le").toString("base64");
98
+ return `"${shell}" -NoProfile -EncodedCommand ${enc}`;
99
+ }
package/cli/pty.test.ts CHANGED
@@ -5,7 +5,8 @@ import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, existsSync, realpa
5
5
  import { tmpdir } from "node:os";
6
6
  import { join } from "node:path";
7
7
  import { launchMode, closeSessions, readSessions, sweepSessions, CLOSE_GRACE_MS } from "./state.ts";
8
- import { loginEnv, startPty, writePty } from "./pty.ts";
8
+ import { loginEnv, startPty, writePty, attachPty, ptyState } from "./pty.ts";
9
+ import { conptyHost, innerCommand, resizeSeq } from "./conpty.ts";
9
10
 
10
11
  const root = realpathSync(mkdtempSync(join(tmpdir(), "kaizen-pty-")));
11
12
 
@@ -194,3 +195,27 @@ test("asking: Claude Code and Codex prompts count as a question, ordinary output
194
195
  expect(asking("Do you want to make this edit to cli/pty.ts?")).toBe(true);
195
196
  expect(asking("Reading cli/pty.ts\r\n\x1b[2K✻ Thinking… 1. step one done")).toBe(false);
196
197
  });
198
+
199
+ test("Windows ConPTY host: resize travels in-band, the agent command survives quotes and newlines", () => {
200
+ expect(resizeSeq(100, 40)).toBe("\x1b]kzr;100;40\x07");
201
+ const line = innerCommand("C:\\ps.exe", ["claude", "it's\nhere"]);
202
+ const enc = line.split(" ").pop()!;
203
+ expect(line.startsWith('"C:\\ps.exe" -NoProfile -EncodedCommand ')).toBe(true);
204
+ expect(Buffer.from(enc, "base64").toString("utf16le")).toBe("& 'claude' 'it''s\nhere'");
205
+ // The host script decodes to PowerShell carrying the C# whole.
206
+ expect(Buffer.from(conptyHost(), "base64").toString("utf16le")).toContain("CreatePseudoConsole");
207
+ });
208
+
209
+ test.skipIf(process.platform !== "win32")("on Windows a card agent runs in a pseudo console and takes typed input", async () => {
210
+ const key = `win-${Date.now()}`;
211
+ const out: string[] = [];
212
+ startPty(key, ["cmd.exe", "/q", "/k", "echo ready"], root);
213
+ attachPty(key, (d) => { if (d) out.push(d); });
214
+ const until = async (re: RegExp) => { for (let i = 0; i < 300 && !re.test(out.join("")); i++) await Bun.sleep(100); return out.join(""); };
215
+ expect(await until(/ready/)).toContain("ready");
216
+ writePty(key, "echo typed-%OS%\r");
217
+ expect(await until(/typed-Windows_NT/)).toContain("typed-Windows_NT");
218
+ writePty(key, "exit\r");
219
+ for (let i = 0; i < 100 && ptyState(key)?.alive; i++) await Bun.sleep(100);
220
+ expect(ptyState(key)?.alive).toBe(false);
221
+ }, 60_000);
package/cli/pty.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  // Agents the web board runs itself, each in a pseudo-terminal the board owns, so a
2
2
  // card can show the agent's screen and pass it the user's typing (agent.launch: card).
3
3
  // They live in this process: the board stopping ends them, as closing a terminal
4
- // window ends the agent in it. Bun has no pseudo-terminal on Windows.
4
+ // window ends the agent in it. Bun has no pseudo-terminal on Windows; there the
5
+ // agent runs under a ConPTY host (conpty.ts) spoken to over pipes.
5
6
  import { writeFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+ import { conptyHost, innerCommand, resizeSeq } from "./conpty.ts";
9
+
10
+ const WIN = process.platform === "win32";
11
+ // Windows PowerShell, which every Windows has, both hosts the console and runs the agent in it.
12
+ const winPs = () => join(process.env.SystemRoot ?? "C:\\Windows", "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
6
13
 
7
14
  type Pty = { proc: Bun.Subprocess; out: string[]; size: number; listeners: Set<(d: string | null) => void>; exit: number | null; asking: boolean; quiet?: Timer; total: number; since: number; onChange?: () => void };
8
15
 
@@ -24,7 +31,7 @@ export const asking = (screen: string) =>
24
31
  const QUIET_MS = 700;
25
32
  // Bun gained pseudo-terminals in 1.3.5; an older one spawns without a tty, so it
26
33
  // keeps opening terminal windows.
27
- export const ptySupported = process.platform !== "win32" && typeof (Bun as any).Terminal === "function";
34
+ export const ptySupported = WIN || typeof (Bun as any).Terminal === "function";
28
35
 
29
36
  // Starts cmd in a new pseudo-terminal under `key` and returns its PID. pidFile gets
30
37
  // that PID, the agent's own, so closeSessions can end it like any launched session.
@@ -46,7 +53,21 @@ export function startPty(key: string, cmd: string[], cwd: string, pidFile?: stri
46
53
  flag(p.exit === null && n > 0 && asking(p.out.join("").slice(-n)));
47
54
  }, QUIET_MS);
48
55
  };
49
- p.proc = Bun.spawn(cmd, {
56
+ if (WIN) {
57
+ const ps = winPs();
58
+ p.proc = Bun.spawn([ps, "-NoProfile", "-NonInteractive", "-EncodedCommand", conptyHost()], {
59
+ cwd,
60
+ env: { ...process.env, KZ_PTY_CMD: innerCommand(ps, cmd), KZ_PTY_CWD: cwd, KZ_PTY_COLS: "120", KZ_PTY_ROWS: "32" },
61
+ stdin: "pipe", stdout: "pipe", stderr: "pipe", windowsHide: true,
62
+ });
63
+ const read = async (s: ReadableStream<Uint8Array>) => {
64
+ const d = new TextDecoder();
65
+ for await (const c of s) push(d.decode(c, { stream: true }));
66
+ };
67
+ read(p.proc.stdout as ReadableStream<Uint8Array>).catch(() => {});
68
+ // The host's own failures (Add-Type, CreateProcess) land on the screen, not nowhere.
69
+ read(p.proc.stderr as ReadableStream<Uint8Array>).catch(() => {});
70
+ } else p.proc = Bun.spawn(cmd, {
50
71
  cwd,
51
72
  env: { ...process.env, TERM: "xterm-256color", COLORTERM: "truecolor" },
52
73
  terminal: { cols: 120, rows: 32, data: (_t, d) => push(dec.decode(d, { stream: true })) },
@@ -82,13 +103,18 @@ export function writePty(key: string, d: string) {
82
103
  if (!p || p.exit !== null) return;
83
104
  p.since = p.total;
84
105
  if (p.asking) { p.asking = false; p.onChange?.(); }
85
- p.proc.terminal?.write(d);
106
+ send(p, d);
86
107
  }
87
108
 
109
+ const send = (p: Pty, d: string) => {
110
+ if (!WIN) return p.proc.terminal?.write(d);
111
+ try { (p.proc.stdin as Bun.FileSink).write(d); (p.proc.stdin as Bun.FileSink).flush(); } catch { /* host gone */ }
112
+ };
113
+
88
114
  export function resizePty(key: string, cols: number, rows: number) {
89
115
  const p = ptys.get(key);
90
116
  const c = Math.max(10, Math.min(500, cols | 0)), r = Math.max(5, Math.min(300, rows | 0));
91
- if (p && p.exit === null) p.proc.terminal?.resize(c, r);
117
+ if (p && p.exit === null) WIN ? send(p, resizeSeq(c, r)) : p.proc.terminal?.resize(c, r);
92
118
  }
93
119
 
94
120
  export const ptyKeys = () => [...ptys.keys()];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaizen-agent",
3
- "version": "1.41.2",
3
+ "version": "1.41.3",
4
4
  "description": "Staged workflow for AI agents — code, writing, research, operations: plan, human approval, build, independent review, bounded fix loop.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -168,8 +168,8 @@ agent:
168
168
  # Where the web board runs the agent it launches.
169
169
  # card - inside the board: the card's Terminal tab shows the agent live and
170
170
  # takes your typing. The agent lives in the board's process, so
171
- # stopping or upgrading the board ends it. Not on Windows, where it
172
- # falls back to a terminal window.
171
+ # stopping or upgrading the board ends it. On Windows it runs in
172
+ # a ConPTY console that Windows PowerShell hosts.
173
173
  # terminal - a new terminal window (or tmux/herdr tab) per launch.
174
174
  # The terminal dashboard always opens terminal windows.
175
175
  launch: card
package/web/board/dom.ts CHANGED
@@ -27,7 +27,11 @@ export function modal(html: string) {
27
27
  dl.className = "kz";
28
28
  dl.innerHTML = `<form class="inl" method="dialog">${html}</form>`;
29
29
  dl.onclose = () => dl.remove();
30
- dl.onclick = (e) => e.target === dl && dl.close(); // a tap on the backdrop
30
+ // A tap on the backdrop. Braces matter: an on* handler that returns false cancels the click,
31
+ // which stopped every submit button inside the form.
32
+ dl.onclick = (e) => {
33
+ if (e.target === dl) dl.close();
34
+ };
31
35
  document.body.appendChild(dl);
32
36
  dl.showModal();
33
37
  return dl;
package/web/board.js CHANGED
@@ -1,5 +1,5 @@
1
- /* kaizen board 4c283dae7e7513b1 -- generated by bun run build:web from web/board/main.ts; do not edit */
2
- (()=>{var a={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,wantTerm:null,setQ:"",pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var n=(e)=>document.getElementById(e),p=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]),q=(e)=>`<svg><use href="#i-${e}"/></svg>`,ht='<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>",mt=(e)=>Promise.all(e.map((t)=>new Promise((o)=>{let r=new FileReader;r.onload=()=>o({name:t.name,data:r.result}),r.readAsDataURL(t)})));function gt(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(o)=>o.target===t&&t.close(),document.body.appendChild(t),t.showModal(),t}var kn;function S(e,t){let o=n("toast");if(o.textContent=e,o.classList.toggle("rep",!!t),t){let r=document.createElement("a");r.href="/issue?"+new URLSearchParams(t),r.target="_blank",r.rel="noopener",r.textContent="Report",o.append(" ",r)}o.classList.add("on"),clearTimeout(kn),kn=setTimeout(()=>o.classList.remove("on"),t?8000:4000)}function ve(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}function wn(e){try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png"})}catch(t){}}var ms="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",$n={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},Ot=null,gs=`import{pipeline}from"${ms}";let asr=null;
1
+ /* kaizen board 140abfe2c22a426a -- generated by bun run build:web from web/board/main.ts; do not edit */
2
+ (()=>{var a={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,wantTerm:null,setQ:"",pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var n=(e)=>document.getElementById(e),p=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]),q=(e)=>`<svg><use href="#i-${e}"/></svg>`,ht='<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>",mt=(e)=>Promise.all(e.map((t)=>new Promise((o)=>{let r=new FileReader;r.onload=()=>o({name:t.name,data:r.result}),r.readAsDataURL(t)})));function gt(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(o)=>{if(o.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var kn;function S(e,t){let o=n("toast");if(o.textContent=e,o.classList.toggle("rep",!!t),t){let r=document.createElement("a");r.href="/issue?"+new URLSearchParams(t),r.target="_blank",r.rel="noopener",r.textContent="Report",o.append(" ",r)}o.classList.add("on"),clearTimeout(kn),kn=setTimeout(()=>o.classList.remove("on"),t?8000:4000)}function ve(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}function wn(e){try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png"})}catch(t){}}var ms="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",$n={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},Ot=null,gs=`import{pipeline}from"${ms}";let asr=null;
3
3
  onmessage=async e=>{const m=e.data;try{
4
4
  if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
5
5
  // WebGPU first, with the encoder in fp16 only where the adapter has shader-f16; any GPU failure falls back to the CPU.
package/web/notebook.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen notebook 4c283dae7e7513b1 -- generated by bun run build:web from web/notebook.ts; do not edit */
1
+ /* kaizen notebook 140abfe2c22a426a -- generated by bun run build:web from web/notebook.ts; do not edit */
2
2
  var Ss=[],ua=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map((t)=>t?parseInt(t,36):1);for(let t=0,i=0;t<e.length;t++)(t%2?ua:Ss).push(i=i+e[t])})();function op(e){if(e<768)return!1;for(let t=0,i=Ss.length;;){let n=t+i>>1;if(e<Ss[n])i=n;else if(e>=ua[n])t=n+1;else return!0;if(t==i)return!1}}function ha(e){return e>=127462&&e<=127487}var fa=8205;function da(e,t,i=!0,n=!0){return(i?Oa:lp)(e,t,n)}function Oa(e,t,i){if(t==e.length)return t;if(t&&pa(e.charCodeAt(t))&&ma(e.charCodeAt(t-1)))t--;let n=bs(e,t);t+=ca(n);while(t<e.length){let r=bs(e,t);if(n==fa||r==fa||i&&op(r))t+=ca(r),n=r;else if(ha(r)){let s=0,o=t-2;while(o>=0&&ha(bs(e,o)))s++,o-=2;if(s%2==0)break;else t+=2}else break}return t}function lp(e,t,i){while(t>1){let n=Oa(e,t-2,i);if(n<t)return n;t--}return 0}function bs(e,t){let i=e.charCodeAt(t);if(!ma(i)||t+1==e.length)return i;let n=e.charCodeAt(t+1);if(!pa(n))return i;return(i-55296<<10)+(n-56320)+65536}function pa(e){return e>=56320&&e<57344}function ma(e){return e>=55296&&e<56320}function ca(e){return e<65536?1:2}class _{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=vi(this,e,t);let n=[];if(this.decompose(0,e,n,2),i.length)i.decompose(0,i.length,n,3);return this.decompose(t,this.length,n,1),ft.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vi(this,e,t);let i=[];return this.decompose(e,t,i,0),ft.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new wi(this),r=new wi(e);for(let s=t,o=t;;){if(n.next(s),r.next(s),s=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new wi(this,e)}iterRange(e,t=this.length){return new Ts(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{if(t==null)t=this.lines+1;let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new As(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return _.empty;return e.length<=32?new oe(e):ft.from(oe.split(e,[]))}}class oe extends _{constructor(e,t=ap(e)){super();this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let r=0;;r++){let s=this.text[r],o=n+s.length;if((t?i:o)>=e)return new ka(n,o,i,s);n=o+1,i++}}decompose(e,t,i,n){let r=e<=0&&t>=this.length?this:new oe(ga(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let s=i.pop(),o=cr(r.text,s.text.slice(),0,r.length);if(o.length<=32)i.push(new oe(o,s.length+r.length));else{let l=o.length>>1;i.push(new oe(o.slice(0,l)),new oe(o.slice(l)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof oe))return super.replace(e,t,i);[e,t]=vi(this,e,t);let n=cr(this.text,cr(i.text,ga(this.text,0,e)),t),r=this.length+i.length-(t-e);if(n.length<=32)return new oe(n,r);return ft.from(oe.split(n,[]),r)}sliceString(e,t=this.length,i=`
3
3
  `){[e,t]=vi(this,e,t);let n="";for(let r=0,s=0;r<=t&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;if(r>e&&s)n+=i;if(e<l&&t>r)n+=o.slice(Math.max(0,e-r),t-r);r=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let r of e)if(i.push(r),n+=r.length+1,i.length==32)t.push(new oe(i,n)),i=[],n=-1;if(n>-1)t.push(new oe(i,n));return t}}class ft extends _{constructor(e,t){super();this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let r=0;;r++){let s=this.children[r],o=n+s.length,l=i+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,i,n);n=o+1,i=l+1}}decompose(e,t,i,n){for(let r=0,s=0;s<=t&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e<=l&&t>=s){let a=n&((s<=e?1:0)|(l>=t?2:0));if(s>=e&&l<=t&&!a)i.push(o);else o.decompose(e-s,t-s,i,a)}s=l+1}}replace(e,t,i){if([e,t]=vi(this,e,t),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],o=r+s.length;if(e>=r&&t<=o){let l=s.replace(e-r,t-r,i),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let h=this.children.slice();return h[n]=l,new ft(h,this.length-(t-e)+i.length)}return super.replace(r,o,l)}r=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
4
4
  `){[e,t]=vi(this,e,t);let n="";for(let r=0,s=0;r<this.children.length&&s<=t;r++){let o=this.children[r],l=s+o.length;if(s>e&&r)n+=i;if(e<l&&t>s)n+=o.sliceString(e-s,t-s,i);s=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ft))return 0;let i=0,[n,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==s||r==o)return i;let l=this.children[n],a=e.children[r];if(l!=a)return i+l.scanIdentical(a,t);i+=l.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let d of e)d.flatten(u);return new oe(u,t)}let n=Math.max(32,i>>5),r=n<<1,s=n>>1,o=[],l=0,a=-1,h=[];function f(u){let d;if(u.lines>r&&u instanceof ft)for(let O of u.children)f(O);else if(u.lines>s&&(l>s||!l))c(),o.push(u);else if(u instanceof oe&&l&&(d=h[h.length-1])instanceof oe&&u.lines+d.lines<=32)l+=u.lines,a+=u.length+1,h[h.length-1]=new oe(d.text.concat(u.text),d.length+1+u.length);else{if(l+u.lines>n)c();l+=u.lines,a+=u.length+1,h.push(u)}}function c(){if(l==0)return;o.push(h.length==1?h[0]:ft.from(h,a)),a=-1,l=h.length=0}for(let u of e)f(u);return c(),o.length==1?o[0]:new ft(o,t)}}_.empty=new oe([""],0);function ap(e){let t=-1;for(let i of e)t+=i.length+1;return t}function cr(e,t,i=0,n=1e9){for(let r=0,s=0,o=!0;s<e.length&&r<=n;s++){let l=e[s],a=r+l.length;if(a>=i){if(a>n)l=l.slice(0,n-r);if(r<i)l=l.slice(i-r);if(o)t[t.length-1]+=l,o=!1;else t.push(l)}r=a+1}return t}function ga(e,t,i){return cr(e,[""],t,i)}class wi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof oe?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=!1;for(;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],s=r>>1,o=n instanceof oe?n.text.length:n.children.length;if(s==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;if(t>0)this.offsets[i-1]++;this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
package/web/term.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen terminal 4c283dae7e7513b1 -- generated by bun run build:web from web/term.ts; do not edit */
1
+ /* kaizen terminal 140abfe2c22a426a -- generated by bun run build:web from web/term.ts; do not edit */
2
2
  (()=>{var{defineProperty:io,getOwnPropertyDescriptor:ih}=Object,sh=(e,t)=>{for(var i in t)io(e,i,{get:t[i],enumerable:!0})},re=(e,t,i,s)=>{for(var r=s>1?void 0:s?ih(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&io(t,i,r),r},T=(e,t)=>(i,s)=>t(i,s,e),Jr="Terminal input",Fs={get:()=>Jr,set:(e)=>Jr=e},Qr="Too much output to announce, navigate to rows manually to read",Ws={get:()=>Qr,set:(e)=>Qr=e};function rh(e){return e.replace(/\r?\n/g,"\r")}function nh(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function oh(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function ah(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");so(r,t,i,s)}}function so(e,t,i,s){e=rh(e),e=nh(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function ro(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function en(e,t,i,s,r){ro(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Lt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function es(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var hh=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},lh=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,l=0,h=0;if(this.interim[0]){let u=!1,_=this.interim[0];_&=(_&224)===192?31:(_&240)===224?15:7;let g=0,v;for(;(v=this.interim[++g]&63)&&g<4;)_<<=6,_|=v;let k=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=k-g;for(;h<A;){if(h>=i)return 0;if(v=e[h++],(v&192)!==128){h--,u=!0;break}else this.interim[g++]=v,_<<=6,_|=v&63}u||(k===2?_<128?h--:t[s++]=_:k===3?_<2048||_>=55296&&_<=57343||_===65279||(t[s++]=_):_<65536||_>1114111||(t[s++]=_)),this.interim.fill(0)}let c=i-4,d=h;for(;d<i;){for(;d<c&&!((r=e[d])&128)&&!((n=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,d+=4;if(r=e[d++],r<128)t[s++]=r;else if((r&224)===192){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(l=(r&31)<<6|n&63,l<128){d--;continue}t[s++]=l}else if((r&240)===224){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(l=(r&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[s++]=l}else if((r&248)===240){if(d>=i)return this.interim[0]=r,s;if(n=e[d++],(n&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[d++],(a&192)!==128){d--;continue}if(l=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[s++]=l}}return s}},no="",Et=" ",Si=class e{constructor(){this.fg=0,this.bg=0,this.extended=new qi}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},qi=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ve=class e extends Si{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new qi,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Lt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},tn="di$target",zs="di$dependencies",Cs=new Map;function ch(e){return e[zs]||[]}function we(e){if(Cs.has(e))return Cs.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");dh(t,i,r)};return t._id=e,Cs.set(e,t),t}function dh(e,t,i){t[tn]===t?t[zs].push({id:e,index:i}):(t[zs]=[{id:e,index:i}],t[tn]=t)}var De=we("BufferService"),oo=we("CoreMouseService"),zt=we("CoreService"),uh=we("CharsetService"),fr=we("InstantiationService"),ao=we("LogService"),Ae=we("OptionsService"),ho=we("OscLinkService"),_h=we("UnicodeService"),wi=we("DecorationService"),Hs=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Ve,o=i.getTrimmedLength(),a=-1,l=-1,h=!1;for(let c=0;c<o;c++)if(!(l===-1&&!i.hasContent(c))){if(i.loadCell(c,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=c,a=n.extended.urlId;continue}else h=n.extended.urlId!==a;else l!==-1&&(h=!0);if(h||l!==-1&&c===o-1){let d=this._oscLinkService.getLinkData(a)?.uri;if(d){let u={start:{x:l+1,y:e},end:{x:c+(!h&&c===o-1?1:0),y:e}},_=!1;if(!r?.allowNonHttpProtocols)try{let g=new URL(d);["http:","https:"].includes(g.protocol)||(_=!0)}catch{_=!0}_||s.push({text:d,range:u,activate:(g,v)=>r?r.activate(g,v,u):fh(g,v),hover:(g,v)=>r?.hover?.(g,v,u),leave:(g,v)=>r?.leave?.(g,v,u)})}h=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=c,a=n.extended.urlId):(l=-1,a=-1)}}t(s)}};Hs=re([T(0,De),T(1,Ae),T(2,ho)],Hs);function fh(e,t){if(confirm(`Do you want to navigate to ${t}?
3
3
 
4
4
  WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var ts=we("CharSizeService"),ct=we("CoreBrowserService"),gr=we("MouseService"),dt=we("RenderService"),gh=we("SelectionService"),lo=we("CharacterJoinerService"),Vt=we("ThemeService"),co=we("LinkProviderService"),ph=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?sn.isErrorNoTelemetry(e)?new sn(e.message+`