@astra-spec/ui 0.0.1

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 (259) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +261 -0
  3. package/TOKENS.md +93 -0
  4. package/blocks.css +7 -0
  5. package/components.css +13 -0
  6. package/dist/blocks/analysis-tree.d.ts +13 -0
  7. package/dist/blocks/analysis-tree.d.ts.map +1 -0
  8. package/dist/blocks/analysis-tree.js +19 -0
  9. package/dist/blocks/analysis-tree.js.map +1 -0
  10. package/dist/blocks/decisions-list.d.ts +17 -0
  11. package/dist/blocks/decisions-list.d.ts.map +1 -0
  12. package/dist/blocks/decisions-list.js +56 -0
  13. package/dist/blocks/decisions-list.js.map +1 -0
  14. package/dist/blocks/findings-list.d.ts +9 -0
  15. package/dist/blocks/findings-list.d.ts.map +1 -0
  16. package/dist/blocks/findings-list.js +35 -0
  17. package/dist/blocks/findings-list.js.map +1 -0
  18. package/dist/blocks/index.d.ts +18 -0
  19. package/dist/blocks/index.d.ts.map +1 -0
  20. package/dist/blocks/index.js +10 -0
  21. package/dist/blocks/index.js.map +1 -0
  22. package/dist/blocks/inputs-list.d.ts +9 -0
  23. package/dist/blocks/inputs-list.d.ts.map +1 -0
  24. package/dist/blocks/inputs-list.js +32 -0
  25. package/dist/blocks/inputs-list.js.map +1 -0
  26. package/dist/blocks/outputs-list.d.ts +18 -0
  27. package/dist/blocks/outputs-list.d.ts.map +1 -0
  28. package/dist/blocks/outputs-list.js +47 -0
  29. package/dist/blocks/outputs-list.js.map +1 -0
  30. package/dist/blocks/papers-list.d.ts +16 -0
  31. package/dist/blocks/papers-list.d.ts.map +1 -0
  32. package/dist/blocks/papers-list.js +20 -0
  33. package/dist/blocks/papers-list.js.map +1 -0
  34. package/dist/blocks/prior-insights-list.d.ts +9 -0
  35. package/dist/blocks/prior-insights-list.d.ts.map +1 -0
  36. package/dist/blocks/prior-insights-list.js +29 -0
  37. package/dist/blocks/prior-insights-list.js.map +1 -0
  38. package/dist/blocks/section.d.ts +36 -0
  39. package/dist/blocks/section.d.ts.map +1 -0
  40. package/dist/blocks/section.js +30 -0
  41. package/dist/blocks/section.js.map +1 -0
  42. package/dist/components/artifact-preview.d.ts +71 -0
  43. package/dist/components/artifact-preview.d.ts.map +1 -0
  44. package/dist/components/artifact-preview.js +170 -0
  45. package/dist/components/artifact-preview.js.map +1 -0
  46. package/dist/components/decision-detail.d.ts +17 -0
  47. package/dist/components/decision-detail.d.ts.map +1 -0
  48. package/dist/components/decision-detail.js +21 -0
  49. package/dist/components/decision-detail.js.map +1 -0
  50. package/dist/components/detail-entry.d.ts +15 -0
  51. package/dist/components/detail-entry.d.ts.map +1 -0
  52. package/dist/components/detail-entry.js +14 -0
  53. package/dist/components/detail-entry.js.map +1 -0
  54. package/dist/components/finding-detail.d.ts +19 -0
  55. package/dist/components/finding-detail.d.ts.map +1 -0
  56. package/dist/components/finding-detail.js +39 -0
  57. package/dist/components/finding-detail.js.map +1 -0
  58. package/dist/components/index.d.ts +28 -0
  59. package/dist/components/index.d.ts.map +1 -0
  60. package/dist/components/index.js +15 -0
  61. package/dist/components/index.js.map +1 -0
  62. package/dist/components/input-detail.d.ts +15 -0
  63. package/dist/components/input-detail.d.ts.map +1 -0
  64. package/dist/components/input-detail.js +21 -0
  65. package/dist/components/input-detail.js.map +1 -0
  66. package/dist/components/insight-detail.d.ts +25 -0
  67. package/dist/components/insight-detail.d.ts.map +1 -0
  68. package/dist/components/insight-detail.js +30 -0
  69. package/dist/components/insight-detail.js.map +1 -0
  70. package/dist/components/insight-trigger.d.ts +20 -0
  71. package/dist/components/insight-trigger.d.ts.map +1 -0
  72. package/dist/components/insight-trigger.js +32 -0
  73. package/dist/components/insight-trigger.js.map +1 -0
  74. package/dist/components/output-detail.d.ts +39 -0
  75. package/dist/components/output-detail.d.ts.map +1 -0
  76. package/dist/components/output-detail.js +124 -0
  77. package/dist/components/output-detail.js.map +1 -0
  78. package/dist/components/output-dialog.d.ts +18 -0
  79. package/dist/components/output-dialog.d.ts.map +1 -0
  80. package/dist/components/output-dialog.js +11 -0
  81. package/dist/components/output-dialog.js.map +1 -0
  82. package/dist/components/paper-detail.d.ts +34 -0
  83. package/dist/components/paper-detail.d.ts.map +1 -0
  84. package/dist/components/paper-detail.js +60 -0
  85. package/dist/components/paper-detail.js.map +1 -0
  86. package/dist/components/record-dialog.d.ts +33 -0
  87. package/dist/components/record-dialog.d.ts.map +1 -0
  88. package/dist/components/record-dialog.js +114 -0
  89. package/dist/components/record-dialog.js.map +1 -0
  90. package/dist/components/relation-items.d.ts +9 -0
  91. package/dist/components/relation-items.d.ts.map +1 -0
  92. package/dist/components/relation-items.js +20 -0
  93. package/dist/components/relation-items.js.map +1 -0
  94. package/dist/components/use-detail-stack.d.ts +31 -0
  95. package/dist/components/use-detail-stack.d.ts.map +1 -0
  96. package/dist/components/use-detail-stack.js +49 -0
  97. package/dist/components/use-detail-stack.js.map +1 -0
  98. package/dist/lib/cn.d.ts +3 -0
  99. package/dist/lib/cn.d.ts.map +1 -0
  100. package/dist/lib/cn.js +6 -0
  101. package/dist/lib/cn.js.map +1 -0
  102. package/dist/lib/labels.d.ts +61 -0
  103. package/dist/lib/labels.d.ts.map +1 -0
  104. package/dist/lib/labels.js +79 -0
  105. package/dist/lib/labels.js.map +1 -0
  106. package/dist/lib/slot.d.ts +11 -0
  107. package/dist/lib/slot.d.ts.map +1 -0
  108. package/dist/lib/slot.js +83 -0
  109. package/dist/lib/slot.js.map +1 -0
  110. package/dist/model/doi.d.ts +2 -0
  111. package/dist/model/doi.d.ts.map +1 -0
  112. package/dist/model/doi.js +5 -0
  113. package/dist/model/doi.js.map +1 -0
  114. package/dist/model/index.d.ts +10 -0
  115. package/dist/model/index.d.ts.map +1 -0
  116. package/dist/model/index.js +7 -0
  117. package/dist/model/index.js.map +1 -0
  118. package/dist/model/locate-record.d.ts +8 -0
  119. package/dist/model/locate-record.d.ts.map +1 -0
  120. package/dist/model/locate-record.js +7 -0
  121. package/dist/model/locate-record.js.map +1 -0
  122. package/dist/model/papers.d.ts +38 -0
  123. package/dist/model/papers.d.ts.map +1 -0
  124. package/dist/model/papers.js +91 -0
  125. package/dist/model/papers.js.map +1 -0
  126. package/dist/model/records.d.ts +10 -0
  127. package/dist/model/records.d.ts.map +1 -0
  128. package/dist/model/records.js +32 -0
  129. package/dist/model/records.js.map +1 -0
  130. package/dist/model/relations.d.ts +45 -0
  131. package/dist/model/relations.d.ts.map +1 -0
  132. package/dist/model/relations.js +98 -0
  133. package/dist/model/relations.js.map +1 -0
  134. package/dist/primitives/badge.d.ts +11 -0
  135. package/dist/primitives/badge.d.ts.map +1 -0
  136. package/dist/primitives/badge.js +7 -0
  137. package/dist/primitives/badge.js.map +1 -0
  138. package/dist/primitives/button.d.ts +18 -0
  139. package/dist/primitives/button.d.ts.map +1 -0
  140. package/dist/primitives/button.js +12 -0
  141. package/dist/primitives/button.js.map +1 -0
  142. package/dist/primitives/detail-layout.d.ts +26 -0
  143. package/dist/primitives/detail-layout.d.ts.map +1 -0
  144. package/dist/primitives/detail-layout.js +21 -0
  145. package/dist/primitives/detail-layout.js.map +1 -0
  146. package/dist/primitives/dialog.d.ts +133 -0
  147. package/dist/primitives/dialog.d.ts.map +1 -0
  148. package/dist/primitives/dialog.js +266 -0
  149. package/dist/primitives/dialog.js.map +1 -0
  150. package/dist/primitives/index.d.ts +25 -0
  151. package/dist/primitives/index.d.ts.map +1 -0
  152. package/dist/primitives/index.js +14 -0
  153. package/dist/primitives/index.js.map +1 -0
  154. package/dist/primitives/kind.d.ts +6 -0
  155. package/dist/primitives/kind.d.ts.map +1 -0
  156. package/dist/primitives/kind.js +14 -0
  157. package/dist/primitives/kind.js.map +1 -0
  158. package/dist/primitives/prose.d.ts +36 -0
  159. package/dist/primitives/prose.d.ts.map +1 -0
  160. package/dist/primitives/prose.js +57 -0
  161. package/dist/primitives/prose.js.map +1 -0
  162. package/dist/primitives/record-list.d.ts +31 -0
  163. package/dist/primitives/record-list.d.ts.map +1 -0
  164. package/dist/primitives/record-list.js +17 -0
  165. package/dist/primitives/record-list.js.map +1 -0
  166. package/dist/primitives/relation-list.d.ts +22 -0
  167. package/dist/primitives/relation-list.d.ts.map +1 -0
  168. package/dist/primitives/relation-list.js +13 -0
  169. package/dist/primitives/relation-list.js.map +1 -0
  170. package/dist/primitives/surface-header.d.ts +31 -0
  171. package/dist/primitives/surface-header.d.ts.map +1 -0
  172. package/dist/primitives/surface-header.js +13 -0
  173. package/dist/primitives/surface-header.js.map +1 -0
  174. package/dist/views/index.d.ts +4 -0
  175. package/dist/views/index.d.ts.map +1 -0
  176. package/dist/views/index.js +3 -0
  177. package/dist/views/index.js.map +1 -0
  178. package/dist/views/inventory.d.ts +46 -0
  179. package/dist/views/inventory.d.ts.map +1 -0
  180. package/dist/views/inventory.js +101 -0
  181. package/dist/views/inventory.js.map +1 -0
  182. package/package.json +127 -0
  183. package/primitives.css +15 -0
  184. package/src/blocks/analysis-tree.tsx +109 -0
  185. package/src/blocks/decisions-list.tsx +113 -0
  186. package/src/blocks/findings-list.tsx +61 -0
  187. package/src/blocks/index.ts +23 -0
  188. package/src/blocks/inputs-list.tsx +51 -0
  189. package/src/blocks/outputs-list.tsx +143 -0
  190. package/src/blocks/papers-list.tsx +65 -0
  191. package/src/blocks/prior-insights-list.tsx +52 -0
  192. package/src/blocks/section.tsx +113 -0
  193. package/src/components/artifact-preview.tsx +314 -0
  194. package/src/components/decision-detail.tsx +93 -0
  195. package/src/components/detail-entry.ts +19 -0
  196. package/src/components/finding-detail.tsx +99 -0
  197. package/src/components/index.ts +44 -0
  198. package/src/components/input-detail.tsx +67 -0
  199. package/src/components/insight-detail.tsx +120 -0
  200. package/src/components/insight-trigger.tsx +102 -0
  201. package/src/components/output-detail.tsx +258 -0
  202. package/src/components/output-dialog.tsx +63 -0
  203. package/src/components/paper-detail.tsx +216 -0
  204. package/src/components/record-dialog.tsx +232 -0
  205. package/src/components/relation-items.ts +31 -0
  206. package/src/components/use-detail-stack.ts +78 -0
  207. package/src/lib/cn.ts +5 -0
  208. package/src/lib/labels.tsx +145 -0
  209. package/src/lib/slot.tsx +87 -0
  210. package/src/model/doi.ts +5 -0
  211. package/src/model/index.ts +32 -0
  212. package/src/model/locate-record.ts +13 -0
  213. package/src/model/papers.ts +146 -0
  214. package/src/model/records.ts +43 -0
  215. package/src/model/relations.ts +134 -0
  216. package/src/primitives/badge.tsx +32 -0
  217. package/src/primitives/button.tsx +58 -0
  218. package/src/primitives/detail-layout.tsx +84 -0
  219. package/src/primitives/dialog.tsx +555 -0
  220. package/src/primitives/index.ts +48 -0
  221. package/src/primitives/kind.ts +19 -0
  222. package/src/primitives/prose.tsx +74 -0
  223. package/src/primitives/record-list.tsx +103 -0
  224. package/src/primitives/relation-list.tsx +95 -0
  225. package/src/primitives/surface-header.tsx +87 -0
  226. package/src/views/index.ts +3 -0
  227. package/src/views/inventory.tsx +224 -0
  228. package/styles/base.css +49 -0
  229. package/styles/blocks/analysis-tree.css +64 -0
  230. package/styles/blocks/decisions-list.css +73 -0
  231. package/styles/blocks/outputs-list.css +349 -0
  232. package/styles/blocks/papers-list.css +98 -0
  233. package/styles/blocks/records.css +72 -0
  234. package/styles/components/artifact-preview.css +242 -0
  235. package/styles/components/decision-detail.css +159 -0
  236. package/styles/components/evidence.css +79 -0
  237. package/styles/components/finding-detail.css +63 -0
  238. package/styles/components/input-detail.css +95 -0
  239. package/styles/components/insight-detail.css +138 -0
  240. package/styles/components/insight-list.css +46 -0
  241. package/styles/components/insight-trigger.css +54 -0
  242. package/styles/components/output-detail.css +732 -0
  243. package/styles/components/paper-detail.css +249 -0
  244. package/styles/components/paper-doi.css +36 -0
  245. package/styles/primitives/badge.css +107 -0
  246. package/styles/primitives/button.css +116 -0
  247. package/styles/primitives/count-heading.css +27 -0
  248. package/styles/primitives/detail-layout.css +225 -0
  249. package/styles/primitives/dialog.css +634 -0
  250. package/styles/primitives/empty-state.css +10 -0
  251. package/styles/primitives/kind.css +41 -0
  252. package/styles/primitives/prose.css +15 -0
  253. package/styles/primitives/record-list.css +425 -0
  254. package/styles/primitives/relation-list.css +184 -0
  255. package/styles/primitives/surface-header.css +183 -0
  256. package/styles/tokens.css +119 -0
  257. package/styles/views/inventory.css +186 -0
  258. package/styles.css +2 -0
  259. package/views.css +3 -0
