@pstdio/workbench 0.6.0 → 0.7.1

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,62 +1,62 @@
1
1
  import { c as m, w as $ } from "./workbench-menu-paths-Bb0ICxeG.js";
2
2
  import { w as p, r as Y } from "./layout-types-DMoZz38-.js";
3
- import { r as ee, l as te, g as ne } from "./surface-map-C1pOTUmF.js";
4
- import { devtools as ie } from "zustand/middleware";
3
+ import { r as ee, l as te, g as ie } from "./surface-map-C1pOTUmF.js";
4
+ import { devtools as ne } from "zustand/middleware";
5
5
  import { createStore as oe } from "zustand/vanilla";
6
- const re = (e, n) => Object.is(e, n), W = (e) => {
7
- const n = oe()(ie(() => e.initialState, {
6
+ const re = (e, i) => Object.is(e, i), W = (e) => {
7
+ const i = oe()(ne(() => e.initialState, {
8
8
  name: e.name ?? "workbench.store"
9
- })), t = (r, s, i = {}) => {
10
- const o = i.equalityFn ?? re;
11
- let a = r(n.getState());
12
- return i.fireImmediately && s(a, a), n.subscribe((c) => {
13
- const l = r(c);
14
- if (o(a, l)) return;
9
+ })), t = (r, s, n = {}) => {
10
+ const o = n.equalityFn ?? re;
11
+ let a = r(i.getState());
12
+ return n.fireImmediately && s(a, a), i.subscribe((c) => {
13
+ const d = r(c);
14
+ if (o(a, d)) return;
15
15
  const g = a;
16
- a = l, s(l, g);
16
+ a = d, s(d, g);
17
17
  });
18
18
  };
19
19
  return {
20
- getState: n.getState,
21
- getInitialState: n.getInitialState,
22
- subscribe: n.subscribe,
20
+ getState: i.getState,
21
+ getInitialState: i.getInitialState,
22
+ subscribe: i.subscribe,
23
23
  subscribeSelector: t,
24
- setState: n.setState,
25
- api: n
24
+ setState: i.setState,
25
+ api: i
26
26
  };
27
- }, Ke = (e, n) => {
27
+ }, je = (e, i) => {
28
28
  for (const t of Object.values(e.regions)) {
29
- const r = t.widgets.findIndex((s) => s.contributionId === n);
29
+ const r = t.widgets.findIndex((s) => s.contributionId === i);
30
30
  if (r >= 0) return {
31
31
  regionId: t.id,
32
32
  index: r,
33
33
  placement: t.widgets[r]
34
34
  };
35
35
  }
36
- }, je = (e, n, t) => {
36
+ }, Ke = (e, i, t) => {
37
37
  for (const r of Object.values(e.regions)) {
38
- const s = r.widgets.findIndex((i) => i.contributionId === n && i.resourceUri === t);
38
+ const s = r.widgets.findIndex((n) => n.contributionId === i && n.resourceUri === t);
39
39
  if (s >= 0) return {
40
40
  regionId: r.id,
41
41
  index: s,
42
42
  placement: r.widgets[s]
43
43
  };
44
44
  }
45
- }, se = (e, n) => {
45
+ }, se = (e, i) => {
46
46
  for (const t of Object.values(e.regions)) {
47
- const r = t.widgets.findIndex((s) => s.widgetId === n);
47
+ const r = t.widgets.findIndex((s) => s.widgetId === i);
48
48
  if (r >= 0) return {
49
49
  regionId: t.id,
50
50
  index: r,
51
51
  placement: t.widgets[r]
52
52
  };
53
53
  }
54
- }, Ee = (e, n) => {
54
+ }, Ee = (e, i) => {
55
55
  const t = new Set(Object.values(e.regions).flatMap((r) => r.widgets.map((s) => s.widgetId)));
56
- return Y(t, n);
57
- }, j = (e) => e.widgets.find((n) => n.widgetId === e.activeWidgetId) ?? e.widgets[0], P = (e) => e.role === "location", _ = (e) => e.resourceUri ?? `${e.contributionId}:${e.widgetId}`, E = (e, n, t, r) => {
58
- if (!n) return e;
59
- const s = _(n), o = {
56
+ return Y(t, i);
57
+ }, K = (e) => e.widgets.find((i) => i.widgetId === e.activeWidgetId) ?? e.widgets[0], P = (e) => e.role === "location", _ = (e) => e.resourceUri ?? `${e.contributionId}:${e.widgetId}`, E = (e, i, t, r) => {
58
+ if (!i) return e;
59
+ const s = _(i), o = {
60
60
  ...e.locationSubPanelSelections?.[s] ?? {}
61
61
  };
62
62
  return r ? o[t] = r : delete o[t], {
@@ -66,56 +66,56 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
66
66
  [s]: o
67
67
  }
68
68
  };
69
- }, F = (e, n) => {
69
+ }, F = (e, i) => {
70
70
  if (!e.locationSubPanelSelections) return e;
71
- const t = Object.fromEntries(Object.entries(e.locationSubPanelSelections).map(([r, s]) => [r, Object.fromEntries(Object.entries(s).filter(([, i]) => i !== n))]));
71
+ const t = Object.fromEntries(Object.entries(e.locationSubPanelSelections).map(([r, s]) => [r, Object.fromEntries(Object.entries(s).filter(([, n]) => n !== i))]));
72
72
  return {
73
73
  ...e,
74
74
  locationSubPanelSelections: t
75
75
  };
76
76
  }, k = (e) => {
77
- const n = e.regions.main.widgets.filter(P);
78
- return n.find((t) => t.widgetId === e.activeLocationWidgetId) ?? n.at(-1);
79
- }, $e = (e, n, t) => {
77
+ const i = e.regions.main.widgets.filter(P);
78
+ return i.find((t) => t.widgetId === e.activeLocationWidgetId) ?? i.at(-1);
79
+ }, $e = (e, i, t) => {
80
80
  const r = {
81
81
  ...e
82
82
  };
83
- return t.resource ? (r.resource = t.resource, r.resourceUri = t.resource.uri, r.title = t.title ?? t.resource.label ?? n.title) : t.title !== void 0 && (r.title = t.title), t.pinned !== void 0 && (r.pinned = t.pinned), t.closable !== void 0 && (r.closable = t.closable), t.mountStrategy !== void 0 && (r.mountStrategy = t.mountStrategy), t.hiddenByDefault !== void 0 && (r.hiddenByDefault = t.hiddenByDefault), t.tabRetention !== void 0 && (r.tabRetention = t.tabRetention), t.tab !== void 0 && (r.tab = t.tab), t.ownerId !== void 0 && (r.ownerId = t.ownerId), t.source !== void 0 && (r.source = t.source), t.role !== void 0 && (r.role = t.role), r;
84
- }, De = (e, n, t) => ({
83
+ return t.resource ? (r.resource = t.resource, r.resourceUri = t.resource.uri, r.title = t.title ?? t.resource.label ?? i.title) : t.title !== void 0 && (r.title = t.title), t.pinned !== void 0 && (r.pinned = t.pinned), t.closable !== void 0 && (r.closable = t.closable), t.mountStrategy !== void 0 && (r.mountStrategy = t.mountStrategy), t.hiddenByDefault !== void 0 && (r.hiddenByDefault = t.hiddenByDefault), t.tabRetention !== void 0 && (r.tabRetention = t.tabRetention), t.tab !== void 0 && (r.tab = t.tab), t.ownerId !== void 0 && (r.ownerId = t.ownerId), t.source !== void 0 && (r.source = t.source), t.role !== void 0 && (r.role = t.role), r;
84
+ }, De = (e, i, t) => ({
85
85
  widgetId: e,
86
- contributionId: n.id,
87
- ownerId: t.ownerId ?? n.ownerId,
88
- source: t.source ?? n.source,
86
+ contributionId: i.id,
87
+ ownerId: t.ownerId ?? i.ownerId,
88
+ source: t.source ?? i.source,
89
89
  resource: t.resource,
90
90
  resourceUri: t.resource?.uri,
91
- title: t.title ?? t.resource?.label ?? n.title,
91
+ title: t.title ?? t.resource?.label ?? i.title,
92
92
  pinned: t.pinned,
93
93
  // Tabbed (non-singleton) widgets are closable unless they opt out; singleton
94
94
  // panels stay non-closable by default.
95
- closable: t.closable ?? n.closable ?? !n.singleton,
96
- mountStrategy: t.mountStrategy ?? n.mountStrategy,
97
- hiddenByDefault: t.hiddenByDefault ?? n.hiddenByDefault,
95
+ closable: t.closable ?? i.closable ?? !i.singleton,
96
+ mountStrategy: t.mountStrategy ?? i.mountStrategy,
97
+ hiddenByDefault: t.hiddenByDefault ?? i.hiddenByDefault,
98
98
  tabRetention: t.tabRetention,
99
- tab: t.tab ?? n.tab,
99
+ tab: t.tab ?? i.tab,
100
100
  role: t.role ?? "content"
101
- }), He = (e, n, t, r = {}) => {
102
- const s = e.regions[n], i = t(s.widgets), o = r.activeWidgetId !== void 0 ? r.activeWidgetId : r.clearActiveWidget ? void 0 : s.activeWidgetId;
101
+ }), He = (e, i, t, r = {}) => {
102
+ const s = e.regions[i], n = t(s.widgets), o = r.activeWidgetId !== void 0 ? r.activeWidgetId : r.clearActiveWidget ? void 0 : s.activeWidgetId;
103
103
  return {
104
104
  ...e,
105
- activeLocationWidgetId: n === "main" && !i.some((a) => a.widgetId === e.activeLocationWidgetId) ? i.filter(P).at(-1)?.widgetId : e.activeLocationWidgetId,
105
+ activeLocationWidgetId: i === "main" && !n.some((a) => a.widgetId === e.activeLocationWidgetId) ? n.filter(P).at(-1)?.widgetId : e.activeLocationWidgetId,
106
106
  regions: {
107
107
  ...e.regions,
108
- [n]: {
108
+ [i]: {
109
109
  ...s,
110
- widgets: i,
110
+ widgets: n,
111
111
  activeWidgetId: o
112
112
  }
113
113
  }
114
114
  };
115
- }, Be = (e, n) => {
115
+ }, Be = (e, i) => {
116
116
  let t = e;
117
117
  for (const s of Object.values(e.regions)) {
118
- const i = s.widgets.filter((c) => c.contributionId === n), o = s.widgets.filter((c) => c.contributionId !== n);
118
+ const n = s.widgets.filter((c) => c.contributionId === i), o = s.widgets.filter((c) => c.contributionId !== i);
119
119
  if (o.length === s.widgets.length) continue;
120
120
  const a = s.activeWidgetId && !o.some((c) => c.widgetId === s.activeWidgetId) ? void 0 : s.activeWidgetId;
121
121
  t = {
@@ -129,11 +129,11 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
129
129
  }
130
130
  }
131
131
  };
132
- for (const c of i)
132
+ for (const c of n)
133
133
  t = F(t, c.widgetId);
134
134
  }
135
- const r = Object.values(t.regions).some((s) => s.widgets.some((i) => i.widgetId === t.activeWidgetId));
136
- return t.activeWidgetId && (!r || t.activeWidgetId.startsWith(`${n}:`) || t.activeWidgetId === n) && (t = {
135
+ const r = Object.values(t.regions).some((s) => s.widgets.some((n) => n.widgetId === t.activeWidgetId));
136
+ return t.activeWidgetId && (!r || t.activeWidgetId.startsWith(`${i}:`) || t.activeWidgetId === i) && (t = {
137
137
  ...t,
138
138
  activeWidgetId: void 0,
139
139
  activeResourceUri: void 0
@@ -141,40 +141,44 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
141
141
  ...t,
142
142
  activeLocationWidgetId: t.regions.main.widgets.filter(P).at(-1)?.widgetId
143
143
  }), t;
144
- }, Te = (e, n) => {
145
- const t = se(e, n);
144
+ }, Te = (e, i) => {
145
+ const t = se(e, i);
146
146
  if (!t) return;
147
- const r = e.regions[t.regionId], s = r.widgets.filter((u) => u.widgetId !== n), i = r.activeWidgetId === n || !r.activeWidgetId && t.index === 0, a = (t.placement.role === "sub-panel" ? s.find((u) => u.role === "sub-panel" && u.ownerResourceUri === t.placement.ownerResourceUri) : void 0) ?? (t.placement.role === "sub-panel" && t.regionId === "main" ? k(e) : s[t.index] ?? s[t.index - 1]), c = i ? a?.widgetId : r.activeWidgetId, l = {
147
+ const r = e.regions[t.regionId], s = r.widgets.filter((u) => u.widgetId !== i), n = r.activeWidgetId === i || !r.activeWidgetId && t.index === 0, a = (t.placement.role === "sub-panel" ? s.find((u) => u.role === "sub-panel" && u.ownerResourceUri === t.placement.ownerResourceUri) : void 0) ?? (t.placement.role === "sub-panel" && t.regionId === "main" ? k(e) : s[t.index] ?? s[t.index - 1]), c = n ? a?.widgetId : r.activeWidgetId, d = {
148
148
  ...r,
149
149
  widgets: s,
150
150
  activeWidgetId: c
151
151
  };
152
152
  let g = F({
153
153
  ...e,
154
- activeLocationWidgetId: e.activeLocationWidgetId === n ? e.regions.main.widgets.filter((u) => u.widgetId !== n && P(u)).at(-1)?.widgetId : e.activeLocationWidgetId,
154
+ activeLocationWidgetId: e.activeLocationWidgetId === i ? e.regions.main.widgets.filter((u) => u.widgetId !== i && P(u)).at(-1)?.widgetId : e.activeLocationWidgetId,
155
155
  regions: {
156
156
  ...e.regions,
157
- [r.id]: l
157
+ [r.id]: d
158
158
  }
159
- }, n);
160
- return i && t.regionId !== "side" && p.includes(t.regionId) && (g = E(g, k(g), t.regionId, a?.role === "sub-panel" ? a.widgetId : void 0)), e.activeWidgetId === n && (g = {
159
+ }, i);
160
+ return n && t.regionId !== "side" && p.includes(t.regionId) && (g = E(g, k(g), t.regionId, a?.role === "sub-panel" ? a.widgetId : void 0)), e.activeWidgetId === i && (g = {
161
161
  ...g,
162
162
  activeWidgetId: a?.widgetId,
163
163
  activeResourceUri: a?.resourceUri
164
164
  }), {
165
165
  regionId: t.regionId,
166
166
  closedPlacement: t.placement,
167
- activePlacement: j(l),
167
+ activePlacement: K(d),
168
168
  layout: g
169
169
  };
170
- }, _e = (e, n, t) => {
171
- const r = e.regions[n];
172
- if (n === "main" && P(t)) {
173
- const i = e.locationSubPanelSelections?.[_(t)] ?? {}, o = {
174
- ...e.regions
175
- };
170
+ }, _e = (e, i, t) => {
171
+ const r = e.regions[i];
172
+ if (i === "main" && P(t)) {
173
+ const n = e.locationSubPanelSelections?.[_(t)] ?? {}, o = Object.fromEntries(Object.entries(e.regions).map(([a, c]) => [a, {
174
+ ...c,
175
+ widgets: c.widgets.map((d) => !t.resource || d.widgetId === t.widgetId || d.ownerResourceUri !== t.resourceUri || d.resourceUri !== t.resourceUri ? d : {
176
+ ...d,
177
+ resource: t.resource
178
+ })
179
+ }]));
176
180
  for (const a of p) {
177
- const c = o[a], l = i[a], g = c.widgets.find((u) => u.widgetId === l && u.role === "sub-panel" && (!u.ownerResourceUri || u.ownerResourceUri === t.resourceUri));
181
+ const c = o[a], d = n[a], g = c.widgets.find((u) => u.widgetId === d && u.role === "sub-panel" && (!u.ownerResourceUri || u.ownerResourceUri === t.resourceUri));
178
182
  o[a] = {
179
183
  ...c,
180
184
  activeWidgetId: a === "side" ? c.activeWidgetId : g?.widgetId ?? (a === "main" ? t.widgetId : void 0)
@@ -188,7 +192,7 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
188
192
  regions: o
189
193
  };
190
194
  }
191
- const s = t.role === "sub-panel" && n !== "side" && p.includes(n) ? E(e, k(e), n, t.widgetId) : e;
195
+ const s = t.role === "sub-panel" && i !== "side" && p.includes(i) ? E(e, k(e), i, t.widgetId) : e;
192
196
  return {
193
197
  ...s,
194
198
  activeWidgetId: t.widgetId,
@@ -196,52 +200,52 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
196
200
  activeResourceUri: t.resourceUri,
197
201
  regions: {
198
202
  ...s.regions,
199
- [n]: {
203
+ [i]: {
200
204
  ...r,
201
205
  activeWidgetId: t.widgetId
202
206
  }
203
207
  }
204
208
  };
205
- }, Fe = (e, n, t) => {
206
- const r = e.regions[n], s = t ? r.widgets.find((a) => a.widgetId === t) : void 0;
207
- if (t && !s) throw new Error(`Widget placement not found in ${n}: ${t}`);
209
+ }, Fe = (e, i, t) => {
210
+ const r = e.regions[i], s = t ? r.widgets.find((a) => a.widgetId === t) : void 0;
211
+ if (t && !s) throw new Error(`Widget placement not found in ${i}: ${t}`);
208
212
  if (r.activeWidgetId === t) return;
209
- const i = e.activeWidgetId === r.activeWidgetId, o = {
213
+ const n = e.activeWidgetId === r.activeWidgetId, o = {
210
214
  ...e,
211
- activeWidgetId: i ? s?.widgetId : e.activeWidgetId,
212
- activeResourceUri: i ? s?.resourceUri : e.activeResourceUri,
213
- activeLocationWidgetId: n === "main" && s?.role === "location" ? s.widgetId : e.activeLocationWidgetId,
215
+ activeWidgetId: n ? s?.widgetId : e.activeWidgetId,
216
+ activeResourceUri: n ? s?.resourceUri : e.activeResourceUri,
217
+ activeLocationWidgetId: i === "main" && s?.role === "location" ? s.widgetId : e.activeLocationWidgetId,
214
218
  regions: {
215
219
  ...e.regions,
216
- [n]: {
220
+ [i]: {
217
221
  ...r,
218
222
  activeWidgetId: s?.widgetId
219
223
  }
220
224
  }
221
225
  };
222
- return n === "side" || !p.includes(n) ? o : E(o, k(o), n, s?.role === "sub-panel" ? s.widgetId : void 0);
223
- }, ce = (e, n) => !(e.resourceKinds?.length && (!n || !e.resourceKinds.includes(n.kind)) || e.canOpen && (!n || !e.canOpen(n))), Ve = (e, n, t, r = {}) => {
224
- const s = e.regions[n];
225
- return s.widgets.find((i) => i.widgetId === s.activeWidgetId && i.role === "sub-panel" && (r.ignoreOwnerResourceUri || !i.ownerResourceUri || i.ownerResourceUri === t?.uri));
226
- }, Ne = (e) => k(e), ae = (e, n, t, r) => {
226
+ return i === "side" || !p.includes(i) ? o : E(o, k(o), i, s?.role === "sub-panel" ? s.widgetId : void 0);
227
+ }, ce = (e, i) => !(e.resourceKinds?.length && (!i || !e.resourceKinds.includes(i.kind)) || e.canOpen && (!i || !e.canOpen(i))), Ve = (e, i, t, r = {}) => {
228
+ const s = e.regions[i];
229
+ return s.widgets.find((n) => n.widgetId === s.activeWidgetId && n.role === "sub-panel" && (r.ignoreOwnerResourceUri || !n.ownerResourceUri || n.ownerResourceUri === t?.uri));
230
+ }, Ne = (e) => k(e), ae = (e, i, t, r) => {
227
231
  const s = e.eligibleLocations;
228
- return !(!V(e, t) || s?.resourceKinds?.length && (!n || !s.resourceKinds.includes(n.kind)) || s?.resourceIds?.length && (!n?.id || !s.resourceIds.includes(n.id)) || s?.canOpen && (!n || !s.canOpen(n)) || r?.ownerResourceUri && r.ownerResourceUri !== n?.uri);
229
- }, V = (e, n) => {
232
+ return !(!V(e, t) || s?.resourceKinds?.length && (!i || !s.resourceKinds.includes(i.kind)) || s?.resourceIds?.length && (!i?.id || !s.resourceIds.includes(i.id)) || s?.canOpen && (!i || !s.canOpen(i)) || r?.ownerResourceUri && r.ownerResourceUri !== i?.uri);
233
+ }, V = (e, i) => {
230
234
  const t = e.eligibleLocations?.modeIds;
231
- return !t?.length || n !== void 0 && t.includes(n);
232
- }, qe = (e, n, t, r, s = {}) => ce(e, r?.resource ?? n) ? s.ignoreResourceLocation ? V(e, t) : ae(e, n, t, r) : !1, ze = (e, n) => {
235
+ return !t?.length || i !== void 0 && t.includes(i);
236
+ }, qe = (e, i, t, r, s = {}) => ce(e, r?.resource ?? i) ? s.ignoreResourceLocation ? V(e, t) : ae(e, i, t, r) : !1, ze = (e, i) => {
233
237
  const t = e.regions.main.widgets.find((r) => r.widgetId === e.regions.main.activeWidgetId) ?? k(e);
234
- return t ? n.find((r) => r.id === t.contributionId)?.floatingPanels !== "hidden" : !0;
235
- }, Qe = (e, n) => {
238
+ return t ? i.find((r) => r.id === t.contributionId)?.floatingPanels !== "hidden" : !0;
239
+ }, Qe = (e, i) => {
236
240
  const t = e.panelMenuOwner ?? {
237
241
  level: "panel"
238
242
  };
239
- return t.contributionId ? (n.subPanel ?? n.locationPanel)?.contributionId === t.contributionId : n.subPanel ? t.level === "sub-panel" : t.level === "panel";
243
+ return t.contributionId ? (i.subPanel ?? i.locationPanel)?.contributionId === t.contributionId : i.subPanel ? t.level === "sub-panel" : t.level === "panel";
240
244
  }, de = "workbench.core", N = (e = {}) => ({
241
245
  source: e.source ?? "module",
242
246
  ownerId: e.ownerId ?? de,
243
247
  priority: e.priority ?? 0
244
- }), x = (e, n) => n.priority - e.priority || e.ownerId.localeCompare(n.ownerId), Ge = (e = {}, n) => {
248
+ }), O = (e, i) => i.priority - e.priority || e.ownerId.localeCompare(i.ownerId), Ge = (e = {}, i) => {
245
249
  const {
246
250
  strategy: t,
247
251
  ...r
@@ -263,7 +267,7 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
263
267
  tabPosition: t.position
264
268
  } : {
265
269
  ...r,
266
- tabRetention: n
270
+ tabRetention: i
267
271
  };
268
272
  }, Je = (e) => ({
269
273
  instanceId: e.widgetId,
@@ -282,7 +286,7 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
282
286
  tab: e.tab
283
287
  }), Xe = (e) => {
284
288
  const {
285
- closable: n,
289
+ closable: i,
286
290
  ownedPanelMenuIds: t,
287
291
  ...r
288
292
  } = e;
@@ -291,53 +295,53 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
291
295
  main: ["main-header", "main-left-menu", "main", "main-right-menu"],
292
296
  secondary: ["secondary-header", "secondary-left-menu", "secondary", "secondary-right-menu"],
293
297
  side: ["side-header", "side-left-menu", "side", "side-right-menu"]
294
- }, H = Object.values(y).flat(), O = (e) => e.panels ?? p, Ze = (e) => Object.keys(y).find((n) => y[n].some((t) => t === e)), Ye = (e, n) => !e || O(e).includes(n), I = (e, n) => {
295
- if (n)
296
- return Object.values(e.regions).flatMap((t) => t.widgets).find((t) => t.widgetId === n);
297
- }, A = (e, n) => {
298
- const t = n.find((r) => r && I(e, r.widgetId));
298
+ }, H = Object.values(y).flat(), x = (e) => e.panels ?? p, Ze = (e) => Object.keys(y).find((i) => y[i].some((t) => t === e)), Ye = (e, i) => !e || x(e).includes(i), I = (e, i) => {
299
+ if (i)
300
+ return Object.values(e.regions).flatMap((t) => t.widgets).find((t) => t.widgetId === i);
301
+ }, A = (e, i) => {
302
+ const t = i.find((r) => r && I(e, r.widgetId));
299
303
  return {
300
304
  ...e,
301
305
  activeWidgetId: t?.widgetId,
302
306
  activeResourceUri: t?.resourceUri
303
307
  };
304
- }, le = (e, n) => {
305
- if (n.length === 0) return e;
306
- const t = new Set(Object.keys(y).filter((c) => y[c].some((l) => n.includes(l)))), r = n.some((c) => {
307
- const l = e.regions[c];
308
- return l.widgets.length > 0 || l.activeWidgetId !== void 0 || l.visible;
309
- }), s = Object.values(e.locationSubPanelSelections ?? {}).some((c) => Object.keys(c).some((l) => t.has(l)));
308
+ }, le = (e, i) => {
309
+ if (i.length === 0) return e;
310
+ const t = new Set(Object.keys(y).filter((c) => y[c].some((d) => i.includes(d)))), r = i.some((c) => {
311
+ const d = e.regions[c];
312
+ return d.widgets.length > 0 || d.activeWidgetId !== void 0 || d.visible;
313
+ }), s = Object.values(e.locationSubPanelSelections ?? {}).some((c) => Object.keys(c).some((d) => t.has(d)));
310
314
  if (!r && !s) return e;
311
- const i = {
315
+ const n = {
312
316
  ...e.regions
313
317
  };
314
- for (const c of n)
315
- i[c] = {
316
- ...i[c],
318
+ for (const c of i)
319
+ n[c] = {
320
+ ...n[c],
317
321
  widgets: [],
318
322
  activeWidgetId: void 0,
319
323
  visible: !1
320
324
  };
321
- const o = Object.fromEntries(Object.entries(e.locationSubPanelSelections ?? {}).map(([c, l]) => [c, Object.fromEntries(Object.entries(l).filter(([g]) => !t.has(g)))])), a = {
325
+ const o = Object.fromEntries(Object.entries(e.locationSubPanelSelections ?? {}).map(([c, d]) => [c, Object.fromEntries(Object.entries(d).filter(([g]) => !t.has(g)))])), a = {
322
326
  ...e,
323
- regions: i
327
+ regions: n
324
328
  };
325
329
  return {
326
330
  ...A(a, [I(a, e.activeWidgetId)]),
327
331
  activeLocationWidgetId: I(a, e.activeLocationWidgetId)?.widgetId,
328
332
  locationSubPanelSelections: o
329
333
  };
330
- }, U = (e, n) => {
331
- const t = new Set(n), r = Object.keys(y).filter((s) => !t.has(s)).flatMap((s) => y[s]);
334
+ }, U = (e, i) => {
335
+ const t = new Set(i), r = Object.keys(y).filter((s) => !t.has(s)).flatMap((s) => y[s]);
332
336
  return le(e, r);
333
- }, ge = (e, n, t) => {
334
- if (!n) {
337
+ }, ge = (e, i, t) => {
338
+ if (!i) {
335
339
  const a = {
336
340
  ...e.regions
337
341
  };
338
- for (const l of H) {
339
- const g = a[l], u = g.widgets.filter((b) => b.role !== "content");
340
- a[l] = {
342
+ for (const d of H) {
343
+ const g = a[d], u = g.widgets.filter((b) => b.role !== "content");
344
+ a[d] = {
341
345
  ...g,
342
346
  widgets: u,
343
347
  activeWidgetId: u.some((b) => b.widgetId === g.activeWidgetId) ? g.activeWidgetId : void 0
@@ -355,36 +359,36 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
355
359
  const r = {
356
360
  ...e.regions
357
361
  };
358
- for (const a of H) r[a] = n.regions[a];
362
+ for (const a of H) r[a] = i.regions[a];
359
363
  const s = U({
360
364
  ...e,
361
365
  regions: r
362
- }, t), i = I(s, n.activeWidgetId), o = I(s, e.activeWidgetId);
366
+ }, t), n = I(s, i.activeWidgetId), o = I(s, e.activeWidgetId);
363
367
  return {
364
- ...A(s, [i, o]),
365
- activeLocationWidgetId: I(s, n.activeLocationWidgetId)?.widgetId ?? I(s, e.activeLocationWidgetId)?.widgetId,
366
- locationSubPanelSelections: n.locationSubPanelSelections
368
+ ...A(s, [n, o]),
369
+ activeLocationWidgetId: I(s, i.activeLocationWidgetId)?.widgetId ?? I(s, e.activeLocationWidgetId)?.widgetId,
370
+ locationSubPanelSelections: i.locationSubPanelSelections
367
371
  };
368
372
  }, C = (e) => {
369
- for (let n = e.length - 1; n >= 0; n -= 1)
370
- e[n]?.dispose();
371
- }, B = (e, n) => {
372
- n !== e.layout.getLayout() && e.layout.restoreLayout(n);
373
- for (const t of p) e.panels.setOpen(t, n.regions[t].visible);
373
+ for (let i = e.length - 1; i >= 0; i -= 1)
374
+ e[i]?.dispose();
375
+ }, B = (e, i) => {
376
+ i !== e.layout.getLayout() && e.layout.restoreLayout(i);
377
+ for (const t of p) e.panels.setOpen(t, i.regions[t].visible);
374
378
  }, et = (e) => {
375
- const n = W({
379
+ const i = W({
376
380
  name: "workbench.modes",
377
381
  initialState: {
378
382
  modes: {},
379
383
  activeModeId: void 0
380
384
  }
381
385
  }), t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
382
- let i = [], o, a, c = !1;
383
- const l = (d) => {
384
- if (t.has(d.id)) return;
385
- const f = D(d.activate(e.resolveContext()));
386
- t.set(d.id, f);
387
- }, g = (d, f) => {
386
+ let n = [], o, a, c = !1;
387
+ const d = (l) => {
388
+ if (t.has(l.id)) return;
389
+ const f = D(l.activate(e.resolveContext()));
390
+ t.set(l.id, f);
391
+ }, g = (l, f) => {
388
392
  let v = !1, h = () => {
389
393
  };
390
394
  const S = () => {
@@ -396,101 +400,101 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
396
400
  };
397
401
  h = f.layout.store.subscribeSelector((w) => w.layout.regions.main, S);
398
402
  try {
399
- d.seed?.(f), S();
403
+ l.seed?.(f), S();
400
404
  } finally {
401
405
  h();
402
406
  }
403
- }, u = (d) => {
404
- const f = e.resolveContext(), v = `${d.id}\0${f.layout.getPersistenceScope() ?? "unscoped"}`, h = U(f.layout.getLayout(), O(d));
405
- B(f, h), f.layout.reconcilePanelMenus(), !r.has(v) && !f.layout.enteredWithPersistedLayout() && g(d, f), r.add(v);
406
- }, b = (d) => {
407
- u(d), d.reconcile?.(e.resolveContext());
408
- }, Q = (d) => {
409
- const f = e.resolveContext(), v = n.getState().activeModeId, h = f.layout.getPersistenceScope() === void 0;
410
- if (v && h && s.set(v, f.layout.getLayout()), R(), d === void 0) {
411
- n.setState({
412
- ...n.getState(),
407
+ }, u = (l) => {
408
+ const f = e.resolveContext(), v = `${l.id}\0${f.layout.getPersistenceScope() ?? "unscoped"}`, h = U(f.layout.getLayout(), x(l));
409
+ B(f, h), f.layout.reconcilePanelMenus(), !r.has(v) && !f.layout.enteredWithPersistedLayout() && g(l, f), r.add(v);
410
+ }, b = (l) => {
411
+ u(l), l.reconcile?.(e.resolveContext());
412
+ }, Q = (l) => {
413
+ const f = e.resolveContext(), v = i.getState().activeModeId, h = f.layout.getPersistenceScope() === void 0;
414
+ if (v && h && s.set(v, f.layout.getLayout()), R(), l === void 0) {
415
+ i.setState({
416
+ ...i.getState(),
413
417
  activeModeId: void 0
414
418
  }, !1, "deactivateMode");
415
419
  return;
416
420
  }
417
- const S = n.getState().modes[d];
418
- if (!S) throw new Error(`Workbench mode not registered: ${d}`);
419
- h && B(f, ge(f.layout.getLayout(), s.get(d), O(S))), G(d, {
420
- seed: a !== d
421
+ const S = i.getState().modes[l];
422
+ if (!S) throw new Error(`Workbench mode not registered: ${l}`);
423
+ h && B(f, ge(f.layout.getLayout(), s.get(l), x(S))), G(l, {
424
+ seed: a !== l
421
425
  });
422
426
  }, R = () => {
423
- C(i), i = [], o?.dispose(), o = void 0;
424
- }, G = (d, f) => {
425
- const v = e.resolveContext(), h = n.getState().modes[d];
426
- if (!h) throw new Error(`Workbench mode not registered: ${d}`);
427
+ C(n), n = [], o?.dispose(), o = void 0;
428
+ }, G = (l, f) => {
429
+ const v = e.resolveContext(), h = i.getState().modes[l];
430
+ if (!h) throw new Error(`Workbench mode not registered: ${l}`);
427
431
  const S = v.context.createScope("workbench.mode");
428
- S.set("activeWorkbenchMode", d), S.set(`workbenchMode.${d}`, !0), o = S;
432
+ S.set("activeWorkbenchMode", l), S.set(`workbenchMode.${l}`, !0), o = S;
429
433
  try {
430
- l(h), n.setState({
431
- ...n.getState(),
432
- activeModeId: d
433
- }, !1, "activateMode"), f.seed && u(h), i = D(h.enter?.(v)), f.seed && h.reconcile?.(e.resolveContext());
434
+ d(h), i.setState({
435
+ ...i.getState(),
436
+ activeModeId: l
437
+ }, !1, "activateMode"), f.seed && u(h), n = D(h.enter?.(v)), f.seed && h.reconcile?.(e.resolveContext());
434
438
  } catch (w) {
435
- throw R(), n.setState({
436
- ...n.getState(),
439
+ throw R(), i.setState({
440
+ ...i.getState(),
437
441
  activeModeId: void 0
438
442
  }, !1, "deactivateMode"), w;
439
443
  }
440
444
  }, J = e.resolveContext().layout.onDidChangePersistenceScope(() => {
441
- const d = n.getState().activeModeId;
442
- if (d === a) return;
443
- const f = d ? n.getState().modes[d] : void 0;
445
+ const l = i.getState().activeModeId;
446
+ if (l === a) return;
447
+ const f = l ? i.getState().modes[l] : void 0;
444
448
  f && b(f);
445
449
  }), X = m(() => {
446
450
  J.dispose(), R();
447
- for (const d of t.values()) C(d);
448
- t.clear(), r.clear(), s.clear(), n.setState({
451
+ for (const l of t.values()) C(l);
452
+ t.clear(), r.clear(), s.clear(), i.setState({
449
453
  modes: {},
450
454
  activeModeId: void 0
451
455
  }, !1, "disposeModes");
452
456
  });
453
457
  return {
454
- store: n,
458
+ store: i,
455
459
  dispose() {
456
460
  X.dispose();
457
461
  },
458
- registerMode(d) {
459
- const f = n.getState();
460
- if (f.modes[d.id]) throw new Error(`Workbench mode already registered: ${d.id}`);
461
- return n.setState({
462
+ registerMode(l) {
463
+ const f = i.getState();
464
+ if (f.modes[l.id]) throw new Error(`Workbench mode already registered: ${l.id}`);
465
+ return i.setState({
462
466
  ...f,
463
467
  modes: {
464
468
  ...f.modes,
465
- [d.id]: d
469
+ [l.id]: l
466
470
  }
467
471
  }, !1, "registerMode"), m(() => {
468
- const v = n.getState();
469
- if (v.modes[d.id] !== d) return;
470
- v.activeModeId === d.id && (R(), n.setState({
471
- ...n.getState(),
472
+ const v = i.getState();
473
+ if (v.modes[l.id] !== l) return;
474
+ v.activeModeId === l.id && (R(), i.setState({
475
+ ...i.getState(),
472
476
  activeModeId: void 0
473
- }, !1, "deactivateMode")), C(t.get(d.id) ?? []), t.delete(d.id), s.delete(d.id);
477
+ }, !1, "deactivateMode")), C(t.get(l.id) ?? []), t.delete(l.id), s.delete(l.id);
474
478
  for (const w of r)
475
- w.startsWith(`${d.id}\0`) && r.delete(w);
479
+ w.startsWith(`${l.id}\0`) && r.delete(w);
476
480
  const {
477
- [d.id]: h,
481
+ [l.id]: h,
478
482
  ...S
479
483
  } = v.modes;
480
- n.setState({
481
- ...n.getState(),
484
+ i.setState({
485
+ ...i.getState(),
482
486
  modes: S
483
487
  }, !1, "unregisterMode");
484
488
  });
485
489
  },
486
- getMode(d) {
487
- return n.getState().modes[d];
490
+ getMode(l) {
491
+ return i.getState().modes[l];
488
492
  },
489
493
  listModes() {
490
- return Object.values(n.getState().modes);
494
+ return Object.values(i.getState().modes);
491
495
  },
492
496
  getActiveModeId() {
493
- return n.getState().activeModeId;
497
+ return i.getState().activeModeId;
494
498
  },
495
499
  // A deferred seed is the second half of one transition: the caller rotates the
496
500
  // layout persistence scope between the two halves. Observers must not treat the
@@ -498,21 +502,21 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
498
502
  isTransitioning() {
499
503
  return c || a !== void 0;
500
504
  },
501
- setActiveMode(d, f = {}) {
502
- if (d === n.getState().activeModeId) {
503
- const v = d ? n.getState().modes[d] : void 0;
504
- v && d !== a && b(v);
505
+ setActiveMode(l, f = {}) {
506
+ if (l === i.getState().activeModeId) {
507
+ const v = l ? i.getState().modes[l] : void 0;
508
+ v && l !== a && b(v);
505
509
  return;
506
510
  }
507
- c = !0, a = f.deferSeed ? d : void 0;
511
+ c = !0, a = f.deferSeed ? l : void 0;
508
512
  try {
509
- Q(d);
513
+ Q(l);
510
514
  } finally {
511
515
  c = !1;
512
516
  }
513
517
  },
514
518
  seedActiveMode() {
515
- const d = n.getState().activeModeId, f = d ? n.getState().modes[d] : void 0;
519
+ const l = i.getState().activeModeId, f = l ? i.getState().modes[l] : void 0;
516
520
  c = !0;
517
521
  try {
518
522
  f && b(f);
@@ -520,56 +524,56 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
520
524
  a = void 0, c = !1;
521
525
  }
522
526
  },
523
- onDidChangeActive(d) {
524
- const f = n.subscribeSelector((v) => v.activeModeId, () => d());
527
+ onDidChangeActive(l) {
528
+ const f = i.subscribeSelector((v) => v.activeModeId, () => l());
525
529
  return m(f);
526
530
  }
527
531
  };
528
532
  }, ue = (e) => Array.isArray(e) ? e : e.trim().split(/\s+/).filter(Boolean), fe = (e) => {
529
- const n = ue(e);
530
- return n.length === 1 ? n[0] ?? "" : n;
533
+ const i = ue(e);
534
+ return i.length === 1 ? i[0] ?? "" : i;
531
535
  }, tt = (e) => {
532
- const n = W({
536
+ const i = W({
533
537
  name: "workbench.keybindings",
534
538
  initialState: {
535
539
  keybindings: []
536
540
  }
537
541
  });
538
542
  return {
539
- store: n,
543
+ store: i,
540
544
  registerKeybinding(t, r) {
541
545
  if (!e.commands.getCommand(t.commandId)) throw new Error(`Keybinding command not registered: ${t.commandId}`);
542
546
  const s = {
543
547
  ...N(r),
544
548
  ...t,
545
549
  keybinding: fe(t.keybinding)
546
- }, i = n.getState();
547
- return n.setState({
548
- keybindings: [...i.keybindings, s]
550
+ }, n = i.getState();
551
+ return i.setState({
552
+ keybindings: [...n.keybindings, s]
549
553
  }, !1, "registerKeybinding"), m(() => {
550
- const o = n.getState(), a = o.keybindings.filter((c) => c !== s);
551
- a.length !== o.keybindings.length && n.setState({
554
+ const o = i.getState(), a = o.keybindings.filter((c) => c !== s);
555
+ a.length !== o.keybindings.length && i.setState({
552
556
  keybindings: a
553
557
  }, !1, "unregisterKeybinding");
554
558
  });
555
559
  },
556
560
  listKeybindings() {
557
- return [...n.getState().keybindings].sort(x);
561
+ return [...i.getState().keybindings].sort(O);
558
562
  },
559
563
  listActiveKeybindings() {
560
- return n.getState().keybindings.filter((t) => e.context.matches(t.when)).sort(x);
564
+ return i.getState().keybindings.filter((t) => e.context.matches(t.when)).sort(O);
561
565
  }
562
566
  };
563
- }, nt = (e, n) => j(e.regions[ee(n)])?.resource, it = ({
567
+ }, it = (e, i) => K(e.regions[ee(i)])?.resource, nt = ({
564
568
  layout: e,
565
- primary: n,
569
+ primary: i,
566
570
  isInScope: t
567
571
  }) => {
568
572
  const r = [];
569
573
  for (const s of te()) {
570
- const i = ne(s);
571
- if (i.role !== "anchor" || i.persistence === "primary") continue;
572
- const o = j(e.regions[s]);
574
+ const n = ie(s);
575
+ if (n.role !== "anchor" || n.persistence === "primary") continue;
576
+ const o = K(e.regions[s]);
573
577
  if (o?.resource) {
574
578
  if (o.role === "sub-panel" && o.ownerResourceUri) {
575
579
  r.push({
@@ -578,7 +582,7 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
578
582
  });
579
583
  continue;
580
584
  }
581
- if (i.persistence === "derived") {
585
+ if (n.persistence === "derived") {
582
586
  r.push({
583
587
  region: s,
584
588
  action: "clear"
@@ -587,14 +591,14 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
587
591
  }
588
592
  r.push({
589
593
  region: s,
590
- action: t(o.resource, n) ? "keep" : "clear"
594
+ action: t(o.resource, i) ? "keep" : "clear"
591
595
  });
592
596
  }
593
597
  }
594
598
  return r;
595
- }, M = (e, n) => {
599
+ }, M = (e, i) => {
596
600
  const {
597
- [n]: t,
601
+ [i]: t,
598
602
  ...r
599
603
  } = e;
600
604
  return r;
@@ -604,35 +608,35 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
604
608
  const e = document.createElement("div");
605
609
  return e.style.display = "contents", e.dataset.workbenchKeepAliveHost = "", e;
606
610
  }, ot = (e = {}) => {
607
- const n = e.createHost ?? ve, t = W({
611
+ const i = e.createHost ?? ve, t = W({
608
612
  name: "workbench.renderers",
609
613
  initialState: {
610
614
  renderers: {},
611
615
  hosts: {},
612
616
  claims: {}
613
617
  }
614
- }), r = (i) => {
615
- const o = t.getState(), a = o.hosts[i], c = a?.attachedTo;
618
+ }), r = (n) => {
619
+ const o = t.getState(), a = o.hosts[n], c = a?.attachedTo;
616
620
  !a || !c || (c.contains(a.host) && c.removeChild(a.host), t.setState({
617
621
  ...o,
618
622
  hosts: {
619
623
  ...o.hosts,
620
- [i]: {
624
+ [n]: {
621
625
  ...a,
622
626
  attachedTo: void 0
623
627
  }
624
628
  },
625
- claims: M(o.claims, i)
629
+ claims: M(o.claims, n)
626
630
  }, !1, "renderers.detach"));
627
631
  }, s = {
628
632
  store: t,
629
- registerRenderer(i) {
633
+ registerRenderer(n) {
630
634
  const o = t.getState();
631
- if (o.renderers[i.id]) throw new Error(`Renderer already registered: ${i.id}`);
632
- const a = i.keepAlive ? n() : void 0, c = a ? {
635
+ if (o.renderers[n.id]) throw new Error(`Renderer already registered: ${n.id}`);
636
+ const a = n.keepAlive ? i() : void 0, c = a ? {
633
637
  ...o.hosts,
634
- [i.id]: {
635
- rendererId: i.id,
638
+ [n.id]: {
639
+ rendererId: n.id,
636
640
  host: a
637
641
  }
638
642
  } : o.hosts;
@@ -640,76 +644,76 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
640
644
  ...o,
641
645
  renderers: {
642
646
  ...o.renderers,
643
- [i.id]: i
647
+ [n.id]: n
644
648
  },
645
649
  hosts: c
646
650
  }, !1, "registerRenderer"), m(() => {
647
- if (t.getState().renderers[i.id] !== i) return;
648
- i.keepAlive && r(i.id);
651
+ if (t.getState().renderers[n.id] !== n) return;
652
+ n.keepAlive && r(n.id);
649
653
  const g = t.getState();
650
654
  t.setState({
651
655
  ...g,
652
- renderers: M(g.renderers, i.id),
653
- hosts: M(g.hosts, i.id),
654
- claims: M(g.claims, i.id)
656
+ renderers: M(g.renderers, n.id),
657
+ hosts: M(g.hosts, n.id),
658
+ claims: M(g.claims, n.id)
655
659
  }, !1, "unregisterRenderer");
656
660
  });
657
661
  },
658
- getRenderer(i) {
659
- return t.getState().renderers[i];
662
+ getRenderer(n) {
663
+ return t.getState().renderers[n];
660
664
  },
661
665
  listRenderers() {
662
666
  return Object.values(t.getState().renderers);
663
667
  },
664
- onDidChange(i) {
665
- const o = t.subscribeSelector((a) => a.renderers, () => i());
668
+ onDidChange(n) {
669
+ const o = t.subscribeSelector((a) => a.renderers, () => n());
666
670
  return m(o);
667
671
  },
668
- claim(i, o, a) {
669
- const c = t.getState(), l = c.renderers[i];
670
- if (!l) throw new Error(`Renderer is not registered: ${i}`);
671
- if (!l.keepAlive) throw new Error(`Renderer ${i} is not keep-alive; cannot claim`);
672
- const g = c.hosts[i];
673
- if (!g) throw new Error(`Renderer ${i} has no host`);
672
+ claim(n, o, a) {
673
+ const c = t.getState(), d = c.renderers[n];
674
+ if (!d) throw new Error(`Renderer is not registered: ${n}`);
675
+ if (!d.keepAlive) throw new Error(`Renderer ${n} is not keep-alive; cannot claim`);
676
+ const g = c.hosts[n];
677
+ if (!g) throw new Error(`Renderer ${n} has no host`);
674
678
  if (g.attachedTo === o)
675
679
  t.setState({
676
680
  ...c,
677
681
  claims: {
678
682
  ...c.claims,
679
- [i]: a
683
+ [n]: a
680
684
  }
681
685
  }, !1, "renderers.updateClaim");
682
686
  else {
683
- r(i);
684
- const u = t.getState(), b = u.hosts[i];
687
+ r(n);
688
+ const u = t.getState(), b = u.hosts[n];
685
689
  o.appendChild(b.host), t.setState({
686
690
  ...u,
687
691
  hosts: {
688
692
  ...u.hosts,
689
- [i]: {
693
+ [n]: {
690
694
  ...b,
691
695
  attachedTo: o
692
696
  }
693
697
  },
694
698
  claims: {
695
699
  ...u.claims,
696
- [i]: a
700
+ [n]: a
697
701
  }
698
702
  }, !1, "renderers.attach");
699
703
  }
700
704
  return m(() => {
701
- const b = t.getState().hosts[i];
702
- !b || b.attachedTo !== o || r(i);
705
+ const b = t.getState().hosts[n];
706
+ !b || b.attachedTo !== o || r(n);
703
707
  });
704
708
  },
705
- getHost(i) {
706
- return t.getState().hosts[i]?.host;
709
+ getHost(n) {
710
+ return t.getState().hosts[n]?.host;
707
711
  },
708
- getClaim(i) {
709
- return t.getState().claims[i];
712
+ getClaim(n) {
713
+ return t.getState().claims[n];
710
714
  }
711
715
  };
712
- for (const i of e.initialRenderers ?? []) s.registerRenderer(i);
716
+ for (const n of e.initialRenderers ?? []) s.registerRenderer(n);
713
717
  return s;
714
718
  }, rt = {
715
719
  project: "folder-root",
@@ -717,13 +721,13 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
717
721
  worktree: "git-pull-request-draft",
718
722
  settings: "settings",
719
723
  kanbanRenderer: "table-properties"
720
- }, be = "resource_hierarchy_cycle", q = (e) => [...e].sort((n, t) => t.priority - n.priority || n.id.localeCompare(t.id)), he = (e, n, t) => {
721
- const r = q(e), s = [n], i = /* @__PURE__ */ new Set([n.uri]);
722
- let o = n;
724
+ }, be = "resource_hierarchy_cycle", q = (e) => [...e].sort((i, t) => t.priority - i.priority || i.id.localeCompare(t.id)), he = (e, i, t) => {
725
+ const r = q(e), s = [i], n = /* @__PURE__ */ new Set([i.uri]);
726
+ let o = i;
723
727
  for (; ; ) {
724
- const c = r.find((l) => l.canResolve(o))?.getParent(o);
728
+ const c = r.find((d) => d.canResolve(o))?.getParent(o);
725
729
  if (!c) break;
726
- if (i.has(c.uri)) {
730
+ if (n.has(c.uri)) {
727
731
  t({
728
732
  code: be,
729
733
  path: [...s],
@@ -731,28 +735,28 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
731
735
  });
732
736
  break;
733
737
  }
734
- s.unshift(c), i.add(c.uri), o = c;
738
+ s.unshift(c), n.add(c.uri), o = c;
735
739
  }
736
740
  return s;
737
741
  }, me = "workbench.resource.kind", Se = "workbench.resource.id", we = (e) => `workbench.resource.metadata.${e}`, z = "workbench.selectionResourceUri", Ie = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean", st = (e) => {
738
742
  if (!e) return {};
739
- const n = {
743
+ const i = {
740
744
  [me]: e.kind,
741
745
  [Se]: e.id ?? e.uri
742
746
  };
743
747
  for (const [t, r] of Object.entries(e.metadata ?? {}))
744
- Ie(r) && (n[we(t)] = r);
745
- return n;
748
+ Ie(r) && (i[we(t)] = r);
749
+ return i;
746
750
  }, ct = (e) => ({
747
751
  [z]: e.uri
748
752
  }), at = (e) => {
749
753
  if (!e) return [];
750
- const n = e.metadata?.[z];
751
- return typeof n != "string" || n === e.uri ? [e.uri] : [e.uri, n];
752
- }, T = (e) => [...e].sort((n, t) => t.priority - n.priority || n.id.localeCompare(t.id)), ye = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", dt = (e = {}) => {
753
- const n = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = e.establishLocation;
754
+ const i = e.metadata?.[z];
755
+ return typeof i != "string" || i === e.uri ? [e.uri] : [e.uri, i];
756
+ }, T = (e) => [...e].sort((i, t) => t.priority - i.priority || i.id.localeCompare(t.id)), ye = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", dt = (e = {}) => {
757
+ const i = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = e.establishLocation;
754
758
  let s = 0;
755
- const i = W({
759
+ const n = W({
756
760
  name: "workbench.resources",
757
761
  initialState: {
758
762
  kinds: {},
@@ -762,136 +766,136 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
762
766
  }
763
767
  });
764
768
  return {
765
- store: i,
769
+ store: n,
766
770
  registerKind(o, a) {
767
- const c = i.getState();
771
+ const c = n.getState();
768
772
  if (c.kinds[o.kind]) throw new Error(`Resource kind already registered: ${o.kind}`);
769
- const l = {
773
+ const d = {
770
774
  ...N(a),
771
775
  ...o
772
776
  };
773
- return i.setState({
777
+ return n.setState({
774
778
  ...c,
775
779
  kinds: {
776
780
  ...c.kinds,
777
- [o.kind]: l
781
+ [o.kind]: d
778
782
  }
779
783
  }, !1, "registerKind"), m(() => {
780
- const g = i.getState();
781
- if (g.kinds[o.kind] !== l) return;
784
+ const g = n.getState();
785
+ if (g.kinds[o.kind] !== d) return;
782
786
  const {
783
787
  [o.kind]: u,
784
788
  ...b
785
789
  } = g.kinds;
786
- i.setState({
790
+ n.setState({
787
791
  ...g,
788
792
  kinds: b
789
793
  }, !1, "unregisterKind");
790
794
  });
791
795
  },
792
796
  getKind(o) {
793
- return i.getState().kinds[o];
797
+ return n.getState().kinds[o];
794
798
  },
795
799
  getSurface(o) {
796
- return i.getState().kinds[o.kind]?.surface;
800
+ return n.getState().kinds[o.kind]?.surface;
797
801
  },
798
802
  listKinds() {
799
- return Object.values(i.getState().kinds).sort(x);
803
+ return Object.values(n.getState().kinds).sort(O);
800
804
  },
801
805
  registerPresenter(o) {
802
- const a = i.getState();
806
+ const a = n.getState();
803
807
  if (a.presenters[o.id]) throw new Error(`Resource presenter already registered: ${o.id}`);
804
808
  const c = {
805
809
  ...o,
806
810
  priority: o.priority ?? 0
807
811
  };
808
- return i.setState({
812
+ return n.setState({
809
813
  ...a,
810
814
  presenters: {
811
815
  ...a.presenters,
812
816
  [o.id]: c
813
817
  }
814
818
  }, !1, "registerPresenter"), m(() => {
815
- const l = i.getState();
816
- if (l.presenters[o.id] !== c) return;
819
+ const d = n.getState();
820
+ if (d.presenters[o.id] !== c) return;
817
821
  const {
818
822
  [o.id]: g,
819
823
  ...u
820
- } = l.presenters;
821
- i.setState({
822
- ...l,
824
+ } = d.presenters;
825
+ n.setState({
826
+ ...d,
823
827
  presenters: u
824
828
  }, !1, "unregisterPresenter");
825
829
  });
826
830
  },
827
831
  listPresenters() {
828
- return T(Object.values(i.getState().presenters));
832
+ return T(Object.values(n.getState().presenters));
829
833
  },
830
834
  registerProvider(o) {
831
- const a = i.getState();
835
+ const a = n.getState();
832
836
  if (a.providers[o.id]) throw new Error(`Resource provider already registered: ${o.id}`);
833
- return i.setState({
837
+ return n.setState({
834
838
  ...a,
835
839
  providers: {
836
840
  ...a.providers,
837
841
  [o.id]: o
838
842
  }
839
843
  }, !1, "registerProvider"), m(() => {
840
- const c = i.getState();
844
+ const c = n.getState();
841
845
  if (c.providers[o.id] !== o) return;
842
846
  const {
843
- [o.id]: l,
847
+ [o.id]: d,
844
848
  ...g
845
849
  } = c.providers;
846
- i.setState({
850
+ n.setState({
847
851
  ...c,
848
852
  providers: g
849
853
  }, !1, "unregisterProvider");
850
854
  });
851
855
  },
852
856
  listProviders() {
853
- return Object.values(i.getState().providers);
857
+ return Object.values(n.getState().providers);
854
858
  },
855
859
  listResources(o) {
856
860
  const a = {
857
861
  primary: e.getPrimary?.()
858
862
  }, c = [];
859
- for (const l of Object.values(i.getState().providers))
860
- c.push(...l.list(o, a));
863
+ for (const d of Object.values(n.getState().providers))
864
+ c.push(...d.list(o, a));
861
865
  return c;
862
866
  },
863
867
  registerHierarchyProvider(o) {
864
- const a = i.getState();
868
+ const a = n.getState();
865
869
  if (a.hierarchyProviders[o.id])
866
870
  throw new Error(`Resource hierarchy provider already registered: ${o.id}`);
867
871
  const c = {
868
872
  ...o,
869
873
  priority: o.priority ?? 0
870
874
  };
871
- return i.setState({
875
+ return n.setState({
872
876
  ...a,
873
877
  hierarchyProviders: {
874
878
  ...a.hierarchyProviders,
875
879
  [o.id]: c
876
880
  }
877
881
  }, !1, "registerHierarchyProvider"), m(() => {
878
- const l = i.getState();
879
- if (l.hierarchyProviders[o.id] !== c) return;
882
+ const d = n.getState();
883
+ if (d.hierarchyProviders[o.id] !== c) return;
880
884
  const {
881
885
  [o.id]: g,
882
886
  ...u
883
- } = l.hierarchyProviders;
884
- i.setState({
885
- ...l,
887
+ } = d.hierarchyProviders;
888
+ n.setState({
889
+ ...d,
886
890
  hierarchyProviders: u
887
891
  }, !1, "unregisterHierarchyProvider");
888
892
  });
889
893
  },
890
894
  listHierarchyProviders() {
891
- return q(Object.values(i.getState().hierarchyProviders));
895
+ return q(Object.values(n.getState().hierarchyProviders));
892
896
  },
893
897
  walkHierarchy(o) {
894
- return o ? he(Object.values(i.getState().hierarchyProviders), o, (a) => {
898
+ return o ? he(Object.values(n.getState().hierarchyProviders), o, (a) => {
895
899
  for (const c of t) c(a);
896
900
  }) : [];
897
901
  },
@@ -904,124 +908,124 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
904
908
  return s > 0;
905
909
  },
906
910
  async openResource(o, a = {}) {
907
- const c = i.getState();
911
+ const c = n.getState();
908
912
  if (!c.kinds[o.kind]) throw new Error(`Unknown resource kind: ${o.kind}`);
909
- const l = T(Object.values(c.presenters)).find((u) => u.canOpen(o));
910
- if (!l) throw new Error(`No presenter registered for resource kind: ${o.kind}`);
913
+ const d = T(Object.values(c.presenters)).find((u) => u.canOpen(o));
914
+ if (!d) throw new Error(`No presenter registered for resource kind: ${o.kind}`);
911
915
  s += 1;
912
916
  let g;
913
917
  try {
914
- const u = l.open(o, a);
915
- g = ye(u) ? await u : u, g = r?.(g) ?? g;
918
+ const u = d.open(o, a);
919
+ g = ye(u) ? await u : u, g = r?.(g) ?? g, d.afterOpen?.(o, g, a);
916
920
  } finally {
917
921
  s -= 1;
918
922
  }
919
- for (const u of n) u(o);
923
+ for (const u of i) u(o);
920
924
  return g;
921
925
  },
922
926
  onDidOpenResource(o) {
923
- return n.add(o), m(() => {
924
- n.delete(o);
927
+ return i.add(o), m(() => {
928
+ i.delete(o);
925
929
  });
926
930
  }
927
931
  };
928
- }, pe = (e) => e.replace(/^['"]|['"]$/g, ""), ke = (e, n) => {
929
- const t = n.trim();
932
+ }, pe = (e) => e.replace(/^['"]|['"]$/g, ""), ke = (e, i) => {
933
+ const t = i.trim();
930
934
  if (t.length === 0) return !0;
931
935
  const r = t.match(/^([A-Za-z0-9_.-]+)\s*(==|!=)\s*(.+)$/);
932
936
  if (r) {
933
- const [, s, i, o] = r, a = e[s ?? ""], c = pe(o ?? "");
934
- return i === "==" ? String(a) === c : String(a) !== c;
937
+ const [, s, n, o] = r, a = e[s ?? ""], c = pe(o ?? "");
938
+ return n === "==" ? String(a) === c : String(a) !== c;
935
939
  }
936
940
  return t.startsWith("!") ? !e[t.slice(1)] : !!e[t];
937
- }, We = (e, n) => n ? n.split("||").some((t) => t.split("&&").every((r) => ke(e, r))) : !0, lt = () => {
941
+ }, We = (e, i) => i ? i.split("||").some((t) => t.split("&&").every((r) => ke(e, r))) : !0, lt = () => {
938
942
  const e = W({
939
943
  name: "workbench.context",
940
944
  initialState: {
941
945
  values: {}
942
946
  }
943
947
  });
944
- let n = {};
948
+ let i = {};
945
949
  const t = /* @__PURE__ */ new Map(), r = () => {
946
- const i = {
947
- ...n
950
+ const n = {
951
+ ...i
948
952
  };
949
- for (const o of t.values()) Object.assign(i, o);
950
- return i;
951
- }, s = (i) => {
953
+ for (const o of t.values()) Object.assign(n, o);
954
+ return n;
955
+ }, s = (n) => {
952
956
  e.setState({
953
957
  values: r()
954
- }, !1, i);
958
+ }, !1, n);
955
959
  };
956
960
  return {
957
961
  store: e,
958
- set(i, o) {
959
- n[i] !== o && (n = {
960
- ...n,
961
- [i]: o
962
+ set(n, o) {
963
+ i[n] !== o && (i = {
964
+ ...i,
965
+ [n]: o
962
966
  }, s("setContextKey"));
963
967
  },
964
- get(i) {
965
- return e.getState().values[i];
968
+ get(n) {
969
+ return e.getState().values[n];
966
970
  },
967
- delete(i) {
968
- if (!(i in n)) return;
971
+ delete(n) {
972
+ if (!(n in i)) return;
969
973
  const {
970
- [i]: o,
974
+ [n]: o,
971
975
  ...a
972
- } = n;
973
- n = a, s("deleteContextKey");
976
+ } = i;
977
+ i = a, s("deleteContextKey");
974
978
  },
975
- createScope(i) {
976
- t.set(i, t.get(i) ?? {});
979
+ createScope(n) {
980
+ t.set(n, t.get(n) ?? {});
977
981
  let o = !1;
978
982
  const a = () => {
979
- if (o) throw new Error(`Context key scope disposed: ${i}`);
983
+ if (o) throw new Error(`Context key scope disposed: ${n}`);
980
984
  };
981
985
  return {
982
- ownerId: i,
983
- set(c, l) {
986
+ ownerId: n,
987
+ set(c, d) {
984
988
  a();
985
- const g = t.get(i) ?? {};
986
- g[c] !== l && (t.set(i, {
989
+ const g = t.get(n) ?? {};
990
+ g[c] !== d && (t.set(n, {
987
991
  ...g,
988
- [c]: l
992
+ [c]: d
989
993
  }), s("setScopedContextKey"));
990
994
  },
991
995
  get(c) {
992
- return a(), t.get(i)?.[c];
996
+ return a(), t.get(n)?.[c];
993
997
  },
994
998
  delete(c) {
995
999
  a();
996
- const l = t.get(i);
997
- if (!l || !(c in l)) return;
1000
+ const d = t.get(n);
1001
+ if (!d || !(c in d)) return;
998
1002
  const {
999
1003
  [c]: g,
1000
1004
  ...u
1001
- } = l;
1002
- t.set(i, u), s("deleteScopedContextKey");
1005
+ } = d;
1006
+ t.set(n, u), s("deleteScopedContextKey");
1003
1007
  },
1004
1008
  dispose() {
1005
- o || (o = !0, t.delete(i) && s("disposeContextKeyScope"));
1009
+ o || (o = !0, t.delete(n) && s("disposeContextKeyScope"));
1006
1010
  }
1007
1011
  };
1008
1012
  },
1009
- deleteOwner(i) {
1010
- t.delete(i) && s("deleteContextKeyOwner");
1013
+ deleteOwner(n) {
1014
+ t.delete(n) && s("deleteContextKeyOwner");
1011
1015
  },
1012
1016
  snapshot() {
1013
1017
  return {
1014
1018
  ...e.getState().values
1015
1019
  };
1016
1020
  },
1017
- matches(i) {
1018
- return We(e.getState().values, i);
1021
+ matches(n) {
1022
+ return We(e.getState().values, n);
1019
1023
  }
1020
1024
  };
1021
- }, Pe = "sidenav", Re = (e, n, t) => {
1022
- e.panels.setOpen(n, t), e.layout.setRegionVisible(n, t);
1023
- }, Me = (e, n) => {
1024
- Re(e, n, !e.panels.isOpen(n));
1025
+ }, Pe = "sidenav", Re = (e, i, t) => {
1026
+ e.panels.setOpen(i, t), e.layout.setRegionVisible(i, t);
1027
+ }, Me = (e, i) => {
1028
+ Re(e, i, !e.panels.isOpen(i));
1025
1029
  }, Le = [{
1026
1030
  id: "workbench.toggleCommandPalette",
1027
1031
  label: "Toggle Command Palette",
@@ -1066,44 +1070,44 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
1066
1070
  icon: "PanelLeft",
1067
1071
  keybinding: "Mod+B",
1068
1072
  execute: (e) => Me(e, Pe)
1069
- }], K = "workbench.action.switchMode", gt = (e) => {
1070
- if (e.kind !== "command" || e.commandId !== K || !e.args || typeof e.args != "object") return;
1071
- const n = "modeId" in e.args ? e.args.modeId : void 0;
1072
- return typeof n == "string" && n.trim().length > 0 ? n : void 0;
1073
+ }], j = "workbench.action.switchMode", gt = (e) => {
1074
+ if (e.kind !== "command" || e.commandId !== j || !e.args || typeof e.args != "object") return;
1075
+ const i = "modeId" in e.args ? e.args.modeId : void 0;
1076
+ return typeof i == "string" && i.trim().length > 0 ? i : void 0;
1073
1077
  }, ut = (e) => {
1074
- for (const n of Le)
1078
+ for (const i of Le)
1075
1079
  e.commands.registerCommand({
1076
- id: n.id,
1077
- label: n.label,
1080
+ id: i.id,
1081
+ label: i.label,
1078
1082
  category: "Workbench",
1079
- icon: n.icon,
1083
+ icon: i.icon,
1080
1084
  when: "!inputFocus"
1081
1085
  }, {
1082
- execute: () => n.execute(e)
1086
+ execute: () => i.execute(e)
1083
1087
  }), e.keybindings.registerKeybinding({
1084
- commandId: n.id,
1085
- keybinding: n.keybinding,
1088
+ commandId: i.id,
1089
+ keybinding: i.keybinding,
1086
1090
  when: "!inputFocus"
1087
1091
  }), e.layout.registerMenuItem($, {
1088
- commandId: n.id,
1092
+ commandId: i.id,
1089
1093
  group: "Workbench"
1090
1094
  });
1091
1095
  e.commands.registerCommand({
1092
- id: K,
1096
+ id: j,
1093
1097
  label: "Switch Mode",
1094
1098
  category: "Workbench",
1095
1099
  icon: "PanelTop",
1096
1100
  when: "!inputFocus"
1097
1101
  }, {
1098
- execute: async (n) => {
1099
- if (!n?.modeId) {
1102
+ execute: async (i) => {
1103
+ if (!i?.modeId) {
1100
1104
  e.commandPalette.open({
1101
1105
  view: "mode"
1102
1106
  });
1103
1107
  return;
1104
1108
  }
1105
1109
  const t = await e.navigator.open({
1106
- modeId: n.modeId
1110
+ modeId: i.modeId
1107
1111
  });
1108
1112
  !t.ok && t.code === "navigation_mode_missing" && e.notifications.show({
1109
1113
  level: "error",
@@ -1112,7 +1116,7 @@ const re = (e, n) => Object.is(e, n), W = (e) => {
1112
1116
  });
1113
1117
  }
1114
1118
  }), e.layout.registerMenuItem($, {
1115
- commandId: K,
1119
+ commandId: j,
1116
1120
  group: "Workbench"
1117
1121
  });
1118
1122
  };
@@ -1135,21 +1139,21 @@ export {
1135
1139
  me as P,
1136
1140
  we as Q,
1137
1141
  z as R,
1138
- K as S,
1142
+ j as S,
1139
1143
  Ve as T,
1140
1144
  Ne as U,
1141
1145
  V,
1142
1146
  Qe as W,
1143
1147
  ze as X,
1144
1148
  He as a,
1145
- x as b,
1149
+ O as b,
1146
1150
  W as c,
1147
1151
  F as d,
1148
1152
  $e as e,
1149
- je as f,
1150
- j as g,
1153
+ Ke as f,
1154
+ K as g,
1151
1155
  k as h,
1152
- Ke as i,
1156
+ je as i,
1153
1157
  Ee as j,
1154
1158
  De as k,
1155
1159
  se as l,
@@ -1164,8 +1168,8 @@ export {
1164
1168
  _e as u,
1165
1169
  Ye as v,
1166
1170
  qe as w,
1167
- nt as x,
1168
- it as y,
1171
+ it as x,
1172
+ nt as y,
1169
1173
  lt as z
1170
1174
  };
1171
- //# sourceMappingURL=workbench-built-ins-BtgeB274.js.map
1175
+ //# sourceMappingURL=workbench-built-ins-BncLJfQA.js.map