cuju-render 0.1.0__py3-none-any.whl

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 (382) hide show
  1. cuju/render/__init__.py +759 -0
  2. cuju/render/__main__.py +1065 -0
  3. cuju/render/_export/__init__.py +3 -0
  4. cuju/render/_export/feed.py +542 -0
  5. cuju/render/_export/sizes.py +157 -0
  6. cuju/render/_export/video.py +1618 -0
  7. cuju/render/_export/video_jobs.py +408 -0
  8. cuju/render/_format/__init__.py +3 -0
  9. cuju/render/_format/annotations.py +235 -0
  10. cuju/render/_format/codec.py +307 -0
  11. cuju/render/_format/keep.py +121 -0
  12. cuju/render/_format/recording.py +860 -0
  13. cuju/render/_format/writer.py +54 -0
  14. cuju/render/_guide/__init__.py +3 -0
  15. cuju/render/_guide/doctor.py +523 -0
  16. cuju/render/_guide/help.py +62 -0
  17. cuju/render/_guide/tutorial.py +254 -0
  18. cuju/render/_http/__init__.py +3 -0
  19. cuju/render/_http/commands.py +57 -0
  20. cuju/render/_http/headers.py +103 -0
  21. cuju/render/_http/launch.py +500 -0
  22. cuju/render/_http/launchers.py +408 -0
  23. cuju/render/_http/pwa.py +128 -0
  24. cuju/render/_http/server.py +2105 -0
  25. cuju/render/_http/window.py +360 -0
  26. cuju/render/_moments/__init__.py +3 -0
  27. cuju/render/_moments/captions.py +284 -0
  28. cuju/render/_moments/events.py +1123 -0
  29. cuju/render/_moments/search.py +694 -0
  30. cuju/render/_packages/__init__.py +3 -0
  31. cuju/render/_packages/glsl.py +746 -0
  32. cuju/render/_packages/loudness.py +334 -0
  33. cuju/render/_packages/pack.py +1959 -0
  34. cuju/render/_packages/presentation.py +1376 -0
  35. cuju/render/_packages/vocabulary.py +609 -0
  36. cuju/render/_playing/__init__.py +3 -0
  37. cuju/render/_playing/achievements.py +463 -0
  38. cuju/render/_playing/bench.py +609 -0
  39. cuju/render/_playing/challenges.py +1813 -0
  40. cuju/render/_playing/demo.py +323 -0
  41. cuju/render/_playing/draw.py +211 -0
  42. cuju/render/_playing/errors.py +20 -0
  43. cuju/render/_playing/game.py +645 -0
  44. cuju/render/_playing/limits.py +339 -0
  45. cuju/render/_playing/play.py +926 -0
  46. cuju/render/_playing/policy_worker.py +250 -0
  47. cuju/render/_playing/strict.py +810 -0
  48. cuju/render/_registry/__init__.py +3 -0
  49. cuju/render/_registry/clips.py +394 -0
  50. cuju/render/_registry/joints.py +108 -0
  51. cuju/render/_registry/teams.py +2058 -0
  52. cuju/render/_store/__init__.py +3 -0
  53. cuju/render/_store/home.py +70 -0
  54. cuju/render/_store/library.py +604 -0
  55. cuju/render/_store/samples.py +163 -0
  56. cuju/render/_text/__init__.py +3 -0
  57. cuju/render/_text/languages.py +637 -0
  58. cuju/render/_text/messages.py +1396 -0
  59. cuju/render/_tournaments/__init__.py +3 -0
  60. cuju/render/_tournaments/results.py +547 -0
  61. cuju/render/_tournaments/tournament.py +2742 -0
  62. cuju/render/_tournaments/tournament_cli.py +587 -0
  63. cuju/render/_tournaments/tournament_runner.py +1975 -0
  64. cuju/render/_version.py +6 -0
  65. cuju/render/_watch/__init__.py +3 -0
  66. cuju/render/_watch/grid.py +265 -0
  67. cuju/render/_watch/live.py +664 -0
  68. cuju/render/_watch/notebook.py +79 -0
  69. cuju/render/_watch/show.py +171 -0
  70. cuju/render/samples/sample-11v11.cjr +0 -0
  71. cuju/render/samples/sample-5v5.cjr +0 -0
  72. cuju/render/samples/teams/starter/main.py +33 -0
  73. cuju/render/scenarios/benchmark_full_game_11_vs_11_easy.py +46 -0
  74. cuju/render/scenarios/benchmark_full_game_11_vs_11_hard.py +46 -0
  75. cuju/render/scenarios/benchmark_full_game_11_vs_11_medium.py +46 -0
  76. cuju/render/scenarios/benchmark_full_game_5_vs_5_easy.py +34 -0
  77. cuju/render/scenarios/benchmark_full_game_5_vs_5_hard.py +34 -0
  78. cuju/render/scenarios/benchmark_full_game_5_vs_5_medium.py +34 -0
  79. cuju/render/web/assets/adboard_polygon.webp +0 -0
  80. cuju/render/web/assets/adboard_your_ad_here.webp +0 -0
  81. cuju/render/web/assets/animations/kaykit-rig-medium-combatmelee.glb +0 -0
  82. cuju/render/web/assets/animations/kaykit-rig-medium-general.glb +0 -0
  83. cuju/render/web/assets/animations/kaykit-rig-medium-movementadvanced.glb +0 -0
  84. cuju/render/web/assets/animations/kaykit-rig-medium-movementbasic.glb +0 -0
  85. cuju/render/web/assets/animations/kaykit-rig-medium-simulation.glb +0 -0
  86. cuju/render/web/assets/animations/kaykit-rig-medium-special.glb +0 -0
  87. cuju/render/web/assets/ball.glb +0 -0
  88. cuju/render/web/assets/challenges/3_vs_1_with_keeper.mp4 +0 -0
  89. cuju/render/web/assets/challenges/3_vs_1_with_keeper.webp +0 -0
  90. cuju/render/web/assets/challenges/corner.mp4 +0 -0
  91. cuju/render/web/assets/challenges/corner.webp +0 -0
  92. cuju/render/web/assets/challenges/counterattack_easy.mp4 +0 -0
  93. cuju/render/web/assets/challenges/counterattack_easy.webp +0 -0
  94. cuju/render/web/assets/challenges/counterattack_hard.mp4 +0 -0
  95. cuju/render/web/assets/challenges/counterattack_hard.webp +0 -0
  96. cuju/render/web/assets/challenges/empty_goal.mp4 +0 -0
  97. cuju/render/web/assets/challenges/empty_goal.webp +0 -0
  98. cuju/render/web/assets/challenges/empty_goal_close.mp4 +0 -0
  99. cuju/render/web/assets/challenges/empty_goal_close.webp +0 -0
  100. cuju/render/web/assets/challenges/manifest.json +375 -0
  101. cuju/render/web/assets/challenges/one_on_one.mp4 +0 -0
  102. cuju/render/web/assets/challenges/one_on_one.webp +0 -0
  103. cuju/render/web/assets/challenges/one_on_one_hard.mp4 +0 -0
  104. cuju/render/web/assets/challenges/one_on_one_hard.webp +0 -0
  105. cuju/render/web/assets/challenges/pass_and_shoot_with_keeper.mp4 +0 -0
  106. cuju/render/web/assets/challenges/pass_and_shoot_with_keeper.webp +0 -0
  107. cuju/render/web/assets/challenges/run_pass_and_shoot_with_keeper.mp4 +0 -0
  108. cuju/render/web/assets/challenges/run_pass_and_shoot_with_keeper.webp +0 -0
  109. cuju/render/web/assets/challenges/run_to_score.mp4 +0 -0
  110. cuju/render/web/assets/challenges/run_to_score.webp +0 -0
  111. cuju/render/web/assets/challenges/run_to_score_with_keeper.mp4 +0 -0
  112. cuju/render/web/assets/challenges/run_to_score_with_keeper.webp +0 -0
  113. cuju/render/web/assets/challenges/single_goal_versus_lazy.mp4 +0 -0
  114. cuju/render/web/assets/challenges/single_goal_versus_lazy.webp +0 -0
  115. cuju/render/web/assets/crowd.webp +0 -0
  116. cuju/render/web/assets/crowd_normal.webp +0 -0
  117. cuju/render/web/assets/cuju-logo-384.png +0 -0
  118. cuju/render/web/assets/cuju-logo.png +0 -0
  119. cuju/render/web/assets/cuju-logo.svg +46 -0
  120. cuju/render/web/assets/cuju-mark-light.svg +33 -0
  121. cuju/render/web/assets/cuju-mark.svg +33 -0
  122. cuju/render/web/assets/goal.glb +0 -0
  123. cuju/render/web/assets/grass.webp +0 -0
  124. cuju/render/web/assets/hair_black.png +0 -0
  125. cuju/render/web/assets/hair_blonde.png +0 -0
  126. cuju/render/web/assets/hair_brown.png +0 -0
  127. cuju/render/web/assets/hair_darkblonde.png +0 -0
  128. cuju/render/web/assets/hair_long01.glb +0 -0
  129. cuju/render/web/assets/hair_long02.glb +0 -0
  130. cuju/render/web/assets/hair_medium01.glb +0 -0
  131. cuju/render/web/assets/hair_red.png +0 -0
  132. cuju/render/web/assets/hair_short01.glb +0 -0
  133. cuju/render/web/assets/hair_short02.glb +0 -0
  134. cuju/render/web/assets/icons/cuju-192.png +0 -0
  135. cuju/render/web/assets/icons/cuju-512.png +0 -0
  136. cuju/render/web/assets/icons/cuju-maskable-512.png +0 -0
  137. cuju/render/web/assets/kit_goalkeeper.webp +0 -0
  138. cuju/render/web/assets/kit_mask.png +0 -0
  139. cuju/render/web/assets/kit_normal.webp +0 -0
  140. cuju/render/web/assets/manifest.json +601 -0
  141. cuju/render/web/assets/models/kaykit-barbarian.glb +0 -0
  142. cuju/render/web/assets/models/kaykit-barbarian.json +23 -0
  143. cuju/render/web/assets/models/kaykit-knight.glb +0 -0
  144. cuju/render/web/assets/models/kaykit-knight.json +23 -0
  145. cuju/render/web/assets/models/kaykit-mage.glb +0 -0
  146. cuju/render/web/assets/models/kaykit-mage.json +23 -0
  147. cuju/render/web/assets/models/kaykit-mannequin-medium.glb +0 -0
  148. cuju/render/web/assets/models/kaykit-mannequin-medium.json +23 -0
  149. cuju/render/web/assets/models/kaykit-ranger.glb +0 -0
  150. cuju/render/web/assets/models/kaykit-ranger.json +23 -0
  151. cuju/render/web/assets/models/kaykit-rogue-hooded.glb +0 -0
  152. cuju/render/web/assets/models/kaykit-rogue-hooded.json +23 -0
  153. cuju/render/web/assets/models/kaykit-rogue.glb +0 -0
  154. cuju/render/web/assets/models/kaykit-rogue.json +23 -0
  155. cuju/render/web/assets/models/kaykit-skeleton-mage.glb +0 -0
  156. cuju/render/web/assets/models/kaykit-skeleton-mage.json +23 -0
  157. cuju/render/web/assets/models/kaykit-skeleton-minion.glb +0 -0
  158. cuju/render/web/assets/models/kaykit-skeleton-minion.json +23 -0
  159. cuju/render/web/assets/models/kaykit-skeleton-rogue.glb +0 -0
  160. cuju/render/web/assets/models/kaykit-skeleton-rogue.json +23 -0
  161. cuju/render/web/assets/models/kaykit-skeleton-warrior.glb +0 -0
  162. cuju/render/web/assets/models/kaykit-skeleton-warrior.json +23 -0
  163. cuju/render/web/assets/pitch.webp +0 -0
  164. cuju/render/web/assets/pitch_normal.webp +0 -0
  165. cuju/render/web/assets/player.glb +0 -0
  166. cuju/render/web/assets/shoe.webp +0 -0
  167. cuju/render/web/assets/shoe_sole.png +0 -0
  168. cuju/render/web/assets/skin_01.png +0 -0
  169. cuju/render/web/assets/skin_02.png +0 -0
  170. cuju/render/web/assets/skin_03.png +0 -0
  171. cuju/render/web/assets/skin_04.png +0 -0
  172. cuju/render/web/assets/sounds/applause.ogg +0 -0
  173. cuju/render/web/assets/sounds/beach-wave-1.ogg +0 -0
  174. cuju/render/web/assets/sounds/beach-wave-2.ogg +0 -0
  175. cuju/render/web/assets/sounds/beach-wave-3.ogg +0 -0
  176. cuju/render/web/assets/sounds/beach-wave-4.ogg +0 -0
  177. cuju/render/web/assets/sounds/city-horn.ogg +0 -0
  178. cuju/render/web/assets/sounds/city-loop.ogg +0 -0
  179. cuju/render/web/assets/sounds/city-siren.ogg +0 -0
  180. cuju/render/web/assets/sounds/crowd-cheer.ogg +0 -0
  181. cuju/render/web/assets/sounds/crowd-loop.ogg +0 -0
  182. cuju/render/web/assets/sounds/crowd-ooh.ogg +0 -0
  183. cuju/render/web/assets/sounds/gulls.ogg +0 -0
  184. cuju/render/web/assets/sounds/neon-sting.ogg +0 -0
  185. cuju/render/web/assets/sounds/rain-loop.ogg +0 -0
  186. cuju/render/web/assets/sounds/sounds.json +46 -0
  187. cuju/render/web/assets/sounds/space-beep.ogg +0 -0
  188. cuju/render/web/assets/sounds/space-hum.ogg +0 -0
  189. cuju/render/web/assets/sounds/space-radio.ogg +0 -0
  190. cuju/render/web/assets/sounds/whistle-long.ogg +0 -0
  191. cuju/render/web/assets/sounds/whistle-short.ogg +0 -0
  192. cuju/render/web/assets/sounds/wind-loop.ogg +0 -0
  193. cuju/render/web/easy.css +357 -0
  194. cuju/render/web/export.html +23 -0
  195. cuju/render/web/feed.css +262 -0
  196. cuju/render/web/feed.html +28 -0
  197. cuju/render/web/flat.css +120 -0
  198. cuju/render/web/home.css +837 -0
  199. cuju/render/web/index.html +373 -0
  200. cuju/render/web/js/boot.js +50 -0
  201. cuju/render/web/js/broadcast/audio.js +2141 -0
  202. cuju/render/web/js/broadcast/celebrate.js +1238 -0
  203. cuju/render/web/js/broadcast/decisions.js +609 -0
  204. cuju/render/web/js/broadcast/hud.js +352 -0
  205. cuju/render/web/js/broadcast/show.js +3614 -0
  206. cuju/render/web/js/broadcast/transition.js +2231 -0
  207. cuju/render/web/js/broadcast/voices.js +153 -0
  208. cuju/render/web/js/capture.js +101 -0
  209. cuju/render/web/js/core/accessibility.js +90 -0
  210. cuju/render/web/js/core/api.js +429 -0
  211. cuju/render/web/js/core/comfort.js +135 -0
  212. cuju/render/web/js/core/i18n.js +705 -0
  213. cuju/render/web/js/core/icons.js +167 -0
  214. cuju/render/web/js/core/input-settings.js +156 -0
  215. cuju/render/web/js/core/keys.js +277 -0
  216. cuju/render/web/js/core/language-ui.js +125 -0
  217. cuju/render/web/js/core/menu.js +853 -0
  218. cuju/render/web/js/core/names.js +113 -0
  219. cuju/render/web/js/core/page-structure.js +110 -0
  220. cuju/render/web/js/core/scenarios.js +109 -0
  221. cuju/render/web/js/core/spoilers.js +236 -0
  222. cuju/render/web/js/core/typeahead.js +38 -0
  223. cuju/render/web/js/export/dom-picture.js +330 -0
  224. cuju/render/web/js/export/export-host.js +97 -0
  225. cuju/render/web/js/export/feed-dialog.js +191 -0
  226. cuju/render/web/js/export/feed-params.js +266 -0
  227. cuju/render/web/js/export/feed.js +363 -0
  228. cuju/render/web/js/export/mp4-mux.js +295 -0
  229. cuju/render/web/js/export/photo-core.js +313 -0
  230. cuju/render/web/js/export/photo.js +1314 -0
  231. cuju/render/web/js/export/safe-frame.js +59 -0
  232. cuju/render/web/js/export/size-fields.js +103 -0
  233. cuju/render/web/js/export/sizes.js +178 -0
  234. cuju/render/web/js/export/video-boot.js +55 -0
  235. cuju/render/web/js/export/video-browser.js +325 -0
  236. cuju/render/web/js/export/video-export.js +417 -0
  237. cuju/render/web/js/export/video-plan.js +207 -0
  238. cuju/render/web/js/export/video-range.js +185 -0
  239. cuju/render/web/js/export/webm-mux.js +198 -0
  240. cuju/render/web/js/feed-boot.js +151 -0
  241. cuju/render/web/js/feed-frame.js +101 -0
  242. cuju/render/web/js/help/doctor.js +488 -0
  243. cuju/render/web/js/help/firstrun.js +379 -0
  244. cuju/render/web/js/help/help-center.js +438 -0
  245. cuju/render/web/js/help/install-offer.js +164 -0
  246. cuju/render/web/js/help/install-state.js +104 -0
  247. cuju/render/web/js/help/lessons-core.js +207 -0
  248. cuju/render/web/js/help/lessons.js +463 -0
  249. cuju/render/web/js/help/palette.js +584 -0
  250. cuju/render/web/js/help/pwa.js +257 -0
  251. cuju/render/web/js/help/tour-core.js +241 -0
  252. cuju/render/web/js/help/tour.js +461 -0
  253. cuju/render/web/js/main.js +2513 -0
  254. cuju/render/web/js/pages/draw.js +188 -0
  255. cuju/render/web/js/pages/fieldpage.js +530 -0
  256. cuju/render/web/js/pages/home.js +521 -0
  257. cuju/render/web/js/pages/matches.js +779 -0
  258. cuju/render/web/js/pages/moments-ui.js +359 -0
  259. cuju/render/web/js/pages/queue-filters.js +63 -0
  260. cuju/render/web/js/pages/recording-groups.js +80 -0
  261. cuju/render/web/js/pages/recordings.js +1069 -0
  262. cuju/render/web/js/play/bench.js +347 -0
  263. cuju/render/web/js/play/challenges.js +1302 -0
  264. cuju/render/web/js/play/medals.js +127 -0
  265. cuju/render/web/js/play/play.js +1953 -0
  266. cuju/render/web/js/play/teasers.js +196 -0
  267. cuju/render/web/js/play/touch.js +350 -0
  268. cuju/render/web/js/play/tournament-layout.js +487 -0
  269. cuju/render/web/js/play/tournament-results.js +441 -0
  270. cuju/render/web/js/play/tournament-strict.js +560 -0
  271. cuju/render/web/js/play/tournament.js +2585 -0
  272. cuju/render/web/js/players/animate.js +972 -0
  273. cuju/render/web/js/players/clips.js +224 -0
  274. cuju/render/web/js/players/kaykit.js +162 -0
  275. cuju/render/web/js/players/kits.js +676 -0
  276. cuju/render/web/js/players/number-patch.js +82 -0
  277. cuju/render/web/js/players/players.js +2694 -0
  278. cuju/render/web/js/players/recolor.js +893 -0
  279. cuju/render/web/js/players/retarget.js +325 -0
  280. cuju/render/web/js/players/rig-numbers.js +174 -0
  281. cuju/render/web/js/presentation/animator.js +231 -0
  282. cuju/render/web/js/presentation/assign.js +85 -0
  283. cuju/render/web/js/presentation/behaviors.js +440 -0
  284. cuju/render/web/js/presentation/budget.js +209 -0
  285. cuju/render/web/js/presentation/catalog.js +1674 -0
  286. cuju/render/web/js/presentation/clocks.js +72 -0
  287. cuju/render/web/js/presentation/commands.js +301 -0
  288. cuju/render/web/js/presentation/contract.js +240 -0
  289. cuju/render/web/js/presentation/effects.js +904 -0
  290. cuju/render/web/js/presentation/flash.js +605 -0
  291. cuju/render/web/js/presentation/freeze-worklet.js +22 -0
  292. cuju/render/web/js/presentation/glsl.js +464 -0
  293. cuju/render/web/js/presentation/host.js +323 -0
  294. cuju/render/web/js/presentation/index.js +2066 -0
  295. cuju/render/web/js/presentation/loudness-worklet.js +235 -0
  296. cuju/render/web/js/presentation/loudness.js +740 -0
  297. cuju/render/web/js/presentation/moments.js +536 -0
  298. cuju/render/web/js/presentation/post.js +327 -0
  299. cuju/render/web/js/presentation/preview.js +180 -0
  300. cuju/render/web/js/presentation/protocol.js +174 -0
  301. cuju/render/web/js/presentation/reach.js +158 -0
  302. cuju/render/web/js/presentation/rigging.js +130 -0
  303. cuju/render/web/js/presentation/sandbox.js +157 -0
  304. cuju/render/web/js/presentation/shaders.js +235 -0
  305. cuju/render/web/js/presentation/stage.js +402 -0
  306. cuju/render/web/js/presentation/teamaudio.js +722 -0
  307. cuju/render/web/js/presentation/tracks.js +197 -0
  308. cuju/render/web/js/presentation/values.js +81 -0
  309. cuju/render/web/js/recording/annotation-data.js +203 -0
  310. cuju/render/web/js/recording/captions.js +491 -0
  311. cuju/render/web/js/recording/codec.js +185 -0
  312. cuju/render/web/js/recording/decode-worker.js +70 -0
  313. cuju/render/web/js/recording/decode.js +94 -0
  314. cuju/render/web/js/recording/episodes.js +46 -0
  315. cuju/render/web/js/recording/format.js +461 -0
  316. cuju/render/web/js/recording/live.js +348 -0
  317. cuju/render/web/js/recording/moments-query.js +59 -0
  318. cuju/render/web/js/recording/moments.js +149 -0
  319. cuju/render/web/js/recording/pose.js +86 -0
  320. cuju/render/web/js/recording/timeline.js +275 -0
  321. cuju/render/web/js/teams/art.js +50 -0
  322. cuju/render/web/js/teams/clip-editor.js +293 -0
  323. cuju/render/web/js/teams/editor.js +1979 -0
  324. cuju/render/web/js/teams/library.js +344 -0
  325. cuju/render/web/js/teams/painter.js +633 -0
  326. cuju/render/web/js/teams/surprise-ui.js +195 -0
  327. cuju/render/web/js/teams/surprise.js +497 -0
  328. cuju/render/web/js/teams/team-check.js +127 -0
  329. cuju/render/web/js/watch/annotations.js +270 -0
  330. cuju/render/web/js/watch/flat.js +366 -0
  331. cuju/render/web/js/watch/grid.js +436 -0
  332. cuju/render/web/js/watch/pitch2d.js +289 -0
  333. cuju/render/web/js/watch/player-tools.js +192 -0
  334. cuju/render/web/js/watch/presets.js +201 -0
  335. cuju/render/web/js/world/arenas.js +997 -0
  336. cuju/render/web/js/world/ball.js +204 -0
  337. cuju/render/web/js/world/cameras.js +982 -0
  338. cuju/render/web/js/world/crowd.js +376 -0
  339. cuju/render/web/js/world/field.js +227 -0
  340. cuju/render/web/js/world/framing.js +145 -0
  341. cuju/render/web/js/world/occlusion.js +48 -0
  342. cuju/render/web/js/world/pitch.js +703 -0
  343. cuju/render/web/js/world/scene.js +395 -0
  344. cuju/render/web/js/world/sky.js +325 -0
  345. cuju/render/web/js/world/stadium.js +1262 -0
  346. cuju/render/web/js/world/vendor-sky.js +367 -0
  347. cuju/render/web/js/world/weather.js +264 -0
  348. cuju/render/web/languages/en.json +4750 -0
  349. cuju/render/web/lessons.json +137 -0
  350. cuju/render/web/manifest.webmanifest +23 -0
  351. cuju/render/web/style.css +8399 -0
  352. cuju/render/web/sw.js +235 -0
  353. cuju/render/web/vendor/fabric/LICENSE +16 -0
  354. cuju/render/web/vendor/fabric/fabric.min.mjs +1 -0
  355. cuju/render/web/vendor/lucide/LICENSE +43 -0
  356. cuju/render/web/vendor/lucide/icons.js +141 -0
  357. cuju/render/web/vendor/three/LICENSE +21 -0
  358. cuju/render/web/vendor/three/build/three.core.js +60586 -0
  359. cuju/render/web/vendor/three/build/three.module.js +19719 -0
  360. cuju/render/web/vendor/three/examples/jsm/loaders/GLTFLoader.js +4925 -0
  361. cuju/render/web/vendor/three/examples/jsm/postprocessing/EffectComposer.js +365 -0
  362. cuju/render/web/vendor/three/examples/jsm/postprocessing/MaskPass.js +195 -0
  363. cuju/render/web/vendor/three/examples/jsm/postprocessing/OutputPass.js +148 -0
  364. cuju/render/web/vendor/three/examples/jsm/postprocessing/Pass.js +191 -0
  365. cuju/render/web/vendor/three/examples/jsm/postprocessing/RenderPass.js +193 -0
  366. cuju/render/web/vendor/three/examples/jsm/postprocessing/ShaderPass.js +135 -0
  367. cuju/render/web/vendor/three/examples/jsm/postprocessing/UnrealBloomPass.js +541 -0
  368. cuju/render/web/vendor/three/examples/jsm/shaders/CopyShader.js +52 -0
  369. cuju/render/web/vendor/three/examples/jsm/shaders/LuminosityHighPassShader.js +68 -0
  370. cuju/render/web/vendor/three/examples/jsm/shaders/OutputShader.js +103 -0
  371. cuju/render/web/vendor/three/examples/jsm/utils/BufferGeometryUtils.js +1501 -0
  372. cuju/render/web/vendor/three/examples/jsm/utils/SkeletonUtils.js +496 -0
  373. cuju_render-0.1.0.dist-info/METADATA +116 -0
  374. cuju_render-0.1.0.dist-info/RECORD +382 -0
  375. cuju_render-0.1.0.dist-info/WHEEL +4 -0
  376. cuju_render-0.1.0.dist-info/licenses/LICENSE +202 -0
  377. cuju_render-0.1.0.dist-info/licenses/LICENSES/CC-BY-4.0.txt +396 -0
  378. cuju_render-0.1.0.dist-info/licenses/LICENSES/CC0-1.0.txt +127 -0
  379. cuju_render-0.1.0.dist-info/licenses/LICENSES/ISC.txt +16 -0
  380. cuju_render-0.1.0.dist-info/licenses/LICENSES/MIT.txt +24 -0
  381. cuju_render-0.1.0.dist-info/licenses/LICENSES/Unlicense.txt +13 -0
  382. cuju_render-0.1.0.dist-info/licenses/NOTICE +35 -0
