@loomwork/blueprint-runtime 0.0.0-stage → 0.1.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 (117) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +83 -2
  4. package/dist/Blueprint.d.ts +14 -0
  5. package/dist/Blueprint.d.ts.map +1 -0
  6. package/dist/Blueprint.js +18 -0
  7. package/dist/Blueprint.js.map +1 -0
  8. package/dist/RendererRegistry.d.ts +9 -0
  9. package/dist/RendererRegistry.d.ts.map +1 -0
  10. package/dist/RendererRegistry.js +39 -0
  11. package/dist/RendererRegistry.js.map +1 -0
  12. package/dist/catalog.d.ts +129 -0
  13. package/dist/catalog.d.ts.map +1 -0
  14. package/dist/catalog.js +435 -0
  15. package/dist/catalog.js.map +1 -0
  16. package/dist/coverage.d.ts +18 -0
  17. package/dist/coverage.d.ts.map +1 -0
  18. package/dist/coverage.js +22 -0
  19. package/dist/coverage.js.map +1 -0
  20. package/dist/customWidget.d.ts +10 -0
  21. package/dist/customWidget.d.ts.map +1 -0
  22. package/dist/customWidget.js +34 -0
  23. package/dist/customWidget.js.map +1 -0
  24. package/dist/esm/Blueprint.js +15 -0
  25. package/dist/esm/Blueprint.js.map +1 -0
  26. package/dist/esm/RendererRegistry.js +35 -0
  27. package/dist/esm/RendererRegistry.js.map +1 -0
  28. package/dist/esm/catalog.js +430 -0
  29. package/dist/esm/catalog.js.map +1 -0
  30. package/dist/esm/coverage.js +19 -0
  31. package/dist/esm/coverage.js.map +1 -0
  32. package/dist/esm/customWidget.js +31 -0
  33. package/dist/esm/customWidget.js.map +1 -0
  34. package/dist/esm/identity.js +116 -0
  35. package/dist/esm/identity.js.map +1 -0
  36. package/dist/esm/index.js +15 -0
  37. package/dist/esm/index.js.map +1 -0
  38. package/dist/esm/irVersion.js +150 -0
  39. package/dist/esm/irVersion.js.map +1 -0
  40. package/dist/esm/layout.js +63 -0
  41. package/dist/esm/layout.js.map +1 -0
  42. package/dist/esm/normalize.js +115 -0
  43. package/dist/esm/normalize.js.map +1 -0
  44. package/dist/esm/pins.js +82 -0
  45. package/dist/esm/pins.js.map +1 -0
  46. package/dist/esm/traverseBlueprint.js +38 -0
  47. package/dist/esm/traverseBlueprint.js.map +1 -0
  48. package/dist/esm/traverseBlueprintAsync.js +48 -0
  49. package/dist/esm/traverseBlueprintAsync.js.map +1 -0
  50. package/dist/esm/types.js +2 -0
  51. package/dist/esm/types.js.map +1 -0
  52. package/dist/esm/widgetStatus.js +137 -0
  53. package/dist/esm/widgetStatus.js.map +1 -0
  54. package/dist/esm/widgets.js +105 -0
  55. package/dist/esm/widgets.js.map +1 -0
  56. package/dist/identity.d.ts +58 -0
  57. package/dist/identity.d.ts.map +1 -0
  58. package/dist/identity.js +122 -0
  59. package/dist/identity.js.map +1 -0
  60. package/dist/index.d.ts +24 -0
  61. package/dist/index.d.ts.map +1 -0
  62. package/dist/index.js +61 -0
  63. package/dist/index.js.map +1 -0
  64. package/dist/irVersion.d.ts +23 -0
  65. package/dist/irVersion.d.ts.map +1 -0
  66. package/dist/irVersion.js +153 -0
  67. package/dist/irVersion.js.map +1 -0
  68. package/dist/layout.d.ts +57 -0
  69. package/dist/layout.d.ts.map +1 -0
  70. package/dist/layout.js +71 -0
  71. package/dist/layout.js.map +1 -0
  72. package/dist/normalize.d.ts +29 -0
  73. package/dist/normalize.d.ts.map +1 -0
  74. package/dist/normalize.js +126 -0
  75. package/dist/normalize.js.map +1 -0
  76. package/dist/pins.d.ts +27 -0
  77. package/dist/pins.d.ts.map +1 -0
  78. package/dist/pins.js +86 -0
  79. package/dist/pins.js.map +1 -0
  80. package/dist/traverseBlueprint.d.ts +27 -0
  81. package/dist/traverseBlueprint.d.ts.map +1 -0
  82. package/dist/traverseBlueprint.js +40 -0
  83. package/dist/traverseBlueprint.js.map +1 -0
  84. package/dist/traverseBlueprintAsync.d.ts +18 -0
  85. package/dist/traverseBlueprintAsync.d.ts.map +1 -0
  86. package/dist/traverseBlueprintAsync.js +51 -0
  87. package/dist/traverseBlueprintAsync.js.map +1 -0
  88. package/dist/types.d.ts +176 -0
  89. package/dist/types.d.ts.map +1 -0
  90. package/dist/types.js +3 -0
  91. package/dist/types.js.map +1 -0
  92. package/dist/widgetStatus.d.ts +66 -0
  93. package/dist/widgetStatus.d.ts.map +1 -0
  94. package/dist/widgetStatus.js +141 -0
  95. package/dist/widgetStatus.js.map +1 -0
  96. package/dist/widgets.d.ts +101 -0
  97. package/dist/widgets.d.ts.map +1 -0
  98. package/dist/widgets.js +115 -0
  99. package/dist/widgets.js.map +1 -0
  100. package/package.json +60 -3
  101. package/src/Blueprint.ts +28 -0
  102. package/src/RendererRegistry.ts +38 -0
  103. package/src/catalog.ts +638 -0
  104. package/src/coverage.ts +52 -0
  105. package/src/customWidget.ts +42 -0
  106. package/src/identity.ts +178 -0
  107. package/src/index.ts +84 -0
  108. package/src/irVersion.ts +195 -0
  109. package/src/layout.ts +105 -0
  110. package/src/normalize.ts +130 -0
  111. package/src/pins.ts +84 -0
  112. package/src/traverseBlueprint.bench.ts +47 -0
  113. package/src/traverseBlueprint.ts +94 -0
  114. package/src/traverseBlueprintAsync.ts +92 -0
  115. package/src/types.ts +195 -0
  116. package/src/widgetStatus.ts +231 -0
  117. package/src/widgets.ts +213 -0
