@litfamily/litcodex 1.0.5 → 1.0.7

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 (816) hide show
  1. package/README.md +327 -25
  2. package/dist/cli.js +42 -0
  3. package/dist/config-migration/config-paths.js +9 -2
  4. package/dist/install/execute.d.ts +2 -0
  5. package/dist/install/execute.js +8 -3
  6. package/dist/install/generated-skill-payload-hashes.d.ts +617 -21
  7. package/dist/install/generated-skill-payload-hashes.js +617 -21
  8. package/dist/install/index.js +13 -2
  9. package/dist/install/marketplace-payload.d.ts +1 -0
  10. package/dist/install/marketplace-payload.js +73 -2
  11. package/dist/install/motion-runtime.d.ts +36 -0
  12. package/dist/install/motion-runtime.js +82 -0
  13. package/dist/install/office-runtime.d.ts +20 -0
  14. package/dist/install/office-runtime.js +37 -0
  15. package/dist/install/skill-catalog.d.ts +1 -1
  16. package/dist/install/skill-catalog.js +26 -2
  17. package/dist/install/skill-resource-hashes.d.ts +1 -1
  18. package/dist/install/skill-resource-hashes.js +1 -1
  19. package/dist/postinstall.js +14 -2
  20. package/marketplace/plugins/litcodex/.codex-plugin/plugin.json +1 -1
  21. package/marketplace/plugins/litcodex/components/auto-update/package.json +1 -1
  22. package/marketplace/plugins/litcodex/components/comment-checker/package.json +1 -1
  23. package/marketplace/plugins/litcodex/components/git-bash/package.json +1 -1
  24. package/marketplace/plugins/litcodex/components/lit-loop/directive.md +90 -5
  25. package/marketplace/plugins/litcodex/components/lit-loop/directives/lit-comprehend.md +13 -17
  26. package/marketplace/plugins/litcodex/components/lit-loop/directives/litwork.md +8 -0
  27. package/marketplace/plugins/litcodex/components/lit-loop/dist/codex-hook.js +8 -1
  28. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.d.ts +18 -0
  29. package/marketplace/plugins/litcodex/components/lit-loop/dist/motion-route.js +95 -0
  30. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-renames.d.ts +3 -1
  31. package/marketplace/plugins/litcodex/components/lit-loop/dist/skill-renames.js +10 -5
  32. package/marketplace/plugins/litcodex/components/lit-loop/package.json +1 -1
  33. package/marketplace/plugins/litcodex/components/lsp/package.json +1 -1
  34. package/marketplace/plugins/litcodex/components/rules/bundled-rules/lit-humanizer.md +12 -0
  35. package/marketplace/plugins/litcodex/components/rules/dist/cli.js +22 -10
  36. package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.d.ts +23 -34
  37. package/marketplace/plugins/litcodex/components/rules/dist/deliverable-hedge-guard.js +420 -388
  38. package/marketplace/plugins/litcodex/components/rules/package.json +1 -1
  39. package/marketplace/plugins/litcodex/components/start-work-continuation/package.json +1 -1
  40. package/marketplace/plugins/litcodex/components/telemetry/package.json +1 -1
  41. package/marketplace/plugins/litcodex/components/wikify-knowledge/package.json +1 -1
  42. package/marketplace/plugins/litcodex/hooks/hooks.json +32 -21
  43. package/marketplace/plugins/litcodex/skills/autoconference/assets/report_template.md +1 -1
  44. package/marketplace/plugins/litcodex/skills/browser-drive/SKILL.md +4 -0
  45. package/marketplace/plugins/litcodex/skills/browser-drive/scripts/capability-probe.mjs +25 -2
  46. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/SKILL.md +14 -15
  47. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/THIRD-PARTY-NOTICE.txt +7 -0
  48. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/examples/readme-ab/README.md +13 -0
  49. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/adaptive-layout.md +12 -83
  50. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/brand-and-imagery.md +17 -65
  51. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/complete-contract.md +44 -13
  52. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/composition.md +14 -80
  53. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/craft-floor.md +103 -0
  54. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/creative-directions.md +13 -82
  55. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/evidence-review.md +14 -112
  56. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/implementation-platforms.md +16 -68
  57. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/inclusive-interface.md +12 -86
  58. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/interaction-motion.md +13 -82
  59. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/motion-guide.md +123 -0
  60. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/operating-lanes.md +12 -100
  61. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/performance-delivery.md +12 -78
  62. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/probe-and-review.md +41 -0
  63. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/product-direction.md +10 -88
  64. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/production-interview.md +10 -12
  65. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/redesign-playbook.md +12 -74
  66. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/slop-register.md +98 -0
  67. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/system-foundations.md +13 -100
  68. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/visual-language.md +11 -74
  69. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/references/visual-reconstruction.md +9 -78
  70. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/hover-probe.mjs +28 -0
  71. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/page-probe.mjs +423 -0
  72. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/probe.mjs +261 -0
  73. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/route-mode.mjs +19 -0
  74. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/rule-data.mjs +115 -0
  75. package/marketplace/plugins/litcodex/skills/frontend-ui-ux/scripts/serve-static.mjs +24 -0
  76. package/marketplace/plugins/litcodex/skills/lit-comprehend/SKILL.md +45 -53
  77. package/marketplace/plugins/litcodex/skills/lit-comprehend/references/artifact-template.md +10 -44
  78. package/marketplace/plugins/litcodex/skills/lit-comprehend/scripts/verify-explainer.ts +0 -18
  79. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/NOTICE +33 -0
  80. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/SKILL.md +167 -0
  81. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/agents/openai.yaml +6 -0
  82. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-architecture-dark.html +1 -0
  83. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-architecture-full.html +1 -0
  84. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-architecture-light.html +1 -0
  85. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bar-dark.html +1 -0
  86. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bar-full.html +1 -0
  87. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bar-light.html +1 -0
  88. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-beeswarm-dark.html +1 -0
  89. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-beeswarm-full.html +1 -0
  90. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-beeswarm-light.html +1 -0
  91. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bubble-dark.html +1 -0
  92. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bubble-full.html +1 -0
  93. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bubble-light.html +1 -0
  94. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bump-dark.html +1 -0
  95. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bump-full.html +1 -0
  96. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-bump-light.html +1 -0
  97. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-data-flow-dark.html +1 -0
  98. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-data-flow-full.html +1 -0
  99. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-data-flow-light.html +1 -0
  100. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-datalake-dark.html +1 -0
  101. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-datalake-full.html +1 -0
  102. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-datalake-light.html +1 -0
  103. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-db-schema-dark.html +1 -0
  104. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-db-schema-full.html +1 -0
  105. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-db-schema-light.html +1 -0
  106. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dependency-dark.html +1 -0
  107. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dependency-full.html +1 -0
  108. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dependency-light.html +1 -0
  109. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-deployment-dark.html +1 -0
  110. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-deployment-full.html +1 -0
  111. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-deployment-light.html +1 -0
  112. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-integration-dark.html +1 -0
  113. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-integration-full.html +1 -0
  114. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-integration-light.html +1 -0
  115. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-dark.html +1 -0
  116. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-full.html +1 -0
  117. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-dp-security-matrix-light.html +1 -0
  118. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-er-dark.html +1 -0
  119. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-er-full.html +1 -0
  120. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-er-light.html +1 -0
  121. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-fishbone-dark.html +1 -0
  122. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-fishbone-full.html +1 -0
  123. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-fishbone-light.html +1 -0
  124. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-flowchart-dark.html +1 -0
  125. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-flowchart-full.html +1 -0
  126. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-flowchart-light.html +1 -0
  127. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-gantt-dark.html +1 -0
  128. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-gantt-full.html +1 -0
  129. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-gantt-light.html +1 -0
  130. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-heatmap-dark.html +1 -0
  131. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-heatmap-full.html +1 -0
  132. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-heatmap-light.html +1 -0
  133. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-dark.html +1 -0
  134. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-full.html +1 -0
  135. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-light.html +1 -0
  136. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-dark.html +1 -0
  137. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-full.html +1 -0
  138. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-high-level-vertical-light.html +1 -0
  139. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-drawio-dark.html +1 -0
  140. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-drawio-full.html +1 -0
  141. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-drawio-light.html +1 -0
  142. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-dark.html +1 -0
  143. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-full.html +1 -0
  144. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-excalidraw-light.html +1 -0
  145. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-dark.html +1 -0
  146. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-full.html +1 -0
  147. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-import-mermaid-light.html +1 -0
  148. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-it-state-dark.html +1 -0
  149. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-it-state-full.html +1 -0
  150. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-it-state-light.html +1 -0
  151. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-journey-dark.html +1 -0
  152. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-journey-full.html +1 -0
  153. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-journey-light.html +1 -0
  154. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-kanban-dark.html +1 -0
  155. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-kanban-full.html +1 -0
  156. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-kanban-light.html +1 -0
  157. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-layers-dark.html +1 -0
  158. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-layers-full.html +1 -0
  159. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-layers-light.html +1 -0
  160. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-line-dark.html +1 -0
  161. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-line-full.html +1 -0
  162. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-line-light.html +1 -0
  163. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-dark.html +1 -0
  164. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-full.html +1 -0
  165. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-light.html +1 -0
  166. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-dark.html +1 -0
  167. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-full.html +1 -0
  168. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-loop-terminal-light.html +1 -0
  169. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-marimekko-dark.html +1 -0
  170. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-marimekko-full.html +1 -0
  171. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-marimekko-light.html +1 -0
  172. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-medallion-dark.html +1 -0
  173. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-medallion-full.html +1 -0
  174. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-medallion-light.html +1 -0
  175. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-nested-dark.html +1 -0
  176. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-nested-full.html +1 -0
  177. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-nested-light.html +1 -0
  178. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-org-chart-dark.html +1 -0
  179. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-org-chart-full.html +1 -0
  180. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-org-chart-light.html +1 -0
  181. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-dark.html +1 -0
  182. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-full.html +1 -0
  183. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-paved-road-animated-light.html +1 -0
  184. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-polar-dark.html +1 -0
  185. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-polar-full.html +1 -0
  186. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-polar-light.html +1 -0
  187. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-dark.html +1 -0
  188. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-full.html +1 -0
  189. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-policy-trace-animated-light.html +1 -0
  190. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-process-dark.html +1 -0
  191. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-process-full.html +1 -0
  192. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-process-light.html +1 -0
  193. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-pyramid-dark.html +1 -0
  194. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-pyramid-full.html +1 -0
  195. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-pyramid-light.html +1 -0
  196. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-dark.html +1 -0
  197. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-full.html +1 -0
  198. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-consultant-light.html +1 -0
  199. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-dark.html +1 -0
  200. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-full.html +1 -0
  201. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-quadrant-light.html +1 -0
  202. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-queue-animated-dark.html +1 -0
  203. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-queue-animated-full.html +1 -0
  204. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-queue-animated-light.html +1 -0
  205. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-radar-dark.html +1 -0
  206. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-radar-full.html +1 -0
  207. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-radar-light.html +1 -0
  208. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-ridgeline-dark.html +1 -0
  209. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-ridgeline-full.html +1 -0
  210. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-ridgeline-light.html +1 -0
  211. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sankey-dark.html +1 -0
  212. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sankey-full.html +1 -0
  213. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sankey-light.html +1 -0
  214. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-scatter-dark.html +1 -0
  215. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-scatter-full.html +1 -0
  216. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-scatter-light.html +1 -0
  217. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-dark.html +1 -0
  218. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-full.html +1 -0
  219. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-light.html +1 -0
  220. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-dark.html +1 -0
  221. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-full.html +1 -0
  222. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-sequence-oauth-light.html +1 -0
  223. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-slopegraph-dark.html +1 -0
  224. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-slopegraph-full.html +1 -0
  225. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-slopegraph-light.html +1 -0
  226. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-dark.html +1 -0
  227. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-full.html +1 -0
  228. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-dark.html +1 -0
  229. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-full.html +1 -0
  230. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-lifecycle-light.html +1 -0
  231. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-state-light.html +1 -0
  232. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-story-map-dark.html +1 -0
  233. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-story-map-full.html +1 -0
  234. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-story-map-light.html +1 -0
  235. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-streamgraph-dark.html +1 -0
  236. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-streamgraph-full.html +1 -0
  237. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-streamgraph-light.html +1 -0
  238. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-swimlane-dark.html +1 -0
  239. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-swimlane-full.html +1 -0
  240. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-swimlane-light.html +1 -0
  241. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-timeline-dark.html +1 -0
  242. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-timeline-full.html +1 -0
  243. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-timeline-light.html +1 -0
  244. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-dark.html +1 -0
  245. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-full.html +1 -0
  246. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-block-decomposition-light.html +1 -0
  247. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-dark.html +1 -0
  248. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-full.html +1 -0
  249. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-tree-light.html +1 -0
  250. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-treemap-dark.html +1 -0
  251. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-treemap-full.html +1 -0
  252. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-treemap-light.html +1 -0
  253. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-uml-class-dark.html +1 -0
  254. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-uml-class-full.html +1 -0
  255. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-uml-class-light.html +1 -0
  256. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-venn-dark.html +1 -0
  257. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-venn-full.html +1 -0
  258. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-venn-light.html +1 -0
  259. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-wardley-dark.html +1 -0
  260. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-wardley-full.html +1 -0
  261. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-wardley-light.html +1 -0
  262. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-waterfall-dark.html +1 -0
  263. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-waterfall-full.html +1 -0
  264. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/examples/type-waterfall-light.html +1 -0
  265. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/fonts/OFL.txt +94 -0
  266. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/fonts/PretendardVariable.woff2 +0 -0
  267. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/fonts/provenance.json +22 -0
  268. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/icons.html +231 -0
  269. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/index.html +1 -0
  270. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/devicon-MIT.txt +20 -0
  271. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/diagram-design-MIT.txt +21 -0
  272. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/log-z-MIT.txt +21 -0
  273. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/simple-icons-CC0.md +30 -0
  274. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/assets/licenses/tabler-MIT.txt +21 -0
  275. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/01-service-architecture/after.html +1 -0
  276. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/01-service-architecture/brief.md +33 -0
  277. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/01-service-architecture/constructed-naive-foil.html +1 -0
  278. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/02-release-decision/after.html +1 -0
  279. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/02-release-decision/brief.md +18 -0
  280. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/02-release-decision/constructed-naive-foil.html +1 -0
  281. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/03-data-retention/after.html +1 -0
  282. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/03-data-retention/brief.md +19 -0
  283. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/03-data-retention/constructed-naive-foil.html +1 -0
  284. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/04-oauth-sequence/after.html +1 -0
  285. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/04-oauth-sequence/brief.md +17 -0
  286. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/04-oauth-sequence/constructed-naive-foil.html +1 -0
  287. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/05-review-lanes/after.html +1 -0
  288. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/05-review-lanes/brief.md +17 -0
  289. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/05-review-lanes/constructed-naive-foil.html +1 -0
  290. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/06-rollout-gates/after.html +1 -0
  291. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/06-rollout-gates/brief.md +17 -0
  292. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/06-rollout-gates/constructed-naive-foil.html +1 -0
  293. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/07-deployment-boundary/after.html +1 -0
  294. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/07-deployment-boundary/brief.md +19 -0
  295. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/07-deployment-boundary/constructed-naive-foil.html +1 -0
  296. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/08-policy-traces/after.html +1 -0
  297. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/08-policy-traces/brief.md +20 -0
  298. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/examples/08-policy-traces/constructed-naive-foil.html +1 -0
  299. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/accessibility.md +37 -0
  300. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/export.md +29 -0
  301. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-drawio.md +21 -0
  302. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-excalidraw.md +14 -0
  303. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-mermaid.md +18 -0
  304. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/import-schema.md +28 -0
  305. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/korean-typography.md +34 -0
  306. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/motion.md +29 -0
  307. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/office-pptx-docx.md +42 -0
  308. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/output-spec.md +48 -0
  309. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-annotation.md +12 -0
  310. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-icons.md +21 -0
  311. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-sketchy.md +11 -0
  312. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/primitive-terminal.md +11 -0
  313. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/profiles.md +24 -0
  314. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/semantic-patterns.md +27 -0
  315. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/style-guide.md +67 -0
  316. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-architecture.md +51 -0
  317. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-bar.md +51 -0
  318. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-beeswarm.md +49 -0
  319. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-bubble.md +49 -0
  320. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-bump.md +49 -0
  321. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-catalog.json +1433 -0
  322. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-data-flow.md +51 -0
  323. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-datalake.md +49 -0
  324. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-db-schema.md +49 -0
  325. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dependency.md +49 -0
  326. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-deployment.md +49 -0
  327. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dp-integration.md +49 -0
  328. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-dp-security-matrix.md +49 -0
  329. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-er.md +49 -0
  330. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-fishbone.md +49 -0
  331. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-flowchart.md +49 -0
  332. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-gantt.md +49 -0
  333. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-heatmap.md +53 -0
  334. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-high-level-vertical.md +53 -0
  335. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-high-level.md +53 -0
  336. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-import-drawio.md +53 -0
  337. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-import-excalidraw.md +53 -0
  338. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-import-mermaid.md +53 -0
  339. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-it-state.md +54 -0
  340. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-journey.md +54 -0
  341. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-kanban.md +54 -0
  342. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-layers.md +54 -0
  343. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-line.md +54 -0
  344. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-loop-terminal.md +53 -0
  345. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-loop.md +54 -0
  346. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-marimekko.md +54 -0
  347. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-medallion.md +54 -0
  348. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-nested.md +59 -0
  349. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-org-chart.md +58 -0
  350. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-paved-road-animated.md +72 -0
  351. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-polar.md +67 -0
  352. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-policy-trace-animated.md +69 -0
  353. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-process.md +58 -0
  354. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-pyramid.md +59 -0
  355. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-quadrant-consultant.md +60 -0
  356. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-quadrant.md +57 -0
  357. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-queue-animated.md +63 -0
  358. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-radar.md +57 -0
  359. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-ridgeline.md +63 -0
  360. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-sankey.md +68 -0
  361. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-scatter.md +60 -0
  362. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-sequence-oauth.md +66 -0
  363. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-sequence.md +63 -0
  364. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-slopegraph.md +65 -0
  365. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-state-lifecycle.md +53 -0
  366. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-state.md +59 -0
  367. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-story-map.md +52 -0
  368. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-streamgraph.md +53 -0
  369. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-swimlane.md +52 -0
  370. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-timeline.md +52 -0
  371. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree-block-decomposition.md +57 -0
  372. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-tree.md +54 -0
  373. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-treemap.md +54 -0
  374. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-uml-class.md +52 -0
  375. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-venn.md +51 -0
  376. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-wardley.md +52 -0
  377. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/type-waterfall.md +54 -0
  378. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/references/verifier-guide.md +59 -0
  379. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/block-registry.mjs +43 -0
  380. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/brief-contract.mjs +94 -0
  381. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/check-visible-text.mjs +15 -0
  382. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-craft-rules.mjs +14 -0
  383. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/diagram-metrics.mjs +219 -0
  384. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/doctor.mjs +28 -0
  385. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/drawio-model.mjs +162 -0
  386. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/drawio-source.mjs +147 -0
  387. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/drawio-xml.mjs +148 -0
  388. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/export.mjs +122 -0
  389. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-common.mjs +85 -0
  390. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-drawio.mjs +48 -0
  391. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-excalidraw.mjs +234 -0
  392. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/import-mermaid.mjs +104 -0
  393. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-common.mjs +115 -0
  394. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-er.mjs +70 -0
  395. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-flowchart.mjs +178 -0
  396. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-sequence.mjs +137 -0
  397. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/mermaid-state.mjs +80 -0
  398. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/office-safety.mjs +54 -0
  399. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/runtime-probes.mjs +11 -0
  400. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-all.mjs +85 -0
  401. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-brief.mjs +16 -0
  402. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-diagram.mjs +27 -0
  403. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-motion.mjs +12 -0
  404. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/verify-type.mjs +48 -0
  405. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality-geometry.mjs +226 -0
  406. package/marketplace/plugins/litcodex/skills/lit-diagram-drawer/scripts/visual-quality.mjs +147 -0
  407. package/marketplace/plugins/litcodex/skills/lit-docx/LICENSE +21 -0
  408. package/marketplace/plugins/litcodex/skills/lit-docx/NOTICE +3 -0
  409. package/marketplace/plugins/litcodex/skills/lit-docx/SKILL.md +102 -0
  410. package/marketplace/plugins/litcodex/skills/lit-docx/agents/openai.yaml +14 -0
  411. package/marketplace/plugins/litcodex/skills/lit-docx/references/frontmatter_schema.md +42 -0
  412. package/marketplace/plugins/litcodex/skills/lit-docx/references/journal_style_spec.md +17 -0
  413. package/marketplace/plugins/litcodex/skills/lit-docx/references/markdown_quality_checklist.md +37 -0
  414. package/marketplace/plugins/litcodex/skills/lit-docx/references/slop_phrase_list.yaml +58 -0
  415. package/marketplace/plugins/litcodex/skills/lit-docx/references/slop_rules.md +35 -0
  416. package/marketplace/plugins/litcodex/skills/lit-docx/runtime/requirements.in +5 -0
  417. package/marketplace/plugins/litcodex/skills/lit-docx/runtime/requirements.lock +20 -0
  418. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/clean_markdown.py +95 -0
  419. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_md_to_docx.py +1046 -0
  420. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_md_to_pdf.py +281 -0
  421. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/convert_pdf.py +130 -0
  422. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/docx_craft.py +95 -0
  423. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/edit_docx.py +297 -0
  424. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/embed_images.py +78 -0
  425. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/generate_docx_templates.py +491 -0
  426. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/slop_lint.py +473 -0
  427. package/marketplace/plugins/litcodex/skills/lit-docx/scripts/visual_audit.py +41 -0
  428. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/acs.docx +0 -0
  429. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/elsevier.docx +0 -0
  430. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/ieee.docx +0 -0
  431. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/korean-generic.docx +0 -0
  432. package/marketplace/plugins/litcodex/skills/lit-docx/templates/docx/nature.docx +0 -0
  433. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/acs/README.md +5 -0
  434. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/acs/template.tex +37 -0
  435. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/elsevier/README.md +5 -0
  436. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/elsevier/template.tex +38 -0
  437. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/ieee/README.md +5 -0
  438. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/ieee/template.tex +37 -0
  439. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/korean-generic/README.md +5 -0
  440. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/korean-generic/template.tex +37 -0
  441. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/nature/README.md +5 -0
  442. package/marketplace/plugins/litcodex/skills/lit-docx/templates/latex/nature/template.tex +37 -0
  443. package/marketplace/plugins/litcodex/skills/lit-docx/templates/registry.yaml +1366 -0
  444. package/marketplace/plugins/litcodex/skills/lit-humanizer/NOTICE +160 -0
  445. package/marketplace/plugins/litcodex/skills/lit-humanizer/SKILL.md +146 -0
  446. package/marketplace/plugins/litcodex/skills/lit-humanizer/always-on-rule.md +9 -0
  447. package/marketplace/plugins/litcodex/skills/lit-humanizer/assets/always-on-rule.md +9 -0
  448. package/marketplace/plugins/litcodex/skills/lit-humanizer/assets/report-skeleton.md +25 -0
  449. package/marketplace/plugins/litcodex/skills/lit-humanizer/assets/slide-text-skeleton.md +28 -0
  450. package/marketplace/plugins/litcodex/skills/lit-humanizer/bench/prompts.md +73 -0
  451. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/accessibility-note/after.md +7 -0
  452. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/accessibility-note/before.md +7 -0
  453. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/api-reference/after.md +9 -0
  454. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/api-reference/before.md +15 -0
  455. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/changelog/after.md +5 -0
  456. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/changelog/before.md +12 -0
  457. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/code-comments/after.md +10 -0
  458. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/code-comments/before.md +19 -0
  459. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/commit/after.md +5 -0
  460. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/commit/before.md +7 -0
  461. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/data-release/after.md +7 -0
  462. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/data-release/before.md +9 -0
  463. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/english-essay/after.md +5 -0
  464. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/english-essay/before.md +5 -0
  465. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/incident-update/after.md +7 -0
  466. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/incident-update/before.md +7 -0
  467. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/ko-essay/after.md +7 -0
  468. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/ko-essay/before.md +9 -0
  469. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/ko-report/after.md +9 -0
  470. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/ko-report/before.md +13 -0
  471. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/ko-slide/after.md +19 -0
  472. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/ko-slide/before.md +21 -0
  473. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/meeting-brief/after.md +9 -0
  474. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/meeting-brief/before.md +11 -0
  475. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/policy-faq/after.md +9 -0
  476. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/policy-faq/before.md +9 -0
  477. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/pr/after.md +15 -0
  478. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/pr/before.md +17 -0
  479. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/project-update/after.md +7 -0
  480. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/project-update/before.md +9 -0
  481. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/readme/after.md +12 -0
  482. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/readme/before.md +14 -0
  483. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/report/after.md +13 -0
  484. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/report/before.md +11 -0
  485. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/research-abstract/after.md +5 -0
  486. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/research-abstract/before.md +5 -0
  487. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/slides/after.md +19 -0
  488. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/slides/before.md +19 -0
  489. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/troubleshooting/after.md +11 -0
  490. package/marketplace/plugins/litcodex/skills/lit-humanizer/examples/troubleshooting/before.md +11 -0
  491. package/marketplace/plugins/litcodex/skills/lit-humanizer/motion-guide.md +123 -0
  492. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/code-patterns.md +468 -0
  493. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/deliverable-channels.md +111 -0
  494. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/en-patterns-checklist.md +43 -0
  495. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/en-patterns-content.md +243 -0
  496. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/en-patterns-structure.md +375 -0
  497. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/en-patterns.md +57 -0
  498. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/ko-metrics.md +33 -0
  499. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/ko-patterns-a-d.md +659 -0
  500. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/ko-patterns-e-j.md +387 -0
  501. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/ko-patterns.md +31 -0
  502. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/prompt-injection-handling.md +7 -0
  503. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/rewrite-playbook.md +54 -0
  504. package/marketplace/plugins/litcodex/skills/lit-humanizer/references/taxonomy.md +153 -0
  505. package/marketplace/plugins/litcodex/skills/lit-humanizer/rules.json +884 -0
  506. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/core.mjs +208 -0
  507. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/detect.mjs +83 -0
  508. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/extract_office_text.py +89 -0
  509. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/ko-metrics.mjs +124 -0
  510. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/test-fixtures.mjs +155 -0
  511. package/marketplace/plugins/litcodex/skills/lit-humanizer/scripts/test-ko-metrics.mjs +27 -0
  512. package/marketplace/plugins/litcodex/skills/lit-init/references/deep-repository-map.md +6 -10
  513. package/marketplace/plugins/litcodex/skills/lit-loop/SKILL.md +95 -12
  514. package/marketplace/plugins/litcodex/skills/lit-loop/agents/openai.yaml +3 -2
  515. package/marketplace/plugins/litcodex/skills/lit-loop/references/full-workflow.md +10 -3
  516. package/marketplace/plugins/litcodex/skills/lit-pptx/NOTICE +7 -0
  517. package/marketplace/plugins/litcodex/skills/lit-pptx/SKILL.md +102 -0
  518. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/analyst.md +49 -0
  519. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/antithesis.md +59 -0
  520. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/architect.md +44 -0
  521. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/critic.md +42 -0
  522. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/openai.yaml +14 -0
  523. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/synthesizer.md +47 -0
  524. package/marketplace/plugins/litcodex/skills/lit-pptx/agents/thesis.md +33 -0
  525. package/marketplace/plugins/litcodex/skills/lit-pptx/assets/azure/circle-lg.png +0 -0
  526. package/marketplace/plugins/litcodex/skills/lit-pptx/assets/azure/circle-md.png +0 -0
  527. package/marketplace/plugins/litcodex/skills/lit-pptx/assets/azure/circle-sm.png +0 -0
  528. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Black.otf +0 -0
  529. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Bold.otf +0 -0
  530. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Light.otf +0 -0
  531. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Medium.otf +0 -0
  532. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/A2Z-Regular.otf +0 -0
  533. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/OFL.txt +94 -0
  534. package/marketplace/plugins/litcodex/skills/lit-pptx/fonts/a2z-font/SOURCE.md +29 -0
  535. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/LICENSE.txt +94 -0
  536. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/PretendardGOV-Bold.otf +0 -0
  537. package/marketplace/plugins/litcodex/skills/lit-pptx/pretendard-font/public/static/PretendardGOV-Regular.otf +0 -0
  538. package/marketplace/plugins/litcodex/skills/lit-pptx/references/anti-slop-checklist.md +71 -0
  539. package/marketplace/plugins/litcodex/skills/lit-pptx/references/authoring-guide.md +141 -0
  540. package/marketplace/plugins/litcodex/skills/lit-pptx/references/consensus-protocol.md +125 -0
  541. package/marketplace/plugins/litcodex/skills/lit-pptx/references/data-display-cookbook.md +45 -0
  542. package/marketplace/plugins/litcodex/skills/lit-pptx/references/design-system-azure.md +58 -0
  543. package/marketplace/plugins/litcodex/skills/lit-pptx/references/interview-protocol.md +113 -0
  544. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/package-lock.json +747 -0
  545. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/package.json +13 -0
  546. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/requirements.in +2 -0
  547. package/marketplace/plugins/litcodex/skills/lit-pptx/runtime/requirements.lock +14 -0
  548. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/check_ooxml.py +40 -0
  549. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/compile-deck.js +399 -0
  550. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/craft_extras.py +246 -0
  551. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/embed_fonts.py +201 -0
  552. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/inventory.py +95 -0
  553. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/learn_template.py +433 -0
  554. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/derive-palette.js +176 -0
  555. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/directive-parser.js +244 -0
  556. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/font-map.js +79 -0
  557. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/gen-bg.js +85 -0
  558. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/gen-gradient-assets.js +36 -0
  559. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/layout-resolver.js +734 -0
  560. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/markdown-loader.js +136 -0
  561. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-adapter-html.js +358 -0
  562. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/render-adapter-pptx.js +1885 -0
  563. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/slide-ast.js +517 -0
  564. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/spec-validator.js +94 -0
  565. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/lib/template-registry.js +355 -0
  566. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/office-run.mjs +137 -0
  567. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/package.json +1 -0
  568. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/qa_deck.py +795 -0
  569. package/marketplace/plugins/litcodex/skills/lit-pptx/scripts/validate_pptx.py +206 -0
  570. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/markdown-slide-spec-v1.md +251 -0
  571. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/markdown-slide-spec-v2.md +207 -0
  572. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/slide-ast-v1.schema.json +229 -0
  573. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/slide-ast-v2.schema.json +144 -0
  574. package/marketplace/plugins/litcodex/skills/lit-pptx/specs/template-enrollment-contract.md +379 -0
  575. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/bauhaus_light.css +4 -0
  576. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/boilerplate_professional.css +508 -0
  577. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/capabilities.yaml +146 -0
  578. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/layout-mapping.yaml +454 -0
  579. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-A2Z/template.yaml +37 -0
  580. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/capabilities.yaml +154 -0
  581. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/layout-mapping.yaml +464 -0
  582. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/AZURE-PRO/template.yaml +37 -0
  583. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/capabilities.yaml +179 -0
  584. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/layout-mapping.yaml +299 -0
  585. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-A2Z/template.yaml +45 -0
  586. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/capabilities.yaml +181 -0
  587. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/layout-mapping.yaml +299 -0
  588. package/marketplace/plugins/litcodex/skills/lit-pptx/templates/enrolled/BOILERPLATE-PRETENDARD/template.yaml +44 -0
  589. package/marketplace/plugins/litcodex/skills/lit-scientific-visualization/SKILL.md +2 -0
  590. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/SKILL.md +73 -0
  591. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/agents/openai.yaml +15 -0
  592. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/NOTICE +23 -0
  593. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/THIRD_PARTY_NOTICES +32 -0
  594. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/browser-app.js +735 -0
  595. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/completion.mjs +9 -0
  596. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/compose.mjs +255 -0
  597. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/constants.mjs +264 -0
  598. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/driver.mjs +169 -0
  599. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/encode.mjs +163 -0
  600. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/flash.mjs +251 -0
  601. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/fonts.mjs +169 -0
  602. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/gate.mjs +466 -0
  603. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/image.mjs +267 -0
  604. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/look.mjs +182 -0
  605. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/passes.mjs +181 -0
  606. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/presets.mjs +110 -0
  607. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/report.mjs +56 -0
  608. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/runtime.mjs +287 -0
  609. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/scenes.mjs +309 -0
  610. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/sound.mjs +463 -0
  611. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-gate.mjs +155 -0
  612. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-init.js +215 -0
  613. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-kit.js +515 -0
  614. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.js +147 -0
  615. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-qa.mjs +243 -0
  616. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-render.mjs +335 -0
  617. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage-worker.mjs +26 -0
  618. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stage.mjs +311 -0
  619. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/stroke.mjs +264 -0
  620. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/timeline.mjs +153 -0
  621. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/treatment.mjs +280 -0
  622. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/type.mjs +234 -0
  623. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/engine/util.mjs +198 -0
  624. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w100-wt400.ttf +0 -0
  625. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w100-wt700.ttf +0 -0
  626. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w100-wt900.ttf +0 -0
  627. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w125-wt400.ttf +0 -0
  628. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w125-wt700.ttf +0 -0
  629. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w125-wt900.ttf +0 -0
  630. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w75-wt400.ttf +0 -0
  631. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w75-wt700.ttf +0 -0
  632. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/Archivo-w75-wt900.ttf +0 -0
  633. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/OFL.txt +93 -0
  634. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/archivo/SHA256SUMS +16 -0
  635. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/CREDITS +6 -0
  636. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSAllure.svg +216 -0
  637. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSFelix.svg +216 -0
  638. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSOsmotron.svg +216 -0
  639. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSReadability.svg +216 -0
  640. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/EMSTech.svg +217 -0
  641. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/stroke/OFL.txt +86 -0
  642. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/vt323/OFL.txt +93 -0
  643. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/fonts/vt323/VT323-Regular.ttf +0 -0
  644. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/quality-gate.md +137 -0
  645. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/runtime.md +68 -0
  646. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/scene-author.md +57 -0
  647. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/stage.md +175 -0
  648. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/style-bibles.md +103 -0
  649. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/treatment.md +119 -0
  650. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/references/type-and-timing.md +83 -0
  651. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/package-lock.json +59 -0
  652. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/package.json +1 -0
  653. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/requirements-audio.txt +1082 -0
  654. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/runtime/word-timing-models.json +11 -0
  655. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/beat-grid.py +50 -0
  656. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/render.mjs +807 -0
  657. package/marketplace/plugins/litcodex/skills/lit-typographic-motion/scripts/runtime.mjs +43 -0
  658. package/marketplace/plugins/litcodex/skills/litresearch/SKILL.md +28 -41
  659. package/marketplace/plugins/litcodex/skills/litwork/SKILL.md +8 -0
  660. package/marketplace/plugins/litcodex/skills/litwork/references/delivery-playbook.md +6 -0
  661. package/node_modules/@litcodex/lit-loop/directive.md +90 -5
  662. package/node_modules/@litcodex/lit-loop/directives/lit-comprehend.md +13 -17
  663. package/node_modules/@litcodex/lit-loop/directives/litwork.md +8 -0
  664. package/node_modules/@litcodex/lit-loop/dist/codex-hook.js +8 -1
  665. package/node_modules/@litcodex/lit-loop/dist/motion-route.d.ts +18 -0
  666. package/node_modules/@litcodex/lit-loop/dist/motion-route.js +95 -0
  667. package/node_modules/@litcodex/lit-loop/dist/skill-renames.d.ts +3 -1
  668. package/node_modules/@litcodex/lit-loop/dist/skill-renames.js +10 -5
  669. package/node_modules/@litcodex/lit-loop/package.json +1 -1
  670. package/node_modules/@litcodex/lit-loop/skills/browser-drive/SKILL.md +4 -0
  671. package/node_modules/@litcodex/lit-loop/skills/browser-drive/scripts/capability-probe.mjs +25 -2
  672. package/node_modules/@litcodex/lit-loop/skills/lit-comprehend/SKILL.md +45 -53
  673. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/NOTICE +160 -0
  674. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/SKILL.md +146 -0
  675. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/always-on-rule.md +9 -0
  676. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/assets/always-on-rule.md +9 -0
  677. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/assets/report-skeleton.md +25 -0
  678. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/assets/slide-text-skeleton.md +28 -0
  679. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/bench/prompts.md +73 -0
  680. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/accessibility-note/after.md +7 -0
  681. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/accessibility-note/before.md +7 -0
  682. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/api-reference/after.md +9 -0
  683. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/api-reference/before.md +15 -0
  684. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/changelog/after.md +5 -0
  685. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/changelog/before.md +12 -0
  686. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/code-comments/after.md +10 -0
  687. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/code-comments/before.md +19 -0
  688. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/commit/after.md +5 -0
  689. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/commit/before.md +7 -0
  690. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/data-release/after.md +7 -0
  691. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/data-release/before.md +9 -0
  692. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/english-essay/after.md +5 -0
  693. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/english-essay/before.md +5 -0
  694. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/incident-update/after.md +7 -0
  695. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/incident-update/before.md +7 -0
  696. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/ko-essay/after.md +7 -0
  697. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/ko-essay/before.md +9 -0
  698. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/ko-report/after.md +9 -0
  699. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/ko-report/before.md +13 -0
  700. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/ko-slide/after.md +19 -0
  701. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/ko-slide/before.md +21 -0
  702. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/meeting-brief/after.md +9 -0
  703. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/meeting-brief/before.md +11 -0
  704. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/policy-faq/after.md +9 -0
  705. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/policy-faq/before.md +9 -0
  706. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/pr/after.md +15 -0
  707. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/pr/before.md +17 -0
  708. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/project-update/after.md +7 -0
  709. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/project-update/before.md +9 -0
  710. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/readme/after.md +12 -0
  711. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/readme/before.md +14 -0
  712. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/report/after.md +13 -0
  713. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/report/before.md +11 -0
  714. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/research-abstract/after.md +5 -0
  715. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/research-abstract/before.md +5 -0
  716. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/slides/after.md +19 -0
  717. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/slides/before.md +19 -0
  718. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/troubleshooting/after.md +11 -0
  719. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/examples/troubleshooting/before.md +11 -0
  720. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/motion-guide.md +123 -0
  721. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/code-patterns.md +468 -0
  722. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/deliverable-channels.md +111 -0
  723. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/en-patterns-checklist.md +43 -0
  724. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/en-patterns-content.md +243 -0
  725. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/en-patterns-structure.md +375 -0
  726. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/en-patterns.md +57 -0
  727. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/ko-metrics.md +33 -0
  728. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/ko-patterns-a-d.md +659 -0
  729. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/ko-patterns-e-j.md +387 -0
  730. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/ko-patterns.md +31 -0
  731. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/prompt-injection-handling.md +7 -0
  732. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/rewrite-playbook.md +54 -0
  733. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/references/taxonomy.md +153 -0
  734. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/rules.json +884 -0
  735. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/core.mjs +208 -0
  736. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/detect.mjs +83 -0
  737. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/extract_office_text.py +89 -0
  738. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/ko-metrics.mjs +124 -0
  739. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/test-fixtures.mjs +155 -0
  740. package/node_modules/@litcodex/lit-loop/skills/lit-humanizer/scripts/test-ko-metrics.mjs +27 -0
  741. package/node_modules/@litcodex/lit-loop/skills/lit-init/references/deep-repository-map.md +6 -10
  742. package/node_modules/@litcodex/lit-loop/skills/lit-loop/SKILL.md +95 -12
  743. package/node_modules/@litcodex/lit-loop/skills/lit-scientific-visualization/SKILL.md +2 -0
  744. package/node_modules/@litcodex/lit-loop/skills/litresearch/SKILL.md +28 -41
  745. package/node_modules/@litcodex/lit-loop/skills/litwork/SKILL.md +8 -0
  746. package/package.json +3 -3
  747. package/readme-assets/ab-simple/assets/s11-baseline-desktop.webp +0 -0
  748. package/readme-assets/ab-simple/assets/s11-baseline-phone.webp +0 -0
  749. package/readme-assets/ab-simple/assets/s11-lit-desktop.webp +0 -0
  750. package/readme-assets/ab-simple/assets/s11-lit-phone.webp +0 -0
  751. package/readme-assets/ab-simple/assets/s3-baseline-desktop.webp +0 -0
  752. package/readme-assets/ab-simple/assets/s3-baseline-phone.webp +0 -0
  753. package/readme-assets/ab-simple/assets/s3-lit-desktop.webp +0 -0
  754. package/readme-assets/ab-simple/assets/s3-lit-phone.webp +0 -0
  755. package/readme-assets/ab-simple/assets/s4-baseline-desktop.webp +0 -0
  756. package/readme-assets/ab-simple/assets/s4-baseline-phone.webp +0 -0
  757. package/readme-assets/ab-simple/assets/s4-lit-desktop.webp +0 -0
  758. package/readme-assets/ab-simple/assets/s4-lit-phone.webp +0 -0
  759. package/readme-assets/ab-simple/assets/s5-baseline-slides.webp +0 -0
  760. package/readme-assets/ab-simple/assets/s5-lit-slides.webp +0 -0
  761. package/readme-assets/ab-simple/assets/s7-lit-diagram.webp +0 -0
  762. package/readme-assets/ab-simple/assets/s8-baseline-slides.webp +0 -0
  763. package/readme-assets/ab-simple/assets/s8-lit-slides.webp +0 -0
  764. package/readme-assets/ab-simple/assets/s9-lit-pages.webp +0 -0
  765. package/readme-assets/badge-version.svg +1 -1
  766. package/readme-assets/cover-motion-still.webp +0 -0
  767. package/readme-assets/cover-motion.webp +0 -0
  768. package/readme-assets/skills/autoconference.webp +0 -0
  769. package/readme-assets/skills/automatic-checks.webp +0 -0
  770. package/readme-assets/skills/autoresearch.webp +0 -0
  771. package/readme-assets/skills/browser-drive.webp +0 -0
  772. package/readme-assets/skills/coding-session-audit.webp +0 -0
  773. package/readme-assets/skills/debugging.webp +0 -0
  774. package/readme-assets/skills/deep-interview.webp +0 -0
  775. package/readme-assets/skills/frontend-ui-ux.webp +0 -0
  776. package/readme-assets/skills/lit-burnoff-file.webp +0 -0
  777. package/readme-assets/skills/lit-burnoff.webp +0 -0
  778. package/readme-assets/skills/lit-code.webp +0 -0
  779. package/readme-assets/skills/lit-commit.webp +0 -0
  780. package/readme-assets/skills/lit-comprehend.webp +0 -0
  781. package/readme-assets/skills/lit-crucible.webp +0 -0
  782. package/readme-assets/skills/lit-diagram-drawer.webp +0 -0
  783. package/readme-assets/skills/lit-docx.webp +0 -0
  784. package/readme-assets/skills/lit-fetch.webp +0 -0
  785. package/readme-assets/skills/lit-handoff.webp +0 -0
  786. package/readme-assets/skills/lit-humanizer.webp +0 -0
  787. package/readme-assets/skills/lit-init.webp +0 -0
  788. package/readme-assets/skills/lit-loop.webp +0 -0
  789. package/readme-assets/skills/lit-plan.webp +0 -0
  790. package/readme-assets/skills/lit-pptx.webp +0 -0
  791. package/readme-assets/skills/lit-recap.webp +0 -0
  792. package/readme-assets/skills/lit-scientific-visualization.webp +0 -0
  793. package/readme-assets/skills/lit-team.webp +0 -0
  794. package/readme-assets/skills/lit-typographic-motion.webp +0 -0
  795. package/readme-assets/skills/litcodex-contribute-bug-fix.webp +0 -0
  796. package/readme-assets/skills/litcodex-doctor.webp +0 -0
  797. package/readme-assets/skills/litcodex-report-bug.webp +0 -0
  798. package/readme-assets/skills/litgoal.webp +0 -0
  799. package/readme-assets/skills/litresearch.webp +0 -0
  800. package/readme-assets/skills/litwork.webp +0 -0
  801. package/readme-assets/skills/lsp-setup.webp +0 -0
  802. package/readme-assets/skills/readme-studio.webp +0 -0
  803. package/readme-assets/skills/refactor.webp +0 -0
  804. package/readme-assets/skills/review-work.webp +0 -0
  805. package/readme-assets/skills/start-approved-plan.webp +0 -0
  806. package/readme-assets/skills/structural-search.webp +0 -0
  807. package/readme-assets/skills/visual-qa.webp +0 -0
  808. package/readme-assets/skills/wikify.webp +0 -0
  809. package/marketplace/plugins/litcodex/skills/lit-korean/SKILL.md +0 -206
  810. package/marketplace/plugins/litcodex/skills/lit-korean/references/prompt-injection-handling.md +0 -23
  811. package/marketplace/plugins/litcodex/skills/lit-korean/references/quick-rules.md +0 -38
  812. package/marketplace/plugins/litcodex/skills/lit-korean/references/safety-checklist.md +0 -38
  813. package/node_modules/@litcodex/lit-loop/skills/lit-korean/SKILL.md +0 -206
  814. package/node_modules/@litcodex/lit-loop/skills/lit-korean/references/prompt-injection-handling.md +0 -23
  815. package/node_modules/@litcodex/lit-loop/skills/lit-korean/references/quick-rules.md +0 -38
  816. package/node_modules/@litcodex/lit-loop/skills/lit-korean/references/safety-checklist.md +0 -38
