@julioventura/opensquad 0.1.17

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 (247) hide show
  1. package/README.md +433 -0
  2. package/_opensquad/config/playwright.config.json +11 -0
  3. package/_opensquad/core/architect.agent.yaml +112 -0
  4. package/_opensquad/core/best-practices/_catalog.yaml +126 -0
  5. package/_opensquad/core/best-practices/blog-post.md +132 -0
  6. package/_opensquad/core/best-practices/blog-seo.md +127 -0
  7. package/_opensquad/core/best-practices/brand-resolution-checklist.md +172 -0
  8. package/_opensquad/core/best-practices/copywriting.md +441 -0
  9. package/_opensquad/core/best-practices/data-analysis.md +401 -0
  10. package/_opensquad/core/best-practices/email-newsletter.md +118 -0
  11. package/_opensquad/core/best-practices/email-sales.md +110 -0
  12. package/_opensquad/core/best-practices/image-design.md +348 -0
  13. package/_opensquad/core/best-practices/instagram-feed.md +235 -0
  14. package/_opensquad/core/best-practices/instagram-reels.md +112 -0
  15. package/_opensquad/core/best-practices/instagram-stories.md +107 -0
  16. package/_opensquad/core/best-practices/linkedin-article.md +116 -0
  17. package/_opensquad/core/best-practices/linkedin-post.md +121 -0
  18. package/_opensquad/core/best-practices/researching.md +349 -0
  19. package/_opensquad/core/best-practices/review.md +269 -0
  20. package/_opensquad/core/best-practices/run-recovery.md +61 -0
  21. package/_opensquad/core/best-practices/social-networks-publishing.md +327 -0
  22. package/_opensquad/core/best-practices/squad-creation-checklist.md +32 -0
  23. package/_opensquad/core/best-practices/strategist.md +344 -0
  24. package/_opensquad/core/best-practices/technical-writing.md +365 -0
  25. package/_opensquad/core/best-practices/twitter-post.md +105 -0
  26. package/_opensquad/core/best-practices/twitter-thread.md +122 -0
  27. package/_opensquad/core/best-practices/whatsapp-broadcast.md +107 -0
  28. package/_opensquad/core/best-practices/youtube-script.md +122 -0
  29. package/_opensquad/core/best-practices/youtube-shorts.md +112 -0
  30. package/_opensquad/core/defaults/youtube-video-assembly.json +84 -0
  31. package/_opensquad/core/prompts/build.prompt.md +613 -0
  32. package/_opensquad/core/prompts/design.prompt.md +606 -0
  33. package/_opensquad/core/prompts/discovery.prompt.md +377 -0
  34. package/_opensquad/core/prompts/sherlock-instagram.md +123 -0
  35. package/_opensquad/core/prompts/sherlock-linkedin.md +73 -0
  36. package/_opensquad/core/prompts/sherlock-shared.md +684 -0
  37. package/_opensquad/core/prompts/sherlock-twitter.md +78 -0
  38. package/_opensquad/core/prompts/sherlock-youtube.md +85 -0
  39. package/_opensquad/core/runner.pipeline.md +743 -0
  40. package/_opensquad/core/skills.engine.md +384 -0
  41. package/bin/opensquad.js +108 -0
  42. package/dashboard/index.html +15 -0
  43. package/dashboard/package-lock.json +1964 -0
  44. package/dashboard/package.json +28 -0
  45. package/dashboard/public/assets/avatars/Female1_1wave.png +0 -0
  46. package/dashboard/public/assets/avatars/Female1_2wave.png +0 -0
  47. package/dashboard/public/assets/avatars/Female1_blink.png +0 -0
  48. package/dashboard/public/assets/avatars/Female1_talk.png +0 -0
  49. package/dashboard/public/assets/avatars/Female2_1wave.png +0 -0
  50. package/dashboard/public/assets/avatars/Female2_2wave.png +0 -0
  51. package/dashboard/public/assets/avatars/Female2_blink.png +0 -0
  52. package/dashboard/public/assets/avatars/Female2_talk.png +0 -0
  53. package/dashboard/public/assets/avatars/Female3_blink.png +0 -0
  54. package/dashboard/public/assets/avatars/Female3_talk.png +0 -0
  55. package/dashboard/public/assets/avatars/Female3_wave.png +0 -0
  56. package/dashboard/public/assets/avatars/Female4_blink.png +0 -0
  57. package/dashboard/public/assets/avatars/Female4_talk.png +0 -0
  58. package/dashboard/public/assets/avatars/Female4_wave.png +0 -0
  59. package/dashboard/public/assets/avatars/Female5_blink.png +0 -0
  60. package/dashboard/public/assets/avatars/Female5_talk.png +0 -0
  61. package/dashboard/public/assets/avatars/Female5_wave.png +0 -0
  62. package/dashboard/public/assets/avatars/Female6_blink.png +0 -0
  63. package/dashboard/public/assets/avatars/Female6_talk.png +0 -0
  64. package/dashboard/public/assets/avatars/Female6_wave.png +0 -0
  65. package/dashboard/public/assets/avatars/Male1_1wave.png +0 -0
  66. package/dashboard/public/assets/avatars/Male1_2wave.png +0 -0
  67. package/dashboard/public/assets/avatars/Male1_blink.png +0 -0
  68. package/dashboard/public/assets/avatars/Male1_talk.png +0 -0
  69. package/dashboard/public/assets/avatars/Male2_1wave.png +0 -0
  70. package/dashboard/public/assets/avatars/Male2_2wave.png +0 -0
  71. package/dashboard/public/assets/avatars/Male2_blink.png +0 -0
  72. package/dashboard/public/assets/avatars/Male2_talk.png +0 -0
  73. package/dashboard/public/assets/avatars/Male3_blink.png +0 -0
  74. package/dashboard/public/assets/avatars/Male3_talk.png +0 -0
  75. package/dashboard/public/assets/avatars/Male3_wave.png +0 -0
  76. package/dashboard/public/assets/avatars/Male4_blink.png +0 -0
  77. package/dashboard/public/assets/avatars/Male4_talk.png +0 -0
  78. package/dashboard/public/assets/avatars/Male4_wave.png +0 -0
  79. package/dashboard/public/assets/desks/desktop_set_black_down.png +0 -0
  80. package/dashboard/public/assets/desks/desktop_set_black_down_coding-1.png +0 -0
  81. package/dashboard/public/assets/desks/desktop_set_black_down_coding.png +0 -0
  82. package/dashboard/public/assets/desks/desktop_set_black_up.png +0 -0
  83. package/dashboard/public/assets/desks/desktop_set_white_down.png +0 -0
  84. package/dashboard/public/assets/desks/desktop_set_white_down_coding-1.png +0 -0
  85. package/dashboard/public/assets/desks/desktop_set_white_down_coding.png +0 -0
  86. package/dashboard/public/assets/desks/desktop_set_white_up.png +0 -0
  87. package/dashboard/public/assets/furniture/armchair_tan.png +0 -0
  88. package/dashboard/public/assets/furniture/armchair_tan_down.png +0 -0
  89. package/dashboard/public/assets/furniture/backpack_blue.png +0 -0
  90. package/dashboard/public/assets/furniture/backpack_red.png +0 -0
  91. package/dashboard/public/assets/furniture/blinds.png +0 -0
  92. package/dashboard/public/assets/furniture/blinds_large_closed_white.png +0 -0
  93. package/dashboard/public/assets/furniture/bookshelf.png +0 -0
  94. package/dashboard/public/assets/furniture/bookshelf_purple_tall.png +0 -0
  95. package/dashboard/public/assets/furniture/bulletin_board.png +0 -0
  96. package/dashboard/public/assets/furniture/clock.png +0 -0
  97. package/dashboard/public/assets/furniture/coffee_mug.png +0 -0
  98. package/dashboard/public/assets/furniture/coffee_mug_blue.png +0 -0
  99. package/dashboard/public/assets/furniture/coffee_table.png +0 -0
  100. package/dashboard/public/assets/furniture/coffeepot_right.png +0 -0
  101. package/dashboard/public/assets/furniture/coffeetable_black_horizontal.png +0 -0
  102. package/dashboard/public/assets/furniture/couch.png +0 -0
  103. package/dashboard/public/assets/furniture/couch_tan_down.png +0 -0
  104. package/dashboard/public/assets/furniture/cushion_blue.png +0 -0
  105. package/dashboard/public/assets/furniture/cushion_tan.png +0 -0
  106. package/dashboard/public/assets/furniture/desk_wood.png +0 -0
  107. package/dashboard/public/assets/furniture/fancy_rug.png +0 -0
  108. package/dashboard/public/assets/furniture/fancy_rug_wide.png +0 -0
  109. package/dashboard/public/assets/furniture/flowers1.png +0 -0
  110. package/dashboard/public/assets/furniture/flowers2.png +0 -0
  111. package/dashboard/public/assets/furniture/lamp_tan.png +0 -0
  112. package/dashboard/public/assets/furniture/lantern.png +0 -0
  113. package/dashboard/public/assets/furniture/monstera.png +0 -0
  114. package/dashboard/public/assets/furniture/monstera_small.png +0 -0
  115. package/dashboard/public/assets/furniture/picture_frame.png +0 -0
  116. package/dashboard/public/assets/furniture/plant1.png +0 -0
  117. package/dashboard/public/assets/furniture/plant2.png +0 -0
  118. package/dashboard/public/assets/furniture/plant3.png +0 -0
  119. package/dashboard/public/assets/furniture/plant_poof.png +0 -0
  120. package/dashboard/public/assets/furniture/plant_spindly.png +0 -0
  121. package/dashboard/public/assets/furniture/poster_blue.png +0 -0
  122. package/dashboard/public/assets/furniture/rug.png +0 -0
  123. package/dashboard/public/assets/furniture/succulent_blue.png +0 -0
  124. package/dashboard/public/assets/furniture/succulent_green.png +0 -0
  125. package/dashboard/public/assets/furniture/treasurechest_closed_gold.png +0 -0
  126. package/dashboard/public/assets/furniture/water_cooler_better.png +0 -0
  127. package/dashboard/public/assets/furniture/whiteboard.png +0 -0
  128. package/dashboard/public/assets/furniture/whiteboard_stand_graph.png +0 -0
  129. package/dashboard/public/assets/furniture/window_blinds_open.png +0 -0
  130. package/dashboard/src/App.tsx +46 -0
  131. package/dashboard/src/components/RunDashboardButton.tsx +92 -0
  132. package/dashboard/src/components/SquadCard.tsx +49 -0
  133. package/dashboard/src/components/SquadSelector.tsx +67 -0
  134. package/dashboard/src/components/StatusBadge.tsx +32 -0
  135. package/dashboard/src/components/StatusBar.tsx +116 -0
  136. package/dashboard/src/hooks/useSquadSocket.ts +135 -0
  137. package/dashboard/src/lib/formatTime.ts +16 -0
  138. package/dashboard/src/lib/normalizeState.ts +25 -0
  139. package/dashboard/src/main.tsx +10 -0
  140. package/dashboard/src/office/AgentSprite.ts +241 -0
  141. package/dashboard/src/office/OfficeScene.ts +153 -0
  142. package/dashboard/src/office/PhaserGame.tsx +80 -0
  143. package/dashboard/src/office/RoomBuilder.ts +190 -0
  144. package/dashboard/src/office/assetKeys.ts +150 -0
  145. package/dashboard/src/office/palette.ts +32 -0
  146. package/dashboard/src/plugin/squadWatcher.ts +397 -0
  147. package/dashboard/src/store/useSquadStore.ts +56 -0
  148. package/dashboard/src/styles/globals.css +36 -0
  149. package/dashboard/src/types/state.ts +63 -0
  150. package/dashboard/src/vite-env.d.ts +1 -0
  151. package/dashboard/tsconfig.json +24 -0
  152. package/dashboard/vite.config.ts +13 -0
  153. package/package.json +59 -0
  154. package/public/sfx/slide-transition-sfx.mp3 +0 -0
  155. package/skills/README.md +84 -0
  156. package/skills/apify/SKILL.md +55 -0
  157. package/skills/blotato/SKILL.md +63 -0
  158. package/skills/canva/SKILL.md +60 -0
  159. package/skills/higgsfield/SKILL.md +147 -0
  160. package/skills/image-ai-generator/SKILL.md +124 -0
  161. package/skills/image-ai-generator/scripts/generate.py +175 -0
  162. package/skills/image-creator/SKILL.md +166 -0
  163. package/skills/image-creator/editorial-slide-template.js +645 -0
  164. package/skills/image-fetcher/SKILL.md +91 -0
  165. package/skills/imgbb-uploader/SKILL.md +73 -0
  166. package/skills/imgbb-uploader/scripts/upload.js +125 -0
  167. package/skills/instagram-publisher/README.md +36 -0
  168. package/skills/instagram-publisher/SKILL.md +231 -0
  169. package/skills/instagram-publisher/scripts/publish-playwright.js +418 -0
  170. package/skills/instagram-publisher/scripts/publish.js +521 -0
  171. package/skills/opensquad-agent-creator/SKILL.md +192 -0
  172. package/skills/opensquad-skill-creator/SKILL.md +420 -0
  173. package/skills/opensquad-skill-creator/agents/analyzer.md +274 -0
  174. package/skills/opensquad-skill-creator/agents/comparator.md +202 -0
  175. package/skills/opensquad-skill-creator/agents/grader.md +223 -0
  176. package/skills/opensquad-skill-creator/assets/eval_review.html +146 -0
  177. package/skills/opensquad-skill-creator/eval-viewer/generate_review.py +471 -0
  178. package/skills/opensquad-skill-creator/eval-viewer/viewer.html +1325 -0
  179. package/skills/opensquad-skill-creator/references/schemas.md +430 -0
  180. package/skills/opensquad-skill-creator/references/skill-format.md +235 -0
  181. package/skills/opensquad-skill-creator/scripts/__init__.py +0 -0
  182. package/skills/opensquad-skill-creator/scripts/aggregate_benchmark.py +401 -0
  183. package/skills/opensquad-skill-creator/scripts/quick_validate.py +103 -0
  184. package/skills/opensquad-skill-creator/scripts/run_eval.py +310 -0
  185. package/skills/opensquad-skill-creator/scripts/utils.py +47 -0
  186. package/skills/pdf-extractor/SKILL.md +57 -0
  187. package/skills/pdf-extractor/scripts/extract.py +82 -0
  188. package/skills/resend/SKILL.md +80 -0
  189. package/skills/run-dashboard/README.md +93 -0
  190. package/skills/run-dashboard/SKILL.md +173 -0
  191. package/skills/run-dashboard/scripts/finalize-state.js +273 -0
  192. package/skills/run-dashboard/scripts/generate.js +1296 -0
  193. package/skills/run-dashboard/scripts/serve.js +135 -0
  194. package/skills/run-dashboard/templates/run-dashboard-simple.template.html +191 -0
  195. package/skills/run-dashboard/templates/run-dashboard.template.html +1164 -0
  196. package/skills/smtp-sender/SKILL.md +88 -0
  197. package/skills/smtp-sender/scripts/send.js +478 -0
  198. package/skills/template-designer/SKILL.md +201 -0
  199. package/skills/template-designer/base-templates/model-a.html +27 -0
  200. package/skills/template-designer/base-templates/model-b.html +31 -0
  201. package/skills/template-designer/base-templates/model-c.html +42 -0
  202. package/skills/youtube-publisher/SKILL.md +232 -0
  203. package/skills/youtube-publisher/scripts/publish.js +2078 -0
  204. package/src/agents-cli.js +158 -0
  205. package/src/agents.js +134 -0
  206. package/src/i18n.js +48 -0
  207. package/src/init.js +442 -0
  208. package/src/locales/en.json +79 -0
  209. package/src/locales/es.json +78 -0
  210. package/src/locales/pt-BR.json +78 -0
  211. package/src/logger.js +38 -0
  212. package/src/prompt.js +46 -0
  213. package/src/readme/README.md +146 -0
  214. package/src/runs.js +318 -0
  215. package/src/skills-cli.js +157 -0
  216. package/src/skills.js +146 -0
  217. package/src/supabase-cli.js +584 -0
  218. package/src/update.js +169 -0
  219. package/templates/_opensquad/.opensquad-version +1 -0
  220. package/templates/_opensquad/_investigations/.gitkeep +0 -0
  221. package/templates/ide-templates/antigravity/.agent/rules/opensquad.md +68 -0
  222. package/templates/ide-templates/antigravity/.agent/workflows/opensquad.md +102 -0
  223. package/templates/ide-templates/claude-code/.claude/skills/opensquad/SKILL.md +182 -0
  224. package/templates/ide-templates/claude-code/.mcp.json +8 -0
  225. package/templates/ide-templates/claude-code/CLAUDE.md +57 -0
  226. package/templates/ide-templates/codex/.agents/skills/opensquad/SKILL.md +6 -0
  227. package/templates/ide-templates/codex/AGENTS.md +120 -0
  228. package/templates/ide-templates/cursor/.cursor/commands/opensquad.md +9 -0
  229. package/templates/ide-templates/cursor/.cursor/mcp.json +8 -0
  230. package/templates/ide-templates/cursor/.cursor/rules/opensquad.mdc +62 -0
  231. package/templates/ide-templates/cursor/.cursorignore +3 -0
  232. package/templates/ide-templates/gemini-cli/.gemini/settings.json +8 -0
  233. package/templates/ide-templates/gemini-cli/.gemini/skills/opensquad/SKILL.md +186 -0
  234. package/templates/ide-templates/gemini-cli/GEMINI.md +57 -0
  235. package/templates/ide-templates/opencode/.opencode/commands/opensquad.md +9 -0
  236. package/templates/ide-templates/opencode/AGENTS.md +120 -0
  237. package/templates/ide-templates/qwen-code/.qwen/settings.json +8 -0
  238. package/templates/ide-templates/qwen-code/.qwen/skills/opensquad/SKILL.md +182 -0
  239. package/templates/ide-templates/qwen-code/QWEN.md +57 -0
  240. package/templates/ide-templates/trae/.trae/mcp.json +8 -0
  241. package/templates/ide-templates/trae/.trae/rules/opensquad.md +64 -0
  242. package/templates/ide-templates/vscode-copilot/.github/copilot-instructions.md +59 -0
  243. package/templates/ide-templates/vscode-copilot/.github/prompts/opensquad.prompt.md +209 -0
  244. package/templates/ide-templates/vscode-copilot/.vscode/mcp.json +8 -0
  245. package/templates/ide-templates/vscode-copilot/.vscode/settings.json +3 -0
  246. package/templates/package.json +8 -0
  247. package/templates/squads/.gitkeep +0 -0
