@salesforce/metadata-core-sdk 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +25 -0
  2. package/dist/index.d.ts +5 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +27 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/sdk/abstractions/core/IPlatformContext.d.ts +1 -1
  7. package/dist/sdk/abstractions/core/IPlatformContext.js +1 -1
  8. package/dist/sdk/abstractions/core/index.d.ts +1 -1
  9. package/dist/sdk/abstractions/core/index.js +1 -1
  10. package/dist/sdk/abstractions/index.d.ts +1 -1
  11. package/dist/sdk/abstractions/index.js +1 -1
  12. package/dist/sdk/abstractions/services/IFileSystem.d.ts +1 -1
  13. package/dist/sdk/abstractions/services/IFileSystem.js +1 -1
  14. package/dist/sdk/abstractions/services/ILogger.d.ts +1 -1
  15. package/dist/sdk/abstractions/services/ILogger.js +1 -1
  16. package/dist/sdk/abstractions/services/ITelemetry.d.ts +1 -1
  17. package/dist/sdk/abstractions/services/ITelemetry.js +1 -1
  18. package/dist/sdk/abstractions/services/index.d.ts +1 -1
  19. package/dist/sdk/abstractions/services/index.js +1 -1
  20. package/dist/sdk/abstractions/types/FileMetadata.d.ts +1 -1
  21. package/dist/sdk/abstractions/types/FileMetadata.js +1 -1
  22. package/dist/sdk/abstractions/types/Result.d.ts +1 -1
  23. package/dist/sdk/abstractions/types/Result.js +1 -1
  24. package/dist/sdk/abstractions/types/index.d.ts +1 -1
  25. package/dist/sdk/abstractions/types/index.js +1 -1
  26. package/dist/sdk/components/LegendPanel/index.d.ts +1 -1
  27. package/dist/sdk/components/LegendPanel/index.js +1 -1
  28. package/dist/sdk/components/ZoomBar/ZoomBar.d.ts.map +1 -1
  29. package/dist/sdk/components/ZoomBar/ZoomBar.js +2 -1
  30. package/dist/sdk/components/ZoomBar/ZoomBar.js.map +1 -1
  31. package/dist/sdk/components/ZoomBar/index.d.ts +1 -1
  32. package/dist/sdk/components/ZoomBar/index.js +1 -1
  33. package/dist/sdk/components/index.d.ts +1 -1
  34. package/dist/sdk/components/index.js +1 -1
  35. package/dist/sdk/constants.d.ts +1 -1
  36. package/dist/sdk/constants.js +1 -1
  37. package/dist/sdk/contracts/core/IMetadataParser.d.ts +23 -1
  38. package/dist/sdk/contracts/core/IMetadataParser.d.ts.map +1 -1
  39. package/dist/sdk/contracts/core/IMetadataParser.js +1 -1
  40. package/dist/sdk/contracts/core/IVisualizationPlugin.d.ts +1 -1
  41. package/dist/sdk/contracts/core/IVisualizationPlugin.js +1 -1
  42. package/dist/sdk/contracts/core/index.d.ts +1 -1
  43. package/dist/sdk/contracts/core/index.js +1 -1
  44. package/dist/sdk/contracts/index.d.ts +1 -1
  45. package/dist/sdk/contracts/index.js +1 -1
  46. package/dist/sdk/contracts/types/MetadataFileInfo.d.ts +1 -1
  47. package/dist/sdk/contracts/types/MetadataFileInfo.js +1 -1
  48. package/dist/sdk/contracts/types/MetadataPluginInfo.d.ts +1 -1
  49. package/dist/sdk/contracts/types/MetadataPluginInfo.js +1 -1
  50. package/dist/sdk/contracts/types/PluginConfig.d.ts +1 -1
  51. package/dist/sdk/contracts/types/PluginConfig.js +1 -1
  52. package/dist/sdk/contracts/types/PluginContext.d.ts +1 -1
  53. package/dist/sdk/contracts/types/PluginContext.js +1 -1
  54. package/dist/sdk/contracts/types/PluginError.d.ts +1 -1
  55. package/dist/sdk/contracts/types/PluginError.js +1 -1
  56. package/dist/sdk/contracts/types/SelectableNode.d.ts +62 -0
  57. package/dist/sdk/contracts/types/SelectableNode.d.ts.map +1 -0
  58. package/dist/sdk/contracts/types/SelectableNode.js +8 -0
  59. package/dist/sdk/contracts/types/SelectableNode.js.map +1 -0
  60. package/dist/sdk/contracts/types/ValidationResult.d.ts +1 -1
  61. package/dist/sdk/contracts/types/ValidationResult.js +1 -1
  62. package/dist/sdk/contracts/types/VersionInfo.d.ts +1 -1
  63. package/dist/sdk/contracts/types/VersionInfo.js +1 -1
  64. package/dist/sdk/contracts/types/index.d.ts +2 -1
  65. package/dist/sdk/contracts/types/index.d.ts.map +1 -1
  66. package/dist/sdk/contracts/types/index.js +2 -1
  67. package/dist/sdk/contracts/types/index.js.map +1 -1
  68. package/dist/sdk/design-system/index.d.ts +3 -1
  69. package/dist/sdk/design-system/index.d.ts.map +1 -1
  70. package/dist/sdk/design-system/index.js +3 -1
  71. package/dist/sdk/design-system/index.js.map +1 -1
  72. package/dist/sdk/design-system/light-design-system.css +724 -0
  73. package/dist/sdk/design-system/themes.d.ts +32 -0
  74. package/dist/sdk/design-system/themes.d.ts.map +1 -0
  75. package/dist/sdk/design-system/themes.js +32 -0
  76. package/dist/sdk/design-system/themes.js.map +1 -0
  77. package/dist/sdk/design-system/tokens/colors.d.ts +1 -1
  78. package/dist/sdk/design-system/tokens/colors.js +1 -1
  79. package/dist/sdk/design-system/tokens/spacing.d.ts +1 -1
  80. package/dist/sdk/design-system/tokens/spacing.js +1 -1
  81. package/dist/sdk/design-system/tokens/typography.d.ts +1 -1
  82. package/dist/sdk/design-system/tokens/typography.js +1 -1
  83. package/dist/sdk/design-system/utils.d.ts +1 -1
  84. package/dist/sdk/design-system/utils.js +1 -1
  85. package/dist/sdk/hooks/vibe-edit/index.d.ts +39 -0
  86. package/dist/sdk/hooks/vibe-edit/index.d.ts.map +1 -0
  87. package/dist/sdk/hooks/vibe-edit/index.js +42 -0
  88. package/dist/sdk/hooks/vibe-edit/index.js.map +1 -0
  89. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.d.ts +56 -0
  90. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.d.ts.map +1 -0
  91. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.js +138 -0
  92. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.js.map +1 -0
  93. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.d.ts +66 -0
  94. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.d.ts.map +1 -0
  95. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.js +73 -0
  96. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.js.map +1 -0
  97. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.d.ts +64 -0
  98. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.d.ts.map +1 -0
  99. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.js +161 -0
  100. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.js.map +1 -0
  101. package/dist/sdk/hooks/vibe-edit/selection/types.d.ts +47 -0
  102. package/dist/sdk/hooks/vibe-edit/selection/types.d.ts.map +1 -0
  103. package/dist/sdk/hooks/vibe-edit/selection/types.js +40 -0
  104. package/dist/sdk/hooks/vibe-edit/selection/types.js.map +1 -0
  105. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.d.ts +30 -0
  106. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.d.ts.map +1 -0
  107. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.js +50 -0
  108. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.js.map +1 -0
  109. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.css +26 -0
  110. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.d.ts +84 -0
  111. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.d.ts.map +1 -0
  112. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.js +256 -0
  113. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.js.map +1 -0
  114. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.css +207 -0
  115. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.d.ts +43 -0
  116. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.d.ts.map +1 -0
  117. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.js +80 -0
  118. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.js.map +1 -0
  119. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.css +79 -0
  120. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.d.ts +116 -0
  121. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.d.ts.map +1 -0
  122. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.js +264 -0
  123. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.js.map +1 -0
  124. package/dist/sdk/utils/HostCommunicationUtils.d.ts +1 -1
  125. package/dist/sdk/utils/HostCommunicationUtils.js +1 -1
  126. package/dist/sdk/utils/errors/ErrorBuilder.d.ts +1 -1
  127. package/dist/sdk/utils/errors/ErrorBuilder.js +1 -1
  128. package/dist/sdk/utils/errors/setupHandlers.d.ts +1 -1
  129. package/dist/sdk/utils/errors/setupHandlers.js +1 -1
  130. package/dist/sdk/utils/logger.d.ts +1 -1
  131. package/dist/sdk/utils/logger.js +1 -1
  132. package/dist/sdk/utils/test-helpers/architecture-test-utils.d.ts +1 -1
  133. package/dist/sdk/utils/test-helpers/architecture-test-utils.js +1 -1
  134. package/dist/sdk/utils/test-helpers/index.d.ts +1 -1
  135. package/dist/sdk/utils/test-helpers/index.js +1 -1
  136. package/dist/sdk/utils/xmlParser.d.ts +1 -1
  137. package/dist/sdk/utils/xmlParser.js +1 -1
  138. package/dist/sdk/webviewMessageTypes.d.ts +78 -1
  139. package/dist/sdk/webviewMessageTypes.d.ts.map +1 -1
  140. package/dist/sdk/webviewMessageTypes.js +8 -5
  141. package/dist/sdk/webviewMessageTypes.js.map +1 -1
  142. package/package.json +11 -3
  143. package/src/sdk/utils/test-helpers/architecture-test-utils.ts +1 -1
  144. package/src/sdk/utils/test-helpers/index.ts +1 -1
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * SelectionGraph engine (C1) — the GENERIC tagger + inverter that replaces the
9
+ * per-plugin `buildContext`/descriptor resolvers.
10
+ *
11
+ * Given the plugin's `SelectableNode[]` (emitted by its parser) and the plugin
12
+ * rendering each selectable element with `data-mv-id={node.id}`, this module:
13
+ * 1. TAGS: finds every `[data-mv-id]` element whose id is a known node and
14
+ * stamps the `data-mv-selectable` + `data-mv-type` hit-test contract onto it
15
+ * (kept live across re-renders via a childList/subtree MutationObserver).
16
+ * 2. INVERTS: turns a marquee/click SelectedItem into a SpatialContext by a
17
+ * single `Map.get(id)` over the node list — no plugin callback, no shape
18
+ * traversal. Because DOM id === graph id (the plugin rendered node.id), the
19
+ * inversion is a pure lookup; this is what dissolves FlexiPage's B3 wall.
20
+ *
21
+ * The engine never inspects the plugin's opaque parsed data — only the flat,
22
+ * uniform node array. All per-plugin knowledge was paid once, in the parser's
23
+ * getSelectableNodes() projection.
24
+ */
25
+ import { type SelectedItem } from './types.js';
26
+ import type { SpatialContext } from '../../../webviewMessageTypes.js';
27
+ import type { SelectableNode } from './selectionGraph.js';
28
+ /** Build the `id -> node` lookup the inverter uses. First-wins on duplicate ids. */
29
+ export declare function indexNodes(nodes: ReadonlyArray<SelectableNode>): Map<string, SelectableNode>;
30
+ /**
31
+ * Keep the hit-test contract live across the plugin's DOM churn via a
32
+ * MutationObserver on childList+subtree ONLY (never attributes — that would
33
+ * observe our own setAttribute and loop).
34
+ *
35
+ * @param nodes the SelectableNode[] for the current data
36
+ * @param tagged caller-owned map of {id -> tagged element}, kept in sync
37
+ * @returns cleanup that disconnects the observer and removes the added tags
38
+ */
39
+ export declare function tagSelectionGraphLive(nodes: ReadonlyArray<SelectableNode>, tagged: Map<string, HTMLElement>): () => void;
40
+ /**
41
+ * Project a SelectableNode to the canonical SpatialContext the host/agent
42
+ * consumes. Pure, generic — no plugin knowledge. `parent` is resolved to the
43
+ * parent node's apiName (human-readable) when the parent is known.
44
+ *
45
+ * `fileName` is the file-level name (from the plugin data context) used as the
46
+ * fallback so `SpatialContext.fileName` — documented as always-available — is
47
+ * populated even for nodes that carry no `filePath` (e.g. flexipage
48
+ * region/component nodes, where `sfdxPath` returns undefined). When a node DOES
49
+ * carry a `filePath`, its basename takes precedence so a decomposed field points
50
+ * at its own `.field-meta.xml` rather than the parent object file.
51
+ */
52
+ export declare function nodeToSpatialContext(node: SelectableNode, byId: Map<string, SelectableNode>, fileName?: string): SpatialContext;
53
+ /**
54
+ * The generic inverter: SelectedItem[] (from the marquee/click) -> SpatialContext[]
55
+ * by pure `Map.get(id)` over the node list. Selection carries the node id in
56
+ * `item.id` (the DOM's data-mv-id === node.id), so no plugin resolver runs.
57
+ * Unknown ids are skipped.
58
+ *
59
+ * `fileName` is the file-level fallback (the current file's basename, from the
60
+ * plugin data context) stamped onto every context that has no more-specific
61
+ * per-node file path — see {@link nodeToSpatialContext}.
62
+ */
63
+ export declare function buildContextsFromNodes(items: ReadonlyArray<SelectedItem>, nodes: ReadonlyArray<SelectableNode>, fileName?: string): SpatialContext[];
64
+ //# sourceMappingURL=selectionGraphEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionGraphEngine.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/selectionGraphEngine.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAuC,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,oFAAoF;AACpF,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAQ5F;AAgDD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,EACpC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GAC/B,MAAM,IAAI,CAiBZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACjC,QAAQ,CAAC,EAAE,MAAM,GAChB,cAAc,CA0BhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,EAClC,KAAK,EAAE,aAAa,CAAC,cAAc,CAAC,EACpC,QAAQ,CAAC,EAAE,MAAM,GAChB,cAAc,EAAE,CAUlB"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * SelectionGraph engine (C1) — the GENERIC tagger + inverter that replaces the
9
+ * per-plugin `buildContext`/descriptor resolvers.
10
+ *
11
+ * Given the plugin's `SelectableNode[]` (emitted by its parser) and the plugin
12
+ * rendering each selectable element with `data-mv-id={node.id}`, this module:
13
+ * 1. TAGS: finds every `[data-mv-id]` element whose id is a known node and
14
+ * stamps the `data-mv-selectable` + `data-mv-type` hit-test contract onto it
15
+ * (kept live across re-renders via a childList/subtree MutationObserver).
16
+ * 2. INVERTS: turns a marquee/click SelectedItem into a SpatialContext by a
17
+ * single `Map.get(id)` over the node list — no plugin callback, no shape
18
+ * traversal. Because DOM id === graph id (the plugin rendered node.id), the
19
+ * inversion is a pure lookup; this is what dissolves FlexiPage's B3 wall.
20
+ *
21
+ * The engine never inspects the plugin's opaque parsed data — only the flat,
22
+ * uniform node array. All per-plugin knowledge was paid once, in the parser's
23
+ * getSelectableNodes() projection.
24
+ */
25
+ import { SELECTABLE_ATTR, TYPE_ATTR, ID_ATTR } from './types.js';
26
+ /** Build the `id -> node` lookup the inverter uses. First-wins on duplicate ids. */
27
+ export function indexNodes(nodes) {
28
+ const byId = new Map();
29
+ for (const n of nodes) {
30
+ if (n.id && !byId.has(n.id)) {
31
+ byId.set(n.id, n);
32
+ }
33
+ }
34
+ return byId;
35
+ }
36
+ /**
37
+ * Stamp the hit-test contract (`data-mv-selectable`, `data-mv-type`) onto every
38
+ * live `[data-mv-id]` element whose id is a known node. `data-mv-id` is already
39
+ * present (the plugin rendered it) — we only add the two attributes the marquee
40
+ * hit-test needs, and record which elements we tagged so teardown can undo it.
41
+ */
42
+ function tagKnownElements(byId, tagged) {
43
+ if (typeof document === 'undefined') {
44
+ return;
45
+ }
46
+ const next = new Map();
47
+ const els = document.querySelectorAll(`[${ID_ATTR}]`);
48
+ for (let i = 0; i < els.length; i++) {
49
+ const el = els.item(i);
50
+ const id = el.getAttribute(ID_ATTR) ?? '';
51
+ const node = byId.get(id);
52
+ if (!node) {
53
+ continue; // an id we don't have a node for — leave it alone
54
+ }
55
+ el.setAttribute(SELECTABLE_ATTR, '');
56
+ el.setAttribute(TYPE_ATTR, node.type);
57
+ next.set(id, el);
58
+ }
59
+ // Untag elements that are no longer present/known so stale ids can't hit-test.
60
+ for (const [id, el] of tagged) {
61
+ if (next.get(id) !== el) {
62
+ el.removeAttribute(SELECTABLE_ATTR);
63
+ el.removeAttribute(TYPE_ATTR);
64
+ }
65
+ }
66
+ tagged.clear();
67
+ next.forEach((el, id) => tagged.set(id, el));
68
+ }
69
+ /** Remove the tags this engine applied (leaves the plugin's own data-mv-id intact). */
70
+ function clearTags(tagged) {
71
+ for (const el of tagged.values()) {
72
+ el.removeAttribute(SELECTABLE_ATTR);
73
+ el.removeAttribute(TYPE_ATTR);
74
+ }
75
+ tagged.clear();
76
+ }
77
+ /**
78
+ * Keep the hit-test contract live across the plugin's DOM churn via a
79
+ * MutationObserver on childList+subtree ONLY (never attributes — that would
80
+ * observe our own setAttribute and loop).
81
+ *
82
+ * @param nodes the SelectableNode[] for the current data
83
+ * @param tagged caller-owned map of {id -> tagged element}, kept in sync
84
+ * @returns cleanup that disconnects the observer and removes the added tags
85
+ */
86
+ export function tagSelectionGraphLive(nodes, tagged) {
87
+ const byId = indexNodes(nodes);
88
+ const retag = () => tagKnownElements(byId, tagged);
89
+ if (typeof document === 'undefined' || typeof MutationObserver === 'undefined') {
90
+ retag();
91
+ return () => clearTags(tagged);
92
+ }
93
+ retag();
94
+ const observer = new MutationObserver(() => retag());
95
+ observer.observe(document.documentElement, { childList: true, subtree: true });
96
+ return () => {
97
+ observer.disconnect();
98
+ clearTags(tagged);
99
+ };
100
+ }
101
+ /**
102
+ * Project a SelectableNode to the canonical SpatialContext the host/agent
103
+ * consumes. Pure, generic — no plugin knowledge. `parent` is resolved to the
104
+ * parent node's apiName (human-readable) when the parent is known.
105
+ *
106
+ * `fileName` is the file-level name (from the plugin data context) used as the
107
+ * fallback so `SpatialContext.fileName` — documented as always-available — is
108
+ * populated even for nodes that carry no `filePath` (e.g. flexipage
109
+ * region/component nodes, where `sfdxPath` returns undefined). When a node DOES
110
+ * carry a `filePath`, its basename takes precedence so a decomposed field points
111
+ * at its own `.field-meta.xml` rather than the parent object file.
112
+ */
113
+ export function nodeToSpatialContext(node, byId, fileName) {
114
+ const parentApiName = node.parentId ? byId.get(node.parentId)?.apiName : undefined;
115
+ const ctx = {
116
+ elementType: node.type,
117
+ apiName: node.apiName,
118
+ };
119
+ if (parentApiName) {
120
+ ctx.parent = parentApiName;
121
+ }
122
+ if (node.attributes && Object.keys(node.attributes).length > 0) {
123
+ ctx.attributes = node.attributes;
124
+ }
125
+ if (node.filePath) {
126
+ // Nodes carry the SFDX path (via sfdxPath). Surface it as filePath; the
127
+ // host's KO-3 fix also falls back to fileName when a host lacks fs paths.
128
+ ctx.filePath = node.filePath;
129
+ }
130
+ // fileName (always-available contract): the node's own file basename when it
131
+ // has a path, otherwise the file-level fallback. Only omitted when neither is
132
+ // known (a node with no path and no file-level name supplied).
133
+ const nodeFileName = node.filePath ? node.filePath.split('/').pop() : undefined;
134
+ const resolvedFileName = nodeFileName || fileName;
135
+ if (resolvedFileName) {
136
+ ctx.fileName = resolvedFileName;
137
+ }
138
+ return ctx;
139
+ }
140
+ /**
141
+ * The generic inverter: SelectedItem[] (from the marquee/click) -> SpatialContext[]
142
+ * by pure `Map.get(id)` over the node list. Selection carries the node id in
143
+ * `item.id` (the DOM's data-mv-id === node.id), so no plugin resolver runs.
144
+ * Unknown ids are skipped.
145
+ *
146
+ * `fileName` is the file-level fallback (the current file's basename, from the
147
+ * plugin data context) stamped onto every context that has no more-specific
148
+ * per-node file path — see {@link nodeToSpatialContext}.
149
+ */
150
+ export function buildContextsFromNodes(items, nodes, fileName) {
151
+ const byId = indexNodes(nodes);
152
+ const contexts = [];
153
+ for (const item of items) {
154
+ const node = byId.get(item.id);
155
+ if (node) {
156
+ contexts.push(nodeToSpatialContext(node, byId, fileName));
157
+ }
158
+ }
159
+ return contexts;
160
+ }
161
+ //# sourceMappingURL=selectionGraphEngine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionGraphEngine.js","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/selectionGraphEngine.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAqB,MAAM,YAAY,CAAC;AAIpF,oFAAoF;AACpF,MAAM,UAAU,UAAU,CAAC,KAAoC;IAC7D,MAAM,IAAI,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC/C,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;YAC5B,IAAI,CAAC,GAA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AG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAqB,EAAE,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/B,IAAI,IAAI,EAAE,CAAC;YACT,QAAQ,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Shared, renderer-agnostic marquee selection.
9
+ *
10
+ * Any visualization (ERD nodes, UEM tree, permission-set grid, flow diagram)
11
+ * gets consistent drag + click selection by tagging its selectable DOM elements
12
+ * with three data attributes — nothing else is required of the renderer:
13
+ *
14
+ * data-mv-selectable marks the element as a selection target
15
+ * data-mv-type="field" the element kind (plugin-defined)
16
+ * data-mv-id="Obj__c::Fld__c" a stable id unique within the visualization
17
+ *
18
+ * The overlay hit-tests purely by on-screen geometry (getBoundingClientRect),
19
+ * so it works identically across rendering technologies and transforms
20
+ * (React Flow zoom/pan included), since both the marquee and the elements are
21
+ * measured in the same client-coordinate space.
22
+ */
23
+ /** Data attribute names — the contract every plugin opts into. */
24
+ export declare const SELECTABLE_ATTR = "data-mv-selectable";
25
+ export declare const TYPE_ATTR = "data-mv-type";
26
+ export declare const ID_ATTR = "data-mv-id";
27
+ /**
28
+ * DOM attributes reflected onto the matching `[data-mv-id]` element by
29
+ * useVibeEdit to drive the selected/hover outline. These are DOM-internal.
30
+ * IMPORTANT: the CSS attribute selectors in `useVibeEdit.css`
31
+ * (`[data-mv-selected]`, `[data-mv-hover]`) are string literals that must
32
+ * mirror these exact values — keep them in sync.
33
+ */
34
+ export declare const SELECTED_ATTR = "data-mv-selected";
35
+ export declare const HOVER_ATTR = "data-mv-hover";
36
+ /** A single selected element resolved from the DOM. */
37
+ export interface SelectedItem {
38
+ /** Plugin-defined element kind, from data-mv-type (e.g. 'object', 'field'). */
39
+ type: string;
40
+ /** Stable id within the visualization, from data-mv-id. */
41
+ id: string;
42
+ }
43
+ /** Fraction of an element's area the marquee must cover to select it (drag). */
44
+ export declare const COVERAGE_THRESHOLD = 0.5;
45
+ /** Pointer travel (px) under which a gesture is treated as a click, not a drag. */
46
+ export declare const CLICK_THRESHOLD_PX = 5;
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/types.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;GAeG;AAEH,kEAAkE;AAClE,eAAO,MAAM,eAAe,uBAAuB,CAAC;AACpD,eAAO,MAAM,SAAS,iBAAiB,CAAC;AACxC,eAAO,MAAM,OAAO,eAAe,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,qBAAqB,CAAC;AAChD,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAE1C,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,+EAA+E;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,IAAI,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Shared, renderer-agnostic marquee selection.
9
+ *
10
+ * Any visualization (ERD nodes, UEM tree, permission-set grid, flow diagram)
11
+ * gets consistent drag + click selection by tagging its selectable DOM elements
12
+ * with three data attributes — nothing else is required of the renderer:
13
+ *
14
+ * data-mv-selectable marks the element as a selection target
15
+ * data-mv-type="field" the element kind (plugin-defined)
16
+ * data-mv-id="Obj__c::Fld__c" a stable id unique within the visualization
17
+ *
18
+ * The overlay hit-tests purely by on-screen geometry (getBoundingClientRect),
19
+ * so it works identically across rendering technologies and transforms
20
+ * (React Flow zoom/pan included), since both the marquee and the elements are
21
+ * measured in the same client-coordinate space.
22
+ */
23
+ /** Data attribute names — the contract every plugin opts into. */
24
+ export const SELECTABLE_ATTR = 'data-mv-selectable';
25
+ export const TYPE_ATTR = 'data-mv-type';
26
+ export const ID_ATTR = 'data-mv-id';
27
+ /**
28
+ * DOM attributes reflected onto the matching `[data-mv-id]` element by
29
+ * useVibeEdit to drive the selected/hover outline. These are DOM-internal.
30
+ * IMPORTANT: the CSS attribute selectors in `useVibeEdit.css`
31
+ * (`[data-mv-selected]`, `[data-mv-hover]`) are string literals that must
32
+ * mirror these exact values — keep them in sync.
33
+ */
34
+ export const SELECTED_ATTR = 'data-mv-selected';
35
+ export const HOVER_ATTR = 'data-mv-hover';
36
+ /** Fraction of an element's area the marquee must cover to select it (drag). */
37
+ export const COVERAGE_THRESHOLD = 0.5;
38
+ /** Pointer travel (px) under which a gesture is treated as a click, not a drag. */
39
+ export const CLICK_THRESHOLD_PX = 5;
40
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/types.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;GAeG;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,eAAe,GAAG,oBAAoB,CAAC;AACpD,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC;AAEpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAChD,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAU1C,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import type { SelectedItem } from './types.js';
8
+ export interface MarqueeSelectionApi {
9
+ /** Selected items keyed by `type::id`. */
10
+ selected: Map<string, SelectedItem>;
11
+ /** Ordered list of selected items (insertion order). */
12
+ items: SelectedItem[];
13
+ /** Replace the whole selection. */
14
+ replace: (items: SelectedItem[]) => void;
15
+ /** Add items (no removal). */
16
+ add: (items: SelectedItem[]) => void;
17
+ /** Toggle a single item. */
18
+ toggle: (item: SelectedItem) => void;
19
+ /** Clear everything. */
20
+ clear: () => void;
21
+ /** True if a given type::id is selected. */
22
+ isSelected: (type: string, id: string) => boolean;
23
+ }
24
+ /**
25
+ * Owns the marquee selection set and exposes the four mutators the overlay
26
+ * drives, plus an isSelected() helper plugins use to style elements. Pure
27
+ * state — no DOM access — so it's trivially testable and renderer-agnostic.
28
+ */
29
+ export declare function useMarqueeSelection(): MarqueeSelectionApi;
30
+ //# sourceMappingURL=useMarqueeSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarqueeSelection.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/useMarqueeSelection.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAIJ,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,wDAAwD;IACxD,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,mCAAmC;IACnC,OAAO,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IACzC,8BAA8B;IAC9B,GAAG,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IACrC,4BAA4B;IAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IACrC,wBAAwB;IACxB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,4CAA4C;IAC5C,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,mBAAmB,CA4CzD"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { useCallback, useMemo, useState } from 'react';
8
+ import { itemKey } from './selectionGeometry.js';
9
+ /**
10
+ * Owns the marquee selection set and exposes the four mutators the overlay
11
+ * drives, plus an isSelected() helper plugins use to style elements. Pure
12
+ * state — no DOM access — so it's trivially testable and renderer-agnostic.
13
+ */
14
+ export function useMarqueeSelection() {
15
+ const [selected, setSelected] = useState(new Map());
16
+ const replace = useCallback((items) => {
17
+ const next = new Map();
18
+ for (const it of items) {
19
+ next.set(itemKey(it), it);
20
+ }
21
+ setSelected(next);
22
+ }, []);
23
+ const add = useCallback((items) => {
24
+ setSelected((prev) => {
25
+ const next = new Map(prev);
26
+ for (const it of items) {
27
+ next.set(itemKey(it), it);
28
+ }
29
+ return next;
30
+ });
31
+ }, []);
32
+ const toggle = useCallback((item) => {
33
+ setSelected((prev) => {
34
+ const next = new Map(prev);
35
+ const key = itemKey(item);
36
+ if (next.has(key)) {
37
+ next.delete(key);
38
+ }
39
+ else {
40
+ next.set(key, item);
41
+ }
42
+ return next;
43
+ });
44
+ }, []);
45
+ const clear = useCallback(() => setSelected(new Map()), []);
46
+ const isSelected = useCallback((type, id) => selected.has(`${type}::${id}`), [selected]);
47
+ const items = useMemo(() => Array.from(selected.values()), [selected]);
48
+ return { selected, items, replace, add, toggle, clear, isSelected };
49
+ }
50
+ //# sourceMappingURL=useMarqueeSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useMarqueeSelection.js","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/useMarqueeSelection.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAoBjD;;;;GAIG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAA4B,IAAI,GAAG,EAAE,CAAC,CAAC;IAE/E,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,KAAqB,EAAE,EAAE;QACpD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC7C,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5B,CAAC;QACD,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,GAAG,GAAG,WAAW,CAAC,CAAC,KAAqB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AAM,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEvE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AACtE,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Copyright (c) 2025, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+
8
+ .mv-marquee-overlay {
9
+ position: absolute;
10
+ inset: 0;
11
+ z-index: 15;
12
+ /* Crosshair cursor while select-mode is active — the marquee/rubber-band
13
+ draw affordance, signalling a drag-to-select gesture rather than a plain
14
+ click. */
15
+ cursor: crosshair;
16
+ /* Transparent catch-all for pointer gestures while select mode is active. */
17
+ background: transparent;
18
+ }
19
+
20
+ .mv-marquee-box {
21
+ position: absolute;
22
+ pointer-events: none;
23
+ background: color-mix(in srgb, var(--mv-interactive-primary) 14%, transparent);
24
+ border: 1px solid var(--mv-interactive-primary);
25
+ border-radius: var(--mv-radius-sm);
26
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import React from 'react';
8
+ import { itemKey } from '../selection/selectionGeometry.js';
9
+ import { type SelectedItem } from '../selection/types.js';
10
+ import './MarqueeSelection.css';
11
+ /**
12
+ * Pure hover-funnel step. Given the previously-hovered key (`type::id` or null),
13
+ * the item now under the pointer (or null), and whether a marquee drag is in
14
+ * progress, decides whether the hover target changed and what to emit:
15
+ *
16
+ * - during a drag → never emit (hover is suppressed while rubber-banding);
17
+ * - moving within the same element → no change (dedup by hover key);
18
+ * - moving onto a new element / off all elements → change, emit the item/null.
19
+ *
20
+ * Extracted so the transition/dedup/suppression contract is unit-testable
21
+ * without a DOM. The component owns the RAF throttle + the hoverKey ref.
22
+ */
23
+ export declare function nextHover(prevKey: string | null, hit: SelectedItem | null, dragging: boolean): {
24
+ changed: boolean;
25
+ key: string | null;
26
+ item: SelectedItem | null;
27
+ };
28
+ interface MarqueeSelectionProps {
29
+ /** When false, the overlay is inert and pointer events pass through. */
30
+ active: boolean;
31
+ /** Currently selected items (keyed by `type::id`). */
32
+ selected: Map<string, SelectedItem>;
33
+ /** Replace the entire selection (drag with no modifier). */
34
+ onReplace: (items: SelectedItem[]) => void;
35
+ /** Add items to the selection (shift/cmd-drag). */
36
+ onAdd: (items: SelectedItem[]) => void;
37
+ /** Toggle a single item (click / shift-click / cmd-click). */
38
+ onToggle: (item: SelectedItem) => void;
39
+ /** Clear the selection (click on empty space, no modifier). */
40
+ onClear: () => void;
41
+ /**
42
+ * Activate (open/drill-into) the item under a double-click. Lets a host drill
43
+ * into a nested view (e.g. a subagent's detail) WITHOUT leaving select-mode —
44
+ * single-click still toggles selection, double-click opens. Optional: overlays
45
+ * that have nothing to drill into simply omit it.
46
+ */
47
+ onActivate?: (item: SelectedItem) => void;
48
+ /**
49
+ * Hover changed: the most-specific selectable element now under the pointer,
50
+ * or null when the pointer is over empty space / has left the overlay. Fires
51
+ * only on hover-target transitions (RAF-throttled, deduped by `type::id`),
52
+ * and is suppressed during a marquee drag. Optional; overlays with no hover
53
+ * affordance simply omit it. Intra-core-sdk child->parent callback — never
54
+ * crosses a wire boundary.
55
+ */
56
+ onHover?: (item: SelectedItem | null) => void;
57
+ /**
58
+ * Marquee preview changed: the full set of elements the drag box currently
59
+ * covers, INCLUDING finer nested elements (a tile's label / description rows
60
+ * as well as the tile), so the owner can show the dotted hover affordance on
61
+ * every selectable the box touches while the user is still dragging. This uses
62
+ * the raw covered set (coveredInMarquee) — NOT the ancestor-wins collapse — so
63
+ * the finer selectables are visible mid-drag even though release selects just
64
+ * the outermost element per {@link selectInMarquee}. RAF-throttled; fires with
65
+ * `[]` when the drag ends or is cancelled. Optional; overlays that don't want a
66
+ * bulk-selection preview simply omit it.
67
+ */
68
+ onMarqueePreview?: (items: SelectedItem[]) => void;
69
+ }
70
+ /**
71
+ * Renderer-agnostic marquee + click selection overlay.
72
+ *
73
+ * Covers its positioned parent. When `active`, a left-drag rubber-bands a
74
+ * selection box and selects every `[data-mv-selectable]` element it covers by
75
+ * >= the coverage threshold (ancestor-wins for nested elements). A click (drag
76
+ * under the click threshold) toggles the most-specific element at the point.
77
+ * Shift/Cmd makes both gestures additive, enabling discontiguous selection.
78
+ *
79
+ * Gestures all funnel into the four callbacks; the owner holds the selection
80
+ * state (see useMarqueeSelection).
81
+ */
82
+ export declare const MarqueeSelection: React.FC<MarqueeSelectionProps>;
83
+ export { itemKey };
84
+ //# sourceMappingURL=MarqueeSelection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MarqueeSelection.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/ui/MarqueeSelection.tsx"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAIL,OAAO,EAGR,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,wBAAwB,CAAC;AAEhC;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,GAAG,EAAE,YAAY,GAAG,IAAI,EACxB,QAAQ,EAAE,OAAO,GAChB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAA;CAAE,CAarE;AAED,UAAU,qBAAqB;IAC7B,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB,sDAAsD;IACtD,QAAQ,EA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