@pithyjs/vite-plugin 0.1.0-beta.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 (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +237 -0
  3. package/dist/aotCodegen/generateBindings.d.ts +184 -0
  4. package/dist/aotCodegen/generateBindings.d.ts.map +1 -0
  5. package/dist/aotCodegen/generateBindings.js +326 -0
  6. package/dist/aotCodegen/generateBindings.js.map +1 -0
  7. package/dist/aotCodegen/generateDomFactory.d.ts +59 -0
  8. package/dist/aotCodegen/generateDomFactory.d.ts.map +1 -0
  9. package/dist/aotCodegen/generateDomFactory.js +302 -0
  10. package/dist/aotCodegen/generateDomFactory.js.map +1 -0
  11. package/dist/aotCodegen/index.d.ts +18 -0
  12. package/dist/aotCodegen/index.d.ts.map +1 -0
  13. package/dist/aotCodegen/index.js +17 -0
  14. package/dist/aotCodegen/index.js.map +1 -0
  15. package/dist/aotCodegen/serializeNode.d.ts +74 -0
  16. package/dist/aotCodegen/serializeNode.d.ts.map +1 -0
  17. package/dist/aotCodegen/serializeNode.js +169 -0
  18. package/dist/aotCodegen/serializeNode.js.map +1 -0
  19. package/dist/aotCodegen/structuralCodegen.d.ts +38 -0
  20. package/dist/aotCodegen/structuralCodegen.d.ts.map +1 -0
  21. package/dist/aotCodegen/structuralCodegen.js +56 -0
  22. package/dist/aotCodegen/structuralCodegen.js.map +1 -0
  23. package/dist/aotCodegen/utils.d.ts +38 -0
  24. package/dist/aotCodegen/utils.d.ts.map +1 -0
  25. package/dist/aotCodegen/utils.js +48 -0
  26. package/dist/aotCodegen/utils.js.map +1 -0
  27. package/dist/babelPlugin/babelPlugin.d.ts +44 -0
  28. package/dist/babelPlugin/babelPlugin.d.ts.map +1 -0
  29. package/dist/babelPlugin/babelPlugin.js +392 -0
  30. package/dist/babelPlugin/babelPlugin.js.map +1 -0
  31. package/dist/babelPlugin/extractOriginalTagNames.d.ts +20 -0
  32. package/dist/babelPlugin/extractOriginalTagNames.d.ts.map +1 -0
  33. package/dist/babelPlugin/extractOriginalTagNames.js +44 -0
  34. package/dist/babelPlugin/extractOriginalTagNames.js.map +1 -0
  35. package/dist/babelPlugin/extractUsedIdentifiers.d.ts +26 -0
  36. package/dist/babelPlugin/extractUsedIdentifiers.d.ts.map +1 -0
  37. package/dist/babelPlugin/extractUsedIdentifiers.js +206 -0
  38. package/dist/babelPlugin/extractUsedIdentifiers.js.map +1 -0
  39. package/dist/buildPlugin/plugin.d.ts +79 -0
  40. package/dist/buildPlugin/plugin.d.ts.map +1 -0
  41. package/dist/buildPlugin/plugin.js +142 -0
  42. package/dist/buildPlugin/plugin.js.map +1 -0
  43. package/dist/designSystemPlugin/collector.d.ts +63 -0
  44. package/dist/designSystemPlugin/collector.d.ts.map +1 -0
  45. package/dist/designSystemPlugin/collector.js +175 -0
  46. package/dist/designSystemPlugin/collector.js.map +1 -0
  47. package/dist/designSystemPlugin/cssTokens.d.ts +34 -0
  48. package/dist/designSystemPlugin/cssTokens.d.ts.map +1 -0
  49. package/dist/designSystemPlugin/cssTokens.js +56 -0
  50. package/dist/designSystemPlugin/cssTokens.js.map +1 -0
  51. package/dist/designSystemPlugin/enumerate.d.ts +24 -0
  52. package/dist/designSystemPlugin/enumerate.d.ts.map +1 -0
  53. package/dist/designSystemPlugin/enumerate.js +430 -0
  54. package/dist/designSystemPlugin/enumerate.js.map +1 -0
  55. package/dist/designSystemPlugin/extractor.d.ts +95 -0
  56. package/dist/designSystemPlugin/extractor.d.ts.map +1 -0
  57. package/dist/designSystemPlugin/extractor.js +150 -0
  58. package/dist/designSystemPlugin/extractor.js.map +1 -0
  59. package/dist/designSystemPlugin/generator.d.ts +33 -0
  60. package/dist/designSystemPlugin/generator.d.ts.map +1 -0
  61. package/dist/designSystemPlugin/generator.js +256 -0
  62. package/dist/designSystemPlugin/generator.js.map +1 -0
  63. package/dist/designSystemPlugin/index.d.ts +18 -0
  64. package/dist/designSystemPlugin/index.d.ts.map +1 -0
  65. package/dist/designSystemPlugin/index.js +19 -0
  66. package/dist/designSystemPlugin/index.js.map +1 -0
  67. package/dist/designSystemPlugin/patterns/a11y.d.ts +19 -0
  68. package/dist/designSystemPlugin/patterns/a11y.d.ts.map +1 -0
  69. package/dist/designSystemPlugin/patterns/a11y.js +230 -0
  70. package/dist/designSystemPlugin/patterns/a11y.js.map +1 -0
  71. package/dist/designSystemPlugin/patterns/borders.d.ts +18 -0
  72. package/dist/designSystemPlugin/patterns/borders.d.ts.map +1 -0
  73. package/dist/designSystemPlugin/patterns/borders.js +474 -0
  74. package/dist/designSystemPlugin/patterns/borders.js.map +1 -0
  75. package/dist/designSystemPlugin/patterns/colors.d.ts +18 -0
  76. package/dist/designSystemPlugin/patterns/colors.d.ts.map +1 -0
  77. package/dist/designSystemPlugin/patterns/colors.js +134 -0
  78. package/dist/designSystemPlugin/patterns/colors.js.map +1 -0
  79. package/dist/designSystemPlugin/patterns/iconography.d.ts +18 -0
  80. package/dist/designSystemPlugin/patterns/iconography.d.ts.map +1 -0
  81. package/dist/designSystemPlugin/patterns/iconography.js +61 -0
  82. package/dist/designSystemPlugin/patterns/iconography.js.map +1 -0
  83. package/dist/designSystemPlugin/patterns/index.d.ts +22 -0
  84. package/dist/designSystemPlugin/patterns/index.d.ts.map +1 -0
  85. package/dist/designSystemPlugin/patterns/index.js +44 -0
  86. package/dist/designSystemPlugin/patterns/index.js.map +1 -0
  87. package/dist/designSystemPlugin/patterns/layout.d.ts +34 -0
  88. package/dist/designSystemPlugin/patterns/layout.d.ts.map +1 -0
  89. package/dist/designSystemPlugin/patterns/layout.js +917 -0
  90. package/dist/designSystemPlugin/patterns/layout.js.map +1 -0
  91. package/dist/designSystemPlugin/patterns/motion.d.ts +19 -0
  92. package/dist/designSystemPlugin/patterns/motion.d.ts.map +1 -0
  93. package/dist/designSystemPlugin/patterns/motion.js +162 -0
  94. package/dist/designSystemPlugin/patterns/motion.js.map +1 -0
  95. package/dist/designSystemPlugin/patterns/radius.d.ts +18 -0
  96. package/dist/designSystemPlugin/patterns/radius.d.ts.map +1 -0
  97. package/dist/designSystemPlugin/patterns/radius.js +107 -0
  98. package/dist/designSystemPlugin/patterns/radius.js.map +1 -0
  99. package/dist/designSystemPlugin/patterns/shadows.d.ts +19 -0
  100. package/dist/designSystemPlugin/patterns/shadows.d.ts.map +1 -0
  101. package/dist/designSystemPlugin/patterns/shadows.js +161 -0
  102. package/dist/designSystemPlugin/patterns/shadows.js.map +1 -0
  103. package/dist/designSystemPlugin/patterns/smartContainer.d.ts +18 -0
  104. package/dist/designSystemPlugin/patterns/smartContainer.d.ts.map +1 -0
  105. package/dist/designSystemPlugin/patterns/smartContainer.js +96 -0
  106. package/dist/designSystemPlugin/patterns/smartContainer.js.map +1 -0
  107. package/dist/designSystemPlugin/patterns/spacing.d.ts +18 -0
  108. package/dist/designSystemPlugin/patterns/spacing.d.ts.map +1 -0
  109. package/dist/designSystemPlugin/patterns/spacing.js +333 -0
  110. package/dist/designSystemPlugin/patterns/spacing.js.map +1 -0
  111. package/dist/designSystemPlugin/patterns/typography.d.ts +18 -0
  112. package/dist/designSystemPlugin/patterns/typography.d.ts.map +1 -0
  113. package/dist/designSystemPlugin/patterns/typography.js +416 -0
  114. package/dist/designSystemPlugin/patterns/typography.js.map +1 -0
  115. package/dist/designSystemPlugin/plugin.d.ts +39 -0
  116. package/dist/designSystemPlugin/plugin.d.ts.map +1 -0
  117. package/dist/designSystemPlugin/plugin.js +351 -0
  118. package/dist/designSystemPlugin/plugin.js.map +1 -0
  119. package/dist/designSystemPlugin/types.d.ts +156 -0
  120. package/dist/designSystemPlugin/types.d.ts.map +1 -0
  121. package/dist/designSystemPlugin/types.js +49 -0
  122. package/dist/designSystemPlugin/types.js.map +1 -0
  123. package/dist/htmlTransform/htmlTransform.d.ts +47 -0
  124. package/dist/htmlTransform/htmlTransform.d.ts.map +1 -0
  125. package/dist/htmlTransform/htmlTransform.js +86 -0
  126. package/dist/htmlTransform/htmlTransform.js.map +1 -0
  127. package/dist/iconsPlugin/index.d.ts +18 -0
  128. package/dist/iconsPlugin/index.d.ts.map +1 -0
  129. package/dist/iconsPlugin/index.js +17 -0
  130. package/dist/iconsPlugin/index.js.map +1 -0
  131. package/dist/iconsPlugin/optimize.d.ts +54 -0
  132. package/dist/iconsPlugin/optimize.d.ts.map +1 -0
  133. package/dist/iconsPlugin/optimize.js +253 -0
  134. package/dist/iconsPlugin/optimize.js.map +1 -0
  135. package/dist/iconsPlugin/plugin.d.ts +49 -0
  136. package/dist/iconsPlugin/plugin.d.ts.map +1 -0
  137. package/dist/iconsPlugin/plugin.js +242 -0
  138. package/dist/iconsPlugin/plugin.js.map +1 -0
  139. package/dist/iconsPlugin/types.d.ts +49 -0
  140. package/dist/iconsPlugin/types.d.ts.map +1 -0
  141. package/dist/iconsPlugin/types.js +30 -0
  142. package/dist/iconsPlugin/types.js.map +1 -0
  143. package/dist/index.d.ts +31 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +37 -0
  146. package/dist/index.js.map +1 -0
  147. package/dist/pithyPlugin/plugin.d.ts +38 -0
  148. package/dist/pithyPlugin/plugin.d.ts.map +1 -0
  149. package/dist/pithyPlugin/plugin.js +119 -0
  150. package/dist/pithyPlugin/plugin.js.map +1 -0
  151. package/dist/routerPlugin/manifest.d.ts +33 -0
  152. package/dist/routerPlugin/manifest.d.ts.map +1 -0
  153. package/dist/routerPlugin/manifest.js +223 -0
  154. package/dist/routerPlugin/manifest.js.map +1 -0
  155. package/dist/routerPlugin/plugin.d.ts +51 -0
  156. package/dist/routerPlugin/plugin.d.ts.map +1 -0
  157. package/dist/routerPlugin/plugin.js +164 -0
  158. package/dist/routerPlugin/plugin.js.map +1 -0
  159. package/dist/routerPlugin/scanner.d.ts +69 -0
  160. package/dist/routerPlugin/scanner.d.ts.map +1 -0
  161. package/dist/routerPlugin/scanner.js +290 -0
  162. package/dist/routerPlugin/scanner.js.map +1 -0
  163. package/dist/ssrPlugin/plugin.d.ts +76 -0
  164. package/dist/ssrPlugin/plugin.d.ts.map +1 -0
  165. package/dist/ssrPlugin/plugin.js +439 -0
  166. package/dist/ssrPlugin/plugin.js.map +1 -0
  167. package/package.json +57 -0
@@ -0,0 +1,302 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.aot.generate-dom-factory",
4
+ "title": "AOT DOM Factory Generator",
5
+ "category": "compiler",
6
+ "description": "Generates a DOM factory function from parsed template nodes, producing static HTML with binding placeholders.",
7
+ "since": "0.0.1",
8
+ "stability": "experimental",
9
+ "testing": {
10
+ "unit": { "required": true, "covered": true, "file": "aotCodegen.test.ts" },
11
+ "integration": { "required": false, "covered": false },
12
+ "e2e": { "required": false, "covered": false }
13
+ }
14
+ }
15
+ */
16
+ import { createSerializeContext, serializeNode, } from './serializeNode';
17
+ import { generateBindings, serializeBindings, } from './generateBindings';
18
+ import { collectIfChain, stripStructuralDirective, isDefaultCase, } from './structuralCodegen';
19
+ import { escapeJS } from './utils';
20
+ /**
21
+ * Generate AOT code from a PithyNode tree.
22
+ *
23
+ * Produces:
24
+ * 1. Sub-factory code for structural directives (@if branches, @for bodies, @switch cases)
25
+ * 2. A bindings descriptor array (const __b_{hash} = [...])
26
+ * 3. A DOM factory function (function __f_{hash}(__ctx) { ... })
27
+ *
28
+ * The factory creates DOM nodes via createElement/createTextNode,
29
+ * sets static attributes, and calls __applyBindings with the
30
+ * pre-extracted descriptors.
31
+ *
32
+ * Structural directives generate sub-factory functions (via recursive calls)
33
+ * and comment placeholders in the parent factory. Sub-factory code is prepended
34
+ * to the output so function references resolve correctly.
35
+ *
36
+ * **Phase 5 gap:** AOT factories do not set runtime-only DOM properties that
37
+ * `pithyTreeToDom` assigns (`__pithyCtx`, `__pithyNode`, `__nodeId`,
38
+ * `__slotName`, `__fallbackFactory`). Phase 5's `applyBindings()` will need
39
+ * to set these on the factory-created DOM before wiring reactive effects.
40
+ *
41
+ * @param nodes - Parsed PithyNode tree (from parse5ToPithyTree)
42
+ * @param hash - Unique identifier for this template (used in names)
43
+ * @param scopeId - CSS scope ID (e.g. "pithy-abc123")
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const result = generateDomFactory(pithyNodes, 'a7f3', 'pithy-abc');
48
+ * // result.code contains the full factory + bindings code
49
+ * // result.factoryName is "__f_a7f3"
50
+ * ```
51
+ */
52
+ /** @codexApi {"parent":"pithy.aot.generate-dom-factory","name":"generateDomFactory","stability":"experimental","signature":"(nodes: PithyNode[], hash: string, scopeId?: string) => AotCodegenResult"} */
53
+ export function generateDomFactory(nodes, hash, scopeId) {
54
+ // Validate scopeId — it's interpolated into an attribute name (data-scope-{id}),
55
+ // so it must contain only characters valid in HTML attribute names.
56
+ if (scopeId && !/^[a-zA-Z0-9_-]+$/.test(scopeId)) {
57
+ throw new Error(`AOT: invalid scopeId "${scopeId}" — must contain only alphanumeric, hyphen, or underscore characters.`);
58
+ }
59
+ // Sanitize hash to ensure valid JS identifiers (replace non-alphanumeric with _)
60
+ const safeHash = hash.replace(/[^a-zA-Z0-9_$]/g, '_');
61
+ const factoryName = `__f_${safeHash}`;
62
+ const bindingsName = `__b_${safeHash}`;
63
+ // Accumulate sub-factory code blocks (emitted before this factory)
64
+ const subFactoryCodeBlocks = [];
65
+ // Accumulate structural descriptors (merged with Phase 1 descriptors)
66
+ const structuralDescriptors = [];
67
+ // Generate DOM factory body
68
+ const ctx = createSerializeContext(scopeId);
69
+ // Process all nodes recursively, handling structural directives at every level
70
+ const topLevelVarNames = processNodes(nodes, ctx, safeHash, scopeId, subFactoryCodeBlocks, structuralDescriptors);
71
+ // Generate Phase 1 binding descriptors (non-structural)
72
+ const phase1Descriptors = generateBindings(nodes);
73
+ // Merge all descriptors: structural first, then Phase 1
74
+ const allDescriptors = [...structuralDescriptors, ...phase1Descriptors];
75
+ const bindingsCode = serializeBindings(allDescriptors);
76
+ // Build factory function body
77
+ const bodyLines = [];
78
+ bodyLines.push(`const f=document.createDocumentFragment();`);
79
+ // Add all serialized node creation code
80
+ bodyLines.push(...ctx.lines);
81
+ // Append top-level nodes to fragment
82
+ if (topLevelVarNames.length === 1) {
83
+ bodyLines.push(`f.appendChild(${topLevelVarNames[0]});`);
84
+ }
85
+ else if (topLevelVarNames.length > 1) {
86
+ bodyLines.push(`f.append(${topLevelVarNames.join(',')});`);
87
+ }
88
+ // Return with applied bindings (or just the fragment if no bindings)
89
+ if (allDescriptors.length > 0) {
90
+ bodyLines.push(`return __applyBindings(f,${bindingsName},__ctx);`);
91
+ }
92
+ else {
93
+ bodyLines.push(`return {el:f,destroy:function(){}};`);
94
+ }
95
+ // Assemble final code: sub-factories first, then this factory
96
+ const codeLines = [];
97
+ // Sub-factory code blocks (from structural directives)
98
+ for (const block of subFactoryCodeBlocks) {
99
+ codeLines.push(block);
100
+ }
101
+ // Bindings constant (only if non-empty)
102
+ if (allDescriptors.length > 0) {
103
+ codeLines.push(`const ${bindingsName}=${bindingsCode};`);
104
+ }
105
+ // Factory function
106
+ codeLines.push(`function ${factoryName}(__ctx){`);
107
+ codeLines.push(...bodyLines);
108
+ codeLines.push(`}`);
109
+ return {
110
+ code: codeLines.join('\n'),
111
+ factoryName,
112
+ bindingsName,
113
+ };
114
+ }
115
+ // ─── Internal: recursive tree processing with structural awareness ───────────
116
+ /**
117
+ * Process an array of sibling nodes, handling structural directives at every level.
118
+ * Returns the varNames of the processed top-level nodes (for parent.append()).
119
+ *
120
+ * This function replaces the simple for-of loop over serializeNode calls.
121
+ * It detects structural directives (which span siblings for @if chains)
122
+ * and delegates to sub-factory generation, creating comment placeholders
123
+ * in the current factory for the structural nodes.
124
+ *
125
+ * For non-structural elements, it serializes the element shell (no children)
126
+ * via serializeNode, then recursively processes children here.
127
+ */
128
+ function processNodes(nodes, ctx, safeHash, scopeId, subFactoryCodeBlocks, structuralDescriptors) {
129
+ const varNames = [];
130
+ for (let i = 0; i < nodes.length; i++) {
131
+ const node = nodes[i];
132
+ // ─── @if/@else-if/@else chain ────────────────────────────────────
133
+ if (node.type === 'element' && node.directives?.if !== undefined) {
134
+ const chain = collectIfChain(nodes, i);
135
+ const pid = node.nodeId ?? `_${i}`;
136
+ i += chain.length - 1; // Skip consumed siblings
137
+ // Generate sub-factory for each branch
138
+ const branches = [];
139
+ for (let b = 0; b < chain.length; b++) {
140
+ const branchNode = chain[b];
141
+ const branchHash = `${safeHash}_if_${pid}_${b}`;
142
+ const stripped = stripStructuralDirective(branchNode);
143
+ const sub = generateDomFactory([stripped], branchHash, scopeId);
144
+ subFactoryCodeBlocks.push(sub.code);
145
+ const branch = {
146
+ factory: sub.factoryName,
147
+ };
148
+ if (branchNode.directives?.if !== undefined)
149
+ branch.expr = branchNode.directives.if;
150
+ else if (branchNode.directives?.elseIf !== undefined)
151
+ branch.expr = branchNode.directives.elseIf;
152
+ branches.push(branch);
153
+ }
154
+ // Emit comment placeholder
155
+ const commentVar = `c${ctx.commentCount++}`;
156
+ ctx.lines.push(`const ${commentVar}=document.createComment('if:${escapeJS(pid)}');`);
157
+ varNames.push(commentVar);
158
+ structuralDescriptors.push({ t: 'if', pid, branches });
159
+ continue;
160
+ }
161
+ // ─── Orphaned @else-if, @else, @case, @default ────────────────────
162
+ if (node.type === 'element' &&
163
+ (node.directives?.elseIf !== undefined ||
164
+ node.directives?.else !== undefined ||
165
+ node.directives?.case !== undefined ||
166
+ isDefaultCase(node))) {
167
+ continue;
168
+ }
169
+ // ─── @for loop ───────────────────────────────────────────────────
170
+ if (node.type === 'element' && node.directives?.for) {
171
+ const pid = node.nodeId ?? `_${i}`;
172
+ const forHash = `${safeHash}_for_${pid}`;
173
+ const stripped = stripStructuralDirective(node);
174
+ const sub = generateDomFactory([stripped], forHash, scopeId);
175
+ subFactoryCodeBlocks.push(sub.code);
176
+ const commentVar = `c${ctx.commentCount++}`;
177
+ ctx.lines.push(`const ${commentVar}=document.createComment('for:${escapeJS(pid)}');`);
178
+ varNames.push(commentVar);
179
+ const forDir = node.directives.for;
180
+ const desc = {
181
+ t: 'for',
182
+ pid,
183
+ item: forDir.itemVar,
184
+ expr: forDir.collectionExpr,
185
+ factory: sub.factoryName,
186
+ };
187
+ if (forDir.indexVar)
188
+ desc.index = forDir.indexVar;
189
+ if (forDir.trackBy)
190
+ desc.trackBy = forDir.trackBy;
191
+ structuralDescriptors.push(desc);
192
+ continue;
193
+ }
194
+ // ─── @switch block ───────────────────────────────────────────────
195
+ if (node.type === 'element' && node.directives?.switch !== undefined) {
196
+ const pid = node.nodeId ?? `_${i}`;
197
+ // Ensure the original node has nodeId so generateBindings can find it too
198
+ if (!node.nodeId)
199
+ node.nodeId = pid;
200
+ // Serialize the switch container (without children, without @switch directive).
201
+ // nodeId is guaranteed set above, so data-pid is always emitted.
202
+ const switchShell = {
203
+ ...node,
204
+ children: [],
205
+ directives: stripSwitchDirective(node.directives),
206
+ };
207
+ const shellResult = serializeNode(switchShell, ctx);
208
+ if (shellResult)
209
+ varNames.push(shellResult.varName);
210
+ // Generate sub-factory for each @case/@default child
211
+ const cases = [];
212
+ for (let c = 0; c < (node.children ?? []).length; c++) {
213
+ const caseNode = node.children[c];
214
+ if (caseNode.type !== 'element')
215
+ continue;
216
+ if (caseNode.directives?.case === undefined && !isDefaultCase(caseNode))
217
+ continue;
218
+ const caseHash = `${safeHash}_sw_${pid}_${c}`;
219
+ const stripped = stripStructuralDirective(caseNode);
220
+ const sub = generateDomFactory([stripped], caseHash, scopeId);
221
+ subFactoryCodeBlocks.push(sub.code);
222
+ const caseDesc = {
223
+ factory: sub.factoryName,
224
+ };
225
+ if (caseNode.directives?.case !== undefined)
226
+ caseDesc.val = caseNode.directives.case;
227
+ cases.push(caseDesc);
228
+ }
229
+ structuralDescriptors.push({
230
+ t: 'switch',
231
+ pid,
232
+ expr: node.directives.switch,
233
+ cases,
234
+ });
235
+ continue;
236
+ }
237
+ // ─── Text nodes ─────────────────────────────────────────────────
238
+ if (node.type === 'text') {
239
+ const result = serializeNode(node, ctx);
240
+ if (result)
241
+ varNames.push(result.varName);
242
+ continue;
243
+ }
244
+ // ─── Slot nodes (content projection) ─────────────────────────────
245
+ if (node.type === 'slot') {
246
+ const slotName = node.slotName ?? '';
247
+ const pid = node.nodeId ?? `_slot_${ctx.commentCount}`;
248
+ // Emit comment anchor for the slot
249
+ const commentVar = `c${ctx.commentCount++}`;
250
+ ctx.lines.push(`const ${commentVar}=document.createComment('slot:${escapeJS(slotName)}');`);
251
+ varNames.push(commentVar);
252
+ // Build projection descriptor
253
+ const projDesc = {
254
+ t: 'proj',
255
+ pid,
256
+ name: slotName,
257
+ };
258
+ // Generate sub-factory for fallback content if present
259
+ if (node.fallbackChildren && node.fallbackChildren.length > 0) {
260
+ const fbHash = `${safeHash}_slot_${pid}`;
261
+ const sub = generateDomFactory(node.fallbackChildren, fbHash, scopeId);
262
+ subFactoryCodeBlocks.push(sub.code);
263
+ projDesc.fallback = sub.factoryName;
264
+ }
265
+ structuralDescriptors.push(projDesc);
266
+ continue;
267
+ }
268
+ // ─── Regular element (no structural directive on THIS node) ──────
269
+ // Serialize element shell (without children) via serializeNode,
270
+ // then process children recursively with structural awareness.
271
+ if (node.type === 'element') {
272
+ const shell = { ...node, children: [] };
273
+ const result = serializeNode(shell, ctx);
274
+ if (!result)
275
+ continue;
276
+ // Recursively process children (handles nested structural directives)
277
+ const childVarNames = processNodes(node.children ?? [], ctx, safeHash, scopeId, subFactoryCodeBlocks, structuralDescriptors);
278
+ // Append children to this element
279
+ if (childVarNames.length === 1) {
280
+ ctx.lines.push(`${result.varName}.appendChild(${childVarNames[0]});`);
281
+ }
282
+ else if (childVarNames.length > 1) {
283
+ ctx.lines.push(`${result.varName}.append(${childVarNames.join(',')});`);
284
+ }
285
+ varNames.push(result.varName);
286
+ continue;
287
+ }
288
+ }
289
+ return varNames;
290
+ }
291
+ /**
292
+ * Remove the `switch` field from a ParsedDirectives object.
293
+ * Used to serialize the switch container element without the @switch directive
294
+ * (since the directive is captured in the SwitchDescriptor instead).
295
+ */
296
+ function stripSwitchDirective(d) {
297
+ const { switch: _switch, ...rest } = d;
298
+ return Object.keys(rest).length > 0
299
+ ? rest
300
+ : undefined;
301
+ }
302
+ //# sourceMappingURL=generateDomFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateDomFactory.js","sourceRoot":"","sources":["../../src/aotCodegen/generateDomFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAGF,OAAO,EACL,sBAAsB,EACtB,aAAa,GAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,GAMlB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAWnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,0MAA0M;AAC1M,MAAM,UAAU,kBAAkB,CAChC,KAAkB,EAClB,IAAY,EACZ,OAAgB;IAEhB,iFAAiF;IACjF,oEAAoE;IACpE,IAAI,OAAO,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACjD,MAAM,IAAI,KAAK,CACb,yBAAyB,OAAO,uEAAuE,CACxG,CAAC;IACJ,CAAC;IAED,iFAAiF;IACjF,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,OAAO,QAAQ,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,OAAO,QAAQ,EAAE,CAAC;IAEvC,mEAAmE;IACnE,MAAM,oBAAoB,GAAa,EAAE,CAAC;IAE1C,sEAAsE;IACtE,MAAM,qBAAqB,GAAwB,EAAE,CAAC;IAEtD,4BAA4B;IAC5B,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAE5C,+EAA+E;IAC/E,MAAM,gBAAgB,GAAG,YAAY,CACnC,KAAK,EACL,GAAG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AAO,gBAAgB,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACxE,CAAC;iBAAM,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1E,CAAC;YAED,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC9B,SAAS;QACX,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAC3B,CAAuC;IAEvC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;QACjC,CAAC,CAAE,IAAgC;QACnC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.aot.codegen",
4
+ "title": "AOT Template Codegen",
5
+ "category": "compiler",
6
+ "description": "Public entry point for the AOT template code generation pipeline, re-exporting DOM factory, bindings, and serialization.",
7
+ "since": "0.0.1",
8
+ "stability": "experimental",
9
+ "testing": {
10
+ "unit": { "required": true, "covered": true, "file": "aotCodegen.test.ts" },
11
+ "integration": { "required": true, "covered": true, "file": "integration.test.ts" },
12
+ "e2e": { "required": false, "covered": false }
13
+ }
14
+ }
15
+ */
16
+ export { generateDomFactory } from './generateDomFactory';
17
+ export type { AotCodegenResult } from './generateDomFactory';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aotCodegen/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.aot.codegen",
4
+ "title": "AOT Template Codegen",
5
+ "category": "compiler",
6
+ "description": "Public entry point for the AOT template code generation pipeline, re-exporting DOM factory, bindings, and serialization.",
7
+ "since": "0.0.1",
8
+ "stability": "experimental",
9
+ "testing": {
10
+ "unit": { "required": true, "covered": true, "file": "aotCodegen.test.ts" },
11
+ "integration": { "required": true, "covered": true, "file": "integration.test.ts" },
12
+ "e2e": { "required": false, "covered": false }
13
+ }
14
+ }
15
+ */
16
+ export { generateDomFactory } from './generateDomFactory';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/aotCodegen/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,74 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.aot.serialize-node",
4
+ "title": "AOT Node Serializer",
5
+ "category": "compiler",
6
+ "description": "Serializes parsed template nodes into static HTML strings with marker comments for dynamic binding points.",
7
+ "since": "0.0.1",
8
+ "stability": "experimental",
9
+ "testing": {
10
+ "unit": { "required": true, "covered": true, "file": "aotCodegen.test.ts" },
11
+ "integration": { "required": false, "covered": false },
12
+ "e2e": { "required": false, "covered": false }
13
+ }
14
+ }
15
+ */
16
+ import type { PithyNode } from '../../../compiler/src/parse/types';
17
+ /** Tracks variable counters during a single factory generation pass. */
18
+ export interface SerializeContext {
19
+ /** Next element variable index (e0, e1, ...) */
20
+ elementCount: number;
21
+ /** Next text node variable index (t0, t1, ...) */
22
+ textCount: number;
23
+ /** Next comment variable index (c0, c1, ...) */
24
+ commentCount: number;
25
+ /** Scope ID for data-scope-{id} attributes (e.g. "pithy-abc123") */
26
+ scopeId?: string;
27
+ /** Accumulated lines of JS code */
28
+ lines: string[];
29
+ }
30
+ /** Result of serializing a single node. */
31
+ export interface SerializedNode {
32
+ /** Variable name assigned to this DOM node (e.g. "e0", "t3") */
33
+ varName: string;
34
+ /** Variable names of direct children (for parent.append(...children)) */
35
+ childVarNames: string[];
36
+ }
37
+ /**
38
+ * Create a fresh serialize context for a single factory generation pass.
39
+ *
40
+ * The context accumulates JS code lines and tracks variable counters
41
+ * across recursive `serializeNode` calls. Each factory should use
42
+ * its own context.
43
+ *
44
+ * @param scopeId - Optional CSS scope ID (e.g. "pithy-abc123").
45
+ * When provided, every element gets a `data-scope-{scopeId}` attribute.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const ctx = createSerializeContext('pithy-abc123');
50
+ * serializeNode(rootNode, ctx);
51
+ * console.log(ctx.lines); // ["const e0=document.createElement('div');", ...]
52
+ * ```
53
+ */
54
+ /** @codexApi {"parent":"pithy.aot.serialize-node","name":"createSerializeContext","stability":"experimental","signature":"(scopeId?: string) => SerializeContext"} */
55
+ export declare function createSerializeContext(scopeId?: string): SerializeContext;
56
+ /**
57
+ * Serialize a single PithyNode into JS code that creates the corresponding
58
+ * DOM node. Appends code lines to `ctx.lines` and returns the variable name.
59
+ *
60
+ * Phase 1 scope: elements, text nodes.
61
+ * Skips directive attributes (@, []) — those become binding descriptors.
62
+ * Throws on structural directives (@for, @if, @switch) — those are Phase 2.
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * const ctx = createSerializeContext('pithy-abc123');
67
+ * const result = serializeNode(node, ctx);
68
+ * // ctx.lines now contains JS code lines
69
+ * // result.varName is e.g. "e0"
70
+ * ```
71
+ */
72
+ /** @codexApi {"parent":"pithy.aot.serialize-node","name":"serializeNode","stability":"experimental","signature":"(node: PithyNode, ctx: SerializeContext) => SerializedNode | null"} */
73
+ export declare function serializeNode(node: PithyNode, ctx: SerializeContext): SerializedNode | null;
74
+ //# sourceMappingURL=serializeNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializeNode.d.ts","sourceRoot":"","sources":["../../src/aotCodegen/serializeNode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAInE,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,2CAA2C;AAC3C,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,sKAAsK;AACtK,wBAAgB,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAQzE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wLAAwL;AACxL,wBAAgB,aAAa,CAC3B,IAAI,EAAE,SAAS,EACf,GAAG,EAAE,gBAAgB,GACpB,cAAc,GAAG,IAAI,CAWvB"}
@@ -0,0 +1,169 @@
1
+ /** @codex
2
+ {
3
+ "id": "pithy.aot.serialize-node",
4
+ "title": "AOT Node Serializer",
5
+ "category": "compiler",
6
+ "description": "Serializes parsed template nodes into static HTML strings with marker comments for dynamic binding points.",
7
+ "since": "0.0.1",
8
+ "stability": "experimental",
9
+ "testing": {
10
+ "unit": { "required": true, "covered": true, "file": "aotCodegen.test.ts" },
11
+ "integration": { "required": false, "covered": false },
12
+ "e2e": { "required": false, "covered": false }
13
+ }
14
+ }
15
+ */
16
+ import { SVG_TAGS, SVG_NS } from '../../../compiler/src/constants';
17
+ import { escapeJS } from './utils';
18
+ /**
19
+ * Create a fresh serialize context for a single factory generation pass.
20
+ *
21
+ * The context accumulates JS code lines and tracks variable counters
22
+ * across recursive `serializeNode` calls. Each factory should use
23
+ * its own context.
24
+ *
25
+ * @param scopeId - Optional CSS scope ID (e.g. "pithy-abc123").
26
+ * When provided, every element gets a `data-scope-{scopeId}` attribute.
27
+ *
28
+ * @example
29
+ * ```typescript
30
+ * const ctx = createSerializeContext('pithy-abc123');
31
+ * serializeNode(rootNode, ctx);
32
+ * console.log(ctx.lines); // ["const e0=document.createElement('div');", ...]
33
+ * ```
34
+ */
35
+ /** @codexApi {"parent":"pithy.aot.serialize-node","name":"createSerializeContext","stability":"experimental","signature":"(scopeId?: string) => SerializeContext"} */
36
+ export function createSerializeContext(scopeId) {
37
+ return {
38
+ elementCount: 0,
39
+ textCount: 0,
40
+ commentCount: 0,
41
+ scopeId,
42
+ lines: [],
43
+ };
44
+ }
45
+ /**
46
+ * Serialize a single PithyNode into JS code that creates the corresponding
47
+ * DOM node. Appends code lines to `ctx.lines` and returns the variable name.
48
+ *
49
+ * Phase 1 scope: elements, text nodes.
50
+ * Skips directive attributes (@, []) — those become binding descriptors.
51
+ * Throws on structural directives (@for, @if, @switch) — those are Phase 2.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const ctx = createSerializeContext('pithy-abc123');
56
+ * const result = serializeNode(node, ctx);
57
+ * // ctx.lines now contains JS code lines
58
+ * // result.varName is e.g. "e0"
59
+ * ```
60
+ */
61
+ /** @codexApi {"parent":"pithy.aot.serialize-node","name":"serializeNode","stability":"experimental","signature":"(node: PithyNode, ctx: SerializeContext) => SerializedNode | null"} */
62
+ export function serializeNode(node, ctx) {
63
+ if (node.type === 'text') {
64
+ return serializeTextNode(node, ctx);
65
+ }
66
+ if (node.type === 'element') {
67
+ return serializeElementNode(node, ctx);
68
+ }
69
+ // Slot nodes are handled by processNodes in generateDomFactory.ts — they should not reach here.
70
+ return null;
71
+ }
72
+ function serializeTextNode(node, ctx) {
73
+ const varName = `t${ctx.textCount++}`;
74
+ const content = node.textContent ?? '';
75
+ ctx.lines.push(`const ${varName}=document.createTextNode('${escapeJS(content)}');`);
76
+ return { varName, childVarNames: [] };
77
+ }
78
+ function serializeElementNode(node, ctx) {
79
+ // Guard: structural directives are not supported in Phase 1
80
+ assertNoStructuralDirectives(node);
81
+ const varName = `e${ctx.elementCount++}`;
82
+ const tag = node.originalTagName ?? node.tagName ?? 'div';
83
+ const tagLower = tag.toLowerCase();
84
+ // Create element (SVG vs HTML namespace)
85
+ if (SVG_TAGS.has(tagLower)) {
86
+ ctx.lines.push(`const ${varName}=document.createElementNS('${SVG_NS}','${escapeJS(tag)}');`);
87
+ }
88
+ else {
89
+ ctx.lines.push(`const ${varName}=document.createElement('${escapeJS(tag)}');`);
90
+ }
91
+ // Set static attributes (skip directive attrs, data-pid, and slot which are set separately)
92
+ for (const [name, value] of Object.entries(node.attrs ?? {})) {
93
+ if (name.startsWith('@') ||
94
+ name.startsWith('[') ||
95
+ name === 'data-pid' ||
96
+ name === 'slot')
97
+ continue;
98
+ // Use original casing (important for SVG attrs like viewBox)
99
+ const originalName = node.originalAttrs?.[name] || name;
100
+ ctx.lines.push(`${varName}.setAttribute('${escapeJS(originalName)}','${escapeJS(value)}');`);
101
+ }
102
+ // Phase 5's applyBindings() reads from descriptors only — directive data-*
103
+ // attributes (data-on-click, data-bind-*, data-class-toggle-*, etc.) are NOT
104
+ // emitted in AOT output. They were transitional scaffolding removed in Phase 6.
105
+ //
106
+ // Slot assignment is still needed as a regular HTML attribute so the runtime
107
+ // binder can collect slot content from DOM children.
108
+ if (node.directives?.slot !== undefined) {
109
+ ctx.lines.push(`${varName}.setAttribute('slot','${escapeJS(node.directives.slot)}');`);
110
+ }
111
+ // Set scope ID attribute
112
+ if (ctx.scopeId) {
113
+ ctx.lines.push(`${varName}.setAttribute('data-scope-${escapeJS(ctx.scopeId)}','');`);
114
+ }
115
+ // Set data-pid for binding resolution (after directives, matching runtime order)
116
+ if (node.nodeId) {
117
+ ctx.lines.push(`${varName}.setAttribute('data-pid','${escapeJS(node.nodeId)}');`);
118
+ }
119
+ else if (node.attrs?.['data-pid']) {
120
+ ctx.lines.push(`${varName}.setAttribute('data-pid','${escapeJS(node.attrs['data-pid'])}');`);
121
+ }
122
+ // Recursively serialize children
123
+ const childVarNames = [];
124
+ for (const child of node.children ?? []) {
125
+ const childResult = serializeNode(child, ctx);
126
+ if (childResult) {
127
+ childVarNames.push(childResult.varName);
128
+ }
129
+ }
130
+ // Append children to this element
131
+ if (childVarNames.length === 1) {
132
+ ctx.lines.push(`${varName}.appendChild(${childVarNames[0]});`);
133
+ }
134
+ else if (childVarNames.length > 1) {
135
+ ctx.lines.push(`${varName}.append(${childVarNames.join(',')});`);
136
+ }
137
+ return { varName, childVarNames };
138
+ }
139
+ /**
140
+ * Defense-in-depth guard: structural directives should be handled by `processNodes`
141
+ * in `generateDomFactory.ts` and never reach `serializeNode`. If one does, it means
142
+ * a bug in the structural codegen pipeline.
143
+ */
144
+ function assertNoStructuralDirectives(node) {
145
+ const d = node.directives;
146
+ if (!d)
147
+ return;
148
+ if (d.for) {
149
+ throw new Error(`AOT: @for directive reached serializeNode (node ${node.nodeId}). This is a bug — structural directives must be handled by processNodes.`);
150
+ }
151
+ if (d.if !== undefined) {
152
+ throw new Error(`AOT: @if directive reached serializeNode (node ${node.nodeId}). This is a bug — structural directives must be handled by processNodes.`);
153
+ }
154
+ if (d.elseIf !== undefined) {
155
+ throw new Error(`AOT: @else-if directive reached serializeNode (node ${node.nodeId}). This is a bug — structural directives must be handled by processNodes.`);
156
+ }
157
+ if (d.else !== undefined) {
158
+ throw new Error(`AOT: @else directive reached serializeNode (node ${node.nodeId}). This is a bug — structural directives must be handled by processNodes.`);
159
+ }
160
+ if (d.switch !== undefined) {
161
+ throw new Error(`AOT: @switch directive reached serializeNode (node ${node.nodeId}). This is a bug — structural directives must be handled by processNodes.`);
162
+ }
163
+ if (d.case !== undefined) {
164
+ throw new Error(`AOT: @case directive reached serializeNode (node ${node.nodeId}). This is a bug — structural directives must be handled by processNodes.`);
165
+ }
166
+ // Note: @default is stored in node.attrs['@default'], not in ParsedDirectives,
167
+ // so it cannot be caught here. It is handled by processNodes via isDefaultCase().
168
+ }
169
+ //# sourceMappingURL=serializeNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializeNode.js","sourceRoot":"","sources":["../../src/aotCodegen/serializeNode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAGF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAwBnC;;;;;;;;;;;;;;;;GAgBG;AACH,sKAAsK;AACtK,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO;QACL,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,OAAO;QACP,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wLAAwL;AACxL,MAAM,UAAU,aAAa,CAC3B,IAAe,EACf,GAAqB;IAErB,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QACzB,OAAO,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,gGAAgG;IAChG,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,iBAAiB,CACxB,IAAe,EACf,GAAqB;IAErB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,C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