@@ -0,0 +1,1164 @@
1
+ <!DOCTYPE html>
2
+ <html lang="pt-BR">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>DASHBOARD-RUN</title>
8
+ <style>
9
+ :root {
10
+ --bg: #08111f;
11
+ --panel: rgba(11, 24, 42, 0.82);
12
+ --panel-border: rgba(0, 221, 255, 0.18);
13
+ --accent: #15f5ba;
14
+ --accent-2: #00c2ff;
15
+ --warn: #ffb84d;
16
+ --danger: #ff5f87;
17
+ --text: #eef7ff;
18
+ --muted: #9ab3c9;
19
+ --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
20
+ --radius: 24px;
21
+ --radius-sm: 16px;
22
+ --grid-gap: 18px;
23
+ font-family: "Segoe UI", Arial, sans-serif;
24
+ }
25
+
26
+ * {
27
+ box-sizing: border-box;
28
+ }
29
+
30
+ body {
31
+ margin: 0;
32
+ min-height: 100vh;
33
+ color: var(--text);
34
+ background:
35
+ radial-gradient(circle at top left, rgba(0, 194, 255, 0.22), transparent 32%),
36
+ radial-gradient(circle at top right, rgba(21, 245, 186, 0.12), transparent 28%),
37
+ linear-gradient(180deg, #07111d 0%, #040812 100%);
38
+ }
39
+
40
+ .shell {
41
+ width: min(1440px, calc(100vw - 32px));
42
+ margin: 20px auto 36px;
43
+ }
44
+
45
+ .hero,
46
+ .panel {
47
+ backdrop-filter: blur(16px);
48
+ background: var(--panel);
49
+ border: 1px solid var(--panel-border);
50
+ border-radius: var(--radius);
51
+ box-shadow: var(--shadow);
52
+ }
53
+
54
+ .hero {
55
+ padding: 24px;
56
+ overflow: hidden;
57
+ position: relative;
58
+ }
59
+
60
+ .hero::after {
61
+ content: "";
62
+ position: absolute;
63
+ inset: 0;
64
+ background: linear-gradient(90deg, rgba(21, 245, 186, 0.08), transparent 28%, rgba(0, 194, 255, 0.08));
65
+ pointer-events: none;
66
+ }
67
+
68
+ .hero-top {
69
+ display: flex;
70
+ gap: 18px;
71
+ justify-content: space-between;
72
+ align-items: flex-start;
73
+ flex-wrap: wrap;
74
+ position: relative;
75
+ z-index: 1;
76
+ }
77
+
78
+ .eyebrow {
79
+ display: inline-flex;
80
+ align-items: center;
81
+ gap: 8px;
82
+ padding: 8px 12px;
83
+ border-radius: 999px;
84
+ background: rgba(0, 194, 255, 0.14);
85
+ color: var(--accent-2);
86
+ font-size: 13px;
87
+ letter-spacing: 0.08em;
88
+ text-transform: uppercase;
89
+ font-weight: 700;
90
+ }
91
+
92
+ h1 {
93
+ margin: 14px 0 10px;
94
+ font-size: clamp(32px, 4vw, 58px);
95
+ line-height: 0.98;
96
+ letter-spacing: -0.04em;
97
+ }
98
+
99
+ .subtitle {
100
+ margin: 0;
101
+ max-width: 860px;
102
+ color: var(--muted);
103
+ font-size: 16px;
104
+ line-height: 1.5;
105
+ }
106
+
107
+ .hero-badges {
108
+ display: flex;
109
+ flex-wrap: wrap;
110
+ gap: 10px;
111
+ margin-top: 16px;
112
+ position: relative;
113
+ z-index: 1;
114
+ }
115
+
116
+ .hero-badge {
117
+ display: inline-flex;
118
+ align-items: center;
119
+ gap: 8px;
120
+ padding: 8px 12px;
121
+ border-radius: 999px;
122
+ font-size: 12px;
123
+ font-weight: 700;
124
+ letter-spacing: 0.08em;
125
+ text-transform: uppercase;
126
+ background: rgba(255, 184, 77, 0.14);
127
+ color: var(--warn);
128
+ border: 1px solid rgba(255, 184, 77, 0.18);
129
+ }
130
+
131
+ .hero-meta {
132
+ display: grid;
133
+ grid-template-columns: repeat(4, minmax(140px, 1fr));
134
+ gap: 14px;
135
+ margin-top: 22px;
136
+ position: relative;
137
+ z-index: 1;
138
+ }
139
+
140
+ .meta-card {
141
+ padding: 14px 16px;
142
+ border-radius: 18px;
143
+ background: rgba(5, 14, 26, 0.56);
144
+ border: 1px solid rgba(255, 255, 255, 0.05);
145
+ }
146
+
147
+ .meta-card .label,
148
+ .panel .label {
149
+ color: var(--muted);
150
+ font-size: 12px;
151
+ letter-spacing: 0.08em;
152
+ text-transform: uppercase;
153
+ }
154
+
155
+ .meta-card .value {
156
+ margin-top: 8px;
157
+ font-size: 20px;
158
+ font-weight: 700;
159
+ }
160
+
161
+ .controls {
162
+ display: flex;
163
+ gap: 12px;
164
+ flex-wrap: wrap;
165
+ justify-content: flex-end;
166
+ }
167
+
168
+ button,
169
+ .action-link {
170
+ appearance: none;
171
+ border: 1px solid rgba(255, 255, 255, 0.08);
172
+ background: linear-gradient(180deg, rgba(0, 194, 255, 0.16), rgba(0, 194, 255, 0.05));
173
+ color: var(--text);
174
+ border-radius: 999px;
175
+ padding: 11px 16px;
176
+ font-size: 14px;
177
+ font-weight: 700;
178
+ cursor: pointer;
179
+ text-decoration: none;
180
+ transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
181
+ }
182
+
183
+ button:hover,
184
+ .action-link:hover {
185
+ transform: translateY(-1px);
186
+ border-color: rgba(21, 245, 186, 0.3);
187
+ background: linear-gradient(180deg, rgba(21, 245, 186, 0.18), rgba(0, 194, 255, 0.08));
188
+ }
189
+
190
+ .dashboard-grid {
191
+ display: grid;
192
+ grid-template-columns: 1.3fr 0.95fr;
193
+ gap: var(--grid-gap);
194
+ margin-top: 18px;
195
+ }
196
+
197
+ .column {
198
+ display: grid;
199
+ gap: var(--grid-gap);
200
+ }
201
+
202
+ .panel {
203
+ padding: 18px;
204
+ }
205
+
206
+ .panel h2 {
207
+ margin: 0 0 14px;
208
+ font-size: 18px;
209
+ letter-spacing: -0.02em;
210
+ }
211
+
212
+ .status-chip {
213
+ display: inline-flex;
214
+ align-items: center;
215
+ gap: 8px;
216
+ padding: 8px 12px;
217
+ border-radius: 999px;
218
+ font-size: 13px;
219
+ font-weight: 700;
220
+ text-transform: uppercase;
221
+ letter-spacing: 0.06em;
222
+ }
223
+
224
+ .status-chip.published,
225
+ .status-chip.completed,
226
+ .status-chip.approved {
227
+ background: rgba(21, 245, 186, 0.14);
228
+ color: var(--accent);
229
+ }
230
+
231
+ .status-chip.partial,
232
+ .status-chip.warning {
233
+ background: rgba(255, 184, 77, 0.14);
234
+ color: var(--warn);
235
+ }
236
+
237
+ .status-chip.failed,
238
+ .status-chip.blocked,
239
+ .status-chip.error {
240
+ background: rgba(255, 95, 135, 0.14);
241
+ color: var(--danger);
242
+ }
243
+
244
+ .checklist {
245
+ display: grid;
246
+ gap: 12px;
247
+ }
248
+
249
+ .checklist-item,
250
+ .channel-card,
251
+ .metric-card,
252
+ .artifact-card,
253
+ .error-item {
254
+ border-radius: var(--radius-sm);
255
+ padding: 14px 16px;
256
+ background: rgba(5, 14, 26, 0.55);
257
+ border: 1px solid rgba(255, 255, 255, 0.05);
258
+ }
259
+
260
+ .checklist-item {
261
+ display: grid;
262
+ grid-template-columns: 26px 1fr auto;
263
+ gap: 12px;
264
+ align-items: start;
265
+ }
266
+
267
+ .marker {
268
+ width: 26px;
269
+ height: 26px;
270
+ border-radius: 999px;
271
+ display: flex;
272
+ align-items: center;
273
+ justify-content: center;
274
+ font-size: 13px;
275
+ font-weight: 800;
276
+ background: rgba(255, 255, 255, 0.08);
277
+ color: var(--text);
278
+ }
279
+
280
+ .marker.ok {
281
+ background: rgba(21, 245, 186, 0.18);
282
+ color: var(--accent);
283
+ }
284
+
285
+ .marker.warn {
286
+ background: rgba(255, 184, 77, 0.18);
287
+ color: var(--warn);
288
+ }
289
+
290
+ .marker.err {
291
+ background: rgba(255, 95, 135, 0.18);
292
+ color: var(--danger);
293
+ }
294
+
295
+ .item-title,
296
+ .channel-title,
297
+ .metric-title {
298
+ font-size: 15px;
299
+ font-weight: 700;
300
+ }
301
+
302
+ .item-desc,
303
+ .channel-meta,
304
+ .metric-meta,
305
+ .artifact-meta,
306
+ .error-meta,
307
+ .empty-state {
308
+ margin-top: 6px;
309
+ color: var(--muted);
310
+ font-size: 13px;
311
+ line-height: 1.45;
312
+ }
313
+
314
+ .channels,
315
+ .previews,
316
+ .metrics,
317
+ .artifacts,
318
+ .errors {
319
+ display: grid;
320
+ gap: 12px;
321
+ }
322
+
323
+ .preview-grid {
324
+ display: grid;
325
+ grid-template-columns: repeat(6, 1fr);
326
+ gap: 12px;
327
+ }
328
+
329
+ @media (max-width: 1024px) {
330
+ .preview-grid {
331
+ grid-template-columns: repeat(3, 1fr);
332
+ }
333
+ }
334
+
335
+ @media (max-width: 640px) {
336
+ .preview-grid {
337
+ grid-template-columns: repeat(2, 1fr);
338
+ }
339
+ }
340
+
341
+ .preview-card {
342
+ border-radius: var(--radius-sm);
343
+ overflow: hidden;
344
+ background: rgba(5, 14, 26, 0.55);
345
+ border: 1px solid rgba(255, 255, 255, 0.05);
346
+ }
347
+
348
+ .preview-media {
349
+ aspect-ratio: 16 / 9;
350
+ background: linear-gradient(180deg, rgba(0, 194, 255, 0.14), rgba(5, 14, 26, 0.9));
351
+ overflow: hidden;
352
+ }
353
+
354
+ .preview-media img {
355
+ width: 100%;
356
+ height: 100%;
357
+ object-fit: cover;
358
+ display: block;
359
+ }
360
+
361
+ .preview-body {
362
+ padding: 14px 16px;
363
+ }
364
+
365
+ .preview-title {
366
+ font-size: 15px;
367
+ font-weight: 700;
368
+ }
369
+
370
+ .preview-headline {
371
+ margin-top: 8px;
372
+ font-size: 18px;
373
+ line-height: 1.2;
374
+ letter-spacing: -0.02em;
375
+ font-weight: 800;
376
+ color: var(--text);
377
+ }
378
+
379
+ .preview-meta {
380
+ margin-top: 6px;
381
+ color: var(--muted);
382
+ font-size: 13px;
383
+ line-height: 1.45;
384
+ }
385
+
386
+ .preview-cta {
387
+ margin-top: 10px;
388
+ padding-top: 10px;
389
+ border-top: 1px solid rgba(255, 255, 255, 0.06);
390
+ color: var(--accent);
391
+ font-size: 12px;
392
+ line-height: 1.45;
393
+ letter-spacing: 0.06em;
394
+ text-transform: uppercase;
395
+ font-weight: 700;
396
+ }
397
+
398
+ .channel-header,
399
+ .metric-header {
400
+ display: flex;
401
+ align-items: center;
402
+ justify-content: space-between;
403
+ gap: 12px;
404
+ }
405
+
406
+ .channel-actions,
407
+ .artifact-actions {
408
+ display: flex;
409
+ gap: 8px;
410
+ flex-wrap: wrap;
411
+ margin-top: 12px;
412
+ }
413
+
414
+ .metric-grid {
415
+ display: grid;
416
+ grid-template-columns: repeat(2, minmax(0, 1fr));
417
+ gap: 12px;
418
+ }
419
+
420
+ .metric-value {
421
+ margin-top: 8px;
422
+ font-size: 28px;
423
+ font-weight: 800;
424
+ letter-spacing: -0.04em;
425
+ }
426
+
427
+ .metric-unit {
428
+ color: var(--muted);
429
+ font-size: 12px;
430
+ text-transform: uppercase;
431
+ letter-spacing: 0.08em;
432
+ }
433
+
434
+ .footer-note {
435
+ margin-top: 18px;
436
+ color: var(--muted);
437
+ font-size: 12px;
438
+ line-height: 1.6;
439
+ }
440
+
441
+ /* Collapsible Panels */
442
+ .panel.collapsible .collapsible-trigger {
443
+ display: flex;
444
+ justify-content: space-between;
445
+ align-items: center;
446
+ cursor: pointer;
447
+ user-select: none;
448
+ margin: 0;
449
+ }
450
+
451
+ .panel.collapsible .collapsible-trigger::after {
452
+ content: "";
453
+ display: inline-block;
454
+ width: 8px;
455
+ height: 8px;
456
+ border-right: 2px solid var(--muted);
457
+ border-bottom: 2px solid var(--muted);
458
+ transform: rotate(45deg);
459
+ transition: transform 0.2s ease, border-color 0.2s ease;
460
+ margin-right: 4px;
461
+ }
462
+
463
+ .panel.collapsible .collapsible-trigger:hover::after {
464
+ border-color: var(--accent);
465
+ }
466
+
467
+ .panel.collapsible.collapsed .collapsible-trigger::after {
468
+ transform: rotate(-45deg);
469
+ }
470
+
471
+ .panel.collapsible.collapsed h2 {
472
+ margin-bottom: 0;
473
+ }
474
+
475
+ .panel.collapsible.collapsed .collapsible-content {
476
+ display: none;
477
+ }
478
+
479
+ /* Slide Preview Styling */
480
+ .preview-card.slide-preview {
481
+ border: 1px solid #1e40af;
482
+ border-radius: var(--radius-sm);
483
+ overflow: hidden;
484
+ background: rgba(5, 14, 26, 0.55);
485
+ display: flex;
486
+ flex-direction: column;
487
+ justify-content: space-between;
488
+ transition: transform 0.2s ease, border-color 0.2s ease;
489
+ }
490
+
491
+ .preview-card.slide-preview:hover {
492
+ transform: translateY(-2px);
493
+ border-color: var(--accent-2);
494
+ }
495
+
496
+ .preview-card.slide-preview .preview-media {
497
+ aspect-ratio: auto;
498
+ height: auto;
499
+ background: transparent;
500
+ }
501
+
502
+ .preview-card.slide-preview .preview-media img {
503
+ width: 100%;
504
+ height: auto;
505
+ object-fit: contain;
506
+ display: block;
507
+ }
508
+
509
+ .slide-preview-body {
510
+ padding: 10px 14px;
511
+ text-align: center;
512
+ background: rgba(4, 8, 18, 0.5);
513
+ /* 50% transparency dark background */
514
+ border-top: 1px solid rgba(30, 64, 175, 0.2);
515
+ }
516
+
517
+ .preview-label {
518
+ font-size: 15px;
519
+ font-weight: 700;
520
+ color: #1e40af;
521
+ }
522
+
523
+ .preview-card.slide-preview-placeholder {
524
+ border: 1px dashed rgba(30, 64, 175, 0.45);
525
+ border-radius: var(--radius-sm);
526
+ overflow: hidden;
527
+ background: rgba(5, 14, 26, 0.2);
528
+ display: flex;
529
+ flex-direction: column;
530
+ justify-content: center;
531
+ align-items: center;
532
+ aspect-ratio: 16 / 9;
533
+ pointer-events: none;
534
+ }
535
+
536
+ /* Modal Premium Styling */
537
+ .modal {
538
+ display: none;
539
+ position: fixed;
540
+ z-index: 1000;
541
+ left: 0;
542
+ top: 0;
543
+ width: 100%;
544
+ height: 100%;
545
+ overflow: hidden;
546
+ background-color: rgba(4, 8, 18, 0.92);
547
+ backdrop-filter: blur(12px);
548
+ align-items: center;
549
+ justify-content: center;
550
+ }
551
+
552
+ .modal-content {
553
+ position: relative;
554
+ width: 80%;
555
+ max-width: 1200px;
556
+ height: 80vh;
557
+ display: flex;
558
+ flex-direction: column;
559
+ align-items: center;
560
+ justify-content: center;
561
+ }
562
+
563
+ .modal-content img {
564
+ max-width: 100%;
565
+ max-height: 100%;
566
+ object-fit: contain;
567
+ border-radius: var(--radius-sm);
568
+ box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
569
+ border: 1px solid #1e40af;
570
+ }
571
+
572
+ .modal-label {
573
+ margin-top: 15px;
574
+ color: #1e40af;
575
+ font-size: 18px;
576
+ font-weight: 700;
577
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
578
+ }
579
+
580
+ .modal-close {
581
+ position: absolute;
582
+ top: 24px;
583
+ right: 32px;
584
+ color: var(--muted);
585
+ font-size: 38px;
586
+ font-weight: bold;
587
+ cursor: pointer;
588
+ transition: color 0.2s;
589
+ z-index: 1010;
590
+ }
591
+
592
+ .modal-close:hover {
593
+ color: var(--danger);
594
+ }
595
+
596
+ .modal-prev,
597
+ .modal-next {
598
+ position: absolute;
599
+ top: 50%;
600
+ transform: translateY(-50%);
601
+ background: rgba(11, 24, 42, 0.7);
602
+ border: 1px solid var(--panel-border);
603
+ color: var(--text);
604
+ font-size: 28px;
605
+ padding: 16px 20px;
606
+ cursor: pointer;
607
+ border-radius: 50%;
608
+ user-select: none;
609
+ transition: background 0.2s, border-color 0.2s, transform 0.2s;
610
+ z-index: 1010;
611
+ display: flex;
612
+ align-items: center;
613
+ justify-content: center;
614
+ width: 60px;
615
+ height: 60px;
616
+ }
617
+
618
+ .modal-prev:hover,
619
+ .modal-next:hover {
620
+ background: var(--accent-2);
621
+ color: #040812;
622
+ border-color: var(--accent-2);
623
+ }
624
+
625
+ .modal-prev {
626
+ left: 40px;
627
+ }
628
+
629
+ .modal-next {
630
+ right: 40px;
631
+ }
632
+
633
+ @media (max-width: 768px) {
634
+ .modal-content {
635
+ width: 95%;
636
+ }
637
+
638
+ .modal-prev {
639
+ left: 10px;
640
+ }
641
+
642
+ .modal-next {
643
+ right: 10px;
644
+ }
645
+
646
+ .modal-prev,
647
+ .modal-next {
648
+ width: 48px;
649
+ height: 48px;
650
+ font-size: 20px;
651
+ }
652
+ }
653
+
654
+ /* Hero Preview Section (Inside Hero container) */
655
+ .hero-preview {
656
+ margin-top: 28px;
657
+ padding-top: 24px;
658
+ border-top: 1px solid var(--panel-border);
659
+ position: relative;
660
+ z-index: 1;
661
+ }
662
+
663
+ .hero-preview h2 {
664
+ margin: 0 0 14px;
665
+ font-size: 18px;
666
+ letter-spacing: -0.02em;
667
+ }
668
+
669
+ @media (max-width: 1120px) {
670
+ .dashboard-grid {
671
+ grid-template-columns: 1fr;
672
+ }
673
+
674
+ .hero-meta {
675
+ grid-template-columns: repeat(2, minmax(0, 1fr));
676
+ }
677
+ }
678
+
679
+ @media (max-width: 720px) {
680
+ .shell {
681
+ width: min(100vw - 18px, 100%);
682
+ margin: 10px auto 24px;
683
+ }
684
+
685
+ .hero,
686
+ .panel {
687
+ border-radius: 20px;
688
+ padding: 16px;
689
+ }
690
+
691
+ .hero-meta,
692
+ .metric-grid {
693
+ grid-template-columns: 1fr;
694
+ }
695
+ }
696
+
697
+ @media (max-width: 500px) {
698
+ .preview-grid {
699
+ grid-template-columns: 1fr;
700
+ }
701
+ }
702
+ </style>
703
+ </head>
704
+
705
+ <body>
706
+ <div class="shell">
707
+ <section class="hero">
708
+
709
+ <div class="hero-meta">
710
+ <div class="meta-card">
711
+ <div class="label">Squad</div>
712
+ <div class="value" id="meta-squad">-</div>
713
+ </div>
714
+ <div class="meta-card">
715
+ <div class="label">Run ID</div>
716
+ <div class="value" id="meta-run-id">-</div>
717
+ </div>
718
+ <div class="meta-card">
719
+ <div class="label">Status</div>
720
+ <div class="value"><span class="status-chip" id="meta-status">Unknown</span></div>
721
+ </div>
722
+ <div class="meta-card">
723
+ <div class="label">Última atualização</div>
724
+ <div class="value" id="meta-updated-at">-</div>
725
+ </div>
726
+ </div>
727
+
728
+
729
+ <div class="hero-top">
730
+ <div>
731
+ <div class="eyebrow">DASHBOARD-RUN</div>
732
+ <h1 id="hero-title">DASHBOARD-RUN</h1>
733
+ <p class="subtitle" id="hero-subtitle">Resumo operacional, publicações, checklist, artefatos e sinais de
734
+ execução.</p>
735
+ <div class="hero-badges" id="hero-badges"></div>
736
+ </div>
737
+ <div class="controls">
738
+ <button id="refresh-button" type="button">Refresh Data</button>
739
+ <button id="reload-button" type="button">Reload Page</button>
740
+ </div>
741
+ </div>
742
+
743
+
744
+ <!-- Preview Visual inside DASHBOARD-RUN hero section -->
745
+ <div class="hero-preview">
746
+ <h2>Preview Visual</h2>
747
+ <div class="previews" id="previews"></div>
748
+ </div>
749
+ </section>
750
+
751
+ <div class="dashboard-grid">
752
+ <div class="column">
753
+ <section class="panel">
754
+ <h2>Postagens e Destinos</h2>
755
+ <div class="channels" id="channels"></div>
756
+ </section>
757
+ <section class="panel collapsible collapsed">
758
+ <h2 class="collapsible-trigger">Artefatos</h2>
759
+ <div class="collapsible-content">
760
+ <div class="artifacts" id="artifacts"></div>
761
+ </div>
762
+ </section>
763
+ </div>
764
+
765
+ <div class="column">
766
+ <section class="panel collapsible collapsed">
767
+ <h2 class="collapsible-trigger">Sinais e Métricas</h2>
768
+ <div class="collapsible-content">
769
+ <div class="metrics" id="metrics"></div>
770
+ <div class="footer-note" id="metrics-note"></div>
771
+ </div>
772
+ </section>
773
+ <section class="panel collapsible collapsed">
774
+ <h2 class="collapsible-trigger">Checklist do Run</h2>
775
+ <div class="collapsible-content">
776
+ <div class="checklist" id="checklist"></div>
777
+ </div>
778
+ </section>
779
+ <section class="panel collapsible collapsed" id="panel-errors">
780
+ <h2 class="collapsible-trigger">Erros e Problemas</h2>
781
+ <div class="collapsible-content">
782
+ <div class="errors" id="errors"></div>
783
+ </div>
784
+ </section>
785
+ </div>
786
+ </div>
787
+ </div>
788
+
789
+ <!-- Slide Zoom Modal -->
790
+ <div id="slide-modal" class="modal">
791
+ <span class="modal-close">&times;</span>
792
+ <div class="modal-content">
793
+ <img id="modal-img" src="" alt="Slide">
794
+ <div id="modal-label" class="modal-label"></div>
795
+ </div>
796
+ <button class="modal-prev" id="modal-prev-btn" type="button">&#10094;</button>
797
+ <button class="modal-next" id="modal-next-btn" type="button">&#10095;</button>
798
+ </div>
799
+
800
+ <script id="run-dashboard-bootstrap" type="application/json">__RUN_DASHBOARD_BOOTSTRAP__</script>
801
+ <script>
802
+ const dashboardDataPath = '__RUN_DASHBOARD_JSON_PATH__';
803
+ let currentModalSlides = [];
804
+ let currentModalIndex = 0;
805
+
806
+ function isFileMode() {
807
+ return window.location.protocol === 'file:';
808
+ }
809
+
810
+ function readEmbeddedData() {
811
+ const node = document.getElementById('run-dashboard-bootstrap');
812
+ try { return JSON.parse(node.textContent); } catch { return null; }
813
+ }
814
+
815
+ function escapeHtml(value) {
816
+ return String(value ?? '')
817
+ .replaceAll('&', '&amp;')
818
+ .replaceAll('<', '&lt;')
819
+ .replaceAll('>', '&gt;')
820
+ .replaceAll('"', '&quot;')
821
+ .replaceAll("'", '&#39;');
822
+ }
823
+
824
+ function formatDate(dateStr) {
825
+ if (!dateStr || dateStr === '-') return '-';
826
+ try {
827
+ const d = new Date(dateStr);
828
+ if (isNaN(d.getTime())) return dateStr;
829
+ const pad = (num) => String(num).padStart(2, '0');
830
+ const day = pad(d.getDate());
831
+ const month = pad(d.getMonth() + 1);
832
+ const year = d.getFullYear();
833
+ const hours = pad(d.getHours());
834
+ const minutes = pad(d.getMinutes());
835
+ return `${day}/${month}/${year} ${hours}:${minutes}`;
836
+ } catch {
837
+ return dateStr;
838
+ }
839
+ }
840
+
841
+ function statusClass(status) {
842
+ const normalized = String(status || 'unknown').toLowerCase();
843
+ if (['published', 'completed', 'approved', 'success'].includes(normalized)) return 'published';
844
+ if (['partial', 'warning'].includes(normalized)) return 'partial';
845
+ if (['failed', 'blocked', 'error'].includes(normalized)) return 'failed';
846
+ return 'warning';
847
+ }
848
+
849
+ function markerClass(status) {
850
+ const normalized = String(status || '').toLowerCase();
851
+ if (['ok', 'done', 'success', 'approved', 'published', 'yes'].includes(normalized)) return 'ok';
852
+ if (['warn', 'warning', 'partial', 'pending'].includes(normalized)) return 'warn';
853
+ return 'err';
854
+ }
855
+
856
+ function renderList(containerId, items, renderer, emptyLabel) {
857
+ const container = document.getElementById(containerId);
858
+ if (!items || items.length === 0) {
859
+ container.innerHTML = `<div class="empty-state">${escapeHtml(emptyLabel)}</div>`;
860
+ return;
861
+ }
862
+ container.innerHTML = items.map(renderer).join('');
863
+ }
864
+
865
+ function render(data) {
866
+ document.title = `${data.squad || 'DASHBOARD-RUN'} — ${data.runId || 'DASHBOARD-RUN'}`;
867
+ document.getElementById('hero-title').textContent = data.title || 'DASHBOARD-RUN';
868
+ document.getElementById('hero-subtitle').textContent = data.subtitle || 'Resumo operacional da execução';
869
+ document.getElementById('meta-squad').textContent = data.squad || '-';
870
+ document.getElementById('meta-run-id').textContent = data.runId || '-';
871
+ document.getElementById('meta-updated-at').textContent = formatDate(data.lastRefreshedAt || data.updatedAt || '-');
872
+ renderHeroBadges(data);
873
+
874
+ const statusNode = document.getElementById('meta-status');
875
+ statusNode.textContent = data.status || 'unknown';
876
+ statusNode.className = `status-chip ${statusClass(data.status)}`;
877
+
878
+ renderList('checklist', data.checklist, (item) => `
879
+ <div class="checklist-item">
880
+ <div class="marker ${markerClass(item.status)}">${escapeHtml(item.icon || '•')}</div>
881
+ <div>
882
+ <div class="item-title">${escapeHtml(item.title)}</div>
883
+ <div class="item-desc">${escapeHtml(item.description || '')}</div>
884
+ </div>
885
+ <div><span class="status-chip ${statusClass(item.badge || item.status)}">${escapeHtml(item.badgeLabel || item.status || 'n/a')}</span></div>
886
+ </div>`, 'Nenhum item de checklist disponível.');
887
+
888
+ renderList('channels', data.channels, (channel) => `
889
+ <div class="channel-card">
890
+ <div class="channel-header">
891
+ <div>
892
+ <div class="channel-title">${escapeHtml(channel.name)}</div>
893
+ <div class="channel-meta">${escapeHtml(channel.summary || '')}</div>
894
+ </div>
895
+ <span class="status-chip ${statusClass(channel.status)}">${escapeHtml(channel.status || 'unknown')}</span>
896
+ </div>
897
+ <div class="channel-actions">
898
+ ${(channel.links || []).map((link) => `<a class="action-link" href="${escapeHtml(link.href)}" target="_blank" rel="noreferrer">${escapeHtml(link.label)}</a>`).join('')}
899
+ </div>
900
+ </div>`, 'Nenhuma publicação registrada para esta run.');
901
+
902
+ renderList('artifacts', data.artifacts, (artifact) => `
903
+ <div class="artifact-card">
904
+ <div class="channel-title">${escapeHtml(artifact.label)}</div>
905
+ <div class="artifact-meta">${escapeHtml(artifact.path || '')}</div>
906
+ <div class="artifact-actions">
907
+ ${artifact.href ? `<a class="action-link" href="${escapeHtml(artifact.href)}" target="_blank" rel="noreferrer">Open</a>` : ''}
908
+ </div>
909
+ </div>`, 'Nenhum artefato registrado.');
910
+
911
+ const slidePreviews = (data.previews || []).filter((p) => p.type === 'slide');
912
+ currentModalSlides = slidePreviews;
913
+ const showLabels = slidePreviews.length >= 11;
914
+
915
+ renderList('previews', slidePreviews.length > 0 ? [{ items: slidePreviews }] : [], (group) => {
916
+ let cardsHtml = group.items.map((preview, idx) => `
917
+ <div class="preview-card slide-preview" data-index="${idx}" style="cursor: pointer;">
918
+ <div class="preview-media">
919
+ ${preview.src ? `<img src="${escapeHtml(preview.src)}" alt="${escapeHtml(preview.label)}">` : ''}
920
+ </div>
921
+ ${showLabels ? `
922
+ <div class="preview-body slide-preview-body">
923
+ <div class="preview-label">${escapeHtml(preview.label)}</div>
924
+ </div>
925
+ ` : ''}
926
+ </div>`).join('');
927
+
928
+ if (group.items.length < 6) {
929
+ const placeholdersCount = 6 - group.items.length;
930
+ for (let i = 0; i < placeholdersCount; i++) {
931
+ cardsHtml += `
932
+ <div class="preview-card slide-preview-placeholder">
933
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round" style="opacity: 0.15;">
934
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
935
+ <line x1="9" y1="17" x2="15" y2="17"></line>
936
+ <line x1="12" y1="17" x2="12" y2="21"></line>
937
+ </svg>
938
+ </div>`;
939
+ }
940
+ }
941
+
942
+ return `
943
+ <div class="preview-grid">
944
+ ${cardsHtml}
945
+ </div>`;
946
+ }, 'Nenhum preview visual disponível.');
947
+
948
+ renderList('metrics', data.metrics, (group) => `
949
+ <div class="metric-card">
950
+ <div class="metric-header">
951
+ <div>
952
+ <div class="metric-title">${escapeHtml(group.label)}</div>
953
+ <div class="metric-meta">${escapeHtml(group.description || '')}</div>
954
+ </div>
955
+ <span class="status-chip ${statusClass(group.status)}">${escapeHtml(group.status || 'snapshot')}</span>
956
+ </div>
957
+ <div class="metric-grid">
958
+ ${(group.values || []).map((entry) => `
959
+ <div class="metric-card">
960
+ <div class="label">${escapeHtml(entry.label)}</div>
961
+ <div class="metric-value">${escapeHtml(entry.value ?? 'N/A')}</div>
962
+ <div class="metric-unit">${escapeHtml(entry.unit || 'snapshot')}</div>
963
+ </div>`).join('')}
964
+ </div>
965
+ </div>`, 'Nenhuma métrica disponível.');
966
+
967
+ renderList('errors', data.errors, (entry) => `
968
+ <div class="error-item">
969
+ <div class="channel-header">
970
+ <div class="channel-title">${escapeHtml(entry.title || 'Ocorrência')}</div>
971
+ <span class="status-chip ${statusClass(entry.status || 'warning')}">${escapeHtml(entry.status || 'warning')}</span>
972
+ </div>
973
+ <div class="error-meta">${escapeHtml(entry.message || '')}</div>
974
+ </div>`, 'Nenhum erro relevante registrado nesta run.');
975
+
976
+ // Toggle collapsed state for Erros e Problemas dynamically based on data availability
977
+ const errorsPanel = document.getElementById('panel-errors');
978
+ if (errorsPanel) {
979
+ if (data.errors && data.errors.length > 0) {
980
+ errorsPanel.classList.remove('collapsed');
981
+ } else {
982
+ errorsPanel.classList.add('collapsed');
983
+ }
984
+ }
985
+
986
+ const fileModeNote = isFileMode()
987
+ ? ' Modo arquivo local ativo: este DASHBOARD 2 usa o snapshot embutido e links relativos, sem depender de servidor para abrir.'
988
+ : '';
989
+ document.getElementById('metrics-note').textContent = `${data.metricsNote || ''}${fileModeNote}`.trim();
990
+ }
991
+
992
+ function renderHeroBadges(data) {
993
+ const badges = [];
994
+ if (data.runContext?.isLegacyOutputRoot) badges.push('Legacy Snapshot');
995
+ if (data.metrics && data.metrics.length > 0) badges.push('Live Metrics Snapshot');
996
+ // if (!data.metrics || data.metrics.length === 0) badges.push('Offline Metrics');
997
+ if (isFileMode()) badges.push('File Mode');
998
+
999
+ const container = document.getElementById('hero-badges');
1000
+ container.innerHTML = badges.map((badge) => `<div class="hero-badge">${escapeHtml(badge)}</div>`).join('');
1001
+ }
1002
+
1003
+ async function refreshData() {
1004
+ if (isRefreshBusy()) return;
1005
+ setRefreshBusy(true);
1006
+
1007
+ if (isFileMode()) {
1008
+ render(readEmbeddedData() || {});
1009
+ setRefreshBusy(false);
1010
+ return;
1011
+ }
1012
+
1013
+ if (!dashboardDataPath || dashboardDataPath === '__RUN_DASHBOARD_JSON_PATH__') {
1014
+ render(readEmbeddedData() || {});
1015
+ setRefreshBusy(false);
1016
+ return;
1017
+ }
1018
+
1019
+ try {
1020
+ const liveResponse = await fetch('__run_dashboard_refresh__', {
1021
+ method: 'POST',
1022
+ headers: { 'Content-Type': 'application/json' },
1023
+ });
1024
+
1025
+ if (liveResponse.ok) {
1026
+ const payload = await liveResponse.json();
1027
+ render(payload);
1028
+ setRefreshBusy(false);
1029
+ return;
1030
+ }
1031
+ } catch {
1032
+ }
1033
+
1034
+ try {
1035
+ const response = await fetch(`${dashboardDataPath}?ts=${Date.now()}`, { cache: 'no-store' });
1036
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
1037
+ const payload = await response.json();
1038
+ render(payload);
1039
+ } catch {
1040
+ render(readEmbeddedData() || {});
1041
+ } finally {
1042
+ setRefreshBusy(false);
1043
+ }
1044
+ }
1045
+
1046
+ function isRefreshBusy() {
1047
+ return document.getElementById('refresh-button').dataset.busy === 'true';
1048
+ }
1049
+
1050
+ function setRefreshBusy(isBusy) {
1051
+ const button = document.getElementById('refresh-button');
1052
+ button.dataset.busy = isBusy ? 'true' : 'false';
1053
+ button.disabled = Boolean(isBusy);
1054
+ button.textContent = isBusy ? 'Refreshing...' : 'Refresh Data';
1055
+ }
1056
+
1057
+ function configureStaticMode() {
1058
+ if (!isFileMode()) return;
1059
+ const button = document.getElementById('refresh-button');
1060
+ button.disabled = false;
1061
+ button.dataset.busy = 'false';
1062
+ button.textContent = 'Reload Embedded Snapshot';
1063
+ button.title = 'Modo arquivo local: recarrega apenas o snapshot embutido neste HTML.';
1064
+ }
1065
+
1066
+ document.getElementById('refresh-button').addEventListener('click', () => { refreshData(); });
1067
+ document.getElementById('reload-button').addEventListener('click', () => {
1068
+ if (isFileMode()) {
1069
+ window.location.reload();
1070
+ } else {
1071
+ const url = new URL(window.location.href);
1072
+ url.searchParams.set('ts', Date.now().toString());
1073
+ window.location.href = url.toString();
1074
+ }
1075
+ });
1076
+
1077
+ // Collapsible panels toggle logic
1078
+ document.querySelectorAll('.panel.collapsible .collapsible-trigger').forEach((trigger) => {
1079
+ trigger.addEventListener('click', () => {
1080
+ trigger.closest('.panel').classList.toggle('collapsed');
1081
+ });
1082
+ });
1083
+
1084
+ // Modal Functions
1085
+ function openModal(index) {
1086
+ currentModalIndex = index;
1087
+ const modal = document.getElementById('slide-modal');
1088
+ const modalImg = document.getElementById('modal-img');
1089
+ const modalLabel = document.getElementById('modal-label');
1090
+
1091
+ const slide = currentModalSlides[currentModalIndex];
1092
+ if (slide) {
1093
+ modalImg.src = slide.src;
1094
+ modalLabel.textContent = slide.label;
1095
+ modal.style.display = 'flex';
1096
+ }
1097
+ }
1098
+
1099
+ function closeModal() {
1100
+ document.getElementById('slide-modal').style.display = 'none';
1101
+ }
1102
+
1103
+ function nextSlide() {
1104
+ if (currentModalSlides.length === 0) return;
1105
+ currentModalIndex = (currentModalIndex + 1) % currentModalSlides.length;
1106
+ openModal(currentModalIndex);
1107
+ }
1108
+
1109
+ function prevSlide() {
1110
+ if (currentModalSlides.length === 0) return;
1111
+ currentModalIndex = (currentModalIndex - 1 + currentModalSlides.length) % currentModalSlides.length;
1112
+ openModal(currentModalIndex);
1113
+ }
1114
+
1115
+ // Modal Events Setup
1116
+ const modal = document.getElementById('slide-modal');
1117
+ if (modal) {
1118
+ document.querySelector('.modal-close').addEventListener('click', closeModal);
1119
+ document.getElementById('modal-prev-btn').addEventListener('click', (e) => {
1120
+ e.stopPropagation();
1121
+ prevSlide();
1122
+ });
1123
+ document.getElementById('modal-next-btn').addEventListener('click', (e) => {
1124
+ e.stopPropagation();
1125
+ nextSlide();
1126
+ });
1127
+ modal.addEventListener('click', (e) => {
1128
+ if (e.target === modal || e.target.classList.contains('modal-content')) {
1129
+ closeModal();
1130
+ }
1131
+ });
1132
+ }
1133
+
1134
+ // Bind click on previews to open modal
1135
+ document.getElementById('previews').addEventListener('click', (e) => {
1136
+ const card = e.target.closest('.slide-preview');
1137
+ if (card) {
1138
+ const index = parseInt(card.dataset.index, 10);
1139
+ if (!isNaN(index)) {
1140
+ openModal(index);
1141
+ }
1142
+ }
1143
+ });
1144
+
1145
+ // Keyboard navigation
1146
+ document.addEventListener('keydown', (e) => {
1147
+ const modalEl = document.getElementById('slide-modal');
1148
+ if (modalEl && modalEl.style.display === 'flex') {
1149
+ if (e.key === 'ArrowRight') {
1150
+ nextSlide();
1151
+ } else if (e.key === 'ArrowLeft') {
1152
+ prevSlide();
1153
+ } else if (e.key === 'Escape') {
1154
+ closeModal();
1155
+ }
1156
+ }
1157
+ });
1158
+
1159
+ configureStaticMode();
1160
+ render(readEmbeddedData() || {});
1161
+ </script>
1162
+ </body>
1163
+
1164
+ </html>