base-screen 0.2.0 → 0.4.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 (518) hide show
  1. package/README.md +3 -12
  2. package/dist/_internal/contracts/document/blueprint-capabilities.d.ts +9 -1
  3. package/dist/_internal/contracts/document/blueprint-capabilities.js +16 -0
  4. package/dist/_internal/contracts/document/blueprint-graph.d.ts +68 -0
  5. package/dist/_internal/contracts/document/blueprint-graph.js +424 -0
  6. package/dist/_internal/contracts/document/blueprint-strict.d.ts +3 -1
  7. package/dist/_internal/contracts/document/blueprint-strict.js +77 -91
  8. package/dist/_internal/contracts/document/component-states.d.ts +54 -0
  9. package/dist/_internal/contracts/document/component-states.js +171 -0
  10. package/dist/_internal/contracts/document/json-schema.js +49 -17
  11. package/dist/_internal/contracts/document/limits.d.ts +40 -8
  12. package/dist/_internal/contracts/document/limits.js +40 -8
  13. package/dist/_internal/contracts/document/parse-parts.d.ts +12 -0
  14. package/dist/_internal/contracts/document/parse-parts.js +56 -0
  15. package/dist/_internal/contracts/document/parse.js +1 -1
  16. package/dist/_internal/contracts/document/references.js +108 -41
  17. package/dist/_internal/contracts/document/schema.d.ts +532 -186
  18. package/dist/_internal/contracts/document/schema.js +235 -96
  19. package/dist/_internal/contracts/document/sub-canvas.d.ts +27 -0
  20. package/dist/_internal/contracts/document/sub-canvas.js +38 -0
  21. package/dist/_internal/contracts/document/theme.d.ts +22 -0
  22. package/dist/_internal/contracts/document/theme.js +65 -0
  23. package/dist/_internal/contracts/document/validate-blueprint.d.ts +7 -0
  24. package/dist/_internal/contracts/document/validate-blueprint.js +223 -25
  25. package/dist/_internal/contracts/document/validate-component.d.ts +2 -0
  26. package/dist/_internal/contracts/document/validate-component.js +111 -54
  27. package/dist/_internal/contracts/document/validate-data-source.js +84 -9
  28. package/dist/_internal/contracts/document/validate-sub-canvas.d.ts +9 -0
  29. package/dist/_internal/contracts/document/validate-sub-canvas.js +92 -0
  30. package/dist/_internal/contracts/document/validate-theme.d.ts +4 -0
  31. package/dist/_internal/contracts/document/validate-theme.js +20 -0
  32. package/dist/_internal/contracts/document/validate-value-ref.js +6 -1
  33. package/dist/_internal/contracts/document/validate.js +19 -2
  34. package/dist/_internal/contracts/index.d.ts +11 -4
  35. package/dist/_internal/contracts/index.js +8 -2
  36. package/dist/_internal/contracts/migration/blueprint-graph-migration.d.ts +21 -0
  37. package/dist/_internal/contracts/migration/blueprint-graph-migration.js +328 -0
  38. package/dist/_internal/contracts/migration/migrate-document.d.ts +2 -1
  39. package/dist/_internal/contracts/migration/migrate-document.js +11 -3
  40. package/dist/_internal/contracts/push/delivery.d.ts +16 -0
  41. package/dist/_internal/contracts/push/delivery.js +70 -0
  42. package/dist/_internal/contracts/push/level-scale.d.ts +7 -0
  43. package/dist/_internal/contracts/push/level-scale.js +91 -0
  44. package/dist/_internal/contracts/screen-document.schema.json +1071 -386
  45. package/dist/_internal/contracts/types/diagnostics.d.ts +1 -1
  46. package/dist/_internal/contracts/types/document.d.ts +280 -77
  47. package/dist/_internal/contracts/types/execution.d.ts +12 -2
  48. package/dist/_internal/contracts/types/execution.js +0 -5
  49. package/dist/_internal/contracts/types/host.d.ts +35 -1
  50. package/dist/_internal/contracts/types/host.js +7 -1
  51. package/dist/_internal/contracts/types/push.d.ts +86 -0
  52. package/dist/_internal/contracts/types/push.js +1 -0
  53. package/dist/_internal/contracts/types/variable.d.ts +5 -0
  54. package/dist/_internal/contracts/variable/parse.js +30 -1
  55. package/dist/_internal/core/blueprint/runtime-compile.d.ts +4 -0
  56. package/dist/_internal/core/blueprint/runtime-compile.js +45 -21
  57. package/dist/_internal/core/blueprint/runtime-dispatch.js +270 -156
  58. package/dist/_internal/core/blueprint/runtime-simulate.d.ts +57 -0
  59. package/dist/_internal/core/blueprint/runtime-simulate.js +177 -0
  60. package/dist/_internal/core/blueprint/runtime-types.d.ts +112 -6
  61. package/dist/_internal/core/blueprint/runtime.d.ts +2 -1
  62. package/dist/_internal/core/blueprint/runtime.js +1 -0
  63. package/dist/_internal/core/commands/apply-collection-commands.d.ts +32 -0
  64. package/dist/_internal/core/commands/apply-collection-commands.js +174 -0
  65. package/dist/_internal/core/commands/apply-component-commands.d.ts +5 -0
  66. package/dist/_internal/core/commands/apply-component-commands.js +74 -2
  67. package/dist/_internal/core/commands/apply.js +76 -3
  68. package/dist/_internal/core/commands/parse-command.js +24 -0
  69. package/dist/_internal/core/commands/types.d.ts +56 -3
  70. package/dist/_internal/core/data/data-candidates.d.ts +38 -0
  71. package/dist/_internal/core/data/data-candidates.js +186 -0
  72. package/dist/_internal/core/data/dataset-profile.d.ts +71 -0
  73. package/dist/_internal/core/data/dataset-profile.js +170 -0
  74. package/dist/_internal/core/data/sample-values.d.ts +25 -0
  75. package/dist/_internal/core/data/sample-values.js +45 -0
  76. package/dist/_internal/core/diff/screen-diff.js +7 -1
  77. package/dist/_internal/core/index.d.ts +7 -1
  78. package/dist/_internal/core/index.js +7 -1
  79. package/dist/_internal/core/state/state-preset.d.ts +32 -0
  80. package/dist/_internal/core/state/state-preset.js +37 -0
  81. package/dist/_internal/core/validation/layout-audit.d.ts +17 -0
  82. package/dist/_internal/core/validation/layout-audit.js +228 -0
  83. package/dist/_internal/core/validation/legibility.d.ts +9 -0
  84. package/dist/_internal/core/validation/legibility.js +33 -0
  85. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge-helpers.d.ts +1 -1
  86. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge.d.ts +11 -1
  87. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-panels-controller.d.ts +18 -4
  88. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-timer-scheduler.d.ts +21 -0
  89. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-workbench-panel.d.ts +8 -1
  90. package/dist/_internal/engine/browser/controllers/dataset/designer-data-source-authoring.d.ts +25 -1
  91. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-controller-context.d.ts +6 -2
  92. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +14 -1
  93. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-surface-controller.d.ts +14 -0
  94. package/dist/_internal/engine/browser/controllers/dataset/designer-update-policy-authoring.d.ts +52 -0
  95. package/dist/_internal/engine/browser/controllers/designer-artboard-controller.d.ts +80 -0
  96. package/dist/_internal/engine/browser/controllers/designer-canvas-runtime-controller.d.ts +21 -3
  97. package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +29 -0
  98. package/dist/_internal/engine/browser/controllers/designer-command-palette-controller.d.ts +2 -0
  99. package/dist/_internal/engine/browser/controllers/designer-notification-controller.d.ts +7 -0
  100. package/dist/_internal/engine/browser/controllers/designer-page-preview-controller.d.ts +34 -0
  101. package/dist/_internal/engine/browser/controllers/designer-popup-preview-controller.d.ts +40 -0
  102. package/dist/_internal/engine/browser/controllers/designer-preview-controller.d.ts +1 -3
  103. package/dist/_internal/engine/browser/controllers/designer-reference-layer-controller.d.ts +45 -0
  104. package/dist/_internal/engine/browser/controllers/designer-viewport-controller.d.ts +10 -0
  105. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-callbacks.d.ts +5 -1
  106. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-controller.d.ts +2 -0
  107. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-environment.d.ts +18 -7
  108. package/dist/_internal/engine/browser/controllers/gesture/designer-group-editing-controller.d.ts +8 -1
  109. package/dist/_internal/engine/browser/controllers/layers/designer-layers-controller.d.ts +11 -0
  110. package/dist/_internal/engine/browser/controllers/panel/designer-component-states-controller.d.ts +26 -0
  111. package/dist/_internal/engine/browser/controllers/panel/designer-inspector-focus.d.ts +30 -0
  112. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller-callbacks.d.ts +23 -6
  113. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller.d.ts +2 -2
  114. package/dist/_internal/engine/browser/controllers/panel/designer-panel-material-controller.d.ts +4 -0
  115. package/dist/_internal/engine/browser/controllers/panel/designer-panel-property-controller.d.ts +2 -0
  116. package/dist/_internal/engine/browser/controllers/workbench/designer-snap-controller.d.ts +5 -1
  117. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +7 -1
  118. package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-inspector-configuration.d.ts +12 -0
  119. package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-library-dom.d.ts +18 -2
  120. package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +22 -5
  121. package/dist/_internal/engine/browser/dom/color/designer-color-palette-dom.d.ts +1 -0
  122. package/dist/_internal/engine/browser/dom/color/designer-color-palette-theme.d.ts +10 -0
  123. package/dist/_internal/engine/browser/dom/color/designer-color-palette-types.d.ts +13 -0
  124. package/dist/_internal/engine/browser/dom/color/designer-color-theme-slots.d.ts +10 -0
  125. package/dist/_internal/engine/browser/dom/dataset/designer-data-section-diff.d.ts +4 -6
  126. package/dist/_internal/engine/browser/dom/dataset/designer-dataset-types.d.ts +17 -6
  127. package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-control-dom.d.ts +17 -1
  128. package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-model.d.ts +2 -0
  129. package/dist/_internal/engine/browser/dom/designer-field-primitives.d.ts +43 -1
  130. package/dist/_internal/engine/browser/dom/designer-icons.d.ts +2 -0
  131. package/dist/_internal/engine/browser/dom/designer-select-dom.d.ts +2 -0
  132. package/dist/_internal/engine/browser/dom/designer-ui-primitives.d.ts +5 -0
  133. package/dist/_internal/engine/browser/dom/layers/designer-layers-model.d.ts +28 -0
  134. package/dist/_internal/engine/browser/dom/material-library/designer-material-library-dom.d.ts +18 -2
  135. package/dist/_internal/engine/browser/dom/material-library/designer-material-library-group-view.d.ts +1 -0
  136. package/dist/_internal/engine/browser/dom/menu/designer-menu-model.d.ts +4 -2
  137. package/dist/_internal/engine/browser/dom/panel/designer-canvas-properties-dom.d.ts +10 -2
  138. package/dist/_internal/engine/browser/dom/panel/designer-canvas-transactions.d.ts +5 -1
  139. package/dist/_internal/engine/browser/dom/panel/designer-chrome-primitives.d.ts +12 -0
  140. package/dist/_internal/engine/browser/dom/panel/designer-color-group-dom.d.ts +45 -0
  141. package/dist/_internal/engine/browser/dom/panel/designer-component-properties-dom.d.ts +4 -3
  142. package/dist/_internal/engine/browser/dom/panel/designer-component-states-dom.d.ts +22 -0
  143. package/dist/_internal/engine/browser/dom/panel/designer-panel-primitives.d.ts +18 -2
  144. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-types.d.ts +2 -0
  145. package/dist/_internal/engine/browser/dom/workspace/designer-workspace-template.d.ts +13 -0
  146. package/dist/_internal/engine/browser/dom/workspace/designer-workspace.d.ts +2 -1
  147. package/dist/_internal/engine/browser/viewport/designer-canvas-aids-types.d.ts +10 -4
  148. package/dist/_internal/engine/browser/viewport/designer-canvas-aids.d.ts +17 -5
  149. package/dist/_internal/engine/browser/viewport/designer-canvas-coordinates.d.ts +7 -0
  150. package/dist/_internal/engine/browser/viewport/designer-canvas-measurements.d.ts +8 -9
  151. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-alignment-index.d.ts +27 -0
  152. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-geometry.d.ts +13 -2
  153. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-preview.d.ts +1 -1
  154. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-spacing.d.ts +12 -0
  155. package/dist/_internal/engine/browser/viewport/designer-guide-overlay-nodes.d.ts +4 -0
  156. package/dist/_internal/engine/browser/viewport/designer-snap-tuning.d.ts +14 -0
  157. package/dist/_internal/engine/common/observability/designer-metrics.d.ts +1 -1
  158. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-geometry.d.ts +12 -0
  159. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-graph.d.ts +203 -0
  160. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model-types.d.ts +6 -2
  161. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model.d.ts +58 -7
  162. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-protocol-types.d.ts +131 -51
  163. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-value-sources.d.ts +7 -3
  164. package/dist/_internal/engine/common/operations/catalog/designer-catalog-refresh.d.ts +13 -1
  165. package/dist/_internal/engine/common/operations/change/designer-change-events.d.ts +2 -0
  166. package/dist/_internal/engine/common/operations/change/designer-change-proposal.d.ts +35 -2
  167. package/dist/_internal/engine/common/operations/designer-operation-registry.d.ts +5 -1
  168. package/dist/_internal/engine/common/operations/designer-variable-operations.d.ts +8 -0
  169. package/dist/_internal/engine/common/operations/display/designer-target-display.d.ts +2 -2
  170. package/dist/_internal/engine/common/operations/element/designer-element-operation-types.d.ts +8 -0
  171. package/dist/_internal/engine/common/operations/host-resource/host-resource-authoring.d.ts +1 -1
  172. package/dist/_internal/engine/common/operations/material-component/material-component-fragment-extract.d.ts +34 -0
  173. package/dist/_internal/engine/common/operations/material-component/material-component-fragment.d.ts +24 -41
  174. package/dist/_internal/engine/common/operations/material-component/material-component.d.ts +1 -1
  175. package/dist/_internal/engine/common/operations/material-library/material-library-fragments.d.ts +46 -0
  176. package/dist/_internal/engine/common/operations/material-library/material-library-grouping.d.ts +11 -0
  177. package/dist/_internal/engine/common/operations/selection/designer-group.d.ts +16 -4
  178. package/dist/_internal/engine/common/operations/selection/designer-multi-selection-operations.d.ts +4 -3
  179. package/dist/_internal/engine/common/operations/selection/designer-selection-actions.d.ts +6 -0
  180. package/dist/_internal/engine/common/operations/selection/designer-selection.d.ts +8 -0
  181. package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +67 -0
  182. package/dist/_internal/engine/common/operations/style/designer-material-appearance.d.ts +30 -0
  183. package/dist/_internal/engine/common/session/designer-artboard.d.ts +40 -0
  184. package/dist/_internal/engine/common/session/designer-session.d.ts +21 -0
  185. package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +169 -0
  186. package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +464 -90
  187. package/dist/_internal/engine/designer-blueprint-workbench-panel-BWSglfAb.js +2792 -0
  188. package/dist/_internal/engine/{designer-dataset-controller-CPytVNBK.js → designer-dataset-controller-DdbY4ILC.js} +1919 -1604
  189. package/dist/_internal/engine/designer-element/api/designer-element-catalog.d.ts +4 -3
  190. package/dist/_internal/engine/designer-element/api/designer-element-change.d.ts +24 -0
  191. package/dist/_internal/engine/designer-element/api/designer-element-configuration-types.d.ts +11 -8
  192. package/dist/_internal/engine/designer-element/api/designer-element-fragment-save.d.ts +16 -0
  193. package/dist/_internal/engine/designer-element/api/designer-element-host-properties.d.ts +0 -5
  194. package/dist/_internal/engine/designer-element/api/designer-element-insert-component-fragment.d.ts +9 -2
  195. package/dist/_internal/engine/designer-element/api/designer-element-material-library-fragments.d.ts +17 -0
  196. package/dist/_internal/engine/designer-element/api/designer-element-project.d.ts +0 -1
  197. package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +36 -24
  198. package/dist/_internal/engine/designer-element/designer-element-public-api.d.ts +7 -6
  199. package/dist/_internal/engine/designer-element/runtime/designer-element-guards.d.ts +0 -2
  200. package/dist/_internal/engine/designer-element/runtime/designer-element-host.d.ts +6 -7
  201. package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +12 -2
  202. package/dist/_internal/engine/designer-element/runtime/designer-element-runtime.d.ts +19 -15
  203. package/dist/_internal/engine/designer-element/runtime/designer-element-sample-data.d.ts +23 -0
  204. package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +29 -10
  205. package/dist/_internal/engine/{designer-ui-primitives-CH4RNiMa.js → designer-field-primitives-Crn464Qg.js} +919 -348
  206. package/dist/_internal/engine/designer-left-panel-groups-dom-DFdLWxxY.js +1282 -0
  207. package/dist/_internal/engine/host-resource-selection-CWrPLVOc.js +2482 -0
  208. package/dist/_internal/engine/host-tokens.css +12 -12
  209. package/dist/_internal/engine/index.js +9202 -6279
  210. package/dist/_internal/host-kit/index.d.ts +3 -0
  211. package/dist/_internal/host-kit/index.js +3 -0
  212. package/dist/_internal/host-kit/intent/index.d.ts +16 -0
  213. package/dist/_internal/host-kit/intent/index.js +13 -0
  214. package/dist/_internal/host-kit/intent/intent-behavior.d.ts +59 -0
  215. package/dist/_internal/host-kit/intent/intent-behavior.js +812 -0
  216. package/dist/_internal/host-kit/intent/intent-block.d.ts +59 -0
  217. package/dist/_internal/host-kit/intent/intent-block.js +359 -0
  218. package/dist/_internal/host-kit/intent/intent-catalog.d.ts +105 -0
  219. package/dist/_internal/host-kit/intent/intent-catalog.js +60 -0
  220. package/dist/_internal/host-kit/intent/intent-compile-types.d.ts +222 -0
  221. package/dist/_internal/host-kit/intent/intent-compile-types.js +10 -0
  222. package/dist/_internal/host-kit/intent/intent-compile.d.ts +35 -0
  223. package/dist/_internal/host-kit/intent/intent-compile.js +465 -0
  224. package/dist/_internal/host-kit/intent/intent-data-check.d.ts +50 -0
  225. package/dist/_internal/host-kit/intent/intent-data-check.js +163 -0
  226. package/dist/_internal/host-kit/intent/intent-data-context.d.ts +53 -0
  227. package/dist/_internal/host-kit/intent/intent-data-context.js +200 -0
  228. package/dist/_internal/host-kit/intent/intent-dataset.d.ts +52 -0
  229. package/dist/_internal/host-kit/intent/intent-dataset.js +125 -0
  230. package/dist/_internal/host-kit/intent/intent-format.d.ts +33 -0
  231. package/dist/_internal/host-kit/intent/intent-format.js +94 -0
  232. package/dist/_internal/host-kit/intent/intent-kpi-bind.d.ts +29 -0
  233. package/dist/_internal/host-kit/intent/intent-kpi-bind.js +59 -0
  234. package/dist/_internal/host-kit/intent/intent-layout.d.ts +102 -0
  235. package/dist/_internal/host-kit/intent/intent-layout.js +264 -0
  236. package/dist/_internal/host-kit/intent/intent-parse.d.ts +39 -0
  237. package/dist/_internal/host-kit/intent/intent-parse.js +930 -0
  238. package/dist/_internal/host-kit/intent/intent-prepare.d.ts +52 -0
  239. package/dist/_internal/host-kit/intent/intent-prepare.js +104 -0
  240. package/dist/_internal/host-kit/intent/intent-session.d.ts +202 -0
  241. package/dist/_internal/host-kit/intent/intent-session.js +1001 -0
  242. package/dist/_internal/host-kit/intent/intent-stream.d.ts +28 -0
  243. package/dist/_internal/host-kit/intent/intent-stream.js +183 -0
  244. package/dist/_internal/host-kit/intent/intent-style.d.ts +37 -0
  245. package/dist/_internal/host-kit/intent/intent-style.js +77 -0
  246. package/dist/_internal/host-kit/intent/intent-types.d.ts +234 -0
  247. package/dist/_internal/host-kit/intent/intent-types.js +10 -0
  248. package/dist/_internal/host-kit/push-result.d.ts +5 -0
  249. package/dist/_internal/host-kit/push-result.js +8 -0
  250. package/dist/_internal/host-kit/sse-subscribe.d.ts +59 -0
  251. package/dist/_internal/host-kit/sse-subscribe.js +253 -0
  252. package/dist/_internal/host-kit/subscription-hub.d.ts +41 -0
  253. package/dist/_internal/host-kit/subscription-hub.js +179 -0
  254. package/dist/_internal/material/base-material.d.ts +1 -0
  255. package/dist/_internal/material/chart.d.ts +4 -0
  256. package/dist/_internal/material/chart.js +123 -58
  257. package/dist/_internal/material/container.js +19 -33
  258. package/dist/_internal/material/{base-material-BArgjOeL.js → editor-descriptor-DJZYygOa.js} +49 -20
  259. package/dist/_internal/material/editor-descriptor.d.ts +18 -0
  260. package/dist/_internal/material/image.js +30 -34
  261. package/dist/_internal/material/rule.js +29 -42
  262. package/dist/_internal/material/shapes.js +57 -74
  263. package/dist/_internal/material/table.d.ts +4 -0
  264. package/dist/_internal/material/table.js +149 -71
  265. package/dist/_internal/material/text.js +40 -68
  266. package/dist/_internal/plugin-core/contracts.d.ts +38 -49
  267. package/dist/_internal/plugin-core/contribution-kind.js +47 -2
  268. package/dist/_internal/plugin-core/editor/editor-ai-description.d.ts +3 -0
  269. package/dist/_internal/plugin-core/editor/editor-ai-description.js +124 -0
  270. package/dist/_internal/plugin-core/editor/editor-descriptor-conditions.js +5 -0
  271. package/dist/_internal/plugin-core/editor/editor-descriptor-inference.d.ts +32 -0
  272. package/dist/_internal/plugin-core/editor/editor-descriptor-inference.js +83 -0
  273. package/dist/_internal/plugin-core/editor/editor-descriptor-items.d.ts +6 -0
  274. package/dist/_internal/plugin-core/editor/editor-descriptor-items.js +41 -12
  275. package/dist/_internal/plugin-core/editor/editor-descriptor-model.d.ts +24 -1
  276. package/dist/_internal/plugin-core/editor/editor-descriptor-model.js +6 -1
  277. package/dist/_internal/plugin-core/editor/editor-descriptor-schema.js +21 -0
  278. package/dist/_internal/plugin-core/editor/editor-descriptor-sections.js +5 -7
  279. package/dist/_internal/plugin-core/editor/editor-descriptor.d.ts +1 -0
  280. package/dist/_internal/plugin-core/editor/editor-descriptor.js +55 -2
  281. package/dist/_internal/plugin-core/fragment/fragment.d.ts +96 -0
  282. package/dist/_internal/plugin-core/fragment/fragment.js +535 -0
  283. package/dist/_internal/plugin-core/index.d.ts +7 -4
  284. package/dist/_internal/plugin-core/index.js +5 -2
  285. package/dist/_internal/plugin-core/material/material-manifest.js +14 -2
  286. package/dist/_internal/plugin-core/material/material-schema.d.ts +9 -0
  287. package/dist/_internal/plugin-core/material/material-schema.js +31 -1
  288. package/dist/_internal/plugin-core/material/material-theme.d.ts +25 -0
  289. package/dist/_internal/plugin-core/material/material-theme.js +77 -0
  290. package/dist/_internal/plugin-core/material/material-validation-constants.js +2 -0
  291. package/dist/_internal/plugin-core/material/material.d.ts +1 -1
  292. package/dist/_internal/plugin-core/material/material.js +1 -1
  293. package/dist/_internal/plugin-manager/contribution-kind-plan.d.ts +2 -1
  294. package/dist/_internal/plugin-manager/contribution-kind-plan.js +6 -0
  295. package/dist/_internal/plugin-manager/contributions.js +10 -0
  296. package/dist/_internal/plugin-sdk/authoring-finding.d.ts +19 -0
  297. package/dist/_internal/plugin-sdk/authoring-finding.js +12 -0
  298. package/dist/_internal/plugin-sdk/fragment-audit.d.ts +14 -0
  299. package/dist/_internal/plugin-sdk/fragment-audit.js +170 -0
  300. package/dist/_internal/plugin-sdk/fragment-definition.d.ts +11 -0
  301. package/dist/_internal/plugin-sdk/fragment-definition.js +16 -0
  302. package/dist/_internal/plugin-sdk/index.d.ts +15 -0
  303. package/dist/_internal/plugin-sdk/index.js +15 -0
  304. package/dist/_internal/plugin-sdk/material-config-groups.d.ts +44 -0
  305. package/dist/_internal/plugin-sdk/material-config-groups.js +80 -0
  306. package/dist/_internal/plugin-sdk/material-editor-audit.d.ts +24 -0
  307. package/dist/_internal/plugin-sdk/material-editor-audit.js +160 -0
  308. package/dist/_internal/plugin-sdk/material-isolated-csp.d.ts +38 -0
  309. package/dist/_internal/plugin-sdk/material-isolated-csp.js +67 -0
  310. package/dist/_internal/plugin-sdk/material-isolated-runtime.d.ts +22 -0
  311. package/dist/_internal/plugin-sdk/material-isolated-runtime.js +262 -0
  312. package/dist/_internal/plugin-sdk/material-isolated.d.ts +94 -0
  313. package/dist/_internal/plugin-sdk/material-isolated.js +1024 -0
  314. package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +77 -0
  315. package/dist/_internal/plugin-sdk/material-rendered-element.js +229 -0
  316. package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +24 -0
  317. package/dist/_internal/plugin-sdk/material-spec-audit.js +204 -0
  318. package/dist/_internal/plugin-sdk/material-spec.d.ts +134 -0
  319. package/dist/_internal/plugin-sdk/material-spec.js +710 -0
  320. package/dist/_internal/plugin-sdk/material-style-keys.d.ts +17 -0
  321. package/dist/_internal/plugin-sdk/material-style-keys.js +82 -0
  322. package/dist/_internal/plugin-sdk/material-template-audit.d.ts +12 -0
  323. package/dist/_internal/plugin-sdk/material-template-audit.js +302 -0
  324. package/dist/_internal/plugin-sdk/material-template-expression.d.ts +98 -0
  325. package/dist/_internal/plugin-sdk/material-template-expression.js +549 -0
  326. package/dist/_internal/plugin-sdk/material-template-render.d.ts +32 -0
  327. package/dist/_internal/plugin-sdk/material-template-render.js +579 -0
  328. package/dist/_internal/plugin-sdk/material-template.d.ts +185 -0
  329. package/dist/_internal/plugin-sdk/material-template.js +879 -0
  330. package/dist/_internal/renderer/index.d.ts +2 -0
  331. package/dist/_internal/renderer/index.js +1745 -616
  332. package/dist/_internal/renderer/renderer/renderer-component-states.d.ts +34 -0
  333. package/dist/_internal/renderer/renderer/renderer-effective-style.d.ts +12 -6
  334. package/dist/_internal/renderer/renderer/renderer-material-dom.d.ts +19 -3
  335. package/dist/_internal/renderer/renderer/renderer-mounted-material.d.ts +11 -10
  336. package/dist/_internal/renderer/renderer/renderer-state.d.ts +17 -1
  337. package/dist/_internal/renderer/renderer/renderer-theme.d.ts +11 -0
  338. package/dist/_internal/renderer/renderer/renderer-types.d.ts +15 -5
  339. package/dist/_internal/renderer/renderer/renderer.d.ts +30 -9
  340. package/dist/_internal/renderer/resource/data-source-runtime.d.ts +25 -2
  341. package/dist/_internal/renderer/resource/push-window.d.ts +43 -0
  342. package/dist/_internal/renderer/resource/source-query-port.d.ts +8 -1
  343. package/dist/_internal/renderer/sub-canvas-layer.d.ts +83 -0
  344. package/dist/_internal/renderer/viewer/viewer-blueprint-timer-scheduler.d.ts +23 -0
  345. package/dist/_internal/renderer/viewer/viewer-configuration-guards.d.ts +0 -1
  346. package/dist/_internal/renderer/viewer/viewer-configuration.d.ts +6 -3
  347. package/dist/_internal/renderer/viewer/viewer-stale-style.d.ts +3 -0
  348. package/dist/_internal/renderer/viewer/viewer-variable-controller.d.ts +2 -0
  349. package/dist/_internal/renderer/viewer/viewer.d.ts +18 -7
  350. package/dist/_internal/sdk/auto-register.js +7 -7
  351. package/dist/_internal/sdk/designer-auto-register.js +3 -3
  352. package/dist/_internal/sdk/designer.d.ts +1 -1
  353. package/dist/_internal/sdk/designer.js +8 -8
  354. package/dist/_internal/sdk/host-tokens.css +12 -12
  355. package/dist/_internal/sdk/index.d.ts +1 -1
  356. package/dist/_internal/sdk/index.js +6 -6
  357. package/dist/auto-register.js +11 -11
  358. package/dist/auto-register.js.map +1 -1
  359. package/dist/contracts.js +73 -43
  360. package/dist/contracts.js.map +1 -1
  361. package/dist/contrast-DRPezUIl.js +131 -0
  362. package/dist/contrast-DRPezUIl.js.map +1 -0
  363. package/dist/core.js +169 -21
  364. package/dist/core.js.map +1 -1
  365. package/dist/{data-contracts-BFld0hw_.js → data-contracts-CnnB5KC9.js} +2 -2
  366. package/dist/{data-contracts-BFld0hw_.js.map → data-contracts-CnnB5KC9.js.map} +1 -1
  367. package/dist/dataset-port-D993nOlT.js +182 -0
  368. package/dist/dataset-port-D993nOlT.js.map +1 -0
  369. package/dist/dataset-profile-Dk6xdtsM.js +261 -0
  370. package/dist/dataset-profile-Dk6xdtsM.js.map +1 -0
  371. package/dist/{designer-Byw45cUM.js → designer-CFOvOmLn.js} +3 -3
  372. package/dist/designer-CFOvOmLn.js.map +1 -0
  373. package/dist/designer-auto-register.js +6 -6
  374. package/dist/designer-auto-register.js.map +1 -1
  375. package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js +2773 -0
  376. package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js.map +1 -0
  377. package/dist/{designer-dataset-controller-CPytVNBK-DWL3SRTP.js → designer-dataset-controller-DdbY4ILC-CMdGdGbr.js} +1471 -1158
  378. package/dist/designer-dataset-controller-DdbY4ILC-CMdGdGbr.js.map +1 -0
  379. package/dist/{designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js → designer-field-primitives-Crn464Qg-Bi7q8s5J.js} +914 -345
  380. package/dist/designer-field-primitives-Crn464Qg-Bi7q8s5J.js.map +1 -0
  381. package/dist/designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js +1265 -0
  382. package/dist/designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js.map +1 -0
  383. package/dist/designer.js +5 -5
  384. package/dist/dist-B2bW2Tru.js +3305 -0
  385. package/dist/dist-B2bW2Tru.js.map +1 -0
  386. package/dist/{dist-BHTClwId.js → dist-CHK9BTXX.js} +9148 -6234
  387. package/dist/dist-CHK9BTXX.js.map +1 -0
  388. package/dist/engine.js +5 -4
  389. package/dist/fragment-B-oP0Fru.js +393 -0
  390. package/dist/fragment-B-oP0Fru.js.map +1 -0
  391. package/dist/host-kit.js +4172 -102
  392. package/dist/host-kit.js.map +1 -1
  393. package/dist/{host-resource-selection-5Cf_gclK-Sv4Z8UXS.js → host-resource-selection-CWrPLVOc-DPDq3jau.js} +1233 -937
  394. package/dist/host-resource-selection-CWrPLVOc-DPDq3jau.js.map +1 -0
  395. package/dist/host-tokens.css +12 -12
  396. package/dist/index.js +10 -10
  397. package/dist/legibility-CS28ivEz.js +12 -0
  398. package/dist/legibility-CS28ivEz.js.map +1 -0
  399. package/dist/level-scale-CwHqFEVd.js +139 -0
  400. package/dist/level-scale-CwHqFEVd.js.map +1 -0
  401. package/dist/{manager-B2CZ2b5I.js → manager-CeB4Jnr9.js} +20 -10
  402. package/dist/manager-CeB4Jnr9.js.map +1 -0
  403. package/dist/material-DeVkzSoT.js +12 -0
  404. package/dist/{material-BPlvEmDi.js.map → material-DeVkzSoT.js.map} +1 -1
  405. package/dist/material-auto-register.js +6 -6
  406. package/dist/material-auto-register.js.map +1 -1
  407. package/dist/{material-definition-B9xCZcD-.js → material-definition-BeW34dJr.js} +2 -2
  408. package/dist/{material-definition-B9xCZcD-.js.map → material-definition-BeW34dJr.js.map} +1 -1
  409. package/dist/{material-manifest-bsGl6vZZ.js → material-manifest-B1XatGPx.js} +222 -137
  410. package/dist/material-manifest-B1XatGPx.js.map +1 -0
  411. package/dist/material-schema-CLoDx-Tl.js +203 -0
  412. package/dist/material-schema-CLoDx-Tl.js.map +1 -0
  413. package/dist/{editor-descriptor-schema-Be30Wv8w.js → material-theme-C91eus78.js} +90 -28
  414. package/dist/material-theme-C91eus78.js.map +1 -0
  415. package/dist/material-validation-utils-ku_6Xxk2.js +125 -0
  416. package/dist/material-validation-utils-ku_6Xxk2.js.map +1 -0
  417. package/dist/material.js +3 -3
  418. package/dist/migrate-document-BM888PtC.js +768 -0
  419. package/dist/migrate-document-BM888PtC.js.map +1 -0
  420. package/dist/parse-Ji7kE9ZT.js +2313 -0
  421. package/dist/parse-Ji7kE9ZT.js.map +1 -0
  422. package/dist/{parse-B0hwp_yj.js → parse-aZat9tAS.js} +69 -61
  423. package/dist/{parse-B0hwp_yj.js.map → parse-aZat9tAS.js.map} +1 -1
  424. package/dist/parse-parts-qzl4suzk.js +42 -0
  425. package/dist/parse-parts-qzl4suzk.js.map +1 -0
  426. package/dist/{plugin-B9Xxtw7G.js → plugin-CstHQ5ws.js} +140 -94
  427. package/dist/plugin-CstHQ5ws.js.map +1 -0
  428. package/dist/plugin-core.js +93 -8
  429. package/dist/plugin-core.js.map +1 -0
  430. package/dist/plugin-manager.js +1 -1
  431. package/dist/plugin-package-DWifuHi1.js +4206 -0
  432. package/dist/plugin-package-DWifuHi1.js.map +1 -0
  433. package/dist/{plugin-registration-BjS_CXJU.js → plugin-registration-DTwBvnHX.js} +4 -4
  434. package/dist/{plugin-registration-BjS_CXJU.js.map → plugin-registration-DTwBvnHX.js.map} +1 -1
  435. package/dist/plugin-sdk.js +6 -6
  436. package/dist/{plugins-B9bwk-t6.js → plugins-QDL0yIql.js} +2 -2
  437. package/dist/{plugins-B9bwk-t6.js.map → plugins-QDL0yIql.js.map} +1 -1
  438. package/dist/plugins.js +8 -8
  439. package/dist/renderer.js +1 -1
  440. package/dist/runtime-dispatch-C0gyIrTv.js +479 -0
  441. package/dist/runtime-dispatch-C0gyIrTv.js.map +1 -0
  442. package/dist/runtime-simulate-aSYO9yDX.js +147 -0
  443. package/dist/runtime-simulate-aSYO9yDX.js.map +1 -0
  444. package/dist/{src-Bm7u11mN-BMeb9fvV.js → src-Bm7u11mN-Bi1hDVkh.js} +30 -30
  445. package/dist/{src-Bm7u11mN-BMeb9fvV.js.map → src-Bm7u11mN-Bi1hDVkh.js.map} +1 -1
  446. package/dist/state-preset-DtpygJOH.js +22 -0
  447. package/dist/state-preset-DtpygJOH.js.map +1 -0
  448. package/dist/{text-BVzTcUas.js → text-BSTz0pFQ.js} +454 -360
  449. package/dist/text-BSTz0pFQ.js.map +1 -0
  450. package/dist/theme-CcBXf4Ay.js +48 -0
  451. package/dist/theme-CcBXf4Ay.js.map +1 -0
  452. package/dist/{value-ref-y4_YKUP5.js → value-ref-XkLuckGV.js} +2 -2
  453. package/dist/{value-ref-y4_YKUP5.js.map → value-ref-XkLuckGV.js.map} +1 -1
  454. package/dist/{viewer-CrJupI8I-DZZfdHXr.js → viewer-CrJupI8I-BJiz1cvW.js} +5 -5
  455. package/dist/{viewer-CrJupI8I-DZZfdHXr.js.map → viewer-CrJupI8I-BJiz1cvW.js.map} +1 -1
  456. package/dist/viewer-auto-register.js +2 -2
  457. package/dist/viewer.js +2 -2
  458. package/dist/viewport-BNIRWjiT.js +1207 -0
  459. package/dist/viewport-BNIRWjiT.js.map +1 -0
  460. package/package.json +12 -12
  461. package/dist/_internal/contracts/document/blueprint-relations.d.ts +0 -16
  462. package/dist/_internal/contracts/document/blueprint-relations.js +0 -196
  463. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-panel-mutations.d.ts +0 -5
  464. package/dist/_internal/engine/browser/controllers/designer-guard-controller.d.ts +0 -27
  465. package/dist/_internal/engine/browser/controllers/designer-scene-controller.d.ts +0 -47
  466. package/dist/_internal/engine/browser/controllers/panel/designer-style-rules-controller.d.ts +0 -12
  467. package/dist/_internal/engine/browser/dom/guard/designer-contrast-measure.d.ts +0 -24
  468. package/dist/_internal/engine/browser/dom/guard/designer-guard-dom.d.ts +0 -15
  469. package/dist/_internal/engine/browser/dom/workspace/designer-canvas-hint-dom.d.ts +0 -6
  470. package/dist/_internal/engine/browser/viewport/designer-canvas-snap-index.d.ts +0 -9
  471. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-connection.d.ts +0 -14
  472. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-mutation-helpers.d.ts +0 -20
  473. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-mutations.d.ts +0 -15
  474. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-node-ids.d.ts +0 -12
  475. package/dist/_internal/engine/common/operations/designer-name-validation.d.ts +0 -2
  476. package/dist/_internal/engine/common/operations/scene/designer-scene.d.ts +0 -55
  477. package/dist/_internal/engine/common/operations/style/designer-host-conditional-style.d.ts +0 -21
  478. package/dist/_internal/engine/common/operations/style/designer-style-rules.d.ts +0 -25
  479. package/dist/_internal/engine/common/validation/designer-guard.d.ts +0 -49
  480. package/dist/_internal/engine/designer-blueprint-workbench-panel-C2MoZwKA.js +0 -3548
  481. package/dist/_internal/engine/designer-element/api/designer-element-guard.d.ts +0 -13
  482. package/dist/_internal/engine/designer-element/api/designer-element-scene.d.ts +0 -14
  483. package/dist/_internal/engine/designer-left-panel-groups-dom-WMsH33zw.js +0 -573
  484. package/dist/_internal/engine/host-resource-selection-5Cf_gclK.js +0 -2188
  485. package/dist/_internal/renderer/style-rules.d.ts +0 -9
  486. package/dist/contrast-CZFqj1I5.js +0 -1050
  487. package/dist/contrast-CZFqj1I5.js.map +0 -1
  488. package/dist/dataset-port-CUsMmX2x.js +0 -65
  489. package/dist/dataset-port-CUsMmX2x.js.map +0 -1
  490. package/dist/designer-Byw45cUM.js.map +0 -1
  491. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js +0 -3517
  492. package/dist/designer-blueprint-workbench-panel-C2MoZwKA-CbXkv78O.js.map +0 -1
  493. package/dist/designer-dataset-controller-CPytVNBK-DWL3SRTP.js.map +0 -1
  494. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js +0 -557
  495. package/dist/designer-left-panel-groups-dom-WMsH33zw-B9pl8loh.js.map +0 -1
  496. package/dist/designer-ui-primitives-CH4RNiMa-BNXQwJPZ.js.map +0 -1
  497. package/dist/dist-BHTClwId.js.map +0 -1
  498. package/dist/dist-DfAV2jGI.js +0 -2185
  499. package/dist/dist-DfAV2jGI.js.map +0 -1
  500. package/dist/editor-descriptor-schema-Be30Wv8w.js.map +0 -1
  501. package/dist/host-resource-selection-5Cf_gclK-Sv4Z8UXS.js.map +0 -1
  502. package/dist/manager-B2CZ2b5I.js.map +0 -1
  503. package/dist/material-BPlvEmDi.js +0 -12
  504. package/dist/material-manifest-bsGl6vZZ.js.map +0 -1
  505. package/dist/material-schema-CtxTkCP2.js +0 -267
  506. package/dist/material-schema-CtxTkCP2.js.map +0 -1
  507. package/dist/migrate-document-BJUN7NPv.js +0 -436
  508. package/dist/migrate-document-BJUN7NPv.js.map +0 -1
  509. package/dist/parse-BQw3u9_4.js +0 -1126
  510. package/dist/parse-BQw3u9_4.js.map +0 -1
  511. package/dist/plugin-B9Xxtw7G.js.map +0 -1
  512. package/dist/plugin-package-BT-pCoTt.js +0 -174
  513. package/dist/plugin-package-BT-pCoTt.js.map +0 -1
  514. package/dist/runtime-dispatch-Dt9fhcI5.js +0 -360
  515. package/dist/runtime-dispatch-Dt9fhcI5.js.map +0 -1
  516. package/dist/schema-C38FI_z2.js +0 -541
  517. package/dist/schema-C38FI_z2.js.map +0 -1
  518. package/dist/text-BVzTcUas.js.map +0 -1
