@pstdio/workbench 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,85 +1,85 @@
1
- import { jsxs as pe, jsx as N } from "react/jsx-runtime";
2
- import { useRef as v, useState as be, useEffect as B, createElement as U } from "react";
3
- import { host as ot } from "rimless";
4
- import { F as ae } from "./file-section-navigation-CfYqVObc.js";
5
- import { r as je, d as de } from "./composition-resolver-types-CWykPyEK.js";
6
- import { c as he, w as st } from "./workbench-menu-paths-Bb0ICxeG.js";
7
- import { W as V } from "./icon-B9XolQG8.js";
8
- import { isLocalizedString as it, matchesResourceWhen as at } from "@pstdio/sdk/extensions";
9
- import { w as dt } from "./layout-types-DMoZz38-.js";
10
- const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "notification.action", "notification.resolve", "notification.dismiss", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "terminal.session", "files.upload", "files.list", "files.delete"], Se = ["host.dispatchKeyboardEvent"], lt = [...ct, ...Se], mt = new Set(lt), He = (e) => mt.has(e), ut = (e) => {
11
- const [t, r] = e.split("@"), n = r === void 0 ? ce : Number(r);
1
+ import { jsxs as Ee, jsx as G } from "react/jsx-runtime";
2
+ import { useRef as R, useState as Pe, useEffect as Q, createElement as K } from "react";
3
+ import { host as yt } from "rimless";
4
+ import { F as we } from "./file-section-navigation-CfYqVObc.js";
5
+ import { i as vt, c as Ae, w as kt } from "./workbench-menu-paths-D-e7iscN.js";
6
+ import { r as Le, d as Ie } from "./composition-resolver-types-CWykPyEK.js";
7
+ import { W as Y, a as Rt } from "./workflow-status-settings-DLiu9FZ0.js";
8
+ import { isLocalizedString as Ct, matchesResourceWhen as xt } from "@pstdio/sdk/extensions";
9
+ import { w as Et } from "./layout-types-DMoZz38-.js";
10
+ const ye = 1, Pt = ["commands.execute", "resource.open", "notification.show", "notification.action", "notification.resolve", "notification.dismiss", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "terminal.session", "files.upload", "files.list", "files.delete"], Ue = ["host.dispatchKeyboardEvent"], At = [...Pt, ...Ue], St = new Set(At), _e = (e) => St.has(e), Tt = (e) => {
11
+ const [t, n] = e.split("@"), r = n === void 0 ? ye : Number(n);
12
12
  return {
13
13
  capability: e,
14
14
  name: t ?? "",
15
- version: n
15
+ version: r
16
16
  };
17
- }, Y = (e) => ({
17
+ }, ne = (e) => ({
18
18
  capability: e,
19
19
  code: "unsupported_webview_capability",
20
20
  message: `Unsupported webview capability: ${e}`,
21
21
  severity: "error"
22
- }), ft = (e, t, r) => ({
22
+ }), jt = (e, t, n) => ({
23
23
  capability: e,
24
24
  code: "unsupported_webview_capability_version",
25
- message: `Unsupported webview capability version: ${t}@${r.toString()} (supported: ${ce.toString()})`,
25
+ message: `Unsupported webview capability version: ${t}@${n.toString()} (supported: ${ye.toString()})`,
26
26
  severity: "error"
27
- }), pt = (e) => ({
27
+ }), Wt = (e) => ({
28
28
  capability: e,
29
29
  code: "undeclared_webview_capability",
30
30
  message: `Webview did not declare host capability: ${e}`,
31
31
  severity: "error"
32
- }), bt = (e, t = {}) => {
33
- const r = [], n = /* @__PURE__ */ new Set();
34
- for (const o of Se)
35
- t[o] && n.add(o);
36
- for (const o of e ?? []) {
37
- const s = ut(o);
38
- if (!He(s.name)) {
39
- r.push(Y(o));
32
+ }), Mt = (e, t = {}) => {
33
+ const n = [], r = /* @__PURE__ */ new Set();
34
+ for (const s of Ue)
35
+ t[s] && r.add(s);
36
+ for (const s of e ?? []) {
37
+ const o = Tt(s);
38
+ if (!_e(o.name)) {
39
+ n.push(ne(s));
40
40
  continue;
41
41
  }
42
- if (s.version !== ce) {
43
- r.push(ft(o, s.name, s.version));
42
+ if (o.version !== ye) {
43
+ n.push(jt(s, o.name, o.version));
44
44
  continue;
45
45
  }
46
- if (!t[s.name]) {
47
- r.push(Y(o));
46
+ if (!t[o.name]) {
47
+ n.push(ne(s));
48
48
  continue;
49
49
  }
50
- n.add(s.name);
50
+ r.add(o.name);
51
51
  }
52
52
  return {
53
- allowed: n,
54
- diagnostics: r
53
+ allowed: r,
54
+ diagnostics: n
55
55
  };
56
- }, ht = (e) => {
56
+ }, Ot = (e) => {
57
57
  const {
58
58
  allowed: t,
59
- diagnostics: r
60
- } = bt(e.declaredCapabilities, e.capabilities), n = (o) => {
61
- e.onDiagnostic?.(o);
59
+ diagnostics: n
60
+ } = Mt(e.declaredCapabilities, e.capabilities), r = (s) => {
61
+ e.onDiagnostic?.(s);
62
62
  };
63
63
  return {
64
- diagnostics: r,
65
- async call(o) {
66
- if (!He(o.method)) {
67
- const i = Y(o.method);
68
- throw n(i), new Error(i.message);
64
+ diagnostics: n,
65
+ async call(s) {
66
+ if (!_e(s.method)) {
67
+ const i = ne(s.method);
68
+ throw r(i), new Error(i.message);
69
69
  }
70
- if (!t.has(o.method)) {
71
- const i = pt(o.method);
72
- throw n(i), new Error(i.message);
70
+ if (!t.has(s.method)) {
71
+ const i = Wt(s.method);
72
+ throw r(i), new Error(i.message);
73
73
  }
74
- const s = e.capabilities[o.method];
75
- if (!s) {
76
- const i = Y(o.method);
77
- throw n(i), new Error(i.message);
74
+ const o = e.capabilities[s.method];
75
+ if (!o) {
76
+ const i = ne(s.method);
77
+ throw r(i), new Error(i.message);
78
78
  }
79
- return await s(o.params);
79
+ return await o(s.params);
80
80
  }
81
81
  };
82
- }, gt = (e) => typeof e == "object" && e !== null, ge = (e) => {
82
+ }, Ht = (e) => typeof e == "object" && e !== null, Se = (e) => {
83
83
  try {
84
84
  const t = JSON.stringify(e);
85
85
  if (typeof t == "string" && t.length > 0) return t;
@@ -90,7 +90,7 @@ const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "n
90
90
  } catch {
91
91
  return "Unknown error";
92
92
  }
93
- }, wt = (e) => {
93
+ }, Kt = (e) => {
94
94
  if (e instanceof Error) return {
95
95
  message: e.message,
96
96
  stack: e.stack
@@ -98,50 +98,50 @@ const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "n
98
98
  if (typeof e == "string") return {
99
99
  message: e
100
100
  };
101
- if (gt(e)) {
102
- const t = typeof e.message == "string" ? e.message : null, r = typeof e.stack == "string" ? e.stack : void 0;
103
- return t ? r ? {
101
+ if (Ht(e)) {
102
+ const t = typeof e.message == "string" ? e.message : null, n = typeof e.stack == "string" ? e.stack : void 0;
103
+ return t ? n ? {
104
104
  message: t,
105
- stack: r
105
+ stack: n
106
106
  } : {
107
107
  message: t
108
108
  } : {
109
- message: ge(e)
109
+ message: Se(e)
110
110
  };
111
111
  }
112
112
  return e == null ? {
113
113
  message: "Unknown error"
114
114
  } : {
115
- message: ge(e)
115
+ message: Se(e)
116
116
  };
117
- }, te = () => {
117
+ }, de = () => {
118
118
  if (typeof document > "u") return {};
119
119
  const e = getComputedStyle(document.documentElement), t = {};
120
- for (let r = 0; r < e.length; r += 1) {
121
- const n = e.item(r);
122
- n.startsWith("--chakra-") && (t[n] = e.getPropertyValue(n).trim());
120
+ for (let n = 0; n < e.length; n += 1) {
121
+ const r = e.item(n);
122
+ r.startsWith("--chakra-") && (t[r] = e.getPropertyValue(r).trim());
123
123
  }
124
124
  return t;
125
- }, re = (e) => {
125
+ }, ce = (e) => {
126
126
  if (typeof document > "u") return e;
127
127
  const t = document.documentElement.getAttribute("data-theme");
128
128
  if (t === "dark" || t === "light") return t;
129
- const r = document.documentElement.getAttribute("data-color-mode");
130
- return r === "dark" || r === "light" ? r : e;
131
- }, It = {
129
+ const n = document.documentElement.getAttribute("data-color-mode");
130
+ return n === "dark" || n === "light" ? n : e;
131
+ }, $t = {
132
132
  border: 0,
133
133
  display: "block",
134
134
  flex: "1 1 0%",
135
135
  height: "100%",
136
136
  minHeight: 0,
137
137
  width: "100%"
138
- }, yt = {
138
+ }, Vt = {
139
139
  display: "flex",
140
140
  height: "100%",
141
141
  minHeight: 0,
142
142
  position: "relative",
143
143
  width: "100%"
144
- }, vt = {
144
+ }, Dt = {
145
145
  alignItems: "center",
146
146
  background: "rgba(255, 255, 255, 0.92)",
147
147
  color: "#7a1f12",
@@ -152,159 +152,160 @@ const ce = 1, ct = ["commands.execute", "resource.open", "notification.show", "n
152
152
  position: "absolute",
153
153
  textAlign: "center",
154
154
  zIndex: 1
155
- }, kt = "allow-scripts allow-forms allow-popups", Rt = (e) => {
155
+ }, Bt = "allow-scripts allow-forms allow-popups", Ft = (e) => {
156
156
  const {
157
157
  view: t,
158
- props: r,
159
- theme: n,
160
- capabilities: o,
161
- hostEvents: s,
158
+ props: n,
159
+ theme: r,
160
+ capabilities: s,
161
+ hostEvents: o,
162
162
  onReady: i,
163
163
  onError: a,
164
164
  onDiagnostics: d,
165
- title: m
166
- } = e, w = v(null), l = v(null), u = v(!1), c = v(null), p = v(r), h = v(n), k = v(o), $ = v(s), Q = v(t.webview.capabilities), b = v(i), I = v(a), R = v(d), [E, G] = be(null), [Z, me] = be(0);
167
- return p.current = r, h.current = n, k.current = o, $.current = s, Q.current = t.webview.capabilities, b.current = i, I.current = a, R.current = d, B(() => {
165
+ title: u
166
+ } = e, w = R(null), l = R(null), m = R(!1), c = R(null), f = R(n), h = R(r), C = R(s), j = R(o), _ = R(t.webview.capabilities), q = R(i), W = R(a), b = R(d), [y, E] = Pe(null), [x, A] = Pe(0);
167
+ return f.current = n, h.current = r, C.current = s, j.current = o, _.current = t.webview.capabilities, q.current = i, W.current = a, b.current = d, Q(() => {
168
168
  const g = w.current;
169
169
  if (!g) return;
170
- const T = () => {
171
- u.current && me((y) => y + 1);
170
+ const M = () => {
171
+ m.current && A((k) => k + 1);
172
172
  };
173
- g.addEventListener("load", T);
174
- const W = () => g.removeEventListener("load", T), F = `${Z}
173
+ g.addEventListener("load", M);
174
+ const O = () => g.removeEventListener("load", M), z = `${x}
175
175
  ${t.webview.runtimeUrl}
176
176
  ${t.webview.moduleUrl}`;
177
- if (c.current === F) return W;
178
- c.current = F;
179
- const et = t.webview.styles, tt = t.webview.moduleUrl, ue = (y) => {
180
- y.length > 0 && R.current?.(y);
181
- }, fe = () => ht({
182
- capabilities: k.current ?? {},
183
- declaredCapabilities: Q.current,
184
- onDiagnostic: (y) => ue([y])
177
+ if (c.current === z) return O;
178
+ c.current = z;
179
+ const gt = t.webview.styles, ht = t.webview.moduleUrl, Ce = (k) => {
180
+ k.length > 0 && b.current?.(k);
181
+ }, xe = () => Ot({
182
+ capabilities: C.current ?? {},
183
+ declaredCapabilities: _.current,
184
+ onDiagnostic: (k) => Ce([k])
185
185
  });
186
- ue(fe().diagnostics);
187
- const rt = {
186
+ Ce(xe().diagnostics);
187
+ const wt = {
188
188
  ready: () => {
189
189
  },
190
- runtimeError: (y) => {
191
- G(y.message), I.current?.(y);
190
+ runtimeError: (k) => {
191
+ E(k.message), W.current?.(k);
192
192
  },
193
- call: async (y) => await fe().call(y)
193
+ call: async (k) => await xe().call(k)
194
194
  };
195
195
  return (() => {
196
- u.current = !1, l.current = null;
197
- const y = ot.connect(g, rt);
198
- g.contentWindow?.location.replace(t.webview.runtimeUrl), y.then(async (ee) => {
199
- const j = ee.remote;
200
- l.current = j, $.current?.bind((nt) => j.hostEvent?.(nt)), await j.init({
201
- moduleUrl: tt,
202
- styles: et,
203
- props: p.current,
204
- theme: re(h.current),
205
- themeVariables: te()
206
- }), u.current = !0, G(null), b.current?.();
207
- }).catch((ee) => {
208
- const j = wt(ee);
209
- G(j.message), I.current?.(j);
196
+ m.current = !1, l.current = null;
197
+ const k = yt.connect(g, wt);
198
+ g.contentWindow?.location.replace(t.webview.runtimeUrl), k.then(async (ae) => {
199
+ const H = ae.remote;
200
+ l.current = H, j.current?.bind((It) => H.hostEvent?.(It)), await H.init({
201
+ moduleUrl: ht,
202
+ styles: gt,
203
+ props: f.current,
204
+ theme: ce(h.current),
205
+ themeVariables: de(),
206
+ extensionId: t.extensionId
207
+ }), m.current = !0, E(null), q.current?.();
208
+ }).catch((ae) => {
209
+ const H = Kt(ae);
210
+ E(H.message), W.current?.(H);
210
211
  });
211
- })(), W;
212
- }, [Z, t.webview.runtimeUrl, t.webview.moduleUrl, t.webview.styles]), B(() => {
212
+ })(), O;
213
+ }, [x, t.extensionId, t.webview.runtimeUrl, t.webview.moduleUrl, t.webview.styles]), Q(() => {
213
214
  const g = l.current;
214
- if (!(!g || !s))
215
- return s.bind((T) => g.hostEvent?.(T)), () => s.unbind();
216
- }, [s]), B(() => {
217
- u.current && l.current?.propsUpdate({
218
- props: r
215
+ if (!(!g || !o))
216
+ return o.bind((M) => g.hostEvent?.(M)), () => o.unbind();
217
+ }, [o]), Q(() => {
218
+ m.current && l.current?.propsUpdate({
219
+ props: n
219
220
  });
220
- }, [r]), B(() => {
221
- u.current && l.current?.themeUpdate({
222
- theme: re(n),
223
- variables: te()
221
+ }, [n]), Q(() => {
222
+ m.current && l.current?.themeUpdate({
223
+ theme: ce(r),
224
+ variables: de()
224
225
  });
225
- }, [n]), B(() => {
226
+ }, [r]), Q(() => {
226
227
  if (typeof window > "u" || typeof MutationObserver > "u") return;
227
228
  let g = null;
228
- const T = () => {
229
+ const M = () => {
229
230
  g !== null && cancelAnimationFrame(g), g = requestAnimationFrame(() => {
230
- g = null, u.current && l.current?.themeUpdate({
231
- theme: re(h.current),
232
- variables: te()
231
+ g = null, m.current && l.current?.themeUpdate({
232
+ theme: ce(h.current),
233
+ variables: de()
233
234
  });
234
235
  });
235
- }, W = new MutationObserver(T), F = {
236
+ }, O = new MutationObserver(M), z = {
236
237
  attributeFilter: ["class", "data-color-mode", "data-theme", "style"],
237
238
  attributes: !0
238
239
  };
239
- return W.observe(document.documentElement, F), W.observe(document.body, F), () => {
240
- W.disconnect(), g !== null && cancelAnimationFrame(g);
240
+ return O.observe(document.documentElement, z), O.observe(document.body, z), () => {
241
+ O.disconnect(), g !== null && cancelAnimationFrame(g);
241
242
  };
242
- }, []), /* @__PURE__ */ pe("div", { style: yt, children: [
243
- E ? /* @__PURE__ */ N("div", { role: "alert", style: vt, children: /* @__PURE__ */ pe("div", { children: [
244
- /* @__PURE__ */ N("strong", { children: "Extension view failed to load." }),
245
- /* @__PURE__ */ N("div", { children: E })
243
+ }, []), /* @__PURE__ */ Ee("div", { style: Vt, children: [
244
+ y ? /* @__PURE__ */ G("div", { role: "alert", style: Dt, children: /* @__PURE__ */ Ee("div", { children: [
245
+ /* @__PURE__ */ G("strong", { children: "Extension view failed to load." }),
246
+ /* @__PURE__ */ G("div", { children: y })
246
247
  ] }) }) : null,
247
- /* @__PURE__ */ N(
248
+ /* @__PURE__ */ G(
248
249
  "iframe",
249
250
  {
250
251
  ref: w,
251
- title: m ?? t.label,
252
+ title: u ?? t.label,
252
253
  allow: "fullscreen",
253
254
  allowFullScreen: !0,
254
- sandbox: kt,
255
+ sandbox: Bt,
255
256
  style: {
256
- ...It,
257
- colorScheme: n
257
+ ...$t,
258
+ colorScheme: r
258
259
  },
259
260
  onLoad: () => {
260
- u.current && me((g) => g + 1);
261
+ m.current && A((g) => g + 1);
261
262
  },
262
263
  onError: () => {
263
264
  const g = `Failed to load extension runtime at ${t.webview.runtimeUrl}`;
264
- G(g), I.current?.({
265
+ E(g), W.current?.({
265
266
  message: g
266
267
  });
267
268
  }
268
269
  },
269
- Z
270
+ x
270
271
  )
271
272
  ] });
272
- }, Ct = () => {
273
+ }, Nt = () => {
273
274
  let e = null;
274
- const t = [], r = /* @__PURE__ */ new Set();
275
+ const t = [], n = /* @__PURE__ */ new Set();
275
276
  return {
276
- emit(n) {
277
- e ? e(n) : t.push(n);
277
+ emit(r) {
278
+ e ? e(r) : t.push(r);
278
279
  },
279
- bind(n) {
280
- for (e = n; t.length > 0; ) n(t.shift());
280
+ bind(r) {
281
+ for (e = r; t.length > 0; ) r(t.shift());
281
282
  },
282
- onDisconnect(n) {
283
- return r.add(n), () => r.delete(n);
283
+ onDisconnect(r) {
284
+ return n.add(r), () => n.delete(r);
284
285
  },
285
286
  unbind() {
286
287
  e = null;
287
- for (const n of r) n();
288
+ for (const r of n) r();
288
289
  }
289
290
  };
290
- }, Et = "terminal.session", Pt = (e) => {
291
+ }, Lt = "terminal.session", Ut = (e) => {
291
292
  const {
292
293
  terminal: t,
293
- hostEvents: r
294
- } = e, n = (o) => {
295
- r.emit({
296
- scope: Et,
297
- payload: o
294
+ hostEvents: n
295
+ } = e, r = (s) => {
296
+ n.emit({
297
+ scope: Lt,
298
+ payload: s
298
299
  });
299
300
  };
300
- return async (o) => {
301
- const s = o;
302
- switch (s.operation) {
301
+ return async (s) => {
302
+ const o = s;
303
+ switch (o.operation) {
303
304
  case "open": {
304
305
  const {
305
306
  sessionId: i
306
307
  } = await t.open({
307
- request: s.request
308
+ request: o.request
308
309
  });
309
310
  return {
310
311
  operation: "open",
@@ -313,25 +314,25 @@ ${t.webview.moduleUrl}`;
313
314
  }
314
315
  case "write":
315
316
  return t.write({
316
- sessionId: s.sessionId,
317
- data: s.data
317
+ sessionId: o.sessionId,
318
+ data: o.data
318
319
  }), {
319
320
  operation: "write",
320
321
  accepted: !0
321
322
  };
322
323
  case "resize":
323
324
  return t.resize({
324
- sessionId: s.sessionId,
325
- cols: s.cols,
326
- rows: s.rows
325
+ sessionId: o.sessionId,
326
+ cols: o.cols,
327
+ rows: o.rows
327
328
  }), {
328
329
  operation: "resize",
329
330
  accepted: !0
330
331
  };
331
332
  case "kill":
332
333
  return await t.kill({
333
- sessionId: s.sessionId,
334
- signal: s.signal
334
+ sessionId: o.sessionId,
335
+ signal: o.signal
335
336
  }), {
336
337
  operation: "kill",
337
338
  accepted: !0
@@ -339,35 +340,35 @@ ${t.webview.moduleUrl}`;
339
340
  case "subscribe": {
340
341
  const {
341
342
  sessionId: i
342
- } = s;
343
+ } = o;
343
344
  let a = () => {
344
345
  }, d = () => {
345
- }, m = !1;
346
+ }, u = !1;
346
347
  const w = () => {
347
- m || (m = !0, a(), d());
348
+ u || (u = !0, a(), d());
348
349
  };
349
350
  return a = t.subscribe(i, {
350
- onData: (l) => n({
351
+ onData: (l) => r({
351
352
  sessionId: i,
352
353
  kind: "data",
353
354
  chunk: l
354
355
  }),
355
356
  onExit: (l) => {
356
- n({
357
+ r({
357
358
  sessionId: i,
358
359
  kind: "exit",
359
360
  code: l.code,
360
361
  signal: l.signal
361
362
  }), w();
362
363
  }
363
- }), d = r.onDisconnect(w), {
364
+ }), d = n.onDisconnect(w), {
364
365
  operation: "subscribe",
365
366
  accepted: !0
366
367
  };
367
368
  }
368
369
  }
369
370
  };
370
- }, At = (e) => {
371
+ }, _t = (e) => {
371
372
  if (typeof document > "u") return;
372
373
  const t = new KeyboardEvent("keydown", {
373
374
  ...e,
@@ -375,78 +376,78 @@ ${t.webview.moduleUrl}`;
375
376
  cancelable: !0
376
377
  });
377
378
  document.dispatchEvent(t);
378
- }, Me = (e) => !e?.strategy || e.strategy === "persistent" ? {} : {
379
+ }, qe = (e) => !e?.strategy || e.strategy === "persistent" ? {} : {
379
380
  replaceActive: !0
380
- }, Oe = (e) => ({
381
+ }, ze = (e) => ({
381
382
  "commands.execute": (t) => {
382
- const r = t;
383
- return e.workbench.commands.executeCommand(r.commandId, r.params);
383
+ const n = t;
384
+ return e.workbench.commands.executeCommand(n.commandId, n.params);
384
385
  },
385
386
  "resource.open": (t) => {
386
- const r = t;
387
- if (!r.resource) throw new Error("resource.open requires a resource.");
388
- return e.workbench.resources.openResource(r.resource, Me(r.input));
387
+ const n = t;
388
+ if (!n.resource) throw new Error("resource.open requires a resource.");
389
+ return e.workbench.resources.openResource(n.resource, qe(n.input));
389
390
  },
390
391
  "notification.show": (t) => {
391
- const r = t;
392
+ const n = t;
392
393
  return e.workbench.notifications.show({
393
- level: r.level,
394
- message: r.message,
395
- title: r.title
394
+ level: n.level,
395
+ message: n.message,
396
+ title: n.title
396
397
  });
397
398
  },
398
399
  "preferences.get": (t) => {
399
- const r = t;
400
- return e.workbench.preferences.getValue(r.name, r.scope);
400
+ const n = t;
401
+ return e.workbench.preferences.getValue(n.name, n.scope);
401
402
  },
402
403
  "preferences.set": (t) => {
403
- const r = t;
404
- return e.workbench.preferences.setValue(r.name, r.value, r.scope ?? {
404
+ const n = t;
405
+ return e.workbench.preferences.setValue(n.name, n.value, n.scope ?? {
405
406
  scope: "user"
406
407
  }), {
407
- name: r.name,
408
- value: r.value
408
+ name: n.name,
409
+ value: n.value
409
410
  };
410
411
  },
411
- "host.dispatchKeyboardEvent": (t) => (e.dispatchKeyboardEvent ?? At)(t),
412
+ "host.dispatchKeyboardEvent": (t) => (e.dispatchKeyboardEvent ?? _t)(t),
412
413
  ...e.hostEvents ? {
413
- "terminal.session": Pt({
414
+ "terminal.session": Ut({
414
415
  terminal: e.workbench.terminal,
415
416
  hostEvents: e.hostEvents
416
417
  })
417
418
  } : {}
418
- }), xt = (e, t) => {
419
- for (const r of t)
420
- console.warn(`[workbench.webview:${e}] ${r.code}/${r.capability}: ${r.message}`);
421
- }, Tt = (e, t) => {
419
+ }), qt = (e, t) => {
420
+ for (const n of t)
421
+ console.warn(`[workbench.webview:${e}] ${n.code}/${n.capability}: ${n.message}`);
422
+ }, zt = (e, t) => {
422
423
  console.error(`[workbench.webview:${e}] runtime error: ${t}`);
423
- }, S = "webview:bridge", Wt = (e) => {
424
+ }, se = "webview:bridge", Qt = (e) => {
424
425
  if (typeof e != "object" || e === null || Array.isArray(e)) return !1;
425
426
  const t = e;
426
427
  return typeof t.runtimeUrl == "string" && typeof t.moduleUrl == "string";
427
- }, jt = ({
428
+ }, Gt = ({
428
429
  placement: e
429
430
  }) => ({
430
431
  placement: e,
431
432
  resource: e.resource
432
- }), Ke = () => "light", we = /* @__PURE__ */ new WeakMap(), De = (e, t) => {
433
- let r = we.get(e);
434
- r || (r = /* @__PURE__ */ new Map(), we.set(e, r));
435
- const n = t.instanceId;
436
- let o = r.get(n);
437
- return o || (o = Ct(), r.set(n, o)), o;
438
- }, $e = (e) => {
433
+ }), Qe = () => "light", Te = /* @__PURE__ */ new WeakMap(), Ge = (e, t) => {
434
+ let n = Te.get(e);
435
+ n || (n = /* @__PURE__ */ new Map(), Te.set(e, n));
436
+ const r = t.instanceId;
437
+ let s = n.get(r);
438
+ return s || (s = Nt(), n.set(r, s)), s;
439
+ }, Ye = (e) => {
439
440
  const {
440
441
  context: t,
441
- createHostCapabilities: r,
442
- createProps: n,
443
- createTheme: o = Ke,
444
- ownerId: s,
442
+ createHostCapabilities: n,
443
+ createProps: r,
444
+ createTheme: s = Qe,
445
+ ownerId: o,
445
446
  title: i,
446
447
  webview: a
447
448
  } = e;
448
- return /* @__PURE__ */ N(Rt, { view: {
449
- extensionId: s ?? "workbench",
449
+ return /* @__PURE__ */ G(Ft, { view: {
450
+ extensionId: o ?? "workbench",
450
451
  id: t.webviewId,
451
452
  label: a.title ?? i,
452
453
  webview: {
@@ -455,69 +456,104 @@ ${t.webview.moduleUrl}`;
455
456
  runtimeUrl: a.runtimeUrl,
456
457
  styles: a.styles ?? []
457
458
  }
458
- }, props: n(t), theme: o(t), capabilities: r(t), hostEvents: t.hostEvents, onDiagnostics: (d) => xt(t.webviewId, d), onError: (d) => Tt(t.webviewId, d.message) });
459
- }, St = (e, t, r, n) => {
459
+ }, props: r(t), theme: s(t), capabilities: n(t), hostEvents: t.hostEvents, onDiagnostics: (d) => qt(t.webviewId, d), onError: (d) => zt(t.webviewId, d.message) });
460
+ }, Yt = (e, t, n, r) => {
460
461
  const {
461
- workbench: o,
462
- panel: s,
462
+ workbench: s,
463
+ panel: o,
463
464
  instance: i
464
- } = e, a = Wt(s.config) ? s.config : null;
465
- return a ? $e({
465
+ } = e, a = Qt(o.config) ? o.config : null;
466
+ return a ? Ye({
466
467
  context: {
467
- workbench: o,
468
+ workbench: s,
468
469
  webviewId: i.panelId,
469
470
  placement: i,
470
- hostEvents: De(o, i)
471
+ hostEvents: Ge(s, i)
471
472
  },
472
473
  createHostCapabilities: t,
473
- createProps: r,
474
- createTheme: n,
475
- ownerId: "ownerId" in s ? s.ownerId : void 0,
476
- title: s.title,
474
+ createProps: n,
475
+ createTheme: r,
476
+ ownerId: "ownerId" in o ? o.ownerId : void 0,
477
+ title: o.title,
477
478
  webview: a
478
479
  }) : null;
479
- }, Ht = (e = {}) => {
480
- const t = e.createHostCapabilities ?? Oe, r = e.createProps ?? jt, n = e.createTheme ?? Ke;
480
+ }, Xt = (e = {}) => {
481
+ const t = e.createHostCapabilities ?? ze, n = e.createProps ?? Gt, r = e.createTheme ?? Qe;
481
482
  return {
482
- id: S,
483
- render: (o) => St(o, t, r, n)
483
+ id: se,
484
+ render: (s) => Yt(s, t, n, r)
484
485
  };
485
- }, C = (e, t) => ({
486
+ }, Jt = (e, t) => ({
487
+ extensionId: "pstdio",
488
+ kind: e,
489
+ id: t
490
+ }), le = (e, t, n) => ({
491
+ id: e,
492
+ ref: Jt("resource-kind", e),
493
+ surface: "primary",
494
+ label: t,
495
+ menuSlots: n
496
+ }), ue = [{
497
+ id: "headerPrimary",
498
+ placement: "header-primary",
499
+ access: "public"
500
+ }, {
501
+ id: "headerOverflow",
502
+ placement: "header-overflow",
503
+ access: "public"
504
+ }], me = {
505
+ project: le("project", "Extension", ue),
506
+ session: le("session", "Session", ue),
507
+ workspace: le("workspace", "Workspace", ue)
508
+ }, $ = {
509
+ project: me.project.ref,
510
+ session: me.session.ref,
511
+ workspace: me.workspace.ref
512
+ }, je = (e) => ({
513
+ ...e,
514
+ kind: "command"
515
+ });
516
+ Object.assign(je, {
517
+ forExtension: (e) => (t) => je({
518
+ extensionId: `${e.publisher}.${e.name}`,
519
+ id: t
520
+ })
521
+ });
522
+ const Zt = (e) => ({
523
+ ...e,
524
+ kind: "event"
525
+ }), re = (e, t) => ({
486
526
  id: e,
487
527
  kind: t.kind,
488
528
  label: t.label,
489
529
  description: t.description,
490
530
  metadata: t.metadata
531
+ }), I = (e) => Zt({
532
+ extensionId: "pstdio",
533
+ id: e
534
+ }), V = (e, t) => re(`${e.id}.${t}`, {
535
+ kind: "menu"
491
536
  });
492
- C("project.sidenav", {
537
+ re("project.sidenav", {
493
538
  kind: "panel"
494
- }), C("project.headerPrimary", {
495
- kind: "menu"
496
- }), C("project.headerOverflow", {
497
- kind: "menu"
498
- }), C("project.settingsPanels", {
539
+ }), V($.project, "headerPrimary"), V($.project, "headerOverflow"), re("project.settingsPanels", {
499
540
  kind: "settings"
500
541
  });
501
- C("session.headerPrimary", {
502
- kind: "menu"
503
- }), C("session.headerOverflow", {
504
- kind: "menu"
505
- }), C("session.transcriptActions", {
506
- kind: "menu"
507
- });
508
- C("workspace.headerPrimary", {
509
- kind: "menu"
510
- }), C("workspace.headerOverflow", {
511
- kind: "menu"
512
- }), C("workspace.sidenav", {
542
+ V($.session, "headerPrimary"), V($.session, "headerOverflow");
543
+ V($.workspace, "headerPrimary"), V($.workspace, "headerOverflow"), re("workspace.sidenav", {
513
544
  kind: "panel"
514
545
  });
515
- const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e.$l10n == "string", f = (e, t = "") => e === void 0 ? t : Mt(e) ? e.default ?? e.$l10n : e, X = (e) => {
546
+ I("project.opened");
547
+ I("session.started"), I("session.resumed"), I("session.awaitingInput"), I("session.succeeded"), I("session.failed"), I("session.completed");
548
+ I("workspace.created"), I("workspace.provision"), I("workspace.ready"), I("workspace.archived"), I("workspace.deleted");
549
+ I("worktree.removed");
550
+ I("git.committed"), I("git.rebased"), I("git.merged"), I("git.conflicted");
551
+ const en = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e.$l10n == "string", p = (e, t = "") => e === void 0 ? t : en(e) ? e.default ?? e.$l10n : e, ie = (e) => {
516
552
  const t = e;
517
553
  if (!t?.outcome) return e;
518
554
  if (t.outcome.status === "success") return t.outcome.value;
519
555
  throw new Error(t.outcome.reason ?? t.outcome.error?.message ?? "Extension command failed.");
520
- }, H = (e) => {
556
+ }, D = (e) => {
521
557
  if (e)
522
558
  return {
523
559
  type: e.kind,
@@ -525,8 +561,8 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
525
561
  label: e.label,
526
562
  metadata: e.metadata
527
563
  };
528
- }, _ = (e) => {
529
- const t = e.icon, r = e.projectId ? {
564
+ }, J = (e) => {
565
+ const t = e.icon, n = e.projectId ? {
530
566
  ...e.metadata,
531
567
  projectId: e.projectId
532
568
  } : e.metadata;
@@ -536,340 +572,386 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
536
572
  id: e.id,
537
573
  label: e.label,
538
574
  icon: typeof t == "string" ? t : void 0,
539
- metadata: r
575
+ metadata: n
540
576
  };
541
- }, M = (e) => ({
577
+ }, B = (e) => ({
542
578
  id: e.id,
543
579
  kind: e.kind,
544
580
  context: {
545
581
  projectId: e.projectId,
546
582
  ...e.context ?? {}
547
583
  }
548
- }), P = async (e, t, r = {}) => {
549
- const n = H(r.resource), o = await e.executeCommand(t, {
584
+ }), tn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), nn = (e) => {
585
+ if (!(!tn(e) || e.deleted !== !0))
586
+ return typeof e.id == "string" ? e.id : void 0;
587
+ }, rn = async (e, t, n) => {
588
+ if (!t || nn(n) !== (t.id ?? t.uri) || (e.workbench.navigator.forgetResource(t.uri), e.workbench.getPrimaryResource()?.uri !== t.uri)) return;
589
+ const r = e.workbench.resources.walkHierarchy(t).at(-2);
590
+ if (r) {
591
+ if (vt(r)) {
592
+ await e.workbench.views.openView(r.viewId, {
593
+ strategy: {
594
+ kind: "replace-active"
595
+ }
596
+ });
597
+ return;
598
+ }
599
+ await e.workbench.resources.openResource(r, {
600
+ replaceActive: !0
601
+ });
602
+ }
603
+ }, P = async (e, t, n = {}) => {
604
+ const r = D(n.resource), s = await e.executeCommand(t, {
550
605
  projectId: e.projectId,
551
- ...r.params ? {
552
- params: r.params
606
+ ...n.params ? {
607
+ params: n.params
553
608
  } : {},
554
- ...n ? {
555
- resource: n
609
+ ...r ? {
610
+ resource: r
556
611
  } : {},
557
- ...r.slot ? {
558
- slot: r.slot
612
+ ...n.slot ? {
613
+ slot: n.slot
559
614
  } : {},
560
615
  source: "dashboard",
561
- ...r.metadata ? {
562
- metadata: r.metadata
616
+ ...n.metadata ? {
617
+ metadata: n.metadata
563
618
  } : {}
564
- });
565
- return X(o);
566
- }, x = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), Ot = (e) => typeof e == "string" || x(e) && typeof e.id == "string", Kt = (e) => x(e) && typeof e.type == "string" && typeof e.id == "string", Dt = (e) => {
567
- if (!Kt(e.resource)) return !1;
619
+ }), o = ie(s);
620
+ return await rn(e, n.resource, o), o;
621
+ }, S = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), Xe = (e, t) => S(e) && e.kind === t && typeof e.id == "string", on = (e) => S(e) && typeof e.type == "string" && typeof e.id == "string", sn = (e) => {
622
+ if (!on(e.resource)) return !1;
568
623
  if (e.input === void 0) return !0;
569
- if (!x(e.input)) return !1;
624
+ if (!S(e.input)) return !1;
570
625
  const t = e.input.strategy;
571
626
  return t === void 0 || t === "persistent" || t === "replace-active";
572
- }, $t = (e) => {
573
- if (typeof e.panel != "string") return !1;
627
+ }, an = (e) => {
628
+ if (!Xe(e.view, "view")) return !1;
574
629
  if (e.input === void 0) return !0;
575
- if (!x(e.input)) return !1;
576
- const t = e.input.strategy, r = e.input.region;
577
- return (r === void 0 || typeof r == "string") && (t === void 0 || t === "persistent" || t === "preview" || t === "replace-active" || t === "replace-invoking");
578
- }, Ie = (e) => x(e) ? e.kind === "resource" ? Dt(e) : e.kind === "panel" ? $t(e) : e.kind === "command" && Ot(e.command) && (e.params === void 0 || x(e.params)) : !1, Ft = (e) => Ie(e) ? !0 : x(e) && e.kind === "compound" && Array.isArray(e.targets) && e.targets.length > 0 && e.targets.every(Ie), Bt = (e, t) => !e || e === "persistent" ? {} : {
630
+ if (!S(e.input)) return !1;
631
+ const t = e.input.strategy;
632
+ return t === void 0 || t === "persistent" || t === "preview" || t === "replace-active" || t === "replace-invoking";
633
+ }, We = (e) => S(e) ? e.kind === "resource" ? sn(e) : e.kind === "view" ? an(e) : e.kind === "href" ? typeof e.href == "string" : e.kind === "command" && S(e.target) && Xe(e.target.command, "command") && (e.target.params === void 0 || S(e.target.params)) : !1, dn = (e) => We(e) ? !0 : S(e) && e.kind === "compound" && Array.isArray(e.targets) && e.targets.length > 0 && e.targets.every(We), cn = (e, t) => !e || e === "persistent" ? {} : {
579
634
  replaceActive: !0
580
- }, Nt = (e, t) => {
581
- const r = e?.strategy, n = e?.region ? {
582
- region: e.region
583
- } : {};
584
- if (!r) return n;
585
- if (r === "persistent" || r === "preview" || r === "replace-active")
635
+ }, ln = (e, t) => {
636
+ const n = e?.strategy;
637
+ if (!n) return {};
638
+ if (n === "persistent" || n === "preview" || n === "replace-active")
586
639
  return {
587
- ...n,
588
640
  strategy: {
589
- kind: r
641
+ kind: n
590
642
  }
591
643
  };
592
644
  if (!t) throw new Error("replace-invoking requires a live source placement.");
593
645
  return {
594
- ...n,
595
646
  strategy: {
596
647
  kind: "replace-panel",
597
648
  instanceId: t.instanceId
598
649
  }
599
650
  };
600
- }, Ut = (e, t) => {
601
- const r = t.commandTargetOf?.(e);
602
- return r || {
651
+ }, un = (e, t) => {
652
+ const n = t.commandTargetOf?.(e);
653
+ if (n) return n;
654
+ const r = e.target.command, s = r.extensionId ?? t.extensionId;
655
+ return {
603
656
  kind: "command",
604
- commandId: t.commandIdOf?.(e.command) ?? (typeof e.command == "string" ? e.command : e.command.id),
605
- args: e.params
657
+ commandId: t.commandIdOf?.(r) ?? (s && s !== "pstdio" ? `${s}.command.${r.id}` : r.id),
658
+ args: e.target.params
606
659
  };
607
- }, J = (e, t = {}) => {
660
+ }, mn = (e, t) => {
661
+ const n = e.view.extensionId ?? t;
662
+ return n ? `${n}.view.${e.view.id}` : e.view.id;
663
+ }, Z = (e, t = {}) => {
608
664
  if (e.kind === "resource") {
609
665
  if (e.section && !t.resourceOf)
610
666
  throw new Error("Resource targets with a section need a resourceOf translator that encodes the section.");
611
667
  return {
612
668
  kind: "resource",
613
- resource: t.resourceOf ? t.resourceOf(e.resource, e) : _(e.resource),
614
- input: Bt(e.input?.strategy, t.sourcePlacement)
669
+ resource: t.resourceOf ? t.resourceOf(e.resource, e) : J(e.resource),
670
+ input: cn(e.input?.strategy, t.sourcePlacement)
615
671
  };
616
672
  }
617
- return e.kind === "panel" ? {
618
- kind: "panel",
619
- panelId: e.panel,
620
- input: Nt(e.input, t.sourcePlacement)
621
- } : e.kind === "command" ? Ut(e, t) : {
673
+ return e.kind === "view" ? {
674
+ kind: "view",
675
+ viewId: mn(e, t.extensionId),
676
+ input: ln(e.input, t.sourcePlacement)
677
+ } : e.kind === "command" ? un(e, t) : e.kind === "href" ? e : {
622
678
  kind: "compound",
623
- targets: e.targets.map((r) => J(r, t))
679
+ targets: e.targets.map((n) => Z(n, t))
624
680
  };
625
- }, Fe = (e, t = {}) => {
681
+ }, Je = (e, t = {}) => {
626
682
  if (e != null) {
627
- if (!Ft(e)) throw new Error("Renderer callback returned an invalid navigation target.");
628
- return J(e, t);
683
+ if (!dn(e)) throw new Error("Renderer callback returned an invalid navigation target.");
684
+ return Z(e, t);
629
685
  }
630
- }, Vt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Lt = (e) => typeof e == "string" ? e : e.id, _t = async (e, t, r) => {
686
+ }, pn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), fn = (e, t) => `${e.extensionId ?? t}.command.${e.id}`, bn = async (e, t, n) => {
631
687
  const {
632
- target: n
633
- } = r;
634
- if (n.kind === "command") {
635
- await P(e, Lt(n.command), {
636
- params: n.params
688
+ target: r
689
+ } = n;
690
+ if (r.kind === "command") {
691
+ await P(e, fn(r.target.command, t.extensionId), {
692
+ params: r.target.params
637
693
  }), e.workbench.commandPaletteResources.refresh();
638
694
  return;
639
695
  }
640
- await e.workbench.navigation.openTarget(J(n, {
641
- resourceOf: (o, s) => {
642
- const i = _(o);
643
- return s.section ? {
696
+ await e.workbench.navigation.openTarget(Z(r, {
697
+ extensionId: t.extensionId,
698
+ resourceOf: (s, o) => {
699
+ const i = J(s);
700
+ return o.section ? {
644
701
  ...i,
645
702
  metadata: {
646
703
  ...i.metadata,
647
- [ae]: {
704
+ [we]: {
648
705
  treeId: t.id,
649
- targetNodeId: r.id,
650
- anchors: s.section.anchors
706
+ targetNodeId: n.id,
707
+ anchors: o.section.anchors
651
708
  }
652
709
  }
653
710
  } : i;
654
711
  }
655
712
  }));
656
- }, qt = (e, t, r, n) => ({
657
- id: `${t.id}:${n.id}`,
658
- label: n.label,
659
- description: n.description,
660
- icon: n.icon,
661
- keywords: n.keywords,
662
- group: r,
663
- activate: () => _t(e, t, n)
664
- }), zt = (e, t) => {
665
- const r = [];
666
- for (const n of t) {
667
- const o = f(n.title, n.id);
668
- r.push(e.workbench.commandPaletteResources.registerProvider({
669
- id: n.id,
670
- title: o,
671
- refreshEventIds: n.refreshEventIds,
713
+ }, gn = (e, t, n, r) => ({
714
+ id: `${t.id}:${r.id}`,
715
+ label: r.label,
716
+ description: r.description,
717
+ icon: r.icon,
718
+ keywords: r.keywords,
719
+ group: n,
720
+ activate: () => bn(e, t, r)
721
+ }), hn = (e, t) => {
722
+ const n = [];
723
+ for (const r of t) {
724
+ const s = p(r.title, r.id);
725
+ n.push(e.workbench.commandPaletteResources.registerProvider({
726
+ id: r.id,
727
+ title: s,
728
+ refreshEventIds: r.refreshEventIds,
672
729
  query: async ({
673
- query: s,
730
+ query: o,
674
731
  limit: i
675
732
  }) => {
676
- const a = e.workbench.getActiveResource(), d = await P(e, n.queryCommandId, {
733
+ const a = e.workbench.getActiveResource(), d = await P(e, r.queryHandlerId, {
677
734
  params: {
678
735
  projectId: e.projectId,
679
736
  modeId: e.workbench.modes.getActiveModeId(),
680
- activeResource: H(a),
681
- providerId: n.id,
682
- query: s,
737
+ activeResource: D(a),
738
+ providerId: r.id,
739
+ query: o,
683
740
  limit: i
684
741
  }
685
742
  });
686
- return Vt(d) ? (d.items ?? []).map((m) => qt(e, n, o, m)) : [];
743
+ return pn(d) ? (d.items ?? []).map((u) => gn(e, r, s, u)) : [];
687
744
  }
688
745
  }));
689
746
  }
690
747
  return {
691
748
  dispose() {
692
- for (let n = r.length - 1; n >= 0; n -= 1) r[n]?.dispose();
749
+ for (let r = n.length - 1; r >= 0; r -= 1) n[r]?.dispose();
693
750
  }
694
751
  };
695
- }, Qt = (e) => e ? (Array.isArray(e) ? e : [e]).map(({
696
- for: r,
697
- ...n
752
+ }, wn = (e) => e ? (Array.isArray(e) ? e : [e]).map(({
753
+ for: n,
754
+ ...r
698
755
  }) => ({
699
- ...n,
700
- resourceKind: r
701
- })) : [], Gt = () => {
702
- const e = [], t = [], r = [], n = /* @__PURE__ */ new Map(), o = (s, i) => he(() => {
703
- const a = s.indexOf(i);
704
- a >= 0 && s.splice(a, 1);
756
+ ...r,
757
+ resourceKind: n
758
+ })) : [], In = () => {
759
+ const e = [], t = [], n = [], r = /* @__PURE__ */ new Map(), s = (o, i) => Ae(() => {
760
+ const a = o.indexOf(i);
761
+ a >= 0 && o.splice(a, 1);
705
762
  });
706
763
  return {
707
- registerResourceKind(s) {
708
- return e.push(s), o(e, s);
764
+ registerResourceKind(o) {
765
+ return e.push(o), s(e, o);
709
766
  },
710
- registerPanelCapability(s) {
711
- return t.push(s), o(t, s);
767
+ registerPanelCapability(o) {
768
+ return t.push(o), s(t, o);
712
769
  },
713
- registerResourcePanel(s) {
714
- return r.push(s), o(r, s);
770
+ registerResourcePanel(o) {
771
+ return n.push(o), s(n, o);
715
772
  },
716
- registerModeComposition(s) {
717
- return n.set(s.id, s), he(() => {
718
- n.get(s.id) === s && n.delete(s.id);
773
+ registerModeComposition(o) {
774
+ return r.set(o.id, o), Ae(() => {
775
+ r.get(o.id) === o && r.delete(o.id);
719
776
  });
720
777
  },
721
778
  getComposition: () => ({
722
779
  resourceKinds: [...e],
723
780
  panels: [...t],
724
- resourcePanels: [...r]
781
+ resourcePanels: [...n]
725
782
  }),
726
- getModeComposition: (s) => n.get(s)
783
+ getModeComposition: (o) => r.get(o)
727
784
  };
728
- }, Be = (e, t) => {
729
- const r = {};
730
- for (const n of de) {
731
- const o = e.regions[n], s = o.widgets.filter((a) => t.has(a.contributionId)).map((a) => a.contributionId), i = o.widgets.find((a) => a.widgetId === o.activeWidgetId);
732
- r[n] = {
733
- order: s,
785
+ }, Ze = (e, t) => {
786
+ const n = {};
787
+ for (const r of Ie) {
788
+ const s = e.regions[r], o = s.widgets.filter((a) => t.has(a.contributionId)).map((a) => a.contributionId), i = s.widgets.find((a) => a.widgetId === s.activeWidgetId);
789
+ n[r] = {
790
+ order: o,
734
791
  activePanelId: i && t.has(i.contributionId) ? i.contributionId : void 0
735
792
  };
736
793
  }
737
794
  return {
738
- regions: r
795
+ regions: n
739
796
  };
740
- }, Yt = (e) => {
797
+ }, yn = (e) => {
741
798
  const t = e.registry.getModeComposition(e.modeId);
742
799
  if (!t) return [];
743
- const r = e.registry.getComposition(), n = new Set(r.panels.map((o) => o.id));
744
- return je({
800
+ const n = e.registry.getComposition(), r = new Set(n.panels.map((s) => s.id));
801
+ return Le({
745
802
  context: {
746
803
  modeId: e.modeId,
747
804
  resourceKind: e.resourceKind
748
805
  },
749
806
  mode: t,
750
- composition: r,
751
- persisted: Be(e.layout, n)
807
+ composition: n,
808
+ persisted: Ze(e.layout, r)
752
809
  }).addablePanels;
753
- }, ye = (e) => e === "main" ? "location" : "sub-panel", Xt = (e, t) => {
754
- const r = e.layout.getLayout(), n = de.find((d) => r.regions[d].widgets.some((m) => m.contributionId === t.panelId)), o = () => e.layout.openWidget(t.panelId, {
810
+ }, Me = (e) => e === "main" ? "location" : "sub-panel", vn = (e, t) => {
811
+ const n = e.layout.getLayout(), r = Ie.find((d) => n.regions[d].widgets.some((u) => u.contributionId === t.panelId)), s = () => e.layout.openWidget(t.panelId, {
755
812
  region: t.region,
756
813
  closable: !t.required,
757
814
  pinned: t.pinned,
758
- role: ye(t.region)
815
+ role: Me(t.region)
759
816
  });
760
- if (!n) {
761
- (t.origin === "persisted" || t.origin === "default" || t.required) && o();
817
+ if (!r) {
818
+ (t.origin === "persisted" || t.origin === "default" || t.required) && s();
762
819
  return;
763
820
  }
764
- if (!t.allowedRegions.includes(n)) {
765
- o();
821
+ if (!t.allowedRegions.includes(r)) {
822
+ s();
766
823
  return;
767
824
  }
768
- const s = r.regions[n].widgets.find((d) => d.contributionId === t.panelId);
769
- if (!s) return;
770
- const i = ye(n), a = !t.required;
771
- ((s.closable ?? !0) !== a || s.pinned !== t.pinned || s.role !== i) && e.layout.updateWidgetPlacement(s.widgetId, {
825
+ const o = n.regions[r].widgets.find((d) => d.contributionId === t.panelId);
826
+ if (!o) return;
827
+ const i = Me(r), a = !t.required;
828
+ ((o.closable ?? !0) !== a || o.pinned !== t.pinned || o.role !== i) && e.layout.updateWidgetPlacement(o.widgetId, {
772
829
  closable: a,
773
830
  pinned: t.pinned,
774
831
  role: i
775
832
  });
776
- }, Jt = (e, t) => {
777
- for (const [r, n] of t) {
778
- if (!n) continue;
779
- const o = e.layout.getLayout().regions[r];
780
- o.activeWidgetId !== n && o.widgets.some((s) => s.widgetId === n) && e.layout.setRegionActiveWidget(r, n);
833
+ }, kn = (e, t) => {
834
+ for (const [n, r] of t) {
835
+ if (!r) continue;
836
+ const s = e.layout.getLayout().regions[n];
837
+ s.activeWidgetId !== r && s.widgets.some((o) => o.widgetId === r) && e.layout.setRegionActiveWidget(n, r);
781
838
  }
782
- }, Zt = (e, t, r) => {
783
- const n = er(t);
784
- if (!r.requiredFallback) {
785
- e.notifications.dismiss(n);
839
+ }, Rn = (e, t, n) => {
840
+ const r = Cn(t);
841
+ if (!n.requiredFallback) {
842
+ e.notifications.dismiss(r);
786
843
  return;
787
844
  }
788
- const o = r.requiredFallback.panelId;
789
- e.layout.getLayout().regions.main.widgets.some((i) => i.contributionId === o) || e.layout.openWidget(o, {
845
+ const s = n.requiredFallback.panelId;
846
+ e.layout.getLayout().regions.main.widgets.some((i) => i.contributionId === s) || e.layout.openWidget(s, {
790
847
  region: "main",
791
848
  pinned: !0,
792
849
  role: "location"
793
850
  }), e.notifications.show({
794
- id: n,
851
+ id: r,
795
852
  level: "error",
796
853
  title: "A required panel could not be placed",
797
- message: r.diagnostics.map((i) => i.message).join(" ")
854
+ message: n.diagnostics.map((i) => i.message).join(" ")
798
855
  });
799
- }, er = (e) => `workbench.composition.required.${e}`, tr = (e, t) => {
800
- const r = t.registry.getModeComposition(t.modeId);
801
- if (!r) return;
802
- const n = t.registry.getComposition(), o = new Set(n.panels.map((m) => m.id)), s = e.layout.getLayout(), i = t.seeding ? void 0 : Be(s, o), a = je({
856
+ }, Cn = (e) => `workbench.composition.required.${e}`, xn = (e, t) => {
857
+ const n = t.registry.getModeComposition(t.modeId);
858
+ if (!n) return;
859
+ const r = t.registry.getComposition(), s = new Set(r.panels.map((u) => u.id)), o = e.layout.getLayout(), i = t.seeding ? void 0 : Ze(o, s), a = Le({
803
860
  context: {
804
861
  modeId: t.modeId,
805
862
  resourceKind: t.resourceKind
806
863
  },
807
- mode: r,
808
- composition: n,
864
+ mode: n,
865
+ composition: r,
809
866
  persisted: i
810
- }), d = new Map(de.map((m) => [m, e.layout.getLayout().regions[m].activeWidgetId]));
811
- for (const m of a.placements) Xt(e, m);
812
- return Jt(e, d), e.layout.reconcilePanelMenus(), Zt(e, t.modeId, a), a;
813
- }, q = (e) => ({
814
- title: f(e.title),
867
+ }), d = new Map(Ie.map((u) => [u, e.layout.getLayout().regions[u].activeWidgetId]));
868
+ for (const u of a.placements) vn(e, u);
869
+ return kn(e, d), e.layout.reconcilePanelMenus(), Rn(e, t.modeId, a), a;
870
+ }, ve = (e) => ({
871
+ title: p(e.title) || void 0,
815
872
  runtimeUrl: e.runtimeUrl,
816
873
  moduleUrl: e.moduleUrl,
817
874
  styles: e.styles,
818
875
  capabilities: e.capabilities
819
- }), rr = (e = 0) => ({
876
+ }), F = (e, t) => e?.({
877
+ id: t.id,
878
+ title: p(t.title, t.id),
879
+ icon: t.icon
880
+ }), En = (e = 0) => ({
820
881
  priority: -e
821
- }), nr = (e, t) => {
822
- const r = e.show ? Array.isArray(e.show) ? e.show : [e.show] : [];
823
- if (r.some((o) => o.for === void 0)) return;
824
- const n = [...r.flatMap((o) => o.for ? [o.for] : []), ...(t ?? []).filter((o) => o.panel === e.id).map((o) => o.resourceKind)].filter((o, s, i) => i.indexOf(o) === s);
825
- return n.length > 0 ? n : void 0;
826
- }, or = (e) => (e.show ? Array.isArray(e.show) ? e.show : [e.show] : [])[0]?.region ?? "main", O = (e) => ({
882
+ }), Pn = (e, t) => {
883
+ const n = e.show ? Array.isArray(e.show) ? e.show : [e.show] : [];
884
+ if (n.some((s) => s.for === void 0)) return;
885
+ const r = [...n.flatMap((s) => s.for ? [s.for] : []), ...(t ?? []).filter((s) => s.panel === e.id).map((s) => s.resourceKind)].filter((s, o, i) => i.indexOf(s) === o);
886
+ return r.length > 0 ? r : void 0;
887
+ }, An = (e) => (e.show ? Array.isArray(e.show) ? e.show : [e.show] : [])[0]?.region ?? "main", N = (e) => ({
827
888
  id: e.panel.id,
828
- title: f(e.panel.title, e.panel.id),
889
+ title: p(e.panel.title, e.panel.id),
829
890
  icon: e.panel.icon,
830
- region: or(e.panel),
891
+ region: An(e.panel),
831
892
  rendererId: e.rendererId,
832
893
  singleton: !0,
833
- resourceKinds: nr(e.panel, e.resourcePanels),
834
- panelMenus: ar(e.panel.panelMenus, e.menuDeclarationOffset),
894
+ resourceKinds: Pn(e.panel, e.resourcePanels),
895
+ panelMenus: jn(e.panel.panelMenus, e.menuDeclarationOffset),
835
896
  config: e.config,
836
- ...rr(e.declarationIndex)
837
- }), K = (e) => {
897
+ ...En(e.declarationIndex)
898
+ }), L = (e) => {
838
899
  const t = [];
839
- let r = 0;
840
- for (const n of e)
841
- t.push(r), r += n.panelMenus?.length ?? 0;
900
+ let n = 0;
901
+ for (const r of e)
902
+ t.push(n), n += r.panelMenus?.length ?? 0;
842
903
  return t;
843
- }, sr = (e) => {
844
- const t = e.renderer?.id ?? (e.webview ? S : void 0);
904
+ }, Sn = (e) => {
905
+ const t = e.renderer?.id ?? (e.webview ? se : void 0);
845
906
  if (!t) throw new Error(`Panel Menu has no renderer: ${e.id}`);
846
907
  return t;
847
- }, ir = {
908
+ }, Tn = {
848
909
  first: 1e6,
849
910
  default: 0,
850
911
  last: -1e6
851
- }, ar = (e, t = 0) => e?.map((r, n) => ({
852
- id: r.id,
853
- title: f(r.title, r.id),
854
- side: r.side,
855
- rendererId: sr(r),
856
- config: r.webview ? q(r.webview) : void 0,
857
- priority: ir[r.placement ?? "default"] - (t + n)
858
- })), D = (e) => e.workbench.layout.registerPanel(e.contribution), z = (e, t) => e.renderer?.kind === t ? e.renderer.id : void 0, ne = (e, t = "") => f(e, t), dr = (e) => !!e && typeof e == "object" && !Array.isArray(e), cr = (e, t, r) => {
859
- const n = M({
912
+ }, jn = (e, t = 0) => e?.map((n, r) => ({
913
+ id: n.id,
914
+ title: p(n.title, n.id),
915
+ side: n.side,
916
+ rendererId: Sn(n),
917
+ config: n.webview ? ve(n.webview) : void 0,
918
+ priority: Tn[n.placement ?? "default"] - (t + r)
919
+ })), U = (e) => {
920
+ const t = e.workbench.layout.registerPanel(e.contribution);
921
+ let n;
922
+ try {
923
+ n = e.workbench.views.registerView({
924
+ id: e.contribution.id,
925
+ panelId: e.contribution.id,
926
+ title: e.contribution.title,
927
+ icon: e.contribution.icon,
928
+ path: e.path,
929
+ aliases: e.aliases,
930
+ resolveInput: e.resolveInput
931
+ });
932
+ } catch (r) {
933
+ throw t.dispose(), r;
934
+ }
935
+ return {
936
+ dispose() {
937
+ n.dispose(), t.dispose();
938
+ }
939
+ };
940
+ }, ee = (e, t) => e.renderer?.kind === t ? e.renderer.id : void 0, pe = (e, t = "") => p(e, t), Wn = (e) => !!e && typeof e == "object" && !Array.isArray(e), Mn = (e, t, n) => {
941
+ const r = B({
860
942
  id: t.id,
861
943
  kind: "renderer",
862
944
  projectId: e.projectId,
863
945
  context: {
864
946
  controlsRendererId: t.id
865
947
  }
866
- }), o = (s, i, a) => s ? P(e, s, {
948
+ }), s = (o, i, a) => o ? P(e, o, {
867
949
  params: {
868
950
  renderer: {
869
951
  rendererId: t.id,
870
952
  projectId: e.projectId,
871
953
  ...a ? {
872
- resource: H(a)
954
+ resource: D(a)
873
955
  } : {},
874
956
  invocation: {
875
957
  placement: "visible"
@@ -878,93 +960,96 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
878
960
  ...i
879
961
  },
880
962
  resource: a,
881
- slot: n,
963
+ slot: r,
882
964
  metadata: {
883
965
  controlsRendererId: t.id
884
966
  }
885
967
  }) : Promise.resolve(void 0);
886
968
  return e.workbench.renderers.registerControlsRenderer({
887
969
  id: t.id,
888
- title: ne(t.title, t.id),
889
- emptyTitle: ne(t.emptyTitle, ""),
890
- emptyDescription: ne(t.emptyDescription, ""),
970
+ title: pe(t.title, t.id),
971
+ emptyTitle: pe(t.emptyTitle, ""),
972
+ emptyDescription: pe(t.emptyDescription, ""),
891
973
  defaultValues: t.defaultValues,
892
- executeQuery: async (s) => {
893
- const i = await o(t.queryHandlerId, {}, s ?? r.resolveResource?.(t));
894
- return dr(i) ? i : {};
974
+ executeQuery: async (o) => {
975
+ const i = await s(t.queryHandlerId, {}, o ?? n.resolveResource?.(t));
976
+ return Wn(i) ? i : {};
895
977
  },
896
978
  updateValue: t.valueChangeHandlerId ? ({
897
- controlId: s,
979
+ controlId: o,
898
980
  value: i,
899
981
  values: a,
900
982
  resource: d
901
- }) => o(t.valueChangeHandlerId, {
902
- controlId: s,
983
+ }) => s(t.valueChangeHandlerId, {
984
+ controlId: o,
903
985
  value: i,
904
986
  values: a
905
987
  }, d).then(() => {
906
988
  }) : void 0,
907
989
  apply: t.applyHandlerId ? ({
908
- values: s,
990
+ values: o,
909
991
  resource: i
910
- }) => o(t.applyHandlerId, {
911
- values: s
992
+ }) => s(t.applyHandlerId, {
993
+ values: o
912
994
  }, i).then(() => {
913
995
  }) : void 0,
914
996
  reset: t.resetHandlerId ? ({
915
- controlIds: s,
997
+ controlIds: o,
916
998
  resource: i
917
- }) => o(t.resetHandlerId, {
918
- controlIds: s
999
+ }) => s(t.resetHandlerId, {
1000
+ controlIds: o
919
1001
  }, i).then(() => {
920
1002
  }) : void 0
921
1003
  });
922
- }, lr = (e, t, r, n, o) => {
923
- const s = z(t, "controls");
924
- if (s)
925
- return D({
1004
+ }, On = (e, t, n, r, s, o) => {
1005
+ const i = ee(t, "controls");
1006
+ if (i)
1007
+ return U({
926
1008
  workbench: e.workbench,
927
- contribution: O({
1009
+ path: t.path,
1010
+ aliases: t.aliases,
1011
+ resolveInput: F(o.resolveViewInput, t),
1012
+ contribution: N({
928
1013
  panel: t,
929
- rendererId: s,
930
- declarationIndex: r,
931
- menuDeclarationOffset: n,
932
- resourcePanels: o
1014
+ rendererId: i,
1015
+ declarationIndex: n,
1016
+ menuDeclarationOffset: r,
1017
+ resourcePanels: s
933
1018
  })
934
1019
  });
935
- }, Xn = (e, t, r, n = {}, o = []) => {
936
- const s = [];
937
- for (const a of t) s.push(cr(e, a, n));
938
- const i = K(r);
939
- return r.forEach((a, d) => {
940
- const m = lr(e, a, d, i[d], o);
941
- m && s.push(m);
1020
+ }, Hn = (e, t, n, r = {}, s = []) => {
1021
+ const o = [];
1022
+ for (const a of t) o.push(Mn(e, a, r));
1023
+ const i = L(n);
1024
+ return n.forEach((a, d) => {
1025
+ const u = On(e, a, d, i[d], s, r);
1026
+ u && o.push(u);
942
1027
  }), {
943
1028
  dispose() {
944
- for (let a = s.length - 1; a >= 0; a -= 1) s[a]?.dispose();
1029
+ for (let a = o.length - 1; a >= 0; a -= 1) o[a]?.dispose();
945
1030
  }
946
1031
  };
947
- }, A = (e, t = "") => f(e, t), ve = (e) => ({
1032
+ }, T = (e, t = "") => p(e, t), Oe = (e) => ({
948
1033
  ...e,
949
- label: A(e.label, e.id),
950
- description: e.description ? A(e.description) : void 0,
951
- icon: e.icon ? U(V, {
1034
+ label: T(e.label, e.id),
1035
+ description: e.description ? T(e.description) : void 0,
1036
+ icon: e.icon ? K(Y, {
952
1037
  name: e.icon,
953
1038
  size: 14
954
1039
  }) : void 0
955
- }), mr = (e) => !!(e && typeof e == "object" && Array.isArray(e.rows)), ur = (e) => ({
1040
+ }), Kn = (e) => !!(e && typeof e == "object" && Array.isArray(e.rows)), $n = (e) => ({
956
1041
  id: e.id,
957
1042
  values: e.values,
958
- resource: e.resource ? _(e.resource) : void 0
959
- }), fr = (e, t) => {
960
- const r = /* @__PURE__ */ new WeakMap(), n = M({
1043
+ resource: e.resource ? J(e.resource) : void 0
1044
+ }), Vn = (e, t) => {
1045
+ const n = /* @__PURE__ */ new WeakMap(), r = B({
961
1046
  id: t.id,
962
1047
  kind: "dataTableRenderer",
963
1048
  projectId: e.projectId,
964
1049
  context: {
965
1050
  dataTableRendererId: t.id
966
1051
  }
967
- }), o = (s, i, a, d) => P(e, s, {
1052
+ }), s = (o, i, a, d) => P(e, o, {
968
1053
  params: {
969
1054
  renderer: {
970
1055
  rendererId: t.id,
@@ -973,7 +1058,7 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
973
1058
  modeId: d
974
1059
  } : {},
975
1060
  ...a ? {
976
- resource: H(a)
1061
+ resource: D(a)
977
1062
  } : {},
978
1063
  invocation: {
979
1064
  placement: "visible"
@@ -982,221 +1067,226 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
982
1067
  ...i
983
1068
  },
984
1069
  resource: a,
985
- slot: n,
1070
+ slot: r,
986
1071
  metadata: {
987
1072
  dataTableRendererId: t.id
988
1073
  }
989
1074
  });
990
1075
  return e.workbench.renderers.registerDataTableRenderer({
991
1076
  id: t.id,
992
- title: A(t.title, t.id),
1077
+ title: T(t.title, t.id),
993
1078
  resourceKind: t.resourceKind,
994
- columns: t.columns?.map(ve),
1079
+ columns: t.columns?.map(Oe),
995
1080
  initialPageSize: t.initialPageSize,
996
1081
  pageSizeOptions: t.pageSizeOptions,
997
1082
  selectionMode: t.selectionMode,
998
- selectionActions: t.selectionActions?.map((s) => ({
999
- id: s.id,
1000
- label: A(s.label, s.id),
1001
- icon: s.icon ? U(V, {
1002
- name: s.icon,
1083
+ selectionActions: t.selectionActions?.map((o) => ({
1084
+ id: o.id,
1085
+ label: T(o.label, o.id),
1086
+ icon: o.icon ? K(Y, {
1087
+ name: o.icon,
1003
1088
  size: 16
1004
1089
  }) : void 0,
1005
- destructive: s.destructive,
1006
- run: (i) => o(s.commandId, {
1090
+ destructive: o.destructive,
1091
+ run: (i) => s(o.commandId, {
1007
1092
  rowIds: i.map((a) => a.id)
1008
1093
  }).then(() => {
1009
1094
  })
1010
1095
  })),
1011
- emptyTitle: t.emptyTitle ? A(t.emptyTitle) : void 0,
1012
- emptyDescription: t.emptyDescription ? A(t.emptyDescription) : void 0,
1096
+ emptyTitle: t.emptyTitle ? T(t.emptyTitle) : void 0,
1097
+ emptyDescription: t.emptyDescription ? T(t.emptyDescription) : void 0,
1013
1098
  executeQuery: async ({
1014
- resource: s,
1099
+ resource: o,
1015
1100
  modeId: i
1016
1101
  }) => {
1017
- const a = await o(t.queryHandlerId, {}, s, i);
1018
- return mr(a) ? {
1019
- rows: a.rows.map((m) => {
1020
- const w = ur(m);
1021
- return r.set(w, m), w;
1102
+ const a = await s(t.queryHandlerId, {}, o, i);
1103
+ return Kn(a) ? {
1104
+ rows: a.rows.map((u) => {
1105
+ const w = $n(u);
1106
+ return n.set(w, u), w;
1022
1107
  }),
1023
- columns: a.columns?.map(ve)
1108
+ columns: a.columns?.map(Oe)
1024
1109
  } : {
1025
1110
  rows: []
1026
1111
  };
1027
1112
  },
1028
- rowActions: t.rowActions?.map((s) => ({
1029
- id: s.id,
1030
- label: A(s.label, s.id),
1031
- icon: s.icon ? U(V, {
1032
- name: s.icon,
1113
+ rowActions: t.rowActions?.map((o) => ({
1114
+ id: o.id,
1115
+ label: T(o.label, o.id),
1116
+ icon: o.icon ? K(Y, {
1117
+ name: o.icon,
1033
1118
  size: 16
1034
1119
  }) : void 0,
1035
- destructive: s.destructive,
1120
+ destructive: o.destructive,
1036
1121
  run: async (i) => {
1037
- await o(s.commandId, {
1122
+ await s(o.commandId, {
1038
1123
  rowId: i.id
1039
1124
  }, i.resource), e.workbench.renderers.refreshDataTableRenderer(t.id);
1040
1125
  }
1041
1126
  })),
1042
- onRowActivate: t.rowActivationHandlerId ? async (s) => {
1043
- const i = await o(t.rowActivationHandlerId, {
1044
- row: r.get(s) ?? s
1045
- }, s.resource), a = Fe(i);
1127
+ onRowActivate: t.rowActivationHandlerId ? async (o) => {
1128
+ const i = await s(t.rowActivationHandlerId, {
1129
+ row: n.get(o) ?? o
1130
+ }, o.resource), a = Je(i, {
1131
+ extensionId: t.extensionId
1132
+ });
1046
1133
  a && await e.workbench.navigation.openTarget(a);
1047
1134
  } : void 0
1048
1135
  });
1049
- }, pr = (e, t, r, n, o) => {
1050
- const s = z(t, "dataTable");
1051
- if (s)
1052
- return D({
1136
+ }, Dn = (e, t, n, r, s, o) => {
1137
+ const i = ee(t, "dataTable");
1138
+ if (i)
1139
+ return U({
1053
1140
  workbench: e.workbench,
1054
- contribution: O({
1141
+ path: t.path,
1142
+ aliases: t.aliases,
1143
+ resolveInput: F(o, t),
1144
+ contribution: N({
1055
1145
  panel: t,
1056
- rendererId: s,
1057
- declarationIndex: r,
1058
- menuDeclarationOffset: n,
1059
- resourcePanels: o
1146
+ rendererId: i,
1147
+ declarationIndex: n,
1148
+ menuDeclarationOffset: r,
1149
+ resourcePanels: s
1060
1150
  })
1061
1151
  });
1062
- }, br = (e, t, r, n = []) => {
1063
- const o = t.map((i) => fr(e, i)), s = K(r);
1064
- return r.forEach((i, a) => {
1065
- const d = pr(e, i, a, s[a], n);
1066
- d && o.push(d);
1152
+ }, Bn = (e, t, n, r = [], s) => {
1153
+ const o = t.map((a) => Vn(e, a)), i = L(n);
1154
+ return n.forEach((a, d) => {
1155
+ const u = Dn(e, a, d, i[d], r, s);
1156
+ u && o.push(u);
1067
1157
  }), {
1068
1158
  dispose() {
1069
- for (let i = o.length - 1; i >= 0; i -= 1) o[i]?.dispose();
1159
+ for (let a = o.length - 1; a >= 0; a -= 1) o[a]?.dispose();
1070
1160
  }
1071
1161
  };
1072
- }, hr = {
1162
+ }, Fn = {
1073
1163
  first: 0,
1074
1164
  default: 1,
1075
1165
  last: 2
1076
- }, Jn = {
1166
+ }, Do = {
1077
1167
  commands: [],
1078
1168
  commandPaletteContributions: [],
1079
1169
  diagnostics: [],
1080
1170
  extensions: [],
1081
1171
  menuContributions: [],
1082
1172
  modes: [],
1083
- routes: [],
1084
- kanbanRenderers: [],
1085
- dataTableRenderers: [],
1086
- treeRenderers: [],
1087
- fileRenderers: [],
1173
+ views: [],
1174
+ viewMenus: [],
1175
+ placements: [],
1176
+ resourceKinds: [],
1177
+ resourceViews: [],
1178
+ navigationItems: [],
1179
+ statusBarItems: [],
1180
+ statuses: [],
1088
1181
  settingsPanels: [],
1089
- settingsDefinitions: [],
1090
- treeItems: [],
1091
- panels: []
1092
- }, gr = (e) => `workbench.extension.menu.${e.id}`, wr = (e) => `workbench.extension.palette.${e.id}`, Ne = (e, t) => hr[e.placement ?? "default"] * 1e3 + t, Ue = (e) => e === void 0 ? "" : it(e) ? e.default ?? e.$l10n : e, Ir = (e) => {
1182
+ settingsDefinitions: []
1183
+ }, Nn = (e) => `workbench.extension.menu.${e.id}`, Ln = (e) => `workbench.extension.palette.${e.id}`, et = (e, t) => Fn[e.placement ?? "default"] * 1e3 + t, tt = (e) => e === void 0 ? "" : Ct(e) ? e.default ?? e.$l10n : e, Un = (e) => {
1093
1184
  const {
1094
1185
  commandId: t,
1095
- contribution: r,
1096
- index: n,
1097
- resolveString: o,
1098
- slot: s,
1186
+ contribution: n,
1187
+ index: r,
1188
+ resolveString: s,
1189
+ slot: o,
1099
1190
  when: i
1100
1191
  } = e;
1101
1192
  return {
1102
1193
  commandId: t,
1103
- sourceCommandId: r.commandId,
1104
- label: o(r.label, r.extensionId),
1105
- icon: r.icon,
1106
- group: s.group ?? r.group,
1107
- args: r.params,
1108
- overflowLabel: s.overflowLabel,
1109
- order: Ne(r, n),
1194
+ sourceCommandId: n.commandId,
1195
+ label: s(n.label, n.extensionId),
1196
+ icon: n.icon,
1197
+ group: o.group ?? n.group,
1198
+ args: n.params,
1199
+ overflowLabel: o.overflowLabel,
1200
+ order: et(n, r),
1110
1201
  when: i
1111
1202
  };
1112
- }, yr = (e) => {
1203
+ }, _n = (e) => {
1113
1204
  const {
1114
1205
  commandId: t,
1115
- contribution: r,
1116
- index: n,
1117
- resolveString: o
1206
+ contribution: n,
1207
+ index: r,
1208
+ resolveString: s
1118
1209
  } = e;
1119
1210
  return {
1120
1211
  commandId: t,
1121
- label: o(r.label, r.extensionId),
1122
- icon: r.icon,
1123
- group: r.group,
1124
- args: r.params,
1125
- order: Ne(r, n)
1212
+ label: s(n.label, n.extensionId),
1213
+ icon: n.icon,
1214
+ group: n.group,
1215
+ args: n.params,
1216
+ order: et(n, r)
1126
1217
  };
1127
- }, vr = (e) => {
1218
+ }, qn = (e) => {
1128
1219
  const {
1129
- createCommandId: t = gr,
1130
- createWhenExpression: r,
1131
- menuSlotsById: n,
1132
- menuTargetsById: o,
1133
- metadata: s,
1134
- resolveString: i = Ue
1135
- } = e, a = [];
1136
- return s.menuContributions.forEach((d, m) => {
1137
- const w = d.target ? o?.get(d.target) : n.get(d.slotId);
1138
- if (!w) return;
1139
- const l = t(d), u = s.commands.find((c) => c.id === d.commandId);
1220
+ createCommandId: t = Nn,
1221
+ createWhenExpression: n,
1222
+ menuSlotsById: r,
1223
+ menuTargetsById: s,
1224
+ metadata: o,
1225
+ resolveString: i = tt
1226
+ } = e, a = [], d = [];
1227
+ return o.menuContributions.forEach((u, w) => {
1228
+ const l = u.target ? s?.get(u.target) : r.get(u.slotId);
1229
+ if (!l) {
1230
+ d.push({
1231
+ contribution: u,
1232
+ targetId: u.target ?? u.slotId
1233
+ });
1234
+ return;
1235
+ }
1236
+ const m = t(u), c = o.commands.find((f) => f.id === u.commandId);
1140
1237
  a.push({
1141
1238
  command: {
1142
- id: l,
1143
- label: i(d.label, d.extensionId),
1144
- category: d.group,
1145
- description: u ? i(u.description, u.extensionId) : void 0,
1146
- icon: d.icon,
1147
- params: u?.params
1239
+ id: m,
1240
+ label: i(u.label, u.extensionId),
1241
+ category: u.group,
1242
+ description: c ? i(c.description, c.extensionId) : void 0,
1243
+ icon: u.icon,
1244
+ params: c?.params
1148
1245
  },
1149
- contribution: d,
1150
- menuItem: Ir({
1151
- commandId: l,
1152
- contribution: d,
1153
- index: m,
1246
+ contribution: u,
1247
+ menuItem: Un({
1248
+ commandId: m,
1249
+ contribution: u,
1250
+ index: w,
1154
1251
  resolveString: i,
1155
- slot: w,
1156
- when: r?.(d)
1252
+ slot: l,
1253
+ when: n?.(u)
1157
1254
  }),
1158
- menuPath: w.menuPath,
1159
- targetCommandId: d.commandId
1255
+ menuPath: l.menuPath,
1256
+ targetCommandId: u.commandId
1160
1257
  });
1161
- }), a;
1162
- }, kr = (e) => {
1258
+ }), {
1259
+ registrations: a,
1260
+ unresolved: d
1261
+ };
1262
+ }, zn = (e) => {
1163
1263
  const {
1164
- createCommandId: t = wr,
1165
- metadata: r,
1166
- resolveString: n = Ue
1167
- } = e, o = [];
1168
- return (r.commandPaletteContributions ?? []).forEach((s, i) => {
1169
- const a = t(s), d = r.commands.find((m) => m.id === s.commandId);
1170
- o.push({
1264
+ createCommandId: t = Ln,
1265
+ metadata: n,
1266
+ resolveString: r = tt
1267
+ } = e, s = [];
1268
+ return (n.commandPaletteContributions ?? []).forEach((o, i) => {
1269
+ const a = t(o), d = n.commands.find((u) => u.id === o.commandId);
1270
+ s.push({
1171
1271
  command: {
1172
1272
  id: a,
1173
- label: n(s.label, s.extensionId),
1174
- category: s.group,
1175
- description: d ? n(d.description, d.extensionId) : void 0,
1176
- icon: s.icon,
1273
+ label: r(o.label, o.extensionId),
1274
+ category: o.group,
1275
+ description: d ? r(d.description, d.extensionId) : void 0,
1276
+ icon: o.icon,
1177
1277
  params: d?.params
1178
1278
  },
1179
- contribution: s,
1180
- menuItem: yr({
1279
+ contribution: o,
1280
+ menuItem: _n({
1181
1281
  commandId: a,
1182
- contribution: s,
1282
+ contribution: o,
1183
1283
  index: i,
1184
- resolveString: n
1284
+ resolveString: r
1185
1285
  }),
1186
- targetCommandId: s.commandId
1286
+ targetCommandId: o.commandId
1187
1287
  });
1188
- }), o;
1189
- }, Zn = (e) => {
1190
- const {
1191
- createResource: t,
1192
- metadata: r
1193
- } = e;
1194
- return r ? r.routes.map((n) => ({
1195
- resource: t({
1196
- route: n
1197
- })
1198
- })) : [];
1199
- }, Rr = (e) => {
1288
+ }), s;
1289
+ }, Qn = (e) => {
1200
1290
  if (e)
1201
1291
  return {
1202
1292
  type: e.kind,
@@ -1204,7 +1294,7 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1204
1294
  label: e.label,
1205
1295
  metadata: e.metadata
1206
1296
  };
1207
- }, Cr = (e) => ({
1297
+ }, Gn = (e) => ({
1208
1298
  id: e.rendererId,
1209
1299
  kind: "renderer",
1210
1300
  context: {
@@ -1214,8 +1304,8 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1214
1304
  resourceId: e.resource.id
1215
1305
  } : {}
1216
1306
  }
1217
- }), ke = async (e, t, r, n, o = {}, s) => {
1218
- const i = Rr(n), a = await e.executeCommand(r, {
1307
+ }), He = async (e, t, n, r, s = {}, o) => {
1308
+ const i = Qn(r), a = await e.executeCommand(n, {
1219
1309
  projectId: e.projectId,
1220
1310
  params: {
1221
1311
  renderer: {
@@ -1228,235 +1318,279 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1228
1318
  placement: "visible"
1229
1319
  }
1230
1320
  },
1231
- ...o
1321
+ ...s
1232
1322
  },
1233
1323
  resource: i,
1234
- slot: Cr({
1324
+ slot: Gn({
1235
1325
  projectId: e.projectId,
1236
1326
  rendererId: t,
1237
1327
  resource: i
1238
1328
  }),
1239
1329
  source: "dashboard",
1240
- ...s ? {
1241
- metadata: s
1330
+ ...o ? {
1331
+ metadata: o
1242
1332
  } : {}
1243
1333
  });
1244
- return X(a);
1245
- }, Ve = (e) => {
1334
+ return ie(a);
1335
+ }, nt = (e) => {
1246
1336
  if (!e || typeof e != "object") return;
1247
1337
  const t = e.revision;
1248
1338
  return typeof t == "string" ? t : void 0;
1249
- }, eo = (e, t) => {
1250
- const r = e.metadata, n = r?.fileRendererOrigin;
1251
- if (!n || typeof n != "object") return;
1252
- const o = n;
1253
- if (typeof o.rendererId != "string" || typeof o.instanceId != "string" || typeof o.operationId != "string")
1339
+ }, Bo = (e, t) => {
1340
+ const n = e.metadata, r = n?.fileRendererOrigin;
1341
+ if (!r || typeof r != "object") return;
1342
+ const s = r;
1343
+ if (typeof s.rendererId != "string" || typeof s.instanceId != "string" || typeof s.operationId != "string")
1254
1344
  return;
1255
- const s = r?.fileRendererResourceUri, i = Ve(t.outcome.value);
1345
+ const o = n?.fileRendererResourceUri, i = nt(t.outcome.value);
1256
1346
  return {
1257
1347
  origin: {
1258
- rendererId: o.rendererId,
1259
- instanceId: o.instanceId,
1260
- operationId: o.operationId
1348
+ rendererId: s.rendererId,
1349
+ instanceId: s.instanceId,
1350
+ operationId: s.operationId
1261
1351
  },
1262
- ...typeof s == "string" ? {
1263
- resourceUri: s
1352
+ ...typeof o == "string" ? {
1353
+ resourceUri: o
1264
1354
  } : {},
1265
1355
  ...i ? {
1266
1356
  revision: i
1267
1357
  } : {}
1268
1358
  };
1269
- }, Er = (e, t) => e.workbench.renderers.registerFileRenderer({
1359
+ }, Yn = (e, t) => e.workbench.renderers.registerFileRenderer({
1270
1360
  id: t.id,
1271
- title: f(t.title, t.id),
1361
+ title: p(t.title, t.id),
1272
1362
  resourceKind: t.resourceKind,
1273
- load: async (r) => await ke(e, t.id, t.loadHandlerId, r) ?? {},
1274
- save: t.saveHandlerId ? async (r, n, o) => {
1275
- const s = await ke(e, t.id, t.saveHandlerId, r, {
1276
- content: n
1363
+ load: async (n) => await He(e, t.id, t.loadHandlerId, n) ?? {},
1364
+ save: t.saveHandlerId ? async (n, r, s) => {
1365
+ const o = await He(e, t.id, t.saveHandlerId, n, {
1366
+ content: r
1277
1367
  }, {
1278
- ...o ? {
1279
- fileRendererOrigin: o
1368
+ ...s ? {
1369
+ fileRendererOrigin: s
1280
1370
  } : {},
1281
- ...r?.uri ? {
1282
- fileRendererResourceUri: r.uri
1371
+ ...n?.uri ? {
1372
+ fileRendererResourceUri: n.uri
1283
1373
  } : {}
1284
- }), i = Ve(s);
1374
+ }), i = nt(o);
1285
1375
  return i ? {
1286
1376
  revision: i
1287
1377
  } : void 0;
1288
1378
  } : void 0
1289
- }), Pr = (e, t, r, n) => {
1290
- const o = z(t, "file");
1291
- if (o)
1292
- return D({
1379
+ }), Xn = (e, t, n, r) => {
1380
+ const s = ee(t, "file");
1381
+ if (s)
1382
+ return U({
1293
1383
  workbench: e.workbench,
1294
- contribution: O({
1384
+ path: t.path,
1385
+ aliases: t.aliases,
1386
+ resolveInput: F(e.resolveViewInput, t),
1387
+ contribution: N({
1295
1388
  panel: t,
1296
- rendererId: o,
1297
- declarationIndex: r,
1298
- menuDeclarationOffset: n,
1389
+ rendererId: s,
1390
+ declarationIndex: n,
1391
+ menuDeclarationOffset: r,
1299
1392
  resourcePanels: e.metadata.resourcePanels
1300
1393
  })
1301
1394
  });
1302
- }, Ar = (e) => {
1395
+ }, Jn = (e) => {
1303
1396
  const t = [];
1304
- for (const n of e.metadata.fileRenderers ?? [])
1305
- t.push(Er(e, n));
1306
- const r = K(e.metadata.panels);
1307
- return e.metadata.panels.forEach((n, o) => {
1308
- const s = Pr(e, n, o, r[o]);
1309
- s && t.push(s);
1397
+ for (const r of e.metadata.fileRenderers ?? [])
1398
+ t.push(Yn(e, r));
1399
+ const n = L(e.metadata.panels);
1400
+ return e.metadata.panels.forEach((r, s) => {
1401
+ const o = Xn(e, r, s, n[s]);
1402
+ o && t.push(o);
1310
1403
  }), {
1311
1404
  dispose() {
1312
- for (let n = t.length - 1; n >= 0; n -= 1) t[n]?.dispose();
1405
+ for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1313
1406
  }
1314
1407
  };
1315
- }, xr = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Re = (e, t, r, n) => (t ?? []).map((o) => {
1316
- const s = {
1408
+ }, Zn = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Ke = (e, t, n, r, s) => (t ?? []).map((o) => {
1409
+ const i = {
1317
1410
  ...o,
1318
- label: r(o.label, o.id),
1319
- type: o.type.kind === "enum" || o.type.kind === "enum-multi" ? {
1411
+ label: n(o.label, o.id),
1412
+ type: o.type.kind === "status" ? {
1413
+ kind: "enum",
1414
+ options: s(o.type.statuses)
1415
+ } : o.type.kind === "enum" || o.type.kind === "enum-multi" ? {
1320
1416
  ...o.type,
1321
- options: Array.isArray(o.type.options) ? o.type.options.map((i) => ({
1322
- ...i,
1323
- label: r(i.label, i.value)
1417
+ options: Array.isArray(o.type.options) ? o.type.options.map((a) => ({
1418
+ ...a,
1419
+ label: n(a.label, a.value)
1324
1420
  })) : o.type.options
1325
1421
  } : o.type
1326
1422
  };
1327
- return n(e, s);
1328
- }), Tr = (e, t, r, n) => {
1329
- let o = Re(e, t, r, n);
1330
- const s = /* @__PURE__ */ new Set();
1423
+ return r(e, i);
1424
+ }), er = (e, t, n, r, s = () => []) => {
1425
+ let o = Ke(e, t, n, r, s);
1426
+ const i = /* @__PURE__ */ new Set();
1331
1427
  return {
1332
1428
  source: {
1333
1429
  getSnapshot: () => o,
1334
- subscribe: (i) => (s.add(i), () => s.delete(i))
1430
+ subscribe: (a) => (i.add(a), () => i.delete(a))
1335
1431
  },
1336
- set(i) {
1337
- o = Re(e, i, r, n);
1338
- for (const a of s) a();
1432
+ set(a) {
1433
+ o = Ke(e, a, n, r, s);
1434
+ for (const d of i) d();
1339
1435
  }
1340
1436
  };
1341
- }, Wr = (e) => !!(e && typeof e == "object" && typeof e.kind == "string"), jr = (e) => !!(e && typeof e == "object" && typeof e.type == "string" && typeof e.id == "string"), Sr = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, Le = (e, t) => {
1437
+ }, tr = (e) => !!(e && typeof e == "object" && typeof e.kind == "string"), nr = (e) => !!(e && typeof e == "object" && typeof e.type == "string" && typeof e.id == "string"), rr = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, rt = (e, t) => {
1342
1438
  const {
1343
- resource: r
1439
+ resource: n
1344
1440
  } = t;
1345
- if (Wr(r)) return r;
1346
- if (jr(r)) return _(r);
1347
- }, Hr = (e, t) => {
1348
- const r = Le(e, t);
1349
- if (r) return r;
1441
+ if (tr(n)) return n;
1442
+ if (nr(n)) return J(n);
1443
+ }, or = (e, t) => {
1444
+ const n = rt(e, t);
1445
+ if (n) return n;
1350
1446
  if (e.resourceKind)
1351
1447
  return {
1352
1448
  kind: e.resourceKind,
1353
- uri: Sr(e.resourceKind, t.id),
1449
+ uri: rr(e.resourceKind, t.id),
1354
1450
  id: t.id,
1355
1451
  label: t.title
1356
1452
  };
1357
- }, Ce = (e, t) => {
1358
- const r = e, n = t(r);
1359
- return n === void 0 ? r : {
1360
- ...r,
1361
- resource: n
1453
+ }, $e = (e, t) => {
1454
+ const n = e, r = t(n);
1455
+ return r === void 0 ? n : {
1456
+ ...n,
1457
+ resource: r
1362
1458
  };
1363
- }, _e = (...e) => Object.assign({}, ...e.filter((t) => !!t)), Mr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Or = (e) => Object.keys(e ?? {}).length > 0, Kr = /* @__PURE__ */ new Set(["text", "longtext", "markdown", "number", "boolean", "select", "multi-select", "files"]), Dr = (e, t, r) => {
1364
- if (!Kr.has(t.type)) return;
1365
- const n = "options" in t && Array.isArray(t.options) ? t.options : [], o = t;
1459
+ }, ot = (...e) => Object.assign({}, ...e.filter((t) => !!t)), sr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, ir = (e) => Object.keys(e ?? {}).length > 0, ar = /* @__PURE__ */ new Set(["text", "longtext", "markdown", "number", "boolean", "select", "multi-select", "files"]), dr = (e, t, n) => {
1460
+ if (!ar.has(t.type)) return;
1461
+ const r = "options" in t && Array.isArray(t.options) ? t.options : [], s = t;
1366
1462
  return {
1367
1463
  id: e,
1368
- label: r(t.label, e),
1369
- description: t.description === void 0 ? void 0 : r(t.description),
1370
- placeholder: o.placeholder === void 0 ? void 0 : r(o.placeholder),
1464
+ label: n(t.label, e),
1465
+ description: t.description === void 0 ? void 0 : n(t.description),
1466
+ placeholder: s.placeholder === void 0 ? void 0 : n(s.placeholder),
1371
1467
  type: t.type,
1372
1468
  required: t.required === !0,
1373
1469
  defaultValue: t.defaultValue,
1374
- options: t.type === "select" || t.type === "multi-select" ? n.map((s) => ({
1375
- value: s.value,
1376
- label: r(s.label, s.value),
1377
- icon: s.icon
1470
+ options: t.type === "select" || t.type === "multi-select" ? r.map((o) => ({
1471
+ value: o.value,
1472
+ label: n(o.label, o.value),
1473
+ icon: o.icon
1378
1474
  })) : void 0,
1379
- multiple: t.type === "files" ? o.multiple !== !1 : void 0,
1380
- accept: t.type === "files" && typeof o.accept == "string" ? o.accept : void 0
1475
+ multiple: t.type === "files" ? s.multiple !== !1 : void 0,
1476
+ accept: t.type === "files" && typeof s.accept == "string" ? s.accept : void 0
1381
1477
  };
1382
- }, $r = (e, t) => Object.entries(e.createRow?.params ?? {}).flatMap(([r, n]) => {
1383
- const o = Dr(r, n, t);
1384
- return o ? [o] : [];
1385
- }), Fr = (e, t) => M({
1478
+ }, cr = (e, t) => Object.entries(e.createRow?.params ?? {}).flatMap(([n, r]) => {
1479
+ const s = dr(n, r, t);
1480
+ return s ? [s] : [];
1481
+ }), lr = (e, t) => B({
1386
1482
  id: t.id,
1387
1483
  kind: "kanbanRenderer",
1388
1484
  projectId: e.projectId,
1389
1485
  context: {
1390
1486
  kanbanRendererId: t.id
1391
1487
  }
1392
- }), L = (e, t, r, n, o) => {
1393
- const s = o ?? e.workbench.getPrimaryResource();
1394
- return P(e, r, {
1488
+ }), X = (e, t, n, r, s) => {
1489
+ const o = s ?? e.workbench.getPrimaryResource();
1490
+ return P(e, n, {
1395
1491
  params: {
1396
1492
  renderer: {
1397
1493
  rendererId: t.id,
1398
1494
  projectId: e.projectId,
1399
- ...s ? {
1400
- resource: H(s)
1495
+ ...o ? {
1496
+ resource: D(o)
1401
1497
  } : {},
1402
1498
  invocation: {
1403
1499
  placement: "visible"
1404
1500
  }
1405
1501
  },
1406
- ...n
1502
+ ...r
1407
1503
  },
1408
- resource: s,
1409
- slot: Fr(e, t),
1504
+ resource: o,
1505
+ slot: lr(e, t),
1410
1506
  metadata: {
1411
1507
  kanbanRendererId: t.id
1412
1508
  }
1413
1509
  });
1414
- }, qe = (e, t) => `workbench.extension.kanbanRenderer.${e.id}.rowAction.${t.id}`, Br = (e, t, r) => (t.rowActions ?? []).map((n) => {
1415
- const o = e.workbench.commands.getCommand(n.commandId)?.command;
1510
+ }, st = (e, t) => `workbench.extension.kanbanRenderer.${e.id}.rowAction.${t.id}`, ur = (e, t, n) => (t.rowActions ?? []).map((r) => {
1511
+ const s = e.workbench.commands.getCommand(r.commandId)?.command;
1416
1512
  return e.workbench.commands.registerCommand({
1417
- id: qe(t, n),
1418
- label: r(n.label, n.id),
1419
- icon: n.icon,
1420
- params: o?.params
1513
+ id: st(t, r),
1514
+ label: n(r.label, r.id),
1515
+ icon: r.icon,
1516
+ params: s?.params
1421
1517
  }, {
1422
- execute: (s, i) => L(e, t, n.commandId, _e(Mr(s)), i?.resource)
1518
+ execute: (o, i) => X(e, t, r.commandId, ot(sr(o)), i?.resource)
1423
1519
  });
1424
- }), Nr = (e, t, r, n, o, s) => {
1425
- const i = qe(t, r), a = e.workbench.commands.getCommand(i), d = {
1426
- rowId: n.id
1427
- }, m = o ? {
1428
- resource: o
1429
- } : void 0, w = s(r.label, r.id);
1430
- return a && Or(a.command.params) ? (e.workbench.commandPalette.requestParams({
1520
+ }), mr = (e, t, n, r, s, o) => {
1521
+ const i = st(t, n), a = e.workbench.commands.getCommand(i), d = {
1522
+ rowId: r.id
1523
+ }, u = s ? {
1524
+ resource: s
1525
+ } : void 0, w = o(n.label, n.id);
1526
+ return a && ir(a.command.params) ? (e.workbench.commandPalette.requestParams({
1431
1527
  record: a,
1432
1528
  label: w,
1433
1529
  args: d,
1434
- context: m
1435
- }), Promise.resolve()) : a ? e.workbench.commands.executeCommand(a.command.id, d, m).then(() => {
1436
- }) : L(e, t, r.commandId, d, o).then(() => {
1530
+ context: u
1531
+ }), Promise.resolve()) : a ? e.workbench.commands.executeCommand(a.command.id, d, u).then(() => {
1532
+ }) : X(e, t, n.commandId, d, s).then(() => {
1437
1533
  });
1438
- }, Ur = (e) => (r) => U(V, {
1534
+ }, pr = (e) => (n) => K(Y, {
1439
1535
  name: e ?? "MoreHorizontal",
1440
- ...r
1441
- }), Vr = (e, t) => ({
1536
+ ...n
1537
+ }), fr = (e, t) => ({
1442
1538
  color: e?.color,
1443
1539
  canDragIn: e?.canDragIn,
1444
1540
  canDragOut: e?.canDragOut,
1445
1541
  canCreate: e?.canCreate,
1446
- actions: e?.actions?.map((r) => ({
1447
- id: r.id,
1448
- label: t(r.label, r.id),
1449
- icon: Ur(r.icon)
1542
+ actions: e?.actions?.map((n) => ({
1543
+ id: n.id,
1544
+ label: t(n.label, n.id),
1545
+ icon: pr(n.icon)
1450
1546
  }))
1451
- }), Lr = (e) => e ? U(V, {
1547
+ }), it = (e, t) => `${t.extensionId ?? e.extensionId}.status.${t.id}`, br = (e, t) => {
1548
+ const n = /* @__PURE__ */ new Map();
1549
+ return (r) => {
1550
+ const s = it(t, r), o = n.get(s);
1551
+ if (o) return o;
1552
+ const i = {
1553
+ getSnapshot: () => (e.workbench.statuses.getStatuses(s) ?? []).map((a) => ({
1554
+ value: a.id,
1555
+ label: a.label,
1556
+ color: a.color,
1557
+ icon: a.icon
1558
+ })),
1559
+ subscribe: (a) => e.workbench.statuses.store.subscribeSelector((d) => d.values[s], a)
1560
+ };
1561
+ return n.set(s, i), e.workbench.statuses.load(s).catch(() => {
1562
+ }), i;
1563
+ };
1564
+ }, gr = (e, t, n, r) => {
1565
+ for (const s of n ?? []) {
1566
+ if (s.type.kind !== "status") continue;
1567
+ const o = it(t, s.type.statuses), i = e.workbench.statuses.getStatuses(o)?.find((d) => d.id === r);
1568
+ if (!i) continue;
1569
+ const a = e.workbench.statuses.getStatusSet(o);
1570
+ return {
1571
+ color: i.color,
1572
+ canCreate: i.board?.canCreate,
1573
+ canDragIn: i.board?.canDragIn,
1574
+ canDragOut: i.board?.canDragOut,
1575
+ actions: i.board?.actions?.flatMap((d) => {
1576
+ const u = a?.actions?.find((w) => w.id === d);
1577
+ return u ? [{
1578
+ id: u.id,
1579
+ label: u.label,
1580
+ icon: u.icon
1581
+ }] : [];
1582
+ })
1583
+ };
1584
+ }
1585
+ }, hr = (e) => e ? K(Y, {
1452
1586
  name: e,
1453
1587
  size: 16
1454
- }) : void 0, _r = (e, t) => {
1588
+ }) : void 0, wr = (e, t) => {
1455
1589
  if (e.createRow)
1456
1590
  return {
1457
1591
  title: t(e.createRow.title, "Create row"),
1458
1592
  submitLabel: t(e.createRow.submitLabel, "Create"),
1459
- fields: $r(e, t),
1593
+ fields: cr(e, t),
1460
1594
  labels: {
1461
1595
  cancel: t(e.createRow.labels?.cancel, "Cancel"),
1462
1596
  properties: t(e.createRow.labels?.properties, "Properties"),
@@ -1464,69 +1598,72 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1464
1598
  removeFile: t(e.createRow.labels?.removeFile, "Remove file")
1465
1599
  }
1466
1600
  };
1467
- }, qr = (e, t, r, n, o) => {
1601
+ }, Ir = (e, t, n, r, s) => {
1468
1602
  if (t.rowActivationHandlerId)
1469
- return async (s) => {
1470
- const i = n(t, s), a = await L(e, t, t.rowActivationHandlerId, {
1471
- row: o(s)
1472
- }, i), d = Fe(a, {
1473
- resourceOf: r.resolveNavigationResource ? (m) => r.resolveNavigationResource(t, m) : void 0
1603
+ return async (o) => {
1604
+ const i = r(t, o), a = await X(e, t, t.rowActivationHandlerId, {
1605
+ row: s(o)
1606
+ }, i), d = Je(a, {
1607
+ extensionId: t.extensionId,
1608
+ resourceOf: n.resolveNavigationResource ? (u) => n.resolveNavigationResource(t, u) : void 0
1474
1609
  });
1475
1610
  d && await e.workbench.navigation.openTarget(d);
1476
1611
  };
1477
- if (r.onRowClick)
1478
- return (s) => r.onRowClick?.({
1612
+ if (n.onRowClick)
1613
+ return (o) => n.onRowClick?.({
1479
1614
  record: t,
1480
- row: s,
1481
- resource: n(t, s)
1615
+ row: o,
1616
+ resource: r(t, o)
1482
1617
  });
1483
- }, zr = (e, t, r) => {
1484
- const n = e.createRow;
1485
- if (n)
1486
- return async (o) => {
1487
- const s = _e(o.values, n.columnParam ? {
1488
- [n.columnParam]: o.columnId
1489
- } : void 0, n.attributesParam ? {
1490
- [n.attributesParam]: o.attributeValues
1491
- } : void 0), i = await r(e, n.commandId, s);
1618
+ }, yr = (e, t, n) => {
1619
+ const r = e.createRow;
1620
+ if (r)
1621
+ return async (s) => {
1622
+ const o = ot(s.values, r.columnParam ? {
1623
+ [r.columnParam]: s.columnId
1624
+ } : void 0, r.attributesParam ? {
1625
+ [r.attributesParam]: s.attributeValues
1626
+ } : void 0), i = await n(e, r.commandId, o);
1492
1627
  await t.onAfterCreate?.({
1493
1628
  record: e,
1494
1629
  created: i,
1495
- submission: o
1630
+ submission: s
1496
1631
  });
1497
1632
  };
1498
- }, Qr = (e, t, r, n, o) => {
1499
- const s = t.rowActions;
1500
- if (s?.length)
1501
- return (i) => s.map((a) => {
1502
- const d = o(t, i), m = () => Nr(e, t, a, i, d, n);
1633
+ }, vr = (e, t, n, r, s) => {
1634
+ const o = t.rowActions;
1635
+ if (o?.length)
1636
+ return (i) => o.map((a) => {
1637
+ const d = s(t, i), u = () => mr(e, t, a, i, d, r);
1503
1638
  return {
1504
1639
  key: a.id,
1505
- label: n(a.label, a.id),
1640
+ label: r(a.label, a.id),
1506
1641
  commandId: a.commandId,
1507
- icon: Lr(a.icon),
1508
- onClick: () => r.executeRowAction ? r.executeRowAction({
1642
+ icon: hr(a.icon),
1643
+ onClick: () => n.executeRowAction ? n.executeRowAction({
1509
1644
  record: t,
1510
1645
  action: a,
1511
1646
  row: i,
1512
1647
  resource: d,
1513
- runDefault: m
1514
- }) : m()
1648
+ runDefault: u
1649
+ }) : u()
1515
1650
  };
1516
1651
  });
1517
- }, Gr = (e, t, r = {}, n = [], o = []) => {
1518
- const s = [], i = r.resolveLabel ?? ((c, p) => f(c, p)), a = r.decorateAttribute ?? ((c, p) => p), d = r.resolveRowResource ?? Le, m = r.resolveRowActionResource ?? Hr, w = r.onAfterMutation ?? (() => {
1519
- }), l = (c, p, h) => L(e, c, p, h).then((k) => (w(c), k));
1652
+ }, kr = (e, t, n = {}, r = [], s = []) => {
1653
+ const o = [], i = n.resolveLabel ?? ((c, f) => p(c, f)), a = n.decorateAttribute ?? ((c, f) => f), d = n.resolveRowResource ?? rt, u = n.resolveRowActionResource ?? or, w = n.onAfterMutation ?? (() => {
1654
+ }), l = (c, f, h) => X(e, c, f, h).then((C) => (w(c), C));
1520
1655
  for (const c of t) {
1521
- const p = Tr(c, c.attributes, i, a), h = /* @__PURE__ */ new WeakMap();
1522
- let k;
1523
- const $ = (b) => d(c, b), Q = (b) => h.get(b) ?? b;
1524
- s.push(...Br(e, c, i)), s.push(e.workbench.renderers.registerKanbanRenderer({
1656
+ const f = br(e, c), h = er(c, c.attributes, i, a, f);
1657
+ let C = c.attributes;
1658
+ const j = /* @__PURE__ */ new WeakMap();
1659
+ let _;
1660
+ const q = (b) => d(c, b), W = (b) => j.get(b) ?? b;
1661
+ o.push(...ur(e, c, i)), o.push(e.workbench.renderers.registerKanbanRenderer({
1525
1662
  id: c.id,
1526
1663
  title: i(c.title, c.id),
1527
1664
  resourceKind: c.resourceKind,
1528
1665
  storageScope: e.projectId,
1529
- attributes: p.source,
1666
+ attributes: h.source,
1530
1667
  defaultSettings: c.defaultSettings,
1531
1668
  defaultFilters: c.defaultFilters,
1532
1669
  defaultViews: c.defaultViews?.map((b) => ({
@@ -1537,106 +1674,118 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1537
1674
  emptyTitle: i(c.emptyTitle, ""),
1538
1675
  emptyDescription: i(c.emptyDescription, ""),
1539
1676
  hideToolbar: c.hideToolbar,
1540
- createRow: _r(c, i),
1541
- getBoardColumnConfig: (b) => Vr(k?.[b], i),
1542
- onRowActivate: qr(e, c, r, d, Q),
1677
+ createRow: wr(c, i),
1678
+ getBoardColumnConfig: (b) => fr(_?.[b] ?? gr(e, c, C, b), i),
1679
+ onRowActivate: Ir(e, c, n, d, W),
1543
1680
  executeQuery: async (b) => {
1544
- const I = await L(e, c, c.queryHandlerId, {
1681
+ const y = await X(e, c, c.queryHandlerId, {
1545
1682
  settings: b.settings,
1546
1683
  filters: b.filters
1547
1684
  });
1548
- return Array.isArray(I) ? I.map((R) => {
1549
- const E = Ce(R, $);
1550
- return h.set(E, R), E;
1551
- }) : xr(I) ? (p.set(I.attributes), k = I.boardColumnConfigs, (I.rows ?? []).map((R) => {
1552
- const E = Ce(R, $);
1553
- return h.set(E, R), E;
1554
- })) : [];
1685
+ if (Array.isArray(y))
1686
+ return y.map((x) => {
1687
+ const A = $e(x, q);
1688
+ return j.set(A, x), A;
1689
+ });
1690
+ if (!Zn(y)) return [];
1691
+ const E = y.attributes ?? C;
1692
+ if (y.boardColumnConfigs && E?.some((x) => x.type.kind === "status"))
1693
+ throw new Error(`Status-backed Kanban renderer "${c.id}" cannot return boardColumnConfigs`);
1694
+ return C = E, h.set(E), _ = y.boardColumnConfigs, (y.rows ?? []).map((x) => {
1695
+ const A = $e(x, q);
1696
+ return j.set(A, x), A;
1697
+ });
1555
1698
  },
1556
- onAttributeChange: c.attributeChangeHandlerId ? (b, I, R) => l(c, c.attributeChangeHandlerId, {
1699
+ onAttributeChange: c.attributeChangeHandlerId ? (b, y, E) => l(c, c.attributeChangeHandlerId, {
1557
1700
  rowId: b,
1558
- attributeId: I,
1559
- value: R
1701
+ attributeId: y,
1702
+ value: E
1560
1703
  }).then(() => {
1561
1704
  }) : void 0,
1562
- onReorder: c.reorderHandlerId ? (b, I) => l(c, c.reorderHandlerId, {
1705
+ onReorder: c.reorderHandlerId ? (b, y) => l(c, c.reorderHandlerId, {
1563
1706
  rowId: b,
1564
- beforeRowId: I
1707
+ beforeRowId: y
1565
1708
  }).then(() => {
1566
1709
  }) : void 0,
1567
- onCreateRow: zr(c, r, l),
1568
- onColumnAction: c.columnActionHandlerId ? async (b, I) => {
1710
+ onCreateRow: yr(c, n, l),
1711
+ onColumnAction: c.columnActionHandlerId ? async (b, y) => {
1569
1712
  await l(c, c.columnActionHandlerId, {
1570
1713
  columnId: b,
1571
- actionId: I
1714
+ actionId: y
1572
1715
  });
1573
1716
  } : void 0,
1574
- getRowContextMenuActions: Qr(e, c, r, i, m)
1717
+ getRowContextMenuActions: vr(e, c, n, i, u)
1575
1718
  }));
1576
1719
  }
1577
- const u = K(n);
1578
- return n.forEach((c, p) => {
1579
- const h = z(c, "kanban");
1580
- h && s.push(D({
1720
+ const m = L(r);
1721
+ return r.forEach((c, f) => {
1722
+ const h = ee(c, "kanban");
1723
+ h && o.push(U({
1581
1724
  workbench: e.workbench,
1582
- contribution: O({
1725
+ path: c.path,
1726
+ aliases: c.aliases,
1727
+ resolveInput: F(n.resolveViewInput, c),
1728
+ contribution: N({
1583
1729
  panel: c,
1584
1730
  rendererId: h,
1585
- declarationIndex: p,
1586
- menuDeclarationOffset: u[p],
1587
- resourcePanels: o
1731
+ declarationIndex: f,
1732
+ menuDeclarationOffset: m[f],
1733
+ resourcePanels: s
1588
1734
  })
1589
1735
  }));
1590
1736
  }), {
1591
1737
  dispose() {
1592
- for (let c = s.length - 1; c >= 0; c -= 1) s[c]?.dispose();
1738
+ for (let c = o.length - 1; c >= 0; c -= 1) o[c]?.dispose();
1593
1739
  }
1594
1740
  };
1595
- }, Yr = (e, t) => {
1741
+ }, Rr = (e, t) => {
1596
1742
  if (e)
1597
- return Object.fromEntries(Object.entries(e).map(([r, n]) => [r, {
1598
- ...n,
1599
- label: n.label === void 0 ? void 0 : t(n.label, r),
1600
- description: n.description === void 0 ? void 0 : t(n.description)
1743
+ return Object.fromEntries(Object.entries(e).map(([n, r]) => [n, {
1744
+ ...r,
1745
+ label: r.label === void 0 ? void 0 : t(r.label, n),
1746
+ description: r.description === void 0 ? void 0 : t(r.description)
1601
1747
  }]));
1602
- }, Xr = (e, t) => e.panels.flatMap((r) => [r, ...r.panelMenus ?? []]).filter((r) => r.renderer?.kind === "tree" && r.renderer.id === t.id), ze = (e, t) => t.viewId ? e.find((r) => r.id === t.viewId) : e.length === 1 ? e[0] : void 0, Jr = async (e) => {
1748
+ }, Cr = (e, t) => e.panels.flatMap((n) => [n, ...n.panelMenus ?? []]).filter((n) => n.renderer?.kind === "tree" && n.renderer.id === t.id), at = (e, t) => t.viewId ? e.find((n) => n.id === t.viewId) : e.length === 1 ? e[0] : void 0, xr = async (e) => {
1603
1749
  const {
1604
1750
  ctx: t,
1605
- getHostTreeHeaderNodes: r,
1606
- record: n,
1607
- treeViews: o
1608
- } = e, s = ze(o, t);
1609
- return !s || !("hostTreeHeader" in s) || s.hostTreeHeader !== "default" ? [] : await r?.({
1751
+ getHostTreeHeaderNodes: n,
1752
+ record: r,
1753
+ treeViews: s
1754
+ } = e, o = at(s, t);
1755
+ return !o || !("hostTreeHeader" in o) || o.hostTreeHeader !== "default" ? [] : await n?.({
1610
1756
  ctx: t,
1611
- record: n,
1612
- panel: s
1757
+ record: r,
1758
+ panel: o
1613
1759
  }) ?? [];
1614
- }, Zr = async (e) => {
1760
+ }, Er = async (e) => {
1615
1761
  const {
1616
1762
  ctx: t,
1617
- getHostTreeFooterNodes: r,
1618
- record: n,
1619
- treeViews: o
1620
- } = e, s = ze(o, t);
1621
- return !s || !("hostTreeFooter" in s) || s.hostTreeFooter !== "default" ? [] : await r?.({
1763
+ getHostTreeFooterNodes: n,
1764
+ record: r,
1765
+ treeViews: s
1766
+ } = e, o = at(s, t);
1767
+ return !o || !("hostTreeFooter" in o) || o.hostTreeFooter !== "default" ? [] : await n?.({
1622
1768
  ctx: t,
1623
- record: n,
1624
- panel: s
1769
+ record: r,
1770
+ panel: o
1625
1771
  }) ?? [];
1626
- }, en = (e, t, r, n) => {
1627
- const o = z(t, "tree");
1628
- if (o)
1629
- return D({
1772
+ }, Pr = (e, t, n, r) => {
1773
+ const s = ee(t, "tree");
1774
+ if (s)
1775
+ return U({
1630
1776
  workbench: e.workbench,
1631
- contribution: O({
1777
+ path: t.path,
1778
+ aliases: t.aliases,
1779
+ resolveInput: F(e.resolveViewInput, t),
1780
+ contribution: N({
1632
1781
  panel: t,
1633
- rendererId: o,
1634
- declarationIndex: r,
1635
- menuDeclarationOffset: n,
1782
+ rendererId: s,
1783
+ declarationIndex: n,
1784
+ menuDeclarationOffset: r,
1636
1785
  resourcePanels: e.resourcePanels
1637
1786
  })
1638
1787
  });
1639
- }, ie = (e) => {
1788
+ }, ge = (e) => {
1640
1789
  if (e)
1641
1790
  return {
1642
1791
  type: e.kind,
@@ -1644,16 +1793,16 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1644
1793
  label: e.label,
1645
1794
  metadata: e.metadata
1646
1795
  };
1647
- }, tn = (e) => typeof e == "string" ? e : e?.id, rn = (e, t) => ({
1796
+ }, Ar = (e, t) => ({
1648
1797
  kind: e.type,
1649
1798
  uri: `pstdio://extension-resource/${encodeURIComponent(e.type)}/${encodeURIComponent(e.id)}`,
1650
1799
  id: e.id,
1651
1800
  label: e.label,
1652
1801
  metadata: t ? {
1653
1802
  ...e.metadata,
1654
- [ae]: t
1803
+ [we]: t
1655
1804
  } : e.metadata
1656
- }), Qe = (e) => ({
1805
+ }), dt = (e) => ({
1657
1806
  id: e.treeId,
1658
1807
  kind: "renderer",
1659
1808
  context: {
@@ -1667,68 +1816,68 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1667
1816
  resourceId: e.resource.id
1668
1817
  } : {}
1669
1818
  }
1670
- }), oe = (e, t, r, n) => {
1671
- const o = ie(r.resource), s = e.workbench.modes.getActiveModeId();
1819
+ }), fe = (e, t, n, r) => {
1820
+ const s = ge(n.resource), o = e.workbench.modes.getActiveModeId();
1672
1821
  return {
1673
1822
  renderer: {
1674
1823
  rendererId: t.id,
1675
1824
  projectId: e.projectId,
1676
- ...s ? {
1677
- modeId: s
1678
- } : {},
1679
1825
  ...o ? {
1680
- resource: o
1826
+ modeId: o
1827
+ } : {},
1828
+ ...s ? {
1829
+ resource: s
1681
1830
  } : {},
1682
1831
  invocation: {
1683
1832
  placement: "visible"
1684
1833
  }
1685
1834
  },
1686
1835
  state: e.workbench.renderers.getTreeState(t.id),
1687
- ...r.filter ? {
1688
- filter: r.filter
1836
+ ...n.filter ? {
1837
+ filter: n.filter
1689
1838
  } : {},
1690
- ...n ? {
1691
- node: n
1839
+ ...r ? {
1840
+ node: r
1692
1841
  } : {}
1693
1842
  };
1694
- }, se = async (e, t, r, n) => {
1695
- const o = n.renderer, s = o?.resource, i = await e.executeCommand(r, {
1843
+ }, be = async (e, t, n, r) => {
1844
+ const s = r.renderer, o = s?.resource, i = await e.executeCommand(n, {
1696
1845
  projectId: e.projectId,
1697
- params: n,
1698
- resource: s,
1699
- slot: Qe({
1700
- modeId: o?.modeId,
1846
+ params: r,
1847
+ resource: o,
1848
+ slot: dt({
1849
+ modeId: s?.modeId,
1701
1850
  projectId: e.projectId,
1702
- resource: s,
1851
+ resource: o,
1703
1852
  treeId: t.id
1704
1853
  }),
1705
1854
  source: "dashboard"
1706
1855
  });
1707
- return X(i);
1708
- }, Ge = async (e, t, r, n, o) => {
1709
- const s = e.workbench.modes.getActiveModeId(), i = {
1710
- ...n ?? {},
1856
+ return ie(i);
1857
+ }, ct = async (e, t, n, r, s) => {
1858
+ const o = e.workbench.modes.getActiveModeId(), i = {
1859
+ ...r ?? {},
1711
1860
  renderer: {
1712
1861
  rendererId: t.id,
1713
1862
  projectId: e.projectId,
1714
- ...s ? {
1715
- modeId: s
1716
- } : {},
1717
1863
  ...o ? {
1718
- resource: o
1864
+ modeId: o
1865
+ } : {},
1866
+ ...s ? {
1867
+ resource: s
1719
1868
  } : {},
1720
1869
  invocation: {
1721
1870
  placement: "visible"
1722
1871
  }
1723
1872
  }
1724
- }, a = await e.executeCommand(r, {
1873
+ }, a = await e.executeCommand(n, {
1725
1874
  projectId: e.projectId,
1726
1875
  params: i,
1727
- resource: o,
1728
- slot: Qe({
1729
- modeId: s,
1876
+ resource: s,
1877
+ slot: dt({
1878
+ modeId: o,
1730
1879
  projectId: e.projectId,
1731
- resource: o,
1880
+ resource: s,
1732
1881
  treeId: t.id
1733
1882
  }),
1734
1883
  source: "dashboard",
@@ -1736,754 +1885,979 @@ const Mt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1736
1885
  treeId: t.id
1737
1886
  }
1738
1887
  });
1739
- return X(a);
1740
- }, nn = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, Ee = (e) => e && !Array.isArray(e) ? e : void 0, on = (e, t) => {
1741
- const r = /* @__PURE__ */ new WeakMap(), n = `workbench.extensionTreeRenderer.${t.id}.command`, o = (l, u) => {
1888
+ return ie(a);
1889
+ }, Sr = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, Ve = (e) => e && !Array.isArray(e) ? e : void 0, Tr = (e, t) => {
1890
+ const n = /* @__PURE__ */ new WeakMap(), r = `workbench.extensionTreeRenderer.${t.id}.command`, s = (l, m) => {
1742
1891
  const c = e.resolveNodeResource?.(l);
1743
- return c ? u ? {
1892
+ return c ? m ? {
1744
1893
  ...c,
1745
1894
  metadata: {
1746
1895
  ...c.metadata,
1747
- [ae]: u
1896
+ [we]: m
1748
1897
  }
1749
- } : c : rn(l, u);
1750
- }, s = (l) => {
1898
+ } : c : Ar(l, m);
1899
+ }, o = (l) => {
1751
1900
  if (l.emptyState)
1752
1901
  return {
1753
- title: f(l.emptyState.title),
1754
- description: f(l.emptyState.description),
1902
+ title: p(l.emptyState.title),
1903
+ description: p(l.emptyState.description),
1755
1904
  icon: l.emptyState.icon
1756
1905
  };
1757
- }, i = (l, u, c) => l ? J(l, {
1906
+ }, i = (l, m, c) => l ? Z(l, {
1758
1907
  commandTargetOf: (h) => ({
1759
1908
  kind: "command",
1760
- commandId: n,
1909
+ commandId: r,
1761
1910
  args: {
1762
- commandId: typeof h.command == "string" ? h.command : h.command.id,
1763
- nodeId: u.id,
1764
- params: h.params,
1765
- resource: u.resource ?? ie(c.resource),
1911
+ commandId: `${h.target.command.extensionId ?? t.extensionId}.command.${h.target.command.id}`,
1912
+ nodeId: m.id,
1913
+ params: h.target.params,
1914
+ resource: m.resource ?? ge(c.resource),
1766
1915
  treeId: t.id
1767
1916
  }
1768
1917
  }),
1769
- resourceOf: (h, k) => o(h, k.section ? {
1918
+ extensionId: t.extensionId,
1919
+ resourceOf: (h, C) => s(h, C.section ? {
1770
1920
  treeId: t.id,
1771
- targetNodeId: u.id,
1772
- anchors: k.section.anchors
1921
+ targetNodeId: m.id,
1922
+ anchors: C.section.anchors
1773
1923
  } : void 0)
1774
- }) : void 0, a = (l, u, c) => {
1775
- const p = tn(l.command);
1924
+ }) : void 0, a = (l, m, c) => {
1925
+ const f = l.command ? `${l.command.extensionId ?? t.extensionId}.command.${l.command.id}` : void 0;
1776
1926
  return {
1777
1927
  id: l.id,
1778
- label: f(l.label),
1928
+ label: p(l.label),
1779
1929
  icon: l.icon,
1780
- args: Ee(l.params),
1781
- params: Yr(l.input, f),
1930
+ args: Ve(l.params),
1931
+ params: Rr(l.input, p),
1782
1932
  submitLabel: l.submitLabel,
1783
1933
  when: l.when,
1784
1934
  disabled: l.disabled,
1785
1935
  // Actions mutate tree data (create/delete/...), so refresh afterwards. Plain
1786
1936
  // node-target navigation runs through the runner command and must not refetch.
1787
- run: p ? async (h) => {
1788
- await Ge(e, t, p, nn(h, Ee(l.params)), u?.resource ?? ie(c.resource)), e.workbench.renderers.refresh(t.id);
1937
+ run: f ? async (h) => {
1938
+ await ct(e, t, f, Sr(h, Ve(l.params)), m?.resource ?? ge(c.resource)), e.workbench.renderers.refresh(t.id);
1789
1939
  } : void 0
1790
1940
  };
1791
- }, d = (l, u) => {
1941
+ }, d = (l, m) => {
1792
1942
  const c = {
1793
1943
  id: l.id,
1794
- label: f(l.label),
1944
+ label: p(l.label),
1795
1945
  icon: l.icon,
1796
1946
  iconColor: l.iconColor,
1797
1947
  iconTooltip: l.iconTooltip,
1798
- resource: l.resource ? o(l.resource) : void 0,
1799
- target: i(l.target, l, u),
1948
+ resource: l.resource ? s(l.resource) : void 0,
1949
+ target: i(l.target, l, m),
1800
1950
  rowVariant: l.rowVariant,
1801
- actions: l.actions?.map((p) => a(p, l, u)),
1802
- contextMenuActions: l.contextMenuActions?.map((p) => a(p, l, u)),
1951
+ actions: l.actions?.map((f) => a(f, l, m)),
1952
+ contextMenuActions: l.contextMenuActions?.map((f) => a(f, l, m)),
1803
1953
  collapsible: l.collapsible,
1804
1954
  disabled: l.disabled,
1805
- children: l.children?.map((p) => d(p, u)),
1955
+ children: l.children?.map((f) => d(f, m)),
1806
1956
  description: l.description,
1807
1957
  contextValue: l.contextValue,
1808
1958
  hiddenByDefault: l.hiddenByDefault,
1809
1959
  canHide: l.canHide
1810
1960
  };
1811
- return r.set(c, l), c;
1961
+ return n.set(c, l), c;
1812
1962
  };
1813
1963
  return {
1814
- mapNodes: (l, u) => l.map((c) => d(c, u)),
1815
- mapSections: (l, u) => l.map((c) => ({
1964
+ mapNodes: (l, m) => l.map((c) => d(c, m)),
1965
+ mapSections: (l, m) => l.map((c) => ({
1816
1966
  id: c.id,
1817
- label: f(c.label),
1818
- actions: c.actions?.map((p) => a(p, void 0, u)),
1967
+ label: p(c.label),
1968
+ actions: c.actions?.map((f) => a(f, void 0, m)),
1819
1969
  collapsible: c.collapsible,
1820
- emptyState: s(c),
1821
- nodes: c.nodes.map((p) => d(p, u)),
1970
+ emptyState: o(c),
1971
+ nodes: c.nodes.map((f) => d(f, m)),
1822
1972
  hiddenByDefault: c.hiddenByDefault,
1823
1973
  canHide: c.canHide
1824
1974
  })),
1825
- originalNodes: r,
1826
- runnerCommandId: n
1975
+ originalNodes: n,
1976
+ runnerCommandId: r
1827
1977
  };
1828
- }, sn = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "nodes" in t), Pe = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "id" in t), Ye = (e) => {
1978
+ }, jr = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "nodes" in t), De = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "id" in t), lt = (e) => {
1829
1979
  for (const t of e) {
1830
1980
  if (t.selected) return t.id;
1831
- const r = Ye(t.children ?? []);
1832
- if (r) return r;
1981
+ const n = lt(t.children ?? []);
1982
+ if (n) return n;
1833
1983
  }
1834
- }, an = (e) => {
1984
+ }, Wr = (e) => {
1835
1985
  for (const t of e) {
1836
- const r = Ye(t.nodes);
1837
- if (r) return r;
1986
+ const n = lt(t.nodes);
1987
+ if (n) return n;
1838
1988
  }
1839
- }, dn = (e, t) => {
1840
- const r = on(e, t), n = Xr(e.metadata, t), o = e.workbench.commands.registerCommand({
1841
- id: r.runnerCommandId,
1842
- label: `${f(t.title, t.id)} tree command`
1989
+ }, Mr = (e, t) => {
1990
+ const n = Tr(e, t), r = Cr(e.metadata, t), s = e.workbench.commands.registerCommand({
1991
+ id: n.runnerCommandId,
1992
+ label: `${p(t.title, t.id)} tree command`
1843
1993
  }, {
1844
1994
  execute: async (i) => {
1845
1995
  const a = i;
1846
1996
  a.nodeId && e.workbench.renderers.setSelectedNode(t.id, a.nodeId);
1847
- const d = await Ge(e, t, a.commandId, a.params, a.resource);
1848
- for (const m of e.workbench.renderers.listFileRenderers())
1849
- e.workbench.renderers.refreshFileRenderer(m.id);
1997
+ const d = await ct(e, t, a.commandId, a.params, a.resource);
1998
+ for (const u of e.workbench.renderers.listFileRenderers())
1999
+ e.workbench.renderers.refreshFileRenderer(u.id);
1850
2000
  return d;
1851
2001
  }
1852
- }), s = e.workbench.renderers.registerTreeRenderer({
2002
+ }), o = e.workbench.renderers.registerTreeRenderer({
1853
2003
  id: t.id,
1854
- title: f(t.title, t.id),
2004
+ title: p(t.title, t.id),
1855
2005
  icon: t.icon,
1856
2006
  searchable: t.searchable,
1857
- searchPlaceholder: f(t.searchPlaceholder, "Search files"),
2007
+ searchPlaceholder: p(t.searchPlaceholder, "Search files"),
1858
2008
  defaultExpandedNodeIds: t.defaultExpandedNodeIds,
1859
2009
  defaultExpandedSectionIds: t.defaultExpandedSectionIds,
1860
- getHeader: (i) => Jr({
2010
+ getHeader: (i) => xr({
1861
2011
  ctx: i,
1862
2012
  getHostTreeHeaderNodes: e.getHostTreeHeaderNodes,
1863
2013
  record: t,
1864
- treeViews: n
2014
+ treeViews: r
1865
2015
  }),
1866
2016
  getBody: async (i) => {
1867
- const a = await se(e, t, t.bodyHandlerId, oe(e, t, i));
1868
- if (!sn(a)) return [];
1869
- const d = an(a);
1870
- return d && e.workbench.renderers.setSelectedNode(t.id, d), r.mapSections(a, i);
2017
+ const a = await be(e, t, t.bodyHandlerId, fe(e, t, i));
2018
+ if (!jr(a)) return [];
2019
+ const d = Wr(a);
2020
+ return d && e.workbench.renderers.setSelectedNode(t.id, d), n.mapSections(a, i);
1871
2021
  },
1872
2022
  getFooter: async (i) => {
1873
- const a = await Zr({
2023
+ const a = await Er({
1874
2024
  ctx: i,
1875
2025
  getHostTreeFooterNodes: e.getHostTreeFooterNodes,
1876
2026
  record: t,
1877
- treeViews: n
2027
+ treeViews: r
1878
2028
  });
1879
2029
  if (!t.footerHandlerId) return a;
1880
- const d = await se(e, t, t.footerHandlerId, oe(e, t, i));
1881
- return [...Pe(d) ? r.mapNodes(d, i) : [], ...a];
2030
+ const d = await be(e, t, t.footerHandlerId, fe(e, t, i));
2031
+ return [...De(d) ? n.mapNodes(d, i) : [], ...a];
1882
2032
  },
1883
2033
  getChildren: async (i, a) => {
1884
2034
  if (!t.childrenHandlerId) return i.children ?? [];
1885
- const d = r.originalNodes.get(i) ?? i, m = await se(e, t, t.childrenHandlerId, oe(e, t, a, d));
1886
- return Pe(m) ? r.mapNodes(m, a) : [];
2035
+ const d = n.originalNodes.get(i) ?? i, u = await be(e, t, t.childrenHandlerId, fe(e, t, a, d));
2036
+ return De(u) ? n.mapNodes(u, a) : [];
1887
2037
  }
1888
2038
  });
1889
2039
  return {
1890
2040
  dispose() {
1891
- s.dispose(), o.dispose();
2041
+ o.dispose(), s.dispose();
1892
2042
  }
1893
2043
  };
1894
- }, cn = (e) => {
2044
+ }, Or = (e) => {
1895
2045
  const t = [];
1896
- for (const n of e.metadata.treeRenderers ?? [])
1897
- t.push(dn(e, n));
1898
- const r = K(e.metadata.panels);
1899
- return e.metadata.panels.forEach((n, o) => {
1900
- const s = en({
2046
+ for (const r of e.metadata.treeRenderers ?? [])
2047
+ t.push(Mr(e, r));
2048
+ const n = L(e.metadata.panels);
2049
+ return e.metadata.panels.forEach((r, s) => {
2050
+ const o = Pr({
1901
2051
  workbench: e.workbench,
1902
- resourcePanels: e.metadata.resourcePanels
1903
- }, n, o, r[o]);
1904
- s && t.push(s);
2052
+ resourcePanels: e.metadata.resourcePanels,
2053
+ resolveViewInput: e.resolveViewInput
2054
+ }, r, s, n[s]);
2055
+ o && t.push(o);
1905
2056
  }), {
1906
2057
  dispose() {
1907
- for (let n = t.length - 1; n >= 0; n -= 1) t[n]?.dispose();
2058
+ for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1908
2059
  }
1909
2060
  };
1910
- }, ln = (e) => (t) => ({
1911
- ...Oe({
1912
- workbench: t.workbench,
1913
- hostEvents: t.hostEvents
1914
- }),
1915
- // Extension guests speak the SDK resource shape (`type`); normalize to the
1916
- // workbench shape (`kind` + synthesized uri) the resource registry expects,
1917
- // mirroring how commands.execute and tree targets normalize their resources.
1918
- "resource.open": (n) => {
1919
- const o = n;
1920
- if (!o.resource) throw new Error("resource.open requires a resource.");
1921
- return t.workbench.resources.openResource(_(o.resource), Me(o.input));
1922
- },
1923
- "commands.execute": async (n) => {
1924
- const o = n, s = o.resource ?? H(t.placement.resource);
1925
- return e.executeCommand(o.commandId, {
1926
- projectId: e.projectId,
1927
- ...o.params ? {
1928
- params: o.params
1929
- } : {},
1930
- ...s ? {
1931
- resource: s
1932
- } : {},
1933
- slot: M({
1934
- id: t.webviewId,
1935
- kind: e.slotKind,
1936
- projectId: e.projectId,
1937
- context: {
1938
- panelId: t.webviewId
1939
- }
1940
- }),
1941
- source: "dashboard"
1942
- });
1943
- },
1944
- ...e.files ? {
1945
- "files.upload": e.files.upload,
1946
- "files.list": e.files.list,
1947
- "files.delete": e.files.delete
1948
- } : {}
1949
- }), Xe = (e, t) => ({
1950
- kind: t,
1951
- uri: `workbench://extension-route/${encodeURIComponent(e.id)}`,
2061
+ }, Hr = (e) => e.includes("main.right") ? "secondary" : (e.includes("main.left"), "sidenav"), Kr = (e, t) => (e.order ?? 0) - (t.order ?? 0) || e.id.localeCompare(t.id), $r = (e) => ({
1952
2062
  id: e.id,
1953
- label: f(e.label, e.id),
1954
- metadata: {
1955
- extensionId: e.extensionId,
1956
- extensionRouteId: e.id,
1957
- path: e.path
1958
- }
1959
- }), Ae = (e, t) => e.routes.find((r) => t.id === r.id || t.metadata?.extensionRouteId === r.id), mn = (e) => {
1960
- if (e.metadata.routes.length === 0) return [];
1961
- const t = [];
1962
- e.workbench.resources.getKind(e.routeResourceKind) || t.push(e.workbench.resources.registerKind({
1963
- kind: e.routeResourceKind,
1964
- label: "Extension route",
1965
- icon: "Component"
1966
- }));
1967
- for (const r of e.metadata.routes)
1968
- t.push(e.workbench.layout.registerPanel({
1969
- id: r.id,
1970
- title: f(r.label, r.id),
1971
- region: "main",
1972
- rendererId: S,
1973
- singleton: !0,
1974
- config: q(r.webview)
1975
- }));
1976
- return t.push(e.workbench.resources.registerProvider({
1977
- id: "workbench.extension.routes",
1978
- kind: e.routeResourceKind,
1979
- list: () => e.metadata.routes.map((r) => ({
1980
- resource: Xe(r, e.routeResourceKind)
1981
- }))
1982
- }), e.workbench.resources.registerPresenter({
1983
- id: "workbench.extension.routes",
1984
- canOpen: (r) => r.kind === e.routeResourceKind && !!Ae(e.metadata, r),
1985
- open: (r, n) => {
1986
- const o = Ae(e.metadata, r);
1987
- return e.workbench.layout.openPanel(o.id, {
1988
- strategy: n.replaceActive ? {
1989
- kind: "replace-active"
1990
- } : {
1991
- kind: "persistent"
1992
- },
1993
- title: f(o.label, o.id)
1994
- });
1995
- }
1996
- })), t;
1997
- }, un = {
1998
- "workbench.left.tree": "sidenav",
1999
- "workbench.main.left.tree": "main-left-menu",
2000
- "workbench.main.right.tree": "main-right-menu"
2001
- }, fn = (e) => e ? un[e] ?? "sidenav" : "sidenav", pn = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, bn = (e, t) => {
2002
- if (t.action.kind === "panel") return {
2003
- kind: "panel",
2004
- panelId: t.action.panelId
2005
- };
2006
- const r = t.action;
2007
- if (r.kind === "route") {
2008
- const n = e.metadata.routes.find((o) => o.id === r.route);
2009
- return n ? {
2010
- kind: "resource",
2011
- resource: Xe(n, e.routeResourceKind)
2012
- } : void 0;
2063
+ label: p(e.label, e.id),
2064
+ icon: e.icon,
2065
+ target: Z(e.action, {
2066
+ extensionId: e.extensionId
2067
+ })
2068
+ }), Vr = (e) => {
2069
+ const t = /* @__PURE__ */ new Map();
2070
+ for (const n of e) {
2071
+ const r = n.group ?? "Extensions";
2072
+ t.set(r, [...t.get(r) ?? [], n]);
2013
2073
  }
2014
- return r.kind === "command" ? {
2015
- kind: "command",
2016
- commandId: r.commandId,
2017
- args: r.args
2018
- } : r.kind === "resource" ? {
2019
- kind: "resource",
2020
- resource: {
2021
- kind: r.resource.type,
2022
- uri: `pstdio://extension-resource/${encodeURIComponent(r.resource.type)}/${encodeURIComponent(r.resource.id)}`,
2023
- id: r.resource.id,
2024
- label: r.resource.label ?? f(t.label, t.id),
2025
- icon: t.icon,
2026
- metadata: r.resource.metadata
2027
- }
2028
- } : {
2029
- kind: "command",
2030
- commandId: `workbench.extension.href.${t.id}`,
2031
- args: {
2032
- href: r.href
2033
- }
2034
- };
2035
- }, hn = (e) => {
2036
- const t = e.metadata.treeItems ?? [];
2037
- if (t.length === 0) return [];
2038
- const r = [], n = /* @__PURE__ */ new Map();
2039
- for (const o of t) n.set(o.target, [...n.get(o.target) ?? [], o]);
2040
- for (const [o, s] of n) {
2041
- const i = `workbench.extension.treeItems.${o}`;
2042
- r.push(e.workbench.renderers.registerTreeRenderer({
2043
- id: i,
2074
+ return t;
2075
+ }, Dr = (e) => {
2076
+ if (e.metadata.navigationItems.length === 0) return [];
2077
+ const t = [], n = /* @__PURE__ */ new Map();
2078
+ for (const r of e.metadata.navigationItems)
2079
+ n.set(r.slot.id, [...n.get(r.slot.id) ?? [], r]);
2080
+ for (const [r, s] of n) {
2081
+ const o = `workbench.extension.navigation.${r}`, i = Vr([...s].sort(Kr));
2082
+ t.push(e.workbench.renderers.registerTreeRenderer({
2083
+ id: o,
2044
2084
  title: "Extensions",
2045
2085
  getChildren: (a) => a.children ?? [],
2046
- getBody: () => [{
2047
- id: "extensions",
2048
- label: "Extensions",
2049
- nodes: s.map((a) => ({
2050
- id: a.id,
2051
- label: f(a.label, a.id),
2052
- icon: a.icon,
2053
- target: bn(e, a)
2054
- }))
2055
- }]
2086
+ getBody: () => [...i].map(([a, d]) => ({
2087
+ id: a,
2088
+ label: a,
2089
+ nodes: d.map($r)
2090
+ }))
2056
2091
  }), e.workbench.layout.registerPanel({
2057
- id: i,
2092
+ id: o,
2058
2093
  title: "Extensions",
2059
- region: fn(o),
2060
- rendererId: i,
2094
+ region: Hr(r),
2095
+ rendererId: o,
2061
2096
  singleton: !0
2062
2097
  }));
2063
2098
  }
2064
- for (const o of t.filter((s) => s.action.kind === "href")) {
2065
- const s = o.action;
2066
- s.kind === "href" && r.push(e.workbench.commands.registerCommand({
2067
- id: `workbench.extension.href.${o.id}`,
2068
- label: f(o.label, o.id)
2069
- }, {
2070
- execute: (i) => e.openHref?.(pn(i)?.href ?? s.href)
2071
- }));
2072
- }
2073
- return r;
2074
- }, xe = "extension-route", gn = "extensions", wn = (e) => {
2075
- for (let t = e.length - 1; t >= 0; t -= 1) e[t]?.dispose();
2076
- }, le = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, In = (e) => e === void 0 ? void 0 : e, yn = (e) => e === "global" ? "user" : "project", vn = (e, t) => t ? (r) => ({
2077
- ...e(r),
2078
- ...t(r)
2079
- }) : e, Je = (e, t) => {
2080
- const r = e.createWebviewHostCapabilities ?? ln({
2081
- executeCommand: e.executeCommand,
2082
- files: e.webviewFiles,
2083
- projectId: e.projectId,
2084
- slotKind: t
2085
- });
2086
- return vn(r, e.createWebviewHostCapabilityOverrides);
2087
- }, kn = (e, t) => {
2088
- e.workbench.renderers.getRenderer(S) || t.push(e.workbench.renderers.registerRenderer(Ht({
2089
- createHostCapabilities: Je(e, "panel"),
2090
- createProps: e.createWebviewProps,
2091
- createTheme: e.createWebviewTheme
2092
- })));
2093
- }, Rn = (e, t) => t.commands.map((r) => e.workbench.commands.registerCommand({
2094
- id: r.id,
2095
- label: f(r.title, r.id),
2096
- description: f(r.description),
2097
- params: r.params
2098
- }, {
2099
- execute: (n, o) => P(e, r.id, {
2100
- params: le(n),
2101
- resource: o?.resource
2102
- })
2103
- })), Ze = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), Cn = (e, t) => e.menuSlotsById ? vr({
2104
- metadata: e.metadata,
2105
- menuSlotsById: e.menuSlotsById,
2106
- menuTargetsById: e.menuTargetsById,
2107
- createWhenExpression: e.createMenuWhenExpression
2108
- }).flatMap((n) => [e.workbench.commands.registerCommand(n.command, {
2109
- execute: (o, s) => P(t, n.targetCommandId, {
2110
- params: {
2111
- ...n.contribution.params ?? {},
2112
- ...le(o) ?? {}
2113
- },
2114
- resource: Ze(e, s),
2115
- slot: M({
2116
- id: n.contribution.slotId,
2117
- kind: "menu",
2118
- projectId: e.projectId,
2119
- context: {
2120
- panelId: n.contribution.id
2121
- }
2122
- })
2123
- })
2124
- }), e.workbench.layout.registerMenuItem(n.menuPath, n.menuItem)]) : [], En = (e, t) => kr({
2125
- metadata: e.metadata
2126
- }).flatMap((n) => [e.workbench.commands.registerCommand(n.command, {
2127
- execute: (o, s) => P(t, n.targetCommandId, {
2128
- params: {
2129
- ...n.contribution.params ?? {},
2130
- ...le(o) ?? {}
2131
- },
2132
- resource: Ze(e, s),
2133
- slot: M({
2134
- id: "workbench.commandPalette",
2135
- kind: "menu",
2136
- projectId: e.projectId,
2137
- context: {
2138
- panelId: n.contribution.id
2139
- }
2140
- })
2141
- }),
2142
- isVisible: () => at(n.contribution.when, e.workbench.getPrimaryResource()?.kind)
2143
- }), e.workbench.layout.registerMenuItem(st, n.menuItem)]), Pn = (e) => {
2144
- const t = K(e.metadata.panels);
2145
- return e.metadata.panels.flatMap((r, n) => r.webview ? [D({
2146
- workbench: e.workbench,
2147
- contribution: O({
2148
- panel: r,
2149
- rendererId: S,
2150
- declarationIndex: n,
2151
- menuDeclarationOffset: t[n],
2152
- resourcePanels: e.metadata.resourcePanels,
2153
- config: q(r.webview)
2154
- })
2155
- })] : []);
2156
- }, An = (e) => {
2157
- const t = [];
2158
- for (const [r, n] of (e.metadata.statusItems ?? []).entries()) {
2159
- if (!n.webview) continue;
2160
- t.push(e.workbench.layout.registerWidget({
2161
- id: n.id,
2162
- title: f(n.title, n.id),
2163
- region: "status",
2164
- rendererId: S,
2165
- closable: !1,
2166
- priority: -r,
2167
- config: q(n.webview)
2168
- }));
2169
- const o = () => {
2170
- const i = n.when?.mode;
2171
- if (!i) return !0;
2172
- const a = e.workbench.modes.getActiveModeId() ?? "";
2173
- return Array.isArray(i) ? i.includes(a) : i === a;
2174
- }, s = () => {
2175
- const i = e.workbench.layout.getLayout().regions.status.widgets.find((a) => a.contributionId === n.id);
2176
- o() && !i ? e.workbench.layout.openWidget(n.id, {
2177
- region: "status"
2178
- }) : !o() && i && e.workbench.layout.removeWidgetPlacement(i.widgetId);
2179
- };
2180
- s(), t.push(e.workbench.modes.onDidChangeActive(s));
2181
- }
2182
2099
  return t;
2183
- }, xn = (e) => {
2184
- const t = [], r = e.settingsSectionId ?? gn;
2185
- e.workbench.settings.getSection(r) || t.push(e.workbench.settings.registerSection({
2186
- id: r,
2187
- title: e.settingsSectionTitle ?? "Extensions"
2188
- }));
2189
- const n = Object.fromEntries((e.metadata.settingsDefinitions ?? []).map((o) => [o.key, {
2190
- type: o.type,
2191
- scope: yn(o.scope),
2192
- default: In(o.default),
2193
- enum: o.enum,
2194
- description: f(o.description)
2195
- }]));
2196
- Object.keys(n).length > 0 && t.push(e.workbench.preferences.registerSchema({
2197
- properties: n
2198
- }));
2199
- for (const o of e.metadata.settingsPanels)
2200
- t.push(e.workbench.settings.registerPanel({
2201
- id: o.id,
2202
- title: f(o.title, o.id),
2203
- kind: "custom",
2204
- section: r,
2205
- scope: o.scope,
2206
- render: (s) => $e({
2207
- context: {
2208
- workbench: s.workbench,
2209
- webviewId: o.id,
2210
- placement: {
2211
- ...s.instance,
2212
- panelId: o.id
2213
- },
2214
- hostEvents: De(s.workbench, s.instance)
2215
- },
2216
- createHostCapabilities: Je(e, "settings"),
2217
- createProps: e.createWebviewProps ?? (({
2218
- placement: i
2219
- }) => ({
2220
- placement: i,
2221
- resource: i.resource
2222
- })),
2223
- createTheme: e.createWebviewTheme,
2224
- ownerId: o.extensionId,
2225
- title: f(o.title, o.id),
2226
- webview: q(o.webview)
2227
- })
2228
- }));
2229
- return t;
2230
- }, Tn = (e) => {
2100
+ }, Br = (e) => {
2231
2101
  const t = /* @__PURE__ */ new Map();
2232
- for (const r of e.resourceKinds ?? [])
2233
- t.set(r.id, {
2234
- surface: r.surface,
2235
- extensionId: r.extensionId,
2236
- label: r.label ? f(r.label, r.id) : void 0,
2237
- icon: r.icon
2102
+ for (const n of e.resourceKinds ?? [])
2103
+ t.set(n.id, {
2104
+ surface: n.surface,
2105
+ extensionId: n.extensionId,
2106
+ label: n.label ? p(n.label, n.id) : void 0,
2107
+ icon: n.icon
2238
2108
  });
2239
- for (const r of e.kanbanRenderers ?? [])
2240
- r.resourceKind && !t.has(r.resourceKind) && t.set(r.resourceKind, {
2109
+ for (const n of e.kanbanRenderers ?? [])
2110
+ n.resourceKind && !t.has(n.resourceKind) && t.set(n.resourceKind, {
2241
2111
  surface: "primary"
2242
2112
  });
2243
2113
  return t;
2244
- }, Wn = (e, t, r) => {
2245
- const o = (e.resourcePanels ?? []).filter((i) => i.resourceKind === t).flatMap((i) => {
2114
+ }, Fr = (e, t, n) => {
2115
+ const s = (e.resourcePanels ?? []).filter((i) => i.resourceKind === t).flatMap((i) => {
2246
2116
  const a = e.panels.find((d) => d.id === i.panel);
2247
2117
  return a ? [{
2248
2118
  edge: i,
2249
2119
  panel: a
2250
2120
  }] : [];
2251
- }), s = new Set(o.map(({
2121
+ }), o = new Set(s.map(({
2252
2122
  panel: i
2253
2123
  }) => i.id));
2254
2124
  for (const i of e.panels) {
2255
- if (s.has(i.id) || i.extensionId !== r) continue;
2256
- const d = (i.show ? Array.isArray(i.show) ? i.show : [i.show] : []).find((m) => m.for === t);
2257
- d && o.push({
2125
+ if (o.has(i.id) || i.extensionId !== n) continue;
2126
+ const d = (i.show ? Array.isArray(i.show) ? i.show : [i.show] : []).find((u) => u.for === t);
2127
+ d && s.push({
2258
2128
  panel: i,
2259
2129
  placement: d
2260
2130
  });
2261
2131
  }
2262
- return o;
2263
- }, jn = (e, t) => {
2264
- const r = e.workbench.layout.getLayout();
2265
- return ["sidenav", "main", "secondary", "side"].find((o) => r.regions[o].widgets.some((s) => s.contributionId === t));
2266
- }, Sn = (e, t, r) => {
2267
- const n = t.map(({
2268
- panel: s
2269
- }) => e.workbench.layout.openPanel(s.id, {
2270
- region: jn(e, s.id),
2271
- resource: r,
2272
- title: r.label ?? r.id ?? r.uri,
2132
+ return s;
2133
+ }, Be = (e, t) => {
2134
+ const n = e.workbench.layout.getLayout();
2135
+ return ["sidenav", "main", "secondary", "side"].find((s) => n.regions[s].widgets.some((o) => o.contributionId === t));
2136
+ }, Nr = (e, t, n) => {
2137
+ e.prepareResource?.(n);
2138
+ const r = t.map(({
2139
+ panel: o
2140
+ }) => e.workbench.layout.openPanel(o.id, {
2141
+ region: Be(e, o.id),
2142
+ resource: n,
2143
+ title: n.label ?? n.id ?? n.uri,
2273
2144
  strategy: {
2274
2145
  kind: "persistent"
2275
2146
  }
2276
- })), o = t.findIndex((s) => s.edge?.slot === "primary" || s.placement?.region === "main");
2277
- return n[o >= 0 ? o : 0];
2278
- }, Hn = (e, t, r) => {
2279
- const n = [];
2280
- e.workbench.resources.getKind(t) || n.push(e.workbench.resources.registerKind({
2147
+ }));
2148
+ e.workbench.sidePanel.getMode() === "closed" && t.some(({
2149
+ panel: o
2150
+ }) => Be(e, o.id) === "side") && e.workbench.sidePanel.setMode("attached");
2151
+ const s = t.findIndex((o) => o.edge?.slot === "primary" || o.placement?.region === "main");
2152
+ return r[s >= 0 ? s : 0];
2153
+ }, Lr = (e, t, n) => {
2154
+ const r = [];
2155
+ e.workbench.resources.getKind(t) || r.push(e.workbench.resources.registerKind({
2281
2156
  kind: t,
2282
- label: r.label ?? t,
2283
- icon: r.icon ?? "FileText",
2284
- surface: r.surface
2157
+ label: n.label ?? t,
2158
+ icon: n.icon ?? "FileText",
2159
+ surface: n.surface
2285
2160
  }));
2286
- const o = Wn(e.metadata, t, r.extensionId);
2287
- return o.length === 0 || n.push(e.workbench.resources.registerPresenter({
2161
+ const s = Fr(e.metadata, t, n.extensionId);
2162
+ return s.length === 0 || r.push(e.workbench.resources.registerPresenter({
2288
2163
  id: `workbench.extension.resource.${t}`,
2289
- canOpen: (s) => s.kind === t,
2290
- // Reuse a placement where the composition resolver or the user put it.
2291
- open: (s) => Sn(e, o, s)
2292
- })), n;
2293
- }, Mn = (e) => [...Tn(e.metadata)].flatMap(([t, r]) => Hn(e, t, r)), On = (e) => {
2294
- const t = Gt(), r = [];
2295
- for (const n of e.metadata.resourceKinds ?? [])
2296
- r.push(t.registerResourceKind({
2297
- id: n.id,
2298
- extensionId: n.extensionId,
2299
- surface: n.surface,
2300
- slots: n.slots
2164
+ canOpen: (o) => o.kind === t,
2165
+ open: (o) => Nr(e, s, o)
2166
+ })), r;
2167
+ }, Ur = (e) => [...Br(e.metadata)].flatMap(([t, n]) => Lr(e, t, n)), _r = (e) => {
2168
+ const t = In(), n = [];
2169
+ for (const r of e.metadata.resourceKinds ?? [])
2170
+ n.push(t.registerResourceKind({
2171
+ id: r.id,
2172
+ extensionId: r.extensionId,
2173
+ surface: r.surface,
2174
+ slots: r.slots
2301
2175
  }));
2302
- for (const n of e.metadata.panels)
2303
- r.push(t.registerPanelCapability({
2304
- id: n.id,
2305
- extensionId: n.extensionId,
2306
- title: f(n.title, n.id),
2307
- icon: n.icon,
2308
- show: Qt(n.show)
2176
+ for (const r of e.metadata.panels)
2177
+ n.push(t.registerPanelCapability({
2178
+ id: r.id,
2179
+ extensionId: r.extensionId,
2180
+ title: p(r.title, r.id),
2181
+ icon: r.icon,
2182
+ show: wn(r.show)
2309
2183
  }));
2310
- for (const n of e.metadata.resourcePanels ?? [])
2311
- r.push(t.registerResourcePanel({
2312
- id: n.id,
2313
- extensionId: n.extensionId,
2314
- resourceKind: n.resourceKind,
2315
- panel: n.panel,
2316
- slot: n.slot
2184
+ for (const r of e.metadata.resourcePanels ?? [])
2185
+ n.push(t.registerResourcePanel({
2186
+ id: r.id,
2187
+ extensionId: r.extensionId,
2188
+ resourceKind: r.resourceKind,
2189
+ panel: r.panel,
2190
+ slot: r.slot
2317
2191
  }));
2318
- for (const n of e.metadata.modes)
2319
- r.push(t.registerModeComposition({
2320
- id: n.modeId,
2321
- extensionId: n.extensionId,
2322
- resources: n.resources,
2323
- modePanels: n.modePanels
2192
+ for (const r of e.metadata.modes)
2193
+ n.push(t.registerModeComposition({
2194
+ id: r.modeId,
2195
+ extensionId: r.extensionId,
2196
+ resources: r.resources,
2197
+ modePanels: r.modePanels
2324
2198
  }));
2325
2199
  return {
2326
2200
  registry: t,
2327
- disposables: r
2201
+ disposables: n
2328
2202
  };
2329
- }, Te = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, Kn = (e, t) => {
2203
+ }, Fe = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, qr = (e, t) => {
2330
2204
  if (t)
2331
2205
  return "commandId" in t ? async () => {
2332
- const r = await e.executeCommand(t.commandId, {
2206
+ const n = await e.executeCommand(t.commandId, {
2333
2207
  projectId: e.projectId
2334
2208
  });
2335
- if (!(!r || typeof r.type != "string" || typeof r.id != "string"))
2209
+ if (!(!n || typeof n.type != "string" || typeof n.id != "string"))
2336
2210
  return {
2337
- kind: r.type,
2338
- uri: Te(r.type, r.id),
2339
- id: r.id,
2340
- label: r.label
2211
+ kind: n.type,
2212
+ uri: Fe(n.type, n.id),
2213
+ id: n.id,
2214
+ label: n.label
2341
2215
  };
2342
2216
  } : {
2343
2217
  kind: t.type,
2344
- uri: Te(t.type, t.id),
2218
+ uri: Fe(t.type, t.id),
2345
2219
  id: t.id,
2346
2220
  label: t.label
2347
2221
  };
2348
- }, Dn = (e, t) => e.metadata.modes.map((r) => {
2349
- const n = (o, s) => {
2350
- tr({
2351
- layout: o.layout,
2352
- notifications: o.notifications
2222
+ }, zr = (e, t) => e.metadata.modes.map((n) => {
2223
+ const r = (s, o) => {
2224
+ xn({
2225
+ layout: s.layout,
2226
+ notifications: s.notifications
2353
2227
  }, {
2354
2228
  registry: t,
2355
- modeId: r.modeId,
2356
- resourceKind: o.navigator.getSelectedResource()?.kind,
2357
- seeding: s
2358
- }), o.layout.getLayout().regions.side.widgets.length > 0 && o.shell.setSidePanelPresentation("attached");
2229
+ modeId: n.modeId,
2230
+ resourceKind: s.navigator.getSelectedResource()?.kind,
2231
+ seeding: o
2232
+ }), s.layout.getLayout().regions.side.widgets.length > 0 && s.shell.setSidePanelPresentation("attached");
2359
2233
  };
2360
2234
  return e.workbench.modes.registerMode({
2361
- id: r.modeId,
2362
- label: f(r.label, r.modeId),
2363
- panels: r.panelRegions,
2364
- resourceKinds: Object.keys(r.resources ?? {}),
2365
- defaultResource: Kn(e, r.defaultResource),
2235
+ id: n.modeId,
2236
+ label: p(n.label, n.modeId),
2237
+ panels: n.panelRegions,
2238
+ resourceKinds: Object.keys(n.resources ?? {}),
2239
+ defaultResource: qr(e, n.defaultResource),
2366
2240
  listAddablePanels: ({
2367
- layout: o,
2368
- resource: s
2369
- }) => Yt({
2241
+ layout: s,
2242
+ resource: o
2243
+ }) => yn({
2370
2244
  registry: t,
2371
- modeId: r.modeId,
2372
- layout: o,
2373
- resourceKind: s?.kind
2374
- }).filter((i) => dt.includes(i.region)),
2245
+ modeId: n.modeId,
2246
+ layout: s,
2247
+ resourceKind: o?.kind
2248
+ }).filter((i) => Et.includes(i.region)),
2375
2249
  activate: () => {
2376
2250
  },
2377
- seed: (o) => n(o, !0),
2378
- reconcile: (o) => n(o, !1)
2251
+ seed: (s) => r(s, !0),
2252
+ reconcile: (s) => r(s, !1)
2379
2253
  });
2380
- }), to = (e) => {
2381
- const t = [], r = e;
2382
- kn(e, t), t.push(...Rn(r, e.metadata)), t.push(...Cn(e, r)), t.push(...En(e, r)), t.push(cn(e)), t.push(Ar(e)), t.push(...Pn(e)), t.push(Gr(r, e.metadata.kanbanRenderers ?? [], void 0, e.metadata.panels, e.metadata.resourcePanels)), t.push(br(r, e.metadata.dataTableRenderers ?? [], e.metadata.panels, e.metadata.resourcePanels)), t.push(zt(r, e.metadata.commandPaletteResources ?? [])), t.push(...xn(e)), t.push(...mn({
2383
- metadata: e.metadata,
2384
- routeResourceKind: e.routeResourceKind ?? xe,
2385
- workbench: e.workbench
2386
- })), t.push(...hn({
2387
- metadata: e.metadata,
2388
- openHref: e.openHref,
2389
- routeResourceKind: e.routeResourceKind ?? xe,
2390
- workbench: e.workbench
2391
- })), t.push(...An(e)), t.push(...Mn(e));
2392
- const n = On(e);
2393
- return t.push(...n.disposables), t.push(...Dn(e, n.registry)), {
2394
- dispose() {
2395
- wn(t);
2396
- }
2254
+ }), Qr = () => {
2255
+ if (typeof navigator > "u") return;
2256
+ const e = `${navigator.platform} ${navigator.userAgent}`.toLowerCase();
2257
+ if (e.includes("mac")) return "mac";
2258
+ if (e.includes("win")) return "win";
2259
+ if (e.includes("linux")) return "linux";
2260
+ }, Gr = (e, t = Qr()) => (t ? e.platformOverrides?.[t] : void 0) ?? e.key, Yr = (e) => e.bindings.map((t) => e.workbench.keybindings.registerKeybinding({
2261
+ commandId: t.commandId,
2262
+ keybinding: Gr(t),
2263
+ when: e.createWhenExpression?.(t.when),
2264
+ args: t.args
2265
+ })), v = (e) => e.extensionId === "pstdio" ? e.id : `${e.extensionId}.${e.kind}.${e.id}`, oe = (e) => e.extensionId === "pstdio" ? e.id : `${e.extensionId}.command.${e.id}`, ut = (e) => {
2266
+ if (!e) return;
2267
+ const t = (n) => {
2268
+ if (n)
2269
+ return Array.isArray(n) ? n.map(v) : v(n);
2397
2270
  };
2398
- }, $n = (e, t, r = {}) => {
2399
- t.kind === "tree" && e.renderers.refresh(t.id), t.kind === "file" && e.renderers.refreshFileRenderer(t.id, r), t.kind === "controls" && e.renderers.refreshControlsRenderer(t.id), t.kind === "dataTable" && e.renderers.refreshDataTableRenderer(t.id), t.kind === "kanban" && e.renderers.refreshKanbanRenderer(t.id);
2400
- }, Fn = (e) => {
2401
- const t = /* @__PURE__ */ new Map(), r = (n, o) => {
2402
- for (const s of new Set(o.refreshEventIds ?? [])) {
2403
- const i = t.get(s) ?? [];
2404
- i.some((a) => a.kind === n && a.id === o.id) || i.push({
2405
- id: o.id,
2406
- kind: n
2407
- }), t.set(s, i);
2271
+ return {
2272
+ mode: t(e.mode),
2273
+ source: e.source,
2274
+ viewId: t(e.view),
2275
+ resourceType: e.resourceType?.map((n) => n.id),
2276
+ metadata: e.metadata
2277
+ };
2278
+ }, Fo = ut, te = (e, t) => e.resourceViews.find((n) => v(n.view) === t)?.resourceKind.id, Xr = (e, t) => {
2279
+ const n = e.placements.flatMap((o) => o.item.kind === "view" && v(o.item.view) === t ? [{
2280
+ region: o.region,
2281
+ allowedRegions: o.movableTo,
2282
+ required: o.required
2283
+ }] : []), s = e.resourceViews.filter((o) => v(o.view) === t).flatMap((o) => e.placements.flatMap((i) => i.item.kind === "resource-slot" && i.item.slot.id === o.slot.id && i.item.slot.resourceKind.id === o.resourceKind.id ? [{
2284
+ for: o.resourceKind.id,
2285
+ region: i.region,
2286
+ allowedRegions: i.movableTo,
2287
+ required: i.required
2288
+ }] : []));
2289
+ return [...n, ...s];
2290
+ }, mt = (e) => e.body.kind === "webview" ? {
2291
+ webview: e.body.webview
2292
+ } : {
2293
+ renderer: {
2294
+ kind: e.body.kind,
2295
+ id: e.id
2296
+ }
2297
+ }, Jr = (e, t) => e.viewMenus.flatMap((n) => {
2298
+ if (v(n.owner) !== t.id) return [];
2299
+ const r = e.views.find((s) => s.id === v(n.view));
2300
+ return r ? [{
2301
+ id: n.id,
2302
+ extensionId: n.extensionId,
2303
+ ownerPanelId: t.id,
2304
+ title: r.title,
2305
+ side: n.side,
2306
+ group: n.group,
2307
+ placement: n.placement,
2308
+ hostTreeHeader: n.hostTreeHeader,
2309
+ hostTreeFooter: n.hostTreeFooter,
2310
+ ...mt(r)
2311
+ }] : [];
2312
+ }), Zr = (e) => e.views.map((t) => {
2313
+ const n = Xr(e, t.id), r = Jr(e, t);
2314
+ return {
2315
+ id: t.id,
2316
+ extensionId: t.extensionId,
2317
+ title: t.title,
2318
+ path: t.path,
2319
+ icon: t.icon,
2320
+ show: n.length === 0 ? void 0 : n.length === 1 ? n[0] : n,
2321
+ panelMenus: r.length > 0 ? r : void 0,
2322
+ ...mt(t)
2323
+ };
2324
+ }), he = (e) => e?.map(({
2325
+ command: t,
2326
+ ...n
2327
+ }) => ({
2328
+ ...n,
2329
+ commandId: oe(t)
2330
+ })), eo = (e) => e.views.flatMap((t) => {
2331
+ const n = t.body;
2332
+ return n.kind !== "kanban" ? [] : [{
2333
+ ...n,
2334
+ id: t.id,
2335
+ extensionId: t.extensionId,
2336
+ title: t.title,
2337
+ icon: t.icon,
2338
+ resourceKind: te(e, t.id),
2339
+ createRow: n.createRow ? {
2340
+ title: n.createRow.title,
2341
+ submitLabel: n.createRow.submitLabel,
2342
+ columnParam: n.createRow.columnParam,
2343
+ params: n.createRow.params,
2344
+ attributesParam: n.createRow.attributesParam,
2345
+ labels: n.createRow.labels,
2346
+ commandId: oe(n.createRow.command),
2347
+ attachments: n.createRow.attachments ? {
2348
+ resourceParam: n.createRow.attachments.resourceParam,
2349
+ fileParam: n.createRow.attachments.fileParam,
2350
+ commandId: oe(n.createRow.attachments.command)
2351
+ } : void 0
2352
+ } : void 0,
2353
+ rowActions: he(n.rowActions)
2354
+ }];
2355
+ }), to = (e) => e.views.flatMap((t) => {
2356
+ const n = t.body;
2357
+ return n.kind !== "dataTable" ? [] : [{
2358
+ ...n,
2359
+ id: t.id,
2360
+ extensionId: t.extensionId,
2361
+ title: t.title,
2362
+ icon: t.icon,
2363
+ resourceKind: te(e, t.id),
2364
+ selectionActions: he(n.selectionActions),
2365
+ rowActions: he(n.rowActions)
2366
+ }];
2367
+ }), no = (e) => e.views.flatMap((t) => t.body.kind === "tree" ? [{
2368
+ ...t.body,
2369
+ id: t.id,
2370
+ extensionId: t.extensionId,
2371
+ title: t.title,
2372
+ icon: t.icon,
2373
+ resourceKind: te(e, t.id)
2374
+ }] : []), ro = (e) => e.views.flatMap((t) => t.body.kind === "file" ? [{
2375
+ ...t.body,
2376
+ id: t.id,
2377
+ extensionId: t.extensionId,
2378
+ title: t.title,
2379
+ icon: t.icon,
2380
+ resourceKind: te(e, t.id)
2381
+ }] : []), oo = (e) => e.views.flatMap((t) => t.body.kind === "controls" ? [{
2382
+ ...t.body,
2383
+ id: t.id,
2384
+ extensionId: t.extensionId,
2385
+ title: t.title,
2386
+ icon: t.icon,
2387
+ resourceKind: te(e, t.id)
2388
+ }] : []), so = (e) => e.modes.map((t) => {
2389
+ const n = e.placements.filter((i) => v(i.mode) === t.id), r = [...new Set(n.flatMap((i) => [i.region, ...i.movableTo ?? []]))].filter((i) => i !== "sidenav"), s = Object.fromEntries(n.flatMap((i) => i.item.kind === "view" ? [[v(i.item.view), {
2390
+ region: i.region,
2391
+ allowedRegions: i.movableTo,
2392
+ required: i.required,
2393
+ defaultOpen: i.required ? !0 : i.defaultOpen
2394
+ }]] : [])), o = Object.fromEntries(e.resourceKinds.flatMap((i) => {
2395
+ const a = Object.fromEntries(n.flatMap((d) => d.item.kind === "resource-slot" && d.item.slot.resourceKind.id === i.id ? [[d.item.slot.id, {
2396
+ region: d.region,
2397
+ allowedRegions: d.movableTo,
2398
+ required: d.required,
2399
+ defaultOpen: d.required ? !0 : d.defaultOpen
2400
+ }]] : []));
2401
+ return Object.keys(a).length > 0 ? [[i.id, {
2402
+ slots: a
2403
+ }]] : [];
2404
+ }));
2405
+ return {
2406
+ id: t.id,
2407
+ extensionId: t.extensionId,
2408
+ modeId: t.id,
2409
+ label: t.label,
2410
+ icon: t.icon,
2411
+ panelRegions: r.length > 0 ? r : void 0,
2412
+ resources: o,
2413
+ modePanels: s
2414
+ };
2415
+ }), io = (e) => {
2416
+ const t = Zr(e);
2417
+ return {
2418
+ extensions: e.extensions,
2419
+ commands: e.commands,
2420
+ menuContributions: e.menuContributions,
2421
+ commandPaletteContributions: e.commandPaletteContributions,
2422
+ modes: so(e),
2423
+ panels: t,
2424
+ resourceKinds: e.resourceKinds.map((n) => ({
2425
+ id: n.id,
2426
+ extensionId: n.extensionId,
2427
+ surface: n.surface,
2428
+ label: n.label,
2429
+ icon: n.icon,
2430
+ slots: Object.fromEntries((n.slots ?? []).map((r) => [r.id, {
2431
+ cardinality: r.cardinality,
2432
+ external: r.access === "public"
2433
+ }])),
2434
+ menuSlots: Object.fromEntries((n.menuSlots ?? []).map((r) => [r.id, {
2435
+ placement: r.placement,
2436
+ label: r.label,
2437
+ external: r.access === "public",
2438
+ order: r.order
2439
+ }]))
2440
+ })),
2441
+ resourcePanels: e.resourceViews.map((n) => ({
2442
+ id: n.id,
2443
+ extensionId: n.extensionId,
2444
+ resourceKind: n.resourceKind.id,
2445
+ panel: v(n.view),
2446
+ slot: n.slot.id
2447
+ })),
2448
+ resourceHierarchyProviders: (e.resourceHierarchyProviders ?? []).map((n) => ({
2449
+ id: n.id,
2450
+ extensionId: n.extensionId,
2451
+ resourceKind: n.resourceKind.id
2452
+ })),
2453
+ routes: [],
2454
+ treeItems: [],
2455
+ activityItems: (e.activityItems ?? []).map((n) => ({
2456
+ id: n.id,
2457
+ extensionId: n.extensionId,
2458
+ title: n.title,
2459
+ icon: n.icon,
2460
+ modes: n.modes.map(v),
2461
+ placement: n.placement,
2462
+ commandId: oe(n.command),
2463
+ params: n.params
2464
+ })),
2465
+ settingsSections: e.settingsSections ?? [],
2466
+ settingsPanels: e.settingsPanels.flatMap((n) => {
2467
+ const r = e.views.find((s) => s.id === v(n.view));
2468
+ return !r || r.body.kind !== "webview" ? [] : [{
2469
+ id: n.id,
2470
+ extensionId: n.extensionId,
2471
+ slotId: n.slot.id,
2472
+ scope: n.slot.id.includes("global") ? "global" : "project",
2473
+ title: r.title,
2474
+ icon: r.icon,
2475
+ section: n.section ? v(n.section) : void 0,
2476
+ webview: r.body.webview
2477
+ }];
2478
+ }),
2479
+ kanbanRenderers: eo(e),
2480
+ dataTableRenderers: to(e),
2481
+ commandPaletteResources: e.commandPaletteResources ?? [],
2482
+ treeRenderers: no(e),
2483
+ fileRenderers: ro(e),
2484
+ controlsRenderers: oo(e),
2485
+ keybindings: e.keybindings ?? [],
2486
+ settingsDefinitions: e.settingsDefinitions ?? [],
2487
+ statuses: e.statuses,
2488
+ statusBarItems: e.statusBarItems.map((n) => ({
2489
+ id: n.id,
2490
+ extensionId: n.extensionId,
2491
+ viewId: v(n.view),
2492
+ slot: n.slot.id.endsWith("leading") ? "leading" : "trailing",
2493
+ order: n.order,
2494
+ when: ut(n.when)
2495
+ })),
2496
+ diagnostics: e.diagnostics
2497
+ };
2498
+ }, ao = (e, t, n = {}) => {
2499
+ t.kind === "tree" && e.renderers.refresh(t.id), t.kind === "file" && e.renderers.refreshFileRenderer(t.id, n), t.kind === "controls" && e.renderers.refreshControlsRenderer(t.id), t.kind === "dataTable" && e.renderers.refreshDataTableRenderer(t.id), t.kind === "kanban" && e.renderers.refreshKanbanRenderer(t.id);
2500
+ }, co = (e) => {
2501
+ const t = /* @__PURE__ */ new Map(), n = (r, s) => {
2502
+ for (const o of new Set(s.refreshEventIds ?? [])) {
2503
+ const i = t.get(o) ?? [];
2504
+ i.some((a) => a.kind === r && a.id === s.id) || i.push({
2505
+ id: s.id,
2506
+ kind: r
2507
+ }), t.set(o, i);
2408
2508
  }
2409
2509
  };
2410
- for (const n of e.treeRenderers ?? []) r("tree", n);
2411
- for (const n of e.fileRenderers ?? []) r("file", n);
2412
- for (const n of e.controlsRenderers ?? []) r("controls", n);
2413
- for (const n of e.dataTableRenderers ?? []) r("dataTable", n);
2414
- for (const n of e.kanbanRenderers ?? []) r("kanban", n);
2510
+ for (const r of e.views)
2511
+ r.body.kind !== "webview" && n(r.body.kind, {
2512
+ id: r.id,
2513
+ refreshEventIds: r.body.refreshEventIds
2514
+ });
2415
2515
  return t;
2416
- }, ro = (e) => {
2417
- const t = Fn(e.metadata);
2418
- return e.subscribe((r) => {
2516
+ }, lo = (e) => {
2517
+ const t = co(e.metadata);
2518
+ return e.subscribe((n) => {
2419
2519
  const {
2420
- id: n,
2421
- ...o
2422
- } = r;
2423
- for (const s of t.get(n) ?? []) $n(e.workbench, s, o);
2520
+ id: r,
2521
+ ...s
2522
+ } = n;
2523
+ for (const o of t.get(r) ?? []) ao(e.workbench, o, s);
2424
2524
  });
2425
- }, We = (e, t) => e.layout.listPanelInstances().find((r) => r.panelId === t), Bn = (e, t) => {
2525
+ }, uo = (e, t) => e.layout.listPanelInstances().find((n) => n.panelId === t), mo = (e, t) => {
2426
2526
  if (t)
2427
2527
  try {
2428
2528
  e.layout.activatePanel(t);
2429
2529
  } catch {
2430
2530
  }
2431
- }, no = (e, t) => {
2432
- const r = e.layout.getLayout().activeWidgetId;
2433
- for (const n of t.panels) {
2434
- if (!n.webview) continue;
2435
- const o = We(e, n.id);
2436
- o && e.layout.openPanel(n.id, {
2437
- resource: o.resource,
2438
- title: f(n.title, o.title),
2531
+ }, No = (e, t) => {
2532
+ const n = e.layout.getLayout().activeWidgetId;
2533
+ for (const r of t.views) {
2534
+ if (r.body.kind !== "webview") continue;
2535
+ const s = uo(e, r.id);
2536
+ s && e.layout.openPanel(r.id, {
2537
+ resource: s.resource,
2538
+ title: p(r.title, s.title),
2439
2539
  strategy: {
2440
2540
  kind: "replace-panel",
2441
- instanceId: o.instanceId
2541
+ instanceId: s.instanceId
2442
2542
  }
2443
2543
  });
2444
2544
  }
2445
- for (const n of t.routes) {
2446
- if (!n.webview) continue;
2447
- const o = We(e, n.id);
2448
- o && e.layout.openPanel(n.id, {
2449
- resource: o.resource,
2450
- title: f(n.label, o.title),
2451
- strategy: {
2452
- kind: "replace-panel",
2453
- instanceId: o.instanceId
2454
- }
2545
+ mo(e, n);
2546
+ }, po = (e) => (t) => ({
2547
+ ...ze({
2548
+ workbench: t.workbench,
2549
+ hostEvents: t.hostEvents
2550
+ }),
2551
+ // Extension guests speak the SDK resource shape (`type`); normalize to the
2552
+ // workbench shape (`kind` + synthesized uri) the resource registry expects,
2553
+ // mirroring how commands.execute and tree targets normalize their resources.
2554
+ "resource.open": (r) => {
2555
+ const s = r;
2556
+ if (!s.resource) throw new Error("resource.open requires a resource.");
2557
+ return t.workbench.resources.openResource(J(s.resource), qe(s.input));
2558
+ },
2559
+ "commands.execute": async (r) => {
2560
+ const s = r, o = s.resource ?? D(t.placement.resource);
2561
+ return e.executeCommand(s.commandId, {
2562
+ projectId: e.projectId,
2563
+ ...s.params ? {
2564
+ params: s.params
2565
+ } : {},
2566
+ ...o ? {
2567
+ resource: o
2568
+ } : {},
2569
+ slot: B({
2570
+ id: t.webviewId,
2571
+ kind: e.slotKind,
2572
+ projectId: e.projectId,
2573
+ context: {
2574
+ panelId: t.webviewId
2575
+ }
2576
+ }),
2577
+ source: "dashboard"
2455
2578
  });
2456
- }
2457
- Bn(e, r);
2579
+ },
2580
+ ...e.files ? {
2581
+ "files.upload": e.files.upload,
2582
+ "files.list": e.files.list,
2583
+ "files.delete": e.files.delete
2584
+ } : {}
2585
+ }), pt = "extensions", fo = 1e3, bo = 25, go = (e) => e === void 0 ? void 0 : e, ho = (e) => e === "global" ? "user" : "project", wo = (e, t) => t ? (n) => ({
2586
+ ...e(n),
2587
+ ...t(n)
2588
+ }) : e, ft = (e, t) => {
2589
+ const n = e.createWebviewHostCapabilities ?? po({
2590
+ executeCommand: e.executeCommand,
2591
+ files: e.webviewFiles,
2592
+ projectId: e.projectId,
2593
+ slotKind: t
2594
+ });
2595
+ return wo(n, e.createWebviewHostCapabilityOverrides);
2596
+ }, Io = (e) => e.workbench.renderers.getRenderer(se) ? [] : [e.workbench.renderers.registerRenderer(Xt({
2597
+ createHostCapabilities: ft(e, "panel"),
2598
+ createProps: e.createWebviewProps,
2599
+ createTheme: e.createWebviewTheme
2600
+ }))], yo = (e) => {
2601
+ const t = L(e.metadata.panels);
2602
+ return e.metadata.panels.flatMap((n, r) => n.webview ? [U({
2603
+ workbench: e.workbench,
2604
+ path: n.path,
2605
+ aliases: n.aliases,
2606
+ resolveInput: F(e.resolveViewInput, n),
2607
+ contribution: N({
2608
+ panel: n,
2609
+ rendererId: se,
2610
+ declarationIndex: r,
2611
+ menuDeclarationOffset: t[r],
2612
+ resourcePanels: e.metadata.resourcePanels,
2613
+ config: ve(n.webview)
2614
+ })
2615
+ })] : []);
2616
+ }, Ne = (e) => {
2617
+ if (!e || typeof e != "object" || !("statuses" in e) || !Array.isArray(e.statuses))
2618
+ throw new Error("Status provider returned an invalid response");
2619
+ return e.statuses;
2620
+ }, vo = (e, t) => {
2621
+ const n = e.metadata.statuses ?? [];
2622
+ if (n.length === 0) return [];
2623
+ const r = n.map((s, o) => e.workbench.statuses.registerStatusSet({
2624
+ id: s.id,
2625
+ title: p(s.title, s.id),
2626
+ actions: s.actions?.map((i) => ({
2627
+ id: i.id,
2628
+ label: p(i.label, i.id),
2629
+ icon: i.icon
2630
+ })),
2631
+ query: async () => Ne(await P(t, s.queryHandlerId, {
2632
+ params: {}
2633
+ })),
2634
+ save: s.saveHandlerId ? async (i) => Ne(await P(t, s.saveHandlerId, {
2635
+ params: {
2636
+ statuses: i
2637
+ }
2638
+ })) : void 0
2639
+ }, {
2640
+ ownerId: s.extensionId,
2641
+ priority: -o
2642
+ }));
2643
+ return r.push(e.workbench.settings.registerPanel({
2644
+ id: "workbench.statuses",
2645
+ title: "Statuses",
2646
+ icon: "list-checks",
2647
+ kind: "custom",
2648
+ order: bo,
2649
+ section: e.settingsSectionId ?? pt,
2650
+ scope: "project",
2651
+ render: () => K(Rt, {
2652
+ workbench: e.workbench
2653
+ })
2654
+ })), r;
2655
+ }, ko = (e) => {
2656
+ const t = [], n = e.settingsSectionId ?? pt;
2657
+ e.workbench.settings.getSection(n) || t.push(e.workbench.settings.registerSection({
2658
+ id: n,
2659
+ title: e.settingsSectionTitle ?? "Extensions"
2660
+ }));
2661
+ const r = [...e.metadata.settingsSections].sort((i, a) => (i.order ?? 0) - (a.order ?? 0) || i.extensionId.localeCompare(a.extensionId) || i.id.localeCompare(a.id));
2662
+ for (const i of r)
2663
+ t.push(e.workbench.settings.registerSection({
2664
+ id: i.id,
2665
+ title: p(i.title, i.id),
2666
+ order: i.order,
2667
+ scope: i.scope
2668
+ }));
2669
+ const s = Object.fromEntries((e.metadata.settingsDefinitions ?? []).map((i) => [i.key, {
2670
+ type: i.type,
2671
+ scope: ho(i.scope),
2672
+ default: go(i.default),
2673
+ enum: i.enum,
2674
+ description: p(i.description)
2675
+ }]));
2676
+ Object.keys(s).length > 0 && t.push(e.workbench.preferences.registerSchema({
2677
+ properties: s
2678
+ }));
2679
+ const o = [...e.metadata.settingsPanels].sort((i, a) => i.extensionId.localeCompare(a.extensionId) || i.id.localeCompare(a.id));
2680
+ for (const [i, a] of o.entries())
2681
+ t.push(e.workbench.settings.registerPanel({
2682
+ id: a.id,
2683
+ title: p(a.title, a.id),
2684
+ icon: a.icon,
2685
+ kind: "custom",
2686
+ order: fo + i,
2687
+ section: a.section ?? n,
2688
+ scope: a.scope,
2689
+ render: (d) => Ye({
2690
+ context: {
2691
+ workbench: d.workbench,
2692
+ webviewId: a.id,
2693
+ placement: {
2694
+ ...d.instance,
2695
+ panelId: a.id
2696
+ },
2697
+ hostEvents: Ge(d.workbench, d.instance)
2698
+ },
2699
+ createHostCapabilities: ft(e, "settings"),
2700
+ createProps: e.createWebviewProps ?? (({
2701
+ placement: u
2702
+ }) => ({
2703
+ placement: u,
2704
+ resource: u.resource
2705
+ })),
2706
+ createTheme: e.createWebviewTheme,
2707
+ ownerId: a.extensionId,
2708
+ title: p(a.title, a.id),
2709
+ webview: ve(a.webview)
2710
+ })
2711
+ }));
2712
+ return t;
2713
+ }, Ro = (e) => {
2714
+ for (let t = e.length - 1; t >= 0; t -= 1) e[t]?.dispose();
2715
+ }, ke = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Re = (e, t, n, r, s) => e.prepareCommandArgs?.(t, n, r, s) ?? n, Co = (e, t) => t.commands.map((n) => e.workbench.commands.registerCommand({
2716
+ id: n.id,
2717
+ label: p(n.title, n.id),
2718
+ description: p(n.description),
2719
+ params: n.params
2720
+ }, {
2721
+ prepareArgs: (r, s, o) => Re(e, n.id, r, s, o),
2722
+ execute: (r, s) => P(e, n.id, {
2723
+ params: ke(r),
2724
+ resource: s?.resource
2725
+ })
2726
+ })), bt = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), xo = (e, t) => {
2727
+ if (!e.menuSlotsById) return [];
2728
+ const {
2729
+ registrations: n
2730
+ } = qn({
2731
+ metadata: e.metadata,
2732
+ menuSlotsById: e.menuSlotsById,
2733
+ menuTargetsById: e.menuTargetsById,
2734
+ createWhenExpression: e.createMenuWhenExpression
2735
+ }), r = n.map(({
2736
+ menuItem: o,
2737
+ menuPath: i,
2738
+ ...a
2739
+ }) => ({
2740
+ ...a,
2741
+ menuItems: [{
2742
+ menuItem: o,
2743
+ menuPath: i
2744
+ }]
2745
+ }));
2746
+ return (e.menuRegistrations ?? r).flatMap((o) => [e.workbench.commands.registerCommand(o.command, {
2747
+ prepareArgs: (i, a, d) => Re(t, o.targetCommandId, i, a, d),
2748
+ execute: (i, a) => P(t, o.targetCommandId, {
2749
+ params: {
2750
+ ...o.contribution.params ?? {},
2751
+ ...ke(i) ?? {}
2752
+ },
2753
+ resource: bt(e, a),
2754
+ slot: B({
2755
+ id: o.contribution.slotId,
2756
+ kind: "menu",
2757
+ projectId: e.projectId,
2758
+ context: {
2759
+ panelId: o.contribution.id
2760
+ }
2761
+ })
2762
+ })
2763
+ }), ...o.menuItems.map(({
2764
+ menuPath: i,
2765
+ menuItem: a
2766
+ }) => e.workbench.layout.registerMenuItem(i, a))]);
2767
+ }, Eo = (e, t) => zn({
2768
+ metadata: e.metadata
2769
+ }).flatMap((r) => [e.workbench.commands.registerCommand(r.command, {
2770
+ prepareArgs: (s, o, i) => Re(t, r.targetCommandId, s, o, i),
2771
+ execute: (s, o) => P(t, r.targetCommandId, {
2772
+ params: {
2773
+ ...r.contribution.params ?? {},
2774
+ ...ke(s) ?? {}
2775
+ },
2776
+ resource: bt(e, o),
2777
+ slot: B({
2778
+ id: "workbench.commandPalette",
2779
+ kind: "menu",
2780
+ projectId: e.projectId,
2781
+ context: {
2782
+ panelId: r.contribution.id
2783
+ }
2784
+ })
2785
+ }),
2786
+ isVisible: () => xt(r.contribution.when, e.workbench.getPrimaryResource()?.kind)
2787
+ }), e.workbench.layout.registerMenuItem(kt, r.menuItem)]), Po = (e, t) => {
2788
+ const n = t?.mode;
2789
+ if (!n) return !0;
2790
+ const r = e.workbench.modes.getActiveModeId() ?? "";
2791
+ return Array.isArray(n) ? n.includes(r) : n === r;
2792
+ }, Ao = (e) => (e.metadata.statusBarItems ?? []).map((t) => e.workbench.statusBar.registerItem({
2793
+ id: t.id,
2794
+ viewId: t.viewId,
2795
+ slot: t.slot,
2796
+ order: t.order,
2797
+ isVisible: () => Po(e, t.when)
2798
+ })), Lo = (e) => {
2799
+ const t = {
2800
+ ...e,
2801
+ metadata: io(e.metadata)
2802
+ }, n = [], r = t;
2803
+ n.push(...Io(t)), n.push(...Co(r, t.metadata)), n.push(...Yr({
2804
+ bindings: t.metadata.keybindings,
2805
+ createWhenExpression: t.createKeybindingWhenExpression,
2806
+ workbench: t.workbench
2807
+ })), n.push(...xo(t, r)), n.push(...Eo(t, r)), n.push(Or({
2808
+ ...t,
2809
+ resolveNodeResource: t.resolveTreeNodeResource
2810
+ })), n.push(Jn(t)), n.push(Hn(r, t.metadata.controlsRenderers ?? [], t.metadata.panels, {
2811
+ resolveViewInput: t.resolveViewInput
2812
+ }, t.metadata.resourcePanels)), n.push(...yo(t)), n.push(...ko(t)), n.push(...vo(t, r)), n.push(kr(r, t.metadata.kanbanRenderers ?? [], {
2813
+ ...t.kanbanAdapter,
2814
+ resolveViewInput: t.resolveViewInput
2815
+ }, t.metadata.panels, t.metadata.resourcePanels)), n.push(Bn(r, t.metadata.dataTableRenderers ?? [], t.metadata.panels, t.metadata.resourcePanels, t.resolveViewInput)), n.push(hn(r, t.metadata.commandPaletteResources ?? [])), n.push(...Dr({
2816
+ metadata: e.metadata,
2817
+ workbench: e.workbench
2818
+ })), e.subscribeRefreshEvents && n.push(lo({
2819
+ metadata: e.metadata,
2820
+ subscribe: e.subscribeRefreshEvents,
2821
+ workbench: e.workbench
2822
+ })), n.push(...Ao(t)), n.push(...Ur(t));
2823
+ const s = _r(t);
2824
+ return n.push(...s.disposables), n.push(...zr(t, s.registry)), {
2825
+ dispose() {
2826
+ Ro(n);
2827
+ }
2828
+ };
2458
2829
  };
2459
2830
  export {
2460
- S as BRIDGE_WEBVIEW_RENDERER_ID,
2461
- kr as buildWorkbenchExtensionCommandPaletteRegistrations,
2462
- vr as buildWorkbenchExtensionMenuRegistrations,
2463
- Zn as buildWorkbenchExtensionRouteEntries,
2464
- er as compositionRequiredNotificationId,
2465
- Ht as createBridgeWebviewRenderer,
2466
- Pt as createTerminalSessionCapability,
2467
- Gt as createWorkbenchCompositionRegistry,
2468
- Oe as createWorkbenchWebviewHostCapabilities,
2469
- Jn as emptyWorkbenchExtensionMetadata,
2470
- eo as fileRendererRefreshEnvelopeFromCommand,
2471
- Yt as listCompositionAddablePanels,
2472
- K as panelMenuDeclarationOffsets,
2473
- tr as reconcileCompositionLayout,
2474
- no as refreshOpenWorkbenchExtensionWebviews,
2475
- $n as refreshWorkbenchExtensionRenderer,
2476
- zt as registerWorkbenchExtensionCommandPaletteResources,
2477
- to as registerWorkbenchExtensionContributions,
2478
- Xn as registerWorkbenchExtensionControlsRenderers,
2479
- br as registerWorkbenchExtensionDataTableRenderers,
2480
- Ar as registerWorkbenchExtensionFileRenderers,
2481
- Gr as registerWorkbenchExtensionKanbanRenderers,
2482
- D as registerWorkbenchExtensionPanel,
2483
- ro as registerWorkbenchExtensionRendererRefreshEvents,
2484
- cn as registerWorkbenchExtensionTreeRenderers,
2485
- $e as renderBridgeWebviewFrame,
2486
- Qt as toPanelPlacements,
2487
- O as toWorkbenchCompositionPanelContribution
2831
+ se as BRIDGE_WEBVIEW_RENDERER_ID,
2832
+ zn as buildWorkbenchExtensionCommandPaletteRegistrations,
2833
+ qn as buildWorkbenchExtensionMenuRegistrations,
2834
+ Cn as compositionRequiredNotificationId,
2835
+ Xt as createBridgeWebviewRenderer,
2836
+ Ut as createTerminalSessionCapability,
2837
+ In as createWorkbenchCompositionRegistry,
2838
+ ze as createWorkbenchWebviewHostCapabilities,
2839
+ Do as emptyWorkbenchExtensionMetadata,
2840
+ Bo as fileRendererRefreshEnvelopeFromCommand,
2841
+ dn as isExtensionNavigationTarget,
2842
+ yn as listCompositionAddablePanels,
2843
+ L as panelMenuDeclarationOffsets,
2844
+ xn as reconcileCompositionLayout,
2845
+ No as refreshOpenWorkbenchExtensionWebviews,
2846
+ ao as refreshWorkbenchExtensionRenderer,
2847
+ hn as registerWorkbenchExtensionCommandPaletteResources,
2848
+ Lo as registerWorkbenchExtensionContributions,
2849
+ Hn as registerWorkbenchExtensionControlsRenderers,
2850
+ Bn as registerWorkbenchExtensionDataTableRenderers,
2851
+ Jn as registerWorkbenchExtensionFileRenderers,
2852
+ kr as registerWorkbenchExtensionKanbanRenderers,
2853
+ U as registerWorkbenchExtensionPanel,
2854
+ lo as registerWorkbenchExtensionRendererRefreshEvents,
2855
+ Or as registerWorkbenchExtensionTreeRenderers,
2856
+ Ye as renderBridgeWebviewFrame,
2857
+ wn as toPanelPlacements,
2858
+ N as toWorkbenchCompositionPanelContribution,
2859
+ Z as toWorkbenchNavigationTarget,
2860
+ Je as toWorkbenchNavigationTargetResult,
2861
+ Fo as toWorkbenchWhenExpression
2488
2862
  };
2489
2863
  //# sourceMappingURL=extensions.js.map