@cratis/event-models 0.111.1 → 0.113.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.
Files changed (179) hide show
  1. package/README.md +65 -0
  2. package/dist/Collections/suppliesBoardEditing.d.ts +2 -0
  3. package/dist/index.js +1347 -1347
  4. package/dist/index.js.map +1 -1
  5. package/dist/screen-editor/BlueprintPreview/blueprintPreviewCatalog.d.ts +57 -0
  6. package/dist/screen-editor/BlueprintPreview/initialPackageSelection.d.ts +18 -0
  7. package/dist/screen-editor/IconLibraries/Lucide/index.d.ts +4 -0
  8. package/dist/screen-editor/IconLibraries/Lucide/lucideAdapter.d.ts +2 -0
  9. package/dist/screen-editor/IconLibraries/Lucide/lucideCatalog.d.ts +2 -0
  10. package/dist/screen-editor/IconLibraries/Lucide/lucideManifest.d.ts +3 -0
  11. package/dist/screen-editor/IconLibraries/Lucide/lucidePackage.d.ts +2 -0
  12. package/dist/screen-editor/Icons/IconPickerCatalogState.d.ts +5 -0
  13. package/dist/screen-editor/Icons/IconPropertyField.d.ts +25 -0
  14. package/dist/screen-editor/Icons/IconPropertyFieldStrings.d.ts +8 -0
  15. package/dist/screen-editor/Icons/IconValueProblem.d.ts +7 -0
  16. package/dist/screen-editor/Icons/UseIconPickerCatalogResult.d.ts +7 -0
  17. package/dist/screen-editor/Icons/describeIconValueProblem.d.ts +3 -0
  18. package/dist/screen-editor/Icons/diagnoseIconValue.d.ts +5 -0
  19. package/dist/screen-editor/Icons/effectiveIconCatalogOf.d.ts +3 -0
  20. package/dist/screen-editor/Icons/iconCatalogSourcesOf.d.ts +3 -0
  21. package/dist/screen-editor/Icons/toIconPickerCatalog.d.ts +5 -0
  22. package/dist/screen-editor/Icons/useIconPickerCatalog.d.ts +4 -0
  23. package/dist/screen-editor/ScreenEditor/Actions/ActionModel.d.ts +7 -0
  24. package/dist/screen-editor/ScreenEditor/Actions/ActionPresentation.d.ts +5 -0
  25. package/dist/screen-editor/ScreenEditor/Actions/StateChangeSlice.d.ts +10 -0
  26. package/dist/screen-editor/ScreenEditor/Actions/actionBehavior.d.ts +8 -0
  27. package/dist/screen-editor/ScreenEditor/Actions/diagnoseAction.d.ts +14 -0
  28. package/dist/screen-editor/ScreenEditor/Binding/availableSourcesFor.d.ts +2 -0
  29. package/dist/screen-editor/ScreenEditor/Binding/bindingScopeTypes.d.ts +2 -0
  30. package/dist/screen-editor/ScreenEditor/Binding/previewState.d.ts +17 -0
  31. package/dist/screen-editor/ScreenEditor/Binding/queryBindingModel.d.ts +8 -0
  32. package/dist/screen-editor/ScreenEditor/Binding/settleBinding.d.ts +7 -0
  33. package/dist/screen-editor/ScreenEditor/Binding/toSceneCandidates.d.ts +22 -0
  34. package/dist/screen-editor/ScreenEditor/Collections/orderedItems.d.ts +11 -0
  35. package/dist/screen-editor/ScreenEditor/Defaults/defaultLayoutIcons.d.ts +2 -0
  36. package/dist/screen-editor/ScreenEditor/Defaults/defaultLayoutLabels.d.ts +2 -0
  37. package/dist/screen-editor/ScreenEditor/Defaults/defaultPaletteIcons.d.ts +2 -0
  38. package/dist/screen-editor/ScreenEditor/Defaults/defaultPaletteSources.d.ts +2 -0
  39. package/dist/screen-editor/ScreenEditor/Defaults/defaultScreenEditorStrings.d.ts +2 -0
  40. package/dist/screen-editor/ScreenEditor/Document/createExternalComponent.d.ts +2 -0
  41. package/dist/screen-editor/ScreenEditor/Document/createPanel.d.ts +6 -0
  42. package/dist/screen-editor/ScreenEditor/Document/frameworkElement.d.ts +21 -0
  43. package/dist/screen-editor/ScreenEditor/Document/readSceneDocument.d.ts +15 -0
  44. package/dist/screen-editor/ScreenEditor/Document/studioScreen.d.ts +10 -0
  45. package/dist/screen-editor/ScreenEditor/DropRegions/DropRegion.d.ts +12 -0
  46. package/dist/screen-editor/ScreenEditor/DropRegions/DropRegionKind.d.ts +4 -0
  47. package/dist/screen-editor/ScreenEditor/DropRegions/InsertionAxis.d.ts +5 -0
  48. package/dist/screen-editor/ScreenEditor/DropRegions/computeDropRegions.d.ts +6 -0
  49. package/dist/screen-editor/ScreenEditor/Exposure/exposureEdits.d.ts +10 -0
  50. package/dist/screen-editor/ScreenEditor/Host/DefaultPaletteHost.d.ts +6 -0
  51. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorBoundary.d.ts +8 -0
  52. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorControlProviders.d.ts +7 -0
  53. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorController.d.ts +41 -0
  54. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorFileUpload.d.ts +5 -0
  55. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorHost.d.ts +36 -0
  56. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorOverlay.d.ts +24 -0
  57. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorPrimeReactProvider.d.ts +3 -0
  58. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWindow.d.ts +28 -0
  59. package/dist/screen-editor/ScreenEditor/Host/ScreenEditorWorkspace.d.ts +21 -0
  60. package/dist/screen-editor/ScreenEditor/Host/UnreadableScreen.d.ts +8 -0
  61. package/dist/screen-editor/ScreenEditor/Host/WindowTitleBar.d.ts +5 -0
  62. package/dist/screen-editor/ScreenEditor/Host/createScreenEditorEnvironment.d.ts +16 -0
  63. package/dist/screen-editor/ScreenEditor/Host/nextElementId.d.ts +1 -0
  64. package/dist/screen-editor/ScreenEditor/Host/openSubject.d.ts +14 -0
  65. package/dist/screen-editor/ScreenEditor/Host/useScreenEditor.d.ts +4 -0
  66. package/dist/screen-editor/ScreenEditor/Inspector/ActionEditor.d.ts +13 -0
  67. package/dist/screen-editor/ScreenEditor/Inspector/DiagnosticList.d.ts +6 -0
  68. package/dist/screen-editor/ScreenEditor/Inspector/ExposureSection.d.ts +11 -0
  69. package/dist/screen-editor/ScreenEditor/Inspector/IconProperties.d.ts +14 -0
  70. package/dist/screen-editor/ScreenEditor/Inspector/InspectorTab.d.ts +4 -0
  71. package/dist/screen-editor/ScreenEditor/Inspector/LayoutTypeSection.d.ts +10 -0
  72. package/dist/screen-editor/ScreenEditor/Inspector/OwnershipBadge.d.ts +6 -0
  73. package/dist/screen-editor/ScreenEditor/Inspector/PropertiesPanel.d.ts +17 -0
  74. package/dist/screen-editor/ScreenEditor/Inspector/QueryBindingEditor.d.ts +12 -0
  75. package/dist/screen-editor/ScreenEditor/Inspector/ScreenEditorStrings.d.ts +106 -0
  76. package/dist/screen-editor/ScreenEditor/Inspector/ScreenInspector.d.ts +13 -0
  77. package/dist/screen-editor/ScreenEditor/Inspector/StructureTree.d.ts +13 -0
  78. package/dist/screen-editor/ScreenEditor/Inspector/StructureTreeRow.d.ts +21 -0
  79. package/dist/screen-editor/ScreenEditor/Inspector/ViewportControls.d.ts +9 -0
  80. package/dist/screen-editor/ScreenEditor/Inspector/pointerDropZone.d.ts +2 -0
  81. package/dist/screen-editor/ScreenEditor/Layouts/LayoutCatalogEntry.d.ts +11 -0
  82. package/dist/screen-editor/ScreenEditor/Layouts/LayoutItem.d.ts +8 -0
  83. package/dist/screen-editor/ScreenEditor/Layouts/PanelConstruct.d.ts +7 -0
  84. package/dist/screen-editor/ScreenEditor/Layouts/layoutCatalog.d.ts +2 -0
  85. package/dist/screen-editor/ScreenEditor/Layouts/layoutChange.d.ts +13 -0
  86. package/dist/screen-editor/ScreenEditor/Layouts/toLayoutContainerDescriptors.d.ts +9 -0
  87. package/dist/screen-editor/ScreenEditor/Palette/PaletteEntry.d.ts +10 -0
  88. package/dist/screen-editor/ScreenEditor/Palette/buildPalette.d.ts +22 -0
  89. package/dist/screen-editor/ScreenEditor/Palette/insertedComponentName.d.ts +2 -0
  90. package/dist/screen-editor/ScreenEditor/Properties/allowedIconChoices.d.ts +3 -0
  91. package/dist/screen-editor/ScreenEditor/Properties/choiceKeys.d.ts +6 -0
  92. package/dist/screen-editor/ScreenEditor/Properties/iconDiagnostics.d.ts +7 -0
  93. package/dist/screen-editor/ScreenEditor/Properties/propertyEdits.d.ts +3 -0
  94. package/dist/screen-editor/ScreenEditor/Properties/toPropertyGroups.d.ts +9 -0
  95. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonDraftKind.d.ts +6 -0
  96. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonDraftOutcome.d.ts +13 -0
  97. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonDraftState.d.ts +4 -0
  98. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonProblem.d.ts +5 -0
  99. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonProblemKind.d.ts +6 -0
  100. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonProperties.d.ts +9 -0
  101. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonPropertyField.d.ts +13 -0
  102. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonPropertyFieldStrings.d.ts +9 -0
  103. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/JsonReading.d.ts +8 -0
  104. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/defaultJsonPropertyFieldStrings.d.ts +2 -0
  105. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/describeJsonProblem.d.ts +3 -0
  106. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/formatJson.d.ts +1 -0
  107. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/isJsonValueType.d.ts +4 -0
  108. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/jsonDraft.d.ts +11 -0
  109. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/numberLiteralsOf.d.ts +1 -0
  110. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/readJson.d.ts +2 -0
  111. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/sameJson.d.ts +1 -0
  112. package/dist/screen-editor/ScreenEditor/PropertyEditors/Json/useJsonDraft.d.ts +9 -0
  113. package/dist/screen-editor/ScreenEditor/PrototypeProjection/LegacyExtras.d.ts +11 -0
  114. package/dist/screen-editor/ScreenEditor/PrototypeProjection/applyLegacyState.d.ts +3 -0
  115. package/dist/screen-editor/ScreenEditor/PrototypeProjection/layoutContainerItems.d.ts +4 -0
  116. package/dist/screen-editor/ScreenEditor/PrototypeProjection/legacyPlacement.d.ts +5 -0
  117. package/dist/screen-editor/ScreenEditor/PrototypeProjection/projectToLegacyElements.d.ts +3 -0
  118. package/dist/screen-editor/ScreenEditor/PrototypeProjection/sceneComponentName.d.ts +3 -0
  119. package/dist/screen-editor/ScreenEditor/PrototypeProjection/withoutNulls.d.ts +1 -0
  120. package/dist/screen-editor/ScreenEditor/Runtime/screenEditorRuntime.d.ts +17 -0
  121. package/dist/screen-editor/ScreenEditor/Runtime/screenEditorRuntimeForProfile.d.ts +4 -0
  122. package/dist/screen-editor/ScreenEditor/Runtime/serverPrototypeTypes.d.ts +3 -0
  123. package/dist/screen-editor/ScreenEditor/Runtime/useLoadedIconCatalog.d.ts +2 -0
  124. package/dist/screen-editor/ScreenEditor/Runtime/withActionPresentation.d.ts +2 -0
  125. package/dist/screen-editor/ScreenEditor/Runtime/withPlacementProperties.d.ts +3 -0
  126. package/dist/screen-editor/ScreenEditor/Selection/panelLayoutItem.d.ts +3 -0
  127. package/dist/screen-editor/ScreenEditor/Selection/sceneStructureAdapter.d.ts +4 -0
  128. package/dist/screen-editor/ScreenEditor/Selection/sceneTree.d.ts +4 -0
  129. package/dist/screen-editor/ScreenEditor/Selection/surfaceArrangementOfRoot.d.ts +3 -0
  130. package/dist/screen-editor/ScreenEditor/Selection/surfaceLayoutOfRoot.d.ts +3 -0
  131. package/dist/screen-editor/ScreenEditor/Selection/toSceneEdits.d.ts +5 -0
  132. package/dist/screen-editor/ScreenEditor/Session/EditSession.d.ts +25 -0
  133. package/dist/screen-editor/ScreenEditor/Session/SessionCell.d.ts +8 -0
  134. package/dist/screen-editor/ScreenEditor/Structure/DropZone.d.ts +5 -0
  135. package/dist/screen-editor/ScreenEditor/Structure/MoveIntent.d.ts +6 -0
  136. package/dist/screen-editor/ScreenEditor/Structure/Ownership.d.ts +5 -0
  137. package/dist/screen-editor/ScreenEditor/Structure/OwnershipResolver.d.ts +2 -0
  138. package/dist/screen-editor/ScreenEditor/Structure/StructureEdit.d.ts +5 -0
  139. package/dist/screen-editor/ScreenEditor/Structure/StructureEditRejection.d.ts +9 -0
  140. package/dist/screen-editor/ScreenEditor/Structure/StructureLocation.d.ts +6 -0
  141. package/dist/screen-editor/ScreenEditor/Structure/StructureOperation.d.ts +9 -0
  142. package/dist/screen-editor/ScreenEditor/Structure/StructureRow.d.ts +8 -0
  143. package/dist/screen-editor/ScreenEditor/Structure/StructureTreeAdapter.d.ts +11 -0
  144. package/dist/screen-editor/ScreenEditor/Structure/findStructureNode.d.ts +4 -0
  145. package/dist/screen-editor/ScreenEditor/Structure/flattenStructure.d.ts +3 -0
  146. package/dist/screen-editor/ScreenEditor/Structure/isOperationPermitted.d.ts +3 -0
  147. package/dist/screen-editor/ScreenEditor/Structure/resolveMoveIntentEdit.d.ts +4 -0
  148. package/dist/screen-editor/ScreenEditor/Structure/resolveTreeDrop.d.ts +4 -0
  149. package/dist/screen-editor/ScreenEditor/Structure/validateStructureEdit.d.ts +4 -0
  150. package/dist/screen-editor/ScreenEditor/Surface/ScreenSurface.d.ts +11 -0
  151. package/dist/screen-editor/ScreenEditor/Surface/dragPayload.d.ts +7 -0
  152. package/dist/screen-editor/ScreenEditor/Surface/dropRegionRects.d.ts +14 -0
  153. package/dist/screen-editor/ScreenEditor/Surface/sameMeasurement.d.ts +5 -0
  154. package/dist/screen-editor/ScreenEditor/Templates/composeEditorScreen.d.ts +8 -0
  155. package/dist/screen-editor/ScreenEditor/Templates/templateProvenance.d.ts +6 -0
  156. package/dist/screen-editor/ScreenEditor/Viewport/ViewportPreset.d.ts +4 -0
  157. package/dist/screen-editor/ScreenEditor/Viewport/ViewportSize.d.ts +4 -0
  158. package/dist/screen-editor/ScreenEditor/Viewport/detectViewportPreset.d.ts +3 -0
  159. package/dist/screen-editor/ScreenEditor/Viewport/resolveViewportSizeClass.d.ts +3 -0
  160. package/dist/screen-editor/ScreenEditor/Viewport/toWindowSize.d.ts +3 -0
  161. package/dist/screen-editor/ScreenEditor/Viewport/viewportPresets.d.ts +4 -0
  162. package/dist/screen-editor/ScreenEditor/index.d.ts +31 -0
  163. package/dist/screen-editor/UiProfile/PackageInclusion.d.ts +9 -0
  164. package/dist/screen-editor/UiProfile/PersistedUiProfile.d.ts +19 -0
  165. package/dist/screen-editor/UiProfile/ResolvedPackageEntry.d.ts +19 -0
  166. package/dist/screen-editor/UiProfile/ResolvedUiProfile.d.ts +20 -0
  167. package/dist/screen-editor/UiProfile/UiProfileSettings.d.ts +29 -0
  168. package/dist/screen-editor/UiProfile/defaultUiProfileSettings.d.ts +13 -0
  169. package/dist/screen-editor/UiProfile/explicitPackageNames.d.ts +10 -0
  170. package/dist/screen-editor/UiProfile/formatMessage.d.ts +11 -0
  171. package/dist/screen-editor/UiProfile/resolveUiProfile.d.ts +18 -0
  172. package/dist/screen-editor/UiProfile/shellLayoutOf.d.ts +10 -0
  173. package/dist/screen-editor/UiProfile/toSceneUiProfile.d.ts +12 -0
  174. package/dist/screen-editor/UiProfileDesigner/filterCompatibleThemes.d.ts +12 -0
  175. package/dist/screen-editor/UiProfileDesigner/findComponentCollisions.d.ts +15 -0
  176. package/dist/screen-editor/catalog-CZx3FR-E.js +4 -0
  177. package/dist/screen-editor/index.js +3327 -0
  178. package/dist/screen-editor/screen-editor.css +2 -0
  179. package/package.json +99 -13
