base-screen 0.4.0 → 0.4.2

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 (368) hide show
  1. package/README.md +5 -2
  2. package/dist/_internal/contracts/diagnostics/material-error.d.ts +1 -1
  3. package/dist/_internal/contracts/diagnostics/material-error.js +1 -1
  4. package/dist/_internal/contracts/document/blueprint-graph.d.ts +3 -3
  5. package/dist/_internal/contracts/document/blueprint-graph.js +4 -4
  6. package/dist/_internal/contracts/document/component-states.d.ts +1 -1
  7. package/dist/_internal/contracts/document/component-states.js +1 -1
  8. package/dist/_internal/contracts/document/image-url.js +1 -1
  9. package/dist/_internal/contracts/document/json-schema.js +1 -1
  10. package/dist/_internal/contracts/document/limits.d.ts +5 -5
  11. package/dist/_internal/contracts/document/limits.js +5 -5
  12. package/dist/_internal/contracts/document/references.js +3 -3
  13. package/dist/_internal/contracts/document/schema.d.ts +2 -2
  14. package/dist/_internal/contracts/document/schema.js +3 -3
  15. package/dist/_internal/contracts/document/sub-canvas.d.ts +2 -2
  16. package/dist/_internal/contracts/document/sub-canvas.js +2 -2
  17. package/dist/_internal/contracts/document/theme.d.ts +2 -2
  18. package/dist/_internal/contracts/document/theme.js +2 -2
  19. package/dist/_internal/contracts/document/validate-blueprint.d.ts +1 -1
  20. package/dist/_internal/contracts/document/validate-blueprint.js +1 -1
  21. package/dist/_internal/contracts/document/validate-component.js +2 -2
  22. package/dist/_internal/contracts/document/validate-data-source.js +2 -2
  23. package/dist/_internal/contracts/document/validate-sub-canvas.d.ts +1 -1
  24. package/dist/_internal/contracts/document/validate-sub-canvas.js +1 -1
  25. package/dist/_internal/contracts/document/validate-value-ref.js +1 -1
  26. package/dist/_internal/contracts/index.d.ts +1 -1
  27. package/dist/_internal/contracts/migration/blueprint-graph-migration.d.ts +1 -1
  28. package/dist/_internal/contracts/migration/migrate-document.js +2 -2
  29. package/dist/_internal/contracts/push/delivery.d.ts +1 -1
  30. package/dist/_internal/contracts/push/delivery.js +1 -1
  31. package/dist/_internal/contracts/push/level-scale.d.ts +1 -1
  32. package/dist/_internal/contracts/push/level-scale.js +1 -1
  33. package/dist/_internal/contracts/types/document.d.ts +19 -19
  34. package/dist/_internal/contracts/types/execution.d.ts +3 -3
  35. package/dist/_internal/contracts/types/host.d.ts +23 -5
  36. package/dist/_internal/contracts/types/host.js +1 -1
  37. package/dist/_internal/contracts/types/push.d.ts +3 -3
  38. package/dist/_internal/contracts/types/variable.d.ts +3 -3
  39. package/dist/_internal/contracts/variable/parse.js +5 -1
  40. package/dist/_internal/core/blueprint/runtime-compile.d.ts +1 -1
  41. package/dist/_internal/core/blueprint/runtime-compile.js +1 -1
  42. package/dist/_internal/core/blueprint/runtime-dispatch.js +1 -1
  43. package/dist/_internal/core/blueprint/runtime-simulate.d.ts +1 -1
  44. package/dist/_internal/core/blueprint/runtime-simulate.js +1 -1
  45. package/dist/_internal/core/blueprint/runtime-types.d.ts +4 -4
  46. package/dist/_internal/core/commands/apply-collection-commands.d.ts +1 -1
  47. package/dist/_internal/core/commands/apply-collection-commands.js +1 -1
  48. package/dist/_internal/core/commands/apply-component-commands.d.ts +1 -1
  49. package/dist/_internal/core/commands/apply-component-commands.js +2 -2
  50. package/dist/_internal/core/commands/apply.js +2 -2
  51. package/dist/_internal/core/commands/types.d.ts +5 -5
  52. package/dist/_internal/core/data/data-candidates.d.ts +1 -1
  53. package/dist/_internal/core/data/data-candidates.js +1 -1
  54. package/dist/_internal/core/data/data-source-dependents.d.ts +1 -1
  55. package/dist/_internal/core/data/data-source-dependents.js +1 -1
  56. package/dist/_internal/core/data/dataset-profile.d.ts +2 -2
  57. package/dist/_internal/core/data/dataset-profile.js +2 -2
  58. package/dist/_internal/core/data/host-dataset.d.ts +2 -2
  59. package/dist/_internal/core/data/host-dataset.js +2 -2
  60. package/dist/_internal/core/data/sample-values.d.ts +1 -1
  61. package/dist/_internal/core/data/sample-values.js +1 -1
  62. package/dist/_internal/core/data/value-ref.d.ts +2 -2
  63. package/dist/_internal/core/data/value-ref.js +1 -1
  64. package/dist/_internal/core/state/state-preset.d.ts +1 -1
  65. package/dist/_internal/core/validation/layout-audit.d.ts +2 -2
  66. package/dist/_internal/core/validation/layout-audit.js +1 -1
  67. package/dist/_internal/core/validation/legibility.js +1 -1
  68. package/dist/_internal/core/validation/validate-semantics.js +1 -1
  69. package/dist/_internal/engine/browser/controllers/blueprint/designer-blueprint-canvas-bridge.d.ts +1 -1
  70. package/dist/_internal/engine/browser/controllers/dataset/designer-data-source-authoring.d.ts +1 -1
  71. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-catalog-controller.d.ts +21 -0
  72. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-controller-context.d.ts +7 -2
  73. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-draft-controller.d.ts +1 -1
  74. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-effective-value.d.ts +1 -1
  75. package/dist/_internal/engine/browser/controllers/dataset/designer-dataset-surface-controller.d.ts +1 -1
  76. package/dist/_internal/engine/browser/controllers/dataset/designer-update-policy-authoring.d.ts +1 -1
  77. package/dist/_internal/engine/browser/controllers/designer-artboard-controller.d.ts +1 -1
  78. package/dist/_internal/engine/browser/controllers/designer-canvas-runtime-controller.d.ts +2 -2
  79. package/dist/_internal/engine/browser/controllers/designer-change-controller.d.ts +3 -3
  80. package/dist/_internal/engine/browser/controllers/designer-command-palette-controller.d.ts +1 -1
  81. package/dist/_internal/engine/browser/controllers/designer-intent-controller.d.ts +5 -0
  82. package/dist/_internal/engine/browser/controllers/designer-page-preview-controller.d.ts +1 -1
  83. package/dist/_internal/engine/browser/controllers/designer-popup-preview-controller.d.ts +1 -1
  84. package/dist/_internal/engine/browser/controllers/designer-reference-layer-controller.d.ts +1 -1
  85. package/dist/_internal/engine/browser/controllers/designer-text-edit-controller.d.ts +2 -2
  86. package/dist/_internal/engine/browser/controllers/designer-viewport-controller.d.ts +7 -1
  87. package/dist/_internal/engine/browser/controllers/gesture/designer-drag-gesture.d.ts +6 -1
  88. package/dist/_internal/engine/browser/controllers/gesture/designer-gesture-callbacks.d.ts +1 -1
  89. package/dist/_internal/engine/browser/controllers/panel/designer-component-states-controller.d.ts +1 -1
  90. package/dist/_internal/engine/browser/controllers/panel/designer-panel-controller-callbacks.d.ts +6 -6
  91. package/dist/_internal/engine/browser/controllers/panel/designer-panel-property-controller.d.ts +7 -0
  92. package/dist/_internal/engine/browser/controllers/variables/designer-variable-catalog-controller.d.ts +9 -1
  93. package/dist/_internal/engine/browser/controllers/variables/designer-variable-editor-controller.d.ts +6 -1
  94. package/dist/_internal/engine/browser/controllers/variables/designer-variables-controller.d.ts +16 -1
  95. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-controller.d.ts +2 -0
  96. package/dist/_internal/engine/browser/controllers/workbench/designer-workbench-tabs-controller.d.ts +2 -0
  97. package/dist/_internal/engine/browser/dom/blueprint/designer-blueprint-inspector-configuration.d.ts +1 -1
  98. package/dist/_internal/engine/browser/dom/change/designer-change-dom.d.ts +1 -1
  99. package/dist/_internal/engine/browser/dom/color/designer-color-palette-model.d.ts +3 -3
  100. package/dist/_internal/engine/browser/dom/color/designer-color-palette-types.d.ts +2 -2
  101. package/dist/_internal/engine/browser/dom/color/designer-color-theme-slots.d.ts +1 -1
  102. package/dist/_internal/engine/browser/dom/dataset/designer-data-group-dom.d.ts +1 -1
  103. package/dist/_internal/engine/browser/dom/dataset/designer-data-panel-notice.d.ts +1 -1
  104. package/dist/_internal/engine/browser/dom/dataset/designer-data-state.d.ts +1 -1
  105. package/dist/_internal/engine/browser/dom/dataset/designer-dataset-authoring-dom.d.ts +1 -1
  106. package/dist/_internal/engine/browser/dom/dataset/designer-dataset-catalog-dom.d.ts +1 -1
  107. package/dist/_internal/engine/browser/dom/dataset/designer-dataset-sections.d.ts +1 -1
  108. package/dist/_internal/engine/browser/dom/dataset/designer-dataset-types.d.ts +11 -4
  109. package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-control-dom.d.ts +1 -1
  110. package/dist/_internal/engine/browser/dom/descriptor/designer-descriptor-model.d.ts +1 -1
  111. package/dist/_internal/engine/browser/dom/designer-field-primitives.d.ts +1 -1
  112. package/dist/_internal/engine/browser/dom/designer-icons.d.ts +2 -0
  113. package/dist/_internal/engine/browser/dom/designer-text-edit-dom.d.ts +2 -2
  114. package/dist/_internal/engine/browser/dom/designer-variable-inspector-dom.d.ts +7 -0
  115. package/dist/_internal/engine/browser/dom/designer-variables-dom.d.ts +5 -1
  116. package/dist/_internal/engine/browser/dom/designer-variables-editor-dom.d.ts +30 -1
  117. package/dist/_internal/engine/browser/dom/designer-variables-toolbar-dom.d.ts +4 -2
  118. package/dist/_internal/engine/browser/dom/intent/designer-intent-reference-picker-dom.d.ts +2 -0
  119. package/dist/_internal/engine/browser/dom/material-library/designer-material-library-dom.d.ts +1 -1
  120. package/dist/_internal/engine/browser/dom/menu/designer-menu-model.d.ts +3 -3
  121. package/dist/_internal/engine/browser/dom/menu/designer-plugin-command-menu.d.ts +5 -2
  122. package/dist/_internal/engine/browser/dom/panel/designer-canvas-transactions.d.ts +1 -1
  123. package/dist/_internal/engine/browser/dom/panel/designer-component-states-dom.d.ts +2 -2
  124. package/dist/_internal/engine/browser/dom/panel/designer-multi-selection-dom.d.ts +1 -1
  125. package/dist/_internal/engine/browser/dom/panel/designer-panel-primitives.d.ts +2 -2
  126. package/dist/_internal/engine/browser/dom/panel/designer-property-transactions.d.ts +1 -1
  127. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-picker-dom.d.ts +1 -1
  128. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-picker-mount.d.ts +1 -1
  129. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-summary-dom.d.ts +1 -1
  130. package/dist/_internal/engine/browser/dom/value-ref/designer-value-ref-types.d.ts +4 -4
  131. package/dist/_internal/engine/common/observability/designer-metrics.d.ts +1 -1
  132. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-capabilities.d.ts +1 -1
  133. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-graph.d.ts +5 -5
  134. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-model.d.ts +1 -1
  135. package/dist/_internal/engine/common/operations/blueprint/designer-blueprint-protocol-types.d.ts +2 -2
  136. package/dist/_internal/engine/common/operations/canvas/canvas-background-image.d.ts +1 -1
  137. package/dist/_internal/engine/common/operations/catalog/designer-catalog-refresh.d.ts +1 -1
  138. package/dist/_internal/engine/common/operations/change/designer-change-events.d.ts +1 -1
  139. package/dist/_internal/engine/common/operations/change/designer-change-proposal.d.ts +4 -4
  140. package/dist/_internal/engine/common/operations/designer-clipboard.d.ts +5 -1
  141. package/dist/_internal/engine/common/operations/designer-text-edit-operations.d.ts +1 -1
  142. package/dist/_internal/engine/common/operations/designer-variable-operations.d.ts +3 -3
  143. package/dist/_internal/engine/common/operations/element/designer-element-operation-types.d.ts +1 -1
  144. package/dist/_internal/engine/common/operations/intent/designer-parameter-intent.d.ts +1 -1
  145. package/dist/_internal/engine/common/operations/material-component/material-component-fragment-extract.d.ts +2 -2
  146. package/dist/_internal/engine/common/operations/material-library/material-library-fragments.d.ts +1 -1
  147. package/dist/_internal/engine/common/operations/material-library/material-library-grouping.d.ts +1 -1
  148. package/dist/_internal/engine/common/operations/plugin/designer-plugin-commands.d.ts +2 -0
  149. package/dist/_internal/engine/common/operations/selection/designer-multi-selection-operations.d.ts +9 -9
  150. package/dist/_internal/engine/common/operations/style/designer-component-states.d.ts +6 -6
  151. package/dist/_internal/engine/common/operations/style/designer-material-appearance.d.ts +1 -1
  152. package/dist/_internal/engine/common/session/designer-artboard.d.ts +1 -1
  153. package/dist/_internal/engine/common/session/designer-session.d.ts +1 -1
  154. package/dist/_internal/engine/common/ui-text/designer-blueprint-ui-text.d.ts +3 -3
  155. package/dist/_internal/engine/common/ui-text/designer-ui-text.d.ts +85 -68
  156. package/dist/_internal/engine/{designer-blueprint-workbench-panel-BWSglfAb.js → designer-blueprint-workbench-panel-DVvKcSvJ.js} +70 -70
  157. package/dist/_internal/engine/{designer-dataset-controller-DdbY4ILC.js → designer-dataset-controller-bSR5OB6n.js} +1461 -1355
  158. package/dist/_internal/engine/designer-element/api/designer-element-catalog.d.ts +2 -2
  159. package/dist/_internal/engine/designer-element/api/designer-element-change.d.ts +2 -2
  160. package/dist/_internal/engine/designer-element/api/designer-element-configuration-types.d.ts +4 -4
  161. package/dist/_internal/engine/designer-element/api/designer-element-fragment-save.d.ts +2 -2
  162. package/dist/_internal/engine/designer-element/api/designer-element-host-resource-selection.d.ts +1 -1
  163. package/dist/_internal/engine/designer-element/base-screen-designer-element.d.ts +10 -10
  164. package/dist/_internal/engine/designer-element/runtime/designer-element-plugin-commands.d.ts +3 -3
  165. package/dist/_internal/engine/designer-element/runtime/designer-element-rendering.d.ts +2 -2
  166. package/dist/_internal/engine/designer-element/runtime/designer-element-sample-data.d.ts +1 -1
  167. package/dist/_internal/engine/designer-element/runtime/designer-element-state.d.ts +7 -7
  168. package/dist/_internal/engine/{designer-field-primitives-Crn464Qg.js → designer-field-primitives-C_StzrUa.js} +197 -178
  169. package/dist/_internal/engine/{designer-left-panel-groups-dom-DFdLWxxY.js → designer-left-panel-groups-dom-DBpI3Nc2.js} +19 -19
  170. package/dist/_internal/engine/{host-resource-selection-CWrPLVOc.js → host-resource-selection-BCRU23WQ.js} +446 -446
  171. package/dist/_internal/engine/index.js +3665 -3247
  172. package/dist/_internal/host-kit/index.d.ts +1 -1
  173. package/dist/_internal/host-kit/index.js +1 -1
  174. package/dist/_internal/host-kit/intent/index.d.ts +2 -1
  175. package/dist/_internal/host-kit/intent/index.js +1 -0
  176. package/dist/_internal/host-kit/intent/intent-behavior.d.ts +5 -5
  177. package/dist/_internal/host-kit/intent/intent-behavior.js +7 -7
  178. package/dist/_internal/host-kit/intent/intent-block.d.ts +11 -4
  179. package/dist/_internal/host-kit/intent/intent-block.js +87 -8
  180. package/dist/_internal/host-kit/intent/intent-catalog.d.ts +9 -6
  181. package/dist/_internal/host-kit/intent/intent-catalog.js +1 -1
  182. package/dist/_internal/host-kit/intent/intent-compile-types.d.ts +10 -10
  183. package/dist/_internal/host-kit/intent/intent-compile.d.ts +1 -1
  184. package/dist/_internal/host-kit/intent/intent-compile.js +4 -4
  185. package/dist/_internal/host-kit/intent/intent-data-check.d.ts +4 -4
  186. package/dist/_internal/host-kit/intent/intent-data-context.d.ts +7 -7
  187. package/dist/_internal/host-kit/intent/intent-data-context.js +2 -2
  188. package/dist/_internal/host-kit/intent/intent-dataset.d.ts +4 -4
  189. package/dist/_internal/host-kit/intent/intent-dataset.js +2 -2
  190. package/dist/_internal/host-kit/intent/intent-format.d.ts +2 -2
  191. package/dist/_internal/host-kit/intent/intent-format.js +2 -2
  192. package/dist/_internal/host-kit/intent/intent-freeform.d.ts +48 -0
  193. package/dist/_internal/host-kit/intent/intent-freeform.js +412 -0
  194. package/dist/_internal/host-kit/intent/intent-kpi-bind.d.ts +2 -2
  195. package/dist/_internal/host-kit/intent/intent-layout.d.ts +2 -2
  196. package/dist/_internal/host-kit/intent/intent-layout.js +2 -2
  197. package/dist/_internal/host-kit/intent/intent-parse.d.ts +2 -0
  198. package/dist/_internal/host-kit/intent/intent-parse.js +13 -12
  199. package/dist/_internal/host-kit/intent/intent-prepare.d.ts +7 -4
  200. package/dist/_internal/host-kit/intent/intent-prepare.js +54 -2
  201. package/dist/_internal/host-kit/intent/intent-session.d.ts +6 -6
  202. package/dist/_internal/host-kit/intent/intent-session.js +4 -4
  203. package/dist/_internal/host-kit/intent/intent-stream.js +2 -2
  204. package/dist/_internal/host-kit/intent/intent-style.d.ts +1 -1
  205. package/dist/_internal/host-kit/intent/intent-style.js +1 -1
  206. package/dist/_internal/host-kit/intent/intent-types.d.ts +55 -12
  207. package/dist/_internal/host-kit/intent/intent-types.js +1 -1
  208. package/dist/_internal/host-kit/push-result.d.ts +1 -1
  209. package/dist/_internal/host-kit/push-result.js +1 -1
  210. package/dist/_internal/host-kit/sse-subscribe.d.ts +1 -1
  211. package/dist/_internal/host-kit/sse-subscribe.js +1 -1
  212. package/dist/_internal/host-kit/subscription-hub.d.ts +3 -3
  213. package/dist/_internal/host-kit/subscription-hub.js +1 -1
  214. package/dist/_internal/material/base-material.d.ts +3 -3
  215. package/dist/_internal/material/editor-descriptor.d.ts +3 -3
  216. package/dist/_internal/plugin-core/contracts.d.ts +18 -16
  217. package/dist/_internal/plugin-core/contracts.js +1 -0
  218. package/dist/_internal/plugin-core/contribution-kind.d.ts +5 -5
  219. package/dist/_internal/plugin-core/contribution-kind.js +14 -6
  220. package/dist/_internal/plugin-core/editor/editor-descriptor-inference.d.ts +1 -1
  221. package/dist/_internal/plugin-core/editor/editor-descriptor-inference.js +2 -2
  222. package/dist/_internal/plugin-core/editor/editor-descriptor-items.d.ts +1 -1
  223. package/dist/_internal/plugin-core/editor/editor-descriptor-items.js +1 -1
  224. package/dist/_internal/plugin-core/editor/editor-descriptor-model.d.ts +2 -2
  225. package/dist/_internal/plugin-core/editor/editor-descriptor.js +1 -1
  226. package/dist/_internal/plugin-core/fragment/fragment.d.ts +4 -4
  227. package/dist/_internal/plugin-core/fragment/fragment.js +1 -1
  228. package/dist/_internal/plugin-core/material/material-manifest-fields.js +1 -1
  229. package/dist/_internal/plugin-core/material/material-manifest.js +1 -1
  230. package/dist/_internal/plugin-core/material/material-theme.d.ts +2 -2
  231. package/dist/_internal/plugin-core/material/material-theme.js +2 -2
  232. package/dist/_internal/plugin-manager/contribution-kind-plan.d.ts +5 -1
  233. package/dist/_internal/plugin-manager/contribution-kind-plan.js +20 -12
  234. package/dist/_internal/plugin-manager/manager.js +47 -30
  235. package/dist/_internal/plugin-manager/resolver.js +7 -13
  236. package/dist/_internal/plugin-manager/types.d.ts +2 -2
  237. package/dist/_internal/plugin-sdk/authoring-finding.d.ts +3 -3
  238. package/dist/_internal/plugin-sdk/fragment-audit.d.ts +6 -6
  239. package/dist/_internal/plugin-sdk/fragment-audit.js +8 -8
  240. package/dist/_internal/plugin-sdk/fragment-definition.d.ts +3 -3
  241. package/dist/_internal/plugin-sdk/fragment-definition.js +3 -3
  242. package/dist/_internal/plugin-sdk/material-config-groups.d.ts +2 -2
  243. package/dist/_internal/plugin-sdk/material-definition.d.ts +5 -1
  244. package/dist/_internal/plugin-sdk/material-definition.js +3 -3
  245. package/dist/_internal/plugin-sdk/material-editor-audit.d.ts +9 -8
  246. package/dist/_internal/plugin-sdk/material-editor-audit.js +19 -11
  247. package/dist/_internal/plugin-sdk/material-isolated-csp.d.ts +1 -1
  248. package/dist/_internal/plugin-sdk/material-isolated-csp.js +1 -1
  249. package/dist/_internal/plugin-sdk/material-isolated-runtime.d.ts +3 -3
  250. package/dist/_internal/plugin-sdk/material-isolated-runtime.js +3 -3
  251. package/dist/_internal/plugin-sdk/material-isolated.d.ts +9 -9
  252. package/dist/_internal/plugin-sdk/material-isolated.js +28 -8
  253. package/dist/_internal/plugin-sdk/material-package.d.ts +3 -3
  254. package/dist/_internal/plugin-sdk/material-package.js +7 -7
  255. package/dist/_internal/plugin-sdk/material-rendered-element.d.ts +13 -6
  256. package/dist/_internal/plugin-sdk/material-rendered-element.js +36 -7
  257. package/dist/_internal/plugin-sdk/material-spec-audit.d.ts +19 -11
  258. package/dist/_internal/plugin-sdk/material-spec-audit.js +85 -19
  259. package/dist/_internal/plugin-sdk/material-spec.d.ts +66 -21
  260. package/dist/_internal/plugin-sdk/material-spec.js +166 -42
  261. package/dist/_internal/plugin-sdk/material-style-keys.d.ts +6 -6
  262. package/dist/_internal/plugin-sdk/material-style-keys.js +7 -7
  263. package/dist/_internal/plugin-sdk/material-template-audit.d.ts +1 -1
  264. package/dist/_internal/plugin-sdk/material-template-audit.js +3 -3
  265. package/dist/_internal/plugin-sdk/material-template-expression.d.ts +3 -3
  266. package/dist/_internal/plugin-sdk/material-template-expression.js +2 -2
  267. package/dist/_internal/plugin-sdk/material-template-render.d.ts +1 -1
  268. package/dist/_internal/plugin-sdk/material-template.d.ts +6 -6
  269. package/dist/_internal/plugin-sdk/material-template.js +2 -2
  270. package/dist/_internal/plugin-sdk/plugin-package.d.ts +2 -2
  271. package/dist/_internal/plugin-sdk/plugin-package.js +3 -3
  272. package/dist/_internal/plugin-sdk/plugin-registration.d.ts +2 -5
  273. package/dist/_internal/plugin-sdk/plugin-registration.js +3 -3
  274. package/dist/_internal/renderer/renderer/renderer-candidates.d.ts +1 -1
  275. package/dist/_internal/renderer/renderer/renderer-component-states.d.ts +1 -1
  276. package/dist/_internal/renderer/renderer/renderer-effective-style.d.ts +1 -1
  277. package/dist/_internal/renderer/renderer/renderer-material-dom.d.ts +1 -1
  278. package/dist/_internal/renderer/renderer/renderer-state.d.ts +2 -2
  279. package/dist/_internal/renderer/renderer/renderer-theme.d.ts +1 -1
  280. package/dist/_internal/renderer/renderer/renderer-types.d.ts +1 -1
  281. package/dist/_internal/renderer/renderer/renderer.d.ts +5 -5
  282. package/dist/_internal/renderer/resource/data-source-runtime.d.ts +3 -3
  283. package/dist/_internal/renderer/resource/push-window.d.ts +1 -1
  284. package/dist/_internal/renderer/resource/request-coordinator.d.ts +1 -1
  285. package/dist/_internal/renderer/resource/source-query-port.d.ts +3 -3
  286. package/dist/_internal/renderer/sub-canvas-layer.d.ts +2 -2
  287. package/dist/_internal/renderer/viewer/viewer-configuration.d.ts +1 -1
  288. package/dist/_internal/renderer/viewer/viewer.d.ts +3 -3
  289. package/dist/auto-register.js +9 -9
  290. package/dist/contracts.js +1 -1
  291. package/dist/contracts.js.map +1 -1
  292. package/dist/core.js.map +1 -1
  293. package/dist/dataset-port-D993nOlT.js.map +1 -1
  294. package/dist/dataset-profile-Dk6xdtsM.js.map +1 -1
  295. package/dist/{designer-CFOvOmLn.js → designer-DzBm8tXS.js} +2 -2
  296. package/dist/{designer-CFOvOmLn.js.map → designer-DzBm8tXS.js.map} +1 -1
  297. package/dist/designer-auto-register.js +5 -5
  298. package/dist/{designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js → designer-blueprint-workbench-panel-DVvKcSvJ-CkRMBKZA.js} +111 -111
  299. package/dist/designer-blueprint-workbench-panel-DVvKcSvJ-CkRMBKZA.js.map +1 -0
  300. package/dist/{designer-dataset-controller-DdbY4ILC-CMdGdGbr.js → designer-dataset-controller-bSR5OB6n-DfUP24S6.js} +1052 -946
  301. package/dist/designer-dataset-controller-bSR5OB6n-DfUP24S6.js.map +1 -0
  302. package/dist/{designer-field-primitives-Crn464Qg-Bi7q8s5J.js → designer-field-primitives-C_StzrUa-QZpcn0yX.js} +198 -179
  303. package/dist/designer-field-primitives-C_StzrUa-QZpcn0yX.js.map +1 -0
  304. package/dist/{designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js → designer-left-panel-groups-dom-DBpI3Nc2-D8kYJLCg.js} +17 -17
  305. package/dist/{designer-left-panel-groups-dom-DFdLWxxY-BarlWMLY.js.map → designer-left-panel-groups-dom-DBpI3Nc2-D8kYJLCg.js.map} +1 -1
  306. package/dist/designer.js +5 -5
  307. package/dist/{dist-CHK9BTXX.js → dist-YCmniYuO.js} +4801 -4383
  308. package/dist/dist-YCmniYuO.js.map +1 -0
  309. package/dist/engine.js +4 -4
  310. package/dist/fragment-B-oP0Fru.js.map +1 -1
  311. package/dist/host-kit.js +979 -554
  312. package/dist/host-kit.js.map +1 -1
  313. package/dist/{host-resource-selection-CWrPLVOc-DPDq3jau.js → host-resource-selection-BCRU23WQ-Cedz0d14.js} +206 -206
  314. package/dist/host-resource-selection-BCRU23WQ-Cedz0d14.js.map +1 -0
  315. package/dist/image-url-D6mUcjY1.js.map +1 -1
  316. package/dist/index.js +9 -9
  317. package/dist/legibility-CS28ivEz.js.map +1 -1
  318. package/dist/level-scale-CwHqFEVd.js.map +1 -1
  319. package/dist/{manager-CeB4Jnr9.js → manager-BcvdcZjM.js} +230 -210
  320. package/dist/manager-BcvdcZjM.js.map +1 -0
  321. package/dist/{material-DeVkzSoT.js → material-ReRzBIbb.js} +2 -2
  322. package/dist/{material-DeVkzSoT.js.map → material-ReRzBIbb.js.map} +1 -1
  323. package/dist/material-auto-register.js +1 -1
  324. package/dist/{material-definition-BeW34dJr.js → material-definition-BcjFM-B-.js} +9 -9
  325. package/dist/material-definition-BcjFM-B-.js.map +1 -0
  326. package/dist/material-manifest-B1XatGPx.js.map +1 -1
  327. package/dist/material-theme-C91eus78.js.map +1 -1
  328. package/dist/material.js +2 -2
  329. package/dist/migrate-document-BM888PtC.js.map +1 -1
  330. package/dist/{parse-aZat9tAS.js → parse-1U_-Qtn4.js} +2 -2
  331. package/dist/parse-1U_-Qtn4.js.map +1 -0
  332. package/dist/parse-Ji7kE9ZT.js.map +1 -1
  333. package/dist/{plugin-CstHQ5ws.js → plugin-BH-4oNvT.js} +60 -52
  334. package/dist/plugin-BH-4oNvT.js.map +1 -0
  335. package/dist/plugin-core.js +1 -1
  336. package/dist/plugin-manager.js +1 -1
  337. package/dist/{plugin-package-DWifuHi1.js → plugin-package-Cj-3iLv3.js} +2068 -1905
  338. package/dist/plugin-package-Cj-3iLv3.js.map +1 -0
  339. package/dist/{plugin-registration-DTwBvnHX.js → plugin-registration-C9_IxTxc.js} +9 -9
  340. package/dist/{plugin-registration-DTwBvnHX.js.map → plugin-registration-C9_IxTxc.js.map} +1 -1
  341. package/dist/plugin-sdk.js +6 -6
  342. package/dist/{plugins-QDL0yIql.js → plugins-CwATlfr0.js} +2 -2
  343. package/dist/{plugins-QDL0yIql.js.map → plugins-CwATlfr0.js.map} +1 -1
  344. package/dist/plugins.js +8 -8
  345. package/dist/runtime-dispatch-C0gyIrTv.js.map +1 -1
  346. package/dist/runtime-simulate-aSYO9yDX.js.map +1 -1
  347. package/dist/{src-Bm7u11mN-Bi1hDVkh.js → src-Bm7u11mN-DFLnFQSk.js} +19 -19
  348. package/dist/{src-Bm7u11mN-Bi1hDVkh.js.map → src-Bm7u11mN-DFLnFQSk.js.map} +1 -1
  349. package/dist/{text-BSTz0pFQ.js → text-DfKom8EG.js} +2 -2
  350. package/dist/{text-BSTz0pFQ.js.map → text-DfKom8EG.js.map} +1 -1
  351. package/dist/theme-CcBXf4Ay.js.map +1 -1
  352. package/dist/value-ref-XkLuckGV.js.map +1 -1
  353. package/dist/{viewer-CrJupI8I-BJiz1cvW.js → viewer-CrJupI8I-CeQS58mA.js} +4 -4
  354. package/dist/{viewer-CrJupI8I-BJiz1cvW.js.map → viewer-CrJupI8I-CeQS58mA.js.map} +1 -1
  355. package/dist/viewer-auto-register.js +1 -1
  356. package/dist/viewer.js +1 -1
  357. package/dist/viewport-BNIRWjiT.js.map +1 -1
  358. package/package.json +13 -13
  359. package/dist/designer-blueprint-workbench-panel-BWSglfAb-ktaj6Ci9.js.map +0 -1
  360. package/dist/designer-dataset-controller-DdbY4ILC-CMdGdGbr.js.map +0 -1
  361. package/dist/designer-field-primitives-Crn464Qg-Bi7q8s5J.js.map +0 -1
  362. package/dist/dist-CHK9BTXX.js.map +0 -1
  363. package/dist/host-resource-selection-CWrPLVOc-DPDq3jau.js.map +0 -1
  364. package/dist/manager-CeB4Jnr9.js.map +0 -1
  365. package/dist/material-definition-BeW34dJr.js.map +0 -1
  366. package/dist/parse-aZat9tAS.js.map +0 -1
  367. package/dist/plugin-CstHQ5ws.js.map +0 -1
  368. package/dist/plugin-package-DWifuHi1.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-document-BM888PtC.js","names":[],"sources":["../../contracts/dist/migration/blueprint-graph-migration.js","../../contracts/dist/migration/migrate-document.js"],"sourcesContent":["import { serializeCanonicalJson } from '../json/canonical.js';\nexport function migrateRelationBlueprint(input) {\n const unchanged = { input, decisions: [] };\n if (!isObject(input) || !isObject(input.blueprint))\n return unchanged;\n const blueprint = input.blueprint;\n if ('nodes' in blueprint || 'edges' in blueprint || !('relations' in blueprint)) {\n return unchanged;\n }\n if (Object.keys(blueprint).some((key) => key !== 'relations' && key !== 'layout')) {\n return unchanged;\n }\n const relations = blueprint.relations;\n if (!Array.isArray(relations))\n return unchanged;\n const nodes = [];\n const nodeIds = new Set();\n const edges = [];\n const edgeIds = new Set();\n const flowKeys = new Set();\n const semanticKeys = new Set();\n const decisions = [];\n const usedIds = new Set();\n for (const relation of relations) {\n if (isObject(relation) && typeof relation.id === 'string')\n usedIds.add(relation.id);\n }\n let conditionCounter = 0;\n let edgeCounter = 0;\n const allocate = (prefix, next) => {\n for (;;) {\n const candidate = `${prefix}-${next()}`;\n if (!usedIds.has(candidate) && !nodeIds.has(candidate)) {\n usedIds.add(candidate);\n return candidate;\n }\n }\n };\n const ensureNode = (id, node) => {\n if (!nodeIds.has(id)) {\n nodeIds.add(id);\n nodes.push(node);\n }\n return id;\n };\n const pushEdge = (edge, key, index) => {\n if (flowKeys.has(key) || semanticKeys.has(key) || edgeIds.has(edge.id)) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation duplicated an earlier relation between the same ports and was dropped.',\n });\n return false;\n }\n (edge.kind === 'semantic' ? semanticKeys : flowKeys).add(key);\n edgeIds.add(edge.id);\n edges.push(edge);\n return true;\n };\n let previousGroupKey;\n let currentCondition;\n for (let index = 0; index < relations.length; index++) {\n const relation = relations[index];\n if (!isObject(relation) || typeof relation.id !== 'string')\n return unchanged;\n if (relation.type === 'semantic') {\n // 旧派生规则跳过语义关系,不打断行为关系的分组。\n const from = componentEndpoint(relation.source);\n const to = componentEndpoint(relation.target);\n if (from === undefined || to === undefined || typeof relation.role !== 'string') {\n return unchanged;\n }\n ensureNode(from, {\n kind: 'component',\n id: from,\n componentId: componentIdOf(relation.source),\n });\n ensureNode(to, { kind: 'component', id: to, componentId: componentIdOf(relation.target) });\n const created = pushEdge({\n kind: 'semantic',\n id: relation.id,\n from: { node: from },\n to: { node: to },\n role: relation.role,\n }, `semantic\\u0000${from}\\u0000${to}`, index);\n if (created) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: 'Semantic relation became a semantic edge.',\n createdEdgeIds: [relation.id],\n });\n }\n continue;\n }\n if (relation.type !== 'behavior')\n return unchanged;\n const source = sourceEndpoint(relation.source);\n if (source === null)\n return unchanged;\n if (source === 'request-state') {\n // 旧派生规则里它自成一组:后续同源同条件的关系不与之前的组合并。\n previousGroupKey = `request-state\\u0000${index}`;\n currentCondition = undefined;\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation was triggered by variable request-state, which the runtime never emits; it was dropped.',\n });\n continue;\n }\n ensureNode(source.endpoint.nodeId, source.node);\n const target = targetEndpoint(relation.target, relation.effect);\n if (target === null)\n return unchanged;\n ensureNode(target.endpoint.nodeId, target.node);\n const condition = relation.condition;\n if (condition !== undefined && !isObject(condition))\n return unchanged;\n const capabilities = relation.requiredCapabilities;\n if (capabilities !== undefined && !Array.isArray(capabilities))\n return unchanged;\n const groupKey = `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${condition === undefined\n ? 'null'\n : serializeCanonicalJson(condition)}`;\n const createdEdgeIds = [];\n let from = source.endpoint;\n if (condition !== undefined) {\n if (previousGroupKey !== groupKey || currentCondition === undefined) {\n currentCondition = allocate('condition', () => ++conditionCounter);\n ensureNode(currentCondition, { kind: 'condition', id: currentCondition, condition });\n const judgeId = allocate('edge', () => ++edgeCounter);\n pushEdge({\n kind: 'flow',\n id: judgeId,\n from: { node: source.endpoint.nodeId, port: source.endpoint.port },\n to: { node: currentCondition, port: 'judge' },\n }, `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${currentCondition}\\u0000judge`, index);\n createdEdgeIds.push(judgeId);\n decisions.push({\n kind: 'blueprint-node',\n path: ['blueprint', 'relations', index, 'condition'],\n action: 'mapped',\n detail: `Relation condition became condition node \"${currentCondition}\".`,\n });\n }\n from = { nodeId: currentCondition, port: 'yes' };\n }\n else {\n currentCondition = undefined;\n }\n previousGroupKey = groupKey;\n const edge = {\n kind: 'flow',\n id: relation.id,\n from: { node: from.nodeId, port: from.port },\n to: { node: target.endpoint.nodeId, port: target.endpoint.port },\n ...target.fields,\n ...(capabilities === undefined ? {} : { requiredCapabilities: capabilities }),\n };\n if (pushEdge(edge, `${from.nodeId}\\u0000${from.port}\\u0000${target.endpoint.nodeId}\\u0000${target.endpoint.port}`, index)) {\n createdEdgeIds.push(relation.id);\n }\n if (createdEdgeIds.length > 0) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: condition === undefined\n ? 'Behavior relation became a flow edge.'\n : 'Conditional behavior relation became a flow edge from a condition node.',\n createdEdgeIds,\n });\n }\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isObject(layout))\n return unchanged;\n const layoutNodes = layout.nodes;\n if (layoutNodes !== undefined && !Array.isArray(layoutNodes))\n return unchanged;\n const kept = [];\n let dropped = 0;\n for (const node of layoutNodes ?? []) {\n if (!isObject(node) || typeof node.id !== 'string')\n return unchanged;\n if (nodeIds.has(node.id))\n kept.push(node);\n else\n dropped += 1;\n }\n if (dropped > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${dropped} layout position(s) for components or variables that no longer have a blueprint node.`,\n });\n }\n migratedLayout = {\n nodes: kept,\n ...(layout.viewport === undefined ? {} : { viewport: layout.viewport }),\n };\n }\n return {\n input: {\n ...input,\n blueprint: {\n nodes,\n edges,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nfunction componentIdOf(value) {\n return value.componentId;\n}\nfunction componentEndpoint(value) {\n if (!isObject(value) || value.kind !== 'component' || typeof value.componentId !== 'string') {\n return undefined;\n }\n return `component:${value.componentId}`;\n}\nfunction sourceEndpoint(source) {\n if (!isObject(source) || !isObject(source.event))\n return null;\n const eventName = source.event.eventName;\n if (source.kind === 'component' && typeof source.componentId === 'string') {\n if (typeof eventName !== 'string')\n return null;\n const id = `component:${source.componentId}`;\n return {\n endpoint: { nodeId: id, port: `event:${eventName}` },\n node: { kind: 'component', id, componentId: source.componentId },\n };\n }\n if (source.kind === 'variable' && typeof source.variableId === 'string') {\n if (eventName === 'request-state')\n return 'request-state';\n if (eventName !== 'data-updated')\n return null;\n const id = `variable:${source.variableId}`;\n return {\n endpoint: { nodeId: id, port: 'data-updated' },\n node: { kind: 'variable', id, variableId: source.variableId },\n };\n }\n if (source.kind === 'lifecycle' && eventName === 'ready') {\n return {\n endpoint: { nodeId: 'lifecycle', port: 'ready' },\n node: { kind: 'lifecycle', id: 'lifecycle' },\n };\n }\n if (source.kind === 'timer' && eventName === 'tick' && Number.isInteger(source.intervalSeconds)) {\n const id = `timer:${source.intervalSeconds}`;\n return {\n endpoint: { nodeId: id, port: 'tick' },\n node: { kind: 'timer', id, intervalSeconds: source.intervalSeconds },\n };\n }\n return null;\n}\nfunction targetEndpoint(target, effect) {\n if (!isObject(target) || !isObject(effect))\n return null;\n if (target.kind === 'component' && typeof target.componentId === 'string') {\n const id = `component:${target.componentId}`;\n const node = { kind: 'component', id, componentId: target.componentId };\n if (effect.type === 'component-visibility') {\n const operation = effect.operation;\n if (operation !== 'show' && operation !== 'hide' && operation !== 'toggle')\n return null;\n return {\n endpoint: { nodeId: id, port: operation },\n node,\n fields: effect.transition === undefined ? {} : { transition: effect.transition },\n };\n }\n if (effect.type === 'request-component-data') {\n return { endpoint: { nodeId: id, port: 'request-data' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'variable' && typeof target.variableId === 'string') {\n const id = `variable:${target.variableId}`;\n const node = { kind: 'variable', id, variableId: target.variableId };\n if (effect.type === 'set-variable' && effect.value !== undefined) {\n return { endpoint: { nodeId: id, port: 'set' }, node, fields: { value: effect.value } };\n }\n if (effect.type === 'request-variable') {\n return { endpoint: { nodeId: id, port: 'request' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'host') {\n const node = { kind: 'host', id: 'host' };\n if (effect.type === 'emit-host-event' && typeof effect.eventName === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `event:${effect.eventName}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n if (effect.type === 'host-action' && typeof effect.actionId === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `action:${effect.actionId}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n }\n return null;\n}\n//# sourceMappingURL=blueprint-graph-migration.js.map","import { parseScreenDocument } from '../document/parse.js';\nimport { migrateRelationBlueprint } from './blueprint-graph-migration.js';\nconst CREATED_ID_PREFIX = 'data-source-';\n/**\n * 把旧形态文档迁移到当前形态,返回新文档与逐条决策。\n *\n * 这是「旧 → 新」的唯一转换路径:读取适配窗口只读,从不产出可写文档。\n * 迁移是幂等的——已经写过 `dataValue` / `dataSources` / 单形态变量的文档原样返回。\n *\n * @param input 待迁移的原始文档(未校验 JSON)。\n */\nexport function migrateScreenDocument(input) {\n const legacy = preprocessLegacyBlueprint(input);\n const graph = migrateRelationBlueprint(legacy.input);\n const preprocessed = {\n input: graph.input,\n decisions: [...legacy.decisions, ...graph.decisions],\n };\n const parsed = parseScreenDocument(preprocessed.input);\n if (!parsed.ok) {\n return {\n ok: false,\n document: undefined,\n decisions: preprocessed.decisions,\n diagnostics: parsed.diagnostics,\n };\n }\n const context = {\n dataSources: [...(parsed.value.dataSources ?? [])],\n usedIds: new Set((parsed.value.dataSources ?? []).map((instance) => instance.id)),\n decisions: [],\n counter: 0,\n };\n const components = parsed.value.components.map((component, index) => migrateComponent(component, index, context));\n const variables = parsed.value.variables.map((entry, index) => migrateVariable(entry, index, context));\n const migrated = parseScreenDocument({\n canvas: parsed.value.canvas,\n components,\n dataSources: context.dataSources,\n variables,\n blueprint: parsed.value.blueprint,\n ...(parsed.value.theme === undefined ? {} : { theme: parsed.value.theme }),\n });\n const decisions = [...preprocessed.decisions, ...context.decisions];\n if (!migrated.ok) {\n return {\n ok: false,\n document: undefined,\n decisions,\n diagnostics: migrated.diagnostics,\n };\n }\n return { ok: true, document: migrated.value, decisions, diagnostics: [] };\n}\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n/**\n * 旧 `blueprint.rules` → relations 的转换路径(ADR-0091);产物随后由\n * `migrateRelationBlueprint` 转成节点图(ADR-0107),因此三种旧形态都能一次迁到当前形态。\n *\n * 只处理结构完整可识别的旧文档;任何无法安全转换的形状都原样返回,让严格解析失败关闭,\n * 不做部分迁移、不静默丢弃规则。\n */\nfunction preprocessLegacyBlueprint(input) {\n if (!isPlainObject(input) || !isPlainObject(input.blueprint)) {\n return { input, decisions: [] };\n }\n const blueprint = input.blueprint;\n if ('relations' in blueprint || !('rules' in blueprint)) {\n return { input, decisions: [] };\n }\n if (Object.keys(blueprint).some((key) => key !== 'rules' && key !== 'layout')) {\n return { input, decisions: [] };\n }\n const rules = blueprint.rules;\n if (!Array.isArray(rules) ||\n !Array.isArray(input.components) ||\n !Array.isArray(input.variables)) {\n return { input, decisions: [] };\n }\n const componentIds = new Set();\n for (const component of input.components) {\n if (!isPlainObject(component) || typeof component.id !== 'string') {\n return { input, decisions: [] };\n }\n componentIds.add(component.id);\n }\n const variableIds = new Set();\n for (const variable of input.variables) {\n if (!isPlainObject(variable) || typeof variable.id !== 'string') {\n return { input, decisions: [] };\n }\n variableIds.add(variable.id);\n }\n const decisions = [];\n const relations = [];\n let relationCounter = 0;\n const allocateRelationId = () => {\n for (;;) {\n relationCounter += 1;\n const candidate = `relation-${relationCounter}`;\n if (!relations.some((relation) => relation.id === candidate))\n return candidate;\n }\n };\n for (let index = 0; index < rules.length; index++) {\n const rule = rules[index];\n if (!isPlainObject(rule))\n return { input, decisions: [] };\n const source = legacyTriggerSource(rule.trigger);\n if (source === null)\n return { input, decisions: [] };\n const actions = rule.actions;\n if (!Array.isArray(actions))\n return { input, decisions: [] };\n const condition = rule.condition;\n if (condition !== undefined && !isPlainObject(condition))\n return { input, decisions: [] };\n const requiredCapabilities = rule.requiredCapabilities;\n if (requiredCapabilities !== undefined && !Array.isArray(requiredCapabilities)) {\n return { input, decisions: [] };\n }\n const createdRelationIds = [];\n for (const action of actions) {\n const relationId = allocateRelationId();\n const relation = legacyActionRelation(action, relationId, source, condition, requiredCapabilities);\n if (relation === null)\n return { input, decisions: [] };\n relations.push(relation);\n createdRelationIds.push(relationId);\n }\n decisions.push({\n kind: 'blueprint-relation',\n path: ['blueprint', 'rules', index],\n action: createdRelationIds.length === 0 ? 'rejected' : 'mapped',\n detail: createdRelationIds.length === 0\n ? 'Rule had no actions and was dropped; it had no runtime behavior.'\n : `Rule was split into ${createdRelationIds.length} behavior relation(s).`,\n ...(createdRelationIds.length === 0 ? {} : { createdRelationIds }),\n });\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isPlainObject(layout))\n return { input, decisions: [] };\n if (Object.keys(layout).some((key) => key !== 'nodes' && key !== 'viewport')) {\n return { input, decisions: [] };\n }\n const nodes = layout.nodes;\n if (nodes !== undefined && !Array.isArray(nodes))\n return { input, decisions: [] };\n if (layout.viewport !== undefined && !isPlainObject(layout.viewport)) {\n return { input, decisions: [] };\n }\n const keptNodes = [];\n let droppedCondition = 0;\n let droppedAction = 0;\n let droppedUnconnected = 0;\n let droppedOther = 0;\n for (const node of nodes ?? []) {\n if (!isPlainObject(node) || typeof node.id !== 'string')\n return { input, decisions: [] };\n const id = node.id;\n if (id.startsWith('component:') && componentIds.has(id.slice('component:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('variable:') && variableIds.has(id.slice('variable:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('condition:')) {\n droppedCondition += 1;\n }\n else if (id.startsWith('action:')) {\n droppedAction += 1;\n }\n else if (id.startsWith('unconnected:')) {\n droppedUnconnected += 1;\n }\n else {\n droppedOther += 1;\n }\n }\n const droppedTotal = droppedCondition + droppedAction + droppedUnconnected + droppedOther;\n if (droppedTotal > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${droppedTotal} layout position(s) with no relation-model equivalent (${droppedCondition} condition, ${droppedAction} action, ${droppedUnconnected} unconnected, ${droppedOther} stale).`,\n });\n }\n const hasViewport = layout.viewport !== undefined;\n if (keptNodes.length > 0 || hasViewport) {\n migratedLayout = {\n ...(keptNodes.length === 0 ? {} : { nodes: keptNodes }),\n ...(hasViewport ? { viewport: layout.viewport } : {}),\n };\n }\n }\n return {\n input: {\n ...input,\n blueprint: {\n relations,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction legacyTriggerSource(trigger) {\n if (!isPlainObject(trigger))\n return null;\n if (trigger.type === 'material-event' &&\n typeof trigger.componentId === 'string' &&\n typeof trigger.eventName === 'string') {\n return {\n kind: 'component',\n componentId: trigger.componentId,\n event: { type: 'material-event', eventName: trigger.eventName },\n };\n }\n if (trigger.type === 'variable-event' &&\n typeof trigger.variableId === 'string' &&\n (trigger.eventName === 'data-updated' || trigger.eventName === 'request-state')) {\n return {\n kind: 'variable',\n variableId: trigger.variableId,\n event: { type: 'variable-event', eventName: trigger.eventName },\n };\n }\n return null;\n}\nfunction legacyActionRelation(action, id, source, condition, requiredCapabilities) {\n if (!isPlainObject(action))\n return null;\n const base = {\n type: 'behavior',\n id,\n source,\n ...(condition === undefined ? {} : { condition }),\n ...(requiredCapabilities === undefined ? {} : { requiredCapabilities }),\n };\n if (action.type === 'component-visibility') {\n if (typeof action.componentId !== 'string' ||\n (action.operation !== 'show' && action.operation !== 'hide' && action.operation !== 'toggle')) {\n return null;\n }\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: {\n type: 'component-visibility',\n operation: action.operation,\n ...(action.transition === undefined ? {} : { transition: action.transition }),\n },\n };\n }\n if (action.type === 'request-component-data') {\n if (typeof action.componentId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: { type: 'request-component-data' },\n };\n }\n if (action.type === 'set-variable') {\n if (typeof action.variableId !== 'string' || action.value === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'set-variable', value: action.value },\n };\n }\n if (action.type === 'request-variable') {\n if (typeof action.variableId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'request-variable' },\n };\n }\n if (action.type === 'emit-host-event') {\n if (typeof action.eventName !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'emit-host-event', eventName: action.eventName, payload: action.payload },\n };\n }\n if (action.type === 'host-action') {\n if (typeof action.actionId !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'host-action', actionId: action.actionId, payload: action.payload },\n };\n }\n return null;\n}\n/** `data-source-<n>`:按实例创建顺序自增、与文档内既有 id 去重、不含时间戳与随机数。 */\nfunction allocateDataSourceId(context) {\n for (;;) {\n context.counter += 1;\n const candidate = `${CREATED_ID_PREFIX}${context.counter}`;\n if (!context.usedIds.has(candidate)) {\n context.usedIds.add(candidate);\n return candidate;\n }\n }\n}\nfunction migrateComponent(component, index, context) {\n if (component.dataValue !== undefined)\n return component;\n const previousSource = component.dataSource;\n if (previousSource === null) {\n return { ...component, dataValue: null };\n }\n const migrated = migrateComponentDataSource(component, previousSource, index, context);\n return migrated;\n}\nfunction migrateComponentDataSource(component, previousSource, index, context) {\n const path = ['components', index, 'dataSource'];\n const base = {\n id: component.id,\n type: component.type,\n name: component.name,\n parentId: component.parentId,\n position: component.position,\n size: component.size,\n rotation: component.rotation,\n zIndex: component.zIndex,\n status: component.status,\n props: component.props,\n style: component.style,\n // 旧字段保留为 null:当前契约仍要求该键存在,它不再是写入口。\n dataSource: null,\n ...(component.states === undefined ? {} : { states: component.states }),\n };\n switch (previousSource.type) {\n case 'static':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Static component value became an inline value reference.',\n });\n return {\n ...base,\n dataValue: { kind: 'inline', value: previousSource.value },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n case 'variable':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Variable component value became a variable value reference.',\n });\n if (previousSource.processorId !== undefined) {\n context.decisions.push({\n kind: 'component-value',\n path: [...path, 'processorId'],\n action: 'rejected',\n detail: 'A component value has no data source instance to own processorId; the field was dropped.',\n });\n }\n return {\n ...base,\n dataValue: { kind: 'variable', variableId: previousSource.variableId },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n default: {\n const dataSourceId = allocateDataSourceId(context);\n const instance = previousSource.type === 'dataset'\n ? {\n id: dataSourceId,\n name: previousSource.datasetId,\n source: { kind: 'dataset', datasetId: previousSource.datasetId },\n params: migrateComponentParams(previousSource.params, index, context),\n }\n : {\n id: dataSourceId,\n name: previousSource.resourceId,\n source: {\n kind: 'host-resource',\n resourceType: previousSource.resourceType,\n resourceId: previousSource.resourceId,\n },\n params: migrateComponentParams(previousSource.params, index, context),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: previousSource.type === 'dataset'\n ? `Dataset component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`\n : `Host resource component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n ...base,\n dataValue: { kind: 'data-source-field', dataSourceId, path: [] },\n dataBinding: previousSource.binding,\n };\n }\n }\n}\nfunction migrateComponentParams(params, componentIndex, context) {\n const migrated = {};\n for (const [name, parameter] of Object.entries(params)) {\n if (parameter.kind === 'literal') {\n migrated[name] = { kind: 'inline', value: parameter.value };\n context.decisions.push({\n kind: 'parameter',\n path: ['components', componentIndex, 'dataSource', 'params', name, 'kind'],\n action: 'renamed',\n detail: 'Literal parameter became an inline value reference.',\n });\n }\n else {\n migrated[name] = { kind: 'variable', variableId: parameter.variableId };\n }\n }\n return migrated;\n}\nfunction migrateVariable(entry, index, context) {\n if (!('type' in entry))\n return entry;\n const path = ['variables', index];\n const withDescription = entry.description === undefined ? {} : { description: entry.description };\n if (entry.type === 'static') {\n context.decisions.push({\n kind: 'variable',\n path: [...path, 'type'],\n action: 'mapped',\n detail: 'Static variable became a variable record with an inline value and controlled false.',\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'inline', value: entry.initialValue },\n controlled: false,\n };\n }\n const dataSourceId = allocateDataSourceId(context);\n const updatePolicy = entry.type === 'data-source' && entry.autoUpdate !== undefined\n ? { mode: 'auto', intervalSeconds: entry.autoUpdate.intervalSeconds }\n : { mode: 'manual' };\n const instance = {\n id: dataSourceId,\n name: entry.name,\n source: entry.type === 'url-query'\n ? { kind: 'url-query', sourceId: entry.sourceId }\n : { kind: 'host-catalog', sourceId: entry.sourceId },\n params: {},\n updatePolicy,\n ...(entry.processorId === undefined ? {} : { processorId: entry.processorId }),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'variable',\n path,\n action: 'mapped',\n detail: entry.type === 'url-query'\n ? `Url query variable became data source instance \"${dataSourceId}\"; processorId moved to the instance.`\n : `Data source variable became data source instance \"${dataSourceId}\"; autoUpdate mapped to updatePolicy and processorId moved to the instance.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'data-source-field', dataSourceId, path: [] },\n controlled: entry.controlled,\n };\n}\n//# sourceMappingURL=migrate-document.js.map"],"mappings":";;;AACA,SAAgB,EAAyB,GAAO;CAC5C,IAAM,IAAY;EAAE;EAAO,WAAW,CAAC;CAAE;CACzC,IAAI,CAAC,EAAS,CAAK,KAAK,CAAC,EAAS,EAAM,SAAS,GAC7C,OAAO;CACX,IAAM,I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AE,MAAM;GAAU,OAAO,EAAM;EAAa;EACnD,YAAY;CAChB;CAEJ,IAAM,IAAe,EAAqB,CAAO,GAC3C,IAAe,EAAM,SAAS,iBAAiB,EAAM,eAAe,KAAA,IACpE;EAAE,MAAM;EAAQ,iBAAiB,EAAM,WAAW;CAAgB,IAClE,EAAE,MAAM,SAAS,GACjB,IAAW;EACb,IAAI;EACJ,MAAM,EAAM;EACZ,QAAQ,EAAM,SAAS,cACjB;GAAE,MAAM;GAAa,UAAU,EAAM;EAAS,IAC9C;GAAE,MAAM;GAAgB,UAAU,EAAM;EAAS;EACvD,QAAQ,CAAC;EACT;EACA,GAAI,EAAM,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,EAAM,YAAY;CAChF;CAWA,OAVA,EAAQ,YAAY,KAAK,CAAQ,GACjC,EAAQ,UAAU,KAAK;EACnB,MAAM;EACN;EACA,QAAQ;EACR,QAAQ,EAAM,SAAS,cACjB,mDAAmD,EAAa,yCAChE,qDAAqD,EAAa;EACxE,qBAAqB;CACzB,CAAC,GACM;EACH,IAAI,EAAM;EACV,MAAM,EAAM;EACZ,GAAG;EACH,cAAc,EAAM;EACpB,OAAO;GAAE,MAAM;GAAqB;GAAc,MAAM,CAAC;EAAE;EAC3D,YAAY,EAAM;CACtB;AACJ"}
1
+ {"version":3,"file":"migrate-document-BM888PtC.js","names":[],"sources":["../../contracts/dist/migration/blueprint-graph-migration.js","../../contracts/dist/migration/migrate-document.js"],"sourcesContent":["import { serializeCanonicalJson } from '../json/canonical.js';\nexport function migrateRelationBlueprint(input) {\n const unchanged = { input, decisions: [] };\n if (!isObject(input) || !isObject(input.blueprint))\n return unchanged;\n const blueprint = input.blueprint;\n if ('nodes' in blueprint || 'edges' in blueprint || !('relations' in blueprint)) {\n return unchanged;\n }\n if (Object.keys(blueprint).some((key) => key !== 'relations' && key !== 'layout')) {\n return unchanged;\n }\n const relations = blueprint.relations;\n if (!Array.isArray(relations))\n return unchanged;\n const nodes = [];\n const nodeIds = new Set();\n const edges = [];\n const edgeIds = new Set();\n const flowKeys = new Set();\n const semanticKeys = new Set();\n const decisions = [];\n const usedIds = new Set();\n for (const relation of relations) {\n if (isObject(relation) && typeof relation.id === 'string')\n usedIds.add(relation.id);\n }\n let conditionCounter = 0;\n let edgeCounter = 0;\n const allocate = (prefix, next) => {\n for (;;) {\n const candidate = `${prefix}-${next()}`;\n if (!usedIds.has(candidate) && !nodeIds.has(candidate)) {\n usedIds.add(candidate);\n return candidate;\n }\n }\n };\n const ensureNode = (id, node) => {\n if (!nodeIds.has(id)) {\n nodeIds.add(id);\n nodes.push(node);\n }\n return id;\n };\n const pushEdge = (edge, key, index) => {\n if (flowKeys.has(key) || semanticKeys.has(key) || edgeIds.has(edge.id)) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation duplicated an earlier relation between the same ports and was dropped.',\n });\n return false;\n }\n (edge.kind === 'semantic' ? semanticKeys : flowKeys).add(key);\n edgeIds.add(edge.id);\n edges.push(edge);\n return true;\n };\n let previousGroupKey;\n let currentCondition;\n for (let index = 0; index < relations.length; index++) {\n const relation = relations[index];\n if (!isObject(relation) || typeof relation.id !== 'string')\n return unchanged;\n if (relation.type === 'semantic') {\n // 旧派生规则跳过语义关系,不打断行为关系的分组。\n const from = componentEndpoint(relation.source);\n const to = componentEndpoint(relation.target);\n if (from === undefined || to === undefined || typeof relation.role !== 'string') {\n return unchanged;\n }\n ensureNode(from, {\n kind: 'component',\n id: from,\n componentId: componentIdOf(relation.source),\n });\n ensureNode(to, { kind: 'component', id: to, componentId: componentIdOf(relation.target) });\n const created = pushEdge({\n kind: 'semantic',\n id: relation.id,\n from: { node: from },\n to: { node: to },\n role: relation.role,\n }, `semantic\\u0000${from}\\u0000${to}`, index);\n if (created) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: 'Semantic relation became a semantic edge.',\n createdEdgeIds: [relation.id],\n });\n }\n continue;\n }\n if (relation.type !== 'behavior')\n return unchanged;\n const source = sourceEndpoint(relation.source);\n if (source === null)\n return unchanged;\n if (source === 'request-state') {\n // 旧派生规则里它自成一组:后续同源同条件的关系不与之前的组合并。\n previousGroupKey = `request-state\\u0000${index}`;\n currentCondition = undefined;\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'rejected',\n detail: 'Relation was triggered by variable request-state, which the runtime never emits; it was dropped.',\n });\n continue;\n }\n ensureNode(source.endpoint.nodeId, source.node);\n const target = targetEndpoint(relation.target, relation.effect);\n if (target === null)\n return unchanged;\n ensureNode(target.endpoint.nodeId, target.node);\n const condition = relation.condition;\n if (condition !== undefined && !isObject(condition))\n return unchanged;\n const capabilities = relation.requiredCapabilities;\n if (capabilities !== undefined && !Array.isArray(capabilities))\n return unchanged;\n const groupKey = `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${condition === undefined\n ? 'null'\n : serializeCanonicalJson(condition)}`;\n const createdEdgeIds = [];\n let from = source.endpoint;\n if (condition !== undefined) {\n if (previousGroupKey !== groupKey || currentCondition === undefined) {\n currentCondition = allocate('condition', () => ++conditionCounter);\n ensureNode(currentCondition, { kind: 'condition', id: currentCondition, condition });\n const judgeId = allocate('edge', () => ++edgeCounter);\n pushEdge({\n kind: 'flow',\n id: judgeId,\n from: { node: source.endpoint.nodeId, port: source.endpoint.port },\n to: { node: currentCondition, port: 'judge' },\n }, `${source.endpoint.nodeId}\\u0000${source.endpoint.port}\\u0000${currentCondition}\\u0000judge`, index);\n createdEdgeIds.push(judgeId);\n decisions.push({\n kind: 'blueprint-node',\n path: ['blueprint', 'relations', index, 'condition'],\n action: 'mapped',\n detail: `Relation condition became condition node \"${currentCondition}\".`,\n });\n }\n from = { nodeId: currentCondition, port: 'yes' };\n }\n else {\n currentCondition = undefined;\n }\n previousGroupKey = groupKey;\n const edge = {\n kind: 'flow',\n id: relation.id,\n from: { node: from.nodeId, port: from.port },\n to: { node: target.endpoint.nodeId, port: target.endpoint.port },\n ...target.fields,\n ...(capabilities === undefined ? {} : { requiredCapabilities: capabilities }),\n };\n if (pushEdge(edge, `${from.nodeId}\\u0000${from.port}\\u0000${target.endpoint.nodeId}\\u0000${target.endpoint.port}`, index)) {\n createdEdgeIds.push(relation.id);\n }\n if (createdEdgeIds.length > 0) {\n decisions.push({\n kind: 'blueprint-edge',\n path: ['blueprint', 'relations', index],\n action: 'mapped',\n detail: condition === undefined\n ? 'Behavior relation became a flow edge.'\n : 'Conditional behavior relation became a flow edge from a condition node.',\n createdEdgeIds,\n });\n }\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isObject(layout))\n return unchanged;\n const layoutNodes = layout.nodes;\n if (layoutNodes !== undefined && !Array.isArray(layoutNodes))\n return unchanged;\n const kept = [];\n let dropped = 0;\n for (const node of layoutNodes ?? []) {\n if (!isObject(node) || typeof node.id !== 'string')\n return unchanged;\n if (nodeIds.has(node.id))\n kept.push(node);\n else\n dropped += 1;\n }\n if (dropped > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${dropped} layout position(s) for components or variables that no longer have a blueprint node.`,\n });\n }\n migratedLayout = {\n nodes: kept,\n ...(layout.viewport === undefined ? {} : { viewport: layout.viewport }),\n };\n }\n return {\n input: {\n ...input,\n blueprint: {\n nodes,\n edges,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction isObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nfunction componentIdOf(value) {\n return value.componentId;\n}\nfunction componentEndpoint(value) {\n if (!isObject(value) || value.kind !== 'component' || typeof value.componentId !== 'string') {\n return undefined;\n }\n return `component:${value.componentId}`;\n}\nfunction sourceEndpoint(source) {\n if (!isObject(source) || !isObject(source.event))\n return null;\n const eventName = source.event.eventName;\n if (source.kind === 'component' && typeof source.componentId === 'string') {\n if (typeof eventName !== 'string')\n return null;\n const id = `component:${source.componentId}`;\n return {\n endpoint: { nodeId: id, port: `event:${eventName}` },\n node: { kind: 'component', id, componentId: source.componentId },\n };\n }\n if (source.kind === 'variable' && typeof source.variableId === 'string') {\n if (eventName === 'request-state')\n return 'request-state';\n if (eventName !== 'data-updated')\n return null;\n const id = `variable:${source.variableId}`;\n return {\n endpoint: { nodeId: id, port: 'data-updated' },\n node: { kind: 'variable', id, variableId: source.variableId },\n };\n }\n if (source.kind === 'lifecycle' && eventName === 'ready') {\n return {\n endpoint: { nodeId: 'lifecycle', port: 'ready' },\n node: { kind: 'lifecycle', id: 'lifecycle' },\n };\n }\n if (source.kind === 'timer' && eventName === 'tick' && Number.isInteger(source.intervalSeconds)) {\n const id = `timer:${source.intervalSeconds}`;\n return {\n endpoint: { nodeId: id, port: 'tick' },\n node: { kind: 'timer', id, intervalSeconds: source.intervalSeconds },\n };\n }\n return null;\n}\nfunction targetEndpoint(target, effect) {\n if (!isObject(target) || !isObject(effect))\n return null;\n if (target.kind === 'component' && typeof target.componentId === 'string') {\n const id = `component:${target.componentId}`;\n const node = { kind: 'component', id, componentId: target.componentId };\n if (effect.type === 'component-visibility') {\n const operation = effect.operation;\n if (operation !== 'show' && operation !== 'hide' && operation !== 'toggle')\n return null;\n return {\n endpoint: { nodeId: id, port: operation },\n node,\n fields: effect.transition === undefined ? {} : { transition: effect.transition },\n };\n }\n if (effect.type === 'request-component-data') {\n return { endpoint: { nodeId: id, port: 'request-data' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'variable' && typeof target.variableId === 'string') {\n const id = `variable:${target.variableId}`;\n const node = { kind: 'variable', id, variableId: target.variableId };\n if (effect.type === 'set-variable' && effect.value !== undefined) {\n return { endpoint: { nodeId: id, port: 'set' }, node, fields: { value: effect.value } };\n }\n if (effect.type === 'request-variable') {\n return { endpoint: { nodeId: id, port: 'request' }, node, fields: {} };\n }\n return null;\n }\n if (target.kind === 'host') {\n const node = { kind: 'host', id: 'host' };\n if (effect.type === 'emit-host-event' && typeof effect.eventName === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `event:${effect.eventName}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n if (effect.type === 'host-action' && typeof effect.actionId === 'string') {\n if (effect.payload === undefined)\n return null;\n return {\n endpoint: { nodeId: 'host', port: `action:${effect.actionId}` },\n node,\n fields: { payload: effect.payload },\n };\n }\n }\n return null;\n}\n//# sourceMappingURL=blueprint-graph-migration.js.map","import { parseScreenDocument } from '../document/parse.js';\nimport { migrateRelationBlueprint } from './blueprint-graph-migration.js';\nconst CREATED_ID_PREFIX = 'data-source-';\n/**\n * 把旧形态文档迁移到当前形态,返回新文档与逐条决策。\n *\n * 这是「旧 → 新」的唯一转换路径:读取适配窗口只读,从不产出可写文档。\n * 迁移是幂等的——已经写过 `dataValue` / `dataSources` / 单形态变量的文档原样返回。\n *\n * @param input 待迁移的原始文档(未校验 JSON)。\n */\nexport function migrateScreenDocument(input) {\n const legacy = preprocessLegacyBlueprint(input);\n const graph = migrateRelationBlueprint(legacy.input);\n const preprocessed = {\n input: graph.input,\n decisions: [...legacy.decisions, ...graph.decisions],\n };\n const parsed = parseScreenDocument(preprocessed.input);\n if (!parsed.ok) {\n return {\n ok: false,\n document: undefined,\n decisions: preprocessed.decisions,\n diagnostics: parsed.diagnostics,\n };\n }\n const context = {\n dataSources: [...(parsed.value.dataSources ?? [])],\n usedIds: new Set((parsed.value.dataSources ?? []).map((instance) => instance.id)),\n decisions: [],\n counter: 0,\n };\n const components = parsed.value.components.map((component, index) => migrateComponent(component, index, context));\n const variables = parsed.value.variables.map((entry, index) => migrateVariable(entry, index, context));\n const migrated = parseScreenDocument({\n canvas: parsed.value.canvas,\n components,\n dataSources: context.dataSources,\n variables,\n blueprint: parsed.value.blueprint,\n ...(parsed.value.theme === undefined ? {} : { theme: parsed.value.theme }),\n });\n const decisions = [...preprocessed.decisions, ...context.decisions];\n if (!migrated.ok) {\n return {\n ok: false,\n document: undefined,\n decisions,\n diagnostics: migrated.diagnostics,\n };\n }\n return { ok: true, document: migrated.value, decisions, diagnostics: [] };\n}\nfunction isPlainObject(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n/**\n * 旧 `blueprint.rules` → relations 的转换路径;产物随后由\n * `migrateRelationBlueprint` 转成节点图,因此三种旧形态都能一次迁到当前形态。\n *\n * 只处理结构完整可识别的旧文档;任何无法安全转换的形状都原样返回,让严格解析失败关闭,\n * 不做部分迁移、不静默丢弃规则。\n */\nfunction preprocessLegacyBlueprint(input) {\n if (!isPlainObject(input) || !isPlainObject(input.blueprint)) {\n return { input, decisions: [] };\n }\n const blueprint = input.blueprint;\n if ('relations' in blueprint || !('rules' in blueprint)) {\n return { input, decisions: [] };\n }\n if (Object.keys(blueprint).some((key) => key !== 'rules' && key !== 'layout')) {\n return { input, decisions: [] };\n }\n const rules = blueprint.rules;\n if (!Array.isArray(rules) ||\n !Array.isArray(input.components) ||\n !Array.isArray(input.variables)) {\n return { input, decisions: [] };\n }\n const componentIds = new Set();\n for (const component of input.components) {\n if (!isPlainObject(component) || typeof component.id !== 'string') {\n return { input, decisions: [] };\n }\n componentIds.add(component.id);\n }\n const variableIds = new Set();\n for (const variable of input.variables) {\n if (!isPlainObject(variable) || typeof variable.id !== 'string') {\n return { input, decisions: [] };\n }\n variableIds.add(variable.id);\n }\n const decisions = [];\n const relations = [];\n let relationCounter = 0;\n const allocateRelationId = () => {\n for (;;) {\n relationCounter += 1;\n const candidate = `relation-${relationCounter}`;\n if (!relations.some((relation) => relation.id === candidate))\n return candidate;\n }\n };\n for (let index = 0; index < rules.length; index++) {\n const rule = rules[index];\n if (!isPlainObject(rule))\n return { input, decisions: [] };\n const source = legacyTriggerSource(rule.trigger);\n if (source === null)\n return { input, decisions: [] };\n const actions = rule.actions;\n if (!Array.isArray(actions))\n return { input, decisions: [] };\n const condition = rule.condition;\n if (condition !== undefined && !isPlainObject(condition))\n return { input, decisions: [] };\n const requiredCapabilities = rule.requiredCapabilities;\n if (requiredCapabilities !== undefined && !Array.isArray(requiredCapabilities)) {\n return { input, decisions: [] };\n }\n const createdRelationIds = [];\n for (const action of actions) {\n const relationId = allocateRelationId();\n const relation = legacyActionRelation(action, relationId, source, condition, requiredCapabilities);\n if (relation === null)\n return { input, decisions: [] };\n relations.push(relation);\n createdRelationIds.push(relationId);\n }\n decisions.push({\n kind: 'blueprint-relation',\n path: ['blueprint', 'rules', index],\n action: createdRelationIds.length === 0 ? 'rejected' : 'mapped',\n detail: createdRelationIds.length === 0\n ? 'Rule had no actions and was dropped; it had no runtime behavior.'\n : `Rule was split into ${createdRelationIds.length} behavior relation(s).`,\n ...(createdRelationIds.length === 0 ? {} : { createdRelationIds }),\n });\n }\n const layout = blueprint.layout;\n let migratedLayout;\n if (layout !== undefined) {\n if (!isPlainObject(layout))\n return { input, decisions: [] };\n if (Object.keys(layout).some((key) => key !== 'nodes' && key !== 'viewport')) {\n return { input, decisions: [] };\n }\n const nodes = layout.nodes;\n if (nodes !== undefined && !Array.isArray(nodes))\n return { input, decisions: [] };\n if (layout.viewport !== undefined && !isPlainObject(layout.viewport)) {\n return { input, decisions: [] };\n }\n const keptNodes = [];\n let droppedCondition = 0;\n let droppedAction = 0;\n let droppedUnconnected = 0;\n let droppedOther = 0;\n for (const node of nodes ?? []) {\n if (!isPlainObject(node) || typeof node.id !== 'string')\n return { input, decisions: [] };\n const id = node.id;\n if (id.startsWith('component:') && componentIds.has(id.slice('component:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('variable:') && variableIds.has(id.slice('variable:'.length))) {\n keptNodes.push(node);\n }\n else if (id.startsWith('condition:')) {\n droppedCondition += 1;\n }\n else if (id.startsWith('action:')) {\n droppedAction += 1;\n }\n else if (id.startsWith('unconnected:')) {\n droppedUnconnected += 1;\n }\n else {\n droppedOther += 1;\n }\n }\n const droppedTotal = droppedCondition + droppedAction + droppedUnconnected + droppedOther;\n if (droppedTotal > 0) {\n decisions.push({\n kind: 'blueprint-layout',\n path: ['blueprint', 'layout', 'nodes'],\n action: 'rejected',\n detail: `Dropped ${droppedTotal} layout position(s) with no relation-model equivalent (${droppedCondition} condition, ${droppedAction} action, ${droppedUnconnected} unconnected, ${droppedOther} stale).`,\n });\n }\n const hasViewport = layout.viewport !== undefined;\n if (keptNodes.length > 0 || hasViewport) {\n migratedLayout = {\n ...(keptNodes.length === 0 ? {} : { nodes: keptNodes }),\n ...(hasViewport ? { viewport: layout.viewport } : {}),\n };\n }\n }\n return {\n input: {\n ...input,\n blueprint: {\n relations,\n ...(migratedLayout === undefined ? {} : { layout: migratedLayout }),\n },\n },\n decisions,\n };\n}\nfunction legacyTriggerSource(trigger) {\n if (!isPlainObject(trigger))\n return null;\n if (trigger.type === 'material-event' &&\n typeof trigger.componentId === 'string' &&\n typeof trigger.eventName === 'string') {\n return {\n kind: 'component',\n componentId: trigger.componentId,\n event: { type: 'material-event', eventName: trigger.eventName },\n };\n }\n if (trigger.type === 'variable-event' &&\n typeof trigger.variableId === 'string' &&\n (trigger.eventName === 'data-updated' || trigger.eventName === 'request-state')) {\n return {\n kind: 'variable',\n variableId: trigger.variableId,\n event: { type: 'variable-event', eventName: trigger.eventName },\n };\n }\n return null;\n}\nfunction legacyActionRelation(action, id, source, condition, requiredCapabilities) {\n if (!isPlainObject(action))\n return null;\n const base = {\n type: 'behavior',\n id,\n source,\n ...(condition === undefined ? {} : { condition }),\n ...(requiredCapabilities === undefined ? {} : { requiredCapabilities }),\n };\n if (action.type === 'component-visibility') {\n if (typeof action.componentId !== 'string' ||\n (action.operation !== 'show' && action.operation !== 'hide' && action.operation !== 'toggle')) {\n return null;\n }\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: {\n type: 'component-visibility',\n operation: action.operation,\n ...(action.transition === undefined ? {} : { transition: action.transition }),\n },\n };\n }\n if (action.type === 'request-component-data') {\n if (typeof action.componentId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'component', componentId: action.componentId },\n effect: { type: 'request-component-data' },\n };\n }\n if (action.type === 'set-variable') {\n if (typeof action.variableId !== 'string' || action.value === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'set-variable', value: action.value },\n };\n }\n if (action.type === 'request-variable') {\n if (typeof action.variableId !== 'string')\n return null;\n return {\n ...base,\n target: { kind: 'variable', variableId: action.variableId },\n effect: { type: 'request-variable' },\n };\n }\n if (action.type === 'emit-host-event') {\n if (typeof action.eventName !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'emit-host-event', eventName: action.eventName, payload: action.payload },\n };\n }\n if (action.type === 'host-action') {\n if (typeof action.actionId !== 'string' || action.payload === undefined)\n return null;\n return {\n ...base,\n target: { kind: 'host' },\n effect: { type: 'host-action', actionId: action.actionId, payload: action.payload },\n };\n }\n return null;\n}\n/** `data-source-<n>`:按实例创建顺序自增、与文档内既有 id 去重、不含时间戳与随机数。 */\nfunction allocateDataSourceId(context) {\n for (;;) {\n context.counter += 1;\n const candidate = `${CREATED_ID_PREFIX}${context.counter}`;\n if (!context.usedIds.has(candidate)) {\n context.usedIds.add(candidate);\n return candidate;\n }\n }\n}\nfunction migrateComponent(component, index, context) {\n if (component.dataValue !== undefined)\n return component;\n const previousSource = component.dataSource;\n if (previousSource === null) {\n return { ...component, dataValue: null };\n }\n const migrated = migrateComponentDataSource(component, previousSource, index, context);\n return migrated;\n}\nfunction migrateComponentDataSource(component, previousSource, index, context) {\n const path = ['components', index, 'dataSource'];\n const base = {\n id: component.id,\n type: component.type,\n name: component.name,\n parentId: component.parentId,\n position: component.position,\n size: component.size,\n rotation: component.rotation,\n zIndex: component.zIndex,\n status: component.status,\n props: component.props,\n style: component.style,\n // 旧字段保留为 null:当前契约仍要求该键存在,它不再是写入口。\n dataSource: null,\n ...(component.states === undefined ? {} : { states: component.states }),\n };\n switch (previousSource.type) {\n case 'static':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Static component value became an inline value reference.',\n });\n return {\n ...base,\n dataValue: { kind: 'inline', value: previousSource.value },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n case 'variable':\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: 'Variable component value became a variable value reference.',\n });\n if (previousSource.processorId !== undefined) {\n context.decisions.push({\n kind: 'component-value',\n path: [...path, 'processorId'],\n action: 'rejected',\n detail: 'A component value has no data source instance to own processorId; the field was dropped.',\n });\n }\n return {\n ...base,\n dataValue: { kind: 'variable', variableId: previousSource.variableId },\n ...(previousSource.binding === undefined ? {} : { dataBinding: previousSource.binding }),\n };\n default: {\n const dataSourceId = allocateDataSourceId(context);\n const instance = previousSource.type === 'dataset'\n ? {\n id: dataSourceId,\n name: previousSource.datasetId,\n source: { kind: 'dataset', datasetId: previousSource.datasetId },\n params: migrateComponentParams(previousSource.params, index, context),\n }\n : {\n id: dataSourceId,\n name: previousSource.resourceId,\n source: {\n kind: 'host-resource',\n resourceType: previousSource.resourceType,\n resourceId: previousSource.resourceId,\n },\n params: migrateComponentParams(previousSource.params, index, context),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'component-value',\n path,\n action: 'mapped',\n detail: previousSource.type === 'dataset'\n ? `Dataset component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`\n : `Host resource component source became a data source instance \"${dataSourceId}\" referenced through an empty field path.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n ...base,\n dataValue: { kind: 'data-source-field', dataSourceId, path: [] },\n dataBinding: previousSource.binding,\n };\n }\n }\n}\nfunction migrateComponentParams(params, componentIndex, context) {\n const migrated = {};\n for (const [name, parameter] of Object.entries(params)) {\n if (parameter.kind === 'literal') {\n migrated[name] = { kind: 'inline', value: parameter.value };\n context.decisions.push({\n kind: 'parameter',\n path: ['components', componentIndex, 'dataSource', 'params', name, 'kind'],\n action: 'renamed',\n detail: 'Literal parameter became an inline value reference.',\n });\n }\n else {\n migrated[name] = { kind: 'variable', variableId: parameter.variableId };\n }\n }\n return migrated;\n}\nfunction migrateVariable(entry, index, context) {\n if (!('type' in entry))\n return entry;\n const path = ['variables', index];\n const withDescription = entry.description === undefined ? {} : { description: entry.description };\n if (entry.type === 'static') {\n context.decisions.push({\n kind: 'variable',\n path: [...path, 'type'],\n action: 'mapped',\n detail: 'Static variable became a variable record with an inline value and controlled false.',\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'inline', value: entry.initialValue },\n controlled: false,\n };\n }\n const dataSourceId = allocateDataSourceId(context);\n const updatePolicy = entry.type === 'data-source' && entry.autoUpdate !== undefined\n ? { mode: 'auto', intervalSeconds: entry.autoUpdate.intervalSeconds }\n : { mode: 'manual' };\n const instance = {\n id: dataSourceId,\n name: entry.name,\n source: entry.type === 'url-query'\n ? { kind: 'url-query', sourceId: entry.sourceId }\n : { kind: 'host-catalog', sourceId: entry.sourceId },\n params: {},\n updatePolicy,\n ...(entry.processorId === undefined ? {} : { processorId: entry.processorId }),\n };\n context.dataSources.push(instance);\n context.decisions.push({\n kind: 'variable',\n path,\n action: 'mapped',\n detail: entry.type === 'url-query'\n ? `Url query variable became data source instance \"${dataSourceId}\"; processorId moved to the instance.`\n : `Data source variable became data source instance \"${dataSourceId}\"; autoUpdate mapped to updatePolicy and processorId moved to the instance.`,\n createdDataSourceId: dataSourceId,\n });\n return {\n id: entry.id,\n name: entry.name,\n ...withDescription,\n initialValue: entry.initialValue,\n value: { kind: 'data-source-field', dataSourceId, path: [] },\n controlled: entry.controlled,\n };\n}\n//# sourceMappingURL=migrate-document.js.map"],"mappings":";;;AACA,SAAgB,EAAyB,GAAO;CAC5C,IAAM,IAAY;EAAE;EAAO,WAAW,CAAC;CAAE;CACzC,IAAI,CAAC,EAAS,CAAK,KAAK,CAAC,EAAS,EAAM,SAAS,GAC7C,OAAO;CACX,IAAM,IAAY,EAAM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GAAU,OAAO,EAAM;EAAa;EACnD,YAAY;CAChB;CAEJ,IAAM,IAAe,EAAqB,CAAO,GAC3C,IAAe,EAAM,SAAS,iBAAiB,EAAM,eAAe,KAAA,IACpE;EAAE,MAAM;EAAQ,iBAAiB,EAAM,WAAW;CAAgB,IAClE,EAAE,MAAM,SAAS,GACjB,IAAW;EACb,IAAI;EACJ,MAAM,EAAM;EACZ,QAAQ,EAAM,SAAS,cACjB;GAAE,MAAM;GAAa,UAAU,EAAM;EAAS,IAC9C;GAAE,MAAM;GAAgB,UAAU,EAAM;EAAS;EACvD,QAAQ,CAAC;EACT;EACA,GAAI,EAAM,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,EAAM,YAAY;CAChF;CAWA,OAVA,EAAQ,YAAY,KAAK,CAAQ,GACjC,EAAQ,UAAU,KAAK;EACnB,MAAM;EACN;EACA,QAAQ;EACR,QAAQ,EAAM,SAAS,cACjB,mDAAmD,EAAa,yCAChE,qDAAqD,EAAa;EACxE,qBAAqB;CACzB,CAAC,GACM;EACH,IAAI,EAAM;EACV,MAAM,EAAM;EACZ,GAAG;EACH,cAAc,EAAM;EACpB,OAAO;GAAE,MAAM;GAAqB;GAAc,MAAM,CAAC;EAAE;EAC3D,YAAY,EAAM;CACtB;AACJ"}
@@ -235,7 +235,7 @@ function T(e) {
235
235
  return typeof e == "string" || typeof e == "number" || typeof e == "boolean";
236
236
  }
237
237
  function E(e, t, n) {
238
- (typeof e.sourceId != "string" || e.sourceId.length === 0 || e.sourceId.length > h || m.test(e.sourceId)) && n.push(A([...t, "sourceId"], "Host catalog source id is invalid.")), r(e.name) || n.push(A([...t, "name"], "Host catalog name is invalid.")), e.description !== null && (typeof e.description != "string" || [...e.description].length > g || m.test(e.description)) && n.push(A([...t, "description"], "Host catalog description is invalid."));
238
+ (typeof e.sourceId != "string" || e.sourceId.length === 0 || e.sourceId.length > h || m.test(e.sourceId)) && n.push(A([...t, "sourceId"], "Host catalog source id is invalid.")), (typeof e.name != "string" || e.name.length === 0 || [...e.name].length > 256 || m.test(e.name)) && n.push(A([...t, "name"], "Host catalog name is invalid.")), e.description !== null && (typeof e.description != "string" || [...e.description].length > g || m.test(e.description)) && n.push(A([...t, "description"], "Host catalog description is invalid."));
239
239
  }
240
240
  function D(e, t, n, r) {
241
241
  for (let i of Object.keys(e)) t.has(i) || r.push(A([...n, i], "Unknown host catalog field."));
@@ -269,4 +269,4 @@ function M(e) {
269
269
  //#endregion
270
270
  export { u as a, S as i, f as n, c as o, x as r, l as s, p as t };
271
271
 
272
- //# sourceMappingURL=parse-aZat9tAS.js.map
272
+ //# sourceMappingURL=parse-1U_-Qtn4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-1U_-Qtn4.js","names":[],"sources":["../../contracts/dist/document/serialize.js","../../contracts/dist/types/host.js","../../contracts/dist/variable/parse.js"],"sourcesContent":["import { DiagnosticCollector } from '../diagnostics/collector.js';\nimport { serializeCanonicalJson } from '../json/canonical.js';\nimport { validateDocument } from './validate.js';\nexport class ScreenSerializationError extends Error {\n name = 'ScreenSerializationError';\n diagnostics;\n constructor(diagnostics) {\n super('Screen document failed canonical validation.');\n this.diagnostics = diagnostics;\n }\n}\nexport function serializeScreenDocument(document) {\n const collector = new DiagnosticCollector();\n const validated = validateDocument(document, collector);\n if (validated === undefined) {\n throw new ScreenSerializationError(collector.done());\n }\n return serializeCanonicalJson(validated);\n}\n//# sourceMappingURL=serialize.js.map","export function validateScreenDesignerHostAdapter(input) {\n if (input === null || typeof input !== 'object' || Array.isArray(input)) {\n return invalidDesignerHostAdapter('Designer host adapter must be an object.');\n }\n const adapter = input;\n const capabilities = adapter.capabilities;\n if (capabilities === null || typeof capabilities !== 'object' || Array.isArray(capabilities)) {\n return invalidDesignerHostAdapter('Designer host capabilities must be an object.');\n }\n const capabilityRecord = capabilities;\n const checks = [\n ['projectCatalog', 'projectCatalog', ['list', 'create', 'clone', 'delete', 'import', 'export']],\n ['projectPreview', 'projectPreview', ['load']],\n ['projectSnapshots', 'projectSnapshots', ['list', 'create', 'restore', 'delete']],\n ['resources', 'resources', ['resolve']],\n ['datasets', 'datasets', ['list', 'describe', 'query']],\n ['hostCatalog', 'hostCatalog', ['list', 'describe', 'resolve']],\n ['actions', 'actions', ['execute']],\n ];\n for (const [capability, port, methods] of checks) {\n if (typeof capabilityRecord[capability] !== 'boolean') {\n return invalidDesignerHostAdapter(`Designer host capability \"${capability}\" must be boolean.`);\n }\n const portValue = adapter[port];\n const hasValidPort = portValue !== null &&\n typeof portValue === 'object' &&\n methods.every((method) => typeof portValue[method] === 'function');\n // 可选的 `subscribe`:出现时必须是函数,缺省表示该端口只支持拉取。\n const hasValidSubscribe = (port !== 'resources' && port !== 'hostCatalog') ||\n portValue === null ||\n typeof portValue !== 'object' ||\n portValue.subscribe === undefined ||\n typeof portValue.subscribe === 'function';\n if ((capabilityRecord[capability] === true && !(hasValidPort && hasValidSubscribe)) ||\n (capabilityRecord[capability] === false && portValue !== undefined)) {\n return invalidDesignerHostAdapter(`Designer host capability \"${capability}\" does not match its port.`);\n }\n }\n return { ok: true, value: adapter, diagnostics: [] };\n}\nfunction invalidDesignerHostAdapter(message) {\n return {\n ok: false,\n diagnostics: [{ severity: 'error', code: 'PROJECT_ADAPTER_INVALID', path: [], message }],\n };\n}\n//# sourceMappingURL=host.js.map","import { MAX_NAME_CODE_POINTS } from '../document/limits.js';\nimport { isScreenVariableName } from '../document/schema.js';\nimport { parseScreenJsonValue } from '../json/parse.js';\nimport { listScreenSourceDeliveryIssues, normalizeScreenSourceDelivery } from '../push/delivery.js';\nimport { listScreenLevelScaleIssues } from '../push/level-scale.js';\nexport const MAX_HOST_CATALOG_PAGE_ITEMS = 50;\nexport const MAX_HOST_CATALOG_BYTES = 256 * 1024;\nconst CONTROL_CHARACTER_PATTERN = /[\\u0000-\\u001f\\u007f-\\u009f]/u;\nconst MAX_VARIABLE_ID_CODE_UNITS = 256;\nconst MAX_DESCRIPTION_CODE_POINTS = 4_096;\nconst MAX_CURSOR_CODE_UNITS = 4_096;\nconst MAX_PARAMETER_DEFINITIONS = 64;\nconst MAX_ALLOWED_VALUES = 256;\nconst VALUE_TYPES = new Set(['string', 'number', 'boolean', 'date']);\nexport function parseScreenHostCatalogDescriptor(input) {\n const parsed = parseCatalogJson(input);\n if (!parsed.ok)\n return parsed;\n const diagnostics = [];\n if (!isRecord(parsed.value)) {\n return invalidCatalog([], 'Host catalog descriptor must be an object.');\n }\n checkExact(parsed.value, new Set([\n 'sourceId',\n 'name',\n 'description',\n 'parameters',\n 'readOnly',\n 'previewable',\n 'delivery',\n 'levelScales',\n ]), [], diagnostics);\n validateSummaryFields(parsed.value, [], diagnostics);\n if (typeof parsed.value.previewable !== 'boolean') {\n diagnostics.push(diagnostic(['previewable'], 'Host catalog previewable flag must be boolean.'));\n }\n if (parsed.value.readOnly !== undefined && typeof parsed.value.readOnly !== 'boolean') {\n diagnostics.push(diagnostic(['readOnly'], 'Host catalog readOnly flag must be boolean.'));\n }\n const delivery = parsed.value.delivery;\n if (delivery !== undefined) {\n for (const issue of listScreenSourceDeliveryIssues(delivery)) {\n diagnostics.push(diagnostic(['delivery', ...issue.path], issue.message));\n }\n }\n const levelScales = parsed.value.levelScales;\n if (levelScales !== undefined) {\n for (const issue of listScreenLevelScaleIssues(levelScales)) {\n diagnostics.push(diagnostic(['levelScales', ...issue.path], issue.message));\n }\n }\n const parameters = parseParameters(parsed.value.parameters, diagnostics);\n if (diagnostics.length > 0)\n return invalidWith(diagnostics);\n const readOnly = parsed.value.readOnly;\n return {\n ok: true,\n value: {\n sourceId: parsed.value.sourceId,\n name: parsed.value.name,\n description: parsed.value.description,\n parameters,\n ...(readOnly === true ? { readOnly: true } : {}),\n previewable: parsed.value.previewable,\n ...(delivery !== undefined\n ? { delivery: normalizeScreenSourceDelivery(delivery) }\n : {}),\n ...(levelScales !== undefined\n ? { levelScales: levelScales }\n : {}),\n },\n diagnostics: [],\n };\n}\nexport function parseScreenHostCatalogPage(input) {\n const parsed = parseCatalogJson(input);\n if (!parsed.ok)\n return parsed;\n const diagnostics = [];\n if (!isRecord(parsed.value)) {\n return invalidCatalog([], 'Host catalog page must be an object.');\n }\n checkExact(parsed.value, new Set(['items', 'nextCursor']), [], diagnostics);\n if (!Array.isArray(parsed.value.items) ||\n parsed.value.items.length > MAX_HOST_CATALOG_PAGE_ITEMS) {\n diagnostics.push(diagnostic(['items'], 'Host catalog page items are invalid.'));\n }\n const items = [];\n const ids = new Set();\n if (Array.isArray(parsed.value.items)) {\n parsed.value.items.forEach((item, index) => {\n const path = ['items', index];\n if (!isRecord(item)) {\n diagnostics.push(diagnostic(path, 'Host catalog summary must be an object.'));\n return;\n }\n checkExact(item, new Set(['sourceId', 'name', 'description']), path, diagnostics);\n const before = diagnostics.length;\n validateSummaryFields(item, path, diagnostics);\n if (typeof item.sourceId === 'string') {\n if (ids.has(item.sourceId)) {\n diagnostics.push(diagnostic([...path, 'sourceId'], 'Host catalog page contains a duplicate id.'));\n }\n ids.add(item.sourceId);\n }\n if (diagnostics.length === before) {\n items.push({\n sourceId: item.sourceId,\n name: item.name,\n description: item.description,\n });\n }\n });\n }\n if (parsed.value.nextCursor !== undefined && !isCursor(parsed.value.nextCursor)) {\n diagnostics.push(diagnostic(['nextCursor'], 'Host catalog page cursor is invalid.'));\n }\n if (diagnostics.length > 0)\n return invalidWith(diagnostics);\n return {\n ok: true,\n value: {\n items,\n ...(parsed.value.nextCursor === undefined\n ? {}\n : { nextCursor: parsed.value.nextCursor }),\n },\n diagnostics: [],\n };\n}\nfunction parseCatalogJson(input) {\n const parsed = parseScreenJsonValue(input, { maxBytes: MAX_HOST_CATALOG_BYTES });\n if (parsed.ok)\n return parsed;\n return {\n ok: false,\n diagnostics: parsed.diagnostics.map((item) => ({\n ...item,\n code: 'HOST_VARIABLE_DESCRIPTOR_INVALID',\n })),\n };\n}\n/** 目录项参数:与数据集参数定义同形(`ScreenDatasetParameterDefinition`)。 */\nfunction parseParameters(input, diagnostics) {\n if (!Array.isArray(input) || input.length > MAX_PARAMETER_DEFINITIONS) {\n diagnostics.push(diagnostic(['parameters'], 'Host catalog parameters are invalid.'));\n return [];\n }\n const parameters = [];\n input.forEach((entry, index) => {\n const path = ['parameters', index];\n if (!isRecord(entry)) {\n diagnostics.push(diagnostic(path, 'Host catalog parameter must be an object.'));\n return;\n }\n checkExact(entry, new Set([\n 'name',\n 'label',\n 'valueType',\n 'required',\n 'defaultValue',\n 'minimum',\n 'maximum',\n 'maxLength',\n 'allowedValues',\n ]), path, diagnostics);\n const before = diagnostics.length;\n if (!isScreenVariableName(entry.name)) {\n diagnostics.push(diagnostic([...path, 'name'], 'Host catalog parameter name is invalid.'));\n }\n if (typeof entry.label !== 'string' ||\n entry.label.length === 0 ||\n [...entry.label].length > MAX_DESCRIPTION_CODE_POINTS) {\n diagnostics.push(diagnostic([...path, 'label'], 'Host catalog parameter label is invalid.'));\n }\n if (typeof entry.valueType !== 'string' || !VALUE_TYPES.has(entry.valueType)) {\n diagnostics.push(diagnostic([...path, 'valueType'], 'Host catalog parameter valueType is invalid.'));\n }\n if (typeof entry.required !== 'boolean') {\n diagnostics.push(diagnostic([...path, 'required'], 'Host catalog parameter required flag is invalid.'));\n }\n if (entry.defaultValue !== undefined && !isParameterValue(entry.defaultValue)) {\n diagnostics.push(diagnostic([...path, 'defaultValue'], 'Host catalog parameter default is invalid.'));\n }\n for (const key of ['minimum', 'maximum']) {\n if (entry[key] !== undefined && typeof entry[key] !== 'number') {\n diagnostics.push(diagnostic([...path, key], 'Host catalog parameter bound is invalid.'));\n }\n }\n if (entry.maxLength !== undefined) {\n const maxLength = entry.maxLength;\n if (typeof maxLength !== 'number' || !Number.isInteger(maxLength) || maxLength < 0) {\n diagnostics.push(diagnostic([...path, 'maxLength'], 'Host catalog parameter maxLength is invalid.'));\n }\n }\n if (entry.allowedValues !== undefined) {\n const allowedValues = entry.allowedValues;\n if (!Array.isArray(allowedValues) ||\n allowedValues.length > MAX_ALLOWED_VALUES ||\n !allowedValues.every((value) => isParameterValue(value))) {\n diagnostics.push(diagnostic([...path, 'allowedValues'], 'Host catalog parameter allowedValues is invalid.'));\n }\n }\n if (diagnostics.length !== before)\n return;\n parameters.push({\n name: entry.name,\n label: entry.label,\n valueType: entry.valueType,\n required: entry.required,\n ...(entry.defaultValue === undefined\n ? {}\n : { defaultValue: entry.defaultValue }),\n ...(entry.minimum === undefined ? {} : { minimum: entry.minimum }),\n ...(entry.maximum === undefined ? {} : { maximum: entry.maximum }),\n ...(entry.maxLength === undefined ? {} : { maxLength: entry.maxLength }),\n ...(entry.allowedValues === undefined\n ? {}\n : { allowedValues: entry.allowedValues }),\n });\n });\n return parameters;\n}\nfunction isParameterValue(value) {\n return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean';\n}\nfunction validateSummaryFields(value, path, diagnostics) {\n if (typeof value.sourceId !== 'string' ||\n value.sourceId.length === 0 ||\n value.sourceId.length > MAX_VARIABLE_ID_CODE_UNITS ||\n CONTROL_CHARACTER_PATTERN.test(value.sourceId)) {\n diagnostics.push(diagnostic([...path, 'sourceId'], 'Host catalog source id is invalid.'));\n }\n if (typeof value.name !== 'string' ||\n value.name.length === 0 ||\n [...value.name].length > MAX_NAME_CODE_POINTS ||\n CONTROL_CHARACTER_PATTERN.test(value.name)) {\n diagnostics.push(diagnostic([...path, 'name'], 'Host catalog name is invalid.'));\n }\n if (value.description !== null &&\n (typeof value.description !== 'string' ||\n [...value.description].length > MAX_DESCRIPTION_CODE_POINTS ||\n CONTROL_CHARACTER_PATTERN.test(value.description))) {\n diagnostics.push(diagnostic([...path, 'description'], 'Host catalog description is invalid.'));\n }\n}\nfunction checkExact(value, allowed, path, diagnostics) {\n for (const key of Object.keys(value)) {\n if (!allowed.has(key)) {\n diagnostics.push(diagnostic([...path, key], 'Unknown host catalog field.'));\n }\n }\n}\nfunction isCursor(value) {\n return (typeof value === 'string' &&\n value.length > 0 &&\n value.length <= MAX_CURSOR_CODE_UNITS &&\n !CONTROL_CHARACTER_PATTERN.test(value));\n}\nfunction isRecord(value) {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\nfunction diagnostic(path, message) {\n return {\n severity: 'error',\n code: 'HOST_VARIABLE_DESCRIPTOR_INVALID',\n path,\n message,\n };\n}\nfunction invalidCatalog(path, message) {\n return { ok: false, diagnostics: [diagnostic(path, message)] };\n}\nfunction invalidWith(diagnostics) {\n return {\n ok: false,\n diagnostics: [...diagnostics].sort((left, right) => left.path.join('/') < right.path.join('/') ? -1 : 1),\n };\n}\n//# sourceMappingURL=parse.js.map"],"mappings":";;;;AAGA,IAAa,IAAb,cAA8C,MAAM;CAChD,OAAO;CACP;CACA,YAAY,GAAa;EAErB,AADA,MAAM,8CAA8C,GACpD,KAAK,cAAc;CACvB;AACJ;AACA,SAAgB,EAAwB,GAAU;CAC9C,IAAM,IAAY,IAAI,EAAoB,GACpC,IAAY,EAAiB,GAAU,CAAS;CACtD,IAAI,MAAc,KAAA,GACd,MAAM,IAAI,EAAyB,EAAU,KAAK,CAAC;CAEvD,OAAO,EAAuB,CAAS;AAC3C;;;AClBA,SAAgB,EAAkC,GAAO;CACrD,IAAsB,OAAO,KAAU,aAAnC,KAA+C,MAAM,QAAQ,CAAK,GAClE,OAAO,EAA2B,0CAA0C;CAEhF,IAAM,IAAU,GACV,IAAe,EAAQ;CAC7B,IAA6B,OAAO,KAAiB,aAAjD,KAA6D,MAAM,QAAQ,CAAY,GACvF,OAAO,EAA2B,+CAA+C;CAErF,IAAM,IAAmB;CAUzB,KAAK,IAAM,CAAC,GAAY,GAAM,MAAY;EARtC;GAAC;GAAkB;GAAkB;IAAC;IAAQ;IAAU;IAAS;IAAU;IAAU;GAAQ;EAAC;EAC9F;GAAC;GAAkB;GAAkB,CAAC,MAAM;EAAC;EAC7C;GAAC;GAAoB;GAAoB;IAAC;IAAQ;IAAU;IAAW;GAAQ;EAAC;EAChF;GAAC;GAAa;GAAa,CAAC,SAAS;EAAC;EACtC;GAAC;GAAY;GAAY;IAA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