@cratis/stage.runtime 4.216.1 → 4.218.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.
package/dist/src/index.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import "./app.css";
2
2
  import { t as e } from "../stageDarkSelector-DAwb43-P.js";
3
3
  import { createContext as t, createElement as n, useCallback as r, useContext as i, useEffect as a, useId as o, useLayoutEffect as s, useMemo as c, useRef as l, useState as u } from "react";
4
- import { ColorScheme as d, DestinationKind as f, FormGenerationMode as p, FormWidthUnit as m, InteractionActionKind as h, InteractionTriggerKind as g, LogoKind as _, PackageKind as v, componentIconLibrary as y } from "@cratis/scene.model";
5
- import { InteractionStop as b, ShellDiagnosticCode as x, ShellOrigin as S, commandResponseContext as C, createBindingResolver as w, hostProfilePackages as T, resolveArgumentSource as E, resolveBehaviors as D, resolveStringsInElement as O, resolveStringsValue as k, runActions as ee, runBindings as A, validateBindingExpression as te, validateResponseBindings as j } from "@cratis/scene.engine";
6
- import { CoreSliceDialog as M, CoreToolbarItem as ne, IconAdapterProvider as re, InteractionScope as ie, SceneElementView as N, SceneNavigationContextInternal as ae, SliceCommandFieldsProvider as oe, SliceDialogView as se, SliceInvokerProvider as P, attachmentFor as ce, componentRegistryKey as le, coreComponents as ue, createBrowserDispatcher as de, createBrowserSceneHistory as fe, createHashSceneHistory as pe, createIconAdapterRegistry as me, sliceDialogParameters as he, useInteractionScope as ge, useOptionalSceneNavigation as _e, useSceneNavigation as ve, useSceneOutlets as ye, useSceneTheme as be } from "@cratis/scene.react";
7
- import { ApplicationHost as xe, ColorScheme as F, ComponentName as I, KanbanBoard as Se, LayoutThemeProvider as Ce, SlotName as L, blueprintPackageCatalog as we, composeApplicationScreen as Te, defaultBlueprintComponents as Ee, defaultBlueprintName as De, defaultBlueprintThemes as R, effectiveShellOf as Oe, externalComponent as z, galleryScreenTemplates as ke, layoutModes as Ae, menuThemes as je, navigationElement as Me, previewComponents as Ne, previewProfile as Pe, useLayoutConfig as Fe } from "@cratis/scene.blueprint.default";
4
+ import { BindingSourceKind as d, ColorScheme as f, DestinationKind as p, FormGenerationMode as m, FormWidthUnit as h, GuardOperator as g, InteractionActionKind as _, InteractionTriggerKind as v, LogoKind as y, PackageKind as b, componentIconLibrary as x } from "@cratis/scene.model";
5
+ import { InteractionStop as S, ShellDiagnosticCode as C, ShellOrigin as w, commandResponseContext as T, createBindingResolver as ee, hostProfilePackages as E, resolveArgumentSource as te, resolveBehaviors as D, resolveStringsInElement as O, resolveStringsValue as k, resolveSubjectReference as A, runActions as ne, runBindings as re, validateBindingExpression as ie, validateResponseBindings as ae } from "@cratis/scene.engine";
6
+ import { CoreSliceDialog as oe, CoreToolbarItem as j, IconAdapterProvider as se, InteractionScope as ce, SceneElementView as le, SceneNavigationContextInternal as M, SliceCommandFieldsProvider as ue, SliceDialogView as de, SliceInvokerProvider as fe, attachmentFor as pe, componentRegistryKey as me, coreComponents as he, createBrowserDispatcher as ge, createBrowserSceneHistory as _e, createHashSceneHistory as ve, createIconAdapterRegistry as ye, sliceDialogParameters as be, useInteractionScope as xe, useOptionalSceneNavigation as Se, useSceneNavigation as Ce, useSceneOutlets as we, useSceneTheme as Te } from "@cratis/scene.react";
7
+ import { ApplicationHost as Ee, ColorScheme as N, ComponentName as P, KanbanBoard as De, LayoutThemeProvider as Oe, SlotName as F, blueprintPackageCatalog as ke, composeApplicationScreen as Ae, defaultBlueprintComponents as je, defaultBlueprintName as Me, defaultBlueprintThemes as I, effectiveShellOf as Ne, externalComponent as L, galleryScreenTemplates as Pe, layoutModes as Fe, menuThemes as Ie, navigationElement as Le, previewComponents as Re, previewProfile as ze, useLayoutConfig as Be } from "@cratis/scene.blueprint.default";
8
8
  import "@cratis/components/tokens";
9
9
  import "@cratis/components/CommandForm/styles";
10
10
  import "@cratis/components/Dropdown/styles";
11
11
  import "@cratis/components/Common/styles";
12
12
  import "@cratis/components/Display/styles";
13
13
  import "@cratis/scene.blueprint.default/styles.css";
14
- import { ArcContext as Ie } from "@cratis/arc.react";
15
- import { ObservableQueryFor as Le, Paging as Re, QueryFor as ze } from "@cratis/arc/queries";
16
- import { resolveCommand as Be, resolveExactQuery as Ve } from "@cratis/scene.components";
17
- import { Fragment as He, jsx as B, jsxs as V } from "react/jsx-runtime";
18
- import { Button as H } from "@cratis/components/Common";
19
- import { Dialog as Ue } from "@cratis/components/Dialogs";
20
- import { Message as We } from "@cratis/components/Display";
21
- import { createPortal as Ge } from "react-dom";
22
- import { DateOnly as Ke, Guid as qe } from "@cratis/fundamentals";
23
- import { Command as Je } from "@cratis/arc/commands";
24
- import { CommandForm as Ye, asCommandFormField as Xe, withCommandFormFieldBinding as Ze } from "@cratis/arc.react/commands";
25
- import { CalendarField as Qe, CheckboxField as $e, DropdownField as et, InputTextField as tt, NumberField as nt } from "@cratis/components/CommandForm";
26
- import { cratisComponents as rt, cratisComponentsPackageManifest as it } from "@cratis/scene.components/runtime";
27
- import { dynamicIconImports as at } from "lucide-react/dynamic";
14
+ import { ArcContext as Ve } from "@cratis/arc.react";
15
+ import { ObservableQueryFor as He, Paging as Ue, QueryFor as We } from "@cratis/arc/queries";
16
+ import { resolveCommand as Ge, resolveExactQuery as Ke } from "@cratis/scene.components";
17
+ import { Command as qe } from "@cratis/arc/commands";
18
+ import { DateOnly as Je, Guid as Ye } from "@cratis/fundamentals";
19
+ import { Fragment as Xe, jsx as R, jsxs as z } from "react/jsx-runtime";
20
+ import { Button as B } from "@cratis/components/Common";
21
+ import { Dialog as Ze } from "@cratis/components/Dialogs";
22
+ import { Message as Qe } from "@cratis/components/Display";
23
+ import { createPortal as $e } from "react-dom";
24
+ import { CommandForm as et, asCommandFormField as tt, withCommandFormFieldBinding as nt } from "@cratis/arc.react/commands";
25
+ import { CalendarField as rt, CheckboxField as it, DropdownField as at, InputTextField as ot, NumberField as st } from "@cratis/components/CommandForm";
26
+ import { cratisComponents as ct, cratisComponentsPackageManifest as lt } from "@cratis/scene.components/runtime";
27
+ import { dynamicIconImports as ut } from "lucide-react/dynamic";
28
28
  // src/stageSource.ts
