@strands-agents/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/LICENSE +175 -0
  2. package/NOTICE +1 -0
  3. package/README.md +576 -0
  4. package/bin/strands.js +256 -0
  5. package/dist/src/cli/arguments.js +198 -0
  6. package/dist/src/cli/arguments.js.map +1 -0
  7. package/dist/src/cli/invocation.js +124 -0
  8. package/dist/src/cli/invocation.js.map +1 -0
  9. package/dist/src/cli/run.js +252 -0
  10. package/dist/src/cli/run.js.map +1 -0
  11. package/dist/src/console.js +235 -0
  12. package/dist/src/console.js.map +1 -0
  13. package/dist/src/logging.js +103 -0
  14. package/dist/src/logging.js.map +1 -0
  15. package/dist/src/main.js +7 -0
  16. package/dist/src/main.js.map +1 -0
  17. package/dist/src/tui/acp/projection.js +276 -0
  18. package/dist/src/tui/acp/projection.js.map +1 -0
  19. package/dist/src/tui/acp/server.js +263 -0
  20. package/dist/src/tui/acp/server.js.map +1 -0
  21. package/dist/src/tui/agent-configuration.js +335 -0
  22. package/dist/src/tui/agent-configuration.js.map +1 -0
  23. package/dist/src/tui/agent-setup.js +80 -0
  24. package/dist/src/tui/agent-setup.js.map +1 -0
  25. package/dist/src/tui/background/activity.js +273 -0
  26. package/dist/src/tui/background/activity.js.map +1 -0
  27. package/dist/src/tui/background/inbox.js +120 -0
  28. package/dist/src/tui/background/inbox.js.map +1 -0
  29. package/dist/src/tui/background/tasks.js +98 -0
  30. package/dist/src/tui/background/tasks.js.map +1 -0
  31. package/dist/src/tui/builtin-tools.js +65 -0
  32. package/dist/src/tui/builtin-tools.js.map +1 -0
  33. package/dist/src/tui/chat/commands.js +98 -0
  34. package/dist/src/tui/chat/commands.js.map +1 -0
  35. package/dist/src/tui/chat/controller-helpers.js +62 -0
  36. package/dist/src/tui/chat/controller-helpers.js.map +1 -0
  37. package/dist/src/tui/chat/controller.js +1913 -0
  38. package/dist/src/tui/chat/controller.js.map +1 -0
  39. package/dist/src/tui/chat/help.js +94 -0
  40. package/dist/src/tui/chat/help.js.map +1 -0
  41. package/dist/src/tui/chat/panels.js +418 -0
  42. package/dist/src/tui/chat/panels.js.map +1 -0
  43. package/dist/src/tui/chat/projector.js +443 -0
  44. package/dist/src/tui/chat/projector.js.map +1 -0
  45. package/dist/src/tui/chat/sdk-projector.js +194 -0
  46. package/dist/src/tui/chat/sdk-projector.js.map +1 -0
  47. package/dist/src/tui/chat/shell.js +263 -0
  48. package/dist/src/tui/chat/shell.js.map +1 -0
  49. package/dist/src/tui/chat/types.js +2 -0
  50. package/dist/src/tui/chat/types.js.map +1 -0
  51. package/dist/src/tui/config.js +497 -0
  52. package/dist/src/tui/config.js.map +1 -0
  53. package/dist/src/tui/configuration-instructions.js +14 -0
  54. package/dist/src/tui/configuration-instructions.js.map +1 -0
  55. package/dist/src/tui/mcp/config.js +370 -0
  56. package/dist/src/tui/mcp/config.js.map +1 -0
  57. package/dist/src/tui/mcp.js +98 -0
  58. package/dist/src/tui/mcp.js.map +1 -0
  59. package/dist/src/tui/memory-options.js +10 -0
  60. package/dist/src/tui/memory-options.js.map +1 -0
  61. package/dist/src/tui/messaging.js +193 -0
  62. package/dist/src/tui/messaging.js.map +1 -0
  63. package/dist/src/tui/model/context.js +13 -0
  64. package/dist/src/tui/model/context.js.map +1 -0
  65. package/dist/src/tui/model/display.js +59 -0
  66. package/dist/src/tui/model/display.js.map +1 -0
  67. package/dist/src/tui/model/runtime.js +365 -0
  68. package/dist/src/tui/model/runtime.js.map +1 -0
  69. package/dist/src/tui/model/selection.js +160 -0
  70. package/dist/src/tui/model/selection.js.map +1 -0
  71. package/dist/src/tui/package-version.js +47 -0
  72. package/dist/src/tui/package-version.js.map +1 -0
  73. package/dist/src/tui/permissions/file-change-preview.js +182 -0
  74. package/dist/src/tui/permissions/file-change-preview.js.map +1 -0
  75. package/dist/src/tui/permissions/policy.js +223 -0
  76. package/dist/src/tui/permissions/policy.js.map +1 -0
  77. package/dist/src/tui/permissions/settings.js +21 -0
  78. package/dist/src/tui/permissions/settings.js.map +1 -0
  79. package/dist/src/tui/project/acp.js +93 -0
  80. package/dist/src/tui/project/acp.js.map +1 -0
  81. package/dist/src/tui/project/archive.js +239 -0
  82. package/dist/src/tui/project/archive.js.map +1 -0
  83. package/dist/src/tui/project/configuration-secrets.js +107 -0
  84. package/dist/src/tui/project/configuration-secrets.js.map +1 -0
  85. package/dist/src/tui/project/configuration.js +201 -0
  86. package/dist/src/tui/project/configuration.js.map +1 -0
  87. package/dist/src/tui/project/export.js +560 -0
  88. package/dist/src/tui/project/export.js.map +1 -0
  89. package/dist/src/tui/project/import.js +75 -0
  90. package/dist/src/tui/project/import.js.map +1 -0
  91. package/dist/src/tui/project/module-loader.js +157 -0
  92. package/dist/src/tui/project/module-loader.js.map +1 -0
  93. package/dist/src/tui/project/packaging.js +53 -0
  94. package/dist/src/tui/project/packaging.js.map +1 -0
  95. package/dist/src/tui/project/portable-dependencies.js +34 -0
  96. package/dist/src/tui/project/portable-dependencies.js.map +1 -0
  97. package/dist/src/tui/project/portable-mcp.js +118 -0
  98. package/dist/src/tui/project/portable-mcp.js.map +1 -0
  99. package/dist/src/tui/project/python.js +414 -0
  100. package/dist/src/tui/project/python.js.map +1 -0
  101. package/dist/src/tui/project/run.js +118 -0
  102. package/dist/src/tui/project/run.js.map +1 -0
  103. package/dist/src/tui/project/source.js +307 -0
  104. package/dist/src/tui/project/source.js.map +1 -0
  105. package/dist/src/tui/project/typescript.js +135 -0
  106. package/dist/src/tui/project/typescript.js.map +1 -0
  107. package/dist/src/tui/project/worker.py +731 -0
  108. package/dist/src/tui/provider/aws-client.js +67 -0
  109. package/dist/src/tui/provider/aws-client.js.map +1 -0
  110. package/dist/src/tui/provider/aws-config.js +66 -0
  111. package/dist/src/tui/provider/aws-config.js.map +1 -0
  112. package/dist/src/tui/provider/bedrock-catalog.js +87 -0
  113. package/dist/src/tui/provider/bedrock-catalog.js.map +1 -0
  114. package/dist/src/tui/provider/discovery.js +323 -0
  115. package/dist/src/tui/provider/discovery.js.map +1 -0
  116. package/dist/src/tui/provider/environment.js +138 -0
  117. package/dist/src/tui/provider/environment.js.map +1 -0
  118. package/dist/src/tui/provider/packages.js +42 -0
  119. package/dist/src/tui/provider/packages.js.map +1 -0
  120. package/dist/src/tui/run.js +257 -0
  121. package/dist/src/tui/run.js.map +1 -0
  122. package/dist/src/tui/runtime.js +520 -0
  123. package/dist/src/tui/runtime.js.map +1 -0
  124. package/dist/src/tui/session/agent-definition.js +100 -0
  125. package/dist/src/tui/session/agent-definition.js.map +1 -0
  126. package/dist/src/tui/session/catalog.js +159 -0
  127. package/dist/src/tui/session/catalog.js.map +1 -0
  128. package/dist/src/tui/session/context.js +118 -0
  129. package/dist/src/tui/session/context.js.map +1 -0
  130. package/dist/src/tui/session/conversation-helpers.js +46 -0
  131. package/dist/src/tui/session/conversation-helpers.js.map +1 -0
  132. package/dist/src/tui/session/conversations.js +456 -0
  133. package/dist/src/tui/session/conversations.js.map +1 -0
  134. package/dist/src/tui/session/desktop-profile.js +80 -0
  135. package/dist/src/tui/session/desktop-profile.js.map +1 -0
  136. package/dist/src/tui/session/options.js +44 -0
  137. package/dist/src/tui/session/options.js.map +1 -0
  138. package/dist/src/tui/session/sessions.js +251 -0
  139. package/dist/src/tui/session/sessions.js.map +1 -0
  140. package/dist/src/tui/session/voice.js +353 -0
  141. package/dist/src/tui/session/voice.js.map +1 -0
  142. package/dist/src/tui/settings.js +362 -0
  143. package/dist/src/tui/settings.js.map +1 -0
  144. package/dist/src/tui/setup/questions.js +277 -0
  145. package/dist/src/tui/setup/questions.js.map +1 -0
  146. package/dist/src/tui/skills.js +135 -0
  147. package/dist/src/tui/skills.js.map +1 -0
  148. package/dist/src/tui/steering.js +67 -0
  149. package/dist/src/tui/steering.js.map +1 -0
  150. package/dist/src/tui/strands-backend.js +368 -0
  151. package/dist/src/tui/strands-backend.js.map +1 -0
  152. package/dist/src/tui/stream-presentation.js +138 -0
  153. package/dist/src/tui/stream-presentation.js.map +1 -0
  154. package/dist/src/tui/telemetry.js +46 -0
  155. package/dist/src/tui/telemetry.js.map +1 -0
  156. package/dist/src/tui/terminal/composer.js +237 -0
  157. package/dist/src/tui/terminal/composer.js.map +1 -0
  158. package/dist/src/tui/terminal/directory-picker.js +76 -0
  159. package/dist/src/tui/terminal/directory-picker.js.map +1 -0
  160. package/dist/src/tui/terminal/ink.js +94 -0
  161. package/dist/src/tui/terminal/ink.js.map +1 -0
  162. package/dist/src/tui/terminal/mouse-input.js +83 -0
  163. package/dist/src/tui/terminal/mouse-input.js.map +1 -0
  164. package/dist/src/tui/terminal/open-url.js +21 -0
  165. package/dist/src/tui/terminal/open-url.js.map +1 -0
  166. package/dist/src/tui/terminal/process-tree.js +132 -0
  167. package/dist/src/tui/terminal/process-tree.js.map +1 -0
  168. package/dist/src/tui/terminal/sanitize.js +71 -0
  169. package/dist/src/tui/terminal/sanitize.js.map +1 -0
  170. package/dist/src/tui/terminal/shell-output.js +43 -0
  171. package/dist/src/tui/terminal/shell-output.js.map +1 -0
  172. package/dist/src/tui/terminal/terminal.js +39 -0
  173. package/dist/src/tui/terminal/terminal.js.map +1 -0
  174. package/dist/src/tui/view/agents-panel.js +21 -0
  175. package/dist/src/tui/view/agents-panel.js.map +1 -0
  176. package/dist/src/tui/view/app.js +1068 -0
  177. package/dist/src/tui/view/app.js.map +1 -0
  178. package/dist/src/tui/view/chat-root.js +88 -0
  179. package/dist/src/tui/view/chat-root.js.map +1 -0
  180. package/dist/src/tui/view/chat-view.js +185 -0
  181. package/dist/src/tui/view/chat-view.js.map +1 -0
  182. package/dist/src/tui/view/command-palette.js +18 -0
  183. package/dist/src/tui/view/command-palette.js.map +1 -0
  184. package/dist/src/tui/view/custom-theme-editor.js +301 -0
  185. package/dist/src/tui/view/custom-theme-editor.js.map +1 -0
  186. package/dist/src/tui/view/export-panel.js +14 -0
  187. package/dist/src/tui/view/export-panel.js.map +1 -0
  188. package/dist/src/tui/view/fade-in.js +106 -0
  189. package/dist/src/tui/view/fade-in.js.map +1 -0
  190. package/dist/src/tui/view/frog-canvas.js +375 -0
  191. package/dist/src/tui/view/frog-canvas.js.map +1 -0
  192. package/dist/src/tui/view/frog-drawing.js +415 -0
  193. package/dist/src/tui/view/frog-drawing.js.map +1 -0
  194. package/dist/src/tui/view/frog-easter-egg.js +53 -0
  195. package/dist/src/tui/view/frog-easter-egg.js.map +1 -0
  196. package/dist/src/tui/view/frog-intro-renderer.js +634 -0
  197. package/dist/src/tui/view/frog-intro-renderer.js.map +1 -0
  198. package/dist/src/tui/view/help-footer.js +36 -0
  199. package/dist/src/tui/view/help-footer.js.map +1 -0
  200. package/dist/src/tui/view/interaction.js +349 -0
  201. package/dist/src/tui/view/interaction.js.map +1 -0
  202. package/dist/src/tui/view/intro.js +35 -0
  203. package/dist/src/tui/view/intro.js.map +1 -0
  204. package/dist/src/tui/view/markdown.js +99 -0
  205. package/dist/src/tui/view/markdown.js.map +1 -0
  206. package/dist/src/tui/view/media.js +70 -0
  207. package/dist/src/tui/view/media.js.map +1 -0
  208. package/dist/src/tui/view/model-panel.js +65 -0
  209. package/dist/src/tui/view/model-panel.js.map +1 -0
  210. package/dist/src/tui/view/panel-components.js +17 -0
  211. package/dist/src/tui/view/panel-components.js.map +1 -0
  212. package/dist/src/tui/view/panels.js +129 -0
  213. package/dist/src/tui/view/panels.js.map +1 -0
  214. package/dist/src/tui/view/presentation.js +382 -0
  215. package/dist/src/tui/view/presentation.js.map +1 -0
  216. package/dist/src/tui/view/prompt-editor.js +74 -0
  217. package/dist/src/tui/view/prompt-editor.js.map +1 -0
  218. package/dist/src/tui/view/provider-list.js +14 -0
  219. package/dist/src/tui/view/provider-list.js.map +1 -0
  220. package/dist/src/tui/view/sessions-panel.js +15 -0
  221. package/dist/src/tui/view/sessions-panel.js.map +1 -0
  222. package/dist/src/tui/view/settings-panel.js +146 -0
  223. package/dist/src/tui/view/settings-panel.js.map +1 -0
  224. package/dist/src/tui/view/setup-question.js +90 -0
  225. package/dist/src/tui/view/setup-question.js.map +1 -0
  226. package/dist/src/tui/view/setup-wizard/brand.js +18 -0
  227. package/dist/src/tui/view/setup-wizard/brand.js.map +1 -0
  228. package/dist/src/tui/view/setup-wizard/index.js +1557 -0
  229. package/dist/src/tui/view/setup-wizard/index.js.map +1 -0
  230. package/dist/src/tui/view/setup-wizard/opening-menu.js +88 -0
  231. package/dist/src/tui/view/setup-wizard/opening-menu.js.map +1 -0
  232. package/dist/src/tui/view/setup-wizard/path-completion.js +53 -0
  233. package/dist/src/tui/view/setup-wizard/path-completion.js.map +1 -0
  234. package/dist/src/tui/view/setup-wizard/profile-fields.js +29 -0
  235. package/dist/src/tui/view/setup-wizard/profile-fields.js.map +1 -0
  236. package/dist/src/tui/view/setup-wizard/progress.js +42 -0
  237. package/dist/src/tui/view/setup-wizard/progress.js.map +1 -0
  238. package/dist/src/tui/view/setup-wizard/providers.js +344 -0
  239. package/dist/src/tui/view/setup-wizard/providers.js.map +1 -0
  240. package/dist/src/tui/view/setup-wizard/settings-panel.js +74 -0
  241. package/dist/src/tui/view/setup-wizard/settings-panel.js.map +1 -0
  242. package/dist/src/tui/view/setup-wizard/steps.js +544 -0
  243. package/dist/src/tui/view/setup-wizard/steps.js.map +1 -0
  244. package/dist/src/tui/view/setup-wizard/types.js +2 -0
  245. package/dist/src/tui/view/setup-wizard/types.js.map +1 -0
  246. package/dist/src/tui/view/setup-wizard/use-provider-discovery.js +145 -0
  247. package/dist/src/tui/view/setup-wizard/use-provider-discovery.js.map +1 -0
  248. package/dist/src/tui/view/startup-view.js +42 -0
  249. package/dist/src/tui/view/startup-view.js.map +1 -0
  250. package/dist/src/tui/view/text-input.js +33 -0
  251. package/dist/src/tui/view/text-input.js.map +1 -0
  252. package/dist/src/tui/view/theme-detection.js +45 -0
  253. package/dist/src/tui/view/theme-detection.js.map +1 -0
  254. package/dist/src/tui/view/theme.js +127 -0
  255. package/dist/src/tui/view/theme.js.map +1 -0
  256. package/dist/src/tui/view/transcript-layout.js +60 -0
  257. package/dist/src/tui/view/transcript-layout.js.map +1 -0
  258. package/dist/src/tui/view/transcript-turn.js +135 -0
  259. package/dist/src/tui/view/transcript-turn.js.map +1 -0
  260. package/dist/src/tui/view/transcript.js +138 -0
  261. package/dist/src/tui/view/transcript.js.map +1 -0
  262. package/dist/src/tui/view/use-party-frame.js +15 -0
  263. package/dist/src/tui/view/use-party-frame.js.map +1 -0
  264. package/dist/src/tui/view/use-spinner.js +14 -0
  265. package/dist/src/tui/view/use-spinner.js.map +1 -0
  266. package/dist/src/tui/voice/session.js +515 -0
  267. package/dist/src/tui/voice/session.js.map +1 -0
  268. package/dist/src/tui/workspace/sandbox.js +156 -0
  269. package/dist/src/tui/workspace/sandbox.js.map +1 -0
  270. package/dist/src/tui/workspace/trust.js +147 -0
  271. package/dist/src/tui/workspace/trust.js.map +1 -0
  272. package/dist/src/usage.js +187 -0
  273. package/dist/src/usage.js.map +1 -0
  274. package/package.json +97 -0
  275. package/src/tui/voice/sidecar.py +606 -0
