codewave-openclaw-installer 2.1.10 → 2.1.12

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 (211) hide show
  1. package/bin/check.mjs +0 -0
  2. package/bin/install.mjs +0 -0
  3. package/package.json +2 -1
  4. package/skills/ppt-master/.env.example +35 -0
  5. package/skills/ppt-master/README.md +90 -0
  6. package/skills/ppt-master/SKILL.md +390 -17
  7. package/skills/ppt-master/audit_report_model_perf.md +213 -0
  8. package/skills/ppt-master/audit_report_portability.md +90 -0
  9. package/skills/ppt-master/audit_report_robustness.md +192 -0
  10. package/skills/ppt-master/audit_report_workflow.md +233 -0
  11. package/skills/ppt-master/fix_report_bid.md +51 -0
  12. package/skills/ppt-master/fix_report_scripts.md +41 -0
  13. package/skills/ppt-master/references/bid-content-example-netease.md +815 -0
  14. package/skills/ppt-master/references/bid-content-template.md +390 -0
  15. package/skills/ppt-master/references/bid-example-netease.md +339 -0
  16. package/skills/ppt-master/references/bid-presentation.md +384 -0
  17. package/skills/ppt-master/references/bid-svgs/03_toc.svg +38 -0
  18. package/skills/ppt-master/references/bid-svgs/04_chapter_company.svg +7 -0
  19. package/skills/ppt-master/references/bid-svgs/05_company_overview.svg +28 -0
  20. package/skills/ppt-master/references/bid-svgs/06_vision_business.svg +45 -0
  21. package/skills/ppt-master/references/bid-svgs/07_product_system.svg +52 -0
  22. package/skills/ppt-master/references/bid-svgs/08_codewave_timeline.svg +29 -0
  23. package/skills/ppt-master/references/bid-svgs/09_certifications.svg +33 -0
  24. package/skills/ppt-master/references/bid-svgs/10_client_logos.svg +25 -0
  25. package/skills/ppt-master/references/bid-svgs/11_brand_mission.svg +14 -0
  26. package/skills/ppt-master/references/bid-svgs/12_chapter_demand.svg +7 -0
  27. package/skills/ppt-master/references/bid-svgs/16_chapter_advantages.svg +7 -0
  28. package/skills/ppt-master/references/bid-svgs/18_platform_arch.svg +24 -0
  29. package/skills/ppt-master/references/bid-svgs/19_function_matrix.svg +35 -0
  30. package/skills/ppt-master/references/bid-svgs/20_dev_arch.svg +29 -0
  31. package/skills/ppt-master/references/bid-svgs/21_source_code.svg +25 -0
  32. package/skills/ppt-master/references/bid-svgs/22_ai_dev.svg +27 -0
  33. package/skills/ppt-master/references/bid-svgs/23_asset_market.svg +33 -0
  34. package/skills/ppt-master/references/bid-svgs/24_multi_org.svg +28 -0
  35. package/skills/ppt-master/references/bid-svgs/25_i18n.svg +22 -0
  36. package/skills/ppt-master/references/bid-svgs/26_multi_tenant.svg +25 -0
  37. package/skills/ppt-master/references/bid-svgs/27_integration.svg +27 -0
  38. package/skills/ppt-master/references/bid-svgs/28_permission.svg +31 -0
  39. package/skills/ppt-master/references/bid-svgs/29_security.svg +25 -0
  40. package/skills/ppt-master/references/bid-svgs/30_ai_capabilities.svg +21 -0
  41. package/skills/ppt-master/references/bid-svgs/31_product_combo.svg +25 -0
  42. package/skills/ppt-master/references/bid-svgs/32_digital_transform.svg +28 -0
  43. package/skills/ppt-master/references/bid-svgs/33_chapter_cases.svg +7 -0
  44. package/skills/ppt-master/references/bid-svgs/34_cummins_case.svg +23 -0
  45. package/skills/ppt-master/references/bid-svgs/35_cpq_cost.svg +22 -0
  46. package/skills/ppt-master/references/bid-svgs/36_tech_platform.svg +18 -0
  47. package/skills/ppt-master/references/bid-svgs/37_platform_value.svg +24 -0
  48. package/skills/ppt-master/references/bid-svgs/38_operation_plan.svg +25 -0
  49. package/skills/ppt-master/references/bid-svgs/39_zpmc_case.svg +21 -0
  50. package/skills/ppt-master/references/bid-svgs/40_zpmc_apps.svg +23 -0
  51. package/skills/ppt-master/references/bid-svgs/41_chapter_service.svg +7 -0
  52. package/skills/ppt-master/references/bid-svgs/42_tech_support.svg +24 -0
  53. package/skills/ppt-master/references/bid-svgs/43_knowledge_transfer.svg +25 -0
  54. package/skills/ppt-master/references/bid-svgs/44_operation_promotion.svg +20 -0
  55. package/skills/ppt-master/references/bid-svgs/45_custom_dev_guide.svg +24 -0
  56. package/skills/ppt-master/references/bid-svgs/46_sla_guarantee.svg +18 -0
  57. package/skills/ppt-master/references/bid-svgs/47_strategic_cooperation.svg +25 -0
  58. package/skills/ppt-master/references/bid-svgs/48_ecosystem.svg +24 -0
  59. package/skills/ppt-master/references/bid-svgs/49_chapter_delivery.svg +23 -0
  60. package/skills/ppt-master/references/bid-svgs/53_pm_intro.svg +24 -0
  61. package/skills/ppt-master/references/bid-svgs/54_after_sales.svg +27 -0
  62. package/skills/ppt-master/references/bid-svgs/55_ending.svg +8 -0
  63. package/skills/ppt-master/references/company_intro.md +93 -0
  64. package/skills/ppt-master/references/company_intro_images/slide1_img00.png +0 -0
  65. package/skills/ppt-master/references/company_intro_images/slide1_img01.png +0 -0
  66. package/skills/ppt-master/references/company_intro_images/slide1_img02.png +0 -0
  67. package/skills/ppt-master/references/company_intro_images/slide1_img03.png +0 -0
  68. package/skills/ppt-master/references/company_intro_images/slide1_img04.png +0 -0
  69. package/skills/ppt-master/references/company_intro_images/slide1_img05.png +0 -0
  70. package/skills/ppt-master/references/company_intro_images/slide1_img06.png +0 -0
  71. package/skills/ppt-master/references/company_intro_images/slide1_img07.png +0 -0
  72. package/skills/ppt-master/references/company_intro_images/slide1_img08.png +0 -0
  73. package/skills/ppt-master/references/company_intro_images/slide1_img09.png +0 -0
  74. package/skills/ppt-master/references/company_intro_images/slide1_img10.png +0 -0
  75. package/skills/ppt-master/references/company_intro_images/slide1_img11.png +0 -0
  76. package/skills/ppt-master/references/company_intro_images/slide1_img12.png +0 -0
  77. package/skills/ppt-master/references/company_intro_images/slide1_img13.png +0 -0
  78. package/skills/ppt-master/references/company_intro_images/slide1_img14.png +0 -0
  79. package/skills/ppt-master/references/company_intro_images/slide1_img15.png +0 -0
  80. package/skills/ppt-master/references/company_intro_images/slide1_img16.png +0 -0
  81. package/skills/ppt-master/references/company_intro_images/slide1_img17.png +0 -0
  82. package/skills/ppt-master/references/company_intro_images/slide1_img18.png +0 -0
  83. package/skills/ppt-master/references/company_intro_images/slide1_img19.png +0 -0
  84. package/skills/ppt-master/references/company_intro_images/slide1_img20.png +0 -0
  85. package/skills/ppt-master/references/company_intro_images/slide1_img21.png +0 -0
  86. package/skills/ppt-master/references/company_intro_images/slide1_img22.png +0 -0
  87. package/skills/ppt-master/references/company_intro_images/slide1_img23.png +0 -0
  88. package/skills/ppt-master/references/company_intro_images/slide1_img24.png +0 -0
  89. package/skills/ppt-master/references/company_intro_images/slide1_img25.png +0 -0
  90. package/skills/ppt-master/references/company_intro_images/slide1_img26.png +0 -0
  91. package/skills/ppt-master/references/company_intro_images/slide1_img27.png +0 -0
  92. package/skills/ppt-master/references/company_intro_images/slide1_img28.png +0 -0
  93. package/skills/ppt-master/references/company_intro_images/slide1_img29.png +0 -0
  94. package/skills/ppt-master/references/company_intro_images/slide2_img30.png +0 -0
  95. package/skills/ppt-master/references/company_intro_images/slide2_img31.jpg +0 -0
  96. package/skills/ppt-master/references/company_intro_images/slide3_img32.png +0 -0
  97. package/skills/ppt-master/references/company_intro_images/slide3_img33.png +0 -0
  98. package/skills/ppt-master/references/drawio-integration.md +144 -0
  99. package/skills/ppt-master/references/executor-base.md +3 -4
  100. package/skills/ppt-master/references/image-generator.md +93 -6
  101. package/skills/ppt-master/references/strategist.md +8 -5
  102. package/skills/ppt-master/requirements.txt +19 -0
  103. package/skills/ppt-master/resources/backgrounds/chapter_bg.png +0 -0
  104. package/skills/ppt-master/resources/backgrounds/company_bg.png +0 -0
  105. package/skills/ppt-master/resources/backgrounds/cover_bg.png +0 -0
  106. package/skills/ppt-master/resources/backgrounds/index.json +40 -0
  107. package/skills/ppt-master/resources/backgrounds/tech_bg.png +0 -0
  108. package/skills/ppt-master/scripts/README.md +1 -1
  109. package/skills/ppt-master/scripts/__pycache__/config.cpython-314.pyc +0 -0
  110. package/skills/ppt-master/scripts/__pycache__/error_helper.cpython-314.pyc +0 -0
  111. package/skills/ppt-master/scripts/__pycache__/pptx_animations.cpython-314.pyc +0 -0
  112. package/skills/ppt-master/scripts/__pycache__/project_utils.cpython-314.pyc +0 -0
  113. package/skills/ppt-master/scripts/arch_diagram.py +370 -0
  114. package/skills/ppt-master/scripts/bid_init.py +79 -0
  115. package/skills/ppt-master/scripts/drawio_gen.py +366 -0
  116. package/skills/ppt-master/scripts/drawio_to_svg.py +458 -0
  117. package/skills/ppt-master/scripts/finalize_svg.py +14 -0
  118. package/skills/ppt-master/scripts/image_backends/__pycache__/__init__.cpython-314.pyc +0 -0
  119. package/skills/ppt-master/scripts/image_backends/__pycache__/backend_aigw_gemini.cpython-314.pyc +0 -0
  120. package/skills/ppt-master/scripts/image_backends/__pycache__/backend_common.cpython-314.pyc +0 -0
  121. package/skills/ppt-master/scripts/svg_finalize/__pycache__/__init__.cpython-314.pyc +0 -0
  122. package/skills/ppt-master/scripts/svg_finalize/__pycache__/crop_images.cpython-314.pyc +0 -0
  123. package/skills/ppt-master/scripts/svg_finalize/__pycache__/embed_icons.cpython-314.pyc +0 -0
  124. package/skills/ppt-master/scripts/svg_finalize/__pycache__/embed_images.cpython-314.pyc +0 -0
  125. package/skills/ppt-master/scripts/svg_finalize/__pycache__/fix_image_aspect.cpython-314.pyc +0 -0
  126. package/skills/ppt-master/scripts/svg_finalize/__pycache__/flatten_tspan.cpython-314.pyc +0 -0
  127. package/skills/ppt-master/scripts/svg_finalize/__pycache__/svg_rect_to_path.cpython-314.pyc +0 -0
  128. package/skills/ppt-master/scripts/svg_page_gen.py +871 -0
  129. package/skills/ppt-master/scripts/svg_quality_checker.py +169 -8
  130. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/__init__.cpython-314.pyc +0 -0
  131. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/drawingml_context.cpython-314.pyc +0 -0
  132. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/drawingml_converter.cpython-314.pyc +0 -0
  133. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/drawingml_elements.cpython-314.pyc +0 -0
  134. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/drawingml_paths.cpython-314.pyc +0 -0
  135. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/drawingml_styles.cpython-314.pyc +0 -0
  136. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/drawingml_utils.cpython-314.pyc +0 -0
  137. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_builder.cpython-314.pyc +0 -0
  138. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_cli.cpython-314.pyc +0 -0
  139. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_dimensions.cpython-314.pyc +0 -0
  140. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_discovery.cpython-314.pyc +0 -0
  141. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_media.cpython-314.pyc +0 -0
  142. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_notes.cpython-314.pyc +0 -0
  143. package/skills/ppt-master/scripts/svg_to_pptx/__pycache__/pptx_slide_xml.cpython-314.pyc +0 -0
  144. package/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py +7 -1
  145. package/skills/ppt-master/scripts/svg_to_pptx/pptx_cli.py +14 -0
  146. package/skills/ppt-master/projects/.gitkeep +0 -0
  147. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246/01_cover.svg" → Technology Blue Business/01_cover.svg} +0 -0
  148. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246/02_chapter.svg" → Technology Blue Business/02_chapter.svg} +0 -0
  149. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246/02_toc.svg" → Technology Blue Business/02_toc.svg} +0 -0
  150. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246/03_content.svg" → Technology Blue Business/03_content.svg} +0 -0
  151. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246/04_ending.svg" → Technology Blue Business/04_ending.svg} +0 -0
  152. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246/design_spec.md" → Technology Blue Business/design_spec.md} +0 -0
  153. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246//351/207/215/345/272/206/345/244/247/345/255/246logo.png" → Technology Blue Business//316/230c/314/247i/314/200/317/203/342/225/221a/314/212/317/203n/314/203/302/272/317/203/302/241/302/252logo.png"} +0 -0
  154. /package/skills/ppt-master/templates/layouts/{/351/207/215/345/272/206/345/244/247/345/255/246//351/207/215/345/272/206/345/244/247/345/255/246logo2.png" → Technology Blue Business//316/230c/314/247i/314/200/317/203/342/225/221a/314/212/317/203n/314/203/302/272/317/203/302/241/302/252logo2.png"} +0 -0
  155. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214 → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202}/01_cover.svg" +0 -0
  156. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214 → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202}/02_chapter.svg" +0 -0
  157. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214 → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202}/02_toc.svg" +0 -0
  158. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214 → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202}/03_content.svg" +0 -0
  159. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214 → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202}/04_ending.svg" +0 -0
  160. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214 → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202}/design_spec.md" +0 -0
  161. /package/skills/ppt-master/templates/layouts//{346/213/233/345/225/206/351/223/266/350/241/214//346/213/233/345/225/206/351/223/266/350/241/214/345/205/254/345/217/270/351/207/221/350/236/215.png" → 302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202//302/265i/314/210/302/242/317/203o/314/200a/314/212/316/230o/314/202/342/225/242/316/246i/314/201i/314/202/317/203a/314/200/302/274/317/203A/314/212/342/225/225/316/230c/314/247/303/246/316/246/342/202/247i/314/200.png"} +0 -0
  162. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/01_cover.svg" +0 -0
  163. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/02_chapter.svg" +0 -0
  164. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/02_toc.svg" +0 -0
  165. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/03_content.svg" +0 -0
  166. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/04_ending.svg" +0 -0
  167. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/design_spec.md" +0 -0
  168. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241//345/217/263/344/270/212/350/247/222 logo.png" → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201//317/203A/314/212/342/224/202/316/243/342/225/225e/314/200/316/246/302/272/303/206 logo.png"} +0 -0
  169. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/225/206/345/212/241//345/244/247/345/236/213 logo.png" → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203o/314/200a/314/212/317/203e/314/200i/314/201//317/203n/314/203/302/272/317/203/342/202/247i/314/210 logo.png"} +0 -0
  170. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/01_cover.svg" +0 -0
  171. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/02_chapter.svg" +0 -0
  172. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/02_toc.svg" +0 -0
  173. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/03_content.svg" +0 -0
  174. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/04_ending.svg" +0 -0
  175. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/design_spec.md" +0 -0
  176. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204//345/217/263/344/270/212/350/247/222 logo.png" → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210//317/203A/314/212/342/224/202/316/243/342/225/225e/314/200/316/246/302/272/303/206 logo.png"} +0 -0
  177. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/345/270/270/350/247/204//345/244/247/345/236/213 logo.png" → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210//317/203n/314/203/302/272/317/203/342/202/247i/314/210 logo.png"} +0 -0
  178. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/01_cover.svg" +0 -0
  179. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/02_chapter.svg" +0 -0
  180. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/02_toc.svg" +0 -0
  181. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/03_content.svg" +0 -0
  182. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/04_ending.svg" +0 -0
  183. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/design_spec.md" +0 -0
  184. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243//345/217/263/344/270/212/350/247/222 logo.png" → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201//317/203A/314/212/342/224/202/316/243/342/225/225e/314/200/316/246/302/272/303/206 logo.png"} +0 -0
  185. /package/skills/ppt-master/templates/layouts//{344/270/255/346/261/275/347/240/224_/347/216/260/344/273/243//345/244/247/345/236/213 logo.png" → 316/243/342/225/225/302/241/302/265/342/226/222/342/225/234/317/204a/314/201o/314/210_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201//317/203n/314/203/302/272/317/203/342/202/247i/314/210 logo.png"} +0 -0
  186. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/01_cover.svg" +0 -0
  187. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/02_chapter.svg" +0 -0
  188. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/02_toc.svg" +0 -0
  189. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/03_content.svg" +0 -0
  190. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/04_ending.svg" +0 -0
  191. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210}/design_spec.md" +0 -0
  192. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204//346/260/264/347/224/265/344/270/211/345/261/200logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210//302/265/342/226/221/342/224/244/317/204o/314/210/342/225/241/316/243/342/225/225e/314/210/317/203/342/226/222C/314/247logo.png"} +0 -0
  193. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204//344/270/255/345/233/275/346/260/264/345/212/241logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210//316/243/342/225/225/302/241/317/203/302/242/342/225/234/302/265/342/226/221/342/224/244/317/203e/314/200i/314/201logo.png"} +0 -0
  194. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204//345/215/216/344/270/234/351/231/242logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210//317/203i/314/200A/314/210/316/243/342/225/225/302/243/316/230O/314/210o/314/201logo.png"} +0 -0
  195. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/345/270/270/350/247/204//347/224/265/345/273/272logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/203/342/225/225/342/225/225/316/246/302/272a/314/210//317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221logo.png"} +0 -0
  196. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/01_cover.svg" +0 -0
  197. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/02_chapter.svg" +0 -0
  198. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/02_toc.svg" +0 -0
  199. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/03_content.svg" +0 -0
  200. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/04_ending.svg" +0 -0
  201. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243 → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201}/design_spec.md" +0 -0
  202. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243//346/260/264/347/224/265/344/270/211/345/261/200logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201//302/265/342/226/221/342/224/244/317/204o/314/210/342/225/241/316/243/342/225/225e/314/210/317/203/342/226/222C/314/247logo.png"} +0 -0
  203. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243//344/270/255/345/233/275/346/260/264/345/212/241logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201//316/243/342/225/225/302/241/317/203/302/242/342/225/234/302/265/342/226/221/342/224/244/317/203e/314/200i/314/201logo.png"} +0 -0
  204. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243//345/215/216/344/270/234/351/231/242logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201//317/203i/314/200A/314/210/316/243/342/225/225/302/243/316/230O/314/210o/314/201logo.png"} +0 -0
  205. /package/skills/ppt-master/templates/layouts//{344/270/255/345/233/275/347/224/265/345/273/272_/347/216/260/344/273/243//347/224/265/345/273/272logo.png" → 316/243/342/225/225/302/241/317/203/302/242/342/225/234/317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221_/317/204A/314/210/342/226/221/316/243/342/225/227u/314/201//317/204o/314/210/342/225/241/317/203/342/225/227/342/225/221logo.png"} +0 -0
  206. /package/skills/ppt-master/templates/layouts//{347/247/221/346/212/200/350/223/235/345/225/206/345/212/241 → 317/204/302/272/303/246/302/265e/314/200C/314/247/316/246o/314/202/302/245/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/01_cover.svg" +0 -0
  207. /package/skills/ppt-master/templates/layouts//{347/247/221/346/212/200/350/223/235/345/225/206/345/212/241 → 317/204/302/272/303/246/302/265e/314/200C/314/247/316/246o/314/202/302/245/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/02_chapter.svg" +0 -0
  208. /package/skills/ppt-master/templates/layouts//{347/247/221/346/212/200/350/223/235/345/225/206/345/212/241 → 317/204/302/272/303/246/302/265e/314/200C/314/247/316/246o/314/202/302/245/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/02_toc.svg" +0 -0
  209. /package/skills/ppt-master/templates/layouts//{347/247/221/346/212/200/350/223/235/345/225/206/345/212/241 → 317/204/302/272/303/246/302/265e/314/200C/314/247/316/246o/314/202/302/245/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/03_content.svg" +0 -0
  210. /package/skills/ppt-master/templates/layouts//{347/247/221/346/212/200/350/223/235/345/225/206/345/212/241 → 317/204/302/272/303/246/302/265e/314/200C/314/247/316/246o/314/202/302/245/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/04_ending.svg" +0 -0
  211. /package/skills/ppt-master/templates/layouts//{347/247/221/346/212/200/350/223/235/345/225/206/345/212/241 → 317/204/302/272/303/246/302/265e/314/200C/314/247/316/246o/314/202/302/245/317/203o/314/200a/314/212/317/203e/314/200i/314/201}/design_spec.md" +0 -0