29
- function ot(e) {
29
+ function dt(e) {
30
30
  return {
31
31
  scene: async () => e.scene,
32
32
  routes: async () => e.routes,
@@ -34,23 +34,23 @@ function ot(e) {
34
34
  strings: async (t) => e.strings[t] ?? {}
35
35
  };
36
36
  }
37
- var st = {
37
+ var ft = {
38
38
  scene: "stage/scene",
39
39
  routes: "stage/routes",
40
40
  locales: "stage/locales",
41
41
  strings: (e) => `stage/strings/${encodeURIComponent(e)}`
42
- }, ct = t(void 0);
43
- function lt({ source: e, children: t }) {
44
- return n(ct.Provider, { value: e }, t);
42
+ }, pt = t(void 0);
43
+ function mt({ source: e, children: t }) {
44
+ return n(pt.Provider, { value: e }, t);
45
45
  }
46
- function ut() {
47
- let e = i(ct);
46
+ function ht() {
47
+ let e = i(pt);
48
48
  if (!e) throw Error("A StageSourceProvider is required to render a Stage application.");
49
49
  return e;
50
50
  }
51
- st.routes;
52
- function dt() {
53
- let e = ut(), [t, n] = u({
51
+ ft.routes;
52
+ function gt() {
53
+ let e = ht(), [t, n] = u({
54
54
  routes: void 0,
55
55
  ready: !1
56
56
  });
@@ -70,24 +70,24 @@ function dt() {
70
70
  }, [e]), t;
71
71
  }
72
72
  // src/applyQueryChangeSet.ts
73
- function ft(e) {
73
+ function _t(e) {
74
74
  return typeof e == "object" && e && "id" in e ? e.id : void 0;
75
75
  }
76
- function pt(e) {
76
+ function vt(e) {
77
77
  if (typeof e != "object" || !e) return e;
78
78
  let t = e.toString();
79
79
  return t === "[object Object]" ? JSON.stringify(e) : t;
80
80
  }
81
- function mt(e, t) {
82
- return e === t ? !0 : e == null || t == null ? !1 : typeof e == "object" && "equals" in e && typeof e.equals == "function" ? e.equals(t) : typeof t == "object" && "equals" in t && typeof t.equals == "function" ? t.equals(e) : pt(e) === pt(t);
81
+ function yt(e, t) {
82
+ return e === t ? !0 : e == null || t == null ? !1 : typeof e == "object" && "equals" in e && typeof e.equals == "function" ? e.equals(t) : typeof t == "object" && "equals" in t && typeof t.equals == "function" ? t.equals(e) : vt(e) === vt(t);
83
83
  }
84
- function ht(e, t) {
85
- if (t.removed.length > 0 ? ft(t.removed[0]) !== void 0 : t.replaced.length > 0) return [...e.filter((e) => !t.removed.some((t) => mt(ft(e), ft(t)))).map((e) => t.replaced.find((t) => mt(ft(t), ft(e))) ?? e), ...t.added];
84
+ function bt(e, t) {
85
+ if (t.removed.length > 0 ? _t(t.removed[0]) !== void 0 : t.replaced.length > 0) return [...e.filter((e) => !t.removed.some((t) => yt(_t(e), _t(t)))).map((e) => t.replaced.find((t) => yt(_t(t), _t(e))) ?? e), ...t.added];
86
86
  let n = new Set(t.removed.map((e) => JSON.stringify(e)));
87
87
  return [...e.filter((e) => !n.has(JSON.stringify(e))), ...t.added];
88
88
  }
89
89
  // src/hostedBasePath.ts
90
- function gt() {
90
+ function xt() {
91
91
  let e = globalThis.document?.baseURI ?? globalThis.location?.href;
92
92
  if (!e) return "";
93
93
  try {
@@ -96,125 +96,51 @@ function gt() {
96
96
  return "";
97
97
  }
98
98
  }
99
- function _t(e) {
100
- return e || gt();
99
+ function St(e) {
100
+ return e || xt();
101
101
  }
102
102
  // src/queryExecutor.ts
103
- var vt;
104
- function yt(e) {
105
- vt = e;
103
+ var Ct;
104
+ function wt(e) {
105
+ Ct = e;
106
106
  }
107
- function bt(e, t) {
108
- let n = Ve(e);
109
- return n === "ambiguous" && t && (n = Ve(`${e}:${t.replace(/^\//, "").split("?")[0]}`)), xt(n) ? n : t ? vt?.(t) : void 0;
107
+ function Tt(e, t) {
108
+ let n = Ke(e);
109
+ return n === "ambiguous" && t && (n = Ke(`${e}:${t.replace(/^\//, "").split("?")[0]}`)), Et(n) ? n : t ? Ct?.(t) : void 0;
110
110
  }
111
- function xt(e) {
112
- return typeof e == "function" && (e.prototype instanceof ze || e.prototype instanceof Le);
111
+ function Et(e) {
112
+ return typeof e == "function" && (e.prototype instanceof We || e.prototype instanceof He);
113
113
  }
114
- function St(e, t) {
115
- e.setMicroservice(t.microservice), e.setApiBasePath(_t(t.apiBasePath)), e.setOrigin(t.origin ?? ""), e.setHttpHeadersCallback(t.httpHeadersCallback ?? (() => ({}))), e.paging = Re.noPaging;
114
+ function Dt(e, t) {
115
+ e.setMicroservice(t.microservice), e.setApiBasePath(St(t.apiBasePath)), e.setOrigin(t.origin ?? ""), e.setHttpHeadersCallback(t.httpHeadersCallback ?? (() => ({}))), e.paging = Ue.noPaging;
116
116
  }
117
- function Ct(e, t, n) {
117
+ function Ot(e, t, n) {
118
118
  let r = new e();
119
- return St(r, n), r.perform(t);
119
+ return Dt(r, n), r.perform(t);
120
120
  }
121
- function wt(e, t, n, r) {
121
+ function kt(e, t, n, r) {
122
122
  let i = new e();
123
- if (i instanceof Le) return St(i, n), i.subscribe(r, t);
124
- }
125
- function Tt(e) {
126
- if (Ot(e)) return typeof e.subject == "string" ? e.subject : typeof e.path == "string" ? e.path : void 0;
127
- }
128
- var Et = "STAGE-SCENE-ACTION-001", Dt = "item.";
129
- function Ot(e) {
130
- return typeof e == "object" && !!e && !Array.isArray(e);
131
- }
132
- function kt(e, t) {
133
- let n = e;
134
- for (let e of t.split(".").filter(Boolean)) {
135
- if (!Ot(n)) return;
136
- n = n[e];
137
- }
138
- return n;
139
- }
140
- function At(e) {
141
- return e === null || [
142
- "string",
143
- "number",
144
- "boolean"
145
- ].includes(typeof e);
146
- }
147
- function jt(e, t) {
148
- if (typeof e == "number") return t[e];
149
- if (typeof e == "string") return t.find((t) => t.toLowerCase() === e.toLowerCase());
150
- }
151
- function Mt(e, t, n, r) {
152
- if (r !== void 0 && (t === "Equal" || t === "NotEqual")) {
153
- let i = jt(e, r), a = typeof n == "string" ? r.find((e) => e.toLowerCase() === n.toLowerCase()) : void 0;
154
- return i === void 0 || a === void 0 ? !1 : t === "Equal" ? i === a : i !== a;
155
- }
156
- switch (t) {
157
- case "Equal": return e != null && e === n;
158
- case "NotEqual": return e != null && e !== n;
159
- case "GreaterThan": return typeof e == "number" && typeof n == "number" && e > n;
160
- case "GreaterThanOrEqual": return typeof e == "number" && typeof n == "number" && e >= n;
161
- case "LessThan": return typeof e == "number" && typeof n == "number" && e < n;
162
- case "LessThanOrEqual": return typeof e == "number" && typeof n == "number" && e <= n;
163
- case "Contains": return typeof n == "string" && (typeof e == "string" || Array.isArray(e)) && e.includes(n);
164
- case "StartsWith": return typeof e == "string" && typeof n == "string" && e.startsWith(n);
165
- default: return;
166
- }
167
- }
168
- function Nt(e, t) {
169
- if (Ot(e)) {
170
- if (e.kind === "comparison") {
171
- let n = Tt(e.left);
172
- if (typeof n != "string" || !n.startsWith(Dt) || typeof e.operator != "string" || !At(e.right)) return;
173
- let r = Array.isArray(e.enumeration) && e.enumeration.every((e) => typeof e == "string") ? e.enumeration : void 0;
174
- return Mt(kt(t, n.slice(5)), e.operator, e.right, r);
175
- }
176
- if (e.kind === "logical") {
177
- let n = Nt(e.left, t), r = Nt(e.right, t);
178
- return n === void 0 || r === void 0 ? void 0 : e.operator === "And" ? n && r : e.operator === "Or" ? n || r : void 0;
179
- }
180
- }
181
- }
182
- function Pt(e) {
183
- return e.every((e) => Nt(e, {}) !== void 0);
184
- }
185
- function Ft(e, t) {
186
- if (Pt(e)) return e.findIndex((e) => Nt(e, t) === !0);
187
- }
188
- function It(e, t) {
189
- if (!Ot(e) || !Array.isArray(e.alternatives) || !Ot(t)) return;
190
- let n = Ft(e.alternatives, t);
191
- if (n !== void 0) {
192
- if (e.kind === "firstMatch" && typeof e.index == "number") return n === e.index;
193
- if (e.kind === "otherwise") return n === -1;
194
- }
195
- }
196
- function Lt(e, t) {
197
- if (e.startsWith(Dt) && Ot(t)) return kt(t, e.slice(5));
123
+ if (i instanceof He) return Dt(i, n), i.subscribe(r, t);
198
124
  }
199
125
  // src/stageSession.ts
200
- var Rt = "stage.session.";
201
- function zt(e) {
126
+ var At = "stage.session.";
127
+ function jt(e) {
202
128
  try {
203
129
  return globalThis.localStorage?.getItem(`stage.session.${e}`) || void 0;
204
130
  } catch {
205
131
  return;
206
132
  }
207
133
  }
208
- function Bt(e) {
209
- let t = zt(e);
134
+ function Mt(e) {
135
+ let t = jt(e);
210
136
  if (t) return t;
211
137
  let n = globalThis.crypto.randomUUID();
212
138
  try {
213
- globalThis.localStorage?.setItem(`${Rt}${e}`, n);
139
+ globalThis.localStorage?.setItem(`${At}${e}`, n);
214
140
  } catch {}
215
141
  return n;
216
142
  }
217
- function Vt() {
143
+ function Nt() {
218
144
  let e = {};
219
145
  try {
220
146
  let t = globalThis.localStorage;
@@ -227,8 +153,202 @@ function Vt() {
227
153
  } catch {}
228
154
  return e;
229
155
  }
156
+ // src/commandExecutor.ts
157
+ function V(e, t, n) {
158
+ for (let r of [
159
+ t,
160
+ n?.replace(/^\//, ""),
161
+ e
162
+ ]) {
163
+ if (!r) continue;
164
+ let t = Ge(r);
165
+ if (Pt(t) && !(r === e && n && new t().route.replace(/^\//, "") !== n.replace(/^\//, ""))) return t;
166
+ }
167
+ }
168
+ function Pt(e) {
169
+ return typeof e == "function" && e.prototype instanceof qe;
170
+ }
171
+ function Ft(e, t) {
172
+ return e.setApiBasePath(St(t)), e;
173
+ }
174
+ async function It(e, t, n) {
175
+ let r = V(e);
176
+ if (!r) return {
177
+ isSuccess: !1,
178
+ validationErrors: [],
179
+ messages: [`The modeled command “${e}” is not registered by this Stage.`]
180
+ };
181
+ let i = new r();
182
+ i.setMicroservice(n.microservice), i.setApiBasePath(St(n.apiBasePath)), i.setOrigin(n.origin ?? ""), i.setHttpHeadersCallback(n.httpHeadersCallback ?? (() => ({})));
183
+ for (let e of i.propertyDescriptors) Object.prototype.hasOwnProperty.call(t, e.name) && Reflect.set(i, e.name, t[e.name]);
184
+ return Lt(e, await i.execute());
185
+ }
186
+ function Lt(e, t) {
187
+ let n = t.isSuccess && t.isAuthorized && t.isValid && !t.hasExceptions, r = t.isValid ? [] : t.validationResults.flatMap((e) => (e.members.length > 0 ? e.members : [""]).map((t) => ({
188
+ member: t,
189
+ message: e.message
190
+ }))), i = n ? [] : [
191
+ ...t.validationResults.map((e) => e.message),
192
+ ...t.exceptionMessages,
193
+ ...t.isAuthorized ? [] : [t.authorizationFailureReason || `“${e}” was not accepted.`]
194
+ ];
195
+ return {
196
+ isSuccess: n,
197
+ response: n ? t.response : void 0,
198
+ validationErrors: r,
199
+ messages: n || i.length > 0 ? i : [`“${e}” was not accepted.`]
200
+ };
201
+ }
202
+ function Rt() {
203
+ let e = i(Ve);
204
+ return r((t, n) => It(t, n, e), [e]);
205
+ }
206
+ // src/stageNavigation.ts
207
+ function zt(e, t = {}) {
208
+ let n = new URLSearchParams(Object.entries(t).filter(([, e]) => e !== "")).toString();
209
+ return n ? `#/${encodeURIComponent(e)}?${n}` : `#/${encodeURIComponent(e)}`;
210
+ }
211
+ function H(e, t = {}) {
212
+ if (!globalThis.location) return;
213
+ if (Bt === "path") {
214
+ let n = Ht(e, t);
215
+ if (`${globalThis.location.pathname}${globalThis.location.search}` === n) return;
216
+ globalThis.history.pushState(null, "", n), globalThis.dispatchEvent(new PopStateEvent("popstate"));
217
+ return;
218
+ }
219
+ let n = zt(e, t);
220
+ globalThis.location.hash !== n && (globalThis.location.hash = n);
221
+ }
222
+ var Bt = "hash";
223
+ function Vt(e) {
224
+ Bt = e;
225
+ }
226
+ function Ht(e, t = {}) {
227
+ let n = new URLSearchParams(Object.entries(t).filter(([, e]) => e !== "")).toString();
228
+ return n ? `/${encodeURIComponent(e)}?${n}` : `/${encodeURIComponent(e)}`;
229
+ }
230
+ function Ut(e) {
231
+ return Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e != null && e !== "" && (typeof e != "object" || e instanceof Ye)).map(([e, t]) => [e, String(t)]));
232
+ }
233
+ // src/screenplayGuard.ts
234
+ function Wt(...[e, t, n]) {
235
+ let r = n.subject?.() ?? n.resolve({ path: "item" });
236
+ return re(e.map((e) => ({
237
+ ...e,
238
+ binding: qt(e.binding, r)
239
+ })), t, n);
240
+ }
241
+ function Gt(e, t) {
242
+ return Yt(e) ? e.kind === "logical" ? {
243
+ ...e,
244
+ left: Gt(e.left, t),
245
+ right: Gt(e.right, t)
246
+ } : e.kind !== "comparison" || e.operator !== g.Contains || typeof Jt(e.left, t) == "string" && typeof e.right == "string" ? e : {
247
+ ...e,
248
+ left: { subject: "" }
249
+ } : e;
250
+ }
251
+ function Kt(e, t) {
252
+ return Array.isArray(e) ? e.map((e) => Yt(e) ? {
253
+ ...e,
254
+ condition: Gt(e.condition, t)
255
+ } : e) : e;
256
+ }
257
+ function qt(e, t) {
258
+ return {
259
+ ...e,
260
+ alternatives: Kt(e.alternatives, t)
261
+ };
262
+ }
263
+ function Jt(e, t) {
264
+ return Yt(e) && typeof e.subject == "string" ? A({ subject: e.subject }, t) : void 0;
265
+ }
266
+ function Yt(e) {
267
+ return typeof e == "object" && !!e && !Array.isArray(e);
268
+ }
230
269
  // src/stageData.tsx
231
- var Ht = "cratis.stage.data-changed", Ut = t(() => () => void 0), Wt = t({
270
+ var Xt = "cratis.stage.data-changed", Zt = t(() => () => void 0), Qt = he["core:guarded-action"];
271
+ function $t(e) {
272
+ return e.componentName === "core:guarded-action" || e.componentName === "core:action" && Array.isArray(e.properties.alternatives);
273
+ }
274
+ function en(e) {
275
+ let { dispatcher: t, attachments: n } = tn(), { item: r, refused: i, error: a } = nn(e.element);
276
+ if (i) return /* @__PURE__ */ z("span", {
277
+ role: "alert",
278
+ children: ["STAGE-SCENE-ACTION-001: The action's data subject or command scope is unavailable.", a]
279
+ });
280
+ let o = {
281
+ kind: d.Literal,
282
+ path: "",
283
+ value: r
284
+ };
285
+ return /* @__PURE__ */ R(ce, {
286
+ dispatcher: t,
287
+ attachments: n,
288
+ children: /* @__PURE__ */ R(Qt, {
289
+ ...e,
290
+ slots: e.slots ?? {},
291
+ element: {
292
+ ...e.element,
293
+ properties: {
294
+ ...e.element.properties,
295
+ item: o,
296
+ alternatives: qt({ alternatives: e.element.properties.alternatives }, r).alternatives
297
+ }
298
+ }
299
+ })
300
+ });
301
+ }
302
+ function tn() {
303
+ let e = U(), t = xe(), n = Rt();
304
+ return {
305
+ dispatcher: t?.dispatcher ?? ge({
306
+ executeCommand: async (t, r) => {
307
+ let i = await n(t, r);
308
+ return i.isSuccess && e.refreshAfterCommand(), {
309
+ isSuccess: i.isSuccess,
310
+ response: i.response,
311
+ validationErrors: i.validationErrors,
312
+ exceptionMessages: i.messages
313
+ };
314
+ },
315
+ navigate: (e, t) => H(e, Object.fromEntries(Object.entries(t).map(([e, t]) => [e, String(t)])))
316
+ }),
317
+ attachments: t?.attachments ?? []
318
+ };
319
+ }
320
+ function nn(e) {
321
+ let t = U(), n = rn(e, t), r = W(n), i = e.properties.itemSelection === !0, a = i ? Object.values(t.selections).filter((e) => e !== void 0) : r.rows;
322
+ return {
323
+ item: a.length === 1 ? a[0] : void 0,
324
+ refused: !cn(n) && !i || !!r.error,
325
+ error: r.error
326
+ };
327
+ }
328
+ function rn(e, t) {
329
+ let n = e.properties, r = an(n.itemQuery), i = t.routes?.queries?.[r ?? ""] ?? an(n.itemRoute), a = K(n.itemArguments) ? n.itemArguments : {}, o = Object.fromEntries(Object.entries(a).map(([e, n]) => [e, on(n, t.resolveBinding)]));
330
+ return {
331
+ scope: `${e.id}:item`,
332
+ name: r,
333
+ route: i,
334
+ arguments: o,
335
+ ready: n.itemSelection !== !0 && Object.values(o).every(sn),
336
+ publish: !1
337
+ };
338
+ }
339
+ function an(e) {
340
+ return typeof e == "string" ? e : void 0;
341
+ }
342
+ function on(e, t) {
343
+ return K(e) && typeof e.path == "string" ? t({ path: e.path }) : e;
344
+ }
345
+ function sn(e) {
346
+ return e != null && e !== "";
347
+ }
348
+ function cn(e) {
349
+ return !!(e.name || e.route);
350
+ }
351
+ var ln = t({
232
352
  locale: "",
233
353
  locales: [],
234
354
  screen: "",
@@ -253,16 +373,16 @@ var Ht = "cratis.stage.data-changed", Ut = t(() => () => void 0), Wt = t({
253
373
  resolveArgument: () => void 0,
254
374
  registerQueryResult: () => void 0,
255
375
  refreshVersion: 0
256
- }), Gt = [
376
+ }), un = [
257
377
  500,
258
378
  1500,
259
379
  3e3,
260
380
  6e3,
261
381
  1e4,
262
382
  15e3
263
- ], Kt = {};
264
- function qt({ routes: e, routesReady: t = !0, parameters: n = Kt, locale: i, locales: o, screen: s, children: l }) {
265
- let [d, f] = u({}), [p, m] = u(0), [h, g] = u({}), [_, v] = u(), [y, b] = u({}), [x, S] = u({}), [C, T] = u({}), [D, O] = u({ version: 0 }), k = c(() => rn(C), [C]), ee = r((e, t) => {
383
+ ], dn = {};
384
+ function fn({ routes: e, routesReady: t = !0, parameters: n = dn, locale: i, locales: o, screen: s, children: l }) {
385
+ let [d, f] = u({}), [p, m] = u(0), [h, g] = u({}), [_, v] = u(), [y, b] = u({}), [x, S] = u({}), [C, w] = u({}), [T, E] = u({ version: 0 }), D = c(() => Sn(C), [C]), O = r((e, t) => {
266
386
  f((n) => {
267
387
  if (!t) {
268
388
  let { [e]: t, ...r } = n;
@@ -273,148 +393,148 @@ function qt({ routes: e, routesReady: t = !0, parameters: n = Kt, locale: i, loc
273
393
  [e]: t
274
394
  };
275
395
  });
276
- }, []), A = n, j = c(() => Vt(), [p]), M = c(() => ({
396
+ }, []), k = n, A = c(() => Nt(), [p]), ne = c(() => ({
277
397
  name: s,
278
398
  keys: {
279
- ...j,
399
+ ...A,
280
400
  ...n
281
401
  }
282
402
  }), [
283
403
  n,
284
404
  s,
285
- j
286
- ]), ne = r((e, t) => {
405
+ A
406
+ ]), re = r((e, t) => {
287
407
  g((n) => ({
288
408
  ...n,
289
409
  [e]: t
290
410
  })), v(t ? e : (t) => t === e ? void 0 : t);
291
- }, []), re = r((e) => {
411
+ }, []), ae = r((e) => {
292
412
  g((t) => ({
293
413
  ...t,
294
414
  [e]: void 0
295
415
  })), v((t) => t === e ? void 0 : t);
296
- }, []), ie = r((e, t, n) => {
416
+ }, []), oe = r((e, t, n) => {
297
417
  S((r) => {
298
- let i = un(r[e]) ? r[e] : {};
418
+ let i = K(r[e]) ? r[e] : {};
299
419
  return {
300
420
  ...r,
301
- [e]: nn(i, t.split(".").filter(Boolean), n)
421
+ [e]: xn(i, t.split(".").filter(Boolean), n)
302
422
  };
303
423
  });
304
- }, []), N = r((e) => O((t) => ({
424
+ }, []), j = r((e) => E((t) => ({
305
425
  query: e,
306
426
  version: t.version + 1
307
- })), []), { settling: ae, refreshAfterCommand: oe, registerAwaitingQuery: se } = Jt(N, m);
427
+ })), []), { settling: se, refreshAfterCommand: ce, registerAwaitingQuery: le } = pn(j, m);
308
428
  a(() => {
309
- let e = () => N(), t = (e) => N(e.detail?.query);
310
- return globalThis.addEventListener(Ht, e), globalThis.addEventListener("cratis.scene.refresh", t), () => {
311
- globalThis.removeEventListener(Ht, e), globalThis.removeEventListener("cratis.scene.refresh", t);
429
+ let e = () => j(), t = (e) => j(e.detail?.query);
430
+ return globalThis.addEventListener(Xt, e), globalThis.addEventListener("cratis.scene.refresh", t), () => {
431
+ globalThis.removeEventListener(Xt, e), globalThis.removeEventListener("cratis.scene.refresh", t);
312
432
  };
313
- }, [N]);
314
- let P = _ ? h[_] : void 0, ce = r((e) => {
315
- if (e === void 0 || typeof e != "string" && e.path === "$guard") return;
316
- if (typeof e == "string") return an(e, P, h, d, y, A, M, i, o);
317
- let t = $t(P, d, y, {
318
- ...k,
433
+ }, [j]);
434
+ let M = _ ? h[_] : void 0, ue = r((e) => {
435
+ if (e === void 0) return;
436
+ if (typeof e == "string") return Cn(e, M, h, d, y, k, ne, i, o);
437
+ let t = vn(M, d, y, {
438
+ ...D,
319
439
  ...x
320
440
  }, h);
321
- if (!e.kind && e.path.startsWith("component.")) return E(e.path, t);
322
- if (!e.kind) return an(e.path, P, h, d, y, A, M, i, o);
323
- let n = te(e, t);
324
- return n.length > 0 && console.warn(`Scene binding could not be resolved: ${n.map((e) => `${e.code}:${e.message}`).join("; ")}`), w(t)(e);
441
+ if (!e.kind && e.path.startsWith("component.")) return te(e.path, t);
442
+ if (!e.kind) return Cn(e.path, M, h, d, y, k, ne, i, o);
443
+ let n = ie(e, t);
444
+ return n.length > 0 && console.warn(`Scene binding could not be resolved: ${n.map((e) => `${e.code}:${e.message}`).join("; ")}`), ee(t)(e);
325
445
  }, [
326
446
  x,
327
447
  i,
328
448
  o,
329
449
  y,
330
- A,
331
450
  k,
451
+ D,
332
452
  d,
453
+ ne,
333
454
  M,
334
- P,
335
455
  h
336
- ]), le = r((e) => e ? E(e, $t(P, d, y, {
337
- ...k,
456
+ ]), de = r((e) => e ? te(e, vn(M, d, y, {
457
+ ...D,
338
458
  ...x
339
459
  }, h)) : void 0, [
340
460
  x,
341
461
  y,
342
- k,
462
+ D,
343
463
  d,
344
- P,
464
+ M,
345
465
  h
346
- ]), ue = r((e, t) => T((n) => ({
466
+ ]), fe = r((e, t) => w((n) => ({
347
467
  ...n,
348
468
  [e]: t
349
- })), []), de = r((e) => T((t) => {
469
+ })), []), pe = r((e) => w((t) => {
350
470
  if (!Object.prototype.hasOwnProperty.call(t, e)) return t;
351
471
  let n = { ...t };
352
472
  return delete n[e], n;
353
- }), []), fe = c(() => $t(void 0, d, {}, {}, {}).queryResults, [d]), pe = c(() => ({
473
+ }), []), me = c(() => vn(void 0, d, {}, {}, {}).queryResults, [d]), he = c(() => ({
354
474
  locale: i,
355
475
  locales: o,
356
476
  screen: s,
357
477
  routes: e,
358
478
  routesReady: t,
359
- parameters: A,
360
- session: j,
479
+ parameters: k,
480
+ session: A,
361
481
  queries: d,
362
- selected: P,
482
+ selected: M,
363
483
  selections: h,
364
- selectRow: ne,
365
- clearSelection: re,
366
- setState: (e, t) => b((n) => nn(n, e.split(".").filter(Boolean), t)),
367
- setComponentOutput: ie,
368
- publishComponentOutputs: ue,
369
- withdrawComponentOutputs: de,
370
- queryResults: fe,
371
- refreshQuery: N,
372
- refreshAfterCommand: oe,
373
- settling: ae,
374
- resolveBinding: ce,
375
- resolveArgument: le,
376
- registerQueryResult: ee,
377
- refreshVersion: D.version,
378
- refreshQueryName: D.query
484
+ selectRow: re,
485
+ clearSelection: ae,
486
+ setState: (e, t) => b((n) => xn(n, e.split(".").filter(Boolean), t)),
487
+ setComponentOutput: oe,
488
+ publishComponentOutputs: fe,
489
+ withdrawComponentOutputs: pe,
490
+ queryResults: me,
491
+ refreshQuery: j,
492
+ refreshAfterCommand: ce,
493
+ settling: se,
494
+ resolveBinding: ue,
495
+ resolveArgument: de,
496
+ registerQueryResult: O,
497
+ refreshVersion: T.version,
498
+ refreshQueryName: T.query
379
499
  }), [
380
- re,
500
+ ae,
381
501
  i,
382
502
  o,
383
503
  d,
384
- oe,
385
- ae,
386
- N,
387
- D.query,
388
- D.version,
389
- ee,
390
- ue,
391
- de,
392
- fe,
393
- le,
394
504
  ce,
505
+ se,
506
+ j,
507
+ T.query,
508
+ T.version,
509
+ O,
510
+ fe,
511
+ pe,
512
+ me,
513
+ de,
514
+ ue,
395
515
  e,
396
516
  t,
517
+ k,
397
518
  A,
398
- j,
399
519
  s,
400
- ne,
401
- P,
520
+ re,
521
+ M,
402
522
  h,
403
- ie
523
+ oe
404
524
  ]);
405
- return /* @__PURE__ */ B(Wt.Provider, {
406
- value: pe,
407
- children: /* @__PURE__ */ B(Ut.Provider, {
408
- value: se,
525
+ return /* @__PURE__ */ R(ln.Provider, {
526
+ value: he,
527
+ children: /* @__PURE__ */ R(Zt.Provider, {
528
+ value: le,
409
529
  children: l
410
530
  })
411
531
  });
412
532
  }
413
- function Jt(e, t) {
533
+ function pn(e, t) {
414
534
  let n = l([]), i = l(0), o = l(0), s = l(/* @__PURE__ */ new Set()), [c, d] = u(!1), f = r(() => (o.current += 1, () => {
415
535
  --o.current, o.current === 0 && s.current.forEach((e) => e());
416
536
  }), []), p = r(() => {
417
- t((e) => e + 1), e(), i.current += 1, d(!0), n.current.push(...Yt(e, s.current, () => {
537
+ t((e) => e + 1), e(), i.current += 1, d(!0), n.current.push(...mn(e, s.current, () => {
418
538
  --i.current, i.current === 0 && d(!1);
419
539
  }, () => o.current > 0));
420
540
  }, [e, t]);
@@ -424,20 +544,20 @@ function Jt(e, t) {
424
544
  registerAwaitingQuery: f
425
545
  };
426
546
  }
427
- function Yt(e, t, n, r) {
547
+ function mn(e, t, n, r) {
428
548
  let i = [], a = () => {
429
549
  i.forEach(clearTimeout), t.delete(a), n();
430
- }, o = Gt[Gt.length - 1];
431
- for (let n of Gt) i.push(setTimeout(() => {
550
+ }, o = un[un.length - 1];
551
+ for (let n of un) i.push(setTimeout(() => {
432
552
  e(), n === 3e3 && (t.add(a), r() || a()), n === o && a();
433
553
  }, n));
434
554
  return i;
435
555
  }
436
- var U = () => i(Wt);
556
+ var U = () => i(ln);
437
557
  function W(e) {
438
- let { refreshQueryName: t, refreshVersion: n, registerQueryResult: o, settling: s } = U(), c = i(Ie), d = e.publish !== !1, f = r((e, t) => {
558
+ let { refreshQueryName: t, refreshVersion: n, registerQueryResult: o, settling: s } = U(), c = i(Ve), d = e.publish !== !1, f = r((e, t) => {
439
559
  d && o(e, t);
440
- }, [d, o]), p = e.ready ?? !0, m = !!e.name && p, [h, g] = u([]), [_, v] = u(""), [y, b] = u(m), [x, S] = u(0), C = l(0), w = l(!1), T = JSON.stringify(e.arguments ?? {});
560
+ }, [d, o]), p = e.ready ?? !0, m = cn(e) && p, [h, g] = u([]), [_, v] = u(""), [y, b] = u(m), [x, S] = u(0), C = l(0), w = l(!1), T = JSON.stringify(e.arguments ?? {});
441
561
  return a(() => {
442
562
  if (!m) {
443
563
  C.current += 1, g([]), v(""), b(!1), f(e.scope, void 0);
@@ -445,17 +565,17 @@ function W(e) {
445
565
  }
446
566
  let t = C.current + 1;
447
567
  C.current = t;
448
- let n = new AbortController(), r = JSON.parse(T), i = bt(e.name ?? "", e.route);
568
+ let n = new AbortController(), r = JSON.parse(T), i = Tt(e.name ?? "", e.route);
449
569
  b(!0), v("");
450
570
  let a = (e) => {
451
571
  C.current !== t || n.signal.aborted || (w.current = !1, g([]), v(e instanceof Error ? e.message : String(e)), b(!1));
452
572
  }, o = [], s = (e) => {
453
573
  if (C.current !== t || n.signal.aborted) return;
454
- let r = cn(e);
455
- r ? a(Error(r)) : e.isReady !== !1 && (o = e.changeSet && Array.isArray(e.data) && e.data.length === 0 && Array.isArray(o) ? ht(o, e.changeSet) : e.data, g(ln(o)), v(""), b(!1));
574
+ let r = En(e);
575
+ r ? a(Error(r)) : e.isReady !== !1 && (o = e.changeSet && Array.isArray(e.data) && e.data.length === 0 && Array.isArray(o) ? bt(o, e.changeSet) : e.data, g(Dn(o)), v(""), b(!1));
456
576
  };
457
577
  if (!i) return a(/* @__PURE__ */ Error(`The modeled query “${e.name}” is not registered by this Stage.`)), () => n.abort();
458
- let l = i.prototype instanceof Le, u = () => Promise.resolve().then(() => Ct(i, l ? {
578
+ let l = i.prototype instanceof He, u = () => Promise.resolve().then(() => Ot(i, l ? {
459
579
  ...r,
460
580
  waitForFirstResult: !0
461
581
  } : r, c)).then(s).catch(a);
@@ -465,7 +585,7 @@ function W(e) {
465
585
  C.current !== t || n.signal.aborted || (w.current = !1, d?.unsubscribe(), d = void 0, u());
466
586
  }, 15e3);
467
587
  try {
468
- d = wt(i, r, c, (e) => {
588
+ d = kt(i, r, c, (e) => {
469
589
  e.isReady !== !1 && globalThis.clearTimeout(p), s(e);
470
590
  });
471
591
  } catch {
@@ -516,47 +636,47 @@ function W(e) {
516
636
  ]), {
517
637
  rows: h,
518
638
  loading: y,
519
- awaitingCommand: Xt(m, h, _, s),
639
+ awaitingCommand: hn(m, h, _, s),
520
640
  error: _,
521
641
  refresh: () => {
522
642
  w.current || S((e) => e + 1);
523
643
  }
524
644
  };
525
645
  }
526
- function Xt(e, t, n, r) {
646
+ function hn(e, t, n, r) {
527
647
  let o = l(!1);
528
648
  t.length > 0 && (o.current = !0);
529
- let s = i(Ut), c = Zt(e, t, n, r) && !o.current;
649
+ let s = i(Zt), c = gn(e, t, n, r) && !o.current;
530
650
  return a(() => {
531
651
  if (c) return s();
532
652
  }, [c, s]), c;
533
653
  }
534
- function Zt(e, t, n, r) {
654
+ function gn(e, t, n, r) {
535
655
  return !(!e || !r || n || t.length !== 0);
536
656
  }
537
- function Qt() {
538
- globalThis.dispatchEvent(new CustomEvent(Ht));
657
+ function _n() {
658
+ globalThis.dispatchEvent(new CustomEvent(Xt));
539
659
  }
540
- function $t(e, t, n, r, i) {
660
+ function vn(e, t, n, r, i) {
541
661
  let a = Object.entries(t).sort(([, e], [, t]) => Number(e.list === !0) - Number(t.list === !0));
542
662
  return {
543
663
  dataContext: e,
544
664
  queryResults: Object.fromEntries(a.flatMap(([e, t]) => {
545
- let n = t.list ? t.rows : en(t.rows);
665
+ let n = t.list ? t.rows : yn(t.rows);
546
666
  return [
547
667
  [e, n],
548
668
  ...t.name ? [[t.name, n]] : [],
549
669
  ...t.alias ? [[t.alias, n]] : []
550
670
  ];
551
671
  })),
552
- componentOutputs: tn(r, i),
672
+ componentOutputs: bn(r, i),
553
673
  state: n
554
674
  };
555
675
  }
556
- function en(e) {
676
+ function yn(e) {
557
677
  return e.length === 1 ? e[0] : e;
558
678
  }
559
- function tn(e, t) {
679
+ function bn(e, t) {
560
680
  let n = { ...e };
561
681
  for (let [e, r] of Object.entries(t)) r && (n[e] = {
562
682
  ...r,
@@ -564,17 +684,17 @@ function tn(e, t) {
564
684
  });
565
685
  return n;
566
686
  }
567
- function nn(e, t, n) {
687
+ function xn(e, t, n) {
568
688
  let [r, ...i] = t;
569
689
  return r ? i.length === 0 ? {
570
690
  ...e,
571
691
  [r]: n
572
692
  } : {
573
693
  ...e,
574
- [r]: nn(un(e[r]) ? e[r] : {}, i, n)
694
+ [r]: xn(K(e[r]) ? e[r] : {}, i, n)
575
695
  } : e;
576
696
  }
577
- function rn(e) {
697
+ function Sn(e) {
578
698
  let t = {};
579
699
  for (let n of Object.values(e)) for (let [e, r] of Object.entries(n)) t[e] = {
580
700
  ...t[e],
@@ -582,7 +702,7 @@ function rn(e) {
582
702
  };
583
703
  return t;
584
704
  }
585
- function an(e, t, n, r, i, a, o, s, c) {
705
+ function Cn(e, t, n, r, i, a, o, s, c) {
586
706
  if (!e) return;
587
707
  let l = e.replace(/^\$\.?/, "").split(".").filter(Boolean);
588
708
  if (l.length !== 0) {
@@ -591,21 +711,21 @@ function an(e, t, n, r, i, a, o, s, c) {
591
711
  let e = G(o, l.slice(1));
592
712
  return e === void 0 && l[1] === "keys" && l.length === 3 ? G(t, [l[2]]) : e;
593
713
  }
594
- return l[0] === "locale" ? s : l[0] === "locales" ? c : l[0] === "query" ? sn(r, l[1], l.slice(2).join(".")) : l[0] === "data" || l[0] === "selected" || l[0] === "current" ? on(l.slice(1).join("."), t, n) : l[0] === "state" ? G(i, l.slice(1)) : l[0] === "parameters" ? l.length === 1 ? a : a[l[1]] : G(t, l) ?? sn(r, void 0, l.join(".")) ?? G(i, l);
714
+ return l[0] === "locale" ? s : l[0] === "locales" ? c : l[0] === "query" ? Tn(r, l[1], l.slice(2).join(".")) : l[0] === "data" || l[0] === "selected" || l[0] === "current" ? wn(l.slice(1).join("."), t, n) : l[0] === "state" ? G(i, l.slice(1)) : l[0] === "parameters" ? l.length === 1 ? a : a[l[1]] : G(t, l) ?? Tn(r, void 0, l.join(".")) ?? G(i, l);
595
715
  }
596
716
  }
597
- function on(e, t, n) {
717
+ function wn(e, t, n) {
598
718
  let r = e?.split(".").filter(Boolean) ?? [];
599
719
  return r.length > 0 && Object.hasOwn(n, r[0]) ? G(n[r[0]], r.slice(1)) : r.length === 0 ? t : G(t, r);
600
720
  }
601
- function sn(e, t, n) {
721
+ function Tn(e, t, n) {
602
722
  let r = Object.entries(e).filter(([e, n]) => t ? n.name === t || e === t : !n.list).map(([, e]) => e.rows);
603
723
  if (r.length === 0) return;
604
724
  let i = r.flat(), a = n?.split(".").filter(Boolean) ?? [];
605
725
  return a.length === 0 ? i : i.length === 1 ? G(i[0], a) : i.map((e) => G(e, a));
606
726
  }
607
- function cn(e) {
608
- if (!un(e)) return "";
727
+ function En(e) {
728
+ if (!K(e)) return "";
609
729
  if (e.isAuthorized === !1) return "The query answered 403.";
610
730
  if (e.isValid === !1 || e.hasExceptions === !0 || e.isSuccess === !1) {
611
731
  let t = Array.isArray(e.exceptionMessages) ? e.exceptionMessages.filter((e) => typeof e == "string") : [];
@@ -613,22 +733,22 @@ function cn(e) {
613
733
  }
614
734
  return "";
615
735
  }
616
- function ln(e) {
617
- return Array.isArray(e) ? e.filter(un) : un(e) ? [e] : [];
736
+ function Dn(e) {
737
+ return Array.isArray(e) ? e.filter(K) : K(e) ? [e] : [];
618
738
  }
619
739
  function G(e, t) {
620
740
  let n = e;
621
741
  for (let e of t) {
622
- if (!un(n)) return;
742
+ if (!K(n)) return;
623
743
  n = n[e];
624
744
  }
625
745
  return n;
626
746
  }
627
- function un(e) {
747
+ function K(e) {
628
748
  return typeof e == "object" && !!e && !Array.isArray(e);
629
749
  }
630
750
  // src/stageComponentOutputs.ts
631
- function dn() {
751
+ function On() {
632
752
  let e = o(), { publishComponentOutputs: t, withdrawComponentOutputs: n, selectRow: i, clearSelection: s } = U(), c = l({});
633
753
  a(() => () => {
634
754
  n(e), Object.keys(c.current).forEach((t) => s(`${e}:${t}`));
@@ -639,7 +759,7 @@ function dn() {
639
759
  ]);
640
760
  let u = r((n) => {
641
761
  t(e, n);
642
- let r = fn(n), a = /* @__PURE__ */ new Set([...Object.keys(c.current), ...Object.keys(r)]);
762
+ let r = kn(n), a = /* @__PURE__ */ new Set([...Object.keys(c.current), ...Object.keys(r)]);
643
763
  for (let t of a) c.current[t] !== r[t] && i(`${e}:${t}`, r[t]);
644
764
  c.current = r;
645
765
  }, [
@@ -649,24 +769,24 @@ function dn() {
649
769
  ]);
650
770
  return Object.assign(u, { scope: e });
651
771
  }
652
- function fn(e) {
772
+ function kn(e) {
653
773
  let t = {};
654
774
  for (let [n, r] of Object.entries(e)) {
655
775
  let e = r.selectedItem;
656
- pn(e) && (t[n] = e);
776
+ An(e) && (t[n] = e);
657
777
  }
658
778
  return t;
659
779
  }
660
- function pn(e) {
780
+ function An(e) {
661
781
  return typeof e == "object" && !!e && !Array.isArray(e);
662
782
  }
663
783
  // src/stageBoardSelection.ts
664
- var mn = /* @__PURE__ */ new Set(["kanbanBoard", "Cratis.Blueprint.Default:kanbanBoard"]);
665
- function hn(e) {
666
- return mn.has(e);
784
+ var jn = /* @__PURE__ */ new Set(["kanbanBoard", "Cratis.Blueprint.Default:kanbanBoard"]);
785
+ function Mn(e) {
786
+ return jn.has(e);
667
787
  }
668
- function gn(e) {
669
- let t = e, n = Object.fromEntries(Object.entries(t.slots ?? {}).map(([e, t]) => [e, t.map(gn)])), r = hn(t.componentName) ? {
788
+ function Nn(e) {
789
+ let t = e, n = Object.fromEntries(Object.entries(t.slots ?? {}).map(([e, t]) => [e, t.map(Nn)])), r = Mn(t.componentName) ? {
670
790
  ...t.properties,
671
791
  selectionMode: "single"
672
792
  } : t.properties;
@@ -677,23 +797,23 @@ function gn(e) {
677
797
  };
678
798
  }
679
799
  // src/humanize.ts
680
- var _n = /[A-Z]+(?![a-z])|[A-Z]?[a-z]+\d*|\d+/g, vn = /* @__PURE__ */ new Set([
800
+ var Pn = /[A-Z]+(?![a-z])|[A-Z]?[a-z]+\d*|\d+/g, Fn = /* @__PURE__ */ new Set([
681
801
  "Screen",
682
802
  "Page",
683
803
  "Dialog"
684
804
  ]);
685
- function yn(e) {
805
+ function In(e) {
686
806
  return e.map((e, t) => e.length > 1 && e === e.toUpperCase() && /[A-Z]/.test(e) ? e : t === 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e.toLowerCase()).join(" ");
687
807
  }
688
- function K(e) {
689
- let t = e.match(_n);
690
- return t ? yn(t) : e;
808
+ function q(e) {
809
+ let t = e.match(Pn);
810
+ return t ? In(t) : e;
691
811
  }
692
- function bn(e) {
693
- let t = e.match(_n);
694
- return t ? yn(t.length > 1 && vn.has(t[t.length - 1]) ? t.slice(0, -1) : t) : e;
812
+ function Ln(e) {
813
+ let t = e.match(Pn);
814
+ return t ? In(t.length > 1 && Fn.has(t[t.length - 1]) ? t.slice(0, -1) : t) : e;
695
815
  }
696
- function xn(e, t) {
816
+ function Rn(e, t) {
697
817
  switch (e.toLowerCase()) {
698
818
  case "primary": return "solid";
699
819
  case "secondary": return "outline";
@@ -702,41 +822,41 @@ function xn(e, t) {
702
822
  }
703
823
  }
704
824
  // src/stageFormSchema.ts
705
- var Sn = 8;
706
- function Cn(e) {
825
+ var zn = 8;
826
+ function Bn(e) {
707
827
  if (!e) return !1;
708
828
  try {
709
829
  let t = JSON.parse(e);
710
- return Nn(t) && t["x-creates"] === !0;
830
+ return Y(t) && t["x-creates"] === !0;
711
831
  } catch {
712
832
  return !1;
713
833
  }
714
834
  }
715
- function q(e) {
835
+ function J(e) {
716
836
  if (!e) return [];
717
837
  try {
718
- return wn(JSON.parse(e), 0);
838
+ return Vn(JSON.parse(e), 0);
719
839
  } catch {
720
840
  return [];
721
841
  }
722
842
  }
723
- function wn(e, t) {
724
- let n = Object.prototype.hasOwnProperty.call(e, "required"), r = Array.isArray(e.required) ? new Set(e.required.filter((e) => typeof e == "string")) : /* @__PURE__ */ new Set(), i = Nn(e.properties) ? e.properties : {};
725
- return Object.entries(i).map(([e, i]) => Tn(e, i, !n || r.has(e), t));
843
+ function Vn(e, t) {
844
+ let n = Object.prototype.hasOwnProperty.call(e, "required"), r = Array.isArray(e.required) ? new Set(e.required.filter((e) => typeof e == "string")) : /* @__PURE__ */ new Set(), i = Y(e.properties) ? e.properties : {};
845
+ return Object.entries(i).map(([e, i]) => Hn(e, i, !n || r.has(e), t));
726
846
  }
727
- function Tn(e, t, n, r) {
728
- let i = En(t?.["x-reference"]);
847
+ function Hn(e, t, n, r) {
848
+ let i = Un(t?.["x-reference"]);
729
849
  return {
730
850
  name: e,
731
851
  identifier: (t?.format === "uuid" || i) && typeof t?.["x-concept"] == "string" ? t["x-concept"] : void 0,
732
852
  ...i ? { reference: i } : {},
733
853
  ...t?.["x-identity"] === !0 ? { identity: !0 } : {},
734
854
  required: n,
735
- ...Dn(t, r)
855
+ ...Wn(t, r)
736
856
  };
737
857
  }
738
- function En(e) {
739
- if (!Nn(e)) return;
858
+ function Un(e) {
859
+ if (!Y(e)) return;
740
860
  let { query: t, value: n, label: r } = e;
741
861
  return typeof t == "string" && t.length > 0 && typeof n == "string" && n.length > 0 && typeof r == "string" && r.length > 0 ? {
742
862
  query: t,
@@ -744,11 +864,11 @@ function En(e) {
744
864
  label: r
745
865
  } : void 0;
746
866
  }
747
- function Dn(e, t) {
867
+ function Wn(e, t) {
748
868
  let n = e?.type;
749
869
  if (Array.isArray(n)) {
750
870
  let r = n.filter((e) => e !== "null");
751
- return r.length === 1 ? Dn({
871
+ return r.length === 1 ? Wn({
752
872
  ...e,
753
873
  type: r[0]
754
874
  }, t) : { unsupportedReason: `union type ${JSON.stringify(n)}` };
@@ -759,8 +879,8 @@ function Dn(e, t) {
759
879
  type: "date",
760
880
  withTime: e.format === "date-time"
761
881
  };
762
- if (n === "array") return On(e, t);
763
- if (n === "object") return kn(e, t);
882
+ if (n === "array") return Gn(e, t);
883
+ if (n === "object") return Kn(e, t);
764
884
  if (n === void 0 || n === "string") {
765
885
  let t = Array.isArray(e?.enum) ? e.enum.filter((e) => typeof e == "string") : [];
766
886
  return t.length > 0 ? {
@@ -770,75 +890,78 @@ function Dn(e, t) {
770
890
  }
771
891
  return { unsupportedReason: `type ${String(n)}` };
772
892
  }
773
- function On(e, t) {
893
+ function Gn(e, t) {
774
894
  let n = { unsupportedReason: "array fields are not supported by the native Stage command form" };
775
- if (t >= Sn || e?.items === void 0) return n;
776
- let r = Tn("", e.items, !0, t + 1);
895
+ if (t >= zn || e?.items === void 0) return n;
896
+ let r = Hn("", e.items, !0, t + 1);
777
897
  return r.unsupportedReason || r.item ? n : { item: r };
778
898
  }
779
- function kn(e, t) {
899
+ function Kn(e, t) {
780
900
  let n = { unsupportedReason: "object fields are not supported by the native Stage command form" };
781
- if (t >= Sn || !Nn(e?.properties) || Object.keys(e.properties).length === 0) return n;
782
- let r = wn(e, t + 1), i = r.find((e) => e.unsupportedReason);
901
+ if (t >= zn || !Y(e?.properties) || Object.keys(e.properties).length === 0) return n;
902
+ let r = Vn(e, t + 1), i = r.find((e) => e.unsupportedReason);
783
903
  return i ? { unsupportedReason: `its member “${i.name}” is not supported: ${i.unsupportedReason}` } : { members: r };
784
904
  }
785
- function An(e, t, n) {
905
+ function qn(e, t, n) {
786
906
  if (t != null) {
787
- if (e.members && Nn(t)) for (let r of e.members) {
788
- let e = t[r.name], i = K(r.name);
789
- if (jn(e)) {
907
+ if (e.members && Y(t)) for (let r of e.members) {
908
+ let e = t[r.name], i = q(r.name);
909
+ if (Jn(e)) {
790
910
  if (r.required) return `${n}: ${i} is required`;
791
911
  continue;
792
912
  }
793
- let a = An(r, e, `${n} ${i.toLowerCase()}`);
913
+ let a = qn(r, e, `${n} ${i.toLowerCase()}`);
794
914
  if (a) return a;
795
915
  }
796
916
  if (e.item && Array.isArray(t)) for (let [r, i] of t.entries()) {
797
- let t = jn(i) ? `${n} ${r + 1} is required` : An(e.item, i, `${n} ${r + 1}`);
917
+ let t = Jn(i) ? `${n} ${r + 1} is required` : qn(e.item, i, `${n} ${r + 1}`);
798
918
  if (t) return t;
799
919
  }
800
920
  }
801
921
  }
802
- function jn(e) {
922
+ function Jn(e) {
803
923
  return e == null || e === "";
804
924
  }
805
- function Mn(e, t) {
806
- return t == null ? t : e.options ? typeof t == "number" ? e.options[t] ?? t : typeof t == "string" ? e.options.find((e) => e.toLowerCase() === t.toLowerCase()) ?? t : t : e.members && Nn(t) ? Object.fromEntries(Object.entries(t).map(([t, n]) => {
925
+ function Yn(e, t) {
926
+ return t == null ? t : e.options ? typeof t == "number" ? e.options[t] ?? t : typeof t == "string" ? e.options.find((e) => e.toLowerCase() === t.toLowerCase()) ?? t : t : e.members && Y(t) ? Object.fromEntries(Object.entries(t).map(([t, n]) => {
807
927
  let r = e.members?.find((e) => e.name === t);
808
- return [t, r ? Mn(r, n) : n];
809
- })) : e.item && Array.isArray(t) ? t.map((t) => Mn(e.item, t)) : t;
928
+ return [t, r ? Yn(r, n) : n];
929
+ })) : e.item && Array.isArray(t) ? t.map((t) => Yn(e.item, t)) : t;
810
930
  }
811
- function Nn(e) {
931
+ function Y(e) {
812
932
  return typeof e == "object" && !!e && !Array.isArray(e);
813
933
  }
814
934
  // src/stageActionSubject.ts
815
- var Pn = /^item\.(.+)$/, Fn = [
935
+ var Xn = /^item\.(.+)$/, Zn = [
816
936
  void 0,
817
937
  null,
818
938
  ""
819
939
  ];
820
- function In(e) {
940
+ function Qn(e) {
821
941
  let t = e.properties.actionSubject;
822
942
  return t === "item" || t === "screen" ? t : void 0;
823
943
  }
824
- function Ln(e, t) {
944
+ function $n(e, t) {
945
+ return Qn(e) === void 0 && (t ? Bn(t) : e.properties.createsEntity === !0);
946
+ }
947
+ function er(e, t) {
825
948
  return e === "item" && t.length === 1 ? t[0] : void 0;
826
949
  }
827
- function Rn(e, t) {
950
+ function tr(e, t) {
828
951
  return e === "item" && !t;
829
952
  }
830
- function zn(e, t) {
831
- let n = In(e), r = e.properties.subjectValues;
953
+ function nr(e, t) {
954
+ let n = Qn(e), r = e.properties.subjectValues;
832
955
  return {
833
956
  ...n === "screen" ? {
834
957
  selectableRows: [],
835
958
  selectedRows: []
836
959
  } : t,
837
960
  rowAction: e.properties.rowAction === !0 || n === "item",
838
- subjectValues: Jn(r) ? r : {}
961
+ subjectValues: dr(r) ? r : {}
839
962
  };
840
963
  }
841
- function Bn(e, t) {
964
+ function rr(e, t) {
842
965
  return {
843
966
  ...t === "screen" ? {} : { rowAction: !0 },
844
967
  ...t === void 0 ? {} : {
@@ -847,12 +970,12 @@ function Bn(e, t) {
847
970
  }
848
971
  };
849
972
  }
850
- function Vn(e, t) {
851
- let n = Object.entries(Gn(e)).map(([e, n]) => [e, qn(t, n)]);
852
- return Object.fromEntries(n.filter(([, e]) => !Fn.includes(e)));
973
+ function ir(e, t) {
974
+ let n = Object.entries(cr(e)).map(([e, n]) => [e, ur(t, n)]);
975
+ return Object.fromEntries(n.filter(([, e]) => !Zn.includes(e)));
853
976
  }
854
- function Hn(e, t, n) {
855
- let r = new Set(Object.keys(Gn(e))), i = t.filter((e) => e.identifier !== void 0 && e.required && Object.hasOwn(n, e.name)).map((e) => e.name), a = /* @__PURE__ */ new Set([...r, ...i]), o = Un(e, t).filter((e) => !a.has(Wn(e))), s = t.length > 0 || Array.isArray(e.properties.fields) ? {
977
+ function ar(e, t, n) {
978
+ let r = new Set(Object.keys(cr(e))), i = t.filter((e) => e.identifier !== void 0 && e.required && Object.hasOwn(n, e.name)).map((e) => e.name), a = /* @__PURE__ */ new Set([...r, ...i]), o = or(e, t).filter((e) => !a.has(sr(e))), s = t.length > 0 || Array.isArray(e.properties.fields) ? {
856
979
  fields: o,
857
980
  generationMode: "manual"
858
981
  } : {}, c = Object.fromEntries(i.map((e) => [e, n[e]]));
@@ -863,139 +986,62 @@ function Hn(e, t, n) {
863
986
  rowAction: !0,
864
987
  subjectValues: {
865
988
  ...c,
866
- ...Vn(e, n)
989
+ ...ir(e, n)
867
990
  },
868
991
  ...s
869
992
  }
870
993
  };
871
994
  }
872
- function Un(e, t) {
995
+ function or(e, t) {
873
996
  let n = e.properties.fields;
874
997
  return Array.isArray(n) ? n : t.map((e) => ({
875
998
  name: e.name,
876
- label: K(e.name)
999
+ label: q(e.name)
877
1000
  }));
878
1001
  }
879
- function Wn(e) {
1002
+ function sr(e) {
880
1003
  let t = e.sourceProperty || e.name;
881
1004
  return typeof t == "string" ? t : "";
882
1005
  }
883
- function Gn(e) {
884
- let t = e.properties.subjectInputs, n = (Jn(t) ? Object.entries(t) : []).map(([e, t]) => [e, Kn(t)]);
1006
+ function cr(e) {
1007
+ let t = e.properties.subjectInputs, n = (dr(t) ? Object.entries(t) : []).map(([e, t]) => [e, lr(t)]);
885
1008
  return Object.fromEntries(n.filter((e) => e[1] !== void 0));
886
1009
  }
887
- function Kn(e) {
888
- let t = Jn(e) ? e.subject : void 0;
889
- return typeof t == "string" ? Pn.exec(t)?.[1] : void 0;
1010
+ function lr(e) {
1011
+ let t = dr(e) ? e.subject : void 0;
1012
+ return typeof t == "string" ? Xn.exec(t)?.[1] : void 0;
890
1013
  }
891
- function qn(e, t) {
892
- return t.split(".").reduce((e, t) => Jn(e) ? e[t] : void 0, e);
1014
+ function ur(e, t) {
1015
+ return t.split(".").reduce((e, t) => dr(e) ? e[t] : void 0, e);
893
1016
  }
894
- function Jn(e) {
1017
+ function dr(e) {
895
1018
  return typeof e == "object" && !!e && !Array.isArray(e);
896
1019
  }
897
- // src/commandExecutor.ts
898
- function J(e, t, n) {
899
- for (let r of [
900
- t,
901
- n?.replace(/^\//, ""),
902
- e
903
- ]) {
904
- if (!r) continue;
905
- let t = Be(r);
906
- if (Yn(t) && !(r === e && n && new t().route.replace(/^\//, "") !== n.replace(/^\//, ""))) return t;
907
- }
908
- }
909
- function Yn(e) {
910
- return typeof e == "function" && e.prototype instanceof Je;
911
- }
912
- function Xn(e, t) {
913
- return e.setApiBasePath(_t(t)), e;
914
- }
915
- async function Zn(e, t, n) {
916
- let r = J(e);
917
- if (!r) return {
918
- isSuccess: !1,
919
- validationErrors: [],
920
- messages: [`The modeled command “${e}” is not registered by this Stage.`]
921
- };
922
- let i = new r();
923
- i.setMicroservice(n.microservice), i.setApiBasePath(_t(n.apiBasePath)), i.setOrigin(n.origin ?? ""), i.setHttpHeadersCallback(n.httpHeadersCallback ?? (() => ({})));
924
- for (let e of i.propertyDescriptors) Object.prototype.hasOwnProperty.call(t, e.name) && Reflect.set(i, e.name, t[e.name]);
925
- return Qn(e, await i.execute());
926
- }
927
- function Qn(e, t) {
928
- let n = t.isSuccess && t.isAuthorized && t.isValid && !t.hasExceptions, r = t.isValid ? [] : t.validationResults.flatMap((e) => (e.members.length > 0 ? e.members : [""]).map((t) => ({
929
- member: t,
930
- message: e.message
931
- }))), i = n ? [] : [
932
- ...t.validationResults.map((e) => e.message),
933
- ...t.exceptionMessages,
934
- ...t.isAuthorized ? [] : [t.authorizationFailureReason || `“${e}” was not accepted.`]
935
- ];
936
- return {
937
- isSuccess: n,
938
- response: n ? t.response : void 0,
939
- validationErrors: r,
940
- messages: n || i.length > 0 ? i : [`“${e}” was not accepted.`]
941
- };
942
- }
943
- function $n() {
944
- let e = i(Ie);
945
- return r((t, n) => Zn(t, n, e), [e]);
946
- }
947
- // src/stageNavigation.ts
948
- function er(e, t = {}) {
949
- let n = new URLSearchParams(Object.entries(t).filter(([, e]) => e !== "")).toString();
950
- return n ? `#/${encodeURIComponent(e)}?${n}` : `#/${encodeURIComponent(e)}`;
951
- }
952
- function tr(e, t = {}) {
953
- if (!globalThis.location) return;
954
- if (nr === "path") {
955
- let n = ir(e, t);
956
- if (`${globalThis.location.pathname}${globalThis.location.search}` === n) return;
957
- globalThis.history.pushState(null, "", n), globalThis.dispatchEvent(new PopStateEvent("popstate"));
958
- return;
959
- }
960
- let n = er(e, t);
961
- globalThis.location.hash !== n && (globalThis.location.hash = n);
962
- }
963
- var nr = "hash";
964
- function rr(e) {
965
- nr = e;
966
- }
967
- function ir(e, t = {}) {
968
- let n = new URLSearchParams(Object.entries(t).filter(([, e]) => e !== "")).toString();
969
- return n ? `/${encodeURIComponent(e)}?${n}` : `/${encodeURIComponent(e)}`;
970
- }
971
- function ar(e) {
972
- return Object.fromEntries(Object.entries(e ?? {}).filter(([, e]) => e != null && e !== "" && (typeof e != "object" || e instanceof qe)).map(([e, t]) => [e, String(t)]));
973
- }
974
1020
  // src/StageValueFields.tsx
975
- var or = Xe((e) => /* @__PURE__ */ B(sr, {
1021
+ var fr = tt((e) => /* @__PURE__ */ R(pr, {
976
1022
  descriptor: e.descriptor,
977
- label: e.title ?? K(e.descriptor.name),
1023
+ label: e.title ?? q(e.descriptor.name),
978
1024
  value: e.value,
979
1025
  onChange: e.onChange,
980
1026
  onBlur: e.onBlur,
981
1027
  invalid: e.invalid
982
1028
  }), { defaultValue: void 0 });
983
- function sr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
984
- return e.members ? /* @__PURE__ */ B(cr, {
1029
+ function pr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1030
+ return e.members ? /* @__PURE__ */ R(mr, {
985
1031
  descriptor: e,
986
1032
  label: t,
987
1033
  value: n,
988
1034
  onChange: r,
989
1035
  onBlur: i,
990
1036
  invalid: a
991
- }) : e.item ? /* @__PURE__ */ B(lr, {
1037
+ }) : e.item ? /* @__PURE__ */ R(hr, {
992
1038
  descriptor: e,
993
1039
  label: t,
994
1040
  value: n,
995
1041
  onChange: r,
996
1042
  onBlur: i,
997
1043
  invalid: a
998
- }) : /* @__PURE__ */ B(ur, {
1044
+ }) : /* @__PURE__ */ R(gr, {
999
1045
  descriptor: e,
1000
1046
  label: t,
1001
1047
  value: n,
@@ -1004,14 +1050,14 @@ function sr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid
1004
1050
  invalid: a
1005
1051
  });
1006
1052
  }
1007
- function cr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1008
- let o = pr(n) ? n : {};
1009
- return /* @__PURE__ */ V("fieldset", {
1053
+ function mr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1054
+ let o = yr(n) ? n : {};
1055
+ return /* @__PURE__ */ z("fieldset", {
1010
1056
  className: "stage-record-field",
1011
1057
  "data-invalid": a ? "true" : void 0,
1012
- children: [/* @__PURE__ */ B("legend", { children: t }), (e.members ?? []).map((e) => /* @__PURE__ */ B(sr, {
1058
+ children: [/* @__PURE__ */ R("legend", { children: t }), (e.members ?? []).map((e) => /* @__PURE__ */ R(pr, {
1013
1059
  descriptor: e,
1014
- label: K(e.name),
1060
+ label: q(e.name),
1015
1061
  value: o[e.name],
1016
1062
  onBlur: i,
1017
1063
  onChange: (t) => r({
@@ -1021,74 +1067,74 @@ function cr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid
1021
1067
  }, e.name))]
1022
1068
  });
1023
1069
  }
1024
- function lr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1070
+ function hr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1025
1071
  let o = e.item, s = Array.isArray(n) ? n : [], c = (e) => r(e);
1026
- return /* @__PURE__ */ V("fieldset", {
1072
+ return /* @__PURE__ */ z("fieldset", {
1027
1073
  className: "stage-list-field",
1028
1074
  "data-invalid": a ? "true" : void 0,
1029
1075
  children: [
1030
- /* @__PURE__ */ B("legend", { children: t }),
1031
- s.length === 0 && /* @__PURE__ */ B("p", {
1076
+ /* @__PURE__ */ R("legend", { children: t }),
1077
+ s.length === 0 && /* @__PURE__ */ R("p", {
1032
1078
  className: "stage-note",
1033
1079
  children: "Nothing added yet."
1034
1080
  }),
1035
- s.map((e, n) => /* @__PURE__ */ V("div", {
1081
+ s.map((e, n) => /* @__PURE__ */ z("div", {
1036
1082
  className: "stage-list-field__row",
1037
- children: [/* @__PURE__ */ B(sr, {
1083
+ children: [/* @__PURE__ */ R(pr, {
1038
1084
  descriptor: o,
1039
1085
  label: `${t} ${n + 1}`,
1040
1086
  value: e,
1041
1087
  onBlur: i,
1042
1088
  onChange: (e) => c(s.map((t, r) => r === n ? e : t))
1043
- }), /* @__PURE__ */ B("button", {
1089
+ }), /* @__PURE__ */ R("button", {
1044
1090
  type: "button",
1045
1091
  "aria-label": `Remove ${t} ${n + 1}`,
1046
1092
  onClick: () => c(s.filter((e, t) => t !== n)),
1047
1093
  children: "Remove"
1048
1094
  })]
1049
1095
  }, n)),
1050
- /* @__PURE__ */ B("button", {
1096
+ /* @__PURE__ */ R("button", {
1051
1097
  type: "button",
1052
1098
  "aria-label": `Add ${t}`,
1053
- onClick: () => c([...s, dr(o)]),
1099
+ onClick: () => c([...s, _r(o)]),
1054
1100
  children: "Add"
1055
1101
  })
1056
1102
  ]
1057
1103
  });
1058
1104
  }
1059
- function ur({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1105
+ function gr({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid: a }) {
1060
1106
  let o = {
1061
1107
  "aria-invalid": a ? !0 : void 0,
1062
1108
  onBlur: i
1063
1109
  };
1064
- if (e.options) return /* @__PURE__ */ V("label", {
1110
+ if (e.options) return /* @__PURE__ */ z("label", {
1065
1111
  className: "stage-value-field",
1066
- children: [/* @__PURE__ */ B("span", { children: t }), /* @__PURE__ */ V("select", {
1112
+ children: [/* @__PURE__ */ R("span", { children: t }), /* @__PURE__ */ z("select", {
1067
1113
  ...o,
1068
1114
  value: typeof n == "string" ? n : "",
1069
1115
  onChange: (e) => r(e.target.value === "" ? void 0 : e.target.value),
1070
- children: [/* @__PURE__ */ B("option", {
1116
+ children: [/* @__PURE__ */ R("option", {
1071
1117
  value: "",
1072
1118
  children: ""
1073
- }), e.options.map((e) => /* @__PURE__ */ B("option", {
1119
+ }), e.options.map((e) => /* @__PURE__ */ R("option", {
1074
1120
  value: e,
1075
- children: K(e)
1121
+ children: q(e)
1076
1122
  }, e))]
1077
1123
  })]
1078
1124
  });
1079
1125
  switch (e.type) {
1080
- case "boolean": return /* @__PURE__ */ V("label", {
1126
+ case "boolean": return /* @__PURE__ */ z("label", {
1081
1127
  className: "stage-value-field stage-value-field--check",
1082
- children: [/* @__PURE__ */ B("input", {
1128
+ children: [/* @__PURE__ */ R("input", {
1083
1129
  ...o,
1084
1130
  type: "checkbox",
1085
1131
  checked: n === !0,
1086
1132
  onChange: (e) => r(e.target.checked)
1087
- }), /* @__PURE__ */ B("span", { children: t })]
1133
+ }), /* @__PURE__ */ R("span", { children: t })]
1088
1134
  });
1089
- case "number": return /* @__PURE__ */ V("label", {
1135
+ case "number": return /* @__PURE__ */ z("label", {
1090
1136
  className: "stage-value-field",
1091
- children: [/* @__PURE__ */ B("span", { children: t }), /* @__PURE__ */ B("input", {
1137
+ children: [/* @__PURE__ */ R("span", { children: t }), /* @__PURE__ */ R("input", {
1092
1138
  ...o,
1093
1139
  type: "number",
1094
1140
  step: "any",
@@ -1096,18 +1142,18 @@ function ur({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid
1096
1142
  onChange: (e) => r(e.target.value === "" ? void 0 : Number(e.target.value))
1097
1143
  })]
1098
1144
  });
1099
- case "date": return /* @__PURE__ */ V("label", {
1145
+ case "date": return /* @__PURE__ */ z("label", {
1100
1146
  className: "stage-value-field",
1101
- children: [/* @__PURE__ */ B("span", { children: t }), /* @__PURE__ */ B("input", {
1147
+ children: [/* @__PURE__ */ R("span", { children: t }), /* @__PURE__ */ R("input", {
1102
1148
  ...o,
1103
1149
  type: e.withTime ? "datetime-local" : "date",
1104
1150
  value: typeof n == "string" ? n.slice(0, e.withTime ? 16 : 10) : "",
1105
- onChange: (t) => r(t.target.value === "" ? void 0 : fr(t.target.value, e.withTime === !0))
1151
+ onChange: (t) => r(t.target.value === "" ? void 0 : vr(t.target.value, e.withTime === !0))
1106
1152
  })]
1107
1153
  });
1108
- default: return /* @__PURE__ */ V("label", {
1154
+ default: return /* @__PURE__ */ z("label", {
1109
1155
  className: "stage-value-field",
1110
- children: [/* @__PURE__ */ B("span", { children: t }), /* @__PURE__ */ B("input", {
1156
+ children: [/* @__PURE__ */ R("span", { children: t }), /* @__PURE__ */ R("input", {
1111
1157
  ...o,
1112
1158
  type: "text",
1113
1159
  value: typeof n == "string" ? n : "",
@@ -1116,55 +1162,55 @@ function ur({ descriptor: e, label: t, value: n, onChange: r, onBlur: i, invalid
1116
1162
  });
1117
1163
  }
1118
1164
  }
1119
- function dr(e) {
1165
+ function _r(e) {
1120
1166
  return e.members ? {} : void 0;
1121
1167
  }
1122
- function fr(e, t) {
1168
+ function vr(e, t) {
1123
1169
  if (!t) return e;
1124
1170
  let n = new Date(e);
1125
1171
  return Number.isNaN(n.getTime()) ? e : n.toISOString();
1126
1172
  }
1127
- function pr(e) {
1173
+ function yr(e) {
1128
1174
  return typeof e == "object" && !!e && !Array.isArray(e);
1129
1175
  }
1130
1176
  // src/stageScreenTables.tsx
1131
- function mr(e) {
1177
+ function br(e) {
1132
1178
  let t = /* @__PURE__ */ new Set(), n = (e) => {
1133
1179
  let r = e;
1134
1180
  if (r.componentName !== "core:outlet") {
1135
- hr(r).forEach((e) => t.add(e));
1181
+ xr(r).forEach((e) => t.add(e));
1136
1182
  for (let e of Object.values(r.slots ?? {})) e.forEach(n);
1137
1183
  }
1138
1184
  };
1139
1185
  return n(e), [...t];
1140
1186
  }
1141
- function hr(e) {
1187
+ function xr(e) {
1142
1188
  if (e.componentName === "core:table") return [e.id];
1143
- if (!hn(e.componentName)) return [];
1189
+ if (!Mn(e.componentName)) return [];
1144
1190
  let t = e.properties.cards, n = t?.kind === "queryResult" && typeof t.query == "string" ? [`binding:${t.query}`] : [];
1145
1191
  return [e.id, ...n];
1146
1192
  }
1147
- var gr = t(void 0);
1148
- function _r({ element: e, outputScope: t, children: n }) {
1149
- let r = c(() => new Set(mr(e).flatMap((e) => t ? [e, `${t}:${e}`] : [e])), [e, t]);
1150
- return /* @__PURE__ */ B(gr.Provider, {
1193
+ var Sr = t(void 0);
1194
+ function Cr({ element: e, outputScope: t, children: n }) {
1195
+ let r = c(() => new Set(br(e).flatMap((e) => t ? [e, `${t}:${e}`] : [e])), [e, t]);
1196
+ return /* @__PURE__ */ R(Sr.Provider, {
1151
1197
  value: r,
1152
1198
  children: n
1153
1199
  });
1154
1200
  }
1155
- function vr({ children: e }) {
1156
- return /* @__PURE__ */ B(gr.Provider, {
1201
+ function wr({ children: e }) {
1202
+ return /* @__PURE__ */ R(Sr.Provider, {
1157
1203
  value: void 0,
1158
1204
  children: e
1159
1205
  });
1160
1206
  }
1161
- function yr() {
1162
- let e = i(gr), { queries: t, selections: n } = U();
1207
+ function Tr() {
1208
+ let e = i(Sr), { queries: t, selections: n } = U();
1163
1209
  return c(() => {
1164
1210
  let r = e ? Object.fromEntries(Object.entries(t).filter(([t]) => e.has(t))) : t, i = e ? Object.fromEntries(Object.entries(n).filter(([t]) => e.has(t))) : n;
1165
1211
  return {
1166
- selectableRows: Qr(r),
1167
- selectedRows: $r(i, r)
1212
+ selectableRows: ai(r),
1213
+ selectedRows: oi(i, r)
1168
1214
  };
1169
1215
  }, [
1170
1216
  t,
@@ -1173,7 +1219,7 @@ function yr() {
1173
1219
  ]);
1174
1220
  }
1175
1221
  // src/StageReferenceField.tsx
1176
- function br(e) {
1222
+ function Er(e) {
1177
1223
  let t = o(), { routes: n, routesReady: r } = U(), i = n?.queries?.[e.reference.query], a = r && !!i, s = W({
1178
1224
  scope: t,
1179
1225
  name: e.reference.query,
@@ -1181,7 +1227,7 @@ function br(e) {
1181
1227
  ready: a,
1182
1228
  publish: !1
1183
1229
  }), c = typeof e.value == "string" ? e.value : "";
1184
- return !a || s.error ? /* @__PURE__ */ V(He, { children: [/* @__PURE__ */ B("input", {
1230
+ return !a || s.error ? /* @__PURE__ */ z(Xe, { children: [/* @__PURE__ */ R("input", {
1185
1231
  id: e.id,
1186
1232
  "aria-label": e.title,
1187
1233
  "aria-invalid": e.invalid,
@@ -1190,17 +1236,17 @@ function br(e) {
1190
1236
  onBlur: e.onBlur,
1191
1237
  required: e.required,
1192
1238
  disabled: e.disabled
1193
- }), s.error && /* @__PURE__ */ B("span", {
1239
+ }), s.error && /* @__PURE__ */ R("span", {
1194
1240
  role: "alert",
1195
1241
  children: s.error
1196
- })] }) : /* @__PURE__ */ B(Sr, {
1242
+ })] }) : /* @__PURE__ */ R(Or, {
1197
1243
  ...e,
1198
1244
  selected: c,
1199
- choices: xr(s.rows, e.reference),
1245
+ choices: Dr(s.rows, e.reference),
1200
1246
  loading: s.loading
1201
1247
  });
1202
1248
  }
1203
- function xr(e, t) {
1249
+ function Dr(e, t) {
1204
1250
  return e.flatMap((e) => {
1205
1251
  let n = e[t.value];
1206
1252
  return typeof n == "string" ? [{
@@ -1209,19 +1255,19 @@ function xr(e, t) {
1209
1255
  }] : [];
1210
1256
  });
1211
1257
  }
1212
- function Sr({ id: e, onChange: t, onBlur: n, invalid: r, title: i, required: a, disabled: o, selected: s, choices: c, loading: l }) {
1258
+ function Or({ id: e, onChange: t, onBlur: n, invalid: r, title: i, required: a, disabled: o, selected: s, choices: c, loading: l }) {
1213
1259
  let [d, f] = u(""), p = c.filter((e) => e.key === s || e.label.toLocaleLowerCase().includes(d.toLocaleLowerCase())), m = s !== "" && !c.some((e) => e.key === s);
1214
- return /* @__PURE__ */ V("div", {
1260
+ return /* @__PURE__ */ z("div", {
1215
1261
  className: "stage-reference-field",
1216
1262
  children: [
1217
- /* @__PURE__ */ B("input", {
1263
+ /* @__PURE__ */ R("input", {
1218
1264
  type: "search",
1219
1265
  "aria-label": `Filter ${i}`,
1220
1266
  value: d,
1221
1267
  onChange: (e) => f(e.target.value),
1222
1268
  disabled: o || l
1223
1269
  }),
1224
- /* @__PURE__ */ V("select", {
1270
+ /* @__PURE__ */ z("select", {
1225
1271
  id: e,
1226
1272
  "aria-label": i,
1227
1273
  "aria-invalid": r,
@@ -1231,48 +1277,48 @@ function Sr({ id: e, onChange: t, onBlur: n, invalid: r, title: i, required: a,
1231
1277
  required: a,
1232
1278
  disabled: o || l,
1233
1279
  children: [
1234
- /* @__PURE__ */ V("option", {
1280
+ /* @__PURE__ */ z("option", {
1235
1281
  value: "",
1236
1282
  children: ["Choose ", i]
1237
1283
  }),
1238
- m && /* @__PURE__ */ B("option", {
1284
+ m && /* @__PURE__ */ R("option", {
1239
1285
  value: s,
1240
1286
  children: s
1241
1287
  }),
1242
- p.map((e) => /* @__PURE__ */ B("option", {
1288
+ p.map((e) => /* @__PURE__ */ R("option", {
1243
1289
  value: e.key,
1244
1290
  children: e.label
1245
1291
  }, e.key))
1246
1292
  ]
1247
1293
  }),
1248
- /* @__PURE__ */ B(Cr, {
1294
+ /* @__PURE__ */ R(kr, {
1249
1295
  loading: l,
1250
1296
  empty: c.length === 0
1251
1297
  })
1252
1298
  ]
1253
1299
  });
1254
1300
  }
1255
- function Cr({ loading: e, empty: t }) {
1256
- return e ? /* @__PURE__ */ B("span", {
1301
+ function kr({ loading: e, empty: t }) {
1302
+ return e ? /* @__PURE__ */ R("span", {
1257
1303
  role: "status",
1258
1304
  children: "Loading choices…"
1259
- }) : t ? /* @__PURE__ */ B("span", { children: "No choices available" }) : null;
1305
+ }) : t ? /* @__PURE__ */ R("span", { children: "No choices available" }) : null;
1260
1306
  }
1261
- function wr(e, t, n) {
1262
- return e?.reference ? /* @__PURE__ */ B(Tr, {
1307
+ function Ar(e, t, n) {
1308
+ return e?.reference ? /* @__PURE__ */ R(jr, {
1263
1309
  ...t,
1264
1310
  reference: e.reference
1265
1311
  }) : n;
1266
1312
  }
1267
- var Tr = Xe(br, { defaultValue: "" }), Er = {
1313
+ var jr = tt(Er, { defaultValue: "" }), Mr = {
1268
1314
  messages: [],
1269
1315
  complete: async (e, t) => t([], !1)
1270
1316
  };
1271
- function Dr(e, t, n) {
1317
+ function Nr(e, t, n) {
1272
1318
  let r = e.properties.onSubmit;
1273
- if (!r?.length) return Er;
1319
+ if (!r?.length) return Mr;
1274
1320
  if (!n) return {
1275
- ...Er,
1321
+ ...Mr,
1276
1322
  messages: ["The form submit continuation requires an interaction scope."]
1277
1323
  };
1278
1324
  let i = t?.command ?? "", a = n.context.responseContracts ?? {
@@ -1280,96 +1326,107 @@ function Dr(e, t, n) {
1280
1326
  targetType: () => void 0
1281
1327
  };
1282
1328
  return {
1283
- messages: j({
1329
+ messages: ae({
1284
1330
  kind: "form",
1285
1331
  command: i,
1286
1332
  onSubmit: r
1287
1333
  }, a).map((e) => e.message),
1288
1334
  complete: async (e, t) => {
1289
- let a = C(n.context, i, e), o = await ee(r, n.dispatcher, a);
1290
- o.findings.length && n.onFindings?.(o.findings), t(o.findings.map((e) => e.detail), o.stop === b.Navigated);
1335
+ let a = T(n.context, i, e), o = await ne(r, n.dispatcher, a);
1336
+ o.findings.length && n.onFindings?.(o.findings), t(o.findings.map((e) => e.detail), o.stop === S.Navigated);
1291
1337
  }
1292
1338
  };
1293
1339
  }
1294
1340
  // src/StageCommandForm.tsx
1295
- var Or = t(void 0), kr = t(null);
1296
- function Ar(e, t) {
1297
- return zn(e, In(e) === void 0 && e.properties.createsEntity === !0 ? {
1298
- selectableRows: [],
1299
- selectedRows: []
1300
- } : t);
1301
- }
1302
- function jr({ element: e, cancellable: t }) {
1303
- let n = U(), r = i(Ie), a = i(Or), o = i(kr), s = l(null), d = c(() => Ir(e), [e]), f = Dr(e, d, ge()), p = c(() => _i(e), [e]), m = typeof e.properties.schema == "string", h = c(() => d ? Lr(d, p) : [], [d, p]), g = d ? J(d.command, Y(e, "typeName"), Y(e, "route")) : void 0, _ = Mr(e, d), v = ii(e, h, n.resolveArgument), y = ni(e, p, n), b = JSON.stringify(y ?? null), x = c(() => y, [b]), { selectableRows: S, selectedRows: C, rowAction: w, subjectValues: T } = Ar(e, yr()), E = c(() => Wr(p, n.parameters, C, T), [
1304
- p,
1305
- C,
1341
+ var Pr = t(void 0), Fr = t(null);
1342
+ function Ir(e, t, n) {
1343
+ return $n(e, n) ? {
1344
+ ...nr(e, {
1345
+ selectableRows: [],
1346
+ selectedRows: []
1347
+ }),
1348
+ rowAction: !1
1349
+ } : nr(e, t);
1350
+ }
1351
+ function Lr(e, t) {
1352
+ let n = X(e, "schema") || t?.commandSchemas?.[X(e, "command")];
1353
+ return {
1354
+ schemaText: n,
1355
+ schema: c(() => J(n ?? ""), [n]),
1356
+ hasSchemaMetadata: typeof n == "string"
1357
+ };
1358
+ }
1359
+ function Rr({ element: e, cancellable: t }) {
1360
+ let n = U(), r = i(Ve), a = i(Pr), o = i(Fr), s = l(null), d = c(() => Ur(e), [e]), f = Nr(e, d, xe()), { schemaText: p, schema: m, hasSchemaMetadata: h } = Lr(e, n.routes), g = c(() => d ? Wr(d, m) : [], [d, m]), _ = d ? V(d.command, X(e, "typeName"), X(e, "route")) : void 0, v = zr(e, d), y = di(e, g, n.resolveArgument), b = li(e, m, n), x = JSON.stringify(b ?? null), S = c(() => b, [x]), { selectableRows: C, selectedRows: w, rowAction: T, subjectValues: ee } = Ir(e, Tr(), p), E = c(() => Zr(m, n.parameters, w, ee), [
1361
+ m,
1362
+ w,
1306
1363
  n.parameters,
1307
- T
1308
- ]), D = c(() => Gr(h, E), [h, E]), O = c(() => ({
1309
- ...x,
1310
- ...Ur(h, p, n.parameters, C, S, w),
1364
+ ee
1365
+ ]), te = c(() => Qr(g, E), [g, E]), D = c(() => ({
1366
+ ...S,
1367
+ ...Xr(g, m, n.parameters, w, C, T),
1311
1368
  ...E,
1312
- ...T,
1313
- ...Hr(h, n.parameters)
1369
+ ...ee,
1370
+ ...Yr(g, n.parameters)
1314
1371
  }), [
1315
- x,
1316
- h,
1317
- p,
1318
- n.parameters,
1319
- C,
1320
1372
  S,
1373
+ g,
1374
+ m,
1375
+ n.parameters,
1321
1376
  w,
1377
+ C,
1378
+ T,
1322
1379
  E,
1323
- T
1324
- ]), k = c(() => ({
1325
- ...Object.fromEntries(Object.keys(E).map((e) => [e, O[e]])),
1326
- ...v
1380
+ ee
1381
+ ]), O = c(() => ({
1382
+ ...Object.fromEntries(Object.keys(E).map((e) => [e, D[e]])),
1383
+ ...y
1327
1384
  }), [
1328
1385
  E,
1329
- O,
1330
- v
1331
- ]), ee = c(() => d ? Rr(d, D, p) : void 0, [
1332
- d,
1333
1386
  D,
1334
- p
1335
- ]), A = c(() => d ? hi(h, p) : [], [
1387
+ y
1388
+ ]), k = c(() => d ? Gr(d, te, m) : void 0, [
1336
1389
  d,
1337
- h,
1338
- p
1339
- ]), te = c(() => d ? gi(d.layout, h) : [], [d, h]), [j, M] = u([]);
1340
- return d ? !g && !n.routesReady ? /* @__PURE__ */ V("p", {
1390
+ te,
1391
+ m
1392
+ ]), A = c(() => d ? Si(g, m) : [], [
1393
+ d,
1394
+ g,
1395
+ m
1396
+ ]), ne = c(() => d ? Ci(d.layout, g) : [], [d, g]), [re, ie] = u([]);
1397
+ return d ? !_ && !n.routesReady ? /* @__PURE__ */ z("p", {
1341
1398
  className: "stage-note",
1342
1399
  children: [
1343
1400
  "The modeled command “",
1344
1401
  d.command,
1345
1402
  "” is waiting for Stage routes."
1346
1403
  ]
1347
- }) : g ? h.length === 0 && !m && e.properties.parameterless !== !0 ? /* @__PURE__ */ B(Fr, {
1404
+ }) : _ ? g.length === 0 && !h && e.properties.parameterless !== !0 ? /* @__PURE__ */ R(Hr, {
1348
1405
  form: d,
1349
1406
  messages: [`The modeled command “${d.command}” has no form fields or schema metadata, so Stage will not submit an empty command body.`]
1350
- }) : A.length + f.messages.length > 0 ? /* @__PURE__ */ B(Fr, {
1407
+ }) : A.length + f.messages.length > 0 ? /* @__PURE__ */ R(Hr, {
1351
1408
  form: d,
1352
1409
  messages: [...A, ...f.messages]
1353
- }) : /* @__PURE__ */ B("section", {
1410
+ }) : /* @__PURE__ */ R("section", {
1354
1411
  ref: s,
1355
1412
  className: "stage-command-form",
1356
1413
  "data-command": d.command,
1357
1414
  "data-generation-mode": d.generationMode,
1358
- children: /* @__PURE__ */ V(Ye, {
1359
- command: g,
1360
- initialValues: O,
1361
- currentValues: k,
1415
+ children: /* @__PURE__ */ z(et, {
1416
+ command: _,
1417
+ initialValues: D,
1418
+ currentValues: O,
1362
1419
  validateOn: "both",
1363
1420
  validateAllFieldsOnChange: !0,
1364
- onBeforeExecute: (e) => Xn(e, r.apiBasePath),
1365
- onFieldValidate: (e, t, n, r) => mi(h, p, t, r),
1366
- onValidationFailure: (e) => M(pi(h, e)),
1367
- onException: (e) => M(e),
1368
- onFailed: (e) => M(Qn(d.command, e).messages),
1421
+ onBeforeExecute: (e) => Ft(e, r.apiBasePath),
1422
+ onFieldValidate: (e, t, n, r) => xi(g, m, t, r),
1423
+ onValidationFailure: (e) => ie(bi(g, e)),
1424
+ onException: (e) => ie(e),
1425
+ onFailed: (e) => ie(Lt(d.command, e).messages),
1369
1426
  onSuccess: async (t) => {
1370
1427
  n.refreshAfterCommand();
1371
1428
  let r = (t, n) => {
1372
- M(t), t.length || Pr(e, n, a);
1429
+ ie(t), t.length || Vr(e, n, a);
1373
1430
  };
1374
1431
  try {
1375
1432
  await f.complete(t, r);
@@ -1378,51 +1435,51 @@ function jr({ element: e, cancellable: t }) {
1378
1435
  }
1379
1436
  },
1380
1437
  children: [
1381
- te.map((e) => /* @__PURE__ */ B("p", {
1438
+ ne.map((e) => /* @__PURE__ */ R("p", {
1382
1439
  role: "alert",
1383
1440
  className: "stage-form-error",
1384
1441
  children: e
1385
1442
  }, e)),
1386
- ee,
1387
- j.map((e) => /* @__PURE__ */ B("p", {
1443
+ k,
1444
+ re.map((e) => /* @__PURE__ */ R("p", {
1388
1445
  role: "alert",
1389
1446
  className: "stage-form-error",
1390
1447
  children: e
1391
1448
  }, e)),
1392
- o ? Ge(/* @__PURE__ */ B(H, {
1449
+ o ? $e(/* @__PURE__ */ R(B, {
1393
1450
  type: "button",
1394
1451
  className: "scene-slice-dialog-submit",
1395
1452
  onClick: () => s.current?.querySelector("form")?.requestSubmit(),
1396
- children: _
1397
- }), o) : /* @__PURE__ */ B(Nr, {
1398
- submitLabel: _,
1453
+ children: v
1454
+ }), o) : /* @__PURE__ */ R(Br, {
1455
+ submitLabel: v,
1399
1456
  cancellable: t
1400
1457
  })
1401
1458
  ]
1402
- }, b)
1403
- }) : /* @__PURE__ */ V("p", {
1459
+ }, x)
1460
+ }) : /* @__PURE__ */ z("p", {
1404
1461
  className: "stage-note",
1405
1462
  children: [
1406
1463
  "The modeled command “",
1407
1464
  d.command,
1408
1465
  "” is not registered by this Stage."
1409
1466
  ]
1410
- }) : /* @__PURE__ */ B("p", {
1467
+ }) : /* @__PURE__ */ R("p", {
1411
1468
  className: "stage-note",
1412
1469
  children: "This form is missing its command metadata."
1413
1470
  });
1414
1471
  }
1415
- function Mr(e, t) {
1416
- return Y(e, "submitLabel") || t?.label || "Submit";
1472
+ function zr(e, t) {
1473
+ return X(e, "submitLabel") || t?.label || "Submit";
1417
1474
  }
1418
- function Nr({ submitLabel: e, cancellable: t }) {
1419
- let n = i(Or);
1420
- return /* @__PURE__ */ V("div", {
1475
+ function Br({ submitLabel: e, cancellable: t }) {
1476
+ let n = i(Pr);
1477
+ return /* @__PURE__ */ z("div", {
1421
1478
  className: "stage-command-form__actions",
1422
- children: [/* @__PURE__ */ B(H, {
1479
+ children: [/* @__PURE__ */ R(B, {
1423
1480
  type: "submit",
1424
1481
  children: e
1425
- }), t && n && /* @__PURE__ */ B(H, {
1482
+ }), t && n && /* @__PURE__ */ R(B, {
1426
1483
  type: "button",
1427
1484
  variant: "outline",
1428
1485
  onClick: n,
@@ -1430,59 +1487,59 @@ function Nr({ submitLabel: e, cancellable: t }) {
1430
1487
  })]
1431
1488
  });
1432
1489
  }
1433
- function Pr(e, t, n) {
1434
- let r = Y(e, "navigateToScreen");
1435
- r && !t && tr(r, {}), n?.();
1490
+ function Vr(e, t, n) {
1491
+ let r = X(e, "navigateToScreen");
1492
+ r && !t && H(r, {}), n?.();
1436
1493
  }
1437
- function Fr({ form: e, messages: t }) {
1438
- return /* @__PURE__ */ B("section", {
1494
+ function Hr({ form: e, messages: t }) {
1495
+ return /* @__PURE__ */ R("section", {
1439
1496
  className: "stage-command-form",
1440
1497
  "data-command": e.command,
1441
1498
  "data-generation-mode": e.generationMode,
1442
- children: t.map((e) => /* @__PURE__ */ B("p", {
1499
+ children: t.map((e) => /* @__PURE__ */ R("p", {
1443
1500
  role: "alert",
1444
1501
  className: "stage-form-error",
1445
1502
  children: e
1446
1503
  }, e))
1447
1504
  });
1448
1505
  }
1449
- function Ir(e) {
1450
- let t = Y(e, "command");
1506
+ function Ur(e) {
1507
+ let t = X(e, "command");
1451
1508
  if (!t) return;
1452
- let n = Array.isArray(e.properties.fields) ? e.properties.fields.filter(X) : [];
1509
+ let n = Array.isArray(e.properties.fields) ? e.properties.fields.filter(Z) : [];
1453
1510
  return {
1454
1511
  command: t,
1455
- label: Y(e, "label") || K(t),
1512
+ label: X(e, "label") || q(t),
1456
1513
  fields: n,
1457
- generationMode: oi(e.properties.generationMode),
1458
- layout: si(e.properties.layout)
1514
+ generationMode: pi(e.properties.generationMode),
1515
+ layout: mi(e.properties.layout)
1459
1516
  };
1460
1517
  }
1461
- function Lr(e, t) {
1462
- return e.generationMode === p.Manual || e.fields.length > 0 ? e.fields : t.filter((e) => !e.unsupportedReason).map((e) => ({
1518
+ function Wr(e, t) {
1519
+ return e.generationMode === m.Manual || e.fields.length > 0 ? e.fields : t.filter((e) => !e.unsupportedReason).map((e) => ({
1463
1520
  name: e.name,
1464
- label: K(e.name)
1521
+ label: q(e.name)
1465
1522
  }));
1466
1523
  }
1467
- function Rr(e, t, n) {
1468
- let r = e.layout, i = r ? ci(r, t) : [];
1469
- if (!r || r.columns.length === 0 && i.length === 0) return t.map((e) => zr(e, n));
1470
- let a = new Map(t.map((e) => [e.name, e])), o = li(r, i), s = {
1471
- gridTemplateColumns: Array.from({ length: o }, (e, t) => ui(t + 1, r.columns)).join(" "),
1472
- columnGap: fi(r.columnGap),
1473
- rowGap: fi(r.rowGap)
1524
+ function Gr(e, t, n) {
1525
+ let r = e.layout, i = r ? hi(r, t) : [];
1526
+ if (!r || r.columns.length === 0 && i.length === 0) return t.map((e) => Kr(e, n));
1527
+ let a = new Map(t.map((e) => [e.name, e])), o = gi(r, i), s = {
1528
+ gridTemplateColumns: Array.from({ length: o }, (e, t) => _i(t + 1, r.columns)).join(" "),
1529
+ columnGap: yi(r.columnGap),
1530
+ rowGap: yi(r.rowGap)
1474
1531
  }, c = /* @__PURE__ */ new Set();
1475
- return /* @__PURE__ */ V("div", {
1532
+ return /* @__PURE__ */ z("div", {
1476
1533
  className: "stage-command-form__layout",
1477
1534
  style: s,
1478
1535
  children: [i.map((e) => {
1479
1536
  let t = a.get(e.field);
1480
- return t ? (c.add(t.name), zr(t, n, e)) : null;
1481
- }), t.filter((e) => !c.has(e.name)).map((e) => zr(e, n))]
1537
+ return t ? (c.add(t.name), Kr(t, n, e)) : null;
1538
+ }), t.filter((e) => !c.has(e.name)).map((e) => Kr(e, n))]
1482
1539
  });
1483
1540
  }
1484
- function zr(e, t, n) {
1485
- let r = e.sourceProperty ?? e.name, i = t.find((e) => e.name === r), a = e.label ?? e.name, o = (e) => e[r], s = i?.required ?? !0, c = wr(i, {
1541
+ function Kr(e, t, n) {
1542
+ let r = e.sourceProperty ?? e.name, i = t.find((e) => e.name === r), a = e.label ?? e.name, o = (e) => e[r], s = i?.required ?? !0, c = Ar(i, {
1486
1543
  value: o,
1487
1544
  fieldName: r,
1488
1545
  title: a,
@@ -1491,9 +1548,9 @@ function zr(e, t, n) {
1491
1548
  if (i?.options) {
1492
1549
  let e = i.options.map((e) => ({
1493
1550
  value: e,
1494
- label: K(e)
1551
+ label: q(e)
1495
1552
  }));
1496
- return /* @__PURE__ */ B(et, {
1553
+ return /* @__PURE__ */ R(at, {
1497
1554
  value: o,
1498
1555
  fieldName: r,
1499
1556
  title: a,
@@ -1503,7 +1560,7 @@ function zr(e, t, n) {
1503
1560
  optionLabel: "label"
1504
1561
  });
1505
1562
  }
1506
- if (i?.members || i?.item) return /* @__PURE__ */ B(or, {
1563
+ if (i?.members || i?.item) return /* @__PURE__ */ R(fr, {
1507
1564
  value: o,
1508
1565
  fieldName: r,
1509
1566
  title: a,
@@ -1511,19 +1568,19 @@ function zr(e, t, n) {
1511
1568
  descriptor: i
1512
1569
  });
1513
1570
  switch (i?.type ?? "text") {
1514
- case "number": return /* @__PURE__ */ B(nt, {
1571
+ case "number": return /* @__PURE__ */ R(st, {
1515
1572
  value: o,
1516
1573
  fieldName: r,
1517
1574
  title: a,
1518
1575
  required: s
1519
1576
  });
1520
- case "boolean": return /* @__PURE__ */ B($e, {
1577
+ case "boolean": return /* @__PURE__ */ R(it, {
1521
1578
  value: o,
1522
1579
  fieldName: r,
1523
1580
  label: a,
1524
1581
  required: s
1525
1582
  });
1526
- case "date": return /* @__PURE__ */ B(Br, {
1583
+ case "date": return /* @__PURE__ */ R(qr, {
1527
1584
  value: o,
1528
1585
  fieldName: r,
1529
1586
  title: a,
@@ -1532,15 +1589,15 @@ function zr(e, t, n) {
1532
1589
  isNonModal: !0,
1533
1590
  showTime: i?.withTime
1534
1591
  });
1535
- default: return /* @__PURE__ */ B(tt, {
1592
+ default: return /* @__PURE__ */ R(ot, {
1536
1593
  value: o,
1537
1594
  fieldName: r,
1538
1595
  title: a,
1539
1596
  required: s
1540
1597
  });
1541
1598
  }
1542
- })()), l = di(n);
1543
- return /* @__PURE__ */ B("span", {
1599
+ })()), l = vi(n);
1600
+ return /* @__PURE__ */ R("span", {
1544
1601
  className: "stage-command-form__field",
1545
1602
  "data-field": e.name,
1546
1603
  "data-row": n?.row,
@@ -1550,21 +1607,21 @@ function zr(e, t, n) {
1550
1607
  children: c
1551
1608
  }, e.name);
1552
1609
  }
1553
- var Br = Ze((e) => /* @__PURE__ */ B(Qe, {
1610
+ var qr = nt((e) => /* @__PURE__ */ R(rt, {
1554
1611
  ...e,
1555
- currentValue: e.showTime ? e.currentValue : Vr(e.currentValue),
1556
- onValueChange: (t) => e.onValueChange?.(!e.showTime && t instanceof Date && !Number.isNaN(t.getTime()) ? Ke.fromDate(t) : t)
1612
+ currentValue: e.showTime ? e.currentValue : Jr(e.currentValue),
1613
+ onValueChange: (t) => e.onValueChange?.(!e.showTime && t instanceof Date && !Number.isNaN(t.getTime()) ? Je.fromDate(t) : t)
1557
1614
  }));
1558
- function Vr(e) {
1559
- if (e instanceof Ke) return e.toDate();
1615
+ function Jr(e) {
1616
+ if (e instanceof Je) return e.toDate();
1560
1617
  if (typeof e != "string") return e;
1561
1618
  try {
1562
- return Ke.parse(e).toDate();
1619
+ return Je.parse(e).toDate();
1563
1620
  } catch {
1564
1621
  return null;
1565
1622
  }
1566
1623
  }
1567
- function Hr(e, t) {
1624
+ function Yr(e, t) {
1568
1625
  let n = {};
1569
1626
  for (let r of e) {
1570
1627
  let e = r.sourceProperty ?? r.name, i = t[e];
@@ -1572,47 +1629,47 @@ function Hr(e, t) {
1572
1629
  }
1573
1630
  return n;
1574
1631
  }
1575
- function Ur(e, t, n, r = [], i = [], a = !1) {
1632
+ function Xr(e, t, n, r = [], i = [], a = !1) {
1576
1633
  let o = new Set(e.map((e) => e.sourceProperty ?? e.name)), s = t.some((e) => e.identity), c = {};
1577
1634
  for (let e of t) {
1578
1635
  if (!e.identifier || !e.required || o.has(e.name)) continue;
1579
- if (a && Yr(e, i)) {
1580
- let t = n[e.name] || Jr(e, r);
1636
+ if (a && ni(e, i)) {
1637
+ let t = n[e.name] || ti(e, r);
1581
1638
  t && (c[e.name] = t);
1582
1639
  continue;
1583
1640
  }
1584
- let t = n[e.name] || Jr(e, r) || zt(e.identifier) || (e.identity || !s && !Yr(e, i) ? Bt(e.identifier) : void 0);
1641
+ let t = n[e.name] || ti(e, r) || jt(e.identifier) || (e.identity || !s && !ni(e, i) ? Mt(e.identifier) : void 0);
1585
1642
  t !== void 0 && (c[e.name] = t);
1586
1643
  }
1587
1644
  return c;
1588
1645
  }
1589
- function Wr(e, t, n, r) {
1646
+ function Zr(e, t, n, r) {
1590
1647
  return Object.fromEntries(e.filter((e) => e.reference).flatMap((e) => {
1591
- let i = t[e.name] || r[e.name] || Jr(e, n) || (Kr({
1648
+ let i = t[e.name] || r[e.name] || ti(e, n) || ($r({
1592
1649
  ...e,
1593
1650
  required: !0
1594
- }, t) ? qr(e, t) : void 0);
1651
+ }, t) ? ei(e, t) : void 0);
1595
1652
  return i === void 0 ? [] : [[e.name, i]];
1596
1653
  }));
1597
1654
  }
1598
- function Gr(e, t) {
1655
+ function Qr(e, t) {
1599
1656
  return e.filter((e) => !Object.hasOwn(t, e.sourceProperty ?? e.name));
1600
1657
  }
1601
- function Kr(e, t) {
1602
- return !e.identifier || !e.required ? !1 : e.identity === !0 || qr(e, t) !== void 0;
1658
+ function $r(e, t) {
1659
+ return !e.identifier || !e.required ? !1 : e.identity === !0 || ei(e, t) !== void 0;
1603
1660
  }
1604
- function qr(e, t) {
1605
- if (e.identifier) return t[e.name] || zt(e.identifier);
1661
+ function ei(e, t) {
1662
+ if (e.identifier) return t[e.name] || jt(e.identifier);
1606
1663
  }
1607
- function Jr(e, t) {
1664
+ function ti(e, t) {
1608
1665
  if (!e.identifier) return;
1609
1666
  let n = new Set(t.map((t) => t[e.name]).filter((e) => typeof e == "string" && e !== ""));
1610
1667
  return n.size === 1 ? [...n][0] : void 0;
1611
1668
  }
1612
- function Yr(e, t) {
1669
+ function ni(e, t) {
1613
1670
  return t.some((t) => Object.hasOwn(t, e.name));
1614
1671
  }
1615
- function Xr(e, t) {
1672
+ function ri(e, t) {
1616
1673
  let n = e.id;
1617
1674
  if (typeof n != "string" || n === "") return e;
1618
1675
  let r = `${t.alias ?? ""} ${t.name ?? ""}`.match(/[A-Z][a-z0-9]+/g) ?? [], i = Object.fromEntries(r.map((e) => `${e.charAt(0).toLowerCase()}${e.slice(1)}Id`).filter((t) => !Object.hasOwn(e, t)).map((e) => [e, n]));
@@ -1621,253 +1678,165 @@ function Xr(e, t) {
1621
1678
  ...e
1622
1679
  };
1623
1680
  }
1624
- function Zr(e) {
1625
- return Object.values(e).flatMap((e) => e.rows.map((t) => [t, Xr(t, e)]));
1681
+ function ii(e) {
1682
+ return Object.values(e).flatMap((e) => e.rows.map((t) => [t, ri(t, e)]));
1626
1683
  }
1627
- function Qr(e) {
1628
- return Zr(e).map(([, e]) => e);
1684
+ function ai(e) {
1685
+ return ii(e).map(([, e]) => e);
1629
1686
  }
1630
- function $r(e, t) {
1631
- let n = new Map(Zr(t));
1687
+ function oi(e, t) {
1688
+ let n = new Map(ii(t));
1632
1689
  return Object.values(e).filter((e) => e !== void 0).map((e) => n.get(e) ?? e);
1633
1690
  }
1634
- function ei(e, t, n, r) {
1635
- return e.filter((e) => e.identifier && e.required && Yr(e, r)).filter((e) => !t[e.name] && Jr(e, n) === void 0).map((e) => e.name);
1691
+ function si(e, t, n, r) {
1692
+ return e.filter((e) => e.identifier && e.required && ni(e, r)).filter((e) => !t[e.name] && ti(e, n) === void 0).map((e) => e.name);
1636
1693
  }
1637
- function ti(e) {
1694
+ function ci(e) {
1638
1695
  let t = e.properties.populateSource;
1639
- return X(t) ? t : void 0;
1696
+ return Z(t) ? t : void 0;
1640
1697
  }
1641
- function ni(e, t, n) {
1642
- let r = ti(e), i = r?.queryName, a = Object.entries(r?.parameterBindings ?? {}).map(([e, r]) => [e, ri(e, r?.path ?? e, t, n)]), o = Object.fromEntries(a.filter(([, e]) => e !== void 0 && e !== "")), s = !!i && n.routesReady && a.every(([, e]) => e !== void 0 && e !== ""), l = W({
1643
- scope: `populate:${Y(e, "command")}`,
1698
+ function li(e, t, n) {
1699
+ let r = ci(e), i = r?.queryName, a = Object.entries(r?.parameterBindings ?? {}).map(([e, r]) => [e, ui(e, r?.path ?? e, t, n)]), o = Object.fromEntries(a.filter(([, e]) => e !== void 0 && e !== "")), s = !!i && n.routesReady && a.every(([, e]) => e !== void 0 && e !== ""), l = W({
1700
+ scope: `populate:${X(e, "command")}`,
1644
1701
  name: i,
1645
1702
  route: i ? n.routes?.queries?.[i] : void 0,
1646
1703
  arguments: o,
1647
1704
  ready: s,
1648
1705
  publish: !1
1649
- }), u = r?.itemBinding ? n.resolveBinding(r.itemBinding) ?? n.selected : void 0, d = i ? l.rows[0] : X(u) ? u : void 0;
1706
+ }), u = r?.itemBinding ? n.resolveBinding(r.itemBinding) ?? n.selected : void 0, d = i ? l.rows[0] : Z(u) ? u : void 0;
1650
1707
  return c(() => {
1651
1708
  if (!d) return;
1652
1709
  let e = {};
1653
1710
  for (let n of t) {
1654
1711
  let t = d[n.name] ?? d[n.name.charAt(0).toLowerCase() + n.name.slice(1)];
1655
- t != null && (e[n.name] = Mn(n, t));
1712
+ t != null && (e[n.name] = Yn(n, t));
1656
1713
  }
1657
1714
  return Object.keys(e).length > 0 ? e : void 0;
1658
1715
  }, [d, t]);
1659
1716
  }
1660
- function ri(e, t, n, r) {
1717
+ function ui(e, t, n, r) {
1661
1718
  let i = r.parameters[t] ?? r.parameters[e];
1662
1719
  if (i) return i;
1663
1720
  let a = n.find((n) => n.name === t || n.name === e)?.identifier;
1664
- if (a) return Bt(a);
1721
+ if (a) return Mt(a);
1665
1722
  let o = r.resolveBinding({ path: t });
1666
1723
  return typeof o == "string" || typeof o == "number" ? o : void 0;
1667
1724
  }
1668
- function ii(e, t, n) {
1669
- let r = c(() => ai(e, t), [e, t]), i = r.map((e) => n(e.source)), a = JSON.stringify(i);
1725
+ function di(e, t, n) {
1726
+ let r = c(() => fi(e, t), [e, t]), i = r.map((e) => n(e.source)), a = JSON.stringify(i);
1670
1727
  return c(() => {
1671
1728
  let e = Object.fromEntries(r.map((e, t) => [e.name, i[t]]).filter(([, e]) => e != null && e !== ""));
1672
1729
  return Object.keys(e).length > 0 ? e : void 0;
1673
1730
  }, [r, a]);
1674
1731
  }
1675
- function ai(e, t) {
1732
+ function fi(e, t) {
1676
1733
  let n = e.properties.arguments;
1677
1734
  if (!Array.isArray(n)) return [];
1678
1735
  let r = new Set(t.map((e) => e.sourceProperty ?? e.name));
1679
1736
  return n.filter((e) => typeof e == "object" && !!e && typeof e.name == "string" && typeof e.source == "string" && r.has(e.name));
1680
1737
  }
1681
- function oi(e) {
1682
- return e === p.Manual ? p.Manual : p.Auto;
1738
+ function pi(e) {
1739
+ return e === m.Manual ? m.Manual : m.Auto;
1683
1740
  }
1684
- function si(e) {
1685
- if (!X(e)) return;
1741
+ function mi(e) {
1742
+ if (!Z(e)) return;
1686
1743
  let t = e;
1687
1744
  return {
1688
- columns: Array.isArray(t.columns) ? t.columns.filter(vi) : [],
1689
- placements: Array.isArray(t.placements) ? t.placements.filter(yi) : [],
1690
- columnGap: bi(t.columnGap) ? t.columnGap : void 0,
1691
- rowGap: bi(t.rowGap) ? t.rowGap : void 0
1745
+ columns: Array.isArray(t.columns) ? t.columns.filter(wi) : [],
1746
+ placements: Array.isArray(t.placements) ? t.placements.filter(Ti) : [],
1747
+ columnGap: Ei(t.columnGap) ? t.columnGap : void 0,
1748
+ rowGap: Ei(t.rowGap) ? t.rowGap : void 0
1692
1749
  };
1693
1750
  }
1694
- function ci(e, t) {
1751
+ function hi(e, t) {
1695
1752
  let n = new Map(e.placements.map((e) => [e.field, e]));
1696
- for (let e of t) !n.has(e.name) && yi(e.placement) && n.set(e.name, e.placement);
1753
+ for (let e of t) !n.has(e.name) && Ti(e.placement) && n.set(e.name, e.placement);
1697
1754
  return [...n.values()].sort((e, t) => e.row - t.row || e.column - t.column || e.field.localeCompare(t.field));
1698
1755
  }
1699
- function li(e, t) {
1756
+ function gi(e, t) {
1700
1757
  return Math.max(1, ...e.columns.map((e) => e.index), ...t.map((e) => e.column + (e.columnSpan ?? 1) - 1));
1701
1758
  }
1702
- function ui(e, t) {
1703
- let n = t.find((t) => t.index === e), r = fi(n?.width), i = fi(n?.minWidth), a = fi(n?.maxWidth);
1704
- return n?.width?.unit === m.Fraction && a ? `minmax(${i ?? "0"}, ${r ?? "1fr"})` : i || a ? `minmax(${i ?? "0"}, ${a && r ? `min(${r}, ${a})` : a ?? r ?? "1fr"})` : r ?? "1fr";
1759
+ function _i(e, t) {
1760
+ let n = t.find((t) => t.index === e), r = yi(n?.width), i = yi(n?.minWidth), a = yi(n?.maxWidth);
1761
+ return n?.width?.unit === h.Fraction && a ? `minmax(${i ?? "0"}, ${r ?? "1fr"})` : i || a ? `minmax(${i ?? "0"}, ${a && r ? `min(${r}, ${a})` : a ?? r ?? "1fr"})` : r ?? "1fr";
1705
1762
  }
1706
- function di(e) {
1763
+ function vi(e) {
1707
1764
  if (e) return {
1708
1765
  gridColumn: `${e.column} / span ${e.columnSpan ?? 1}`,
1709
1766
  gridRow: `${e.row} / span ${e.rowSpan ?? 1}`,
1710
- width: e.width?.unit === m.Fraction ? void 0 : fi(e.width)
1767
+ width: e.width?.unit === h.Fraction ? void 0 : yi(e.width)
1711
1768
  };
1712
1769
  }
1713
- function fi(e) {
1770
+ function yi(e) {
1714
1771
  if (e) switch (e.unit) {
1715
- case m.Fraction: return `${e.value ?? 1}fr`;
1716
- case m.Pixels: return `${e.value ?? 0}px`;
1717
- case m.Percent: return `${e.value ?? 100}%`;
1718
- case m.Auto: return "auto";
1772
+ case h.Fraction: return `${e.value ?? 1}fr`;
1773
+ case h.Pixels: return `${e.value ?? 0}px`;
1774
+ case h.Percent: return `${e.value ?? 100}%`;
1775
+ case h.Auto: return "auto";
1719
1776
  }
1720
1777
  }
1721
- function pi(e, t) {
1778
+ function bi(e, t) {
1722
1779
  let n = (e, t) => !!e.members?.some((e) => e === t || e.startsWith(`${t}.`)), r = new Set(e.map((e) => t.find((t) => n(t, e.sourceProperty ?? e.name))).filter((e) => e !== void 0));
1723
1780
  return [...new Set(t.filter((e) => !r.has(e)).map((e) => e.message))];
1724
1781
  }
1725
- function mi(e, t, n, r) {
1782
+ function xi(e, t, n, r) {
1726
1783
  let i = e.find((e) => (e.sourceProperty ?? e.name) === n), a = t.find((e) => e.name === n);
1727
- if (a?.required ?? !0) return r == null || r === "" ? `${i?.label ?? n} is required` : a ? An(a, r, i?.label ?? n) : void 0;
1784
+ if (a?.required ?? !0) return r == null || r === "" ? `${i?.label ?? n} is required` : a ? qn(a, r, i?.label ?? n) : void 0;
1728
1785
  }
1729
- function hi(e, t) {
1786
+ function Si(e, t) {
1730
1787
  let n = new Map(t.map((e) => [e.name, e]));
1731
1788
  return e.flatMap((e) => {
1732
1789
  let t = n.get(e.sourceProperty ?? e.name);
1733
1790
  return t?.unsupportedReason ? [`The field “${e.label ?? e.name}” uses unsupported schema metadata: ${t.unsupportedReason}.`] : [];
1734
1791
  });
1735
1792
  }
1736
- function gi(e, t) {
1793
+ function Ci(e, t) {
1737
1794
  if (!e) return [];
1738
- let n = ci(e, t).filter((e) => e.width?.unit === m.Fraction).map((e) => `The field “${e.field}” uses a fractional field width, which cannot be applied to an individual form control.`), r = e.columns.filter((e) => e.width?.unit === m.Fraction && !!e.maxWidth).map((e) => `Column ${e.index} combines a fractional width with maxWidth; Stage keeps the fractional track and ignores maxWidth for that column.`);
1795
+ let n = hi(e, t).filter((e) => e.width?.unit === h.Fraction).map((e) => `The field “${e.field}” uses a fractional field width, which cannot be applied to an individual form control.`), r = e.columns.filter((e) => e.width?.unit === h.Fraction && !!e.maxWidth).map((e) => `Column ${e.index} combines a fractional width with maxWidth; Stage keeps the fractional track and ignores maxWidth for that column.`);
1739
1796
  return [...n, ...r];
1740
1797
  }
1741
- function _i(e) {
1742
- return q(Y(e, "schema"));
1743
- }
1744
- function Y(e, t, n = "") {
1798
+ function X(e, t, n = "") {
1745
1799
  let r = e.properties[t];
1746
1800
  return typeof r == "string" ? r : n;
1747
1801
  }
1748
- function vi(e) {
1749
- return X(e) && typeof e.index == "number" && Number.isInteger(e.index) && e.index > 0;
1802
+ function wi(e) {
1803
+ return Z(e) && typeof e.index == "number" && Number.isInteger(e.index) && e.index > 0;
1750
1804
  }
1751
- function yi(e) {
1752
- return X(e) && typeof e.field == "string" && typeof e.row == "number" && typeof e.column == "number" && e.row > 0 && e.column > 0;
1805
+ function Ti(e) {
1806
+ return Z(e) && typeof e.field == "string" && typeof e.row == "number" && typeof e.column == "number" && e.row > 0 && e.column > 0;
1753
1807
  }
1754
- function bi(e) {
1755
- return X(e) && Object.values(m).includes(e.unit);
1808
+ function Ei(e) {
1809
+ return Z(e) && Object.values(h).includes(e.unit);
1756
1810
  }
1757
- function X(e) {
1811
+ function Z(e) {
1758
1812
  return typeof e == "object" && !!e && !Array.isArray(e);
1759
1813
  }
1760
1814
  // src/readableValue.ts
1761
- var xi = /^(\d{4})-(\d{2})-(\d{2})$/, Si = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/;
1762
- function Ci(e) {
1815
+ var Di = /^(\d{4})-(\d{2})-(\d{2})$/, Oi = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?$/;
1816
+ function ki(e) {
1763
1817
  if (typeof e == "boolean") return e ? "Yes" : "No";
1764
- if (typeof e == "string") return wi(e) ?? Ti(e);
1818
+ if (typeof e == "string") return Ai(e) ?? ji(e);
1765
1819
  }
1766
- function wi(e) {
1767
- let t = xi.exec(e);
1820
+ function Ai(e) {
1821
+ let t = Di.exec(e);
1768
1822
  if (!t) return;
1769
1823
  let n = new Date(2e3, Number(t[2]) - 1, Number(t[3]));
1770
1824
  return n.setFullYear(Number(t[1])), Number.isNaN(n.getTime()) || n.getMonth() !== Number(t[2]) - 1 ? void 0 : n.toLocaleDateString();
1771
1825
  }
1772
- function Ti(e) {
1773
- if (!Si.test(e)) return;
1826
+ function ji(e) {
1827
+ if (!Oi.test(e)) return;
1774
1828
  let t = new Date(e);
1775
1829
  return Number.isNaN(t.getTime()) ? void 0 : t.toLocaleString();
1776
1830
  }
1777
- // src/StageGuardedAction.tsx
1778
- function Ei(e) {
1779
- return typeof e == "object" && !!e && !Array.isArray(e);
1780
- }
1781
- function Di(e, t) {
1782
- let n = e.properties[t];
1783
- return typeof n == "string" ? n : "";
1784
- }
1785
- function Oi(e) {
1786
- return e.componentName === "core:action" && (Array.isArray(e.properties.alternatives) || e.properties.otherwise !== void 0);
1787
- }
1788
- function ki(e) {
1789
- let t = U(), n = Di(e, "itemQuery"), r = (n ? t.routes?.queries?.[n] : void 0) ?? Di(e, "itemRoute"), i = Ei(e.properties.itemArguments) ? e.properties.itemArguments : {}, a = {}, o = !0;
1790
- for (let [e, n] of Object.entries(i)) {
1791
- let r = Ei(n) && (typeof n.path == "string" || typeof n.kind == "string") ? t.resolveBinding(n) : n;
1792
- a[e] = r, (r == null || r === "") && (o = !1);
1793
- }
1794
- let s = e.properties.itemSelection === !0, c = Object.values(t.selections).filter((e) => e !== void 0), l = W({
1795
- scope: `${e.id}:item`,
1796
- name: n || void 0,
1797
- route: r || void 0,
1798
- arguments: a,
1799
- ready: o && !s,
1800
- publish: !1
1801
- });
1802
- return s ? {
1803
- hasSource: !0,
1804
- item: c.length === 1 ? c[0] : void 0
1805
- } : {
1806
- hasSource: !!n || !!r,
1807
- item: l.rows.length === 1 ? l.rows[0] : void 0
1808
- };
1809
- }
1810
- function Ai(e, t) {
1811
- return Object.fromEntries(Object.entries(e.arguments ?? {}).map(([e, n]) => [e, Lt(Tt(n) ?? "", t)]));
1812
- }
1813
- function ji({ element: e, interactions: t }) {
1814
- let n = U(), r = ki(e), i = $n(), [a, o] = u([]), [s, l] = u(!1), d = Di(e, "label"), f = c(() => Array.isArray(e.properties.alternatives) ? e.properties.alternatives : [], [e]), p = Ei(e.properties.otherwise) ? e.properties.otherwise : void 0, m = f.map((e) => e.condition), h = !p || p.outcome === "Hidden" || p.outcome === "Execute" && !!p.command;
1815
- if (!Pt(m) || !h || !r.hasSource) {
1816
- let n = r.hasSource ? `${Et}: “${d}” has a guard this Stage cannot evaluate, so it stays unavailable.` : `${Et}: “${d}” has no data subject to evaluate its guard against.`;
1817
- return /* @__PURE__ */ V("div", {
1818
- className: "stage-guarded-action",
1819
- "data-scene-id": e.id,
1820
- children: [/* @__PURE__ */ B(H, {
1821
- type: "button",
1822
- disabled: !0,
1823
- title: n,
1824
- ...t,
1825
- children: d
1826
- }), /* @__PURE__ */ B("p", {
1827
- role: "alert",
1828
- className: "stage-form-error",
1829
- children: n
1830
- })]
1831
- });
1832
- }
1833
- if (!r.item) return null;
1834
- let g = Ft(m, r.item), _ = g !== void 0 && g >= 0 ? f[g] : p?.outcome === "Execute" ? p : void 0;
1835
- if (!_?.command) return null;
1836
- let v = _.command, y = J(v), b = r.item, x = async () => {
1837
- if (!y) return;
1838
- l(!0);
1839
- let t = await i(v, Ai(_, b));
1840
- if (l(!1), o(t.messages), !t.isSuccess) return;
1841
- n.refreshAfterCommand();
1842
- let r = Di(e, "navigateToScreen"), a = Di(e, "navigateByParameter"), s = a ? Lt(`item.${a}`, b) : void 0;
1843
- r && tr(r, a && s != null ? { [a]: String(s) } : {});
1844
- };
1845
- return /* @__PURE__ */ V("div", {
1846
- className: "stage-guarded-action",
1847
- "data-scene-id": e.id,
1848
- "data-command": v,
1849
- children: [/* @__PURE__ */ B(H, {
1850
- ...t,
1851
- type: "button",
1852
- disabled: !y || s,
1853
- title: y ? void 0 : "This command is not exposed as an API yet",
1854
- onClick: () => void x(),
1855
- children: d
1856
- }), a.map((e) => /* @__PURE__ */ B("p", {
1857
- role: "alert",
1858
- className: "stage-form-error",
1859
- children: e
1860
- }, e))]
1861
- });
1862
- }
1863
1831
  function Mi(e) {
1864
- let t = ge(), n = l(void 0), i = c(() => D(ce(e.id, e.behaviors), g.DoubleClick), [e.behaviors, e.id]);
1832
+ let t = xe(), n = l(void 0), i = c(() => D(pe(e.id, e.behaviors), v.DoubleClick), [e.behaviors, e.id]);
1865
1833
  a(() => () => clearTimeout(n.current), []);
1866
1834
  let o = r((e) => {
1867
1835
  if (clearTimeout(n.current), n.current = void 0, !t) return;
1868
- let r = (n) => n.path === "$guard" ? It(n.value, e) : n.path?.startsWith("item.") ? Lt(n.path, e) : t.context.resolve(n);
1869
- A(i, t.dispatcher, {
1836
+ let r = (n) => n.path?.startsWith("item.") ? A({ subject: n.path }, e) : t.context.resolve(n);
1837
+ Wt(i, t.dispatcher, {
1870
1838
  ...t.context,
1839
+ subject: () => e,
1871
1840
  resolve: r
1872
1841
  }).then((e) => {
1873
1842
  e.findings.length > 0 && t.onFindings?.(e.findings);
@@ -1888,7 +1857,7 @@ function Fi(e, t) {
1888
1857
  let n = new Set(t.map((e) => e.name));
1889
1858
  return e.map((t) => {
1890
1859
  if (t.screenTemplate !== Pi || n.has(Pi)) return t;
1891
- let r = Ii(t), i = e.find((e) => e.name !== t.name)?.name, a = z(`confirm-dialog-${t.name}`, Ni, {
1860
+ let r = Ii(t), i = e.find((e) => e.name !== t.name)?.name, a = L(`confirm-dialog-${t.name}`, Ni, {
1892
1861
  title: t.name,
1893
1862
  decisions: r,
1894
1863
  home: i
@@ -1927,23 +1896,23 @@ function Ri(e) {
1927
1896
  }
1928
1897
  // src/StageConfirmDialog.tsx
1929
1898
  function zi({ element: e }) {
1930
- let { routes: t, parameters: n, queries: r, selections: i } = U(), [o, s] = u(), c = l(null), d = typeof e.properties.title == "string" ? e.properties.title : "", f = Array.isArray(e.properties.decisions) ? e.properties.decisions : [], p = typeof e.properties.home == "string" ? e.properties.home : void 0, m = f.find((e) => e.command === o), h = $r(i, r);
1931
- return a(() => c.current?.focus(), []), /* @__PURE__ */ V("section", {
1899
+ let { routes: t, parameters: n, queries: r, selections: i } = U(), [o, s] = u(), c = l(null), d = typeof e.properties.title == "string" ? e.properties.title : "", f = Array.isArray(e.properties.decisions) ? e.properties.decisions : [], p = typeof e.properties.home == "string" ? e.properties.home : void 0, m = f.find((e) => e.command === o), h = oi(i, r);
1900
+ return a(() => c.current?.focus(), []), /* @__PURE__ */ z("section", {
1932
1901
  className: "scene-slice-dialog stage-confirm-dialog",
1933
1902
  role: "dialog",
1934
- "aria-label": K(d),
1903
+ "aria-label": q(d),
1935
1904
  "data-stage-component": Ni,
1936
1905
  children: [
1937
- /* @__PURE__ */ B("header", {
1906
+ /* @__PURE__ */ R("header", {
1938
1907
  className: "scene-slice-dialog-header",
1939
- children: /* @__PURE__ */ B("h2", {
1908
+ children: /* @__PURE__ */ R("h2", {
1940
1909
  className: "scene-slice-dialog-title",
1941
- children: K(d)
1910
+ children: q(d)
1942
1911
  })
1943
1912
  }),
1944
- /* @__PURE__ */ B("div", {
1913
+ /* @__PURE__ */ R("div", {
1945
1914
  className: "stage-confirm-dialog__decisions",
1946
- children: f.map((e, t) => /* @__PURE__ */ B("button", {
1915
+ children: f.map((e, t) => /* @__PURE__ */ R("button", {
1947
1916
  ref: t === 0 ? c : void 0,
1948
1917
  type: "button",
1949
1918
  className: t === 0 ? "scene-slice-dialog-submit stage-confirm-dialog__decision" : "scene-slice-dialog-cancel stage-confirm-dialog__decision",
@@ -1953,10 +1922,10 @@ function zi({ element: e }) {
1953
1922
  children: Vi(e)
1954
1923
  }, e.command))
1955
1924
  }),
1956
- m && /* @__PURE__ */ B(vr, { children: /* @__PURE__ */ B(jr, { element: Wi(m, t?.commandSchemas?.[m.command] ?? "", n, h) }, m.command) }),
1957
- /* @__PURE__ */ B("footer", {
1925
+ m && /* @__PURE__ */ R(wr, { children: /* @__PURE__ */ R(Rr, { element: Wi(m, t?.commandSchemas?.[m.command] ?? "", n, h) }, m.command) }),
1926
+ /* @__PURE__ */ R("footer", {
1958
1927
  className: "scene-slice-dialog-footer",
1959
- children: /* @__PURE__ */ B("button", {
1928
+ children: /* @__PURE__ */ R("button", {
1960
1929
  type: "button",
1961
1930
  className: "scene-slice-dialog-cancel stage-confirm-dialog__cancel",
1962
1931
  onClick: () => Bi(f, p),
@@ -1968,13 +1937,13 @@ function zi({ element: e }) {
1968
1937
  }
1969
1938
  function Bi(e, t) {
1970
1939
  let n = new Set(e.map((e) => e.navigateToScreen).filter((e) => !!e)), r = n.size === 1 ? [...n][0] : t;
1971
- r && tr(r, {});
1940
+ r && H(r, {});
1972
1941
  }
1973
1942
  function Vi(e) {
1974
- return e.label ?? K(e.command);
1943
+ return e.label ?? q(e.command);
1975
1944
  }
1976
1945
  function Hi(e, t, n) {
1977
- return !e.identifier || !e.required ? !1 : e.identity === !0 || !!t[e.name] || Jr(e, n) !== void 0;
1946
+ return !e.identifier || !e.required ? !1 : e.identity === !0 || !!t[e.name] || ti(e, n) !== void 0;
1978
1947
  }
1979
1948
  function Ui(e, t, n, r) {
1980
1949
  let i = e.form?.fields ?? [], a = i.length > 0 ? i : t.filter((e) => !e.unsupportedReason).map((e) => ({
@@ -1983,11 +1952,11 @@ function Ui(e, t, n, r) {
1983
1952
  })), o = new Set(t.filter((e) => Hi(e, n, r)).map((e) => e.name)), s = a.filter((e) => !o.has(e.sourceProperty ?? e.name)), c = new Set(s.map((e) => e.sourceProperty ?? e.name)), l = t.filter((e) => e.identifier && e.required && !o.has(e.name) && !c.has(e.name));
1984
1953
  return [...s, ...l.map((e) => ({
1985
1954
  name: e.name,
1986
- label: K(e.name)
1955
+ label: q(e.name)
1987
1956
  }))];
1988
1957
  }
1989
1958
  function Wi(e, t, n, r) {
1990
- let i = Ui(e, q(t), n, r);
1959
+ let i = Ui(e, J(t), n, r);
1991
1960
  return {
1992
1961
  id: `confirm-${e.command}`,
1993
1962
  componentName: Ni,
@@ -1999,7 +1968,7 @@ function Wi(e, t, n, r) {
1999
1968
  route: e.route,
2000
1969
  navigateToScreen: e.navigateToScreen,
2001
1970
  schema: t || void 0,
2002
- generationMode: i.length === 0 ? p.Manual : e.form?.generationMode,
1971
+ generationMode: i.length === 0 ? m.Manual : e.form?.generationMode,
2003
1972
  layout: e.form?.layout,
2004
1973
  populateSource: e.form?.populateSource,
2005
1974
  fields: i
@@ -2037,38 +2006,40 @@ function qi(e, t, n, r) {
2037
2006
  };
2038
2007
  }
2039
2008
  function Ji(e, t) {
2040
- return (n) => n.path === "$guard" ? It(n.value, e.item) : n.path === "value" ? e.value : n.path === "previous" ? e.previous : n.path?.startsWith("item.") ? Lt(n.path, e.item) : t(n);
2009
+ let n = ee({ dataContext: { item: e.item } });
2010
+ return (r) => r.path === "value" ? e.value : r.path === "previous" ? e.previous : r.path === "item" || r.path?.startsWith("item.") ? n(r) : t(r);
2041
2011
  }
2042
2012
  function Yi(e, t) {
2043
- let n = ge(), i = U(), { element: a, rowsProperty: o, idField: s, valueField: d } = e, f = c(() => D(ce(a.id, a.behaviors), g.Change), [a.behaviors, a.id]), p = l(void 0), m = l(!1), [h, _] = u(0), v = l({
2013
+ let n = xe(), i = U(), { element: a, rowsProperty: o, idField: s, valueField: d } = e, f = c(() => D(pe(a.id, a.behaviors), v.Change), [a.behaviors, a.id]), p = l(void 0), m = l(!1), [h, g] = u(0), _ = l({
2044
2014
  scope: n,
2045
2015
  data: i,
2046
2016
  element: a,
2047
2017
  bindings: f
2048
2018
  });
2049
- v.current = {
2019
+ _.current = {
2050
2020
  scope: n,
2051
2021
  data: i,
2052
2022
  element: a,
2053
2023
  bindings: f
2054
2024
  };
2055
2025
  let y = r((e, t) => {
2056
- let { scope: n, data: r, element: i, bindings: a } = v.current, c = Ki(e, t);
2026
+ let { scope: n, data: r, element: i, bindings: a } = _.current, c = Ki(e, t);
2057
2027
  if (!n || a.length === 0 || c === void 0) return;
2058
2028
  let l = qi(i.properties[o], c, s, d);
2059
2029
  if (l === void 0) return;
2060
2030
  let u = {
2061
2031
  ...n.context,
2032
+ subject: () => l.item,
2062
2033
  resolve: Ji(l, n.context.resolve)
2063
- }, f = !1, p = !1, m = {
2034
+ }, f = !1, p = !1;
2035
+ Wt(a, {
2064
2036
  ...n.dispatcher,
2065
2037
  executeCommand: async (e, t) => {
2066
2038
  let r = await n.dispatcher.executeCommand(e, t);
2067
2039
  return r?.isSuccess ? f = !0 : p = !0, r;
2068
2040
  }
2069
- };
2070
- A(a, m, u).then((e) => {
2071
- e.findings.length > 0 && n.onFindings?.(e.findings), r.refreshAfterCommand(), (!f || p) && _((e) => e + 1);
2041
+ }, u).then((e) => {
2042
+ e.findings.length > 0 && n.onFindings?.(e.findings), r.refreshAfterCommand(), (!f || p) && g((e) => e + 1);
2072
2043
  });
2073
2044
  }, [
2074
2045
  o,
@@ -2097,17 +2068,17 @@ function Xi(e) {
2097
2068
  rowsProperty: "cards",
2098
2069
  idField: typeof t.properties.cardId == "string" ? t.properties.cardId : "id",
2099
2070
  valueField: n
2100
- }, e.bindingOutputs), i = Se;
2101
- return r.declared ? /* @__PURE__ */ B(i, {
2071
+ }, e.bindingOutputs), i = De;
2072
+ return r.declared ? /* @__PURE__ */ R(i, {
2102
2073
  ...e,
2103
2074
  interactions: {
2104
2075
  ...e.interactions,
2105
2076
  onChange: r.onChange
2106
2077
  },
2107
2078
  bindingOutputs: r.outputs
2108
- }, r.revision) : /* @__PURE__ */ B(i, { ...e });
2079
+ }, r.revision) : /* @__PURE__ */ R(i, { ...e });
2109
2080
  }
2110
- var Zi = le(De, I.KanbanBoard), Qi = "Stage:commandForm";
2081
+ var Zi = me(Me, P.KanbanBoard), Qi = "Stage:commandForm";
2111
2082
  function $i(e, t, n = {}) {
2112
2083
  return {
2113
2084
  id: e,
@@ -2116,23 +2087,23 @@ function $i(e, t, n = {}) {
2116
2087
  slots: n
2117
2088
  };
2118
2089
  }
2119
- function Z(e, t, n = "") {
2090
+ function Q(e, t, n = "") {
2120
2091
  let r = e.properties[t];
2121
2092
  return typeof r == "string" ? r : n;
2122
2093
  }
2123
2094
  function ea(e, t, n) {
2124
2095
  let r = typeof e == "number" && Number.isInteger(e) ? n && n.length === t?.length ? t?.[n.indexOf(e)] : t?.[e] : e;
2125
- return typeof r == "string" && t?.includes(r) ? K(r) : Ci(e) ?? String(e ?? "");
2096
+ return typeof r == "string" && t?.includes(r) ? q(r) : ki(e) ?? String(e ?? "");
2126
2097
  }
2127
2098
  function ta(e, t) {
2128
2099
  let n = e.properties.queryArguments;
2129
- if (!oa(n)) return {
2100
+ if (!sa(n)) return {
2130
2101
  values: {},
2131
2102
  ready: !0
2132
2103
  };
2133
2104
  let r = {}, i = !0;
2134
2105
  for (let [e, a] of Object.entries(n)) {
2135
- let n = aa(a) ? t.resolveBinding(a) : a;
2106
+ let n = oa(a) ? t.resolveBinding(a) : a;
2136
2107
  r[e] = n, (n == null || n === "") && (i = !1);
2137
2108
  }
2138
2109
  return {
@@ -2155,20 +2126,20 @@ function na(e, t) {
2155
2126
  }));
2156
2127
  return n.length > 0 ? n : r;
2157
2128
  }
2158
- function Q(e, t) {
2129
+ function ra(e, t) {
2159
2130
  return e[t] ?? e.id ?? e.key;
2160
2131
  }
2161
- function ra({ element: e, slots: t }) {
2162
- let n = U(), r = Z(e, "query", Z(e, "typeName", e.id)), i = (Z(e, "query") ? n.routes?.queries?.[Z(e, "query")] : void 0) ?? Z(e, "route"), o = c(() => ta(e, n), [n, e]), { rows: s, error: l, loading: u, awaitingCommand: d } = W({
2132
+ function ia({ element: e, slots: t }) {
2133
+ let n = U(), r = Q(e, "query", Q(e, "typeName", e.id)), i = (Q(e, "query") ? n.routes?.queries?.[Q(e, "query")] : void 0) ?? Q(e, "route"), o = c(() => ta(e, n), [n, e]), { rows: s, error: l, loading: u, awaitingCommand: d } = W({
2163
2134
  scope: e.id,
2164
2135
  name: r,
2165
2136
  route: i || void 0,
2166
2137
  arguments: o.values,
2167
2138
  ready: o.ready
2168
- }), f = na(e, s), p = Z(e, "navigateOnRowClickToScreen"), m = Z(e, "navigateOnRowClickByParameter"), h = Z(e, "dataKey") || m || "id", g = n.selections[e.id], _ = m ? n.parameters[m] : void 0, v = Mi(e);
2139
+ }), f = na(e, s), p = Q(e, "navigateOnRowClickToScreen"), m = Q(e, "navigateOnRowClickByParameter"), h = Q(e, "dataKey") || m || "id", g = n.selections[e.id], _ = m ? n.parameters[m] : void 0, v = Mi(e);
2169
2140
  a(() => {
2170
2141
  if (!g) return;
2171
- let t = Q(g, h), r = t === void 0 ? void 0 : s.find((e) => Q(e, h) === t);
2142
+ let t = ra(g, h), r = t === void 0 ? void 0 : s.find((e) => ra(e, h) === t);
2172
2143
  r && r !== g ? n.selectRow(e.id, r) : !r && t !== void 0 && !u && n.clearSelection(e.id);
2173
2144
  }, [
2174
2145
  n,
@@ -2183,8 +2154,8 @@ function ra({ element: e, slots: t }) {
2183
2154
  g && n.clearSelection(e.id);
2184
2155
  return;
2185
2156
  }
2186
- if (g && String(Q(g, h)) === _) return;
2187
- let t = s.find((e) => String(Q(e, h)) === _);
2157
+ if (g && String(ra(g, h)) === _) return;
2158
+ let t = s.find((e) => String(ra(e, h)) === _);
2188
2159
  t && n.selectRow(e.id, t);
2189
2160
  }, [
2190
2161
  n,
@@ -2196,54 +2167,54 @@ function ra({ element: e, slots: t }) {
2196
2167
  g
2197
2168
  ]);
2198
2169
  let y = (t) => {
2199
- let r = Q(t, h);
2170
+ let r = ra(t, h);
2200
2171
  if (m && r != null) {
2201
2172
  let i = {
2202
2173
  ...p && p !== n.screen ? {} : n.parameters,
2203
2174
  [m]: String(r)
2204
2175
  };
2205
- p && p !== n.screen || n.selectRow(e.id, t), tr(p || n.screen, i);
2176
+ p && p !== n.screen || n.selectRow(e.id, t), H(p || n.screen, i);
2206
2177
  } else n.selectRow(e.id, t);
2207
2178
  };
2208
- return !Z(e, "query") && !i && !bt(r) ? /* @__PURE__ */ V("section", {
2179
+ return !Q(e, "query") && !i && !Tt(r) ? /* @__PURE__ */ z("section", {
2209
2180
  className: "stage-table",
2210
2181
  "data-scene-id": e.id,
2211
- children: [/* @__PURE__ */ V("p", {
2182
+ children: [/* @__PURE__ */ z("p", {
2212
2183
  className: "stage-note",
2213
2184
  children: [
2214
2185
  "No query is exposed for ",
2215
- Z(e, "typeName", "this read model"),
2186
+ Q(e, "typeName", "this read model"),
2216
2187
  " yet."
2217
2188
  ]
2218
2189
  }), t.columns]
2219
- }) : /* @__PURE__ */ V("section", {
2190
+ }) : /* @__PURE__ */ z("section", {
2220
2191
  className: "stage-table",
2221
2192
  "data-scene-id": e.id,
2222
2193
  children: [
2223
- (u || d) && /* @__PURE__ */ B(We, {
2194
+ (u || d) && /* @__PURE__ */ R(Qe, {
2224
2195
  severity: "info",
2225
2196
  text: "Loading…"
2226
2197
  }),
2227
- l && /* @__PURE__ */ B(We, {
2198
+ l && /* @__PURE__ */ R(Qe, {
2228
2199
  severity: "error",
2229
2200
  text: l
2230
2201
  }),
2231
- g && /* @__PURE__ */ B(H, {
2202
+ g && /* @__PURE__ */ R(B, {
2232
2203
  type: "button",
2233
2204
  size: "small",
2234
2205
  onClick: () => {
2235
2206
  if (n.clearSelection(e.id), !m || n.parameters[m] === void 0) return;
2236
2207
  let { [m]: t, ...r } = n.parameters;
2237
- tr(n.screen, r);
2208
+ H(n.screen, r);
2238
2209
  },
2239
2210
  children: "Clear selection"
2240
2211
  }),
2241
- /* @__PURE__ */ V("table", {
2242
- "aria-label": Z(e, "label", Z(e, "typeName", "Results")),
2243
- children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ B("tr", { children: f.map((e) => /* @__PURE__ */ B("th", {
2212
+ /* @__PURE__ */ z("table", {
2213
+ "aria-label": Q(e, "label", Q(e, "typeName", "Results")),
2214
+ children: [/* @__PURE__ */ R("thead", { children: /* @__PURE__ */ R("tr", { children: f.map((e) => /* @__PURE__ */ R("th", {
2244
2215
  scope: "col",
2245
2216
  children: e.label
2246
- }, e.property)) }) }), /* @__PURE__ */ V("tbody", { children: [s.map((e, t) => /* @__PURE__ */ B("tr", {
2217
+ }, e.property)) }) }), /* @__PURE__ */ z("tbody", { children: [s.map((e, t) => /* @__PURE__ */ R("tr", {
2247
2218
  "aria-selected": g === e,
2248
2219
  tabIndex: 0,
2249
2220
  onClick: () => v.click(e, () => y(e)),
@@ -2251,8 +2222,8 @@ function ra({ element: e, slots: t }) {
2251
2222
  onKeyDown: (t) => {
2252
2223
  (t.key === "Enter" || t.key === " ") && (t.preventDefault(), y(e));
2253
2224
  },
2254
- children: f.map((t) => /* @__PURE__ */ B("td", { children: ea(e[t.property], t.options, t.optionValues) }, t.property))
2255
- }, String(Q(e, h) ?? t))), /* @__PURE__ */ B(ia, {
2225
+ children: f.map((t) => /* @__PURE__ */ R("td", { children: ea(e[t.property], t.options, t.optionValues) }, t.property))
2226
+ }, String(ra(e, h) ?? t))), /* @__PURE__ */ R(aa, {
2256
2227
  rowCount: s.length,
2257
2228
  columnCount: f.length,
2258
2229
  loading: u,
@@ -2262,82 +2233,116 @@ function ra({ element: e, slots: t }) {
2262
2233
  ]
2263
2234
  });
2264
2235
  }
2265
- function ia({ rowCount: e, columnCount: t, loading: n, awaitingCommand: r }) {
2266
- return e !== 0 || n || r ? null : /* @__PURE__ */ B("tr", { children: /* @__PURE__ */ B("td", {
2236
+ function aa({ rowCount: e, columnCount: t, loading: n, awaitingCommand: r }) {
2237
+ return e !== 0 || n || r ? null : /* @__PURE__ */ R("tr", { children: /* @__PURE__ */ R("td", {
2267
2238
  colSpan: Math.max(t, 1),
2268
2239
  children: "No records found"
2269
2240
  }) });
2270
2241
  }
2271
- function aa(e) {
2272
- return oa(e) && (typeof e.path == "string" || typeof e.kind == "string");
2273
- }
2274
2242
  function oa(e) {
2243
+ return sa(e) && (typeof e.path == "string" || typeof e.kind == "string");
2244
+ }
2245
+ function sa(e) {
2275
2246
  return typeof e == "object" && !!e && !Array.isArray(e);
2276
2247
  }
2277
- function sa({ element: e, interactions: t, slots: n }) {
2278
- return Oi(e) ? /* @__PURE__ */ B(ji, {
2248
+ function ca({ element: e, interactions: t, slots: n }) {
2249
+ return $t(e) ? /* @__PURE__ */ R(en, {
2279
2250
  element: e,
2280
2251
  interactions: t
2281
- }) : /* @__PURE__ */ B(ca, {
2252
+ }) : /* @__PURE__ */ R(fa, {
2282
2253
  element: e,
2283
2254
  interactions: t,
2284
2255
  slots: n
2285
2256
  });
2286
2257
  }
2287
- function ca({ element: e, interactions: t }) {
2288
- let n = Z(e, "label") || K(Z(e, "command")), r = J(Z(e, "command"), Z(e, "typeName"), Z(e, "route")), i = In(e), a = la(e, i), o = Z(e, "schema"), s = c(() => q(o), [o]), { selectedRows: l } = yr(), u = Ln(i, l);
2289
- return r ? a.length > 0 || Rn(i, u) ? /* @__PURE__ */ B(H, {
2258
+ function la(e) {
2259
+ let { routes: t, parameters: n } = U(), r = Q(e, "schema") || t?.commandSchemas?.[Q(e, "command")], i = c(() => J(r ?? ""), [r]), a = Qn(e), o = $n(e, r), { selectableRows: s, selectedRows: l } = Tr(), u = Q(e, "generationMode").toLowerCase() !== "manual", d = ua(e, a, o, u), f = u ? da(e, r, i, n, a, o ? [] : s) : {};
2260
+ return {
2261
+ element: {
2262
+ ...e,
2263
+ properties: {
2264
+ ...e.properties,
2265
+ ...f,
2266
+ ...r ? { schema: r } : {},
2267
+ createsEntity: o,
2268
+ rowAction: d
2269
+ }
2270
+ },
2271
+ subject: a,
2272
+ properties: i,
2273
+ selectedRows: l
2274
+ };
2275
+ }
2276
+ function ua(e, t, n, r) {
2277
+ return n || t !== void 0 ? !1 : r || e.properties.rowAction === !0;
2278
+ }
2279
+ function da(e, t, n, r, i, a) {
2280
+ let o = e.properties.fields;
2281
+ if (!Array.isArray(o) || o.length === 0) return Ca(t, n, r, i, a);
2282
+ if (a.length === 0 || i === "screen" || i === void 0 && e.properties.rowAction !== !0 && n.filter((e) => e.identifier).length > 1) return {};
2283
+ let s = new Set(n.filter((e) => xa(e, i, a)).map((e) => e.name));
2284
+ return {
2285
+ fields: o.filter((e) => !s.has(ha(e))),
2286
+ generationMode: "manual"
2287
+ };
2288
+ }
2289
+ function fa({ element: e, interactions: t }) {
2290
+ let { element: n, subject: r, properties: i, selectedRows: a } = la(e), o = Q(n, "label") || q(Q(n, "command")), s = V(Q(n, "command"), Q(n, "typeName"), Q(n, "route")), c = pa(n, r), l = er(r, a);
2291
+ return s ? c.length > 0 || tr(r, l) ? /* @__PURE__ */ R(B, {
2290
2292
  type: "button",
2291
- "data-scene-id": e.id,
2293
+ "data-scene-id": n.id,
2292
2294
  disabled: !0,
2293
2295
  title: "Select a row first",
2294
2296
  ...t,
2295
- children: n
2296
- }) : /* @__PURE__ */ B(fa, {
2297
- element: u ? Hn(e, s, u) : e,
2298
- label: n
2299
- }) : /* @__PURE__ */ B(H, {
2297
+ children: o
2298
+ }) : /* @__PURE__ */ R(_a, {
2299
+ element: l ? ar(n, i, l) : n,
2300
+ label: o
2301
+ }) : /* @__PURE__ */ R(B, {
2300
2302
  type: "button",
2301
- "data-scene-id": e.id,
2303
+ "data-scene-id": n.id,
2302
2304
  disabled: !0,
2303
2305
  title: "This command is not exposed as an API yet",
2304
2306
  ...t,
2305
- children: n
2307
+ children: o
2306
2308
  });
2307
2309
  }
2308
- function la(e, t) {
2309
- let { parameters: n } = U(), r = Z(e, "schema"), i = e.properties.fields, a = Z(e, "generationMode").toLowerCase(), o = c(() => q(r), [r]), { selectableRows: s, selectedRows: l } = yr(), u = Array.isArray(i) ? i : [], d = u.length > 0 || a === "manual" ? new Set(u.map(ua).filter((e) => e !== "")) : void 0;
2310
- return !d || t !== void 0 ? [] : ei(o.filter((e) => !d.has(e.name)), n, l, s);
2310
+ function pa(e, t) {
2311
+ let { parameters: n } = U(), r = Q(e, "schema"), i = e.properties.fields, a = c(() => J(r), [r]), { selectableRows: o, selectedRows: s } = Tr(), l = Array.isArray(i) ? i : [], u = ma(e, l) ? new Set(l.map(ha).filter((e) => e !== "")) : void 0;
2312
+ return !u || t !== void 0 || $n(e, r) ? [] : si(a.filter((e) => !u.has(e.name)), n, s, o);
2313
+ }
2314
+ function ma(e, t) {
2315
+ return t.length > 0 || e.properties.rowAction === !0 || Q(e, "generationMode").toLowerCase() === "manual";
2311
2316
  }
2312
- function ua(e) {
2313
- return oa(e) ? typeof e.sourceProperty == "string" && e.sourceProperty !== "" ? e.sourceProperty : typeof e.name == "string" ? e.name : "" : "";
2317
+ function ha(e) {
2318
+ return sa(e) ? typeof e.sourceProperty == "string" && e.sourceProperty !== "" ? e.sourceProperty : typeof e.name == "string" ? e.name : "" : "";
2314
2319
  }
2315
- function da(e) {
2320
+ function ga(e) {
2316
2321
  let t = (e?.parentElement?.classList.contains("stage-toolbar-action") ? e.parentElement : e)?.previousElementSibling;
2317
2322
  return t?.classList.contains("stage-action") === !0 || t?.classList.contains("stage-toolbar-action") === !0;
2318
2323
  }
2319
- function fa({ element: e, label: t }) {
2324
+ function _a({ element: e, label: t }) {
2320
2325
  let [n, i] = u(0), [a, o] = u(!1), [c, d] = u(!1), f = l(null);
2321
- s(() => d(da(f.current)));
2326
+ s(() => d(ga(f.current)));
2322
2327
  let p = r(() => {
2323
2328
  o(!1), i((e) => e + 1);
2324
- }, []), m = /* @__PURE__ */ B(Or.Provider, {
2329
+ }, []), m = /* @__PURE__ */ R(Pr.Provider, {
2325
2330
  value: p,
2326
- children: /* @__PURE__ */ B(jr, {
2331
+ children: /* @__PURE__ */ R(Rr, {
2327
2332
  element: e,
2328
2333
  cancellable: !0
2329
2334
  }, n)
2330
2335
  });
2331
- return /* @__PURE__ */ V("div", {
2336
+ return /* @__PURE__ */ z("div", {
2332
2337
  className: "stage-action",
2333
2338
  "data-scene-id": e.id,
2334
2339
  ref: f,
2335
- children: [/* @__PURE__ */ B(H, {
2340
+ children: [/* @__PURE__ */ R(B, {
2336
2341
  type: "button",
2337
- variant: xn(Z(e, "emphasis"), c),
2342
+ variant: Rn(Q(e, "emphasis"), c),
2338
2343
  onClick: () => o(!0),
2339
2344
  children: t
2340
- }), /* @__PURE__ */ B(Ue, {
2345
+ }), /* @__PURE__ */ R(Ze, {
2341
2346
  title: t,
2342
2347
  visible: a,
2343
2348
  onClose: () => o(!1),
@@ -2348,45 +2353,45 @@ function fa({ element: e, label: t }) {
2348
2353
  })]
2349
2354
  });
2350
2355
  }
2351
- function pa(e) {
2352
- let t = e.element ?? $i("slice-dialog", {}), n = _e(), { routes: i, parameters: a } = U(), o = he(n?.currentDialogParameters), s = Z(t, "command") || o?.command || Z(t, "slice") || "", l = Z(t, "title") || o?.title || K(s), d = i?.commandSchemas?.[s], f = c(() => q(d ?? ""), [d]), { selectableRows: p, selectedRows: m } = yr(), h = r(() => n?.closeDialog(), [n]), [g, _] = u(null), v = (e) => e.identifier && e.required && Yr(e, p) && Jr(e, m) !== void 0;
2353
- if (!d || !(f.some((e) => e.options || e.members || e.item) || f.some(v))) return e.element ? /* @__PURE__ */ B(M, {
2356
+ function va(e) {
2357
+ let t = e.element ?? $i("slice-dialog", {}), n = Se(), { routes: i, parameters: a } = U(), o = be(n?.currentDialogParameters), s = Q(t, "command") || o?.command || Q(t, "slice") || "", l = Q(t, "title") || o?.title || q(s), d = i?.commandSchemas?.[s], f = c(() => J(d ?? ""), [d]), { selectableRows: p, selectedRows: m } = Tr(), h = r(() => n?.closeDialog(), [n]), [g, _] = u(null), v = (e) => e.identifier && e.required && ni(e, p) && ti(e, m) !== void 0;
2358
+ if (!d || !(f.some((e) => e.options || e.members || e.item) || f.some(v))) return e.element ? /* @__PURE__ */ R(oe, {
2354
2359
  element: e.element,
2355
2360
  slots: e.slots ?? {}
2356
- }) : /* @__PURE__ */ B(se, {});
2357
- let y = f.filter((e) => !Kr(e, a) && !v(e)), b = $i(`slice-dialog-${s}`, {
2361
+ }) : /* @__PURE__ */ R(de, {});
2362
+ let y = f.filter((e) => !$r(e, a) && !v(e)), b = $i(`slice-dialog-${s}`, {
2358
2363
  command: s,
2359
2364
  label: l,
2360
2365
  schema: d,
2361
2366
  fields: y.map((e) => ({
2362
2367
  name: e.name,
2363
- label: K(e.name)
2368
+ label: q(e.name)
2364
2369
  })),
2365
2370
  generationMode: "manual"
2366
2371
  });
2367
- return /* @__PURE__ */ V("section", {
2372
+ return /* @__PURE__ */ z("section", {
2368
2373
  className: "scene-slice-dialog",
2369
- "data-scene-slice-dialog": Z(t, "slice") || o?.slice,
2374
+ "data-scene-slice-dialog": Q(t, "slice") || o?.slice,
2370
2375
  "data-scene-command": s,
2371
2376
  children: [
2372
- /* @__PURE__ */ B("header", {
2377
+ /* @__PURE__ */ R("header", {
2373
2378
  className: "scene-slice-dialog-header",
2374
- children: /* @__PURE__ */ B("h2", {
2379
+ children: /* @__PURE__ */ R("h2", {
2375
2380
  className: "scene-slice-dialog-title",
2376
2381
  children: l
2377
2382
  })
2378
2383
  }),
2379
- /* @__PURE__ */ B(Or.Provider, {
2384
+ /* @__PURE__ */ R(Pr.Provider, {
2380
2385
  value: h,
2381
- children: /* @__PURE__ */ B(kr.Provider, {
2386
+ children: /* @__PURE__ */ R(Fr.Provider, {
2382
2387
  value: g,
2383
- children: /* @__PURE__ */ B(jr, { element: b })
2388
+ children: /* @__PURE__ */ R(Rr, { element: b })
2384
2389
  })
2385
2390
  }),
2386
- /* @__PURE__ */ B("footer", {
2391
+ /* @__PURE__ */ R("footer", {
2387
2392
  ref: _,
2388
2393
  className: "scene-slice-dialog-footer",
2389
- children: /* @__PURE__ */ B("button", {
2394
+ children: /* @__PURE__ */ R("button", {
2390
2395
  type: "button",
2391
2396
  className: "scene-slice-dialog-cancel",
2392
2397
  onClick: h,
@@ -2396,18 +2401,18 @@ function pa(e) {
2396
2401
  ]
2397
2402
  });
2398
2403
  }
2399
- function ma(e) {
2404
+ function ya(e) {
2400
2405
  let { element: t } = e;
2401
- return Z(t, "slice") === "" ? Z(t, "kind").toLowerCase() === "action" ? /* @__PURE__ */ B(_a, { ...e }) : /* @__PURE__ */ B(ne, { ...e }) : /* @__PURE__ */ B(ha, { ...e });
2406
+ return Q(t, "slice") === "" ? Q(t, "kind").toLowerCase() === "action" ? /* @__PURE__ */ R(Sa, { ...e }) : /* @__PURE__ */ R(j, { ...e }) : /* @__PURE__ */ R(ba, { ...e });
2402
2407
  }
2403
- function ha(e) {
2404
- let { element: t } = e, { routes: n, parameters: r } = U(), i = Z(t, "slice"), a = Z(t, "command") || i.split(".").at(-1) || "", o = n?.commandSchemas?.[a], s = c(() => q(o ?? ""), [o]), { selectableRows: l, selectedRows: u } = yr();
2405
- if (ei(s, r, u, l).length === 0) return /* @__PURE__ */ B(ne, { ...e });
2406
- let d = Z(t, "label", Z(t, "name", t.id));
2407
- return /* @__PURE__ */ B("span", {
2408
+ function ba(e) {
2409
+ let { element: t } = e, { routes: n, parameters: r } = U(), i = Q(t, "slice"), a = Q(t, "command") || i.split(".").at(-1) || "", o = n?.commandSchemas?.[a], s = c(() => J(o ?? ""), [o]), { selectableRows: l, selectedRows: u } = Tr();
2410
+ if ((Bn(o ?? "") ? [] : si(s, r, u, l)).length === 0) return /* @__PURE__ */ R(j, { ...e });
2411
+ let d = Q(t, "label", Q(t, "name", t.id));
2412
+ return /* @__PURE__ */ R("span", {
2408
2413
  className: "stage-toolbar-action",
2409
- "data-scene-toolbar-item": Z(t, "name", t.id),
2410
- children: /* @__PURE__ */ B(H, {
2414
+ "data-scene-toolbar-item": Q(t, "name", t.id),
2415
+ children: /* @__PURE__ */ R(B, {
2411
2416
  type: "button",
2412
2417
  "data-scene-id": t.id,
2413
2418
  disabled: !0,
@@ -2417,61 +2422,62 @@ function ha(e) {
2417
2422
  })
2418
2423
  });
2419
2424
  }
2420
- function ga(e, t, n) {
2421
- return t !== "screen" && !!e.identifier && e.required && Yr(e, n);
2425
+ function xa(e, t, n) {
2426
+ return t !== "screen" && !!e.identifier && e.required && ni(e, n);
2422
2427
  }
2423
- function _a(e) {
2424
- let { element: t } = e, { routes: n, parameters: r } = U(), i = Z(t, "name", t.id), a = Z(t, "target"), o = Z(t, "label", i), s = n?.commandSchemas?.[a], l = c(() => q(s ?? ""), [s]), u = In(t), d = c(() => u === void 0 && Cn(s ?? ""), [s, u]), { selectableRows: f, selectedRows: p } = yr(), m = d ? [] : f, h = u === void 0 && !d ? ei(l, r, p, m) : [], g = va(s, l, r, u, m), _ = d ? { createsEntity: !0 } : Bn(t, u), v = {
2428
+ function Sa(e) {
2429
+ let { element: t } = e, { routes: n, parameters: r } = U(), i = Q(t, "name", t.id), a = Q(t, "target"), o = Q(t, "label", i), s = n?.commandSchemas?.[a], l = c(() => J(s ?? ""), [s]), u = Qn(t), d = c(() => u === void 0 && Bn(s ?? ""), [s, u]), { selectableRows: f, selectedRows: p } = Tr(), m = d ? [] : f, h = u === void 0 && !d ? si(l, r, p, m) : [], g = Ca(s, l, r, u, m), _ = d ? { createsEntity: !0 } : rr(t, u), v = {
2425
2430
  ...t,
2426
2431
  componentName: "core:action",
2427
2432
  properties: {
2428
2433
  command: a,
2429
2434
  label: o,
2430
- emphasis: Z(t, "emphasis"),
2435
+ emphasis: Q(t, "emphasis"),
2431
2436
  ...g,
2432
2437
  ..._
2433
2438
  }
2434
2439
  };
2435
- return /* @__PURE__ */ B("span", {
2440
+ return /* @__PURE__ */ R("span", {
2436
2441
  className: "stage-toolbar-action",
2437
2442
  "data-scene-toolbar-item": i,
2438
- children: h.length > 0 ? /* @__PURE__ */ B(H, {
2443
+ children: h.length > 0 ? /* @__PURE__ */ R(B, {
2439
2444
  type: "button",
2440
2445
  "data-scene-id": t.id,
2441
2446
  disabled: !0,
2442
2447
  title: "Select a row first",
2443
2448
  ...e.interactions,
2444
2449
  children: o
2445
- }) : /* @__PURE__ */ B(sa, {
2450
+ }) : /* @__PURE__ */ R(ca, {
2446
2451
  element: v,
2447
2452
  interactions: e.interactions,
2448
2453
  slots: e.slots
2449
2454
  })
2450
2455
  });
2451
2456
  }
2452
- function va(e, t, n, r, i) {
2457
+ function Ca(e, t, n, r, i) {
2453
2458
  return e ? {
2454
2459
  schema: e,
2455
- fields: t.filter((e) => !Kr(e, n) && !ga(e, r, i)).map((e) => ({
2460
+ fields: t.filter((e) => !$r(e, n) && !xa(e, r, i)).map((e) => ({
2456
2461
  name: e.name,
2457
- label: K(e.name)
2462
+ label: q(e.name)
2458
2463
  })),
2459
2464
  generationMode: "manual"
2460
2465
  } : {};
2461
2466
  }
2462
- var ya = {
2463
- ...ue,
2464
- "core:table": ra,
2465
- "core:action": sa,
2466
- "core:toolbarItem": ma,
2467
- "core:sliceDialog": pa,
2468
- [Qi]: jr,
2467
+ var wa = {
2468
+ ...he,
2469
+ "core:table": ia,
2470
+ "core:action": ca,
2471
+ "core:guarded-action": en,
2472
+ "core:toolbarItem": ya,
2473
+ "core:sliceDialog": va,
2474
+ [Qi]: Rr,
2469
2475
  [Ni]: zi,
2470
2476
  [Zi]: Xi
2471
2477
  };
2472
2478
  // src/useStrings.ts
2473
- function ba() {
2474
- let e = ut(), [t, n] = u([]), [r, i] = u(""), [o, s] = u({});
2479
+ function Ta() {
2480
+ let e = ht(), [t, n] = u([]), [r, i] = u(""), [o, s] = u({});
2475
2481
  return a(() => {
2476
2482
  let t = new AbortController();
2477
2483
  return e.locales(t.signal).then((e) => {
@@ -2492,11 +2498,11 @@ function ba() {
2492
2498
  dictionary: o
2493
2499
  };
2494
2500
  }
2495
- var xa = /* @__PURE__ */ new Set(["core:table"]);
2496
- function Sa(e) {
2497
- return Ca(e, /* @__PURE__ */ new Map(), void 0);
2501
+ var Ea = /* @__PURE__ */ new Set(["core:table"]);
2502
+ function Da(e) {
2503
+ return Oa(e, /* @__PURE__ */ new Map(), void 0);
2498
2504
  }
2499
- function Ca(e, t, n) {
2505
+ function Oa(e, t, n) {
2500
2506
  let r = e;
2501
2507
  if (!r.slots) return e;
2502
2508
  let i = !1, a = {};
@@ -2505,7 +2511,7 @@ function Ca(e, t, n) {
2505
2511
  a[e] = o.map((e) => {
2506
2512
  let t = e, n = $(t, "typeName");
2507
2513
  t.componentName === "core:data" && n && (r.set(n, t), s = t);
2508
- let a = Ca(Ta(wa(t, r), s), r, s);
2514
+ let a = Oa(Aa(ka(t, r), s), r, s);
2509
2515
  return a !== e && (i = !0), a;
2510
2516
  });
2511
2517
  }
@@ -2514,8 +2520,8 @@ function Ca(e, t, n) {
2514
2520
  slots: a
2515
2521
  } : e;
2516
2522
  }
2517
- function wa(e, t) {
2518
- if (!xa.has(e.componentName)) return e;
2523
+ function ka(e, t) {
2524
+ if (!Ea.has(e.componentName)) return e;
2519
2525
  let n = $(e, "typeName"), r = n ? t.get(n) : void 0;
2520
2526
  if (!r || e.properties.queryArguments !== void 0) return e;
2521
2527
  let i = $(r, "by"), a = { ...e.properties }, o = $(r, "query");
@@ -2524,8 +2530,8 @@ function wa(e, t) {
2524
2530
  properties: a
2525
2531
  };
2526
2532
  }
2527
- function Ta(e, t) {
2528
- if (e.componentName !== "core:action" || !Array.isArray(e.properties?.alternatives) || !t || e.properties.itemQuery !== void 0) return e;
2533
+ function Aa(e, t) {
2534
+ if (!["core:guarded-action", "core:action"].includes(e.componentName) || !Array.isArray(e.properties?.alternatives) || !t || e.properties.itemQuery !== void 0) return e;
2529
2535
  let n = { ...e.properties };
2530
2536
  if (t.properties?.isCollection === !0) return n.itemSelection = !0, {
2531
2537
  ...e,
@@ -2542,7 +2548,7 @@ function $(e, t) {
2542
2548
  return typeof n == "string" && n.length > 0 ? n : void 0;
2543
2549
  }
2544
2550
  // src/stageQueryBindings.tsx
2545
- function Ea(e) {
2551
+ function ja(e) {
2546
2552
  let t = /* @__PURE__ */ new Set(), n = (e) => {
2547
2553
  if (Array.isArray(e)) {
2548
2554
  e.forEach(n);
@@ -2558,7 +2564,7 @@ function Ea(e) {
2558
2564
  };
2559
2565
  return r(e), [...t];
2560
2566
  }
2561
- function Da(e) {
2567
+ function Ma(e) {
2562
2568
  let t = /* @__PURE__ */ new Map(), n = (e, t) => {
2563
2569
  let n = e.properties?.[t];
2564
2570
  return typeof n == "string" && n.length > 0 ? n : void 0;
@@ -2577,7 +2583,7 @@ function Da(e) {
2577
2583
  };
2578
2584
  return r(e), [...t.values()];
2579
2585
  }
2580
- function Oa({ source: e }) {
2586
+ function Na({ source: e }) {
2581
2587
  let { routes: t, routesReady: n, parameters: r, session: i } = U(), a = e.by ? r[e.by] || i[e.by] : void 0, o = c(() => e.by ? a ? { [e.by]: a } : {} : {
2582
2588
  ...i,
2583
2589
  ...r
@@ -2597,7 +2603,7 @@ function Oa({ source: e }) {
2597
2603
  list: !0
2598
2604
  }), null;
2599
2605
  }
2600
- function ka({ name: e }) {
2606
+ function Pa({ name: e }) {
2601
2607
  let { routes: t, routesReady: n, parameters: r, session: i } = U(), a = c(() => ({
2602
2608
  ...i,
2603
2609
  ...r
@@ -2611,59 +2617,59 @@ function ka({ name: e }) {
2611
2617
  list: !0
2612
2618
  }), null;
2613
2619
  }
2614
- function Aa({ element: e }) {
2615
- let t = c(() => Ea(e), [e]), n = c(() => Da(e), [e]);
2616
- return /* @__PURE__ */ V(He, { children: [t.map((e) => /* @__PURE__ */ B(ka, { name: e }, e)), n.map((e) => /* @__PURE__ */ B(Oa, { source: e }, e.typeName))] });
2620
+ function Fa({ element: e }) {
2621
+ let t = c(() => ja(e), [e]), n = c(() => Ma(e), [e]);
2622
+ return /* @__PURE__ */ z(Xe, { children: [t.map((e) => /* @__PURE__ */ R(Pa, { name: e }, e)), n.map((e) => /* @__PURE__ */ R(Na, { source: e }, e.typeName))] });
2617
2623
  }
2618
2624
  // src/stageThemeChoice.ts
2619
- var ja = "cratis.stage.theme";
2620
- function Ma() {
2625
+ var Ia = "cratis.stage.theme";
2626
+ function La() {
2621
2627
  try {
2622
2628
  return globalThis.localStorage ?? null;
2623
2629
  } catch {
2624
2630
  return null;
2625
2631
  }
2626
2632
  }
2627
- function Na() {
2633
+ function Ra() {
2628
2634
  try {
2629
- return Ma()?.getItem("cratis.stage.theme") || void 0;
2635
+ return La()?.getItem("cratis.stage.theme") || void 0;
2630
2636
  } catch {
2631
2637
  return;
2632
2638
  }
2633
2639
  }
2634
- function Pa(e) {
2640
+ function za(e) {
2635
2641
  try {
2636
- Ma()?.setItem(ja, e);
2642
+ La()?.setItem(Ia, e);
2637
2643
  } catch {}
2638
2644
  }
2639
2645
  // src/screenTitle.ts
2640
- var Fa = "core:title", Ia = ["content", "main"];
2641
- function La(e) {
2646
+ var Ba = "core:title", Va = ["content", "main"];
2647
+ function Ha(e) {
2642
2648
  let t = e;
2643
- if (t.componentName !== Fa) return;
2649
+ if (t.componentName !== Ba) return;
2644
2650
  let n = t.properties?.text;
2645
2651
  return typeof n == "string" && n.trim().length > 0 ? n : void 0;
2646
2652
  }
2647
- function Ra(e) {
2653
+ function Ua(e) {
2648
2654
  for (let t of e ?? []) {
2649
- let e = La(t);
2655
+ let e = Ha(t);
2650
2656
  if (e !== void 0) return e;
2651
2657
  }
2652
2658
  }
2653
- function za(e) {
2654
- let t = e.slotContent ?? {}, n = [...Ia, ...Object.keys(t).filter((e) => !Ia.includes(e))];
2659
+ function Wa(e) {
2660
+ let t = e.slotContent ?? {}, n = [...Va, ...Object.keys(t).filter((e) => !Va.includes(e))];
2655
2661
  for (let e of n) {
2656
- let n = Ra(t[e]);
2662
+ let n = Ua(t[e]);
2657
2663
  if (n !== void 0) return n;
2658
2664
  }
2659
- return bn(e.name);
2665
+ return Ln(e.name);
2660
2666
  }
2661
- function Ba(e) {
2667
+ function Ga(e) {
2662
2668
  let t = /* @__PURE__ */ new Set(), n = [];
2663
2669
  for (let r of e.flatMap((e) => e.contributions ?? [])) {
2664
- let e = Ha(r);
2670
+ let e = qa(r);
2665
2671
  if (!e) continue;
2666
- let i = Wa(e);
2672
+ let i = Ya(e);
2667
2673
  t.has(i) || (t.add(i), n.push(e));
2668
2674
  }
2669
2675
  return n.map((e, t) => ({
@@ -2671,47 +2677,47 @@ function Ba(e) {
2671
2677
  index: t
2672
2678
  })).sort((e, t) => (e.entry.order ?? 2 ** 53 - 1) - (t.entry.order ?? 2 ** 53 - 1) || e.index - t.index).map(({ entry: e }) => e);
2673
2679
  }
2674
- function Va(e) {
2680
+ function Ka(e) {
2675
2681
  let t = {
2676
2682
  label: "",
2677
2683
  children: []
2678
2684
  };
2679
2685
  for (let n of e) {
2680
- let e = n.hierarchy.reduce((e, t) => Ga(e, t, !1), t);
2681
- (n.group ? Ga(e, n.group, !0) : e).children.push(Ka(n));
2686
+ let e = n.hierarchy.reduce((e, t) => Xa(e, t, !1), t);
2687
+ (n.group ? Xa(e, n.group, !0) : e).children.push(Za(n));
2682
2688
  }
2683
2689
  return t.children;
2684
2690
  }
2685
- function Ha(e) {
2691
+ function qa(e) {
2686
2692
  if (e.contributionPointName !== "Navigation") return;
2687
2693
  let t = e.content?.properties ?? {}, n = t.label, r = t.targetScreen;
2688
2694
  if (typeof n != "string" || typeof r != "string") return;
2689
- let i = Ua(t), a = e.order ?? (typeof t.order == "number" ? t.order : void 0), o = t.destination;
2695
+ let i = Ja(t), a = e.order ?? (typeof t.order == "number" ? t.order : void 0), o = t.destination;
2690
2696
  return {
2691
2697
  label: n,
2692
2698
  targetScreen: r,
2693
2699
  hierarchy: i,
2694
2700
  order: a,
2695
- ...Ja({
2696
- id: qa(t.id),
2697
- group: qa(t.group),
2698
- icon: qa(t.icon),
2699
- presentation: qa(t.presentation),
2700
- destination: Xa(o) && Za(o) ? o : void 0
2701
+ ...$a({
2702
+ id: Qa(t.id),
2703
+ group: Qa(t.group),
2704
+ icon: Qa(t.icon),
2705
+ presentation: Qa(t.presentation),
2706
+ destination: to(o) && no(o) ? o : void 0
2701
2707
  })
2702
2708
  };
2703
2709
  }
2704
- function Ua(e) {
2710
+ function Ja(e) {
2705
2711
  return Array.isArray(e.hierarchy) ? e.hierarchy.filter((e) => typeof e == "string") : [];
2706
2712
  }
2707
- function Wa(e) {
2713
+ function Ya(e) {
2708
2714
  return e.id === void 0 ? JSON.stringify([
2709
2715
  e.hierarchy,
2710
2716
  e.targetScreen,
2711
2717
  e.label
2712
2718
  ]) : JSON.stringify(["id", e.id]);
2713
2719
  }
2714
- function Ga(e, t, n) {
2720
+ function Xa(e, t, n) {
2715
2721
  let r = e.children.find((e) => e.screen === void 0 && e.section === !0 === n && e.label === t);
2716
2722
  if (r) return r;
2717
2723
  let i = n ? {
@@ -2724,12 +2730,12 @@ function Ga(e, t, n) {
2724
2730
  };
2725
2731
  return e.children.push(i), i;
2726
2732
  }
2727
- function Ka(e) {
2733
+ function Za(e) {
2728
2734
  return {
2729
2735
  label: e.label,
2730
- ...Ja({ id: e.id || void 0 }),
2736
+ ...$a({ id: e.id || void 0 }),
2731
2737
  screen: e.targetScreen,
2732
- ...Ja({
2738
+ ...$a({
2733
2739
  icon: e.icon || void 0,
2734
2740
  presentation: e.presentation || void 0,
2735
2741
  destination: e.destination
@@ -2737,82 +2743,82 @@ function Ka(e) {
2737
2743
  children: []
2738
2744
  };
2739
2745
  }
2740
- function qa(e) {
2746
+ function Qa(e) {
2741
2747
  return typeof e == "string" ? e : void 0;
2742
2748
  }
2743
- function Ja(e) {
2749
+ function $a(e) {
2744
2750
  return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
2745
2751
  }
2746
- function Ya(e, t) {
2752
+ function eo(e, t) {
2747
2753
  for (let n of e) {
2748
2754
  if (n.screen === t) return [n.label];
2749
- let e = Ya(n.children, t);
2755
+ let e = eo(n.children, t);
2750
2756
  if (e.length > 0) return n.section ? e : [n.label, ...e];
2751
2757
  }
2752
2758
  return [];
2753
2759
  }
2754
- function Xa(e) {
2760
+ function to(e) {
2755
2761
  return typeof e == "object" && !!e && !Array.isArray(e);
2756
2762
  }
2757
- function Za(e) {
2763
+ function no(e) {
2758
2764
  return e.outlet !== void 0 || e.dialog !== void 0 || e.kind === "external" || e.kind === "dialog";
2759
2765
  }
2760
- function Qa(e, t, n) {
2766
+ function ro(e, t, n) {
2761
2767
  return e.filter((e) => !t.has(e.name)).map((e) => ({
2762
- label: za(e),
2768
+ label: Wa(e),
2763
2769
  targetScreen: e.name,
2764
2770
  hierarchy: e.path && e.path.length > 0 ? [...e.path] : [n]
2765
2771
  }));
2766
2772
  }
2767
2773
  // src/blueprint.ts
2768
- var $a = "Stage:locale", eo = "Stage:themeToggle", to = "Cratis.Components", no = "PrimeReact", ro = /* @__PURE__ */ new Map();
2769
- function io(e) {
2770
- return Pe(e).packages.includes(no);
2774
+ var io = "Stage:locale", ao = "Stage:themeToggle", oo = "Cratis.Components", so = "PrimeReact", co = /* @__PURE__ */ new Map();
2775
+ function lo(e) {
2776
+ return ze(e).packages.includes(so);
2771
2777
  }
2772
- function ao(e, t) {
2773
- ro.set(e, t);
2778
+ function uo(e, t) {
2779
+ co.set(e, t);
2774
2780
  }
2775
- function oo(e) {
2776
- let t = Pe(e);
2781
+ function fo(e) {
2782
+ let t = ze(e);
2777
2783
  return {
2778
2784
  ...t,
2779
2785
  name: e?.length ? t.name : "Stage",
2780
- packages: T(t.packages, {
2781
- baseline: to,
2782
- catalog: { [De]: v.Blueprint }
2786
+ packages: E(t.packages, {
2787
+ baseline: oo,
2788
+ catalog: { [Me]: b.Blueprint }
2783
2789
  })
2784
2790
  };
2785
2791
  }
2786
- var so = {
2787
- ...we,
2788
- [to]: it.components
2792
+ var po = {
2793
+ ...ke,
2794
+ [oo]: lt.components
2789
2795
  };
2790
- function co(e) {
2791
- let t = [...ro.values()].reduce((e, t) => ({
2796
+ function mo(e) {
2797
+ let t = [...co.values()].reduce((e, t) => ({
2792
2798
  ...e,
2793
2799
  ...t.components
2794
2800
  }), {});
2795
2801
  return {
2796
- ...ue,
2797
- ...rt,
2802
+ ...he,
2803
+ ...ct,
2798
2804
  ...t,
2799
- ...Ee,
2800
- ...Ne,
2805
+ ...je,
2806
+ ...Re,
2801
2807
  ...e
2802
2808
  };
2803
2809
  }
2804
- function lo(e) {
2805
- let t = Object.fromEntries([...ro].map(([e, t]) => [e, t.declared]));
2810
+ function ho(e) {
2811
+ let t = Object.fromEntries([...co].map(([e, t]) => [e, t.declared]));
2806
2812
  return {
2807
2813
  ...e,
2808
- ...so,
2814
+ ...po,
2809
2815
  ...t
2810
2816
  };
2811
2817
  }
2812
- var uo = "Stage:navigationTree";
2813
- function fo(e, t, n) {
2818
+ var go = "Stage:navigationTree";
2819
+ function _o(e, t, n) {
2814
2820
  let r = t?.title ?? "Cratis Stage";
2815
- return z(e, I.Logo, {
2821
+ return L(e, P.Logo, {
2816
2822
  label: r,
2817
2823
  initials: r.slice(0, 1).toUpperCase() || "S",
2818
2824
  targetScreen: n,
@@ -2821,42 +2827,42 @@ function fo(e, t, n) {
2821
2827
  ...t?.showName === void 0 ? {} : { showName: t.showName }
2822
2828
  });
2823
2829
  }
2824
- function po(e, t, n) {
2830
+ function vo(e, t, n) {
2825
2831
  let r = [];
2826
- return e.length > 1 && r.push(z("topbar-locale", $a, {
2832
+ return e.length > 1 && r.push(L("topbar-locale", io, {
2827
2833
  locales: e,
2828
2834
  locale: t
2829
- })), n && r.push(z("topbar-theme", eo, {})), r;
2835
+ })), n && r.push(L("topbar-theme", ao, {})), r;
2830
2836
  }
2831
- function mo(e, t, n, r, i, a = {}) {
2832
- let { regions: o = !1, showFooter: s = !0, showThemeSwitcher: c = !0 } = a, l = e[0]?.name ?? "", u = i?.title ?? "Cratis Stage", d = Ba(e), f = Qa(e, new Set(d.map((e) => e.targetScreen)), "Other screens"), p = Va([...d, ...d.length > 0 ? f : []]), m = e.map((e, n) => Me({
2833
- label: za(e),
2837
+ function yo(e, t, n, r, i, a = {}) {
2838
+ let { regions: o = !1, showFooter: s = !0, showThemeSwitcher: c = !0 } = a, l = e[0]?.name ?? "", u = i?.title ?? "Cratis Stage", d = Ga(e), f = ro(e, new Set(d.map((e) => e.targetScreen)), "Other screens"), p = Ka([...d, ...d.length > 0 ? f : []]), m = e.map((e, n) => Le({
2839
+ label: Wa(e),
2834
2840
  targetScreen: e.name,
2835
2841
  icon: "pi pi-table",
2836
2842
  group: "Screens",
2837
2843
  order: n
2838
- }, t)), h = e.find((e) => e.name === t), g = h ? za(h) : bn(t), _ = Ya(Va(d), t), v = e.find((e) => e.name === t)?.path?.length ? Ya(p, t) : [], y = _.length > 0 ? _ : v, b = d.length > 0 ? z("menu-hierarchy", uo, {
2844
+ }, t)), h = e.find((e) => e.name === t), g = h ? Wa(h) : Ln(t), _ = eo(Ka(d), t), v = e.find((e) => e.name === t)?.path?.length ? eo(p, t) : [], y = _.length > 0 ? _ : v, b = d.length > 0 ? L("menu-hierarchy", go, {
2839
2845
  nodes: p,
2840
2846
  activeScreen: t
2841
- }) : z("menu-screens", I.Menu, {
2847
+ }) : L("menu-screens", P.Menu, {
2842
2848
  title: "Screens",
2843
2849
  label: "Screens"
2844
- }, { items: m }), x = po(n, r, c), S = { regionNavigation: o };
2850
+ }, { items: m }), x = vo(n, r, c), S = { regionNavigation: o };
2845
2851
  return {
2846
- [L.Topbar]: [z("topbar", I.Topbar, S, {
2847
- logo: [fo("topbar-logo", i, l)],
2852
+ [F.Topbar]: [L("topbar", P.Topbar, S, {
2853
+ logo: [_o("topbar-logo", i, l)],
2848
2854
  end: x
2849
2855
  })],
2850
- [L.Sidebar]: [z("sidebar", I.Sidebar, S, { logo: [fo("sidebar-logo", i, l)] })],
2851
- ...o ? {} : { [L.Menu]: [b] },
2852
- [L.Breadcrumb]: [z("breadcrumb", I.Breadcrumb, {
2856
+ [F.Sidebar]: [L("sidebar", P.Sidebar, S, { logo: [_o("sidebar-logo", i, l)] })],
2857
+ ...o ? {} : { [F.Menu]: [b] },
2858
+ [F.Breadcrumb]: [L("breadcrumb", P.Breadcrumb, {
2853
2859
  homeTargetScreen: l,
2854
2860
  items: (y.length > 0 ? y : [g]).map((e) => ({ label: e }))
2855
2861
  })],
2856
- ...s ? { [L.Footer]: [z("footer", I.Footer, { text: u })] } : {},
2857
- [L.ConfigPanel]: [z(I.ConfigPanel, I.ConfigPanel, {
2862
+ ...s ? { [F.Footer]: [L("footer", P.Footer, { text: u })] } : {},
2863
+ [F.ConfigPanel]: [L(P.ConfigPanel, P.ConfigPanel, {
2858
2864
  title: "Settings",
2859
- themes: R.map((e) => ({
2865
+ themes: I.map((e) => ({
2860
2866
  name: e.name,
2861
2867
  label: e.name,
2862
2868
  isDark: e.isDark ?? !1
@@ -2864,11 +2870,11 @@ function mo(e, t, n, r, i, a = {}) {
2864
2870
  })]
2865
2871
  };
2866
2872
  }
2867
- function ho(e) {
2873
+ function bo(e) {
2868
2874
  return `#/${encodeURIComponent(e)}`;
2869
2875
  }
2870
2876
  // src/externalRouteHref.ts
2871
- function go(e) {
2877
+ function xo(e) {
2872
2878
  try {
2873
2879
  let t = new URL(e ?? "");
2874
2880
  return t.protocol === "http:" || t.protocol === "https:" ? e : void 0;
@@ -2877,48 +2883,48 @@ function go(e) {
2877
2883
  }
2878
2884
  }
2879
2885
  // src/StageChrome.tsx
2880
- var _o = t({
2886
+ var So = t({
2881
2887
  locales: [],
2882
2888
  locale: "",
2883
2889
  setLocale: () => void 0,
2884
2890
  activity: ""
2885
2891
  });
2886
- function vo({ state: e, children: t }) {
2887
- return /* @__PURE__ */ B(_o.Provider, {
2892
+ function Co({ state: e, children: t }) {
2893
+ return /* @__PURE__ */ R(So.Provider, {
2888
2894
  value: e,
2889
2895
  children: t
2890
2896
  });
2891
2897
  }
2892
- var yo = "Stage:activity";
2893
- function bo() {
2894
- let { locales: e, locale: t, setLocale: n } = i(_o);
2895
- return e.length < 2 ? null : /* @__PURE__ */ B("select", {
2898
+ var wo = "Stage:activity";
2899
+ function To() {
2900
+ let { locales: e, locale: t, setLocale: n } = i(So);
2901
+ return e.length < 2 ? null : /* @__PURE__ */ R("select", {
2896
2902
  className: "stage-locale",
2897
2903
  "aria-label": "Locale",
2898
2904
  value: t,
2899
2905
  onChange: (e) => n(e.target.value),
2900
- children: e.map((e) => /* @__PURE__ */ B("option", {
2906
+ children: e.map((e) => /* @__PURE__ */ R("option", {
2901
2907
  value: e,
2902
2908
  children: e
2903
2909
  }, e))
2904
2910
  });
2905
2911
  }
2906
- function xo({ element: e }) {
2907
- let { config: t, setThemeName: n, setColorScheme: r } = Fe(), i = R.find((e) => e.name === t.themeName)?.isDark ?? t.colorScheme === F.Dark, a = R.find((e) => (e.isDark ?? !1) !== i);
2912
+ function Eo({ element: e }) {
2913
+ let { config: t, setThemeName: n, setColorScheme: r } = Be(), i = I.find((e) => e.name === t.themeName)?.isDark ?? t.colorScheme === N.Dark, a = I.find((e) => (e.isDark ?? !1) !== i);
2908
2914
  if (!a) return null;
2909
2915
  let o = i ? "Switch to a light theme" : "Switch to a dark theme";
2910
- return /* @__PURE__ */ B("div", {
2916
+ return /* @__PURE__ */ R("div", {
2911
2917
  className: "stage-theme-toggle",
2912
2918
  "data-scene-id": e.id,
2913
- children: /* @__PURE__ */ B("button", {
2919
+ children: /* @__PURE__ */ R("button", {
2914
2920
  type: "button",
2915
2921
  className: "stage-theme-toggle__button",
2916
2922
  "aria-label": o,
2917
2923
  title: o,
2918
2924
  onClick: () => {
2919
- Pa(a.name), n(a.name), r(a.isDark ? F.Dark : F.Light);
2925
+ za(a.name), n(a.name), r(a.isDark ? N.Dark : N.Light);
2920
2926
  },
2921
- children: /* @__PURE__ */ B("svg", {
2927
+ children: /* @__PURE__ */ R("svg", {
2922
2928
  width: "18",
2923
2929
  height: "18",
2924
2930
  viewBox: "0 0 24 24",
@@ -2928,43 +2934,43 @@ function xo({ element: e }) {
2928
2934
  strokeLinecap: "round",
2929
2935
  strokeLinejoin: "round",
2930
2936
  "aria-hidden": "true",
2931
- children: i ? /* @__PURE__ */ V(He, { children: [/* @__PURE__ */ B("circle", {
2937
+ children: i ? /* @__PURE__ */ z(Xe, { children: [/* @__PURE__ */ R("circle", {
2932
2938
  cx: "12",
2933
2939
  cy: "12",
2934
2940
  r: "4"
2935
- }), /* @__PURE__ */ B("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" })] }) : /* @__PURE__ */ B("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
2941
+ }), /* @__PURE__ */ R("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" })] }) : /* @__PURE__ */ R("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
2936
2942
  })
2937
2943
  })
2938
2944
  });
2939
2945
  }
2940
- function So({ element: e }) {
2946
+ function Do({ element: e }) {
2941
2947
  let t = e.properties ?? {};
2942
- return /* @__PURE__ */ B("nav", {
2948
+ return /* @__PURE__ */ R("nav", {
2943
2949
  className: "stage-navigation-tree",
2944
2950
  "aria-label": "Navigation",
2945
2951
  "data-scene-id": e.id,
2946
- children: /* @__PURE__ */ B(Co, {
2952
+ children: /* @__PURE__ */ R(Oo, {
2947
2953
  nodes: t.nodes ?? [],
2948
2954
  activeScreen: t.activeScreen
2949
2955
  })
2950
2956
  });
2951
2957
  }
2952
- function Co({ nodes: e, activeScreen: t }) {
2953
- return /* @__PURE__ */ B("ul", {
2958
+ function Oo({ nodes: e, activeScreen: t }) {
2959
+ return /* @__PURE__ */ R("ul", {
2954
2960
  role: "tree",
2955
- children: e.map((e) => e.screen === void 0 ? /* @__PURE__ */ V("li", {
2961
+ children: e.map((e) => e.screen === void 0 ? /* @__PURE__ */ z("li", {
2956
2962
  role: "treeitem",
2957
2963
  "aria-expanded": "true",
2958
- children: [/* @__PURE__ */ B("span", {
2964
+ children: [/* @__PURE__ */ R("span", {
2959
2965
  className: "stage-navigation-group",
2960
2966
  children: e.label
2961
- }), /* @__PURE__ */ B(Co, {
2967
+ }), /* @__PURE__ */ R(Oo, {
2962
2968
  nodes: e.children,
2963
2969
  activeScreen: t
2964
2970
  })]
2965
- }, e.label) : /* @__PURE__ */ B("li", {
2971
+ }, e.label) : /* @__PURE__ */ R("li", {
2966
2972
  role: "treeitem",
2967
- children: /* @__PURE__ */ B(wo, {
2973
+ children: /* @__PURE__ */ R(ko, {
2968
2974
  node: e,
2969
2975
  screen: e.screen,
2970
2976
  activeScreen: t
@@ -2972,11 +2978,11 @@ function Co({ nodes: e, activeScreen: t }) {
2972
2978
  }, `${e.screen}:${e.label}`))
2973
2979
  });
2974
2980
  }
2975
- function wo({ node: e, screen: t, activeScreen: n }) {
2976
- let r = i(ae), a = e.presentation === "icon" || e.presentation === "text" ? e.presentation : "both", o = e.destination, s = o?.kind === "external", c = o && r && !s && Za(o) ? (e) => {
2981
+ function ko({ node: e, screen: t, activeScreen: n }) {
2982
+ let r = i(M), a = e.presentation === "icon" || e.presentation === "text" ? e.presentation : "both", o = e.destination, s = o?.kind === "external", c = o && r && !s && no(o) ? (e) => {
2977
2983
  e.preventDefault(), r.navigate(o);
2978
- } : void 0, l = s ? go(o.route) : ho(t), u = s && l === void 0;
2979
- return /* @__PURE__ */ V("a", {
2984
+ } : void 0, l = s ? xo(o.route) : bo(t), u = s && l === void 0;
2985
+ return /* @__PURE__ */ z("a", {
2980
2986
  href: l,
2981
2987
  rel: s && !u ? "noreferrer" : void 0,
2982
2988
  "aria-disabled": u ? "true" : void 0,
@@ -2985,30 +2991,30 @@ function wo({ node: e, screen: t, activeScreen: n }) {
2985
2991
  "data-presentation": e.presentation,
2986
2992
  "data-icon": e.icon,
2987
2993
  onClick: c,
2988
- children: [a !== "text" && e.icon && /* @__PURE__ */ B("span", {
2994
+ children: [a !== "text" && e.icon && /* @__PURE__ */ R("span", {
2989
2995
  className: "stage-navigation-icon",
2990
2996
  "aria-hidden": "true",
2991
2997
  "data-icon-name": e.icon
2992
2998
  }), a !== "icon" && e.label]
2993
2999
  });
2994
3000
  }
2995
- function To({ element: e }) {
2996
- let t = typeof e.properties.name == "string" ? e.properties.name : "", n = i(ae), r = ye(), a = U(), o = n?.outlets[t], s = o && r ? r.screens[o] : void 0, c = e.properties.closable === !0;
2997
- return /* @__PURE__ */ V("div", {
3001
+ function Ao({ element: e }) {
3002
+ let t = typeof e.properties.name == "string" ? e.properties.name : "", n = i(M), r = we(), a = U(), o = n?.outlets[t], s = o && r ? r.screens[o] : void 0, c = e.properties.closable === !0;
3003
+ return /* @__PURE__ */ z("div", {
2998
3004
  "data-scene-outlet": t,
2999
3005
  "data-scene-outlet-screen": o,
3000
- children: [c && o && /* @__PURE__ */ B("div", {
3006
+ children: [c && o && /* @__PURE__ */ R("div", {
3001
3007
  className: "scene-outlet-bar",
3002
- children: /* @__PURE__ */ B("button", {
3008
+ children: /* @__PURE__ */ R("button", {
3003
3009
  type: "button",
3004
3010
  className: "scene-outlet-close",
3005
3011
  "aria-label": "Close",
3006
3012
  onClick: () => n?.closeOutlet(t),
3007
3013
  children: "Close"
3008
3014
  })
3009
- }), s && r && /* @__PURE__ */ B(_r, {
3015
+ }), s && r && /* @__PURE__ */ R(Cr, {
3010
3016
  element: s,
3011
- children: /* @__PURE__ */ B(N, {
3017
+ children: /* @__PURE__ */ R(le, {
3012
3018
  element: s,
3013
3019
  registry: r.registry,
3014
3020
  resolveBinding: a.resolveBinding
@@ -3016,16 +3022,16 @@ function To({ element: e }) {
3016
3022
  })]
3017
3023
  });
3018
3024
  }
3019
- function Eo() {
3020
- let { activity: e } = i(_o);
3021
- return e ? /* @__PURE__ */ B("p", {
3025
+ function jo() {
3026
+ let { activity: e } = i(So);
3027
+ return e ? /* @__PURE__ */ R("p", {
3022
3028
  className: "stage-activity",
3023
3029
  role: "status",
3024
3030
  children: e
3025
3031
  }) : null;
3026
3032
  }
3027
- function Do() {
3028
- let e = be(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
3033
+ function Mo() {
3034
+ let e = Te(), t = e?.tokens?.["surface.background"], n = e?.tokens?.["text.color"];
3029
3035
  return a(() => {
3030
3036
  let r = e?.isDark ? "dark" : "light";
3031
3037
  document.documentElement.setAttribute("data-scene-color-scheme", r), document.body.setAttribute("data-scene-color-scheme", r), document.body.style.backgroundColor = t ?? "", document.body.style.color = n ?? "";
@@ -3035,39 +3041,39 @@ function Do() {
3035
3041
  n
3036
3042
  ]), null;
3037
3043
  }
3038
- var Oo = {
3039
- [$a]: bo,
3040
- [eo]: xo,
3041
- [uo]: So,
3042
- [yo]: Eo,
3043
- "core:outlet": To
3044
+ var No = {
3045
+ [io]: To,
3046
+ [ao]: Eo,
3047
+ [go]: Do,
3048
+ [wo]: jo,
3049
+ "core:outlet": Ao
3044
3050
  };
3045
3051
  // src/stageResponseContracts.ts
3046
- function ko(e) {
3052
+ function Po(e) {
3047
3053
  return {
3048
3054
  commandResponse: (t) => e?.commands[t] ?? void 0,
3049
- targetType: (t, n) => Ao(e, t, n)
3055
+ targetType: (t, n) => Fo(e, t, n)
3050
3056
  };
3051
3057
  }
3052
- function Ao(e, t, n) {
3058
+ function Fo(e, t, n) {
3053
3059
  if (n.kind === "message") return { kind: "string" };
3054
- if (n.kind === "argument") return jo(e, t, n.name);
3060
+ if (n.kind === "argument") return Io(e, t, n.name);
3055
3061
  }
3056
- function jo(e, t, n) {
3062
+ function Io(e, t, n) {
3057
3063
  switch (t.kind) {
3058
- case h.ExecuteCommand: return e?.commandInputs[t.command]?.[n] ?? void 0;
3059
- case h.Navigate: return e?.screenInputs[t.screen]?.[n] ?? void 0;
3064
+ case _.ExecuteCommand: return e?.commandInputs[t.command]?.[n] ?? void 0;
3065
+ case _.Navigate: return e?.screenInputs[t.screen]?.[n] ?? void 0;
3060
3066
  default: return;
3061
3067
  }
3062
3068
  }
3063
3069
  // src/stageShell.ts
3064
- var Mo = [
3070
+ var Lo = [
3065
3071
  "navigationMode",
3066
3072
  "menuTheme",
3067
3073
  "showFooter",
3068
3074
  "showThemeSwitcher"
3069
- ], No = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
3070
- function Po(e, t, n = !1) {
3075
+ ], Ro = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
3076
+ function zo(e, t, n = !1) {
3071
3077
  let r = [], i = {
3072
3078
  showFooter: !0,
3073
3079
  showThemeSwitcher: !0,
@@ -3075,54 +3081,54 @@ function Po(e, t, n = !1) {
3075
3081
  problems: r
3076
3082
  };
3077
3083
  for (let [e, n] of Object.entries(t.options ?? {})) {
3078
- let a = Fo(i, t.name, e, n);
3084
+ let a = Bo(i, t.name, e, n);
3079
3085
  a && r.push(a);
3080
3086
  }
3081
- return Lo(i, e?.appearance, n), i;
3087
+ return Ho(i, e?.appearance, n), i;
3082
3088
  }
3083
- function Fo(e, t, n, r) {
3084
- if (!Mo.includes(n)) return `The shell '${t}' has no option '${n}'; the options it understands are ${Mo.join(", ")}.`;
3085
- if (n === "navigationMode") return Io(n, r, Ae, (t) => {
3089
+ function Bo(e, t, n, r) {
3090
+ if (!Lo.includes(n)) return `The shell '${t}' has no option '${n}'; the options it understands are ${Lo.join(", ")}.`;
3091
+ if (n === "navigationMode") return Vo(n, r, Fe, (t) => {
3086
3092
  e.mode = t;
3087
3093
  });
3088
- if (n === "menuTheme") return Io(n, r, je, (t) => {
3094
+ if (n === "menuTheme") return Vo(n, r, Ie, (t) => {
3089
3095
  e.menuTheme = t;
3090
3096
  });
3091
3097
  if (typeof r != "boolean") return `Option '${n}' is '${String(r)}'; expected true or false.`;
3092
3098
  n === "showFooter" ? e.showFooter = r : e.showThemeSwitcher = r;
3093
3099
  }
3094
- function Io(e, t, n, r) {
3100
+ function Vo(e, t, n, r) {
3095
3101
  let i = n.find((e) => e === t);
3096
3102
  if (!i) return `Option '${e}' is '${String(t)}'; expected one of ${n.join(", ")}.`;
3097
3103
  r(i);
3098
3104
  }
3099
- function Lo(e, t, n) {
3105
+ function Ho(e, t, n) {
3100
3106
  if (t?.colorScheme !== void 0) {
3101
- e.followsSystem = t.colorScheme === d.System;
3102
- let r = e.followsSystem ? n : t.colorScheme === d.Dark;
3103
- e.colorScheme = r ? F.Dark : F.Light, e.themeName = R.find((e) => (e.isDark ?? !1) === r)?.name, e.followsSystem || (e.showThemeSwitcher = !1);
3107
+ e.followsSystem = t.colorScheme === f.System;
3108
+ let r = e.followsSystem ? n : t.colorScheme === f.Dark;
3109
+ e.colorScheme = r ? N.Dark : N.Light, e.themeName = I.find((e) => (e.isDark ?? !1) === r)?.name, e.followsSystem || (e.showThemeSwitcher = !1);
3104
3110
  }
3105
- t?.accent !== void 0 && (No.test(t.accent) ? e.accent = t.accent : e.problems.push(`The accent '${t.accent}' is not a colour written as #rgb or #rrggbb.`));
3111
+ t?.accent !== void 0 && (Ro.test(t.accent) ? e.accent = t.accent : e.problems.push(`The accent '${t.accent}' is not a colour written as #rgb or #rrggbb.`));
3106
3112
  }
3107
- function Ro(e) {
3113
+ function Uo(e) {
3108
3114
  return {
3109
3115
  showFooter: e?.showFooter ?? !0,
3110
3116
  showThemeSwitcher: e?.showThemeSwitcher ?? !0
3111
3117
  };
3112
3118
  }
3113
- function zo(e, t) {
3119
+ function Wo(e, t) {
3114
3120
  if (e?.root === void 0) return [];
3115
3121
  let n = /* @__PURE__ */ new Set([
3116
- x.RootTemplateUnknown,
3117
- x.RootTemplateVersionNotSatisfied,
3118
- x.RootTemplateNotApplicable,
3119
- x.RootTemplateMissingContentSlot,
3120
- x.RootTemplateCycle,
3121
- x.RootTemplateBlueprintNotInstalled
3122
+ C.RootTemplateUnknown,
3123
+ C.RootTemplateVersionNotSatisfied,
3124
+ C.RootTemplateNotApplicable,
3125
+ C.RootTemplateMissingContentSlot,
3126
+ C.RootTemplateCycle,
3127
+ C.RootTemplateBlueprintNotInstalled
3122
3128
  ]), r = t.diagnostics.filter((e) => n.has(e.code)).map((e) => e.message);
3123
- return r.length === 0 && t.origin !== S.Root && r.push(`The root template '${e.root.template.id}' did not resolve, so the application would not start in the shell it names.`), r;
3129
+ return r.length === 0 && t.origin !== w.Root && r.push(`The root template '${e.root.template.id}' did not resolve, so the application would not start in the shell it names.`), r;
3124
3130
  }
3125
- function Bo(e) {
3131
+ function Go(e) {
3126
3132
  let t = e.length === 4 ? [...e.slice(1)].map((e) => e + e).join("") : e.slice(1), [n, r, i] = [
3127
3133
  0,
3128
3134
  2,
@@ -3130,7 +3136,7 @@ function Bo(e) {
3130
3136
  ].map((e) => parseInt(t.slice(e, e + 2), 16));
3131
3137
  return (n * 299 + r * 587 + i * 114) / 1e3 >= 150 ? "#111827" : "#ffffff";
3132
3138
  }
3133
- function Vo(e, t) {
3139
+ function Ko(e, t) {
3134
3140
  if (t === void 0) return e;
3135
3141
  let n = t.length === 4 ? [...t.slice(1)].map((e) => e + e).join("") : t.slice(1), [r, i, a] = [
3136
3142
  0,
@@ -3142,25 +3148,25 @@ function Vo(e, t) {
3142
3148
  tokens: {
3143
3149
  ...e.tokens,
3144
3150
  "primary.color": t,
3145
- "primary.contrastColor": Bo(t),
3151
+ "primary.contrastColor": Go(t),
3146
3152
  "focus.ring": `0 0 0 2px rgb(${r} ${i} ${a} / 0.4)`
3147
3153
  }
3148
3154
  }));
3149
3155
  }
3150
3156
  // src/StageShellSettings.tsx
3151
- var Ho = "(prefers-color-scheme: dark)";
3152
- function Uo() {
3157
+ var qo = "(prefers-color-scheme: dark)";
3158
+ function Jo() {
3153
3159
  return globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ?? !1;
3154
3160
  }
3155
- function Wo({ settings: e, onSystemSchemeChange: t }) {
3156
- let n = l(Fe());
3157
- n.current = Fe();
3161
+ function Yo({ settings: e, onSystemSchemeChange: t }) {
3162
+ let n = l(Be());
3163
+ n.current = Be();
3158
3164
  let { mode: r, menuTheme: i, colorScheme: o, themeName: s } = e;
3159
3165
  return a(() => {
3160
3166
  let { setMode: e, setMenuTheme: t, setColorScheme: a, setThemeName: c } = n.current;
3161
3167
  r !== void 0 && e(r), i !== void 0 && t(i);
3162
- let l = R.find((e) => e.name === Na());
3163
- l ? (c(l.name), a(l.isDark ? F.Dark : F.Light)) : (o !== void 0 && a(o), s !== void 0 && c(s));
3168
+ let l = I.find((e) => e.name === Ra());
3169
+ l ? (c(l.name), a(l.isDark ? N.Dark : N.Light)) : (o !== void 0 && a(o), s !== void 0 && c(s));
3164
3170
  }, [
3165
3171
  r,
3166
3172
  i,
@@ -3168,15 +3174,15 @@ function Wo({ settings: e, onSystemSchemeChange: t }) {
3168
3174
  s
3169
3175
  ]), a(() => {
3170
3176
  if (!e.followsSystem || !globalThis.matchMedia || !t) return;
3171
- let n = globalThis.matchMedia(Ho), r = (e) => t(e.matches);
3177
+ let n = globalThis.matchMedia(qo), r = (e) => t(e.matches);
3172
3178
  return n.addEventListener("change", r), () => n.removeEventListener("change", r);
3173
3179
  }, [e.followsSystem, t]), null;
3174
3180
  }
3175
3181
  // src/stageNavigationModel.ts
3176
- function Go(e) {
3182
+ function Xo(e) {
3177
3183
  return (e?.application.regions.length ?? 0) > 0 || (e?.modules.length ?? 0) > 0;
3178
3184
  }
3179
- function Ko(e) {
3185
+ function Zo(e) {
3180
3186
  let t = /* @__PURE__ */ new Map();
3181
3187
  for (let n of e) {
3182
3188
  let e = (n.path ?? []).join(".");
@@ -3189,41 +3195,41 @@ function Ko(e) {
3189
3195
  return t.get(r) ?? i ?? (e.some((e) => e.name === r) ? r : void 0);
3190
3196
  };
3191
3197
  }
3192
- function qo(e) {
3198
+ function Qo(e) {
3193
3199
  return (t) => e.find((e) => e.name === t)?.path?.[0];
3194
3200
  }
3195
- function Jo(e, t, n) {
3201
+ function $o(e, t, n) {
3196
3202
  let r = e.navigation ?? {
3197
3203
  application: { regions: [] },
3198
3204
  modules: []
3199
3205
  };
3200
3206
  return {
3201
3207
  structure: e.structure ?? { modules: [] },
3202
- navigation: n ? Yo(r, n) : r,
3203
- screenFor: Ko(e.screens),
3204
- moduleOf: qo(e.screens),
3208
+ navigation: n ? es(r, n) : r,
3209
+ screenFor: Zo(e.screens),
3210
+ moduleOf: Qo(e.screens),
3205
3211
  ...t ? { isVisible: t } : {}
3206
3212
  };
3207
3213
  }
3208
- function Yo(e, t) {
3209
- return typeof e == "string" ? k(e, t) : Array.isArray(e) ? e.map((e) => Yo(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, Yo(n, t)])) : e;
3214
+ function es(e, t) {
3215
+ return typeof e == "string" ? k(e, t) : Array.isArray(e) ? e.map((e) => es(e, t)) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, es(n, t)])) : e;
3210
3216
  }
3211
3217
  // src/stageSlices.ts
3212
- function Xo(e) {
3213
- return (t) => q(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0 && !e.members && !e.item).map((e) => ({
3218
+ function ts(e) {
3219
+ return (t) => J(e?.[t] ?? "").filter((e) => e.unsupportedReason === void 0 && !e.members && !e.item).map((e) => ({
3214
3220
  name: e.name,
3215
3221
  type: e.type === "text" || e.type === void 0 ? "string" : e.type,
3216
- label: Zo(e.name),
3222
+ label: ns(e.name),
3217
3223
  required: e.required
3218
3224
  }));
3219
3225
  }
3220
- function Zo(e) {
3226
+ function ns(e) {
3221
3227
  return e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/^./, (e) => e.toUpperCase());
3222
3228
  }
3223
- function Qo(e, t, n) {
3229
+ function rs(e, t, n) {
3224
3230
  return { invoke: async (r, i, a) => {
3225
3231
  let o = a ?? r.slice(r.lastIndexOf(".") + 1);
3226
- if (!J(o)) return {
3232
+ if (!V(o)) return {
3227
3233
  succeeded: !1,
3228
3234
  message: t ? `The modeled command “${o}” is not registered by this Stage.` : `The modeled command “${o}” is waiting for Stage routes.`
3229
3235
  };
@@ -3240,7 +3246,7 @@ function Qo(e, t, n) {
3240
3246
  } };
3241
3247
  }
3242
3248
  // src/withoutSeededSlots.ts
3243
- function $o(e, t) {
3249
+ function is(e, t) {
3244
3250
  let n = /* @__PURE__ */ new Map();
3245
3251
  for (let e of t) n.has(e.name) || n.set(e.name, e.slots.map((e) => e.name));
3246
3252
  return e.map((e) => {
@@ -3257,7 +3263,7 @@ function $o(e, t) {
3257
3263
  });
3258
3264
  }
3259
3265
  // src/stageIcons.ts
3260
- var es = /* @__PURE__ */ new Map([
3266
+ var as = /* @__PURE__ */ new Map([
3261
3267
  ["chart", "chart-column"],
3262
3268
  ["add", "plus"],
3263
3269
  ["dollar", "dollar-sign"],
@@ -3265,23 +3271,23 @@ var es = /* @__PURE__ */ new Map([
3265
3271
  ["refresh", "refresh-cw"],
3266
3272
  ["invoice", "receipt-text"],
3267
3273
  ["batch", "layers"]
3268
- ]), ts = (e) => e.trim().replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9]+)/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), ns = me([{
3269
- library: y,
3274
+ ]), os = (e) => e.trim().replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9]+)/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(), ss = ye([{
3275
+ library: x,
3270
3276
  loadGlyph: async ({ key: e }) => {
3271
- let t = ts(e), n = es.get(t) ?? t;
3272
- if (Object.hasOwn(at, n)) return (await at[n]())?.default;
3277
+ let t = os(e), n = as.get(t) ?? t;
3278
+ if (Object.hasOwn(ut, n)) return (await ut[n]())?.default;
3273
3279
  }
3274
3280
  }]);
3275
3281
  // src/App.tsx
3276
- function rs(e = {}) {
3277
- return co({
3282
+ function cs(e = {}) {
3283
+ return mo({
3278
3284
  ...e,
3279
- ...ya,
3280
- ...Oo
3285
+ ...wa,
3286
+ ...No
3281
3287
  });
3282
3288
  }
3283
- function is(e, t) {
3284
- return z(`form-${e}-${t.name}`, Qi, {
3289
+ function ls(e, t) {
3290
+ return L(`form-${e}-${t.name}`, Qi, {
3285
3291
  command: t.forCommand,
3286
3292
  label: t.name,
3287
3293
  generationMode: t.generationMode,
@@ -3290,71 +3296,71 @@ function is(e, t) {
3290
3296
  onSubmit: t.onSubmit
3291
3297
  });
3292
3298
  }
3293
- function as(e, t) {
3299
+ function us(e, t) {
3294
3300
  let n = e.screens[0];
3295
- return Oe(e, n, {
3296
- profile: oo(e.uiProfiles),
3297
- blueprintTemplates: t?.length ? [...ke, ...t] : ke
3301
+ return Ne(e, n, {
3302
+ profile: fo(e.uiProfiles),
3303
+ blueprintTemplates: t?.length ? [...Pe, ...t] : Pe
3298
3304
  });
3299
3305
  }
3300
- function os(e, t) {
3306
+ function ds(e, t) {
3301
3307
  return t ? e.map((e) => ({
3302
3308
  ...e,
3303
3309
  slotContent: Object.fromEntries(Object.entries(e.slotContent ?? {}).map(([e, n]) => [e, n.map((e) => O(e, t))]))
3304
3310
  })) : e;
3305
3311
  }
3306
- function ss(e, t, n, r, i, a, o = !0, s = !0) {
3312
+ function fs(e, t, n, r, i, a, o = !0, s = !0) {
3307
3313
  let c = {
3308
- regions: Go(e.navigation),
3314
+ regions: Xo(e.navigation),
3309
3315
  showFooter: o,
3310
3316
  showThemeSwitcher: s
3311
- }, l = os(e.screens, i), u = cs(e);
3317
+ }, l = ds(e.screens, i), u = ps(e);
3312
3318
  return {
3313
- profile: oo(e.uiProfiles),
3314
- catalog: lo(r),
3315
- blueprintTemplates: a?.length ? [...ke, ...a] : ke,
3319
+ profile: fo(e.uiProfiles),
3320
+ catalog: ho(r),
3321
+ blueprintTemplates: a?.length ? [...Pe, ...a] : Pe,
3316
3322
  namedTemplateOnly: !0,
3317
- chrome: (e, r) => r === I.FullPageShell ? { [L.ConfigPanel]: mo(l, e.name, t, n, u, c)[L.ConfigPanel] } : mo(l, e.name, t, n, u, c),
3318
- form: is,
3319
- trailing: [z("activity", yo)],
3323
+ chrome: (e, r) => r === P.FullPageShell ? { [F.ConfigPanel]: yo(l, e.name, t, n, u, c)[F.ConfigPanel] } : yo(l, e.name, t, n, u, c),
3324
+ form: ls,
3325
+ trailing: [L("activity", wo)],
3320
3326
  decorate: (e) => {
3321
- let t = Sa(gn(e));
3327
+ let t = Da(Nn(e));
3322
3328
  return i ? O(t, i) : t;
3323
3329
  }
3324
3330
  };
3325
3331
  }
3326
- function cs(e) {
3332
+ function ps(e) {
3327
3333
  let t = e.navigation?.application.logo;
3328
3334
  if (t) return {
3329
3335
  title: t.title,
3330
3336
  image: t.image || void 0
3331
3337
  };
3332
- let n = oo(e.uiProfiles).identity;
3338
+ let n = fo(e.uiProfiles).identity;
3333
3339
  if (!n?.name) return;
3334
3340
  let r = n.logo;
3335
3341
  return {
3336
3342
  title: n.name,
3337
- image: r?.kind === _.Image && r.image || void 0,
3338
- icon: r?.kind === _.Icon ? r.icon : void 0,
3343
+ image: r?.kind === y.Image && r.image || void 0,
3344
+ icon: r?.kind === y.Icon ? r.icon : void 0,
3339
3345
  showName: n.showName
3340
3346
  };
3341
3347
  }
3342
- function ls(e, t, n, r, i, a) {
3343
- let [o] = Fi([t], us(e));
3344
- return Te(e, o, ss(e, n, r, i, void 0, a)).element;
3348
+ function ms(e, t, n, r, i, a) {
3349
+ let [o] = Fi([t], hs(e));
3350
+ return Ae(e, o, fs(e, n, r, i, void 0, a)).element;
3345
3351
  }
3346
- function us(e) {
3352
+ function hs(e) {
3347
3353
  return [...e.screenTemplates ?? [], ...e.dialogTemplates ?? []];
3348
3354
  }
3349
- function ds() {
3355
+ function gs() {
3350
3356
  try {
3351
3357
  return globalThis.localStorage ?? null;
3352
3358
  } catch {
3353
3359
  return null;
3354
3360
  }
3355
3361
  }
3356
- function fs({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: i, routing: o = "hash" } = {}) {
3357
- let s = ut(), [l, d] = u(), [f, p] = u(""), m = c(() => rs(e), [e, l]), h = dt(), g = ba();
3362
+ function _s({ components: e, packageCatalog: t, screenTemplates: n, dialogTemplates: r, isVisible: i, routing: o = "hash" } = {}) {
3363
+ let s = ht(), [l, d] = u(), [f, p] = u(""), m = c(() => cs(e), [e, l]), h = gt(), g = Ta();
3358
3364
  return a(() => {
3359
3365
  let e = new AbortController();
3360
3366
  return s.scene(e.signal).then((e) => d(r?.length ? {
@@ -3363,10 +3369,10 @@ function fs({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
3363
3369
  } : e)).catch((t) => {
3364
3370
  e.signal.aborted || p(t instanceof Error ? t.message : String(t));
3365
3371
  }), () => e.abort();
3366
- }, [s, r]), f ? /* @__PURE__ */ V("main", {
3372
+ }, [s, r]), f ? /* @__PURE__ */ z("main", {
3367
3373
  className: "stage-message",
3368
- children: [/* @__PURE__ */ B("h1", { children: "Unable to render this Stage" }), /* @__PURE__ */ B("p", { children: f })]
3369
- }) : l ? /* @__PURE__ */ B(ps, {
3374
+ children: [/* @__PURE__ */ R("h1", { children: "Unable to render this Stage" }), /* @__PURE__ */ R("p", { children: f })]
3375
+ }) : l ? /* @__PURE__ */ R(vs, {
3370
3376
  scene: l,
3371
3377
  registry: m,
3372
3378
  routing: o,
@@ -3375,25 +3381,25 @@ function fs({ components: e, packageCatalog: t, screenTemplates: n, dialogTempla
3375
3381
  packageCatalog: t,
3376
3382
  screenTemplates: n,
3377
3383
  isVisible: i
3378
- }) : /* @__PURE__ */ B("main", {
3384
+ }) : /* @__PURE__ */ R("main", {
3379
3385
  className: "stage-message",
3380
- children: /* @__PURE__ */ B("h1", { children: "Preparing the Stage" })
3386
+ children: /* @__PURE__ */ R("h1", { children: "Preparing the Stage" })
3381
3387
  });
3382
3388
  }
3383
- function ps({ scene: e, registry: t, routing: n, routeState: i, strings: a, packageCatalog: o, screenTemplates: s, isVisible: l }) {
3389
+ function vs({ scene: e, registry: t, routing: n, routeState: i, strings: a, packageCatalog: o, screenTemplates: s, isVisible: l }) {
3384
3390
  let d = c(() => {
3385
- if (rr(n), n === "hash") return pe();
3391
+ if (Vt(n), n === "hash") return ve();
3386
3392
  let e = /^#\/(.+)$/.exec(globalThis.location.hash);
3387
- return e && globalThis.history.replaceState(null, "", `/${e[1]}`), fe(window, "/");
3388
- }, [n]), [f, p] = u(Uo), m = e.screens[0]?.name ?? "", h = c(() => oo(e.uiProfiles), [e]), g = c(() => m ? as(e, s) : void 0, [
3393
+ return e && globalThis.history.replaceState(null, "", `/${e[1]}`), _e(window, "/");
3394
+ }, [n]), [f, p] = u(Jo), m = e.screens[0]?.name ?? "", h = c(() => fo(e.uiProfiles), [e]), g = c(() => m ? us(e, s) : void 0, [
3389
3395
  e,
3390
3396
  s,
3391
3397
  m
3392
- ]), _ = c(() => g ? zo(h, g) : [], [h, g]), v = c(() => g ? Po(h, g, f) : void 0, [
3398
+ ]), _ = c(() => g ? Wo(h, g) : [], [h, g]), v = c(() => g ? zo(h, g, f) : void 0, [
3393
3399
  h,
3394
3400
  g,
3395
3401
  f
3396
- ]), y = c(() => Vo(R, v?.accent), [v?.accent]), { showFooter: b, showThemeSwitcher: x } = Ro(v), S = c(() => ss(e, a.locales, a.locale, o, a.dictionary, s, b, x), [
3402
+ ]), y = c(() => Ko(I, v?.accent), [v?.accent]), { showFooter: b, showThemeSwitcher: x } = Uo(v), S = c(() => fs(e, a.locales, a.locale, o, a.dictionary, s, b, x), [
3397
3403
  e,
3398
3404
  a.locales,
3399
3405
  a.locale,
@@ -3402,37 +3408,37 @@ function ps({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
3402
3408
  s,
3403
3409
  b,
3404
3410
  x
3405
- ]), C = r((e) => p(e), []), w = c(() => Jo(e, l, a.dictionary), [
3411
+ ]), C = r((e) => p(e), []), w = c(() => $o(e, l, a.dictionary), [
3406
3412
  e,
3407
3413
  l,
3408
3414
  a.dictionary
3409
3415
  ]), T = c(() => ({
3410
3416
  ...e,
3411
- screens: Fi($o(e.screens, [
3417
+ screens: Fi(is(e.screens, [
3412
3418
  ...e.screenTemplates,
3413
3419
  ...e.dialogTemplates ?? [],
3414
- ...ke,
3420
+ ...Pe,
3415
3421
  ...s ?? []
3416
- ]), us(e))
3422
+ ]), hs(e))
3417
3423
  }), [e, s]);
3418
- return m ? _.length > 0 ? /* @__PURE__ */ V("main", {
3424
+ return m ? _.length > 0 ? /* @__PURE__ */ z("main", {
3419
3425
  className: "stage-message",
3420
3426
  role: "alert",
3421
3427
  "data-stage-startup-problem": "root-template",
3422
3428
  children: [
3423
- /* @__PURE__ */ B("h1", { children: "Unable to start this Stage" }),
3424
- /* @__PURE__ */ B("p", { children: "The ui profile's root template cannot be the application's shell." }),
3425
- /* @__PURE__ */ B("ul", { children: _.map((e) => /* @__PURE__ */ B("li", { children: e }, e)) })
3429
+ /* @__PURE__ */ R("h1", { children: "Unable to start this Stage" }),
3430
+ /* @__PURE__ */ R("p", { children: "The ui profile's root template cannot be the application's shell." }),
3431
+ /* @__PURE__ */ R("ul", { children: _.map((e) => /* @__PURE__ */ R("li", { children: e }, e)) })
3426
3432
  ]
3427
- }) : /* @__PURE__ */ B(xe, {
3433
+ }) : /* @__PURE__ */ R(Ee, {
3428
3434
  application: T,
3429
3435
  composition: S,
3430
3436
  navigationModel: w,
3431
3437
  registry: t,
3432
3438
  initialScreen: m,
3433
3439
  history: d,
3434
- layoutConfigStorage: ds(),
3435
- scope: (t, n) => /* @__PURE__ */ B(ms, {
3440
+ layoutConfigStorage: gs(),
3441
+ scope: (t, n) => /* @__PURE__ */ R(ys, {
3436
3442
  scene: e,
3437
3443
  routeState: i,
3438
3444
  strings: a,
@@ -3442,26 +3448,26 @@ function ps({ scene: e, registry: t, routing: n, routeState: i, strings: a, pack
3442
3448
  onSystemSchemeChange: C,
3443
3449
  children: n
3444
3450
  }),
3445
- renderScreen: (e, n) => /* @__PURE__ */ B(gs, {
3451
+ renderScreen: (e, n) => /* @__PURE__ */ R(xs, {
3446
3452
  element: e,
3447
3453
  configuration: n,
3448
3454
  registry: t
3449
3455
  }),
3450
- renderDialog: () => /* @__PURE__ */ B(pa, {}),
3451
- renderDialogTemplate: (e, n, r) => /* @__PURE__ */ B(_s, {
3456
+ renderDialog: () => /* @__PURE__ */ R(va, {}),
3457
+ renderDialogTemplate: (e, n, r) => /* @__PURE__ */ R(Ss, {
3452
3458
  template: e,
3453
3459
  content: n,
3454
3460
  registry: t,
3455
3461
  strings: a,
3456
3462
  close: () => r.closeDialog()
3457
3463
  })
3458
- }) : /* @__PURE__ */ V("main", {
3464
+ }) : /* @__PURE__ */ z("main", {
3459
3465
  className: "stage-message",
3460
- children: [/* @__PURE__ */ B("h1", { children: "Nothing to show yet" }), /* @__PURE__ */ B("p", { children: "This model has no slice carrying a command or a read model, so there is no screen to render." })]
3466
+ children: [/* @__PURE__ */ R("h1", { children: "Nothing to show yet" }), /* @__PURE__ */ R("p", { children: "This model has no slice carrying a command or a read model, so there is no screen to render." })]
3461
3467
  });
3462
3468
  }
3463
- function ms({ scene: e, routeState: t, strings: n, navigation: r, themes: i, shellSettings: o, onSystemSchemeChange: s, children: c }) {
3464
- let [l, d] = u(""), { navigate: p } = r;
3469
+ function ys({ scene: e, routeState: t, strings: n, navigation: r, themes: i, shellSettings: o, onSystemSchemeChange: s, children: c }) {
3470
+ let [l, d] = u(""), { navigate: f } = r;
3465
3471
  return a(() => d(""), [r.currentScreen, r.currentDialog]), a(() => {
3466
3472
  let e = (e) => {
3467
3473
  let t = e.detail;
@@ -3471,30 +3477,30 @@ function ms({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
3471
3477
  }, []), a(() => {
3472
3478
  let t = (t) => {
3473
3479
  let n = t.detail, r = n.destination ?? (n.dialog ? {
3474
- kind: f.Dialog,
3480
+ kind: p.Dialog,
3475
3481
  dialog: n.dialog
3476
3482
  } : n.targetScreen ? { screen: n.targetScreen } : void 0);
3477
- r && (r.dialog === void 0 ? r.screen !== void 0 && !e.screens.some((e) => e.name === r.screen) ? d(`The modeled screen “${r.screen}” is not available.`) : p(r) : e.dialogTemplates?.some((e) => e.name === r.dialog) ? p(r) : d(`The modeled dialog “${r.dialog}” is not available in this Stage runtime.`));
3483
+ r && (r.dialog === void 0 ? r.screen !== void 0 && !e.screens.some((e) => e.name === r.screen) ? d(`The modeled screen “${r.screen}” is not available.`) : f(r) : e.dialogTemplates?.some((e) => e.name === r.dialog) ? f(r) : d(`The modeled dialog “${r.dialog}” is not available in this Stage runtime.`));
3478
3484
  };
3479
3485
  return globalThis.addEventListener("cratis.scene.navigate", t), () => globalThis.removeEventListener("cratis.scene.navigate", t);
3480
- }, [p, e]), /* @__PURE__ */ B(re, {
3481
- registry: ns,
3482
- children: /* @__PURE__ */ V(Ce, {
3486
+ }, [f, e]), /* @__PURE__ */ R(se, {
3487
+ registry: ss,
3488
+ children: /* @__PURE__ */ z(Oe, {
3483
3489
  themes: i,
3484
3490
  children: [
3485
- o && /* @__PURE__ */ B(Wo, {
3491
+ o && /* @__PURE__ */ R(Yo, {
3486
3492
  settings: o,
3487
3493
  onSystemSchemeChange: s
3488
3494
  }),
3489
- /* @__PURE__ */ B(Do, {}),
3490
- /* @__PURE__ */ B(qt, {
3495
+ /* @__PURE__ */ R(Mo, {}),
3496
+ /* @__PURE__ */ R(fn, {
3491
3497
  routes: t.routes,
3492
3498
  routesReady: t.ready,
3493
3499
  parameters: r.currentParameters,
3494
3500
  locale: n.locale,
3495
3501
  locales: n.locales,
3496
3502
  screen: r.primaryScreen ?? e.screens[0]?.name ?? "",
3497
- children: /* @__PURE__ */ B(hs, {
3503
+ children: /* @__PURE__ */ R(bs, {
3498
3504
  activity: l,
3499
3505
  routesReady: t.ready,
3500
3506
  scene: e,
@@ -3507,14 +3513,14 @@ function ms({ scene: e, routeState: t, strings: n, navigation: r, themes: i, she
3507
3513
  })
3508
3514
  });
3509
3515
  }
3510
- function hs({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: a }) {
3511
- let o = U(), s = ve(), l = $n(), u = c(() => Qo(l, t, o.refreshAfterCommand), [
3516
+ function bs({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i, children: a }) {
3517
+ let o = U(), s = Ce(), l = Rt(), u = c(() => rs(l, t, o.refreshAfterCommand), [
3512
3518
  l,
3513
3519
  t,
3514
3520
  o.refreshAfterCommand
3515
- ]), d = c(() => Xo(n.commandSchemas), [n.commandSchemas]), p = de({
3521
+ ]), d = c(() => ts(n.commandSchemas), [n.commandSchemas]), f = ge({
3516
3522
  executeCommand: async (e, n) => {
3517
- let i = J(e);
3523
+ let i = V(e);
3518
3524
  if (!i && !t) return r(`The modeled command “${e}” is waiting for Stage routes.`), {
3519
3525
  isSuccess: !1,
3520
3526
  validationErrors: []
@@ -3531,13 +3537,13 @@ function hs({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3531
3537
  };
3532
3538
  },
3533
3539
  navigate: (e, t) => {
3534
- n.screens.some((t) => t.name === e) ? tr(e, ar(t)) : r(`The modeled screen “${e}” is not available.`);
3540
+ n.screens.some((t) => t.name === e) ? H(e, Ut(t)) : r(`The modeled screen “${e}” is not available.`);
3535
3541
  },
3536
3542
  navigateBack: () => globalThis.history?.back(),
3537
3543
  openDialog: async (e) => {
3538
3544
  let t = n.dialogTemplates?.find((t) => t.name === e);
3539
3545
  return t ? (s.navigate({
3540
- kind: f.Dialog,
3546
+ kind: p.Dialog,
3541
3547
  dialog: t.name
3542
3548
  }), { isConfirmed: !0 }) : (r(`The modeled dialog “${e}” is not available in this Stage runtime.`), { isConfirmed: !1 });
3543
3549
  },
@@ -3548,23 +3554,23 @@ function hs({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3548
3554
  refreshQuery: async (e) => o.refreshQuery(e),
3549
3555
  raise: async (e) => r(`The modeled trigger “${e}” is not available in this Stage runtime.`)
3550
3556
  });
3551
- return /* @__PURE__ */ B(vo, {
3557
+ return /* @__PURE__ */ R(Co, {
3552
3558
  state: {
3553
3559
  locales: i.locales,
3554
3560
  locale: i.locale,
3555
3561
  setLocale: i.setLocale,
3556
3562
  activity: e
3557
3563
  },
3558
- children: /* @__PURE__ */ B(P, {
3564
+ children: /* @__PURE__ */ R(fe, {
3559
3565
  invoker: u,
3560
- children: /* @__PURE__ */ B(oe, {
3566
+ children: /* @__PURE__ */ R(ue, {
3561
3567
  fieldsFor: d,
3562
- children: /* @__PURE__ */ B(ie, {
3563
- dispatcher: p,
3568
+ children: /* @__PURE__ */ R(ce, {
3569
+ dispatcher: f,
3564
3570
  context: {
3565
3571
  resolve: o.resolveBinding,
3566
3572
  localize: (e) => i.dictionary[e] ?? e,
3567
- responseContracts: ko(n.responseContracts)
3573
+ responseContracts: Po(n.responseContracts)
3568
3574
  },
3569
3575
  attachments: [],
3570
3576
  onFindings: (e) => r(e.map((e) => e.detail).join(" ")),
@@ -3574,12 +3580,12 @@ function hs({ activity: e, routesReady: t, scene: n, setActivity: r, strings: i,
3574
3580
  })
3575
3581
  });
3576
3582
  }
3577
- function gs({ element: e, configuration: t, registry: n }) {
3578
- let r = U(), i = dn();
3579
- return /* @__PURE__ */ V(_r, {
3583
+ function xs({ element: e, configuration: t, registry: n }) {
3584
+ let r = U(), i = On();
3585
+ return /* @__PURE__ */ z(Cr, {
3580
3586
  element: e,
3581
3587
  outputScope: i.scope,
3582
- children: [/* @__PURE__ */ B(Aa, { element: e }), /* @__PURE__ */ B(N, {
3588
+ children: [/* @__PURE__ */ R(Fa, { element: e }), /* @__PURE__ */ R(le, {
3583
3589
  element: e,
3584
3590
  registry: n,
3585
3591
  resolveBinding: r.resolveBinding,
@@ -3589,27 +3595,27 @@ function gs({ element: e, configuration: t, registry: n }) {
3589
3595
  })]
3590
3596
  });
3591
3597
  }
3592
- function _s({ template: e, content: t, registry: n, strings: r, close: i }) {
3593
- let o = U(), s = dn(), c = O(t, r.dictionary);
3598
+ function Ss({ template: e, content: t, registry: n, strings: r, close: i }) {
3599
+ let o = U(), s = On(), c = O(t, r.dictionary);
3594
3600
  return a(() => {
3595
3601
  let e = (e) => {
3596
3602
  e.key === "Escape" && i();
3597
3603
  };
3598
3604
  return globalThis.addEventListener("keydown", e), () => globalThis.removeEventListener("keydown", e);
3599
- }, [i]), /* @__PURE__ */ B("div", {
3605
+ }, [i]), /* @__PURE__ */ R("div", {
3600
3606
  className: "stage-dialog-backdrop",
3601
- children: /* @__PURE__ */ V("section", {
3607
+ children: /* @__PURE__ */ z("section", {
3602
3608
  role: "dialog",
3603
3609
  "aria-modal": "true",
3604
3610
  "aria-label": e.displayName ?? e.name,
3605
3611
  className: "stage-dialog",
3606
- children: [/* @__PURE__ */ B("button", {
3612
+ children: [/* @__PURE__ */ R("button", {
3607
3613
  type: "button",
3608
3614
  onClick: i,
3609
3615
  children: "Close"
3610
- }), /* @__PURE__ */ B(_r, {
3616
+ }), /* @__PURE__ */ R(Cr, {
3611
3617
  element: c,
3612
- children: /* @__PURE__ */ B(N, {
3618
+ children: /* @__PURE__ */ R(le, {
3613
3619
  element: c,
3614
3620
  registry: n,
3615
3621
  resolveBinding: o.resolveBinding,
@@ -3620,4 +3626,4 @@ function _s({ template: e, content: t, registry: n, strings: r, close: i }) {
3620
3626
  })
3621
3627
  });
3622
3628
  }
3623
- export { fs as App, fs as StageApplication, jr as StageCommandForm, qt as StageDataProvider, ji as StageGuardedAction, lt as StageSourceProvider, ls as composeStageScreen, Qo as createStageSliceInvoker, Qt as dataChanged, Zn as executeRegisteredCommand, gt as hostedBasePath, io as listsPrimeReact, Ct as performQuery, yt as registerQueryRouteResolver, ao as registerStageLibrary, J as registeredCommand, bt as registeredQuery, Xo as sliceFieldsFrom, rs as stageApplicationRegistry, ss as stageComposition, e as stageDarkSelector, st as stageEndpoints, as as stageShellOf, ot as staticStageSource, wt as subscribeQuery, $n as useStageCommandExecutor, U as useStageData, W as useStageQuery, ut as useStageSource };
3629
+ export { _s as App, _s as StageApplication, Rr as StageCommandForm, fn as StageDataProvider, en as StageGuardedAction, mt as StageSourceProvider, ms as composeStageScreen, rs as createStageSliceInvoker, _n as dataChanged, It as executeRegisteredCommand, xt as hostedBasePath, lo as listsPrimeReact, Ot as performQuery, wt as registerQueryRouteResolver, uo as registerStageLibrary, V as registeredCommand, Tt as registeredQuery, ts as sliceFieldsFrom, cs as stageApplicationRegistry, fs as stageComposition, e as stageDarkSelector, ft as stageEndpoints, us as stageShellOf, dt as staticStageSource, kt as subscribeQuery, Rt as useStageCommandExecutor, U as useStageData, W as useStageQuery, ht as useStageSource };