@@ -0,0 +1,3327 @@
1
+ import { useCallback as U, useEffect as Me, useId as cn, useLayoutEffect as nt, useMemo as F, useRef as _e, useState as D } from "react";
2
+ import { Toolbar as ln, ToolbarFolder as bt } from "@cratis/components/Toolbar";
3
+ import { LayoutArrangement as L, PrototypeOverlayFrame as wt } from "@cratis/scene/ScreenEditor";
4
+ import { CollectionOperation as J, DiagnosticCode as G, DiagnosticSeverity as dn, EditTarget as un, EditingScopeKind as Re, FlowContainerKind as Ie, GridUnitType as pn, HorizontalAlignment as Fe, Orientation as ne, PackageKind as me, PropertyValueType as E, ProvenanceKind as rt, QueryOriginKind as mn, QueryResultShape as fn, SceneEditKind as z, SceneNodeKind as hn, VerticalAlignment as ze, Visibility as Ue, isIconReference as gn, parseIconReference as vn } from "@cratis/scene.model";
5
+ import { EffectiveIconCatalog as yn, applyEdit as Ct, baseComponentLibraries as bn, computeSizeClass as wn, corePackage as qe, createDescriptorCatalog as Cn, elementNodeId as W, findLayoutTypeDescriptor as it, inspect as kt, isCanvas as $e, isDockPanel as kn, isExternalComponent as fe, isGrid as Be, isPackageSelectionValid as In, isPanel as ce, isStackPanel as Ve, isThemeCompatible as Sn, isWrapPanel as Pn, packagesOfKind as ot, resolveComponentName as je, resolveIconLibraries as Tn, resolvePackageDependencies as Rn, resolveTemplateChain as Nn, toComponentCatalog as We, validateBinding as On } from "@cratis/scene.engine";
6
+ import { Fragment as ae, jsx as s, jsxs as b } from "react/jsx-runtime";
7
+ import { ErrorBoundary as xn, IconButton as se, Tabs as Ln, TextArea as Dn } from "@cratis/components/Common";
8
+ import { OrderedItemEditor as En, PropertyControls as An } from "@cratis/components/ConfigurationEditor";
9
+ import { IconPicker as Mn, isIconPickerAllowed as _n, isSameIconPickerValue as Fn } from "@cratis/components/IconPicker";
10
+ import { IconAdapterProvider as zn, SceneElementView as Un, SceneIcon as qn, componentRegistryKey as It, corePackage as $n, mergeIconAdapters as Bn, mergePackageRegistries as St } from "@cratis/scene.react";
11
+ import { PrototypeLayout as X } from "@cratis/scene";
12
+ import { FileUploadHandlerProvider as Vn, QuillLoaderProvider as jn, primeReactPackage as Wn } from "@cratis/scene.primereact";
13
+ import { FaBars as Gn, FaCube as at, FaDesktop as Jn, FaGripLinesVertical as Kn, FaMobileAlt as Qn, FaRedo as Hn, FaRegSquare as Yn, FaSlidersH as Zn, FaThLarge as Pt, FaThList as Xn, FaTrash as er, FaUndo as tr, FaVectorSquare as nr } from "react-icons/fa";
14
+ import { ColorScheme as rr, LayoutMode as ir, defaultBlueprint as or, resolveElementComponentNames as ar } from "@cratis/scene.blueprint.default";
15
+ import { PrimeReactProvider as sr } from "@primereact/core/config";
16
+ import { loadQuill as cr } from "@cratis/scene.primereact/quill";
17
+ import { cratisComponentsPackage as lr } from "@cratis/scene.components";
18
+ import { tailwindPackage as dr } from "@cratis/scene.tailwind";
19
+ import { componentsBlueprint as ur } from "@cratis/scene.blueprint.components";
20
+ import { dynamicIconImports as pr } from "lucide-react/dynamic";
21
+ var Ge = {
22
+ name: "StudioScreen",
23
+ slots: [{ name: "content" }]
24
+ }, he = "content", Ce = "Screen", mr = "template-root", fr = "screen-root", Tt = () => ({
25
+ layouts: [Ge],
26
+ screenTemplates: [],
27
+ dialogTemplates: [],
28
+ screens: [],
29
+ exposures: [],
30
+ instanceContributions: []
31
+ });
32
+ function hr(e, t) {
33
+ return {
34
+ ...Tt(),
35
+ screens: [{
36
+ name: Ce,
37
+ layout: Ge.name,
38
+ slotContent: { [he]: [e] },
39
+ forms: [],
40
+ contributions: [],
41
+ ...t ? { screenTemplate: t } : {}
42
+ }]
43
+ };
44
+ }
45
+ function gr(e, t, n) {
46
+ return {
47
+ ...Tt(),
48
+ screenTemplates: [{
49
+ name: e,
50
+ slots: [{ name: he }],
51
+ content: { [he]: [t] },
52
+ ...n ? { fitsSlot: n } : {}
53
+ }]
54
+ };
55
+ }
56
+ function ge(e, t) {
57
+ return (t === void 0 ? e.screens.find((n) => n.name === Ce)?.slotContent : e.screenTemplates.find((n) => n.name === t)?.content)?.[he]?.[0];
58
+ }
59
+ function Ne(e, t = !1) {
60
+ return t && e !== void 0 ? {
61
+ kind: Re.ScreenTemplate,
62
+ name: e,
63
+ layout: Ge.name
64
+ } : {
65
+ kind: Re.Screen,
66
+ name: Ce
67
+ };
68
+ }
69
+ var Se = (e, t) => typeof t == "string" ? Object.values(e).find((n) => n === t) : void 0, vr = (e) => {
70
+ const t = e;
71
+ return !!t && typeof t == "object" && [
72
+ "left",
73
+ "top",
74
+ "right",
75
+ "bottom"
76
+ ].every((n) => typeof t[n] == "number");
77
+ };
78
+ function yr(e, t, n) {
79
+ const r = e;
80
+ r.zIndex = n;
81
+ const i = Se(Ue, t.visibility);
82
+ i !== void 0 && (r.visibility = i), typeof t.isEnabled == "boolean" && (r.isEnabled = t.isEnabled), typeof t.opacity == "number" && (r.opacity = t.opacity), vr(t.margin) && (r.margin = { ...t.margin });
83
+ const o = Se(Fe, t.horizontalAlignment);
84
+ o !== void 0 && (r.horizontalAlignment = o);
85
+ const a = Se(ze, t.verticalAlignment);
86
+ a !== void 0 && (r.verticalAlignment = a);
87
+ }
88
+ var Oe = {
89
+ visibility: Ue.Visible,
90
+ isEnabled: !0,
91
+ opacity: 1,
92
+ margin: {
93
+ left: 0,
94
+ top: 0,
95
+ right: 0,
96
+ bottom: 0
97
+ },
98
+ horizontalAlignment: Fe.Stretch,
99
+ verticalAlignment: ze.Stretch
100
+ };
101
+ function br(e) {
102
+ const t = {
103
+ ...Oe,
104
+ margin: { ...Oe.margin }
105
+ };
106
+ return yr(t, e, 0), delete t.zIndex, t;
107
+ }
108
+ var wr = Object.keys(Oe), w = /* @__PURE__ */ (function(e) {
109
+ return e.Stack = "stack", e.Row = "row", e.Grid = "grid", e.Container = "container", e.Wrap = "wrap", e.Canvas = "canvas", e;
110
+ })({}), Cr = "StudioLayout", kr = {
111
+ Stack: w.Stack,
112
+ Row: w.Row,
113
+ Grid: w.Grid,
114
+ Container: w.Container,
115
+ Wrap: w.Wrap,
116
+ Canvas: w.Canvas
117
+ };
118
+ function Ir(e) {
119
+ const t = Object.entries(kr).find(([, n]) => n === e)?.[0] ?? "Container";
120
+ return `${Cr}.${t}`;
121
+ }
122
+ var Je = "Canvas.Left", Ke = "Canvas.Top", st = "legacyType", Sr = "legacy", ct = "legacyExtras", Pr = {
123
+ DatePicker: "calendar",
124
+ OrgChart: "organizationChart",
125
+ Chips: "chips",
126
+ ToggleButton: "toggleSwitch"
127
+ }, Tr = Object.fromEntries(Object.entries(Pr).map(([e, t]) => [t, e]));
128
+ function Rt(e) {
129
+ const t = e.includes(":") ? e.slice(e.lastIndexOf(":") + 1) : e;
130
+ return Tr[t] ?? t.charAt(0).toUpperCase() + t.slice(1);
131
+ }
132
+ function xe(e) {
133
+ return Array.isArray(e) ? e.filter((t) => t !== null).map(xe) : e !== null && typeof e == "object" ? Object.fromEntries(Object.entries(e).filter(([, t]) => t !== null).map(([t, n]) => [t, xe(n)])) : e;
134
+ }
135
+ function ke(e) {
136
+ return ce(e) ? e.children : fe(e) ? Object.values(e.slots).flat() : [];
137
+ }
138
+ function Nt(e) {
139
+ return e.flatMap((t) => [t.id, ...Nt(ke(t))]);
140
+ }
141
+ function Le(e, t) {
142
+ for (const n of e) {
143
+ if (n.id === t) return n;
144
+ const r = Le(ke(n), t);
145
+ if (r) return r;
146
+ }
147
+ }
148
+ function Ot(e) {
149
+ if ($e(e)) return w.Canvas;
150
+ if (Be(e)) return w.Grid;
151
+ if (!kn(e))
152
+ return Ve(e) ? e.orientation === ne.Horizontal ? w.Row : w.Stack : Pn(e) ? w.Wrap : w.Container;
153
+ }
154
+ function De(e, t = () => {
155
+ }) {
156
+ return xe((e?.children ?? []).map((n) => xt(n, t)));
157
+ }
158
+ var B = (e, t) => typeof e == "number" ? e : t;
159
+ function xt(e, t) {
160
+ const n = e, r = { ...n.properties ?? {} }, i = ke(e).map((N) => xt(N, t)), o = r[Sr];
161
+ if (o != null && typeof o == "object") return Nr(o, n, r, i);
162
+ const a = r[ct], l = typeof r.legacyType == "string" && r.legacyType !== "" ? r[st] : void 0, d = l ?? (ce(e) ? Ir(Ot(e)) : t(fe(e) ? e.componentName : "")), u = fe(e) ? e.componentName : "", { [st]: c, [ct]: m, [Je]: I, [Ke]: g, ...P } = r, O = {};
163
+ for (const N of a?.topKeys ?? []) N in P && (O[N] = P[N], delete P[N]);
164
+ const h = B(I, a?.position.x ?? 0), S = B(g, a?.position.y ?? 0), R = n.name ?? "", C = a?.emptyName === !0 && R === (l ?? "");
165
+ return {
166
+ ...Rr(n, a),
167
+ ...O,
168
+ _derivedTypeId: d ?? "externalComponent",
169
+ id: n.id,
170
+ ...C ? {} : { name: R },
171
+ componentName: d ? d.slice(d.lastIndexOf(".") + 1) : Rt(u),
172
+ properties: {
173
+ ...P,
174
+ canvas: {
175
+ ...a?.canvas ?? {},
176
+ x: h,
177
+ y: S
178
+ }
179
+ },
180
+ slots: {
181
+ ...a?.slots ?? {},
182
+ ...i.length > 0 ? { children: i } : {}
183
+ },
184
+ width: n.size?.width,
185
+ height: n.size?.height,
186
+ ZIndex: n.zIndex ?? 0
187
+ };
188
+ }
189
+ function Rr(e, t) {
190
+ const n = t?.top ?? {}, r = br(n), i = e, o = { ...n };
191
+ for (const a of wr) JSON.stringify(i[a]) !== JSON.stringify(r[a]) && (o[a] = i[a]);
192
+ return o;
193
+ }
194
+ function Nr(e, t, n, r) {
195
+ const i = { ...e }, o = e.properties ?? {}, a = o.canvas ?? {}, l = n[Je], d = n[Ke];
196
+ (typeof l == "number" || typeof d == "number") && (e.position && typeof e.position == "object" ? i.position = {
197
+ ...e.position,
198
+ x: B(l, B(a.x, 0)),
199
+ y: B(d, B(a.y, 0))
200
+ } : i.properties = {
201
+ ...o,
202
+ canvas: {
203
+ ...a,
204
+ x: B(l, B(a.x, 0)),
205
+ y: B(d, B(a.y, 0))
206
+ }
207
+ }), t.size?.width !== void 0 && (i.width = t.size.width), t.size?.height !== void 0 && (i.height = t.size.height), t.name !== void 0 && t.name !== "" && t.name !== e.componentName && t.name !== e._derivedTypeId && (i.name = t.name), t.zIndex !== void 0 && "ZIndex" in e && (i.ZIndex = t.zIndex);
208
+ const u = e.slots ?? {};
209
+ return (r.length > 0 || "children" in u) && (i.slots = {
210
+ ...u,
211
+ children: r
212
+ }), i;
213
+ }
214
+ function Lt(e, t, n, r = 0, i = null) {
215
+ return e.flatMap((o) => {
216
+ const a = n.idOf(o), l = n.childrenOf(o), d = l.length > 0 && t.has(a), u = {
217
+ node: o,
218
+ id: a,
219
+ depth: r,
220
+ parentId: i,
221
+ hasChildren: l.length > 0,
222
+ isExpanded: d
223
+ };
224
+ return d ? [u, ...Lt(l, t, n, r + 1, a)] : [u];
225
+ });
226
+ }
227
+ var K = /* @__PURE__ */ (function(e) {
228
+ return e.MoveUp = "moveUp", e.MoveDown = "moveDown", e.Outdent = "outdent", e.Indent = "indent", e;
229
+ })({});
230
+ function ie(e, t, n, r = null) {
231
+ for (const [i, o] of e.entries()) {
232
+ if (n.idOf(o) === t) return {
233
+ node: o,
234
+ parent: r,
235
+ index: i,
236
+ siblings: e
237
+ };
238
+ const a = ie(n.childrenOf(o), t, n, o);
239
+ if (a) return a;
240
+ }
241
+ }
242
+ function Dt(e, t, n) {
243
+ return n.idOf(e) === t ? !0 : n.childrenOf(e).some((r) => Dt(r, t, n));
244
+ }
245
+ function Or(e, t, n, r) {
246
+ const i = ie(e, t, r);
247
+ if (!i) return;
248
+ const o = i.parent === null ? null : r.idOf(i.parent);
249
+ switch (n) {
250
+ case K.MoveUp:
251
+ return i.index > 0 ? {
252
+ nodeId: t,
253
+ targetParentId: o,
254
+ index: i.index - 1
255
+ } : void 0;
256
+ case K.MoveDown:
257
+ return i.index < i.siblings.length - 1 ? {
258
+ nodeId: t,
259
+ targetParentId: o,
260
+ index: i.index + 1
261
+ } : void 0;
262
+ case K.Outdent: {
263
+ if (i.parent === null) return;
264
+ const a = ie(e, r.idOf(i.parent), r);
265
+ return {
266
+ nodeId: t,
267
+ targetParentId: a.parent === null ? null : r.idOf(a.parent),
268
+ index: a.index + 1
269
+ };
270
+ }
271
+ case K.Indent: {
272
+ const a = i.index > 0 ? i.siblings[i.index - 1] : void 0;
273
+ return !a || !r.acceptsChildren(a) ? void 0 : {
274
+ nodeId: t,
275
+ targetParentId: r.idOf(a),
276
+ index: r.childrenOf(a).length
277
+ };
278
+ }
279
+ }
280
+ }
281
+ var Y = /* @__PURE__ */ (function(e) {
282
+ return e.Before = "before", e.Inside = "inside", e.After = "after", e;
283
+ })({});
284
+ function xr(e, t, n, r, i) {
285
+ const o = ie(e, n, i);
286
+ if (!o) return;
287
+ if (r === Y.Inside) return {
288
+ nodeId: t,
289
+ targetParentId: n,
290
+ index: i.childrenOf(o.node).filter((l) => i.idOf(l) !== t).length
291
+ };
292
+ const a = o.siblings.filter((l) => i.idOf(l) !== t).findIndex((l) => i.idOf(l) === n);
293
+ return {
294
+ nodeId: t,
295
+ targetParentId: o.parent === null ? null : i.idOf(o.parent),
296
+ index: r === Y.Before ? a : a + 1
297
+ };
298
+ }
299
+ function Lr(e, t, n) {
300
+ if (t <= 0) return Y.After;
301
+ const r = e / t;
302
+ return r < 0.25 ? Y.Before : r > 0.75 || !n ? r < 0.5 ? Y.Before : Y.After : Y.Inside;
303
+ }
304
+ var M = /* @__PURE__ */ (function(e) {
305
+ return e.Local = "local", e.Inherited = "inherited", e.ConfigurableInherited = "configurableInherited", e;
306
+ })({}), Z = /* @__PURE__ */ (function(e) {
307
+ return e.Select = "select", e.Configure = "configure", e.Move = "move", e.Resize = "resize", e.Restyle = "restyle", e.Insert = "insert", e.Delete = "delete", e;
308
+ })({});
309
+ function ve(e, t) {
310
+ switch (e) {
311
+ case M.Local:
312
+ return !0;
313
+ case M.ConfigurableInherited:
314
+ return t === Z.Select || t === Z.Configure;
315
+ case M.Inherited:
316
+ return t === Z.Select;
317
+ }
318
+ }
319
+ var Et = ({ ownership: e, label: t }) => e === M.Local ? null : /* @__PURE__ */ s("span", {
320
+ className: "studio-editor-ownership-badge",
321
+ "data-ownership": e,
322
+ children: t
323
+ });
324
+ function Dr({ row: e, adapter: t, strings: n, isSelected: r, isFocusable: i, dropZone: o, onSelect: a, onToggle: l, onKeyDown: d, onDragStart: u, onDragOver: c, onDrop: m, onDragEnd: I }) {
325
+ const g = t.ownershipOf(e.node), P = ve(g, Z.Move);
326
+ return /* @__PURE__ */ b("li", {
327
+ role: "treeitem",
328
+ "aria-level": e.depth + 1,
329
+ "aria-selected": r,
330
+ "aria-expanded": e.hasChildren ? e.isExpanded : void 0,
331
+ tabIndex: i ? 0 : -1,
332
+ "data-row-id": e.id,
333
+ "data-ownership": g,
334
+ "data-drop-zone": o,
335
+ className: "studio-editor-structure-row",
336
+ style: { paddingInlineStart: `${e.depth * 16 + 8}px` },
337
+ draggable: P,
338
+ onClick: () => a(e.id),
339
+ onKeyDown: (O) => d(O, e.id),
340
+ onDragStart: () => u(e.id),
341
+ onDragOver: (O) => c(O, e.id),
342
+ onDrop: (O) => m(O, e.id),
343
+ onDragEnd: I,
344
+ children: [
345
+ /* @__PURE__ */ s("button", {
346
+ type: "button",
347
+ tabIndex: -1,
348
+ className: "studio-editor-structure-row__toggle",
349
+ "aria-hidden": !e.hasChildren,
350
+ disabled: !e.hasChildren,
351
+ onClick: (O) => {
352
+ O.stopPropagation(), l(e.id);
353
+ },
354
+ children: e.hasChildren ? e.isExpanded ? "▾" : "▸" : ""
355
+ }),
356
+ /* @__PURE__ */ s("span", {
357
+ className: "studio-editor-structure-row__name",
358
+ children: t.nameOf(e.node)
359
+ }),
360
+ /* @__PURE__ */ s(Et, {
361
+ ownership: g,
362
+ label: n.ownership[g]
363
+ })
364
+ ]
365
+ });
366
+ }
367
+ var lt = {
368
+ ArrowUp: K.MoveUp,
369
+ ArrowDown: K.MoveDown,
370
+ ArrowLeft: K.Outdent,
371
+ ArrowRight: K.Indent
372
+ };
373
+ function At({ roots: e, adapter: t, strings: n, selectedId: r, onSelect: i, onEdit: o }) {
374
+ const [a, l] = D(() => new Set(e.flatMap((p) => [t.idOf(p), ...t.childrenOf(p).map((y) => t.idOf(y))]))), [d, u] = D(r), [c, m] = D(), [I, g] = D(), [P, O] = D(""), h = F(() => Lt(e, a, t), [
375
+ e,
376
+ a,
377
+ t
378
+ ]), S = h.some((p) => p.id === d) ? d : h[0]?.id, R = U((p) => l((y) => {
379
+ const k = new Set(y);
380
+ return k.delete(p) || k.add(p), k;
381
+ }), []), C = U((p) => {
382
+ if (!p) return;
383
+ const y = o(p);
384
+ O(y ? n.rejection[y] : n.moved), !y && p.targetParentId && l((k) => new Set(k).add(p.targetParentId));
385
+ }, [o, n]), N = (p) => {
386
+ p && (u(p), requestAnimationFrame(() => document.querySelector(`[data-row-id="${CSS.escape(p)}"]`)?.focus()));
387
+ }, v = (p, y) => {
388
+ const k = h.findIndex((A) => A.id === y), T = h[k];
389
+ if (p.altKey && lt[p.key]) {
390
+ p.preventDefault(), C(Or(e, y, lt[p.key], t)), N(y);
391
+ return;
392
+ }
393
+ switch (p.key) {
394
+ case "ArrowDown":
395
+ p.preventDefault(), N(h[k + 1]?.id);
396
+ break;
397
+ case "ArrowUp":
398
+ p.preventDefault(), N(h[k - 1]?.id);
399
+ break;
400
+ case "Home":
401
+ p.preventDefault(), N(h[0]?.id);
402
+ break;
403
+ case "End":
404
+ p.preventDefault(), N(h[h.length - 1]?.id);
405
+ break;
406
+ case "ArrowRight":
407
+ p.preventDefault(), T.hasChildren && !T.isExpanded ? R(y) : N(h[k + 1]?.parentId === y ? h[k + 1].id : void 0);
408
+ break;
409
+ case "ArrowLeft":
410
+ p.preventDefault(), T.isExpanded ? R(y) : N(T.parentId ?? void 0);
411
+ break;
412
+ case "Enter":
413
+ case " ":
414
+ p.preventDefault(), i(y);
415
+ }
416
+ }, f = (p, y) => {
417
+ if (!c) return;
418
+ p.preventDefault();
419
+ const k = p.currentTarget.getBoundingClientRect(), T = h.find((A) => A.id === y);
420
+ g({
421
+ id: y,
422
+ zone: Lr(p.clientY - k.top, k.height, !!T && t.acceptsChildren(T.node))
423
+ });
424
+ }, x = (p, y) => {
425
+ p.preventDefault(), c && I?.id === y && C(xr(e, c, y, I.zone, t)), m(void 0), g(void 0);
426
+ };
427
+ return h.length === 0 ? /* @__PURE__ */ s("p", {
428
+ className: "studio-editor-structure-empty",
429
+ children: n.structureEmpty
430
+ }) : /* @__PURE__ */ b(ae, { children: [/* @__PURE__ */ s("ul", {
431
+ role: "tree",
432
+ "aria-label": n.structureLabel,
433
+ className: "studio-editor-structure-tree",
434
+ children: h.map((p) => /* @__PURE__ */ s(Dr, {
435
+ row: p,
436
+ adapter: t,
437
+ strings: n,
438
+ isSelected: p.id === r,
439
+ isFocusable: p.id === S,
440
+ dropZone: I?.id === p.id ? I.zone : void 0,
441
+ onSelect: (y) => {
442
+ u(y), i(y);
443
+ },
444
+ onToggle: R,
445
+ onKeyDown: v,
446
+ onDragStart: m,
447
+ onDragOver: f,
448
+ onDrop: x,
449
+ onDragEnd: () => {
450
+ m(void 0), g(void 0);
451
+ }
452
+ }, p.id))
453
+ }), /* @__PURE__ */ s("p", {
454
+ className: "studio-editor-structure-announcement",
455
+ role: "status",
456
+ "aria-live": "polite",
457
+ children: P
458
+ })] });
459
+ }
460
+ var Pe = /* @__PURE__ */ (function(e) {
461
+ return e.Properties = "properties", e.Structure = "structure", e;
462
+ })({});
463
+ function Er(e, t) {
464
+ return e.replace(/\{(\w+)\}/g, (n, r) => t[r] ?? n);
465
+ }
466
+ function Ar(e, t) {
467
+ const n = e.diagnostic ? t.diagnostics[e.diagnostic.kind] : t.notAllowed;
468
+ return Er(n, {
469
+ library: e.reference.library,
470
+ key: e.reference.key,
471
+ variant: e.reference.variant
472
+ });
473
+ }
474
+ function Mr(e, t, n, r) {
475
+ if (!n) return;
476
+ const i = e.lookup(n);
477
+ if (!i) return;
478
+ if (!i.isResolved) return {
479
+ reference: n,
480
+ diagnostic: i.diagnostic,
481
+ isNotAllowed: !1
482
+ };
483
+ const o = t.icons.find((a) => Fn(a, n));
484
+ return o && r && !_n(o, r) ? {
485
+ reference: n,
486
+ isNotAllowed: !0
487
+ } : void 0;
488
+ }
489
+ var _r = 24;
490
+ function Fr(e) {
491
+ return e.libraries.map((t) => ({
492
+ id: t.library,
493
+ name: t.package.displayName ?? t.package.name,
494
+ version: t.package.version,
495
+ attribution: t.package.iconLibrary?.attribution
496
+ }));
497
+ }
498
+ function zr(e, t) {
499
+ return e.flatMap((n) => n.references.map((r) => ({
500
+ library: r.library,
501
+ key: r.key,
502
+ ...r.variant === void 0 ? {} : { variant: r.variant },
503
+ name: n.entry.name,
504
+ categories: n.entry.categories,
505
+ tags: n.entry.tags,
506
+ aliases: n.entry.aliases,
507
+ renderPreview: () => /* @__PURE__ */ s(qn, {
508
+ reference: r,
509
+ adapters: t,
510
+ size: _r
511
+ })
512
+ })));
513
+ }
514
+ function Ur(e, t, n, r = { status: "ready" }) {
515
+ return {
516
+ libraries: Fr(e),
517
+ icons: zr(t, n),
518
+ status: r.status,
519
+ error: r.error
520
+ };
521
+ }
522
+ function qr(e) {
523
+ return e.error ? {
524
+ status: "error",
525
+ error: e.error
526
+ } : e.diagnostics.some((t) => t.kind === "catalog-unavailable") ? { status: "error" } : { status: "ready" };
527
+ }
528
+ function $r(e, t) {
529
+ const [n, r] = D(), [i, o] = D(0);
530
+ return Me(() => {
531
+ let a = !0;
532
+ return e.search().then((l) => {
533
+ a && (r({
534
+ source: e,
535
+ entries: l.entries,
536
+ diagnostics: [...e.diagnostics, ...l.diagnostics]
537
+ }), o((d) => d + 1));
538
+ }).catch((l) => {
539
+ a && (r({
540
+ source: e,
541
+ entries: [],
542
+ diagnostics: e.diagnostics,
543
+ error: l instanceof Error ? l.message : String(l)
544
+ }), o((d) => d + 1));
545
+ }), () => {
546
+ a = !1;
547
+ };
548
+ }, [e]), F(() => {
549
+ const a = n?.source === e ? n : void 0, l = a ? qr(a) : { status: "loading" };
550
+ return {
551
+ catalog: Ur(e, a?.entries ?? [], t, l),
552
+ diagnostics: a?.diagnostics ?? e.diagnostics,
553
+ loadedVersion: i
554
+ };
555
+ }, [
556
+ e,
557
+ t,
558
+ n,
559
+ i
560
+ ]);
561
+ }
562
+ function Mt({ value: e, onChange: t, catalog: n, adapters: r, allowed: i, readOnly: o, disabled: a, validationMessage: l, showMessage: d = !0, invalid: u, strings: c, pickerLabels: m, placement: I, id: g, ...P }) {
563
+ const { catalog: O, loadedVersion: h } = $r(n, r), S = h > 0 ? Mr(n, O, e, i) : void 0, R = l ?? (S ? Ar(S, c) : void 0);
564
+ return /* @__PURE__ */ s(Mn, {
565
+ id: g,
566
+ value: e,
567
+ onChange: (C) => t({
568
+ library: C.library,
569
+ key: C.key,
570
+ ...C.variant === void 0 ? {} : { variant: C.variant }
571
+ }),
572
+ catalog: O,
573
+ allowed: i,
574
+ readOnly: o,
575
+ disabled: a,
576
+ invalid: R !== void 0 || u === !0,
577
+ validationMessage: d ? R : void 0,
578
+ placement: I,
579
+ labels: {
580
+ ...c.picker,
581
+ ...m
582
+ },
583
+ "aria-label": P["aria-label"] ?? (P["aria-labelledby"] ? void 0 : c.ariaLabel),
584
+ "aria-labelledby": P["aria-labelledby"],
585
+ "aria-describedby": P["aria-describedby"]
586
+ });
587
+ }
588
+ var Br = (e) => typeof e == "string" ? e : "";
589
+ function Vr(e) {
590
+ const t = (e.items ?? []).map((n) => ({
591
+ id: n.id,
592
+ label: Br(n.values.label),
593
+ ...n.values.icon ? { icon: n.values.icon } : {},
594
+ ...n.values.destination ? { destination: n.values.destination.screen } : {},
595
+ values: n.values,
596
+ editable: n.editable
597
+ }));
598
+ return {
599
+ fixed: t.filter((n) => !n.editable),
600
+ items: t.filter((n) => n.editable)
601
+ };
602
+ }
603
+ function jr(e) {
604
+ const t = new Set(e.operations ?? []), n = t.has(J.EditFields), r = e.descriptor.constraints?.maximumItems;
605
+ return {
606
+ add: t.has(J.Add),
607
+ remove: t.has(J.Remove),
608
+ reorder: t.has(J.Reorder),
609
+ fields: {
610
+ label: n ? "editable" : "readonly",
611
+ icon: n ? "editable" : "readonly",
612
+ destination: n ? "editable" : "readonly"
613
+ },
614
+ ...r !== void 0 ? { maxItems: r } : {},
615
+ ...e.reason ? { reasons: {
616
+ add: e.reason,
617
+ remove: e.reason,
618
+ reorder: e.reason
619
+ } } : {}
620
+ };
621
+ }
622
+ function Wr(e, t, n) {
623
+ const r = {
624
+ component: e,
625
+ path: t.descriptor.path
626
+ };
627
+ switch (n.kind) {
628
+ case "add":
629
+ return [{
630
+ kind: z.AddCollectionItem,
631
+ ...r,
632
+ item: {
633
+ id: n.item.id,
634
+ values: Jr(n.item)
635
+ },
636
+ index: n.index
637
+ }];
638
+ case "remove":
639
+ return [{
640
+ kind: z.RemoveCollectionItem,
641
+ ...r,
642
+ itemId: n.item.id
643
+ }];
644
+ case "move":
645
+ return [{
646
+ kind: z.ReorderCollectionItem,
647
+ ...r,
648
+ itemId: n.item.id,
649
+ index: n.toIndex
650
+ }];
651
+ case "update":
652
+ return [{
653
+ kind: z.EditCollectionItem,
654
+ ...r,
655
+ itemId: n.item.id,
656
+ field: n.field,
657
+ value: Gr(n.item, n.field)
658
+ }];
659
+ }
660
+ }
661
+ var Gr = (e, t) => t === "destination" ? e.destination ? { screen: e.destination } : void 0 : e[t], Jr = (e) => ({
662
+ ...e.values,
663
+ label: e.label,
664
+ ...e.icon ? { icon: e.icon } : {},
665
+ ...e.destination ? { destination: { screen: e.destination } } : {}
666
+ });
667
+ function Kr(e) {
668
+ return { types: e };
669
+ }
670
+ var le = (e) => `${typeof e}:${String(e)}`, Qr = (e) => e == null ? "" : le(e);
671
+ function Hr(e, t) {
672
+ if (t == null || t === "") return { value: void 0 };
673
+ const n = (e.descriptor.choices ?? []).find((r) => le(r.value) === t);
674
+ return n ? { value: n.value } : void 0;
675
+ }
676
+ var Yr = /* @__PURE__ */ new Set([
677
+ E.String,
678
+ E.Number,
679
+ E.Boolean,
680
+ E.Enum
681
+ ]), Zr = (e) => Yr.has(e.descriptor.valueType) && e.descriptor.editorKind === void 0, Xr = { action: /* @__PURE__ */ new Set([
682
+ "command",
683
+ "arguments",
684
+ "presentation"
685
+ ]) }, ei = (e, t) => Xr[e.slice(e.lastIndexOf(":") + 1)]?.has(t) ?? !1;
686
+ function ti(e) {
687
+ const { descriptor: t } = e, n = {
688
+ name: t.path,
689
+ label: t.label,
690
+ ...t.description ? { description: t.description } : {},
691
+ editable: e.editable,
692
+ ...e.reason ? { unavailableReason: e.reason } : {}
693
+ };
694
+ switch (t.valueType) {
695
+ case E.Number:
696
+ return {
697
+ ...n,
698
+ kind: "number",
699
+ ...t.constraints?.minimum !== void 0 ? { min: t.constraints.minimum } : {},
700
+ ...t.constraints?.maximum !== void 0 ? { max: t.constraints.maximum } : {},
701
+ ...t.constraints?.integer ? { step: 1 } : {},
702
+ required: t.constraints?.required ?? !1
703
+ };
704
+ case E.Boolean:
705
+ return {
706
+ ...n,
707
+ kind: "boolean"
708
+ };
709
+ case E.Enum: {
710
+ const r = (t.choices ?? []).map((a) => ({
711
+ value: le(a.value),
712
+ label: a.label
713
+ })), i = e.effectiveValue, o = i == null || r.some((a) => a.value === le(i));
714
+ return {
715
+ ...n,
716
+ kind: "choice",
717
+ options: o ? r : [...r, {
718
+ value: le(i),
719
+ label: String(i)
720
+ }]
721
+ };
722
+ }
723
+ default:
724
+ return {
725
+ ...n,
726
+ kind: "text"
727
+ };
728
+ }
729
+ }
730
+ function ni(e, t = "") {
731
+ const n = /* @__PURE__ */ new Map(), r = {};
732
+ for (const i of e.filter((o) => Zr(o) && !ei(t, o.descriptor.path))) {
733
+ const o = i.descriptor.group;
734
+ n.set(o, [...n.get(o) ?? [], ti(i)]), r[i.descriptor.path] = i.descriptor.valueType === E.Enum ? Qr(i.effectiveValue) : i.effectiveValue ?? "";
735
+ }
736
+ return {
737
+ groups: [...n.entries()].map(([i, o]) => ({
738
+ id: i,
739
+ title: i,
740
+ properties: o
741
+ })),
742
+ values: r
743
+ };
744
+ }
745
+ var ri = (e, t) => e.descriptor.valueType === "number" && typeof t == "string" ? t.trim() === "" ? void 0 : Number(t) : t;
746
+ function _t(e, t, n) {
747
+ const r = ri(t, n);
748
+ return t.editTarget === un.Instance ? r === void 0 ? {
749
+ kind: z.ResetInstanceValue,
750
+ component: e,
751
+ path: t.descriptor.path
752
+ } : {
753
+ kind: z.SetInstanceValue,
754
+ component: e,
755
+ path: t.descriptor.path,
756
+ value: r
757
+ } : r === void 0 ? {
758
+ kind: z.ResetProperty,
759
+ nodeId: W(e),
760
+ path: t.descriptor.path
761
+ } : {
762
+ kind: z.SetProperty,
763
+ nodeId: W(e),
764
+ path: t.descriptor.path,
765
+ value: r
766
+ };
767
+ }
768
+ var Ft = ({ diagnostics: e, label: t }) => {
769
+ if (e.length === 0) return null;
770
+ const n = [...e].sort((r, i) => +(i.severity === "error") - +(r.severity === "error"));
771
+ return /* @__PURE__ */ s("ul", {
772
+ className: "studio-editor-diagnostics",
773
+ role: "alert",
774
+ "aria-label": t,
775
+ children: n.map((r, i) => /* @__PURE__ */ s("li", {
776
+ "data-severity": r.severity,
777
+ children: r.message
778
+ }, `${r.code}:${r.path ?? ""}:${i}`))
779
+ });
780
+ }, V = /* @__PURE__ */ (function(e) {
781
+ return e.None = "none", e.Modal = "modal", e.Drawer = "drawer", e;
782
+ })({}), Q = /* @__PURE__ */ (function(e) {
783
+ return e.MissingSlice = "missingSlice", e.UnmappedInput = "unmappedInput", e.UnknownInput = "unknownInput", e.UnknownSource = "unknownSource", e;
784
+ })({});
785
+ function ii(e, t, n) {
786
+ const r = t.find((o) => o.id === e.sliceId);
787
+ if (!r) return [{ kind: Q.MissingSlice }];
788
+ const i = [];
789
+ for (const o of r.inputs) {
790
+ const a = e.inputs[o.name]?.trim();
791
+ a ? n.has(a) || i.push({
792
+ kind: Q.UnknownSource,
793
+ input: o.name
794
+ }) : o.required && i.push({
795
+ kind: Q.UnmappedInput,
796
+ input: o.name
797
+ });
798
+ }
799
+ for (const o of Object.keys(e.inputs)) r.inputs.some((a) => a.name === o) || i.push({
800
+ kind: Q.UnknownInput,
801
+ input: o
802
+ });
803
+ return i;
804
+ }
805
+ function oi(e, t) {
806
+ return Object.fromEntries(e.inputs.flatMap((n) => {
807
+ const r = t(n.name);
808
+ return r === void 0 ? [] : [[n.name, r]];
809
+ }));
810
+ }
811
+ var ai = (e, t) => {
812
+ const n = e.input ?? "";
813
+ switch (e.kind) {
814
+ case Q.MissingSlice:
815
+ return t.missingSlice;
816
+ case Q.UnmappedInput:
817
+ return t.unmappedInput(n);
818
+ case Q.UnknownInput:
819
+ return t.unknownInput(n);
820
+ case Q.UnknownSource:
821
+ return t.unknownSource(n);
822
+ }
823
+ }, si = ({ action: e, slices: t, sources: n, strings: r, disabled: i, suggestSource: o, onChange: a }) => {
824
+ const l = r.properties.action, d = e ? t.find((c) => c.id === e.sliceId) : void 0, u = e ? ii(e, t, new Set(n)) : [];
825
+ return /* @__PURE__ */ b("fieldset", {
826
+ className: "studio-editor-query",
827
+ disabled: i,
828
+ children: [
829
+ /* @__PURE__ */ s("legend", { children: l.label }),
830
+ /* @__PURE__ */ b("label", { children: [/* @__PURE__ */ s("span", { children: l.slice }), /* @__PURE__ */ b("select", {
831
+ value: e?.sliceId ?? "",
832
+ onChange: (c) => {
833
+ const m = t.find((I) => I.id === c.target.value);
834
+ a(m ? {
835
+ sliceId: m.id,
836
+ sliceName: m.name,
837
+ inputs: oi(m, o),
838
+ presentation: e?.presentation ?? V.None
839
+ } : void 0);
840
+ },
841
+ children: [
842
+ /* @__PURE__ */ s("option", {
843
+ value: "",
844
+ children: l.none
845
+ }),
846
+ e && !d && /* @__PURE__ */ s("option", {
847
+ value: e.sliceId,
848
+ children: e.sliceName
849
+ }),
850
+ t.map((c) => /* @__PURE__ */ b("option", {
851
+ value: c.id,
852
+ children: [c.name, c.origin.length > 0 ? ` - ${c.origin.join(" / ")}` : ""]
853
+ }, c.id))
854
+ ]
855
+ })] }),
856
+ e && d && /* @__PURE__ */ b(ae, { children: [/* @__PURE__ */ b("div", {
857
+ className: "studio-editor-query__group",
858
+ children: [/* @__PURE__ */ s("strong", { children: l.inputs }), d.inputs.map((c) => /* @__PURE__ */ b("label", { children: [/* @__PURE__ */ b("span", { children: [l.sourceFor(c.name), c.required ? " *" : ""] }), /* @__PURE__ */ b("select", {
859
+ value: e.inputs[c.name] ?? "",
860
+ onChange: (m) => a({
861
+ ...e,
862
+ inputs: {
863
+ ...e.inputs,
864
+ [c.name]: m.target.value
865
+ }
866
+ }),
867
+ children: [/* @__PURE__ */ s("option", {
868
+ value: "",
869
+ children: r.properties.query.noSource
870
+ }), n.map((m) => /* @__PURE__ */ s("option", {
871
+ value: m,
872
+ children: m
873
+ }, m))]
874
+ })] }, c.name))]
875
+ }), /* @__PURE__ */ b("label", { children: [/* @__PURE__ */ s("span", { children: l.presentation }), /* @__PURE__ */ b("select", {
876
+ value: e.presentation,
877
+ onChange: (c) => a({
878
+ ...e,
879
+ presentation: c.target.value
880
+ }),
881
+ children: [
882
+ /* @__PURE__ */ s("option", {
883
+ value: V.None,
884
+ children: l.presentations.none
885
+ }),
886
+ /* @__PURE__ */ s("option", {
887
+ value: V.Modal,
888
+ children: l.presentations.modal
889
+ }),
890
+ /* @__PURE__ */ s("option", {
891
+ value: V.Drawer,
892
+ children: l.presentations.drawer
893
+ })
894
+ ]
895
+ })] })] }),
896
+ u.length > 0 && /* @__PURE__ */ s("ul", {
897
+ className: "studio-editor-diagnostics",
898
+ role: "alert",
899
+ "aria-label": r.properties.diagnostics,
900
+ children: u.map((c, m) => /* @__PURE__ */ s("li", {
901
+ "data-severity": "error",
902
+ children: ai(c, l.problems)
903
+ }, m))
904
+ })
905
+ ]
906
+ });
907
+ };
908
+ function ci(e) {
909
+ return {
910
+ queryId: e.id,
911
+ query: e.name,
912
+ arguments: [],
913
+ results: []
914
+ };
915
+ }
916
+ function li(e) {
917
+ const t = e;
918
+ return !!t && typeof t == "object" && typeof t.queryId == "string" && Array.isArray(t.arguments) && Array.isArray(t.results);
919
+ }
920
+ function di(e, t, n) {
921
+ const r = e.arguments.filter((i) => i.parameter !== t);
922
+ return {
923
+ ...e,
924
+ arguments: n.trim() === "" ? r : [...r, {
925
+ parameter: t,
926
+ source: { path: n.trim() }
927
+ }]
928
+ };
929
+ }
930
+ function ui(e, t, n = t) {
931
+ return e.results.some((r) => r.field === t) ? e : {
932
+ ...e,
933
+ results: [...e.results, {
934
+ target: n,
935
+ field: t
936
+ }]
937
+ };
938
+ }
939
+ function pi(e, t) {
940
+ return {
941
+ ...e,
942
+ results: e.results.filter((n) => n.field !== t)
943
+ };
944
+ }
945
+ var mi = (e, t) => e.arguments.find((n) => n.parameter === t.name)?.source.path ?? "", fi = (e, t) => e.results.some((n) => n.field === t.name), $ = /* @__PURE__ */ (function(e) {
946
+ return e.NoQuery = "noQuery", e.MissingQuery = "missingQuery", e.Loading = "loading", e.Empty = "empty", e.Error = "error", e.Ready = "ready", e;
947
+ })({});
948
+ function hi({ binding: e, candidate: t, isLoading: n, error: r, rowCount: i }) {
949
+ return e ? t ? r != null ? $.Error : n ? $.Loading : i === 0 ? $.Empty : $.Ready : $.MissingQuery : $.NoQuery;
950
+ }
951
+ function dt(e, t, n, r) {
952
+ const i = On(e, t, n, r);
953
+ return {
954
+ diagnostics: i,
955
+ isStorable: i.every((o) => o.severity !== "error")
956
+ };
957
+ }
958
+ var gi = (e) => e.origin.map((t) => t.name).join(" / "), vi = ({ property: e, candidates: t, scope: n, strings: r, disabled: i, onChange: o }) => {
959
+ const a = r.properties.query, [l, d] = D(), u = li(e.effectiveValue) ? e.effectiveValue : void 0, c = l ?? u, m = c ? t.find((h) => h.id === c.queryId) : void 0, I = c ? dt(e.descriptor, m, c, n).diagnostics : [], g = (h) => {
960
+ if (!h) {
961
+ d(void 0), o(void 0);
962
+ return;
963
+ }
964
+ const S = dt(e.descriptor, t.find((R) => R.id === h.queryId), h, n);
965
+ d(S.isStorable ? void 0 : h), S.isStorable && o(h);
966
+ }, P = hi({
967
+ binding: c,
968
+ candidate: m,
969
+ isLoading: !1
970
+ }), O = Object.keys(n.types);
971
+ return /* @__PURE__ */ b("fieldset", {
972
+ className: "studio-editor-query",
973
+ disabled: i,
974
+ children: [
975
+ /* @__PURE__ */ s("legend", { children: e.descriptor.label }),
976
+ /* @__PURE__ */ b("label", { children: [/* @__PURE__ */ s("span", { children: a.label }), /* @__PURE__ */ b("select", {
977
+ value: c?.queryId ?? "",
978
+ onChange: (h) => {
979
+ const S = t.find((R) => R.id === h.target.value);
980
+ g(S ? ci(S) : void 0);
981
+ },
982
+ children: [
983
+ /* @__PURE__ */ s("option", {
984
+ value: "",
985
+ children: a.none
986
+ }),
987
+ c && !m && /* @__PURE__ */ s("option", {
988
+ value: c.queryId,
989
+ children: c.query
990
+ }),
991
+ t.map((h) => /* @__PURE__ */ b("option", {
992
+ value: h.id,
993
+ children: [
994
+ h.name,
995
+ " - ",
996
+ gi(h)
997
+ ]
998
+ }, h.id))
999
+ ]
1000
+ })] }),
1001
+ c && !m && /* @__PURE__ */ s("p", {
1002
+ className: "studio-editor-query__missing",
1003
+ role: "alert",
1004
+ children: a.missing
1005
+ }),
1006
+ c && m && /* @__PURE__ */ b(ae, { children: [m.parameters.length > 0 && /* @__PURE__ */ b("div", {
1007
+ className: "studio-editor-query__group",
1008
+ children: [/* @__PURE__ */ s("strong", { children: a.parameters }), m.parameters.map((h) => /* @__PURE__ */ b("label", { children: [/* @__PURE__ */ b("span", { children: [a.sourceFor(h.name), h.required ? " *" : ""] }), /* @__PURE__ */ b("select", {
1009
+ value: mi(c, h),
1010
+ onChange: (S) => g(di(c, h.name, S.target.value)),
1011
+ children: [/* @__PURE__ */ s("option", {
1012
+ value: "",
1013
+ children: a.noSource
1014
+ }), O.map((S) => /* @__PURE__ */ s("option", {
1015
+ value: S,
1016
+ children: S
1017
+ }, S))]
1018
+ })] }, h.name))]
1019
+ }), /* @__PURE__ */ b("div", {
1020
+ className: "studio-editor-query__group",
1021
+ children: [/* @__PURE__ */ s("strong", { children: a.columns }), m.resultFields.map((h) => /* @__PURE__ */ b("label", {
1022
+ className: "studio-editor-query__column",
1023
+ children: [/* @__PURE__ */ s("input", {
1024
+ type: "checkbox",
1025
+ checked: fi(c, h),
1026
+ onChange: (S) => g(S.target.checked ? ui(c, h.name) : pi(c, h.name))
1027
+ }), /* @__PURE__ */ s("span", { children: a.showColumn(h.name) })]
1028
+ }, h.name))]
1029
+ })] }),
1030
+ /* @__PURE__ */ s("p", {
1031
+ className: "studio-editor-query__preview",
1032
+ role: "status",
1033
+ "data-state": P,
1034
+ children: yi(P, a.preview)
1035
+ }),
1036
+ /* @__PURE__ */ s(Ft, {
1037
+ diagnostics: I,
1038
+ label: r.properties.diagnostics
1039
+ })
1040
+ ]
1041
+ });
1042
+ };
1043
+ function yi(e, t) {
1044
+ switch (e) {
1045
+ case $.NoQuery:
1046
+ return t.noQuery;
1047
+ case $.MissingQuery:
1048
+ return t.missingQuery;
1049
+ case $.Loading:
1050
+ return t.loading;
1051
+ case $.Empty:
1052
+ return t.empty;
1053
+ case $.Error:
1054
+ return t.error;
1055
+ case $.Ready:
1056
+ return "";
1057
+ }
1058
+ }
1059
+ var bi = (e, t, n = !1) => ({
1060
+ kind: z.ChangeLayoutType,
1061
+ nodeId: e,
1062
+ to: t,
1063
+ ...n ? { acceptLoss: !0 } : {}
1064
+ });
1065
+ function wi(e, t, n) {
1066
+ if (t) return { kind: "applied" };
1067
+ const r = n.find((i) => i.code === G.LossyConversionNotAccepted);
1068
+ return r ? {
1069
+ kind: "confirm",
1070
+ lost: r.message,
1071
+ edit: {
1072
+ ...e,
1073
+ acceptLoss: !0
1074
+ }
1075
+ } : {
1076
+ kind: "refused",
1077
+ diagnostics: [...n]
1078
+ };
1079
+ }
1080
+ var Ci = ({ inspection: e, controller: t, strings: n, disabled: r }) => {
1081
+ const i = n.properties, [o, a] = D(), l = it(t.context.catalog, e.typeId), d = l?.capabilities.convertibleTo ?? [];
1082
+ if (!l || d.length === 0) return null;
1083
+ const u = (c) => {
1084
+ const m = t.tryApply(c, i.changeLayout), I = wi(c, m.applied, m.diagnostics);
1085
+ a(I.kind === "confirm" ? {
1086
+ lost: I.lost,
1087
+ edit: I.edit
1088
+ } : void 0);
1089
+ };
1090
+ return /* @__PURE__ */ b("section", {
1091
+ className: "studio-editor-properties__layout",
1092
+ children: [/* @__PURE__ */ b("label", { children: [/* @__PURE__ */ s("span", { children: i.layoutType }), /* @__PURE__ */ b("select", {
1093
+ value: e.typeId,
1094
+ disabled: r,
1095
+ onChange: (c) => u(bi(e.nodeId, c.target.value)),
1096
+ children: [/* @__PURE__ */ s("option", {
1097
+ value: e.typeId,
1098
+ children: l.label
1099
+ }), d.map((c) => /* @__PURE__ */ s("option", {
1100
+ value: c,
1101
+ children: it(t.context.catalog, c)?.label ?? c
1102
+ }, c))]
1103
+ })] }), o && /* @__PURE__ */ b("div", {
1104
+ className: "studio-editor-properties__confirm",
1105
+ role: "alertdialog",
1106
+ "aria-label": i.confirmLayoutTitle,
1107
+ children: [
1108
+ /* @__PURE__ */ s("strong", { children: i.confirmLayoutTitle }),
1109
+ /* @__PURE__ */ s("p", { children: o.lost }),
1110
+ /* @__PURE__ */ s("button", {
1111
+ type: "button",
1112
+ onClick: () => {
1113
+ t.apply(o.edit, i.changeLayout), a(void 0);
1114
+ },
1115
+ children: i.confirmLayoutAccept
1116
+ }),
1117
+ /* @__PURE__ */ s("button", {
1118
+ type: "button",
1119
+ onClick: () => a(void 0),
1120
+ children: i.confirmLayoutCancel
1121
+ })
1122
+ ]
1123
+ })]
1124
+ });
1125
+ };
1126
+ function ki(e, t, n, r = {}) {
1127
+ const i = {
1128
+ component: t,
1129
+ path: n,
1130
+ ...r.label ? { label: r.label } : {},
1131
+ ...r.operations && r.operations.length > 0 ? { operations: r.operations } : {},
1132
+ ...r.editableFields && r.editableFields.length > 0 ? { editableFields: r.editableFields } : {}
1133
+ };
1134
+ return {
1135
+ kind: z.ExposeProperty,
1136
+ owner: e,
1137
+ property: i
1138
+ };
1139
+ }
1140
+ function Ii(e, t, n) {
1141
+ return {
1142
+ kind: z.UnexposeProperty,
1143
+ owner: e,
1144
+ component: t,
1145
+ path: n
1146
+ };
1147
+ }
1148
+ var Si = (e, t, n, r) => e.exposures.some((i) => i.owner === t && i.properties.some((o) => o.component === n && o.path === r)), Pi = [
1149
+ J.Add,
1150
+ J.Remove,
1151
+ J.Reorder,
1152
+ J.EditFields
1153
+ ], Ti = ({ inspection: e, componentId: t, controller: n, strings: r, authoringTemplate: i }) => {
1154
+ const o = r.properties;
1155
+ if (i === void 0) return null;
1156
+ const a = e.properties.filter((l) => l.descriptor.valueType !== E.Object && l.descriptor.group !== "Placement");
1157
+ return a.length === 0 ? null : /* @__PURE__ */ b("section", {
1158
+ className: "studio-editor-properties__exposure",
1159
+ children: [/* @__PURE__ */ s("strong", { children: o.exposure }), /* @__PURE__ */ s("ul", { children: a.map((l) => {
1160
+ const d = l.descriptor.path, u = Si(n.document, i, t, d), c = l.descriptor.valueType === E.Collection;
1161
+ return /* @__PURE__ */ s("li", { children: /* @__PURE__ */ b("label", { children: [
1162
+ /* @__PURE__ */ s("input", {
1163
+ type: "checkbox",
1164
+ checked: u,
1165
+ onChange: (m) => n.apply(m.target.checked ? ki(i, t, d, c ? { operations: Pi } : {}) : Ii(i, t, d), u ? o.unexposeProperty : o.exposeProperty)
1166
+ }),
1167
+ /* @__PURE__ */ s("span", { children: l.descriptor.label }),
1168
+ u && /* @__PURE__ */ s("em", { children: o.exposedToScopes })
1169
+ ] }) }, d);
1170
+ }) })]
1171
+ });
1172
+ };
1173
+ function zt(e) {
1174
+ if (e !== void 0)
1175
+ return e.filter((t) => typeof t.value == "string").map((t) => vn(t.value)).filter((t) => t !== void 0);
1176
+ }
1177
+ var Ri = /* @__PURE__ */ new Set([
1178
+ G.MissingIconLibrary,
1179
+ G.MissingIcon,
1180
+ G.MissingIconVariant,
1181
+ G.IncompatibleIconLibrary,
1182
+ G.IconCatalogUnavailable,
1183
+ G.IconNotVerified
1184
+ ]), Ut = (e) => Ri.has(e.code), Ni = (e) => e.code === G.IconNotVerified;
1185
+ function qt(e, t, n) {
1186
+ const r = e.filter((i) => Ut(i) && !Ni(i) && i.path === t && i.itemId === n);
1187
+ return (r.find((i) => i.severity === dn.Error) ?? r[0])?.message;
1188
+ }
1189
+ var Oi = (e) => e.filter((t) => !Ut(t));
1190
+ function xi(e, t) {
1191
+ const n = {};
1192
+ for (const r of e) {
1193
+ if (r.itemId === void 0) continue;
1194
+ const i = qt(e, t, r.itemId);
1195
+ i && (n[r.itemId] = { icon: i });
1196
+ }
1197
+ return n;
1198
+ }
1199
+ var Li = ({ properties: e, controller: t, catalog: n, adapters: r, diagnostics: i, strings: o }) => {
1200
+ if (e.length === 0) return null;
1201
+ const a = o.properties;
1202
+ return /* @__PURE__ */ s("section", {
1203
+ className: "studio-editor-properties__icons",
1204
+ children: e.map((l) => {
1205
+ const { path: d, label: u } = l.descriptor, c = gn(l.effectiveValue) ? l.effectiveValue : void 0, m = `studio-editor-icon-${d}`;
1206
+ return /* @__PURE__ */ b("div", {
1207
+ className: "studio-editor-properties__icon",
1208
+ children: [
1209
+ /* @__PURE__ */ s("span", {
1210
+ id: m,
1211
+ className: "studio-editor-properties__icon-label",
1212
+ children: u
1213
+ }),
1214
+ /* @__PURE__ */ s(Mt, {
1215
+ value: c,
1216
+ onChange: (I) => t.setProperty(l, I),
1217
+ catalog: n,
1218
+ adapters: r,
1219
+ allowed: zt(l.descriptor.choices),
1220
+ readOnly: !l.editable,
1221
+ validationMessage: qt(i, d),
1222
+ strings: a.icon,
1223
+ pickerLabels: a.iconPickerLabels,
1224
+ "aria-labelledby": m
1225
+ }),
1226
+ !l.editable && l.reason && /* @__PURE__ */ s("p", {
1227
+ className: "studio-editor-properties__hint",
1228
+ children: l.reason
1229
+ })
1230
+ ]
1231
+ }, d);
1232
+ })
1233
+ });
1234
+ }, $t = {
1235
+ placeholder: 'Empty means not set. Type JSON, such as {"a": 1}, [1, 2] or null.',
1236
+ problems: {
1237
+ required: "This setting needs a value.",
1238
+ syntax: (e) => `This is not valid JSON: ${e}`,
1239
+ unsafeInteger: (e) => `${e} is too large to be kept exactly as a number.`,
1240
+ outOfRange: (e) => `${e} is too large to be a number.`
1241
+ }
1242
+ }, q = /* @__PURE__ */ (function(e) {
1243
+ return e.Unchanged = "unchanged", e.Unset = "unset", e.Set = "set", e.Invalid = "invalid", e;
1244
+ })({}), j = /* @__PURE__ */ (function(e) {
1245
+ return e.Required = "required", e.Syntax = "syntax", e.UnsafeInteger = "unsafeInteger", e.OutOfRange = "outOfRange", e;
1246
+ })({});
1247
+ function Di(e, t) {
1248
+ switch (e.kind) {
1249
+ case j.Required:
1250
+ return t.problems.required;
1251
+ case j.Syntax:
1252
+ return t.problems.syntax(e.detail);
1253
+ case j.UnsafeInteger:
1254
+ return t.problems.unsafeInteger(e.detail);
1255
+ case j.OutOfRange:
1256
+ return t.problems.outOfRange(e.detail);
1257
+ }
1258
+ }
1259
+ var Bt = (e) => e === void 0 ? "" : JSON.stringify(e, null, 2) ?? "", ut = /-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
1260
+ function Ei(e) {
1261
+ const t = [];
1262
+ let n = 0;
1263
+ for (; n < e.length; ) {
1264
+ const r = e[n];
1265
+ if (r === '"') {
1266
+ for (n++; n < e.length && e[n] !== '"'; ) n += e[n] === "\\" ? 2 : 1;
1267
+ n++;
1268
+ continue;
1269
+ }
1270
+ if (r === "-" || r >= "0" && r <= "9") {
1271
+ ut.lastIndex = n;
1272
+ const i = ut.exec(e);
1273
+ if (i) {
1274
+ t.push(i[0]), n += i[0].length;
1275
+ continue;
1276
+ }
1277
+ }
1278
+ n++;
1279
+ }
1280
+ return t;
1281
+ }
1282
+ var Ai = (e) => {
1283
+ const [t] = e.replace("-", "").split(/[eE]/);
1284
+ return t.replace(".", "").replace(/^0+/, "").replace(/0+$/, "").length;
1285
+ }, Mi = (e, t) => Number.isSafeInteger(t) ? !1 : /[.eE]/.test(e) ? Number.isInteger(t) && Ai(e) > 15 : !0, _i = (e) => {
1286
+ for (const t of Ei(e)) {
1287
+ const n = Number(t);
1288
+ if (!Number.isFinite(n)) return {
1289
+ kind: j.OutOfRange,
1290
+ detail: t
1291
+ };
1292
+ if (Mi(t, n)) return {
1293
+ kind: j.UnsafeInteger,
1294
+ detail: t
1295
+ };
1296
+ }
1297
+ };
1298
+ function Fi(e) {
1299
+ let t;
1300
+ try {
1301
+ t = JSON.parse(e);
1302
+ } catch (r) {
1303
+ return { problem: {
1304
+ kind: j.Syntax,
1305
+ detail: r instanceof Error ? r.message : String(r)
1306
+ } };
1307
+ }
1308
+ const n = _i(e);
1309
+ return n ? { problem: n } : { value: t };
1310
+ }
1311
+ function ye(e, t) {
1312
+ if (typeof e == "number" || typeof t == "number") return Object.is(e, t);
1313
+ if (e === null || t === null || typeof e != "object" || typeof t != "object") return e === t;
1314
+ if (Array.isArray(e) !== Array.isArray(t)) return !1;
1315
+ if (Array.isArray(e) && Array.isArray(t)) return e.length === t.length && e.every((i, o) => ye(i, t[o]));
1316
+ const n = Object.keys(e), r = Object.keys(t);
1317
+ return n.length === r.length && n.every((i, o) => i === r[o] && ye(e[i], t[i]));
1318
+ }
1319
+ var Qe = (e) => ({
1320
+ text: Bt(e),
1321
+ base: e
1322
+ }), zi = (e, t) => ({
1323
+ ...e,
1324
+ text: t
1325
+ }), Ui = (e, t) => ye(e.base, t) ? e : Qe(t), Vt = (e) => Qe(e.base);
1326
+ function jt(e, t) {
1327
+ if (e.text.trim() === "")
1328
+ return t ? {
1329
+ kind: q.Invalid,
1330
+ problem: {
1331
+ kind: j.Required,
1332
+ detail: ""
1333
+ }
1334
+ } : e.base === void 0 ? { kind: q.Unchanged } : { kind: q.Unset };
1335
+ if (e.text === Bt(e.base)) return { kind: q.Unchanged };
1336
+ const n = Fi(e.text);
1337
+ return n.problem ? {
1338
+ kind: q.Invalid,
1339
+ problem: n.problem
1340
+ } : t && n.value === null ? {
1341
+ kind: q.Invalid,
1342
+ problem: {
1343
+ kind: j.Required,
1344
+ detail: ""
1345
+ }
1346
+ } : ye(n.value, e.base) ? { kind: q.Unchanged } : {
1347
+ kind: q.Set,
1348
+ value: n.value
1349
+ };
1350
+ }
1351
+ function qi(e, t) {
1352
+ const n = jt(e, t);
1353
+ return {
1354
+ state: n.kind === q.Unchanged ? Vt(e) : e,
1355
+ outcome: n
1356
+ };
1357
+ }
1358
+ function $i(e, t, n) {
1359
+ const [r, i] = D(() => Qe(e)), o = Ui(r, e);
1360
+ return o !== r && i(o), {
1361
+ text: o.text,
1362
+ outcome: jt(o, t),
1363
+ edit: (a) => i(zi(o, a)),
1364
+ revert: () => i(Vt(o)),
1365
+ commit: () => {
1366
+ const a = qi(o, t);
1367
+ i(a.state), a.outcome.kind === q.Set && n(a.outcome.value), a.outcome.kind === q.Unset && n(void 0);
1368
+ }
1369
+ };
1370
+ }
1371
+ var Bi = (e) => e.key === "Enter" && (e.ctrlKey || e.metaKey), Vi = ({ label: e, description: t, value: n, onApply: r, readOnly: i = !1, reason: o, required: a = !1, strings: l, rows: d = 6 }) => {
1372
+ const u = $i(n, a, r), c = cn(), m = u.outcome.kind === q.Invalid ? Di(u.outcome.problem, l) : void 0, I = [
1373
+ t && `${c}-description`,
1374
+ m && `${c}-problem`,
1375
+ o && `${c}-reason`
1376
+ ].filter(Boolean).join(" ") || void 0;
1377
+ return /* @__PURE__ */ b("div", {
1378
+ className: "studio-editor-json",
1379
+ children: [
1380
+ /* @__PURE__ */ s("label", {
1381
+ htmlFor: c,
1382
+ className: "studio-editor-json__label",
1383
+ children: e
1384
+ }),
1385
+ t && /* @__PURE__ */ s("p", {
1386
+ id: `${c}-description`,
1387
+ className: "studio-editor-json__description",
1388
+ children: t
1389
+ }),
1390
+ /* @__PURE__ */ s(Dn, {
1391
+ id: c,
1392
+ className: "studio-editor-json__text",
1393
+ value: u.text,
1394
+ rows: d,
1395
+ readOnly: i,
1396
+ invalid: m !== void 0,
1397
+ placeholder: i ? void 0 : l.placeholder,
1398
+ spellCheck: !1,
1399
+ "aria-describedby": I,
1400
+ onChange: u.edit,
1401
+ onBlur: i ? void 0 : u.commit,
1402
+ onKeyDown: (g) => {
1403
+ i || (Bi(g) && u.commit(), g.key === "Escape" && u.revert());
1404
+ }
1405
+ }),
1406
+ m && /* @__PURE__ */ s("p", {
1407
+ id: `${c}-problem`,
1408
+ role: "alert",
1409
+ className: "studio-editor-json__problem",
1410
+ children: m
1411
+ }),
1412
+ i && o && /* @__PURE__ */ s("p", {
1413
+ id: `${c}-reason`,
1414
+ className: "studio-editor-json__reason",
1415
+ children: o
1416
+ })
1417
+ ]
1418
+ });
1419
+ }, ji = ({ properties: e, componentId: t, setProperty: n, strings: r = $t }) => e.length === 0 ? null : /* @__PURE__ */ s("section", {
1420
+ className: "studio-editor-json-properties",
1421
+ children: e.map((i) => /* @__PURE__ */ s(Vi, {
1422
+ label: i.descriptor.label,
1423
+ description: i.descriptor.description,
1424
+ value: i.effectiveValue,
1425
+ readOnly: !i.editable || i.descriptor.readOnly === !0,
1426
+ reason: i.reason,
1427
+ required: i.descriptor.constraints?.required === !0,
1428
+ strings: r,
1429
+ onApply: (o) => n(i, o)
1430
+ }, `${t}:${i.descriptor.path}`))
1431
+ }), Wi = E.Json, Gi = (e) => e === Wi, Ji = (e) => Gi(e.descriptor.valueType), Ki = "action", He = "presentation", Ye = "arguments", pe = (e) => typeof e == "string" ? e : "";
1432
+ function Qi(e, t = "") {
1433
+ const n = pe(e?.command);
1434
+ if (n === "") return;
1435
+ const r = Array.isArray(e?.arguments) ? e[Ye] : [], i = Object.fromEntries(r.map((a) => [pe(a.name), pe(a.source)]).filter(([a]) => a !== "")), o = pe(e?.[He]);
1436
+ return {
1437
+ sliceId: n,
1438
+ sliceName: t,
1439
+ inputs: i,
1440
+ presentation: Object.values(V).includes(o) ? o : V.None
1441
+ };
1442
+ }
1443
+ function Hi(e) {
1444
+ return {
1445
+ command: e.sliceId,
1446
+ [He]: e.presentation,
1447
+ [Ye]: Object.entries(e.inputs).filter(([, t]) => t.trim() !== "").map(([t, n]) => ({
1448
+ id: t,
1449
+ name: t,
1450
+ source: n.trim()
1451
+ }))
1452
+ };
1453
+ }
1454
+ function Yi(e, t) {
1455
+ const n = W(e);
1456
+ return Object.entries(Hi(t)).map(([r, i]) => ({
1457
+ kind: z.SetProperty,
1458
+ nodeId: n,
1459
+ path: r,
1460
+ value: i
1461
+ }));
1462
+ }
1463
+ var Zi = (e) => e.descriptor.valueType === E.QueryReference, Xi = /* @__PURE__ */ new Set([Ye]), eo = (e) => e.descriptor.valueType === E.Collection && !!e.descriptor.item && !Xi.has(e.descriptor.path), to = ({ controller: e, environment: t, strings: n, ownership: r, authoringTemplate: i }) => {
1464
+ const { inspection: o, selectedId: a, selection: l } = e, d = n.properties, u = F(() => Kr(t.availableSources), [t.availableSources]);
1465
+ if (!a || !l || !o) return /* @__PURE__ */ s("p", {
1466
+ className: "studio-editor-properties-empty",
1467
+ children: n.noSelection
1468
+ });
1469
+ const c = ni(o.properties, o.typeId), m = new Map(o.properties.map((f) => [f.descriptor.path, f])), I = o.properties.filter(Zi), g = o.properties.filter(eo), P = o.properties.filter((f) => f.descriptor.valueType === E.Icon), O = o.properties.filter(Ji), h = [...o.diagnostics, ...e.diagnostics], { runtime: S } = t, R = o.typeId.endsWith("action"), C = l.properties, N = (f) => {
1470
+ const x = m.get(f.name);
1471
+ if (!x) return;
1472
+ if (x.descriptor.valueType !== E.Enum) return e.setProperty(x, f.value);
1473
+ const p = Hr(x, f.value);
1474
+ p && e.setProperty(x, p.value);
1475
+ }, v = (f, x) => e.apply(_t(a, f, x), "Bind query");
1476
+ return /* @__PURE__ */ b("div", {
1477
+ className: "studio-editor-properties",
1478
+ children: [
1479
+ /* @__PURE__ */ b("header", {
1480
+ className: "studio-editor-properties__header",
1481
+ children: [
1482
+ /* @__PURE__ */ s("strong", { children: o.label }),
1483
+ /* @__PURE__ */ s("span", { children: o.typeId }),
1484
+ r && /* @__PURE__ */ s(Et, {
1485
+ ownership: r,
1486
+ label: n.ownership[r]
1487
+ })
1488
+ ]
1489
+ }),
1490
+ r && /* @__PURE__ */ s("p", {
1491
+ className: "studio-editor-properties__hint",
1492
+ children: n.ownershipHint[r]
1493
+ }),
1494
+ /* @__PURE__ */ s(Ft, {
1495
+ diagnostics: Oi(h),
1496
+ label: d.diagnostics
1497
+ }),
1498
+ /* @__PURE__ */ s(Ci, {
1499
+ inspection: o,
1500
+ controller: e,
1501
+ strings: n,
1502
+ disabled: r !== void 0 && r !== "local"
1503
+ }),
1504
+ c.groups.length > 0 ? /* @__PURE__ */ s(An, {
1505
+ groups: c.groups,
1506
+ values: c.values,
1507
+ onChange: N,
1508
+ "aria-label": n.propertiesTab
1509
+ }) : o.properties.length === 0 && /* @__PURE__ */ s("p", {
1510
+ className: "studio-editor-properties-empty",
1511
+ children: d.noProperties
1512
+ }),
1513
+ /* @__PURE__ */ s(Li, {
1514
+ properties: P,
1515
+ controller: e,
1516
+ catalog: S.icons,
1517
+ adapters: S.iconAdapters,
1518
+ diagnostics: h,
1519
+ strings: n
1520
+ }),
1521
+ /* @__PURE__ */ s(ji, {
1522
+ properties: O,
1523
+ componentId: a,
1524
+ setProperty: e.setProperty,
1525
+ strings: d.json
1526
+ }),
1527
+ g.map((f) => /* @__PURE__ */ s(no, {
1528
+ property: f,
1529
+ componentId: a,
1530
+ controller: e,
1531
+ strings: n,
1532
+ destinations: t.destinations,
1533
+ icons: {
1534
+ catalog: S.icons,
1535
+ adapters: S.iconAdapters,
1536
+ diagnostics: h
1537
+ }
1538
+ }, f.descriptor.path)),
1539
+ I.map((f) => /* @__PURE__ */ s(vi, {
1540
+ property: f,
1541
+ candidates: t.queryCandidates,
1542
+ scope: u,
1543
+ strings: n,
1544
+ disabled: !f.editable,
1545
+ onChange: (x) => v(f, x)
1546
+ }, `${a}:${f.descriptor.path}`)),
1547
+ R && /* @__PURE__ */ s(si, {
1548
+ action: Qi(C, t.stateChangeSlices.find((f) => f.id === C?.command)?.name ?? ""),
1549
+ slices: t.stateChangeSlices,
1550
+ sources: Object.keys(t.availableSources),
1551
+ strings: n,
1552
+ disabled: r !== void 0 && r !== "local",
1553
+ suggestSource: (f) => f === "id" || f.endsWith("Id") ? "row.id" : void 0,
1554
+ onChange: (f) => f && e.applyAll(Yi(a, f), n.properties.action.label)
1555
+ }),
1556
+ /* @__PURE__ */ s(Ti, {
1557
+ inspection: o,
1558
+ componentId: a,
1559
+ controller: e,
1560
+ strings: n,
1561
+ authoringTemplate: i
1562
+ })
1563
+ ]
1564
+ });
1565
+ }, no = ({ property: e, componentId: t, controller: n, strings: r, destinations: i, icons: o }) => {
1566
+ const { items: a, fixed: l } = Vr(e), d = xi(o.diagnostics, e.descriptor.path);
1567
+ return /* @__PURE__ */ s("section", {
1568
+ className: "studio-editor-properties__collection",
1569
+ children: /* @__PURE__ */ s(En, {
1570
+ items: a,
1571
+ fixedItems: l,
1572
+ capabilities: jr(e),
1573
+ destinations: i,
1574
+ validation: d,
1575
+ renderIconField: (u) => /* @__PURE__ */ s(Mt, {
1576
+ value: u.value,
1577
+ onChange: u.onChange,
1578
+ allowed: zt(e.descriptor.item?.properties.find((c) => c.path === "icon")?.choices),
1579
+ catalog: o.catalog,
1580
+ adapters: o.adapters,
1581
+ readOnly: u.readOnly,
1582
+ showMessage: !1,
1583
+ invalid: u.invalid,
1584
+ strings: r.properties.icon,
1585
+ pickerLabels: r.properties.iconPickerLabels,
1586
+ "aria-label": u["aria-label"],
1587
+ "aria-describedby": u["aria-describedby"]
1588
+ }),
1589
+ "aria-label": e.descriptor.label,
1590
+ createItem: () => ({
1591
+ id: globalThis.crypto.randomUUID(),
1592
+ label: "",
1593
+ values: {}
1594
+ }),
1595
+ onChange: (u) => n.applyAll(Wr(t, e, u), r.properties.itemsLabel)
1596
+ })
1597
+ });
1598
+ }, Wt = ({ strings: e, controller: t, environment: n, authoringTemplate: r, structure: i, onClose: o }) => {
1599
+ const [a, l] = D(Pe.Properties), d = t.selectedId ? t.ownershipOf(t.selectedId) : void 0;
1600
+ return /* @__PURE__ */ b("section", {
1601
+ className: "studio-editor-inspector",
1602
+ "aria-label": e.inspectorTitle,
1603
+ children: [/* @__PURE__ */ b("header", {
1604
+ className: "studio-editor-inspector__header",
1605
+ children: [/* @__PURE__ */ s("h2", {
1606
+ className: "studio-editor-inspector__title",
1607
+ children: e.inspectorTitle
1608
+ }), /* @__PURE__ */ s("button", {
1609
+ type: "button",
1610
+ className: "studio-editor-inspector__close",
1611
+ "aria-label": e.closeInspector,
1612
+ title: e.closeInspector,
1613
+ onClick: o,
1614
+ children: "×"
1615
+ })]
1616
+ }), /* @__PURE__ */ s(Ln, {
1617
+ className: "studio-editor-inspector__tabs",
1618
+ "aria-label": e.inspectorTitle,
1619
+ value: a,
1620
+ onChange: l,
1621
+ tabs: [{
1622
+ id: Pe.Properties,
1623
+ label: e.propertiesTab,
1624
+ content: /* @__PURE__ */ s(to, {
1625
+ controller: t,
1626
+ environment: n,
1627
+ strings: e,
1628
+ ownership: d,
1629
+ authoringTemplate: r
1630
+ })
1631
+ }, {
1632
+ id: Pe.Structure,
1633
+ label: e.structureTab,
1634
+ content: i
1635
+ }]
1636
+ })]
1637
+ });
1638
+ }, ee = /* @__PURE__ */ (function(e) {
1639
+ return e.Panel = "Panel", e.StackPanel = "StackPanel", e.WrapPanel = "WrapPanel", e.Grid = "Grid", e.Canvas = "Canvas", e;
1640
+ })({}), ro = [
1641
+ {
1642
+ item: w.Stack,
1643
+ type: "Stack",
1644
+ panel: ee.StackPanel,
1645
+ flowKind: Ie.Column,
1646
+ arrangement: L.Column
1647
+ },
1648
+ {
1649
+ item: w.Row,
1650
+ type: "Row",
1651
+ panel: ee.StackPanel,
1652
+ flowKind: Ie.Row,
1653
+ arrangement: L.Row
1654
+ },
1655
+ {
1656
+ item: w.Grid,
1657
+ type: "Grid",
1658
+ panel: ee.Grid,
1659
+ flowKind: Ie.Grid,
1660
+ arrangement: L.Grid
1661
+ },
1662
+ {
1663
+ item: w.Container,
1664
+ type: "Container",
1665
+ panel: ee.Panel,
1666
+ arrangement: L.Grouping
1667
+ },
1668
+ {
1669
+ item: w.Wrap,
1670
+ type: "Wrap",
1671
+ panel: ee.WrapPanel,
1672
+ arrangement: L.Wrap
1673
+ },
1674
+ {
1675
+ item: w.Canvas,
1676
+ type: "Canvas",
1677
+ panel: ee.Canvas,
1678
+ arrangement: L.Freeform
1679
+ }
1680
+ ], io = /* @__PURE__ */ new Set([
1681
+ "column",
1682
+ "screenShell",
1683
+ "shell"
1684
+ ]), oo = (e) => e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).trim();
1685
+ function Gt(e, t, n, r) {
1686
+ return [{
1687
+ id: "layout",
1688
+ title: e,
1689
+ items: ro.map((i) => ({
1690
+ id: `layout:${i.item}`,
1691
+ title: t[i.item],
1692
+ icon: n.layout(i.item),
1693
+ payload: {
1694
+ kind: "layout",
1695
+ item: i.item
1696
+ }
1697
+ }))
1698
+ }, ...r.map((i) => ({
1699
+ id: `package:${i.package}`,
1700
+ title: i.package,
1701
+ items: i.components.filter((o) => !io.has(o)).map((o) => ({
1702
+ id: `component:${i.package}:${o}`,
1703
+ title: oo(o),
1704
+ icon: n.component(o),
1705
+ payload: {
1706
+ kind: "component",
1707
+ componentName: o,
1708
+ package: i.package
1709
+ }
1710
+ }))
1711
+ })).filter((i) => i.items.length > 0)];
1712
+ }
1713
+ var de = (e) => {
1714
+ const t = e;
1715
+ return !!t && (t.kind === "layout" && typeof t.item == "string" || t.kind === "component" && typeof t.componentName == "string" && typeof t.package == "string");
1716
+ }, ao = "core", so = /* @__PURE__ */ new Set([Ki]);
1717
+ function Ze(e, t) {
1718
+ return so.has(e) && t === "core" ? `${ao}:${e}` : e;
1719
+ }
1720
+ var Xe = "application/x-studio-palette-item", Jt = (e, t) => {
1721
+ e.dataTransfer.setData(Xe, JSON.stringify(t)), e.dataTransfer.effectAllowed = "copyMove";
1722
+ };
1723
+ function co(e) {
1724
+ try {
1725
+ const t = JSON.parse(e.dataTransfer.getData(Xe));
1726
+ return de(t) ? t : void 0;
1727
+ } catch {
1728
+ return;
1729
+ }
1730
+ }
1731
+ var lo = (e) => e.dataTransfer.types.includes(Xe);
1732
+ function Ee(e) {
1733
+ return e ? Be(e) ? X.grid : Ve(e) ? e.orientation === ne.Horizontal ? X.flexRow : X.flexColumn : $e(e) ? X.absolute : X.flexColumn : X.absolute;
1734
+ }
1735
+ function Kt(e, t) {
1736
+ return {
1737
+ id: e,
1738
+ name: t,
1739
+ visibility: Ue.Visible,
1740
+ isEnabled: !0,
1741
+ opacity: 1,
1742
+ size: {},
1743
+ zIndex: 0,
1744
+ minimumSize: {},
1745
+ maximumSize: {},
1746
+ margin: {
1747
+ left: 0,
1748
+ top: 0,
1749
+ right: 0,
1750
+ bottom: 0
1751
+ },
1752
+ horizontalAlignment: Fe.Stretch,
1753
+ verticalAlignment: ze.Stretch,
1754
+ properties: {}
1755
+ };
1756
+ }
1757
+ var pt = {
1758
+ unitType: pn.Star,
1759
+ value: 1
1760
+ };
1761
+ function be(e, t, n, r = [], i = {}) {
1762
+ const o = uo(e, i);
1763
+ return {
1764
+ ...Kt(t, n),
1765
+ children: r,
1766
+ ...o
1767
+ };
1768
+ }
1769
+ function uo(e, t) {
1770
+ switch (e) {
1771
+ case w.Stack:
1772
+ return {
1773
+ orientation: ne.Vertical,
1774
+ spacing: 8
1775
+ };
1776
+ case w.Row:
1777
+ return {
1778
+ orientation: ne.Horizontal,
1779
+ spacing: 8
1780
+ };
1781
+ case w.Grid:
1782
+ return {
1783
+ rows: [],
1784
+ columns: [{
1785
+ width: pt,
1786
+ minimumWidth: 0,
1787
+ maximumWidth: Number.POSITIVE_INFINITY
1788
+ }, {
1789
+ width: pt,
1790
+ minimumWidth: 0,
1791
+ maximumWidth: Number.POSITIVE_INFINITY
1792
+ }]
1793
+ };
1794
+ case w.Wrap:
1795
+ return { orientation: ne.Horizontal };
1796
+ case w.Canvas:
1797
+ return { extent: t };
1798
+ case w.Container:
1799
+ return {};
1800
+ }
1801
+ }
1802
+ var H = /* @__PURE__ */ (function(e) {
1803
+ return e.NotJson = "notJson", e.WrongShape = "wrongShape", e.MissingScreen = "missingScreen", e.MissingTemplate = "missingTemplate", e;
1804
+ })({}), po = [
1805
+ "layouts",
1806
+ "screenTemplates",
1807
+ "dialogTemplates",
1808
+ "screens",
1809
+ "exposures",
1810
+ "instanceContributions"
1811
+ ];
1812
+ function mo(e, t) {
1813
+ let n = e;
1814
+ if (typeof e == "string") try {
1815
+ n = JSON.parse(e);
1816
+ } catch {
1817
+ return {
1818
+ readable: !1,
1819
+ problem: H.NotJson
1820
+ };
1821
+ }
1822
+ const r = n;
1823
+ if (!r || typeof r != "object" || po.some((o) => !Array.isArray(r[o]))) return {
1824
+ readable: !1,
1825
+ problem: H.WrongShape
1826
+ };
1827
+ const i = r;
1828
+ return t !== void 0 ? i.screenTemplates.some((o) => o.name === t) ? {
1829
+ readable: !0,
1830
+ document: i
1831
+ } : {
1832
+ readable: !1,
1833
+ problem: H.MissingTemplate
1834
+ } : i.screens.some((o) => o.name === "Screen") ? {
1835
+ readable: !0,
1836
+ document: i
1837
+ } : {
1838
+ readable: !1,
1839
+ problem: H.MissingScreen
1840
+ };
1841
+ }
1842
+ function Qt(e) {
1843
+ const t = e.documentText ?? e.document;
1844
+ if (t !== void 0) {
1845
+ const n = mo(t, e.authoringTemplate);
1846
+ return n.readable ? {
1847
+ opened: !0,
1848
+ subject: { document: n.document }
1849
+ } : {
1850
+ opened: !1,
1851
+ problem: n.problem
1852
+ };
1853
+ }
1854
+ return {
1855
+ opened: !0,
1856
+ subject: { document: fo(e) }
1857
+ };
1858
+ }
1859
+ function fo(e) {
1860
+ const t = e.windowSize ? {
1861
+ width: e.windowSize.width,
1862
+ height: e.windowSize.height
1863
+ } : {};
1864
+ return e.authoringTemplate !== void 0 ? gr(e.authoringTemplate, be(w.Canvas, mr, "Template", [], t)) : hr(be(w.Canvas, fr, "Screen", [], t), e.screenTemplate);
1865
+ }
1866
+ var Ht = ({ placement: e, children: t }) => /* @__PURE__ */ s("div", {
1867
+ className: "studio-screen-editor-palette-host",
1868
+ "data-placement": e,
1869
+ "data-cratis-part": "screen-editor-palette",
1870
+ children: /* @__PURE__ */ s(ln, { children: t })
1871
+ }), Yt = ({ strings: e, onClose: t, children: n }) => /* @__PURE__ */ s(xn, {
1872
+ fallback: /* @__PURE__ */ b("div", {
1873
+ className: "studio-screen-editor-unreadable",
1874
+ role: "alertdialog",
1875
+ "aria-label": e.stopped.title,
1876
+ children: [
1877
+ /* @__PURE__ */ s("strong", { children: e.stopped.title }),
1878
+ /* @__PURE__ */ s("p", { children: e.stopped.message }),
1879
+ t && /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("button", {
1880
+ type: "button",
1881
+ onClick: t,
1882
+ children: e.stopped.close
1883
+ }) })
1884
+ ]
1885
+ }),
1886
+ children: n
1887
+ }), Zt = ({ problem: e, strings: t, onClose: n }) => /* @__PURE__ */ b("div", {
1888
+ className: "studio-screen-editor-unreadable",
1889
+ role: "alertdialog",
1890
+ "aria-label": t.unreadable.title,
1891
+ children: [
1892
+ /* @__PURE__ */ s("strong", { children: t.unreadable.title }),
1893
+ /* @__PURE__ */ s("p", { children: t.unreadable.reasons[e] }),
1894
+ /* @__PURE__ */ s("p", { children: t.unreadable.warning }),
1895
+ n && /* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("button", {
1896
+ type: "button",
1897
+ onClick: n,
1898
+ children: t.unreadable.close
1899
+ }) })
1900
+ ]
1901
+ }), Xt = ({ environment: e, children: t }) => {
1902
+ const n = /* @__PURE__ */ s(Vn, {
1903
+ handler: e.fileUpload?.handler,
1904
+ allowedOrigins: e.fileUpload?.allowedOrigins,
1905
+ children: t
1906
+ });
1907
+ return e.richText ? /* @__PURE__ */ s(jn, {
1908
+ loader: e.richText,
1909
+ children: n
1910
+ }) : n;
1911
+ }, ho = ({ controls: e }) => /* @__PURE__ */ s("div", {
1912
+ className: "studio-window-title-bar",
1913
+ role: "toolbar",
1914
+ children: /* @__PURE__ */ s("div", {
1915
+ className: "studio-window-title-bar__controls",
1916
+ children: e
1917
+ })
1918
+ }), oe = /* @__PURE__ */ (function(e) {
1919
+ return e.Desktop = "desktop", e.Mobile = "mobile", e;
1920
+ })({}), et = {
1921
+ [oe.Desktop]: {
1922
+ width: 1280,
1923
+ height: 800
1924
+ },
1925
+ [oe.Mobile]: {
1926
+ width: 390,
1927
+ height: 844
1928
+ }
1929
+ };
1930
+ function en(e, t) {
1931
+ return {
1932
+ width: Math.min(e.width, t.width),
1933
+ height: Math.min(e.height + 40, t.height)
1934
+ };
1935
+ }
1936
+ function tn(e) {
1937
+ return {
1938
+ width: e.width,
1939
+ height: Math.max(0, e.height - 40)
1940
+ };
1941
+ }
1942
+ function go(e, t) {
1943
+ return Object.values(oe).find((n) => {
1944
+ const r = en(et[n], t);
1945
+ return r.width === e.width && r.height === e.height;
1946
+ });
1947
+ }
1948
+ function vo(e) {
1949
+ const t = tn(e);
1950
+ return wn(t.width, t.height);
1951
+ }
1952
+ var yo = ({ windowSize: e, available: t, strings: n, onResize: r }) => {
1953
+ const i = go(e, t), o = tn(e), a = vo(e), l = (d, u, c) => /* @__PURE__ */ s(se, {
1954
+ icon: u,
1955
+ "aria-label": c,
1956
+ "aria-pressed": i === d,
1957
+ title: c,
1958
+ variant: "ghost",
1959
+ size: "small",
1960
+ onClick: () => r(en(et[d], t))
1961
+ });
1962
+ return /* @__PURE__ */ b("div", {
1963
+ className: "studio-editor-viewport-controls",
1964
+ role: "group",
1965
+ "aria-label": n.sizeClass(a.width, a.height),
1966
+ children: [
1967
+ l(oe.Desktop, /* @__PURE__ */ s(Jn, { "aria-hidden": "true" }), n.desktopPreview),
1968
+ l(oe.Mobile, /* @__PURE__ */ s(Qn, { "aria-hidden": "true" }), n.mobilePreview),
1969
+ /* @__PURE__ */ b("span", {
1970
+ className: "studio-editor-viewport-controls__size",
1971
+ role: "status",
1972
+ children: [
1973
+ n.viewportSize(o.width, o.height),
1974
+ " · ",
1975
+ n.sizeClass(a.width, a.height)
1976
+ ]
1977
+ })
1978
+ ]
1979
+ });
1980
+ }, we = /* @__PURE__ */ (function(e) {
1981
+ return e.Container = "container", e.Between = "between", e;
1982
+ })({}), re = /* @__PURE__ */ (function(e) {
1983
+ return e.Horizontal = "horizontal", e.Vertical = "vertical", e.None = "none", e;
1984
+ })({}), te = 3;
1985
+ function bo(e, t, n) {
1986
+ const r = e.containerId === null ? t : n(e.containerId);
1987
+ if (!r) return;
1988
+ if (e.kind === we.Container) return r;
1989
+ const i = e.afterId ? n(e.afterId) : void 0, o = e.beforeId ? n(e.beforeId) : void 0;
1990
+ if (e.axis === re.Horizontal) {
1991
+ const a = i ? i.top + i.height : o ? o.top - te : r.top;
1992
+ return {
1993
+ left: r.left,
1994
+ top: a - te / 2,
1995
+ width: r.width,
1996
+ height: te
1997
+ };
1998
+ }
1999
+ if (e.axis === re.Vertical) return {
2000
+ left: (i ? i.left + i.width : o ? o.left - te : r.left) - te / 2,
2001
+ top: r.top,
2002
+ width: te,
2003
+ height: r.height
2004
+ };
2005
+ }
2006
+ function mt(e, t, n, r = 6) {
2007
+ return e.filter(({ rect: i }) => t >= i.left - r && t <= i.left + i.width + r && n >= i.top - r && n <= i.top + i.height + r).sort((i, o) => i.rect.width * i.rect.height - o.rect.width * o.rect.height)[0];
2008
+ }
2009
+ var nn = (e, t) => e === t || !!e && !!t && e.left === t.left && e.top === t.top && e.width === t.width && e.height === t.height, wo = (e, t) => e.length === t.length && e.every((n, r) => n.region.id === t[r].region.id && nn(n.rect, t[r].rect)), Co = nn, ko = () => {
2010
+ }, Io = (e, t) => ({
2011
+ left: t.left - e.left,
2012
+ top: t.top - e.top,
2013
+ width: t.width,
2014
+ height: t.height
2015
+ }), So = ({ controller: e, environment: t, resolveBinding: n = ko, configuration: r }) => {
2016
+ const i = _e(null), [o, a] = D([]), [l, d] = D(), [u, c] = D(), { composition: m, dropRegions: I, selectedId: g } = e, P = U(() => {
2017
+ const v = i.current;
2018
+ if (!v) return;
2019
+ const f = v.getBoundingClientRect(), x = (T) => {
2020
+ const A = v.querySelector(`[data-scene-id="${CSS.escape(T)}"]`);
2021
+ return A ? Io(f, A.getBoundingClientRect()) : void 0;
2022
+ }, p = {
2023
+ left: 0,
2024
+ top: 0,
2025
+ width: f.width,
2026
+ height: f.height
2027
+ }, y = I.flatMap((T) => {
2028
+ const A = bo(T, p, x);
2029
+ return A ? [{
2030
+ region: T,
2031
+ rect: A
2032
+ }] : [];
2033
+ });
2034
+ a((T) => wo(T, y) ? T : y);
2035
+ const k = g ? x(g) : void 0;
2036
+ d((T) => Co(T, k) ? T : k);
2037
+ }, [I, g]);
2038
+ nt(() => {
2039
+ P();
2040
+ }), nt(() => {
2041
+ const v = i.current;
2042
+ if (!v || typeof ResizeObserver > "u") return;
2043
+ const f = new ResizeObserver(P);
2044
+ return f.observe(v), () => f.disconnect();
2045
+ }, [P]);
2046
+ const O = (v) => {
2047
+ const f = v.target.closest("[data-scene-id]");
2048
+ e.select(f?.dataset.sceneId);
2049
+ }, h = (v) => {
2050
+ const f = i.current.getBoundingClientRect();
2051
+ return {
2052
+ x: v.clientX - f.left,
2053
+ y: v.clientY - f.top
2054
+ };
2055
+ }, S = (v) => {
2056
+ if (!lo(v)) return;
2057
+ v.preventDefault(), v.dataTransfer.dropEffect = "copy";
2058
+ const { x: f, y: x } = h(v);
2059
+ c(mt(o, f, x));
2060
+ }, R = (v) => {
2061
+ const f = co(v), { x, y: p } = h(v), y = mt(o, x, p);
2062
+ if (v.preventDefault(), c(void 0), !f || !y) return;
2063
+ const k = y.region.containerId ?? void 0, T = y.region.kind === we.Container ? void 0 : y.region.index;
2064
+ f.kind === "layout" ? e.insertLayout(f.item, k, T) : e.insertComponent(Ze(f.componentName, f.package), k, T);
2065
+ }, C = F(() => ar(m.element, t.runtime.profile, t.runtime.packages), [
2066
+ m,
2067
+ t.runtime.profile,
2068
+ t.runtime.packages
2069
+ ]), N = F(() => /* @__PURE__ */ s(zn, {
2070
+ registry: t.runtime.iconAdapters,
2071
+ children: /* @__PURE__ */ s(Un, {
2072
+ element: C,
2073
+ registry: t.runtime.registry,
2074
+ resolveBinding: n,
2075
+ configuration: r
2076
+ })
2077
+ }), [
2078
+ C,
2079
+ t.runtime.registry,
2080
+ t.runtime.iconAdapters,
2081
+ n,
2082
+ r
2083
+ ]);
2084
+ return /* @__PURE__ */ b("div", {
2085
+ ref: i,
2086
+ className: "studio-screen-surface",
2087
+ onClick: O,
2088
+ onDragOver: S,
2089
+ onDragLeave: () => c(void 0),
2090
+ onDrop: R,
2091
+ children: [N, /* @__PURE__ */ b("div", {
2092
+ className: "studio-screen-surface__chrome",
2093
+ "aria-hidden": "true",
2094
+ children: [l && /* @__PURE__ */ s("div", {
2095
+ className: "studio-screen-surface__selection",
2096
+ style: l
2097
+ }), u && /* @__PURE__ */ s("div", {
2098
+ className: `studio-screen-surface__target studio-screen-surface__target--${u.region.kind}`,
2099
+ "data-empty": u.region.isEmptyContainer,
2100
+ style: u.rect
2101
+ })]
2102
+ })]
2103
+ });
2104
+ }, rn = ({ controller: e, environment: t, strings: n, window: r, deviceFrame: i = !1, saveFailure: o }) => {
2105
+ const a = !!e.selectedId && e.ownershipOf(e.selectedId) === M.Local, l = /* @__PURE__ */ b(ae, { children: [
2106
+ /* @__PURE__ */ s(yo, {
2107
+ windowSize: r.size,
2108
+ available: r.available,
2109
+ strings: n,
2110
+ onResize: r.setSize
2111
+ }),
2112
+ /* @__PURE__ */ s(se, {
2113
+ icon: /* @__PURE__ */ s(tr, { "aria-hidden": "true" }),
2114
+ "aria-label": n.undo,
2115
+ title: n.undo,
2116
+ variant: "ghost",
2117
+ size: "small",
2118
+ disabled: !e.canUndo,
2119
+ onClick: e.undo
2120
+ }),
2121
+ /* @__PURE__ */ s(se, {
2122
+ icon: /* @__PURE__ */ s(Hn, { "aria-hidden": "true" }),
2123
+ "aria-label": n.redo,
2124
+ title: n.redo,
2125
+ variant: "ghost",
2126
+ size: "small",
2127
+ disabled: !e.canRedo,
2128
+ onClick: e.redo
2129
+ }),
2130
+ /* @__PURE__ */ s(se, {
2131
+ icon: /* @__PURE__ */ s(er, { "aria-hidden": "true" }),
2132
+ "aria-label": n.deleteElement,
2133
+ title: n.deleteElement,
2134
+ variant: "ghost",
2135
+ size: "small",
2136
+ disabled: !a,
2137
+ onClick: () => e.selectedId && e.remove(e.selectedId)
2138
+ }),
2139
+ /* @__PURE__ */ s(se, {
2140
+ icon: /* @__PURE__ */ s(Zn, { "aria-hidden": "true" }),
2141
+ "aria-label": r.isInspectorOpen ? n.closeInspector : n.openInspector,
2142
+ "aria-pressed": r.isInspectorOpen,
2143
+ title: r.isInspectorOpen ? n.closeInspector : n.openInspector,
2144
+ variant: "ghost",
2145
+ size: "small",
2146
+ onClick: r.toggleInspector
2147
+ })
2148
+ ] });
2149
+ return /* @__PURE__ */ b("div", {
2150
+ className: "studio-screen-editor-window",
2151
+ role: "group",
2152
+ "aria-label": n.windowLabel,
2153
+ children: [
2154
+ /* @__PURE__ */ s(ho, { controls: l }),
2155
+ o && /* @__PURE__ */ b("p", {
2156
+ className: "studio-screen-editor-window__notice",
2157
+ role: "alert",
2158
+ children: [
2159
+ /* @__PURE__ */ s("strong", { children: n.saveRefused }),
2160
+ " ",
2161
+ o
2162
+ ]
2163
+ }),
2164
+ /* @__PURE__ */ s("div", {
2165
+ className: "studio-screen-editor-window__canvas",
2166
+ children: /* @__PURE__ */ s("div", {
2167
+ className: i ? "studio-screen-editor-window__device" : void 0,
2168
+ style: i ? {
2169
+ width: r.size.width,
2170
+ minHeight: r.size.height - 40
2171
+ } : void 0,
2172
+ children: /* @__PURE__ */ s(So, {
2173
+ controller: e,
2174
+ environment: t,
2175
+ resolveBinding: () => {
2176
+ }
2177
+ })
2178
+ })
2179
+ })
2180
+ ]
2181
+ });
2182
+ };
2183
+ function Po(e, t, n, r = {}, i = {}) {
2184
+ return {
2185
+ ...Kt(e, t),
2186
+ componentName: n,
2187
+ properties: r,
2188
+ slots: i
2189
+ };
2190
+ }
2191
+ function To(e) {
2192
+ switch (e) {
2193
+ case L.Row:
2194
+ case L.Wrap:
2195
+ case L.Grid:
2196
+ return re.Vertical;
2197
+ case L.Column:
2198
+ case L.Grouping:
2199
+ case void 0:
2200
+ return re.Horizontal;
2201
+ case L.Freeform:
2202
+ return re.None;
2203
+ }
2204
+ }
2205
+ function ft(e, t, n, r) {
2206
+ const i = e ?? "screen", o = To(n), a = {
2207
+ id: `${i}:container`,
2208
+ kind: we.Container,
2209
+ containerId: e,
2210
+ index: t.length,
2211
+ axis: o,
2212
+ isEmptyContainer: t.length === 0
2213
+ };
2214
+ return o === re.None || t.length === 0 ? [a] : [a, ...Array.from({ length: t.length + 1 }, (l, d) => ({
2215
+ id: `${i}:between:${d}`,
2216
+ kind: we.Between,
2217
+ containerId: e,
2218
+ index: d,
2219
+ axis: o,
2220
+ isEmptyContainer: !1,
2221
+ ...d > 0 ? { afterId: r.idOf(t[d - 1]) } : {},
2222
+ ...d < t.length ? { beforeId: r.idOf(t[d]) } : {}
2223
+ }))];
2224
+ }
2225
+ function Ro(e, t, n) {
2226
+ const r = (i) => i.flatMap((o) => {
2227
+ if (!n.acceptsChildren(o)) return [];
2228
+ const a = n.childrenOf(o);
2229
+ return [...ve(n.ownershipOf(o), Z.Insert) ? ft(n.idOf(o), a, n.arrangementOf(o), n) : [], ...r(a)];
2230
+ });
2231
+ return [...ft(null, e, t, n), ...r(e)];
2232
+ }
2233
+ var No = class {
2234
+ latest;
2235
+ publish;
2236
+ constructor(e, t) {
2237
+ this.latest = e, this.publish = t;
2238
+ }
2239
+ get current() {
2240
+ return this.latest;
2241
+ }
2242
+ commit(e) {
2243
+ return this.latest = e(this.latest), this.publish(this.latest), this.latest;
2244
+ }
2245
+ };
2246
+ function Oo(e) {
2247
+ return {
2248
+ document: e,
2249
+ undoable: [],
2250
+ redoable: [],
2251
+ diagnostics: [],
2252
+ isDirty: !1,
2253
+ savedDocument: e
2254
+ };
2255
+ }
2256
+ function xo(e, t, n, r) {
2257
+ const i = Ct(e.document, t, n);
2258
+ return i.applied ? {
2259
+ ...e,
2260
+ document: i.model,
2261
+ undoable: [...e.undoable, {
2262
+ before: e.document,
2263
+ label: r
2264
+ }].slice(-100),
2265
+ redoable: [],
2266
+ diagnostics: i.diagnostics,
2267
+ isDirty: i.model !== e.savedDocument
2268
+ } : {
2269
+ ...e,
2270
+ diagnostics: i.diagnostics
2271
+ };
2272
+ }
2273
+ function Lo(e, t, n, r) {
2274
+ let i = e.document;
2275
+ const o = [];
2276
+ for (const a of t) {
2277
+ const l = Ct(i, a, n);
2278
+ if (o.push(...l.diagnostics), !l.applied) return {
2279
+ ...e,
2280
+ diagnostics: o
2281
+ };
2282
+ i = l.model;
2283
+ }
2284
+ return {
2285
+ ...e,
2286
+ document: i,
2287
+ undoable: [...e.undoable, {
2288
+ before: e.document,
2289
+ label: r
2290
+ }].slice(-100),
2291
+ redoable: [],
2292
+ diagnostics: o,
2293
+ isDirty: i !== e.savedDocument
2294
+ };
2295
+ }
2296
+ var Do = (e) => e.undoable.length > 0, Eo = (e) => e.redoable.length > 0;
2297
+ function Ao(e) {
2298
+ const t = e.undoable[e.undoable.length - 1];
2299
+ return t ? {
2300
+ ...e,
2301
+ document: t.before,
2302
+ undoable: e.undoable.slice(0, -1),
2303
+ redoable: [...e.redoable, {
2304
+ before: e.document,
2305
+ label: t.label
2306
+ }],
2307
+ diagnostics: [],
2308
+ isDirty: t.before !== e.savedDocument
2309
+ } : e;
2310
+ }
2311
+ function Mo(e) {
2312
+ const t = e.redoable[e.redoable.length - 1];
2313
+ return t ? {
2314
+ ...e,
2315
+ document: t.before,
2316
+ undoable: [...e.undoable, {
2317
+ before: e.document,
2318
+ label: t.label
2319
+ }],
2320
+ redoable: e.redoable.slice(0, -1),
2321
+ diagnostics: [],
2322
+ isDirty: t.before !== e.savedDocument
2323
+ } : e;
2324
+ }
2325
+ var Ae = (e) => e.id, _o = (e) => e.name || Ae(e), Fo = (e) => {
2326
+ switch (e) {
2327
+ case w.Stack:
2328
+ return L.Column;
2329
+ case w.Row:
2330
+ return L.Row;
2331
+ case w.Grid:
2332
+ return L.Grid;
2333
+ case w.Wrap:
2334
+ return L.Wrap;
2335
+ case w.Canvas:
2336
+ return L.Freeform;
2337
+ case w.Container:
2338
+ return L.Grouping;
2339
+ case void 0:
2340
+ return;
2341
+ }
2342
+ };
2343
+ function zo(e) {
2344
+ return {
2345
+ idOf: Ae,
2346
+ nameOf: _o,
2347
+ childrenOf: ke,
2348
+ withChildren: (t, n) => ce(t) ? {
2349
+ ...t,
2350
+ children: n
2351
+ } : fe(t) ? {
2352
+ ...t,
2353
+ slots: { children: n }
2354
+ } : t,
2355
+ acceptsChildren: (t) => ce(t),
2356
+ ownershipOf: (t) => e(Ae(t)) ?? M.Local,
2357
+ arrangementOf: (t) => ce(t) ? Fo(Ot(t)) : void 0
2358
+ };
2359
+ }
2360
+ function Uo(e) {
2361
+ if (e.targetParentId !== null)
2362
+ return {
2363
+ kind: z.MoveNode,
2364
+ nodeId: W(e.nodeId),
2365
+ target: W(e.targetParentId),
2366
+ index: e.index
2367
+ };
2368
+ }
2369
+ function qo(e, t, n) {
2370
+ return {
2371
+ kind: z.InsertNode,
2372
+ target: W(e),
2373
+ index: t,
2374
+ element: n
2375
+ };
2376
+ }
2377
+ function $o(e) {
2378
+ return {
2379
+ kind: z.RemoveNode,
2380
+ nodeId: W(e)
2381
+ };
2382
+ }
2383
+ function Bo(e) {
2384
+ return e ? $e(e) ? L.Freeform : Be(e) ? L.Grid : Ve(e) ? e.orientation === ne.Horizontal ? L.Row : L.Column : L.Column : L.Column;
2385
+ }
2386
+ var _ = /* @__PURE__ */ (function(e) {
2387
+ return e.NodeNotFound = "nodeNotFound", e.TargetNotFound = "targetNotFound", e.TargetNotContainer = "targetNotContainer", e.WouldCreateCycle = "wouldCreateCycle", e.NodeLocked = "nodeLocked", e.TargetLocked = "targetLocked", e.NoChange = "noChange", e;
2388
+ })({}), Vo = (e, t) => Math.max(0, Math.min(e, t));
2389
+ function jo(e, t, n) {
2390
+ const r = ie(e, t.nodeId, n);
2391
+ if (!r) return _.NodeNotFound;
2392
+ if (!ve(n.ownershipOf(r.node), Z.Move)) return _.NodeLocked;
2393
+ let i = e;
2394
+ if (t.targetParentId !== null) {
2395
+ const o = ie(e, t.targetParentId, n);
2396
+ if (!o) return _.TargetNotFound;
2397
+ if (Dt(r.node, t.targetParentId, n)) return _.WouldCreateCycle;
2398
+ if (!n.acceptsChildren(o.node)) return _.TargetNotContainer;
2399
+ if (!ve(n.ownershipOf(o.node), Z.Insert)) return _.TargetLocked;
2400
+ i = n.childrenOf(o.node);
2401
+ }
2402
+ if ((r.parent === null ? null : n.idOf(r.parent)) === t.targetParentId) {
2403
+ const o = i.length - 1;
2404
+ if (Vo(t.index, o) === r.index) return _.NoChange;
2405
+ }
2406
+ }
2407
+ var Wo = "composition";
2408
+ function Go(e, t) {
2409
+ const n = e.screens.find((a) => a.name === Ce), r = t !== void 0 ? Ne(t, !0) : Ne(void 0), i = Nn(e, r).levels.filter((a) => a.kind === hn.ScreenTemplate).map((a) => a.owner), o = [];
2410
+ for (const a of i) {
2411
+ const l = e.screenTemplates.find((d) => d.name === a);
2412
+ if (l)
2413
+ for (const d of l.slots) o.push(...l.content?.[d.name] ?? []);
2414
+ }
2415
+ return (t === void 0 || r.kind === Re.Screen) && o.push(...n?.slotContent.content ?? []), {
2416
+ element: be(w.Stack, Wo, "Composition", o),
2417
+ roots: o,
2418
+ templates: i
2419
+ };
2420
+ }
2421
+ function Jo(e) {
2422
+ switch (e) {
2423
+ case rt.Inherited:
2424
+ return M.Inherited;
2425
+ case rt.ConfigurableInherited:
2426
+ return M.ConfigurableInherited;
2427
+ default:
2428
+ return M.Local;
2429
+ }
2430
+ }
2431
+ function Ko(e, t, n) {
2432
+ const r = /* @__PURE__ */ new Map();
2433
+ for (const i of Nt(t)) {
2434
+ const o = kt(e, W(i), n);
2435
+ r.set(i, o ? Jo(o.provenance.kind) : M.Inherited);
2436
+ }
2437
+ return (i) => r.get(i) ?? M.Local;
2438
+ }
2439
+ var ht = () => globalThis.crypto.randomUUID();
2440
+ function Qo(e) {
2441
+ const [t, n] = D({
2442
+ catalog: e,
2443
+ times: 0
2444
+ });
2445
+ return Me(() => {
2446
+ let r = !0;
2447
+ const i = () => {
2448
+ r && n((o) => ({
2449
+ catalog: e,
2450
+ times: o.times + 1
2451
+ }));
2452
+ };
2453
+ return e.load().then(i, i), () => {
2454
+ r = !1;
2455
+ };
2456
+ }, [e]), t.catalog === e ? t.times : 0;
2457
+ }
2458
+ function on(e, t, n) {
2459
+ const [r, i] = D(() => Oo(e.document)), o = _e(void 0);
2460
+ o.current ??= new No(r, i);
2461
+ const a = U((p) => o.current.commit(p), []), [l, d] = D(), u = Qo(n.runtime.icons), c = F(() => ({
2462
+ catalog: n.runtime.catalog,
2463
+ scope: Ne(t, t !== void 0),
2464
+ queryCandidates: [...n.queryCandidates],
2465
+ iconCatalog: n.runtime.icons
2466
+ }), [
2467
+ n,
2468
+ t,
2469
+ u
2470
+ ]), m = F(() => Go(r.document, t), [r.document, t]), I = F(() => Ko(r.document, m.roots, c), [
2471
+ r.document,
2472
+ m,
2473
+ c
2474
+ ]), g = F(() => zo(I), [I]), P = ge(r.document, t), O = F(() => Ro(m.roots, Bo(P), g).filter((p) => p.containerId !== null), [
2475
+ m,
2476
+ P,
2477
+ g
2478
+ ]), h = l ? Le(m.roots, l) : void 0, S = F(() => l ? kt(r.document, W(l), c) : void 0, [
2479
+ r.document,
2480
+ l,
2481
+ c
2482
+ ]), R = U((p, y) => {
2483
+ const k = o.current.current, T = a((A) => xo(A, p, c, y));
2484
+ return {
2485
+ applied: T.undoable.length > k.undoable.length || T.document !== k.document,
2486
+ diagnostics: T.diagnostics
2487
+ };
2488
+ }, [a, c]), C = U((p, y) => {
2489
+ R(p, y);
2490
+ }, [R]), N = U((p, y) => {
2491
+ const k = o.current.current, T = a((A) => Lo(A, p, c, y));
2492
+ return {
2493
+ applied: T.document !== k.document,
2494
+ diagnostics: T.diagnostics
2495
+ };
2496
+ }, [a, c]), v = U((p, y) => {
2497
+ const k = p ?? P?.id, T = k ? Le(m.roots, k)?.children ?? [] : [];
2498
+ return {
2499
+ parent: k,
2500
+ index: y ?? T.length
2501
+ };
2502
+ }, [P, m]), f = U((p, y, k, T) => {
2503
+ const A = v(y, k);
2504
+ A.parent && R(qo(A.parent, A.index, p), T).applied && d(p.id);
2505
+ }, [R, v]), x = U((p) => {
2506
+ const y = jo(m.roots, p, g);
2507
+ if (y) return y;
2508
+ const k = Uo(p);
2509
+ return k ? R(k, "Move").applied ? void 0 : _.NodeLocked : _.TargetNotContainer;
2510
+ }, [
2511
+ m,
2512
+ g,
2513
+ R
2514
+ ]);
2515
+ return {
2516
+ document: r.document,
2517
+ composition: m,
2518
+ context: c,
2519
+ selectedId: l,
2520
+ selection: h,
2521
+ inspection: S,
2522
+ diagnostics: r.diagnostics,
2523
+ adapter: g,
2524
+ ownershipOf: I,
2525
+ dropRegions: O,
2526
+ select: d,
2527
+ apply: C,
2528
+ tryApply: R,
2529
+ applyAll: N,
2530
+ move: x,
2531
+ insertComponent: (p, y, k) => f(Po(ht(), p, p), y, k, "Add"),
2532
+ insertLayout: (p, y, k) => f(be(p, ht(), p), y, k, "Add layout"),
2533
+ remove: (p) => {
2534
+ R($o(p), "Remove").applied && d(void 0);
2535
+ },
2536
+ setProperty: (p, y) => l && C(_t(l, p, y), "Change"),
2537
+ undo: () => {
2538
+ a(Ao);
2539
+ },
2540
+ redo: () => {
2541
+ a(Mo);
2542
+ },
2543
+ canUndo: Do(r),
2544
+ canRedo: Eo(r),
2545
+ isDirty: r.isDirty
2546
+ };
2547
+ }
2548
+ var Ho = () => ({
2549
+ width: window.innerWidth - 64,
2550
+ height: window.innerHeight - 64
2551
+ }), Xa = (e) => /* @__PURE__ */ s(Yt, {
2552
+ strings: e.strings,
2553
+ onClose: () => e.onDismiss?.(),
2554
+ children: /* @__PURE__ */ s(Yo, { ...e })
2555
+ }), Yo = (e) => {
2556
+ const t = F(() => Qt(e.subject), [e.subject]);
2557
+ return t.opened ? /* @__PURE__ */ s(Zo, {
2558
+ ...e,
2559
+ opened: t.subject
2560
+ }, e.environment.runtime.id) : /* @__PURE__ */ s(wt, {
2561
+ sourceRect: e.sourceRect,
2562
+ initialSize: e.initialSize,
2563
+ centerOffsetX: e.centerOffsetX,
2564
+ onClosed: () => e.onDismiss?.(),
2565
+ children: (n) => /* @__PURE__ */ s(Zt, {
2566
+ problem: t.problem,
2567
+ strings: e.strings,
2568
+ onClose: () => n.close()
2569
+ })
2570
+ });
2571
+ }, Zo = ({ subject: e, environment: t, strings: n, layoutLabels: r, icons: i, paletteSources: o, sourceRect: a, initialSize: l, centerOffsetX: d, renderPaletteHost: u, onClose: c, onBeforeClose: m, opened: I }) => {
2572
+ const g = on(I, e.authoringTemplate, t), P = F(() => Gt(n.layoutDrawer, r, i, o), [
2573
+ n,
2574
+ r,
2575
+ i,
2576
+ o
2577
+ ]), O = U((v) => {
2578
+ const f = ge(g.document, e.authoringTemplate);
2579
+ c({
2580
+ document: g.document,
2581
+ legacyElements: De(f, t.runtime.legacyTypeOf),
2582
+ windowSize: v,
2583
+ layout: Ee(f),
2584
+ changed: g.isDirty
2585
+ });
2586
+ }, [
2587
+ g,
2588
+ t.runtime.legacyTypeOf,
2589
+ c,
2590
+ e.authoringTemplate
2591
+ ]), [h, S] = D(), R = U(async (v) => {
2592
+ const f = ge(g.document, e.authoringTemplate), x = {
2593
+ document: g.document,
2594
+ legacyElements: De(f, t.runtime.legacyTypeOf),
2595
+ windowSize: v,
2596
+ layout: Ee(f),
2597
+ changed: g.isDirty
2598
+ }, p = await m?.(x);
2599
+ return S(p), !p;
2600
+ }, [
2601
+ g,
2602
+ t.runtime.legacyTypeOf,
2603
+ m,
2604
+ e.authoringTemplate
2605
+ ]), C = /* @__PURE__ */ s(ae, { children: P.map((v) => /* @__PURE__ */ s(bt, {
2606
+ icon: v.id === "layout" ? i.drawer.layout : i.drawer.package,
2607
+ title: v.title,
2608
+ heading: v.title,
2609
+ closeLabel: n.closeDrawer,
2610
+ presentation: "drawer",
2611
+ items: v.items,
2612
+ draggable: !0,
2613
+ onActivate: (f) => N(f.payload),
2614
+ onItemDragStart: (f, x) => de(f.payload) && Jt(x, f.payload)
2615
+ }, v.id)) });
2616
+ function N(v) {
2617
+ if (!de(v)) return;
2618
+ const f = g.selection && Xo(g) ? g.selectedId : void 0;
2619
+ v.kind === "layout" ? g.insertLayout(v.item, f, void 0) : g.insertComponent(Ze(v.componentName, v.package), f, void 0);
2620
+ }
2621
+ return /* @__PURE__ */ b(Xt, {
2622
+ environment: t,
2623
+ children: [u ? u(C) : /* @__PURE__ */ s(Ht, {
2624
+ placement: "floating",
2625
+ children: C
2626
+ }), /* @__PURE__ */ s(wt, {
2627
+ sourceRect: a,
2628
+ initialSize: l,
2629
+ centerOffsetX: d,
2630
+ canClose: R,
2631
+ onClosed: O,
2632
+ renderInspector: (v) => /* @__PURE__ */ s(Wt, {
2633
+ strings: n,
2634
+ controller: g,
2635
+ environment: t,
2636
+ authoringTemplate: e.authoringTemplate,
2637
+ onClose: v.toggleInspector,
2638
+ structure: /* @__PURE__ */ s(At, {
2639
+ roots: g.composition.roots,
2640
+ adapter: g.adapter,
2641
+ strings: n,
2642
+ selectedId: g.selectedId,
2643
+ onSelect: g.select,
2644
+ onEdit: g.move
2645
+ })
2646
+ }),
2647
+ children: (v) => /* @__PURE__ */ s(rn, {
2648
+ controller: g,
2649
+ environment: t,
2650
+ strings: n,
2651
+ window: {
2652
+ ...v,
2653
+ available: Ho()
2654
+ },
2655
+ saveFailure: h
2656
+ })
2657
+ })]
2658
+ });
2659
+ };
2660
+ function Xo(e) {
2661
+ return !!e.selection && "children" in e.selection;
2662
+ }
2663
+ var es = (e) => /* @__PURE__ */ s(sr, { ...e }), ts = (e) => /* @__PURE__ */ s(Yt, {
2664
+ strings: e.strings,
2665
+ onClose: e.onDismiss,
2666
+ children: /* @__PURE__ */ s(ea, { ...e })
2667
+ }), ea = (e) => {
2668
+ const t = F(() => Qt(e.subject), [e.subject]);
2669
+ return t.opened ? /* @__PURE__ */ s(ta, {
2670
+ ...e,
2671
+ opened: t.subject
2672
+ }, e.environment.runtime.id) : /* @__PURE__ */ s(Zt, {
2673
+ problem: t.problem,
2674
+ strings: e.strings
2675
+ });
2676
+ }, ta = ({ subject: e, environment: t, strings: n, layoutLabels: r, icons: i, paletteSources: o, initialSize: a, onChange: l, renderPaletteHost: d, opened: u }) => {
2677
+ const c = on(u, e.authoringTemplate, t), [m, I] = D(a ?? et[oe.Desktop]), [g, P] = D(!0), O = F(() => Gt(n.layoutDrawer, r, i, o), [
2678
+ n,
2679
+ r,
2680
+ i,
2681
+ o
2682
+ ]), h = _e(l);
2683
+ h.current = l, Me(() => {
2684
+ const C = ge(c.document, e.authoringTemplate);
2685
+ h.current?.({
2686
+ document: c.document,
2687
+ legacyElements: De(C, t.runtime.legacyTypeOf),
2688
+ windowSize: m,
2689
+ layout: Ee(C),
2690
+ changed: c.isDirty
2691
+ });
2692
+ }, [
2693
+ c.document,
2694
+ c.isDirty,
2695
+ m,
2696
+ e.authoringTemplate,
2697
+ t.runtime.legacyTypeOf
2698
+ ]);
2699
+ const S = U((C) => {
2700
+ if (!de(C)) return;
2701
+ const N = c.selection, v = N && "children" in N ? c.selectedId : void 0;
2702
+ C.kind === "layout" ? c.insertLayout(C.item, v, void 0) : c.insertComponent(Ze(C.componentName, C.package), v, void 0);
2703
+ }, [c]), R = /* @__PURE__ */ s(ae, { children: O.map((C) => /* @__PURE__ */ s(bt, {
2704
+ icon: C.id === "layout" ? i.drawer.layout : i.drawer.package,
2705
+ title: C.title,
2706
+ heading: C.title,
2707
+ closeLabel: n.closeDrawer,
2708
+ presentation: "drawer",
2709
+ items: C.items,
2710
+ draggable: !0,
2711
+ onActivate: (N) => S(N.payload),
2712
+ onItemDragStart: (N, v) => de(N.payload) && Jt(v, N.payload)
2713
+ }, C.id)) });
2714
+ return /* @__PURE__ */ s(Xt, {
2715
+ environment: t,
2716
+ children: /* @__PURE__ */ b("div", {
2717
+ className: "studio-screen-editor-workspace",
2718
+ children: [
2719
+ d ? d(R) : /* @__PURE__ */ s(Ht, {
2720
+ placement: "inline",
2721
+ children: R
2722
+ }),
2723
+ /* @__PURE__ */ s("div", {
2724
+ className: "studio-screen-editor-workspace__stage",
2725
+ children: /* @__PURE__ */ s(rn, {
2726
+ controller: c,
2727
+ environment: t,
2728
+ strings: n,
2729
+ window: {
2730
+ size: m,
2731
+ setSize: I,
2732
+ isInspectorOpen: g,
2733
+ toggleInspector: () => P((C) => !C),
2734
+ available: {
2735
+ width: 1600,
2736
+ height: 1e3
2737
+ }
2738
+ },
2739
+ deviceFrame: !0
2740
+ })
2741
+ }),
2742
+ g && /* @__PURE__ */ s("aside", {
2743
+ className: "studio-screen-editor-workspace__inspector",
2744
+ children: /* @__PURE__ */ s(Wt, {
2745
+ strings: n,
2746
+ controller: c,
2747
+ environment: t,
2748
+ authoringTemplate: e.authoringTemplate,
2749
+ onClose: () => P(!1),
2750
+ structure: /* @__PURE__ */ s(At, {
2751
+ roots: c.composition.roots,
2752
+ adapter: c.adapter,
2753
+ strings: n,
2754
+ selectedId: c.selectedId,
2755
+ onSelect: c.select,
2756
+ onEdit: c.move
2757
+ })
2758
+ })
2759
+ })
2760
+ ]
2761
+ })
2762
+ });
2763
+ };
2764
+ function na(e) {
2765
+ const t = {
2766
+ "row.id": "Guid",
2767
+ "selection.id": "Guid"
2768
+ };
2769
+ for (const n of e) for (const r of n.parameters) t[`route.${r.name}`] ??= r.type;
2770
+ return t;
2771
+ }
2772
+ var ra = new Set(Object.values(fn)), ia = new Set(Object.values(mn));
2773
+ function oa(e) {
2774
+ return e.filter((t) => ra.has(t.resultShape) && t.origin.every((n) => ia.has(n.kind))).map((t) => t);
2775
+ }
2776
+ function ns(e) {
2777
+ const t = oa(e.queryCandidates ?? []);
2778
+ return {
2779
+ runtime: e.runtime,
2780
+ queryCandidates: t,
2781
+ stateChangeSlices: e.stateChangeSlices ?? [],
2782
+ destinations: e.destinations ?? [],
2783
+ availableSources: na(t),
2784
+ ...e.richText === !1 ? {} : { richText: e.richText ?? cr },
2785
+ ...e.fileUpload ? { fileUpload: e.fileUpload } : {}
2786
+ };
2787
+ }
2788
+ function aa(e) {
2789
+ return e.flatMap((t) => t.iconLibrary ? [t.iconLibrary.catalog] : []);
2790
+ }
2791
+ function sa(e, t) {
2792
+ const n = Tn(e, t.map((r) => r.manifest));
2793
+ return new yn(n, aa(t));
2794
+ }
2795
+ var ca = [
2796
+ "PrimeReact.Accordion",
2797
+ "PrimeReact.AutoComplete",
2798
+ "PrimeReact.Avatar",
2799
+ "PrimeReact.AvatarGroup",
2800
+ "PrimeReact.Badge",
2801
+ "PrimeReact.BlockUI",
2802
+ "PrimeReact.Breadcrumb",
2803
+ "PrimeReact.Button",
2804
+ "PrimeReact.Card",
2805
+ "PrimeReact.Carousel",
2806
+ "PrimeReact.CascadeSelect",
2807
+ "PrimeReact.Chart",
2808
+ "PrimeReact.Checkbox",
2809
+ "PrimeReact.Chip",
2810
+ "PrimeReact.ColorPicker",
2811
+ "PrimeReact.ConfirmDialog",
2812
+ "PrimeReact.ConfirmPopup",
2813
+ "PrimeReact.ContextMenu",
2814
+ "PrimeReact.DataScroller",
2815
+ "PrimeReact.DataTable",
2816
+ "PrimeReact.DataView",
2817
+ "PrimeReact.DatePicker",
2818
+ "PrimeReact.Deferred",
2819
+ "PrimeReact.Dialog",
2820
+ "PrimeReact.Divider",
2821
+ "PrimeReact.Dock",
2822
+ "PrimeReact.Drawer",
2823
+ "PrimeReact.Editor",
2824
+ "PrimeReact.Fieldset",
2825
+ "PrimeReact.FileUpload",
2826
+ "PrimeReact.FloatLabel",
2827
+ "PrimeReact.Galleria",
2828
+ "PrimeReact.IconField",
2829
+ "PrimeReact.Image",
2830
+ "PrimeReact.Inplace",
2831
+ "PrimeReact.InputMask",
2832
+ "PrimeReact.InputNumber",
2833
+ "PrimeReact.InputOtp",
2834
+ "PrimeReact.InputText",
2835
+ "PrimeReact.Knob",
2836
+ "PrimeReact.ListBox",
2837
+ "PrimeReact.MegaMenu",
2838
+ "PrimeReact.Mention",
2839
+ "PrimeReact.Menu",
2840
+ "PrimeReact.Menubar",
2841
+ "PrimeReact.Message",
2842
+ "PrimeReact.Messages",
2843
+ "PrimeReact.MeterGroup",
2844
+ "PrimeReact.MultiSelect",
2845
+ "PrimeReact.MultiStateCheckbox",
2846
+ "PrimeReact.OrderList",
2847
+ "PrimeReact.OrgChart",
2848
+ "PrimeReact.OverlayBadge",
2849
+ "PrimeReact.Paginator",
2850
+ "PrimeReact.Panel",
2851
+ "PrimeReact.PanelMenu",
2852
+ "PrimeReact.Password",
2853
+ "PrimeReact.PickList",
2854
+ "PrimeReact.Popover",
2855
+ "PrimeReact.RadioButton",
2856
+ "PrimeReact.Rating",
2857
+ "PrimeReact.ScrollPanel",
2858
+ "PrimeReact.ScrollTop",
2859
+ "PrimeReact.Select",
2860
+ "PrimeReact.SelectButton",
2861
+ "PrimeReact.Skeleton",
2862
+ "PrimeReact.Slider",
2863
+ "PrimeReact.SpeedDial",
2864
+ "PrimeReact.SplitButton",
2865
+ "PrimeReact.Splitter",
2866
+ "PrimeReact.Stepper",
2867
+ "PrimeReact.Steps",
2868
+ "PrimeReact.TabMenu",
2869
+ "PrimeReact.TabView",
2870
+ "PrimeReact.Tag",
2871
+ "PrimeReact.Terminal",
2872
+ "PrimeReact.Textarea",
2873
+ "PrimeReact.TieredMenu",
2874
+ "PrimeReact.Timeline",
2875
+ "PrimeReact.Toast",
2876
+ "PrimeReact.ToggleSwitch",
2877
+ "PrimeReact.Toolbar",
2878
+ "PrimeReact.Tooltip",
2879
+ "PrimeReact.Tree",
2880
+ "PrimeReact.TreeSelect",
2881
+ "PrimeReact.TreeTable",
2882
+ "PrimeReact.TriStateCheckbox",
2883
+ "PrimeReact.VirtualScroller",
2884
+ "StudioLayout.Canvas",
2885
+ "StudioLayout.Container",
2886
+ "StudioLayout.Grid",
2887
+ "StudioLayout.Row",
2888
+ "StudioLayout.Stack",
2889
+ "StudioLayout.Wrap",
2890
+ "canvas",
2891
+ "contentControl",
2892
+ "dockPanel",
2893
+ "externalComponent",
2894
+ "grid",
2895
+ "itemsControl",
2896
+ "stackPanel",
2897
+ "wrapPanel"
2898
+ ], la = ["PrimeReact.Dialog"], da = new Set(ca.filter((e) => !la.includes(e))), ua = [
2899
+ {
2900
+ value: V.None,
2901
+ label: "Run directly"
2902
+ },
2903
+ {
2904
+ value: V.Modal,
2905
+ label: "Ask in a dialog"
2906
+ },
2907
+ {
2908
+ value: V.Drawer,
2909
+ label: "Ask in a drawer"
2910
+ }
2911
+ ];
2912
+ function pa(e) {
2913
+ return !e.component.endsWith(":action") || e.properties.some((t) => t.path === "presentation") ? e : {
2914
+ ...e,
2915
+ properties: [...e.properties, {
2916
+ path: He,
2917
+ label: "Presentation",
2918
+ group: "Behavior",
2919
+ valueType: E.Enum,
2920
+ default: V.None,
2921
+ choices: ua,
2922
+ description: "Whether the command runs straight away or first asks for its input in a dialog or a drawer."
2923
+ }]
2924
+ };
2925
+ }
2926
+ var gt = "Placement", ma = [{
2927
+ path: Je,
2928
+ label: "Left",
2929
+ group: gt,
2930
+ valueType: E.Number
2931
+ }, {
2932
+ path: Ke,
2933
+ label: "Top",
2934
+ group: gt,
2935
+ valueType: E.Number
2936
+ }];
2937
+ function fa(e) {
2938
+ const t = new Set(e.properties.map((n) => n.path));
2939
+ return {
2940
+ ...e,
2941
+ properties: [...e.properties, ...ma.filter((n) => !t.has(n.path))]
2942
+ };
2943
+ }
2944
+ var vt = "PrimeReact", ha = 1;
2945
+ function ga(e, t) {
2946
+ const n = We(e.map((u) => u.manifest)), r = e.flatMap((u) => u.descriptors ?? []), i = new Set(r.map((u) => u.component)), o = e.flatMap((u) => u.manifest.components.map((c) => ({
2947
+ component: It(u.manifest.name, c),
2948
+ displayName: c,
2949
+ properties: []
2950
+ }))).filter((u) => !i.has(u.component)), a = [...r, ...o].map(pa).map(fa), l = [...a, ...va(a, n, t)], d = new Set(Object.values(n).flat());
2951
+ return {
2952
+ id: ha++,
2953
+ bundles: e,
2954
+ registry: St(e),
2955
+ packages: n,
2956
+ descriptors: l,
2957
+ catalog: Cn(l),
2958
+ profile: t,
2959
+ icons: sa(t.packages, e),
2960
+ iconAdapters: Bn(e),
2961
+ isKnownComponent: (u) => d.has(u),
2962
+ legacyTypeOf: (u) => {
2963
+ const c = je(u, t, n), m = c?.package === vt ? `${vt}.${Rt(c.name)}` : void 0;
2964
+ return m !== void 0 && da.has(m) ? m : void 0;
2965
+ }
2966
+ };
2967
+ }
2968
+ function va(e, t, n) {
2969
+ const r = [];
2970
+ for (const i of new Set(Object.values(t).flat())) {
2971
+ const o = je(i, n, t), a = o && e.find((l) => l.component === It(o.package, o.name));
2972
+ a && r.push({
2973
+ ...a,
2974
+ component: i
2975
+ });
2976
+ }
2977
+ return r;
2978
+ }
2979
+ var tt = "Cratis.Icons.Lucide", ya = {
2980
+ name: tt,
2981
+ version: "1.50.0",
2982
+ kind: me.IconLibrary,
2983
+ dependencies: [],
2984
+ components: [],
2985
+ layouts: [],
2986
+ screenTemplates: [],
2987
+ dialogTemplates: [],
2988
+ themes: [],
2989
+ displayName: "Lucide",
2990
+ description: "Clean, consistent outline icons for navigation, actions and status.",
2991
+ module: "@cratis/studio.editor/IconLibraries/Lucide",
2992
+ license: "ISC",
2993
+ licenseUrl: "https://lucide.dev/license",
2994
+ iconLibrary: {
2995
+ variants: [],
2996
+ renderers: ["react"],
2997
+ attribution: "Icons by Lucide contributors",
2998
+ attributionUrl: "https://lucide.dev",
2999
+ iconCount: 1858
3000
+ }
3001
+ }, ba = {
3002
+ library: tt,
3003
+ loadEntries: async () => (await import("./catalog-CZx3FR-E.js")).default
3004
+ }, wa = pr, Ca = {
3005
+ library: tt,
3006
+ loadGlyph: async ({ key: e }) => (await wa[e]?.())?.default
3007
+ }, ka = {
3008
+ manifest: ya,
3009
+ components: {},
3010
+ iconLibrary: {
3011
+ catalog: ba,
3012
+ adapter: Ca
3013
+ }
3014
+ }, ue = [
3015
+ $n,
3016
+ dr,
3017
+ Wn,
3018
+ lr,
3019
+ or,
3020
+ ur,
3021
+ ka
3022
+ ], Ia = ue.map((e) => e.manifest), rs = St(ue), is = We(Ia), os = ue.flatMap((e) => e.themes ?? []);
3023
+ function Sa(e) {
3024
+ const t = bn(e).map((i) => i.name), n = ot(e, me.Styling).map((i) => i.name), r = ot(e, me.Blueprint)[0];
3025
+ return r ? [
3026
+ ...t,
3027
+ ...n,
3028
+ r.name
3029
+ ] : [...t, ...n];
3030
+ }
3031
+ function Pa(e, t) {
3032
+ return t.filter((n) => Sn(n, e));
3033
+ }
3034
+ function Ta(e, t) {
3035
+ return [...new Set(Object.values(t).flat())].map((n) => je(n, e, t)).filter((n) => n !== void 0 && n.shadows.length > 0).sort((n, r) => n.name.localeCompare(r.name));
3036
+ }
3037
+ var Te = /* @__PURE__ */ (function(e) {
3038
+ return e.Fallback = "fallback", e.Explicit = "explicit", e.Automatic = "automatic", e;
3039
+ })({});
3040
+ function Ra(e) {
3041
+ const t = [
3042
+ qe,
3043
+ ...e.packages,
3044
+ e.shell,
3045
+ ...e.templatePacks
3046
+ ];
3047
+ return [...new Set(t.filter((n) => n.length > 0))];
3048
+ }
3049
+ function Na(e, t) {
3050
+ return e.find((n) => n.manifest.name === t)?.manifest.layouts[0] ?? "";
3051
+ }
3052
+ var an = "UI Profile";
3053
+ function sn(e, t) {
3054
+ const n = t.map((d) => d.manifest), r = Ra(e), i = Rn(r, n), o = Na(t, e.shell), a = {
3055
+ name: an,
3056
+ targetPlatform: "web",
3057
+ packages: i.packages,
3058
+ layout: o.length > 0 ? o : void 0,
3059
+ theme: e.theme.length > 0 ? e.theme : void 0
3060
+ }, l = new Set(r);
3061
+ return {
3062
+ selection: i,
3063
+ profile: a,
3064
+ entries: i.packages.flatMap((d) => {
3065
+ const u = n.find((c) => c.name === d);
3066
+ return u ? [{
3067
+ name: d,
3068
+ displayName: u.displayName ?? u.name,
3069
+ description: u.description,
3070
+ version: u.version,
3071
+ kind: u.kind,
3072
+ inclusion: d === qe ? Te.Fallback : l.has(d) ? Te.Explicit : Te.Automatic,
3073
+ requiredBy: n.filter((c) => i.packages.includes(c.name) && c.dependencies.some((m) => m.name === d)).map((c) => c.name)
3074
+ }] : [];
3075
+ }),
3076
+ collisions: Ta(a, We(n)),
3077
+ compatibleThemes: Pa(a, t.flatMap((d) => d.themes ?? [])),
3078
+ layout: o,
3079
+ isValid: In(i)
3080
+ };
3081
+ }
3082
+ function Oa(e) {
3083
+ const t = e.map((a) => a.manifest), n = Sa(t), r = n.find((a) => t.find((l) => l.name === a)?.kind === me.Blueprint) ?? "", i = {
3084
+ packages: n.filter((a) => a !== r && a !== qe),
3085
+ shell: r,
3086
+ templatePacks: [],
3087
+ theme: "",
3088
+ colorScheme: rr.Light,
3089
+ navigationMode: ir.Static,
3090
+ accent: "",
3091
+ defaultScreenTemplate: ""
3092
+ }, o = sn(i, e).compatibleThemes.find((a) => !a.isDark);
3093
+ return {
3094
+ ...i,
3095
+ theme: o?.name ?? ""
3096
+ };
3097
+ }
3098
+ function xa(e) {
3099
+ return {
3100
+ name: an,
3101
+ targetPlatform: "web",
3102
+ packages: [...e.resolvedPackages],
3103
+ layout: e.layout.length > 0 ? e.layout : void 0,
3104
+ theme: e.theme.length > 0 ? e.theme : void 0
3105
+ };
3106
+ }
3107
+ function as(e, t = ue) {
3108
+ const n = e ? xa(e) : sn(Oa(t), t).profile;
3109
+ return ga(t, n);
3110
+ }
3111
+ var yt = {
3112
+ Compact: "Compact",
3113
+ Regular: "Regular"
3114
+ }, La = {
3115
+ ariaLabel: "Icon",
3116
+ picker: {
3117
+ placeholder: "Choose an icon",
3118
+ title: "Choose an icon",
3119
+ search: "Search icons",
3120
+ searchPlaceholder: "Search by name or tag",
3121
+ clearSearch: "Clear search",
3122
+ close: "Close",
3123
+ categories: "Categories",
3124
+ allCategories: "All",
3125
+ uncategorized: "Other",
3126
+ library: "Library",
3127
+ allLibraries: "All libraries",
3128
+ loading: "Loading icons…",
3129
+ empty: "The profile has no icon library to choose from.",
3130
+ clearFilters: "Clear filters",
3131
+ error: "Some icons could not be loaded.",
3132
+ deprecated: "Deprecated",
3133
+ notAllowed: "Not available for this field",
3134
+ trigger: "Icon"
3135
+ },
3136
+ diagnostics: {
3137
+ "missing-library": "{library} is not an icon library of this profile, so its icon {key} cannot be drawn. Add the library to the profile or choose another icon.",
3138
+ "missing-icon": "{library} no longer has an icon named {key}. Choose another icon.",
3139
+ "missing-variant": "{library} has {key}, but not in the {variant} style. Choose another style or icon.",
3140
+ "incompatible-version": "{library} is at a version another package of this profile does not accept. Use a compatible version or remove the package that needs it.",
3141
+ "catalog-unavailable": "The icons of {library} could not be read, so they cannot be checked. Try again in a moment."
3142
+ },
3143
+ notAllowed: "This icon is not available for this field. Choose one of the icons the field offers."
3144
+ }, ss = {
3145
+ inspectorTitle: "Inspector",
3146
+ windowLabel: "Screen editor",
3147
+ stopped: {
3148
+ title: "The screen editor stopped",
3149
+ message: "Something in the editor failed, so it was closed. The screen as it was last saved is untouched; changes made since are lost.",
3150
+ close: "Close"
3151
+ },
3152
+ unreadable: {
3153
+ title: "This screen could not be opened",
3154
+ warning: "The saved screen has not been changed. Close this window to leave it as it is.",
3155
+ close: "Close",
3156
+ reasons: {
3157
+ [H.NotJson]: "The saved screen is not readable data.",
3158
+ [H.WrongShape]: "The saved screen is not in a form this editor understands.",
3159
+ [H.MissingScreen]: "The saved screen does not contain a screen to edit.",
3160
+ [H.MissingTemplate]: "The saved template does not contain the template you asked to edit."
3161
+ }
3162
+ },
3163
+ propertiesTab: "Properties",
3164
+ structureTab: "Structure",
3165
+ openInspector: "Open inspector",
3166
+ closeInspector: "Close inspector",
3167
+ desktopPreview: "Desktop preview",
3168
+ mobilePreview: "Mobile preview",
3169
+ sizeClass: (e, t) => `${yt[e] ?? e} width, ${yt[t] ?? t} height`,
3170
+ viewportSize: (e, t) => `${e} × ${t}`,
3171
+ noSelection: "Select a component on the screen or in Structure to see its details.",
3172
+ nameLabel: "Name",
3173
+ typeLabel: "Type",
3174
+ ownershipLabel: "Source",
3175
+ ownership: {
3176
+ [M.Local]: "This screen",
3177
+ [M.Inherited]: "Inherited",
3178
+ [M.ConfigurableInherited]: "Inherited, configurable"
3179
+ },
3180
+ ownershipHint: {
3181
+ [M.Local]: "Authored on this screen. You can move, resize and change it.",
3182
+ [M.Inherited]: "Inherited from a template. It can be inspected here but not changed; open the template to edit it.",
3183
+ [M.ConfigurableInherited]: "Inherited from a template that exposes some of its settings to this screen. The structure stays locked."
3184
+ },
3185
+ undo: "Undo",
3186
+ redo: "Redo",
3187
+ palette: "Components",
3188
+ layoutDrawer: "Layout",
3189
+ closeDrawer: "Close",
3190
+ deleteElement: "Delete selected component",
3191
+ saveRefused: "The screen could not be saved.",
3192
+ properties: {
3193
+ diagnostics: "Problems",
3194
+ noProperties: "This component has no settings to change.",
3195
+ layoutType: "Layout type",
3196
+ changeLayout: "Change layout",
3197
+ confirmLayoutTitle: "This change drops some settings",
3198
+ confirmLayoutAccept: "Change anyway",
3199
+ confirmLayoutCancel: "Keep the current layout",
3200
+ exposure: "Settings screens may change",
3201
+ exposeProperty: "Allow screens to change this",
3202
+ unexposeProperty: "Stop allowing screens to change this",
3203
+ exposedToScopes: "Screens can change this",
3204
+ itemsLabel: "Items",
3205
+ addItem: "Add item",
3206
+ icon: La,
3207
+ json: $t,
3208
+ query: {
3209
+ label: "Query",
3210
+ choose: "Choose a query",
3211
+ none: "No query",
3212
+ missing: "The query this was bound to is not available here any more.",
3213
+ parameters: "Parameters",
3214
+ columns: "Columns",
3215
+ sourceFor: (e) => e,
3216
+ noSource: "Not set",
3217
+ showColumn: (e) => e,
3218
+ preview: {
3219
+ noQuery: "Choose a query to show data.",
3220
+ missingQuery: "The bound query is not available, so there is nothing to show.",
3221
+ loading: "Loading data…",
3222
+ empty: "The query returned no rows.",
3223
+ error: "The query could not be run."
3224
+ }
3225
+ },
3226
+ action: {
3227
+ label: "Action",
3228
+ none: "No action",
3229
+ slice: "Submits",
3230
+ chooseSlice: "Choose a state change",
3231
+ inputs: "Inputs",
3232
+ presentation: "Presentation",
3233
+ presentations: {
3234
+ none: "Run directly",
3235
+ modal: "Ask in a dialog",
3236
+ drawer: "Ask in a drawer"
3237
+ },
3238
+ sourceFor: (e) => e,
3239
+ problems: {
3240
+ missingSlice: "The state change this submits is no longer in the model.",
3241
+ unmappedInput: (e) => `${e} has nothing feeding it.`,
3242
+ unknownInput: (e) => `${e} is not an input of this state change any more.`,
3243
+ unknownSource: (e) => `${e} is fed from a value this screen does not have.`
3244
+ }
3245
+ }
3246
+ },
3247
+ structureLabel: "Screen structure",
3248
+ structureEmpty: "This screen has no components yet.",
3249
+ moveUp: "Move up",
3250
+ moveDown: "Move down",
3251
+ outdent: "Move out of parent",
3252
+ indent: "Move into previous sibling",
3253
+ moved: "Moved.",
3254
+ rejection: {
3255
+ [_.NodeNotFound]: "That component no longer exists.",
3256
+ [_.TargetNotFound]: "That destination no longer exists.",
3257
+ [_.TargetNotContainer]: "That component cannot contain other components.",
3258
+ [_.WouldCreateCycle]: "A component cannot be moved into itself or one of its own children.",
3259
+ [_.NodeLocked]: "Inherited components cannot be moved. Open the template to change it.",
3260
+ [_.TargetLocked]: "Inherited components cannot receive new content. Open the template to change it.",
3261
+ [_.NoChange]: "It is already there."
3262
+ }
3263
+ }, cs = {
3264
+ [w.Stack]: "Stack",
3265
+ [w.Row]: "Row",
3266
+ [w.Grid]: "Grid",
3267
+ [w.Container]: "Container",
3268
+ [w.Wrap]: "Wrap",
3269
+ [w.Canvas]: "Canvas"
3270
+ }, Da = {
3271
+ [w.Stack]: Gn,
3272
+ [w.Row]: Kn,
3273
+ [w.Grid]: Pt,
3274
+ [w.Container]: Yn,
3275
+ [w.Wrap]: Xn,
3276
+ [w.Canvas]: nr
3277
+ }, ls = {
3278
+ layout: (e) => {
3279
+ const t = Da[e];
3280
+ return /* @__PURE__ */ s(t, { "aria-hidden": "true" });
3281
+ },
3282
+ component: () => /* @__PURE__ */ s(at, { "aria-hidden": "true" }),
3283
+ drawer: {
3284
+ layout: /* @__PURE__ */ s(Pt, { "aria-hidden": "true" }),
3285
+ package: /* @__PURE__ */ s(at, { "aria-hidden": "true" })
3286
+ }
3287
+ }, ds = ue.map((e) => ({
3288
+ package: e.manifest.name,
3289
+ components: e.manifest.components
3290
+ }));
3291
+ function us(e, t, n) {
3292
+ return e.map((r) => ({
3293
+ type: r.type,
3294
+ name: t[r.item],
3295
+ arrangement: r.arrangement,
3296
+ icon: n?.[r.item]
3297
+ }));
3298
+ }
3299
+ export {
3300
+ Vi as JsonPropertyField,
3301
+ w as LayoutItem,
3302
+ M as Ownership,
3303
+ H as SceneDocumentProblem,
3304
+ Xa as ScreenEditorOverlay,
3305
+ es as ScreenEditorPrimeReactProvider,
3306
+ rn as ScreenEditorWindow,
3307
+ ts as ScreenEditorWorkspace,
3308
+ _ as StructureEditRejection,
3309
+ Gt as buildPalette,
3310
+ ns as createScreenEditorEnvironment,
3311
+ ga as createScreenEditorRuntime,
3312
+ $t as defaultJsonPropertyFieldStrings,
3313
+ Da as defaultLayoutIcons,
3314
+ cs as defaultLayoutLabels,
3315
+ ls as defaultPaletteIcons,
3316
+ ds as defaultPaletteSources,
3317
+ ss as defaultScreenEditorStrings,
3318
+ Bt as formatJson,
3319
+ Ji as isJsonProperty,
3320
+ Gi as isJsonValueType,
3321
+ Wi as jsonValueType,
3322
+ Fi as readJson,
3323
+ mo as readSceneDocument,
3324
+ as as screenEditorRuntimeForProfile,
3325
+ us as toLayoutContainerDescriptors,
3326
+ oa as toSceneCandidates
3327
+ };