@@ -0,0 +1,871 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ svg_page_gen.py v5 - Batch SVG page generator for PPT Master.
4
+ 13+ layout types aligned with v4 reference PPT design language.
5
+ """
6
+
7
+ import json, sys, os, argparse, math, base64
8
+
9
+ FONT = "Microsoft YaHei, PingFang SC, Helvetica, Arial, sans-serif"
10
+ W, H = 1280, 720
11
+
12
+ PRIMARY = "#003366"
13
+ ACCENT_GOLD = "#D4AF37"
14
+ TEXT_DARK = "#1A1A2E"
15
+ TEXT_MID = "#64748B"
16
+ TEXT_LIGHT = "#94A3B8"
17
+ WHITE = "#FFFFFF"
18
+ PANEL_BG = "#FFFFFF"
19
+ PANEL_OPACITY = 0.88
20
+
21
+ ACCENTS = ["#003366", "#00838F", "#2E7D32", "#C23531", "#6A1B9A", "#AD1457", "#E65100", "#37474F"]
22
+
23
+ def esc(t):
24
+ if not t: return ""
25
+ return str(t).replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")
26
+
27
+ def load_bg(path):
28
+ if not path or not os.path.exists(path): return None
29
+ ext = os.path.splitext(path)[1].lower().lstrip(".")
30
+ mime = {"png":"image/png","jpg":"image/jpeg","jpeg":"image/jpeg","webp":"image/webp"}.get(ext,"image/png")
31
+ try:
32
+ with open(path,"rb") as f: d = base64.b64encode(f.read()).decode()
33
+ except IOError as e:
34
+ print(f" Warning: Cannot read background image '{path}': {e}", file=sys.stderr)
35
+ return None
36
+ return f"data:{mime};base64,{d}"
37
+
38
+ def bg_image(L, uri):
39
+ if uri:
40
+ L.append(f'<image href="{uri}" x="0" y="0" width="{W}" height="{H}" preserveAspectRatio="xMidYMid slice"/>')
41
+ else:
42
+ L.append(f'<defs><linearGradient id="bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0%" stop-color="#f0f4f8"/><stop offset="100%" stop-color="#e2e8f0"/></linearGradient></defs><rect width="{W}" height="{H}" fill="url(#bg)"/>')
43
+
44
+ def page_footer(L, pname, pnum):
45
+ fy = H - 20
46
+ if pname:
47
+ L.append(f'<text x="{W/2}" y="{fy}" text-anchor="middle" font-family="{FONT}" font-size="9" fill="{TEXT_LIGHT}">{esc(pname)}</text>')
48
+ if pnum is not None:
49
+ L.append(f'<text x="{W-20}" y="{fy}" text-anchor="end" font-family="{FONT}" font-size="9" fill="{TEXT_LIGHT}">{pnum:02d}</text>')
50
+
51
+ def page_title_bar(L, title):
52
+ L.append(f'<rect x="60" y="24" width="4" height="36" rx="2" fill="{PRIMARY}"/>')
53
+ L.append(f'<text x="76" y="50" font-family="{FONT}" font-size="22.5" font-weight="bold" fill="{PRIMARY}">{esc(title)}</text>')
54
+
55
+ def panel(L, x, y, w, h, rx=10, opacity=PANEL_OPACITY, header_color=None, header_h=5):
56
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{w:.1f}" height="{h:.1f}" rx="{rx}" fill="{PANEL_BG}" opacity="{opacity}"/>')
57
+ if header_color:
58
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{w:.1f}" height="{header_h}" rx="{min(rx, header_h)}" fill="{header_color}"/>')
59
+
60
+ def _bullets(L, items, x, y, max_y, fs=10.5, color=TEXT_DARK, spacing=20):
61
+ for b in items:
62
+ if y + 12 > max_y: break
63
+ L.append(f'<text x="{x}" y="{y+10}" font-family="{FONT}" font-size="{fs}" fill="{color}">\u2022 {esc(b)}</text>')
64
+ y += spacing
65
+ return y
66
+
67
+ # ==================== PAGE RENDERERS ====================
68
+
69
+ def render_cover(pg, L, bg, pname):
70
+ bg_image(L, bg)
71
+ L.append(f'<rect width="{W}" height="{H}" fill="#000000" opacity="0.45"/>')
72
+ L.append(f'<rect x="80" y="200" width="4" height="200" rx="2" fill="{ACCENT_GOLD}"/>')
73
+ org = pg.get("organization","")
74
+ if org:
75
+ L.append(f'<text x="108" y="240" font-family="{FONT}" font-size="16.5" font-weight="bold" fill="{ACCENT_GOLD}">{esc(org)}</text>')
76
+ L.append(f'<text x="108" y="300" font-family="{FONT}" font-size="33" font-weight="bold" fill="{WHITE}">{esc(pg.get("title",""))}</text>')
77
+ sub = pg.get("subtitle","")
78
+ if sub:
79
+ L.append(f'<text x="108" y="345" font-family="{FONT}" font-size="21" fill="#E0E0E0">{esc(sub)}</text>')
80
+ L.append(f'<rect x="80" y="380" width="400" height="1" fill="{ACCENT_GOLD}"/>')
81
+ bidder = pg.get("bidder","")
82
+ if bidder:
83
+ L.append(f'<text x="108" y="420" font-family="{FONT}" font-size="15" fill="#E0E0E0">{esc(bidder)}</text>')
84
+ date = pg.get("date","")
85
+ if date:
86
+ L.append(f'<text x="108" y="450" font-family="{FONT}" font-size="13.5" fill="{TEXT_LIGHT}">{esc(date)}</text>')
87
+
88
+ def render_toc(pg, L, bg, pname):
89
+ bg_image(L, bg)
90
+ page_title_bar(L, pg.get("title", "目录"))
91
+ items = pg.get("items", [])
92
+ cols = 2
93
+ per = math.ceil(len(items) / cols) if items else 1
94
+ gap, iw, ih = 12, (W - 120 - 12) / 2, 76
95
+ for i, item in enumerate(items):
96
+ col, row = i // per, i % per
97
+ x, y = 60 + col * (iw + gap), 80 + row * (ih + gap)
98
+ color = ACCENTS[i % len(ACCENTS)]
99
+ panel(L, x, y, iw, ih, 8, 0.9)
100
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="5" height="{ih}" rx="2" fill="{color}"/>')
101
+ L.append(f'<text x="{x+20}" y="{y+28}" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{color}">{esc(item.get("num",""))}</text>')
102
+ L.append(f'<text x="{x+52}" y="{y+28}" font-family="{FONT}" font-size="16" font-weight="bold" fill="{TEXT_DARK}">{esc(item.get("title",""))}</text>')
103
+ L.append(f'<text x="{x+52}" y="{y+52}" font-family="{FONT}" font-size="10.5" fill="{TEXT_MID}">{esc(item.get("desc",""))}</text>')
104
+ page_footer(L, pname, pg.get("page_num"))
105
+
106
+ def render_chapter(pg, L, bg, pname):
107
+ bg_image(L, bg)
108
+ L.append(f'<rect width="{W}" height="{H}" fill="#000000" opacity="0.35"/>')
109
+ num = pg.get("chapter_num","01")
110
+ L.append(f'<text x="640" y="280" text-anchor="middle" font-family="{FONT}" font-size="100" font-weight="bold" fill="{PRIMARY}" opacity="0.15">{esc(num)}</text>')
111
+ L.append(f'<text x="640" y="370" text-anchor="middle" font-family="{FONT}" font-size="36" font-weight="bold" fill="{WHITE}">{esc(pg.get("title",""))}</text>')
112
+ sub = pg.get("subtitle","")
113
+ if sub:
114
+ L.append(f'<text x="640" y="410" text-anchor="middle" font-family="{FONT}" font-size="15" fill="#E0E0E0">{esc(sub)}</text>')
115
+ page_footer(L, pname, pg.get("page_num"))
116
+
117
+ def render_ending(pg, L, bg, pname):
118
+ bg_image(L, bg)
119
+ L.append(f'<rect width="{W}" height="{H}" fill="#000000" opacity="0.35"/>')
120
+ L.append(f'<text x="640" y="270" text-anchor="middle" font-family="{FONT}" font-size="36" font-weight="bold" fill="{WHITE}">{esc(pg.get("title","感谢聆听"))}</text>')
121
+ sub = pg.get("subtitle","")
122
+ if sub:
123
+ L.append(f'<text x="640" y="315" text-anchor="middle" font-family="{FONT}" font-size="15" fill="#E0E0E0">{esc(sub)}</text>')
124
+ L.append(f'<rect x="540" y="335" width="200" height="2" rx="1" fill="{ACCENT_GOLD}" opacity="0.6"/>')
125
+ points = pg.get("points", pg.get("contacts",[]))
126
+ if points:
127
+ cols = min(len(points), 4)
128
+ pw = 160
129
+ sx = (W - cols * pw) / 2
130
+ for pi, pt in enumerate(points):
131
+ cx = sx + pi * pw + pw/2
132
+ L.append(f'<text x="{cx:.0f}" y="390" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{ACCENT_GOLD}">{esc(pt)}</text>')
133
+
134
+ # ==================== CONTENT LAYOUTS ====================
135
+
136
+ def _layout_radial(L, sections):
137
+ """Center circle + left/right lists with connecting lines (v4 slide 2)."""
138
+ cx, cy, cr = W/2, H/2 - 20, 80
139
+ # Outer + inner circle
140
+ L.append(f'<circle cx="{cx}" cy="{cy}" r="{cr+10}" fill="none" stroke="{PRIMARY}" stroke-width="1.5" opacity="0.3"/>')
141
+ L.append(f'<circle cx="{cx}" cy="{cy}" r="{cr}" fill="{PRIMARY}" opacity="0.08"/>')
142
+ # Center label
143
+ center_text = sections[0].get("title","") if sections else ""
144
+ L.append(f'<text x="{cx}" y="{cy-5}" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(center_text)}</text>')
145
+ center_sub = sections[0].get("subtitle","") if sections else ""
146
+ if center_sub:
147
+ L.append(f'<text x="{cx}" y="{cy+15}" text-anchor="middle" font-family="{FONT}" font-size="9.8" fill="{TEXT_MID}">{esc(center_sub)}</text>')
148
+ # Left items (sections[1] if exists)
149
+ left_items = sections[1].get("bullets",[]) if len(sections) > 1 else []
150
+ left_title = sections[1].get("title","") if len(sections) > 1 else ""
151
+ if left_title:
152
+ L.append(f'<text x="140" y="100" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(left_title)}</text>')
153
+ for i, item in enumerate(left_items[:6]):
154
+ iy = 130 + i * 42
155
+ color = ACCENTS[i % len(ACCENTS)]
156
+ panel(L, 60, iy, 240, 36, 6, 0.88, color, 4)
157
+ L.append(f'<text x="80" y="{iy+23}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">{esc(item)}</text>')
158
+ # Connecting line
159
+ L.append(f'<line x1="300" y1="{iy+18}" x2="{cx-cr-10}" y2="{cy}" stroke="{TEXT_LIGHT}" stroke-width="0.8" opacity="0.5"/>')
160
+ # Right items
161
+ right_items = sections[2].get("bullets",[]) if len(sections) > 2 else []
162
+ right_title = sections[2].get("title","") if len(sections) > 2 else ""
163
+ if right_title:
164
+ L.append(f'<text x="{W-140}" y="100" text-anchor="end" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(right_title)}</text>')
165
+ for i, item in enumerate(right_items[:6]):
166
+ iy = 130 + i * 42
167
+ color = ACCENTS[(i+3) % len(ACCENTS)]
168
+ panel(L, W-300, iy, 240, 36, 6, 0.88, color, 4)
169
+ L.append(f'<text x="{W-280}" y="{iy+23}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">{esc(item)}</text>')
170
+ L.append(f'<line x1="{W-300}" y1="{iy+18}" x2="{cx+cr+10}" y2="{cy}" stroke="{TEXT_LIGHT}" stroke-width="0.8" opacity="0.5"/>')
171
+
172
+ def _layout_columns_n(L, sections, n=None):
173
+ """N equal vertical card columns with colored header + item lists (v4 slide 3)."""
174
+ ns = len(sections)
175
+ cols = n or min(ns, 5)
176
+ gap = 10
177
+ top_y = 80
178
+ # Optional banner
179
+ banner_sec = None
180
+ if sections and sections[0].get("is_banner"):
181
+ banner_sec = sections[0]
182
+ sections = sections[1:]
183
+ ns -= 1
184
+ cols = n or min(ns, 5)
185
+ panel(L, 60, 74, W-120, 42, 8, 0.85)
186
+ # Icon circle
187
+ L.append(f'<circle cx="88" cy="95" r="12" fill="{PRIMARY}" opacity="0.1"/>')
188
+ L.append(f'<text x="108" y="90" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(banner_sec.get("title",""))}</text>')
189
+ for bi, b in enumerate(banner_sec.get("bullets",[])[:2]):
190
+ L.append(f'<text x="108" y="{104+bi*14}" font-family="{FONT}" font-size="9.8" fill="{TEXT_MID}">{esc(b)}</text>')
191
+ top_y = 126
192
+ cw = (W - 120 - (cols-1)*gap) / cols
193
+ ch = H - top_y - 40
194
+ for si, sec in enumerate(sections[:cols]):
195
+ x = 60 + si * (cw + gap)
196
+ y = top_y
197
+ color = ACCENTS[si % len(ACCENTS)]
198
+ # Card with colored header
199
+ panel(L, x, y, cw, ch, 8, 0.88)
200
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{cw:.1f}" height="36" rx="8" fill="{color}"/>')
201
+ L.append(f'<rect x="{x:.1f}" y="{y+28:.1f}" width="{cw:.1f}" height="8" fill="{color}"/>')
202
+ # Header text
203
+ L.append(f'<text x="{x+cw/2:.1f}" y="{y+23}" text-anchor="middle" font-family="{FONT}" font-size="12" font-weight="bold" fill="{WHITE}">{esc(sec.get("title",""))}</text>')
204
+ # Items with separator lines
205
+ ty = y + 48
206
+ for bi, b in enumerate(sec.get("bullets",[])):
207
+ if ty + 14 > y + ch - 8: break
208
+ if bi > 0:
209
+ L.append(f'<line x1="{x+8}" y1="{ty-4}" x2="{x+cw-8}" y2="{ty-4}" stroke="#E0E0E0" stroke-width="0.5"/>')
210
+ L.append(f'<text x="{x+cw/2:.1f}" y="{ty+10}" text-anchor="middle" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">{esc(b)}</text>')
211
+ ty += 28
212
+
213
+ def _layout_layers(L, sections):
214
+ """Horizontal stacked layers with optional left sidebar label (v4 slide 4)."""
215
+ ns = len(sections)
216
+ gap = 6
217
+ sidebar_w = 40
218
+ has_sidebar = any(s.get("sidebar_label") for s in sections)
219
+ lx = 60 + (sidebar_w if has_sidebar else 0)
220
+ lw = W - lx - 60
221
+ layer_h = (H - 100 - (ns-1)*gap) / ns
222
+ for si, sec in enumerate(sections):
223
+ y = 80 + si * (layer_h + gap)
224
+ color = ACCENTS[si % len(ACCENTS)]
225
+ # Layer band
226
+ panel(L, lx, y, lw, layer_h, 6, 0.88)
227
+ L.append(f'<rect x="{lx:.1f}" y="{y:.1f}" width="{lw:.1f}" height="5" rx="3" fill="{color}"/>')
228
+ # Layer title (centered top)
229
+ title = sec.get("title","")
230
+ L.append(f'<text x="{lx+lw/2:.1f}" y="{y+22}" text-anchor="middle" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(title)}</text>')
231
+ # Sub-items as horizontal pills
232
+ items = sec.get("bullets",[])
233
+ if items:
234
+ n_items = len(items)
235
+ pill_gap = 8
236
+ pill_w = min((lw - 20 - (n_items-1)*pill_gap) / n_items, 200)
237
+ total_pw = n_items * pill_w + (n_items-1) * pill_gap
238
+ px_start = lx + (lw - total_pw) / 2
239
+ py = y + 30
240
+ for pi, item in enumerate(items):
241
+ px = px_start + pi * (pill_w + pill_gap)
242
+ L.append(f'<rect x="{px:.1f}" y="{py:.1f}" width="{pill_w:.1f}" height="28" rx="5" fill="{color}" opacity="0.12"/>')
243
+ L.append(f'<text x="{px+pill_w/2:.1f}" y="{py+18}" text-anchor="middle" font-family="{FONT}" font-size="9.8" fill="{TEXT_DARK}">{esc(item)}</text>')
244
+ # Sidebar label
245
+ if has_sidebar and sec.get("sidebar_label"):
246
+ L.append(f'<text x="70" y="{y+layer_h/2}" font-family="{FONT}" font-size="10" fill="{PRIMARY}" transform="rotate(-90 70 {y+layer_h/2})">{esc(sec["sidebar_label"])}</text>')
247
+ # Arrow between layers
248
+ if si < ns - 1:
249
+ ay = y + layer_h + gap/2
250
+ L.append(f'<polygon points="{lx+lw/2-5},{ay-3} {lx+lw/2+5},{ay-3} {lx+lw/2},{ay+3}" fill="{TEXT_LIGHT}"/>')
251
+
252
+ def _layout_left_detail_right_grid(L, sections):
253
+ """Left large detail panel + right 2x2 card grid (v4 slide 5)."""
254
+ left_w = (W - 140) * 0.38
255
+ ph = H - 120
256
+ # Left panel
257
+ panel(L, 60, 80, left_w, ph, 10, 0.88)
258
+ y = 108
259
+ if sections:
260
+ sec0 = sections[0]
261
+ # Icon area
262
+ L.append(f'<circle cx="88" cy="{y}" r="10" fill="{PRIMARY}" opacity="0.1"/>')
263
+ st = sec0.get("title","")
264
+ if st:
265
+ L.append(f'<text x="86" y="{y+26}" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(st)}</text>')
266
+ y += 36
267
+ for b in sec0.get("bullets",[]):
268
+ if y + 14 > 80 + ph - 8: break
269
+ L.append(f'<text x="86" y="{y+12}" font-family="{FONT}" font-size="11.2" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
270
+ y += 24
271
+ # Subsection titles
272
+ sub_title = sec0.get("subtitle","")
273
+ if sub_title:
274
+ y += 12
275
+ L.append(f'<text x="86" y="{y+12}" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(sub_title)}</text>')
276
+ y += 24
277
+ # Right grid (2x2 or Nx2)
278
+ right_secs = sections[1:] if len(sections) > 1 else []
279
+ rx = 60 + left_w + 20
280
+ rw = W - rx - 60
281
+ n = len(right_secs)
282
+ cols = 2
283
+ rows = math.ceil(n / cols)
284
+ gap = 12
285
+ cw = (rw - (cols-1)*gap) / cols
286
+ ch = (ph - (rows-1)*gap) / rows
287
+ for si, sec in enumerate(right_secs):
288
+ col, row = si % cols, si // cols
289
+ cx = rx + col*(cw+gap)
290
+ cy = 80 + row*(ch+gap)
291
+ color = ACCENTS[(si+1) % len(ACCENTS)]
292
+ panel(L, cx, cy, cw, ch, 8, 0.88, color, 5)
293
+ # Icon placeholder
294
+ L.append(f'<circle cx="{cx+cw/2:.1f}" cy="{cy+24}" r="10" fill="{color}" opacity="0.15"/>')
295
+ st = sec.get("title","")
296
+ ty = cy + 42
297
+ if st:
298
+ L.append(f'<text x="{cx+14}" y="{ty}" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(st)}</text>')
299
+ ty += 22
300
+ for b in sec.get("bullets",[]):
301
+ if ty + 12 > cy + ch - 8: break
302
+ L.append(f'<text x="{cx+14}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_MID}">{esc(b)}</text>')
303
+ ty += 20
304
+
305
+ def _layout_tall_cards(L, sections):
306
+ """Tall vertical cards with icon area, big number, title, bullets (v4 slide 6)."""
307
+ ns = len(sections)
308
+ cols = min(ns, 4)
309
+ gap = 14
310
+ cw = (W - 120 - (cols-1)*gap) / cols
311
+ ch = H - 120
312
+ for si, sec in enumerate(sections[:cols]):
313
+ x = 60 + si * (cw + gap)
314
+ y = 80
315
+ color = ACCENTS[si % len(ACCENTS)]
316
+ panel(L, x, y, cw, ch, 8, 0.88)
317
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{cw:.1f}" height="5" rx="2" fill="{color}"/>')
318
+ # Icon circle
319
+ L.append(f'<circle cx="{x+cw/2:.1f}" cy="{y+40}" r="18" fill="{color}" opacity="0.1"/>')
320
+ # Big number (gold)
321
+ highlight = sec.get("highlight","")
322
+ ty = y + 72
323
+ if highlight:
324
+ L.append(f'<text x="{x+cw/2:.1f}" y="{ty+20}" text-anchor="middle" font-family="{FONT}" font-size="27" font-weight="bold" fill="{ACCENT_GOLD}">{esc(highlight)}</text>')
325
+ ty += 45
326
+ # Title
327
+ st = sec.get("title","")
328
+ if st:
329
+ L.append(f'<text x="{x+cw/2:.1f}" y="{ty+10}" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(st)}</text>')
330
+ ty += 28
331
+ # Bullets
332
+ for b in sec.get("bullets",[]):
333
+ if ty + 12 > y + ch - 8: break
334
+ L.append(f'<text x="{x+14}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
335
+ ty += 20
336
+ # Bottom subtitle
337
+ sub = sec.get("subtitle","")
338
+ if sub:
339
+ L.append(f'<text x="{x+cw/2:.1f}" y="{y+ch-12}" text-anchor="middle" font-family="{FONT}" font-size="9.8" fill="{TEXT_MID}">{esc(sub)}</text>')
340
+
341
+ def _layout_grid(L, sections, cols=3, rows=None):
342
+ """Generic NxM card grid with icon + title + bullets (v4 slide 8 = 2x3, slide 12 = 2x2)."""
343
+ ns = len(sections)
344
+ if rows is None: rows = math.ceil(ns / cols)
345
+ gap = 14
346
+ cw = (W - 120 - (cols-1)*gap) / cols
347
+ ch = (H - 120 - (rows-1)*gap) / rows
348
+ for si, sec in enumerate(sections[:cols*rows]):
349
+ col, row = si % cols, si // cols
350
+ x = 60 + col*(cw+gap)
351
+ y = 80 + row*(ch+gap)
352
+ color = ACCENTS[si % len(ACCENTS)]
353
+ panel(L, x, y, cw, ch, 8, 0.88)
354
+ # Left accent bar
355
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="4" height="{ch:.1f}" rx="2" fill="{color}"/>')
356
+ # Icon placeholder
357
+ L.append(f'<rect x="{x+14}" y="{y+14}" width="28" height="28" rx="6" fill="{color}" opacity="0.12"/>')
358
+ # Title
359
+ st = sec.get("title","")
360
+ ty = y + 56
361
+ if st:
362
+ L.append(f'<text x="{x+14}" y="{y+36}" font-family="{FONT}" font-size="12" font-weight="bold" fill="{PRIMARY}">{esc(st)}</text>')
363
+ # Divider
364
+ L.append(f'<line x1="{x+10}" y1="{ty-6}" x2="{x+cw-10}" y2="{ty-6}" stroke="#E0E0E0" stroke-width="0.5"/>')
365
+ # Bullets
366
+ for b in sec.get("bullets",[]):
367
+ if ty + 12 > y + ch - 8: break
368
+ L.append(f'<text x="{x+14}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
369
+ ty += 20
370
+
371
+ def _layout_split_half(L, sections):
372
+ """Left/right 50-50 split panels, each with colored header bar + detail list (v4 slide 9)."""
373
+ gap = 14
374
+ pw = (W - 120 - gap) / 2
375
+ ph = H - 120
376
+ for si, sec in enumerate(sections[:2]):
377
+ x = 60 + si * (pw + gap)
378
+ y = 80
379
+ color = ACCENTS[si % len(ACCENTS)]
380
+ panel(L, x, y, pw, ph, 8, 0.88)
381
+ # Colored header bar
382
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{pw:.1f}" height="38" rx="8" fill="{color}"/>')
383
+ L.append(f'<rect x="{x:.1f}" y="{y+30:.1f}" width="{pw:.1f}" height="8" fill="{color}"/>')
384
+ # Header icon + title
385
+ L.append(f'<circle cx="{x+20}" cy="{y+19}" r="8" fill="{WHITE}" opacity="0.3"/>')
386
+ st = sec.get("title","")
387
+ L.append(f'<text x="{x+36}" y="{y+24}" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{WHITE}">{esc(st)}</text>')
388
+ # Items with labels + descriptions
389
+ ty = y + 52
390
+ for b in sec.get("bullets",[]):
391
+ if ty + 14 > y + ph - 8: break
392
+ if isinstance(b, dict):
393
+ label = b.get("label","")
394
+ desc = b.get("desc","")
395
+ L.append(f'<text x="{x+14}" y="{ty+12}" font-family="{FONT}" font-size="11.2" font-weight="bold" fill="{TEXT_DARK}">{esc(label)}</text>')
396
+ ty += 20
397
+ if desc:
398
+ L.append(f'<text x="{x+20}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_MID}">{esc(desc)}</text>')
399
+ ty += 18
400
+ L.append(f'<line x1="{x+10}" y1="{ty+2}" x2="{x+pw-10}" y2="{ty+2}" stroke="#E0E0E0" stroke-width="0.5"/>')
401
+ ty += 8
402
+ else:
403
+ L.append(f'<text x="{x+14}" y="{ty+12}" font-family="{FONT}" font-size="11.2" fill="{TEXT_DARK}">{esc(b)}</text>')
404
+ ty += 24
405
+ L.append(f'<line x1="{x+10}" y1="{ty-4}" x2="{x+pw-10}" y2="{ty-4}" stroke="#E0E0E0" stroke-width="0.5"/>')
406
+
407
+ def _layout_matrix_plus_metrics(L, sections):
408
+ """Top matrix/table area + bottom big-number cards (v4 slide 10)."""
409
+ # Top area: first section as matrix
410
+ top_h = (H - 120) * 0.48
411
+ bot_y = 80 + top_h + 14
412
+ bot_h = H - bot_y - 40
413
+ if sections:
414
+ sec0 = sections[0]
415
+ panel(L, 60, 80, W-120, top_h, 8, 0.88)
416
+ st = sec0.get("title","")
417
+ if st:
418
+ L.append(f'<text x="86" y="106" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(st)}</text>')
419
+ # Render bullets as labeled rows
420
+ ty = 124
421
+ for b in sec0.get("bullets",[]):
422
+ if ty + 14 > 80 + top_h - 8: break
423
+ if isinstance(b, dict):
424
+ label = b.get("label","")
425
+ items = b.get("items",[])
426
+ L.append(f'<text x="86" y="{ty+12}" font-family="{FONT}" font-size="11.2" fill="{TEXT_DARK}">{esc(label)}</text>')
427
+ # Render items as pills
428
+ px = 200
429
+ for item in items:
430
+ pw_pill = min(len(str(item))*8+16, 120)
431
+ L.append(f'<rect x="{px}" y="{ty}" width="{pw_pill}" height="22" rx="4" fill="{PRIMARY}" opacity="0.08"/>')
432
+ L.append(f'<text x="{px+pw_pill/2:.0f}" y="{ty+15}" text-anchor="middle" font-family="{FONT}" font-size="9.8" fill="{TEXT_DARK}">{esc(item)}</text>')
433
+ px += pw_pill + 8
434
+ ty += 30
435
+ else:
436
+ L.append(f'<text x="86" y="{ty+12}" font-family="{FONT}" font-size="11.2" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
437
+ ty += 24
438
+ # Bottom: metric cards
439
+ bot_secs = sections[1:] if len(sections) > 1 else []
440
+ n = len(bot_secs)
441
+ cols = min(n, 3) if n > 0 else 3
442
+ gap = 14
443
+ mcw = (W - 120 - (cols-1)*gap) / cols
444
+ for mi, sec in enumerate(bot_secs[:cols]):
445
+ mx = 60 + mi * (mcw + gap)
446
+ color = ACCENTS[mi % len(ACCENTS)]
447
+ panel(L, mx, bot_y, mcw, bot_h, 8, 0.88)
448
+ L.append(f'<rect x="{mx:.1f}" y="{bot_y:.1f}" width="{mcw:.1f}" height="4" rx="2" fill="{color}"/>')
449
+ # Icon
450
+ L.append(f'<circle cx="{mx+mcw/2:.1f}" cy="{bot_y+24}" r="12" fill="{color}" opacity="0.12"/>')
451
+ # Big number
452
+ highlight = sec.get("highlight","")
453
+ L.append(f'<text x="{mx+mcw/2:.1f}" y="{bot_y+bot_h*0.5}" text-anchor="middle" font-family="{FONT}" font-size="27" font-weight="bold" fill="{ACCENT_GOLD}">{esc(highlight)}</text>')
454
+ # Label
455
+ L.append(f'<text x="{mx+mcw/2:.1f}" y="{bot_y+bot_h*0.68}" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(sec.get("title",""))}</text>')
456
+ # Desc
457
+ desc = sec.get("subtitle","")
458
+ if desc:
459
+ L.append(f'<text x="{mx+mcw/2:.1f}" y="{bot_y+bot_h*0.82}" text-anchor="middle" font-family="{FONT}" font-size="9.8" fill="{TEXT_MID}">{esc(desc)}</text>')
460
+
461
+ def _layout_zigzag_timeline(L, sections):
462
+ """Alternating up/down nodes on center timeline line (v4 slide 11)."""
463
+ ns = len(sections)
464
+ # Horizontal timeline line
465
+ line_y = H * 0.5
466
+ L.append(f'<line x1="80" y1="{line_y}" x2="{W-80}" y2="{line_y}" stroke="{TEXT_LIGHT}" stroke-width="1.5"/>')
467
+ step = (W - 200) / max(ns - 1, 1)
468
+ node_r = 8
469
+ card_w = min(step - 20, 150)
470
+ card_h = 140
471
+ for si, sec in enumerate(sections):
472
+ nx = 100 + si * step
473
+ is_up = si % 2 == 0
474
+ # Node dot
475
+ L.append(f'<circle cx="{nx:.0f}" cy="{line_y}" r="{node_r}" fill="{ACCENTS[si % len(ACCENTS)]}"/>')
476
+ L.append(f'<circle cx="{nx:.0f}" cy="{line_y}" r="{node_r-3}" fill="{WHITE}"/>')
477
+ # Vertical connector
478
+ if is_up:
479
+ cy = line_y - card_h - 20
480
+ L.append(f'<line x1="{nx:.0f}" y1="{line_y-node_r}" x2="{nx:.0f}" y2="{cy+card_h}" stroke="{TEXT_LIGHT}" stroke-width="1"/>')
481
+ else:
482
+ cy = line_y + 20
483
+ L.append(f'<line x1="{nx:.0f}" y1="{line_y+node_r}" x2="{nx:.0f}" y2="{cy}" stroke="{TEXT_LIGHT}" stroke-width="1"/>')
484
+ # Card
485
+ cx = nx - card_w/2
486
+ color = ACCENTS[si % len(ACCENTS)]
487
+ panel(L, cx, cy, card_w, card_h, 6, 0.88, color, 4)
488
+ # Phase name
489
+ L.append(f'<text x="{nx:.0f}" y="{cy+22}" text-anchor="middle" font-family="{FONT}" font-size="11" font-weight="bold" fill="{PRIMARY}">{esc(sec.get("title",""))}</text>')
490
+ # Bullets
491
+ ty = cy + 36
492
+ for b in sec.get("bullets",[]):
493
+ if ty + 12 > cy + card_h - 8: break
494
+ L.append(f'<text x="{cx+8}" y="{ty+10}" font-family="{FONT}" font-size="9.8" fill="{TEXT_DARK}">{esc(b)}</text>')
495
+ ty += 16
496
+ # Duration label
497
+ dur = sec.get("duration", sec.get("subtitle",""))
498
+ if dur:
499
+ L.append(f'<text x="{nx:.0f}" y="{cy+card_h-8}" text-anchor="middle" font-family="{FONT}" font-size="9" fill="{TEXT_MID}">{esc(dur)}</text>')
500
+
501
+ def _layout_people_cards(L, sections):
502
+ """Horizontal people cards with avatar circle + role + bullets + bottom banner (v4 slide 13)."""
503
+ ns = len(sections)
504
+ # Check if last section is a banner
505
+ banner = None
506
+ if sections and sections[-1].get("is_banner"):
507
+ banner = sections[-1]
508
+ sections = sections[:-1]
509
+ ns -= 1
510
+ cols = min(ns, 4)
511
+ gap = 10
512
+ cw = (W - 120 - (cols-1)*gap) / cols
513
+ ch = H - 120 - (80 if banner else 0)
514
+ for si, sec in enumerate(sections[:cols]):
515
+ x = 60 + si * (cw + gap)
516
+ y = 80
517
+ color = ACCENTS[si % len(ACCENTS)]
518
+ panel(L, x, y, cw, ch, 8, 0.88)
519
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{cw:.1f}" height="4" rx="2" fill="{color}"/>')
520
+ # Avatar circle
521
+ acx = x + cw/2
522
+ L.append(f'<circle cx="{acx:.0f}" cy="{y+42}" r="26" fill="{color}" opacity="0.08" stroke="{color}" stroke-width="1.5"/>')
523
+ # Role title
524
+ L.append(f'<text x="{acx:.0f}" y="{y+84}" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(sec.get("title",""))}</text>')
525
+ # Subtitle (experience)
526
+ sub = sec.get("subtitle","")
527
+ if sub:
528
+ L.append(f'<text x="{acx:.0f}" y="{y+102}" text-anchor="middle" font-family="{FONT}" font-size="10.5" fill="{color}">{esc(sub)}</text>')
529
+ # Bullets
530
+ ty = y + 116
531
+ for b in sec.get("bullets",[]):
532
+ if ty + 12 > y + ch - 8: break
533
+ L.append(f'<text x="{x+14}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
534
+ ty += 20
535
+ # Bottom banner
536
+ if banner:
537
+ by = 80 + ch + 10
538
+ panel(L, 60, by, W-120, 60, 8, 0.88)
539
+ bt = banner.get("title","")
540
+ if bt:
541
+ L.append(f'<text x="{W/2}" y="{by+20}" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(bt)}</text>')
542
+ items = banner.get("bullets",[])
543
+ n = len(items)
544
+ if n:
545
+ iw = (W - 160) / n
546
+ for bi, b in enumerate(items):
547
+ bx = 80 + bi * iw + iw/2
548
+ L.append(f'<text x="{bx:.0f}" y="{by+42}" text-anchor="middle" font-family="{FONT}" font-size="10.5" fill="{TEXT_MID}">{esc(b)}</text>')
549
+
550
+ def _layout_case_cards(L, sections):
551
+ """3 tall case study cards with header, sections dividers, checkmark results (v4 slide 14)."""
552
+ ns = len(sections)
553
+ cols = min(ns, 3)
554
+ gap = 12
555
+ cw = (W - 120 - (cols-1)*gap) / cols
556
+ ch = H - 120
557
+ for si, sec in enumerate(sections[:cols]):
558
+ x = 60 + si * (cw + gap)
559
+ y = 80
560
+ color = ACCENTS[si % len(ACCENTS)]
561
+ panel(L, x, y, cw, ch, 8, 0.88)
562
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{cw:.1f}" height="4" rx="2" fill="{color}"/>')
563
+ # Icon + company name
564
+ L.append(f'<circle cx="{x+20}" cy="{y+24}" r="10" fill="{color}" opacity="0.12"/>')
565
+ L.append(f'<text x="{x+36}" y="{y+28}" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(sec.get("title",""))}</text>')
566
+ # Industry tag
567
+ sub = sec.get("subtitle","")
568
+ if sub:
569
+ L.append(f'<text x="{x+14}" y="{y+48}" font-family="{FONT}" font-size="9.8" fill="{TEXT_MID}">{esc(sub)}</text>')
570
+ # Divider
571
+ L.append(f'<line x1="{x+10}" y1="{y+56}" x2="{x+cw-10}" y2="{y+56}" stroke="#E0E0E0" stroke-width="0.5"/>')
572
+ # Sections (background, solution, results)
573
+ ty = y + 68
574
+ for b in sec.get("bullets",[]):
575
+ if ty + 14 > y + ch - 8: break
576
+ if isinstance(b, dict):
577
+ label = b.get("label","")
578
+ items = b.get("items",[])
579
+ L.append(f'<text x="{x+14}" y="{ty+10}" font-family="{FONT}" font-size="11.2" font-weight="bold" fill="{TEXT_DARK}">{esc(label)}</text>')
580
+ ty += 22
581
+ for item in items:
582
+ if ty + 12 > y + ch - 8: break
583
+ prefix = "\u2713 " if label.startswith("\u6210") or "result" in label.lower() else "\u2022 "
584
+ L.append(f'<text x="{x+20}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">{prefix}{esc(item)}</text>')
585
+ ty += 18
586
+ ty += 6
587
+ else:
588
+ L.append(f'<text x="{x+14}" y="{ty+10}" font-family="{FONT}" font-size="10.5" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
589
+ ty += 20
590
+
591
+ def _layout_metrics_grid(L, sections):
592
+ """2x3 or NxM grid of big number highlight cards (v4 slide 15)."""
593
+ ns = len(sections)
594
+ cols = min(ns, 3)
595
+ rows = math.ceil(ns / cols)
596
+ gap = 14
597
+ cw = (W - 120 - (cols-1)*gap) / cols
598
+ ch = (H - 120 - (rows-1)*gap) / rows
599
+ for si, sec in enumerate(sections[:cols*rows]):
600
+ col, row = si % cols, si // cols
601
+ x = 60 + col*(cw+gap)
602
+ y = 80 + row*(ch+gap)
603
+ color = ACCENTS[si % len(ACCENTS)]
604
+ panel(L, x, y, cw, ch, 10, 0.88)
605
+ L.append(f'<rect x="{x:.1f}" y="{y:.1f}" width="{cw:.1f}" height="4" rx="2" fill="{color}"/>')
606
+ # Icon
607
+ L.append(f'<circle cx="{x+cw/2:.1f}" cy="{y+ch*0.22}" r="14" fill="{color}" opacity="0.1"/>')
608
+ # Big number (gold)
609
+ highlight = sec.get("highlight","")
610
+ L.append(f'<text x="{x+cw/2:.1f}" y="{y+ch*0.48}" text-anchor="middle" font-family="{FONT}" font-size="27" font-weight="bold" fill="{ACCENT_GOLD}">{esc(highlight)}</text>')
611
+ # Label
612
+ L.append(f'<text x="{x+cw/2:.1f}" y="{y+ch*0.65}" text-anchor="middle" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(sec.get("title",""))}</text>')
613
+ # Desc
614
+ desc = sec.get("subtitle","")
615
+ if desc:
616
+ L.append(f'<text x="{x+cw/2:.1f}" y="{y+ch*0.8}" text-anchor="middle" font-family="{FONT}" font-size="9.8" fill="{TEXT_MID}">{esc(desc)}</text>')
617
+
618
+ def _layout_full_width(L, sections):
619
+ """Single full-width panel with all sections stacked."""
620
+ pw, ph = W - 120, H - 120
621
+ panel(L, 60, 80, pw, ph, 10, 0.88)
622
+ y = 108
623
+ for sec in sections:
624
+ st = sec.get("title","")
625
+ if st:
626
+ L.append(f'<text x="86" y="{y+16}" font-family="{FONT}" font-size="13.5" font-weight="bold" fill="{PRIMARY}">{esc(st)}</text>')
627
+ y += 30
628
+ for b in sec.get("bullets",[]):
629
+ L.append(f'<text x="86" y="{y+12}" font-family="{FONT}" font-size="11.2" fill="{TEXT_DARK}">\u2022 {esc(b)}</text>')
630
+ y += 24
631
+ y += 16
632
+
633
+ # ==================== SMART LAYOUT SELECTION ====================
634
+
635
+ LAYOUT_MAP = {
636
+ "radial": _layout_radial,
637
+ "columns": _layout_columns_n,
638
+ "columns_5": lambda L, s: _layout_columns_n(L, s, 5),
639
+ "columns_4": lambda L, s: _layout_columns_n(L, s, 4),
640
+ "columns_3": lambda L, s: _layout_columns_n(L, s, 3),
641
+ "layers": _layout_layers,
642
+ "left_right": _layout_left_detail_right_grid,
643
+ "left_detail_right_grid": _layout_left_detail_right_grid,
644
+ "tall_cards": _layout_tall_cards,
645
+ "grid_2x3": lambda L, s: _layout_grid(L, s, 3, 2),
646
+ "grid_2x2": lambda L, s: _layout_grid(L, s, 2, 2),
647
+ "grid_3x2": lambda L, s: _layout_grid(L, s, 2, 3),
648
+ "split_half": _layout_split_half,
649
+ "matrix_metrics": _layout_matrix_plus_metrics,
650
+ "matrix_plus_metrics": _layout_matrix_plus_metrics,
651
+ "zigzag_timeline": _layout_zigzag_timeline,
652
+ "zigzag": _layout_zigzag_timeline,
653
+ "people_cards": _layout_people_cards,
654
+ "people": _layout_people_cards,
655
+ "case_cards": _layout_case_cards,
656
+ "cases": _layout_case_cards,
657
+ "metrics_grid": _layout_metrics_grid,
658
+ "full": _layout_full_width,
659
+ }
660
+
661
+ def _auto_select_layout(sections):
662
+ """Smart layout selection based on content structure."""
663
+ ns = len(sections)
664
+ has_highlights = any(s.get("highlight") for s in sections)
665
+ has_banners = any(s.get("is_banner") for s in sections)
666
+ has_sidebar = any(s.get("sidebar_label") for s in sections)
667
+ total_bullets = sum(len(s.get("bullets",[])) for s in sections)
668
+ has_dict_bullets = any(isinstance(b, dict) for s in sections for b in s.get("bullets",[]))
669
+
670
+ # Specific patterns
671
+ if has_sidebar:
672
+ return "layers"
673
+ if has_highlights and ns >= 6:
674
+ return "metrics_grid"
675
+ if has_highlights and ns >= 3:
676
+ return "tall_cards"
677
+ if ns == 1:
678
+ return "full"
679
+ if ns == 2 and has_dict_bullets:
680
+ return "split_half"
681
+ if ns == 2 and total_bullets > 8:
682
+ return "left_right"
683
+ if ns == 2:
684
+ return "split_half"
685
+ if ns == 3 and has_highlights:
686
+ return "tall_cards"
687
+ if ns == 3 and total_bullets <= 12:
688
+ return "columns_3"
689
+ if ns == 3:
690
+ return "grid_2x3" # Will show as 1x3
691
+ if ns == 4 and total_bullets <= 16:
692
+ return "grid_2x2"
693
+ if ns == 4:
694
+ return "tall_cards"
695
+ if ns == 5:
696
+ return "columns_5"
697
+ if ns == 6:
698
+ return "grid_2x3"
699
+ return "columns"
700
+
701
+ def render_content(pg, L, bg, pname):
702
+ """Content page with 13+ layout modes, smart auto-selection."""
703
+ bg_image(L, bg)
704
+ page_title_bar(L, pg.get("title",""))
705
+ sections = pg.get("sections", [])
706
+
707
+ # Optional subtitle banner
708
+ banner = pg.get("subtitle","")
709
+ if banner:
710
+ panel(L, 60, 68, W-120, 28, 6, 0.8)
711
+ L.append(f'<text x="80" y="87" font-family="{FONT}" font-size="10.5" fill="{PRIMARY}">{esc(banner)}</text>')
712
+
713
+ layout = pg.get("layout", "auto")
714
+ if layout == "auto":
715
+ layout = _auto_select_layout(sections)
716
+
717
+ renderer = LAYOUT_MAP.get(layout, _layout_full_width)
718
+ renderer(L, sections)
719
+ page_footer(L, pname, pg.get("page_num"))
720
+
721
+ # Keep legacy renderers as aliases
722
+ def render_cards(pg, L, bg, pname):
723
+ """Cards page -> delegates to content with cards layout."""
724
+ cards = pg.get("cards",[])
725
+ # Convert cards to sections format
726
+ sections = []
727
+ for c in cards:
728
+ desc = c.get("desc",[])
729
+ if isinstance(desc, str): desc = [desc]
730
+ sections.append({"title": c.get("title",""), "bullets": desc})
731
+ pg2 = dict(pg)
732
+ pg2["sections"] = sections
733
+ if not pg2.get("layout"):
734
+ pg2["layout"] = "columns"
735
+ render_content(pg2, L, bg, pname)
736
+
737
+ def render_metrics(pg, L, bg, pname):
738
+ """Metrics page -> delegates to content with metrics_grid layout."""
739
+ metrics = pg.get("metrics",[])
740
+ sections = []
741
+ for m in metrics:
742
+ sections.append({"title": m.get("label",""), "highlight": m.get("value",""), "subtitle": m.get("desc","")})
743
+ pg2 = dict(pg)
744
+ pg2["sections"] = sections
745
+ pg2["layout"] = "metrics_grid"
746
+ render_content(pg2, L, bg, pname)
747
+
748
+ def render_timeline(pg, L, bg, pname):
749
+ """Timeline -> delegates to content with zigzag_timeline layout."""
750
+ phases = pg.get("phases",[])
751
+ sections = []
752
+ for p in phases:
753
+ sections.append({"title": p.get("name",""), "bullets": [p.get("label","")] if p.get("label") else [], "duration": p.get("duration",""), "subtitle": p.get("duration","")})
754
+ pg2 = dict(pg)
755
+ pg2["sections"] = sections
756
+ pg2["layout"] = "zigzag_timeline"
757
+ render_content(pg2, L, bg, pname)
758
+
759
+ def render_team(pg, L, bg, pname):
760
+ """Team -> delegates to content with people_cards layout."""
761
+ members = pg.get("members",[])
762
+ sections = []
763
+ for m in members:
764
+ s = {"title": m.get("role", m.get("name","")), "subtitle": m.get("exp",""), "bullets": []}
765
+ if m.get("name"): s["bullets"].append(m["name"])
766
+ if m.get("cert"): s["bullets"].append(m["cert"])
767
+ sections.append(s)
768
+ pg2 = dict(pg)
769
+ pg2["sections"] = sections
770
+ pg2["layout"] = "people_cards"
771
+ render_content(pg2, L, bg, pname)
772
+
773
+ RENDERERS = {
774
+ "cover": render_cover, "toc": render_toc, "chapter": render_chapter,
775
+ "content": render_content, "cards": render_cards, "metrics": render_metrics,
776
+ "timeline": render_timeline, "team": render_team, "ending": render_ending,
777
+ }
778
+
779
+ def generate(pg, total, bg_uri, pname):
780
+ L = [f'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {W} {H}" width="{W}" height="{H}">']
781
+ ptype = pg.get("type","content")
782
+ renderer = RENDERERS.get(ptype, render_content)
783
+ renderer(pg, L, bg_uri, pname)
784
+ L.append('</svg>')
785
+ return "\n".join(L)
786
+
787
+ def main():
788
+ try:
789
+ _main_impl()
790
+ except KeyboardInterrupt:
791
+ print("\nInterrupted by user.")
792
+ sys.exit(130)
793
+ except SystemExit:
794
+ raise
795
+ except Exception as e:
796
+ print(f"Fatal error: {type(e).__name__}: {e}", file=sys.stderr)
797
+ sys.exit(1)
798
+
799
+ def _main_impl():
800
+ p = argparse.ArgumentParser(description="PPT Master SVG Page Generator v5")
801
+ p.add_argument("input", help="JSON page definitions file")
802
+ p.add_argument("-o","--output", required=True, help="Output directory")
803
+ p.add_argument("--width", type=int, default=1280)
804
+ p.add_argument("--height", type=int, default=720)
805
+ p.add_argument("--bg", default=None, help="Background image file path (fallback)")
806
+ args = p.parse_args()
807
+
808
+ global W, H
809
+ W, H = args.width, args.height
810
+
811
+ try:
812
+ os.makedirs(args.output, exist_ok=True)
813
+ except OSError as e:
814
+ print(f"Error: Cannot create output directory '{args.output}': {e}", file=sys.stderr)
815
+ sys.exit(1)
816
+
817
+ try:
818
+ with open(args.input, "r", encoding="utf-8") as f:
819
+ spec = json.load(f)
820
+ except FileNotFoundError:
821
+ print(f"Error: Input file not found: {args.input}", file=sys.stderr)
822
+ sys.exit(1)
823
+ except json.JSONDecodeError as e:
824
+ print(f"Error: Invalid JSON in '{args.input}': {e}", file=sys.stderr)
825
+ sys.exit(1)
826
+ except IOError as e:
827
+ print(f"Error: Cannot read input file '{args.input}': {e}", file=sys.stderr)
828
+ sys.exit(1)
829
+
830
+ pages = spec.get("pages", [])
831
+ total = len(pages)
832
+ pname = spec.get("project_name", "")
833
+ global_bg_path = args.bg or spec.get("background_image")
834
+ global_bg_uri = load_bg(global_bg_path)
835
+ if global_bg_uri:
836
+ print(f" BG global: {global_bg_path} ({len(global_bg_uri)//1024}KB)")
837
+
838
+ gen_count = skip_count = fail_count = 0
839
+ failed_pages = []
840
+ for pg in pages:
841
+ fn = pg.get("file")
842
+ if not fn: continue
843
+ if pg.get("skip"):
844
+ skip_count += 1
845
+ print(f" SKIP {fn}")
846
+ continue
847
+ try:
848
+ page_bg_path = pg.get("background_image")
849
+ bg_uri = load_bg(page_bg_path) if page_bg_path else global_bg_uri
850
+ svg = generate(pg, total, bg_uri, pname)
851
+ out_path = os.path.join(args.output, fn)
852
+ with open(out_path, "w", encoding="utf-8") as f:
853
+ f.write(svg)
854
+ gen_count += 1
855
+ layout = pg.get("layout","auto")
856
+ print(f" OK {fn} ({len(svg)} bytes) [{layout}]")
857
+ except IOError as e:
858
+ fail_count += 1
859
+ failed_pages.append(fn)
860
+ print(f" FAIL {fn}: write error: {e}", file=sys.stderr)
861
+ except Exception as e:
862
+ fail_count += 1
863
+ failed_pages.append(fn)
864
+ print(f" FAIL {fn}: {type(e).__name__}: {e}", file=sys.stderr)
865
+
866
+ print(f"\nDone: {gen_count} generated, {skip_count} skipped, {fail_count} failed, {total} total")
867
+ if failed_pages:
868
+ print(f"Failed pages: {', '.join(failed_pages)}", file=sys.stderr)
869
+
870
+ if __name__ == "__main__":
871
+ main()