@@ -0,0 +1,521 @@
1
+ // Copyright 2026 The cuju Authors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // The Home page, the first page of the viewer, laid out as a landing page. A wide opening band
5
+ // carries the logo as the name, a line on what the viewer does and the ways into its pages. Below
6
+ // it the page runs down in bands, the live sources and the newest recordings with a way into each,
7
+ // or a first run guide while the library is empty, then what the viewer does, the keys of the
8
+ // Watch page, a note on what cuju is with links to the renderer and the engine, and the versions
9
+ // of both. Every text from the server goes into the page as text, never as markup.
10
+
11
+ import { api, formatDate } from '../core/api.js';
12
+ import { el as h } from '../core/menu.js';
13
+ import { recordingTitle, summaryTeams } from '../core/names.js';
14
+ import { scenarioName } from '../core/scenarios.js';
15
+ import { t, tn } from '../core/i18n.js';
16
+ import { icon, reicon, relabel, symbolOnly } from '../core/icons.js';
17
+ import { chord } from '../core/keys.js';
18
+
19
+ const REFRESH_MS = 8000;
20
+ const LATEST = 5;
21
+ const SVG_NS = 'http://www.w3.org/2000/svg';
22
+
23
+ // Each link names its messages, home.links.<key>.label and .hint. The first five lead to the
24
+ // renderer, cuju-render, and the last three to the engine, cuju.
25
+ const LINKS = [
26
+ ['repository', 'https://github.com/AndreKoraleski/cuju-render'],
27
+ ['rendering', 'https://github.com/AndreKoraleski/cuju-render/blob/main/docs/rendering.md'],
28
+ ['issues', 'https://github.com/AndreKoraleski/cuju-render/issues'],
29
+ ['changelog', 'https://github.com/AndreKoraleski/cuju-render/blob/main/CHANGELOG.md'],
30
+ ['pypi', 'https://pypi.org/project/cuju-render/'],
31
+ ['engine', 'https://github.com/AndreKoraleski/cuju'],
32
+ ['documentation', 'https://github.com/AndreKoraleski/cuju/tree/main/docs'],
33
+ ['enginePypi', 'https://pypi.org/project/cuju/'],
34
+ ];
35
+ const NOTICE_URL = 'https://github.com/AndreKoraleski/cuju-render/blob/main/NOTICE';
36
+
37
+ // What the viewer does, each with the symbol of the page that shows it and its messages
38
+ // home.feature.<name>.title and .text, whose placeholder {code} is the code of the part.
39
+ const FEATURES = [
40
+ ['camera', 'video'],
41
+ ['replay', 'replay'],
42
+ ['shirt', 'shirt'],
43
+ ['live', 'live', 'CUJU_RENDER=on'],
44
+ ['podium', 'podium'],
45
+ ['field', 'field'],
46
+ ];
47
+
48
+ // Each key group lists its rows, each row its keys, where a key is a chord such as `Shift R`
49
+ // that the keyboard kit draws, and `to` joins a range. The group's name is the message
50
+ // home.keys.<group>.title and each row's text home.keys.<group>.<row>.
51
+ const KEYS = [
52
+ ['cameras', [
53
+ [['V'], 'cycle'],
54
+ [['B'], 'ball'],
55
+ [['P'], 'owner'],
56
+ [['1', 'to', '0'], 'players'],
57
+ [['G'], 'goalkeeper'],
58
+ [['W', 'A', 'S', 'D'], 'fly'],
59
+ [['Q', 'E'], 'height'],
60
+ ]],
61
+ ['playback', [
62
+ [['Space'], 'play'],
63
+ [['J', 'K', 'L'], 'shuttle'],
64
+ [['Left', 'Right'], 'step'],
65
+ [['N'], 'next'],
66
+ ]],
67
+ ['replays', [
68
+ [['R'], 'last'],
69
+ [['Shift R'], 'angles'],
70
+ [['Enter'], 'skip'],
71
+ [['Esc'], 'end'],
72
+ ]],
73
+ ['screen', [
74
+ [['T'], 'tv'],
75
+ [['F'], 'fullscreen'],
76
+ [['M'], 'mute'],
77
+ [['H'], 'shortcuts'],
78
+ ]],
79
+ ];
80
+
81
+ function createdMs(m) {
82
+ if (typeof m.created === 'number') {
83
+ return m.created < 1e12 ? m.created * 1000 : m.created;
84
+ }
85
+ return Date.parse(m.created) || 0;
86
+ }
87
+
88
+ // An element of an SVG drawing, with its attributes and children.
89
+ function svg(tag, attrs = {}, ...children) {
90
+ const node = document.createElementNS(SVG_NS, tag);
91
+ for (const [k, v] of Object.entries(attrs)) {
92
+ node.setAttribute(k, String(v));
93
+ }
94
+ node.append(...children);
95
+ return node;
96
+ }
97
+
98
+ // The markings of a football pitch of 105 by 68 meters in tenths of a meter, drawn behind the
99
+ // opening band as a quiet backdrop.
100
+ function pitchArt() {
101
+ const line = (d) => svg('path', { d });
102
+ const spot = (cx) => svg('circle', { class: 'spot', cx, cy: 340, r: 4 });
103
+ const drawing = svg('svg', { class: 'home-pitch', viewBox: '-40 -20 1130 720', 'aria-hidden': 'true', focusable: 'false' },
104
+ line('M0 0H1050V680H0Z'),
105
+ line('M525 0V680'),
106
+ svg('circle', { cx: 525, cy: 340, r: 91.5 }),
107
+ line('M0 138.5H165V541.5H0'),
108
+ line('M1050 138.5H885V541.5H1050'),
109
+ line('M0 248.4H55V431.6H0'),
110
+ line('M1050 248.4H995V431.6H1050'),
111
+ line('M165 266.9A91.5 91.5 0 0 1 165 413.1'),
112
+ line('M885 266.9A91.5 91.5 0 0 0 885 413.1'),
113
+ line('M10 0A10 10 0 0 1 0 10'),
114
+ line('M1040 0A10 10 0 0 0 1050 10'),
115
+ line('M0 670A10 10 0 0 1 10 680'),
116
+ line('M1050 670A10 10 0 0 0 1040 680'),
117
+ line('M0 303.4H-20V376.6H0'),
118
+ line('M1050 303.4H1070V376.6H1050'),
119
+ spot(110), spot(525), spot(940),
120
+ svg('circle', { class: 'ball', cx: 760, cy: 250, r: 7 }));
121
+ return h('div', { class: 'home-pitch-frame', 'aria-hidden': 'true' }, drawing);
122
+ }
123
+
124
+ // The head of a band, a heading with an optional line above it and an optional control at its right.
125
+ function bandHead(id, title, { eyebrow, aside, level = 'h2' } = {}) {
126
+ return h('div', { class: 'home-head' },
127
+ h('div', { class: 'home-head-text' },
128
+ eyebrow ? h('p', { class: 'home-eyebrow' }, eyebrow) : null,
129
+ h(level, { id, class: 'home-h2' }, title)),
130
+ aside || null);
131
+ }
132
+
133
+ // A command to copy, with a button that puts it on the clipboard.
134
+ function command(text) {
135
+ const button = h('button', { type: 'button', class: 'btn small ghost home-copy', ...symbolOnly(t('home.copy.label', { command: text })) }, icon('copy'));
136
+ // The button names what it did for a moment, its check mark showing the copy.
137
+ const tell = (label, symbol) => {
138
+ relabel(button, label);
139
+ reicon(button, symbol);
140
+ };
141
+ button.addEventListener('click', async () => {
142
+ try {
143
+ await navigator.clipboard.writeText(text);
144
+ tell(t('home.copy.done'), 'check');
145
+ } catch {
146
+ // Without the clipboard the text is selected, so a key press copies it.
147
+ const range = document.createRange();
148
+ range.selectNodeContents(code);
149
+ const sel = window.getSelection();
150
+ sel.removeAllRanges();
151
+ sel.addRange(range);
152
+ tell(t('home.copy.selected'), 'check');
153
+ }
154
+ setTimeout(() => {
155
+ tell(t('home.copy.label', { command: text }), 'copy');
156
+ }, 1600);
157
+ });
158
+ const code = h('code', {}, text);
159
+ return h('div', { class: 'home-command' }, code, button);
160
+ }
161
+
162
+ function keyChord(keys) {
163
+ return keys.flatMap((k, i) => {
164
+ const node = k === 'to' ? h('span', { class: 'home-key-word' }, t('home.keys.to')) : chord(k);
165
+ return i ? [' ', node] : [node];
166
+ });
167
+ }
168
+
169
+ // The bare mark in both grays, the light one for the dark theme and the dark one for the light
170
+ // theme, of which style.css shows the one that suits the theme in force. Home is the page's own
171
+ // surface, so the mark stands on it without its tile.
172
+ function themedMark(className, alt, side) {
173
+ return [['cuju-mark.svg', 'mark-for-dark'], ['cuju-mark-light.svg', 'mark-for-light']].map(([file, theme]) => h('img', {
174
+ class: `${className} ${theme}`, src: `assets/${file}`, alt, width: side, height: side,
175
+ }));
176
+ }
177
+
178
+ function newTab(label) {
179
+ return [label, h('span', { class: 'sr-only' }, t('home.newtab'))];
180
+ }
181
+
182
+ export class HomePage {
183
+ constructor(app) {
184
+ this.app = app;
185
+ this.root = document.getElementById('page-home');
186
+ this.timer = null;
187
+ this.token = 0;
188
+ this.shown = false;
189
+ this.signature = null;
190
+ this.build();
191
+ // A file chosen from this page plays on the Watch page.
192
+ const input = document.getElementById('file-input');
193
+ if (input) {
194
+ input.addEventListener('change', () => {
195
+ if (this.app.page === 'home' && this.pickedFile) {
196
+ this.app.showPage('watch');
197
+ }
198
+ this.pickedFile = false;
199
+ });
200
+ }
201
+ document.addEventListener('visibilitychange', () => {
202
+ if (this.shown && !document.hidden) {
203
+ this.refresh();
204
+ }
205
+ });
206
+ this.loadVersion();
207
+ }
208
+
209
+ show() {
210
+ this.shown = true;
211
+ clearInterval(this.timer);
212
+ this.timer = setInterval(() => {
213
+ if (!document.hidden) {
214
+ this.refresh();
215
+ }
216
+ }, REFRESH_MS);
217
+ this.refresh();
218
+ }
219
+
220
+ hide() {
221
+ this.shown = false;
222
+ clearInterval(this.timer);
223
+ this.timer = null;
224
+ // An answer that arrives after the page is left is dropped.
225
+ this.token++;
226
+ }
227
+
228
+ build() {
229
+ // The live sources and the recordings, or the guide or the offline note in their place.
230
+ this.status = h('div', { class: 'home-status', 'aria-live': 'polite' },
231
+ h('p', { class: 'muted home-checking' }, t('home.status.asking')));
232
+ this.root.replaceChildren(h('div', { class: 'home' },
233
+ this.hero(),
234
+ h('div', { class: 'home-band home-now' }, h('div', { class: 'home-wrap' }, this.status)),
235
+ this.featuresBand(),
236
+ this.keysBand(),
237
+ this.footBand()));
238
+ }
239
+
240
+ // The opening band, the logo as the name, the line beneath it and the ways into the pages.
241
+ hero() {
242
+ const go = (page) => () => this.app.showPage(page);
243
+ this.glanceLive = h('span', { class: 'home-glance-item live' });
244
+ this.glanceRecordings = h('button', { type: 'button', class: 'home-glance-item link', onclick: go('recordings') });
245
+ // A glance at what the server holds, shown once both counts are known.
246
+ this.glance = h('p', { class: 'home-glance', hidden: true }, this.glanceLive, this.glanceRecordings);
247
+ return h('header', { class: 'home-hero' },
248
+ pitchArt(),
249
+ h('div', { class: 'home-wrap home-hero-inner' },
250
+ h('p', { class: 'home-eyebrow' }, t('home.hero.eyebrow')),
251
+ h('h1', { class: 'home-title' },
252
+ themedMark('home-wordmark', t('structure.name'), '408')),
253
+ h('p', { class: 'home-tagline' }, t('home.hero.tagline')),
254
+ h('p', { class: 'home-lede' }, t('home.hero.lede')),
255
+ h('nav', { class: 'home-actions', 'aria-label': t('home.hero.pages') },
256
+ h('button', { type: 'button', class: 'btn primary home-cta', onclick: go('watch') }, icon('watch'), t('home.hero.watch')),
257
+ h('button', { type: 'button', class: 'btn', onclick: go('play') }, icon('gamepad'), t('home.hero.play')),
258
+ h('button', { type: 'button', class: 'btn', onclick: go('challenges') }, icon('challenges'), t('home.hero.challenges')),
259
+ h('button', { type: 'button', class: 'btn', onclick: go('matches') }, icon('matches'), t('home.hero.matches')),
260
+ h('button', { type: 'button', class: 'btn', onclick: go('teams') }, icon('shirt'), t('home.hero.teams')),
261
+ h('button', { type: 'button', class: 'btn', onclick: go('field') }, icon('field'), t('home.hero.field'))),
262
+ this.glance));
263
+ }
264
+
265
+ featuresBand() {
266
+ const items = FEATURES.map(([name, symbol, code]) => h('li', { class: 'home-feature' },
267
+ icon(symbol, 'home-icon'),
268
+ h('h3', {}, t(`home.feature.${name}.title`)),
269
+ h('p', {}, ...tn(`home.feature.${name}.text`, code ? { code: h('code', {}, code) } : {}))));
270
+ return h('section', { class: 'home-band home-features', 'aria-labelledby': 'home-features-title' },
271
+ h('div', { class: 'home-wrap' },
272
+ bandHead('home-features-title', t('home.features.title'), { eyebrow: t('home.features.eyebrow') }),
273
+ h('ul', { class: 'home-feature-list' }, ...items)));
274
+ }
275
+
276
+ keysBand() {
277
+ const groups = KEYS.map(([name, rows]) => h('div', { class: 'home-keys-group' },
278
+ h('h3', {}, t(`home.keys.${name}.title`)),
279
+ h('dl', {}, ...rows.flatMap(([keys, row]) => [h('dt', {}, ...keyChord(keys)), h('dd', {}, tn(`home.keys.${name}.${row}`))]))));
280
+ const all = h('button', { type: 'button', class: 'btn ghost', onclick: () => {
281
+ const btn = document.getElementById('open-help');
282
+ if (btn) {
283
+ btn.click();
284
+ }
285
+ } }, icon('keyboard'), ...tn('home.keys.all'));
286
+ return h('section', { class: 'home-band home-keys', 'aria-labelledby': 'home-keys-title' },
287
+ h('div', { class: 'home-wrap' },
288
+ bandHead('home-keys-title', t('home.keys.title'), { eyebrow: t('home.keys.eyebrow'), aside: all }),
289
+ h('div', { class: 'home-keys-grid' }, ...groups)));
290
+ }
291
+
292
+ // The foot of the page, what cuju is with its credits, the links and the version.
293
+ footBand() {
294
+ this.version = h('span', { class: 'home-version', hidden: true });
295
+ const links = LINKS.map(([key, href]) => h('li', {},
296
+ h('a', { href, target: '_blank', rel: 'noopener noreferrer', class: 'home-link' },
297
+ h('span', { class: 'home-link-label' }, ...newTab(t(`home.links.${key}.label`))),
298
+ h('span', { class: 'home-link-hint' }, t(`home.links.${key}.hint`)))));
299
+ const notice = h('a', { href: NOTICE_URL, target: '_blank', rel: 'noopener noreferrer' }, ...newTab('NOTICE'));
300
+ const about = h('section', { class: 'home-about', 'aria-labelledby': 'home-about-title' },
301
+ bandHead('home-about-title', t('home.about.title')),
302
+ h('p', {}, tn('home.about.runs')),
303
+ h('p', {}, tn('home.about.watch')),
304
+ h('p', {}, h('a', { href: 'https://en.wikipedia.org/wiki/Cuju', target: '_blank', rel: 'noopener noreferrer' },
305
+ ...newTab(t('home.about.name')))),
306
+ h('p', { class: 'home-credits' }, ...tn('home.about.credits', { notice })));
307
+ const linkList = h('section', { class: 'home-links', 'aria-labelledby': 'home-links-title' },
308
+ bandHead('home-links-title', t('home.links.title')),
309
+ h('ul', { class: 'home-link-list' }, ...links));
310
+ return h('footer', { class: 'home-band home-foot' },
311
+ h('div', { class: 'home-wrap' },
312
+ h('div', { class: 'home-foot-grid' }, about, linkList),
313
+ h('div', { class: 'home-colophon' },
314
+ themedMark('home-colophon-logo', '', '22'),
315
+ h('span', {}, t('home.license')),
316
+ this.version)));
317
+ }
318
+
319
+ // The installed version of the renderer with that of cuju, shown only when the server offers
320
+ // them.
321
+ async loadVersion() {
322
+ if (typeof api.info !== 'function') {
323
+ return;
324
+ }
325
+ try {
326
+ const info = await api.info();
327
+ if (info && typeof info.version === 'string' && info.version) {
328
+ const engine = typeof info.cuju === 'string' && info.cuju;
329
+ this.version.textContent = engine
330
+ ? t('home.versions', { version: info.version, engine })
331
+ : t('home.version', { version: info.version });
332
+ this.version.hidden = false;
333
+ }
334
+ } catch {
335
+ // An older server has no version to show, the line stays hidden.
336
+ }
337
+ }
338
+
339
+ async refresh() {
340
+ const token = ++this.token;
341
+ const [live, matches] = await Promise.allSettled([api.live(), api.matches()]);
342
+ if (token !== this.token) {
343
+ return;
344
+ }
345
+ const failed = [live, matches].filter((r) => r.status === 'rejected').map((r) => r.reason);
346
+ const offline = failed.some((err) => !err || !err.status);
347
+ if (this.app.library && typeof this.app.library.setOffline === 'function') {
348
+ this.app.library.setOffline(offline);
349
+ }
350
+ const state = {
351
+ offline,
352
+ live: live.status === 'fulfilled' && Array.isArray(live.value) ? live.value : null,
353
+ liveError: live.status === 'rejected' ? String(live.reason && live.reason.message || live.reason) : null,
354
+ matches: matches.status === 'fulfilled' && Array.isArray(matches.value) ? matches.value : null,
355
+ matchesError: matches.status === 'rejected' ? String(matches.reason && matches.reason.message || matches.reason) : null,
356
+ };
357
+ // The same answer leaves the page as it is, so the focus and the hover stay put.
358
+ const signature = JSON.stringify(state);
359
+ if (signature === this.signature) {
360
+ return;
361
+ }
362
+ this.signature = signature;
363
+ this.renderStatus(state);
364
+ }
365
+
366
+ renderStatus(state) {
367
+ const known = !state.offline && state.live && state.matches;
368
+ this.glance.hidden = !known;
369
+ if (known) {
370
+ const on = state.live.length > 0;
371
+ this.glanceLive.classList.toggle('on', on);
372
+ this.glanceLive.replaceChildren(
373
+ h('i', { class: 'home-live-dot', 'aria-hidden': 'true' }),
374
+ on ? t('home.glance.live', { count: state.live.length }) : t('home.glance.none'));
375
+ this.glanceRecordings.textContent = t('home.glance.recordings', { count: state.matches.length });
376
+ }
377
+ // The focus returns to the same control after a redraw.
378
+ const active = document.activeElement;
379
+ const focusKey = active && this.status.contains(active) ? active.dataset.focusKey : null;
380
+ let parts;
381
+ if (state.offline) {
382
+ parts = [this.offlineBlock()];
383
+ } else if (state.live && state.matches && !state.live.length && !state.matches.length) {
384
+ parts = [this.firstRunBlock()];
385
+ } else {
386
+ parts = [this.liveBlock(state), this.recordingsBlock(state)];
387
+ }
388
+ this.status.replaceChildren(...parts);
389
+ if (focusKey) {
390
+ const again = this.status.querySelector(`[data-focus-key="${CSS.escape(focusKey)}"]`);
391
+ if (again) {
392
+ again.focus();
393
+ }
394
+ }
395
+ }
396
+
397
+ openFile() {
398
+ const input = document.getElementById('file-input');
399
+ if (input) {
400
+ this.pickedFile = true;
401
+ input.click();
402
+ }
403
+ }
404
+
405
+ offlineBlock() {
406
+ return h('section', { class: 'home-block home-wide home-offline', 'aria-labelledby': 'home-offline-title' },
407
+ bandHead('home-offline-title', t('home.offline.title')),
408
+ h('div', { class: 'home-prose' },
409
+ h('p', {}, tn('home.offline.text')),
410
+ command('cuju render serve --open'),
411
+ h('div', { class: 'home-row' },
412
+ h('button', { type: 'button', class: 'btn primary', 'data-focus-key': 'open-file', onclick: () => this.openFile() }, icon('folder'), t('home.openFile')),
413
+ h('button', { type: 'button', class: 'btn', 'data-focus-key': 'retry', ...symbolOnly(t('home.offline.retry')), onclick: () => this.refresh() }, icon('refresh')))));
414
+ }
415
+
416
+ firstRunBlock() {
417
+ const step = (n, title, text, ...extra) => h('li', { class: 'home-step' },
418
+ h('span', { class: 'home-step-n', 'aria-hidden': 'true' }, String(n)),
419
+ h('h3', {}, title),
420
+ h('p', {}, text),
421
+ ...extra);
422
+ return h('section', { class: 'home-block home-wide home-first', 'aria-labelledby': 'home-first-title' },
423
+ bandHead('home-first-title', t('home.first.title'), { eyebrow: t('home.first.eyebrow') }),
424
+ h('p', { class: 'home-intro' }, t('home.first.intro')),
425
+ h('ol', { class: 'home-steps' },
426
+ step(1, t('home.first.serve.title'), tn('home.first.serve.text'),
427
+ command('cuju render serve --open')),
428
+ step(2, t('home.first.stream.title'), tn('home.first.stream.text'),
429
+ command('CUJU_RENDER=on python train.py')),
430
+ step(3, t('home.first.record.title'), tn('home.first.record.text', { code: h('code', {}, 'cuju.render.Recorder') }),
431
+ h('div', { class: 'home-row' },
432
+ h('button', { type: 'button', class: 'btn', 'data-focus-key': 'first-matches', onclick: () => this.app.showPage('matches') }, icon('matches'), t('home.requestMatch')),
433
+ h('button', { type: 'button', class: 'btn ghost', 'data-focus-key': 'first-file', onclick: () => this.openFile() }, icon('folder'), t('home.openFile'))))));
434
+ }
435
+
436
+ liveBlock(state) {
437
+ const list = state.live || [];
438
+ const count = list.length
439
+ ? h('span', { class: 'home-live-count' }, h('i', { class: 'home-live-dot', 'aria-hidden': 'true' }), t('home.live.count', { count: list.length }))
440
+ : null;
441
+ let body;
442
+ if (state.liveError) {
443
+ body = h('p', { class: 'home-empty error-text' }, t('home.live.error', { error: state.liveError }));
444
+ } else if (!list.length) {
445
+ body = h('p', { class: 'home-empty muted' }, ...tn('home.live.empty', { code: h('code', {}, 'CUJU_RENDER=on') }));
446
+ } else {
447
+ body = h('ul', { class: 'home-list' }, ...list.map((s) => {
448
+ const meta = [scenarioName(s.scenario), Number.isFinite(s.environment) ? t('home.live.environment', { index: s.environment }) : null].filter(Boolean);
449
+ return h('li', { class: 'home-item live' },
450
+ h('div', { class: 'home-item-main' },
451
+ h('p', { class: 'home-item-title' }, recordingTitle(s) || s.id),
452
+ h('p', { class: 'home-item-meta' }, ...meta.map((m) => h('span', {}, m)))),
453
+ h('button', {
454
+ type: 'button',
455
+ class: 'btn small primary',
456
+ 'data-focus-key': `live:${s.id}`,
457
+ ...symbolOnly(t('home.live.watch.label', { title: recordingTitle(s) || s.id })),
458
+ onclick: () => this.app.openLive(s.id),
459
+ }, icon('play')));
460
+ }));
461
+ }
462
+ return h('section', { class: 'home-block home-live', 'aria-labelledby': 'home-live-title' },
463
+ bandHead('home-live-title', t('home.live.title'), { aside: count }), body);
464
+ }
465
+
466
+ recordingsBlock(state) {
467
+ const all = (state.matches || []).slice().sort((a, b) => createdMs(b) - createdMs(a));
468
+ const latest = all.slice(0, LATEST);
469
+ const more = h('button', {
470
+ type: 'button',
471
+ class: 'link home-more',
472
+ 'data-focus-key': 'all-recordings',
473
+ onclick: () => this.app.showPage('recordings'),
474
+ }, all.length > LATEST ? t('home.recordings.all', { count: all.length }) : t('home.recordings.open'));
475
+ let body;
476
+ if (state.matchesError) {
477
+ body = h('p', { class: 'home-empty error-text' }, t('home.recordings.error', { error: state.matchesError }));
478
+ } else if (!latest.length) {
479
+ body = h('div', { class: 'home-empty' },
480
+ h('p', { class: 'muted' }, ...tn('home.recordings.empty', { code: h('code', {}, 'cuju.render.Recorder') })),
481
+ h('div', { class: 'home-row' },
482
+ h('button', { type: 'button', class: 'btn', 'data-focus-key': 'rec-matches', onclick: () => this.app.showPage('matches') }, icon('matches'), t('home.requestMatch'))));
483
+ } else {
484
+ body = h('ul', { class: 'home-list' }, ...latest.map((m) => this.recordingItem(m)));
485
+ }
486
+ return h('section', { class: 'home-block home-recordings', 'aria-labelledby': 'home-rec-title' },
487
+ bandHead('home-rec-title', t('home.recordings.title'), { aside: more }), body);
488
+ }
489
+
490
+ recordingItem(m) {
491
+ const teams = summaryTeams(m);
492
+ const score = Array.isArray(m.score) ? m.score : null;
493
+ const board = teams.length === 2
494
+ ? h('p', { class: 'home-board' },
495
+ h('span', { class: 'home-board-team left' }, teams[0]),
496
+ h('span', { class: 'home-score' },
497
+ h('span', { 'aria-hidden': 'true' }, score ? String(score[0]) : '-'),
498
+ h('span', { 'aria-hidden': 'true' }, score ? String(score[1]) : '-'),
499
+ h('span', { class: 'sr-only' }, ` ${score ? t('home.score', { left: score[0], right: score[1] }) : t('home.score.none')} `)),
500
+ h('span', { class: 'home-board-team right' }, teams[1]))
501
+ : null;
502
+ const date = formatDate(m.created);
503
+ const meta = [scenarioName(m.scenario), date].filter(Boolean);
504
+ const title = recordingTitle(m) || m.id;
505
+ // A title that only names the two teams says what the scoreboard below it says.
506
+ const english = Array.isArray(m.teams) ? `${m.teams[0]} against ${m.teams[1]}` : null;
507
+ const plain = board && (m.title_id === 'server.names.against' || (!m.title_id && m.title === english));
508
+ return h('li', { class: 'home-item' },
509
+ h('div', { class: 'home-item-main' },
510
+ plain ? null : h('p', { class: 'home-item-title' }, title),
511
+ board,
512
+ h('p', { class: 'home-item-meta' }, ...meta.map((x) => h('span', {}, x)))),
513
+ h('button', {
514
+ type: 'button',
515
+ class: 'btn small',
516
+ 'data-focus-key': `rec:${m.id}`,
517
+ ...symbolOnly(t('home.recordings.play.label', { title })),
518
+ onclick: () => this.app.openMatchInWatch(m.id),
519
+ }, icon('play')));
520
+ }
521
+ }