@@ -0,0 +1,634 @@
1
+ import { Canvas } from './frog-canvas.js';
2
+ import { FROG_POSES, drawTongue, drawPushingTongue, frogFootOffset, smoothStep, hopState, drawArrivalRipple, drawFrog, interpolatePose, fillEllipse, fillCircle, clamp, lerp, easeOutCubic, easeInOutCubic, hash01, } from './frog-drawing.js';
3
+ export const FROG_INTRO_DURATION_MS = 4_200;
4
+ export const SETUP_GUIDE_TRANSITION_DURATION_MS = 1_200;
5
+ export function setupGuideLayout(width, height, showFrog = true) {
6
+ const wide = width >= 68;
7
+ const frogWidth = showFrog ? (wide ? 26 : Math.min(24, width)) : 0;
8
+ const frogHeight = showFrog ? Math.min(wide ? 14 : 5, Math.max(4, height - 7)) : 0;
9
+ const bubbleWidth = wide ? Math.max(24, Math.min(88, width - frogWidth - 4)) : Math.max(20, width);
10
+ const tailWidth = wide && showFrog ? 2 : 0;
11
+ return {
12
+ wide,
13
+ frogWidth,
14
+ frogHeight,
15
+ bubbleWidth,
16
+ tailWidth,
17
+ contentWidth: wide ? frogWidth + bubbleWidth + tailWidth : bubbleWidth,
18
+ };
19
+ }
20
+ const GLYPHS = {
21
+ A: [' █████╗ ', '██╔══██╗', '███████║', '██╔══██║', '██║ ██║', '╚═╝ ╚═╝'],
22
+ D: ['██████╗ ', '██╔══██╗', '██║ ██║', '██║ ██║', '██████╔╝', '╚═════╝ '],
23
+ N: ['███╗ ██╗', '████╗ ██║', '██╔██╗ ██║', '██║╚██╗██║', '██║ ╚████║', '╚═╝ ╚═══╝'],
24
+ R: ['██████╗ ', '██╔══██╗', '██████╔╝', '██╔══██╗', '██║ ██║', '╚═╝ ╚═╝'],
25
+ S: ['███████╗', '██╔════╝', '███████╗', '╚════██║', '███████║', '╚══════╝'],
26
+ T: ['████████╗', '╚══██╔══╝', ' ██║ ', ' ██║ ', ' ██║ ', ' ╚═╝ '],
27
+ };
28
+ const BRAND_WORD = wordShape('STRANDS');
29
+ export const FROG_BRAND_EASTER_EGG_DURATION_MS = 3_200;
30
+ export function renderFrogSpiralFrame(width, height, progress, elapsedMs, color = false, theme = 'green', options = {}) {
31
+ const canvas = new Canvas(Math.max(1, width), Math.max(1, height), theme, false, 0, options);
32
+ const artHeight = frogStartupHeight(canvas.width, canvas.height - 6);
33
+ const top = artHeight >= 12 ? 2 : 1;
34
+ const value = clamp(progress);
35
+ if (artHeight < 12 || value >= 1) {
36
+ const artwork = renderFrogStartupLockup(canvas.width, color, 0, theme, false, options, artHeight).split('\n');
37
+ return canvas
38
+ .rows(color)
39
+ .map((row, index) => artwork[index - top] ?? row)
40
+ .join('\n');
41
+ }
42
+ const scene = createScene(canvas.width, canvas.height, Math.max(12, Math.floor((canvas.height - 15) / 2)) + 3);
43
+ if (value < 0.23) {
44
+ drawSpiralAct(canvas, scene, value / 0.23, elapsedMs);
45
+ return canvas.rows(color).join('\n');
46
+ }
47
+ const local = (value - 0.23) / 0.77;
48
+ drawDanglingLetterAct(canvas, scene, local, elapsedMs);
49
+ const wide = canvas.width >= BRAND_WORD.width + 26;
50
+ const shift = Math.round((scene.wordY - (wide ? 7 : 9)) * smoothStep((local - 0.51) / 0.17));
51
+ const rows = canvas.rows(color);
52
+ return rows.map((_, index) => rows[index + shift] ?? ' '.repeat(canvas.width)).join('\n');
53
+ }
54
+ export function renderFrogStartupLockup(width, color = false, elapsedMs = 0, theme = 'green', party = false, options = {}, height = lockupLayout(width).height) {
55
+ const canvas = new Canvas(Math.max(1, width), Math.max(1, height), theme, party, elapsedMs, options);
56
+ if (canvas.width < 74 || canvas.height < lockupLayout(canvas.width).height) {
57
+ drawCompactLockup(canvas, elapsedMs);
58
+ return canvas.rows(color).join('\n');
59
+ }
60
+ drawFinalLockup(canvas, elapsedMs);
61
+ return canvas.rows(color).join('\n');
62
+ }
63
+ export function renderSetupGuideFrog(width, height, progress, elapsedMs, color = false, theme = 'green', options = {}) {
64
+ const canvas = new Canvas(Math.max(1, width), Math.max(1, height), theme, false, elapsedMs, options);
65
+ const landing = { x: canvas.width / 2, y: canvas.height * 2 - 12 };
66
+ const scale = Math.min(1, Math.max(0.24, canvas.height / 13), Math.max(0.24, canvas.width / 24));
67
+ const value = clamp(progress);
68
+ let pose;
69
+ let transform;
70
+ if (value < 0.78) {
71
+ const state = hopState({ x: landing.x, y: -8 }, landing, value / 0.78);
72
+ pose = state.pose;
73
+ transform = { ...state.transform, scale };
74
+ }
75
+ else {
76
+ pose = interpolatePose(FROG_POSES.squash, FROG_POSES.settled, smoothStep((value - 0.78) / 0.22));
77
+ transform = { ...landing, scale, rotation: -0.04 };
78
+ drawArrivalRipple(canvas, landing.x, landing.y + 3, (value - 0.78) / 0.22);
79
+ }
80
+ drawFrog(canvas, transform, pose, elapsedMs);
81
+ if (value >= 0.78) {
82
+ const eyeY = transform.y - 4.7;
83
+ canvas.setPixel(transform.x - 2.3, eyeY, 'ink', 130);
84
+ canvas.setPixel(transform.x + 3, eyeY, 'ink', 130);
85
+ }
86
+ return canvas.rows(color).join('\n');
87
+ }
88
+ export function renderSetupGuideTransitionFrame(width, height, progress, elapsedMs, landingX, color = false, theme = 'green', options = {}, landingY) {
89
+ const canvas = new Canvas(Math.max(1, width), Math.max(1, height), theme, false, elapsedMs, options);
90
+ const value = clamp(progress);
91
+ const layout = lockupLayout(canvas.width);
92
+ const landing = { x: landingX, y: landingY ?? canvas.height * 2 - 12 };
93
+ if (canvas.width < 74 || canvas.height < 12) {
94
+ if (value < 0.16) {
95
+ drawCompactLockup(canvas, elapsedMs);
96
+ return canvas.rows(color).join('\n');
97
+ }
98
+ }
99
+ else {
100
+ const dissolve = smoothStep((value - 0.08) / 0.5);
101
+ for (const point of BRAND_WORD.points) {
102
+ const order = hash01(point.index * 83 + 17);
103
+ if (order > dissolve) {
104
+ canvas.set(layout.wordX + point.x, layout.wordY + point.y, point.character, wordColor(canvas, point), 68);
105
+ }
106
+ else if (value < 0.72 && order > dissolve - 0.22) {
107
+ const drift = Math.max(0, dissolve - order);
108
+ canvas.set(layout.wordX + point.x + drift * (8 + hash01(point.index * 29) * 10), layout.wordY + point.y - drift * (3 + hash01(point.index * 41) * 5), drift < 0.08 ? '▒' : '·', wordColor(canvas, point), 42);
109
+ }
110
+ }
111
+ }
112
+ const start = { x: layout.frogX, y: layout.frogY };
113
+ if (value < 0.14) {
114
+ drawFrog(canvas, { ...start, scale: 1 }, interpolatePose(FROG_POSES.settled, FROG_POSES.crouch, smoothStep(value / 0.14)), elapsedMs);
115
+ }
116
+ else if (value < 0.88) {
117
+ const state = hopState(start, landing, (value - 0.14) / 0.74);
118
+ state.transform.scale = 1;
119
+ drawFrog(canvas, state.transform, state.pose, elapsedMs);
120
+ }
121
+ else {
122
+ const settle = smoothStep((value - 0.88) / 0.12);
123
+ drawArrivalRipple(canvas, landing.x, landing.y + 3, settle);
124
+ drawFrog(canvas, { ...landing, scale: 1, rotation: lerp(-0.06, -0.04, settle) }, interpolatePose(FROG_POSES.squash, FROG_POSES.settled, settle), elapsedMs);
125
+ const eyeY = landing.y - 4.7;
126
+ canvas.setPixel(landing.x - 2.3, eyeY, 'ink', 130);
127
+ canvas.setPixel(landing.x + 3, eyeY, 'ink', 130);
128
+ }
129
+ return canvas.rows(color).join('\n');
130
+ }
131
+ export function renderFrogBrandEasterEggFrame(width, progress, elapsedMs, color = false, theme = 'green', party = false, partyElapsedMs = elapsedMs, options = {}, height = lockupLayout(width).height) {
132
+ const canvas = new Canvas(Math.max(1, width), Math.max(1, height), theme, party, partyElapsedMs, options);
133
+ if (canvas.width < 74 || canvas.height < lockupLayout(canvas.width).height) {
134
+ drawCompactLockup(canvas, elapsedMs);
135
+ return canvas.rows(color).join('\n');
136
+ }
137
+ drawFrogBrandEasterEgg(canvas, clamp(progress), elapsedMs);
138
+ return canvas.rows(color).join('\n');
139
+ }
140
+ export function frogStartupHeight(width, availableHeight) {
141
+ if (width >= 74 && availableHeight >= 26) {
142
+ return lockupLayout(width).height;
143
+ }
144
+ return width >= 26 && availableHeight >= 8 ? 4 : 1;
145
+ }
146
+ export function frogStartupHitbox(width, height = lockupLayout(width).height) {
147
+ const canvasWidth = Math.max(1, width);
148
+ if (canvasWidth < 74 || height < lockupLayout(canvasWidth).height) {
149
+ return { left: Math.max(0, Math.floor((canvasWidth - 24) / 2)), top: 0, width: Math.min(8, canvasWidth), height };
150
+ }
151
+ const { frogX, frogY } = lockupLayout(canvasWidth);
152
+ const left = Math.max(0, Math.floor(frogX - 7));
153
+ const right = Math.min(canvasWidth, Math.ceil(frogX + 7));
154
+ return {
155
+ left,
156
+ top: Math.max(0, frogY / 2 - 5),
157
+ width: Math.max(1, right - left),
158
+ height: 12,
159
+ };
160
+ }
161
+ export function renderFrogAnimationRuns(width, height, variant, progress, elapsedMs, color = false, theme = 'green', options = {}) {
162
+ const canvas = new Canvas(Math.max(1, width), Math.max(1, height), theme, false, 0, options);
163
+ const value = clamp(progress);
164
+ if (variant === 'hop') {
165
+ drawFrogHop(canvas, value, elapsedMs);
166
+ }
167
+ else if (variant === 'fly') {
168
+ drawFrogFly(canvas, value, elapsedMs);
169
+ }
170
+ else if (variant === 'peek') {
171
+ drawFrogPeek(canvas, value, elapsedMs);
172
+ }
173
+ else {
174
+ drawFrogFireflies(canvas, value, elapsedMs);
175
+ }
176
+ return canvas.runs(color);
177
+ }
178
+ function drawFrogHop(canvas, progress, elapsedMs) {
179
+ const groundY = canvas.height * 2 - 9;
180
+ const stops = [canvas.width + 10, canvas.width * 0.76, canvas.width * 0.52, canvas.width * 0.28, -10].map((x) => ({
181
+ x,
182
+ y: groundY,
183
+ }));
184
+ const scaledProgress = progress * (stops.length - 1);
185
+ const segment = Math.min(stops.length - 2, Math.floor(scaledProgress));
186
+ const local = scaledProgress - segment;
187
+ const state = hopState(stops[segment], stops[segment + 1], local);
188
+ const landing = (local - 0.78) / 0.22;
189
+ if (landing > 0 && landing < 1) {
190
+ drawArrivalRipple(canvas, stops[segment + 1].x, groundY, landing);
191
+ }
192
+ drawFrog(canvas, state.transform, state.pose, elapsedMs);
193
+ }
194
+ function drawFrogFly(canvas, progress, elapsedMs) {
195
+ const groundY = canvas.height * 2 - 9;
196
+ const landing = { x: canvas.width * 0.7, y: groundY };
197
+ const flyTarget = {
198
+ x: canvas.width * 0.36,
199
+ y: Math.max(4, canvas.height * 0.72),
200
+ };
201
+ const flyIn = easeOutCubic(progress / 0.28);
202
+ const extension = easeOutCubic((progress - 0.58) / 0.14);
203
+ const release = easeInOutCubic((progress - 0.74) / 0.1);
204
+ const fly = {
205
+ x: lerp(canvas.width + 4, flyTarget.x, flyIn) + Math.sin(elapsedMs / 95) * (1 - extension) * 2.4,
206
+ y: flyTarget.y + Math.cos(elapsedMs / 80) * (1 - extension) * 2,
207
+ };
208
+ let frog;
209
+ if (progress >= 0.2 && progress < 0.52) {
210
+ frog = hopState({ x: canvas.width + 10, y: groundY }, landing, (progress - 0.2) / 0.32);
211
+ }
212
+ else if (progress >= 0.52 && progress < 0.84) {
213
+ frog = {
214
+ pose: interpolatePose(FROG_POSES.settled, FROG_POSES.reach, extension * (1 - release)),
215
+ transform: { ...landing, scale: 0.9 },
216
+ };
217
+ }
218
+ else if (progress >= 0.84) {
219
+ frog = hopState(landing, { x: -10, y: groundY }, (progress - 0.84) / 0.16);
220
+ }
221
+ if (frog) {
222
+ drawFrog(canvas, frog.transform, frog.pose, elapsedMs);
223
+ drawTongue(canvas, frog, fly, extension, release);
224
+ }
225
+ if (progress < 0.77) {
226
+ drawFly(canvas, fly, elapsedMs);
227
+ }
228
+ }
229
+ function drawFly(canvas, point, elapsedMs) {
230
+ const flap = Math.sin(elapsedMs / 45) * 0.6;
231
+ fillCircle(canvas, point.x, point.y, 0.75, 'ink', 90);
232
+ fillEllipse(canvas, point.x - 0.9, point.y - 0.7 - flap, 0.9, 0.45, 'white', 89, -0.35);
233
+ fillEllipse(canvas, point.x + 0.9, point.y - 0.7 + flap, 0.9, 0.45, 'mint', 89, 0.35);
234
+ }
235
+ function drawFrogPeek(canvas, progress, elapsedMs) {
236
+ const rise = progress < 0.25 ? easeOutCubic(progress / 0.25) : progress < 0.72 ? 1 : 1 - easeInOutCubic((progress - 0.72) / 0.28);
237
+ drawFrog(canvas, {
238
+ x: canvas.width * 0.68,
239
+ y: lerp(canvas.height * 2 + 8, canvas.height * 2 - 1, rise),
240
+ scale: 1,
241
+ rotation: progress > 0.4 && progress < 0.62 ? Math.sin((progress - 0.4) * Math.PI * 9) * 0.045 : 0,
242
+ }, FROG_POSES.settled, elapsedMs);
243
+ }
244
+ function drawFrogFireflies(canvas, progress, elapsedMs) {
245
+ const groundY = canvas.height * 2 - 9;
246
+ const landing = { x: canvas.width * 0.72, y: groundY };
247
+ const swarmIn = easeOutCubic(progress / 0.34);
248
+ const extension = easeOutCubic((progress - 0.52) / 0.14);
249
+ const release = easeInOutCubic((progress - 0.7) / 0.1);
250
+ const scatter = easeInOutCubic((progress - 0.64) / 0.2);
251
+ const fireflies = Array.from({ length: 5 }, (_, index) => {
252
+ const target = {
253
+ x: canvas.width * (0.3 + index * 0.075),
254
+ y: 5 + ((index * 5) % 9),
255
+ };
256
+ const phase = elapsedMs / 170 + index * 1.7;
257
+ return {
258
+ x: lerp(canvas.width + 5 + index * 3, target.x, swarmIn) +
259
+ Math.sin(phase) * 1.8 -
260
+ (index === 0 ? 0 : scatter * (canvas.width * 0.45 + index * 3)),
261
+ y: target.y + Math.cos(phase * 1.2) * 1.4 + (index === 0 ? 0 : Math.sin(index) * scatter * 5),
262
+ };
263
+ });
264
+ let frog;
265
+ if (progress >= 0.18 && progress < 0.48) {
266
+ frog = hopState({ x: canvas.width + 10, y: groundY }, landing, (progress - 0.18) / 0.3);
267
+ }
268
+ else if (progress >= 0.48 && progress < 0.8) {
269
+ frog = {
270
+ pose: interpolatePose(FROG_POSES.settled, FROG_POSES.reach, extension * (1 - release)),
271
+ transform: { ...landing, scale: 0.9 },
272
+ };
273
+ }
274
+ else if (progress >= 0.8) {
275
+ frog = hopState(landing, { x: -10, y: groundY }, (progress - 0.8) / 0.2);
276
+ }
277
+ for (const [index, firefly] of fireflies.entries()) {
278
+ if (index > 0 || progress < 0.74) {
279
+ drawFirefly(canvas, firefly, elapsedMs + index * 120);
280
+ }
281
+ }
282
+ if (frog) {
283
+ drawFrog(canvas, frog.transform, frog.pose, elapsedMs);
284
+ drawTongue(canvas, frog, fireflies[0], extension, release);
285
+ if (progress >= 0.72 && progress < 0.92) {
286
+ drawFirefly(canvas, { x: frog.transform.x - 5, y: frog.transform.y - 5 }, elapsedMs, 1 - Math.max(0, (progress - 0.84) / 0.08));
287
+ }
288
+ }
289
+ }
290
+ function drawFirefly(canvas, point, elapsedMs, glow = 1) {
291
+ const pulse = (0.65 + Math.sin(elapsedMs / 90) * 0.2) * glow;
292
+ fillCircle(canvas, point.x, point.y, 1.6 * pulse, 'green', 86);
293
+ fillCircle(canvas, point.x, point.y, 0.8 * glow, 'lime', 88);
294
+ fillCircle(canvas, point.x, point.y, 0.35 * glow, 'white', 90);
295
+ }
296
+ function createScene(width, height, wordY) {
297
+ const count = Math.max(86, Math.min(210, Math.round(width * 1.6)));
298
+ const random = seededRandom(width * 7_919 + height * 104_729);
299
+ const particles = [];
300
+ for (let index = 0; index < count; index++) {
301
+ particles.push({
302
+ angle: random() * Math.PI * 2,
303
+ radius: 0.25 + random() * 0.75,
304
+ depth: random(),
305
+ speed: 0.65 + random() * 1.4,
306
+ strand: index % 2,
307
+ });
308
+ }
309
+ return {
310
+ width,
311
+ height,
312
+ centerX: Math.floor(width / 2),
313
+ centerY: wordY + 2,
314
+ particles,
315
+ source: BRAND_WORD,
316
+ sourceX: Math.floor((width - BRAND_WORD.width) / 2),
317
+ wordY,
318
+ };
319
+ }
320
+ function drawSpiralAct(canvas, scene, progress, elapsedMs) {
321
+ const seconds = elapsedMs / 1_000;
322
+ const reveal = easeOutCubic(progress / 0.3);
323
+ const expansion = easeInOutCubic(progress / 0.32);
324
+ const radiusX = Math.min(31, Math.max(13, scene.width * 0.3));
325
+ const radiusY = Math.min(7, Math.max(3, scene.height * 0.22));
326
+ const wipeProgress = easeInOutCubic((progress - 0.28) / 0.72);
327
+ const wipeStart = Math.min(scene.centerX - radiusX - 3, scene.sourceX - 3);
328
+ const wipeEnd = Math.max(scene.centerX + radiusX + 3, scene.sourceX + BRAND_WORD.width + 3);
329
+ const wipeX = lerp(wipeStart, wipeEnd, wipeProgress);
330
+ drawHelix(canvas, scene, expansion, seconds, radiusX, radiusY, wipeX);
331
+ drawVortexParticles(canvas, scene, reveal, expansion, seconds, radiusX, radiusY, wipeX);
332
+ drawWipeRevealedWord(canvas, BRAND_WORD, scene.sourceX, scene.wordY, wipeX, 68);
333
+ if (wipeProgress > 0 && wipeProgress < 1) {
334
+ drawDissolveFront(canvas, scene, wipeX, seconds);
335
+ }
336
+ }
337
+ function drawDanglingLetterAct(canvas, scene, time, elapsedMs) {
338
+ const wide = canvas.width >= BRAND_WORD.width + 26;
339
+ const wordX = wide ? Math.floor((canvas.width - BRAND_WORD.width - 26) / 2) + 26 : scene.sourceX;
340
+ const restingWordY = scene.wordY - 3;
341
+ const landing = wide
342
+ ? { x: wordX - 15.5, y: (restingWordY + 3) * 2, scale: 1 }
343
+ : { x: scene.sourceX + 7.5, y: (restingWordY + 8) * 2, scale: 1 };
344
+ const letters = [5, 2, 0];
345
+ const impacts = letters.map((_, index) => (index + 1) * 0.17 - 0.015);
346
+ const presses = impacts.map((impact) => {
347
+ const age = time - impact;
348
+ return smoothStep(age / 0.018) * (1 - smoothStep((age - 0.07) / 0.05)) * 2;
349
+ });
350
+ const stops = [
351
+ { x: canvas.width + 10.5, y: scene.wordY * 2, scale: 0.9 },
352
+ ...letters.map((index) => ({ x: letterCenter(scene, index), y: scene.wordY * 2, scale: 0.9 })),
353
+ { ...landing, y: landing.y + frogFootOffset(landing, FROG_POSES.settled) + 1 },
354
+ ];
355
+ const segment = Math.min(3, Math.floor(time / 0.17));
356
+ const local = (time - segment * 0.17) / 0.17;
357
+ const from = stops[segment];
358
+ const to = stops[segment + 1];
359
+ const state = hopState(from, to, clamp(local));
360
+ const travel = easeInOutCubic(local);
361
+ state.transform.scale = lerp(from.scale, to.scale, travel);
362
+ if (to.scale === 1) {
363
+ state.pose = interpolatePose(FROG_POSES.squash, FROG_POSES.settled, travel);
364
+ }
365
+ const frog = state.transform;
366
+ if (segment === 3 && local < 1) {
367
+ frog.x -= Math.sin(Math.PI * local) * (wide ? 5 : 26);
368
+ }
369
+ // Hop waypoints describe the feet; the sprite renderer positions its center.
370
+ frog.y = segment === 3 && local >= 1 ? landing.y : frog.y - frogFootOffset(frog, state.pose) - 1;
371
+ const titleX = lerp(scene.sourceX, wordX, smoothStep((time - 0.51) / 0.17));
372
+ const titleY = lerp(scene.wordY, restingWordY - (wide ? 0 : 4), smoothStep((time - 0.51) / 0.17));
373
+ const hangingLetter = letters[1];
374
+ const hangAge = Math.max(0, time - impacts[1]);
375
+ const hanging = smoothStep(hangAge / 0.035) * (1 - smoothStep((time - 0.81) / 0.085));
376
+ const bobAge = Math.max(0, hangAge - 0.035);
377
+ const drop = Math.round((2 + Math.sin(bobAge * 30) * 0.85 * Math.exp(-bobAge * 10)) * hanging);
378
+ const sway = Math.round(Math.sin(hangAge * 20) * Math.exp(-hangAge * 4) * 0.9 * hanging);
379
+ const points = BRAND_WORD.points.map((point) => {
380
+ const dangling = point.letterIndex === hangingLetter;
381
+ return {
382
+ ...point,
383
+ x: point.x + (dangling ? sway : 0),
384
+ y: point.y + (dangling ? drop : (presses[letters.indexOf(point.letterIndex)] ?? 0)),
385
+ };
386
+ });
387
+ drawSolidWord(canvas, { ...BRAND_WORD, points }, titleX, titleY, 60);
388
+ const reach = time > 0.74 && time < 0.97 ? smoothStep((time - 0.74) / 0.07) * (1 - smoothStep((time - 0.91) / 0.06)) : 0;
389
+ state.pose = interpolatePose(FROG_POSES.settled, FROG_POSES.reach, reach);
390
+ drawFrog(canvas, frog, state.pose, elapsedMs);
391
+ if (reach > 0) {
392
+ drawPushingTongue(canvas, state, { x: letterCenter(scene, hangingLetter) + titleX - scene.sourceX - 2.5 + sway, y: (titleY + 6 + drop) * 2 }, reach);
393
+ }
394
+ }
395
+ function letterCenter(scene, letterIndex) {
396
+ const points = BRAND_WORD.points.filter((point) => point.letterIndex === letterIndex);
397
+ return scene.sourceX + (Math.min(...points.map((point) => point.x)) + Math.max(...points.map((point) => point.x))) / 2;
398
+ }
399
+ function drawFinalLockup(canvas, elapsedMs) {
400
+ const layout = lockupLayout(canvas.width);
401
+ drawSolidWord(canvas, BRAND_WORD, layout.wordX, layout.wordY, 68);
402
+ drawFrog(canvas, { x: layout.frogX, y: layout.frogY, scale: 1 }, FROG_POSES.settled, elapsedMs);
403
+ }
404
+ function drawCompactLockup(canvas, elapsedMs) {
405
+ if (canvas.width < 26 || canvas.height < 4) {
406
+ const title = 'STRANDS'.slice(0, canvas.width);
407
+ const left = Math.floor((canvas.width - title.length) / 2);
408
+ for (const [index, character] of [...title].entries()) {
409
+ canvas.set(left + index, 0, character, 'green', 68);
410
+ }
411
+ return;
412
+ }
413
+ const left = Math.floor((canvas.width - 24) / 2);
414
+ drawFrog(canvas, { x: left + 4, y: 4, scale: 0.34 }, FROG_POSES.settled, elapsedMs);
415
+ for (const [index, character] of [...'STRANDS'].entries()) {
416
+ canvas.set(left + 10 + index, 1, character, 'green', 68);
417
+ }
418
+ }
419
+ function drawFrogBrandEasterEgg(canvas, progress, elapsedMs) {
420
+ if (progress <= 0 || progress >= 1) {
421
+ drawFinalLockup(canvas, elapsedMs);
422
+ return;
423
+ }
424
+ const layout = lockupLayout(canvas.width);
425
+ const dissolve = easeInOutCubic((progress - 0.16) / 0.3);
426
+ const reform = easeInOutCubic((progress - 0.62) / 0.22);
427
+ const vortex = dissolve * (1 - reform);
428
+ if (vortex <= 0) {
429
+ drawSolidWord(canvas, BRAND_WORD, layout.wordX, layout.wordY, 68);
430
+ }
431
+ else {
432
+ const scene = createScene(canvas.width, canvas.height, layout.wordY);
433
+ scene.centerX = layout.wordX + (BRAND_WORD.width - 1) / 2;
434
+ scene.centerY = layout.wordY + 2.5;
435
+ const radiusX = Math.min(31, BRAND_WORD.width / 2);
436
+ const radiusY = Math.min(3, scene.centerY, canvas.height - 1 - scene.centerY);
437
+ const seconds = elapsedMs / 1_000;
438
+ const wipeX = scene.centerX - radiusX - 8;
439
+ drawHelix(canvas, scene, vortex, seconds, radiusX, radiusY, wipeX);
440
+ drawVortexParticles(canvas, scene, vortex, vortex, seconds, radiusX, radiusY, wipeX);
441
+ for (const point of BRAND_WORD.points) {
442
+ const angle = hash01(point.index * 71 + 13) * Math.PI * 2 + elapsedMs / 180;
443
+ const radius = 3 + hash01(point.index * 97 + 29) * 12;
444
+ canvas.set(lerp(layout.wordX + point.x, scene.centerX + Math.cos(angle) * radius, vortex), lerp(layout.wordY + point.y, scene.centerY + Math.sin(angle) * Math.min(radius * 0.32, radiusY), vortex), vortex < 0.3 ? point.character : vortex < 0.68 ? '▒' : '·', wordColor(canvas, point), 68);
445
+ }
446
+ }
447
+ drawBrandFrogJump(canvas, layout.frogX, layout.frogY, progress, elapsedMs);
448
+ }
449
+ function drawBrandFrogJump(canvas, frogX, baseY, progress, elapsedMs) {
450
+ const start = { x: frogX, y: baseY };
451
+ const offscreen = { x: frogX - 8, y: -16 };
452
+ if (progress < 0.2) {
453
+ if (progress < 0.04) {
454
+ drawFrog(canvas, { ...start, scale: 1 }, interpolatePose(FROG_POSES.settled, FROG_POSES.crouch, easeInOutCubic(progress / 0.04)), elapsedMs);
455
+ return;
456
+ }
457
+ const jump = (progress - 0.04) / 0.16;
458
+ const state = hopState(start, offscreen, jump);
459
+ state.transform.scale = lerp(1, 0.9, Math.min(1, jump / 0.18));
460
+ drawFrog(canvas, state.transform, state.pose, elapsedMs);
461
+ return;
462
+ }
463
+ if (progress > 0.8) {
464
+ if (progress < 0.96) {
465
+ const landing = (progress - 0.8) / 0.16;
466
+ const state = hopState(offscreen, start, landing);
467
+ state.transform.scale = lerp(0.9, 1, Math.max(0, (landing - 0.76) / 0.24));
468
+ if (landing > 0.76) {
469
+ drawArrivalRipple(canvas, frogX, baseY, (landing - 0.76) / 0.24);
470
+ }
471
+ drawFrog(canvas, state.transform, state.pose, elapsedMs);
472
+ return;
473
+ }
474
+ drawFrog(canvas, { ...start, scale: 1 }, interpolatePose(FROG_POSES.squash, FROG_POSES.settled, easeInOutCubic((progress - 0.96) / 0.04)), elapsedMs);
475
+ }
476
+ }
477
+ function drawSolidWord(canvas, word, originX, originY, priority) {
478
+ const accent = canvas.theme === 'circuit' ? 'blue' : canvas.theme === 'spectre' ? 'red' : undefined;
479
+ if (accent) {
480
+ for (const point of word.points) {
481
+ canvas.set(originX + point.x + 1, originY + point.y + 1, '░', accent, priority - 1);
482
+ }
483
+ }
484
+ for (const point of word.points) {
485
+ canvas.set(originX + point.x, originY + point.y, point.character, wordColor(canvas, point), priority);
486
+ }
487
+ }
488
+ function wordColor(canvas, point) {
489
+ if (canvas.theme === 'homeland') {
490
+ const region = (Math.floor(point.localX / 3) + Math.floor(point.localY / 2) + point.letterIndex * 2) % 5;
491
+ return region < 2 ? (region === 0 ? 'lime' : 'green') : region === 2 ? 'cyan' : 'blue';
492
+ }
493
+ if (canvas.theme === 'circuit') {
494
+ return point.index % 19 === 0 ? 'tongue' : 'lime';
495
+ }
496
+ if (canvas.theme === 'spectre') {
497
+ return point.localY === 5 ? 'red' : 'mint';
498
+ }
499
+ if (canvas.theme === 'merlin') {
500
+ return point.index % 23 === 0 ? 'white' : 'lime';
501
+ }
502
+ return 'lime';
503
+ }
504
+ function drawWipeRevealedWord(canvas, word, originX, originY, wipeX, priority) {
505
+ for (const point of word.points) {
506
+ if (originX + point.x > wipeX) {
507
+ continue;
508
+ }
509
+ canvas.set(originX + point.x, originY + point.y, point.character, wordColor(canvas, point), priority);
510
+ }
511
+ }
512
+ function drawDissolveFront(canvas, scene, wipeX, seconds) {
513
+ const top = Math.max(0, scene.centerY - 8);
514
+ const bottom = Math.min(scene.height - 1, scene.centerY + 8);
515
+ for (let row = top; row <= bottom; row++) {
516
+ const seed = row * 37 + Math.floor(seconds * 16);
517
+ if (hash01(seed) < 0.38) {
518
+ continue;
519
+ }
520
+ const drift = Math.round((hash01(seed + 11) - 0.5) * 4);
521
+ canvas.set(wipeX + drift, row, hash01(seed + 23) > 0.7 ? '◆' : hash01(seed + 31) > 0.45 ? '∙' : '·', hash01(seed + 43) > 0.65 ? 'mint' : 'emerald', 24);
522
+ }
523
+ }
524
+ function lockupLayout(width) {
525
+ const wide = width >= BRAND_WORD.width + 26;
526
+ const wordX = Math.floor((width - BRAND_WORD.width - (wide ? 26 : 0)) / 2) + (wide ? 26 : 0);
527
+ return {
528
+ frogX: wide ? wordX - 15.5 : wordX + 7.5,
529
+ frogY: wide ? 10 : 24,
530
+ wordX,
531
+ wordY: wide ? 2 : 0,
532
+ height: wide ? 12 : 19,
533
+ };
534
+ }
535
+ function drawHelix(canvas, scene, expansion, seconds, radiusX, radiusY, wipeX) {
536
+ const sampleCount = Math.max(21, Math.min(69, Math.round(scene.width * 0.5)));
537
+ const samples = sampleCount % 2 === 0 ? sampleCount + 1 : sampleCount;
538
+ const activeRadiusY = radiusY * expansion;
539
+ let previousA;
540
+ let previousB;
541
+ for (let index = 0; index < samples; index++) {
542
+ const phase = index / (samples - 1);
543
+ if (Math.abs(phase - 0.5) * 2 > expansion) {
544
+ previousA = undefined;
545
+ previousB = undefined;
546
+ continue;
547
+ }
548
+ const x = scene.centerX - radiusX + phase * radiusX * 2;
549
+ const angle = phase * Math.PI * 4 + seconds * 2.3;
550
+ const depth = Math.cos(angle);
551
+ const a = { x, y: scene.centerY + Math.sin(angle) * activeRadiusY };
552
+ const b = { x, y: scene.centerY + Math.sin(angle + Math.PI) * activeRadiusY };
553
+ const visibleA = hash01(index * 47 + 13) <= spiralPresence(a.x, wipeX, index * 47 + 13);
554
+ const visibleB = hash01(index * 47 + 29) <= spiralPresence(b.x, wipeX, index * 47 + 29);
555
+ if (previousA && visibleA) {
556
+ canvas.line(previousA, a, depth > 0 ? '━' : '─', depth > 0 ? 'green' : 'forest', 13);
557
+ }
558
+ if (previousB && visibleB) {
559
+ canvas.line(previousB, b, depth < 0 ? '━' : '─', depth < 0 ? 'mint' : 'emerald', 13);
560
+ }
561
+ if (index % 4 === 0 &&
562
+ Math.min(hash01(index * 61 + 7), hash01(index * 61 + 19)) <= spiralPresence(x, wipeX, index * 61 + 7)) {
563
+ canvas.line(a, b, '·', 'dim', 8);
564
+ }
565
+ if (visibleA) {
566
+ canvas.set(a.x, a.y, depth > 0 ? '●' : '•', depth > 0 ? 'green' : 'forest', 18);
567
+ }
568
+ if (visibleB) {
569
+ canvas.set(b.x, b.y, depth < 0 ? '●' : '•', depth < 0 ? 'mint' : 'emerald', 18);
570
+ }
571
+ previousA = visibleA ? a : undefined;
572
+ previousB = visibleB ? b : undefined;
573
+ }
574
+ }
575
+ function drawVortexParticles(canvas, scene, reveal, expansion, seconds, radiusX, radiusY, wipeX) {
576
+ const visible = Math.floor(scene.particles.length * reveal);
577
+ for (let index = 0; index < visible; index++) {
578
+ const particle = scene.particles[index];
579
+ const direction = particle.strand === 0 ? 1 : -1;
580
+ const angle = particle.angle + direction * seconds * particle.speed;
581
+ const radiusScale = 0.35 + particle.radius * 0.65;
582
+ const x = scene.centerX + Math.cos(angle) * radiusX * radiusScale * expansion;
583
+ const y = scene.centerY + Math.sin(angle * 1.7) * radiusY * radiusScale * expansion;
584
+ if (hash01(index * 53 + 11) > spiralPresence(x, wipeX, index * 53 + 11)) {
585
+ continue;
586
+ }
587
+ const bright = particle.depth > 0.72;
588
+ canvas.set(x, y, bright ? (particle.strand === 0 ? '◆' : '◇') : index % 3 === 0 ? '∙' : '·', bright ? (particle.strand === 0 ? 'green' : 'mint') : particle.strand === 0 ? 'emerald' : 'forest', bright ? 22 : 16);
589
+ }
590
+ }
591
+ function spiralPresence(x, wipeX, seed) {
592
+ const distance = x - wipeX;
593
+ if (distance <= 0) {
594
+ return 0;
595
+ }
596
+ if (distance >= 6) {
597
+ return 1;
598
+ }
599
+ return clamp(distance / 6 + (hash01(seed + 97) - 0.5) * 0.28);
600
+ }
601
+ function wordShape(word) {
602
+ const points = [];
603
+ let offset = 0;
604
+ for (const [letterIndex, rawLetter] of [...word].entries()) {
605
+ const glyph = GLYPHS[rawLetter];
606
+ for (let localY = 0; localY < glyph.length; localY++) {
607
+ const row = glyph[localY];
608
+ for (let localX = 0; localX < row.length; localX++) {
609
+ const character = row[localX];
610
+ if (character !== ' ') {
611
+ points.push({
612
+ character,
613
+ index: points.length,
614
+ letterIndex,
615
+ localX,
616
+ localY,
617
+ x: offset + localX,
618
+ y: localY,
619
+ });
620
+ }
621
+ }
622
+ }
623
+ offset += Math.max(...glyph.map((row) => row.length)) + 1;
624
+ }
625
+ return { points, width: offset - 1 };
626
+ }
627
+ function seededRandom(seed) {
628
+ let value = seed >>> 0;
629
+ return () => {
630
+ value = (value * 1_664_525 + 1_013_904_223) >>> 0;
631
+ return value / 0x1_0000_0000;
632
+ };
633
+ }
634
+ //# sourceMappingURL=frog-intro-renderer.js.map