@@ -0,0 +1,137 @@
1
+ const DEFAULT_MESSAGE = {
2
+ redacted: "redacted",
3
+ error: "error",
4
+ empty: "no data",
5
+ stale: "stale",
6
+ pending: "",
7
+ loading: "",
8
+ ready: "",
9
+ };
10
+ const INVALID = Symbol("invalid");
11
+ const degradedChainOf = (widget) => {
12
+ const degraded = widget.source?.degradedFrom;
13
+ if (degraded === undefined)
14
+ return undefined;
15
+ if (!Array.isArray(degraded))
16
+ return INVALID;
17
+ const parts = [];
18
+ for (const d of degraded) {
19
+ if (typeof d !== "object" || d === null)
20
+ return INVALID;
21
+ const { type, version } = d;
22
+ parts.push(`${String(type)}@${String(version)}`);
23
+ }
24
+ return parts.join(" › ") || undefined;
25
+ };
26
+ /**
27
+ * Decide what a widget shows. `check` is the optional caller value-contract check; it runs only
28
+ * for a widget whose binding declares a status channel, and only when there is a subject to check
29
+ * (not under `error` or `empty`). A finding outranks `stale`, `pending` and `ready`.
30
+ */
31
+ export function describeWidgetStatus(widget, value, status, check) {
32
+ // IR 2.5.0: a redacted widget outranks everything — it is decided before `value`, `status`,
33
+ // `check`, `binding`, `title` or a malformed `source.degradedFrom` is looked at, so none of them
34
+ // can reach a renderer's output. The message is the constant, never data from the widget.
35
+ if (widget.source?.redacted === true) {
36
+ return {
37
+ tag: "redacted",
38
+ message: DEFAULT_MESSAGE.redacted,
39
+ finding: undefined,
40
+ hasValue: false,
41
+ showBody: false,
42
+ degradedChain: undefined,
43
+ };
44
+ }
45
+ const chain = degradedChainOf(widget);
46
+ if (chain === INVALID)
47
+ return { tag: "invalid", reason: "source.degradedFrom is not an array of objects" };
48
+ const hasValue = value !== undefined;
49
+ const base = { hasValue, degradedChain: chain };
50
+ if (widget.binding?.status === undefined) {
51
+ return { tag: "inert", message: "", finding: undefined, showBody: true, ...base };
52
+ }
53
+ const noValue = status?.state === "error" || status?.state === "empty";
54
+ const contract = noValue ? undefined : check?.(widget, value);
55
+ const finding = contract ? contract.message : status?.finding?.message;
56
+ let tag;
57
+ if (status?.state === "error")
58
+ tag = "error";
59
+ else if (status?.state === "empty")
60
+ tag = "empty";
61
+ else if (contract)
62
+ tag = "error";
63
+ else if (status?.state === "stale")
64
+ tag = "stale";
65
+ // `status` undefined (not yet written, or malformed) is treated like `ready`: a value that
66
+ // already exists is shown rather than hidden behind a spinner.
67
+ else if (!hasValue)
68
+ tag = "loading";
69
+ else
70
+ tag = status?.state === "pending" ? "pending" : "ready";
71
+ return {
72
+ tag,
73
+ message: finding ?? DEFAULT_MESSAGE[tag],
74
+ finding,
75
+ showBody: tag === "ready" || tag === "pending" || (tag === "stale" && hasValue),
76
+ ...base,
77
+ };
78
+ }
79
+ /**
80
+ * The surface-independent facts of a decided status. A redacted widget yields the constant marker
81
+ * and no source/degraded facts (nothing of the widget may reach the output).
82
+ */
83
+ export function describeWidgetFrame(widget, d) {
84
+ if (d.tag === "redacted") {
85
+ return {
86
+ state: "redacted",
87
+ sourceType: undefined,
88
+ sourceVersion: undefined,
89
+ degraded: undefined,
90
+ tooltip: undefined,
91
+ marker: {
92
+ name: "redacted",
93
+ role: "status",
94
+ glyph: "⊘",
95
+ text: `⊘ ${d.message}`,
96
+ tooltip: undefined,
97
+ block: true,
98
+ },
99
+ };
100
+ }
101
+ const label = widget.title ?? widget.kind;
102
+ const degraded = d.degradedChain;
103
+ let marker;
104
+ const row = (name, role, glyph, text, block, tooltip) => ({ name, role, glyph, text, tooltip, block });
105
+ switch (d.tag) {
106
+ case "error":
107
+ marker = row("error", "alert", "✗", `✗ ${label}: ${d.message}`, true);
108
+ break;
109
+ case "empty":
110
+ marker = row("empty", "status", "○", `○ ${label}: ${d.message}`, true);
111
+ break;
112
+ case "stale":
113
+ marker = d.hasValue
114
+ ? row("stale", undefined, "~", undefined, false, d.finding)
115
+ : row("stale", undefined, "~", `~ ${label}: ${d.message} — no value`, true);
116
+ break;
117
+ case "pending":
118
+ marker = row("pending", undefined, "⋯", undefined, false);
119
+ break;
120
+ case "loading":
121
+ marker = row("loading", undefined, "…", undefined, true);
122
+ break;
123
+ default:
124
+ marker = undefined;
125
+ }
126
+ return {
127
+ state: d.tag === "inert" ? undefined : d.tag,
128
+ sourceType: widget.source?.type,
129
+ sourceVersion: widget.source?.version,
130
+ degraded,
131
+ tooltip: degraded
132
+ ? `${widget.source?.type}@${widget.source?.version} shown as ${widget.kind} (degraded from ${degraded})`
133
+ : undefined,
134
+ marker,
135
+ };
136
+ }
137
+ //# sourceMappingURL=widgetStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgetStatus.js","sourceRoot":"","sources":["../../src/widgetStatus.ts"],"names":[],"mappings":"AAiDA,MAAM,eAAe,GAAqC;IACxD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QAAQ;YACf,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,aAAa,MAAM,CAAC,IAAI,mBAAmB,QAAQ,GAAG;YACxG,CAAC,CAAC,SAAS;QACb,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,105 @@
1
+ // A derived id, used when the caller supplies none. It is an IDENTITY, not a
2
+ // content address: a 32-bit non-cryptographic hash, scoped to one blueprint.
3
+ // Never treat it as an audit anchor for "which view was this" — use a real digest
4
+ // (`contentAddress` in @loomwork/plugin-content) for that.
5
+ //
6
+ // Because it is derived from the props, it CHANGES when any prop changes. That is
7
+ // correct for a view that is authored once and wrong for one a composer revises,
8
+ // which is why every builder accepts an explicit `id`.
9
+ function stableId(kind, props) {
10
+ const str = kind + JSON.stringify(props, Object.keys(props).sort());
11
+ let hash = 0;
12
+ for (let i = 0; i < str.length; i++) {
13
+ hash = (Math.imul(31, hash) + str.charCodeAt(i)) | 0;
14
+ }
15
+ return `${kind}-${(hash >>> 0).toString(16)}`;
16
+ }
17
+ export function MetricCard(props) {
18
+ const { title, id, ...rest } = props;
19
+ return {
20
+ _tag: "Widget",
21
+ id: id ?? stableId("MetricCard", props),
22
+ kind: "MetricCard",
23
+ title,
24
+ props: rest,
25
+ binding: props.binding,
26
+ };
27
+ }
28
+ export function Timeline(props) {
29
+ const { title, id, ...rest } = props;
30
+ return {
31
+ _tag: "Widget",
32
+ id: id ?? stableId("Timeline", props),
33
+ kind: "Timeline",
34
+ ...(title !== undefined && { title }),
35
+ props: rest,
36
+ binding: props.binding,
37
+ };
38
+ }
39
+ export function ApprovalCard(props) {
40
+ const { title, id, ...rest } = props;
41
+ return {
42
+ _tag: "Widget",
43
+ id: id ?? stableId("ApprovalCard", props),
44
+ kind: "ApprovalCard",
45
+ title,
46
+ props: rest,
47
+ binding: props.binding,
48
+ };
49
+ }
50
+ export function StatusBadge(props) {
51
+ const { title, id, ...rest } = props;
52
+ return {
53
+ _tag: "Widget",
54
+ id: id ?? stableId("StatusBadge", props),
55
+ kind: "StatusBadge",
56
+ ...(title !== undefined && { title }),
57
+ props: rest,
58
+ binding: props.binding,
59
+ };
60
+ }
61
+ export function ProgressBar(props) {
62
+ const { title, id, ...rest } = props;
63
+ return {
64
+ _tag: "Widget",
65
+ id: id ?? stableId("ProgressBar", props),
66
+ kind: "ProgressBar",
67
+ ...(title !== undefined && { title }),
68
+ props: rest,
69
+ binding: props.binding,
70
+ };
71
+ }
72
+ export function DataTable(props) {
73
+ const { title, id, ...rest } = props;
74
+ return {
75
+ _tag: "Widget",
76
+ id: id ?? stableId("DataTable", props),
77
+ kind: "DataTable",
78
+ ...(title !== undefined && { title }),
79
+ props: rest,
80
+ binding: props.binding,
81
+ };
82
+ }
83
+ export function AlertCard(props) {
84
+ const { title, id, ...rest } = props;
85
+ return {
86
+ _tag: "Widget",
87
+ id: id ?? stableId("AlertCard", props),
88
+ kind: "AlertCard",
89
+ ...(title !== undefined && { title }),
90
+ props: rest,
91
+ binding: props.binding,
92
+ };
93
+ }
94
+ export function StreamingText(props) {
95
+ const { title, id, ...rest } = props;
96
+ return {
97
+ _tag: "Widget",
98
+ id: id ?? stableId("StreamingText", props),
99
+ kind: "StreamingText",
100
+ ...(title !== undefined && { title }),
101
+ props: rest,
102
+ binding: props.binding,
103
+ };
104
+ }
105
+ //# sourceMappingURL=widgets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widgets.js","sourceRoot":"","sources":["../../src/widgets.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,6EAA6E;AAC7E,kFAAkF;AAClF,2DAA2D;AAC3D,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,uDAAuD;AACvD,SAAS,QAAQ,CAAC,IAAY,EAAE,KAAa;IAC3C,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAgC,CAAC,CA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AAQ,CAAC,WAAW,EAAE,KAAK,CAAC;QACtC,IAAI,EAAE,WAAW;QACjB,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AAeD,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,EAAE,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,CAAC;QACtC,IAAI,EAAE,WAAW;QACjB,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC;AASD,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IACrC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,EAAE,IAAI,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC;QAC1C,IAAI,EAAE,eAAe;QACrB,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { Blueprint } from "./types";
2
+ /** Why a node id went missing. Shares `validateBlueprint`'s vocabulary deliberately. */
3
+ export interface IdentityFinding {
4
+ readonly code: "dropped-node-id";
5
+ readonly severity: "error";
6
+ readonly nodeId: string;
7
+ readonly message: string;
8
+ }
9
+ export interface IdentityReport {
10
+ /** True iff no id present before is missing after. */
11
+ readonly ok: boolean;
12
+ readonly findings: readonly IdentityFinding[];
13
+ /**
14
+ * Ids the change introduced. Not a defect — adding is how a variant sits above a floor,
15
+ * and how a recompose adds a panel — but a `dropped` finding beside an `added` id of the
16
+ * same component is what a RE-IDENTIFICATION looks like, and telling those apart is the
17
+ * caller's job.
18
+ */
19
+ readonly added: readonly string[];
20
+ /**
21
+ * Ids compared (the size of `before`). The denominator: `ok: true` over an empty `before`
22
+ * is not evidence that identity was preserved, and this is how a caller tells.
23
+ */
24
+ readonly compared: number;
25
+ }
26
+ /**
27
+ * Every WIDGET id in a blueprint, in pre-order. Duplicates are `validateBlueprint`'s job.
28
+ *
29
+ * Widget-only by contract, also after IR 2.4.0: callers read its output as widget ids (a
30
+ * renderer's remount report, the a2ui bridge's `identityDiff`). Layout ids are
31
+ * `blueprintLayoutIds`; `preservesBlueprintNodes` compares both.
32
+ */
33
+ export declare function blueprintNodeIds(blueprint: Blueprint): string[];
34
+ /**
35
+ * Every well-formed LAYOUT id in a blueprint (IR 2.4.0, ADR 0101), in pre-order, the root
36
+ * included. Absent and malformed ids are skipped. Duplicates are `validateBlueprint`'s job.
37
+ */
38
+ export declare function blueprintLayoutIds(blueprint: Blueprint): string[];
39
+ /**
40
+ * Which of `before`'s node ids survive into `after`.
41
+ *
42
+ * Two readings, one function:
43
+ * - *"did this revision keep the nodes it kept?"* — `before` is the previous tree;
44
+ * - *"does this variant contain the floor?"* — `before` is the floor's ids, and any finding
45
+ * is a floor violation. Nodes above the floor land in `added`, which is exactly right:
46
+ * a variant may add, never subtract.
47
+ *
48
+ * One pass over each side, `Set`-backed: O(|before| + |after|).
49
+ */
50
+ export declare function preservesNodes(before: Iterable<string>, after: Iterable<string>): IdentityReport;
51
+ /**
52
+ * `preservesNodes` over two blueprints — the common case, spelled once. Compares widget ids AND
53
+ * layout ids (IR 2.4.0, ADR 0101): they are one identity axis, so a re-identified container is a
54
+ * `dropped-node-id` finding rather than a silent loss of the state under it. A `before` with no
55
+ * layout ids (any pre-2.4.0 artifact) contributes none, so upgrading only adds to `added`.
56
+ */
57
+ export declare function preservesBlueprintNodes(before: Blueprint, after: Blueprint): IdentityReport;
58
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAA4B,MAAM,SAAS,CAAC;AA4BnE,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,CAAC;IAC9C;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AA2CD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,EAAE,CAI/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,EAAE,CAIjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,cAAc,CA0BhG;AAYD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,cAAc,CAE3F"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.blueprintNodeIds = blueprintNodeIds;
4
+ exports.blueprintLayoutIds = blueprintLayoutIds;
5
+ exports.preservesNodes = preservesNodes;
6
+ exports.preservesBlueprintNodes = preservesBlueprintNodes;
7
+ const layout_1 = require("./layout");
8
+ const normalize_1 = require("./normalize");
9
+ /**
10
+ * The one total, iterative, pre-order walk behind every id list below. `onWidget` sees each
11
+ * widget id; `onLayout` each WELL-FORMED layout id (IR 2.4.0, ADR 0101) — an absent or malformed
12
+ * one is skipped, exactly as a renderer treats it as absent.
13
+ */
14
+ function walkNodeIds(blueprint, onWidget, onLayout) {
15
+ // Iterative, matching `eachNode` in catalog.ts: a deep composed tree must not be able
16
+ // to blow the call stack.
17
+ //
18
+ // Length-driven, not `pop() !== undefined`: a blueprint is data an agent or a composer
19
+ // may have authored, so a layout child CAN legitimately be `undefined` (a malformed
20
+ // `cell(6, undefined)`, a hole from a revision) — and `stack.pop()` returns `undefined`
21
+ // both for "the stack is empty" and for "the next element IS `undefined`". A sentinel
22
+ // loop conflates the two and stops early, silently dropping every id not yet visited.
23
+ // Rejecting the hole is `validateBlueprint`'s job (`malformed-node`); this walk stays
24
+ // total and skips only the one non-object child.
25
+ const stack = [blueprint.layout];
26
+ while (stack.length > 0) {
27
+ const node = stack.pop();
28
+ if (typeof node !== "object" || node === null)
29
+ continue;
30
+ if ("_tag" in node && node._tag === "Widget") {
31
+ onWidget?.(node.id);
32
+ continue;
33
+ }
34
+ const layout = node;
35
+ if (!Array.isArray(layout.children))
36
+ continue;
37
+ if (onLayout !== undefined && (0, layout_1.hasLayoutId)(layout))
38
+ onLayout(layout.id);
39
+ for (let i = layout.children.length - 1; i >= 0; i--) {
40
+ stack.push(layout.type === "grid"
41
+ ? (0, normalize_1.asCell)(layout.children[i]).node
42
+ : layout.children[i]);
43
+ }
44
+ }
45
+ }
46
+ /**
47
+ * Every WIDGET id in a blueprint, in pre-order. Duplicates are `validateBlueprint`'s job.
48
+ *
49
+ * Widget-only by contract, also after IR 2.4.0: callers read its output as widget ids (a
50
+ * renderer's remount report, the a2ui bridge's `identityDiff`). Layout ids are
51
+ * `blueprintLayoutIds`; `preservesBlueprintNodes` compares both.
52
+ */
53
+ function blueprintNodeIds(blueprint) {
54
+ const ids = [];
55
+ walkNodeIds(blueprint, (id) => ids.push(id), undefined);
56
+ return ids;
57
+ }
58
+ /**
59
+ * Every well-formed LAYOUT id in a blueprint (IR 2.4.0, ADR 0101), in pre-order, the root
60
+ * included. Absent and malformed ids are skipped. Duplicates are `validateBlueprint`'s job.
61
+ */
62
+ function blueprintLayoutIds(blueprint) {
63
+ const ids = [];
64
+ walkNodeIds(blueprint, undefined, (id) => ids.push(id));
65
+ return ids;
66
+ }
67
+ /**
68
+ * Which of `before`'s node ids survive into `after`.
69
+ *
70
+ * Two readings, one function:
71
+ * - *"did this revision keep the nodes it kept?"* — `before` is the previous tree;
72
+ * - *"does this variant contain the floor?"* — `before` is the floor's ids, and any finding
73
+ * is a floor violation. Nodes above the floor land in `added`, which is exactly right:
74
+ * a variant may add, never subtract.
75
+ *
76
+ * One pass over each side, `Set`-backed: O(|before| + |after|).
77
+ */
78
+ function preservesNodes(before, after) {
79
+ const afterIds = new Set(after);
80
+ const findings = [];
81
+ const seen = new Set();
82
+ for (const id of before) {
83
+ // A repeated id in `before` is one node's worth of identity, so report it once —
84
+ // otherwise a duplicated id inflates the finding count for a single lost node.
85
+ if (seen.has(id))
86
+ continue;
87
+ seen.add(id);
88
+ if (!afterIds.has(id)) {
89
+ findings.push({
90
+ code: "dropped-node-id",
91
+ severity: "error",
92
+ nodeId: id,
93
+ message: `node "${id}" is present before the change and absent after — either it was removed, or a prop edit re-identified it (ids are derived from kind + props unless supplied explicitly)`,
94
+ });
95
+ }
96
+ }
97
+ const added = [];
98
+ for (const id of afterIds) {
99
+ if (!seen.has(id))
100
+ added.push(id);
101
+ }
102
+ return { ok: findings.length === 0, findings, added, compared: seen.size };
103
+ }
104
+ /** Widget ids and layout ids together, in one pre-order (document) walk. */
105
+ function allNodeIds(blueprint) {
106
+ const ids = [];
107
+ const push = (id) => {
108
+ ids.push(id);
109
+ };
110
+ walkNodeIds(blueprint, push, push);
111
+ return ids;
112
+ }
113
+ /**
114
+ * `preservesNodes` over two blueprints — the common case, spelled once. Compares widget ids AND
115
+ * layout ids (IR 2.4.0, ADR 0101): they are one identity axis, so a re-identified container is a
116
+ * `dropped-node-id` finding rather than a silent loss of the state under it. A `before` with no
117
+ * layout ids (any pre-2.4.0 artifact) contributes none, so upgrading only adds to `added`.
118
+ */
119
+ function preservesBlueprintNodes(before, after) {
120
+ return preservesNodes(allNodeIds(before), allNodeIds(after));
121
+ }
122
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":";;AAwGA,4CAIC;AAMD,gDAIC;AAaD,wCA0BC;AAkBD,0DAEC;AAjLD,qCAAuC;AACvC,2CAAqC;AAuDrC;;;;GAIG;AACH,SAAS,WAAW,CAClB,SAAoB,EACpB,QAA4C,EAC5C,QAA4C;IAE5C,sFAAsF;IACtF,0BAA0B;IAC1B,EAAE;IACF,uFAAuF;IACvF,oFAAoF;IACpF,wFAAwF;IACxF,sFAAsF;IACtF,sFAAsF;IACtF,sFAAsF;IACtF,iDAAiD;IACjD,MAAM,KAAK,GAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YAAE,SAAS;QACxD,IAAI,MAAM,IAAI,IAAI,IAAK,IAAe,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzD,QAAQ,EAAE,CAAE,IAAe,CAAC,EAAE,CAAC,CAAC;YAChC,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B,EAAE,KAAgB;IACzE,OAAO,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,24 @@
1
+ export { blueprint$ } from "./Blueprint";
2
+ export { grid, flex, stack, isLayoutId, isLayoutRole } from "./layout";
3
+ export { asCell, cell, upgradeBlueprint, blueprintIrVersion, isBindingStatus, isWidget, resolveWidgetStatus, IR_VERSION_LEGACY, } from "./normalize";
4
+ export { MetricCard, Timeline, ApprovalCard, StatusBadge, ProgressBar, DataTable, AlertCard, StreamingText, } from "./widgets";
5
+ export { customWidget$ } from "./customWidget";
6
+ export { BLUEPRINT_IR_SHAPE, BLUEPRINT_IR_VERSION } from "./irVersion";
7
+ export { validateBlueprint, defineWidgetCatalog, builtinCatalog, BUILTIN_CATALOG_ID, } from "./catalog";
8
+ export { catalogCoverage } from "./coverage";
9
+ export { blueprintLayoutIds, blueprintNodeIds, preservesBlueprintNodes, preservesNodes, } from "./identity";
10
+ export { blueprintPins, checkBlueprintPins } from "./pins";
11
+ export type { PinFinding, PinFindingCode, PinReport, VersionPins } from "@loomwork/core";
12
+ export { RendererRegistry } from "./RendererRegistry";
13
+ export { traverseBlueprint, resolveWidgetValue, resolvePath } from "./traverseBlueprint";
14
+ export { describeWidgetFrame, describeWidgetStatus } from "./widgetStatus";
15
+ export type { WidgetShownState, WidgetStatusDescriptor, WidgetStatusFrame, WidgetStatusMarker, WidgetValueCheck, } from "./widgetStatus";
16
+ export { traverseBlueprintAsync } from "./traverseBlueprintAsync";
17
+ export type { AsyncTraversalOptions, IncrementalRenderer, } from "./traverseBlueprintAsync";
18
+ export type { BindingState, BindingStatus, Blueprint, DataBinding, FlexLayout, GridCell, GridLayout, Layout, StackLayout, Widget, WidgetKind, WidgetSource, WidgetAction, WidgetRendererProps, } from "./types";
19
+ export type { DataClass } from "@loomwork/classify";
20
+ export type { ContainerContext, BlueprintTraversalOptions } from "./traverseBlueprint";
21
+ export type { CatalogEntry, WidgetCatalog, BlueprintFinding, BlueprintFindingCode, BlueprintValidation, } from "./catalog";
22
+ export type { CoverageReport } from "./coverage";
23
+ export type { IdentityFinding, IdentityReport } from "./identity";
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvE,OAAO,EACL,MAAM,EACN,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAI3D,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EACV,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,UAAU,EACV,QAAQ,EACR,UAAU,EACV,MAAM,EACN,WAAW,EACX,MAAM,EACN,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AACvF,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.traverseBlueprintAsync = exports.describeWidgetStatus = exports.describeWidgetFrame = exports.resolvePath = exports.resolveWidgetValue = exports.traverseBlueprint = exports.RendererRegistry = exports.checkBlueprintPins = exports.blueprintPins = exports.preservesNodes = exports.preservesBlueprintNodes = exports.blueprintNodeIds = exports.blueprintLayoutIds = exports.catalogCoverage = exports.BUILTIN_CATALOG_ID = exports.builtinCatalog = exports.defineWidgetCatalog = exports.validateBlueprint = exports.BLUEPRINT_IR_VERSION = exports.BLUEPRINT_IR_SHAPE = exports.customWidget$ = exports.StreamingText = exports.AlertCard = exports.DataTable = exports.ProgressBar = exports.StatusBadge = exports.ApprovalCard = exports.Timeline = exports.MetricCard = exports.IR_VERSION_LEGACY = exports.resolveWidgetStatus = exports.isWidget = exports.isBindingStatus = exports.blueprintIrVersion = exports.upgradeBlueprint = exports.cell = exports.asCell = exports.isLayoutRole = exports.isLayoutId = exports.stack = exports.flex = exports.grid = exports.blueprint$ = void 0;
4
+ var Blueprint_1 = require("./Blueprint");
5
+ Object.defineProperty(exports, "blueprint$", { enumerable: true, get: function () { return Blueprint_1.blueprint$; } });
6
+ var layout_1 = require("./layout");
7
+ Object.defineProperty(exports, "grid", { enumerable: true, get: function () { return layout_1.grid; } });
8
+ Object.defineProperty(exports, "flex", { enumerable: true, get: function () { return layout_1.flex; } });
9
+ Object.defineProperty(exports, "stack", { enumerable: true, get: function () { return layout_1.stack; } });
10
+ Object.defineProperty(exports, "isLayoutId", { enumerable: true, get: function () { return layout_1.isLayoutId; } });
11
+ Object.defineProperty(exports, "isLayoutRole", { enumerable: true, get: function () { return layout_1.isLayoutRole; } });
12
+ var normalize_1 = require("./normalize");
13
+ Object.defineProperty(exports, "asCell", { enumerable: true, get: function () { return normalize_1.asCell; } });
14
+ Object.defineProperty(exports, "cell", { enumerable: true, get: function () { return normalize_1.cell; } });
15
+ Object.defineProperty(exports, "upgradeBlueprint", { enumerable: true, get: function () { return normalize_1.upgradeBlueprint; } });
16
+ Object.defineProperty(exports, "blueprintIrVersion", { enumerable: true, get: function () { return normalize_1.blueprintIrVersion; } });
17
+ Object.defineProperty(exports, "isBindingStatus", { enumerable: true, get: function () { return normalize_1.isBindingStatus; } });
18
+ Object.defineProperty(exports, "isWidget", { enumerable: true, get: function () { return normalize_1.isWidget; } });
19
+ Object.defineProperty(exports, "resolveWidgetStatus", { enumerable: true, get: function () { return normalize_1.resolveWidgetStatus; } });
20
+ Object.defineProperty(exports, "IR_VERSION_LEGACY", { enumerable: true, get: function () { return normalize_1.IR_VERSION_LEGACY; } });
21
+ var widgets_1 = require("./widgets");
22
+ Object.defineProperty(exports, "MetricCard", { enumerable: true, get: function () { return widgets_1.MetricCard; } });
23
+ Object.defineProperty(exports, "Timeline", { enumerable: true, get: function () { return widgets_1.Timeline; } });
24
+ Object.defineProperty(exports, "ApprovalCard", { enumerable: true, get: function () { return widgets_1.ApprovalCard; } });
25
+ Object.defineProperty(exports, "StatusBadge", { enumerable: true, get: function () { return widgets_1.StatusBadge; } });
26
+ Object.defineProperty(exports, "ProgressBar", { enumerable: true, get: function () { return widgets_1.ProgressBar; } });
27
+ Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return widgets_1.DataTable; } });
28
+ Object.defineProperty(exports, "AlertCard", { enumerable: true, get: function () { return widgets_1.AlertCard; } });
29
+ Object.defineProperty(exports, "StreamingText", { enumerable: true, get: function () { return widgets_1.StreamingText; } });
30
+ var customWidget_1 = require("./customWidget");
31
+ Object.defineProperty(exports, "customWidget$", { enumerable: true, get: function () { return customWidget_1.customWidget$; } });
32
+ var irVersion_1 = require("./irVersion");
33
+ Object.defineProperty(exports, "BLUEPRINT_IR_SHAPE", { enumerable: true, get: function () { return irVersion_1.BLUEPRINT_IR_SHAPE; } });
34
+ Object.defineProperty(exports, "BLUEPRINT_IR_VERSION", { enumerable: true, get: function () { return irVersion_1.BLUEPRINT_IR_VERSION; } });
35
+ var catalog_1 = require("./catalog");
36
+ Object.defineProperty(exports, "validateBlueprint", { enumerable: true, get: function () { return catalog_1.validateBlueprint; } });
37
+ Object.defineProperty(exports, "defineWidgetCatalog", { enumerable: true, get: function () { return catalog_1.defineWidgetCatalog; } });
38
+ Object.defineProperty(exports, "builtinCatalog", { enumerable: true, get: function () { return catalog_1.builtinCatalog; } });
39
+ Object.defineProperty(exports, "BUILTIN_CATALOG_ID", { enumerable: true, get: function () { return catalog_1.BUILTIN_CATALOG_ID; } });
40
+ var coverage_1 = require("./coverage");
41
+ Object.defineProperty(exports, "catalogCoverage", { enumerable: true, get: function () { return coverage_1.catalogCoverage; } });
42
+ var identity_1 = require("./identity");
43
+ Object.defineProperty(exports, "blueprintLayoutIds", { enumerable: true, get: function () { return identity_1.blueprintLayoutIds; } });
44
+ Object.defineProperty(exports, "blueprintNodeIds", { enumerable: true, get: function () { return identity_1.blueprintNodeIds; } });
45
+ Object.defineProperty(exports, "preservesBlueprintNodes", { enumerable: true, get: function () { return identity_1.preservesBlueprintNodes; } });
46
+ Object.defineProperty(exports, "preservesNodes", { enumerable: true, get: function () { return identity_1.preservesNodes; } });
47
+ var pins_1 = require("./pins");
48
+ Object.defineProperty(exports, "blueprintPins", { enumerable: true, get: function () { return pins_1.blueprintPins; } });
49
+ Object.defineProperty(exports, "checkBlueprintPins", { enumerable: true, get: function () { return pins_1.checkBlueprintPins; } });
50
+ var RendererRegistry_1 = require("./RendererRegistry");
51
+ Object.defineProperty(exports, "RendererRegistry", { enumerable: true, get: function () { return RendererRegistry_1.RendererRegistry; } });
52
+ var traverseBlueprint_1 = require("./traverseBlueprint");
53
+ Object.defineProperty(exports, "traverseBlueprint", { enumerable: true, get: function () { return traverseBlueprint_1.traverseBlueprint; } });
54
+ Object.defineProperty(exports, "resolveWidgetValue", { enumerable: true, get: function () { return traverseBlueprint_1.resolveWidgetValue; } });
55
+ Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return traverseBlueprint_1.resolvePath; } });
56
+ var widgetStatus_1 = require("./widgetStatus");
57
+ Object.defineProperty(exports, "describeWidgetFrame", { enumerable: true, get: function () { return widgetStatus_1.describeWidgetFrame; } });
58
+ Object.defineProperty(exports, "describeWidgetStatus", { enumerable: true, get: function () { return widgetStatus_1.describeWidgetStatus; } });
59
+ var traverseBlueprintAsync_1 = require("./traverseBlueprintAsync");
60
+ Object.defineProperty(exports, "traverseBlueprintAsync", { enumerable: true, get: function () { return traverseBlueprintAsync_1.traverseBlueprintAsync; } });
61
+ //# sourceMappingURL=index.js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hF,sHAAA,iBAAiB,OAAA;AAAE,uHAAA,kBAAkB,OAAA;AAAE,gHAAA,WAAW,OAAA;AAC3D,+CAA2E;AAAlE,mHAAA,mBAAmB,OAAA;AAAE,oHAAA,oBAAoB,OAAA;AAQlD,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA"}
@@ -0,0 +1,23 @@
1
+ export declare const BLUEPRINT_IR_VERSION = "2.5.0";
2
+ /**
3
+ * The shape of the Blueprint IR at `BLUEPRINT_IR_VERSION`, as sorted key sets. Digest this
4
+ * (`fnv1a64(canonicalJson(BLUEPRINT_IR_SHAPE))`) to compare two builds' IR without a type checker.
5
+ */
6
+ export declare const BLUEPRINT_IR_SHAPE: {
7
+ readonly widget: readonly string[];
8
+ readonly dataBinding: readonly string[];
9
+ readonly bindingStatusRef: readonly string[];
10
+ readonly bindingStatus: readonly string[];
11
+ readonly bindingFinding: readonly string[];
12
+ readonly widgetSource: readonly string[];
13
+ readonly degradedFrom: readonly string[];
14
+ readonly gridCell: readonly string[];
15
+ readonly gridLayout: readonly string[];
16
+ readonly flexLayout: readonly string[];
17
+ readonly stackLayout: readonly string[];
18
+ readonly blueprint: readonly string[];
19
+ readonly widgetKinds: readonly string[];
20
+ readonly layoutTypes: readonly string[];
21
+ readonly bindingStates: readonly string[];
22
+ };
23
+ //# sourceMappingURL=irVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"irVersion.d.ts","sourceRoot":"","sources":["../src/irVersion.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,oBAAoB,UAAU,CAAC;AA2I5C;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAgBrB,CAAC"}