@@ -1,3548 +0,0 @@
1
- import { _ as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, p as l, r as u, s as d, t as f, u as p, w as m, x as h } from "./designer-left-panel-groups-dom-WMsH33zw.js";
2
- import { _ as g, d as ee, h as _, i as v, m as te, n as y, s as ne, v as re, y as b } from "./designer-ui-primitives-CH4RNiMa.js";
3
- import { compileScreenBlueprint as ie, traceScreenBlueprintEvent as ae } from "@base-screen/core";
4
- import { MAX_VALUE_REF_PATH_SEGMENTS as oe, SCREEN_BLUEPRINT_CAPABILITIES as se, VALUE_REF_PATH_SEGMENT_PATTERN as ce, deriveScreenBlueprintRules as x, parseScreenDocument as S, parseScreenJsonValue as C, readScreenBlueprintRelationCategory as le, readScreenComponentValueRef as ue, readScreenDocumentDataSources as de, screenBlueprintEffectTargetKind as w } from "@base-screen/contracts";
5
- //#region src/common/operations/blueprint/designer-blueprint-node-ids.ts
6
- var T = "host";
7
- function E(e) {
8
- return `component:${e}`;
9
- }
10
- function fe(e) {
11
- return `variable:${e}`;
12
- }
13
- function pe(e, t) {
14
- if (!t.startsWith("component:")) return;
15
- let n = t.slice(10);
16
- return e.components.some((e) => e.id === n) ? n : void 0;
17
- }
18
- function me(e, t) {
19
- if (!t.startsWith("variable:")) return;
20
- let n = t.slice(9);
21
- return e.variables.some((e) => e.id === n) ? n : void 0;
22
- }
23
- //#endregion
24
- //#region src/common/operations/blueprint/designer-blueprint-mutation-helpers.ts
25
- function he(e, t, n) {
26
- return e.relations.some((e) => e.id === t) ? {
27
- ...e,
28
- relations: e.relations.map((e) => e.id === t ? n(e) : e)
29
- } : null;
30
- }
31
- function ge(e, t) {
32
- return {
33
- ...e,
34
- relations: e.relations.filter((e) => e.id !== t)
35
- };
36
- }
37
- function _e(e, t, n) {
38
- return he(e, t, (e) => e.type === "behavior" ? {
39
- ...e,
40
- condition: n
41
- } : e);
42
- }
43
- function ve(e, t) {
44
- return he(e, t, (e) => {
45
- if (e.type !== "behavior") return e;
46
- let { condition: t, ...n } = e;
47
- return n;
48
- });
49
- }
50
- function ye(e, t, n) {
51
- let r = e.relations.find((e) => e.id === t);
52
- return r === void 0 || r.type !== "behavior" || r.target.kind !== w(n) ? null : he(e, t, (e) => ({
53
- ...e,
54
- effect: n
55
- }));
56
- }
57
- function be(e, t, n) {
58
- let r = e.relations.find((e) => e.id === t);
59
- if (r === void 0 || r.type !== "behavior") return null;
60
- if (r.source.kind === "variable") {
61
- if (n !== "data-updated" && n !== "request-state") return null;
62
- let r = n;
63
- return he(e, t, (e) => e.type !== "behavior" || e.source.kind !== "variable" ? e : {
64
- ...e,
65
- source: {
66
- ...e.source,
67
- event: {
68
- type: "variable-event",
69
- eventName: r
70
- }
71
- }
72
- });
73
- }
74
- return he(e, t, (e) => e.type !== "behavior" || e.source.kind !== "component" ? e : {
75
- ...e,
76
- source: {
77
- ...e.source,
78
- event: {
79
- type: "material-event",
80
- eventName: n
81
- }
82
- }
83
- });
84
- }
85
- function D(e, t, n) {
86
- return he(e, t, (e) => e.type === "semantic" ? {
87
- ...e,
88
- role: n
89
- } : e);
90
- }
91
- function xe(e) {
92
- return e.startsWith("relation:") ? {
93
- kind: "relation",
94
- relationId: e.slice(9)
95
- } : e.startsWith("semantic:") ? {
96
- kind: "semantic",
97
- relationId: e.slice(9)
98
- } : null;
99
- }
100
- function Se(e, t) {
101
- return e.type === "semantic" ? e.source.componentId === t || e.target.componentId === t : e.source.kind === "component" && e.source.componentId === t || e.target.kind === "component" && e.target.componentId === t;
102
- }
103
- function Ce(e, t) {
104
- if (e.type === "semantic") return !1;
105
- if (e.source.kind === "variable" && e.source.variableId === t || e.target.kind === "variable" && e.target.variableId === t || e.condition !== void 0 && (De(e.condition.left).includes(t) || e.condition.right !== void 0 && De(e.condition.right).includes(t))) return !0;
106
- let n = e.effect;
107
- return n.type === "set-variable" ? De(n.value).includes(t) : n.type === "emit-host-event" || n.type === "host-action" ? De(n.payload).includes(t) : !1;
108
- }
109
- function we(e) {
110
- return e.type === "behavior" && e.target.kind === "host";
111
- }
112
- function O(e, t, n) {
113
- let r = e.layout?.nodes ?? [], i = ke(n) ? n : Oe(r);
114
- return {
115
- ...e,
116
- layout: {
117
- nodes: [...r.filter((e) => e.id !== t), {
118
- id: t,
119
- x: Ae(i.x),
120
- y: Ae(i.y)
121
- }],
122
- ...e.layout?.viewport === void 0 ? {} : { viewport: e.layout.viewport }
123
- }
124
- };
125
- }
126
- function Te(e, t) {
127
- if (e.layout === void 0) return e;
128
- let n = e.layout.nodes.filter((e) => !t.has(e.id));
129
- return {
130
- ...e,
131
- layout: {
132
- nodes: n,
133
- ...e.layout.viewport === void 0 ? {} : { viewport: e.layout.viewport }
134
- }
135
- };
136
- }
137
- function Ee(e, t) {
138
- let n = new Set(e.relations.map((e) => e.id)), r = t.toLowerCase().replace(/[^a-z0-9_-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 56) || "relation", i = 1, a = `${r}-${i}`;
139
- for (; n.has(a);) a = `${r}-${++i}`;
140
- return a;
141
- }
142
- function De(e) {
143
- return e.kind === "variable" ? [e.variableId] : e.kind === "array" ? e.items.flatMap(De) : e.kind === "object" ? Object.values(e.properties).flatMap(De) : [];
144
- }
145
- function Oe(e) {
146
- let t = e.length;
147
- return {
148
- x: 72 + t % 3 * 264,
149
- y: 72 + Math.floor(t / 3) * 224
150
- };
151
- }
152
- function ke(e) {
153
- return e !== void 0 && Number.isFinite(e.x) && Number.isFinite(e.y) && Math.abs(e.x) <= 1e6 && Math.abs(e.y) <= 1e6;
154
- }
155
- function Ae(e) {
156
- return Math.round(e * 100) / 100;
157
- }
158
- //#endregion
159
- //#region src/common/operations/blueprint/designer-blueprint-mutations.ts
160
- function je(e, t, n) {
161
- return e.components.some((e) => e.id === t) ? O(e.blueprint, E(t), n) : null;
162
- }
163
- function k(e, t, n) {
164
- return e.variables.some((e) => e.id === t) ? O(e.blueprint, fe(t), n) : null;
165
- }
166
- function Me(e, t) {
167
- return O(e, T, t);
168
- }
169
- function Ne(e, t) {
170
- if (t.kind === "edge") {
171
- let n = xe(t.id);
172
- return n === null ? null : ge(e, n.relationId);
173
- }
174
- if (t.id === "host") {
175
- let t = e;
176
- for (let n of e.relations) we(n) && (t = ge(t, n.id));
177
- return Te(t, /* @__PURE__ */ new Set([T]));
178
- }
179
- if (t.id.startsWith("component:")) {
180
- let n = t.id.slice(10), r = e;
181
- for (let t of e.relations) Se(t, n) && (r = ge(r, t.id));
182
- return Te(r, /* @__PURE__ */ new Set([t.id]));
183
- }
184
- if (t.id.startsWith("variable:")) {
185
- let n = t.id.slice(9), r = e;
186
- for (let t of e.relations) Ce(t, n) && (r = ge(r, t.id));
187
- return Te(r, /* @__PURE__ */ new Set([t.id]));
188
- }
189
- return null;
190
- }
191
- function Pe(e, t, n) {
192
- let r = n ?? e.layout?.viewport;
193
- return {
194
- ...e,
195
- layout: {
196
- nodes: t,
197
- ...r === void 0 ? {} : { viewport: r }
198
- }
199
- };
200
- }
201
- function Fe(e, t) {
202
- return e.layout === void 0 || e.layout.nodes.length === 0 ? e : {
203
- ...e,
204
- layout: {
205
- nodes: e.layout.nodes,
206
- viewport: t
207
- }
208
- };
209
- }
210
- function Ie(e, t, n) {
211
- return _e(e, t, n);
212
- }
213
- function Le(e, t) {
214
- return ve(e, t);
215
- }
216
- function Re(e, t, n) {
217
- return ye(e, t, n);
218
- }
219
- function ze(e, t, n) {
220
- return be(e, t, n);
221
- }
222
- function Be(e, t, n) {
223
- return D(e, t, n);
224
- }
225
- //#endregion
226
- //#region src/common/operations/blueprint/designer-blueprint-model.ts
227
- var Ve = 200, He = 264, A = 252, Ue = 196;
228
- function We(e, t, n) {
229
- let r = d(n, se.materialEvent);
230
- return e.components.flatMap((e) => {
231
- let i = t?.get(e.type)?.manifest, a = new Map((i?.editorDescriptor?.events ?? []).map((e) => [e.name, e]));
232
- return (i?.events ?? []).map((t) => {
233
- let i = a.get(t), o = i?.requiredCapability, s = i?.triggerContexts === void 0 || i.triggerContexts.includes("blueprint");
234
- return {
235
- componentId: e.id,
236
- componentName: e.name,
237
- materialType: e.type,
238
- name: t,
239
- label: i?.label ?? t,
240
- available: s && r && (o === void 0 || d(n, o)),
241
- ...o === void 0 ? {} : { requiredCapability: o }
242
- };
243
- });
244
- });
245
- }
246
- function j(e, t, n) {
247
- let r = new Map(e.blueprint.layout?.nodes.map((e) => [e.id, e])), i = We(e, t, n), a = /* @__PURE__ */ new Map();
248
- for (let e of i) {
249
- let t = a.get(e.componentId) ?? [];
250
- t.push(e), a.set(e.componentId, t);
251
- }
252
- let o = /* @__PURE__ */ new Map();
253
- for (let t of e.components) {
254
- if (t.parentId === null) continue;
255
- let e = o.get(t.parentId) ?? [];
256
- e.push(t.id), o.set(t.parentId, e);
257
- }
258
- let s = R(e), c = /* @__PURE__ */ new Map();
259
- return e.components.map((e) => {
260
- let t = s.get(e.id) ?? 0, n = c.get(t) ?? 0;
261
- c.set(t, n + 1);
262
- let i = o.get(e.id) ?? [];
263
- return Xe({
264
- id: E(e.id),
265
- kind: "component",
266
- x: 72 + t * He,
267
- y: 72 + n * A,
268
- componentId: e.id,
269
- componentName: e.name,
270
- materialType: e.type,
271
- hidden: e.status.hidden,
272
- ...e.parentId === null ? {} : { parentId: e.parentId },
273
- ...i.length === 0 ? {} : {
274
- childCount: i.length,
275
- isContainer: !0
276
- },
277
- events: a.get(e.id) ?? []
278
- }, r);
279
- });
280
- }
281
- function M(e) {
282
- let t = new Map(e.blueprint.layout?.nodes.map((e) => [e.id, e])), n = Math.max(0, ...R(e).values());
283
- return re(e).map((e, r) => Xe({
284
- id: fe(e.id),
285
- kind: "variable",
286
- x: 72 + (n + 1) * He,
287
- y: 72 + r * Ue,
288
- variableId: e.id,
289
- variableName: e.name,
290
- variableType: e.type,
291
- ...e.description === void 0 ? {} : { variableDescription: e.description },
292
- variableInitialValue: e.initialValue,
293
- events: [{
294
- name: "data-updated",
295
- label: "data-updated",
296
- available: !0
297
- }, {
298
- name: "request-state",
299
- label: "request-state",
300
- available: !0
301
- }]
302
- }, t));
303
- }
304
- function Ge(e, t, n) {
305
- let r = new Map(e.blueprint.layout?.nodes.map((e) => [e.id, e])), i = j(e, t, n), a = M(e), o = F(e), s = /* @__PURE__ */ new Set();
306
- for (let t of e.blueprint.relations) if (t.type === "behavior") {
307
- t.source.kind === "variable" && s.add(t.source.variableId), t.target.kind === "variable" && s.add(t.target.variableId);
308
- for (let e of Ye(t)) s.add(e);
309
- }
310
- let c = new Set(r.keys()), l = P(e, i, o, s, c), u = i.filter((e) => e.componentId !== void 0 && l.has(e.componentId)), d = new Set(u.map((e) => e.id)), f = new Set(s);
311
- for (let e of l) for (let t of o.get(e) ?? []) f.add(t);
312
- let p = a.filter((e) => {
313
- let t = e.variableId;
314
- return t === void 0 ? !1 : f.has(t) || c.has(e.id);
315
- });
316
- for (let e of p) d.add(e.id);
317
- let m = e.blueprint.relations.some((e) => e.type === "behavior" && e.target.kind === "host"), h = c.has(T), g = m || h ? Xe({
318
- id: T,
319
- kind: "host",
320
- x: 72 + (Math.max(0, ...R(e).values()) + 2) * He,
321
- y: 72
322
- }, r) : void 0;
323
- g !== void 0 && d.add(g.id);
324
- let ee = [
325
- ...u,
326
- ...p,
327
- ...g === void 0 ? [] : [g]
328
- ], _ = [];
329
- for (let t of e.blueprint.relations) Ke(_, d, t);
330
- for (let t of e.components) {
331
- if (!l.has(t.id) || t.parentId === null) continue;
332
- let e = E(t.parentId), n = E(t.id);
333
- !d.has(e) || !d.has(n) || _.push({
334
- id: `containment:${t.parentId}:${t.id}`,
335
- source: e,
336
- target: n,
337
- sourceHandle: "containment:out",
338
- targetHandle: "containment:in",
339
- kind: "containment",
340
- locked: !0,
341
- deletable: !1
342
- });
343
- }
344
- for (let [e, t] of o) {
345
- if (!l.has(e)) continue;
346
- let n = E(e);
347
- for (let r of t) {
348
- let t = fe(r);
349
- !d.has(t) || !d.has(n) || _.push({
350
- id: `dependency:read:${r}:${e}`,
351
- source: t,
352
- target: n,
353
- sourceHandle: "dependency:out",
354
- targetHandle: "dependency:in",
355
- kind: "dependency",
356
- locked: !0,
357
- deletable: !1
358
- });
359
- }
360
- }
361
- for (let t of e.blueprint.relations) {
362
- if (t.type !== "behavior" || t.condition === void 0) continue;
363
- let e = N(t);
364
- if (d.has(e)) for (let n of Ye(t)) {
365
- let r = fe(n);
366
- d.has(r) && _.push({
367
- id: `dependency:condition:${t.id}:${n}`,
368
- source: r,
369
- target: e,
370
- sourceHandle: "dependency:out",
371
- targetHandle: "dependency:in",
372
- kind: "dependency",
373
- locked: !0,
374
- deletable: !1,
375
- relationId: t.id
376
- });
377
- }
378
- }
379
- let v = Je(ee, _);
380
- return {
381
- nodes: ee.map((e) => {
382
- let t = v.get(e.id);
383
- return t === void 0 ? e : {
384
- ...e,
385
- inboundCount: t.inbound,
386
- outboundCount: t.outbound,
387
- relationCount: t.inbound + t.outbound,
388
- ...e.kind === "variable" ? {
389
- readCount: t.read,
390
- writeCount: t.write
391
- } : e.kind === "host" ? { exitCount: t.exit } : {}
392
- };
393
- }),
394
- edges: _,
395
- ...e.blueprint.layout?.viewport === void 0 ? {} : { viewport: e.blueprint.layout.viewport }
396
- };
397
- }
398
- function Ke(e, t, n) {
399
- let r = qe(n), i = N(n);
400
- if (!t.has(r) || !t.has(i)) return;
401
- if (n.type === "semantic") {
402
- e.push({
403
- id: `semantic:${n.id}`,
404
- source: r,
405
- target: i,
406
- sourceHandle: "semantic:out",
407
- targetHandle: "relation:in",
408
- kind: "semantic",
409
- relationId: n.id,
410
- relationKind: "semantic",
411
- semanticRole: n.role,
412
- deletable: !0
413
- });
414
- return;
415
- }
416
- let a = n.effect;
417
- e.push({
418
- id: `relation:${n.id}`,
419
- source: r,
420
- target: i,
421
- sourceHandle: `event:${n.source.event.eventName}`,
422
- targetHandle: "relation:in",
423
- kind: "relation",
424
- relationId: n.id,
425
- relationKind: "behavior",
426
- effectType: a.type,
427
- eventName: n.source.event.eventName,
428
- ...a.type === "component-visibility" ? { operation: a.operation } : {},
429
- ...a.type === "host-action" ? { actionId: a.actionId } : {},
430
- ...n.target.kind === "variable" ? { variableId: n.target.variableId } : {},
431
- deletable: !0
432
- });
433
- }
434
- function qe(e) {
435
- return e.type === "semantic" || e.source.kind === "component" ? E(e.source.componentId) : fe(e.source.variableId);
436
- }
437
- function N(e) {
438
- if (e.type === "semantic") return E(e.target.componentId);
439
- let t = e.target;
440
- return t.kind === "component" ? E(t.componentId) : t.kind === "variable" ? fe(t.variableId) : T;
441
- }
442
- function Je(e, t) {
443
- let n = /* @__PURE__ */ new Map();
444
- for (let t of e) n.set(t.id, {
445
- inbound: 0,
446
- outbound: 0,
447
- read: 0,
448
- write: 0,
449
- exit: 0
450
- });
451
- for (let e of t) {
452
- let t = n.get(e.source), r = n.get(e.target);
453
- if (t !== void 0) {
454
- let r = {
455
- ...t,
456
- outbound: t.outbound + 1
457
- };
458
- n.set(e.source, {
459
- ...r,
460
- ...e.kind === "dependency" ? { read: r.read + 1 } : {}
461
- });
462
- }
463
- if (r !== void 0) {
464
- let t = {
465
- ...r,
466
- inbound: r.inbound + 1
467
- }, i = e.kind === "relation" && (e.effectType === "set-variable" || e.effectType === "request-variable"), a = e.kind === "relation" && (e.effectType === "emit-host-event" || e.effectType === "host-action");
468
- n.set(e.target, {
469
- ...t,
470
- ...i ? { write: t.write + 1 } : {},
471
- ...a ? { exit: t.exit + 1 } : {}
472
- });
473
- }
474
- }
475
- return n;
476
- }
477
- function P(e, t, n, r, i) {
478
- if (e.components.length <= Ve) return new Set(e.components.map((e) => e.id));
479
- let a = /* @__PURE__ */ new Set(), o = new Map(e.components.map((e) => [e.id, e]));
480
- for (let t of e.blueprint.relations) t.type === "semantic" ? (a.add(t.source.componentId), a.add(t.target.componentId)) : (t.source.kind === "component" && a.add(t.source.componentId), t.target.kind === "component" && a.add(t.target.componentId));
481
- for (let e of t) e.componentId !== void 0 && i.has(e.id) && a.add(e.componentId);
482
- for (let [e, t] of n) t.some((e) => r.has(e)) && a.add(e);
483
- let s = (t) => {
484
- let n = o.get(t);
485
- if (!(n === void 0 || a.has(n.id))) {
486
- a.add(n.id), n.parentId !== null && s(n.parentId);
487
- for (let t of e.components) t.parentId === n.id && s(t.id);
488
- }
489
- };
490
- for (let e of [...a]) s(e);
491
- return a;
492
- }
493
- function F(e) {
494
- let t = new Map(de(e).map((e) => [e.id, e])), n = /* @__PURE__ */ new Map();
495
- for (let r of e.components) {
496
- let e = /* @__PURE__ */ new Set(), i = ue(r);
497
- i !== null && I(i, t, e), n.set(r.id, [...e]);
498
- }
499
- return n;
500
- }
501
- function I(e, t, n) {
502
- if (e.kind === "variable") {
503
- n.add(e.variableId);
504
- return;
505
- }
506
- if (e.kind !== "data-source-field") return;
507
- let r = t.get(e.dataSourceId);
508
- if (r !== void 0) for (let e of Object.values(r.params)) e.kind === "variable" && n.add(e.variableId);
509
- }
510
- function Ye(e) {
511
- if (e.condition === void 0) return [];
512
- let t = /* @__PURE__ */ new Set();
513
- return L(e.condition.left, t), e.condition.right !== void 0 && L(e.condition.right, t), [...t];
514
- }
515
- function L(e, t) {
516
- if (e.kind === "variable") t.add(e.variableId);
517
- else if (e.kind === "array") for (let n of e.items) L(n, t);
518
- else if (e.kind === "object") for (let n of Object.values(e.properties)) L(n, t);
519
- }
520
- function R(e) {
521
- let t = new Map(e.components.map((e) => [e.id, e])), n = /* @__PURE__ */ new Map();
522
- for (let r of e.components) {
523
- let e = 0, i = r.parentId, a = /* @__PURE__ */ new Set([r.id]);
524
- for (; i !== null && !a.has(i);) a.add(i), e += 1, i = t.get(i)?.parentId ?? null;
525
- n.set(r.id, e);
526
- }
527
- return n;
528
- }
529
- function Xe(e, t) {
530
- let n = t.get(e.id);
531
- return n === void 0 ? e : {
532
- ...e,
533
- x: n.x,
534
- y: n.y,
535
- ...n.collapsed === !0 ? { collapsed: !0 } : {}
536
- };
537
- }
538
- //#endregion
539
- //#region src/browser/dom/blueprint/designer-blueprint-default-canvas.ts
540
- var Ze = 208, Qe = 28, $e = 40, et = 32, tt = 8, nt = 96, z = 72, rt = 256, it = 8, at = 150, ot = 48, st = .1, ct = 2, lt = [
541
- .1,
542
- .2,
543
- .3,
544
- .4,
545
- .5,
546
- .6,
547
- .7,
548
- .84,
549
- 1,
550
- 1.25,
551
- 1.5,
552
- 2
553
- ], ut = "http://www.w3.org/2000/svg", dt = .62, ft = 2, B = b.blueprint.canvasSurface, V = b.blueprint;
554
- function pt(e) {
555
- let t = e.defaultView, n = e.createElement("div");
556
- n.className = "designer-blueprint-canvas", n.dataset.designerBlueprintCanvas = "true";
557
- let r = e.createElement("div");
558
- r.className = "designer-blueprint-canvas-bar", r.setAttribute("role", "toolbar"), r.setAttribute("aria-label", B.toolbar);
559
- let a = e.createElement("span");
560
- a.className = "designer-blueprint-canvas-menu-anchor";
561
- let o = Et(e, "plus", B.addNode, "add-node");
562
- o.setAttribute("aria-haspopup", "menu"), o.setAttribute("aria-expanded", "false");
563
- let c = e.createElement("span");
564
- c.className = "designer-blueprint-canvas-bar-chevron", c.setAttribute("aria-hidden", "true"), c.innerHTML = _("arrow-down"), o.append(c);
565
- let u = e.createElement("div");
566
- u.className = "designer-blueprint-canvas-menu", u.dataset.canvasMenu = "add-node", u.setAttribute("role", "menu"), u.setAttribute("aria-label", B.addNodeMenu), u.hidden = !0;
567
- for (let [t, n] of [["host", V.relationList.addHost]]) {
568
- let r = y(e, {
569
- className: "designer-blueprint-canvas-menu-item",
570
- text: n,
571
- variant: "canvas-tool"
572
- });
573
- r.dataset.canvasInsert = t, r.setAttribute("role", "menuitem"), u.append(r);
574
- }
575
- a.append(o, u);
576
- let d = Et(e, "grid", V.autoLayout, "auto-layout"), f = y(e, {
577
- className: "designer-blueprint-canvas-problems-button",
578
- variant: "canvas-tool"
579
- });
580
- f.dataset.canvasAction = "problems", f.dataset.state = "ok", f.setAttribute("aria-haspopup", "dialog"), f.setAttribute("aria-expanded", "false");
581
- let p = e.createElement("span");
582
- p.className = "designer-blueprint-canvas-problems-dot", p.setAttribute("aria-hidden", "true");
583
- let m = e.createElement("span");
584
- m.className = "designer-blueprint-canvas-bar-label", m.dataset.canvasProblemsLabel = "true", f.append(p, m);
585
- let h = Et(e, "activity", B.traceToggle, "trace");
586
- h.setAttribute("aria-pressed", "true");
587
- let g = e.createElement("span");
588
- g.className = "designer-blueprint-canvas-bar-spacer";
589
- let re = e.createElement("span");
590
- re.className = "designer-blueprint-canvas-bar-separator", re.setAttribute("aria-hidden", "true");
591
- let b = e.createElement("span");
592
- b.className = "designer-blueprint-canvas-bar-separator", b.setAttribute("aria-hidden", "true");
593
- let ie = Dt(e, "minus", B.zoomOut, "zoom-out"), ae = e.createElement("span");
594
- ae.className = "designer-blueprint-canvas-zoom", ae.dataset.canvasZoom = "true", ae.setAttribute("role", "status");
595
- let oe = Dt(e, "plus", B.zoomIn, "zoom-in"), se = Dt(e, "fit", V.fit, "fit"), ce = Et(e, "play", B.simulatePanel, "simulate");
596
- ce.setAttribute("aria-expanded", "false"), r.append(a, d, f, h, g, re, ie, ae, oe, se, b, ce);
597
- let x = e.createElement("div");
598
- x.className = "designer-blueprint-canvas-problems", x.dataset.canvasProblems = "true", x.setAttribute("role", "dialog"), x.setAttribute("aria-label", V.problemsTitle), x.hidden = !0;
599
- let S = e.createElement("div");
600
- S.className = "designer-blueprint-canvas-viewport", S.dataset.canvasViewport = "true", S.tabIndex = 0;
601
- let C = e.createElement("div");
602
- C.className = "designer-blueprint-canvas-layers", C.style.setProperty("zoom", String(ft));
603
- let le = e.createElementNS(ut, "svg");
604
- le.classList.add("designer-blueprint-canvas-edges");
605
- let ue = e.createElement("div");
606
- ue.className = "designer-blueprint-canvas-edge-labels", C.append(le, ue);
607
- let de = e.createElementNS(ut, "svg");
608
- de.classList.add("designer-blueprint-canvas-overlay");
609
- let w = e.createElementNS(ut, "path");
610
- w.classList.add("designer-blueprint-canvas-link-preview"), w.setAttribute("visibility", "hidden"), de.append(w);
611
- let T = e.createElement("div");
612
- T.className = "designer-blueprint-canvas-marquee", T.hidden = !0;
613
- let E = e.createElement("section");
614
- E.className = "designer-blueprint-canvas-empty", E.dataset.canvasEmpty = "true", E.hidden = !0;
615
- let fe = e.createElement("h3");
616
- fe.textContent = B.emptyTitle;
617
- let pe = e.createElement("p");
618
- pe.textContent = B.emptyDescription;
619
- let me = e.createElement("ol");
620
- for (let t of [
621
- B.emptyStepTrigger,
622
- B.emptyStepConnect,
623
- B.emptyStepExit
624
- ]) {
625
- let n = e.createElement("li");
626
- n.textContent = t, me.append(n);
627
- }
628
- let he = e.createElement("div");
629
- he.className = "designer-blueprint-canvas-empty-actions";
630
- let ge = y(e, {
631
- className: "designer-blueprint-canvas-empty-primary",
632
- text: V.relationList.addHost,
633
- variant: "primary"
634
- });
635
- ge.dataset.canvasInsert = "host";
636
- let _e = e.createElement("span");
637
- _e.className = "designer-blueprint-canvas-empty-hint", _e.textContent = B.emptyLibraryHint, he.append(ge, _e), E.append(fe, pe, me, he);
638
- let ve = e.createElement("div");
639
- ve.className = "designer-blueprint-canvas-no-events", ve.dataset.canvasNoEvents = "true", ve.hidden = !0, ve.setAttribute("role", "status");
640
- let ye = e.createElement("strong");
641
- ye.textContent = B.noEventsTitle;
642
- let be = e.createElement("span");
643
- be.textContent = B.noEventsBody, ve.append(ye, be);
644
- let D = e.createElement("div");
645
- D.className = "designer-blueprint-canvas-status", D.dataset.canvasStatus = "true", D.setAttribute("role", "status"), D.setAttribute("aria-live", "polite"), D.hidden = !0;
646
- let xe = e.createElement("div");
647
- xe.className = "designer-blueprint-canvas-simulation-bar", xe.dataset.canvasSimulationBar = "true";
648
- let Se = e.createElement("span");
649
- Se.className = "designer-blueprint-canvas-simulation-bar-icon", Se.setAttribute("aria-hidden", "true"), Se.innerHTML = _("play");
650
- let Ce = e.createElement("span");
651
- Ce.className = "designer-blueprint-canvas-simulation-bar-label";
652
- let we = Et(e, "arrow-up", B.expandSimulation, "simulation-expand");
653
- we.dataset.density = "tight", xe.append(Se, Ce, we);
654
- let O = e.createElement("section");
655
- O.className = "designer-blueprint-canvas-simulation", O.dataset.canvasSimulation = "true", O.hidden = !0, O.setAttribute("aria-label", V.simulate);
656
- let Te = e.createElement("header");
657
- Te.className = "designer-blueprint-canvas-simulation-header";
658
- let Ee = e.createElement("strong");
659
- Ee.textContent = B.simulationTitle;
660
- let De = Ot(e, "close", B.collapseSimulation, "simulation-close");
661
- Te.append(Ee, De);
662
- let Oe = e.createElement("div");
663
- Oe.className = "designer-blueprint-canvas-simulation-content";
664
- let ke = e.createElement("div");
665
- ke.className = "designer-blueprint-canvas-simulation-controls";
666
- let Ae = e.createElement("div");
667
- Ae.className = "designer-blueprint-canvas-simulation-field";
668
- let je = e.createElement("span");
669
- je.textContent = B.simulationEventLabel;
670
- let k = ne(e, {
671
- ariaLabel: B.simulationEventLabel,
672
- className: "designer-blueprint-canvas-simulation-select"
673
- });
674
- k.dataset.canvasSimulationEvent = "true";
675
- let Me = te(k);
676
- Me.trigger.dataset.density = "compact", Ae.append(je, Me.element);
677
- let Ne = e.createElement("label");
678
- Ne.className = "designer-blueprint-canvas-simulation-field";
679
- let Pe = e.createElement("span");
680
- Pe.textContent = B.simulationPayloadLabel;
681
- let Fe = ee(e, {
682
- ariaLabel: B.simulationPayloadAria,
683
- className: "designer-blueprint-canvas-simulation-payload",
684
- value: "{}"
685
- });
686
- Fe.dataset.canvasSimulationPayload = "true", Fe.spellcheck = !1, Ne.append(Pe, Fe);
687
- let Ie = e.createElement("div");
688
- Ie.className = "designer-blueprint-canvas-simulation-footer";
689
- let Le = e.createElement("span");
690
- Le.className = "designer-blueprint-canvas-simulation-status", Le.dataset.canvasSimulationStatus = "true", Le.setAttribute("role", "status");
691
- let Re = y(e, {
692
- className: "designer-blueprint-canvas-simulation-run",
693
- text: B.simulationRun,
694
- variant: "primary"
695
- });
696
- Re.dataset.canvasAction = "simulation-run", Ie.append(Le, Re), ke.append(Ae, Ne, Ie);
697
- let ze = e.createElement("div");
698
- ze.className = "designer-blueprint-canvas-simulation-trace";
699
- let Be = e.createElement("h4");
700
- Be.textContent = B.simulationTraceTitle;
701
- let Ve = e.createElement("ol");
702
- Ve.dataset.canvasTrace = "true";
703
- let He = e.createElement("p");
704
- He.className = "designer-blueprint-canvas-simulation-trace-empty", He.textContent = B.simulationNoTrace, ze.append(Be, Ve, He), Oe.append(ke, ze), O.append(Te, Oe), S.append(C, de, T, E, ve, x, xe, O, D), n.append(r, S);
705
- let A = null, Ue = -1, We = !1, j = /* @__PURE__ */ new Map(), M = {
706
- x: 0,
707
- y: 0,
708
- zoom: 1
709
- }, Ge = "", Ke = "", qe = !1, N, Je, P = null, F = null, I = null, Ye = !1, L = null, R = null, Xe = 0, pt, ht = !1, gt = !1, _t = /* @__PURE__ */ new Map(), vt = !1, yt = !1, bt = !1, xt = !0, H = !1, St = !1, U = !1, Ct = "", wt = !1, Tt = typeof t?.ResizeObserver == "function" ? new t.ResizeObserver(() => {
710
- vt && Gn();
711
- }) : void 0;
712
- Tt?.observe(S);
713
- function Et(e, t, n, r) {
714
- let i = y(e, {
715
- ariaLabel: n,
716
- className: "designer-blueprint-canvas-bar-button",
717
- tip: n,
718
- variant: "canvas-tool"
719
- });
720
- i.dataset.canvasAction = r, i.insertAdjacentHTML("afterbegin", _(t));
721
- let a = e.createElement("span");
722
- return a.className = "designer-blueprint-canvas-bar-label", a.textContent = n, i.append(a), i;
723
- }
724
- function Dt(e, t, n, r) {
725
- let i = v(e, {
726
- className: "designer-blueprint-canvas-bar-button",
727
- icon: t,
728
- label: n,
729
- variant: "canvas-tool"
730
- });
731
- return i.dataset.canvasAction = r, i;
732
- }
733
- function Ot(e, t, n, r) {
734
- let i = v(e, {
735
- className: "designer-blueprint-canvas-panel-icon",
736
- icon: t,
737
- label: n
738
- });
739
- return i.dataset.canvasAction = r, i;
740
- }
741
- function W() {
742
- return A?.graph ?? null;
743
- }
744
- function G(e) {
745
- let t = tn(e) === "" ? 0 : et;
746
- if (e.kind === "component" || e.kind === "variable") {
747
- let n = 65 + (e.kind === "variable" ? $e : 0), r = e.events ?? [], i = Math.max(1, r.length), a = r.map((e, t) => ({
748
- handle: `event:${e.name}`,
749
- label: e.label === "" ? e.name : e.label,
750
- y: n + t * Qe + Qe / 2,
751
- available: e.available,
752
- ...e.requiredCapability === void 0 ? {} : { requiredCapability: e.requiredCapability }
753
- })), o = i;
754
- e.kind === "component" && (a.push({
755
- handle: "semantic:out",
756
- label: V.relationCategories.semantic,
757
- y: n + o * Qe + Qe / 2,
758
- available: !0,
759
- semantic: !0
760
- }), o += 1, e.isContainer === !0 && (a.push({
761
- handle: "containment:out",
762
- label: V.relationList.containment,
763
- y: n + o * Qe + Qe / 2,
764
- available: !0,
765
- containment: !0
766
- }), o += 1));
767
- let s = n + o * Qe + (t === 0 ? tt : t);
768
- return {
769
- width: Ze,
770
- height: s,
771
- portStart: n,
772
- inputY: s / 2,
773
- inputHandle: "relation:in",
774
- outputs: a,
775
- dependency: e.kind === "variable"
776
- };
777
- }
778
- let n = nt;
779
- return {
780
- width: Ze,
781
- height: n,
782
- portStart: 65,
783
- inputY: n / 2,
784
- inputHandle: "relation:in",
785
- outputs: [],
786
- dependency: !1
787
- };
788
- }
789
- function K(e) {
790
- return j.get(e.id) ?? {
791
- x: e.x,
792
- y: e.y
793
- };
794
- }
795
- function kt(e) {
796
- return Math.round(e / it) * it;
797
- }
798
- function At(e, t) {
799
- let n = G(e);
800
- return n.outputs.find((e) => e.handle === t)?.y ?? n.height / 2;
801
- }
802
- function jt(e) {
803
- return G(e).inputY;
804
- }
805
- function Mt(e) {
806
- return W()?.nodes.find((t) => t.id === e);
807
- }
808
- function q(e) {
809
- if (A === null) return;
810
- Xe += 1;
811
- let t = {
812
- ...e,
813
- commandId: `designer-blueprint-${Date.now()}-${Xe}`,
814
- generation: A.generation,
815
- documentRevision: A.documentRevision
816
- };
817
- return n.dispatchEvent(new CustomEvent(l, {
818
- bubbles: !0,
819
- composed: !0,
820
- detail: { command: t }
821
- })), t;
822
- }
823
- function J(e, t = "info") {
824
- D.textContent = e, D.dataset.tone = t, D.hidden = !1, Je !== void 0 && clearTimeout(Je), Je = setTimeout(() => {
825
- D.hidden = !0, Je = void 0;
826
- }, 3200);
827
- }
828
- function Nt(e) {
829
- return `${e.x.toFixed(1)}:${e.y.toFixed(1)}:${e.zoom.toFixed(3)}`;
830
- }
831
- function Y() {
832
- let e = M.zoom / ft;
833
- C.style.transform = `translate(${M.x / ft}px, ${M.y / ft}px) scale(${e})`, S.dataset.zoomFar = String(M.zoom < dt);
834
- let t = Math.round(M.zoom * 100);
835
- ae.textContent = B.zoomValue(t), ae.setAttribute("aria-label", B.zoomAria(t));
836
- }
837
- function Pt() {
838
- qe = !0, N !== void 0 && clearTimeout(N), N = setTimeout(() => {
839
- N = void 0, Ft();
840
- }, 280);
841
- }
842
- function Ft() {
843
- if (N !== void 0 && clearTimeout(N), N = void 0, qe = !1, ht) return;
844
- let e = {
845
- x: Math.round(M.x),
846
- y: Math.round(M.y),
847
- zoom: Math.round(M.zoom * 1e3) / 1e3
848
- };
849
- Ge = Nt(e), q({
850
- type: "commit-viewport",
851
- viewport: e
852
- });
853
- }
854
- function It(e) {
855
- if (e === void 0) return;
856
- let t = Nt(e);
857
- if (t !== Ke && !(qe || P !== null || F !== null || L !== null)) {
858
- if (t !== Nt(M) && t !== Ge) {
859
- M = {
860
- x: e.x,
861
- y: e.y,
862
- zoom: e.zoom
863
- }, Ke = t, Y();
864
- return;
865
- }
866
- Ke = t;
867
- }
868
- }
869
- function Lt(e, t) {
870
- let n = S.getBoundingClientRect();
871
- return {
872
- x: (e - n.left - M.x) / M.zoom,
873
- y: (t - n.top - M.y) / M.zoom
874
- };
875
- }
876
- function Rt(e) {
877
- let t = Mt(e.source), n = Mt(e.target);
878
- if (t === void 0 || n === void 0) return null;
879
- let r = G(t), i = K(t), a = K(n), o = i.x + r.width, s = i.y + At(t, e.sourceHandle), c = a.x, l = a.y + jt(n), u = Math.max(i.y + r.height, a.y + G(n).height), d = zt(e.id, o, s, c, l, u);
880
- return {
881
- path: Bt(d, 12),
882
- start: d[0],
883
- end: d[d.length - 1],
884
- beforeEnd: d[d.length - 2],
885
- label: Wt(d, e.id)
886
- };
887
- }
888
- function zt(e, t, n, r, i, a) {
889
- let o = r - t, s = Ut(e);
890
- if (o >= 48) {
891
- let e = s % 4 * 6, a = Math.min(r - 16, t + Math.min(120, Math.max(28, o * .42)) + e);
892
- return [
893
- {
894
- x: t,
895
- y: n
896
- },
897
- {
898
- x: a,
899
- y: n
900
- },
901
- {
902
- x: a,
903
- y: i
904
- },
905
- {
906
- x: r,
907
- y: i
908
- }
909
- ];
910
- }
911
- let c = a + 28 + s % 4 * 14;
912
- return [
913
- {
914
- x: t,
915
- y: n
916
- },
917
- {
918
- x: t + 24,
919
- y: n
920
- },
921
- {
922
- x: t + 24,
923
- y: c
924
- },
925
- {
926
- x: r - 24,
927
- y: c
928
- },
929
- {
930
- x: r - 24,
931
- y: i
932
- },
933
- {
934
- x: r,
935
- y: i
936
- }
937
- ];
938
- }
939
- function Bt(e, t) {
940
- let n = e[0], r = `M ${n.x} ${n.y}`;
941
- for (let n = 1; n < e.length - 1; n += 1) {
942
- let i = e[n - 1], a = e[n], o = e[n + 1], s = Ht(i, a), c = Ht(a, o), l = Math.min(t, s / 2, c / 2), u = l === 0 ? a : {
943
- x: a.x - (a.x - i.x) / s * l,
944
- y: a.y - (a.y - i.y) / s * l
945
- }, d = l === 0 ? a : {
946
- x: a.x + (o.x - a.x) / c * l,
947
- y: a.y + (o.y - a.y) / c * l
948
- };
949
- r += ` L ${u.x} ${u.y} Q ${a.x} ${a.y} ${d.x} ${d.y}`;
950
- }
951
- let i = e[e.length - 1];
952
- return `${r} L ${i.x} ${i.y}`;
953
- }
954
- function Vt(e, t) {
955
- let n = Math.atan2(e.y - t.y, e.x - t.x), r = 3.4, i = {
956
- x: e.x - 7 * Math.cos(n) + r * Math.sin(n),
957
- y: e.y - 7 * Math.sin(n) - r * Math.cos(n)
958
- }, a = {
959
- x: e.x - 7 * Math.cos(n) - r * Math.sin(n),
960
- y: e.y - 7 * Math.sin(n) + r * Math.cos(n)
961
- };
962
- return `M ${e.x} ${e.y} L ${i.x} ${i.y} L ${a.x} ${a.y} Z`;
963
- }
964
- function Ht(e, t) {
965
- return Math.hypot(t.x - e.x, t.y - e.y);
966
- }
967
- function Ut(e) {
968
- let t = 0;
969
- for (let n = 0; n < e.length; n += 1) t = t * 31 + e.charCodeAt(n) >>> 0;
970
- return t;
971
- }
972
- function Wt(e, t) {
973
- let n = Ut(t);
974
- if (e.length < 3) {
975
- let t = e[0], r = e[e.length - 1];
976
- return {
977
- x: (t.x + r.x) / 2,
978
- y: (t.y + r.y) / 2 - 12 - n % 4 * 3
979
- };
980
- }
981
- if (e.length === 4) {
982
- let t = e[0], r = e[1], i = e[2], a = e[3];
983
- return Math.abs(r.x - t.x) >= Math.abs(a.x - i.x) ? {
984
- x: (t.x + r.x) / 2,
985
- y: t.y - 11 - n % 4 * 3
986
- } : {
987
- x: (i.x + a.x) / 2,
988
- y: a.y - 11 - n % 4 * 3
989
- };
990
- }
991
- let r = e[0], i = e[2], a = e[e.length - 1];
992
- return {
993
- x: (r.x + a.x) / 2,
994
- y: i.y + 12 + n % 3 * 3
995
- };
996
- }
997
- function Gt(e) {
998
- return e.kind === "dependency" ? "eye" : e.kind === "semantic" ? "link" : e.kind === "containment" ? "group" : "activity";
999
- }
1000
- function Kt(e) {
1001
- if (e.kind === "dependency") {
1002
- let t = Mt(e.source);
1003
- return B.edgeDependency(t?.variableName ?? t?.variableId ?? "");
1004
- }
1005
- return e.kind === "containment" ? V.relationList.containment : e.kind === "semantic" ? V.semanticRoles[e.semanticRole ?? "related"] : e.kind === "relation" ? e.effectType === "component-visibility" ? `${e.eventName ?? ""} · ${V.visibilityOperation[e.operation ?? "toggle"]}` : e.effectType === "set-variable" ? V.setVariableAction(e.variableId ?? "") : e.effectType === "request-variable" ? `${V.relationEffects["request-variable"]} ${e.variableId ?? ""}` : e.effectType === "request-component-data" ? `${e.eventName ?? ""} · ${V.relationEffects["request-component-data"]}` : e.effectType === "emit-host-event" ? `${V.relationEffects["emit-host-event"]} ${e.eventName ?? ""}` : e.effectType === "host-action" ? `${V.relationEffects["host-action"]} ${e.actionId ?? ""}` : e.eventName ?? "" : e.operation === void 0 ? e.sourceHandle.startsWith("event:") ? e.sourceHandle.slice(6) : "true" : V.visibilityOperation[e.operation];
1006
- }
1007
- function X(e) {
1008
- let t = 28;
1009
- for (let n of e) t += /[\x00-\x7f]/.test(n) ? 6 : 10;
1010
- return Math.min(168, t);
1011
- }
1012
- function Z(e, t, n) {
1013
- let r = X(t) / 2;
1014
- return [
1015
- e,
1016
- {
1017
- x: e.x,
1018
- y: e.y - 24
1019
- },
1020
- {
1021
- x: e.x,
1022
- y: e.y - 46
1023
- },
1024
- {
1025
- x: e.x,
1026
- y: e.y + 24
1027
- },
1028
- {
1029
- x: e.x,
1030
- y: e.y + 46
1031
- },
1032
- {
1033
- x: e.x - 72,
1034
- y: e.y
1035
- },
1036
- {
1037
- x: e.x + 72,
1038
- y: e.y
1039
- },
1040
- {
1041
- x: e.x - 72,
1042
- y: e.y - 24
1043
- },
1044
- {
1045
- x: e.x + 72,
1046
- y: e.y - 24
1047
- }
1048
- ].find((e) => !n.some((t) => e.x - r < t.right + 2 && e.x + r > t.left - 2 && e.y - 11 < t.bottom + 2 && e.y + 11 > t.top - 2)) ?? e;
1049
- }
1050
- function qt() {
1051
- let t = W();
1052
- if (le.replaceChildren(), ue.replaceChildren(), t === null) return;
1053
- let n = new Set(xt ? A?.trace?.executedEdgeIds ?? [] : []), r = new Set(xt ? A?.trace?.failedRelationIds ?? [] : []), i = n.size > 0, a = [], o = t.nodes.map((e) => {
1054
- let t = G(e), n = K(e);
1055
- return {
1056
- left: n.x,
1057
- top: n.y,
1058
- right: n.x + t.width,
1059
- bottom: n.y + t.height
1060
- };
1061
- });
1062
- for (let s of t.edges) {
1063
- let t = Rt(s);
1064
- if (t === null) continue;
1065
- let c = A?.selection?.kind === "edge" && A.selection.id === s.id, l = e.createElementNS(ut, "g");
1066
- l.classList.add("designer-blueprint-canvas-edge-group"), l.dataset.kind = s.kind, i && n.has(s.id) && (l.dataset.traced = "true"), i && s.relationId !== void 0 && r.has(s.relationId) && (l.dataset.failed = "true"), c && (l.dataset.selected = "true");
1067
- let u = e.createElementNS(ut, "path");
1068
- u.classList.add("designer-blueprint-canvas-edge-line"), u.setAttribute("d", t.path), l.append(u);
1069
- let d = e.createElementNS(ut, "g");
1070
- if (d.classList.add("designer-blueprint-canvas-edge-caps"), s.kind === "semantic") d.append(Jt(t.start, 2.6), Jt(t.end, 2.6));
1071
- else if (s.kind === "dependency") d.append(Jt(t.end, 2.6));
1072
- else if (s.kind === "relation") {
1073
- let n = e.createElementNS(ut, "path");
1074
- n.setAttribute("d", Vt(t.end, t.beforeEnd)), d.append(n);
1075
- }
1076
- l.append(d);
1077
- let f = e.createElementNS(ut, "path");
1078
- f.classList.add("designer-blueprint-canvas-edge-hit"), f.setAttribute("d", t.path), f.dataset.edgeId = s.id, f.setAttribute("tabindex", "0"), f.setAttribute("role", "button");
1079
- let p = Kt(s);
1080
- if (f.setAttribute("aria-label", B.edgeAria(p)), f.addEventListener("pointerdown", (e) => {
1081
- e.stopPropagation(), fn({
1082
- kind: "edge",
1083
- id: s.id
1084
- }, e);
1085
- }), f.addEventListener("keydown", (e) => {
1086
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), fn({
1087
- kind: "edge",
1088
- id: s.id
1089
- }, e));
1090
- }), l.append(f), le.append(l), p !== "" && (s.kind !== "dependency" || c || i && n.has(s.id))) {
1091
- let r = e.createElement("span");
1092
- r.className = "designer-blueprint-canvas-edge-label", r.dataset.edgeLabel = s.id, r.dataset.kind = s.kind, r.setAttribute("role", "button"), r.setAttribute("tabindex", "0"), r.setAttribute("aria-label", B.edgeAria(p)), c && (r.dataset.selected = "true", r.setAttribute("aria-current", "true")), i && n.has(s.id) && (r.dataset.traced = "true");
1093
- let l = e.createElement("span");
1094
- l.className = "designer-blueprint-canvas-edge-label-icon", l.innerHTML = _(Gt(s));
1095
- let u = e.createElement("span");
1096
- u.className = "designer-blueprint-canvas-edge-label-text", u.textContent = p, r.append(l, u);
1097
- let d = Z(t.label, p, o);
1098
- for (; a.some((e) => Math.abs(e.x - d.x) < 96 && Math.abs(e.y - d.y) < 16);) d = {
1099
- x: d.x,
1100
- y: d.y + 22
1101
- };
1102
- a.push(d), r.style.left = `${d.x}px`, r.style.top = `${d.y}px`, r.addEventListener("pointerdown", (e) => {
1103
- e.stopPropagation(), fn({
1104
- kind: "edge",
1105
- id: s.id
1106
- }, e);
1107
- }), r.addEventListener("keydown", (e) => {
1108
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), fn({
1109
- kind: "edge",
1110
- id: s.id
1111
- }, e));
1112
- }), ue.append(r);
1113
- }
1114
- }
1115
- }
1116
- function Jt(t, n) {
1117
- let r = e.createElementNS(ut, "circle");
1118
- return r.setAttribute("cx", String(t.x)), r.setAttribute("cy", String(t.y)), r.setAttribute("r", String(n)), r;
1119
- }
1120
- function Q() {
1121
- let t = W();
1122
- for (let e of C.querySelectorAll(".designer-blueprint-canvas-node")) e.remove();
1123
- if (qt(), t === null) return;
1124
- let n = xt ? A?.trace : null, r = new Set(n?.executedEdgeIds ?? []), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
1125
- for (let e of t.edges) r.has(e.id) && (i.add(e.source), i.add(e.target)), e.relationId !== void 0 && (n?.failedRelationIds ?? []).includes(e.relationId) && a.add(e.target);
1126
- for (let n of t.nodes) {
1127
- let t = G(n), o = K(n), s = e.createElement("div");
1128
- s.className = "designer-blueprint-canvas-node", s.dataset.nodeId = n.id, s.dataset.kind = n.kind, s.style.left = `${o.x}px`, s.style.top = `${o.y}px`, s.style.width = `${t.width}px`, s.style.height = `${t.height}px`, s.tabIndex = 0, s.setAttribute("role", "button");
1129
- let c = B.nodeKind[n.kind], l = Zt(n);
1130
- s.setAttribute("aria-label", `${c} ${l}`), A?.selection?.kind === "node" && A.selection.id === n.id && (s.dataset.selected = "true"), r.size > 0 && i.has(n.id) && (s.dataset.traced = "true"), a.has(n.id) && (s.dataset.failed = "true");
1131
- let u = e.createElement("div");
1132
- u.className = "designer-blueprint-canvas-node-header";
1133
- let d = e.createElement("span");
1134
- d.className = "designer-blueprint-canvas-node-icon", d.innerHTML = _($t(n));
1135
- let f = e.createElement("div");
1136
- f.className = "designer-blueprint-canvas-node-copy";
1137
- let p = e.createElement("span");
1138
- p.className = "designer-blueprint-canvas-node-kind", p.textContent = Qt(n);
1139
- let m = e.createElement("span");
1140
- if (m.className = "designer-blueprint-canvas-node-title", m.textContent = l, f.append(p, m), u.append(d, f), n.kind !== "variable") {
1141
- let t = n.outboundCount ?? 0, r = n.inboundCount ?? 0, i = e.createElement("span");
1142
- i.className = "designer-blueprint-canvas-node-relcount", i.title = B.relationCountTitle(t, r);
1143
- let a = e.createElement("span");
1144
- a.textContent = `${B.relationCounts.out} `;
1145
- let o = e.createElement("b");
1146
- o.textContent = String(t);
1147
- let s = e.createElement("span");
1148
- s.textContent = ` ${B.relationCounts.in} `;
1149
- let c = e.createElement("b");
1150
- c.textContent = String(r), i.append(a, o, s, c), u.append(i);
1151
- }
1152
- let h = e.createElement("div");
1153
- h.className = "designer-blueprint-canvas-node-subtitle", h.textContent = en(n);
1154
- let g;
1155
- if (n.kind === "variable") {
1156
- g = e.createElement("div"), g.className = "designer-blueprint-canvas-node-value";
1157
- let t = e.createElement("span");
1158
- t.textContent = `${B.variableValueLabel} `;
1159
- let r = e.createElement("b");
1160
- r.textContent = n.variableInitialValue === void 0 ? B.variableValueEmpty : nn(n.variableInitialValue);
1161
- let i = e.createElement("span");
1162
- i.textContent = B.variableCounts(n.writeCount ?? 0, n.readCount ?? 0), g.append(t, r, i);
1163
- }
1164
- let ee = tn(n), v;
1165
- ee !== "" && (v = e.createElement("div"), v.className = "designer-blueprint-canvas-node-summary", v.textContent = ee, v.style.bottom = "0", v.style.height = `${et}px`);
1166
- let te = e.createElement("div");
1167
- if (te.className = "designer-blueprint-canvas-ports", te.style.top = `${t.portStart}px`, n.kind === "component" || n.kind === "variable") {
1168
- let n = t.outputs.filter((e) => e.semantic !== !0 && e.containment !== !0);
1169
- if (n.length === 0) {
1170
- let t = e.createElement("div");
1171
- t.className = "designer-blueprint-canvas-port-row", t.dataset.available = "false", t.textContent = B.nodeNoEvents, te.append(t);
1172
- }
1173
- for (let e of n) te.append(Yt(e));
1174
- for (let e of t.outputs.filter((e) => e.semantic === !0 || e.containment === !0)) te.append(Yt(e));
1175
- }
1176
- let y = e.createElement("span");
1177
- y.className = "designer-blueprint-canvas-port designer-blueprint-canvas-port-in", y.dataset.nodeId = n.id, y.dataset.armed = String(R !== null && Xt(R)), y.style.top = `${t.inputY}px`, y.setAttribute("role", "button"), y.setAttribute("tabindex", "0"), y.setAttribute("aria-label", B.inputPort), y.addEventListener("pointerdown", (e) => bn(e)), y.addEventListener("keydown", (e) => {
1178
- (e.key === "Enter" || e.key === " ") && R !== null && (e.preventDefault(), e.stopPropagation(), xn(R.nodeId, R.handle, y), R = null);
1179
- }), s.append(u, h), g !== void 0 && s.append(g), s.append(te), t.inputHandle !== void 0 && (y.dataset.inputHandle = t.inputHandle, s.append(y));
1180
- for (let r of t.outputs) {
1181
- let t = e.createElement("span");
1182
- t.className = "designer-blueprint-canvas-port designer-blueprint-canvas-port-out", t.dataset.outputHandle = r.handle, t.dataset.nodeId = n.id, t.dataset.available = String(r.available), r.dependency === !0 && (t.dataset.dependency = "true"), r.semantic === !0 && (t.dataset.semantic = "true"), r.containment === !0 && (t.dataset.containment = "true"), t.style.top = `${r.y}px`, t.setAttribute("role", "button"), t.setAttribute("tabindex", "0");
1183
- let i = `${r.label}`;
1184
- t.setAttribute("aria-label", r.available ? i : B.portUnavailableAria(i)), r.available || (t.setAttribute("aria-disabled", "true"), t.setAttribute("data-tip", r.requiredCapability === void 0 ? B.portUnavailable : B.portUnavailableCapability(r.requiredCapability))), r.dependency === !0 || r.containment === !0 ? (t.setAttribute("aria-disabled", "true"), r.containment === !0 && t.setAttribute("data-tip", V.relationList.containmentHint)) : (t.addEventListener("pointerdown", (e) => _n(e, n, r)), t.addEventListener("keydown", (e) => {
1185
- if (e.key === "Enter" || e.key === " ") {
1186
- if (e.preventDefault(), e.stopPropagation(), !r.available) {
1187
- J(B.statusPortUnavailable, "error");
1188
- return;
1189
- }
1190
- R = {
1191
- nodeId: n.id,
1192
- handle: r.handle
1193
- }, Q();
1194
- }
1195
- })), s.append(t);
1196
- }
1197
- v !== void 0 && s.append(v), s.addEventListener("pointerdown", (e) => pn(e, n)), s.addEventListener("keydown", (e) => {
1198
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), dn({
1199
- kind: "node",
1200
- id: n.id
1201
- }));
1202
- }), C.append(s);
1203
- }
1204
- }
1205
- function Yt(t) {
1206
- let n = e.createElement("div");
1207
- n.className = "designer-blueprint-canvas-port-row", n.dataset.available = String(t.available), t.dependency === !0 && (n.dataset.dependency = "true"), t.semantic === !0 && (n.dataset.semantic = "true"), t.containment === !0 && (n.dataset.containment = "true");
1208
- let r = e.createElement("span");
1209
- r.className = "designer-blueprint-canvas-port-name", r.textContent = t.label;
1210
- let i = e.createElement("span");
1211
- if (i.className = "designer-blueprint-canvas-port-tag", i.textContent = t.semantic === !0 ? B.portTags.semantic : t.containment === !0 ? B.portTags.structure : t.available ? B.portTags.event : B.portTags.unavailable, n.append(r, i), t.available !== !0) {
1212
- let t = e.createElement("span");
1213
- t.className = "designer-blueprint-canvas-port-lock", t.innerHTML = _("lock"), n.append(t);
1214
- }
1215
- return n;
1216
- }
1217
- function Xt(e) {
1218
- return Mt(e.nodeId) !== void 0;
1219
- }
1220
- function Zt(e) {
1221
- return e.kind === "component" ? e.componentName ?? e.componentId ?? e.id : e.kind === "variable" ? e.variableName ?? e.variableId ?? e.id : e.kind === "host" ? V.hostNode : e.id;
1222
- }
1223
- function Qt(e) {
1224
- return e.kind === "component" ? B.nodeKindLine.component(e.materialType ?? B.nodeKind.component) : e.kind === "variable" ? B.nodeKindLine.variable : e.kind === "host" ? B.nodeKindLine.host : B.nodeKind[e.kind];
1225
- }
1226
- function $t(e) {
1227
- if (e.kind === "variable") return "variable";
1228
- if (e.kind === "host") return "terminal";
1229
- if (e.isContainer === !0) return "group";
1230
- let t = e.materialType ?? "";
1231
- return t.includes("chart") ? "chart-line" : t.includes("table") || t.includes("ranking") ? "table" : t.includes("text") || t.includes("title") ? "type" : t.includes("image") ? "image" : "shapes";
1232
- }
1233
- function en(e) {
1234
- return e.kind === "component" ? B.nodeSubtitle.component(e.materialType ?? B.nodeKind.component, e.componentId ?? e.id) : e.kind === "variable" ? B.nodeSubtitle.variable(e.variableType ?? B.nodeKind.variable, e.variableId ?? e.id) : e.kind === "host" ? B.nodeSubtitle.host(e.exitCount ?? 0) : e.id;
1235
- }
1236
- function tn(e) {
1237
- return e.kind === "component" && (e.childCount ?? 0) > 0 ? `${V.structureTitle} · ${V.structure.children} ${e.childCount}` : "";
1238
- }
1239
- function nn(e) {
1240
- try {
1241
- let t = JSON.stringify(e);
1242
- return t !== void 0 && t.length > 22 ? `${t.slice(0, 21)}…` : t ?? "…";
1243
- } catch {
1244
- return "…";
1245
- }
1246
- }
1247
- function rn() {
1248
- let e = W(), t = (A?.diagnostics ?? []).filter((e) => e.severity === "error");
1249
- f.dataset.state = t.length === 0 ? "ok" : "error", m.textContent = t.length === 0 ? B.validationPassed : B.validationFailed(t.length), f.setAttribute("aria-label", B.validationAria(t.length)), f.setAttribute("aria-expanded", String(U)), d.disabled = (e?.nodes.length ?? 0) === 0, h.setAttribute("aria-pressed", String(xt)), h.dataset.active = String(xt), ce.setAttribute("aria-expanded", String(H)), ce.dataset.active = String(H), xe.hidden = H, O.hidden = !H, n.dataset.simulation = H ? "open" : "closed";
1250
- let r = A?.trace?.lines ?? [], i = r.length > 0 ? r.at(-1) ?? B.simulationIdle : B.simulationIdle;
1251
- Ce.textContent = `${B.simulationTitle} · ${i}`;
1252
- }
1253
- function an() {
1254
- let e = (W()?.nodes.length ?? 0) === 0;
1255
- E.hidden = !e, e && (d.disabled = !0);
1256
- }
1257
- function on() {
1258
- let e = W(), t = e?.nodes.some((e) => e.kind === "component" || e.kind === "variable") ?? !1, n = e?.nodes.some((e) => (e.events ?? []).some((e) => e.available)) ?? !1;
1259
- ve.hidden = !(t && !n);
1260
- }
1261
- function sn() {
1262
- let t = A?.diagnostics ?? [];
1263
- x.replaceChildren();
1264
- let n = e.createElement("header"), r = e.createElement("strong");
1265
- r.textContent = V.problemsTitle;
1266
- let i = Ot(e, "close", V.problemsTitle, "problems-close");
1267
- n.append(r, i);
1268
- let a = e.createElement("ul");
1269
- if (t.length === 0) {
1270
- let t = e.createElement("li");
1271
- t.textContent = B.problemsEmpty, a.append(t);
1272
- } else for (let n of t) {
1273
- let t = e.createElement("li");
1274
- t.dataset.severity = n.severity;
1275
- let r = e.createElement("span");
1276
- r.textContent = n.message;
1277
- let i = e.createElement("code");
1278
- i.textContent = n.code, t.append(r, i), a.append(t);
1279
- }
1280
- x.append(n, a), x.hidden = !U, f.setAttribute("aria-expanded", String(U));
1281
- }
1282
- function cn() {
1283
- let t = k.value, n = [];
1284
- for (let e of W()?.nodes ?? []) if (e.kind === "component" || e.kind === "variable") for (let t of e.events ?? []) t.available && n.push({
1285
- value: JSON.stringify({
1286
- componentId: e.componentId ?? e.variableId ?? e.id,
1287
- eventName: t.name
1288
- }),
1289
- label: `${Zt(e)} · ${t.name}`
1290
- });
1291
- if (k.replaceChildren(), n.length === 0) {
1292
- let t = e.createElement("option");
1293
- t.textContent = B.simulationNoEvent, t.value = "", k.append(t), k.disabled = !0, Me.refresh(), Re.disabled = !0;
1294
- return;
1295
- }
1296
- for (let t of n) {
1297
- let n = e.createElement("option");
1298
- n.value = t.value, n.textContent = t.label, k.append(n);
1299
- }
1300
- k.disabled = !1, n.some((e) => e.value === t) ? k.value = t : t !== "" && (k.value = n[0]?.value ?? ""), Me.refresh(), Re.disabled = k.value === "";
1301
- }
1302
- function ln() {
1303
- cn();
1304
- let t = A?.trace, n = (t?.failedRuleIds.length ?? 0) > 0, r = A?.lastCommand?.commandId === Ct && A.lastCommand.status === "rejected";
1305
- t === null || (t?.lines.length ?? 0) === 0 ? (Le.textContent = r ? `${B.simulationRejected} · ${A?.lastCommand?.diagnostics.map((e) => e.message).join(";") || V.invalidCommand}` : B.simulationIdle, Le.dataset.tone = "idle") : (Le.textContent = n ? B.simulationFailed : B.simulationSuccess, Le.dataset.tone = n ? "error" : "success"), Ve.replaceChildren(), He.hidden = (t?.lines.length ?? 0) > 0;
1306
- for (let n of t?.lines ?? []) {
1307
- let t = e.createElement("li");
1308
- t.textContent = n, Ve.append(t);
1309
- }
1310
- }
1311
- function un() {
1312
- rn(), an(), on(), sn(), ln(), Y(), Q();
1313
- }
1314
- function dn(e) {
1315
- q({
1316
- type: "select",
1317
- selection: e
1318
- });
1319
- }
1320
- function fn(e, t) {
1321
- let n = A?.selection;
1322
- if ((t.ctrlKey || t.metaKey) && n != null && n.kind === e.kind && n.id === e.id) {
1323
- dn(null);
1324
- return;
1325
- }
1326
- dn(e);
1327
- }
1328
- function pn(e, n) {
1329
- if (e.button !== 0 || (e.target instanceof Element ? e.target : null)?.closest("[data-output-handle], [data-input-handle], [data-canvas-menu]") != null) return;
1330
- e.stopPropagation();
1331
- let r = K(n);
1332
- P = {
1333
- nodeId: n.id,
1334
- pointerId: e.pointerId,
1335
- startClientX: e.clientX,
1336
- startClientY: e.clientY,
1337
- startX: r.x,
1338
- startY: r.y,
1339
- moved: !1
1340
- }, e.currentTarget.setPointerCapture(e.pointerId), t?.addEventListener("pointermove", mn), t?.addEventListener("pointerup", hn), t?.addEventListener("pointercancel", hn);
1341
- }
1342
- function mn(e) {
1343
- if (P === null || e.pointerId !== P.pointerId) return;
1344
- let t = (e.clientX - P.startClientX) / M.zoom, n = (e.clientY - P.startClientY) / M.zoom;
1345
- if (!P.moved && Math.abs(t) + Math.abs(n) < 3) return;
1346
- P.moved = !0;
1347
- let r = {
1348
- x: kt(P.startX + t),
1349
- y: kt(P.startY + n)
1350
- };
1351
- j.set(P.nodeId, r);
1352
- let i = C.querySelector(`[data-node-id="${mt(P.nodeId)}"]`);
1353
- i !== null && (i.style.left = `${r.x}px`, i.style.top = `${r.y}px`), gn();
1354
- }
1355
- function hn(e) {
1356
- if (P === null || e.pointerId !== P.pointerId) return;
1357
- let n = P;
1358
- if (P = null, t?.removeEventListener("pointermove", mn), t?.removeEventListener("pointerup", hn), t?.removeEventListener("pointercancel", hn), !n.moved) {
1359
- fn({
1360
- kind: "node",
1361
- id: n.nodeId
1362
- }, e);
1363
- return;
1364
- }
1365
- Cn();
1366
- }
1367
- function gn() {
1368
- qt();
1369
- }
1370
- function _n(e, n, r) {
1371
- if (e.stopPropagation(), e.preventDefault(), !r.available) {
1372
- J(B.statusPortUnavailable, "error");
1373
- return;
1374
- }
1375
- L = {
1376
- nodeId: n.id,
1377
- handle: r.handle,
1378
- pointerId: e.pointerId,
1379
- target: null
1380
- };
1381
- let i = S.getBoundingClientRect(), a = {
1382
- x: e.clientX - i.left,
1383
- y: e.clientY - i.top
1384
- };
1385
- w.setAttribute("d", `M ${a.x} ${a.y} L ${a.x} ${a.y}`), w.setAttribute("visibility", "visible"), w.dataset.startX = String(a.x), w.dataset.startY = String(a.y), S.dataset.linking = "true", t?.addEventListener("pointermove", vn), t?.addEventListener("pointerup", yn), t?.addEventListener("pointercancel", yn);
1386
- }
1387
- function vn(e) {
1388
- if (L === null || e.pointerId !== L.pointerId) return;
1389
- let t = Number(w.dataset.startX ?? "0"), n = Number(w.dataset.startY ?? "0"), r = S.getBoundingClientRect(), i = {
1390
- x: e.clientX - r.left,
1391
- y: e.clientY - r.top
1392
- };
1393
- w.setAttribute("d", `M ${t} ${n} L ${i.x} ${i.y}`);
1394
- let a = Sn(e.clientX, e.clientY);
1395
- L = {
1396
- ...L,
1397
- target: a
1398
- };
1399
- for (let e of S.querySelectorAll("[data-input-handle]")) e.dataset.hover = String(a !== null && e === a);
1400
- }
1401
- function yn(e) {
1402
- if (L === null || e.pointerId !== L.pointerId) return;
1403
- let n = L;
1404
- L = null, w.setAttribute("visibility", "hidden"), S.dataset.linking = "false", t?.removeEventListener("pointermove", vn), t?.removeEventListener("pointerup", yn), t?.removeEventListener("pointercancel", yn);
1405
- for (let e of S.querySelectorAll("[data-input-handle]")) e.dataset.hover = "false";
1406
- let r = Sn(e.clientX, e.clientY) ?? n.target;
1407
- if (r !== null) {
1408
- xn(n.nodeId, n.handle, r);
1409
- return;
1410
- }
1411
- R = {
1412
- nodeId: n.nodeId,
1413
- handle: n.handle
1414
- }, J(B.statusArmed), Q();
1415
- }
1416
- function bn(e) {
1417
- e.stopPropagation(), R !== null && (e.preventDefault(), xn(R.nodeId, R.handle, e.currentTarget), R = null);
1418
- }
1419
- function xn(e, t, n) {
1420
- let r = n.closest("[data-input-handle]");
1421
- if (r === null) return;
1422
- let i = r.dataset.nodeId, a = r.dataset.inputHandle;
1423
- if (i !== void 0 && a !== void 0) {
1424
- if (i === e) {
1425
- J(B.statusSameNode, "error");
1426
- return;
1427
- }
1428
- q({
1429
- type: "connect",
1430
- sourceNodeId: e,
1431
- sourceHandle: t,
1432
- targetNodeId: i,
1433
- targetHandle: a
1434
- }), R = null, Q();
1435
- }
1436
- }
1437
- function Sn(e, t) {
1438
- let r = n.getRootNode(), i = r.elementFromPoint?.bind(r);
1439
- return (i?.(e, t) ?? null)?.closest("[data-input-handle]") ?? null;
1440
- }
1441
- function Cn() {
1442
- let e = W();
1443
- if (e === null) return;
1444
- let t = e.nodes.map((e) => {
1445
- let t = K(e);
1446
- return {
1447
- id: e.id,
1448
- x: Math.round(t.x),
1449
- y: Math.round(t.y),
1450
- ...e.collapsed === !0 ? { collapsed: !0 } : {}
1451
- };
1452
- });
1453
- ht = !1, Ge = Nt(M), q({
1454
- type: "commit-layout",
1455
- nodes: t,
1456
- viewport: {
1457
- x: Math.round(M.x),
1458
- y: Math.round(M.y),
1459
- zoom: Math.round(M.zoom * 1e3) / 1e3
1460
- }
1461
- });
1462
- }
1463
- function wn(e) {
1464
- if (e.button !== 0 || (e.target instanceof Element ? e.target : null)?.closest(".designer-blueprint-canvas-node, [data-edge-id], [data-canvas-empty], [data-canvas-simulation], [data-canvas-simulation-bar], [data-canvas-problems], [data-canvas-no-events]") != null) return;
1465
- R = null;
1466
- let n = S.getBoundingClientRect();
1467
- I = {
1468
- pointerId: e.pointerId,
1469
- startClientX: e.clientX,
1470
- startClientY: e.clientY,
1471
- startLeft: e.clientX - n.left,
1472
- startTop: e.clientY - n.top,
1473
- moved: !1
1474
- }, S.setPointerCapture(e.pointerId), t?.addEventListener("pointermove", Tn), t?.addEventListener("pointerup", En), t?.addEventListener("pointercancel", En);
1475
- }
1476
- function Tn(e) {
1477
- if (I === null || e.pointerId !== I.pointerId) return;
1478
- let t = S.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, i = Math.min(I.startLeft, n), a = Math.min(I.startTop, r), o = Math.abs(n - I.startLeft), s = Math.abs(r - I.startTop);
1479
- !I.moved && o + s < 3 || (I = {
1480
- ...I,
1481
- moved: !0
1482
- }, T.hidden = !1, T.style.left = `${i}px`, T.style.top = `${a}px`, T.style.width = `${o}px`, T.style.height = `${s}px`);
1483
- }
1484
- function En(e) {
1485
- if (I === null || e.pointerId !== I.pointerId) return;
1486
- let n = I;
1487
- if (I = null, t?.removeEventListener("pointermove", Tn), t?.removeEventListener("pointerup", En), t?.removeEventListener("pointercancel", En), T.hidden = !0, !n.moved) {
1488
- dn(null);
1489
- return;
1490
- }
1491
- let r = S.getBoundingClientRect(), i = Dn(Math.min(n.startClientX, e.clientX) - r.left, Math.min(n.startClientY, e.clientY) - r.top, Math.max(n.startClientX, e.clientX) - r.left, Math.max(n.startClientY, e.clientY) - r.top);
1492
- if (i === void 0) {
1493
- dn(null);
1494
- return;
1495
- }
1496
- fn({
1497
- kind: "node",
1498
- id: i
1499
- }, e);
1500
- }
1501
- function Dn(e, t, n, r) {
1502
- let i, a = 0, o = S.getBoundingClientRect();
1503
- for (let s of C.querySelectorAll(".designer-blueprint-canvas-node")) {
1504
- let c = s.getBoundingClientRect(), l = c.left - o.left, u = c.top - o.top, d = Math.max(0, Math.min(l + c.width, n) - Math.max(l, e)) * Math.max(0, Math.min(u + c.height, r) - Math.max(u, t));
1505
- d > a && s.dataset.nodeId !== void 0 && (a = d, i = s.dataset.nodeId);
1506
- }
1507
- return i;
1508
- }
1509
- function On(e) {
1510
- F = {
1511
- pointerId: e.pointerId,
1512
- startClientX: e.clientX,
1513
- startClientY: e.clientY,
1514
- startX: M.x,
1515
- startY: M.y,
1516
- moved: !1
1517
- }, S.dataset.panning = "true", S.setPointerCapture(e.pointerId), t?.addEventListener("pointermove", kn), t?.addEventListener("pointerup", An), t?.addEventListener("pointercancel", An);
1518
- }
1519
- function $(e) {
1520
- e.button !== 0 || !Ye || ((e.target instanceof Element ? e.target : null)?.closest("[data-canvas-empty], [data-canvas-simulation], [data-canvas-simulation-bar], [data-canvas-problems], [data-canvas-no-events], [data-canvas-menu], [data-canvas-status]") ?? (e.preventDefault(), e.stopPropagation(), R = null, On(e)));
1521
- }
1522
- function kn(e) {
1523
- if (F === null || e.pointerId !== F.pointerId) return;
1524
- let t = e.clientX - F.startClientX, n = e.clientY - F.startClientY;
1525
- !F.moved && Math.abs(t) + Math.abs(n) < 3 || (F = {
1526
- ...F,
1527
- moved: !0
1528
- }, M = {
1529
- ...M,
1530
- x: F.startX + t,
1531
- y: F.startY + n
1532
- }, qe = !0, Y());
1533
- }
1534
- function An(e) {
1535
- if (F === null || e.pointerId !== F.pointerId) return;
1536
- let n = F;
1537
- F = null, S.dataset.panning = "false", t?.removeEventListener("pointermove", kn), t?.removeEventListener("pointerup", An), t?.removeEventListener("pointercancel", An), n.moved && Ft();
1538
- }
1539
- function jn(e) {
1540
- let t = e.composedPath()[0];
1541
- return t instanceof HTMLElement ? t.isContentEditable || t.closest("input, textarea, select, button, a, [contenteditable=\"true\"]") !== null : !1;
1542
- }
1543
- function Mn(e) {
1544
- e.code !== "Space" || jn(e) || A?.active === !0 && n.getClientRects().length !== 0 && (e.preventDefault(), e.stopPropagation(), Ye = !0, S.dataset.hand = "true");
1545
- }
1546
- function Nn(e) {
1547
- e.code !== "Space" || !Ye || (Ye = !1, S.dataset.hand = "false");
1548
- }
1549
- function Pn() {
1550
- Ye = !1, S.dataset.hand = "false", F !== null && (S.dataset.panning = "false", F = null, t?.removeEventListener("pointermove", kn), t?.removeEventListener("pointerup", An), t?.removeEventListener("pointercancel", An), qe = !0);
1551
- }
1552
- function Fn(e) {
1553
- if (e.preventDefault(), e.ctrlKey || e.metaKey) {
1554
- let t = e.deltaY < 0 ? 1.1 : 1 / 1.1, n = In(M.zoom * t), r = Lt(e.clientX, e.clientY), i = S.getBoundingClientRect();
1555
- M = {
1556
- zoom: n,
1557
- x: e.clientX - i.left - r.x * n,
1558
- y: e.clientY - i.top - r.y * n
1559
- };
1560
- } else {
1561
- let t = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? 512 : 1, n = (e.shiftKey ? e.deltaY : e.deltaX) * t, r = (e.shiftKey ? e.deltaX : e.deltaY) * t;
1562
- M = {
1563
- ...M,
1564
- x: M.x - n,
1565
- y: M.y - r
1566
- };
1567
- }
1568
- Y(), Pt();
1569
- }
1570
- function In(e) {
1571
- return Math.min(ct, Math.max(st, Math.round(e * 1e3) / 1e3));
1572
- }
1573
- function Ln(e) {
1574
- let t = M.zoom;
1575
- Rn(In(e > 0 ? lt.find((e) => e > t + .001) ?? ct : [...lt].reverse().find((e) => e < t - .001) ?? st));
1576
- }
1577
- function Rn(e) {
1578
- let t = S.getBoundingClientRect(), n = (t.width / 2 - M.x) / M.zoom, r = (t.height / 2 - M.y) / M.zoom;
1579
- M = {
1580
- zoom: e,
1581
- x: t.width / 2 - n * e,
1582
- y: t.height / 2 - r * e
1583
- }, Y(), Ft();
1584
- }
1585
- function zn(e, t = !0, n = 0) {
1586
- let r = W();
1587
- if (r === null) return;
1588
- let i = e ?? r.nodes;
1589
- if (i.length === 0) {
1590
- M = {
1591
- x: 0,
1592
- y: 0,
1593
- zoom: 1
1594
- }, Y(), t && Ft();
1595
- return;
1596
- }
1597
- let a = Infinity, o = Infinity, s = -Infinity, c = -Infinity;
1598
- for (let e of i) {
1599
- let t = K(e), n = G(e);
1600
- a = Math.min(a, t.x), o = Math.min(o, t.y), s = Math.max(s, t.x + n.width), c = Math.max(c, t.y + n.height);
1601
- }
1602
- let l = S.getBoundingClientRect(), u = Math.max(1, s - a), d = Math.max(1, c - o), f = Math.max(1, l.width - 56), p = Math.max(1, l.height - 56 - n), m = In(Math.min(1.15, f / u, p / d));
1603
- M = {
1604
- zoom: m,
1605
- x: (l.width - u * m) / 2 - a * m,
1606
- y: (l.height - n - d * m) / 2 - o * m
1607
- }, Y(), t && Ft();
1608
- }
1609
- function Bn() {
1610
- let e = W();
1611
- e !== null && e.nodes.length !== 0 && (j = Vn(e.nodes), ht = !1, Q(), zn(void 0, !1, H ? at : ot), Cn(), J(B.statusLayoutApplied));
1612
- }
1613
- function Vn(e) {
1614
- let t = /* @__PURE__ */ new Map(), n = e.filter((e) => e.kind === "component"), r = e.filter((e) => e.kind === "variable"), i = e.filter((e) => e.kind === "host"), a = W()?.edges ?? [], o = r.filter((e) => !a.some((t) => t.target === e.id && t.kind === "relation")), s = r.length > 0 && o.length === r.length, c = S.clientWidth >= 900 ? 3 : 2, l = Math.max(1, Math.min(n.length, c)), u = Math.max(0, ...n.map((e) => G(e).height)) + 28, d = Hn(e), f = [...n].sort((e, t) => {
1615
- let n = (d.get(e.id) ?? 0) - (d.get(t.id) ?? 0);
1616
- return n === 0 ? 0 : n;
1617
- }), p = z + (s ? rt : 0), m = Math.max(1, Math.ceil(f.length / l));
1618
- f.forEach((e, n) => {
1619
- let r = Math.floor(n / m), i = n % m;
1620
- t.set(e.id, {
1621
- x: p + r * rt,
1622
- y: z + i * u
1623
- });
1624
- });
1625
- let h = p + Math.max(0, l - 1) * rt, g = (e) => f.reduce((n, r) => {
1626
- let i = t.get(r.id);
1627
- return i !== void 0 && i.x === e ? Math.max(n, i.y + G(r).height) : n;
1628
- }, z), ee = z;
1629
- if (s) {
1630
- let e = z;
1631
- for (let n of o) t.set(n.id, {
1632
- x: z,
1633
- y: e
1634
- }), e += G(n).height + 20;
1635
- } else {
1636
- let e = p + l * rt;
1637
- for (let n of r) t.set(n.id, {
1638
- x: e,
1639
- y: ee
1640
- }), ee += G(n).height + 20;
1641
- }
1642
- let _ = p + l * rt, v = s ? z : ee;
1643
- s && i.length > 0 && (v = Math.max(z, g(h)));
1644
- for (let e of i) t.set(e.id, {
1645
- x: _,
1646
- y: v
1647
- }), v += G(e).height + 24;
1648
- return t;
1649
- }
1650
- function Hn(e) {
1651
- let t = new Map(e.map((e) => [e.id, 0])), n = (W()?.edges ?? []).filter((e) => e.kind === "relation" || e.kind === "semantic"), r = Math.min(e.length, 8);
1652
- for (let e = 0; e < r; e += 1) {
1653
- let e = !1;
1654
- for (let i of n) {
1655
- let n = t.get(i.source), a = t.get(i.target);
1656
- if (n === void 0 || a === void 0) continue;
1657
- let o = n + 1;
1658
- o > a && o < r && (t.set(i.target, o), e = !0);
1659
- }
1660
- if (!e) break;
1661
- }
1662
- return t;
1663
- }
1664
- function Un(e) {
1665
- return e === void 0 ? 0 : e.kind === "host" ? 2 : 0;
1666
- }
1667
- function Wn(e) {
1668
- let t = z + Un(e) * rt, n = 0;
1669
- for (let r of W()?.nodes ?? []) {
1670
- if (r.id === e?.id) continue;
1671
- let i = K(r);
1672
- Math.abs(i.x - t) > rt / 2 || (n = Math.max(n, i.y + G(r).height));
1673
- }
1674
- return {
1675
- x: t,
1676
- y: n === 0 ? z : n + 48
1677
- };
1678
- }
1679
- function Gn() {
1680
- vt = !0, (t?.requestAnimationFrame ?? ((e) => setTimeout(() => e(Date.now()), 0)))(() => {
1681
- if (!vt || wt) return;
1682
- let e = W();
1683
- if (e === null || e.nodes.length === 0) return;
1684
- let t = S.getBoundingClientRect();
1685
- t.width !== 0 && t.height !== 0 && (vt = !1, yt = !0, zn(e.nodes, !1, H ? at : ot));
1686
- });
1687
- }
1688
- function Kn() {
1689
- q({
1690
- type: "insert-node",
1691
- kind: "host"
1692
- }), Qn();
1693
- }
1694
- function qn() {
1695
- if (k.value === "") {
1696
- J(B.statusNoSimulationEvent, "error");
1697
- return;
1698
- }
1699
- let e;
1700
- try {
1701
- e = JSON.parse(k.value);
1702
- } catch {
1703
- J(B.statusSimulationEventStale, "error");
1704
- return;
1705
- }
1706
- if (typeof e.componentId != "string" || typeof e.eventName != "string") return;
1707
- let t;
1708
- try {
1709
- t = JSON.parse(Fe.value);
1710
- } catch {
1711
- J(B.statusSimulationPayloadInvalid, "error");
1712
- return;
1713
- }
1714
- let n = q({
1715
- type: "run-simulation",
1716
- componentId: e.componentId,
1717
- eventName: e.eventName,
1718
- payload: t
1719
- });
1720
- n !== void 0 && (Ct = n.commandId);
1721
- }
1722
- function Jn(e) {
1723
- let t = e.dataTransfer;
1724
- if (t === null) return;
1725
- let n = t.getData(i);
1726
- if (n === "") return;
1727
- e.preventDefault();
1728
- let r;
1729
- try {
1730
- r = JSON.parse(n);
1731
- } catch {
1732
- J(B.statusDropInvalid, "error");
1733
- return;
1734
- }
1735
- let a = Lt(e.clientX, e.clientY);
1736
- q({
1737
- ...r,
1738
- type: "insert-node",
1739
- position: {
1740
- x: kt(a.x),
1741
- y: kt(a.y)
1742
- }
1743
- });
1744
- }
1745
- function Yn(e) {
1746
- if (e.key === "Escape") {
1747
- if (St) {
1748
- Qn();
1749
- return;
1750
- }
1751
- if (U) {
1752
- U = !1, sn();
1753
- return;
1754
- }
1755
- if (H) {
1756
- tr(), zn(void 0, !1);
1757
- return;
1758
- }
1759
- if (R !== null) {
1760
- R = null, Q();
1761
- return;
1762
- }
1763
- if (A?.selection !== null && A?.selection !== void 0) {
1764
- dn(null);
1765
- return;
1766
- }
1767
- return;
1768
- }
1769
- if (e.key === "0" && (e.ctrlKey || e.metaKey)) {
1770
- e.preventDefault(), zn(void 0, !0, H ? at : ot);
1771
- return;
1772
- }
1773
- if (e.key !== "Delete" && e.key !== "Backspace" || A?.selection === null || A?.selection === void 0) return;
1774
- let t = e.target;
1775
- t instanceof HTMLInputElement || t instanceof HTMLSelectElement || t instanceof HTMLTextAreaElement || (e.preventDefault(), q({
1776
- type: "delete-selection",
1777
- selection: A.selection
1778
- }));
1779
- }
1780
- function Xn(e) {
1781
- let t = e.detail;
1782
- if (typeof t != "object" || !t || t.state === void 0) return;
1783
- let n = t.state, r = n.generation !== Ue;
1784
- if (A = n, r && (Ue = n.generation, We = !1, R = null, M = n.graph.viewport ?? {
1785
- x: 0,
1786
- y: 0,
1787
- zoom: 1
1788
- }, Ke = Nt(M), Ge = "", qe = !1, _t = new Map(n.graph.nodes.map((e) => [e.id, {
1789
- x: e.x,
1790
- y: e.y
1791
- }])), ht = n.graph.viewport === void 0, j = ht ? Vn(n.graph.nodes) : new Map(_t), gt = n.graph.nodes.length > 0, yt = !1, vt = !1, Ct = "", tr(!1), Gn()), !r) {
1792
- let e = new Map(n.graph.nodes.map((e) => [e.id, {
1793
- x: e.x,
1794
- y: e.y
1795
- }]));
1796
- if (P === null) {
1797
- if (!gt && e.size > 0) ht = n.graph.viewport === void 0, j = ht ? Vn(n.graph.nodes) : new Map(e), gt = !0, Gn();
1798
- else if (gt) {
1799
- for (let [t, r] of e) {
1800
- let e = _t.get(t);
1801
- e === void 0 && ht ? j.set(t, Wn(Mt(t) ?? n.graph.nodes.find((e) => e.id === t))) : (e === void 0 || e.x !== r.x || e.y !== r.y) && j.set(t, r);
1802
- }
1803
- for (let t of [...j.keys()]) e.has(t) || j.delete(t);
1804
- }
1805
- }
1806
- _t = e, n.graph.nodes.length === 0 && (gt = !1);
1807
- }
1808
- r || It(n.graph.viewport), n.active && !bt && !yt && Gn(), bt = n.active, un(), We || (We = !0, q({ type: "ready" })), n.viewRequest !== void 0 && n.viewRequest.id !== pt && (pt = n.viewRequest.id, Zn(n.viewRequest.targetId));
1809
- }
1810
- function Zn(e) {
1811
- let t = Mt(e);
1812
- if (t === void 0) return;
1813
- let n = K(t), r = G(t), i = S.getBoundingClientRect();
1814
- M = {
1815
- ...M,
1816
- x: i.width / 2 - (n.x + r.width / 2) * M.zoom,
1817
- y: i.height / 2 - (H ? at : ot) / 2 - (n.y + r.height / 2) * M.zoom
1818
- }, Y();
1819
- }
1820
- function Qn() {
1821
- St && (St = !1, u.hidden = !0, o.setAttribute("aria-expanded", "false"), a.classList.remove("is-open"));
1822
- }
1823
- function $n() {
1824
- St = !0, u.hidden = !1, o.setAttribute("aria-expanded", "true"), a.classList.add("is-open"), u.querySelector("button")?.focus();
1825
- }
1826
- function er() {
1827
- H || (H = !0, rn(), ln(), k.focus());
1828
- }
1829
- function tr(e = !0) {
1830
- H && (H = !1, rn(), ln(), e && ce.focus());
1831
- }
1832
- function nr() {
1833
- U = !U, sn();
1834
- }
1835
- return o.addEventListener("click", () => {
1836
- St ? Qn() : $n();
1837
- }), r.addEventListener("click", (e) => {
1838
- let t = e.target instanceof Element ? e.target : null;
1839
- if (t === null) return;
1840
- if (t.closest("[data-canvas-insert]")?.dataset.canvasInsert === "host") {
1841
- Kn();
1842
- return;
1843
- }
1844
- let n = t.closest("[data-canvas-action]")?.dataset.canvasAction;
1845
- if (n !== void 0) {
1846
- if (n === "auto-layout") {
1847
- Bn();
1848
- return;
1849
- }
1850
- if (n === "problems") {
1851
- nr();
1852
- return;
1853
- }
1854
- if (n === "trace") {
1855
- if (A?.trace === null || A?.trace === void 0) {
1856
- J(B.statusTraceUnavailable);
1857
- return;
1858
- }
1859
- xt = !xt, rn(), Q();
1860
- return;
1861
- }
1862
- if (n === "zoom-in") {
1863
- Ln(1);
1864
- return;
1865
- }
1866
- if (n === "zoom-out") {
1867
- Ln(-1);
1868
- return;
1869
- }
1870
- if (n === "fit") {
1871
- zn(void 0, !0, H ? at : ot);
1872
- return;
1873
- }
1874
- n === "simulate" && (H ? tr() : er());
1875
- }
1876
- }), E.addEventListener("click", (e) => {
1877
- (e.target instanceof Element ? e.target : null)?.closest("[data-canvas-insert]")?.dataset.canvasInsert === "host" && Kn();
1878
- }), x.addEventListener("click", (e) => {
1879
- (e.target instanceof Element ? e.target : null)?.closest("[data-canvas-action=\"problems-close\"]") !== null && (U = !1, sn());
1880
- }), O.addEventListener("click", (e) => {
1881
- let t = e.target instanceof Element ? e.target : null;
1882
- if (t?.closest("[data-canvas-action=\"simulation-run\"]") !== null) {
1883
- qn();
1884
- return;
1885
- }
1886
- t?.closest("[data-canvas-action=\"simulation-close\"]") !== null && tr();
1887
- }), we.addEventListener("click", er), k.addEventListener("change", () => {
1888
- Re.disabled = k.value === "";
1889
- }), n.addEventListener("pointerdown", (e) => {
1890
- let t = e.target instanceof Element ? e.target : null;
1891
- St && t?.closest("[data-canvas-menu]") === null && t?.closest("[data-canvas-action=\"add-node\"]") === null && Qn(), U && t?.closest("[data-canvas-problems]") === null && t?.closest("[data-canvas-action=\"problems\"]") === null && (U = !1, sn());
1892
- }), S.addEventListener("pointerdown", $, !0), S.addEventListener("pointerdown", wn), S.addEventListener("wheel", Fn, { passive: !1 }), S.addEventListener("dragover", (e) => {
1893
- Array.from(e.dataTransfer?.types ?? []).includes("application/x-base-screen-blueprint-node") && (e.preventDefault(), e.dataTransfer !== null && (e.dataTransfer.dropEffect = "copy"));
1894
- }), S.addEventListener("drop", Jn), n.addEventListener("keydown", Yn), n.addEventListener(s, Xn), t?.addEventListener("keydown", Mn, !0), t?.addEventListener("keyup", Nn, !0), t?.addEventListener("blur", Pn), Y(), rn(), {
1895
- element: n,
1896
- destroy() {
1897
- wt = !0, Tt?.disconnect(), N !== void 0 && clearTimeout(N), Je !== void 0 && clearTimeout(Je), t?.removeEventListener("pointermove", mn), t?.removeEventListener("pointerup", hn), t?.removeEventListener("pointercancel", hn), t?.removeEventListener("pointermove", vn), t?.removeEventListener("pointerup", yn), t?.removeEventListener("pointercancel", yn), t?.removeEventListener("pointermove", kn), t?.removeEventListener("pointerup", An), t?.removeEventListener("pointercancel", An), t?.removeEventListener("pointermove", Tn), t?.removeEventListener("pointerup", En), t?.removeEventListener("pointercancel", En), t?.removeEventListener("keydown", Mn, !0), t?.removeEventListener("keyup", Nn, !0), t?.removeEventListener("blur", Pn);
1898
- }
1899
- };
1900
- }
1901
- function mt(e) {
1902
- let t = globalThis.CSS?.escape;
1903
- return typeof t == "function" ? t(e) : e.replace(/["\\]/g, "\\$&");
1904
- }
1905
- //#endregion
1906
- //#region src/browser/dom/blueprint/designer-blueprint-workbench-dom.ts
1907
- function ht(e, t, n, r) {
1908
- let i = e.querySelector(".designer");
1909
- i !== null && (i.dataset.authoringMode = t);
1910
- let a = e.querySelector("[data-blueprint-surface]");
1911
- a !== null && (a.hidden = t !== "blueprint" || !n, a.dataset.slotReady = String(n));
1912
- for (let r of e.querySelectorAll("[data-workbench-mode-tab]")) {
1913
- let e = r.dataset.workbenchModeTab, i = e === t, a = e === "blueprint" && !n;
1914
- r.disabled = a, r.dataset.active = String(i), r.setAttribute("aria-selected", String(i)), r.tabIndex = i ? 0 : -1;
1915
- let o = a ? b.interactionWorkspaceUnavailable : e === "blueprint" ? b.interactionWorkspaceHint : b.canvasWorkspace;
1916
- r.setAttribute("data-tip", o), r.ariaLabel = o;
1917
- }
1918
- let o = t === "blueprint" ? b.commandPalette.blueprintTrigger : b.commandPalette.trigger, s = e.querySelector("[data-command-palette-trigger-label]");
1919
- s !== null && (s.textContent = o);
1920
- let c = e.querySelector("[data-command-palette-toggle]");
1921
- if (c !== null && (c.ariaLabel = o, c.setAttribute("data-tip", o)), gt(e, t, r.nodes), t !== "blueprint") return;
1922
- let l = e.querySelector("[data-status-selection]");
1923
- l !== null && (l.textContent = b.blueprint.workbench);
1924
- let u = e.querySelector("[data-status-canvas]");
1925
- u !== null && (u.textContent = b.blueprint.status(r.nodes, r.relations, r.semantic, r.structural, r.problems));
1926
- }
1927
- function gt(e, t, n) {
1928
- let r = t === "blueprint", i = e.querySelector("[data-blueprint-library]"), a = e.querySelector("[data-blueprint-inspector]");
1929
- i !== null && (i.hidden = !r), a !== null && (a.hidden = !r), _t(e, "left", r, b.blueprint.library, n), _t(e, "right", r, b.blueprint.inspector);
1930
- }
1931
- function _t(e, t, n, r, i) {
1932
- let a = e.querySelector(`[data-${t}-panel-title]`), o = e.querySelector(`[data-${t}-panel-count]`);
1933
- a !== null && (n ? (a.dataset.canvasTitle ??= a.textContent ?? "", a.textContent = r) : a.dataset.canvasTitle !== void 0 && (a.textContent = a.dataset.canvasTitle, delete a.dataset.canvasTitle)), o !== null && (n ? (o.dataset.canvasCount ??= o.textContent ?? "", o.dataset.canvasAriaLabel ??= o.getAttribute("aria-label") ?? "", o.textContent = String(i ?? 0), o.setAttribute("aria-label", b.blueprint.panelCount(r, i ?? 0))) : o.dataset.canvasCount !== void 0 && (o.textContent = o.dataset.canvasCount, o.setAttribute("aria-label", o.dataset.canvasAriaLabel ?? ""), delete o.dataset.canvasCount, delete o.dataset.canvasAriaLabel));
1934
- }
1935
- //#endregion
1936
- //#region src/common/operations/blueprint/designer-blueprint-connection.ts
1937
- function vt(e, t, n, r, i, a) {
1938
- let o = pe(e, t), s = me(e, t), c = pe(e, r), l = me(e, r);
1939
- if (o === void 0 && s === void 0 || c === void 0 && l === void 0 && r !== T) return {
1940
- ok: !1,
1941
- reason: "invalid"
1942
- };
1943
- if (n === "semantic:out") {
1944
- if (o === void 0 || c === void 0 || o === c || i !== "relation:in") return {
1945
- ok: !1,
1946
- reason: "invalid"
1947
- };
1948
- if (e.blueprint.relations.some((e) => e.type === "semantic" && e.source.componentId === o && e.target.componentId === c)) return {
1949
- ok: !1,
1950
- reason: "duplicate"
1951
- };
1952
- let t = Ee(e.blueprint, `${o}-${c}-semantic`);
1953
- return {
1954
- ok: !0,
1955
- blueprint: {
1956
- ...e.blueprint,
1957
- relations: [...e.blueprint.relations, {
1958
- type: "semantic",
1959
- id: t,
1960
- source: {
1961
- kind: "component",
1962
- componentId: o
1963
- },
1964
- target: {
1965
- kind: "component",
1966
- componentId: c
1967
- },
1968
- role: "related"
1969
- }]
1970
- },
1971
- selection: {
1972
- kind: "edge",
1973
- id: `semantic:${t}`
1974
- }
1975
- };
1976
- }
1977
- let u = yt(n, "event:"), d;
1978
- if (o !== void 0 && u !== void 0) {
1979
- if (!a.some((e) => e.componentId === o && e.name === u && e.available)) return {
1980
- ok: !1,
1981
- reason: "invalid"
1982
- };
1983
- d = {
1984
- kind: "component",
1985
- componentId: o,
1986
- event: {
1987
- type: "material-event",
1988
- eventName: u
1989
- }
1990
- };
1991
- } else if (s !== void 0 && (u === "data-updated" || u === "request-state")) d = {
1992
- kind: "variable",
1993
- variableId: s,
1994
- event: {
1995
- type: "variable-event",
1996
- eventName: u
1997
- }
1998
- };
1999
- else return {
2000
- ok: !1,
2001
- reason: "invalid"
2002
- };
2003
- let f, p;
2004
- if (c !== void 0) {
2005
- let e = yt(i, "visibility:");
2006
- if (i !== "relation:in" && i !== "dependency:in" && e !== "show" && e !== "hide" && e !== "toggle") return {
2007
- ok: !1,
2008
- reason: "invalid"
2009
- };
2010
- f = {
2011
- kind: "component",
2012
- componentId: c
2013
- }, p = {
2014
- type: "component-visibility",
2015
- operation: e === "hide" || e === "toggle" ? e : "show",
2016
- transition: {
2017
- effect: "fade",
2018
- durationMs: 200,
2019
- easing: "ease-in-out-quad"
2020
- }
2021
- };
2022
- } else if (l !== void 0) {
2023
- if (i !== "relation:in" && i !== "dependency:in") return {
2024
- ok: !1,
2025
- reason: "invalid"
2026
- };
2027
- f = {
2028
- kind: "variable",
2029
- variableId: l
2030
- }, p = {
2031
- type: "set-variable",
2032
- value: {
2033
- kind: "literal",
2034
- value: null
2035
- }
2036
- };
2037
- } else {
2038
- if (i !== "relation:in" && i !== "dependency:in") return {
2039
- ok: !1,
2040
- reason: "invalid"
2041
- };
2042
- f = { kind: "host" }, p = {
2043
- type: "emit-host-event",
2044
- eventName: "host_event",
2045
- payload: {
2046
- kind: "event-payload",
2047
- path: []
2048
- }
2049
- };
2050
- }
2051
- if (e.blueprint.relations.some((e) => e.type === "behavior" && e.condition === void 0 && xt(e.source, d) && H(e.target, f) && St(e.effect, p))) return {
2052
- ok: !1,
2053
- reason: "duplicate"
2054
- };
2055
- let m = f.kind === "component" ? f.componentId : f.kind === "variable" ? f.variableId : "host", h = Ee(e.blueprint, `${bt(d)}-${u}-${m}`), g = {
2056
- type: "behavior",
2057
- id: h,
2058
- source: d,
2059
- target: f,
2060
- effect: p
2061
- };
2062
- return {
2063
- ok: !0,
2064
- blueprint: {
2065
- ...e.blueprint,
2066
- relations: [...e.blueprint.relations, g]
2067
- },
2068
- selection: {
2069
- kind: "edge",
2070
- id: `relation:${h}`
2071
- }
2072
- };
2073
- }
2074
- function yt(e, t) {
2075
- return e.startsWith(t) && e.length > t.length ? e.slice(t.length) : void 0;
2076
- }
2077
- function bt(e) {
2078
- return e.kind === "component" ? e.componentId : e.variableId;
2079
- }
2080
- function xt(e, t) {
2081
- return e.kind === t.kind ? e.kind === "component" && t.kind === "component" ? e.componentId === t.componentId && e.event.type === t.event.type && e.event.eventName === t.event.eventName : e.kind === "variable" && t.kind === "variable" && e.variableId === t.variableId && e.event.type === t.event.type && e.event.eventName === t.event.eventName : !1;
2082
- }
2083
- function H(e, t) {
2084
- return e.kind === t.kind ? e.kind === "component" && t.kind === "component" ? e.componentId === t.componentId : e.kind === "variable" && t.kind === "variable" ? e.variableId === t.variableId : e.kind === "host" && t.kind === "host" : !1;
2085
- }
2086
- function St(e, t) {
2087
- return e.type === t.type ? e.type === "component-visibility" && t.type === "component-visibility" ? e.operation === t.operation : e.type === "emit-host-event" && t.type === "emit-host-event" ? e.eventName === t.eventName : e.type === "host-action" && t.type === "host-action" ? e.actionId === t.actionId : !0 : !1;
2088
- }
2089
- //#endregion
2090
- //#region src/browser/controllers/blueprint/designer-blueprint-canvas-bridge-helpers.ts
2091
- function U(e) {
2092
- return typeof e == "object" && !!e && !Array.isArray(e);
2093
- }
2094
- function Ct(e, t) {
2095
- return {
2096
- severity: "error",
2097
- code: e,
2098
- path: [],
2099
- message: t
2100
- };
2101
- }
2102
- function wt(e, t) {
2103
- return {
2104
- ok: !1,
2105
- diagnostics: [Ct(e, t)]
2106
- };
2107
- }
2108
- function Tt(e, t) {
2109
- let n = U(e) && typeof e.commandId == "string" ? e.commandId.slice(0, 128) : "invalid-command";
2110
- return m({
2111
- commandId: n,
2112
- status: "rejected",
2113
- diagnostics: t
2114
- });
2115
- }
2116
- function Et(e) {
2117
- return { hasBlueprintCapability: (t) => {
2118
- try {
2119
- return e()?.hasBlueprintCapability(t) === !0;
2120
- } catch {
2121
- return !1;
2122
- }
2123
- } };
2124
- }
2125
- function Dt(e) {
2126
- return e === "duplicate" ? b.blueprint.duplicateConnection : e === "source-unconnected" ? b.blueprint.sourceNodeUnconnected : e === "unconfigured" ? b.blueprint.nodeNeedsConfiguration : b.blueprint.invalidConnection;
2127
- }
2128
- //#endregion
2129
- //#region src/browser/controllers/blueprint/designer-blueprint-canvas-bridge.ts
2130
- var Ot = 256, W = class {
2131
- callbacks;
2132
- #e;
2133
- #t;
2134
- #n = null;
2135
- #r;
2136
- #i = 0;
2137
- #a = /* @__PURE__ */ new Map();
2138
- #o = (e) => this.receive(e);
2139
- constructor(e) {
2140
- this.callbacks = e;
2141
- }
2142
- get canvas() {
2143
- return this.#t;
2144
- }
2145
- get trace() {
2146
- return this.#n;
2147
- }
2148
- connect(e) {
2149
- this.#e !== e && (this.disconnect(), this.#e = e, e.addEventListener(l, this.#o));
2150
- }
2151
- disconnect() {
2152
- this.#e?.removeEventListener(l, this.#o), this.#e = void 0;
2153
- }
2154
- setCanvas(e) {
2155
- return e !== this.#t && (this.#t = e, this.#i++, this.#a.clear(), this.#r = void 0, !0);
2156
- }
2157
- reset() {
2158
- this.#n = null, this.#r = void 0, this.#a.clear();
2159
- }
2160
- dispatchState(e = this.callbacks.getGraph()) {
2161
- let t = this.#t;
2162
- if (t === void 0) return;
2163
- let n = this.callbacks.getViewRequest(), r = m({
2164
- generation: this.#i,
2165
- documentRevision: this.callbacks.getDocumentRevision(),
2166
- projectRevision: this.callbacks.getProjectRevision(),
2167
- active: this.callbacks.getMode() === "blueprint",
2168
- canUndo: this.callbacks.canUndo(),
2169
- canRedo: this.callbacks.canRedo(),
2170
- graph: e,
2171
- selection: this.callbacks.getSelection(),
2172
- diagnostics: this.stateDiagnostics(),
2173
- trace: this.#n,
2174
- ...n === void 0 ? {} : { viewRequest: n },
2175
- ...this.#r === void 0 ? {} : { lastCommand: this.#r }
2176
- });
2177
- t.dispatchEvent(new CustomEvent(s, { detail: { state: r } }));
2178
- }
2179
- commitBlueprint(e) {
2180
- let t = this.callbacks.getDocument();
2181
- if (t === void 0) return wt("AUTHORING_EXPIRED", b.lifecycle.unloaded);
2182
- if (e === null) return wt("AUTHORING_REQUEST_INVALID", b.blueprint.invalidCommand);
2183
- if (JSON.stringify(e) === JSON.stringify(t.blueprint)) return {
2184
- ok: !0,
2185
- value: t,
2186
- diagnostics: []
2187
- };
2188
- let n = S({
2189
- ...t,
2190
- blueprint: e
2191
- });
2192
- if (!n.ok) return n;
2193
- let r = ie(n.value, this.capabilities);
2194
- return r.ok ? this.callbacks.executeCommand({
2195
- type: "replace-blueprint",
2196
- blueprint: n.value.blueprint
2197
- }) : {
2198
- ok: !1,
2199
- diagnostics: r.diagnostics
2200
- };
2201
- }
2202
- stateDiagnostics() {
2203
- let e = this.callbacks.getDocument(), t = e === void 0 ? void 0 : ie(e, this.capabilities);
2204
- return [...t !== void 0 && !t.ok ? t.diagnostics : [], ...this.#r?.diagnostics ?? []];
2205
- }
2206
- receive(e) {
2207
- if (this.#t === void 0 || !e.composedPath().includes(this.#t)) return;
2208
- let t = e.detail, n = U(t) && Object.keys(t).length === 1 && "command" in t ? t.command : void 0, i = r(n);
2209
- if (!i.ok) {
2210
- this.rejectUnknown(n, i.diagnostics);
2211
- return;
2212
- }
2213
- let a = i.value, o = this.#a.get(a.commandId);
2214
- if (o !== void 0) {
2215
- this.#r = o, this.dispatchState();
2216
- return;
2217
- }
2218
- if (a.generation !== this.#i || a.documentRevision !== this.callbacks.getDocumentRevision()) {
2219
- this.finish(a.commandId, "rejected", [Ct("AUTHORING_EXPIRED", b.blueprint.staleCommand)]);
2220
- return;
2221
- }
2222
- this.execute(a);
2223
- }
2224
- execute(e) {
2225
- if (e.type === "ready") {
2226
- this.finish(e.commandId, "accepted", []);
2227
- return;
2228
- }
2229
- let t = this.callbacks.getDocument();
2230
- if (t === void 0) {
2231
- this.finish(e.commandId, "rejected", [Ct("AUTHORING_EXPIRED", b.lifecycle.unloaded)]);
2232
- return;
2233
- }
2234
- let n = {
2235
- ok: !0,
2236
- value: null,
2237
- diagnostics: []
2238
- };
2239
- switch (e.type) {
2240
- case "select":
2241
- n = this.callbacks.select(e.selection, !1);
2242
- break;
2243
- case "connect": {
2244
- let r = vt(t, e.sourceNodeId, e.sourceHandle, e.targetNodeId, e.targetHandle, We(t, this.callbacks.getCatalog(), this.callbacks.getRuntimeContributions()));
2245
- n = r.ok ? this.commitBlueprint(r.blueprint) : wt("AUTHORING_REQUEST_INVALID", Dt(r.reason)), n.ok && r.ok && (n = this.callbacks.select(r.selection, !1));
2246
- break;
2247
- }
2248
- case "delete-selection":
2249
- n = this.commitBlueprint(Ne(t.blueprint, e.selection)), n.ok && this.callbacks.select(null, !1);
2250
- break;
2251
- case "insert-node": {
2252
- let r = e.kind === "component" ? E(e.componentId) : e.kind === "variable" ? fe(e.variableId) : T, i = e.kind === "component" ? je(t, e.componentId, e.position) : e.kind === "variable" ? k(t, e.variableId, e.position) : Me(t.blueprint, e.position);
2253
- n = this.commitBlueprint(i), n.ok && (n = this.callbacks.select({
2254
- kind: "node",
2255
- id: r
2256
- }, !1));
2257
- break;
2258
- }
2259
- case "commit-layout": {
2260
- let r = new Set(this.callbacks.getGraph().nodes.map((e) => e.id)), i = new Set(e.nodes.map((e) => e.id));
2261
- n = r.size !== i.size || [...r].some((e) => !i.has(e)) ? wt("AUTHORING_REQUEST_INVALID", b.blueprint.staleCommand) : this.commitBlueprint(Pe(t.blueprint, e.nodes, e.viewport));
2262
- break;
2263
- }
2264
- case "commit-viewport":
2265
- if ((t.blueprint.layout?.nodes.length ?? 0) === 0) break;
2266
- n = this.commitBlueprint(Fe(t.blueprint, e.viewport));
2267
- break;
2268
- case "history-undo":
2269
- n = this.callbacks.undo();
2270
- break;
2271
- case "history-redo":
2272
- n = this.callbacks.redo();
2273
- break;
2274
- case "run-simulation": n = this.runSimulation(e.componentId, e.eventName, e.payload);
2275
- }
2276
- this.finish(e.commandId, n.ok ? "accepted" : "rejected", n.diagnostics);
2277
- }
2278
- runSimulation(e, t, n) {
2279
- let r = this.callbacks.getDocument();
2280
- if (r === void 0) return wt("AUTHORING_EXPIRED", b.lifecycle.unloaded);
2281
- let i = ie(r, this.capabilities);
2282
- if (!i.ok) return i;
2283
- let a = ae(i.value, i.value.initialVariables, {
2284
- componentId: e,
2285
- name: t,
2286
- payload: n
2287
- });
2288
- if (!a.ok) return a;
2289
- let o = [], s = [], c = [], l = [], u = x(r.blueprint);
2290
- for (let e of a.value.ruleTraces) {
2291
- if (!e.triggerMatched) continue;
2292
- let t = u.find((t) => t.id === e.ruleId);
2293
- if (e.condition === "failed") s.push(e.ruleId), t !== void 0 && c.push(...t.relationIds);
2294
- else if (t !== void 0) for (let n of e.actions) {
2295
- let e = t.relationIds[n.actionIndex];
2296
- e !== void 0 && o.push(`relation:${e}`);
2297
- }
2298
- let n = e.condition === "failed" ? b.blueprint.conditionStates.failed : e.condition === "passed" ? b.blueprint.conditionStates.passed : b.blueprint.conditionStates.none;
2299
- l.push(b.blueprint.simulationLine(e.ruleId, n, e.actions.length));
2300
- }
2301
- return l.length === 0 && l.push(b.blueprint.simulationEmpty), this.#n = {
2302
- executedEdgeIds: o,
2303
- failedRuleIds: s,
2304
- failedRelationIds: c,
2305
- lines: l
2306
- }, {
2307
- ok: !0,
2308
- value: null,
2309
- diagnostics: []
2310
- };
2311
- }
2312
- finish(e, t, n) {
2313
- let r = m({
2314
- commandId: e,
2315
- status: t,
2316
- diagnostics: n
2317
- });
2318
- this.#r = r, this.#a.set(e, r), this.#a.size > Ot && this.#a.delete(this.#a.keys().next().value), this.callbacks.render(), t === "rejected" && this.callbacks.emitDiagnostics(n);
2319
- }
2320
- rejectUnknown(e, t) {
2321
- this.#r = Tt(e, t), this.callbacks.render(), this.callbacks.emitDiagnostics(t);
2322
- }
2323
- get capabilities() {
2324
- return Et(this.callbacks.getRuntimeContributions);
2325
- }
2326
- };
2327
- //#endregion
2328
- //#region src/browser/dom/blueprint/designer-blueprint-host-left-panel-dom.ts
2329
- function G(e, t, n) {
2330
- for (let n of e.querySelectorAll(".host-left-panel-view[data-host-left-panel-group]")) {
2331
- let e = n.dataset.hostLeftPanelGroup === t?.id;
2332
- n.hidden = !e, e && t !== void 0 && n.setAttribute("aria-labelledby", f(t.id));
2333
- }
2334
- let r = e.querySelector("[data-left-panel-count]");
2335
- r !== null && (r.hidden = t !== void 0, t === void 0 ? (r.textContent = String(n), r.setAttribute("aria-label", b.blueprint.panelCount(b.blueprint.library, n))) : (r.textContent = "", r.removeAttribute("aria-label")));
2336
- let i = e.querySelector("[data-left-panel-title]");
2337
- i !== null && (i.textContent = t?.label ?? b.blueprint.library);
2338
- let a = e.querySelector("[data-left-panel-scope]");
2339
- a !== null && (a.textContent = t === void 0 ? b.panelScope.builtin : b.panelScope.host);
2340
- }
2341
- //#endregion
2342
- //#region src/common/operations/blueprint/designer-blueprint-value-sources.ts
2343
- var K = new RegExp(ce);
2344
- function kt(e, t) {
2345
- let n = e.blueprint.relations.find((e) => e.id === t);
2346
- return n?.type === "behavior" && n.source.kind === "component";
2347
- }
2348
- function At(e) {
2349
- let t = e.split(".").map((e) => e.trim());
2350
- return t.length === 0 || t.length > oe || t.some((e) => e === "" || !K.test(e)) ? null : t;
2351
- }
2352
- function jt(e) {
2353
- return e.kind === "literal" ? "literal" : e.kind === "event-payload" ? e.path.length === 0 ? "event" : "event-field" : e.kind === "variable" ? "variable" : "advanced";
2354
- }
2355
- function Mt(e, t, n) {
2356
- let r = e.blueprint.relations.find((e) => e.id === t);
2357
- if (r?.type !== "behavior" || r.source.kind !== "component") return [];
2358
- let i = r.source, a = e.components.find((e) => e.id === i.componentId), o = n?.get(a?.type ?? "")?.manifest.editorDescriptor?.events?.find((e) => e.name === i.event.eventName)?.payloadSchema;
2359
- return o === void 0 ? [] : q(o);
2360
- }
2361
- function q(e, t = []) {
2362
- return Object.entries(e.properties).flatMap(([e, n]) => {
2363
- let r = [...t, e];
2364
- return n.kind === "object" ? [r, ...q(n, r)] : [r];
2365
- });
2366
- }
2367
- //#endregion
2368
- //#region src/browser/dom/blueprint/designer-blueprint-inspector-configuration.ts
2369
- var J = [
2370
- "eq",
2371
- "neq",
2372
- "gt",
2373
- "gte",
2374
- "lt",
2375
- "lte",
2376
- "contains",
2377
- "exists"
2378
- ];
2379
- function Nt(e, t, n, r) {
2380
- if (e === void 0 || n === null) return $t();
2381
- if (n.kind === "node") {
2382
- let r = t.nodes.find((e) => e.id === n.id);
2383
- return r === void 0 ? $t() : r.kind === "component" ? Y(e, t, r) : r.kind === "variable" ? Pt(e, t, r) : r.kind === "host" ? Ft(e, t, r) : $t();
2384
- }
2385
- let i = t.edges.find((e) => e.id === n.id);
2386
- if (i === void 0) return $t();
2387
- let a = i.relationId === void 0 ? void 0 : e.blueprint.relations.find((e) => e.id === i.relationId);
2388
- return i.kind === "semantic" && a?.type === "semantic" ? Lt(e, a) : i.kind === "relation" && a?.type === "behavior" ? It(e, t, a, i, r) : Rt(e, i);
2389
- }
2390
- function Y(e, n, r) {
2391
- let i = r.componentId ?? "", a = e.components.find((e) => e.id === i), s = n.edges.filter((e) => e.target === r.id), c = n.edges.filter((e) => e.source === r.id), l = n.edges.filter((e) => e.kind === "dependency" && e.target === r.id), u = a?.parentId ?? null, d = e.components.filter((e) => e.parentId === i), f = (r.events ?? []).map((e) => `<span data-available="${String(e.available)}"><i aria-hidden="true"></i><strong>${o(e.label)}</strong><small>${o(e.name)}</small></span>`).join("");
2392
- return `${Kt(i, r.materialType ?? "")}
2393
- ${X(b.blueprint.nodeInformation, `<dl class="blueprint-inspector-facts">
2394
- ${Z(b.blueprint.sourceComponent, a?.name ?? i)}
2395
- ${Z(b.blueprint.nodeIdentifier, i)}
2396
- ${Z(b.blueprint.relationCategories.structure, b.blueprint.relationCounts(r.outboundCount ?? c.length, r.inboundCount ?? s.length))}
2397
- </dl>`)}
2398
- ${X(b.blueprint.outputEvents, `<div class="blueprint-port-list">${f || `<p>${b.blueprint.noEvents}</p>`}</div>`)}
2399
- ${X(b.blueprint.structureTitle, `<dl class="blueprint-inspector-facts">
2400
- ${Z(b.blueprint.structure.parent, u === null ? "—" : Xt(e, u))}
2401
- ${Z(b.blueprint.structure.children, d.length === 0 ? "—" : d.map((e) => e.name).join("、"))}
2402
- </dl>`)}
2403
- ${X(b.blueprint.inputActions, Gt(e, s))}
2404
- ${X(b.blueprint.outputEvents, Gt(e, c))}
2405
- ${X(b.blueprint.linkedVariablesTitle, l.length === 0 ? `<p>${b.blueprint.linkedVariablesEmpty(0)}</p>` : `<div class="blueprint-action-summary-list">${l.map((n) => `<button type="button" class="blueprint-action-summary" data-blueprint-select-relation="${t(n.id)}"><em>${_("variable")}</em><strong>${o(Qt(e, n.source))}</strong><small>${b.blueprint.readLabel}</small></button>`).join("")}</div>`)}
2406
- ${Q()}`;
2407
- }
2408
- function Pt(e, t, n) {
2409
- let r = e.variables.find((e) => e.id === n.variableId);
2410
- if (r === void 0) return $t();
2411
- let i = g(e, r), a = t.edges.filter((e) => e.target === n.id && e.kind === "relation"), o = t.edges.filter((e) => e.source === n.id && e.kind === "dependency"), s = i.type === "static" ? i.type : i.sourceId;
2412
- return `${Kt(i.id, b.blueprint.variableKind[i.type])}
2413
- ${X(b.blueprint.variableValueTitle, `<dl class="blueprint-inspector-facts">
2414
- ${Z(b.variables.name, i.name)}
2415
- ${Z(b.variables.sourceId, s)}
2416
- ${Z(b.variables.initialValue, JSON.stringify(i.initialValue))}
2417
- ${Z(b.blueprint.variableCounts(n.writeCount ?? 0, n.readCount ?? 0), b.blueprint.relationCategories.data)}
2418
- </dl>`)}
2419
- ${X(b.blueprint.inputActions, Gt(e, a))}
2420
- ${X(b.blueprint.linkedVariablesTitle, Gt(e, o))}
2421
- ${X(b.blueprint.directNodeHint, `<p>${b.blueprint.setVariableHint}</p>`)}
2422
- ${Q()}`;
2423
- }
2424
- function Ft(e, t, n) {
2425
- let r = t.edges.filter((e) => e.target === n.id && e.kind === "relation");
2426
- return `${Kt(n.id, b.blueprint.hostNode)}
2427
- ${X(b.blueprint.hostNode, `<p>${b.blueprint.hostNodeHint}</p>`)}
2428
- ${X(b.blueprint.exitRelations, Gt(e, r))}
2429
- ${Q()}`;
2430
- }
2431
- function It(e, n, r, i, a) {
2432
- let o = n.nodes.find((e) => e.id === i.source), s = Qt(e, i.source), c = Qt(e, i.target);
2433
- return `${Kt(r.id, `${b.blueprint.relationCategories[le(r)]} · ${b.blueprint.relationEffects[r.effect.type]}`)}
2434
- ${X(b.blueprint.relationNode.source, `<dl class="blueprint-inspector-facts">
2435
- ${Z(b.blueprint.relationNode.sourceComponent, s)}
2436
- ${Z(b.blueprint.relationNode.target, c)}
2437
- </dl>
2438
- <label class="blueprint-inspector-field"><span>${b.blueprint.relationNode.event}</span>
2439
- <select class="designer-control designer-select" data-relation-id="${t(r.id)}" data-blueprint-source-event="true">
2440
- ${Wt(r, o).join("")}
2441
- </select>
2442
- </label>`)}
2443
- ${zt(r)}
2444
- ${Bt(e, r, a)}
2445
- ${Q()}`;
2446
- }
2447
- function Lt(e, n) {
2448
- return `${Kt(n.id, b.blueprint.relationCategories.semantic)}
2449
- ${X(b.blueprint.semanticRoleTitle, `<div class="blueprint-action-summary-list">
2450
- <span><em>1</em><strong>${o(Xt(e, n.source.componentId))} → ${o(Xt(e, n.target.componentId))}</strong><small>${b.blueprint.selectionType.edge}</small></span>
2451
- </div>
2452
- <div class="blueprint-inspector-role-list" role="group" aria-label="${b.blueprint.semanticRoleTitle}">
2453
- ${[
2454
- "related",
2455
- "detail",
2456
- "group",
2457
- "drill-down"
2458
- ].map((e) => `<button type="button" class="designer-control designer-button" data-relation-id="${t(n.id)}" data-blueprint-semantic-role="${e}" data-active="${String(n.role === e)}">${b.blueprint.semanticRoles[e]}</button>`).join("")}
2459
- </div>`)}
2460
- ${X(b.blueprint.semanticHintTitle, `<p>${b.blueprint.semanticHint}</p>`)}
2461
- ${Q()}`;
2462
- }
2463
- function Rt(e, t) {
2464
- let n = Qt(e, t.source), r = Qt(e, t.target), i = t.kind === "containment" ? b.blueprint.relationCategories.structure : b.blueprint.lockedDependency, a = t.kind === "containment" ? b.blueprint.relationList.containmentHint : b.blueprint.lockedDependency;
2465
- return `${Kt(t.id, i)}
2466
- ${X(b.blueprint.nodeConnectionState, `<dl class="blueprint-inspector-facts">
2467
- ${Z(b.blueprint.relationNode.source, n)}
2468
- ${Z(b.blueprint.relationNode.target, r)}
2469
- </dl><p>${o(a)}</p>`)}`;
2470
- }
2471
- function zt(e) {
2472
- return e.condition === void 0 ? X(b.blueprint.conditionExpression, `<p>${b.blueprint.relationNode.noCondition}</p>
2473
- <button type="button" class="designer-control designer-button" data-relation-id="${t(e.id)}" data-blueprint-add-condition>${b.blueprint.relationNode.addCondition}</button>`) : X(b.blueprint.conditionExpression, `<div class="blueprint-expression-grid">
2474
- ${qt(b.blueprint.conditionLeft, e.condition.left)}
2475
- ${qt(b.blueprint.conditionRight, e.condition.right, b.blueprint.noConditionRight)}
2476
- </div>
2477
- <label class="blueprint-inspector-field"><span>${b.blueprint.conditionOperatorLabel}</span>
2478
- <select class="designer-control designer-select" data-relation-id="${t(e.id)}" data-blueprint-condition-operator>
2479
- ${J.map((t) => `<option value="${t}"${t === e.condition?.operator ? " selected" : ""}>${b.blueprint.conditionOperator(t)}</option>`).join("")}
2480
- </select>
2481
- </label>
2482
- <button type="button" class="designer-control designer-button" data-relation-id="${t(e.id)}" data-blueprint-remove-condition>${b.blueprint.relationNode.removeCondition}</button>`);
2483
- }
2484
- function Bt(e, n, r) {
2485
- let i = n.effect, a = n.target.kind, o = a === "component" ? [{
2486
- type: "component-visibility",
2487
- label: b.blueprint.relationEffects["component-visibility"]
2488
- }, {
2489
- type: "request-component-data",
2490
- label: b.blueprint.relationEffects["request-component-data"]
2491
- }] : a === "variable" ? [{
2492
- type: "set-variable",
2493
- label: b.blueprint.relationEffects["set-variable"]
2494
- }, {
2495
- type: "request-variable",
2496
- label: b.blueprint.relationEffects["request-variable"]
2497
- }] : [{
2498
- type: "emit-host-event",
2499
- label: b.blueprint.relationEffects["emit-host-event"]
2500
- }, ...i.type === "host-action" ? [{
2501
- type: "host-action",
2502
- label: b.blueprint.relationEffects["host-action"]
2503
- }] : []];
2504
- return X(b.blueprint.relationNode.effect, `<div class="blueprint-inspector-role-list" role="group" aria-label="${b.blueprint.relationNode.effect}">
2505
- ${o.map((e) => `<button type="button" class="designer-control designer-button" data-relation-id="${t(n.id)}" data-blueprint-effect-type="${e.type}" data-active="${String(i.type === e.type)}">${e.label}</button>`).join("")}
2506
- </div>
2507
- ${Vt(e, n, r)}`);
2508
- }
2509
- function Vt(e, n, r) {
2510
- let i = n.effect, a = `data-relation-id="${t(n.id)}"`;
2511
- if (i.type === "component-visibility") return `<label class="blueprint-inspector-field"><span>${b.blueprint.operation}</span>
2512
- <select class="designer-control designer-select" data-blueprint-visibility-operation ${a}>
2513
- ${[
2514
- "show",
2515
- "hide",
2516
- "toggle"
2517
- ].map((e) => `<option value="${e}"${e === i.operation ? " selected" : ""}>${Yt(e)}</option>`).join("")}
2518
- </select>
2519
- </label>
2520
- <label class="blueprint-inspector-field"><span>${b.blueprint.transitionDuration}</span>
2521
- <input type="number" class="designer-control designer-input" min="0" max="60000" step="10" value="${i.transition?.durationMs ?? 0}" data-blueprint-transition-duration ${a}>
2522
- </label>`;
2523
- if (i.type === "request-component-data" || i.type === "request-variable") {
2524
- let t = n.target.kind === "component" ? Xt(e, n.target.componentId) : n.target.kind === "variable" ? Zt(e, n.target.variableId) : b.blueprint.hostNode;
2525
- return `<p>${b.blueprint.relationNode.target}:${o(t)}</p>`;
2526
- }
2527
- if (i.type === "set-variable") {
2528
- let o = jt(i.value), s = Mt(e, n.id, r), c = e.variables.filter((e) => n.target.kind !== "variable" || e.id !== n.target.variableId), l = kt(e, n.id);
2529
- return `<label class="blueprint-inspector-field"><span>${b.blueprint.variableId}</span>
2530
- <input type="text" class="designer-control designer-input" value="${t(n.target.kind === "variable" ? n.target.variableId : "")}" readonly>
2531
- </label>
2532
- <label class="blueprint-inspector-field"><span>${b.blueprint.valueSource}</span>
2533
- <select class="designer-control designer-select" data-blueprint-action-value-source ${a}>
2534
- ${Ht(o, l, c.length > 0)}
2535
- </select>
2536
- </label>
2537
- ${Ut(i.value, o, s, c, a)}`;
2538
- }
2539
- return i.type === "emit-host-event" ? `<label class="blueprint-inspector-field"><span>${b.blueprint.eventName}</span>
2540
- <input type="text" class="designer-control designer-input" value="${t(i.eventName)}" data-blueprint-action-event ${a}>
2541
- </label>
2542
- <p>${b.blueprint.eventPayloadValue("")}</p>` : `<p>${o(i.actionId)}</p>`;
2543
- }
2544
- function Ht(e, t, n) {
2545
- return [
2546
- {
2547
- value: "literal",
2548
- label: b.blueprint.valueSources.literal
2549
- },
2550
- {
2551
- value: "event",
2552
- label: b.blueprint.valueSources.event
2553
- },
2554
- {
2555
- value: "event-field",
2556
- label: b.blueprint.valueSources.eventField,
2557
- disabled: !t
2558
- },
2559
- {
2560
- value: "variable",
2561
- label: b.blueprint.valueSources.variable,
2562
- disabled: !n
2563
- }
2564
- ].map((t) => `<option value="${t.value}"${t.value === e ? " selected" : ""}${t.disabled === !0 ? " disabled" : ""}>${t.label}</option>`).join("");
2565
- }
2566
- function Ut(e, n, r, i, a) {
2567
- if (n === "literal") return `<label class="blueprint-inspector-field"><span>${b.blueprint.literalJson}</span>
2568
- <input type="text" class="designer-control designer-input" value="${t(e.kind === "literal" ? JSON.stringify(e.value) ?? "null" : "")}" data-blueprint-action-value ${a}>
2569
- </label>`;
2570
- if (n === "event-field") {
2571
- let n = e.kind === "event-payload" ? e.path : [], i = `blueprint-event-field-${a.replace(/[^A-Za-z0-9]+/g, "-")}`;
2572
- return `<label class="blueprint-inspector-field"><span>${b.blueprint.eventField}</span>
2573
- <input type="text" class="designer-control designer-input" value="${t(n.join("."))}" placeholder="row.city" list="${t(i)}" spellcheck="false" data-blueprint-action-event-path ${a}>
2574
- <datalist id="${t(i)}">${r.map((e) => `<option value="${t(e.join("."))}"></option>`).join("")}</datalist>
2575
- </label>`;
2576
- }
2577
- if (n === "variable") {
2578
- let n = e.kind === "variable" ? e.variableId : "";
2579
- return `<label class="blueprint-inspector-field"><span>${b.blueprint.sourceVariable}</span>
2580
- <select class="designer-control designer-select" data-blueprint-action-source-variable ${a}>
2581
- ${i.map((e) => `<option value="${t(e.id)}"${e.id === n ? " selected" : ""}>${o(e.name)}</option>`).join("")}
2582
- </select>
2583
- </label>`;
2584
- }
2585
- return "";
2586
- }
2587
- function Wt(e, n) {
2588
- return e.source.kind === "variable" ? ["data-updated", "request-state"].map((t) => `<option value="${t}"${e.source.event.eventName === t ? " selected" : ""}>${t}</option>`) : (n?.events ?? []).map((n) => `<option value="${t(n.name)}"${e.source.event.eventName === n.name ? " selected" : ""}${n.available ? "" : " disabled"}>${o(n.label)}${n.available ? "" : ` · ${b.blueprint.relationNode.sourceEventUnavailable}`}</option>`);
2589
- }
2590
- function Gt(e, n) {
2591
- return n.length === 0 ? `<p>${b.blueprint.noActions}</p>` : `<div class="blueprint-action-summary-list">${n.map((n) => {
2592
- let r = Qt(e, n.source), i = Qt(e, n.target), a = n.kind === "containment" ? b.blueprint.relationList.containment : n.kind === "dependency" ? b.blueprint.readLabel : n.effectType === void 0 ? n.kind : b.blueprint.relationEffects[n.effectType];
2593
- return `<button type="button" class="blueprint-action-summary" data-blueprint-select-relation="${t(n.id)}"><em>${_(n.kind === "containment" ? "group" : n.kind === "dependency" ? "variable" : "link")}</em><strong>${o(r)} → ${o(i)}</strong><small>${o(a)}</small></button>`;
2594
- }).join("")}</div>`;
2595
- }
2596
- function Kt(e, t) {
2597
- return X(b.blueprint.nodeInformation, `<dl class="blueprint-inspector-facts">
2598
- ${Z(b.blueprint.nodeIdentifier, e)}
2599
- ${Z(b.blueprint.nodeType, t)}
2600
- </dl>`);
2601
- }
2602
- function X(e, t) {
2603
- return `<section class="designer-panel-section blueprint-inspector-section" data-variant="header"><header><h3 class="designer-panel-section-title">${o(e)}</h3><span class="designer-panel-section-disclosure" aria-hidden="true">${_("chevron-down")}</span></header><div class="blueprint-inspector-section-content">${t}</div></section>`;
2604
- }
2605
- function Z(e, t) {
2606
- return `<div><dt>${o(e)}</dt><dd>${o(t)}</dd></div>`;
2607
- }
2608
- function qt(e, t, n = "") {
2609
- return `<span><small>${o(e)}</small><strong>${o(t === void 0 ? n : Jt(t))}</strong></span>`;
2610
- }
2611
- function Jt(e) {
2612
- return e.kind === "literal" ? b.blueprint.literalValue(JSON.stringify(e.value) ?? "null") : e.kind === "event-payload" ? b.blueprint.eventPayloadValue(e.path.join(".")) : e.kind === "variable" ? b.blueprint.variableValue(e.variableId) : e.kind === "array" ? b.blueprint.arrayValue(e.items.length) : b.blueprint.objectValue(Object.keys(e.properties).length);
2613
- }
2614
- function Q() {
2615
- return `<button type="button" class="designer-control designer-button blueprint-delete-button" data-variant="danger" data-blueprint-delete>${b.blueprint.deleteSelection}</button>`;
2616
- }
2617
- function Yt(e) {
2618
- return e === "show" ? b.blueprint.visibilityOperation.show : e === "hide" ? b.blueprint.visibilityOperation.hide : b.blueprint.visibilityOperation.toggle;
2619
- }
2620
- function Xt(e, t) {
2621
- return e.components.find((e) => e.id === t)?.name ?? t;
2622
- }
2623
- function Zt(e, t) {
2624
- return e.variables.find((e) => e.id === t)?.name ?? t;
2625
- }
2626
- function Qt(e, t) {
2627
- if (t === "host") return b.blueprint.hostNode;
2628
- if (t.startsWith("component:")) return Xt(e, t.slice(10));
2629
- if (t.startsWith("variable:")) {
2630
- let n = t.slice(9);
2631
- return e.variables.find((e) => e.id === n)?.name ?? n;
2632
- }
2633
- return t;
2634
- }
2635
- function $t() {
2636
- return `<div class="designer-empty"><span class="designer-empty-icon" aria-hidden="true">${_("sliders")}</span><p class="designer-empty-title">${b.blueprint.inspectorEmpty}</p><p class="designer-empty-hint">${b.blueprint.inspectorEmptyHint}</p></div>`;
2637
- }
2638
- //#endregion
2639
- //#region src/browser/dom/blueprint/designer-blueprint-inspector-dom.ts
2640
- var en = [
2641
- "configuration",
2642
- "problems",
2643
- "trace"
2644
- ];
2645
- function tn(e, t, n, r, i, a, s, c) {
2646
- if (e === void 0) return;
2647
- let l = {
2648
- configuration: r === null ? 0 : 1,
2649
- problems: a.length,
2650
- trace: s?.executedEdgeIds.length ?? 0
2651
- }, u = on(t, n, r, i);
2652
- e.innerHTML = `<div class="blueprint-inspector-shell">
2653
- <header class="blueprint-inspector-topbar">
2654
- <span><strong>${o(u.title)}</strong><small>${o(u.detail)}</small></span>
2655
- <div class="blueprint-inspector-modes" role="tablist" aria-label="${b.blueprint.inspector}">
2656
- ${en.map((e) => sn(e, i, l[e])).join("")}
2657
- </div>
2658
- </header>
2659
- <div class="blueprint-panel-scroll" id="designer-blueprint-inspector-${i}-panel" role="tabpanel" aria-labelledby="designer-blueprint-inspector-${i}-tab" tabindex="0" aria-live="polite">
2660
- ${nn(i, t, n, r, a, s, c)}
2661
- </div>
2662
- </div>`;
2663
- }
2664
- function nn(e, t, n, r, i, a, o) {
2665
- return e === "problems" ? rn(i) : e === "trace" ? an(a) : Nt(t, n, r, o);
2666
- }
2667
- function rn(e) {
2668
- let t = e.slice(0, 8);
2669
- return t.length === 0 ? `<div class="designer-empty" data-tone="success"><span class="designer-empty-icon" aria-hidden="true">${_("check")}</span><p class="designer-empty-title">${b.blueprint.problemsHealthy}</p><p class="designer-empty-hint">${b.blueprint.problemsHealthyHint}</p></div>` : `<section class="blueprint-inspector-status" data-blueprint-problems><ul>${t.map((e) => `<li data-severity="${e.severity}"><strong>${o(e.code)}</strong><span>${o(e.message)}</span><small>${o(e.path.join(".") || "—")}</small></li>`).join("")}</ul></section>`;
2670
- }
2671
- function an(e) {
2672
- return e === null ? `<div class="designer-empty"><span class="designer-empty-icon" aria-hidden="true">${_("terminal")}</span><p class="designer-empty-title">${b.blueprint.noTrace}</p><p class="designer-empty-hint">${b.blueprint.noTraceHint}</p></div>` : `<section class="blueprint-inspector-status" data-blueprint-trace>
2673
- <div class="blueprint-trace-summary">${b.blueprint.traceSummary(e.executedEdgeIds.length, e.failedRuleIds.length)}</div>
2674
- <ol>${e.lines.slice(-20).map((e) => `<li>${o(e)}</li>`).join("")}</ol>
2675
- </section>`;
2676
- }
2677
- function on(e, t, n, r) {
2678
- if (r === "problems") return {
2679
- title: b.blueprint.problemsTitle,
2680
- detail: b.blueprint.inspector
2681
- };
2682
- if (r === "trace") return {
2683
- title: b.blueprint.traceTitle,
2684
- detail: b.blueprint.inspector
2685
- };
2686
- if (n === null) return {
2687
- title: b.blueprint.inspector,
2688
- detail: b.blueprint.inspectorEmpty
2689
- };
2690
- let i = n.kind === "node" ? t.nodes.find((e) => e.id === n.id) : void 0;
2691
- if (i?.kind === "component") return {
2692
- title: i.componentName ?? i.componentId ?? b.blueprint.layers,
2693
- detail: i.materialType ?? b.blueprint.selectionType.component
2694
- };
2695
- if (i?.kind === "host") return {
2696
- title: b.blueprint.hostNode,
2697
- detail: b.blueprint.hostNodeHint
2698
- };
2699
- if (i?.kind === "variable") return {
2700
- title: i.variableName ?? i.variableId ?? b.blueprint.globalVariables,
2701
- detail: i.variableType === void 0 ? b.blueprint.globalVariables : b.blueprint.variableKind[i.variableType]
2702
- };
2703
- let a = t.edges.find((e) => e.id === n.id);
2704
- return {
2705
- title: (a?.relationId === void 0 ? void 0 : e?.blueprint.relations.find((e) => e.id === a.relationId))?.id ?? a?.id ?? b.blueprint.selectionType.edge,
2706
- detail: a?.kind === "semantic" ? b.blueprint.semanticRoles[a.semanticRole ?? "related"] : a?.kind === "containment" ? b.blueprint.relationCategories.structure : a?.kind === "dependency" ? b.blueprint.readLabel : a?.effectType === void 0 ? b.blueprint.selectionType.edge : b.blueprint.relationEffects[a.effectType]
2707
- };
2708
- }
2709
- function sn(e, t, n) {
2710
- let r = b.blueprint.inspectorTabs[e];
2711
- return `<button type="button" class="blueprint-inspector-mode" id="designer-blueprint-inspector-${e}-tab" role="tab" aria-controls="designer-blueprint-inspector-${e}-panel" aria-selected="${String(e === t)}" tabindex="${e === t ? 0 : -1}" data-blueprint-inspector-tab="${e}" data-tip="${r}" aria-label="${r}"><span aria-hidden="true">${_(e === "configuration" ? "sliders" : e === "problems" ? "check" : "terminal")}</span>${n === 0 ? "" : `<em>${n}</em>`}</button>`;
2712
- }
2713
- //#endregion
2714
- //#region src/browser/dom/blueprint/designer-blueprint-library-dom.ts
2715
- var cn = [
2716
- "components",
2717
- "relations",
2718
- "variables"
2719
- ];
2720
- function ln(e, n, r, i, o, s, l, u) {
2721
- if (e === void 0) return;
2722
- let d = (u ?? []).filter((e) => h(e, "blueprint")), f = c(l), p = d.some((e) => e.id === f) ? f : void 0, m = bn(l) ? l : "components", g = p === void 0 ? m : a(p);
2723
- e.innerHTML = `<div class="blueprint-library-shell">
2724
- <nav class="rail-tabs blueprint-library-rail" role="tablist" aria-orientation="vertical" aria-label="${b.blueprint.library}">
2725
- ${cn.map((e) => vn(e, g)).join("")}
2726
- ${d.map((e) => yn(e, p)).join("")}
2727
- </nav>
2728
- <section class="rail-view blueprint-library-main"${p === void 0 ? "" : " hidden"}>
2729
- <div class="layer-panel-controls blueprint-library-controls">
2730
- <label class="designer-field layer-search blueprint-library-search">
2731
- <span class="layer-search-glyph" aria-hidden="true">${_("search")}</span>
2732
- <input type="search" class="designer-control designer-input" data-blueprint-library-search value="${t(s)}" placeholder="${m === "relations" ? b.blueprint.relationList.search : b.blueprint.librarySearch}" aria-label="${m === "relations" ? b.blueprint.relationList.search : b.blueprint.librarySearch}">
2733
- </label>
2734
- </div>
2735
- <div class="blueprint-panel-scroll" id="designer-blueprint-library-${m}-panel" role="tabpanel" aria-labelledby="designer-blueprint-library-${m}-tab" tabindex="0">
2736
- ${un(m, n, r, i, o, s)}
2737
- </div>
2738
- </section>
2739
- </div>`;
2740
- }
2741
- function un(e, t, n, r, i, a) {
2742
- let o = a.trim().toLocaleLowerCase();
2743
- return e === "components" ? dn(n, r, i, o) : e === "relations" ? pn(t, n, i, o) : gn(t, n, i, o);
2744
- }
2745
- function dn(e, t, n, r) {
2746
- let i = new Set(e.nodes.filter((e) => e.kind === "component").map((e) => e.id)), a = t.filter((e) => e.kind === "component" && (r.length === 0 || `${e.componentName ?? ""} ${e.componentId ?? ""} ${e.materialType ?? ""}`.toLocaleLowerCase().includes(r)));
2747
- if (a.length === 0) return wn(b.blueprint.noComponentNodes);
2748
- let o = new Map(a.map((e) => [e.componentId ?? "", e])), s = new Map(e.nodes.filter((e) => e.componentId !== void 0).map((e) => [e.componentId ?? "", e])), c = (e) => {
2749
- let t = 0, n = e.parentId, r = /* @__PURE__ */ new Set();
2750
- for (; n !== void 0 && !r.has(n);) r.add(n), t += 1, n = o.get(n)?.parentId;
2751
- return t;
2752
- };
2753
- return `<section class="blueprint-palette-group" aria-label="${b.blueprint.layers}">
2754
- <header><strong>${b.blueprint.currentCanvas}</strong><span>${a.length}</span></header>
2755
- <div class="blueprint-palette-list">
2756
- ${a.map((e) => fn(e, i.has(e.id), n?.kind === "node" && n.id === e.id, c(e), s.get(e.componentId ?? ""))).join("")}
2757
- </div>
2758
- <p class="blueprint-library-hint">${b.blueprint.componentNodeHint}</p>
2759
- </section>`;
2760
- }
2761
- function fn(e, n, r, i = 0, a) {
2762
- let s = e.componentId ?? "", c = e.componentName ?? s, l = (e.events ?? []).filter((e) => e.available).length, u = n ? `data-blueprint-select-node="${t(e.id)}"` : `data-blueprint-add-component="${t(s)}"`, d = n ? b.blueprint.locateComponent(c) : b.blueprint.addComponent(c), f = e.childCount === void 0 ? "" : ` · ${b.blueprint.structure.children} ${e.childCount}`, p = n && a !== void 0 ? `<em class="blueprint-palette-counts">${o(b.blueprint.relationCounts(a.outboundCount ?? 0, a.inboundCount ?? 0))}</em>` : "";
2763
- return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-depth="${i}" style="--bp-indent: ${i * 16}px" data-placed="${String(n)}" data-selected="${String(r)}"${n ? "" : ` draggable="true" data-blueprint-drag-kind="component" data-component-id="${t(s)}" data-blueprint-drag-label="${t(c)}"`}>
2764
- <button type="button" class="blueprint-palette-primary" ${u} aria-label="${t(d)}">
2765
- <span class="blueprint-palette-glyph" aria-hidden="true">${_("layers")}</span>
2766
- <span><strong>${o(c)}</strong><small>${o(e.materialType ?? "")} · ${b.blueprint.componentEventCount(l)}${o(f)}</small></span>
2767
- ${p}
2768
- </button>
2769
- <button type="button" class="blueprint-palette-action" ${u} data-tip="${t(d)}" aria-label="${t(d)}">${_(n ? "locate" : "plus")}</button>
2770
- </div>`;
2771
- }
2772
- function pn(e, t, n, r) {
2773
- if (e === void 0) return wn(b.blueprint.relationList.noRelations);
2774
- let i = /* @__PURE__ */ new Map(), a = (e, t) => {
2775
- let n = i.get(e) ?? [];
2776
- n.push(t), i.set(e, n);
2777
- };
2778
- for (let i of e.blueprint.relations) {
2779
- let o = mn(e, t, i, n, r);
2780
- o !== null && a(le(i), o);
2781
- }
2782
- for (let i of t.edges) {
2783
- if (i.kind !== "containment") continue;
2784
- let t = hn(e, i, n, r);
2785
- t !== null && a("structure", t);
2786
- }
2787
- let o = t.nodes.find((e) => e.id === "host"), s = o === void 0 ? `<div class="designer-list-row blueprint-palette-item" data-density="default"><button type="button" class="blueprint-palette-primary" data-blueprint-insert-host aria-label="${b.blueprint.relationList.addHost}"><span class="blueprint-palette-glyph" aria-hidden="true">${_("activity")}</span><span><strong>${b.blueprint.hostNode}</strong><small>${b.blueprint.hostNodeHint}</small></span><span class="blueprint-palette-inline-add" aria-hidden="true">${_("plus")}</span></button></div>` : `<div class="designer-list-row blueprint-palette-item" data-density="default" data-placed="true" data-selected="${String(n?.kind === "node" && n.id === o.id)}"><button type="button" class="blueprint-palette-primary" data-blueprint-select-node="${o.id}" aria-label="${b.blueprint.hostNode}"><span class="blueprint-palette-glyph" aria-hidden="true">${_("activity")}</span><span><strong>${b.blueprint.hostNode}</strong><small>${b.blueprint.hostNodeHint}</small></span><em>${b.blueprint.placed}</em></button></div>`, c = `${[
2788
- "structure",
2789
- "interaction",
2790
- "data",
2791
- "exit",
2792
- "semantic"
2793
- ].map((e) => {
2794
- let t = i.get(e);
2795
- return t === void 0 || t.length === 0 ? "" : `<section class="blueprint-palette-group" aria-label="${b.blueprint.relationCategories[e]}"><header><strong>${b.blueprint.relationCategories[e]}</strong><span>${t.length}</span></header><div class="blueprint-palette-list">${t.join("")}</div></section>`;
2796
- }).join("")}${`<section class="blueprint-palette-group" aria-label="${b.blueprint.hostNode}"><header><strong>${b.blueprint.hostNode}</strong><span>${o === void 0 ? 0 : 1}</span></header><div class="blueprint-palette-list">${s}</div></section>`}`;
2797
- return c === "" ? wn(b.blueprint.relationList.noRelations) : c;
2798
- }
2799
- function mn(e, n, r, i, a) {
2800
- let s = r.type === "semantic" ? `semantic:${r.id}` : `relation:${r.id}`;
2801
- if (n.edges.find((e) => e.id === s) === void 0) return null;
2802
- let c = Cn(e, xn(r)), l = Cn(e, Sn(r)), u = r.type === "semantic" ? b.blueprint.semanticRoles[r.role] : `${r.source.event.eventName} · ${b.blueprint.relationEffects[r.effect.type]}`, d = `${c} ${l} ${u} ${r.type === "behavior" && r.condition !== void 0 ? b.blueprint.conditionExpression : b.blueprint.relationNode.noCondition}`.toLocaleLowerCase();
2803
- if (a.length > 0 && !d.includes(a)) return null;
2804
- let f = i?.kind === "edge" && i.id === s;
2805
- return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-kind="relation" data-selected="${String(f)}">
2806
- <button type="button" class="blueprint-palette-primary" data-blueprint-select-relation="${t(s)}" aria-label="${t(`${c} → ${l}`)}">
2807
- <span class="blueprint-palette-glyph" aria-hidden="true">${_(r.type === "semantic" ? "link" : "activity")}</span>
2808
- <span><strong>${o(c)} → ${o(l)}</strong><small>${o(u)}</small></span>
2809
- </button>
2810
- </div>`;
2811
- }
2812
- function hn(e, n, r, i) {
2813
- let a = Cn(e, n.source), s = Cn(e, n.target), c = b.blueprint.relationList.containment, l = `${a} ${s} ${c}`.toLocaleLowerCase();
2814
- if (i.length > 0 && !l.includes(i)) return null;
2815
- let u = r?.kind === "edge" && r.id === n.id;
2816
- return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-kind="structure" data-selected="${String(u)}">
2817
- <button type="button" class="blueprint-palette-primary" data-blueprint-select-relation="${t(n.id)}" aria-label="${t(`${a} → ${s}`)}" data-tip="${t(b.blueprint.relationList.containmentHint)}">
2818
- <span class="blueprint-palette-glyph" aria-hidden="true">${_("group")}</span>
2819
- <span><strong>${o(a)} → ${o(s)}</strong><small>${c}</small></span>
2820
- <em>${b.blueprint.relationList.readOnly}</em>
2821
- </button>
2822
- </div>`;
2823
- }
2824
- function gn(e, t, n, r) {
2825
- let i = new Set(t.nodes.filter((e) => e.kind === "variable").map((e) => e.id)), a = re(e).filter((e) => `${e.name} ${e.type} ${e.type === "static" ? JSON.stringify(e.initialValue) : e.sourceId}`.toLocaleLowerCase().includes(r));
2826
- return a.length === 0 ? wn(b.blueprint.noVariables) : `<div class="blueprint-palette-list">
2827
- ${a.map((e) => _n(e, i.has(`variable:${e.id}`), n?.kind === "node" && n.id === `variable:${e.id}`)).join("")}
2828
- </div>`;
2829
- }
2830
- function _n(e, n, r) {
2831
- let i = e.type === "static" ? JSON.stringify(e.initialValue) : e.sourceId, a = n ? `data-blueprint-select-node="variable:${t(e.id)}"` : `data-blueprint-add-variable="${t(e.id)}"`, s = n ? b.blueprint.locateVariable(e.name) : b.blueprint.addVariableNode(e.name);
2832
- return `<div class="designer-list-row blueprint-palette-item" data-density="default" data-kind="variable" data-placed="${String(n)}" data-selected="${String(r)}"${n ? "" : ` draggable="true" data-blueprint-drag-kind="variable" data-variable-id="${t(e.id)}" data-blueprint-drag-label="${t(e.name)}"`}>
2833
- <button type="button" class="blueprint-palette-primary" ${a} aria-label="${t(s)}">
2834
- <span class="blueprint-palette-glyph" aria-hidden="true">${_("variable")}</span>
2835
- <span><strong>${o(e.name)}</strong><small>${o(b.blueprint.variableKind[e.type])} · ${o(i)}</small></span>${n ? `<em>${b.blueprint.placed}</em>` : `<span class="blueprint-palette-inline-add" aria-hidden="true">${_("plus")}</span>`}
2836
- </button>
2837
- </div>`;
2838
- }
2839
- function vn(e, t) {
2840
- let n = b.blueprint.libraryTabs[e], r = e === "components" ? b.blueprint.layers : e === "relations" ? b.blueprint.library : b.blueprint.globalVariables;
2841
- return `<button type="button" class="designer-tab blueprint-library-rail-tab" id="designer-blueprint-library-${e}-tab" role="tab" aria-controls="designer-blueprint-library-${e}-panel" aria-selected="${String(e === t)}" tabindex="${e === t ? 0 : -1}" data-blueprint-library-tab="${e}" data-tip="${r}" aria-label="${r}"><span class="rail-tab-glyph" aria-hidden="true">${_(e === "components" ? "layers" : e === "relations" ? "link" : "variable")}</span><span class="rail-tab-label">${n}</span></button>`;
2842
- }
2843
- function yn(e, n) {
2844
- let r = e.id === n, i = a(e.id), s = t(e.label);
2845
- return `<button type="button" class="designer-tab blueprint-library-rail-tab" id="${f(e.id)}" role="tab" aria-controls="${u(e.id)}" aria-selected="${String(r)}" tabindex="${r ? 0 : -1}" data-blueprint-library-tab="${i}" data-host-left-panel-group="${t(e.id)}" data-host-left-panel-mode="blueprint" data-tip="${s}" aria-label="${s}"><span class="rail-tab-glyph" aria-hidden="true">${_(e.icon ?? "shapes")}</span><span class="rail-tab-label">${o(e.label)}</span></button>`;
2846
- }
2847
- function bn(e) {
2848
- return e === "components" || e === "relations" || e === "variables";
2849
- }
2850
- function xn(e) {
2851
- return e.type === "semantic" || e.source.kind === "component" ? `component:${e.source.componentId}` : `variable:${e.source.variableId}`;
2852
- }
2853
- function Sn(e) {
2854
- return e.type === "semantic" || e.target.kind === "component" ? `component:${e.target.componentId}` : e.target.kind === "variable" ? `variable:${e.target.variableId}` : "host";
2855
- }
2856
- function Cn(e, t) {
2857
- if (t === "host") return b.blueprint.hostNode;
2858
- if (t.startsWith("component:")) {
2859
- let n = t.slice(10);
2860
- return e.components.find((e) => e.id === n)?.name ?? n;
2861
- }
2862
- if (t.startsWith("variable:")) {
2863
- let n = t.slice(9);
2864
- return e.variables.find((e) => e.id === n)?.name ?? n;
2865
- }
2866
- return t;
2867
- }
2868
- function wn(e) {
2869
- return `<div class="designer-empty"><span class="designer-empty-icon" aria-hidden="true">${_("search")}</span><p class="designer-empty-title">${e}</p></div>`;
2870
- }
2871
- //#endregion
2872
- //#region src/browser/controllers/blueprint/designer-blueprint-panel-mutations.ts
2873
- var Tn = /* @__PURE__ */ new Set([
2874
- "eq",
2875
- "neq",
2876
- "gt",
2877
- "gte",
2878
- "lt",
2879
- "lte",
2880
- "contains",
2881
- "exists"
2882
- ]);
2883
- function En(e) {
2884
- return Tn.has(e);
2885
- }
2886
- function Dn(e, t, n, r) {
2887
- let i = n.effect;
2888
- if (e.matches("[data-blueprint-visibility-operation]")) {
2889
- let t = e.value;
2890
- return i.type === "component-visibility" && (t === "show" || t === "hide" || t === "toggle") ? $({
2891
- ...i,
2892
- operation: t
2893
- }) : $(null);
2894
- }
2895
- if (e.matches("[data-blueprint-transition-duration]")) {
2896
- let t = Number(e.value);
2897
- return i.type !== "component-visibility" || !Number.isInteger(t) || t < 0 || t > 6e4 ? kn() : $({
2898
- ...i,
2899
- transition: {
2900
- effect: i.transition?.effect ?? "fade",
2901
- durationMs: t,
2902
- easing: i.transition?.easing ?? "ease-in-out-quad"
2903
- }
2904
- });
2905
- }
2906
- if (e.matches("[data-blueprint-action-value]")) {
2907
- if (i.type !== "set-variable") return $(null);
2908
- try {
2909
- let t = C(JSON.parse(e.value));
2910
- return t.ok ? $({
2911
- ...i,
2912
- value: {
2913
- kind: "literal",
2914
- value: t.value
2915
- }
2916
- }) : {
2917
- ok: !1,
2918
- diagnostics: t.diagnostics
2919
- };
2920
- } catch {
2921
- return kn("AUTHORING_SOURCE_INVALID");
2922
- }
2923
- }
2924
- if (e.matches("[data-blueprint-action-value-source]")) return i.type === "set-variable" ? On(e.value, t, i, r, n.id) : $(null);
2925
- if (e.matches("[data-blueprint-action-event-path]")) {
2926
- if (i.type !== "set-variable") return $(null);
2927
- let t = At(e.value);
2928
- return t === null ? An(b.blueprint.eventFieldInvalid) : $({
2929
- ...i,
2930
- value: {
2931
- kind: "event-payload",
2932
- path: t
2933
- }
2934
- });
2935
- }
2936
- if (e.matches("[data-blueprint-action-source-variable]")) {
2937
- if (i.type !== "set-variable") return $(null);
2938
- let r = e.value;
2939
- return r !== (n.target.kind === "variable" ? n.target.variableId : void 0) && t.variables.some((e) => e.id === r) ? $({
2940
- ...i,
2941
- value: {
2942
- kind: "variable",
2943
- variableId: r
2944
- }
2945
- }) : kn();
2946
- }
2947
- if (e.matches("[data-blueprint-action-event]")) {
2948
- let t = e.value.trim();
2949
- return i.type === "emit-host-event" && t.length > 0 && t.length <= 256 ? $({
2950
- ...i,
2951
- eventName: t
2952
- }) : $(null);
2953
- }
2954
- return $(null);
2955
- }
2956
- function On(e, t, n, r, i) {
2957
- if (e === "literal") return $({
2958
- ...n,
2959
- value: n.value.kind === "literal" ? n.value : {
2960
- kind: "literal",
2961
- value: null
2962
- }
2963
- });
2964
- if (e === "event") return $({
2965
- ...n,
2966
- value: {
2967
- kind: "event-payload",
2968
- path: []
2969
- }
2970
- });
2971
- if (e === "event-field") {
2972
- if (n.value.kind === "event-payload" && n.value.path.length > 0) return $({
2973
- ...n,
2974
- value: n.value
2975
- });
2976
- let e = Mt(t, i, r)[0];
2977
- return $({
2978
- ...n,
2979
- value: {
2980
- kind: "event-payload",
2981
- path: e ?? ["row"]
2982
- }
2983
- });
2984
- }
2985
- if (e === "variable") {
2986
- let e = t.blueprint.relations.find((e) => e.id === i), r = e?.type === "behavior" && e.target.kind === "variable" ? e.target.variableId : void 0, a = t.variables.find((e) => e.id !== r);
2987
- return a === void 0 ? kn() : $({
2988
- ...n,
2989
- value: {
2990
- kind: "variable",
2991
- variableId: a.id
2992
- }
2993
- });
2994
- }
2995
- return kn();
2996
- }
2997
- function $(e) {
2998
- return {
2999
- ok: !0,
3000
- value: e,
3001
- diagnostics: []
3002
- };
3003
- }
3004
- function kn(e = "AUTHORING_REQUEST_INVALID") {
3005
- return {
3006
- ok: !1,
3007
- diagnostics: [{
3008
- severity: "error",
3009
- code: e,
3010
- path: [],
3011
- message: b.blueprint.invalidCommand
3012
- }]
3013
- };
3014
- }
3015
- function An(e) {
3016
- return {
3017
- ok: !1,
3018
- diagnostics: [{
3019
- severity: "error",
3020
- code: "AUTHORING_REQUEST_INVALID",
3021
- path: [],
3022
- message: e
3023
- }]
3024
- };
3025
- }
3026
- //#endregion
3027
- //#region src/browser/controllers/blueprint/designer-blueprint-panel-tabs.ts
3028
- function jn(e, t) {
3029
- if (e === void 0) return !1;
3030
- if (bn(e)) return !0;
3031
- let n = c(e);
3032
- return n !== void 0 && t?.some((e) => e.id === n && h(e, "blueprint")) === !0;
3033
- }
3034
- function Mn(e) {
3035
- return e === "configuration" || e === "problems" || e === "trace";
3036
- }
3037
- //#endregion
3038
- //#region src/browser/controllers/blueprint/designer-blueprint-panels-controller.ts
3039
- var Nn = class {
3040
- callbacks;
3041
- #e;
3042
- #t;
3043
- #n = "";
3044
- #r = "components";
3045
- #i = "configuration";
3046
- constructor(e) {
3047
- this.callbacks = e;
3048
- }
3049
- connect(e) {
3050
- this.#e = e.querySelector("[data-blueprint-library]") ?? void 0, this.#t = e.querySelector("[data-blueprint-inspector]") ?? void 0;
3051
- }
3052
- release() {
3053
- this.#e = void 0, this.#t = void 0;
3054
- }
3055
- reset() {
3056
- this.#n = "", this.#r = "components", this.#i = "configuration";
3057
- }
3058
- get selectedLeftPanelGroupId() {
3059
- return c(this.#r);
3060
- }
3061
- selectLeftPanelGroup(e) {
3062
- let t = this.blueprintHostGroup(e);
3063
- return t !== void 0 && (this.#r = a(t.id), this.callbacks.expandLeftPanel(), this.render(), !0);
3064
- }
3065
- refreshLeftPanelGroups() {
3066
- this.reconcileLibraryTab();
3067
- }
3068
- render() {
3069
- let e = this.hasLibraryTabFocus();
3070
- this.reconcileLibraryTab();
3071
- let t = this.callbacks.getDocument(), n = this.callbacks.getGraph(), r = this.callbacks.getComponentLibrary(), i = this.callbacks.getSelection();
3072
- ln(this.#e, t, n, r, i, this.#n, this.#r, this.callbacks.getLeftPanelGroups()), tn(this.#t, t, n, i, this.#i, this.callbacks.getDiagnostics(), this.callbacks.getTrace(), this.callbacks.getCatalog()), this.#e !== void 0 && p(this.#e), this.#t !== void 0 && p(this.#t), this.callbacks.getMode() === "blueprint" && this.#e !== void 0 && (G(this.#e.getRootNode(), this.blueprintHostGroup(this.selectedLeftPanelGroupId), r.length), this.callbacks.onActiveLeftPanelGroupChange()), e && this.#e?.querySelector(`[data-blueprint-library-tab="${this.#r}"]`)?.focus();
3073
- }
3074
- onClick(e) {
3075
- let t = e.closest("[data-blueprint-library-tab]")?.dataset.blueprintLibraryTab;
3076
- if (jn(t, this.callbacks.getLeftPanelGroups())) return this.#r = t, this.callbacks.expandLeftPanel(), this.render(), this.#e?.querySelector(`[data-blueprint-library-tab="${t}"]`)?.focus(), !0;
3077
- let n = e.closest("[data-blueprint-inspector-tab]")?.dataset.blueprintInspectorTab;
3078
- if (Mn(n)) return this.#i = n, this.render(), this.#t?.querySelector(`[data-blueprint-inspector-tab="${n}"]`)?.focus(), !0;
3079
- let r = e.closest("[data-blueprint-select-node]")?.dataset.blueprintSelectNode;
3080
- if (r !== void 0) return this.callbacks.select({
3081
- kind: "node",
3082
- id: r
3083
- }, !0), !0;
3084
- let i = e.closest("[data-blueprint-add-component]")?.dataset.blueprintAddComponent;
3085
- if (i !== void 0) {
3086
- let e = this.callbacks.getDocument(), t = E(i);
3087
- if (this.callbacks.getGraph().nodes.some((e) => e.id === t)) return this.callbacks.select({
3088
- kind: "node",
3089
- id: t
3090
- }, !0), !0;
3091
- let n = this.callbacks.commitBlueprint(e === void 0 ? null : je(e, i));
3092
- return n.ok && this.callbacks.select({
3093
- kind: "node",
3094
- id: t
3095
- }, !0), this.report(n), !0;
3096
- }
3097
- let a = e.closest("[data-blueprint-add-variable]")?.dataset.blueprintAddVariable;
3098
- if (a !== void 0) {
3099
- let e = this.callbacks.getDocument(), t = fe(a);
3100
- if (this.callbacks.getGraph().nodes.some((e) => e.id === t)) return this.callbacks.select({
3101
- kind: "node",
3102
- id: t
3103
- }, !0), !0;
3104
- let n = this.callbacks.commitBlueprint(e === void 0 ? null : k(e, a));
3105
- return n.ok && this.callbacks.select({
3106
- kind: "node",
3107
- id: t
3108
- }, !0), this.report(n), !0;
3109
- }
3110
- if (e.closest("[data-blueprint-insert-host]") !== null) {
3111
- let e = this.callbacks.getDocument();
3112
- if (e !== void 0) {
3113
- let t = this.callbacks.commitBlueprint(Me(e.blueprint));
3114
- t.ok && this.callbacks.select({
3115
- kind: "node",
3116
- id: T
3117
- }, !0), this.report(t);
3118
- }
3119
- return !0;
3120
- }
3121
- let o = e.closest("[data-blueprint-effect-type]");
3122
- if (o !== null) {
3123
- let e = o.dataset.relationId, t = this.callbacks.getDocument();
3124
- if (e !== void 0 && t !== void 0) {
3125
- let n = t.blueprint.relations.find((t) => t.id === e);
3126
- if (n?.type === "behavior") {
3127
- let r = Pn(o.dataset.blueprintEffectType, n.target.kind);
3128
- r !== null && this.report(this.callbacks.commitBlueprint(Re(t.blueprint, e, r)));
3129
- }
3130
- }
3131
- return !0;
3132
- }
3133
- let s = e.closest("[data-blueprint-semantic-role]");
3134
- if (s !== null) {
3135
- let e = s.dataset.relationId, t = s.dataset.blueprintSemanticRole, n = this.callbacks.getDocument();
3136
- return e !== void 0 && n !== void 0 && (t === "related" || t === "detail" || t === "group" || t === "drill-down") && this.report(this.callbacks.commitBlueprint(Be(n.blueprint, e, t))), !0;
3137
- }
3138
- let c = e.closest("[data-blueprint-add-condition]");
3139
- if (c !== null) {
3140
- let e = c.dataset.relationId, t = this.callbacks.getDocument();
3141
- return e !== void 0 && t !== void 0 && this.report(this.callbacks.commitBlueprint(Ie(t.blueprint, e, {
3142
- left: {
3143
- kind: "event-payload",
3144
- path: []
3145
- },
3146
- operator: "exists"
3147
- }))), !0;
3148
- }
3149
- let l = e.closest("[data-blueprint-remove-condition]");
3150
- if (l !== null) {
3151
- let e = l.dataset.relationId, t = this.callbacks.getDocument();
3152
- return e !== void 0 && t !== void 0 && this.report(this.callbacks.commitBlueprint(Le(t.blueprint, e))), !0;
3153
- }
3154
- let u = e.closest("[data-blueprint-select-relation]");
3155
- if (u !== null) {
3156
- let e = u.dataset.blueprintSelectRelation;
3157
- return e !== void 0 && this.callbacks.select({
3158
- kind: "edge",
3159
- id: e
3160
- }, !0), !0;
3161
- }
3162
- if (e.closest("[data-blueprint-delete]") !== null) {
3163
- let e = this.callbacks.getDocument(), t = this.callbacks.getSelection(), n = this.callbacks.commitBlueprint(e === void 0 || t === null ? null : Ne(e.blueprint, t));
3164
- return n.ok && this.callbacks.select(null, !1), this.report(n), !0;
3165
- }
3166
- return !1;
3167
- }
3168
- onDragStart(e) {
3169
- let t = (e.target instanceof Element ? e.target : null)?.closest("[data-blueprint-drag-kind]"), n = e.dataTransfer;
3170
- if (t == null || n === null) return !1;
3171
- let r = t.dataset.blueprintDragKind, a;
3172
- return r === "component" && t.dataset.componentId !== void 0 ? a = {
3173
- kind: r,
3174
- componentId: t.dataset.componentId
3175
- } : r === "variable" && t.dataset.variableId !== void 0 && (a = {
3176
- kind: r,
3177
- variableId: t.dataset.variableId
3178
- }), a !== void 0 && (n.effectAllowed = "copy", n.setData(i, JSON.stringify(a)), n.setData("text/plain", t.dataset.blueprintDragLabel ?? a.kind), !0);
3179
- }
3180
- onKeyDown(e) {
3181
- let t = e.target?.closest("[data-blueprint-library-tab], [data-blueprint-inspector-tab]");
3182
- if (t == null || ![
3183
- "ArrowLeft",
3184
- "ArrowRight",
3185
- "ArrowUp",
3186
- "ArrowDown",
3187
- "Home",
3188
- "End"
3189
- ].includes(e.key)) return !1;
3190
- e.preventDefault();
3191
- let n = t.dataset.blueprintLibraryTab === void 0 ? "[data-blueprint-inspector-tab]" : "[data-blueprint-library-tab]", r = [...(t.dataset.blueprintLibraryTab === void 0 ? this.#t : this.#e)?.querySelectorAll(n) ?? []];
3192
- if (r.length === 0) return !0;
3193
- let i = r.indexOf(t);
3194
- return (e.key === "Home" ? r[0] : e.key === "End" ? r.at(-1) : r[(i + (e.key === "ArrowRight" || e.key === "ArrowDown" ? 1 : -1) + r.length) % r.length])?.click(), !0;
3195
- }
3196
- onInput(e) {
3197
- let t = e.closest("[data-blueprint-library-search]");
3198
- if (t === null) return !1;
3199
- this.#n = t.value, this.render();
3200
- let n = this.#e?.querySelector("[data-blueprint-library-search]");
3201
- return n?.focus(), n?.setSelectionRange(n.value.length, n.value.length), !0;
3202
- }
3203
- onChange(e) {
3204
- let t = e.dataset.relationId;
3205
- if (t === void 0) return !1;
3206
- let n = this.callbacks.getDocument();
3207
- if (n === void 0) return !0;
3208
- let r = n.blueprint.relations.find((e) => e.id === t);
3209
- if (r === void 0) return !0;
3210
- if (e.dataset.blueprintSourceEvent !== void 0) return this.report(this.callbacks.commitBlueprint(ze(n.blueprint, t, e.value))), !0;
3211
- if (e.matches("[data-blueprint-condition-operator]")) {
3212
- let i = e.value;
3213
- return this.report(this.callbacks.commitBlueprint(r.type !== "behavior" || r.condition === void 0 || !En(i) ? null : Ie(n.blueprint, t, {
3214
- ...r.condition,
3215
- operator: i
3216
- }))), !0;
3217
- }
3218
- if (r.type !== "behavior") return !0;
3219
- let i = Dn(e, n, r, this.callbacks.getCatalog());
3220
- return i.ok ? (i.value !== null && this.report(this.callbacks.commitBlueprint(Re(n.blueprint, t, i.value))), !0) : (this.callbacks.emitDiagnostics(i.diagnostics), !0);
3221
- }
3222
- report(e) {
3223
- e.ok || this.callbacks.emitDiagnostics(e.diagnostics);
3224
- }
3225
- reconcileLibraryTab() {
3226
- let e = this.selectedLeftPanelGroupId;
3227
- e !== void 0 && this.blueprintHostGroup(e) === void 0 && (this.#r = "components");
3228
- }
3229
- hasLibraryTabFocus() {
3230
- return (this.#e?.getRootNode())?.activeElement?.closest("[data-blueprint-library-tab]") != null;
3231
- }
3232
- blueprintHostGroup(e) {
3233
- if (e !== void 0) return this.callbacks.getLeftPanelGroups()?.find((t) => t.id === e && h(t, "blueprint"));
3234
- }
3235
- };
3236
- function Pn(e, t) {
3237
- return e === void 0 ? null : t === "component" ? e === "component-visibility" ? {
3238
- type: "component-visibility",
3239
- operation: "show",
3240
- transition: {
3241
- effect: "fade",
3242
- durationMs: 200,
3243
- easing: "ease-in-out-quad"
3244
- }
3245
- } : e === "request-component-data" ? { type: "request-component-data" } : null : t === "variable" ? e === "set-variable" ? {
3246
- type: "set-variable",
3247
- value: {
3248
- kind: "literal",
3249
- value: null
3250
- }
3251
- } : e === "request-variable" ? { type: "request-variable" } : null : e === "emit-host-event" ? {
3252
- type: "emit-host-event",
3253
- eventName: "host_event",
3254
- payload: {
3255
- kind: "event-payload",
3256
- path: []
3257
- }
3258
- } : null;
3259
- }
3260
- //#endregion
3261
- //#region src/browser/controllers/blueprint/designer-blueprint-workbench-panel.ts
3262
- var Fn = class {
3263
- callbacks;
3264
- #e;
3265
- #t;
3266
- #n;
3267
- #r;
3268
- #i = "canvas";
3269
- #a = null;
3270
- #o;
3271
- #s = 0;
3272
- #c;
3273
- #l;
3274
- #u = () => this.resolveCanvas();
3275
- constructor(e) {
3276
- this.callbacks = e, this.#c = new W({
3277
- getDocument: e.getDocument,
3278
- getGraph: () => this.graph,
3279
- getMode: () => this.#i,
3280
- getSelection: () => this.#a,
3281
- getViewRequest: () => this.#o,
3282
- getCatalog: e.getCatalog,
3283
- getRuntimeContributions: e.getRuntimeContributions,
3284
- getDocumentRevision: e.getDocumentRevision,
3285
- getProjectRevision: e.getProjectRevision,
3286
- canUndo: e.canUndo,
3287
- canRedo: e.canRedo,
3288
- select: (e, t) => this.select(e, t),
3289
- executeCommand: e.executeCommand,
3290
- undo: e.undo,
3291
- redo: e.redo,
3292
- render: () => this.render(),
3293
- emitDiagnostics: e.emitDiagnostics
3294
- }), this.#l = new Nn({
3295
- getDocument: e.getDocument,
3296
- getGraph: () => this.graph,
3297
- getCatalog: e.getCatalog,
3298
- getComponentLibrary: () => this.componentLibrary,
3299
- getSelection: () => this.#a,
3300
- getDiagnostics: () => this.#c.stateDiagnostics(),
3301
- getTrace: () => this.#c.trace,
3302
- getLeftPanelGroups: e.getLeftPanelGroups,
3303
- getMode: () => this.#i,
3304
- select: (t, n) => {
3305
- let r = this.select(t, n);
3306
- r.ok || e.emitDiagnostics(r.diagnostics);
3307
- },
3308
- commitBlueprint: (e) => this.#c.commitBlueprint(e),
3309
- expandLeftPanel: e.expandLeftPanel,
3310
- onActiveLeftPanelGroupChange: e.onActiveLeftPanelGroupChange,
3311
- emitDiagnostics: e.emitDiagnostics
3312
- });
3313
- }
3314
- get mode() {
3315
- return this.#i;
3316
- }
3317
- get available() {
3318
- return this.#c.canvas !== void 0;
3319
- }
3320
- get selectedLeftPanelGroupId() {
3321
- return this.#l.selectedLeftPanelGroupId;
3322
- }
3323
- setInitialMode(e) {
3324
- this.#i = e;
3325
- }
3326
- connect(e) {
3327
- if (this.#e === e) {
3328
- this.bindSlot(e.querySelector("[data-blueprint-canvas-slot]") ?? void 0), this.#n = e.querySelector("[data-blueprint-default-canvas]") ?? void 0, this.mountDefaultCanvas(), this.#l.connect(e), this.resolveCanvas(), this.render();
3329
- return;
3330
- }
3331
- this.disconnect(), this.#e = e, this.bindSlot(e.querySelector("[data-blueprint-canvas-slot]") ?? void 0), this.#n = e.querySelector("[data-blueprint-default-canvas]") ?? void 0, this.mountDefaultCanvas(), this.#l.connect(e), this.#c.connect(this.callbacks.getHost()), this.resolveCanvas(), this.render();
3332
- }
3333
- bindSlot(e) {
3334
- this.#t !== e && (this.#t?.removeEventListener("slotchange", this.#u), this.#t = e, this.#t?.addEventListener("slotchange", this.#u));
3335
- }
3336
- disconnect() {
3337
- this.#t?.removeEventListener("slotchange", this.#u), this.#c.disconnect(), this.#l.release(), this.#r?.destroy(), this.#r?.element.remove(), this.#r = void 0, this.#n = void 0, this.#e = void 0, this.#t = void 0;
3338
- }
3339
- addVariableNode(e) {
3340
- let t = this.callbacks.getDocument();
3341
- if (t === void 0) return;
3342
- let n = k(t, e);
3343
- if (n !== null) {
3344
- let e = this.callbacks.executeCommand({
3345
- type: "replace-blueprint",
3346
- blueprint: n
3347
- });
3348
- if (!e.ok) {
3349
- this.callbacks.emitDiagnostics(e.diagnostics);
3350
- return;
3351
- }
3352
- }
3353
- this.setMode("blueprint", { focus: {
3354
- kind: "variable",
3355
- id: e
3356
- } });
3357
- }
3358
- resetSession() {
3359
- this.#a = null, this.#o = void 0, this.#l.reset(), this.#c.reset(), this.render();
3360
- }
3361
- selectLeftPanelGroup(e) {
3362
- return this.#i === "blueprint" && this.#l.selectLeftPanelGroup(e);
3363
- }
3364
- refreshLeftPanelGroups() {
3365
- this.#l.refreshLeftPanelGroups(), this.render();
3366
- }
3367
- setMode(e, t = {}, r = "api") {
3368
- let i = n(e, t);
3369
- if (!i.ok) return i;
3370
- if (e === "blueprint" && !this.available) return Rn("BLUEPRINT_CAPABILITY_UNAVAILABLE", b.blueprint.noHostCanvas);
3371
- if (t.focus !== void 0) {
3372
- let e = this.resolveFocus(t.focus);
3373
- if (e === void 0) return Rn("AUTHORING_REQUEST_INVALID", b.blueprint.invalidSelection);
3374
- this.#a = {
3375
- kind: this.graphHasEdge(e) ? "edge" : "node",
3376
- id: e
3377
- }, this.#o = {
3378
- id: ++this.#s,
3379
- type: "focus",
3380
- targetId: e
3381
- };
3382
- }
3383
- let a = this.#i;
3384
- return this.#i = e, this.render(), a !== e && this.emitModeChange(a, e, r), Ln(null);
3385
- }
3386
- render() {
3387
- let e = this.graph;
3388
- this.reconcileSelection(e), this.renderChrome(), this.callbacks.setWorkbenchAuthoringMode(this.#i), this.#l.render(), this.#c.dispatchState(e), this.callbacks.onActiveLeftPanelGroupChange();
3389
- }
3390
- dispatchState() {
3391
- this.#c.dispatchState();
3392
- }
3393
- onClick(e) {
3394
- let t = e.closest("[data-workbench-mode-tab]");
3395
- if (t !== null) {
3396
- let e = t.dataset.workbenchModeTab;
3397
- if (e === "canvas" || e === "blueprint") {
3398
- let t = this.setMode(e, {}, "user");
3399
- t.ok || this.callbacks.emitDiagnostics(t.diagnostics);
3400
- }
3401
- return !0;
3402
- }
3403
- let n = e.closest("[data-blueprint-search-id]")?.dataset.blueprintSearchId;
3404
- if (n !== void 0) {
3405
- let e = this.select({
3406
- kind: this.graphHasEdge(n) ? "edge" : "node",
3407
- id: n
3408
- }, !0);
3409
- e.ok || this.callbacks.emitDiagnostics(e.diagnostics);
3410
- let t = this.setMode("blueprint", {}, "user");
3411
- return t.ok || this.callbacks.emitDiagnostics(t.diagnostics), !0;
3412
- }
3413
- return this.#l.onClick(e);
3414
- }
3415
- onInput(e) {
3416
- return this.#l.onInput(e);
3417
- }
3418
- onChange(e) {
3419
- return this.#l.onChange(e);
3420
- }
3421
- onDragStart(e) {
3422
- return this.#l.onDragStart(e);
3423
- }
3424
- onKeyDown(e) {
3425
- if (this.#l.onKeyDown(e)) return !0;
3426
- let t = e.target?.closest("[data-workbench-mode-tab]");
3427
- if (t == null || ![
3428
- "ArrowLeft",
3429
- "ArrowRight",
3430
- "Home",
3431
- "End"
3432
- ].includes(e.key)) return !1;
3433
- e.preventDefault();
3434
- let n = [...this.#e?.querySelectorAll("[data-workbench-mode-tab]:not(:disabled)") ?? []];
3435
- if (n.length === 0) return !0;
3436
- let r = n.indexOf(t), i = e.key === "Home" ? n[0] : e.key === "End" ? n.at(-1) : n[(r + (e.key === "ArrowRight" ? 1 : -1) + n.length) % n.length];
3437
- return i?.focus(), i?.click(), !0;
3438
- }
3439
- get graph() {
3440
- let e = this.callbacks.getDocument();
3441
- return e === void 0 ? {
3442
- nodes: [],
3443
- edges: []
3444
- } : Ge(e, this.callbacks.getCatalog(), this.callbacks.getRuntimeContributions());
3445
- }
3446
- get componentLibrary() {
3447
- let e = this.callbacks.getDocument();
3448
- return e === void 0 ? [] : j(e, this.callbacks.getCatalog(), this.callbacks.getRuntimeContributions());
3449
- }
3450
- mountDefaultCanvas() {
3451
- if (this.#r !== void 0 || this.#n === void 0) return;
3452
- let e = pt(this.#n.ownerDocument);
3453
- this.#n.append(e.element), this.#r = e;
3454
- }
3455
- resolveCanvas() {
3456
- let e = this.#t?.assignedElements({ flatten: !0 })[0], t = this.#r?.element;
3457
- t !== void 0 && (t.hidden = e !== void 0), this.#n !== void 0 && (this.#n.hidden = e !== void 0);
3458
- let n = e ?? t, r = this.#c.canvas;
3459
- if (!this.#c.setCanvas(n)) {
3460
- n === void 0 && this.#i === "blueprint" ? this.fallbackToCanvas(!1) : (this.renderChrome(), this.#c.dispatchState());
3461
- return;
3462
- }
3463
- if (n === void 0 && this.#i === "blueprint") {
3464
- this.fallbackToCanvas(r !== void 0);
3465
- return;
3466
- }
3467
- this.render();
3468
- }
3469
- fallbackToCanvas(e) {
3470
- let t = this.#i;
3471
- this.#i = "canvas", this.render(), this.emitModeChange(t, "canvas", "fallback"), e && this.callbacks.emitDiagnostics([In("BLUEPRINT_CAPABILITY_UNAVAILABLE", b.blueprint.noHostCanvas)]);
3472
- }
3473
- select(e, t) {
3474
- return e !== null && !(e.kind === "node" ? this.graph.nodes.some((t) => t.id === e.id) : this.graph.edges.some((t) => t.id === e.id)) ? Rn("AUTHORING_REQUEST_INVALID", b.blueprint.invalidSelection) : (this.#a = e, t && e !== null && (this.#o = {
3475
- id: ++this.#s,
3476
- type: "focus",
3477
- targetId: e.id
3478
- }), this.render(), Ln(null));
3479
- }
3480
- reconcileSelection(e) {
3481
- this.#a !== null && ((this.#a.kind === "node" ? e.nodes.some((e) => e.id === this.#a?.id) : e.edges.some((e) => e.id === this.#a?.id)) || (this.#a = null));
3482
- }
3483
- resolveFocus(e) {
3484
- let t = this.graph;
3485
- if (e.kind === "component") {
3486
- let n = `component:${e.id}`;
3487
- return t.nodes.some((e) => e.id === n) ? n : void 0;
3488
- }
3489
- if (e.kind === "variable") {
3490
- let n = `variable:${e.id}`;
3491
- return t.nodes.some((e) => e.id === n) ? n : void 0;
3492
- }
3493
- if (e.kind === "relation") return t.edges.find((t) => t.relationId === e.id)?.id ?? (this.graphHasEdge(e.id) ? e.id : void 0);
3494
- if (e.kind === "rule") return t.edges.find((t) => t.relationId === e.id)?.id;
3495
- if (t.nodes.some((t) => t.id === e.id) || this.graphHasEdge(e.id)) return e.id;
3496
- }
3497
- graphHasEdge(e) {
3498
- return this.graph.edges.some((t) => t.id === e);
3499
- }
3500
- renderChrome() {
3501
- let e = this.#e;
3502
- if (e === void 0) return;
3503
- let t = this.callbacks.getDocument(), n = this.#c.stateDiagnostics().filter((e) => e.severity === "error").length, r = t?.blueprint.relations ?? [];
3504
- ht(e, this.#i, this.available, {
3505
- nodes: this.componentLibrary.length,
3506
- relations: r.length,
3507
- semantic: r.filter((e) => e.type === "semantic").length,
3508
- structural: t?.components.filter((e) => e.parentId !== null).length ?? 0,
3509
- problems: n
3510
- });
3511
- }
3512
- emitModeChange(t, n, r) {
3513
- this.callbacks.getHost().dispatchEvent(new CustomEvent(e, {
3514
- bubbles: !0,
3515
- composed: !0,
3516
- detail: {
3517
- previousMode: t,
3518
- mode: n,
3519
- reason: r
3520
- }
3521
- }));
3522
- }
3523
- };
3524
- function In(e, t) {
3525
- return {
3526
- severity: "error",
3527
- code: e,
3528
- path: [],
3529
- message: t
3530
- };
3531
- }
3532
- function Ln(e) {
3533
- return {
3534
- ok: !0,
3535
- value: e,
3536
- diagnostics: []
3537
- };
3538
- }
3539
- function Rn(e, t) {
3540
- return {
3541
- ok: !1,
3542
- diagnostics: [In(e, t)]
3543
- };
3544
- }
3545
- //#endregion
3546
- export { Fn as DesignerBlueprintWorkbenchPanel };
3547
-
3548
- //# sourceMappingURL=designer-blueprint-workbench-panel-C2MoZwKA.js.map