@@ -0,0 +1,1885 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * render-adapter-pptx.js — Render a resolved slide spec to a PPTX file.
5
+ *
6
+ * Architecture: Each text line is its own separate shape (individual addText()
7
+ * call). Bullet items use manual "• " prefix in green (#00AE41) Bold 16pt.
8
+ * Section headers are separate shapes in Bold 18pt black.
9
+ *
10
+ * Input: resolved spec from layout-resolver, templateObj from registry, output path.
11
+ * Output: writes a .pptx file via pptxgenjs.
12
+ */
13
+
14
+ const fs = require("fs");
15
+ const os = require("os");
16
+ const path = require("path");
17
+ const PptxGenJS = require("pptxgenjs");
18
+ const { extractContent, looksLikeKpi } = require("./layout-resolver");
19
+
20
+ // Narrowest a KPI badge can be and still read as one glance.
21
+ const KPI_MIN_CARD_WIDTH_IN = 1.9;
22
+
23
+ const TOOLKIT_ROOT = path.resolve(__dirname, "../..");
24
+ const ASSETS_MEDIA = path.join(TOOLKIT_ROOT, "assets", "media");
25
+ const ASSETS_AZURE = path.join(TOOLKIT_ROOT, "assets", "azure");
26
+
27
+ /** Resolve a decoration asset path: explicit absolute override (custom-accent
28
+ * regenerated gradients), then d.dir "azure" → assets/azure, else assets/media. */
29
+ function decorAssetPath(d) {
30
+ if (d.assetPath) return d.assetPath;
31
+ if (d.dir === "azure") return path.join(ASSETS_AZURE, d.asset);
32
+ return path.join(ASSETS_MEDIA, d.asset);
33
+ }
34
+ const hex = (c) => (c || "#000000").replace("#", "");
35
+
36
+ function linkedTableCell(text, options) {
37
+ const original = cleanMd(text);
38
+ let display = original;
39
+ let url = null;
40
+ const markdown = original.match(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/i);
41
+ if (markdown) {
42
+ display = original.replace(markdown[0], markdown[1]);
43
+ url = markdown[2];
44
+ } else {
45
+ const rawUrl = original.match(/https?:\/\/[^\s<>\])}]+/i);
46
+ const doi = original.match(/\b10\.\d{4,9}\/[^\s<>\])}]+/i);
47
+ if (rawUrl) url = rawUrl[0].replace(/[.,;:]+$/, "");
48
+ else if (doi) url = `https://doi.org/${doi[0].replace(/[.,;:]+$/, "")}`;
49
+ }
50
+ return {
51
+ text: display,
52
+ options: {
53
+ ...options,
54
+ ...(url ? { hyperlink: { url } } : {}),
55
+ },
56
+ };
57
+ }
58
+
59
+ // ── Text style constants (template-derived with neutral fallbacks).
60
+ // These are reassigned from the template at the start of render() so the same
61
+ // adapter serves any enrolled template (e.g. BOILERPLATE-PRETENDARD).
62
+ let FONT_BOLD = "Pretendard";
63
+ let FONT_MEDIUM = "Pretendard";
64
+ let FONT_LIGHT = "Pretendard";
65
+ let CHAR_SPACING = -0.7;
66
+
67
+ function expandHome(p) {
68
+ if (p === "~") return os.homedir();
69
+ if (p && p.startsWith(`~${path.sep}`)) return path.join(os.homedir(), p.slice(2));
70
+ return p;
71
+ }
72
+
73
+ function resolveImagePath(src, sourceDir) {
74
+ if (!src) throw new Error("Image source is empty");
75
+ const expanded = expandHome(src);
76
+ const candidates = [];
77
+ if (path.isAbsolute(expanded)) candidates.push(expanded);
78
+ else {
79
+ if (sourceDir) candidates.push(path.resolve(sourceDir, expanded));
80
+ candidates.push(path.resolve(process.cwd(), expanded));
81
+ candidates.push(path.join(ASSETS_MEDIA, expanded));
82
+ candidates.push(path.resolve(TOOLKIT_ROOT, expanded));
83
+ }
84
+ const found = candidates.find((candidate) => fs.existsSync(candidate));
85
+ if (!found) {
86
+ throw new Error(`Image not found: ${src}. Checked: ${candidates.join(", ")}`);
87
+ }
88
+ return found;
89
+ }
90
+
91
+ function readImageSize(filePath) {
92
+ const buf = fs.readFileSync(filePath);
93
+ if (buf.length >= 24 && buf.toString("ascii", 1, 4) === "PNG") {
94
+ return { width: buf.readUInt32BE(16), height: buf.readUInt32BE(20) };
95
+ }
96
+ if (buf.length >= 4 && buf[0] === 0xff && buf[1] === 0xd8) {
97
+ let offset = 2;
98
+ while (offset + 9 < buf.length) {
99
+ if (buf[offset] !== 0xff) { offset++; continue; }
100
+ const marker = buf[offset + 1];
101
+ const length = buf.readUInt16BE(offset + 2);
102
+ if (length < 2) break;
103
+ if ((marker >= 0xc0 && marker <= 0xc3) || (marker >= 0xc5 && marker <= 0xc7) ||
104
+ (marker >= 0xc9 && marker <= 0xcb) || (marker >= 0xcd && marker <= 0xcf)) {
105
+ return { width: buf.readUInt16BE(offset + 7), height: buf.readUInt16BE(offset + 5) };
106
+ }
107
+ offset += 2 + length;
108
+ }
109
+ }
110
+ return null;
111
+ }
112
+
113
+ function containBox(x, y, w, h, imageSize) {
114
+ if (!imageSize || !imageSize.width || !imageSize.height) return { x, y, w, h };
115
+ const boxRatio = w / h;
116
+ const imageRatio = imageSize.width / imageSize.height;
117
+ if (imageRatio > boxRatio) {
118
+ const fittedH = w / imageRatio;
119
+ return { x, y: y + (h - fittedH) / 2, w, h: fittedH };
120
+ }
121
+ const fittedW = h * imageRatio;
122
+ return { x: x + (w - fittedW) / 2, y, w: fittedW, h };
123
+ }
124
+
125
+ // Bullet items
126
+ let BULLET_FONT = FONT_BOLD;
127
+ const BULLET_SIZE = 16;
128
+ let BULLET_COLOR = "334155"; // neutral fallback, reassigned per-template
129
+ let SECTION_ACCENT = "334155"; // neutral fallback, reassigned per-template
130
+ const BULLET_PREFIX = "\u2022 "; // "• " (bullet + two spaces)
131
+ const BULLET_X = 0.59;
132
+ const BULLET_W = 8.8;
133
+ const BULLET_H = 0.38;
134
+ const BULLET_Y_SPACING = 0.42;
135
+ const BULLET_LINE_SPACING = 1.25;
136
+
137
+ // Section headers
138
+ let SEC_HEADER_FONT = FONT_BOLD;
139
+ const SEC_HEADER_SIZE = 18;
140
+ const SEC_HEADER_COLOR = "000000";
141
+ const SEC_HEADER_X = 0.39;
142
+ const SEC_HEADER_W = 9.0;
143
+ const SEC_HEADER_H = 0.5;
144
+
145
+ // Summary (narrow width)
146
+ const SUMMARY_HEADER_W = 4.3;
147
+ const SUMMARY_BULLET_W = 4.8;
148
+ const SUMMARY_BULLET_SIZE = 14;
149
+ const SUMMARY_BULLET_H = 0.34;
150
+ const SUMMARY_BULLET_Y_SPACING = 0.38;
151
+ const SUMMARY_BULLET_LINE_SPACING = 1.05;
152
+
153
+ // TOC items (separate shapes)
154
+ let TOC_FONT = FONT_BOLD;
155
+ const TOC_SIZE = 18;
156
+ const TOC_COLOR = "000000";
157
+ const TOC_X = 0.390;
158
+ const TOC_W = 7.500;
159
+ const TOC_H = 0.550;
160
+ const TOC_Y_START = 0.957;
161
+ const TOC_Y_SPACING = 0.650;
162
+
163
+ function weightedTextLength(text) {
164
+ let total = 0;
165
+ for (const ch of String(text || "")) {
166
+ if (/\s/.test(ch)) total += 0.35;
167
+ else if (/^[\x00-\x7F]$/.test(ch)) total += 0.58;
168
+ else total += 1.0;
169
+ }
170
+ return total;
171
+ }
172
+
173
+ function estimateWrappedLines(text, widthIn, fontSize) {
174
+ const usablePt = Math.max(12, (widthIn || 4) * 72 - 10);
175
+ // Conservative on purpose: PowerPoint wraps dense mixed
176
+ // Korean-English strings earlier than a naive ASCII width estimate.
177
+ const unitsPerLine = Math.max(4, usablePt / Math.max(4, fontSize * 0.95));
178
+ return Math.max(1, Math.ceil(weightedTextLength(text) / unitsPerLine));
179
+ }
180
+
181
+ function estimateTextHeight(text, widthIn, fontSize, lineSpacingMultiple) {
182
+ const lines = estimateWrappedLines(text, widthIn, fontSize);
183
+ return Math.max(0.14, ((lines * fontSize * lineSpacingMultiple) / 72) * 1.4 + 0.08);
184
+ }
185
+
186
+ function bodyElements(items) {
187
+ const elements = [];
188
+ let numberedCounter = 0;
189
+ for (const item of items) {
190
+ if (item.type === "section") {
191
+ elements.push({ kind: "section", text: item.heading || "" });
192
+ numberedCounter = 0;
193
+ for (const child of item.children || []) {
194
+ numberedCounter++;
195
+ elements.push({ kind: "numbered", text: `(${numberedCounter}) ${child.text || ""}` });
196
+ }
197
+ } else if (item.type === "bullet") {
198
+ elements.push({ kind: "bullet", text: item.text || "" });
199
+ numberedCounter = 0;
200
+ for (const child of item.children || []) {
201
+ numberedCounter++;
202
+ elements.push({ kind: "numbered", text: `(${numberedCounter}) ${child.text || ""}` });
203
+ }
204
+ } else if (item.type === "numbered") {
205
+ numberedCounter++;
206
+ elements.push({ kind: "numbered", text: `(${numberedCounter}) ${item.text || ""}` });
207
+ } else if (item.type === "text") {
208
+ elements.push({ kind: "text", text: item.text || "" });
209
+ }
210
+ }
211
+ return elements;
212
+ }
213
+
214
+ function chooseBodyStyle(items, widthIn, startY, bottomY) {
215
+ const available = Math.max(0.5, (bottomY || 7.0) - startY);
216
+ const sizes = [16, 15, 14, 13];
217
+ for (const bodySize of sizes) {
218
+ const sectionSize = Math.min(18, bodySize + 2);
219
+ const lineSpacing = bodySize <= 10 ? 1.05 : 1.18;
220
+ const gap = bodySize <= 10 ? 0.035 : 0.05;
221
+ const total = bodyElements(items).reduce((sum, el) => {
222
+ const size = el.kind === "section" ? sectionSize : bodySize;
223
+ const w = el.kind === "section" ? Math.min(widthIn, SEC_HEADER_W) : widthIn;
224
+ return sum + estimateTextHeight(el.text, w, size, lineSpacing) + gap;
225
+ }, 0);
226
+ if (total <= available) return { bodySize, sectionSize, lineSpacing, gap };
227
+ }
228
+ return { bodySize: 13, sectionSize: 15, lineSpacing: 1.08, gap: 0.04 };
229
+ }
230
+
231
+ function estimateSectionHeight(item, secW, bulletW, style) {
232
+ let total = estimateTextHeight(item.heading || "", secW, style.sectionSize, style.lineSpacing) + style.gap;
233
+ let numberedCounter = 0;
234
+ for (const child of item.children || []) {
235
+ numberedCounter++;
236
+ total += estimateTextHeight(`(${numberedCounter}) ${child.text || ""}`, bulletW, style.bodySize, style.lineSpacing) + style.gap;
237
+ }
238
+ return total + 0.12;
239
+ }
240
+
241
+ function addSectionCard(slide, x, y, w, h) {
242
+ slide.addShape("rect", {
243
+ x,
244
+ y: y - 0.035,
245
+ w,
246
+ h: Math.max(0.28, h),
247
+ fill: { color: "F7F9F8", transparency: 12 },
248
+ line: { color: "D8E2DD", width: 0.5, transparency: 20 },
249
+ });
250
+ }
251
+
252
+ function bodyItemsToDiagnosticLines(items) {
253
+ const lines = [];
254
+ let numberedCounter = 0;
255
+ for (const item of items || []) {
256
+ if (item.type === "section") {
257
+ lines.push(`■ ${item.heading || ""}`);
258
+ numberedCounter = 0;
259
+ for (const child of item.children || []) {
260
+ numberedCounter++;
261
+ lines.push(`(${numberedCounter}) ${child.text || ""}`);
262
+ }
263
+ } else if (item.type === "bullet") {
264
+ lines.push(`• ${item.text || ""}`);
265
+ numberedCounter = 0;
266
+ for (const child of item.children || []) {
267
+ numberedCounter++;
268
+ lines.push(`(${numberedCounter}) ${child.text || ""}`);
269
+ }
270
+ } else if (item.type === "numbered") {
271
+ numberedCounter++;
272
+ lines.push(`(${numberedCounter}) ${item.text || ""}`);
273
+ } else if (item.type === "text") {
274
+ lines.push(item.text || "");
275
+ }
276
+ }
277
+ return lines.filter(Boolean);
278
+ }
279
+
280
+ function bodyItemsToDiagnosticCards(items) {
281
+ const cards = [];
282
+ let numberedCounter = 0;
283
+ for (const item of items || []) {
284
+ if (item.type === "section" || item.type === "bullet") {
285
+ const title = item.heading || item.text || "";
286
+ const body = [];
287
+ numberedCounter = 0;
288
+ for (const child of item.children || []) {
289
+ numberedCounter++;
290
+ body.push(`(${numberedCounter}) ${child.text || ""}`);
291
+ }
292
+ if (title || body.length) cards.push({ title, body });
293
+ } else if (item.type === "numbered") {
294
+ numberedCounter++;
295
+ cards.push({ title: `(${numberedCounter})`, body: [item.text || ""] });
296
+ } else if (item.type === "text" && item.text) {
297
+ cards.push({ title: "", body: [item.text] });
298
+ }
299
+ }
300
+ return cards;
301
+ }
302
+
303
+ function splitLinesByWeight(lines, columns) {
304
+ const groups = Array.from({ length: columns }, () => []);
305
+ const weights = Array(columns).fill(0);
306
+ for (const line of lines) {
307
+ let target = 0;
308
+ for (let i = 1; i < columns; i++) {
309
+ if (weights[i] < weights[target]) target = i;
310
+ }
311
+ groups[target].push(line);
312
+ weights[target] += Math.max(20, weightedTextLength(line));
313
+ }
314
+ return groups;
315
+ }
316
+
317
+ function splitCardsByWeight(cards, columns) {
318
+ const groups = Array.from({ length: columns }, () => []);
319
+ const weights = Array(columns).fill(0);
320
+ for (const card of cards) {
321
+ let target = 0;
322
+ for (let i = 1; i < columns; i++) {
323
+ if (weights[i] < weights[target]) target = i;
324
+ }
325
+ groups[target].push(card);
326
+ const cardWeight = weightedTextLength(card.title || "") * 1.4
327
+ + (card.body || []).reduce((sum, line) => sum + weightedTextLength(line), 0);
328
+ weights[target] += Math.max(80, cardWeight);
329
+ }
330
+ return groups;
331
+ }
332
+
333
+ function renderDiagnosticCard(slide, card, x, y, w, h, idx) {
334
+ slide.addShape("rect", {
335
+ x,
336
+ y,
337
+ w,
338
+ h,
339
+ fill: { color: idx % 2 ? "F8FAF9" : "F3F6F4", transparency: 2 },
340
+ line: { color: "D6E2DB", width: 0.35, transparency: 12 },
341
+ });
342
+ slide.addShape("rect", {
343
+ x,
344
+ y,
345
+ w: 0.028,
346
+ h,
347
+ fill: { color: SECTION_ACCENT, transparency: 0 },
348
+ line: { color: SECTION_ACCENT, transparency: 100 },
349
+ });
350
+
351
+ const padX = 0.055;
352
+ const padY = 0.05;
353
+ const titleH = card.title ? Math.min(0.28, Math.max(0.18, h * 0.16)) : 0;
354
+ if (card.title) {
355
+ slide.addText(card.title, {
356
+ x: x + padX,
357
+ y: y + padY,
358
+ w: w - padX * 1.45,
359
+ h: titleH,
360
+ fontFace: FONT_BOLD,
361
+ fontSize: 7.4,
362
+ color: "002554",
363
+ charSpacing: -0.25,
364
+ fit: "shrink",
365
+ margin: 0.01,
366
+ breakLine: false,
367
+ valign: "top",
368
+ });
369
+ }
370
+
371
+ const bodyText = (card.body || []).join("\n");
372
+ if (bodyText) {
373
+ slide.addText(bodyText, {
374
+ x: x + padX,
375
+ y: y + padY + titleH + 0.015,
376
+ w: w - padX * 1.45,
377
+ h: Math.max(0.16, h - titleH - padY * 1.6),
378
+ fontFace: FONT_MEDIUM,
379
+ fontSize: 5.85,
380
+ color: "1F1F1F",
381
+ charSpacing: -0.18,
382
+ fit: "shrink",
383
+ margin: 0.008,
384
+ paraSpaceAfterPt: 0,
385
+ lineSpacingMultiple: 0.96,
386
+ breakLine: false,
387
+ valign: "top",
388
+ });
389
+ }
390
+ }
391
+
392
+ function estimateDiagnosticCardHeight(card, w) {
393
+ const padY = 0.05;
394
+ const titleH = card.title ? 0.24 : 0;
395
+ const bodyText = (card.body || []).join("\n");
396
+ const bodyH = bodyText ? estimateTextHeight(bodyText, Math.max(0.8, w - 0.12), 5.85, 1.02) : 0;
397
+ return Math.max(0.56, Math.min(2.35, padY * 2 + titleH + bodyH));
398
+ }
399
+
400
+ function renderCramStressBody(slide, items, pageW, pageH) {
401
+ const cards = bodyItemsToDiagnosticCards(items);
402
+ const columns = 3;
403
+ const groups = cards.length ? splitCardsByWeight(cards, columns) : splitLinesByWeight(bodyItemsToDiagnosticLines(items), columns).map((group) => [{ title: "", body: group }]);
404
+ const x = 0.28;
405
+ const y = 0.98;
406
+ const w = 7.78;
407
+ const h = pageH - y - 0.34;
408
+ const gap = 0.105;
409
+ const colW = (w - gap * (columns - 1)) / columns;
410
+ groups.forEach((group, idx) => {
411
+ const colX = x + idx * (colW + gap);
412
+ const cardGap = 0.075;
413
+ const availableH = h - cardGap * Math.max(0, group.length - 1);
414
+ const desiredHeights = group.map((card) => estimateDiagnosticCardHeight(card, colW));
415
+ const desiredTotal = desiredHeights.reduce((sum, value) => sum + value, 0) || 1;
416
+ const scale = desiredTotal > availableH ? availableH / desiredTotal : 1;
417
+ let cursorY = y;
418
+ group.forEach((card, cardIdx) => {
419
+ const remainingCards = group.length - cardIdx - 1;
420
+ const rawH = desiredHeights[cardIdx] * scale;
421
+ const cardH = Math.max(0.62, Math.min(rawH, h - (cursorY - y) - remainingCards * (0.62 + cardGap)));
422
+ renderDiagnosticCard(slide, card, colX, cursorY, colW, cardH, idx + cardIdx);
423
+ cursorY += cardH + cardGap;
424
+ });
425
+ });
426
+ }
427
+
428
+ function renderCramStressImageSheet(slide, content, sourceDir, pageW, pageH) {
429
+ if (!content) return;
430
+ const images = content.type === "image-grid"
431
+ ? (Array.isArray(content.images) ? content.images : [])
432
+ : content.type === "image" ? [content] : [];
433
+ if (images.length === 0) return;
434
+ const x = 8.24;
435
+ const y = 0.98;
436
+ const w = pageW - x - 0.25;
437
+ const h = pageH - y - 0.34;
438
+ const cols = images.length >= 8 ? 2 : 1;
439
+ const rows = Math.ceil(images.length / cols);
440
+ const gap = 0.04;
441
+ const cellW = (w - gap * (cols - 1)) / cols;
442
+ const headerH = 0.28;
443
+ const sheetH = Math.min(h - 0.9, rows * 0.58 + gap * (rows - 1));
444
+ const cellH = (sheetH - gap * (rows - 1)) / rows;
445
+ const noteY = y + headerH + sheetH + 0.16;
446
+ const noteH = Math.min(1.0, h - (noteY - y) - 0.08);
447
+ const panelH = noteY - y + noteH;
448
+ slide.addShape("rect", {
449
+ x: x - 0.04,
450
+ y: y - 0.04,
451
+ w: w + 0.08,
452
+ h: panelH + 0.08,
453
+ fill: { color: "F5F8F6", transparency: 0 },
454
+ line: { color: "CAD4CE", width: 0.5 },
455
+ });
456
+ slide.addText("RAW EVIDENCE CONTACT SHEET", {
457
+ x,
458
+ y: y + 0.02,
459
+ w,
460
+ h: 0.16,
461
+ fontFace: FONT_BOLD,
462
+ fontSize: 5.8,
463
+ color: "002554",
464
+ charSpacing: -0.15,
465
+ fit: "shrink",
466
+ margin: 0,
467
+ });
468
+ slide.addShape("rect", {
469
+ x,
470
+ y: y + 0.22,
471
+ w,
472
+ h: 0,
473
+ line: { color: SECTION_ACCENT, width: 0.45 },
474
+ });
475
+ images.forEach((image, idx) => {
476
+ const imgPath = resolveImagePath(image.src, sourceDir);
477
+ const col = idx % cols;
478
+ const row = Math.floor(idx / cols);
479
+ const fit = containBox(
480
+ x + col * (cellW + gap),
481
+ y + headerH + row * (cellH + gap),
482
+ cellW,
483
+ cellH,
484
+ readImageSize(imgPath),
485
+ );
486
+ slide.addImage({
487
+ path: imgPath,
488
+ ...fit,
489
+ altText: image.caption || path.basename(image.src || imgPath),
490
+ });
491
+ });
492
+ slide.addShape("rect", {
493
+ x,
494
+ y: noteY,
495
+ w,
496
+ h: noteH,
497
+ fill: { color: "FFFFFF", transparency: 0 },
498
+ line: { color: "D6E2DB", width: 0.35, transparency: 20 },
499
+ });
500
+ slide.addText("diagnostic cram-stress\nmicrotext is intentional\nproduction decks must synthesize\noverflow / marker / missing media = fail", {
501
+ x: x + 0.06,
502
+ y: noteY + 0.07,
503
+ w: w - 0.12,
504
+ h: Math.max(0.24, noteH - 0.14),
505
+ fontFace: FONT_MEDIUM,
506
+ fontSize: 5.3,
507
+ color: "333333",
508
+ charSpacing: -0.15,
509
+ fit: "shrink",
510
+ margin: 0.01,
511
+ breakLine: false,
512
+ lineSpacingMultiple: 1.02,
513
+ valign: "mid",
514
+ });
515
+ }
516
+
517
+ function isCramStressDeck(resolved) {
518
+ const meta = (resolved && resolved.deck && resolved.deck.metadata) || {};
519
+ return String(meta.render_mode || meta.renderMode || "").toLowerCase() === "cram-stress";
520
+ }
521
+
522
+ function renderCramStressSlide(slide, slideSpec, pageW, pageH, sourceDir) {
523
+ const regions = slideSpec.regions || {};
524
+ const title = regions.title && regions.title.content;
525
+ if (title) {
526
+ slide.addText(String(title), {
527
+ x: 0.24,
528
+ y: 0.24,
529
+ w: pageW - 1.72,
530
+ h: 0.46,
531
+ fontFace: FONT_BOLD,
532
+ fontSize: 13.5,
533
+ color: "000000",
534
+ charSpacing: CHAR_SPACING,
535
+ fit: "shrink",
536
+ });
537
+ slide.addShape("rect", {
538
+ x: 0.24,
539
+ y: 0.76,
540
+ w: pageW - 0.48,
541
+ h: 0,
542
+ line: { color: SECTION_ACCENT, width: 1.2 },
543
+ });
544
+ }
545
+ if (regions.body && regions.body.content && regions.body.content.type === "body") {
546
+ renderCramStressBody(slide, regions.body.content.items || [], pageW, pageH);
547
+ }
548
+ if (regions.image && regions.image.content) {
549
+ renderCramStressImageSheet(slide, regions.image.content, sourceDir, pageW, pageH);
550
+ }
551
+ }
552
+
553
+ function shouldUseDenseBodyFlow(items, widthIn, startY, bottomY) {
554
+ const elements = bodyElements(items);
555
+ const charCount = elements.reduce((sum, el) => sum + String(el.text || "").length, 0);
556
+ const available = Math.max(0.5, (bottomY || 7.0) - startY);
557
+ const estimatedAtMin = elements.reduce((sum, el) => {
558
+ const size = el.kind === "section" ? 12.8 : 11.5;
559
+ return sum + estimateTextHeight(el.text, Math.max(1.8, widthIn / 2), size, 1.02) + 0.025;
560
+ }, 0);
561
+ return widthIn >= 4.4 && (elements.length >= 18 || charCount >= 2400 || estimatedAtMin > available * 1.35);
562
+ }
563
+
564
+ function chooseDenseBodyStyle() {
565
+ return { bodySize: 11.5, sectionSize: 12.8, lineSpacing: 1.02, gap: 0.025 };
566
+ }
567
+
568
+ // ── Font role helpers ───────────────────────────────────────────────────────
569
+
570
+ /**
571
+ * Build font role map from template capabilities.
572
+ * Maps YAML field names to pptxgenjs option names.
573
+ */
574
+ function buildFontRoles(templateObj) {
575
+ if (!templateObj || !templateObj.capabilities || !templateObj.capabilities.font_roles) {
576
+ return {};
577
+ }
578
+
579
+ const roles = {};
580
+ for (const [name, def] of Object.entries(templateObj.capabilities.font_roles)) {
581
+ roles[name] = {
582
+ font: def.font,
583
+ size: def.size,
584
+ color: (def.color || "#000000").replace("#", ""),
585
+ align: def.align || "left",
586
+ charSpacing: def.char_spacing,
587
+ lineSpacing: def.line_spacing,
588
+ bold: def.bold,
589
+ spaceAfter: def.space_after,
590
+ bulletType: def.bullet_type,
591
+ bulletChar: def.bullet_char,
592
+ bulletFont: def.bullet_font,
593
+ numberType: def.number_type,
594
+ marL: def.marL,
595
+ indent: def.indent,
596
+ fill: def.fill ? def.fill.replace("#", "") : undefined,
597
+ borderColor: def.border_color ? def.border_color.replace("#", "") : undefined,
598
+ borderWidth: def.border_width,
599
+ };
600
+ }
601
+ return roles;
602
+ }
603
+
604
+ // ── Decoration rendering ────────────────────────────────────────────────────
605
+
606
+ /**
607
+ * Add decoration elements to a pptxgenjs slide.
608
+ * Note: slide_number is intentionally omitted — the reference template has none.
609
+ */
610
+ function addDecorations(slide, decorations, slideIdx, fontRoles) {
611
+ if (!decorations || !Array.isArray(decorations)) return;
612
+
613
+ for (const d of decorations) {
614
+ if (d.type === "image") {
615
+ slide.addImage({
616
+ path: decorAssetPath(d),
617
+ x: d.x || 0,
618
+ y: d.y || 0,
619
+ w: d.w || 1,
620
+ h: d.h || 1,
621
+ rotate: d.rotate || undefined,
622
+ altText: d.asset || "template-image",
623
+ });
624
+
625
+ } else if (d.type === "rect" || d.type === "roundRect" || d.type === "pill") {
626
+ // Solid color block / rounded card / full-radius pill. Optional text label.
627
+ const shape = d.type === "rect" ? "rect" : "roundRect";
628
+ const opts = {
629
+ x: d.x || 0, y: d.y || 0, w: d.w || 1, h: d.h || 0.5,
630
+ };
631
+ if (d.fill) opts.fill = { color: hex(d.fill), transparency: d.alpha || 0 };
632
+ else opts.fill = { type: "none" };
633
+ if (d.line) opts.line = { color: hex(d.line), width: d.line_width || 1 };
634
+ else opts.line = { type: "none" };
635
+ if (shape === "roundRect") opts.rectRadius = d.type === "pill" ? (d.h || 0.5) / 2 : (d.radius != null ? d.radius : 0.12);
636
+ slide.addShape(shape, opts);
637
+ if (d.text) {
638
+ slide.addText(d.text, {
639
+ x: d.x || 0, y: d.y || 0, w: d.w || 1, h: d.h || 0.5,
640
+ fontFace: d.font || FONT_BOLD, fontSize: d.size || 12,
641
+ color: hex(d.text_color || "#FFFFFF"), bold: !!d.bold,
642
+ align: d.align || "center", valign: "middle",
643
+ charSpacing: d.char_spacing != null ? d.char_spacing : CHAR_SPACING,
644
+ });
645
+ }
646
+
647
+ } else if (d.type === "ellipse" || d.type === "ring") {
648
+ const opts = { x: d.x || 0, y: d.y || 0, w: d.w || 1, h: d.h || (d.w || 1) };
649
+ if (d.type === "ring" || !d.fill) {
650
+ opts.fill = { type: "none" };
651
+ opts.line = { color: hex(d.line || d.color || "#FFFFFF"), width: d.line_width || 2 };
652
+ } else {
653
+ opts.fill = { color: hex(d.fill), transparency: d.alpha || 0 };
654
+ opts.line = { type: "none" };
655
+ }
656
+ slide.addShape("ellipse", opts);
657
+
658
+ } else if (d.type === "text") {
659
+ slide.addText(d.text || "", {
660
+ x: d.x || 0, y: d.y || 0, w: d.w || 4, h: d.h || 1,
661
+ fontFace: d.font || FONT_BOLD, fontSize: d.size || 14,
662
+ color: hex(d.color || "#000000"), bold: !!d.bold,
663
+ align: d.align || "left", valign: d.valign || "top",
664
+ charSpacing: d.char_spacing != null ? d.char_spacing : CHAR_SPACING,
665
+ transparency: d.transparency != null ? d.transparency : undefined,
666
+ });
667
+
668
+ } else if (d.type === "line") {
669
+ slide.addShape("rect", {
670
+ x: d.x || 0,
671
+ y: d.y || 0,
672
+ w: d.w || 1,
673
+ h: 0,
674
+ line: { color: (d.color || "#000000").replace("#", ""), width: d.width || 1 },
675
+ });
676
+
677
+ } else if (d.type === "confidential_mark") {
678
+ const role = fontRoles.confidential_mark || {};
679
+ const mX = d.x || 0, mY = d.y || 0, mW = d.w || 1, mH = d.h || 0.3;
680
+ const bColor = role.borderColor || "C00000";
681
+ const bPt = role.borderWidth || 1;
682
+ slide.addShape("rect", {
683
+ x: mX, y: mY, w: mW, h: mH,
684
+ line: { color: bColor, width: bPt },
685
+ });
686
+ slide.addText(d.text || "Confidential", {
687
+ x: mX, y: mY, w: mW, h: mH,
688
+ fontFace: role.font || "Pretendard",
689
+ fontSize: role.size || 14,
690
+ color: role.color || "C00000",
691
+ align: role.align || "center",
692
+ valign: "middle",
693
+ });
694
+
695
+ } else if (d.type === "disclaimer") {
696
+ const role = fontRoles.disclaimer || {};
697
+ slide.addText(
698
+ d.text || "※ 본 문서는 대외비입니다.",
699
+ {
700
+ x: d.x || 0,
701
+ y: d.y || 0,
702
+ w: d.w || 1,
703
+ h: d.h || 0.2,
704
+ fontFace: role.font || FONT_LIGHT,
705
+ fontSize: role.size || 6,
706
+ color: role.color || "666666",
707
+ align: role.align || "left",
708
+ }
709
+ );
710
+ }
711
+ // slide_number intentionally removed — reference template has none
712
+ }
713
+ }
714
+
715
+ // ── Body shape rendering (individual shapes per line) ────────────────────
716
+
717
+ /**
718
+ * Add body items as individual shapes to a slide.
719
+ * Each section header and bullet item is a separate positioned shape.
720
+ *
721
+ * @param {object} slide - pptxgenjs slide
722
+ * @param {Array} items - AST items (section, bullet, numbered, text)
723
+ * @param {number} startY - Starting y position
724
+ * @param {number} maxX - Max width for positioning
725
+ * @returns {number} The y position after the last item
726
+ */
727
+ function addBodyShapes(slide, items, startY, maxX, bottomY, originX) {
728
+ const denseFlow = shouldUseDenseBodyFlow(items, maxX, startY, bottomY || 7.0);
729
+ const columns = denseFlow ? 2 : 1;
730
+ const colGap = denseFlow ? 0.16 : 0;
731
+ const colW = (maxX - colGap * (columns - 1)) / columns;
732
+ let col = 0;
733
+ let y = startY;
734
+ // Template regions have always drawn body text at the template's own left
735
+ // margin. A placed box carries its own, and passes it here.
736
+ const baseX = originX != null ? originX : SEC_HEADER_X;
737
+ const bodyIndent = denseFlow ? 0.13 : (BULLET_X - SEC_HEADER_X);
738
+ const BODY_FULL_W = 10.188;
739
+ const scale = colW / BODY_FULL_W;
740
+ const secW = denseFlow ? Math.max(1.4, colW - 0.04) : SEC_HEADER_W * scale;
741
+ const bulletW = denseFlow ? Math.max(1.2, colW - bodyIndent - 0.02) : BULLET_W * scale;
742
+ let numberedCounter = 0;
743
+ const style = denseFlow ? chooseDenseBodyStyle() : chooseBodyStyle(items, bulletW, startY, bottomY || 7.0);
744
+
745
+ function colX() { return baseX + col * (colW + colGap); }
746
+ function secX() { return colX(); }
747
+ function bulletX() { return colX() + bodyIndent; }
748
+ function maybeAdvanceColumn(nextHeight) {
749
+ if (!denseFlow || col >= columns - 1) return;
750
+ if (y + nextHeight > (bottomY || 7.0)) {
751
+ col++;
752
+ y = startY;
753
+ }
754
+ }
755
+
756
+ for (const item of items) {
757
+ if (item.type === "section") {
758
+ const sectionH = estimateTextHeight(item.heading, secW, style.sectionSize, style.lineSpacing);
759
+ const cardH = estimateSectionHeight(item, secW, bulletW, style);
760
+ maybeAdvanceColumn(Math.min(cardH, sectionH + 0.2));
761
+ addSectionCard(slide, secX() - 0.035, y - 0.03, Math.max(secW, bulletW + bodyIndent) + 0.07, cardH);
762
+ // Section header — separate shape, black, 1.5 line spacing
763
+ slide.addText(mdRuns(item.heading, {
764
+ fontFace: SEC_HEADER_FONT,
765
+ fontSize: style.sectionSize,
766
+ color: SEC_HEADER_COLOR,
767
+ charSpacing: CHAR_SPACING,
768
+ }), {
769
+ x: secX(),
770
+ y: y,
771
+ w: secW,
772
+ h: sectionH,
773
+ lineSpacingMultiple: style.lineSpacing,
774
+ });
775
+ y += sectionH + style.gap;
776
+
777
+ // Numbered children with (1)(2)(3) format
778
+ if (item.children) {
779
+ numberedCounter = 0;
780
+ for (const child of item.children) {
781
+ numberedCounter++;
782
+ const numPrefix = `(${numberedCounter}) `;
783
+ const text = numPrefix + cleanMd(child.text);
784
+ const h = estimateTextHeight(text, bulletW, style.bodySize, style.lineSpacing);
785
+ maybeAdvanceColumn(h);
786
+ slide.addText([
787
+ { text: numPrefix, options: { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING } },
788
+ ...mdRuns(child.text, { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING }),
789
+ ], {
790
+ x: bulletX(),
791
+ y: y,
792
+ w: bulletW,
793
+ h,
794
+ lineSpacingMultiple: style.lineSpacing,
795
+ });
796
+ y += h + style.gap;
797
+ }
798
+ }
799
+ y += 0.08;
800
+
801
+ } else if (item.type === "bullet") {
802
+ const h = estimateTextHeight(item.text, bulletW, style.bodySize, style.lineSpacing);
803
+ maybeAdvanceColumn(h);
804
+ // Bullet item — green prefix + black text
805
+ slide.addText([
806
+ { text: BULLET_PREFIX, options: { fontFace: FONT_BOLD, fontSize: style.bodySize, color: BULLET_COLOR, charSpacing: CHAR_SPACING } },
807
+ ...mdRuns(item.text, { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING }),
808
+ ], {
809
+ x: bulletX(),
810
+ y: y,
811
+ w: bulletW,
812
+ h,
813
+ lineSpacingMultiple: style.lineSpacing,
814
+ });
815
+ y += h + style.gap;
816
+
817
+ // Children (numbered sub-items)
818
+ if (item.children) {
819
+ numberedCounter = 0;
820
+ for (const child of item.children) {
821
+ numberedCounter++;
822
+ const numPrefix = `(${numberedCounter}) `;
823
+ const text = numPrefix + cleanMd(child.text);
824
+ const childH = estimateTextHeight(text, bulletW, style.bodySize, style.lineSpacing);
825
+ maybeAdvanceColumn(childH);
826
+ slide.addText([
827
+ { text: numPrefix, options: { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING } },
828
+ ...mdRuns(child.text, { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING }),
829
+ ], {
830
+ x: bulletX(),
831
+ y: y,
832
+ w: bulletW,
833
+ h: childH,
834
+ lineSpacingMultiple: style.lineSpacing,
835
+ });
836
+ y += childH + style.gap;
837
+ }
838
+ }
839
+
840
+ } else if (item.type === "numbered") {
841
+ numberedCounter++;
842
+ const numPrefix = `(${numberedCounter}) `;
843
+ const text = numPrefix + cleanMd(item.text);
844
+ const h = estimateTextHeight(text, bulletW, style.bodySize, style.lineSpacing);
845
+ maybeAdvanceColumn(h);
846
+ slide.addText([
847
+ { text: numPrefix, options: { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING } },
848
+ ...mdRuns(item.text, { fontFace: FONT_MEDIUM, fontSize: style.bodySize, color: "000000", charSpacing: CHAR_SPACING }),
849
+ ], {
850
+ x: bulletX(),
851
+ y: y,
852
+ w: bulletW,
853
+ h,
854
+ lineSpacingMultiple: style.lineSpacing,
855
+ });
856
+ y += h + style.gap;
857
+
858
+ } else if (item.type === "text") {
859
+ const h = estimateTextHeight(item.text, bulletW, style.bodySize, style.lineSpacing);
860
+ maybeAdvanceColumn(h);
861
+ slide.addText(mdRuns(item.text, {
862
+ fontFace: FONT_MEDIUM,
863
+ fontSize: style.bodySize,
864
+ color: "000000",
865
+ charSpacing: CHAR_SPACING,
866
+ }), {
867
+ x: bulletX(),
868
+ y: y,
869
+ w: bulletW,
870
+ h,
871
+ lineSpacingMultiple: style.lineSpacing,
872
+ });
873
+ y += h + style.gap;
874
+ }
875
+ }
876
+
877
+ return y;
878
+ }
879
+
880
+ /**
881
+ * Add summary group content as individual shapes.
882
+ * Uses narrow width (~4.3" for headers, ~4.1" for bullets).
883
+ */
884
+ function addSummaryShapes(slide, content, region) {
885
+ let y = region.y || 1.04;
886
+
887
+ // Group heading
888
+ if (content.heading) {
889
+ slide.addText(mdRuns(content.heading, {
890
+ fontFace: SEC_HEADER_FONT,
891
+ fontSize: SEC_HEADER_SIZE,
892
+ color: SEC_HEADER_COLOR,
893
+ charSpacing: CHAR_SPACING,
894
+ }), {
895
+ x: region.x || 0.39,
896
+ y: y,
897
+ w: SUMMARY_HEADER_W,
898
+ h: SEC_HEADER_H,
899
+ });
900
+ y += SEC_HEADER_H + 0.08;
901
+ }
902
+
903
+ // Items
904
+ if (content.items) {
905
+ for (const item of content.items) {
906
+ if (item.type === "section") {
907
+ // Section header
908
+ slide.addText(mdRuns(item.heading, {
909
+ fontFace: SEC_HEADER_FONT,
910
+ fontSize: SEC_HEADER_SIZE,
911
+ color: SEC_HEADER_COLOR,
912
+ charSpacing: CHAR_SPACING,
913
+ }), {
914
+ x: region.x || 0.39,
915
+ y: y,
916
+ w: SUMMARY_HEADER_W,
917
+ h: SEC_HEADER_H,
918
+ });
919
+ y += SEC_HEADER_H + 0.05;
920
+
921
+ // Children as bullet items
922
+ if (item.children) {
923
+ for (const child of item.children) {
924
+ slide.addText([
925
+ { text: BULLET_PREFIX, options: { fontFace: FONT_BOLD, fontSize: SUMMARY_BULLET_SIZE, color: BULLET_COLOR, charSpacing: CHAR_SPACING } },
926
+ ...mdRuns(child.text, { fontFace: FONT_MEDIUM, fontSize: SUMMARY_BULLET_SIZE, color: "000000", charSpacing: CHAR_SPACING }),
927
+ ], {
928
+ x: 0.59,
929
+ y: y,
930
+ w: SUMMARY_BULLET_W,
931
+ h: SUMMARY_BULLET_H,
932
+ lineSpacingMultiple: SUMMARY_BULLET_LINE_SPACING,
933
+ });
934
+ y += SUMMARY_BULLET_Y_SPACING;
935
+ }
936
+ }
937
+
938
+ } else if (item.type === "bullet") {
939
+ slide.addText([
940
+ { text: BULLET_PREFIX, options: { fontFace: FONT_BOLD, fontSize: SUMMARY_BULLET_SIZE, color: BULLET_COLOR, charSpacing: CHAR_SPACING } },
941
+ ...mdRuns(item.text, { fontFace: FONT_MEDIUM, fontSize: SUMMARY_BULLET_SIZE, color: "000000", charSpacing: CHAR_SPACING }),
942
+ ], {
943
+ x: 0.59,
944
+ y: y,
945
+ w: SUMMARY_BULLET_W,
946
+ h: SUMMARY_BULLET_H,
947
+ lineSpacingMultiple: SUMMARY_BULLET_LINE_SPACING,
948
+ });
949
+ y += SUMMARY_BULLET_Y_SPACING;
950
+
951
+ if (item.children) {
952
+ for (const child of item.children) {
953
+ slide.addText([
954
+ { text: BULLET_PREFIX, options: { fontFace: FONT_BOLD, fontSize: SUMMARY_BULLET_SIZE, color: BULLET_COLOR, charSpacing: CHAR_SPACING } },
955
+ ...mdRuns(child.text, { fontFace: FONT_MEDIUM, fontSize: SUMMARY_BULLET_SIZE, color: "000000", charSpacing: CHAR_SPACING }),
956
+ ], {
957
+ x: 0.59,
958
+ y: y,
959
+ w: SUMMARY_BULLET_W,
960
+ h: SUMMARY_BULLET_H,
961
+ lineSpacingMultiple: SUMMARY_BULLET_LINE_SPACING,
962
+ });
963
+ y += SUMMARY_BULLET_Y_SPACING;
964
+ }
965
+ }
966
+
967
+ } else if (item.type === "numbered") {
968
+ slide.addText([
969
+ { text: BULLET_PREFIX, options: { fontFace: FONT_BOLD, fontSize: SUMMARY_BULLET_SIZE, color: BULLET_COLOR, charSpacing: CHAR_SPACING } },
970
+ ...mdRuns(item.text, { fontFace: FONT_MEDIUM, fontSize: SUMMARY_BULLET_SIZE, color: "000000", charSpacing: CHAR_SPACING }),
971
+ ], {
972
+ x: 0.59,
973
+ y: y,
974
+ w: SUMMARY_BULLET_W,
975
+ h: SUMMARY_BULLET_H,
976
+ lineSpacingMultiple: SUMMARY_BULLET_LINE_SPACING,
977
+ });
978
+ y += SUMMARY_BULLET_Y_SPACING;
979
+ }
980
+ }
981
+ }
982
+ }
983
+
984
+ // ── TOC rendering (separate shapes per item) ─────────────────────────────
985
+
986
+ /**
987
+ * Add TOC items as separate text shapes, matching TEMPLATE-PPTX.pptx exactly.
988
+ * Each item is: "N. text" in the template title font at 18pt, w=7.5, h=0.55, spaced 0.65" apart.
989
+ */
990
+ function addTocShapes(slide, items) {
991
+ let y = TOC_Y_START;
992
+ let num = 1;
993
+
994
+ for (const item of items) {
995
+ const text = `${num}. ${cleanMd(item.text || item.heading || "")}`;
996
+ slide.addText(text, {
997
+ x: TOC_X,
998
+ y: y,
999
+ w: TOC_W,
1000
+ h: TOC_H,
1001
+ fontFace: TOC_FONT,
1002
+ fontSize: TOC_SIZE,
1003
+ color: TOC_COLOR,
1004
+ charSpacing: CHAR_SPACING,
1005
+ });
1006
+ y += TOC_Y_SPACING;
1007
+ num++;
1008
+ }
1009
+ }
1010
+
1011
+ /**
1012
+ * Check if a slide is a TOC slide by inspecting the title region content.
1013
+ */
1014
+ function isTocSlide(regions) {
1015
+ const title = regions.title;
1016
+ if (!title || typeof title.content !== "string") return false;
1017
+ return title.content.includes("목차");
1018
+ }
1019
+
1020
+ function adjustedRegionsForImageColumn(regions) {
1021
+ const body = regions.body;
1022
+ const image = regions.image;
1023
+ if (!body || !image || !body.content || !image.content) return regions;
1024
+ if (body.content.type !== "body" || !["image", "image-grid"].includes(image.content.type)) return regions;
1025
+
1026
+ const bodyX = body.x || 0;
1027
+ const bodyW = body.w || 10.188;
1028
+ const imageX = image.x || 0;
1029
+ const gap = 0.25;
1030
+ if (imageX <= bodyX || imageX >= bodyX + bodyW) return regions;
1031
+
1032
+ const denseImageGrid = image.content.type === "image-grid" && Array.isArray(image.content.images) && image.content.images.length >= 6;
1033
+ return {
1034
+ ...regions,
1035
+ body: {
1036
+ ...body,
1037
+ w: Math.max(0.5, imageX - bodyX - gap),
1038
+ },
1039
+ image: denseImageGrid ? {
1040
+ ...image,
1041
+ y: Math.min(image.y || 1.5, 1.08),
1042
+ h: Math.max(image.h || 3.0, 5.85),
1043
+ } : image,
1044
+ figure_caption: denseImageGrid && regions.figure_caption ? {
1045
+ ...regions.figure_caption,
1046
+ y: Math.max(regions.figure_caption.y || 4.55, 7.02),
1047
+ } : regions.figure_caption,
1048
+ };
1049
+ }
1050
+
1051
+ // ── Region rendering ────────────────────────────────────────────────────────
1052
+
1053
+ /**
1054
+ * Add a region as a positioned element on the slide.
1055
+ *
1056
+ * Content types:
1057
+ * - string: title, main-box, notes
1058
+ * - { type: "body" } bullet/section/numbered items → individual shapes
1059
+ * - { type: "kpi-table" } table with headers and rows
1060
+ * - { type: "image" } image element
1061
+ * - { type: "figure-caption" } figure caption (auto-numbered "도 N.")
1062
+ * - { type: "table-caption" } table caption (auto-numbered "표 N.")
1063
+ * - { type: "summary-group" } heading + items → individual shapes
1064
+ */
1065
+ function addRegion(slide, name, region, fontRoles, pageH, regionBottom, isToc, sourceDir) {
1066
+ if (!region) return;
1067
+
1068
+ const content = region.content;
1069
+ if (content === undefined || content === null || (typeof content === "string" && !content.trim())) return;
1070
+ if (typeof content === "object" && !content.type) return;
1071
+
1072
+ const roleName = region.font_role || region.heading_role || region.sub_item_role;
1073
+ const role = fontRoles[roleName] || {};
1074
+
1075
+ // ── String content (title, main-box, notes) ────────────────────────
1076
+ if (typeof content === "string") {
1077
+ const opts = {
1078
+ x: region.x || 0,
1079
+ y: region.y || 0,
1080
+ w: region.w || 4,
1081
+ h: region.h || ((regionBottom || (pageH - 0.5)) - (region.y || 0)),
1082
+ fontFace: role.font || FONT_BOLD,
1083
+ fontSize: role.size || 16,
1084
+ color: (role.color || "000000").replace("#", ""),
1085
+ align: region.align || role.align || "left",
1086
+ valign: region.valign || "top",
1087
+ };
1088
+
1089
+ if (role.charSpacing != null) opts.charSpacing = role.charSpacing;
1090
+ if (role.lineSpacing) opts.lineSpacingMultiple = role.lineSpacing;
1091
+
1092
+ // Border (main_box)
1093
+ if (region.border) {
1094
+ opts.line = {
1095
+ color: (region.border.color || "#000000").replace("#", ""),
1096
+ width: region.border.width || 1,
1097
+ };
1098
+ }
1099
+
1100
+ // Autofit
1101
+ if (region.autofit === "resize") opts.autoFit = true;
1102
+ else if (region.autofit === "shrink") opts.shrinkText = true;
1103
+
1104
+ slide.addText(mdRuns(content, {
1105
+ fontFace: opts.fontFace,
1106
+ fontSize: opts.fontSize,
1107
+ color: opts.color,
1108
+ ...(opts.charSpacing != null ? { charSpacing: opts.charSpacing } : {}),
1109
+ }), opts);
1110
+ return;
1111
+ }
1112
+
1113
+ // ── Body content → TOC shapes or individual shapes ──────────────────
1114
+ if (content.type === "body") {
1115
+ if (isToc) {
1116
+ addTocShapes(slide, content.items || []);
1117
+ } else {
1118
+ const startY = region.y || 1.044;
1119
+ addBodyShapes(slide, content.items || [], startY, region.w || 10.188, regionBottom || pageH - 0.5, region.originX);
1120
+ }
1121
+ return;
1122
+ }
1123
+
1124
+ // ── KPI Table ──────────────────────────────────────────────────────
1125
+ if (content.type === "kpi-table") {
1126
+ const headerRole = fontRoles[region.font_role_header] || fontRoles.table_header;
1127
+ const dataRole = fontRoles[region.font_role_data] || fontRoles.table_data;
1128
+
1129
+ const tableData = [];
1130
+
1131
+ if (content.headers && content.headers.length > 0) {
1132
+ tableData.push(
1133
+ content.headers.map((h) => ({
1134
+ text: cleanMd(h),
1135
+ options: {
1136
+ bold: false,
1137
+ fontSize: headerRole ? headerRole.size : 14,
1138
+ fontFace: headerRole ? headerRole.font : FONT_BOLD,
1139
+ color: headerRole ? headerRole.color : "000000",
1140
+ align: headerRole ? headerRole.align : "left",
1141
+ valign: "middle",
1142
+ ...(headerRole && headerRole.charSpacing != null
1143
+ ? { charSpacing: headerRole.charSpacing }
1144
+ : {}),
1145
+ ...(headerRole && headerRole.fill
1146
+ ? { fill: { color: headerRole.fill.replace("#", "") } }
1147
+ : {}),
1148
+ },
1149
+ }))
1150
+ );
1151
+ }
1152
+
1153
+ if (content.rows) {
1154
+ for (const row of content.rows) {
1155
+ tableData.push(
1156
+ row.map((cell) => linkedTableCell(cell, {
1157
+ fontSize: dataRole ? dataRole.size : 14,
1158
+ fontFace: dataRole ? dataRole.font : FONT_MEDIUM,
1159
+ color: dataRole ? dataRole.color : "000000",
1160
+ align: dataRole ? dataRole.align : "left",
1161
+ valign: "middle",
1162
+ ...(dataRole && dataRole.charSpacing != null
1163
+ ? { charSpacing: dataRole.charSpacing }
1164
+ : {}),
1165
+ }))
1166
+ );
1167
+ }
1168
+ }
1169
+
1170
+ const numCols = (content.headers && content.headers.length) || 1;
1171
+ const tblX = region.x || 0;
1172
+ const tblY = region.y || 0;
1173
+ const tblW = region.w || 4;
1174
+ slide.addTable(tableData, {
1175
+ x: tblX,
1176
+ y: tblY,
1177
+ w: tblW,
1178
+ border: { pt: 1.5, color: "000000" },
1179
+ colW: Array(numCols).fill(tblW / numCols),
1180
+ margin: [3.6, 7.2, 3.6, 7.2],
1181
+ rowH: 0.35,
1182
+ });
1183
+ return;
1184
+ }
1185
+
1186
+ // ── Image ──────────────────────────────────────────────────────────
1187
+ if (content.type === "image") {
1188
+ const imgPath = resolveImagePath(content.src, sourceDir);
1189
+ const fit = containBox(
1190
+ region.x || 0,
1191
+ region.y || 0,
1192
+ region.w || 2,
1193
+ region.h || 1,
1194
+ readImageSize(imgPath),
1195
+ );
1196
+ slide.addImage({
1197
+ path: imgPath,
1198
+ ...fit,
1199
+ altText: content.caption || path.basename(content.src || imgPath),
1200
+ });
1201
+ return;
1202
+ }
1203
+
1204
+ if (content.type === "image-grid") {
1205
+ const images = Array.isArray(content.images) ? content.images : [];
1206
+ const count = images.length;
1207
+ if (count === 0) return;
1208
+ const cols = count <= 2 ? count : 2;
1209
+ const rows = Math.ceil(count / cols);
1210
+ const gap = 0.06;
1211
+ const baseX = region.x || 0;
1212
+ const baseY = region.y || 0;
1213
+ const baseW = region.w || 4;
1214
+ const baseH = region.h || 3;
1215
+ const cellW = (baseW - gap * (cols - 1)) / cols;
1216
+ const cellH = (baseH - gap * (rows - 1)) / rows;
1217
+ images.forEach((image, idx) => {
1218
+ const imgPath = resolveImagePath(image.src, sourceDir);
1219
+ const col = idx % cols;
1220
+ const row = Math.floor(idx / cols);
1221
+ const fit = containBox(
1222
+ baseX + col * (cellW + gap),
1223
+ baseY + row * (cellH + gap),
1224
+ cellW,
1225
+ cellH,
1226
+ readImageSize(imgPath),
1227
+ );
1228
+ slide.addImage({
1229
+ path: imgPath,
1230
+ ...fit,
1231
+ altText: image.caption || path.basename(image.src || imgPath),
1232
+ });
1233
+ });
1234
+ return;
1235
+ }
1236
+
1237
+ // ── Figure Caption ────────────────────────────────────────────────
1238
+ if (content.type === "figure-caption") {
1239
+ const num = content.number || 1;
1240
+ const prefix = content.prefix || "도";
1241
+ const captionText = content.caption ? `${prefix} ${num}. ${cleanMd(content.caption)}` : `${prefix} ${num}.`;
1242
+ const captionRole = fontRoles.figure_caption || {};
1243
+ const captionW = region.w || 4;
1244
+ const captionSize = captionRole.size || 16;
1245
+ const captionSpacing = captionRole.lineSpacing || 1.3;
1246
+ slide.addText(captionText, {
1247
+ x: region.x || 0,
1248
+ y: region.y || 0,
1249
+ w: captionW,
1250
+ // A caption that wraps needs a box tall enough to hold every line, or it
1251
+ // overflows its frame. The declared region height is the floor, not the cap.
1252
+ h: Math.max(
1253
+ region.h || 0.456,
1254
+ estimateTextHeight(captionText, captionW, captionSize, captionSpacing)
1255
+ ),
1256
+ fontFace: captionRole.font || FONT_MEDIUM,
1257
+ fontSize: captionSize,
1258
+ color: (captionRole.color || "000000").replace("#", ""),
1259
+ align: region.align || captionRole.align || "center",
1260
+ charSpacing: captionRole.charSpacing != null ? captionRole.charSpacing : CHAR_SPACING,
1261
+ lineSpacingMultiple: captionRole.lineSpacing || 1.3,
1262
+ });
1263
+ return;
1264
+ }
1265
+
1266
+ // ── Table Caption ─────────────────────────────────────────────────
1267
+ if (content.type === "table-caption") {
1268
+ const num = content.number || 1;
1269
+ const prefix = content.prefix || "표";
1270
+ const captionText = content.caption ? `${prefix} ${num}. ${cleanMd(content.caption)}` : `${prefix} ${num}.`;
1271
+ const captionRole = fontRoles.table_caption || {};
1272
+ const captionW = region.w || 4;
1273
+ const captionSize = captionRole.size || 16;
1274
+ const captionSpacing = captionRole.lineSpacing || 1.3;
1275
+ slide.addText(captionText, {
1276
+ x: region.x || 0,
1277
+ y: region.y || 0,
1278
+ w: captionW,
1279
+ // Same rule as the figure caption: the declared region height is the
1280
+ // floor, not the cap, or a wrapping caption overflows its frame.
1281
+ h: Math.max(
1282
+ region.h || 0.456,
1283
+ estimateTextHeight(captionText, captionW, captionSize, captionSpacing)
1284
+ ),
1285
+ fontFace: captionRole.font || FONT_MEDIUM,
1286
+ fontSize: captionSize,
1287
+ color: (captionRole.color || "000000").replace("#", ""),
1288
+ align: region.align || captionRole.align || "center",
1289
+ charSpacing: captionRole.charSpacing != null ? captionRole.charSpacing : CHAR_SPACING,
1290
+ lineSpacingMultiple: captionRole.lineSpacing || 1.3,
1291
+ });
1292
+ return;
1293
+ }
1294
+
1295
+ // ── Summary Group → individual shapes ──────────────────────────────
1296
+ if (content.type === "summary-group") {
1297
+ addSummaryShapes(slide, content, region);
1298
+ return;
1299
+ }
1300
+ }
1301
+
1302
+ // ── AZURE rich rendering (isolated; only used when template.render_style==="azure") ──
1303
+
1304
+ /** Split a title string into runs, emphasizing **word** in the primary color. */
1305
+ function azureTitleRuns(text, P) {
1306
+ return text.split(/(\*\*[^*]+\*\*)/g).filter(Boolean).map((p) =>
1307
+ p.startsWith("**") && p.endsWith("**")
1308
+ ? { text: p.slice(2, -2), options: { color: hex(P.primary) } }
1309
+ : { text: p, options: {} }
1310
+ );
1311
+ }
1312
+
1313
+ /** Strip leftover markdown markers (### heading, list dashes, **bold**, `code`)
1314
+ * from inline text, returning a clean plain string. */
1315
+ function cleanMd(s) {
1316
+ return String(s || "")
1317
+ .replace(/^#{1,6}\s+/, "")
1318
+ .replace(/^\s*[*-]\s+/, "")
1319
+ .replace(/\*\*(.+?)\*\*/g, "$1")
1320
+ .replace(/`/g, "")
1321
+ .trim();
1322
+ }
1323
+
1324
+ /** Convert inline markdown in `text` to pptxgenjs styled runs: **x** → a bold
1325
+ * run, plain segments → normal runs. Leading heading/list markers and backticks
1326
+ * are stripped. `runOpts` styles every run; bold runs additionally set bold.
1327
+ * Guarantees no raw "**", "###", or backtick reaches the rendered <a:t>. */
1328
+ function mdRuns(text, runOpts = {}) {
1329
+ const clean = String(text || "")
1330
+ .replace(/^#{1,6}\s+/, "")
1331
+ .replace(/^\s*[*-]\s+/, "")
1332
+ .replace(/`/g, "");
1333
+ const parts = clean.split(/(\*\*[^*]+\*\*)/g).filter((p) => p !== "");
1334
+ if (parts.length === 0) return [{ text: "", options: { ...runOpts } }];
1335
+ return parts.map((p) =>
1336
+ p.startsWith("**") && p.endsWith("**")
1337
+ ? { text: p.slice(2, -2), options: { ...runOpts, bold: true } }
1338
+ : { text: p, options: { ...runOpts } }
1339
+ );
1340
+ }
1341
+
1342
+ /** Convert body items into up to 4 cards: {heading, lines[]}.
1343
+ * Handles both authoring styles:
1344
+ * - `### Title` (parsed as `text`) followed by `- **point**` (a `section`) → one card
1345
+ * titled by the heading, the section folded into the body.
1346
+ * - bare `- **Title**` sections → one card each (heading = bold title). */
1347
+ function bodyToCards(items) {
1348
+ const cards = [];
1349
+ let cur = null;
1350
+ for (const item of items || []) {
1351
+ if (item.type === "text" && item.text) {
1352
+ cur = { heading: cleanMd(item.text), lines: [] };
1353
+ cards.push(cur);
1354
+ } else if (item.type === "section" || item.type === "bullet") {
1355
+ const head = cleanMd(item.heading || item.text || "");
1356
+ const kids = (item.children || []).map((c) => cleanMd(c.text)).filter(Boolean);
1357
+ if (cur && cur.lines.length === 0 && cur.heading) {
1358
+ // fold this section under the preceding heading card
1359
+ if (head) cur.lines.push(head);
1360
+ kids.forEach((k) => cur.lines.push(" " + k));
1361
+ } else {
1362
+ cur = { heading: head, lines: kids };
1363
+ cards.push(cur);
1364
+ }
1365
+ } else if (item.type === "numbered" && item.text) {
1366
+ if (cur) cur.lines.push(cleanMd(item.text));
1367
+ else { cur = { heading: "", lines: [cleanMd(item.text)] }; cards.push(cur); }
1368
+ }
1369
+ }
1370
+ return cards.slice(0, 4);
1371
+ }
1372
+
1373
+ /** Draw one rounded card with a numbered chip, heading, and body lines. */
1374
+ function drawAzureCard(slide, x, y, w, h, card, idx, P, emphasized) {
1375
+ const bg = emphasized ? hex(P.primary_deep) : hex(P.tint);
1376
+ const headColor = emphasized ? "FFFFFF" : hex(P.ink);
1377
+ const bodyColor = emphasized ? hex(P.emphasisTextColor) : hex(P.ink_muted);
1378
+ slide.addShape("roundRect", { x, y, w, h, rectRadius: 0.16, fill: { color: bg }, line: { type: "none" } });
1379
+ const pad = 0.30;
1380
+ // numbered chip
1381
+ const chip = 0.52;
1382
+ slide.addShape("roundRect", {
1383
+ x: x + pad, y: y + pad, w: chip, h: chip, rectRadius: 0.12,
1384
+ fill: { color: emphasized ? "FFFFFF" : hex(P.primary) }, line: { type: "none" },
1385
+ });
1386
+ // Number sits in a text box whose rect is identical to the chip rect, with
1387
+ // margin:0 and tight line spacing so the numeral reads dead-centre.
1388
+ slide.addText(String(idx + 1).padStart(2, "0"), {
1389
+ x: x + pad, y: y + pad, w: chip, h: chip, align: "center", valign: "middle",
1390
+ fontFace: P.titleFont, fontSize: 15, bold: true,
1391
+ color: emphasized ? hex(P.primary_deep) : "FFFFFF",
1392
+ margin: 0, lineSpacingMultiple: 1,
1393
+ });
1394
+ if (card.heading) {
1395
+ slide.addText(card.heading, {
1396
+ x: x + pad, y: y + pad + chip + 0.18, w: w - 2 * pad, h: 0.4,
1397
+ fontFace: P.titleFont, fontSize: 15, bold: true, color: headColor, align: "left", valign: "top",
1398
+ charSpacing: -0.3,
1399
+ });
1400
+ }
1401
+ const bodyY = y + pad + chip + (card.heading ? 0.62 : 0.18);
1402
+ const bodyH = h - (bodyY - y) - 0.18;
1403
+ if (card.bodyRuns && card.bodyRuns.length) {
1404
+ slide.addText(card.bodyRuns, {
1405
+ x: x + pad, y: bodyY, w: w - 2 * pad, h: bodyH,
1406
+ color: bodyColor, align: "left", valign: "top", lineSpacingMultiple: card.lineSpacing || 1.28, charSpacing: -0.2,
1407
+ });
1408
+ } else if (card.lines && card.lines.length) {
1409
+ // Shrink body font when there are many lines so it never exceeds the frame.
1410
+ const fs = card.lines.length > 4 ? 10.5 : 11.5;
1411
+ slide.addText(card.lines.join("\n"), {
1412
+ x: x + pad, y: bodyY, w: w - 2 * pad, h: bodyH,
1413
+ fontFace: P.bodyFont, fontSize: fs, color: bodyColor, align: "left", valign: "top",
1414
+ lineSpacingMultiple: 1.3, charSpacing: -0.2,
1415
+ });
1416
+ }
1417
+ }
1418
+
1419
+ /** Render content/main body as a row of cards. */
1420
+ function renderAzureCards(slide, items, region, P) {
1421
+ const cards = bodyToCards(items);
1422
+ if (!cards.length) return;
1423
+ const n = cards.length;
1424
+ const x0 = region.x || 0.6, y0 = region.y || 1.6, w = region.w || 12.1;
1425
+ const h = region.h || 3.0;
1426
+ const gap = 0.28;
1427
+ const cardW = (w - (n - 1) * gap) / n;
1428
+ cards.forEach((c, i) => {
1429
+ drawAzureCard(slide, x0 + i * (cardW + gap), y0, cardW, h, c, i, P, n >= 3 && i === n - 1);
1430
+ });
1431
+ }
1432
+
1433
+ /** Flatten body/summary items (sections + children + bullets) into styled runs.
1434
+ * `scale` (≤1) shrinks fonts to fit a fixed card height. */
1435
+ function itemsToRuns(items, P, scale = 1) {
1436
+ const s = (v) => Math.max(8, Math.round(v * scale * 10) / 10);
1437
+ const runs = [];
1438
+ for (const it of items || []) {
1439
+ if (it.type === "section") {
1440
+ runs.push({ text: cleanMd(it.heading || ""), options: { bold: true, fontFace: P.titleFont, fontSize: s(12.5), color: hex(P.ink), breakLine: true } });
1441
+ for (const c of it.children || []) {
1442
+ runs.push({ text: " " + cleanMd(c.text || ""), options: { fontFace: P.bodyFont, fontSize: s(11), color: hex(P.ink_muted), breakLine: true } });
1443
+ }
1444
+ } else if (it.text) {
1445
+ runs.push({ text: (it.type === "numbered" ? " " : "• ") + cleanMd(it.text), options: { fontFace: P.bodyFont, fontSize: s(11.5), color: hex(P.ink_muted), breakLine: true } });
1446
+ }
1447
+ }
1448
+ return runs;
1449
+ }
1450
+
1451
+ /** Estimate the rendered height of a group's items at a given font scale,
1452
+ * using the same conservative metric inventory respects (estimateTextHeight). */
1453
+ function estimateGroupHeight(items, innerW, scale, lineSpacing) {
1454
+ let hsum = 0;
1455
+ for (const it of items || []) {
1456
+ if (it.type === "section") {
1457
+ hsum += estimateTextHeight(it.heading || "", innerW, 12.5 * scale, lineSpacing);
1458
+ for (const c of it.children || []) hsum += estimateTextHeight(" " + (c.text || ""), innerW - 0.1, 11 * scale, lineSpacing);
1459
+ } else if (it.text) {
1460
+ hsum += estimateTextHeight(it.text, innerW, 11.5 * scale, lineSpacing);
1461
+ }
1462
+ }
1463
+ return hsum;
1464
+ }
1465
+
1466
+ /** Render a single summary-group as one card (heading + items, iterative shrink-to-fit). */
1467
+ function renderAzureGroupCard(slide, content, region, P, idx) {
1468
+ const w = region.w || 5.6, h = region.h || 2.4;
1469
+ const innerW = w - 0.60;
1470
+ const innerH = h - 0.30 - 0.52 - (content.heading ? 0.62 : 0.18) - 0.18;
1471
+ let scale = 0.55, ls = 1.12;
1472
+ for (const s of [1, 0.92, 0.85, 0.78, 0.72, 0.66, 0.6, 0.55]) {
1473
+ if (estimateGroupHeight(content.items, innerW, s, s < 1 ? 1.12 : 1.28) <= innerH) { scale = s; ls = s < 1 ? 1.12 : 1.28; break; }
1474
+ }
1475
+ const card = {
1476
+ heading: cleanMd(content.heading || ""),
1477
+ bodyRuns: itemsToRuns(content.items, P, scale),
1478
+ lineSpacing: ls,
1479
+ };
1480
+ drawAzureCard(slide, region.x || 0.6, region.y || 1.6, w, h, card, idx, P, false);
1481
+ }
1482
+
1483
+ /** Render a general data table (palette-styled): primary header, zebra tint rows. */
1484
+ function renderAzureTable(slide, content, region, P) {
1485
+ const headers = content.headers || [];
1486
+ const rows = content.rows || [];
1487
+ if (!headers.length) return;
1488
+ const x = region.x || 0.6, y = region.y || 1.6, w = region.w || 6.0;
1489
+ const numericColumns = headers.map((_, col) => rows.length > 0 && rows.every((row) => numericValue(row[col]) !== null));
1490
+ const tableRows = [];
1491
+ tableRows.push(headers.map((h, col) => ({
1492
+ text: cleanMd(h),
1493
+ options: { bold: true, color: "FFFFFF", fill: { color: hex(P.primary) }, fontFace: P.titleFont, fontSize: 12, align: numericColumns[col] ? "right" : "left", valign: "middle" },
1494
+ })));
1495
+ rows.forEach((r, ri) => {
1496
+ tableRows.push(r.map((c, col) => linkedTableCell(c, {
1497
+ color: hex(P.ink), fill: { color: ri % 2 ? "FFFFFF" : hex(P.tint) }, fontFace: P.bodyFont, fontSize: 11.5, align: numericColumns[col] ? "right" : "left", valign: "middle",
1498
+ })));
1499
+ });
1500
+ slide.addTable(tableRows, {
1501
+ x, y, w, colW: Array(headers.length).fill(w / headers.length),
1502
+ border: { type: "solid", color: hex(P.line), pt: 0.5 }, rowH: 0.4, margin: 0.06, autoPage: false,
1503
+ });
1504
+ }
1505
+
1506
+ function numericValue(cell) {
1507
+ const value = cleanMd(cell).replace(/[\s,]/g, "").replace(/^[₩$€]/, "").replace(/%$/, "");
1508
+ return /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(value) ? Number(value) : null;
1509
+ }
1510
+
1511
+ /** A period/category column plus at least two fully numeric rows is a series. */
1512
+ function chartSeries(content) {
1513
+ const { headers = [], rows = [] } = content;
1514
+ if (/^(?:표|table\b)/i.test(cleanMd(content.caption || ""))) return null;
1515
+ if (headers.length < 2 || rows.length < 2 || rows.some((row) => row.length !== headers.length)) return null;
1516
+ const series = headers.slice(1).map((name, index) => ({
1517
+ name: cleanMd(name),
1518
+ labels: rows.map((row) => cleanMd(row[0])),
1519
+ values: rows.map((row) => numericValue(row[index + 1])),
1520
+ }));
1521
+ return series.every((item) => item.values.every((value) => value !== null)) ? series : null;
1522
+ }
1523
+
1524
+ function renderAzureChart(slide, content, region, P, pptx) {
1525
+ const series = chartSeries(content);
1526
+ if (!series || !pptx) return false;
1527
+ slide.addChart(pptx.ChartType.bar, series, {
1528
+ x: region.x || 0.84, y: region.y || 2.05,
1529
+ w: region.w || 11.65, h: region.h > 2.8 ? region.h : 3.4,
1530
+ barDir: "col", showLegend: series.length > 1,
1531
+ chartColors: [hex(P.primary), hex(P.azure_soft), hex(P.primary_deep)],
1532
+ showTitle: false, showValue: false,
1533
+ catAxisLabelFontFace: P.bodyFont, catAxisLabelFontSize: 11,
1534
+ valAxisLabelFontFace: P.bodyFont, valAxisLabelFontSize: 10,
1535
+ showMarker: false, showBorder: false,
1536
+ });
1537
+ return true;
1538
+ }
1539
+
1540
+ /** Render a kpi-table as a row of KPI cards (value + label); first card filled. */
1541
+ function renderAzureKpi(slide, content, region, P) {
1542
+ const cards = kpiCards(content);
1543
+ const values = cards.map((c) => c.value);
1544
+ const labels = cards.map((c) => c.label);
1545
+ const n = Math.min(values.length, 4);
1546
+ if (!n) return;
1547
+ const x0 = region.x || 0.6, y0 = region.y || 1.6, w = region.w || 12.1, h = Math.max(3.0, region.h || 0);
1548
+ const gap = 0.26;
1549
+ const cardW = (w - (n - 1) * gap) / n;
1550
+ for (let i = 0; i < n; i++) {
1551
+ const fill = i === 0;
1552
+ const x = x0 + i * (cardW + gap);
1553
+ slide.addShape("roundRect", {
1554
+ x, y: y0, w: cardW, h, rectRadius: 0.16,
1555
+ fill: { color: fill ? hex(P.primary) : "FFFFFF" },
1556
+ line: fill ? { type: "none" } : { color: hex(P.line), width: 1 },
1557
+ });
1558
+ slide.addText(cleanMd(values[i]), {
1559
+ x: x + 0.28, y: y0 + 0.70, w: cardW - 0.56, h: 0.9,
1560
+ fontFace: P.titleFont, fontSize: 30, bold: true,
1561
+ color: fill ? "FFFFFF" : hex(P.primary), align: "left", valign: "middle", charSpacing: -1, margin: 0,
1562
+ });
1563
+ slide.addText(cleanMd(labels[i]).toUpperCase(), {
1564
+ x: x + 0.30, y: y0 + h - 0.72, w: cardW - 0.56, h: 0.4,
1565
+ fontFace: P.bodyFont, fontSize: 9.5, bold: false,
1566
+ color: fill ? hex(P.emphasisTextColor) : hex(P.ink_muted), align: "left", valign: "middle", charSpacing: 0.4, margin: 0,
1567
+ });
1568
+ }
1569
+ }
1570
+
1571
+ /** A pipe table reads as KPI in two shapes:
1572
+ * - TALL: 2 cols of value|label pairs, ≤4 pairs, value cell short/metric-like.
1573
+ * - WIDE: 3–4 cols, a single data row of short metric values (labels = header).
1574
+ * Anything else (multi-row, long cells) is a real data table. */
1575
+
1576
+
1577
+ /** Normalize a kpi-table into [{value,label}] cards for both KPI shapes. */
1578
+ /**
1579
+ * Is there room to draw this as KPI badges?
1580
+ *
1581
+ * A badge stacks a value over a label and reads as one glance, which stops
1582
+ * working the moment the card is narrower than its own words: in a column half
1583
+ * the slide wide, four badges leave 1.4in each and a label like "영업이익" wraps
1584
+ * to one character per line. Below the floor the same data is drawn as a table,
1585
+ * which narrows gracefully.
1586
+ */
1587
+ function kpiFits(content, widthIn) {
1588
+ const cards = kpiCards(content).length;
1589
+ return cards > 0 && (widthIn || 0) / cards >= KPI_MIN_CARD_WIDTH_IN;
1590
+ }
1591
+
1592
+ function kpiCards(content) {
1593
+ const headers = content.headers || [];
1594
+ const rows = content.rows || [];
1595
+ if (headers.length === 2) {
1596
+ return [headers, ...rows].slice(0, 4).map((p) => ({ value: p[0], label: p[1] }));
1597
+ }
1598
+ const row = rows[0] || [];
1599
+ return headers.slice(0, 4).map((lab, i) => ({ value: row[i] != null ? row[i] : "", label: lab }));
1600
+ }
1601
+
1602
+ /** Azure region dispatch. Returns true if it fully handled the region.
1603
+ * opts.hasImage = slide also has a populated image region (→ never card the body). */
1604
+ function renderAzureRegion(slide, layout, name, region, fontRoles, P, opts = {}) {
1605
+ const content = region.content;
1606
+ if (content == null) return false;
1607
+ if (layout === "cover" && name === "title" && typeof content === "string" && content.includes("**")) {
1608
+ const role = fontRoles.cover_title || {};
1609
+ slide.addText(azureTitleRuns(content, P), {
1610
+ x: region.x || 0, y: region.y || 0, w: region.w || 8, h: region.h || 1,
1611
+ fontFace: role.font || P.titleFont, fontSize: role.size || 48, bold: role.bold !== false,
1612
+ align: role.align || "left", valign: "middle",
1613
+ charSpacing: role.charSpacing != null ? role.charSpacing : -1, lineSpacingMultiple: role.lineSpacing || 1.08,
1614
+ });
1615
+ return true;
1616
+ }
1617
+ if (typeof content === "object") {
1618
+ if (content.type === "body" && (layout === "content" || layout === "main")) {
1619
+ // Cards ONLY for section-structured bodies (≥2 ### sections) with no image.
1620
+ // Prose bullets, or any body sharing the slide with an image, render as a
1621
+ // normal text column (fall through to addRegion) so nothing is cramped.
1622
+ const sections = (content.items || []).filter((i) => i.type === "section");
1623
+ if (sections.length >= 2 && !opts.hasImage) {
1624
+ renderAzureCards(slide, content.items, region, P);
1625
+ return true;
1626
+ }
1627
+ return false;
1628
+ }
1629
+ if (content.type === "kpi-table") {
1630
+ if (renderAzureChart(slide, content, region, P, opts.pptx)) return true;
1631
+ if (looksLikeKpi(content) && kpiFits(content, region.w)) {
1632
+ renderAzureKpi(slide, content, region, P);
1633
+ }
1634
+ else renderAzureTable(slide, content, region, P);
1635
+ return true;
1636
+ }
1637
+ if (content.type === "summary-group") {
1638
+ const idx = name === "group_bottom" ? 1 : 0;
1639
+ renderAzureGroupCard(slide, content, region, P, idx);
1640
+ return true;
1641
+ }
1642
+ }
1643
+ return false;
1644
+ }
1645
+
1646
+ // ── Placements (author-positioned boxes and shapes) ─────────────────────────
1647
+
1648
+ /** Region name a placed block should be rendered as. */
1649
+ function partRegionName(blockType) {
1650
+ switch (blockType) {
1651
+ case "title": return "title";
1652
+ case "kpi-table": return "table";
1653
+ case "image": return "image";
1654
+ case "figure-caption": return "figure_caption";
1655
+ case "table-caption": return "table_caption";
1656
+ default: return "body";
1657
+ }
1658
+ }
1659
+
1660
+ /** font_role a placed block falls back to when its box names none. */
1661
+ function defaultPartRole(blockType) {
1662
+ switch (blockType) {
1663
+ case "title": return "section_title";
1664
+ case "figure-caption": return "figure_caption";
1665
+ case "table-caption": return "table_caption";
1666
+ case "notes": return "disclaimer";
1667
+ default: return "body_text";
1668
+ }
1669
+ }
1670
+
1671
+ function estimatePartHeight(content, widthIn, role) {
1672
+ const size = role.size || 13;
1673
+ const spacing = role.lineSpacing || 1.3;
1674
+ if (typeof content === "string") {
1675
+ return estimateTextHeight(content, widthIn, size, spacing) + 0.08;
1676
+ }
1677
+ if (content && content.type === "body") {
1678
+ const text = (content.items || []).map((i) => i.heading || i.text || "").join("\n");
1679
+ return estimateTextHeight(text, widthIn, size, spacing) + 0.12;
1680
+ }
1681
+ return 0.5;
1682
+ }
1683
+
1684
+ /**
1685
+ * Turn a shape placement into the decoration element addDecorations reads.
1686
+ *
1687
+ * A rule is drawn as a zero-height rect whose stroke is the visible mark, so it
1688
+ * reads its colour and thickness from `color`/`width` while every other
1689
+ * primitive reads `line`/`line_width`. Authors write one spelling — `line=` and
1690
+ * `lw=` — and the difference is absorbed here.
1691
+ */
1692
+ function shapeToDecoration(placement, sourceDir) {
1693
+ const isRule = placement.shape === "line";
1694
+ const element = {
1695
+ type: placement.shape,
1696
+ x: placement.x, y: placement.y, w: placement.w, h: placement.h,
1697
+ };
1698
+ for (const [key, value] of Object.entries(placement)) {
1699
+ if (["kind", "z", "shape", "x", "y", "w", "h"].includes(key)) continue;
1700
+ if (key === "lw") element[isRule ? "width" : "line_width"] = value;
1701
+ else if (key === "line" && isRule) element.color = value;
1702
+ else if (key === "src") element.assetPath = resolveImagePath(value, sourceDir);
1703
+ else element[key] = value;
1704
+ }
1705
+ return element;
1706
+ }
1707
+
1708
+ /**
1709
+ * Render one placed box by flowing its blocks down the box.
1710
+ *
1711
+ * Every block but the last takes the height its content needs; the last takes
1712
+ * whatever is left, so a heading followed by body fills the box rather than
1713
+ * floating in its top edge. Nothing here consults the auto-nudge rules: a box
1714
+ * lands exactly where the author put it, and the QA gate reports the consequence.
1715
+ */
1716
+ function renderPlacementBox(slide, placement, ctx) {
1717
+ const blocks = placement.blocks || [];
1718
+ if (blocks.length === 0) return;
1719
+
1720
+ // Columns replace the body region, so they render in the template's own idiom.
1721
+ // An explicit box is literal: the author asked for this content, here.
1722
+ const useRich = ctx.rich && placement.z === "content";
1723
+ const bottom = placement.y + (placement.h != null ? placement.h : 1.0);
1724
+ let y = placement.y;
1725
+
1726
+ blocks.forEach((block, i) => {
1727
+ const remaining = Math.max(0.2, bottom - y);
1728
+ const roleName = placement.role || defaultPartRole(block.type);
1729
+ const role = ctx.fontRoles[roleName] || {};
1730
+ const content = extractContent(block);
1731
+ const isLast = i === blocks.length - 1;
1732
+ const h = isLast
1733
+ ? remaining
1734
+ : Math.min(remaining, Math.max(0.2, estimatePartHeight(content, placement.w, role)));
1735
+
1736
+ const region = {
1737
+ x: placement.x, y, w: placement.w, h,
1738
+ content,
1739
+ font_role: roleName,
1740
+ originX: placement.x,
1741
+ ...(placement.align ? { align: placement.align } : {}),
1742
+ ...(placement.valign ? { valign: placement.valign } : {}),
1743
+ };
1744
+
1745
+ const name = partRegionName(block.type);
1746
+ const rendered = useRich &&
1747
+ renderAzureRegion(slide, ctx.layout, name, region, ctx.fontRoles, ctx.P, { pptx: ctx.pptx });
1748
+ if (!rendered) {
1749
+ addRegion(slide, name, region, ctx.fontRoles, ctx.pageH, y + h, false, ctx.sourceDir);
1750
+ }
1751
+ y += h;
1752
+ });
1753
+ }
1754
+
1755
+ function renderPlacements(slide, placements, band, ctx) {
1756
+ for (const placement of placements) {
1757
+ if (placement.z !== band) continue;
1758
+ if (placement.kind === "shape") {
1759
+ addDecorations(slide, [shapeToDecoration(placement, ctx.sourceDir)], ctx.slideIndex, ctx.fontRoles);
1760
+ } else {
1761
+ renderPlacementBox(slide, placement, ctx);
1762
+ }
1763
+ }
1764
+ }
1765
+
1766
+ // ── Main render function ────────────────────────────────────────────────────
1767
+
1768
+ /**
1769
+ * Render the full resolved spec to a PPTX file.
1770
+ *
1771
+ * @param {object} resolved - Resolved spec from layout-resolver
1772
+ * @param {object} templateObj - Template object from template-registry
1773
+ * @param {string} outputPath - Where to write the .pptx file
1774
+ * @returns {Promise<string>} Resolves with the output path
1775
+ */
1776
+ async function render(resolved, templateObj, outputPath) {
1777
+ const fontRoles = buildFontRoles(templateObj);
1778
+
1779
+ // Derive font, spacing, and accent from the template, with neutral fallbacks.
1780
+ const tpl = (templateObj && templateObj.template) || {};
1781
+ const tplFonts = tpl.fonts || {};
1782
+ const tplType = tpl.global_typography || {};
1783
+ FONT_BOLD = tplFonts.title || "Pretendard";
1784
+ FONT_MEDIUM = tplFonts.body || "Pretendard";
1785
+ FONT_LIGHT = tplFonts.light || "Pretendard";
1786
+ CHAR_SPACING = tplType.char_spacing != null ? tplType.char_spacing : -0.7;
1787
+ BULLET_FONT = FONT_BOLD;
1788
+ SEC_HEADER_FONT = FONT_BOLD;
1789
+ TOC_FONT = FONT_BOLD;
1790
+ BULLET_COLOR = (tplType.bullet_color || "334155").replace("#", "");
1791
+ SECTION_ACCENT = (tplType.section_accent || "334155").replace("#", "");
1792
+
1793
+ // Rich card/KPI/divider rendering uses the enrolled template's palette.
1794
+ const rich = tpl.render_style === "azure";
1795
+ const pal = tpl.palette || {};
1796
+ const P = {
1797
+ titleFont: FONT_BOLD, bodyFont: FONT_MEDIUM,
1798
+ primary: pal.primary || "#1D4ED8", primary_deep: pal.primary_deep || "#0B2E6F",
1799
+ ink: pal.ink || "#0E1B2C", ink_muted: pal.ink_muted || "#51607A",
1800
+ tint: pal.tint || "#EEF4FF", line: pal.line || "#D5DEEC", azure_soft: pal.azure_soft || "#93C5FD",
1801
+ emphasisTextColor: pal.emphasis_text || "#C9D8F5",
1802
+ };
1803
+
1804
+ const dims =
1805
+ (templateObj && templateObj.template && templateObj.template.dimensions) || {};
1806
+ const pageW = dims.width || 10.833;
1807
+ const pageH = dims.height || 7.5;
1808
+
1809
+ const pptx = new PptxGenJS();
1810
+ pptx.defineLayout({ name: "A4_LANDSCAPE", width: pageW, height: pageH });
1811
+ pptx.layout = "A4_LANDSCAPE";
1812
+
1813
+ const title = (resolved.deck && resolved.deck.title) || "Presentation";
1814
+ pptx.title = title;
1815
+ const sourceDir = resolved.sourceDir;
1816
+ const cramStress = isCramStressDeck(resolved);
1817
+
1818
+ for (const slideSpec of resolved.slides || []) {
1819
+ const slide = pptx.addSlide();
1820
+
1821
+ // Draw order is a band at a time: template decorations, then anything the
1822
+ // author put under the content, then the template's regions, then the
1823
+ // columns that replaced the body, then anything sitting on top.
1824
+ addDecorations(slide, slideSpec.decorations, slideSpec.index, fontRoles);
1825
+
1826
+ const placements = slideSpec.placements || [];
1827
+ const placementCtx = {
1828
+ rich, P, fontRoles, pageH, sourceDir, pptx,
1829
+ layout: slideSpec.layout,
1830
+ slideIndex: slideSpec.index,
1831
+ };
1832
+ renderPlacements(slide, placements, "under", placementCtx);
1833
+
1834
+ const regions = adjustedRegionsForImageColumn(slideSpec.regions || {});
1835
+ const chartRegionName = ["table", "kpi_table"].find((name) => regions[name] && chartSeries(regions[name].content || {}));
1836
+ if (rich && chartRegionName && regions.body?.content) {
1837
+ // Keep one concise takeaway above the plot instead of stacking prose on
1838
+ // top of the editable chart's data area.
1839
+ regions.body = { ...regions.body, x: 0.84, y: 1.53, w: pageW - 1.68, h: 0.58 };
1840
+ const items = regions.body.content.items || [];
1841
+ if (items.length && items.every((item) => item.type === "text")) {
1842
+ regions.body.content = items.map((item) => item.text).join(" ");
1843
+ regions.body.h = 0.78;
1844
+ }
1845
+ regions[chartRegionName] = { ...regions[chartRegionName], y: 2.40, h: 3.15 };
1846
+ }
1847
+ if (cramStress && ["content", "main"].includes(slideSpec.layout) && regions.body) {
1848
+ renderCramStressSlide(slide, { ...slideSpec, regions }, pageW, pageH, sourceDir);
1849
+ continue;
1850
+ }
1851
+
1852
+ // Calculate bottom boundary for regions without explicit h
1853
+ const bottomBoundary = {};
1854
+ for (const [name, region] of Object.entries(regions)) {
1855
+ let bottom = pageH - 0.5;
1856
+ for (const [otherName, otherRegion] of Object.entries(regions)) {
1857
+ if (otherName === name || otherName === "title") continue;
1858
+ if (name === "body" && ["image", "figure_caption"].includes(otherName)) continue;
1859
+ if (otherRegion.y && otherRegion.y > (region.y || 0) && otherRegion.h) {
1860
+ const candidateBottom = otherRegion.y - 0.15;
1861
+ if (candidateBottom < bottom) bottom = candidateBottom;
1862
+ }
1863
+ }
1864
+ bottomBoundary[name] = bottom;
1865
+ }
1866
+
1867
+ const tocSlide = isTocSlide(regions);
1868
+ const hasImage = Object.entries(regions).some(([n, r]) =>
1869
+ (n === "image" || n === "figure") && r.content &&
1870
+ (r.content.type === "image" || r.content.type === "image-grid"));
1871
+
1872
+ for (const [name, region] of Object.entries(regions)) {
1873
+ if (rich && renderAzureRegion(slide, slideSpec.layout, name, region, fontRoles, P, { hasImage, pptx })) continue;
1874
+ addRegion(slide, name, region, fontRoles, pageH, bottomBoundary[name], tocSlide, sourceDir);
1875
+ }
1876
+
1877
+ renderPlacements(slide, placements, "content", placementCtx);
1878
+ renderPlacements(slide, placements, "over", placementCtx);
1879
+ }
1880
+
1881
+ await pptx.writeFile({ fileName: outputPath });
1882
+ return outputPath;
1883
+ }
1884
+
1885
+ module.exports = { render };