@hachej/boring-workspace 0.1.10 → 0.1.13

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.
@@ -1,13 +1,13 @@
1
1
  var Lr = Object.defineProperty;
2
2
  var _r = (e, t, n) => t in e ? Lr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var q = (e, t, n) => _r(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsx as c, jsxs as x, Fragment as De } from "react/jsx-runtime";
3
+ var V = (e, t, n) => _r(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { jsx as c, jsxs as S, Fragment as De } from "react/jsx-runtime";
5
5
  import { useRef as _, useMemo as J, useContext as ue, createContext as Pe, useSyncExternalStore as Tt, useState as L, useCallback as E, Component as Or, useEffect as $, lazy as Qe, createElement as ve, Suspense as lt } from "react";
6
6
  import { AlertTriangleIcon as Mr, ImageIcon as Te, FileTextIcon as fe, FileJsonIcon as qt, FileCodeIcon as ie, FileIcon as He, Loader2 as jr, X as Cn, FolderTree as ct, Plus as Wr, ChevronLeft as En, PanelLeft as zr, Search as Vt, ChevronRight as Nn, TerminalIcon as mt, ClockIcon as Ur, ArrowUp as Br, ArrowDown as qr, CornerDownLeft as Vr } from "lucide-react";
7
7
  import { Notice as Tn, IconButton as me, LoadingState as Hr, Input as An, toast as Se, ErrorState as ze, Skeleton as Kr, Spinner as ut, Button as ke, AlertDialog as Gr, AlertDialogContent as Yr, AlertDialogHeader as Jr, AlertDialogTitle as Qr, AlertDialogDescription as Xr, AlertDialogFooter as Zr, AlertDialogCancel as eo, AlertDialogAction as to, EmptyState as In, Kbd as je, Tabs as no, TabsList as ro, TabsTrigger as oo, Toaster as so, Dialog as io, DialogContent as ao, DialogHeader as co, DialogTitle as lo, DialogDescription as uo, Command as fo, CommandInput as mo, CommandList as po, CommandEmpty as ho, CommandGroup as pt, CommandItem as Be, CommandShortcut as go } from "@hachej/boring-ui-kit";
8
8
  import { useStore as Ce, create as yo } from "zustand";
9
9
  import { persist as vo } from "zustand/middleware";
10
- import { z as B } from "zod";
10
+ import { z as q } from "zod";
11
11
  import { useQueryClient as Dn, QueryClient as bo, QueryClientProvider as wo, useQuery as At, useMutation as dt } from "@tanstack/react-query";
12
12
  import { c as ce } from "./utils-B6yFEsav.js";
13
13
  import { DockviewReact as So } from "dockview-react";
@@ -34,17 +34,17 @@ const Ht = /* @__PURE__ */ new Set([
34
34
  "surface-resolver",
35
35
  "agent-tool"
36
36
  ]);
37
- function K(e, t) {
37
+ function G(e, t) {
38
38
  throw new St("validation", `plugin "${e}": ${t}`);
39
39
  }
40
40
  function Fn(e, t) {
41
41
  const n = /* @__PURE__ */ new Set();
42
42
  for (let r = 0; r < t.length; r++) {
43
43
  const o = t[r];
44
- (!o.id || typeof o.id != "string") && K(e, `panels[${r}].id must be a non-empty string`), n.has(o.id) && K(e, `panels[${r}].id "${o.id}" is duplicated within this plugin`), n.add(o.id), o.placement && !Ht.has(o.placement) && K(
44
+ (!o.id || typeof o.id != "string") && G(e, `panels[${r}].id must be a non-empty string`), n.has(o.id) && G(e, `panels[${r}].id "${o.id}" is duplicated within this plugin`), n.add(o.id), o.placement && !Ht.has(o.placement) && G(
45
45
  e,
46
46
  `panels[${r}].placement must be one of ${[...Ht].join(", ")} (got: "${o.placement}")`
47
- ), typeof o.component != "function" && K(
47
+ ), typeof o.component != "function" && G(
48
48
  e,
49
49
  `panels[${r}].component must be a ComponentType or lazy factory (got: ${typeof o.component})`
50
50
  );
@@ -54,13 +54,13 @@ function $n(e, t) {
54
54
  const n = /* @__PURE__ */ new Set();
55
55
  for (let r = 0; r < t.length; r++) {
56
56
  const o = t[r];
57
- if ((!o.id || typeof o.id != "string") && K(e, `commands[${r}].id must be a non-empty string`), n.has(o.id) && K(e, `commands[${r}].id "${o.id}" is duplicated within this plugin`), n.add(o.id), typeof o.run != "function" && K(
57
+ if ((!o.id || typeof o.id != "string") && G(e, `commands[${r}].id must be a non-empty string`), n.has(o.id) && G(e, `commands[${r}].id "${o.id}" is duplicated within this plugin`), n.add(o.id), typeof o.run != "function" && G(
58
58
  e,
59
59
  `commands[${r}].run must be a function (got: ${typeof o.run})`
60
60
  ), o.keywords !== void 0) {
61
- Array.isArray(o.keywords) || K(e, `commands[${r}].keywords must be an array when provided`);
61
+ Array.isArray(o.keywords) || G(e, `commands[${r}].keywords must be an array when provided`);
62
62
  for (let s = 0; s < o.keywords.length; s++)
63
- (!o.keywords[s] || typeof o.keywords[s] != "string") && K(
63
+ (!o.keywords[s] || typeof o.keywords[s] != "string") && G(
64
64
  e,
65
65
  `commands[${r}].keywords[${s}] must be a non-empty string`
66
66
  );
@@ -72,10 +72,10 @@ function Rn(e, t) {
72
72
  const n = /* @__PURE__ */ new Set();
73
73
  for (let o = 0; o < t.length; o++) {
74
74
  const s = t[o];
75
- (!s.id || typeof s.id != "string") && K(e, `catalogs[${o}].id must be a non-empty string`), n.has(s.id) && K(e, `catalogs[${o}].id "${s.id}" is duplicated within this plugin`), n.add(s.id), (!s.adapter || typeof s.adapter != "object" || typeof s.adapter.search != "function") && K(
75
+ (!s.id || typeof s.id != "string") && G(e, `catalogs[${o}].id must be a non-empty string`), n.has(s.id) && G(e, `catalogs[${o}].id "${s.id}" is duplicated within this plugin`), n.add(s.id), (!s.adapter || typeof s.adapter != "object" || typeof s.adapter.search != "function") && G(
76
76
  e,
77
77
  `catalogs[${o}].adapter.search must be a function (got: ${typeof ((r = s.adapter) == null ? void 0 : r.search)})`
78
- ), typeof s.onSelect != "function" && K(
78
+ ), typeof s.onSelect != "function" && G(
79
79
  e,
80
80
  `catalogs[${o}].onSelect must be a function (got: ${typeof s.onSelect})`
81
81
  );
@@ -83,7 +83,7 @@ function Rn(e, t) {
83
83
  }
84
84
  function Ln(e, t) {
85
85
  for (let n = 0; n < t.length; n++)
86
- xo(t[n]) || K(
86
+ xo(t[n]) || G(
87
87
  e,
88
88
  `agentTools[${n}] is not a valid AgentTool (missing required fields: name, description, parameters, execute)`
89
89
  );
@@ -95,14 +95,14 @@ function xo(e) {
95
95
  }
96
96
  function xt(e, t) {
97
97
  for (let n = 0; n < t.length; n++)
98
- typeof t[n] != "function" && K(e, `bindings[${n}] must be a component function (got: ${typeof t[n]})`);
98
+ typeof t[n] != "function" && G(e, `bindings[${n}] must be a component function (got: ${typeof t[n]})`);
99
99
  }
100
100
  function ko(e, t, n) {
101
101
  const r = t.resolver;
102
- (!r || typeof r != "object") && K(e, `outputs[${n}].resolver must be an object`), (!r.id || typeof r.id != "string") && K(e, `outputs[${n}].resolver.id must be a non-empty string`), typeof r.resolve != "function" && K(e, `outputs[${n}].resolver.resolve must be a function`);
102
+ (!r || typeof r != "object") && G(e, `outputs[${n}].resolver must be an object`), (!r.id || typeof r.id != "string") && G(e, `outputs[${n}].resolver.id must be a non-empty string`), typeof r.resolve != "function" && G(e, `outputs[${n}].resolver.resolve must be a function`);
103
103
  }
104
104
  function Po(e, t, n) {
105
- (!t.id || typeof t.id != "string") && K(e, `outputs[${n}].id must be a non-empty string`), (!t.title || typeof t.title != "string") && K(e, `outputs[${n}].title must be a non-empty string`), typeof t.component != "function" && K(
105
+ (!t.id || typeof t.id != "string") && G(e, `outputs[${n}].id must be a non-empty string`), (!t.title || typeof t.title != "string") && G(e, `outputs[${n}].title must be a non-empty string`), typeof t.component != "function" && G(
106
106
  e,
107
107
  `outputs[${n}].component must be a ComponentType or lazy factory (got: ${typeof t.component})`
108
108
  );
@@ -133,41 +133,41 @@ function Eo(e, t) {
133
133
  const n = /* @__PURE__ */ new Set();
134
134
  for (let r = 0; r < t.length; r++) {
135
135
  const o = t[r];
136
- (!o || typeof o != "object") && K(e, `outputs[${r}] must be an object`), Kt.has(o.type) || K(
136
+ (!o || typeof o != "object") && G(e, `outputs[${r}] must be an object`), Kt.has(o.type) || G(
137
137
  e,
138
138
  `outputs[${r}].type must be one of ${[...Kt].join(", ")} (got: "${o.type}")`
139
139
  );
140
140
  const s = Co(o, r);
141
- switch (n.has(s) && K(e, `outputs[${r}] "${s}" is duplicated within this plugin`), n.add(s), o.type) {
141
+ switch (n.has(s) && G(e, `outputs[${r}] "${s}" is duplicated within this plugin`), n.add(s), o.type) {
142
142
  case "left-tab":
143
143
  Po(e, o, r);
144
144
  break;
145
145
  case "panel":
146
- (!o.panel || typeof o.panel != "object") && K(e, `outputs[${r}].panel must be an object`), Fn(e, [o.panel]);
146
+ (!o.panel || typeof o.panel != "object") && G(e, `outputs[${r}].panel must be an object`), Fn(e, [o.panel]);
147
147
  break;
148
148
  case "command":
149
- (!o.command || typeof o.command != "object") && K(e, `outputs[${r}].command must be an object`), $n(e, [o.command]);
149
+ (!o.command || typeof o.command != "object") && G(e, `outputs[${r}].command must be an object`), $n(e, [o.command]);
150
150
  break;
151
151
  case "catalog":
152
- (!o.catalog || typeof o.catalog != "object") && K(e, `outputs[${r}].catalog must be an object`), Rn(e, [o.catalog]);
152
+ (!o.catalog || typeof o.catalog != "object") && G(e, `outputs[${r}].catalog must be an object`), Rn(e, [o.catalog]);
153
153
  break;
154
154
  case "binding":
155
- (!o.id || typeof o.id != "string") && K(e, `outputs[${r}].id must be a non-empty string`), xt(e, [o.component]);
155
+ (!o.id || typeof o.id != "string") && G(e, `outputs[${r}].id must be a non-empty string`), xt(e, [o.component]);
156
156
  break;
157
157
  case "provider":
158
- (!o.id || typeof o.id != "string") && K(e, `outputs[${r}].id must be a non-empty string`), xt(e, [o.component]);
158
+ (!o.id || typeof o.id != "string") && G(e, `outputs[${r}].id must be a non-empty string`), xt(e, [o.component]);
159
159
  break;
160
160
  case "surface-resolver":
161
161
  ko(e, o, r);
162
162
  break;
163
163
  case "agent-tool":
164
- (!o.id || typeof o.id != "string") && K(e, `outputs[${r}].id must be a non-empty string`), Ln(e, [o.tool]);
164
+ (!o.id || typeof o.id != "string") && G(e, `outputs[${r}].id must be a non-empty string`), Ln(e, [o.tool]);
165
165
  break;
166
166
  }
167
167
  }
168
168
  }
169
169
  function No(e) {
170
- (!e.id || typeof e.id != "string") && K(e.id ?? "<unknown>", "id must be a non-empty string"), e.panels && Fn(e.id, e.panels), e.commands && $n(e.id, e.commands), e.catalogs && Rn(e.id, e.catalogs), e.bindings && xt(e.id, e.bindings), e.agentTools && Ln(e.id, e.agentTools), e.outputs && Eo(e.id, e.outputs);
170
+ (!e.id || typeof e.id != "string") && G(e.id ?? "<unknown>", "id must be a non-empty string"), e.panels && Fn(e.id, e.panels), e.commands && $n(e.id, e.commands), e.catalogs && Rn(e.id, e.catalogs), e.bindings && xt(e.id, e.bindings), e.agentTools && Ln(e.id, e.agentTools), e.outputs && Eo(e.id, e.outputs);
171
171
  }
172
172
  function To(e) {
173
173
  return No(e), Object.assign({}, e);
@@ -269,14 +269,14 @@ function Do() {
269
269
  }
270
270
  class _n {
271
271
  constructor(t = {}) {
272
- q(this, "catalogs", /* @__PURE__ */ new Map());
273
- q(this, "listeners", /* @__PURE__ */ new Set());
274
- q(this, "snapshotCache", null);
275
- q(this, "warnOnDuplicate");
276
- q(this, "subscribe", (t) => (this.listeners.add(t), () => {
272
+ V(this, "catalogs", /* @__PURE__ */ new Map());
273
+ V(this, "listeners", /* @__PURE__ */ new Set());
274
+ V(this, "snapshotCache", null);
275
+ V(this, "warnOnDuplicate");
276
+ V(this, "subscribe", (t) => (this.listeners.add(t), () => {
277
277
  this.listeners.delete(t);
278
278
  }));
279
- q(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = Array.from(this.catalogs.values())), this.snapshotCache));
279
+ V(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = Array.from(this.catalogs.values())), this.snapshotCache));
280
280
  this.warnOnDuplicate = t.warnOnDuplicate ?? Do();
281
281
  }
282
282
  register(t, n) {
@@ -306,14 +306,14 @@ class _n {
306
306
  }
307
307
  class On {
308
308
  constructor() {
309
- q(this, "resolvers", /* @__PURE__ */ new Map());
310
- q(this, "registrationOrder", []);
311
- q(this, "listeners", /* @__PURE__ */ new Set());
312
- q(this, "snapshotCache", null);
313
- q(this, "subscribe", (t) => (this.listeners.add(t), () => {
309
+ V(this, "resolvers", /* @__PURE__ */ new Map());
310
+ V(this, "registrationOrder", []);
311
+ V(this, "listeners", /* @__PURE__ */ new Set());
312
+ V(this, "snapshotCache", null);
313
+ V(this, "subscribe", (t) => (this.listeners.add(t), () => {
314
314
  this.listeners.delete(t);
315
315
  }));
316
- q(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = this.list()), this.snapshotCache));
316
+ V(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = this.list()), this.snapshotCache));
317
317
  }
318
318
  register(t, n) {
319
319
  const r = this.resolvers.has(t);
@@ -414,8 +414,8 @@ function _o({ pluginId: e, message: t, kind: n }) {
414
414
  tone: "error",
415
415
  icon: /* @__PURE__ */ c(Mr, { className: "size-4" }),
416
416
  className: "py-2",
417
- description: /* @__PURE__ */ x("span", { className: "block min-w-0 truncate", children: [
418
- /* @__PURE__ */ x("span", { className: "font-medium", children: [
417
+ description: /* @__PURE__ */ S("span", { className: "block min-w-0 truncate", children: [
418
+ /* @__PURE__ */ S("span", { className: "font-medium", children: [
419
419
  "[",
420
420
  e,
421
421
  "]"
@@ -446,7 +446,7 @@ function mc() {
446
446
  class ft extends Or {
447
447
  constructor() {
448
448
  super(...arguments);
449
- q(this, "state", { error: null });
449
+ V(this, "state", { error: null });
450
450
  }
451
451
  static getDerivedStateFromError(n) {
452
452
  return { error: n };
@@ -474,19 +474,19 @@ class ft extends Or {
474
474
  ) : this.props.children;
475
475
  }
476
476
  }
477
- q(ft, "contextType", Ft);
477
+ V(ft, "contextType", Ft);
478
478
  function Mo(e, t) {
479
479
  return e.split(`
480
480
  `).filter((r) => r.trim()).slice(0, t).join(`
481
481
  `);
482
482
  }
483
- const jo = 1024, Wo = 500, zo = /^[a-zA-Z0-9_-]+$/, Uo = 64, et = 50, Gt = 16384, $t = B.string().min(1).max(jo).refine((e) => !e.includes(".."), "path traversal not allowed").refine((e) => !e.includes("\0"), "null bytes not allowed"), Bo = B.object({
483
+ const jo = 1024, Wo = 500, zo = /^[a-zA-Z0-9_-]+$/, Uo = 64, et = 50, Gt = 16384, $t = q.string().min(1).max(jo).refine((e) => !e.includes(".."), "path traversal not allowed").refine((e) => !e.includes("\0"), "null bytes not allowed"), Bo = q.object({
484
484
  path: $t,
485
- mode: B.enum(["view", "edit", "diff"]).optional()
486
- }), qo = B.object({
487
- id: B.string().max(Uo).regex(zo, "invalid panel ID"),
488
- component: B.string().min(1),
489
- params: B.record(B.unknown()).optional().refine(
485
+ mode: q.enum(["view", "edit", "diff"]).optional()
486
+ }), qo = q.object({
487
+ id: q.string().max(Uo).regex(zo, "invalid panel ID"),
488
+ component: q.string().min(1),
489
+ params: q.record(q.unknown()).optional().refine(
490
490
  (e) => {
491
491
  if (!e) return !0;
492
492
  try {
@@ -497,16 +497,16 @@ const jo = 1024, Wo = 500, zo = /^[a-zA-Z0-9_-]+$/, Uo = 64, et = 50, Gt = 16384
497
497
  },
498
498
  `params must be JSON-serializable and under ${Gt} bytes`
499
499
  ),
500
- title: B.string().max(200).optional()
501
- }), Vo = B.object({
502
- id: B.string().min(1)
503
- }), Ho = B.object({
504
- msg: B.string().max(Wo),
505
- level: B.enum(["info", "warn", "error"]).optional()
506
- }), Ko = B.object({
500
+ title: q.string().max(200).optional()
501
+ }), Vo = q.object({
502
+ id: q.string().min(1)
503
+ }), Ho = q.object({
504
+ msg: q.string().max(Wo),
505
+ level: q.enum(["info", "warn", "error"]).optional()
506
+ }), Ko = q.object({
507
507
  file: $t,
508
- line: B.number().int().positive()
509
- }), Go = B.object({
508
+ line: q.number().int().positive()
509
+ }), Go = q.object({
510
510
  path: $t
511
511
  });
512
512
  function Yo(e) {
@@ -692,31 +692,31 @@ function Zo(e) {
692
692
  onConnectionChange: d
693
693
  } = e;
694
694
  let i = null, u = null, m = null, p = null, g = !1, N = !1, T = 0;
695
- function R(S) {
696
- N || g !== S && (g = S, d == null || d(S));
695
+ function R(O) {
696
+ N || g !== O && (g = O, d == null || d(O));
697
697
  }
698
- async function v(S) {
698
+ async function v(O) {
699
699
  if (N) return;
700
- const j = Xo(r, S);
700
+ const U = Xo(r, O);
701
701
  try {
702
702
  const A = await fetch(`${t}/api/v1/ui/state`, {
703
703
  method: "PUT",
704
704
  headers: Yt(o),
705
- body: JSON.stringify(j)
705
+ body: JSON.stringify(U)
706
706
  });
707
707
  if (N) return;
708
708
  (A.status === 401 || A.status === 403) && (f == null || f(A.status));
709
709
  } catch {
710
710
  }
711
711
  }
712
- function C(S) {
712
+ function P(O) {
713
713
  m !== null && clearTimeout(m), m = setTimeout(() => {
714
- m = null, v(S);
714
+ m = null, v(O);
715
715
  }, Jo);
716
716
  }
717
- function D(S, j) {
717
+ function D(O, U) {
718
718
  if (!N)
719
- switch (S) {
719
+ switch (O) {
720
720
  case "init": {
721
721
  R(!0), v("restore");
722
722
  break;
@@ -724,7 +724,7 @@ function Zo(e) {
724
724
  case "command": {
725
725
  let A;
726
726
  try {
727
- A = JSON.parse(j);
727
+ A = JSON.parse(U);
728
728
  } catch {
729
729
  return;
730
730
  }
@@ -740,7 +740,7 @@ function Zo(e) {
740
740
  case "error": {
741
741
  let A;
742
742
  try {
743
- A = JSON.parse(j);
743
+ A = JSON.parse(U);
744
744
  } catch {
745
745
  return;
746
746
  }
@@ -754,38 +754,38 @@ function Zo(e) {
754
754
  }
755
755
  }
756
756
  function W() {
757
- const S = `${t}/api/v1/ui/commands/next`, j = new EventSource(S, { withCredentials: !0 });
758
- j.addEventListener("init", (A) => {
757
+ const O = `${t}/api/v1/ui/commands/next`, U = new EventSource(O, { withCredentials: !0 });
758
+ U.addEventListener("init", (A) => {
759
759
  D("init", A.data);
760
- }), j.addEventListener("command", (A) => {
760
+ }), U.addEventListener("command", (A) => {
761
761
  D("command", A.data);
762
- }), j.addEventListener("error", (A) => {
762
+ }), U.addEventListener("error", (A) => {
763
763
  A.data ? D("error", A.data) : R(!1);
764
- }), j.addEventListener("heartbeat", (A) => {
764
+ }), U.addEventListener("heartbeat", (A) => {
765
765
  D("heartbeat", A.data);
766
- }), i = j;
766
+ }), i = U;
767
767
  }
768
- async function U() {
768
+ async function z() {
769
769
  if (!N)
770
770
  try {
771
- const S = `${t}/api/v1/ui/commands/next?poll=true`, j = await fetch(S, { headers: Yt(o) });
771
+ const O = `${t}/api/v1/ui/commands/next?poll=true`, U = await fetch(O, { headers: Yt(o) });
772
772
  if (N) return;
773
- if (j.status === 401 || j.status === 403) {
774
- f == null || f(j.status);
773
+ if (U.status === 401 || U.status === 403) {
774
+ f == null || f(U.status);
775
775
  return;
776
776
  }
777
- if (!j.ok) return;
778
- const A = await j.json();
777
+ if (!U.ok) return;
778
+ const A = await U.json();
779
779
  if (!Array.isArray(A)) return;
780
- for (const G of A) {
780
+ for (const C of A) {
781
781
  if (N) return;
782
- if (G.v !== 1) {
783
- a == null || a(G.v);
782
+ if (C.v !== 1) {
783
+ a == null || a(C.v);
784
784
  continue;
785
785
  }
786
786
  T++;
787
787
  try {
788
- await Jt(n, G.kind, G.params);
788
+ await Jt(n, C.kind, C.params);
789
789
  } finally {
790
790
  T--;
791
791
  }
@@ -795,22 +795,22 @@ function Zo(e) {
795
795
  R(!1);
796
796
  }
797
797
  }
798
- function ne() {
798
+ function re() {
799
799
  p = r.subscribe(() => {
800
800
  if (N) return;
801
- const S = T > 0 ? "agent" : "user";
802
- C(S);
801
+ const O = T > 0 ? "agent" : "user";
802
+ P(O);
803
803
  });
804
804
  }
805
805
  return {
806
806
  connect() {
807
- N = !1, !s && typeof EventSource < "u" ? W() : (U(), u = setInterval(U, l)), ne();
807
+ N = !1, !s && typeof EventSource < "u" ? W() : (z(), u = setInterval(z, l)), re();
808
808
  },
809
809
  disconnect() {
810
810
  i && (i.close(), i = null), u !== null && (clearInterval(u), u = null), m !== null && (clearTimeout(m), m = null), p && (p(), p = null), R(!1), N = !0;
811
811
  },
812
- pushState(S) {
813
- v(S);
812
+ pushState(O) {
813
+ v(O);
814
814
  }
815
815
  };
816
816
  }
@@ -958,14 +958,14 @@ function qe(e) {
958
958
  }
959
959
  function kt(e, t) {
960
960
  const n = _(t);
961
- n.current = t, $(() => V.on(e, (r) => n.current(r)), [e]);
961
+ n.current = t, $(() => H.on(e, (r) => n.current(r)), [e]);
962
962
  }
963
963
  function ds(e) {
964
- V.emit(pe.agentData, { ts: Date.now(), part: e });
964
+ H.emit(pe.agentData, { ts: Date.now(), part: e });
965
965
  }
966
- const V = rs(), fs = "boring-workspace:ui-command";
966
+ const H = rs(), fs = "boring-workspace:ui-command";
967
967
  function zn(e) {
968
- V.emit(pe.uiCommand, { ...Ue(), command: e }), typeof globalThis.dispatchEvent == "function" && typeof CustomEvent < "u" && globalThis.dispatchEvent(new CustomEvent(fs, { detail: e }));
968
+ H.emit(pe.uiCommand, { ...Ue(), command: e }), typeof globalThis.dispatchEvent == "function" && typeof CustomEvent < "u" && globalThis.dispatchEvent(new CustomEvent(fs, { detail: e }));
969
969
  }
970
970
  const ms = 1500, ps = 1e3, hs = 5;
971
971
  function Qt(e, t) {
@@ -979,13 +979,13 @@ function Qt(e, t) {
979
979
  function gs(e) {
980
980
  const t = e.endpoint ?? "", n = e.ctx, r = e.query, o = e.eventSourceCtor === null ? null : e.eventSourceCtor ?? (typeof EventSource < "u" ? EventSource : null), s = e.fetcher ?? (typeof fetch < "u" ? fetch : null), l = e.reconnectDelayMs ?? ps, f = e.maxReconnects ?? hs, a = e.pollIntervalMs ?? ms;
981
981
  let d = !1, i = null, u = null, m = null, p = null, g = 0, N = !1;
982
- function T(C) {
983
- C && typeof C == "object" && typeof C.kind == "string" && Wn(C, n);
982
+ function T(P) {
983
+ P && typeof P == "object" && typeof P.kind == "string" && Wn(P, n);
984
984
  }
985
985
  function R() {
986
986
  if (d || N || !s) return;
987
987
  N = !0;
988
- const C = async () => {
988
+ const P = async () => {
989
989
  if (!d) {
990
990
  m = new AbortController();
991
991
  try {
@@ -995,16 +995,16 @@ function gs(e) {
995
995
  if (d) return;
996
996
  if (D.ok) {
997
997
  const W = await D.json();
998
- if (Array.isArray(W)) for (const U of W) T(U);
998
+ if (Array.isArray(W)) for (const z of W) T(z);
999
999
  }
1000
1000
  } catch {
1001
1001
  } finally {
1002
1002
  m = null;
1003
1003
  }
1004
- d || (u = setTimeout(C, a));
1004
+ d || (u = setTimeout(P, a));
1005
1005
  }
1006
1006
  };
1007
- C();
1007
+ P();
1008
1008
  }
1009
1009
  function v() {
1010
1010
  if (!d) {
@@ -1012,8 +1012,8 @@ function gs(e) {
1012
1012
  R();
1013
1013
  return;
1014
1014
  }
1015
- i = new o(Qt(`${t}/api/v1/ui/commands/next`, r)), i.addEventListener("command", (C) => {
1016
- const D = C.data;
1015
+ i = new o(Qt(`${t}/api/v1/ui/commands/next`, r)), i.addEventListener("command", (P) => {
1016
+ const D = P.data;
1017
1017
  if (!(typeof D != "string" || D.length === 0))
1018
1018
  try {
1019
1019
  T(JSON.parse(D));
@@ -1045,13 +1045,13 @@ function ws(e) {
1045
1045
  }
1046
1046
  class Ss {
1047
1047
  constructor(t) {
1048
- q(this, "baseUrl");
1049
- q(this, "headers");
1050
- q(this, "onAuthError");
1051
- q(this, "onTimeout");
1052
- q(this, "timeout");
1053
- q(this, "maxRetries");
1054
- q(this, "retryBaseMs");
1048
+ V(this, "baseUrl");
1049
+ V(this, "headers");
1050
+ V(this, "onAuthError");
1051
+ V(this, "onTimeout");
1052
+ V(this, "timeout");
1053
+ V(this, "maxRetries");
1054
+ V(this, "retryBaseMs");
1055
1055
  this.baseUrl = t.apiBaseUrl.replace(/\/$/, ""), this.headers = { "Content-Type": "application/json", ...t.authHeaders }, this.onAuthError = t.onAuthError, this.onTimeout = t.onTimeout, this.timeout = t.timeout ?? ys, this.maxRetries = t.maxRetries ?? vs, this.retryBaseMs = t.retryBaseMs ?? bs;
1056
1056
  }
1057
1057
  async request(t, n, r, o, s) {
@@ -1197,7 +1197,7 @@ async function xs(e) {
1197
1197
  return null;
1198
1198
  }
1199
1199
  }
1200
- const ks = "filesystem:file.changed", Ps = "filesystem:file.created", Cs = "filesystem:file.moved", Es = "filesystem:file.deleted", te = {
1200
+ const ks = "filesystem:file.changed", Ps = "filesystem:file.created", Cs = "filesystem:file.moved", Es = "filesystem:file.deleted", ne = {
1201
1201
  changed: ks,
1202
1202
  created: Ps,
1203
1203
  moved: Cs,
@@ -1206,13 +1206,13 @@ const ks = "filesystem:file.changed", Ps = "filesystem:file.created", Cs = "file
1206
1206
  function Ts() {
1207
1207
  const e = Dn(), t = _e(), n = Oe();
1208
1208
  $(() => {
1209
- const r = V.on(te.changed, (f) => {
1209
+ const r = H.on(ne.changed, (f) => {
1210
1210
  Ve(e, t, n, f.path);
1211
- }), o = V.on(te.created, (f) => {
1211
+ }), o = H.on(ne.created, (f) => {
1212
1212
  ht(e, t, n), f.kind === "file" && Ve(e, t, n, f.path);
1213
- }), s = V.on(te.moved, (f) => {
1213
+ }), s = H.on(ne.moved, (f) => {
1214
1214
  ht(e, t, n), Ve(e, t, n, f.from), Ve(e, t, n, f.to), Zt(e, t, n);
1215
- }), l = V.on(te.deleted, (f) => {
1215
+ }), l = H.on(ne.deleted, (f) => {
1216
1216
  ht(e, t, n), Ve(e, t, n, f.path), Zt(e, t, n);
1217
1217
  });
1218
1218
  return () => {
@@ -1269,16 +1269,16 @@ function As() {
1269
1269
  function Is(e) {
1270
1270
  switch (e.op) {
1271
1271
  case "write":
1272
- V.emit(te.changed, { ...qe(), path: e.path });
1272
+ H.emit(ne.changed, { ...qe(), path: e.path });
1273
1273
  return;
1274
1274
  case "mkdir":
1275
- V.emit(te.created, { ...qe(), path: e.path, kind: "dir" });
1275
+ H.emit(ne.created, { ...qe(), path: e.path, kind: "dir" });
1276
1276
  return;
1277
1277
  case "unlink":
1278
- V.emit(te.deleted, { ...qe(), path: e.path });
1278
+ H.emit(ne.deleted, { ...qe(), path: e.path });
1279
1279
  return;
1280
1280
  case "rename":
1281
- e.oldPath ? V.emit(te.moved, { ...qe(), from: e.oldPath, to: e.path }) : V.emit(te.created, { ...qe(), path: e.path, kind: "file" });
1281
+ e.oldPath ? H.emit(ne.moved, { ...qe(), from: e.oldPath, to: e.path }) : H.emit(ne.created, { ...qe(), path: e.path, kind: "file" });
1282
1282
  return;
1283
1283
  }
1284
1284
  }
@@ -1329,7 +1329,7 @@ function Rs({
1329
1329
  () => o ?? new Ss({ apiBaseUrl: e, authHeaders: t, onAuthError: n, timeout: r }),
1330
1330
  [o, e, t, n, r]
1331
1331
  ), a = (t == null ? void 0 : t["x-boring-workspace-id"]) ?? (t == null ? void 0 : t["X-Boring-Workspace-Id"]) ?? null;
1332
- return /* @__PURE__ */ c(wo, { client: l.current, children: /* @__PURE__ */ c(Qn.Provider, { value: e, children: /* @__PURE__ */ c(Xn.Provider, { value: a, children: /* @__PURE__ */ x(Jn.Provider, { value: f, children: [
1332
+ return /* @__PURE__ */ c(wo, { client: l.current, children: /* @__PURE__ */ c(Qn.Provider, { value: e, children: /* @__PURE__ */ c(Xn.Provider, { value: a, children: /* @__PURE__ */ S(Jn.Provider, { value: f, children: [
1333
1333
  /* @__PURE__ */ c(Ls, {}),
1334
1334
  s
1335
1335
  ] }) }) }) });
@@ -1394,7 +1394,7 @@ function nr() {
1394
1394
  return dt({
1395
1395
  mutationFn: ({ path: t, content: n, expectedMtimeMs: r }) => e.writeFile(t, n, r != null ? { expectedMtimeMs: r } : void 0),
1396
1396
  onSuccess: (t, { path: n }) => {
1397
- V.emit(te.changed, { ...Ue(), path: n });
1397
+ H.emit(ne.changed, { ...Ue(), path: n });
1398
1398
  }
1399
1399
  });
1400
1400
  }
@@ -1403,7 +1403,7 @@ function zs() {
1403
1403
  return dt({
1404
1404
  mutationFn: ({ path: t }) => e.createDir(t),
1405
1405
  onSuccess: (t, { path: n }) => {
1406
- V.emit(te.created, { ...Ue(), path: n, kind: "dir" });
1406
+ H.emit(ne.created, { ...Ue(), path: n, kind: "dir" });
1407
1407
  }
1408
1408
  });
1409
1409
  }
@@ -1412,7 +1412,7 @@ function Us() {
1412
1412
  return dt({
1413
1413
  mutationFn: ({ from: t, to: n }) => e.moveFile(t, n),
1414
1414
  onSuccess: (t, { from: n, to: r }) => {
1415
- V.emit(te.moved, { ...Ue(), from: n, to: r });
1415
+ H.emit(ne.moved, { ...Ue(), from: n, to: r });
1416
1416
  }
1417
1417
  });
1418
1418
  }
@@ -1421,21 +1421,21 @@ function Bs() {
1421
1421
  return dt({
1422
1422
  mutationFn: ({ path: t }) => e.deleteFile(t),
1423
1423
  onSuccess: (t, { path: n }) => {
1424
- V.emit(te.deleted, { ...Ue(), path: n });
1424
+ H.emit(ne.deleted, { ...Ue(), path: n });
1425
1425
  }
1426
1426
  });
1427
1427
  }
1428
1428
  class qs {
1429
1429
  constructor(t = {}) {
1430
- q(this, "panels", /* @__PURE__ */ new Map());
1431
- q(this, "registrationOrder", []);
1432
- q(this, "capabilities");
1433
- q(this, "listeners", /* @__PURE__ */ new Set());
1434
- q(this, "snapshotCache", null);
1435
- q(this, "subscribe", (t) => (this.listeners.add(t), () => {
1430
+ V(this, "panels", /* @__PURE__ */ new Map());
1431
+ V(this, "registrationOrder", []);
1432
+ V(this, "capabilities");
1433
+ V(this, "listeners", /* @__PURE__ */ new Set());
1434
+ V(this, "snapshotCache", null);
1435
+ V(this, "subscribe", (t) => (this.listeners.add(t), () => {
1436
1436
  this.listeners.delete(t);
1437
1437
  }));
1438
- q(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = this.filteredPanels()), this.snapshotCache));
1438
+ V(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = this.filteredPanels()), this.snapshotCache));
1439
1439
  this.capabilities = new Set(
1440
1440
  Object.entries(t).filter(([, n]) => n).map(([n]) => n)
1441
1441
  );
@@ -1504,13 +1504,13 @@ function Vs() {
1504
1504
  }
1505
1505
  class Hs {
1506
1506
  constructor() {
1507
- q(this, "commands", /* @__PURE__ */ new Map());
1508
- q(this, "listeners", /* @__PURE__ */ new Set());
1509
- q(this, "snapshotCache", null);
1510
- q(this, "subscribe", (t) => (this.listeners.add(t), () => {
1507
+ V(this, "commands", /* @__PURE__ */ new Map());
1508
+ V(this, "listeners", /* @__PURE__ */ new Set());
1509
+ V(this, "snapshotCache", null);
1510
+ V(this, "subscribe", (t) => (this.listeners.add(t), () => {
1511
1511
  this.listeners.delete(t);
1512
1512
  }));
1513
- q(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = this.getCommands()), this.snapshotCache));
1513
+ V(this, "getSnapshot", () => (this.snapshotCache || (this.snapshotCache = this.getCommands()), this.snapshotCache));
1514
1514
  }
1515
1515
  registerCommand(t) {
1516
1516
  this.commands.set(t.id, t), this.emit();
@@ -1654,7 +1654,7 @@ function Ys(e) {
1654
1654
  const d = (i) => {
1655
1655
  i.stopPropagation(), t.close();
1656
1656
  };
1657
- return /* @__PURE__ */ x(
1657
+ return /* @__PURE__ */ S(
1658
1658
  "div",
1659
1659
  {
1660
1660
  className: ce(
@@ -1911,12 +1911,12 @@ function ni({
1911
1911
  const d = It(), i = Gs(), u = _(null), m = _(null), p = _(void 0), g = J(() => {
1912
1912
  const v = d.getComponents();
1913
1913
  return o ? Object.fromEntries(
1914
- Object.entries(v).filter(([C]) => o.includes(C))
1914
+ Object.entries(v).filter(([P]) => o.includes(P))
1915
1915
  ) : v;
1916
1916
  }, [d, o]), N = J(() => Zs(u), []), T = E(
1917
1917
  (v) => {
1918
- var C;
1919
- (C = p.current) == null || C.call(p), p.current = ti(
1918
+ var P;
1919
+ (P = p.current) == null || P.call(p), p.current = ti(
1920
1920
  v,
1921
1921
  e,
1922
1922
  t,
@@ -1931,22 +1931,22 @@ function ni({
1931
1931
  var v;
1932
1932
  return (v = p.current) == null ? void 0 : v.call(p);
1933
1933
  }, []), $(() => {
1934
- const v = V.on(pe.panelUpdate, ({ match: D, params: W, title: U }) => {
1935
- const ne = u.current;
1936
- if (ne)
1937
- for (const M of tn(ne, D))
1938
- W && M.api.updateParameters({
1939
- ...M.params ?? {},
1934
+ const v = H.on(pe.panelUpdate, ({ match: D, params: W, title: z }) => {
1935
+ const re = u.current;
1936
+ if (re)
1937
+ for (const j of tn(re, D))
1938
+ W && j.api.updateParameters({
1939
+ ...j.params ?? {},
1940
1940
  ...W
1941
- }), U && M.api.setTitle(U);
1942
- }), C = V.on(pe.panelClose, ({ match: D }) => {
1941
+ }), z && j.api.setTitle(z);
1942
+ }), P = H.on(pe.panelClose, ({ match: D }) => {
1943
1943
  const W = u.current;
1944
1944
  if (W)
1945
- for (const U of tn(W, D))
1946
- W.removePanel(U);
1945
+ for (const z of tn(W, D))
1946
+ W.removePanel(z);
1947
1947
  });
1948
1948
  return () => {
1949
- v(), C();
1949
+ v(), P();
1950
1950
  };
1951
1951
  }, []);
1952
1952
  const R = E(
@@ -2010,8 +2010,8 @@ function si({
2010
2010
  return J(
2011
2011
  () => s ? oi(s) : null,
2012
2012
  [s]
2013
- ), /* @__PURE__ */ x("div", { className: ce("flex h-full flex-col overflow-hidden", o), children: [
2014
- /* @__PURE__ */ x("div", { className: "flex h-9 shrink-0 items-center gap-2 border-b border-border bg-muted/50 px-3", children: [
2013
+ ), /* @__PURE__ */ S("div", { className: ce("flex h-full flex-col overflow-hidden", o), children: [
2014
+ /* @__PURE__ */ S("div", { className: "flex h-9 shrink-0 items-center gap-2 border-b border-border bg-muted/50 px-3", children: [
2015
2015
  t && /* @__PURE__ */ c(t, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
2016
2016
  /* @__PURE__ */ c("span", { className: "truncate text-sm font-medium", children: e }),
2017
2017
  /* @__PURE__ */ c("div", { className: "flex-1" }),
@@ -2095,7 +2095,7 @@ function li(e) {
2095
2095
  }
2096
2096
  return t;
2097
2097
  }
2098
- const ir = () => import("./FileTree-CwC01Ijr.js").then((e) => ({ default: e.FileTree }));
2098
+ const ir = () => import("./FileTree-BVfqs3rR.js").then((e) => ({ default: e.FileTree }));
2099
2099
  function ui() {
2100
2100
  ir();
2101
2101
  }
@@ -2177,121 +2177,121 @@ function rn({
2177
2177
  ), p = J(
2178
2178
  () => ci(m, r),
2179
2179
  [m, r]
2180
- ), { mutateAsync: g } = nr(), { mutateAsync: N } = zs(), { mutateAsync: T } = Us(), { mutateAsync: R } = Bs(), [v, C] = L(/* @__PURE__ */ new Map()), D = J(() => {
2180
+ ), { mutateAsync: g } = nr(), { mutateAsync: N } = zs(), { mutateAsync: T } = Us(), { mutateAsync: R } = Bs(), [v, P] = L(/* @__PURE__ */ new Map()), D = J(() => {
2181
2181
  if (d.size === 0) return v;
2182
2182
  const b = new Map(v);
2183
- for (const [P, F] of d) {
2184
- if (P === u) continue;
2185
- const Z = yt(b.get(P), F);
2186
- Z && b.set(P, Z);
2183
+ for (const [k, F] of d) {
2184
+ if (k === u) continue;
2185
+ const ee = yt(b.get(k), F);
2186
+ ee && b.set(k, ee);
2187
2187
  }
2188
2188
  return b;
2189
- }, [v, d, u]), W = _(null), [U, ne] = L(400), [M, S] = L(null), [j, A] = L(null), G = _(null), [re, h] = L(
2189
+ }, [v, d, u]), W = _(null), [z, re] = L(400), [j, O] = L(null), [U, A] = L(null), C = _(null), [Q, h] = L(
2190
2190
  ((Bt = n == null ? void 0 : n.getActiveFile) == null ? void 0 : Bt.call(n)) ?? null
2191
- ), [w, H] = L(null), [oe, le] = L(null), de = _(0), $e = ((p == null ? void 0 : p.length) ?? 0) + Array.from(D.values()).reduce(
2192
- (b, P) => b + P.length,
2191
+ ), [w, K] = L(null), [oe, le] = L(null), de = _(0), $e = ((p == null ? void 0 : p.length) ?? 0) + Array.from(D.values()).reduce(
2192
+ (b, k) => b + k.length,
2193
2193
  0
2194
2194
  ) >= ii && ((t == null ? void 0 : t.length) ?? 0) > 0, { data: Re } = Ws(
2195
2195
  $e ? sr(t ?? "") : "",
2196
2196
  50
2197
2197
  );
2198
2198
  $(() => {
2199
- if (!M) return;
2200
- function b(P) {
2201
- G.current && !G.current.contains(P.target) && S(null);
2199
+ if (!j) return;
2200
+ function b(k) {
2201
+ C.current && !C.current.contains(k.target) && O(null);
2202
2202
  }
2203
2203
  return document.addEventListener("pointerdown", b), () => document.removeEventListener("pointerdown", b);
2204
- }, [M]), $(() => {
2204
+ }, [j]), $(() => {
2205
2205
  var b;
2206
2206
  if (h(((b = n == null ? void 0 : n.getActiveFile) == null ? void 0 : b.call(n)) ?? null), !!(n != null && n.select))
2207
- return n.select((P) => P.activeFile, (P) => {
2208
- h(P);
2207
+ return n.select((k) => k.activeFile, (k) => {
2208
+ h(k);
2209
2209
  });
2210
2210
  }, [n]), $(() => {
2211
2211
  const b = W.current;
2212
2212
  if (!b) return;
2213
- const P = new ResizeObserver(([F]) => {
2214
- F && ne(Math.floor(F.contentRect.height));
2213
+ const k = new ResizeObserver(([F]) => {
2214
+ F && re(Math.floor(F.contentRect.height));
2215
2215
  });
2216
- return P.observe(b), () => P.disconnect();
2216
+ return k.observe(b), () => k.disconnect();
2217
2217
  }, []);
2218
2218
  const y = ($e && Re ? Re.map((b) => ({
2219
2219
  name: b.split("/").pop() ?? b,
2220
2220
  kind: "file",
2221
2221
  path: b
2222
- })) : void 0) ?? ar(p ?? [], D), k = cr(y, w, e), I = E(
2222
+ })) : void 0) ?? ar(p ?? [], D), x = cr(y, w, e), I = E(
2223
2223
  (b) => {
2224
2224
  h(b), n == null || n.openFile(b, { mode: "edit" });
2225
2225
  },
2226
2226
  [n]
2227
- ), O = E(
2227
+ ), M = E(
2228
2228
  async (b) => {
2229
2229
  try {
2230
- const P = await s.getTree(b), F = r.length === 0 ? P : P.filter((Z) => !Ct(Z.name, r));
2231
- C((Z) => new Map(Z).set(b, F));
2230
+ const k = await s.getTree(b), F = r.length === 0 ? k : k.filter((ee) => !Ct(ee.name, r));
2231
+ P((ee) => new Map(ee).set(b, F));
2232
2232
  } catch {
2233
2233
  }
2234
2234
  },
2235
2235
  [s, r]
2236
- ), Q = E(
2237
- async (b, P) => {
2236
+ ), X = E(
2237
+ async (b, k) => {
2238
2238
  const F = Array.from(new Set(b)).filter(
2239
2239
  (Y) => Y && Y !== e && Y !== "."
2240
2240
  );
2241
2241
  if (F.length === 0) return;
2242
- const Z = await Promise.all(
2242
+ const ee = await Promise.all(
2243
2243
  F.map(async (Y) => {
2244
2244
  try {
2245
- const ee = await s.getTree(Y), ge = r.length === 0 ? ee : ee.filter((we) => !Ct(we.name, r));
2245
+ const te = await s.getTree(Y), ge = r.length === 0 ? te : te.filter((we) => !Ct(we.name, r));
2246
2246
  return [Y, ge];
2247
2247
  } catch {
2248
2248
  return null;
2249
2249
  }
2250
2250
  })
2251
2251
  );
2252
- C((Y) => {
2253
- const ee = new Map(Y);
2254
- for (const ge of Z) {
2252
+ P((Y) => {
2253
+ const te = new Map(Y);
2254
+ for (const ge of ee) {
2255
2255
  if (!ge) continue;
2256
2256
  const [we, ye] = ge;
2257
- (P != null && P.force || ee.has(we)) && ee.set(we, ye);
2257
+ (k != null && k.force || te.has(we)) && te.set(we, ye);
2258
2258
  }
2259
- return ee;
2259
+ return te;
2260
2260
  });
2261
2261
  },
2262
2262
  [s, e, r]
2263
- ), z = E((b, P) => {
2263
+ ), B = E((b, k) => {
2264
2264
  i((F) => {
2265
- const Z = gt(b), Y = new Map(F), ee = yt(Y.get(Z), [P]) ?? [P];
2266
- return Y.set(Z, ee), Y;
2265
+ const ee = gt(b), Y = new Map(F), te = yt(Y.get(ee), [k]) ?? [k];
2266
+ return Y.set(ee, te), Y;
2267
2267
  });
2268
- }, []), ae = E((b, P) => {
2268
+ }, []), ae = E((b, k) => {
2269
2269
  i((F) => {
2270
- const Z = gt(b), Y = F.get(Z);
2270
+ const ee = gt(b), Y = F.get(ee);
2271
2271
  if (!(Y != null && Y.length)) return F;
2272
- const ee = Y.filter((we) => we.path !== P), ge = new Map(F);
2273
- return ee.length > 0 ? ge.set(Z, ee) : ge.delete(Z), ge;
2272
+ const te = Y.filter((we) => we.path !== k), ge = new Map(F);
2273
+ return te.length > 0 ? ge.set(ee, te) : ge.delete(ee), ge;
2274
2274
  });
2275
- }, []), [X, he] = L(/* @__PURE__ */ new Set()), be = E((b) => {
2276
- he((P) => {
2277
- const F = new Set(P);
2275
+ }, []), [Z, he] = L(/* @__PURE__ */ new Set()), be = E((b) => {
2276
+ he((k) => {
2277
+ const F = new Set(k);
2278
2278
  return F.add(b), F;
2279
2279
  });
2280
2280
  }, []), Me = E((b) => {
2281
- he((P) => {
2282
- if (!P.has(b)) return P;
2283
- const F = new Set(P);
2281
+ he((k) => {
2282
+ if (!k.has(b)) return k;
2283
+ const F = new Set(k);
2284
2284
  return F.delete(b), F;
2285
2285
  });
2286
2286
  }, []), kr = E(
2287
- (b, P) => {
2288
- S({ node: P, x: b.clientX, y: b.clientY });
2287
+ (b, k) => {
2288
+ O({ node: k, x: b.clientX, y: b.clientY });
2289
2289
  },
2290
2290
  []
2291
2291
  ), Pr = E(
2292
2292
  (b) => {
2293
- const P = b.target;
2294
- P.closest("[role=treeitem]") || P.closest("[data-path]") || (b.preventDefault(), S({
2293
+ const k = b.target;
2294
+ k.closest("[role=treeitem]") || k.closest("[data-path]") || (b.preventDefault(), O({
2295
2295
  node: { name: e, kind: "dir", path: e },
2296
2296
  x: b.clientX,
2297
2297
  y: b.clientY,
@@ -2300,73 +2300,73 @@ function rn({
2300
2300
  },
2301
2301
  [e]
2302
2302
  ), Cr = E(
2303
- async (b, P) => {
2304
- const F = b.split("/").pop() ?? b, Z = P === "." ? e : P, Y = Z === "." ? F : `${Z}/${F}`;
2303
+ async (b, k) => {
2304
+ const F = b.split("/").pop() ?? b, ee = k === "." ? e : k, Y = ee === "." ? F : `${ee}/${F}`;
2305
2305
  if (Y !== b) {
2306
2306
  be(b);
2307
2307
  try {
2308
- await T({ from: b, to: Y }), await Q([Le(b), Le(Y)]), Se.success({ title: "Moved", description: `${b} → ${Y}` });
2309
- } catch (ee) {
2308
+ await T({ from: b, to: Y }), await X([Le(b), Le(Y)]), Se.success({ title: "Moved", description: `${b} → ${Y}` });
2309
+ } catch (te) {
2310
2310
  Se.error({
2311
2311
  title: "Move failed",
2312
- description: ee instanceof Error ? ee.message : String(ee)
2312
+ description: te instanceof Error ? te.message : String(te)
2313
2313
  });
2314
2314
  } finally {
2315
2315
  Me(b);
2316
2316
  }
2317
2317
  }
2318
2318
  },
2319
- [T, Q, e, be, Me]
2319
+ [T, X, e, be, Me]
2320
2320
  );
2321
2321
  function Er(b) {
2322
2322
  return () => {
2323
- S(null), (async () => {
2323
+ O(null), (async () => {
2324
2324
  try {
2325
2325
  await b();
2326
- } catch (P) {
2326
+ } catch (k) {
2327
2327
  Se.error({
2328
2328
  title: "Action failed",
2329
- description: P instanceof Error ? P.message : String(P)
2329
+ description: k instanceof Error ? k.message : String(k)
2330
2330
  });
2331
2331
  }
2332
2332
  })();
2333
2333
  };
2334
2334
  }
2335
2335
  const Ut = (b) => {
2336
- const P = M == null ? void 0 : M.node;
2337
- S(null);
2338
- const F = (P == null ? void 0 : P.kind) === "dir" ? P.path : P ? Le(P.path) : e, Z = `__draft__:${++de.current}`;
2339
- H({ kind: b, parentDir: F, path: Z });
2336
+ const k = j == null ? void 0 : j.node;
2337
+ O(null);
2338
+ const F = (k == null ? void 0 : k.kind) === "dir" ? k.path : k ? Le(k.path) : e, ee = `__draft__:${++de.current}`;
2339
+ K({ kind: b, parentDir: F, path: ee });
2340
2340
  }, Nr = () => Ut("create-file"), Tr = () => Ut("create-folder"), Ar = () => {
2341
- const b = M == null ? void 0 : M.node;
2342
- S(null), b && H({ kind: "rename", path: b.path, initialValue: b.name });
2341
+ const b = j == null ? void 0 : j.node;
2342
+ O(null), b && K({ kind: "rename", path: b.path, initialValue: b.name });
2343
2343
  }, Ir = E(
2344
- async (b, P) => {
2344
+ async (b, k) => {
2345
2345
  const F = w;
2346
- if (H(null), !F) return;
2347
- const Z = P.trim();
2348
- if (!Z) return;
2349
- const Y = F.kind === "rename" ? Le(F.path) : F.parentDir, ee = F.kind === "rename" ? F.path : Y === "." || Y === "" ? Z : `${Y}/${Z}`, ge = F.kind === "rename" ? F.path : ee;
2346
+ if (K(null), !F) return;
2347
+ const ee = k.trim();
2348
+ if (!ee) return;
2349
+ const Y = F.kind === "rename" ? Le(F.path) : F.parentDir, te = F.kind === "rename" ? F.path : Y === "." || Y === "" ? ee : `${Y}/${ee}`, ge = F.kind === "rename" ? F.path : te;
2350
2350
  be(ge);
2351
2351
  let we = null;
2352
2352
  try {
2353
2353
  if (F.kind === "rename") {
2354
- if (Z === F.initialValue) return;
2354
+ if (ee === F.initialValue) return;
2355
2355
  const ye = F.path.split("/");
2356
- ye[ye.length - 1] = Z;
2356
+ ye[ye.length - 1] = ee;
2357
2357
  const Ze = ye.join("/");
2358
- await T({ from: F.path, to: Ze }), await Q([Le(F.path)]), Se.success({ title: "Renamed", description: `${F.path} → ${Ze}` });
2358
+ await T({ from: F.path, to: Ze }), await X([Le(F.path)]), Se.success({ title: "Renamed", description: `${F.path} → ${Ze}` });
2359
2359
  } else {
2360
2360
  const ye = {
2361
- name: Z,
2361
+ name: ee,
2362
2362
  kind: F.kind === "create-file" ? "file" : "dir",
2363
- path: ee
2363
+ path: te
2364
2364
  };
2365
- z(Y, ye), we = ee, F.kind === "create-file" ? (await g({ path: ee, content: "" }), V.emit(te.created, {
2365
+ B(Y, ye), we = te, F.kind === "create-file" ? (await g({ path: te, content: "" }), H.emit(ne.created, {
2366
2366
  ...Ue(),
2367
- path: ee,
2367
+ path: te,
2368
2368
  kind: "file"
2369
- }), Se.success({ title: "File created", description: ee })) : (await N({ path: ee }), Se.success({ title: "Folder created", description: ee })), await Q([Y], { force: !0 }), le(ee);
2369
+ }), Se.success({ title: "File created", description: te })) : (await N({ path: te }), Se.success({ title: "Folder created", description: te })), await X([Y], { force: !0 }), le(te);
2370
2370
  }
2371
2371
  } catch (ye) {
2372
2372
  we && ae(Y, we);
@@ -2384,39 +2384,39 @@ function rn({
2384
2384
  T,
2385
2385
  g,
2386
2386
  N,
2387
- Q,
2387
+ X,
2388
2388
  be,
2389
2389
  Me,
2390
- z,
2390
+ B,
2391
2391
  ae
2392
2392
  ]
2393
2393
  ), Dr = E(() => {
2394
- H(null);
2394
+ K(null);
2395
2395
  }, []), Fr = Er(async () => {
2396
- M != null && M.node && (await fi(M.node.path), Se.success({ title: "Path copied", description: M.node.path }));
2396
+ j != null && j.node && (await fi(j.node.path), Se.success({ title: "Path copied", description: j.node.path }));
2397
2397
  }), $r = E(async () => {
2398
- if (!j) return;
2399
- const b = j;
2398
+ if (!U) return;
2399
+ const b = U;
2400
2400
  A(null), be(b.path);
2401
2401
  try {
2402
- await R({ path: b.path }), ae(Le(b.path), b.path), await Q([Le(b.path)]), Se.success({ title: "Deleted", description: b.path });
2403
- } catch (P) {
2402
+ await R({ path: b.path }), ae(Le(b.path), b.path), await X([Le(b.path)]), Se.success({ title: "Deleted", description: b.path });
2403
+ } catch (k) {
2404
2404
  Se.error({
2405
2405
  title: "Delete failed",
2406
- description: P instanceof Error ? P.message : String(P)
2406
+ description: k instanceof Error ? k.message : String(k)
2407
2407
  });
2408
2408
  } finally {
2409
2409
  Me(b.path);
2410
2410
  }
2411
2411
  }, [
2412
- j,
2412
+ U,
2413
2413
  R,
2414
- Q,
2414
+ X,
2415
2415
  be,
2416
2416
  Me,
2417
2417
  ae
2418
2418
  ]), Rr = !$e && ((t == null ? void 0 : t.length) ?? 0) > 0 ? t : void 0;
2419
- return /* @__PURE__ */ x("div", { className: "flex h-full min-h-0 flex-col", children: [
2419
+ return /* @__PURE__ */ S("div", { className: "flex h-full min-h-0 flex-col", children: [
2420
2420
  f && /* @__PURE__ */ c(
2421
2421
  ze,
2422
2422
  {
@@ -2431,25 +2431,25 @@ function rn({
2431
2431
  ref: W,
2432
2432
  className: "min-h-0 flex-1 overflow-hidden",
2433
2433
  onContextMenu: Pr,
2434
- children: a ? /* @__PURE__ */ c("div", { className: "space-y-1 p-2", "data-testid": "tree-skeleton", children: Array.from({ length: 8 }).map((b, P) => /* @__PURE__ */ c(
2434
+ children: a ? /* @__PURE__ */ c("div", { className: "space-y-1 p-2", "data-testid": "tree-skeleton", children: Array.from({ length: 8 }).map((b, k) => /* @__PURE__ */ c(
2435
2435
  Kr,
2436
2436
  {
2437
2437
  className: "h-5",
2438
- style: { width: `${60 + P * 13 % 30}%` }
2438
+ style: { width: `${60 + k * 13 % 30}%` }
2439
2439
  },
2440
- P
2440
+ k
2441
2441
  )) }) : /* @__PURE__ */ c(
2442
2442
  lt,
2443
2443
  {
2444
- fallback: /* @__PURE__ */ x("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
2444
+ fallback: /* @__PURE__ */ S("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
2445
2445
  /* @__PURE__ */ c(ut, { className: "size-3.5" }),
2446
2446
  /* @__PURE__ */ c("span", { children: "Loading..." })
2447
2447
  ] }),
2448
2448
  children: /* @__PURE__ */ c(
2449
2449
  di,
2450
2450
  {
2451
- files: k,
2452
- selectedPath: re,
2451
+ files: x,
2452
+ selectedPath: Q,
2453
2453
  searchQuery: Rr,
2454
2454
  editing: w ? {
2455
2455
  path: w.path,
@@ -2457,14 +2457,14 @@ function rn({
2457
2457
  initialValue: w.kind === "rename" ? w.initialValue : void 0
2458
2458
  } : null,
2459
2459
  revealPath: oe,
2460
- pendingPaths: X,
2460
+ pendingPaths: Z,
2461
2461
  onSelect: I,
2462
- onExpand: O,
2462
+ onExpand: M,
2463
2463
  onContextMenu: kr,
2464
2464
  onSubmitEdit: Ir,
2465
2465
  onCancelEdit: Dr,
2466
2466
  onDragDrop: Cr,
2467
- height: U,
2467
+ height: z,
2468
2468
  className: ce(o)
2469
2469
  }
2470
2470
  )
@@ -2472,17 +2472,17 @@ function rn({
2472
2472
  )
2473
2473
  }
2474
2474
  ),
2475
- M && /* @__PURE__ */ x(
2475
+ j && /* @__PURE__ */ S(
2476
2476
  "div",
2477
2477
  {
2478
- ref: G,
2478
+ ref: C,
2479
2479
  role: "menu",
2480
2480
  className: "fixed z-50 min-w-[10rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
2481
- style: { left: M.x, top: M.y },
2481
+ style: { left: j.x, top: j.y },
2482
2482
  children: [
2483
2483
  /* @__PURE__ */ c(ke, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: Nr, children: "New file" }),
2484
2484
  /* @__PURE__ */ c(ke, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: Tr, children: "New folder" }),
2485
- !M.isBackground && /* @__PURE__ */ x(De, { children: [
2485
+ !j.isBackground && /* @__PURE__ */ S(De, { children: [
2486
2486
  /* @__PURE__ */ c(ke, { type: "button", role: "menuitem", variant: "ghost", size: "sm", className: "w-full justify-start", onClick: Ar, children: "Rename" }),
2487
2487
  /* @__PURE__ */ c(
2488
2488
  ke,
@@ -2493,7 +2493,7 @@ function rn({
2493
2493
  size: "sm",
2494
2494
  className: "w-full justify-start text-destructive hover:bg-destructive/10 hover:text-destructive",
2495
2495
  onClick: () => {
2496
- A(M.node), S(null);
2496
+ A(j.node), O(null);
2497
2497
  },
2498
2498
  children: "Delete"
2499
2499
  }
@@ -2506,20 +2506,20 @@ function rn({
2506
2506
  /* @__PURE__ */ c(
2507
2507
  Gr,
2508
2508
  {
2509
- open: j !== null,
2509
+ open: U !== null,
2510
2510
  onOpenChange: (b) => {
2511
2511
  b || A(null);
2512
2512
  },
2513
- children: /* @__PURE__ */ x(Yr, { children: [
2514
- /* @__PURE__ */ x(Jr, { children: [
2515
- /* @__PURE__ */ x(Qr, { children: [
2513
+ children: /* @__PURE__ */ S(Yr, { children: [
2514
+ /* @__PURE__ */ S(Jr, { children: [
2515
+ /* @__PURE__ */ S(Qr, { children: [
2516
2516
  "Delete ",
2517
- j == null ? void 0 : j.name,
2517
+ U == null ? void 0 : U.name,
2518
2518
  "?"
2519
2519
  ] }),
2520
2520
  /* @__PURE__ */ c(Xr, { children: "This action cannot be undone." })
2521
2521
  ] }),
2522
- /* @__PURE__ */ x(Zr, { children: [
2522
+ /* @__PURE__ */ S(Zr, { children: [
2523
2523
  /* @__PURE__ */ c(eo, { children: "Cancel" }),
2524
2524
  /* @__PURE__ */ c(to, { onClick: $r, children: "Delete" })
2525
2525
  ] })
@@ -2549,13 +2549,13 @@ function mi({
2549
2549
  bridge: d,
2550
2550
  className: ce("px-1 pt-1 [&_[role=treeitem]]:!indent-0", f)
2551
2551
  }
2552
- ) : /* @__PURE__ */ c(si, { title: "Files", panelApi: m, children: /* @__PURE__ */ x("div", { className: "flex h-full flex-col", children: [
2552
+ ) : /* @__PURE__ */ c(si, { title: "Files", panelApi: m, children: /* @__PURE__ */ S("div", { className: "flex h-full flex-col", children: [
2553
2553
  /* @__PURE__ */ c("div", { className: "border-b border-border px-2 py-1.5", children: /* @__PURE__ */ c(
2554
2554
  An,
2555
2555
  {
2556
2556
  placeholder: "Search files...",
2557
2557
  value: u ?? p,
2558
- onChange: (C) => g(C.target.value),
2558
+ onChange: (P) => g(P.target.value),
2559
2559
  className: "h-7 text-xs",
2560
2560
  "aria-label": "Search files"
2561
2561
  }
@@ -2576,15 +2576,15 @@ function pi(e) {
2576
2576
  }
2577
2577
  function hi() {
2578
2578
  return $(() => {
2579
- const e = V.on(te.moved, ({ from: n, to: r, ...o }) => {
2580
- V.emit(pe.panelUpdate, {
2579
+ const e = H.on(ne.moved, ({ from: n, to: r, ...o }) => {
2580
+ H.emit(pe.panelUpdate, {
2581
2581
  ...o,
2582
2582
  match: [{ id: `file:${n}` }, { param: "path", value: n }],
2583
2583
  params: { path: r },
2584
2584
  title: pi(r)
2585
2585
  });
2586
- }), t = V.on(te.deleted, ({ path: n, ...r }) => {
2587
- V.emit(pe.panelClose, {
2586
+ }), t = H.on(ne.deleted, ({ path: n, ...r }) => {
2587
+ H.emit(pe.panelClose, {
2588
2588
  ...r,
2589
2589
  match: [{ id: `file:${n}` }, { param: "path", value: n }]
2590
2590
  });
@@ -2616,41 +2616,41 @@ function vi(e) {
2616
2616
  const n = us(t.toolCallId);
2617
2617
  switch (t.op) {
2618
2618
  case "rename":
2619
- t.oldPath && V.emit(te.moved, {
2619
+ t.oldPath && H.emit(ne.moved, {
2620
2620
  ...n,
2621
2621
  from: t.oldPath,
2622
2622
  to: t.path
2623
2623
  });
2624
2624
  return;
2625
2625
  case "unlink":
2626
- V.emit(te.deleted, { ...n, path: t.path });
2626
+ H.emit(ne.deleted, { ...n, path: t.path });
2627
2627
  return;
2628
2628
  case "mkdir":
2629
- V.emit(te.created, { ...n, path: t.path, kind: "dir" });
2629
+ H.emit(ne.created, { ...n, path: t.path, kind: "dir" });
2630
2630
  return;
2631
2631
  case "write":
2632
- t.existsBefore === !1 ? V.emit(te.created, {
2632
+ t.existsBefore === !1 ? H.emit(ne.created, {
2633
2633
  ...n,
2634
2634
  path: t.path,
2635
2635
  kind: "file"
2636
- }) : V.emit(te.changed, { ...n, path: t.path });
2636
+ }) : H.emit(ne.changed, { ...n, path: t.path });
2637
2637
  return;
2638
2638
  case "edit":
2639
- V.emit(te.changed, { ...n, path: t.path });
2639
+ H.emit(ne.changed, { ...n, path: t.path });
2640
2640
  return;
2641
2641
  }
2642
2642
  }
2643
2643
  function bi(e, t = {}) {
2644
2644
  const { skip: n, filesOnly: r = !0 } = t;
2645
- kt(te.created, (o) => {
2645
+ kt(ne.created, (o) => {
2646
2646
  o.cause === "agent" && (r && o.kind !== "file" || n != null && n(o.path) || e(o.path));
2647
2647
  });
2648
2648
  }
2649
2649
  function kc(e) {
2650
- return V.on(te.changed, e);
2650
+ return H.on(ne.changed, e);
2651
2651
  }
2652
2652
  function wi() {
2653
- return $(() => V.on(pe.agentData, ({ part: e }) => {
2653
+ return $(() => H.on(pe.agentData, ({ part: e }) => {
2654
2654
  vi(e);
2655
2655
  }), []), bi((e) => {
2656
2656
  zn({ kind: "openFile", params: { path: e } });
@@ -2658,63 +2658,63 @@ function wi() {
2658
2658
  }
2659
2659
  const Si = 1e3, xi = 3e3;
2660
2660
  function ki(e, t) {
2661
- const { adapter: n, panelId: r, onDirtyChange: o, serverMtime: s } = t, [l, f] = L(!1), [a, d] = L(!1), [i, u] = L(null), [m, p] = L(!1), [g, N] = L(!1), T = _(void 0), R = _(null), v = _(0), C = _(null), D = _(o);
2661
+ const { adapter: n, panelId: r, onDirtyChange: o, serverMtime: s } = t, [l, f] = L(!1), [a, d] = L(!1), [i, u] = L(null), [m, p] = L(!1), [g, N] = L(!1), T = _(void 0), R = _(null), v = _(0), P = _(null), D = _(o);
2662
2662
  D.current = o;
2663
2663
  const W = _(n);
2664
2664
  W.current = n;
2665
- const U = E(async () => {
2666
- const re = W.current;
2667
- if (!re || !e || !re.isDirty()) return;
2665
+ const z = E(async () => {
2666
+ const Q = W.current;
2667
+ if (!Q || !e || !Q.isDirty()) return;
2668
2668
  if (R.current) return R.current;
2669
2669
  const h = (async () => {
2670
2670
  var w;
2671
- d(!0), V.emit(pe.editorSaveStart, { panelId: r });
2671
+ d(!0), H.emit(pe.editorSaveStart, { panelId: r });
2672
2672
  try {
2673
- await re.save(), v.current = Date.now(), u(Date.now()), f(!1), (w = D.current) == null || w.call(D, e, !1);
2673
+ await Q.save(), v.current = Date.now(), u(Date.now()), f(!1), (w = D.current) == null || w.call(D, e, !1);
2674
2674
  } catch {
2675
2675
  } finally {
2676
- V.emit(pe.editorSaveEnd, { panelId: r }), d(!1), R.current = null;
2676
+ H.emit(pe.editorSaveEnd, { panelId: r }), d(!1), R.current = null;
2677
2677
  }
2678
2678
  })();
2679
2679
  return R.current = h, h;
2680
- }, [e, r]), ne = E(() => {
2681
- clearTimeout(T.current), T.current = setTimeout(U, Si);
2682
- }, [U]), M = E(() => {
2683
- var re;
2684
- e && (f(!0), (re = D.current) == null || re.call(D, e, !0), ne());
2685
- }, [e, ne]), S = E(async () => {
2686
- var re;
2680
+ }, [e, r]), re = E(() => {
2681
+ clearTimeout(T.current), T.current = setTimeout(z, Si);
2682
+ }, [z]), j = E(() => {
2683
+ var Q;
2684
+ e && (f(!0), (Q = D.current) == null || Q.call(D, e, !0), re());
2685
+ }, [e, re]), O = E(async () => {
2686
+ var Q;
2687
2687
  if (clearTimeout(T.current), R.current) return R.current;
2688
- if ((re = W.current) != null && re.isDirty())
2689
- return U();
2690
- }, [U]), j = E(() => p(!1), []), A = E(() => N(!1), []), G = E((re) => {
2691
- C.current = re, N(!1);
2688
+ if ((Q = W.current) != null && Q.isDirty())
2689
+ return z();
2690
+ }, [z]), U = E(() => p(!1), []), A = E(() => N(!1), []), C = E((Q) => {
2691
+ P.current = Q, N(!1);
2692
2692
  }, []);
2693
2693
  return $(() => {
2694
2694
  if (!(s == null || !e)) {
2695
- if (C.current === null) {
2696
- C.current = s;
2695
+ if (P.current === null) {
2696
+ P.current = s;
2697
2697
  return;
2698
2698
  }
2699
- if (s !== C.current) {
2699
+ if (s !== P.current) {
2700
2700
  if (Date.now() - v.current < xi) {
2701
- C.current = s;
2701
+ P.current = s;
2702
2702
  return;
2703
2703
  }
2704
- C.current = s, l ? N(!0) : p(!0);
2704
+ P.current = s, l ? N(!0) : p(!0);
2705
2705
  }
2706
2706
  }
2707
2707
  }, [s, e, l]), $(() => () => clearTimeout(T.current), []), {
2708
2708
  isDirty: l,
2709
2709
  isSaving: a,
2710
2710
  lastSavedAt: i,
2711
- markDirty: M,
2712
- flushSave: S,
2711
+ markDirty: j,
2712
+ flushSave: O,
2713
2713
  shouldSync: m,
2714
- ackSync: j,
2714
+ ackSync: U,
2715
2715
  externalChangeWhileDirty: g,
2716
2716
  ackExternalChange: A,
2717
- notifySaved: G
2717
+ notifySaved: C
2718
2718
  };
2719
2719
  }
2720
2720
  function Pi(e, t) {
@@ -2757,14 +2757,14 @@ function ur(e) {
2757
2757
  save: async () => {
2758
2758
  var A;
2759
2759
  try {
2760
- const G = await f({
2760
+ const C = await f({
2761
2761
  path: t,
2762
2762
  content: i.current,
2763
2763
  expectedMtimeMs: p.current ?? void 0
2764
2764
  });
2765
- typeof G.mtimeMs == "number" && (p.current = G.mtimeMs, (A = g.current) == null || A.call(g, G.mtimeMs)), u.current = !1, T(null);
2766
- } catch (G) {
2767
- throw G instanceof Ye && T(G), G;
2765
+ typeof C.mtimeMs == "number" && (p.current = C.mtimeMs, (A = g.current) == null || A.call(g, C.mtimeMs)), u.current = !1, T(null);
2766
+ } catch (C) {
2767
+ throw C instanceof Ye && T(C), C;
2768
2768
  }
2769
2769
  },
2770
2770
  getContent: () => i.current
@@ -2784,24 +2784,24 @@ function ur(e) {
2784
2784
  }, [v.shouldSync, v, o, d]), $(() => {
2785
2785
  !v.externalChangeWhileDirty || (o == null ? void 0 : o.mtimeMs) == null || (T(new Ye(t, o.mtimeMs, p.current)), v.ackExternalChange());
2786
2786
  }, [v.externalChangeWhileDirty, v, o, t]);
2787
- const C = t ? t.split("/").pop() ?? t : "", [D, W] = L("");
2787
+ const P = t ? t.split("/").pop() ?? t : "", [D, W] = L("");
2788
2788
  $(() => {
2789
- const A = C ? v.isDirty ? `${C} ●` : C : "";
2789
+ const A = P ? v.isDirty ? `${P} ●` : P : "";
2790
2790
  W(A);
2791
- }, [C, v.isDirty, n]);
2792
- const U = E((A) => {
2791
+ }, [P, v.isDirty, n]);
2792
+ const z = E((A) => {
2793
2793
  d(A), i.current = A, u.current = !0, v.markDirty();
2794
- }, [d, v]), ne = E(async () => {
2794
+ }, [d, v]), re = E(async () => {
2795
2795
  o && (d(o.content), i.current = o.content, p.current = o.mtimeMs ?? null, u.current = !1, T(null));
2796
- }, [o, d]), M = E(async () => {
2796
+ }, [o, d]), j = E(async () => {
2797
2797
  try {
2798
- const A = a ?? i.current, G = await f({ path: t, content: A });
2799
- typeof G.mtimeMs == "number" && (p.current = G.mtimeMs), u.current = !1, T(null);
2798
+ const A = a ?? i.current, C = await f({ path: t, content: A });
2799
+ typeof C.mtimeMs == "number" && (p.current = C.mtimeMs), u.current = !1, T(null);
2800
2800
  } catch {
2801
2801
  }
2802
- }, [t, f, a]), S = E(async () => {
2802
+ }, [t, f, a]), O = E(async () => {
2803
2803
  !R || !u.current || await R.save();
2804
- }, [R]), j = E(async () => {
2804
+ }, [R]), U = E(async () => {
2805
2805
  await v.flushSave();
2806
2806
  }, [v]);
2807
2807
  return {
@@ -2810,12 +2810,12 @@ function ur(e) {
2810
2810
  content: a,
2811
2811
  isDirty: v.isDirty,
2812
2812
  conflict: N,
2813
- onReloadFromServer: ne,
2814
- onOverwrite: M,
2815
- setContent: U,
2816
- save: S,
2817
- flushSave: j,
2818
- fileName: C,
2813
+ onReloadFromServer: re,
2814
+ onOverwrite: j,
2815
+ setContent: z,
2816
+ save: O,
2817
+ flushSave: U,
2818
+ fileName: P,
2819
2819
  tabTitle: D
2820
2820
  };
2821
2821
  }
@@ -2827,7 +2827,7 @@ function Ei({ conflict: e, onReload: t, onOverwrite: n }) {
2827
2827
  tone: "accent",
2828
2828
  className: "rounded-none border-x-0 border-t-0",
2829
2829
  description: /* @__PURE__ */ c(De, { children: "This file has been modified outside the editor. Your unsaved changes will be lost if you reload, or will overwrite the latest version on disk if you save." }),
2830
- actions: /* @__PURE__ */ x(De, { children: [
2830
+ actions: /* @__PURE__ */ S(De, { children: [
2831
2831
  /* @__PURE__ */ c(ke, { type: "button", variant: "outline", size: "xs", onClick: () => void t(), children: "Reload" }),
2832
2832
  /* @__PURE__ */ c(
2833
2833
  ke,
@@ -2863,11 +2863,11 @@ function dr({
2863
2863
  return /* @__PURE__ */ c("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ c(In, { className: "min-h-0 border-0", title: "No file selected", description: "Choose a file from the file tree to open an editor." }) });
2864
2864
  if (r)
2865
2865
  return /* @__PURE__ */ c("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ c(ze, { title: "Failed to load file", description: u ?? r.message }) });
2866
- const p = i ?? /* @__PURE__ */ x("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
2866
+ const p = i ?? /* @__PURE__ */ S("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
2867
2867
  /* @__PURE__ */ c(ut, { className: "size-3.5" }),
2868
2868
  /* @__PURE__ */ c("span", { children: "Loading file..." })
2869
2869
  ] });
2870
- return /* @__PURE__ */ x("div", { className: `flex h-full min-h-0 flex-col ${m ?? ""}`, children: [
2870
+ return /* @__PURE__ */ S("div", { className: `flex h-full min-h-0 flex-col ${m ?? ""}`, children: [
2871
2871
  o && /* @__PURE__ */ c(
2872
2872
  Ei,
2873
2873
  {
@@ -2945,7 +2945,7 @@ function on({ params: e, api: t, className: n }) {
2945
2945
  );
2946
2946
  }
2947
2947
  const Ai = Qe(
2948
- () => import("./MarkdownEditor-CB7nfhN9.js").then((e) => ({ default: e.MarkdownEditor }))
2948
+ () => import("./MarkdownEditor-CcCDF65H.js").then((e) => ({ default: e.MarkdownEditor }))
2949
2949
  );
2950
2950
  function Ii({ params: e, api: t, className: n }) {
2951
2951
  const r = typeof (e == null ? void 0 : e.path) == "string" ? e.path : "", {
@@ -3005,11 +3005,11 @@ function Fi({ path: e, kind: t, className: n }) {
3005
3005
  }), () => {
3006
3006
  m.abort(), p && URL.revokeObjectURL(p);
3007
3007
  };
3008
- }, [u, o]), e ? d ? /* @__PURE__ */ x("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
3008
+ }, [u, o]), e ? d ? /* @__PURE__ */ S("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
3009
3009
  /* @__PURE__ */ c(ut, { className: "size-3.5" }),
3010
3010
  /* @__PURE__ */ c("span", { children: "Loading preview..." })
3011
- ] }) : f || !s ? /* @__PURE__ */ c("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ c(ze, { title: "Failed to load preview", description: f ?? "Preview unavailable." }) }) : /* @__PURE__ */ x("div", { className: ce("flex h-full min-h-0 flex-col bg-background", n), children: [
3012
- /* @__PURE__ */ x("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-3 py-2", children: [
3011
+ ] }) : f || !s ? /* @__PURE__ */ c("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ c(ze, { title: "Failed to load preview", description: f ?? "Preview unavailable." }) }) : /* @__PURE__ */ S("div", { className: ce("flex h-full min-h-0 flex-col bg-background", n), children: [
3012
+ /* @__PURE__ */ S("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-3 py-2", children: [
3013
3013
  /* @__PURE__ */ c("div", { className: "min-w-0 truncate text-xs font-medium text-muted-foreground", title: e, children: tt(e) }),
3014
3014
  /* @__PURE__ */ c(
3015
3015
  "a",
@@ -3138,6 +3138,7 @@ async function Mi(e) {
3138
3138
  ["audio", "src"],
3139
3139
  ["track", "src"],
3140
3140
  ["iframe", "src"],
3141
+ ["script", "src"],
3141
3142
  ["object", "data"],
3142
3143
  ["embed", "src"],
3143
3144
  ["link", "href"]
@@ -3176,11 +3177,11 @@ function ji({ path: e, className: t }) {
3176
3177
  }).finally(() => {
3177
3178
  u.signal.aborted || d(!1);
3178
3179
  }), () => u.abort();
3179
- }, [n, e, i, r]), e ? a ? /* @__PURE__ */ x("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
3180
+ }, [n, e, i, r]), e ? a ? /* @__PURE__ */ S("div", { className: "flex h-full items-center justify-center gap-2 text-sm text-muted-foreground", children: [
3180
3181
  /* @__PURE__ */ c(ut, { className: "size-3.5" }),
3181
3182
  /* @__PURE__ */ c("span", { children: "Loading HTML preview..." })
3182
- ] }) : l || o === null ? /* @__PURE__ */ c("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ c(ze, { title: "Failed to load HTML preview", description: l ?? "Preview unavailable." }) }) : /* @__PURE__ */ x("div", { className: ce("flex h-full min-h-0 flex-col bg-background", t), children: [
3183
- /* @__PURE__ */ x("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-3 py-2", children: [
3183
+ ] }) : l || o === null ? /* @__PURE__ */ c("div", { className: "flex h-full items-center justify-center p-6", children: /* @__PURE__ */ c(ze, { title: "Failed to load HTML preview", description: l ?? "Preview unavailable." }) }) : /* @__PURE__ */ S("div", { className: ce("flex h-full min-h-0 flex-col bg-background", t), children: [
3184
+ /* @__PURE__ */ S("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border/60 px-3 py-2", children: [
3184
3185
  /* @__PURE__ */ c("div", { className: "min-w-0 truncate text-xs font-medium text-muted-foreground", title: e, children: an(e) }),
3185
3186
  /* @__PURE__ */ c(
3186
3187
  "a",
@@ -3198,7 +3199,7 @@ function ji({ path: e, className: t }) {
3198
3199
  {
3199
3200
  srcDoc: o,
3200
3201
  title: an(e),
3201
- sandbox: "allow-forms allow-popups allow-popups-to-escape-sandbox",
3202
+ sandbox: "allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",
3202
3203
  className: "min-h-0 flex-1 border-0 bg-white"
3203
3204
  }
3204
3205
  )
@@ -3507,27 +3508,27 @@ function ta() {
3507
3508
  ]
3508
3509
  });
3509
3510
  }
3510
- const un = ta(), na = B.string().max(64).regex(/^[a-zA-Z0-9_-]+$/), it = B.string().max(1024), ra = B.number().nonnegative(), oa = B.object({
3511
- collapsed: B.boolean(),
3512
- width: B.number().int().positive()
3513
- }), sa = B.record(na, ra), ia = B.object({
3514
- root: B.unknown(),
3515
- width: B.number().nonnegative().optional(),
3516
- height: B.number().nonnegative().optional(),
3517
- orientation: B.number().optional()
3518
- }).passthrough(), aa = B.object({
3511
+ const un = ta(), na = q.string().max(64).regex(/^[a-zA-Z0-9_-]+$/), it = q.string().max(1024), ra = q.number().nonnegative(), oa = q.object({
3512
+ collapsed: q.boolean(),
3513
+ width: q.number().int().positive()
3514
+ }), sa = q.record(na, ra), ia = q.object({
3515
+ root: q.unknown(),
3516
+ width: q.number().nonnegative().optional(),
3517
+ height: q.number().nonnegative().optional(),
3518
+ orientation: q.number().optional()
3519
+ }).passthrough(), aa = q.object({
3519
3520
  id: it,
3520
3521
  contentComponent: it.optional(),
3521
3522
  title: it.optional()
3522
- }).passthrough(), ca = B.object({
3523
+ }).passthrough(), ca = q.object({
3523
3524
  grid: ia,
3524
- panels: B.record(it, aa)
3525
- }).passthrough().nullable(), la = B.object({
3525
+ panels: q.record(it, aa)
3526
+ }).passthrough().nullable(), la = q.object({
3526
3527
  layout: ca,
3527
3528
  sidebar: oa,
3528
3529
  panelSizes: sa
3529
- }), ua = B.object({
3530
- theme: B.enum(["light", "dark"])
3530
+ }), ua = q.object({
3531
+ theme: q.enum(["light", "dark"])
3531
3532
  });
3532
3533
  function da(e) {
3533
3534
  const t = la.safeParse(e);
@@ -3808,7 +3809,7 @@ function Sa({
3808
3809
  className: l
3809
3810
  }) {
3810
3811
  const f = J(() => ba(e), [e]);
3811
- return /* @__PURE__ */ x(
3812
+ return /* @__PURE__ */ S(
3812
3813
  "div",
3813
3814
  {
3814
3815
  "data-boring-workspace-part": "session-list",
@@ -3816,27 +3817,27 @@ function Sa({
3816
3817
  role: "navigation",
3817
3818
  "aria-label": "Session history",
3818
3819
  children: [
3819
- /* @__PURE__ */ x(
3820
+ /* @__PURE__ */ S(
3820
3821
  "div",
3821
3822
  {
3822
3823
  className: "flex items-center justify-between border-b border-[color:oklch(from_var(--border)_l_c_h/0.25)] px-3",
3823
3824
  style: { height: 44 },
3824
3825
  children: [
3825
3826
  /* @__PURE__ */ c("span", { className: "text-[10.5px] font-medium uppercase tracking-[0.12em] text-muted-foreground/70", children: "Sessions" }),
3826
- /* @__PURE__ */ x("div", { className: "flex items-center gap-0.5", children: [
3827
+ /* @__PURE__ */ S("div", { className: "flex items-center gap-0.5", children: [
3827
3828
  r && /* @__PURE__ */ c(me, { type: "button", variant: "ghost", size: "icon-xs", onClick: r, "aria-label": "New session", title: "New chat", children: /* @__PURE__ */ c(Wr, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
3828
3829
  s && /* @__PURE__ */ c(me, { type: "button", variant: "ghost", size: "icon-xs", onClick: s, "aria-label": "Close sessions", title: "Close sessions (⌘1)", children: /* @__PURE__ */ c(En, { className: "h-4 w-4", strokeWidth: 1.75 }) })
3829
3830
  ] })
3830
3831
  ]
3831
3832
  }
3832
3833
  ),
3833
- /* @__PURE__ */ x("div", { className: "flex-1 overflow-y-auto py-2", children: [
3834
- e.length === 0 && /* @__PURE__ */ x("div", { className: "px-3 py-8 text-center text-[13px] text-muted-foreground", children: [
3834
+ /* @__PURE__ */ S("div", { className: "flex-1 overflow-y-auto py-2", children: [
3835
+ e.length === 0 && /* @__PURE__ */ S("div", { className: "px-3 py-8 text-center text-[13px] text-muted-foreground", children: [
3835
3836
  "No sessions yet.",
3836
3837
  /* @__PURE__ */ c("br", {}),
3837
3838
  "Start a new chat to begin."
3838
3839
  ] }),
3839
- f.map((a, d) => /* @__PURE__ */ x("section", { className: ce(d > 0 && "mt-2"), children: [
3840
+ f.map((a, d) => /* @__PURE__ */ S("section", { className: ce(d > 0 && "mt-2"), children: [
3840
3841
  /* @__PURE__ */ c("div", { className: "px-4 pb-1 pt-2 text-[10.5px] font-medium uppercase tracking-[0.14em] text-muted-foreground/70", children: a.label }),
3841
3842
  /* @__PURE__ */ c("ul", { role: "list", className: "flex flex-col", children: a.items.map((i) => /* @__PURE__ */ c(
3842
3843
  xa,
@@ -3861,7 +3862,7 @@ function xa({
3861
3862
  onDelete: r
3862
3863
  }) {
3863
3864
  const o = wa(e.updatedAt);
3864
- return /* @__PURE__ */ x(
3865
+ return /* @__PURE__ */ S(
3865
3866
  "li",
3866
3867
  {
3867
3868
  role: "listitem",
@@ -3874,9 +3875,9 @@ function xa({
3874
3875
  ),
3875
3876
  onClick: () => n == null ? void 0 : n(e.id),
3876
3877
  children: [
3877
- /* @__PURE__ */ x("span", { className: "min-w-0 flex-1 truncate leading-5", title: e.title, children: [
3878
+ /* @__PURE__ */ S("span", { className: "min-w-0 flex-1 truncate leading-5", title: e.title, children: [
3878
3879
  /* @__PURE__ */ c("span", { className: ce(t ? "font-medium text-foreground" : "text-foreground/90"), children: e.title || "Untitled" }),
3879
- o && /* @__PURE__ */ x("span", { className: "ml-1.5 text-muted-foreground/70 tabular-nums", children: [
3880
+ o && /* @__PURE__ */ S("span", { className: "ml-1.5 text-muted-foreground/70 tabular-nums", children: [
3880
3881
  "· ",
3881
3882
  o
3882
3883
  ] })
@@ -3923,38 +3924,38 @@ function gr({
3923
3924
  onCollapse: r,
3924
3925
  className: o
3925
3926
  }) {
3926
- var M;
3927
+ var U, A;
3927
3928
  const s = It(), l = Tt(
3928
3929
  s.subscribe,
3929
3930
  s.getSnapshot,
3930
3931
  s.getSnapshot
3931
3932
  ), f = J(
3932
- () => l.filter((S) => S.placement === "left-tab"),
3933
+ () => l.filter((C) => C.placement === "left-tab"),
3933
3934
  [l]
3934
3935
  ), a = J(() => {
3935
- const S = [];
3936
- for (const j of f) {
3937
- const A = j.icon;
3938
- S.push({
3939
- id: j.id,
3940
- title: j.title,
3941
- icon: A ? /* @__PURE__ */ c(A, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ c(zr, { className: "h-3.5 w-3.5" }),
3942
- panel: j
3936
+ const C = [];
3937
+ for (const Q of f) {
3938
+ const h = Q.icon;
3939
+ C.push({
3940
+ id: Q.id,
3941
+ title: Q.title,
3942
+ icon: h ? /* @__PURE__ */ c(h, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ c(zr, { className: "h-3.5 w-3.5" }),
3943
+ panel: Q
3943
3944
  });
3944
3945
  }
3945
- return S;
3946
- }, [f]), [d, i] = L(n ?? ""), u = a.some((S) => S.id === d) ? d : ((M = a[0]) == null ? void 0 : M.id) ?? "", [m, p] = L(!1), [g, N] = L(""), [T, R] = L(""), v = _(null), C = _(void 0);
3947
- $(() => (clearTimeout(C.current), C.current = setTimeout(() => R(g), 180), () => clearTimeout(C.current)), [g]), $(() => {
3948
- var S;
3949
- m && ((S = v.current) == null || S.focus());
3946
+ return C;
3947
+ }, [f]), [d, i] = L(n ?? ""), u = a.some((C) => C.id === d) ? d : ((U = a[0]) == null ? void 0 : U.id) ?? "", [m, p] = L(!1), [g, N] = L(""), [T, R] = L(""), v = _(null), P = _(void 0);
3948
+ $(() => (clearTimeout(P.current), P.current = setTimeout(() => R(g), 180), () => clearTimeout(P.current)), [g]), $(() => {
3949
+ var C;
3950
+ m && ((C = v.current) == null || C.focus());
3950
3951
  }, [m]), $(() => {
3951
- a.length > 0 && !a.some((S) => S.id === d) && i(a[0].id);
3952
+ a.length > 0 && !a.some((C) => C.id === d) && i(a[0].id);
3952
3953
  }, [d, a]);
3953
3954
  const D = E(() => {
3954
- p((S) => (S && N(""), !S));
3955
- }, []), W = E((S) => {
3956
- S.key === "Escape" && (S.preventDefault(), p(!1), N(""));
3957
- }, []), U = a.find((S) => S.id === u), ne = J(
3955
+ p((C) => (C && N(""), !C));
3956
+ }, []), W = E((C) => {
3957
+ C.key === "Escape" && (C.preventDefault(), p(!1), N(""));
3958
+ }, []), z = a.find((C) => C.id === u), j = !!!((A = z == null ? void 0 : z.panel) != null && A.chromeless), O = J(
3958
3959
  () => ({
3959
3960
  rootDir: e,
3960
3961
  bridge: t,
@@ -3964,21 +3965,21 @@ function gr({
3964
3965
  }),
3965
3966
  [t, T, e]
3966
3967
  );
3967
- return /* @__PURE__ */ x("div", { "data-boring-workspace-part": "workbench-left", className: ce("workbench-left-root flex h-full min-h-0 flex-col", o), children: [
3968
- /* @__PURE__ */ x("div", { className: "flex h-11 items-center gap-1 border-b border-[color:oklch(from_var(--border)_l_c_h/0.25)] px-2", children: [
3969
- /* @__PURE__ */ c(no, { value: u, onValueChange: i, className: "min-w-0 flex-1", "aria-label": "Workbench sources", children: /* @__PURE__ */ c(ro, { variant: "line", className: "h-auto gap-0.5 p-0", children: a.map((S) => /* @__PURE__ */ x(
3968
+ return /* @__PURE__ */ S("div", { "data-boring-workspace-part": "workbench-left", className: ce("workbench-left-root flex h-full min-h-0 flex-col", o), children: [
3969
+ /* @__PURE__ */ S("div", { className: "flex h-11 items-center gap-1 border-b border-[color:oklch(from_var(--border)_l_c_h/0.25)] px-2", children: [
3970
+ /* @__PURE__ */ c(no, { value: u, onValueChange: i, className: "min-w-0 flex-1", "aria-label": "Workbench sources", children: /* @__PURE__ */ c(ro, { variant: "line", className: "h-auto gap-0.5 p-0", children: a.map((C) => /* @__PURE__ */ S(
3970
3971
  oo,
3971
3972
  {
3972
- value: S.id,
3973
+ value: C.id,
3973
3974
  className: "h-8 flex-none gap-1.5 px-2 py-1 text-[12px] data-[state=active]:text-foreground data-[state=active]:after:bg-[color:var(--accent)]",
3974
3975
  children: [
3975
- /* @__PURE__ */ c("span", { className: "data-[state=active]:text-[color:var(--accent)]", children: S.icon }),
3976
- /* @__PURE__ */ c("span", { className: "tracking-tight", children: S.title })
3976
+ /* @__PURE__ */ c("span", { className: "data-[state=active]:text-[color:var(--accent)]", children: C.icon }),
3977
+ /* @__PURE__ */ c("span", { className: "tracking-tight", children: C.title })
3977
3978
  ]
3978
3979
  },
3979
- S.id
3980
+ C.id
3980
3981
  )) }) }),
3981
- /* @__PURE__ */ c(
3982
+ j && /* @__PURE__ */ c(
3982
3983
  me,
3983
3984
  {
3984
3985
  type: "button",
@@ -4004,7 +4005,7 @@ function gr({
4004
4005
  }
4005
4006
  )
4006
4007
  ] }),
4007
- m && /* @__PURE__ */ x("div", { className: "flex items-center gap-1 border-b border-border/60 px-2 py-1.5", children: [
4008
+ j && m && /* @__PURE__ */ S("div", { className: "flex items-center gap-1 border-b border-border/60 px-2 py-1.5", children: [
4008
4009
  /* @__PURE__ */ c(Vt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
4009
4010
  /* @__PURE__ */ c(
4010
4011
  An,
@@ -4012,9 +4013,9 @@ function gr({
4012
4013
  ref: v,
4013
4014
  type: "text",
4014
4015
  value: g,
4015
- onChange: (S) => N(S.target.value),
4016
+ onChange: (C) => N(C.target.value),
4016
4017
  onKeyDown: W,
4017
- placeholder: `Search ${((U == null ? void 0 : U.title) ?? "sources").toLowerCase()}...`,
4018
+ placeholder: `Search ${((z == null ? void 0 : z.title) ?? "sources").toLowerCase()}...`,
4018
4019
  className: "h-7 flex-1 border-0 bg-transparent px-0 py-0 text-xs shadow-none focus-visible:ring-0 dark:bg-transparent"
4019
4020
  }
4020
4021
  ),
@@ -4030,7 +4031,7 @@ function gr({
4030
4031
  }
4031
4032
  )
4032
4033
  ] }),
4033
- /* @__PURE__ */ c("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ c(Ta, { panel: U == null ? void 0 : U.panel, params: ne }) })
4034
+ /* @__PURE__ */ c("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ c(Ta, { panel: z == null ? void 0 : z.panel, params: O }) })
4034
4035
  ] });
4035
4036
  }
4036
4037
  const Ca = { dispose() {
@@ -4221,105 +4222,105 @@ function La({
4221
4222
  try {
4222
4223
  const y = localStorage.getItem(`${o}:sidebarWidth`);
4223
4224
  if (!y) return t;
4224
- const k = Number(y);
4225
- return Number.isFinite(k) ? Math.max(n, Math.min(r, k)) : t;
4225
+ const x = Number(y);
4226
+ return Number.isFinite(x) ? Math.max(n, Math.min(r, x)) : t;
4226
4227
  } catch {
4227
4228
  return t;
4228
4229
  }
4229
- }), g = _(null), N = _(null), T = _(null), [R, v] = L(null), C = _(s);
4230
- C.current = s;
4230
+ }), g = _(null), N = _(null), T = _(null), [R, v] = L(null), P = _(s);
4231
+ P.current = s;
4231
4232
  const D = _(l);
4232
4233
  D.current = l;
4233
- const W = _(/* @__PURE__ */ new Set()), U = It(), ne = $o(), M = _(U);
4234
- M.current = U;
4235
- const S = _(ne);
4236
- S.current = ne;
4237
- const j = J(() => {
4234
+ const W = _(/* @__PURE__ */ new Set()), z = It(), re = $o(), j = _(z);
4235
+ j.current = z;
4236
+ const O = _(re);
4237
+ O.current = re;
4238
+ const U = J(() => {
4238
4239
  const y = /* @__PURE__ */ new Set();
4239
- for (const k of U.list())
4240
- k.placement === "center" && y.add(k.id);
4241
- for (const k of a ?? [])
4242
- y.add(k);
4240
+ for (const x of z.list())
4241
+ x.placement === "center" && y.add(x.id);
4242
+ for (const x of a ?? [])
4243
+ y.add(x);
4243
4244
  return [...y];
4244
- }, [a, U]), A = E((y) => {
4245
- const k = g.current;
4246
- if (!k) {
4245
+ }, [a, z]), A = E((y) => {
4246
+ const x = g.current;
4247
+ if (!x) {
4247
4248
  console.warn("[SurfaceShell] openFile: surface not ready (dockview not initialized)");
4248
4249
  return;
4249
4250
  }
4250
- const I = Et(y), O = bt(k, I);
4251
- if (O) {
4252
- O.api.setActive();
4251
+ const I = Et(y), M = bt(x, I);
4252
+ if (M) {
4253
+ M.api.setActive();
4253
4254
  return;
4254
4255
  }
4255
- const Q = {
4256
+ const X = {
4256
4257
  kind: Ke,
4257
4258
  target: I
4258
- }, z = S.current.resolve(Q);
4259
- if (!z) {
4259
+ }, B = O.current.resolve(X);
4260
+ if (!B) {
4260
4261
  console.warn(`[SurfaceShell] openFile: no surface resolver matched "${I}"`);
4261
4262
  return;
4262
4263
  }
4263
- if (!M.current.has(z.component)) {
4264
- console.warn(`[SurfaceShell] openFile: resolver returned unknown panel "${z.component}" for "${I}"`);
4264
+ if (!j.current.has(B.component)) {
4265
+ console.warn(`[SurfaceShell] openFile: resolver returned unknown panel "${B.component}" for "${I}"`);
4265
4266
  return;
4266
4267
  }
4267
- const ae = wt(Q, z), X = k.getPanel(ae);
4268
- if (X) {
4269
- z.params && X.api.updateParameters(z.params), X.api.setActive();
4268
+ const ae = wt(X, B), Z = x.getPanel(ae);
4269
+ if (Z) {
4270
+ B.params && Z.api.updateParameters(B.params), Z.api.setActive();
4270
4271
  return;
4271
4272
  }
4272
- k.addPanel({
4273
+ x.addPanel({
4273
4274
  id: ae,
4274
- component: z.component,
4275
- title: z.title ?? I.split("/").pop() ?? I,
4276
- params: z.params ?? { path: I }
4275
+ component: B.component,
4276
+ title: B.title ?? I.split("/").pop() ?? I,
4277
+ params: B.params ?? { path: I }
4277
4278
  });
4278
- }, []), G = E((y) => {
4279
- const k = g.current;
4280
- if (!k) {
4279
+ }, []), C = E((y) => {
4280
+ const x = g.current;
4281
+ if (!x) {
4281
4282
  console.warn("[SurfaceShell] openSurface: surface not ready (dockview not initialized)");
4282
4283
  return;
4283
4284
  }
4284
- const I = Ra(y), O = S.current.resolve(I);
4285
- if (!O) {
4285
+ const I = Ra(y), M = O.current.resolve(I);
4286
+ if (!M) {
4286
4287
  console.warn(`[SurfaceShell] openSurface: no resolver matched kind="${I.kind}" target="${I.target}"`);
4287
4288
  return;
4288
4289
  }
4289
- const Q = wt(I, O), z = I.kind === Ke ? bt(k, I.target) ?? k.getPanel(Q) : k.getPanel(Q);
4290
- if (z) {
4291
- O.params && z.api.updateParameters(O.params), z.api.setActive();
4290
+ const X = wt(I, M), B = I.kind === Ke ? bt(x, I.target) ?? x.getPanel(X) : x.getPanel(X);
4291
+ if (B) {
4292
+ M.params && B.api.updateParameters(M.params), B.api.setActive();
4292
4293
  return;
4293
4294
  }
4294
- const ae = M.current;
4295
- if (!ae.has(O.component)) {
4296
- const X = ae.list().map((he) => he.id).join(", ");
4295
+ const ae = j.current;
4296
+ if (!ae.has(M.component)) {
4297
+ const Z = ae.list().map((he) => he.id).join(", ");
4297
4298
  throw new Error(
4298
- `openSurface: unknown component "${O.component}". Registered panels: [${X}]. Register the component through a panel output before resolving to it.`
4299
+ `openSurface: unknown component "${M.component}". Registered panels: [${Z}]. Register the component through a panel output before resolving to it.`
4299
4300
  );
4300
4301
  }
4301
- k.addPanel({
4302
- id: Q,
4303
- component: O.component,
4304
- title: O.title ?? I.target,
4305
- params: O.params
4302
+ x.addPanel({
4303
+ id: X,
4304
+ component: M.component,
4305
+ title: M.title ?? I.target,
4306
+ params: M.params
4306
4307
  });
4307
- }, []), re = E((y) => {
4308
- const k = g.current;
4309
- if (!k) return;
4310
- const I = k.getPanel(y.id);
4308
+ }, []), Q = E((y) => {
4309
+ const x = g.current;
4310
+ if (!x) return;
4311
+ const I = x.getPanel(y.id);
4311
4312
  if (I) {
4312
4313
  y.params && I.api.updateParameters(y.params), I.api.setActive();
4313
4314
  return;
4314
4315
  }
4315
- const O = M.current;
4316
- if (!O.has(y.component)) {
4317
- const Q = O.list().map((z) => z.id).join(", ");
4316
+ const M = j.current;
4317
+ if (!M.has(y.component)) {
4318
+ const X = M.list().map((B) => B.id).join(", ");
4318
4319
  throw new Error(
4319
- `openPanel: unknown component "${y.component}". Registered panels: [${Q}]. Add the component to WorkspaceProvider's "panels" prop, or pick one of the registered ids.`
4320
+ `openPanel: unknown component "${y.component}". Registered panels: [${X}]. Add the component to WorkspaceProvider's "panels" prop, or pick one of the registered ids.`
4320
4321
  );
4321
4322
  }
4322
- k.addPanel({
4323
+ x.addPanel({
4323
4324
  id: y.id,
4324
4325
  component: y.component,
4325
4326
  title: y.title ?? y.id,
@@ -4328,81 +4329,81 @@ function La({
4328
4329
  }, []), h = E(() => {
4329
4330
  var I;
4330
4331
  const y = g.current;
4331
- return y ? { openTabs: y.panels.map((O) => ({
4332
- id: O.id,
4333
- title: O.title ?? O.id,
4334
- params: O.params ?? void 0
4332
+ return y ? { openTabs: y.panels.map((M) => ({
4333
+ id: M.id,
4334
+ title: M.title ?? M.id,
4335
+ params: M.params ?? void 0
4335
4336
  })), activeTab: ((I = y.activePanel) == null ? void 0 : I.id) ?? null } : { openTabs: [], activeTab: null };
4336
4337
  }, []), w = E(() => {
4337
- var z, ae;
4338
- const y = g.current, k = y ? y.panels.map((X) => ({
4339
- id: X.id,
4340
- component: String(X.component ?? ""),
4341
- params: X.params ?? void 0
4342
- })) : [], I = ((z = y == null ? void 0 : y.activePanel) == null ? void 0 : z.id) ?? null, O = ((ae = y == null ? void 0 : y.activePanel) == null ? void 0 : ae.params) ?? void 0, Q = typeof (O == null ? void 0 : O.path) == "string" ? O.path : null;
4338
+ var B, ae;
4339
+ const y = g.current, x = y ? y.panels.map((Z) => ({
4340
+ id: Z.id,
4341
+ component: String(Z.component ?? ""),
4342
+ params: Z.params ?? void 0
4343
+ })) : [], I = ((B = y == null ? void 0 : y.activePanel) == null ? void 0 : B.id) ?? null, M = ((ae = y == null ? void 0 : y.activePanel) == null ? void 0 : ae.params) ?? void 0, X = typeof (M == null ? void 0 : M.path) == "string" ? M.path : null;
4343
4344
  return {
4344
4345
  hydrationComplete: !0,
4345
4346
  layout: null,
4346
4347
  sidebar: { collapsed: !1, width: t },
4347
4348
  panelSizes: {},
4348
4349
  preferences: { theme: "dark" },
4349
- panels: k,
4350
+ panels: x,
4350
4351
  activePanel: I,
4351
- activeFile: Q,
4352
- visibleFiles: k.map((X) => {
4352
+ activeFile: X,
4353
+ visibleFiles: x.map((Z) => {
4353
4354
  var he;
4354
- return (he = X.params) == null ? void 0 : he.path;
4355
- }).filter((X) => typeof X == "string"),
4355
+ return (he = Z.params) == null ? void 0 : he.path;
4356
+ }).filter((Z) => typeof Z == "string"),
4356
4357
  dirtyFiles: {},
4357
4358
  notifications: []
4358
4359
  };
4359
- }, [t]), H = E(() => {
4360
+ }, [t]), K = E(() => {
4360
4361
  const y = w();
4361
- for (const k of W.current)
4362
- k(y);
4362
+ for (const x of W.current)
4363
+ x(y);
4363
4364
  }, [w]), oe = E((y) => {
4364
4365
  var I;
4365
- g.current = y, v(y), (I = C.current) == null || I.call(C, {
4366
+ g.current = y, v(y), (I = P.current) == null || I.call(P, {
4366
4367
  openFile: A,
4367
- openSurface: G,
4368
- openPanel: re,
4368
+ openSurface: C,
4369
+ openPanel: Q,
4369
4370
  closeWorkbenchLeftPane: () => u(!0),
4370
4371
  getSnapshot: h
4371
4372
  });
4372
- const k = () => {
4373
- var O;
4374
- (O = D.current) == null || O.call(D, h()), H();
4373
+ const x = () => {
4374
+ var M;
4375
+ (M = D.current) == null || M.call(D, h()), K();
4375
4376
  };
4376
- y.onDidAddPanel(k), y.onDidRemovePanel(k), y.onDidActivePanelChange(k), k();
4377
- }, [A, G, re, h, H]), le = E(
4377
+ y.onDidAddPanel(x), y.onDidRemovePanel(x), y.onDidActivePanelChange(x), x();
4378
+ }, [A, C, Q, h, K]), le = E(
4378
4379
  async (y) => {
4379
4380
  try {
4380
- const k = g.current;
4381
- if (!k) return nt("not-ready", "surface not ready");
4382
- const I = Et(y), O = bt(k, I);
4383
- if (O)
4384
- return O.api.setActive(), xe();
4385
- const Q = {
4381
+ const x = g.current;
4382
+ if (!x) return nt("not-ready", "surface not ready");
4383
+ const I = Et(y), M = bt(x, I);
4384
+ if (M)
4385
+ return M.api.setActive(), xe();
4386
+ const X = {
4386
4387
  kind: Ke,
4387
4388
  target: I
4388
- }, z = S.current.resolve(Q);
4389
- if (!z) return nt("NO_SURFACE_RESOLVER", `no registered surface resolver handles ${I}`);
4390
- if (!M.current.has(z.component))
4389
+ }, B = O.current.resolve(X);
4390
+ if (!B) return nt("NO_SURFACE_RESOLVER", `no registered surface resolver handles ${I}`);
4391
+ if (!j.current.has(B.component))
4391
4392
  return nt(
4392
4393
  "NO_SURFACE_PANEL",
4393
- `surface resolver "${Q.kind}" returned unknown panel "${z.component}"`
4394
+ `surface resolver "${X.kind}" returned unknown panel "${B.component}"`
4394
4395
  );
4395
- const ae = wt(Q, z), X = k.getPanel(ae);
4396
- return X ? (z.params && X.api.updateParameters(z.params), X.api.setActive(), xe()) : (k.addPanel({
4396
+ const ae = wt(X, B), Z = x.getPanel(ae);
4397
+ return Z ? (B.params && Z.api.updateParameters(B.params), Z.api.setActive(), xe()) : (x.addPanel({
4397
4398
  id: ae,
4398
- component: z.component,
4399
- title: z.title ?? I.split("/").pop() ?? I,
4400
- params: z.params ?? { path: I }
4399
+ component: B.component,
4400
+ title: B.title ?? I.split("/").pop() ?? I,
4401
+ params: B.params ?? { path: I }
4401
4402
  }), xe());
4402
- } catch (k) {
4403
+ } catch (x) {
4403
4404
  return nt(
4404
4405
  "INVALID_SURFACE_PATH",
4405
- k instanceof Error ? k.message : "failed to open file"
4406
+ x instanceof Error ? x.message : "failed to open file"
4406
4407
  );
4407
4408
  }
4408
4409
  },
@@ -4425,8 +4426,8 @@ function La({
4425
4426
  },
4426
4427
  subscribe: () => () => {
4427
4428
  },
4428
- select: (y, k) => {
4429
- const I = (O) => k(y(O));
4429
+ select: (y, x) => {
4430
+ const I = (M) => x(y(M));
4430
4431
  return W.current.add(I), I(w()), () => {
4431
4432
  W.current.delete(I);
4432
4433
  };
@@ -4439,10 +4440,10 @@ function La({
4439
4440
  [i, m]
4440
4441
  ), $e = E(
4441
4442
  (y) => {
4442
- const k = T.current;
4443
- if (!k) return;
4444
- const I = y.clientX - k.startX, O = Math.max(n, Math.min(r, k.startWidth + I));
4445
- p(O);
4443
+ const x = T.current;
4444
+ if (!x) return;
4445
+ const I = y.clientX - x.startX, M = Math.max(n, Math.min(r, x.startWidth + I));
4446
+ p(M);
4446
4447
  },
4447
4448
  [n, r]
4448
4449
  ), Re = E((y) => {
@@ -4450,8 +4451,8 @@ function La({
4450
4451
  }, []), se = E(
4451
4452
  (y) => {
4452
4453
  if (i) return;
4453
- const k = y.shiftKey ? 32 : 16;
4454
- y.key === "ArrowLeft" ? (y.preventDefault(), p((I) => Math.max(n, I - k))) : y.key === "ArrowRight" ? (y.preventDefault(), p((I) => Math.min(r, I + k))) : y.key === "Home" ? (y.preventDefault(), p(n)) : y.key === "End" && (y.preventDefault(), p(r));
4454
+ const x = y.shiftKey ? 32 : 16;
4455
+ y.key === "ArrowLeft" ? (y.preventDefault(), p((I) => Math.max(n, I - x))) : y.key === "ArrowRight" ? (y.preventDefault(), p((I) => Math.min(r, I + x))) : y.key === "Home" ? (y.preventDefault(), p(n)) : y.key === "End" && (y.preventDefault(), p(r));
4455
4456
  },
4456
4457
  [i, n, r]
4457
4458
  );
@@ -4467,7 +4468,7 @@ function La({
4467
4468
  localStorage.setItem(`${o}:sidebarCollapsed`, i ? "1" : "0");
4468
4469
  } catch {
4469
4470
  }
4470
- }, [o, i]), /* @__PURE__ */ x(
4471
+ }, [o, i]), /* @__PURE__ */ S(
4471
4472
  "div",
4472
4473
  {
4473
4474
  ref: N,
@@ -4475,7 +4476,7 @@ function La({
4475
4476
  className: ce("flex h-full min-h-0 w-full bg-background", d),
4476
4477
  "data-testid": "surface-shell",
4477
4478
  children: [
4478
- i ? null : /* @__PURE__ */ x(De, { children: [
4479
+ i ? null : /* @__PURE__ */ S(De, { children: [
4479
4480
  /* @__PURE__ */ c(
4480
4481
  "aside",
4481
4482
  {
@@ -4514,7 +4515,7 @@ function La({
4514
4515
  }
4515
4516
  )
4516
4517
  ] }),
4517
- /* @__PURE__ */ x("div", { className: "relative min-w-0 flex-1", children: [
4518
+ /* @__PURE__ */ S("div", { className: "relative min-w-0 flex-1", children: [
4518
4519
  /* @__PURE__ */ c(
4519
4520
  "div",
4520
4521
  {
@@ -4527,7 +4528,7 @@ function La({
4527
4528
  {
4528
4529
  storageKey: o,
4529
4530
  onReady: oe,
4530
- allowedPanels: j,
4531
+ allowedPanels: U,
4531
4532
  rightHeaderActions: f ? () => /* @__PURE__ */ c(_a, { onClose: f }) : void 0
4532
4533
  }
4533
4534
  )
@@ -4590,8 +4591,8 @@ function Oa({
4590
4591
  return () => {
4591
4592
  f.dispose(), a.dispose();
4592
4593
  };
4593
- }, [e]), o ? /* @__PURE__ */ x(De, { children: [
4594
- /* @__PURE__ */ x("div", { className: "pointer-events-none absolute inset-x-0 top-0 flex items-center gap-0.5 border-b border-[color:oklch(from_var(--border)_l_c_h/0.4)] bg-background px-1", style: { height: 44 }, children: [
4594
+ }, [e]), o ? /* @__PURE__ */ S(De, { children: [
4595
+ /* @__PURE__ */ S("div", { className: "pointer-events-none absolute inset-x-0 top-0 flex items-center gap-0.5 border-b border-[color:oklch(from_var(--border)_l_c_h/0.4)] bg-background px-1", style: { height: 44 }, children: [
4595
4596
  t && /* @__PURE__ */ c(
4596
4597
  me,
4597
4598
  {
@@ -4620,14 +4621,14 @@ function Oa({
4620
4621
  }
4621
4622
  )
4622
4623
  ] }),
4623
- /* @__PURE__ */ x("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-3 px-6 pt-12 pb-10 text-center", children: [
4624
- /* @__PURE__ */ x("div", { className: "flex items-center gap-2 text-[10.5px] font-medium uppercase tracking-[0.16em] text-muted-foreground", children: [
4624
+ /* @__PURE__ */ S("div", { className: "pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-3 px-6 pt-12 pb-10 text-center", children: [
4625
+ /* @__PURE__ */ S("div", { className: "flex items-center gap-2 text-[10.5px] font-medium uppercase tracking-[0.16em] text-muted-foreground", children: [
4625
4626
  /* @__PURE__ */ c("span", { className: "inline-block h-px w-4 bg-[color:var(--accent)]", "aria-hidden": "true" }),
4626
4627
  "Workbench"
4627
4628
  ] }),
4628
4629
  /* @__PURE__ */ c("div", { className: "text-[15px] font-medium tracking-tight text-foreground", children: "Nothing open yet" }),
4629
4630
  /* @__PURE__ */ c("p", { className: "max-w-[280px] text-[12.5px] leading-relaxed text-muted-foreground", children: "Open a source item, or let the agent produce an artifact here." }),
4630
- t && /* @__PURE__ */ x(
4631
+ t && /* @__PURE__ */ S(
4631
4632
  ke,
4632
4633
  {
4633
4634
  type: "button",
@@ -4822,7 +4823,7 @@ function Ja({
4822
4823
  function Qa({ onOpenFile: e }) {
4823
4824
  return $(() => {
4824
4825
  if (e)
4825
- return V.on(pe.uiCommand, ({ command: t }) => {
4826
+ return H.on(pe.uiCommand, ({ command: t }) => {
4826
4827
  if (t.kind !== "openFile") return;
4827
4828
  const n = t.params.path;
4828
4829
  typeof n == "string" && e(n);
@@ -4850,8 +4851,8 @@ function Tc({
4850
4851
  onAuthError: R,
4851
4852
  onOpenFile: v
4852
4853
  }) {
4853
- const C = _(null);
4854
- if (!C.current) {
4854
+ const P = _(null);
4855
+ if (!P.current) {
4855
4856
  const se = hr({
4856
4857
  workspaceId: p,
4857
4858
  storageKey: g,
@@ -4859,67 +4860,67 @@ function Tc({
4859
4860
  });
4860
4861
  rr(se);
4861
4862
  const y = u ?? wr();
4862
- y !== "light" && !N ? se.getState().setTheme(y) : y !== "light" && (typeof localStorage < "u" && localStorage.getItem("boring-ui-v2:preferences") !== null || se.getState().setTheme(y)), C.current = se;
4863
+ y !== "light" && !N ? se.getState().setTheme(y) : y !== "light" && (typeof localStorage < "u" && localStorage.getItem("boring-ui-v2:preferences") !== null || se.getState().setTheme(y)), P.current = se;
4863
4864
  }
4864
- const D = C.current, W = _(null), U = _(d);
4865
- U.current = d;
4866
- const ne = _(R);
4867
- ne.current = R, $(() => () => {
4865
+ const D = P.current, W = _(null), z = _(d);
4866
+ z.current = d;
4867
+ const re = _(R);
4868
+ re.current = R, $(() => () => {
4868
4869
  var se;
4869
4870
  (se = W.current) == null || se.disconnect(), W.current = null, D.cleanup();
4870
4871
  }, [D]), $(() => {
4871
- var I, O;
4872
+ var I, M;
4872
4873
  if (W.current && (W.current.disconnect(), W.current = null), !T) return;
4873
- const se = Yo(D), y = (O = (I = U.current) == null ? void 0 : I.Authorization) == null ? void 0 : O.replace(/^Bearer\s+/i, ""), k = Zo({
4874
+ const se = Yo(D), y = (M = (I = z.current) == null ? void 0 : I.Authorization) == null ? void 0 : M.replace(/^Bearer\s+/i, ""), x = Zo({
4874
4875
  endpoint: T,
4875
4876
  bridge: se,
4876
4877
  store: D,
4877
4878
  authToken: y,
4878
- onAuthError: (Q) => {
4879
- var z;
4880
- return (z = ne.current) == null ? void 0 : z.call(ne, Q);
4879
+ onAuthError: (X) => {
4880
+ var B;
4881
+ return (B = re.current) == null ? void 0 : B.call(re, X);
4881
4882
  },
4882
4883
  onConnectionChange: Fe
4883
4884
  });
4884
- return k.connect(), W.current = k, () => {
4885
- k.disconnect(), W.current = null;
4885
+ return x.connect(), W.current = x, () => {
4886
+ x.disconnect(), W.current = null;
4886
4887
  };
4887
4888
  }, [T, D]);
4888
- const { panelRegistry: M, commandRegistry: S, catalogRegistry: j, surfaceResolverRegistry: A, pluginMetas: G, pluginsWithBindings: re } = J(() => {
4889
- const se = new qs(f), y = new Hs(), k = new _n(), I = new On();
4890
- for (const X of Wa) {
4891
- const { id: he, ...be } = X;
4889
+ const { panelRegistry: j, commandRegistry: O, catalogRegistry: U, surfaceResolverRegistry: A, pluginMetas: C, pluginsWithBindings: Q } = J(() => {
4890
+ const se = new qs(f), y = new Hs(), x = new _n(), I = new On();
4891
+ for (const Z of Wa) {
4892
+ const { id: he, ...be } = Z;
4892
4893
  se.register(he, be);
4893
4894
  }
4894
- const Q = new Set(r ?? []).has(un.id) ? [] : [un], z = [...Q, ...n ?? []];
4895
+ const X = new Set(r ?? []).has(un.id) ? [] : [un], B = [...X, ...n ?? []];
4895
4896
  Io({
4896
4897
  chatPanel: t ?? za,
4897
4898
  plugins: n ?? [],
4898
- defaults: Q,
4899
+ defaults: X,
4899
4900
  excludeDefaults: r,
4900
- registries: { panels: se, commands: y, catalogs: k, surfaceResolvers: I }
4901
+ registries: { panels: se, commands: y, catalogs: x, surfaceResolvers: I }
4901
4902
  });
4902
4903
  const ae = [
4903
4904
  { id: "workspace:chat-layout", label: "Layout" },
4904
4905
  { id: "agent:chat-layout", label: "Layout" },
4905
- ...z.map((X) => ({
4906
- id: X.id,
4907
- label: X.label,
4908
- systemPrompt: X.systemPrompt
4906
+ ...B.map((Z) => ({
4907
+ id: Z.id,
4908
+ label: Z.label,
4909
+ systemPrompt: Z.systemPrompt
4909
4910
  }))
4910
4911
  ];
4911
4912
  if (o)
4912
- for (const X of o) {
4913
- const { id: he, ...be } = X;
4913
+ for (const Z of o) {
4914
+ const { id: he, ...be } = Z;
4914
4915
  se.register(he, be);
4915
4916
  }
4916
4917
  return {
4917
4918
  panelRegistry: se,
4918
4919
  commandRegistry: y,
4919
- catalogRegistry: k,
4920
+ catalogRegistry: x,
4920
4921
  surfaceResolverRegistry: I,
4921
4922
  pluginMetas: ae,
4922
- pluginsWithBindings: z
4923
+ pluginsWithBindings: B
4923
4924
  };
4924
4925
  }, [f, t, n, r, o]), h = _(m);
4925
4926
  h.current = m;
@@ -4929,7 +4930,7 @@ function Tc({
4929
4930
  D.getState().setTheme(se), (y = h.current) == null || y.call(h, se);
4930
4931
  },
4931
4932
  [D]
4932
- ), H = E(() => {
4933
+ ), K = E(() => {
4933
4934
  const se = D.getState().preferences.theme === "light" ? "dark" : "light";
4934
4935
  w(se);
4935
4936
  }, [D, w]), oe = _t();
@@ -4937,32 +4938,32 @@ function Tc({
4937
4938
  document.documentElement.removeAttribute("data-theme");
4938
4939
  }), [oe]);
4939
4940
  const le = J(
4940
- () => ({ setTheme: w, toggleTheme: H }),
4941
- [w, H]
4941
+ () => ({ setTheme: w, toggleTheme: K }),
4942
+ [w, K]
4942
4943
  ), [de, Fe] = L(!1), $e = J(
4943
4944
  () => ({ connected: de }),
4944
4945
  [de]
4945
4946
  ), Re = J(
4946
- () => ({ chatPanel: t ?? null, registeredPlugins: G }),
4947
- [t, G]
4947
+ () => ({ chatPanel: t ?? null, registeredPlugins: C }),
4948
+ [t, C]
4948
4949
  );
4949
4950
  return /* @__PURE__ */ c(jt.Provider, { value: Re, children: /* @__PURE__ */ c(Mt.Provider, { value: le, children: /* @__PURE__ */ c(Sr.Provider, { value: $e, children: /* @__PURE__ */ c(Oo, { children: /* @__PURE__ */ c(
4950
4951
  Fo,
4951
4952
  {
4952
- panelRegistry: M,
4953
- commandRegistry: S,
4954
- catalogRegistry: j,
4953
+ panelRegistry: j,
4954
+ commandRegistry: O,
4955
+ catalogRegistry: U,
4955
4956
  surfaceResolverRegistry: A,
4956
- children: /* @__PURE__ */ x(
4957
+ children: /* @__PURE__ */ S(
4957
4958
  Ja,
4958
4959
  {
4959
- plugins: re,
4960
+ plugins: Q,
4960
4961
  apiBaseUrl: a,
4961
4962
  authHeaders: d,
4962
4963
  onAuthError: R,
4963
4964
  apiTimeout: i,
4964
4965
  children: [
4965
- /* @__PURE__ */ c(Ya, { plugins: re }),
4966
+ /* @__PURE__ */ c(Ya, { plugins: Q }),
4966
4967
  /* @__PURE__ */ c(Qa, { onOpenFile: v }),
4967
4968
  /* @__PURE__ */ c(Ka, { commands: s }),
4968
4969
  /* @__PURE__ */ c(
@@ -5082,23 +5083,23 @@ function ec(e) {
5082
5083
  for (const w of (p == null ? void 0 : p.registeredPlugins) ?? [])
5083
5084
  w.label && (h[w.id] = w.label);
5084
5085
  return h;
5085
- }, [p == null ? void 0 : p.registeredPlugins]), N = _(null), T = _(null), R = _(!1), v = s === "commands", C = r.trim();
5086
+ }, [p == null ? void 0 : p.registeredPlugins]), N = _(null), T = _(null), R = _(!1), v = s === "commands", P = r.trim();
5086
5087
  $(() => {
5087
5088
  if (v) {
5088
5089
  a("");
5089
5090
  return;
5090
5091
  }
5091
- const h = setTimeout(() => a(C), 180);
5092
+ const h = setTimeout(() => a(P), 180);
5092
5093
  return () => clearTimeout(h);
5093
- }, [v, C]), $(() => {
5094
+ }, [v, P]), $(() => {
5094
5095
  if (!t) return;
5095
- const h = (H) => {
5096
- H.key === "Escape" && (H.preventDefault(), H.stopPropagation(), n(!1));
5097
- }, w = (H) => {
5098
- const oe = H.target;
5096
+ const h = (K) => {
5097
+ K.key === "Escape" && (K.preventDefault(), K.stopPropagation(), n(!1));
5098
+ }, w = (K) => {
5099
+ const oe = K.target;
5099
5100
  if (!oe) return;
5100
5101
  const le = document.querySelector('[data-slot="dialog-content"]');
5101
- le && !le.contains(oe) && (H.preventDefault(), H.stopPropagation(), n(!1));
5102
+ le && !le.contains(oe) && (K.preventDefault(), K.stopPropagation(), n(!1));
5102
5103
  };
5103
5104
  return window.addEventListener("keydown", h, { capture: !0 }), window.addEventListener("pointerdown", w, { capture: !0 }), () => {
5104
5105
  window.removeEventListener("keydown", h, { capture: !0 }), window.removeEventListener("pointerdown", w, { capture: !0 });
@@ -5132,17 +5133,17 @@ function ec(e) {
5132
5133
  var w;
5133
5134
  return (w = N.current) == null ? void 0 : w.focus();
5134
5135
  });
5135
- }, []), U = E(() => {
5136
+ }, []), z = E(() => {
5136
5137
  W(s === "commands" ? "catalogs" : "commands");
5137
- }, [s, W]), ne = E((h) => {
5138
+ }, [s, W]), re = E((h) => {
5138
5139
  if (h.startsWith(">")) {
5139
5140
  l("commands"), o(h.slice(1));
5140
5141
  return;
5141
5142
  }
5142
5143
  o(h);
5143
- }, []), M = E((h) => {
5144
- h.key === "Tab" && (h.preventDefault(), h.stopPropagation(), U());
5145
- }, [U]);
5144
+ }, []), j = E((h) => {
5145
+ h.key === "Tab" && (h.preventDefault(), h.stopPropagation(), z());
5146
+ }, [z]);
5146
5147
  $(() => {
5147
5148
  if (v || !f) {
5148
5149
  i([]);
@@ -5156,7 +5157,7 @@ function ec(e) {
5156
5157
  loading: !0
5157
5158
  }))
5158
5159
  );
5159
- const H = (oe, le) => {
5160
+ const K = (oe, le) => {
5160
5161
  h.signal.aborted || i(
5161
5162
  (de) => de.map(
5162
5163
  (Fe) => Fe.catalog.id === oe.id ? { catalog: oe, ...le } : Fe
@@ -5174,13 +5175,13 @@ function ec(e) {
5174
5175
  });
5175
5176
  Promise.resolve(le).then(
5176
5177
  (de) => {
5177
- H(oe, {
5178
+ K(oe, {
5178
5179
  rows: de.items.slice(0, rt),
5179
5180
  loading: !1
5180
5181
  });
5181
5182
  },
5182
5183
  (de) => {
5183
- H(oe, {
5184
+ K(oe, {
5184
5185
  rows: [],
5185
5186
  loading: !1,
5186
5187
  error: xn(de)
@@ -5188,7 +5189,7 @@ function ec(e) {
5188
5189
  }
5189
5190
  );
5190
5191
  } catch (le) {
5191
- H(oe, {
5192
+ K(oe, {
5192
5193
  rows: [],
5193
5194
  loading: !1,
5194
5195
  error: xn(le)
@@ -5198,33 +5199,33 @@ function ec(e) {
5198
5199
  h.abort();
5199
5200
  };
5200
5201
  }, [u, f, v]);
5201
- const S = J(() => {
5202
+ const O = J(() => {
5202
5203
  if (!v) return [];
5203
5204
  const h = m.filter(Za);
5204
- if (!C) return h.slice(0, rt);
5205
- const w = C.toLowerCase();
5206
- return h.filter((H) => {
5205
+ if (!P) return h.slice(0, rt);
5206
+ const w = P.toLowerCase();
5207
+ return h.filter((K) => {
5207
5208
  var oe;
5208
- return H.title.toLowerCase().includes(w) ? !0 : ((oe = H.keywords) == null ? void 0 : oe.some((le) => le.toLowerCase().includes(w))) ?? !1;
5209
+ return K.title.toLowerCase().includes(w) ? !0 : ((oe = K.keywords) == null ? void 0 : oe.some((le) => le.toLowerCase().includes(w))) ?? !1;
5209
5210
  }).slice(0, rt);
5210
- }, [m, v, C]), j = J(() => v || C ? [] : Wt().filter((w) => w.type === "catalog" ? u.some((H) => H.id === w.catalogId) : m.some((H) => H.id === w.commandId)), [v, C, u, m]), A = E((h, w) => {
5211
+ }, [m, v, P]), U = J(() => v || P ? [] : Wt().filter((w) => w.type === "catalog" ? u.some((K) => K.id === w.catalogId) : m.some((K) => K.id === w.commandId)), [v, P, u, m]), A = E((h, w) => {
5211
5212
  vn(h.id, w), h.onSelect(w), n(!1);
5212
- }, []), G = E(
5213
+ }, []), C = E(
5213
5214
  (h) => {
5214
5215
  bn(h.id, h.title), h.run(), n(!1);
5215
5216
  },
5216
5217
  []
5217
- ), re = E((h) => {
5218
+ ), Q = E((h) => {
5218
5219
  if (h.type === "catalog") {
5219
- const w = u.find((H) => H.id === h.catalogId);
5220
+ const w = u.find((K) => K.id === h.catalogId);
5220
5221
  w && (vn(w.id, h.rowSnapshot), w.onSelect(h.rowSnapshot));
5221
5222
  } else {
5222
- const w = m.find((H) => H.id === h.commandId);
5223
+ const w = m.find((K) => K.id === h.commandId);
5223
5224
  w && (bn(w.id, w.title), w.run());
5224
5225
  }
5225
5226
  n(!1);
5226
5227
  }, [u, m]);
5227
- return /* @__PURE__ */ c(io, { open: t, onOpenChange: n, children: /* @__PURE__ */ x(
5228
+ return /* @__PURE__ */ c(io, { open: t, onOpenChange: n, children: /* @__PURE__ */ S(
5228
5229
  ao,
5229
5230
  {
5230
5231
  className: "cmdk-shell overflow-hidden border-border/60 p-0 shadow-2xl backdrop-blur-md sm:max-w-[640px] [&>button.dialog-close]:hidden",
@@ -5232,13 +5233,13 @@ function ec(e) {
5232
5233
  onPointerDownOutside: () => n(!1),
5233
5234
  onEscapeKeyDown: () => n(!1),
5234
5235
  children: [
5235
- /* @__PURE__ */ x(co, { className: "sr-only", children: [
5236
+ /* @__PURE__ */ S(co, { className: "sr-only", children: [
5236
5237
  /* @__PURE__ */ c(lo, { children: "Command Palette" }),
5237
5238
  /* @__PURE__ */ c(uo, { children: "Search catalogs or switch to commands" })
5238
5239
  ] }),
5239
- /* @__PURE__ */ x(fo, { shouldFilter: !1, className: "bg-transparent", children: [
5240
- /* @__PURE__ */ x("div", { className: "relative flex items-stretch [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:h-auto", children: [
5241
- /* @__PURE__ */ x(
5240
+ /* @__PURE__ */ S(fo, { shouldFilter: !1, className: "bg-transparent", children: [
5241
+ /* @__PURE__ */ S("div", { className: "relative flex items-stretch [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:h-auto", children: [
5242
+ /* @__PURE__ */ S(
5242
5243
  "div",
5243
5244
  {
5244
5245
  role: "group",
@@ -5272,26 +5273,26 @@ function ec(e) {
5272
5273
  ref: N,
5273
5274
  placeholder: v ? "Run a command..." : "Search catalogs or type > for commands",
5274
5275
  value: r,
5275
- onValueChange: ne,
5276
- onKeyDown: M,
5276
+ onValueChange: re,
5277
+ onKeyDown: j,
5277
5278
  className: "h-12 bg-transparent text-base focus-visible:ring-0"
5278
5279
  }
5279
5280
  )
5280
5281
  ] }),
5281
- /* @__PURE__ */ x(po, { className: "max-h-[440px] overflow-y-auto py-1", children: [
5282
+ /* @__PURE__ */ S(po, { className: "max-h-[440px] overflow-y-auto py-1", children: [
5282
5283
  /* @__PURE__ */ c(ho, { className: "py-10 text-center text-sm text-muted-foreground", children: v ? "No matching commands" : "No catalog results" }),
5283
- !v && j.length > 0 && !C && /* @__PURE__ */ c(pt, { heading: "Recent", children: j.map((h) => {
5284
+ !v && U.length > 0 && !P && /* @__PURE__ */ c(pt, { heading: "Recent", children: U.map((h) => {
5284
5285
  const w = h.type === "catalog" ? `recent:catalog:${h.catalogId}:${h.rowId}` : `recent:command:${h.commandId}`;
5285
5286
  return /* @__PURE__ */ c(
5286
5287
  Be,
5287
5288
  {
5288
5289
  value: w,
5289
- onSelect: () => re(h),
5290
+ onSelect: () => Q(h),
5290
5291
  className: "group flex items-center gap-3 rounded-md px-3 py-2 text-sm aria-selected:bg-[color:oklch(from_var(--accent)_l_c_h/0.10)] aria-selected:text-foreground",
5291
- children: h.type === "catalog" ? /* @__PURE__ */ x(De, { children: [
5292
+ children: h.type === "catalog" ? /* @__PURE__ */ S(De, { children: [
5292
5293
  /* @__PURE__ */ c(Ur, { className: "size-4 shrink-0 text-muted-foreground/70 group-aria-selected:text-[color:var(--accent)]" }),
5293
5294
  /* @__PURE__ */ c(Pn, { row: h.rowSnapshot })
5294
- ] }) : /* @__PURE__ */ x(De, { children: [
5295
+ ] }) : /* @__PURE__ */ S(De, { children: [
5295
5296
  /* @__PURE__ */ c(mt, { className: "size-4 shrink-0 text-muted-foreground/70 group-aria-selected:text-[color:var(--accent)]" }),
5296
5297
  /* @__PURE__ */ c("span", { className: "flex-1 truncate", children: h.titleSnapshot }),
5297
5298
  /* @__PURE__ */ c("span", { className: "shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground", children: "command" })
@@ -5300,8 +5301,8 @@ function ec(e) {
5300
5301
  w
5301
5302
  );
5302
5303
  }) }),
5303
- !v && d.filter((h) => h.loading || h.error || h.rows.length > 0).map((h) => /* @__PURE__ */ x(pt, { heading: h.catalog.label, children: [
5304
- h.loading ? /* @__PURE__ */ x(
5304
+ !v && d.filter((h) => h.loading || h.error || h.rows.length > 0).map((h) => /* @__PURE__ */ S(pt, { heading: h.catalog.label, children: [
5305
+ h.loading ? /* @__PURE__ */ S(
5305
5306
  Be,
5306
5307
  {
5307
5308
  value: `${h.catalog.id}:loading`,
@@ -5313,7 +5314,7 @@ function ec(e) {
5313
5314
  ]
5314
5315
  }
5315
5316
  ) : null,
5316
- h.error ? /* @__PURE__ */ x(
5317
+ h.error ? /* @__PURE__ */ S(
5317
5318
  Be,
5318
5319
  {
5319
5320
  value: `${h.catalog.id}:error`,
@@ -5331,7 +5332,7 @@ function ec(e) {
5331
5332
  value: `${h.catalog.id}:${w.id}:${w.title}:${w.subtitle ?? ""}`,
5332
5333
  onSelect: () => A(h.catalog, w),
5333
5334
  className: "group flex items-center gap-3 rounded-md px-3 py-2 text-sm aria-selected:bg-[color:oklch(from_var(--accent)_l_c_h/0.10)] aria-selected:text-foreground",
5334
- children: /* @__PURE__ */ x(
5335
+ children: /* @__PURE__ */ S(
5335
5336
  ft,
5336
5337
  {
5337
5338
  pluginId: h.catalog.pluginId ?? h.catalog.id,
@@ -5347,11 +5348,11 @@ function ec(e) {
5347
5348
  `${h.catalog.id}:${w.id}`
5348
5349
  ))
5349
5350
  ] }, h.catalog.id)),
5350
- v && S.length > 0 && /* @__PURE__ */ c(pt, { heading: "Commands", children: S.map((h) => /* @__PURE__ */ x(
5351
+ v && O.length > 0 && /* @__PURE__ */ c(pt, { heading: "Commands", children: O.map((h) => /* @__PURE__ */ S(
5351
5352
  Be,
5352
5353
  {
5353
5354
  value: h.title,
5354
- onSelect: () => G(h),
5355
+ onSelect: () => C(h),
5355
5356
  className: "group flex items-center gap-3 rounded-md px-3 py-2 text-sm aria-selected:bg-[color:oklch(from_var(--accent)_l_c_h/0.10)] aria-selected:text-foreground",
5356
5357
  children: [
5357
5358
  /* @__PURE__ */ c(mt, { className: "size-4 shrink-0 text-muted-foreground/70 group-aria-selected:text-[color:var(--accent)]" }),
@@ -5363,23 +5364,23 @@ function ec(e) {
5363
5364
  h.id
5364
5365
  )) })
5365
5366
  ] }),
5366
- /* @__PURE__ */ x("div", { className: "flex items-center justify-between border-t border-border/50 bg-muted/30 px-3 py-2 text-[11px] text-muted-foreground", children: [
5367
+ /* @__PURE__ */ S("div", { className: "flex items-center justify-between border-t border-border/50 bg-muted/30 px-3 py-2 text-[11px] text-muted-foreground", children: [
5367
5368
  /* @__PURE__ */ c("span", { className: "font-medium tracking-wide uppercase", children: v ? "Commands" : Sn }),
5368
- /* @__PURE__ */ x("div", { className: "flex items-center gap-3", children: [
5369
- /* @__PURE__ */ x("span", { className: "flex items-center gap-1", children: [
5369
+ /* @__PURE__ */ S("div", { className: "flex items-center gap-3", children: [
5370
+ /* @__PURE__ */ S("span", { className: "flex items-center gap-1", children: [
5370
5371
  /* @__PURE__ */ c(je, { children: "tab" }),
5371
5372
  /* @__PURE__ */ c("span", { children: "switch" })
5372
5373
  ] }),
5373
- /* @__PURE__ */ x("span", { className: "flex items-center gap-1", children: [
5374
+ /* @__PURE__ */ S("span", { className: "flex items-center gap-1", children: [
5374
5375
  /* @__PURE__ */ c(je, { children: /* @__PURE__ */ c(Br, { className: "size-3" }) }),
5375
5376
  /* @__PURE__ */ c(je, { children: /* @__PURE__ */ c(qr, { className: "size-3" }) }),
5376
5377
  /* @__PURE__ */ c("span", { children: "navigate" })
5377
5378
  ] }),
5378
- /* @__PURE__ */ x("span", { className: "flex items-center gap-1", children: [
5379
+ /* @__PURE__ */ S("span", { className: "flex items-center gap-1", children: [
5379
5380
  /* @__PURE__ */ c(je, { children: /* @__PURE__ */ c(Vr, { className: "size-3" }) }),
5380
5381
  /* @__PURE__ */ c("span", { children: "open" })
5381
5382
  ] }),
5382
- /* @__PURE__ */ x("span", { className: "flex items-center gap-1", children: [
5383
+ /* @__PURE__ */ S("span", { className: "flex items-center gap-1", children: [
5383
5384
  /* @__PURE__ */ c(je, { children: "esc" }),
5384
5385
  /* @__PURE__ */ c("span", { children: "close" })
5385
5386
  ] })
@@ -5396,7 +5397,7 @@ function kn({
5396
5397
  label: n,
5397
5398
  onClick: r
5398
5399
  }) {
5399
- return /* @__PURE__ */ x(
5400
+ return /* @__PURE__ */ S(
5400
5401
  ke,
5401
5402
  {
5402
5403
  type: "button",
@@ -5416,7 +5417,7 @@ function kn({
5416
5417
  );
5417
5418
  }
5418
5419
  function Pn({ row: e }) {
5419
- return /* @__PURE__ */ x("span", { className: "flex min-w-0 flex-1 items-baseline gap-2 truncate", children: [
5420
+ return /* @__PURE__ */ S("span", { className: "flex min-w-0 flex-1 items-baseline gap-2 truncate", children: [
5420
5421
  /* @__PURE__ */ c("span", { className: "truncate font-medium text-foreground", children: e.title }),
5421
5422
  e.subtitle ? /* @__PURE__ */ c("span", { className: "truncate text-xs text-muted-foreground/70", children: e.subtitle }) : null,
5422
5423
  e.meta ? /* @__PURE__ */ c("span", { className: "ml-auto shrink-0 text-xs text-muted-foreground/70", children: e.meta }) : null
@@ -5428,10 +5429,10 @@ export {
5428
5429
  vi as B,
5429
5430
  _n as C,
5430
5431
  ni as D,
5431
- V as E,
5432
+ H as E,
5432
5433
  mi as F,
5433
5434
  Go as G,
5434
- te as H,
5435
+ ne as H,
5435
5436
  un as I,
5436
5437
  Pc as J,
5437
5438
  Ks as K,