@@ -0,0 +1,98 @@
1
+ import { walkAnalyses } from '@astra-spec/sdk';
2
+ import { locateRecord } from './locate-record.js';
3
+ import { isInsight } from './records.js';
4
+ export function linkedRecord(index, canonicalPath) {
5
+ const located = locateRecord(index, canonicalPath);
6
+ return {
7
+ canonicalPath,
8
+ ...(located ? { record: located.record, analysis: located.analysis } : {}),
9
+ };
10
+ }
11
+ /**
12
+ * Decisions an output depends on only through its upstream outputs: the
13
+ * provenance of every input that is (or aliases) an output, followed
14
+ * recursively, minus the output's own direct decisions. Document order of
15
+ * discovery; cycles are ignored.
16
+ */
17
+ export function indirectDecisionPaths(index, output) {
18
+ const direct = new Set(output.provenance.decisionPaths);
19
+ const seen = new Set([output.canonicalPath]);
20
+ const found = [];
21
+ const queue = [...output.provenance.inputPaths];
22
+ // Array iteration sees entries pushed while it runs, so the walk is a BFS.
23
+ for (const path of queue) {
24
+ if (seen.has(path))
25
+ continue;
26
+ seen.add(path);
27
+ let record = index.recordByPath.get(path);
28
+ if (record?.kind === 'input' && record.resolvedFrom)
29
+ record = index.recordByPath.get(record.resolvedFrom);
30
+ if (record?.kind !== 'output')
31
+ continue;
32
+ for (const decisionPath of record.provenance.decisionPaths) {
33
+ if (!direct.has(decisionPath) && !found.includes(decisionPath))
34
+ found.push(decisionPath);
35
+ }
36
+ queue.push(...record.provenance.inputPaths);
37
+ if (record.resolvedFrom)
38
+ queue.push(record.resolvedFrom);
39
+ }
40
+ return found;
41
+ }
42
+ /** Inputs, direct and indirect decisions, and alias source an output depends on; a record referenced twice (e.g. through an alias) is listed once. */
43
+ export function outputRelations(index, output) {
44
+ const unique = (paths) => [...new Set(paths)];
45
+ return {
46
+ inputs: unique(output.provenance.inputPaths).map((path) => linkedRecord(index, path)),
47
+ decisions: unique(output.provenance.decisionPaths).map((path) => linkedRecord(index, path)),
48
+ indirectDecisions: indirectDecisionPaths(index, output).map((path) => linkedRecord(index, path)),
49
+ ...(output.resolvedFrom ? { alias: linkedRecord(index, output.resolvedFrom) } : {}),
50
+ };
51
+ }
52
+ /** Artifact-backed evidence of a finding, resolved to outputs where possible. */
53
+ export function findingEvidence(index, finding) {
54
+ return finding.evidence
55
+ .filter((evidence) => Boolean(evidence.artifact) || Boolean(evidence.resolvedOutputPath))
56
+ .map((evidence) => {
57
+ const located = evidence.resolvedOutputPath
58
+ ? locateRecord(index, evidence.resolvedOutputPath)
59
+ : undefined;
60
+ const output = located?.record.kind === 'output' ? located.record : undefined;
61
+ return {
62
+ evidence,
63
+ ...(output && located ? { output, analysis: located.analysis } : {}),
64
+ };
65
+ });
66
+ }
67
+ /** Literature evidence (a DOI, with or without a quote) a finding or insight cites. */
68
+ export function findingLiterature(finding) {
69
+ return finding.evidence.filter((evidence) => Boolean(evidence.doi));
70
+ }
71
+ /** Insight paths cited by a decision's options, selected option first. */
72
+ export function decisionInsightPaths(decision) {
73
+ const selected = decision.options.find(({ id }) => id === decision.selectedOptionId);
74
+ return [...new Set([
75
+ ...(selected?.resolvedInsightPaths ?? []),
76
+ ...decision.options
77
+ .filter(({ id }) => id !== decision.selectedOptionId)
78
+ .flatMap(({ resolvedInsightPaths }) => resolvedInsightPaths),
79
+ ])];
80
+ }
81
+ export function decisionInsights(index, decision) {
82
+ return decisionInsightPaths(decision)
83
+ .map((path) => index.recordByPath.get(path))
84
+ .filter(isInsight);
85
+ }
86
+ /** Decisions anywhere in the document whose options cite this insight. */
87
+ export function informedDecisions(document, insight) {
88
+ const decisions = new Map();
89
+ for (const analysis of walkAnalyses(document)) {
90
+ for (const decision of analysis.decisions) {
91
+ if (decision.options.some(({ resolvedInsightPaths }) => resolvedInsightPaths.includes(insight.canonicalPath))) {
92
+ decisions.set(decision.canonicalPath, decision);
93
+ }
94
+ }
95
+ }
96
+ return [...decisions.values()];
97
+ }
98
+ //# sourceMappingURL=relations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relations.js","sourceRoot":"","sources":["../../src/model/relations.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,YAAY,EAAqD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AA4BzC,MAAM,UAAU,YAAY,CAAC,KAAoB,EAAE,aAAqB;IACtE,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACnD,OAAO;QACL,aAAa;QACb,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAoB,EAAE,MAAsB;IAChF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IACrD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAChD,2EAA2E;IAC3E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,SAAS;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,C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9G,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type HTMLAttributes } from 'react';
2
+ import type { SurfaceKind } from './kind.js';
3
+ export type BadgeTone = 'neutral' | 'kind' | 'status' | 'universe';
4
+ export type BadgeStatus = 'available' | 'current' | 'materialized' | 'ready' | 'error' | 'missing' | 'stale';
5
+ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
6
+ kind?: SurfaceKind | undefined;
7
+ status?: BadgeStatus | (string & {}) | undefined;
8
+ tone?: BadgeTone | undefined;
9
+ }
10
+ export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
11
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/primitives/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;AAE7G,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,eAAe,CAAC;IACjE,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACjD,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,KAAK,wGAkBhB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { cn } from '../lib/cn.js';
4
+ export const Badge = forwardRef(function Badge({ className, kind, status, tone = kind ? 'kind' : status ? 'status' : 'neutral', ...props }, ref) {
5
+ return (_jsx("span", { "data-slot": "badge", ...props, ref: ref, className: cn('astra-badge', className), "data-tone": tone, ...(kind ? { 'data-kind': kind } : {}), ...(status ? { 'data-status': status } : {}) }));
6
+ });
7
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../src/primitives/badge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAYlC,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAA8B,SAAS,KAAK,CAAC,EAC1E,SAAS,EACT,IAAI,EACJ,MAAM,EACN,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACpD,GAAG,KAAK,EACT,EAAE,GAAG;IACJ,OAAO,CACL,4BACY,OAAO,KACb,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,eAC5B,IAAI,KACX,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KACnC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAC7C,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type ButtonHTMLAttributes } from 'react';
2
+ export type ButtonVariant = 'primary' | 'secondary' | 'quiet';
3
+ export type ButtonSize = 'small' | 'medium';
4
+ export type ButtonTone = 'neutral' | 'accent';
5
+ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
6
+ variant?: ButtonVariant | undefined;
7
+ size?: ButtonSize | undefined;
8
+ tone?: ButtonTone | undefined;
9
+ /** Render the child element instead of a `<button>`, merging props onto it. */
10
+ asChild?: boolean | undefined;
11
+ }
12
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
13
+ export interface IconButtonProps extends ButtonProps {
14
+ /** Accessible name; icon buttons never rely on visible text. */
15
+ label: string;
16
+ }
17
+ export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
18
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/primitives/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAI9D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC5C,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9C,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC1E,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IACpC,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED,eAAO,MAAM,MAAM,2GAsBjB,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,UAAU,+GAYtB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { cn } from '../lib/cn.js';
4
+ import { Slot } from '../lib/slot.js';
5
+ export const Button = forwardRef(function Button({ className, variant = 'secondary', size = 'medium', tone = 'neutral', type, asChild = false, ...props }, ref) {
6
+ const Component = asChild ? Slot : 'button';
7
+ return (_jsx(Component, { "data-slot": "button", ...props, ...(asChild ? (type ? { type } : {}) : { type: type ?? 'button' }), ref: ref, className: cn('astra-button', className), "data-variant": variant, "data-size": size, "data-tone": tone }));
8
+ });
9
+ export const IconButton = forwardRef(function IconButton({ label, className, ...props }, ref) {
10
+ return (_jsx(Button, { "data-slot": "icon-button", ...props, ref: ref, className: cn('astra-icon-button', className), "aria-label": label }));
11
+ });
12
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../src/primitives/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA6B,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AActC,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAiC,SAAS,MAAM,CAAC,EAC/E,SAAS,EACT,OAAO,GAAG,WAAW,EACrB,IAAI,GAAG,QAAQ,EACf,IAAI,GAAG,SAAS,EAChB,IAAI,EACJ,OAAO,GAAG,KAAK,EACf,GAAG,KAAK,EACT,EAAE,GAAG;IACJ,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5C,OAAO,CACL,KAAC,SAAS,iBACE,QAAQ,KACd,KAAK,KACL,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,CAAC,EACnE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,cAAc,EAAE,SAAS,CAAC,kBAC1B,OAAO,eACV,IAAI,eACJ,IAAI,GACf,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,SAAS,UAAU,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACrD,OAAO,CACL,KAAC,MAAM,iBACK,aAAa,KACnB,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,mBAAmB,EAAE,SAAS,CAAC,gBACjC,KAAK,GACjB,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ export type DetailLayoutMode = 'split' | 'single';
3
+ export interface DetailLayoutProps extends HTMLAttributes<HTMLDivElement> {
4
+ /** `split` places a rail beside the main column; `single` is one scrolling column. */
5
+ layout?: DetailLayoutMode | undefined;
6
+ }
7
+ /** Two-column (or single-column) frame for a record detail body. */
8
+ export declare const DetailLayout: import("react").ForwardRefExoticComponent<DetailLayoutProps & import("react").RefAttributes<HTMLDivElement>>;
9
+ export declare const DetailMain: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
10
+ export interface DetailRailProps extends HTMLAttributes<HTMLElement> {
11
+ label: string;
12
+ }
13
+ export declare const DetailRail: import("react").ForwardRefExoticComponent<DetailRailProps & import("react").RefAttributes<HTMLElement>>;
14
+ export interface DetailSectionProps extends HTMLAttributes<HTMLElement> {
15
+ label: ReactNode;
16
+ /** `section` renders the label as a section heading rather than an eyebrow. */
17
+ heading?: 'eyebrow' | 'section' | undefined;
18
+ }
19
+ /** A labelled block of prose or content inside a detail body. */
20
+ export declare const DetailSection: import("react").ForwardRefExoticComponent<DetailSectionProps & import("react").RefAttributes<HTMLElement>>;
21
+ export interface CountHeadingProps extends Omit<HTMLAttributes<HTMLHeadingElement>, 'title'> {
22
+ title: ReactNode;
23
+ count: number;
24
+ }
25
+ export declare const CountHeading: import("react").ForwardRefExoticComponent<CountHeadingProps & import("react").RefAttributes<HTMLHeadingElement>>;
26
+ //# sourceMappingURL=detail-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detail-layout.d.ts","sourceRoot":"","sources":["../../src/primitives/detail-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,iBAAkB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACvE,sFAAsF;IACtF,MAAM,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAC;CACvC;AAED,oEAAoE;AACpE,eAAO,MAAM,YAAY,8GAcvB,CAAC;AAEH,eAAO,MAAM,UAAU,2HAErB,CAAC;AAEH,MAAM,WAAW,eAAgB,SAAQ,cAAc,CAAC,WAAW,CAAC;IAClE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,UAAU,yGAErB,CAAC;AAEH,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACrE,KAAK,EAAE,SAAS,CAAC;IACjB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;CAC7C;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,4GAmBxB,CAAC;AAEH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC1F,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,YAAY,kHAWvB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { cn } from '../lib/cn.js';
4
+ /** Two-column (or single-column) frame for a record detail body. */
5
+ export const DetailLayout = forwardRef(function DetailLayout({ layout = 'split', className, ...props }, ref) {
6
+ return (_jsx("div", { "data-slot": "detail-layout", ...props, ref: ref, className: cn('astra-detail__layout', className), "data-layout": layout }));
7
+ });
8
+ export const DetailMain = forwardRef(function DetailMain({ className, ...props }, ref) {
9
+ return _jsx("div", { "data-slot": "detail-main", ...props, ref: ref, className: cn('astra-detail__main', className) });
10
+ });
11
+ export const DetailRail = forwardRef(function DetailRail({ label, className, ...props }, ref) {
12
+ return _jsx("aside", { "data-slot": "detail-rail", ...props, ref: ref, className: cn('astra-detail__aside', className), "aria-label": label });
13
+ });
14
+ /** A labelled block of prose or content inside a detail body. */
15
+ export const DetailSection = forwardRef(function DetailSection({ label, heading = 'eyebrow', className, children, ...props }, ref) {
16
+ return (_jsxs("section", { "data-slot": "detail-section", ...props, ref: ref, className: cn('astra-detail__section', className), ...(heading === 'section' ? { 'data-heading': 'section' } : {}), children: [_jsx("span", { children: label }), _jsx("div", { children: children })] }));
17
+ });
18
+ export const CountHeading = forwardRef(function CountHeading({ title, count, className, ...props }, ref) {
19
+ return (_jsxs("h4", { "data-slot": "count-heading", ...props, ref: ref, className: cn('astra-count-heading', className), children: [title, " ", _jsx("span", { children: count })] }));
20
+ });
21
+ //# sourceMappingURL=detail-layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detail-layout.js","sourceRoot":"","sources":["../../src/primitives/detail-layout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAuC,MAAM,OAAO,CAAC;AACxE,OAAO,EAA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AC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAEhE,yBAAO,KAAK,GAAQ,EACpB,wBAAM,QAAQ,GAAO,IACb,CACX,CAAC;AACJ,CAAC,CAAC,CAAC;AAOH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAwC,SAAS,YAAY,CAAC,EAClG,KAAK,EACL,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,GAAG;IACJ,OAAO,CACL,2BAAc,eAAe,KAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,aAC/F,KAAK,OAAE,yBAAO,KAAK,GAAQ,IACzB,CACN,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { type HTMLAttributes, type ReactNode } from 'react';
2
+ import type { SurfaceKind } from './kind.js';
3
+ import { type SurfaceHeadingLevel } from './surface-header.js';
4
+ export type DialogMode = 'modal' | 'embedded';
5
+ export type DialogLayout = 'single' | 'reader';
6
+ interface DialogPresentation {
7
+ mode?: DialogMode | undefined;
8
+ backLabel?: string | undefined;
9
+ backText?: string | undefined;
10
+ }
11
+ export interface DialogProviderProps extends DialogPresentation {
12
+ children: ReactNode;
13
+ }
14
+ /**
15
+ * Sets the default mode (modal or embedded) and back-trail text for every
16
+ * Dialog below it. Nested providers inherit what they do not set; explicit
17
+ * props on a Dialog still win.
18
+ */
19
+ export declare function DialogProvider({ mode, backLabel, backText, children }: DialogProviderProps): import("react").JSX.Element;
20
+ export interface DialogContextValue {
21
+ open: boolean;
22
+ mode: DialogMode;
23
+ kind: SurfaceKind | undefined;
24
+ layout: DialogLayout | undefined;
25
+ titleId: string;
26
+ backLabel: string;
27
+ backText: string | undefined;
28
+ /** Dismisses the dialog: runs the native close (modal), which then notifies `onOpenChange(false)`. */
29
+ requestClose: () => void;
30
+ /**
31
+ * What Escape does: the innermost dismissal guard handles it when one is
32
+ * registered (an inner layer exits), otherwise the dialog closes.
33
+ */
34
+ requestDismiss: () => void;
35
+ /** Reports a state change to the host; DialogContent calls it from the native `close` event. */
36
+ notifyOpenChange: (open: boolean) => void;
37
+ /** Registers a dismissal guard with its Escape handler; returns the release function. */
38
+ addGuard: (onDismiss?: () => void) => () => void;
39
+ isGuarded: () => boolean;
40
+ /** DialogContent registers the native close steps here so `requestClose` can run them. */
41
+ registerNativeClose: (close: (() => boolean) | null) => void;
42
+ closeRef: {
43
+ current: HTMLButtonElement | null;
44
+ };
45
+ }
46
+ export declare function useDialog(): DialogContextValue;
47
+ /** The enclosing Dialog, or null outside one. */
48
+ export declare function useOptionalDialog(): DialogContextValue | null;
49
+ export interface DialogProps {
50
+ /** Mounting a Dialog opens it; pass `false` to keep it mounted but closed. */
51
+ open?: boolean | undefined;
52
+ /** Called with `false` when the user dismisses the dialog (Escape, backdrop, close button). */
53
+ onOpenChange?: ((open: boolean) => void) | undefined;
54
+ mode?: DialogMode | undefined;
55
+ kind?: SurfaceKind | undefined;
56
+ layout?: DialogLayout | undefined;
57
+ backLabel?: string | undefined;
58
+ backText?: string | undefined;
59
+ children: ReactNode;
60
+ }
61
+ export declare function Dialog({ open, onOpenChange, mode, kind, layout, backLabel, backText, children, }: DialogProps): import("react").JSX.Element;
62
+ /**
63
+ * Registers a dismissal guard while `active`: backdrop clicks are ignored and
64
+ * Escape calls `onDismiss` (the inner layer exits) instead of closing the
65
+ * dialog. Inside a modal Dialog the inner layer must not listen for Escape
66
+ * itself; the `<dialog>`'s cancel event is the one signal that arrives after
67
+ * any host keydown handling. Safe to call outside a Dialog.
68
+ */
69
+ export declare function useDialogDismissGuard(active: boolean, onDismiss?: () => void): void;
70
+ export interface DialogContentProps extends HTMLAttributes<HTMLElement> {
71
+ /** Class name for the inner panel; the root receives `className`. */
72
+ panelClassName?: string | undefined;
73
+ /** Element focused when the dialog opens; defaults to the close button. */
74
+ initialFocusRef?: {
75
+ current: HTMLElement | null;
76
+ } | undefined;
77
+ }
78
+ export declare const DialogContent: import("react").ForwardRefExoticComponent<DialogContentProps & import("react").RefAttributes<HTMLElement>>;
79
+ export interface DialogHeaderProps {
80
+ /** Short kind label shown in the trail (e.g. "Decision"). */
81
+ kindLabel?: ReactNode | undefined;
82
+ title: ReactNode;
83
+ titleAs?: SurfaceHeadingLevel | undefined;
84
+ identifier?: ReactNode | undefined;
85
+ /** Renders the back control; the trail text comes from Dialog/DialogProvider `backText`. */
86
+ onBack?: (() => void) | undefined;
87
+ /** Extra controls rendered before the close button. */
88
+ actions?: ReactNode | undefined;
89
+ closeLabel?: string | undefined;
90
+ showCloseButton?: boolean | undefined;
91
+ className?: string | undefined;
92
+ }
93
+ export declare function DialogHeader({ kindLabel, title, titleAs, identifier, onBack, actions, closeLabel, showCloseButton, className, }: DialogHeaderProps): import("react").JSX.Element;
94
+ export interface DialogCloseProps {
95
+ /** Accessible name; defaults to the labels' close text. */
96
+ label?: string | undefined;
97
+ className?: string | undefined;
98
+ }
99
+ /** The dialog's close control; dismisses through the Dialog root. */
100
+ export declare function DialogClose({ label, className }: DialogCloseProps): import("react").JSX.Element;
101
+ export interface DialogBackProps {
102
+ onClick: () => void;
103
+ className?: string | undefined;
104
+ }
105
+ export declare function DialogBack({ onClick, className }: DialogBackProps): import("react").JSX.Element;
106
+ export interface DialogActionProps extends HTMLAttributes<HTMLElement> {
107
+ /** Render the child (e.g. an `<a>`) instead of a `<button>`. */
108
+ asChild?: boolean | undefined;
109
+ }
110
+ /** A text action for the dialog header (e.g. "Open ↗"); pass `asChild` to render a link. */
111
+ export declare const DialogAction: import("react").ForwardRefExoticComponent<DialogActionProps & import("react").RefAttributes<HTMLElement>>;
112
+ export declare const DialogBody: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
113
+ export interface DetailDialogProps extends Omit<DialogProps, 'children' | 'onOpenChange'>, Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'onClose'> {
114
+ kindLabel?: ReactNode | undefined;
115
+ title: ReactNode;
116
+ titleAs?: SurfaceHeadingLevel | undefined;
117
+ identifier?: ReactNode | undefined;
118
+ onBack?: (() => void) | undefined;
119
+ actions?: ReactNode | undefined;
120
+ closeLabel?: string | undefined;
121
+ onClose: () => void;
122
+ panelClassName?: string | undefined;
123
+ children: ReactNode;
124
+ }
125
+ /**
126
+ * Dialog + DialogContent + DialogHeader + DialogBody with the record-detail
127
+ * chrome. Every kind dialog and the inventory explorer build on this; hosts
128
+ * that need a different header compose the parts directly. HTML attributes
129
+ * land on the dialog root.
130
+ */
131
+ export declare function DetailDialog({ open, mode, kind, layout, backLabel, backText, kindLabel, title, titleAs, identifier, onBack, actions, closeLabel, onClose, panelClassName, children, ...content }: DetailDialogProps): import("react").JSX.Element;
132
+ export {};
133
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/primitives/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,cAAc,EAEnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC;AAC9C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAQ/C,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAID,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D,QAAQ,EAAE,SAAS,CAAC;CACrB;A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