@omerdlw/base-framework 3.4.0 → 4.0.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 (840) hide show
  1. package/README.md +56 -72
  2. package/dist/ambient/index.js +9 -10
  3. package/dist/ambient/server/index.js +3 -3
  4. package/dist/ambient/server/index.js.map +1 -1
  5. package/dist/ambient/worker/index.js +7 -4
  6. package/dist/ambient/worker/index.js.map +1 -1
  7. package/dist/background/index.js +8 -9
  8. package/dist/{chunk-KOYTJW5E.js → chunk-3FSDBJ7V.js} +7 -7
  9. package/dist/chunk-3FSDBJ7V.js.map +1 -0
  10. package/dist/{chunk-CRKJAACG.js → chunk-4QQ3QVY7.js} +10 -10
  11. package/dist/{chunk-CRKJAACG.js.map → chunk-4QQ3QVY7.js.map} +1 -1
  12. package/dist/{chunk-UQLTP3XB.js → chunk-5TQSH6KE.js} +143 -144
  13. package/dist/chunk-5TQSH6KE.js.map +1 -0
  14. package/dist/{chunk-HFR6YROB.js → chunk-6P3F4JU3.js} +1160 -1172
  15. package/dist/chunk-6P3F4JU3.js.map +1 -0
  16. package/dist/chunk-AKPH5CEJ.js +357 -0
  17. package/dist/chunk-AKPH5CEJ.js.map +1 -0
  18. package/dist/{chunk-QGPRTUED.js → chunk-AWLK2I56.js} +35 -39
  19. package/dist/chunk-AWLK2I56.js.map +1 -0
  20. package/dist/{chunk-ZXRE2KZO.js → chunk-C3SEBNF5.js} +11 -15
  21. package/dist/chunk-C3SEBNF5.js.map +1 -0
  22. package/dist/{chunk-R4K6VAOK.js → chunk-C527JOJQ.js} +11 -18
  23. package/dist/chunk-C527JOJQ.js.map +1 -0
  24. package/dist/{chunk-VNSMNGWP.js → chunk-DMQKXBWO.js} +5 -5
  25. package/dist/{chunk-VNSMNGWP.js.map → chunk-DMQKXBWO.js.map} +1 -1
  26. package/dist/{chunk-IH3STE7W.js → chunk-ED32WLAD.js} +1168 -1215
  27. package/dist/chunk-ED32WLAD.js.map +1 -0
  28. package/dist/{chunk-67MOKJFZ.js → chunk-EXB7VFD3.js} +16 -16
  29. package/dist/chunk-EXB7VFD3.js.map +1 -0
  30. package/dist/chunk-FG2AKFXP.js +108 -0
  31. package/dist/chunk-FG2AKFXP.js.map +1 -0
  32. package/dist/chunk-GA5SZ6E2.js +17 -0
  33. package/dist/{chunk-AZ2ZDFNP.js.map → chunk-GA5SZ6E2.js.map} +1 -1
  34. package/dist/chunk-GG2ILNK2.js +44 -0
  35. package/dist/chunk-GG2ILNK2.js.map +1 -0
  36. package/dist/{chunk-6IP6YFQX.js → chunk-JA75E4BG.js} +21 -31
  37. package/dist/chunk-JA75E4BG.js.map +1 -0
  38. package/dist/{chunk-WQTMOUCA.js → chunk-JWUKAZ3A.js} +45 -67
  39. package/dist/chunk-JWUKAZ3A.js.map +1 -0
  40. package/dist/{chunk-LKYW4LH6.js → chunk-QZA5AIT6.js} +37 -47
  41. package/dist/chunk-QZA5AIT6.js.map +1 -0
  42. package/dist/{chunk-D222OCTV.js → chunk-S67HGKJ2.js} +49 -55
  43. package/dist/chunk-S67HGKJ2.js.map +1 -0
  44. package/dist/chunk-T53WFIZN.js +29 -0
  45. package/dist/chunk-T53WFIZN.js.map +1 -0
  46. package/dist/{chunk-RDYYP36I.js → chunk-TMKA5ZHO.js} +7 -6
  47. package/dist/chunk-TMKA5ZHO.js.map +1 -0
  48. package/dist/{chunk-XGAYTDSI.js → chunk-UWX7GCNX.js} +23 -26
  49. package/dist/chunk-UWX7GCNX.js.map +1 -0
  50. package/dist/{chunk-QRXDXAQI.js → chunk-WVED7PDH.js} +161 -165
  51. package/dist/chunk-WVED7PDH.js.map +1 -0
  52. package/dist/{chunk-FFJWJ4OB.js → chunk-XIFQMK2Z.js} +12317 -12355
  53. package/dist/chunk-XIFQMK2Z.js.map +1 -0
  54. package/dist/{chunk-BMFHS3GV.js → chunk-YHWA7FXX.js} +22 -12
  55. package/dist/chunk-YHWA7FXX.js.map +1 -0
  56. package/dist/{chunk-YZS2B6YE.js → chunk-YKHAFHB7.js} +9 -12
  57. package/dist/chunk-YKHAFHB7.js.map +1 -0
  58. package/dist/{chunk-GKAJ4EM2.js → chunk-ZQI4ZCVU.js} +83 -83
  59. package/dist/chunk-ZQI4ZCVU.js.map +1 -0
  60. package/dist/context-menu/index.js +13 -15
  61. package/dist/controls/index.js +7 -6
  62. package/dist/core/error/boundary.d.ts.map +1 -1
  63. package/dist/core/error/constants.d.ts +9 -0
  64. package/dist/core/error/constants.d.ts.map +1 -1
  65. package/dist/core/error/index.d.ts +2 -3
  66. package/dist/core/error/index.d.ts.map +1 -1
  67. package/dist/core/error/listener.d.ts.map +1 -1
  68. package/dist/core/error/reporter.d.ts +7 -6
  69. package/dist/core/error/reporter.d.ts.map +1 -1
  70. package/dist/core/error/utils.d.ts.map +1 -1
  71. package/dist/core/kernel/constants.d.ts +1 -1
  72. package/dist/core/kernel/constants.d.ts.map +1 -1
  73. package/dist/core/kernel/{compose.d.ts → host/compose.d.ts} +0 -4
  74. package/dist/core/kernel/host/compose.d.ts.map +1 -0
  75. package/dist/core/kernel/{installed.d.ts → host/installed.d.ts} +1 -1
  76. package/dist/core/kernel/host/installed.d.ts.map +1 -0
  77. package/dist/core/kernel/{module.d.ts → host/module.d.ts} +2 -5
  78. package/dist/core/kernel/host/module.d.ts.map +1 -0
  79. package/dist/core/kernel/{adapters.d.ts → host/registration.d.ts} +2 -2
  80. package/dist/core/kernel/host/registration.d.ts.map +1 -0
  81. package/dist/core/kernel/index.d.ts +12 -12
  82. package/dist/core/kernel/index.d.ts.map +1 -1
  83. package/dist/core/kernel/{page-controller.d.ts → page.d.ts} +2 -2
  84. package/dist/core/kernel/page.d.ts.map +1 -0
  85. package/dist/core/kernel/{handlers.d.ts → registry/apply.d.ts} +2 -2
  86. package/dist/core/kernel/registry/apply.d.ts.map +1 -0
  87. package/dist/core/kernel/{hooks.d.ts → registry/hooks.d.ts} +1 -1
  88. package/dist/core/kernel/registry/hooks.d.ts.map +1 -0
  89. package/dist/core/kernel/{operations.d.ts → registry/operations.d.ts} +2 -2
  90. package/dist/core/kernel/registry/operations.d.ts.map +1 -0
  91. package/dist/core/kernel/{provider.d.ts → registry/provider.d.ts} +2 -2
  92. package/dist/core/kernel/registry/provider.d.ts.map +1 -0
  93. package/dist/core/kernel/{operations-records.d.ts → registry/records.d.ts} +2 -2
  94. package/dist/core/kernel/registry/records.d.ts.map +1 -0
  95. package/dist/core/kernel/registry/registration.d.ts +13 -0
  96. package/dist/core/kernel/registry/registration.d.ts.map +1 -0
  97. package/dist/core/kernel/{schema.d.ts → registry/schema.d.ts} +1 -1
  98. package/dist/core/kernel/registry/schema.d.ts.map +1 -0
  99. package/dist/core/kernel/{store-snapshots.d.ts → registry/snapshots.d.ts} +3 -3
  100. package/dist/core/kernel/registry/snapshots.d.ts.map +1 -0
  101. package/dist/core/kernel/{stabilize.d.ts → registry/stabilize.d.ts} +1 -1
  102. package/dist/core/kernel/registry/stabilize.d.ts.map +1 -0
  103. package/dist/core/kernel/{store.d.ts → registry/store.d.ts} +2 -2
  104. package/dist/core/kernel/registry/store.d.ts.map +1 -0
  105. package/dist/core/kernel/{store-subscriptions.d.ts → registry/subscriptions.d.ts} +2 -6
  106. package/dist/core/kernel/registry/subscriptions.d.ts.map +1 -0
  107. package/dist/core/kernel/{runtime.d.ts → registry/transaction.d.ts} +2 -2
  108. package/dist/core/kernel/registry/transaction.d.ts.map +1 -0
  109. package/dist/core/kernel/{types-modules.d.ts → types/modules.d.ts} +4 -4
  110. package/dist/core/kernel/types/modules.d.ts.map +1 -0
  111. package/dist/core/kernel/{types-page.d.ts → types/page.d.ts} +3 -3
  112. package/dist/core/kernel/types/page.d.ts.map +1 -0
  113. package/dist/core/kernel/{types.d.ts → types/registry.d.ts} +4 -4
  114. package/dist/core/kernel/types/registry.d.ts.map +1 -0
  115. package/dist/core/kernel/{types-store.d.ts → types/store.d.ts} +3 -3
  116. package/dist/core/kernel/types/store.d.ts.map +1 -0
  117. package/dist/core/kernel/utils.d.ts +1 -1
  118. package/dist/core/kernel/utils.d.ts.map +1 -1
  119. package/dist/core/navigation/{navigator-holds.d.ts → holds.d.ts} +2 -1
  120. package/dist/core/navigation/holds.d.ts.map +1 -0
  121. package/dist/core/navigation/navigator.d.ts.map +1 -1
  122. package/dist/core/navigation/{navigator-patience.d.ts → patience.d.ts} +1 -1
  123. package/dist/core/navigation/patience.d.ts.map +1 -0
  124. package/dist/core/navigation/{navigator-payload.d.ts → payload.d.ts} +2 -1
  125. package/dist/core/navigation/payload.d.ts.map +1 -0
  126. package/dist/core/navigation/{navigator-prefetch.d.ts → prefetch.d.ts} +2 -1
  127. package/dist/core/navigation/prefetch.d.ts.map +1 -0
  128. package/dist/core/navigation/settings.d.ts.map +1 -1
  129. package/dist/core/navigation/state.d.ts.map +1 -1
  130. package/dist/core/navigation/utils.d.ts +3 -0
  131. package/dist/core/navigation/utils.d.ts.map +1 -1
  132. package/dist/core/provider/index.d.ts +4 -9
  133. package/dist/core/provider/index.d.ts.map +1 -1
  134. package/dist/dock/index.js +12 -14
  135. package/dist/error/index.js +4 -7
  136. package/dist/events/index.js +24 -20
  137. package/dist/events/index.js.map +1 -1
  138. package/dist/foundation/events/index.d.ts.map +1 -1
  139. package/dist/foundation/recipes/index.d.ts +0 -7
  140. package/dist/foundation/recipes/index.d.ts.map +1 -1
  141. package/dist/foundation/recipes/recipe.d.ts.map +1 -1
  142. package/dist/foundation/result/index.d.ts.map +1 -1
  143. package/dist/foundation/utils/collections.d.ts +11 -0
  144. package/dist/foundation/utils/collections.d.ts.map +1 -0
  145. package/dist/foundation/utils/dom.d.ts.map +1 -1
  146. package/dist/foundation/utils/report.d.ts.map +1 -1
  147. package/dist/foundation/utils/scheduler.d.ts.map +1 -1
  148. package/dist/foundation/utils/store.d.ts.map +1 -1
  149. package/dist/foundation/utils/string.d.ts.map +1 -1
  150. package/dist/foundation/utils/tempo.d.ts.map +1 -1
  151. package/dist/foundation/utils/timing.d.ts.map +1 -1
  152. package/dist/foundation/utils/user-message.d.ts.map +1 -1
  153. package/dist/hooks/index.js +3 -3
  154. package/dist/index.js +22 -24
  155. package/dist/kernel/index.js +4 -4
  156. package/dist/loading/index.js +6 -8
  157. package/dist/media/index.js +5 -5
  158. package/dist/modal/index.js +153 -166
  159. package/dist/modal/index.js.map +1 -1
  160. package/dist/modules/ambient/{analyze.d.ts → analysis/analyze.d.ts} +3 -3
  161. package/dist/modules/ambient/analysis/analyze.d.ts.map +1 -0
  162. package/dist/modules/ambient/{analyze-bounds.d.ts → analysis/bounds.d.ts} +2 -2
  163. package/dist/modules/ambient/analysis/bounds.d.ts.map +1 -0
  164. package/dist/modules/ambient/{analyze-clusters.d.ts → analysis/clusters.d.ts} +3 -3
  165. package/dist/modules/ambient/analysis/clusters.d.ts.map +1 -0
  166. package/dist/modules/ambient/{analyze-ground.d.ts → analysis/ground.d.ts} +3 -3
  167. package/dist/modules/ambient/analysis/ground.d.ts.map +1 -0
  168. package/dist/modules/ambient/{analyze-measures.d.ts → analysis/measures.d.ts} +2 -2
  169. package/dist/modules/ambient/analysis/measures.d.ts.map +1 -0
  170. package/dist/modules/ambient/{oklab.d.ts → analysis/oklab.d.ts} +1 -3
  171. package/dist/modules/ambient/analysis/oklab.d.ts.map +1 -0
  172. package/dist/modules/ambient/analysis/quantize.d.ts.map +1 -0
  173. package/dist/modules/ambient/{analyze-swatches.d.ts → analysis/swatches.d.ts} +3 -3
  174. package/dist/modules/ambient/analysis/swatches.d.ts.map +1 -0
  175. package/dist/modules/ambient/hooks.d.ts +0 -1
  176. package/dist/modules/ambient/hooks.d.ts.map +1 -1
  177. package/dist/modules/ambient/index.d.ts +2 -2
  178. package/dist/modules/ambient/index.d.ts.map +1 -1
  179. package/dist/modules/ambient/module.d.ts +0 -3
  180. package/dist/modules/ambient/module.d.ts.map +1 -1
  181. package/dist/modules/ambient/pipeline.d.ts +6 -5
  182. package/dist/modules/ambient/pipeline.d.ts.map +1 -1
  183. package/dist/modules/ambient/server/index.d.ts +2 -2
  184. package/dist/modules/ambient/server/index.d.ts.map +1 -1
  185. package/dist/modules/ambient/settings.d.ts +0 -2
  186. package/dist/modules/ambient/settings.d.ts.map +1 -1
  187. package/dist/modules/ambient/worker/index.d.ts.map +1 -1
  188. package/dist/modules/background/constants.d.ts +3 -1
  189. package/dist/modules/background/constants.d.ts.map +1 -1
  190. package/dist/modules/background/context.d.ts +1 -1
  191. package/dist/modules/background/context.d.ts.map +1 -1
  192. package/dist/modules/background/hooks.d.ts +929 -0
  193. package/dist/modules/background/hooks.d.ts.map +1 -1
  194. package/dist/modules/background/index.d.ts +6 -6
  195. package/dist/modules/background/index.d.ts.map +1 -1
  196. package/dist/modules/background/module.d.ts +1 -1
  197. package/dist/modules/background/module.d.ts.map +1 -1
  198. package/dist/modules/background/{hooks/use-native-video-model.d.ts → native-video.d.ts} +4 -8
  199. package/dist/modules/background/native-video.d.ts.map +1 -0
  200. package/dist/modules/background/overlay.d.ts.map +1 -0
  201. package/dist/modules/background/playback.d.ts.map +1 -0
  202. package/dist/modules/background/{model/state.d.ts → state.d.ts} +11 -1
  203. package/dist/modules/background/state.d.ts.map +1 -0
  204. package/dist/modules/background/{model/visual.d.ts → visual.d.ts} +43 -6
  205. package/dist/modules/background/visual.d.ts.map +1 -0
  206. package/dist/modules/background/youtube/audio.d.ts.map +1 -0
  207. package/dist/modules/background/youtube/iframe.d.ts +92 -0
  208. package/dist/modules/background/youtube/iframe.d.ts.map +1 -0
  209. package/dist/modules/background/youtube/{lib/parse.d.ts → parse.d.ts} +1 -1
  210. package/dist/modules/background/youtube/parse.d.ts.map +1 -0
  211. package/dist/modules/background/youtube/{components/player.d.ts → player.d.ts} +1 -1
  212. package/dist/modules/background/youtube/player.d.ts.map +1 -0
  213. package/dist/modules/background/youtube/{lib/timing.d.ts → timing.d.ts} +0 -2
  214. package/dist/modules/background/youtube/timing.d.ts.map +1 -0
  215. package/dist/modules/background/youtube/use-iframe-player.d.ts +37 -0
  216. package/dist/modules/background/youtube/use-iframe-player.d.ts.map +1 -0
  217. package/dist/modules/background/youtube/{hooks/use-youtube-background-player-model.d.ts → use-player.d.ts} +2 -2
  218. package/dist/modules/background/youtube/use-player.d.ts.map +1 -0
  219. package/dist/modules/background/youtube/{hooks/use-youtube-video-sync.d.ts → use-video-sync.d.ts} +8 -4
  220. package/dist/modules/background/youtube/use-video-sync.d.ts.map +1 -0
  221. package/dist/modules/background/youtube/{lib/video-events.d.ts → video-events.d.ts} +8 -8
  222. package/dist/modules/background/youtube/video-events.d.ts.map +1 -0
  223. package/dist/modules/context-menu/dom.d.ts.map +1 -1
  224. package/dist/modules/context-menu/items.d.ts.map +1 -1
  225. package/dist/modules/context-menu/overlay.d.ts +3 -10
  226. package/dist/modules/context-menu/overlay.d.ts.map +1 -1
  227. package/dist/modules/context-menu/resolver.d.ts.map +1 -1
  228. package/dist/modules/controls/overlay.d.ts +0 -10
  229. package/dist/modules/controls/overlay.d.ts.map +1 -1
  230. package/dist/modules/dock/{lib → card}/banner.d.ts +3 -16
  231. package/dist/modules/dock/card/banner.d.ts.map +1 -0
  232. package/dist/modules/dock/{components/card-item.d.ts → card/card.d.ts} +5 -2
  233. package/dist/modules/dock/card/card.d.ts.map +1 -0
  234. package/dist/modules/dock/card/compact.d.ts.map +1 -0
  235. package/dist/modules/dock/{components/item-content.d.ts → card/content.d.ts} +1 -1
  236. package/dist/modules/dock/card/content.d.ts.map +1 -0
  237. package/dist/modules/dock/card/header.d.ts +8 -0
  238. package/dist/modules/dock/card/header.d.ts.map +1 -0
  239. package/dist/modules/dock/{components → card}/icon.d.ts +1 -1
  240. package/dist/modules/dock/card/icon.d.ts.map +1 -0
  241. package/dist/modules/dock/{lib/card-item.d.ts → card/model.d.ts} +20 -2
  242. package/dist/modules/dock/card/model.d.ts.map +1 -0
  243. package/dist/modules/dock/{hooks/use-card-item-model.d.ts → card/use-card.d.ts} +44 -43
  244. package/dist/modules/dock/{hooks/use-card-item-model.d.ts.map → card/use-card.d.ts.map} +1 -1
  245. package/dist/modules/dock/commands/command-bar.d.ts.map +1 -0
  246. package/dist/modules/dock/{runtime/commands.d.ts → commands/registry.d.ts} +1 -1
  247. package/dist/modules/dock/commands/registry.d.ts.map +1 -0
  248. package/dist/modules/dock/constants.d.ts +4 -7
  249. package/dist/modules/dock/constants.d.ts.map +1 -1
  250. package/dist/modules/dock/context.d.ts +1 -1
  251. package/dist/modules/dock/context.d.ts.map +1 -1
  252. package/dist/modules/dock/hooks.d.ts +47 -0
  253. package/dist/modules/dock/hooks.d.ts.map +1 -0
  254. package/dist/modules/dock/{hud.d.ts → hud/hud.d.ts} +14 -7
  255. package/dist/modules/dock/hud/hud.d.ts.map +1 -0
  256. package/dist/modules/dock/{model/hud-definition.d.ts → hud/model.d.ts} +7 -1
  257. package/dist/modules/dock/hud/model.d.ts.map +1 -0
  258. package/dist/modules/dock/{components/hud-view.d.ts → hud/view.d.ts} +1 -1
  259. package/dist/modules/dock/hud/view.d.ts.map +1 -0
  260. package/dist/modules/dock/index.d.ts +22 -22
  261. package/dist/modules/dock/index.d.ts.map +1 -1
  262. package/dist/modules/dock/items/attention.d.ts +43 -0
  263. package/dist/modules/dock/items/attention.d.ts.map +1 -0
  264. package/dist/modules/dock/{runtime/model/items.d.ts → items/build.d.ts} +2 -2
  265. package/dist/modules/dock/items/build.d.ts.map +1 -0
  266. package/dist/modules/dock/{runtime → items}/display.d.ts +2 -5
  267. package/dist/modules/dock/items/display.d.ts.map +1 -0
  268. package/dist/modules/dock/items/operations.d.ts +22 -0
  269. package/dist/modules/dock/items/operations.d.ts.map +1 -0
  270. package/dist/modules/dock/{runtime → items}/pipeline.d.ts +1 -1
  271. package/dist/modules/dock/items/pipeline.d.ts.map +1 -0
  272. package/dist/modules/dock/{components/media-action.d.ts → media/controls.d.ts} +5 -2
  273. package/dist/modules/dock/media/controls.d.ts.map +1 -0
  274. package/dist/modules/dock/{lib/media.d.ts → media/model.d.ts} +1 -3
  275. package/dist/modules/dock/media/model.d.ts.map +1 -0
  276. package/dist/modules/dock/{components/media-scrubber.d.ts → media/scrubber.d.ts} +1 -1
  277. package/dist/modules/dock/media/scrubber.d.ts.map +1 -0
  278. package/dist/modules/dock/{hooks/use-media-controls-model.d.ts → media/use-controls.d.ts} +8 -8
  279. package/dist/modules/dock/media/use-controls.d.ts.map +1 -0
  280. package/dist/modules/dock/module.d.ts.map +1 -1
  281. package/dist/modules/dock/motion.d.ts +27 -28
  282. package/dist/modules/dock/motion.d.ts.map +1 -1
  283. package/dist/modules/dock/provider.d.ts.map +1 -1
  284. package/dist/modules/dock/routing/breadcrumbs-card.d.ts.map +1 -0
  285. package/dist/modules/dock/routing/{model/continuity.d.ts → continuity-state.d.ts} +2 -2
  286. package/dist/modules/dock/routing/continuity-state.d.ts.map +1 -0
  287. package/dist/modules/dock/routing/continuity.d.ts +8 -8
  288. package/dist/modules/dock/routing/continuity.d.ts.map +1 -1
  289. package/dist/modules/dock/routing/navigation.d.ts +0 -10
  290. package/dist/modules/dock/routing/navigation.d.ts.map +1 -1
  291. package/dist/modules/dock/routing/paths.d.ts.map +1 -0
  292. package/dist/modules/dock/routing/{model/policy.d.ts → policy.d.ts} +1 -1
  293. package/dist/modules/dock/routing/policy.d.ts.map +1 -0
  294. package/dist/modules/dock/routing/{hooks/use-route-prefetch.d.ts → prefetch.d.ts} +3 -3
  295. package/dist/modules/dock/routing/prefetch.d.ts.map +1 -0
  296. package/dist/modules/dock/routing/route-bridge.d.ts +8 -0
  297. package/dist/modules/dock/routing/route-bridge.d.ts.map +1 -0
  298. package/dist/modules/dock/routing/{model/topology.d.ts → topology.d.ts} +1 -1
  299. package/dist/modules/dock/routing/topology.d.ts.map +1 -0
  300. package/dist/modules/dock/{runtime/model → stack}/cards.d.ts +8 -5
  301. package/dist/modules/dock/stack/cards.d.ts.map +1 -0
  302. package/dist/modules/dock/stack/dock.d.ts.map +1 -0
  303. package/dist/modules/dock/stack/focus.d.ts +22 -0
  304. package/dist/modules/dock/stack/focus.d.ts.map +1 -0
  305. package/dist/modules/dock/{model → stack}/layout.d.ts +8 -2
  306. package/dist/modules/dock/stack/layout.d.ts.map +1 -0
  307. package/dist/modules/dock/{runtime/dock.d.ts → stack/use-dock-model.d.ts} +2 -1
  308. package/dist/modules/dock/stack/use-dock-model.d.ts.map +1 -0
  309. package/dist/modules/dock/{runtime/hooks → stack}/use-dock.d.ts +9 -9
  310. package/dist/modules/dock/stack/use-dock.d.ts.map +1 -0
  311. package/dist/modules/dock/stack/use-height.d.ts +12 -0
  312. package/dist/modules/dock/stack/use-height.d.ts.map +1 -0
  313. package/dist/modules/dock/{components/status-actions.d.ts → status/actions.d.ts} +1 -1
  314. package/dist/modules/dock/status/actions.d.ts.map +1 -0
  315. package/dist/modules/dock/status/events.d.ts +4 -4
  316. package/dist/modules/dock/status/events.d.ts.map +1 -1
  317. package/dist/modules/dock/status/hooks.d.ts.map +1 -1
  318. package/dist/modules/dock/status/model.d.ts +34 -4
  319. package/dist/modules/dock/status/model.d.ts.map +1 -1
  320. package/dist/modules/dock/surface/{model/builder.d.ts → builder.d.ts} +13 -7
  321. package/dist/modules/dock/surface/builder.d.ts.map +1 -0
  322. package/dist/modules/dock/{components/surface/item-content.d.ts → surface/content.d.ts} +2 -2
  323. package/dist/modules/dock/surface/content.d.ts.map +1 -0
  324. package/dist/modules/dock/surface/context.d.ts +12 -3
  325. package/dist/modules/dock/surface/context.d.ts.map +1 -1
  326. package/dist/modules/dock/surface/controls.d.ts +26 -0
  327. package/dist/modules/dock/surface/controls.d.ts.map +1 -0
  328. package/dist/modules/dock/surface/definition.d.ts.map +1 -1
  329. package/dist/modules/dock/{components/surface → surface}/extensions-bar.d.ts +1 -1
  330. package/dist/modules/dock/surface/extensions-bar.d.ts.map +1 -0
  331. package/dist/modules/dock/{components/surface/action.d.ts → surface/extensions.d.ts} +4 -2
  332. package/dist/modules/dock/surface/extensions.d.ts.map +1 -0
  333. package/dist/modules/dock/{components/surface → surface}/header-button.d.ts +3 -3
  334. package/dist/modules/dock/surface/header-button.d.ts.map +1 -0
  335. package/dist/modules/dock/surface/helpers.d.ts +13 -1
  336. package/dist/modules/dock/surface/helpers.d.ts.map +1 -1
  337. package/dist/modules/dock/surface/{model/normalize.d.ts → normalize.d.ts} +1 -1
  338. package/dist/modules/dock/surface/normalize.d.ts.map +1 -0
  339. package/dist/modules/dock/surface/runtime/choreography.d.ts +28 -2
  340. package/dist/modules/dock/surface/runtime/choreography.d.ts.map +1 -1
  341. package/dist/modules/dock/surface/runtime/flows.d.ts +1 -1
  342. package/dist/modules/dock/surface/runtime/flows.d.ts.map +1 -1
  343. package/dist/modules/dock/surface/{machine.d.ts → runtime/machine.d.ts} +1 -1
  344. package/dist/modules/dock/surface/runtime/machine.d.ts.map +1 -0
  345. package/dist/modules/dock/surface/runtime/open.d.ts +1 -2
  346. package/dist/modules/dock/surface/runtime/open.d.ts.map +1 -1
  347. package/dist/modules/dock/surface/{model → runtime}/records.d.ts +1 -1
  348. package/dist/modules/dock/surface/runtime/records.d.ts.map +1 -0
  349. package/dist/modules/dock/surface/{stack.d.ts → runtime/stack.d.ts} +10 -10
  350. package/dist/modules/dock/surface/runtime/stack.d.ts.map +1 -0
  351. package/dist/modules/dock/surface/runtime/steps.d.ts +1 -1
  352. package/dist/modules/dock/surface/runtime/steps.d.ts.map +1 -1
  353. package/dist/modules/dock/surface/{model/transition-state.d.ts → runtime/transition.d.ts} +1 -1
  354. package/dist/modules/dock/surface/runtime/transition.d.ts.map +1 -0
  355. package/dist/modules/dock/surface/runtime/url.d.ts.map +1 -0
  356. package/dist/modules/dock/surface/{hooks/use-surface-shell-model.d.ts → shell.d.ts} +9 -3
  357. package/dist/modules/dock/surface/shell.d.ts.map +1 -0
  358. package/dist/modules/dock/surface/{hooks/use-surface-flow.d.ts → use-flow.d.ts} +2 -2
  359. package/dist/modules/dock/surface/use-flow.d.ts.map +1 -0
  360. package/dist/modules/dock/surface/view-model.d.ts.map +1 -1
  361. package/dist/modules/dock/{lib/styles.d.ts → theme.d.ts} +22 -18
  362. package/dist/modules/dock/theme.d.ts.map +1 -0
  363. package/dist/modules/dock/types/card.d.ts +12 -3
  364. package/dist/modules/dock/types/card.d.ts.map +1 -1
  365. package/dist/modules/dock/types/index.d.ts +1 -1
  366. package/dist/modules/dock/types/index.d.ts.map +1 -1
  367. package/dist/modules/dock/types/surface.d.ts +2 -2
  368. package/dist/modules/dock/types/surface.d.ts.map +1 -1
  369. package/dist/modules/dock/{lib/helpers.d.ts → utils.d.ts} +10 -3
  370. package/dist/modules/dock/utils.d.ts.map +1 -0
  371. package/dist/modules/index.js +20 -22
  372. package/dist/modules/loading/hooks.d.ts +2 -1
  373. package/dist/modules/loading/hooks.d.ts.map +1 -1
  374. package/dist/modules/loading/state.d.ts.map +1 -1
  375. package/dist/modules/media/hooks.d.ts.map +1 -1
  376. package/dist/modules/media/playback.d.ts.map +1 -1
  377. package/dist/modules/modal/constants.d.ts +3 -1
  378. package/dist/modules/modal/constants.d.ts.map +1 -1
  379. package/dist/modules/modal/{components/modal-container.d.ts → container.d.ts} +2 -2
  380. package/dist/modules/modal/container.d.ts.map +1 -0
  381. package/dist/modules/modal/context.d.ts +5 -1
  382. package/dist/modules/modal/context.d.ts.map +1 -1
  383. package/dist/modules/modal/dom.d.ts.map +1 -0
  384. package/dist/modules/modal/hooks.d.ts +3 -2
  385. package/dist/modules/modal/hooks.d.ts.map +1 -1
  386. package/dist/modules/modal/index.d.ts +7 -7
  387. package/dist/modules/modal/index.d.ts.map +1 -1
  388. package/dist/modules/modal/{model/layout.d.ts → layout.d.ts} +1 -1
  389. package/dist/modules/modal/layout.d.ts.map +1 -0
  390. package/dist/modules/modal/module.d.ts +1 -1
  391. package/dist/modules/modal/module.d.ts.map +1 -1
  392. package/dist/modules/modal/overlay.d.ts.map +1 -0
  393. package/dist/modules/modal/state.d.ts +52 -0
  394. package/dist/modules/modal/state.d.ts.map +1 -0
  395. package/dist/modules/navigation/hooks.d.ts.map +1 -1
  396. package/dist/modules/notification/hooks.d.ts.map +1 -1
  397. package/dist/modules/notification/overlay.d.ts +0 -1
  398. package/dist/modules/notification/overlay.d.ts.map +1 -1
  399. package/dist/navigation/index.js +33 -41
  400. package/dist/navigation/index.js.map +1 -1
  401. package/dist/notification/index.js +8 -7
  402. package/dist/overlay-ZCMQVNYT.js +12 -0
  403. package/dist/{overlay-7QLGWHCH.js.map → overlay-ZCMQVNYT.js.map} +1 -1
  404. package/dist/provider/index.js +7 -11
  405. package/dist/react/hooks/index.d.ts +3 -1
  406. package/dist/react/hooks/index.d.ts.map +1 -1
  407. package/dist/react/hooks/use-client-value.d.ts +15 -0
  408. package/dist/react/hooks/use-client-value.d.ts.map +1 -0
  409. package/dist/react/hooks/use-controllable-state.d.ts +8 -1
  410. package/dist/react/hooks/use-controllable-state.d.ts.map +1 -1
  411. package/dist/react/hooks/use-fullscreen-state.d.ts +0 -2
  412. package/dist/react/hooks/use-fullscreen-state.d.ts.map +1 -1
  413. package/dist/react/hooks/use-global-event.d.ts +7 -1
  414. package/dist/react/hooks/use-global-event.d.ts.map +1 -1
  415. package/dist/react/hooks/use-hotkey.d.ts +9 -1
  416. package/dist/react/hooks/use-hotkey.d.ts.map +1 -1
  417. package/dist/react/hooks/use-scroll-lock.d.ts.map +1 -1
  418. package/dist/react/hooks/use-store.d.ts +3 -0
  419. package/dist/react/hooks/use-store.d.ts.map +1 -1
  420. package/dist/react/theme/index.d.ts +7 -2
  421. package/dist/react/theme/index.d.ts.map +1 -1
  422. package/dist/react/theme/parts.d.ts +89 -0
  423. package/dist/react/theme/parts.d.ts.map +1 -0
  424. package/dist/recipes/index.js +6 -121
  425. package/dist/recipes/index.js.map +1 -1
  426. package/dist/result/index.js +12 -15
  427. package/dist/result/index.js.map +1 -1
  428. package/dist/theme/index.js +2 -2
  429. package/dist/utils/index.js +31 -34
  430. package/dist/utils/index.js.map +1 -1
  431. package/docs/README.md +11 -12
  432. package/docs/architecture-and-rules.md +43 -32
  433. package/docs/core-engine.md +11 -13
  434. package/docs/custom-modules.md +1 -1
  435. package/docs/design.md +60 -153
  436. package/docs/getting-started.md +3 -5
  437. package/docs/modules/README.md +16 -16
  438. package/docs/modules/ambient.md +23 -23
  439. package/docs/modules/background.md +24 -19
  440. package/docs/modules/context-menu.md +1 -1
  441. package/docs/modules/dock.md +47 -43
  442. package/docs/modules/error-boundary.md +2 -3
  443. package/docs/modules/kernel.md +28 -30
  444. package/docs/modules/loading.md +1 -1
  445. package/docs/modules/modal.md +17 -16
  446. package/docs/modules/navigation.md +14 -14
  447. package/docs/testing.md +1 -1
  448. package/package.json +1 -8
  449. package/templates/AGENTS.md +4 -3
  450. package/MIGRATION.md +0 -99
  451. package/dist/chunk-67MOKJFZ.js.map +0 -1
  452. package/dist/chunk-6IP6YFQX.js.map +0 -1
  453. package/dist/chunk-7VU2OAJB.js +0 -464
  454. package/dist/chunk-7VU2OAJB.js.map +0 -1
  455. package/dist/chunk-AZ2ZDFNP.js +0 -17
  456. package/dist/chunk-BMFHS3GV.js.map +0 -1
  457. package/dist/chunk-D222OCTV.js.map +0 -1
  458. package/dist/chunk-ESD5EQ5H.js +0 -178
  459. package/dist/chunk-ESD5EQ5H.js.map +0 -1
  460. package/dist/chunk-FFJWJ4OB.js.map +0 -1
  461. package/dist/chunk-GKAJ4EM2.js.map +0 -1
  462. package/dist/chunk-HFR6YROB.js.map +0 -1
  463. package/dist/chunk-IH3STE7W.js.map +0 -1
  464. package/dist/chunk-KOYTJW5E.js.map +0 -1
  465. package/dist/chunk-LKYW4LH6.js.map +0 -1
  466. package/dist/chunk-QGPRTUED.js.map +0 -1
  467. package/dist/chunk-QRXDXAQI.js.map +0 -1
  468. package/dist/chunk-R4K6VAOK.js.map +0 -1
  469. package/dist/chunk-RDYYP36I.js.map +0 -1
  470. package/dist/chunk-RGC2VFQO.js +0 -139
  471. package/dist/chunk-RGC2VFQO.js.map +0 -1
  472. package/dist/chunk-TAWTGCWJ.js +0 -113
  473. package/dist/chunk-TAWTGCWJ.js.map +0 -1
  474. package/dist/chunk-UDJ7ARCH.js +0 -140
  475. package/dist/chunk-UDJ7ARCH.js.map +0 -1
  476. package/dist/chunk-UQLTP3XB.js.map +0 -1
  477. package/dist/chunk-WQTMOUCA.js.map +0 -1
  478. package/dist/chunk-WZ5T2NXH.js +0 -702
  479. package/dist/chunk-WZ5T2NXH.js.map +0 -1
  480. package/dist/chunk-XGAYTDSI.js.map +0 -1
  481. package/dist/chunk-YZS2B6YE.js.map +0 -1
  482. package/dist/chunk-ZXRE2KZO.js.map +0 -1
  483. package/dist/core/error/theme.d.ts +0 -10
  484. package/dist/core/error/theme.d.ts.map +0 -1
  485. package/dist/core/kernel/adapters.d.ts.map +0 -1
  486. package/dist/core/kernel/compose.d.ts.map +0 -1
  487. package/dist/core/kernel/handlers.d.ts.map +0 -1
  488. package/dist/core/kernel/hooks.d.ts.map +0 -1
  489. package/dist/core/kernel/installed.d.ts.map +0 -1
  490. package/dist/core/kernel/module.d.ts.map +0 -1
  491. package/dist/core/kernel/operations-records.d.ts.map +0 -1
  492. package/dist/core/kernel/operations-resolve.d.ts +0 -5
  493. package/dist/core/kernel/operations-resolve.d.ts.map +0 -1
  494. package/dist/core/kernel/operations.d.ts.map +0 -1
  495. package/dist/core/kernel/page-controller.d.ts.map +0 -1
  496. package/dist/core/kernel/provider.d.ts.map +0 -1
  497. package/dist/core/kernel/runtime.d.ts.map +0 -1
  498. package/dist/core/kernel/schema.d.ts.map +0 -1
  499. package/dist/core/kernel/stabilize.d.ts.map +0 -1
  500. package/dist/core/kernel/store-batch.d.ts +0 -17
  501. package/dist/core/kernel/store-batch.d.ts.map +0 -1
  502. package/dist/core/kernel/store-entries.d.ts +0 -6
  503. package/dist/core/kernel/store-entries.d.ts.map +0 -1
  504. package/dist/core/kernel/store-handles.d.ts +0 -4
  505. package/dist/core/kernel/store-handles.d.ts.map +0 -1
  506. package/dist/core/kernel/store-registration.d.ts +0 -14
  507. package/dist/core/kernel/store-registration.d.ts.map +0 -1
  508. package/dist/core/kernel/store-snapshots.d.ts.map +0 -1
  509. package/dist/core/kernel/store-subscriptions.d.ts.map +0 -1
  510. package/dist/core/kernel/store.d.ts.map +0 -1
  511. package/dist/core/kernel/types-modules.d.ts.map +0 -1
  512. package/dist/core/kernel/types-page.d.ts.map +0 -1
  513. package/dist/core/kernel/types-store.d.ts.map +0 -1
  514. package/dist/core/kernel/types.d.ts.map +0 -1
  515. package/dist/core/navigation/navigator-defaults.d.ts +0 -4
  516. package/dist/core/navigation/navigator-defaults.d.ts.map +0 -1
  517. package/dist/core/navigation/navigator-holds.d.ts.map +0 -1
  518. package/dist/core/navigation/navigator-patience.d.ts.map +0 -1
  519. package/dist/core/navigation/navigator-payload.d.ts.map +0 -1
  520. package/dist/core/navigation/navigator-prefetch.d.ts.map +0 -1
  521. package/dist/foundation/recipes/anatomy.d.ts +0 -139
  522. package/dist/foundation/recipes/anatomy.d.ts.map +0 -1
  523. package/dist/foundation/recipes/define.d.ts +0 -133
  524. package/dist/foundation/recipes/define.d.ts.map +0 -1
  525. package/dist/modules/ambient/analyze-bounds.d.ts.map +0 -1
  526. package/dist/modules/ambient/analyze-clusters.d.ts.map +0 -1
  527. package/dist/modules/ambient/analyze-ground.d.ts.map +0 -1
  528. package/dist/modules/ambient/analyze-measures.d.ts.map +0 -1
  529. package/dist/modules/ambient/analyze-swatches.d.ts.map +0 -1
  530. package/dist/modules/ambient/analyze.d.ts.map +0 -1
  531. package/dist/modules/ambient/oklab.d.ts.map +0 -1
  532. package/dist/modules/ambient/quantize.d.ts.map +0 -1
  533. package/dist/modules/background/components/background-gradients.d.ts +0 -8
  534. package/dist/modules/background/components/background-gradients.d.ts.map +0 -1
  535. package/dist/modules/background/components/edge-gradient.d.ts +0 -9
  536. package/dist/modules/background/components/edge-gradient.d.ts.map +0 -1
  537. package/dist/modules/background/components/native-video.d.ts +0 -4
  538. package/dist/modules/background/components/native-video.d.ts.map +0 -1
  539. package/dist/modules/background/components/noise-overlay.d.ts +0 -11
  540. package/dist/modules/background/components/noise-overlay.d.ts.map +0 -1
  541. package/dist/modules/background/components/overlay.d.ts.map +0 -1
  542. package/dist/modules/background/components/solid-overlay.d.ts +0 -10
  543. package/dist/modules/background/components/solid-overlay.d.ts.map +0 -1
  544. package/dist/modules/background/hooks/use-background-media-source.d.ts +0 -4
  545. package/dist/modules/background/hooks/use-background-media-source.d.ts.map +0 -1
  546. package/dist/modules/background/hooks/use-background-motion-model.d.ts +0 -15
  547. package/dist/modules/background/hooks/use-background-motion-model.d.ts.map +0 -1
  548. package/dist/modules/background/hooks/use-background-overlay-model.d.ts +0 -929
  549. package/dist/modules/background/hooks/use-background-overlay-model.d.ts.map +0 -1
  550. package/dist/modules/background/hooks/use-native-video-model.d.ts.map +0 -1
  551. package/dist/modules/background/lib/theme.d.ts +0 -4
  552. package/dist/modules/background/lib/theme.d.ts.map +0 -1
  553. package/dist/modules/background/model/override.d.ts +0 -14
  554. package/dist/modules/background/model/override.d.ts.map +0 -1
  555. package/dist/modules/background/model/playback.d.ts.map +0 -1
  556. package/dist/modules/background/model/state.d.ts.map +0 -1
  557. package/dist/modules/background/model/video-frame.d.ts +0 -31
  558. package/dist/modules/background/model/video-frame.d.ts.map +0 -1
  559. package/dist/modules/background/model/visual.d.ts.map +0 -1
  560. package/dist/modules/background/youtube/components/player.d.ts.map +0 -1
  561. package/dist/modules/background/youtube/hooks/use-youtube-background-player-model.d.ts.map +0 -1
  562. package/dist/modules/background/youtube/hooks/use-youtube-iframe-player.d.ts +0 -20
  563. package/dist/modules/background/youtube/hooks/use-youtube-iframe-player.d.ts.map +0 -1
  564. package/dist/modules/background/youtube/hooks/use-youtube-stream-sources.d.ts +0 -8
  565. package/dist/modules/background/youtube/hooks/use-youtube-stream-sources.d.ts.map +0 -1
  566. package/dist/modules/background/youtube/hooks/use-youtube-video-sync.d.ts.map +0 -1
  567. package/dist/modules/background/youtube/lib/audio.d.ts.map +0 -1
  568. package/dist/modules/background/youtube/lib/iframe-engine.d.ts +0 -29
  569. package/dist/modules/background/youtube/lib/iframe-engine.d.ts.map +0 -1
  570. package/dist/modules/background/youtube/lib/iframe-proxy.d.ts +0 -47
  571. package/dist/modules/background/youtube/lib/iframe-proxy.d.ts.map +0 -1
  572. package/dist/modules/background/youtube/lib/iframe.d.ts +0 -47
  573. package/dist/modules/background/youtube/lib/iframe.d.ts.map +0 -1
  574. package/dist/modules/background/youtube/lib/parse.d.ts.map +0 -1
  575. package/dist/modules/background/youtube/lib/timing.d.ts.map +0 -1
  576. package/dist/modules/background/youtube/lib/video-events.d.ts.map +0 -1
  577. package/dist/modules/dock/components/badge.d.ts +0 -5
  578. package/dist/modules/dock/components/badge.d.ts.map +0 -1
  579. package/dist/modules/dock/components/breadcrumbs-card.d.ts.map +0 -1
  580. package/dist/modules/dock/components/card-banner.d.ts +0 -4
  581. package/dist/modules/dock/components/card-banner.d.ts.map +0 -1
  582. package/dist/modules/dock/components/card-header.d.ts +0 -4
  583. package/dist/modules/dock/components/card-header.d.ts.map +0 -1
  584. package/dist/modules/dock/components/card-item.d.ts.map +0 -1
  585. package/dist/modules/dock/components/command-bar.d.ts.map +0 -1
  586. package/dist/modules/dock/components/compact.d.ts.map +0 -1
  587. package/dist/modules/dock/components/description.d.ts +0 -4
  588. package/dist/modules/dock/components/description.d.ts.map +0 -1
  589. package/dist/modules/dock/components/dock.d.ts.map +0 -1
  590. package/dist/modules/dock/components/hud-view.d.ts.map +0 -1
  591. package/dist/modules/dock/components/icon.d.ts.map +0 -1
  592. package/dist/modules/dock/components/item-content.d.ts.map +0 -1
  593. package/dist/modules/dock/components/media-action.d.ts.map +0 -1
  594. package/dist/modules/dock/components/media-controls.d.ts +0 -4
  595. package/dist/modules/dock/components/media-controls.d.ts.map +0 -1
  596. package/dist/modules/dock/components/media-scrubber.d.ts.map +0 -1
  597. package/dist/modules/dock/components/status-actions.d.ts.map +0 -1
  598. package/dist/modules/dock/components/surface/action.d.ts.map +0 -1
  599. package/dist/modules/dock/components/surface/controls.d.ts +0 -12
  600. package/dist/modules/dock/components/surface/controls.d.ts.map +0 -1
  601. package/dist/modules/dock/components/surface/extensions-bar.d.ts.map +0 -1
  602. package/dist/modules/dock/components/surface/header-button.d.ts.map +0 -1
  603. package/dist/modules/dock/components/surface/item-content.d.ts.map +0 -1
  604. package/dist/modules/dock/components/surface/shell.d.ts +0 -3
  605. package/dist/modules/dock/components/surface/shell.d.ts.map +0 -1
  606. package/dist/modules/dock/components/title.d.ts +0 -4
  607. package/dist/modules/dock/components/title.d.ts.map +0 -1
  608. package/dist/modules/dock/hooks/use-action-slot.d.ts +0 -6
  609. package/dist/modules/dock/hooks/use-action-slot.d.ts.map +0 -1
  610. package/dist/modules/dock/hooks/use-badge.d.ts +0 -4
  611. package/dist/modules/dock/hooks/use-badge.d.ts.map +0 -1
  612. package/dist/modules/dock/hooks/use-card-banner-model.d.ts +0 -18
  613. package/dist/modules/dock/hooks/use-card-banner-model.d.ts.map +0 -1
  614. package/dist/modules/dock/hooks/use-card-header-model.d.ts +0 -7
  615. package/dist/modules/dock/hooks/use-card-header-model.d.ts.map +0 -1
  616. package/dist/modules/dock/hooks/use-command-bar-model.d.ts +0 -12
  617. package/dist/modules/dock/hooks/use-command-bar-model.d.ts.map +0 -1
  618. package/dist/modules/dock/hooks/use-dock-banner.d.ts +0 -11
  619. package/dist/modules/dock/hooks/use-dock-banner.d.ts.map +0 -1
  620. package/dist/modules/dock/hooks/use-dock-config.d.ts +0 -19
  621. package/dist/modules/dock/hooks/use-dock-config.d.ts.map +0 -1
  622. package/dist/modules/dock/hooks/use-dock-dimensions.d.ts +0 -7
  623. package/dist/modules/dock/hooks/use-dock-dimensions.d.ts.map +0 -1
  624. package/dist/modules/dock/hooks/use-dock-focus-trap.d.ts +0 -7
  625. package/dist/modules/dock/hooks/use-dock-focus-trap.d.ts.map +0 -1
  626. package/dist/modules/dock/hooks/use-dock-height-controller.d.ts +0 -6
  627. package/dist/modules/dock/hooks/use-dock-height-controller.d.ts.map +0 -1
  628. package/dist/modules/dock/hooks/use-dock-keyboard.d.ts +0 -11
  629. package/dist/modules/dock/hooks/use-dock-keyboard.d.ts.map +0 -1
  630. package/dist/modules/dock/hooks/use-dock-registration.d.ts +0 -8
  631. package/dist/modules/dock/hooks/use-dock-registration.d.ts.map +0 -1
  632. package/dist/modules/dock/hooks/use-dock-route-reset.d.ts +0 -2
  633. package/dist/modules/dock/hooks/use-dock-route-reset.d.ts.map +0 -1
  634. package/dist/modules/dock/hooks/use-dock-theme.d.ts +0 -6
  635. package/dist/modules/dock/hooks/use-dock-theme.d.ts.map +0 -1
  636. package/dist/modules/dock/hooks/use-dock-viewport.d.ts +0 -6
  637. package/dist/modules/dock/hooks/use-dock-viewport.d.ts.map +0 -1
  638. package/dist/modules/dock/hooks/use-element-height.d.ts +0 -3
  639. package/dist/modules/dock/hooks/use-element-height.d.ts.map +0 -1
  640. package/dist/modules/dock/hooks/use-hud-registry.d.ts +0 -16
  641. package/dist/modules/dock/hooks/use-hud-registry.d.ts.map +0 -1
  642. package/dist/modules/dock/hooks/use-hud-view-model.d.ts +0 -9
  643. package/dist/modules/dock/hooks/use-hud-view-model.d.ts.map +0 -1
  644. package/dist/modules/dock/hooks/use-media-controls-model.d.ts.map +0 -1
  645. package/dist/modules/dock/hooks/use-media-scrubber-model.d.ts +0 -27
  646. package/dist/modules/dock/hooks/use-media-scrubber-model.d.ts.map +0 -1
  647. package/dist/modules/dock/hooks/use-pending-skeleton.d.ts +0 -7
  648. package/dist/modules/dock/hooks/use-pending-skeleton.d.ts.map +0 -1
  649. package/dist/modules/dock/hooks/use-standard-item-content-model.d.ts +0 -12
  650. package/dist/modules/dock/hooks/use-standard-item-content-model.d.ts.map +0 -1
  651. package/dist/modules/dock/hooks/use-surface-return.d.ts +0 -8
  652. package/dist/modules/dock/hooks/use-surface-return.d.ts.map +0 -1
  653. package/dist/modules/dock/hud.d.ts.map +0 -1
  654. package/dist/modules/dock/lib/banner.d.ts.map +0 -1
  655. package/dist/modules/dock/lib/card-item.d.ts.map +0 -1
  656. package/dist/modules/dock/lib/card.d.ts +0 -20
  657. package/dist/modules/dock/lib/card.d.ts.map +0 -1
  658. package/dist/modules/dock/lib/command-bar.d.ts +0 -8
  659. package/dist/modules/dock/lib/command-bar.d.ts.map +0 -1
  660. package/dist/modules/dock/lib/dom.d.ts +0 -7
  661. package/dist/modules/dock/lib/dom.d.ts.map +0 -1
  662. package/dist/modules/dock/lib/element-helpers.d.ts +0 -8
  663. package/dist/modules/dock/lib/element-helpers.d.ts.map +0 -1
  664. package/dist/modules/dock/lib/helpers.d.ts.map +0 -1
  665. package/dist/modules/dock/lib/media.d.ts.map +0 -1
  666. package/dist/modules/dock/lib/styles.d.ts.map +0 -1
  667. package/dist/modules/dock/model/hud-definition.d.ts.map +0 -1
  668. package/dist/modules/dock/model/hud.d.ts +0 -10
  669. package/dist/modules/dock/model/hud.d.ts.map +0 -1
  670. package/dist/modules/dock/model/layout.d.ts.map +0 -1
  671. package/dist/modules/dock/model/page-entry.d.ts +0 -11
  672. package/dist/modules/dock/model/page-entry.d.ts.map +0 -1
  673. package/dist/modules/dock/model/page-surface.d.ts +0 -4
  674. package/dist/modules/dock/model/page-surface.d.ts.map +0 -1
  675. package/dist/modules/dock/model/paths.d.ts.map +0 -1
  676. package/dist/modules/dock/model/state.d.ts +0 -28
  677. package/dist/modules/dock/model/state.d.ts.map +0 -1
  678. package/dist/modules/dock/model/surface-return.d.ts +0 -14
  679. package/dist/modules/dock/model/surface-return.d.ts.map +0 -1
  680. package/dist/modules/dock/routing/hooks/use-route-prefetch.d.ts.map +0 -1
  681. package/dist/modules/dock/routing/lib/restore.d.ts +0 -7
  682. package/dist/modules/dock/routing/lib/restore.d.ts.map +0 -1
  683. package/dist/modules/dock/routing/model/continuity.d.ts.map +0 -1
  684. package/dist/modules/dock/routing/model/policy.d.ts.map +0 -1
  685. package/dist/modules/dock/routing/model/topology.d.ts.map +0 -1
  686. package/dist/modules/dock/runtime/commands.d.ts.map +0 -1
  687. package/dist/modules/dock/runtime/display.d.ts.map +0 -1
  688. package/dist/modules/dock/runtime/dock.d.ts.map +0 -1
  689. package/dist/modules/dock/runtime/hooks/use-dock-expansion.d.ts +0 -10
  690. package/dist/modules/dock/runtime/hooks/use-dock-expansion.d.ts.map +0 -1
  691. package/dist/modules/dock/runtime/hooks/use-dock-layout.d.ts +0 -10
  692. package/dist/modules/dock/runtime/hooks/use-dock-layout.d.ts.map +0 -1
  693. package/dist/modules/dock/runtime/hooks/use-dock-operation-state.d.ts +0 -14
  694. package/dist/modules/dock/runtime/hooks/use-dock-operation-state.d.ts.map +0 -1
  695. package/dist/modules/dock/runtime/hooks/use-dock-route-bridge.d.ts +0 -7
  696. package/dist/modules/dock/runtime/hooks/use-dock-route-bridge.d.ts.map +0 -1
  697. package/dist/modules/dock/runtime/hooks/use-dock.d.ts.map +0 -1
  698. package/dist/modules/dock/runtime/model/attention.d.ts +0 -25
  699. package/dist/modules/dock/runtime/model/attention.d.ts.map +0 -1
  700. package/dist/modules/dock/runtime/model/cards.d.ts.map +0 -1
  701. package/dist/modules/dock/runtime/model/items.d.ts.map +0 -1
  702. package/dist/modules/dock/runtime/model/layout.d.ts +0 -10
  703. package/dist/modules/dock/runtime/model/layout.d.ts.map +0 -1
  704. package/dist/modules/dock/runtime/pipeline.d.ts.map +0 -1
  705. package/dist/modules/dock/runtime/provider-actions.d.ts +0 -38
  706. package/dist/modules/dock/runtime/provider-actions.d.ts.map +0 -1
  707. package/dist/modules/dock/status/action-options.d.ts +0 -35
  708. package/dist/modules/dock/status/action-options.d.ts.map +0 -1
  709. package/dist/modules/dock/surface/components/surface-extensions-provider.d.ts +0 -5
  710. package/dist/modules/dock/surface/components/surface-extensions-provider.d.ts.map +0 -1
  711. package/dist/modules/dock/surface/components/surface-flow-provider.d.ts +0 -7
  712. package/dist/modules/dock/surface/components/surface-flow-provider.d.ts.map +0 -1
  713. package/dist/modules/dock/surface/constants.d.ts +0 -5
  714. package/dist/modules/dock/surface/constants.d.ts.map +0 -1
  715. package/dist/modules/dock/surface/hooks/use-surface-controls-model.d.ts +0 -15
  716. package/dist/modules/dock/surface/hooks/use-surface-controls-model.d.ts.map +0 -1
  717. package/dist/modules/dock/surface/hooks/use-surface-extensions-bar-model.d.ts +0 -7
  718. package/dist/modules/dock/surface/hooks/use-surface-extensions-bar-model.d.ts.map +0 -1
  719. package/dist/modules/dock/surface/hooks/use-surface-extensions.d.ts +0 -14
  720. package/dist/modules/dock/surface/hooks/use-surface-extensions.d.ts.map +0 -1
  721. package/dist/modules/dock/surface/hooks/use-surface-flow.d.ts.map +0 -1
  722. package/dist/modules/dock/surface/hooks/use-surface-header-button-model.d.ts +0 -13
  723. package/dist/modules/dock/surface/hooks/use-surface-header-button-model.d.ts.map +0 -1
  724. package/dist/modules/dock/surface/hooks/use-surface-shell-model.d.ts.map +0 -1
  725. package/dist/modules/dock/surface/lib/drag.d.ts +0 -9
  726. package/dist/modules/dock/surface/lib/drag.d.ts.map +0 -1
  727. package/dist/modules/dock/surface/lib/target.d.ts +0 -8
  728. package/dist/modules/dock/surface/lib/target.d.ts.map +0 -1
  729. package/dist/modules/dock/surface/machine.d.ts.map +0 -1
  730. package/dist/modules/dock/surface/model/builder.d.ts.map +0 -1
  731. package/dist/modules/dock/surface/model/normalize.d.ts.map +0 -1
  732. package/dist/modules/dock/surface/model/open.d.ts +0 -26
  733. package/dist/modules/dock/surface/model/open.d.ts.map +0 -1
  734. package/dist/modules/dock/surface/model/records.d.ts.map +0 -1
  735. package/dist/modules/dock/surface/model/steps.d.ts +0 -9
  736. package/dist/modules/dock/surface/model/steps.d.ts.map +0 -1
  737. package/dist/modules/dock/surface/model/transition-state.d.ts.map +0 -1
  738. package/dist/modules/dock/surface/model/url.d.ts.map +0 -1
  739. package/dist/modules/dock/surface/runtime/context.d.ts +0 -29
  740. package/dist/modules/dock/surface/runtime/context.d.ts.map +0 -1
  741. package/dist/modules/dock/surface/runtime/release.d.ts +0 -9
  742. package/dist/modules/dock/surface/runtime/release.d.ts.map +0 -1
  743. package/dist/modules/dock/surface/stack.d.ts.map +0 -1
  744. package/dist/modules/dock/types/compact.d.ts +0 -13
  745. package/dist/modules/dock/types/compact.d.ts.map +0 -1
  746. package/dist/modules/modal/components/close-button.d.ts +0 -6
  747. package/dist/modules/modal/components/close-button.d.ts.map +0 -1
  748. package/dist/modules/modal/components/modal-container.d.ts.map +0 -1
  749. package/dist/modules/modal/components/modal-layer-switcher.d.ts +0 -9
  750. package/dist/modules/modal/components/modal-layer-switcher.d.ts.map +0 -1
  751. package/dist/modules/modal/components/modal-layer.d.ts +0 -17
  752. package/dist/modules/modal/components/modal-layer.d.ts.map +0 -1
  753. package/dist/modules/modal/components/overlay.d.ts.map +0 -1
  754. package/dist/modules/modal/components/resolve-header.d.ts +0 -10
  755. package/dist/modules/modal/components/resolve-header.d.ts.map +0 -1
  756. package/dist/modules/modal/components/slot-row.d.ts +0 -12
  757. package/dist/modules/modal/components/slot-row.d.ts.map +0 -1
  758. package/dist/modules/modal/hooks/use-mobile-viewport.d.ts +0 -3
  759. package/dist/modules/modal/hooks/use-mobile-viewport.d.ts.map +0 -1
  760. package/dist/modules/modal/hooks/use-modal-focus-trap.d.ts +0 -12
  761. package/dist/modules/modal/hooks/use-modal-focus-trap.d.ts.map +0 -1
  762. package/dist/modules/modal/hooks/use-modal-scroll-lock.d.ts +0 -3
  763. package/dist/modules/modal/hooks/use-modal-scroll-lock.d.ts.map +0 -1
  764. package/dist/modules/modal/lib/dom.d.ts.map +0 -1
  765. package/dist/modules/modal/lib/theme.d.ts +0 -4
  766. package/dist/modules/modal/lib/theme.d.ts.map +0 -1
  767. package/dist/modules/modal/model/entry.d.ts +0 -18
  768. package/dist/modules/modal/model/entry.d.ts.map +0 -1
  769. package/dist/modules/modal/model/header.d.ts +0 -16
  770. package/dist/modules/modal/model/header.d.ts.map +0 -1
  771. package/dist/modules/modal/model/identity.d.ts +0 -13
  772. package/dist/modules/modal/model/identity.d.ts.map +0 -1
  773. package/dist/modules/modal/model/layout.d.ts.map +0 -1
  774. package/dist/modules/modal/model/state.d.ts +0 -10
  775. package/dist/modules/modal/model/state.d.ts.map +0 -1
  776. package/dist/overlay-7QLGWHCH.js +0 -13
  777. package/dist/react/hooks/types.d.ts +0 -25
  778. package/dist/react/hooks/types.d.ts.map +0 -1
  779. package/dist/react/ui/components/avatar.d.ts +0 -6
  780. package/dist/react/ui/components/avatar.d.ts.map +0 -1
  781. package/dist/react/ui/components/button.d.ts +0 -6
  782. package/dist/react/ui/components/button.d.ts.map +0 -1
  783. package/dist/react/ui/components/carousel.d.ts +0 -6
  784. package/dist/react/ui/components/carousel.d.ts.map +0 -1
  785. package/dist/react/ui/components/checkbox.d.ts +0 -10
  786. package/dist/react/ui/components/checkbox.d.ts.map +0 -1
  787. package/dist/react/ui/components/icon.d.ts +0 -6
  788. package/dist/react/ui/components/icon.d.ts.map +0 -1
  789. package/dist/react/ui/components/image.d.ts +0 -6
  790. package/dist/react/ui/components/image.d.ts.map +0 -1
  791. package/dist/react/ui/components/indicator.d.ts +0 -45
  792. package/dist/react/ui/components/indicator.d.ts.map +0 -1
  793. package/dist/react/ui/components/input.d.ts +0 -10
  794. package/dist/react/ui/components/input.d.ts.map +0 -1
  795. package/dist/react/ui/components/loader.d.ts +0 -10
  796. package/dist/react/ui/components/loader.d.ts.map +0 -1
  797. package/dist/react/ui/components/segmented.d.ts +0 -6
  798. package/dist/react/ui/components/segmented.d.ts.map +0 -1
  799. package/dist/react/ui/components/select-parts.d.ts +0 -22
  800. package/dist/react/ui/components/select-parts.d.ts.map +0 -1
  801. package/dist/react/ui/components/select.d.ts +0 -6
  802. package/dist/react/ui/components/select.d.ts.map +0 -1
  803. package/dist/react/ui/components/skeleton.d.ts +0 -10
  804. package/dist/react/ui/components/skeleton.d.ts.map +0 -1
  805. package/dist/react/ui/components/switch.d.ts +0 -6
  806. package/dist/react/ui/components/switch.d.ts.map +0 -1
  807. package/dist/react/ui/components/tooltip-group.d.ts +0 -34
  808. package/dist/react/ui/components/tooltip-group.d.ts.map +0 -1
  809. package/dist/react/ui/components/tooltip-placement.d.ts +0 -43
  810. package/dist/react/ui/components/tooltip-placement.d.ts.map +0 -1
  811. package/dist/react/ui/components/tooltip-slot.d.ts +0 -23
  812. package/dist/react/ui/components/tooltip-slot.d.ts.map +0 -1
  813. package/dist/react/ui/components/tooltip.d.ts +0 -13
  814. package/dist/react/ui/components/tooltip.d.ts.map +0 -1
  815. package/dist/react/ui/index.d.ts +0 -19
  816. package/dist/react/ui/index.d.ts.map +0 -1
  817. package/dist/react/ui/provider.d.ts +0 -22
  818. package/dist/react/ui/provider.d.ts.map +0 -1
  819. package/dist/react/ui/types-controls.d.ts +0 -133
  820. package/dist/react/ui/types-controls.d.ts.map +0 -1
  821. package/dist/react/ui/types.d.ts +0 -213
  822. package/dist/react/ui/types.d.ts.map +0 -1
  823. package/dist/react/ui/utils.d.ts +0 -65
  824. package/dist/react/ui/utils.d.ts.map +0 -1
  825. package/dist/ui/index.d.ts +0 -1
  826. package/dist/ui/index.js +0 -2268
  827. package/dist/ui/index.js.map +0 -1
  828. package/docs/proposals/navigation.md +0 -210
  829. /package/dist/modules/ambient/{quantize.d.ts → analysis/quantize.d.ts} +0 -0
  830. /package/dist/modules/background/{components/overlay.d.ts → overlay.d.ts} +0 -0
  831. /package/dist/modules/background/{model/playback.d.ts → playback.d.ts} +0 -0
  832. /package/dist/modules/background/youtube/{lib/audio.d.ts → audio.d.ts} +0 -0
  833. /package/dist/modules/dock/{components → card}/compact.d.ts +0 -0
  834. /package/dist/modules/dock/{components → commands}/command-bar.d.ts +0 -0
  835. /package/dist/modules/dock/{components → routing}/breadcrumbs-card.d.ts +0 -0
  836. /package/dist/modules/dock/{model → routing}/paths.d.ts +0 -0
  837. /package/dist/modules/dock/{components → stack}/dock.d.ts +0 -0
  838. /package/dist/modules/dock/surface/{model → runtime}/url.d.ts +0 -0
  839. /package/dist/modules/modal/{lib/dom.d.ts → dom.d.ts} +0 -0
  840. /package/dist/modules/modal/{components/overlay.d.ts → overlay.d.ts} +0 -0
@@ -1,12 +1,11 @@
1
- import { useOptionalMediaActions } from './chunk-ZXRE2KZO.js';
2
- import { defineModule, useRegistryValue, useModuleRegistration } from './chunk-IH3STE7W.js';
3
- import { useStore, useRequiredContext } from './chunk-WQTMOUCA.js';
4
- import { Spinner } from './chunk-7VU2OAJB.js';
5
- import { cn } from './chunk-TAWTGCWJ.js';
6
- import { defineThemeSpec, useTheme, useMotionTokens, useModuleMotion } from './chunk-ESD5EQ5H.js';
7
- import { createStore, cssEasing, report } from './chunk-D222OCTV.js';
1
+ import { useOptionalMediaActions } from './chunk-C3SEBNF5.js';
2
+ import { cn } from './chunk-GG2ILNK2.js';
3
+ import { defineModule, useRegistryValue, useModuleRegistration } from './chunk-ED32WLAD.js';
4
+ import { useStore, useRequiredContext } from './chunk-JWUKAZ3A.js';
5
+ import { defineThemeSpec, useTheme, useMotionTokens, useModuleMotion, ThemeSpinner } from './chunk-AKPH5CEJ.js';
6
+ import { createStore, cssEasing, report } from './chunk-S67HGKJ2.js';
8
7
  import { getOrCreateGlobalContext } from './chunk-J3VTDBC6.js';
9
- import { retime } from './chunk-BMFHS3GV.js';
8
+ import { retime } from './chunk-YHWA7FXX.js';
10
9
  import { c } from 'react/compiler-runtime';
11
10
  import { motion, AnimatePresence } from 'motion/react';
12
11
  import { useState, useLayoutEffect, useEffect, use, useRef, useCallback } from 'react';
@@ -19,67 +18,82 @@ var BACKGROUND_REGISTRY_KEY = "page-background";
19
18
  var BACKGROUND_MEDIA_ID = "background";
20
19
  var DEFAULT_AUDIBLE_VOLUME = 0.8;
21
20
  var PROXY_UNMUTE_VOLUME = 0.7;
22
- function useBackgroundMediaSource(state, actions) {
23
- const $ = c(11);
24
- const media = useOptionalMediaActions();
25
- const {
26
- isPlaying,
27
- isVideo,
28
- videoElement
29
- } = state;
30
- const isLoop = Boolean(state.videoOptions?.loop);
31
- let t0;
32
- let t1;
33
- if ($[0] !== actions || $[1] !== isLoop || $[2] !== isPlaying || $[3] !== isVideo || $[4] !== media || $[5] !== videoElement) {
34
- t0 = () => {
35
- if (!isVideo) {
36
- media.removeSource(BACKGROUND_MEDIA_ID);
37
- return;
38
- }
39
- media.upsertSource({
40
- controls: {
41
- setMuted: actions.setVideoMuted,
42
- toggle: actions.toggleVideo,
43
- toggleLoop: actions.toggleLoop
44
- },
45
- element: videoElement ?? null,
46
- id: BACKGROUND_MEDIA_ID,
47
- isPlaying,
48
- kind: "video",
49
- loop: isLoop
21
+
22
+ // src/modules/background/playback.ts
23
+ function applyVideoPlaybackState({
24
+ isPlaying,
25
+ playbackRate,
26
+ setVideoPlaying,
27
+ videoElement
28
+ }) {
29
+ if (!videoElement) return;
30
+ const numericPlaybackRate = Number(playbackRate);
31
+ const resolvedPlaybackRate = Number.isFinite(numericPlaybackRate) && numericPlaybackRate > 0 ? numericPlaybackRate : 1;
32
+ try {
33
+ if (videoElement.playbackRate !== resolvedPlaybackRate) {
34
+ videoElement.playbackRate = resolvedPlaybackRate;
35
+ }
36
+ } catch {
37
+ return;
38
+ }
39
+ if (!isPlaying) {
40
+ if (!videoElement.paused) videoElement.pause();
41
+ return;
42
+ }
43
+ if (videoElement.readyState === 0) {
44
+ return;
45
+ }
46
+ const playPromise = videoElement.play();
47
+ if (!playPromise || typeof playPromise.then !== "function") return;
48
+ playPromise.then(() => setVideoPlaying(true)).catch((error) => {
49
+ if (error?.name === "AbortError" || videoElement.readyState < 2) {
50
+ return;
51
+ }
52
+ if (error?.name === "NotAllowedError") {
53
+ videoElement.muted = true;
54
+ videoElement.play().then(() => setVideoPlaying(true)).catch(() => {
50
55
  });
51
- };
52
- t1 = [actions, isLoop, isPlaying, isVideo, media, videoElement];
53
- $[0] = actions;
54
- $[1] = isLoop;
55
- $[2] = isPlaying;
56
- $[3] = isVideo;
57
- $[4] = media;
58
- $[5] = videoElement;
59
- $[6] = t0;
60
- $[7] = t1;
56
+ return;
57
+ }
58
+ setVideoPlaying(false);
59
+ });
60
+ }
61
+ function triggerVideoPlaybackDirect(videoElement, nextPlaying, configuredMuted) {
62
+ if (!videoElement) return;
63
+ if (nextPlaying) {
64
+ videoElement.muted = configuredMuted;
65
+ if (!configuredMuted && videoElement.volume === 0) {
66
+ videoElement.volume = DEFAULT_AUDIBLE_VOLUME;
67
+ }
68
+ videoElement.play().catch((err) => {
69
+ if (err?.name === "NotAllowedError") {
70
+ videoElement.muted = true;
71
+ videoElement.play().catch(() => {
72
+ });
73
+ }
74
+ });
61
75
  } else {
62
- t0 = $[6];
63
- t1 = $[7];
76
+ videoElement.pause();
64
77
  }
65
- useEffect(t0, t1);
66
- let t2;
67
- let t3;
68
- if ($[8] !== media) {
69
- t2 = () => () => media.removeSource(BACKGROUND_MEDIA_ID);
70
- t3 = [media];
71
- $[8] = media;
72
- $[9] = t2;
73
- $[10] = t3;
74
- } else {
75
- t2 = $[9];
76
- t3 = $[10];
78
+ }
79
+ function syncVideoMutedDirect(videoElement, nextMuted) {
80
+ if (!videoElement) return;
81
+ videoElement.muted = nextMuted;
82
+ if (!nextMuted && videoElement.volume === 0) {
83
+ videoElement.volume = DEFAULT_AUDIBLE_VOLUME;
77
84
  }
78
- useEffect(t2, t3);
85
+ }
86
+ function syncVideoLoopDirect(videoElement, nextLoop) {
87
+ if (!videoElement) return;
88
+ videoElement.loop = nextLoop;
89
+ }
90
+ function isElementPlaying(element, fallback) {
91
+ return element ? !element.paused && !element.ended : Boolean(fallback);
79
92
  }
80
93
 
81
- // src/modules/background/youtube/lib/parse.ts
94
+ // src/modules/background/youtube/parse.ts
82
95
  var YOUTUBE_ID_PATTERN = /^[a-zA-Z0-9_-]{11}$/;
96
+ var YOUTUBE_HOST_PATH = /^(?:www\.|m\.|music\.)?(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\//i;
83
97
  function parseYouTubeTimeParam(value) {
84
98
  if (value === void 0 || value === null || value === "") return 0;
85
99
  if (typeof value === "number") {
@@ -99,7 +113,6 @@ function parseYouTubeTimeParam(value) {
99
113
  }
100
114
  return 0;
101
115
  }
102
- var YOUTUBE_HOST_PATH = /^(?:www\.|m\.|music\.)?(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\//i;
103
116
  function toUrl(input, {
104
117
  youtubeOnly = false
105
118
  } = {}) {
@@ -249,7 +262,7 @@ function createYouTubeVideoElementProxy(controller) {
249
262
  return proxyVideo;
250
263
  }
251
264
 
252
- // src/modules/background/model/state.ts
265
+ // src/modules/background/state.ts
253
266
  var DEFAULT_BACKGROUND = Object.freeze({
254
267
  animation: null,
255
268
  className: "",
@@ -386,8 +399,6 @@ function computeBackgroundState(background) {
386
399
  youtubeVideoId
387
400
  };
388
401
  }
389
-
390
- // src/modules/background/model/override.ts
391
402
  function mergeOverridePatch(currentPatch, nextPatch) {
392
403
  return {
393
404
  ...currentPatch || {},
@@ -414,78 +425,6 @@ function applyOverrideUpdate(prev, inputs, updater) {
414
425
  pathname: currentPath
415
426
  };
416
427
  }
417
-
418
- // src/modules/background/model/playback.ts
419
- function applyVideoPlaybackState({
420
- isPlaying,
421
- playbackRate,
422
- setVideoPlaying,
423
- videoElement
424
- }) {
425
- if (!videoElement) return;
426
- const numericPlaybackRate = Number(playbackRate);
427
- const resolvedPlaybackRate = Number.isFinite(numericPlaybackRate) && numericPlaybackRate > 0 ? numericPlaybackRate : 1;
428
- try {
429
- if (videoElement.playbackRate !== resolvedPlaybackRate) {
430
- videoElement.playbackRate = resolvedPlaybackRate;
431
- }
432
- } catch {
433
- return;
434
- }
435
- if (!isPlaying) {
436
- if (!videoElement.paused) videoElement.pause();
437
- return;
438
- }
439
- if (videoElement.readyState === 0) {
440
- return;
441
- }
442
- const playPromise = videoElement.play();
443
- if (!playPromise || typeof playPromise.then !== "function") return;
444
- playPromise.then(() => setVideoPlaying(true)).catch((error) => {
445
- if (error?.name === "AbortError" || videoElement.readyState < 2) {
446
- return;
447
- }
448
- if (error?.name === "NotAllowedError") {
449
- videoElement.muted = true;
450
- videoElement.play().then(() => setVideoPlaying(true)).catch(() => {
451
- });
452
- return;
453
- }
454
- setVideoPlaying(false);
455
- });
456
- }
457
- function triggerVideoPlaybackDirect(videoElement, nextPlaying, configuredMuted) {
458
- if (!videoElement) return;
459
- if (nextPlaying) {
460
- videoElement.muted = configuredMuted;
461
- if (!configuredMuted && videoElement.volume === 0) {
462
- videoElement.volume = DEFAULT_AUDIBLE_VOLUME;
463
- }
464
- videoElement.play().catch((err) => {
465
- if (err?.name === "NotAllowedError") {
466
- videoElement.muted = true;
467
- videoElement.play().catch(() => {
468
- });
469
- }
470
- });
471
- } else {
472
- videoElement.pause();
473
- }
474
- }
475
- function syncVideoMutedDirect(videoElement, nextMuted) {
476
- if (!videoElement) return;
477
- videoElement.muted = nextMuted;
478
- if (!nextMuted && videoElement.volume === 0) {
479
- videoElement.volume = DEFAULT_AUDIBLE_VOLUME;
480
- }
481
- }
482
- function syncVideoLoopDirect(videoElement, nextLoop) {
483
- if (!videoElement) return;
484
- videoElement.loop = nextLoop;
485
- }
486
- function isElementPlaying(element, fallback) {
487
- return element ? !element.paused && !element.ended : Boolean(fallback);
488
- }
489
428
  var BackgroundContext = getOrCreateGlobalContext("BackgroundContext", null);
490
429
  function createBackground(initial) {
491
430
  let inputs = initial;
@@ -690,50 +629,102 @@ function BackgroundProvider(t0) {
690
629
  }
691
630
  return t8;
692
631
  }
693
-
694
- // src/modules/background/hooks.ts
695
- var NOOP_BACKGROUND_STORE = createStore(DEFAULT_BACKGROUND_COMPUTED);
696
- function useBackgroundRegistration(config, options) {
697
- useModuleRegistration("background", config, options);
698
- }
699
- function useBackgroundState() {
632
+ function useBackgroundMediaSource(state, actions) {
633
+ const $ = c(11);
634
+ const media = useOptionalMediaActions();
700
635
  const {
701
- store
702
- } = useRequiredContext(BackgroundContext, "useBackgroundState", "BackgroundProvider");
703
- return useStore(store);
704
- }
705
- function useBackgroundActions() {
706
- return useRequiredContext(BackgroundContext, "useBackgroundActions", "BackgroundProvider").actions;
707
- }
708
- function useBackground(config, options) {
709
- const $ = c(3);
710
- useBackgroundRegistration(config, options);
711
- const actions = useBackgroundActions();
712
- const state = useBackgroundState();
636
+ isPlaying,
637
+ isVideo,
638
+ videoElement
639
+ } = state;
640
+ const isLoop = Boolean(state.videoOptions?.loop);
713
641
  let t0;
714
- if ($[0] !== actions || $[1] !== state) {
715
- t0 = {
716
- ...state,
717
- ...actions
642
+ let t1;
643
+ if ($[0] !== actions || $[1] !== isLoop || $[2] !== isPlaying || $[3] !== isVideo || $[4] !== media || $[5] !== videoElement) {
644
+ t0 = () => {
645
+ if (!isVideo) {
646
+ media.removeSource(BACKGROUND_MEDIA_ID);
647
+ return;
648
+ }
649
+ media.upsertSource({
650
+ controls: {
651
+ setMuted: actions.setVideoMuted,
652
+ toggle: actions.toggleVideo,
653
+ toggleLoop: actions.toggleLoop
654
+ },
655
+ element: videoElement ?? null,
656
+ id: BACKGROUND_MEDIA_ID,
657
+ isPlaying,
658
+ kind: "video",
659
+ loop: isLoop
660
+ });
718
661
  };
662
+ t1 = [actions, isLoop, isPlaying, isVideo, media, videoElement];
719
663
  $[0] = actions;
720
- $[1] = state;
721
- $[2] = t0;
664
+ $[1] = isLoop;
665
+ $[2] = isPlaying;
666
+ $[3] = isVideo;
667
+ $[4] = media;
668
+ $[5] = videoElement;
669
+ $[6] = t0;
670
+ $[7] = t1;
722
671
  } else {
723
- t0 = $[2];
672
+ t0 = $[6];
673
+ t1 = $[7];
724
674
  }
725
- return t0;
675
+ useEffect(t0, t1);
676
+ let t2;
677
+ let t3;
678
+ if ($[8] !== media) {
679
+ t2 = () => () => media.removeSource(BACKGROUND_MEDIA_ID);
680
+ t3 = [media];
681
+ $[8] = media;
682
+ $[9] = t2;
683
+ $[10] = t3;
684
+ } else {
685
+ t2 = $[9];
686
+ t3 = $[10];
687
+ }
688
+ useEffect(t2, t3);
726
689
  }
727
- function useOptionalBackgroundState(selector, isEqual) {
728
- const ctx = use(BackgroundContext);
729
- return useStore(ctx?.store ?? NOOP_BACKGROUND_STORE, selector, isEqual);
690
+
691
+ // src/modules/background/motion.ts
692
+ function useBackgroundMotion() {
693
+ return useModuleMotion(backgroundTheme);
730
694
  }
731
- function useOptionalBackgroundActions() {
732
- const ctx = use(BackgroundContext);
733
- return ctx?.actions ?? INERT_BACKGROUND_ACTIONS;
695
+ function getBackgroundMotionConfig(motion2, animation) {
696
+ return {
697
+ animate: animation?.animate ?? motion2.animate,
698
+ exit: animation?.exit ?? motion2.exit,
699
+ exitDurationFactor: Number(animation?.exitDurationFactor),
700
+ initial: animation?.initial ?? motion2.initial,
701
+ transition: animation?.transition ?? motion2.transition
702
+ };
703
+ }
704
+ function getBackgroundExitTransition(motion2, config) {
705
+ const own = config.exit.transition;
706
+ const fallback = motion2.exit.transition;
707
+ const factor = Number.isFinite(config.exitDurationFactor) ? Math.max(0, config.exitDurationFactor) : motion2.exitDurationFactor;
708
+ return {
709
+ ...config.transition,
710
+ delay: 0,
711
+ duration: own?.duration ?? (config.transition.duration ?? motion2.transition.duration ?? 0) * factor,
712
+ ease: own?.ease ?? fallback?.ease
713
+ };
714
+ }
715
+ function toCssDuration(seconds, fallback = 0) {
716
+ const value = Number(seconds);
717
+ return `${Math.max(0, Number.isFinite(value) ? value : fallback) * 1e3}ms`;
718
+ }
719
+ function toCssDelay(seconds) {
720
+ const value = Number(seconds);
721
+ return `${Math.max(0, Number.isFinite(value) ? value : 0) * 1e3}ms`;
722
+ }
723
+ function toCssEasing(easing) {
724
+ return cssEasing(easing);
734
725
  }
735
726
 
736
- // src/modules/background/model/visual.ts
727
+ // src/modules/background/visual.ts
737
728
  var objectFit = (value) => ({
738
729
  objectFit: value
739
730
  });
@@ -759,6 +750,11 @@ var BG_TOKEN_TO_OBJECT_STYLE = Object.freeze({
759
750
  var OBJECT_FITS = Object.freeze(["contain", "cover", "fill", "none", "scale-down"]);
760
751
  var DEFAULT_COLOR = "currentColor";
761
752
  var WIDTH_CLASS = /^(w-|max-w-|min-w-)/;
753
+ var FADE_PERCENT_PER_STRENGTH = 7.5;
754
+ var MIN_FADE_PERCENT = 12;
755
+ var MAX_FADE_PERCENT = 48;
756
+ var WIDTH_FADE_PERCENT = 20;
757
+ var OPACITY_PER_STRENGTH = 0.22;
762
758
  function resolveVideoClassNames(...inputs) {
763
759
  const tokens = inputs.flatMap((input) => typeof input === "string" ? input.replace(/,/g, " ").split(/\s+/) : []).filter(Boolean);
764
760
  return {
@@ -803,18 +799,17 @@ function getVisualStyle(currentStyle = {}) {
803
799
  rightGradient: Number(rightGradient) || 0
804
800
  };
805
801
  }
802
+ var fadePercentFor = (strength) => Math.min(MAX_FADE_PERCENT, Math.max(MIN_FADE_PERCENT, strength * FADE_PERCENT_PER_STRENGTH));
803
+ var opacityFor = (strength) => strength > 0 ? Math.min(1, strength * OPACITY_PER_STRENGTH) : 0;
806
804
  function resolveGradientSettings({
807
805
  fadeEdges = null,
808
806
  hasWidth = false,
809
807
  leftGradient = 0,
810
808
  rightGradient = 0
811
809
  }) {
812
- let leftPercent = 0;
813
- let rightPercent = 0;
814
- if (leftGradient > 0) leftPercent = Math.min(48, Math.max(12, leftGradient * 7.5));
815
- else if (hasWidth && fadeEdges !== false) leftPercent = 20;
816
- if (rightGradient > 0) rightPercent = Math.min(48, Math.max(12, rightGradient * 7.5));
817
- else if (hasWidth && fadeEdges !== false) rightPercent = 20;
810
+ const widthFade = hasWidth && fadeEdges !== false ? WIDTH_FADE_PERCENT : 0;
811
+ let leftPercent = leftGradient > 0 ? fadePercentFor(leftGradient) : widthFade;
812
+ let rightPercent = rightGradient > 0 ? fadePercentFor(rightGradient) : widthFade;
818
813
  if (typeof fadeEdges === "number") {
819
814
  leftPercent = fadeEdges;
820
815
  rightPercent = fadeEdges;
@@ -834,13 +829,11 @@ function resolveGradientSettings({
834
829
  leftPercent = 0;
835
830
  rightPercent = 0;
836
831
  }
837
- const leftOpacity = leftGradient > 0 ? Math.min(1, leftGradient * 0.22) : 0;
838
- const rightOpacity = rightGradient > 0 ? Math.min(1, rightGradient * 0.22) : 0;
839
832
  return {
840
833
  enabled: leftPercent > 0 || rightPercent > 0,
841
- leftOpacity,
834
+ leftOpacity: opacityFor(leftGradient),
842
835
  leftPercent,
843
- rightOpacity,
836
+ rightOpacity: opacityFor(rightGradient),
844
837
  rightPercent
845
838
  };
846
839
  }
@@ -899,8 +892,6 @@ function resolveCssWidth(rawWidth) {
899
892
  }
900
893
  return typeof rawWidth === "number" ? `${rawWidth}px` : String(rawWidth);
901
894
  }
902
-
903
- // src/modules/background/model/video-frame.ts
904
895
  function resolveVideoFrame({
905
896
  baseStyle,
906
897
  className,
@@ -959,99 +950,47 @@ function resolveVideoFrame({
959
950
  };
960
951
  }
961
952
 
962
- // src/modules/background/motion.ts
963
- function useBackgroundMotion() {
964
- return useModuleMotion(backgroundTheme);
965
- }
966
- function getBackgroundMotionConfig(motion2, animation) {
967
- return {
968
- animate: animation?.animate ?? motion2.animate,
969
- exit: animation?.exit ?? motion2.exit,
970
- exitDurationFactor: Number(animation?.exitDurationFactor),
971
- initial: animation?.initial ?? motion2.initial,
972
- transition: animation?.transition ?? motion2.transition
973
- };
974
- }
975
- function getBackgroundExitTransition(motion2, config) {
976
- const own = config.exit.transition;
977
- const fallback = motion2.exit.transition;
978
- const factor = Number.isFinite(config.exitDurationFactor) ? Math.max(0, config.exitDurationFactor) : motion2.exitDurationFactor;
979
- return {
980
- ...config.transition,
981
- delay: 0,
982
- duration: own?.duration ?? (config.transition.duration ?? motion2.transition.duration ?? 0) * factor,
983
- ease: own?.ease ?? fallback?.ease
984
- };
985
- }
986
- function toCssDuration(seconds, fallback = 0) {
987
- const value = Number(seconds);
988
- return `${Math.max(0, Number.isFinite(value) ? value : fallback) * 1e3}ms`;
953
+ // src/modules/background/hooks.ts
954
+ var NOOP_BACKGROUND_STORE = createStore(DEFAULT_BACKGROUND_COMPUTED);
955
+ function useBackgroundRegistration(config, options) {
956
+ useModuleRegistration("background", config, options);
989
957
  }
990
- function toCssDelay(seconds) {
991
- const value = Number(seconds);
992
- return `${Math.max(0, Number.isFinite(value) ? value : 0) * 1e3}ms`;
958
+ function useBackgroundState() {
959
+ const {
960
+ store
961
+ } = useRequiredContext(BackgroundContext, "useBackgroundState", "BackgroundProvider");
962
+ return useStore(store);
993
963
  }
994
- function toCssEasing(easing) {
995
- return cssEasing(easing);
964
+ function useBackgroundActions() {
965
+ return useRequiredContext(BackgroundContext, "useBackgroundActions", "BackgroundProvider").actions;
996
966
  }
997
-
998
- // src/modules/background/hooks/use-background-motion-model.ts
999
- function useBackgroundMotionModel(animation) {
1000
- const $ = c(12);
1001
- const backgroundMotion = useBackgroundMotion();
1002
- const {
1003
- reduced,
1004
- still,
1005
- tempo
1006
- } = useMotionTokens();
1007
- let motionConfig;
1008
- let overlayTransitionStyle;
967
+ function useBackground(config, options) {
968
+ const $ = c(3);
969
+ useBackgroundRegistration(config, options);
970
+ const actions = useBackgroundActions();
971
+ const state = useBackgroundState();
1009
972
  let t0;
1010
- if ($[0] !== animation || $[1] !== backgroundMotion || $[2] !== reduced || $[3] !== still || $[4] !== tempo) {
1011
- motionConfig = getBackgroundMotionConfig(backgroundMotion, retime(animation, {
1012
- reduced,
1013
- still,
1014
- tempo
1015
- }));
1016
- overlayTransitionStyle = {
1017
- transitionDelay: toCssDelay(motionConfig.transition.delay),
1018
- transitionDuration: toCssDuration(motionConfig.transition.duration, backgroundMotion.transition.duration),
1019
- transitionProperty: "opacity",
1020
- transitionTimingFunction: toCssEasing(motionConfig.transition.ease)
1021
- };
1022
- t0 = getBackgroundExitTransition(backgroundMotion, motionConfig);
1023
- $[0] = animation;
1024
- $[1] = backgroundMotion;
1025
- $[2] = reduced;
1026
- $[3] = still;
1027
- $[4] = tempo;
1028
- $[5] = motionConfig;
1029
- $[6] = overlayTransitionStyle;
1030
- $[7] = t0;
1031
- } else {
1032
- motionConfig = $[5];
1033
- overlayTransitionStyle = $[6];
1034
- t0 = $[7];
1035
- }
1036
- const exitTransition = t0;
1037
- let t1;
1038
- if ($[8] !== exitTransition || $[9] !== motionConfig || $[10] !== overlayTransitionStyle) {
1039
- t1 = {
1040
- exitTransition,
1041
- motionConfig,
1042
- overlayTransitionStyle
973
+ if ($[0] !== actions || $[1] !== state) {
974
+ t0 = {
975
+ ...state,
976
+ ...actions
1043
977
  };
1044
- $[8] = exitTransition;
1045
- $[9] = motionConfig;
1046
- $[10] = overlayTransitionStyle;
1047
- $[11] = t1;
978
+ $[0] = actions;
979
+ $[1] = state;
980
+ $[2] = t0;
1048
981
  } else {
1049
- t1 = $[11];
982
+ t0 = $[2];
1050
983
  }
1051
- return t1;
984
+ return t0;
985
+ }
986
+ function useOptionalBackgroundState(selector, isEqual) {
987
+ const ctx = use(BackgroundContext);
988
+ return useStore(ctx?.store ?? NOOP_BACKGROUND_STORE, selector, isEqual);
989
+ }
990
+ function useOptionalBackgroundActions() {
991
+ const ctx = use(BackgroundContext);
992
+ return ctx?.actions ?? INERT_BACKGROUND_ACTIONS;
1052
993
  }
1053
-
1054
- // src/modules/background/hooks/use-background-overlay-model.ts
1055
994
  function resolveBackgroundKey({
1056
995
  image,
1057
996
  isVideo,
@@ -1289,88 +1228,79 @@ function useBackgroundOverlayModel() {
1289
1228
  }
1290
1229
  return t3;
1291
1230
  }
1231
+ function useBackgroundMotionModel(animation) {
1232
+ const $ = c(12);
1233
+ const backgroundMotion = useBackgroundMotion();
1234
+ const {
1235
+ reduced,
1236
+ still,
1237
+ tempo
1238
+ } = useMotionTokens();
1239
+ let motionConfig;
1240
+ let overlayTransitionStyle;
1241
+ let t0;
1242
+ if ($[0] !== animation || $[1] !== backgroundMotion || $[2] !== reduced || $[3] !== still || $[4] !== tempo) {
1243
+ motionConfig = getBackgroundMotionConfig(backgroundMotion, retime(animation, {
1244
+ reduced,
1245
+ still,
1246
+ tempo
1247
+ }));
1248
+ overlayTransitionStyle = {
1249
+ transitionDelay: toCssDelay(motionConfig.transition.delay),
1250
+ transitionDuration: toCssDuration(motionConfig.transition.duration, backgroundMotion.transition.duration),
1251
+ transitionProperty: "opacity",
1252
+ transitionTimingFunction: toCssEasing(motionConfig.transition.ease)
1253
+ };
1254
+ t0 = getBackgroundExitTransition(backgroundMotion, motionConfig);
1255
+ $[0] = animation;
1256
+ $[1] = backgroundMotion;
1257
+ $[2] = reduced;
1258
+ $[3] = still;
1259
+ $[4] = tempo;
1260
+ $[5] = motionConfig;
1261
+ $[6] = overlayTransitionStyle;
1262
+ $[7] = t0;
1263
+ } else {
1264
+ motionConfig = $[5];
1265
+ overlayTransitionStyle = $[6];
1266
+ t0 = $[7];
1267
+ }
1268
+ const exitTransition = t0;
1269
+ let t1;
1270
+ if ($[8] !== exitTransition || $[9] !== motionConfig || $[10] !== overlayTransitionStyle) {
1271
+ t1 = {
1272
+ exitTransition,
1273
+ motionConfig,
1274
+ overlayTransitionStyle
1275
+ };
1276
+ $[8] = exitTransition;
1277
+ $[9] = motionConfig;
1278
+ $[10] = overlayTransitionStyle;
1279
+ $[11] = t1;
1280
+ } else {
1281
+ t1 = $[11];
1282
+ }
1283
+ return t1;
1284
+ }
1292
1285
 
1293
- // src/modules/background/youtube/lib/audio.ts
1294
- var AUDIO_SEEK_COOLDOWN_MS = 1500;
1295
- var AUDIO_DRIFT_LIMIT = 0.35;
1296
- var AUDIO_DRIFT_LIMIT_SILENT = 0.5;
1297
- var AUDIO_VOLUME_EPSILON = 5e-3;
1298
- var AUDIO_MIN_READY_STATE = 2;
1299
- var AUDIO_SYNC_EVENTS = ["play", "playing", "pause", "waiting", "volumechange", "ratechange"];
1300
- function setElementMuted(video, muted) {
1301
- video.muted = muted;
1302
- if (!muted && video.volume === 0) video.volume = DEFAULT_AUDIBLE_VOLUME;
1303
- }
1304
- function unlockAudioOnGesture(unlock) {
1305
- const handler = () => {
1306
- unlock();
1307
- window.removeEventListener("pointerdown", handler);
1308
- window.removeEventListener("keydown", handler);
1309
- };
1310
- window.addEventListener("pointerdown", handler, {
1311
- once: true
1312
- });
1313
- window.addEventListener("keydown", handler, {
1314
- once: true
1315
- });
1316
- }
1317
- function resolveCompanionVolume(volume) {
1318
- const numeric = Number(volume);
1319
- return Math.max(0, Math.min(1, Number.isFinite(numeric) ? numeric : 1));
1320
- }
1321
- function syncCompanionAudioElements({
1322
- audio,
1323
- forceSeek,
1324
- seekClock,
1325
- video
1326
- }) {
1327
- if (!video || !audio) return;
1328
- try {
1329
- const targetRate = Number(video.playbackRate) || 1;
1330
- if (audio.playbackRate !== targetRate) audio.playbackRate = targetRate;
1331
- if (audio.readyState < AUDIO_MIN_READY_STATE || !Number.isFinite(audio.duration) || audio.duration <= 0) {
1332
- return;
1333
- }
1334
- const volume = resolveCompanionVolume(video.volume);
1335
- if (Math.abs(audio.volume - volume) > AUDIO_VOLUME_EPSILON) {
1336
- audio.volume = volume;
1337
- }
1338
- const isSilent = Boolean(video.muted) || volume === 0;
1339
- if (audio.muted !== isSilent) audio.muted = isSilent;
1340
- if (video.paused || video.ended || video.seeking) {
1341
- if (!audio.paused) audio.pause();
1342
- return;
1343
- }
1344
- const now = performance.now();
1345
- const drift = Math.abs(audio.currentTime - video.currentTime);
1346
- const maxDrift = isSilent ? AUDIO_DRIFT_LIMIT_SILENT : AUDIO_DRIFT_LIMIT;
1347
- if (forceSeek || drift > maxDrift && now - seekClock.current > AUDIO_SEEK_COOLDOWN_MS) {
1348
- seekClock.current = now;
1349
- audio.currentTime = video.currentTime;
1350
- }
1351
- if (audio.paused) audio.play().catch(() => {
1352
- });
1353
- } catch {
1354
- }
1355
- }
1356
-
1357
- // src/modules/background/youtube/lib/timing.ts
1358
- function scheduleRetryTimer(timerIds, callback, delay) {
1359
- const timerId = window.setTimeout(() => {
1360
- timerIds.delete(timerId);
1361
- try {
1362
- callback();
1363
- } catch {
1364
- }
1365
- }, delay);
1366
- timerIds.add(timerId);
1286
+ // src/modules/background/youtube/timing.ts
1287
+ var IFRAME_MIN_END_MARGIN = 0.4;
1288
+ function scheduleRetryTimer(timerIds, callback, delay) {
1289
+ const timerId = window.setTimeout(() => {
1290
+ timerIds.delete(timerId);
1291
+ try {
1292
+ callback();
1293
+ } catch (error) {
1294
+ report("Background playback retry", error, "warn");
1295
+ }
1296
+ }, delay);
1297
+ timerIds.add(timerId);
1367
1298
  }
1368
1299
  function resolveEffectiveEnd(endTime, corp, duration) {
1369
1300
  if (endTime > 0) return endTime;
1370
1301
  if (corp > 0 && duration > 0) return duration - corp;
1371
1302
  return 0;
1372
1303
  }
1373
- var IFRAME_MIN_END_MARGIN = 0.4;
1374
1304
  function resolveIframeSafetyEnd(endTime, corp, duration) {
1375
1305
  if (endTime > 0) return endTime;
1376
1306
  if (duration > 0) return duration - Math.max(corp, IFRAME_MIN_END_MARGIN);
@@ -1384,213 +1314,303 @@ function isWithinCorp(currentTime, duration, corp) {
1384
1314
  if (!duration) return false;
1385
1315
  return corp > 0 && currentTime >= duration - corp;
1386
1316
  }
1387
-
1388
- // src/modules/background/youtube/lib/video-events.ts
1389
- var HAVE_CURRENT_DATA = 2;
1390
- var ERROR_RESUME_RETRY_DELAY_MS = 150;
1391
- var LOAD_RETRY_DELAY_MS = 200;
1392
- var AUDIO_RETRY_DELAY_MS = 200;
1393
- var MAX_VIDEO_LOAD_RETRIES = 1;
1394
- var MAX_AUDIO_LOAD_RETRIES = 1;
1395
- function playWithMutedFallback({
1396
- forceSeek,
1397
- live,
1398
- setVideoPlaying,
1399
- syncCompanionAudio,
1400
- unlockAudio,
1401
- video,
1402
- videoRef
1403
- }) {
1404
- const onPlayed = () => {
1405
- setVideoPlaying(true);
1406
- syncCompanionAudio(forceSeek);
1407
- };
1408
- video.play().then(onPlayed).catch((error) => {
1409
- if (error?.name !== "NotAllowedError") return;
1410
- video.muted = true;
1411
- video.play().then(() => {
1412
- onPlayed();
1413
- if (!unlockAudio) return;
1414
- unlockAudioOnGesture(() => {
1415
- const current = videoRef.current;
1416
- if (!live.current.isMuted && current) {
1417
- setElementMuted(current, false);
1418
- }
1419
- });
1420
- }).catch(() => {
1421
- });
1422
- });
1423
- }
1424
- function endVideoPlayback(ctx) {
1317
+ function NativeVideo(t0) {
1318
+ const $ = c(22);
1425
1319
  const {
1426
- audioRef,
1427
- live,
1320
+ corp,
1321
+ isLoop,
1322
+ isMuted,
1323
+ isPlaying,
1324
+ playbackRate,
1325
+ setVideoElement,
1428
1326
  setVideoPlaying,
1429
- syncCompanionAudio,
1430
- videoRef
1431
- } = ctx;
1432
- const video = videoRef.current;
1433
- const audio = audioRef.current;
1434
- if (!video) return;
1435
- if (video.loop || live.current.isLoop) {
1436
- const resetTime = Math.max(0, live.current.startTime || 0);
1437
- video.currentTime = resetTime;
1438
- if (audio && audio.readyState >= HAVE_CURRENT_DATA) {
1439
- audio.currentTime = resetTime;
1440
- }
1441
- video.play().then(() => {
1442
- setVideoPlaying(true);
1443
- syncCompanionAudio(true);
1444
- }).catch(() => {
1445
- });
1446
- return;
1327
+ shouldAutoPlay,
1328
+ src,
1329
+ style,
1330
+ className
1331
+ } = t0;
1332
+ let t1;
1333
+ if ($[0] !== className || $[1] !== corp || $[2] !== isLoop || $[3] !== isMuted || $[4] !== isPlaying || $[5] !== playbackRate || $[6] !== setVideoElement || $[7] !== setVideoPlaying || $[8] !== shouldAutoPlay || $[9] !== src || $[10] !== style) {
1334
+ t1 = {
1335
+ corp,
1336
+ isLoop,
1337
+ isMuted,
1338
+ isPlaying,
1339
+ playbackRate,
1340
+ setVideoElement,
1341
+ setVideoPlaying,
1342
+ shouldAutoPlay,
1343
+ src,
1344
+ style,
1345
+ className
1346
+ };
1347
+ $[0] = className;
1348
+ $[1] = corp;
1349
+ $[2] = isLoop;
1350
+ $[3] = isMuted;
1351
+ $[4] = isPlaying;
1352
+ $[5] = playbackRate;
1353
+ $[6] = setVideoElement;
1354
+ $[7] = setVideoPlaying;
1355
+ $[8] = shouldAutoPlay;
1356
+ $[9] = src;
1357
+ $[10] = style;
1358
+ $[11] = t1;
1359
+ } else {
1360
+ t1 = $[11];
1447
1361
  }
1448
- video.pause();
1449
- if (audio && !audio.paused) audio.pause();
1450
- setVideoPlaying(false);
1451
- }
1452
- function handleCompanionAudioError(ctx) {
1453
1362
  const {
1454
- audioRef,
1455
- live,
1456
- scheduleRetry,
1457
- setUseIframeFallback,
1458
- videoRef
1459
- } = ctx;
1460
- const audio = audioRef.current;
1461
- if (!audio) return;
1462
- ctx.audioErrorRetryCountRef.current += 1;
1463
- if (ctx.audioErrorRetryCountRef.current <= MAX_AUDIO_LOAD_RETRIES) {
1464
- scheduleRetry(() => {
1465
- audio.load();
1466
- if (videoRef.current) {
1467
- audio.currentTime = videoRef.current.currentTime || 0;
1468
- }
1469
- }, AUDIO_RETRY_DELAY_MS);
1470
- return;
1471
- }
1472
- if (!live.current.isMuted) {
1473
- setUseIframeFallback(true);
1363
+ videoRef,
1364
+ handleEnded,
1365
+ handleTimeUpdate,
1366
+ handleLoadedData
1367
+ } = useNativeVideoModel(t1);
1368
+ let t2;
1369
+ if ($[12] !== className || $[13] !== handleEnded || $[14] !== handleLoadedData || $[15] !== handleTimeUpdate || $[16] !== isLoop || $[17] !== isMuted || $[18] !== src || $[19] !== style || $[20] !== videoRef) {
1370
+ t2 = /* @__PURE__ */ jsx("video", { ref: videoRef, src, className, preload: "auto", muted: isMuted, loop: isLoop, playsInline: true, style, onTimeUpdate: handleTimeUpdate, onEnded: handleEnded, onLoadedData: handleLoadedData });
1371
+ $[12] = className;
1372
+ $[13] = handleEnded;
1373
+ $[14] = handleLoadedData;
1374
+ $[15] = handleTimeUpdate;
1375
+ $[16] = isLoop;
1376
+ $[17] = isMuted;
1377
+ $[18] = src;
1378
+ $[19] = style;
1379
+ $[20] = videoRef;
1380
+ $[21] = t2;
1381
+ } else {
1382
+ t2 = $[21];
1474
1383
  }
1384
+ return t2;
1475
1385
  }
1476
- function onTimeUpdate(ctx) {
1477
- const video = ctx.videoRef.current;
1478
- if (!video) return;
1479
- if (video.currentTime > 0 && video.readyState >= HAVE_CURRENT_DATA) {
1480
- ctx.setIsFrameReady(true);
1481
- ctx.setIsBuffering(false);
1386
+ function pauseQuietly(video) {
1387
+ try {
1388
+ video?.pause();
1389
+ } catch {
1482
1390
  }
1483
- const duration = Number(video.duration) || 0;
1391
+ }
1392
+ function useNativeVideoModel(t0) {
1393
+ const $ = c(27);
1484
1394
  const {
1485
1395
  corp,
1486
- endTime
1487
- } = ctx.live.current;
1488
- if (hasPassedEnd(video.currentTime, endTime, corp, duration)) {
1489
- ctx.handleEnded();
1490
- }
1491
- }
1492
- function onPlay(ctx) {
1493
- const video = ctx.videoRef.current;
1494
- ctx.hasLoadedVideoRef.current = true;
1495
- if (video && !ctx.live.current.isMuted && video.muted) {
1496
- setElementMuted(video, false);
1396
+ isMuted,
1397
+ isPlaying,
1398
+ playbackRate,
1399
+ setVideoElement,
1400
+ setVideoPlaying,
1401
+ shouldAutoPlay,
1402
+ src
1403
+ } = t0;
1404
+ const videoRef = useRef(null);
1405
+ let t1;
1406
+ if ($[0] !== setVideoPlaying) {
1407
+ t1 = () => {
1408
+ const video = videoRef.current;
1409
+ if (!video) {
1410
+ return;
1411
+ }
1412
+ if (video.loop) {
1413
+ video.currentTime = 0;
1414
+ video.play().catch(_temp);
1415
+ return;
1416
+ }
1417
+ video.pause();
1418
+ setVideoPlaying(false);
1419
+ };
1420
+ $[0] = setVideoPlaying;
1421
+ $[1] = t1;
1422
+ } else {
1423
+ t1 = $[1];
1497
1424
  }
1498
- if (!video || video.readyState < HAVE_CURRENT_DATA) ctx.setIsBuffering(true);
1499
- ctx.setVideoPlaying(true);
1500
- ctx.syncCompanionAudio(false);
1501
- }
1502
- function onPlaying(ctx) {
1503
- ctx.hasLoadedVideoRef.current = true;
1504
- ctx.setIsFrameReady(true);
1505
- ctx.setIsBuffering(false);
1506
- ctx.setVideoPlaying(true);
1507
- ctx.syncCompanionAudio(false);
1508
- }
1509
- function onPause(ctx) {
1510
- const video = ctx.videoRef.current;
1511
- ctx.syncCompanionAudio(false);
1512
- ctx.setIsBuffering(false);
1513
- if (video && !video.seeking && !video.ended && !ctx.live.current.isPlaying) {
1514
- ctx.setVideoPlaying(false);
1425
+ const handleEnded = t1;
1426
+ let t2;
1427
+ if ($[2] !== corp || $[3] !== handleEnded) {
1428
+ t2 = () => {
1429
+ const video_0 = videoRef.current;
1430
+ if (video_0 && isWithinCorp(video_0.currentTime, video_0.duration, corp)) {
1431
+ handleEnded();
1432
+ }
1433
+ };
1434
+ $[2] = corp;
1435
+ $[3] = handleEnded;
1436
+ $[4] = t2;
1437
+ } else {
1438
+ t2 = $[4];
1515
1439
  }
1516
- }
1517
- function onSeeked(ctx) {
1518
- const video = ctx.videoRef.current;
1519
- if (!video) return;
1520
- const {
1521
- isPlaying
1522
- } = ctx.live.current;
1523
- ctx.setIsFrameReady(true);
1524
- if (video.readyState >= HAVE_CURRENT_DATA && (!isPlaying || !video.paused)) {
1525
- ctx.setIsBuffering(false);
1440
+ const handleTimeUpdate = t2;
1441
+ let t3;
1442
+ if ($[5] !== isMuted || $[6] !== playbackRate || $[7] !== setVideoPlaying || $[8] !== shouldAutoPlay) {
1443
+ t3 = () => {
1444
+ const video_1 = videoRef.current;
1445
+ if (!video_1) {
1446
+ return;
1447
+ }
1448
+ video_1.playbackRate = playbackRate;
1449
+ if (!shouldAutoPlay) {
1450
+ return;
1451
+ }
1452
+ if (isMuted) {
1453
+ video_1.muted = true;
1454
+ }
1455
+ video_1.play().then(() => setVideoPlaying(true)).catch((error_0) => {
1456
+ report("Background autoplay", error_0, "warn");
1457
+ setVideoPlaying(false);
1458
+ });
1459
+ };
1460
+ $[5] = isMuted;
1461
+ $[6] = playbackRate;
1462
+ $[7] = setVideoPlaying;
1463
+ $[8] = shouldAutoPlay;
1464
+ $[9] = t3;
1465
+ } else {
1466
+ t3 = $[9];
1526
1467
  }
1527
- ctx.syncCompanionAudio(true);
1528
- if (isPlaying && video.paused) {
1529
- video.play().then(() => {
1530
- ctx.setVideoPlaying(true);
1531
- ctx.syncCompanionAudio(true);
1532
- }).catch(() => {
1533
- });
1468
+ const handleLoadedData = t3;
1469
+ let t4;
1470
+ if ($[10] !== setVideoElement) {
1471
+ t4 = () => {
1472
+ const video_2 = videoRef.current;
1473
+ setVideoElement(video_2);
1474
+ return () => {
1475
+ pauseQuietly(video_2);
1476
+ };
1477
+ };
1478
+ $[10] = setVideoElement;
1479
+ $[11] = t4;
1480
+ } else {
1481
+ t4 = $[11];
1534
1482
  }
1535
- }
1536
- function onCanPlay(ctx) {
1537
- const video = ctx.videoRef.current;
1538
- if (!video) return;
1539
- ctx.hasLoadedVideoRef.current = true;
1540
- if (!ctx.live.current.isPlaying) {
1541
- ctx.setIsFrameReady(true);
1542
- ctx.setIsBuffering(false);
1543
- } else if (video.paused) {
1544
- setElementMuted(video, Boolean(ctx.live.current.isMuted));
1545
- ctx.playWithFallback(video, false, true);
1483
+ let t5;
1484
+ if ($[12] !== setVideoElement || $[13] !== src) {
1485
+ t5 = [src, setVideoElement];
1486
+ $[12] = setVideoElement;
1487
+ $[13] = src;
1488
+ $[14] = t5;
1489
+ } else {
1490
+ t5 = $[14];
1546
1491
  }
1547
- }
1548
- function onLoadedMetadata(ctx) {
1549
- const video = ctx.videoRef.current;
1550
- if (!video) return;
1551
- ctx.hasLoadedVideoRef.current = true;
1552
- if (ctx.startTime > 0 && video.currentTime < ctx.startTime) {
1553
- video.currentTime = ctx.startTime;
1554
- if (ctx.audioRef.current) ctx.audioRef.current.currentTime = ctx.startTime;
1492
+ useEffect(t4, t5);
1493
+ let t6;
1494
+ let t7;
1495
+ if ($[15] !== setVideoElement) {
1496
+ t6 = () => () => setVideoElement(null);
1497
+ t7 = [setVideoElement];
1498
+ $[15] = setVideoElement;
1499
+ $[16] = t6;
1500
+ $[17] = t7;
1501
+ } else {
1502
+ t6 = $[16];
1503
+ t7 = $[17];
1555
1504
  }
1556
- }
1557
- function onLoadedData(ctx) {
1558
- const video = ctx.videoRef.current;
1559
- if (!video) return;
1560
- ctx.hasLoadedVideoRef.current = true;
1561
- video.playbackRate = ctx.playbackRate;
1562
- setElementMuted(video, Boolean(ctx.live.current.isMuted));
1563
- if (ctx.startTime > 0 && video.currentTime < ctx.startTime) {
1564
- video.currentTime = ctx.startTime;
1505
+ useEffect(t6, t7);
1506
+ let t8;
1507
+ let t9;
1508
+ if ($[18] !== isPlaying || $[19] !== playbackRate || $[20] !== setVideoPlaying) {
1509
+ t8 = () => {
1510
+ applyVideoPlaybackState({
1511
+ isPlaying,
1512
+ playbackRate,
1513
+ setVideoPlaying,
1514
+ videoElement: videoRef.current
1515
+ });
1516
+ };
1517
+ t9 = [isPlaying, playbackRate, setVideoPlaying];
1518
+ $[18] = isPlaying;
1519
+ $[19] = playbackRate;
1520
+ $[20] = setVideoPlaying;
1521
+ $[21] = t8;
1522
+ $[22] = t9;
1523
+ } else {
1524
+ t8 = $[21];
1525
+ t9 = $[22];
1565
1526
  }
1566
- if (!ctx.live.current.isPlaying) {
1567
- ctx.setIsFrameReady(true);
1568
- ctx.setIsBuffering(false);
1569
- } else if (video.paused) {
1570
- ctx.playWithFallback(video, true, false);
1527
+ useEffect(t8, t9);
1528
+ let t10;
1529
+ if ($[23] !== handleEnded || $[24] !== handleLoadedData || $[25] !== handleTimeUpdate) {
1530
+ t10 = {
1531
+ videoRef,
1532
+ handleEnded,
1533
+ handleTimeUpdate,
1534
+ handleLoadedData
1535
+ };
1536
+ $[23] = handleEnded;
1537
+ $[24] = handleLoadedData;
1538
+ $[25] = handleTimeUpdate;
1539
+ $[26] = t10;
1540
+ } else {
1541
+ t10 = $[26];
1571
1542
  }
1543
+ return t10;
1572
1544
  }
1573
- function onError(ctx) {
1574
- const video = ctx.videoRef.current;
1575
- if (video && ctx.hasLoadedVideoRef.current) {
1576
- const resumeTime = video.currentTime || 0;
1577
- ctx.scheduleRetry(() => {
1578
- video.load();
1579
- video.currentTime = resumeTime;
1580
- if (ctx.live.current.isPlaying) video.play().catch(() => {
1581
- });
1582
- }, ERROR_RESUME_RETRY_DELAY_MS);
1583
- return;
1584
- }
1585
- ctx.errorRetryCountRef.current += 1;
1586
- if (video && ctx.errorRetryCountRef.current <= MAX_VIDEO_LOAD_RETRIES) {
1587
- ctx.scheduleRetry(() => video.load(), LOAD_RETRY_DELAY_MS);
1588
- return;
1545
+ function _temp(error) {
1546
+ return report("Background loop play", error, "warn");
1547
+ }
1548
+
1549
+ // src/modules/background/youtube/audio.ts
1550
+ var AUDIO_SEEK_COOLDOWN_MS = 1500;
1551
+ var AUDIO_DRIFT_LIMIT = 0.35;
1552
+ var AUDIO_DRIFT_LIMIT_SILENT = 0.5;
1553
+ var AUDIO_VOLUME_EPSILON = 5e-3;
1554
+ var AUDIO_MIN_READY_STATE = 2;
1555
+ var AUDIO_SYNC_EVENTS = ["play", "playing", "pause", "waiting", "volumechange", "ratechange"];
1556
+ function setElementMuted(video, muted) {
1557
+ video.muted = muted;
1558
+ if (!muted && video.volume === 0) video.volume = DEFAULT_AUDIBLE_VOLUME;
1559
+ }
1560
+ function unlockAudioOnGesture(unlock) {
1561
+ const handler = () => {
1562
+ unlock();
1563
+ window.removeEventListener("pointerdown", handler);
1564
+ window.removeEventListener("keydown", handler);
1565
+ };
1566
+ window.addEventListener("pointerdown", handler, {
1567
+ once: true
1568
+ });
1569
+ window.addEventListener("keydown", handler, {
1570
+ once: true
1571
+ });
1572
+ }
1573
+ function resolveCompanionVolume(volume) {
1574
+ const numeric = Number(volume);
1575
+ return Math.max(0, Math.min(1, Number.isFinite(numeric) ? numeric : 1));
1576
+ }
1577
+ function syncCompanionAudioElements({
1578
+ audio,
1579
+ forceSeek,
1580
+ seekClock,
1581
+ video
1582
+ }) {
1583
+ if (!video || !audio) return;
1584
+ try {
1585
+ const targetRate = Number(video.playbackRate) || 1;
1586
+ if (audio.playbackRate !== targetRate) audio.playbackRate = targetRate;
1587
+ if (audio.readyState < AUDIO_MIN_READY_STATE || !Number.isFinite(audio.duration) || audio.duration <= 0) {
1588
+ return;
1589
+ }
1590
+ const volume = resolveCompanionVolume(video.volume);
1591
+ if (Math.abs(audio.volume - volume) > AUDIO_VOLUME_EPSILON) {
1592
+ audio.volume = volume;
1593
+ }
1594
+ const isSilent = Boolean(video.muted) || volume === 0;
1595
+ if (audio.muted !== isSilent) audio.muted = isSilent;
1596
+ if (video.paused || video.ended || video.seeking) {
1597
+ if (!audio.paused) audio.pause();
1598
+ return;
1599
+ }
1600
+ const now = performance.now();
1601
+ const drift = Math.abs(audio.currentTime - video.currentTime);
1602
+ const maxDrift = isSilent ? AUDIO_DRIFT_LIMIT_SILENT : AUDIO_DRIFT_LIMIT;
1603
+ if (forceSeek || drift > maxDrift && now - seekClock.current > AUDIO_SEEK_COOLDOWN_MS) {
1604
+ seekClock.current = now;
1605
+ audio.currentTime = video.currentTime;
1606
+ }
1607
+ if (audio.paused) audio.play().catch(() => {
1608
+ });
1609
+ } catch {
1589
1610
  }
1590
- ctx.setUseIframeFallback(true);
1591
1611
  }
1592
1612
 
1593
- // src/modules/background/youtube/lib/iframe.ts
1613
+ // src/modules/background/youtube/iframe.ts
1594
1614
  var PLAYER_STATE = {
1595
1615
  ENDED: 0,
1596
1616
  PLAYING: 1,
@@ -1624,125 +1644,6 @@ function setHighQuality(player) {
1624
1644
  player?.setPlaybackQualityRange?.("hd1080", "hd1080");
1625
1645
  player?.setPlaybackQuality?.("hd1080");
1626
1646
  }
1627
-
1628
- // src/modules/background/youtube/lib/iframe-engine.ts
1629
- function createIframeEngine({
1630
- emit,
1631
- getPlayer,
1632
- getProxy,
1633
- isDisposed,
1634
- live,
1635
- setIsBuffering,
1636
- setIsFrameReady,
1637
- setPlayer,
1638
- setVideoElement,
1639
- setVideoPlaying,
1640
- startProgress,
1641
- state
1642
- }) {
1643
- const restart = (target) => {
1644
- const restartAt = Math.max(0, live.current.startTime || 0);
1645
- target?.seekTo?.(restartAt, true);
1646
- target?.playVideo?.();
1647
- return restartAt;
1648
- };
1649
- const trackProgress = () => {
1650
- const current = getPlayer();
1651
- if (!current || typeof current.getCurrentTime !== "function") return;
1652
- const time = Number(current.getCurrentTime()) || 0;
1653
- const duration = Number(current.getDuration?.()) || state.duration;
1654
- state.currentTime = time;
1655
- if (duration > 0 && duration !== state.duration) {
1656
- state.duration = duration;
1657
- emit("durationchange");
1658
- }
1659
- const {
1660
- corp,
1661
- endTime,
1662
- isLoop: loops
1663
- } = live.current;
1664
- const safetyEnd = resolveIframeSafetyEnd(endTime, corp, duration);
1665
- if (safetyEnd > 0 && time >= safetyEnd) {
1666
- if (state.loop || loops) {
1667
- state.currentTime = restart(current);
1668
- } else {
1669
- current.pauseVideo?.();
1670
- state.paused = true;
1671
- setVideoPlaying(false);
1672
- }
1673
- }
1674
- emit("timeupdate");
1675
- };
1676
- const handleReady = (event) => {
1677
- if (isDisposed()) return;
1678
- const target = event.target;
1679
- setPlayer(target ?? null);
1680
- state.duration = Number(target?.getDuration?.()) || 0;
1681
- const {
1682
- isMuted: muted,
1683
- isPlaying,
1684
- playbackRate: rate
1685
- } = live.current;
1686
- if (rate !== 1) target?.setPlaybackRate?.(rate);
1687
- if (muted) {
1688
- target?.mute?.();
1689
- } else {
1690
- target?.unMute?.();
1691
- target?.setVolume?.(toPlayerVolume(DEFAULT_AUDIBLE_VOLUME));
1692
- }
1693
- if (live.current.shouldAutoPlay && isPlaying) {
1694
- setHighQuality(target);
1695
- target?.playVideo?.();
1696
- state.paused = false;
1697
- setVideoPlaying(true);
1698
- }
1699
- const proxy = getProxy();
1700
- if (proxy) {
1701
- setVideoElement(proxy);
1702
- emit("loadedmetadata");
1703
- emit("durationchange");
1704
- }
1705
- startProgress(trackProgress);
1706
- };
1707
- const handleStateChange = (event) => {
1708
- if (isDisposed()) return;
1709
- switch (event.data) {
1710
- case PLAYER_STATE.PLAYING:
1711
- setHighQuality(event.target);
1712
- state.paused = false;
1713
- setIsFrameReady(true);
1714
- setIsBuffering(false);
1715
- setVideoPlaying(true);
1716
- emit("play");
1717
- emit("playing");
1718
- break;
1719
- case PLAYER_STATE.BUFFERING:
1720
- setIsBuffering(true);
1721
- break;
1722
- case PLAYER_STATE.PAUSED:
1723
- state.paused = true;
1724
- setIsBuffering(false);
1725
- setVideoPlaying(false);
1726
- emit("pause");
1727
- break;
1728
- case PLAYER_STATE.ENDED:
1729
- if (state.loop || live.current.isLoop) {
1730
- restart(getPlayer());
1731
- } else {
1732
- state.paused = true;
1733
- setVideoPlaying(false);
1734
- emit("ended");
1735
- }
1736
- break;
1737
- }
1738
- };
1739
- return {
1740
- handleReady,
1741
- handleStateChange
1742
- };
1743
- }
1744
-
1745
- // src/modules/background/youtube/lib/iframe-proxy.ts
1746
1647
  function createIframeProxyController({
1747
1648
  player,
1748
1649
  setVideoPlaying,
@@ -1841,7 +1742,7 @@ function createIframePlaybackState({
1841
1742
  };
1842
1743
  }
1843
1744
 
1844
- // src/modules/background/youtube/hooks/use-youtube-iframe-player.ts
1745
+ // src/modules/background/youtube/use-iframe-player.ts
1845
1746
  var PROGRESS_INTERVAL_MS = 200;
1846
1747
  function destroyQuietly(player) {
1847
1748
  try {
@@ -2004,32 +1905,123 @@ function useYouTubeIframePlayer(t0) {
2004
1905
  }
2005
1906
  useEffect(t3, t4);
2006
1907
  }
2007
-
2008
- // src/modules/background/youtube/hooks/use-youtube-stream-sources.ts
2009
- function useYouTubeStreamSources({
2010
- codec,
2011
- posterUrl,
2012
- quality,
2013
- showPoster,
2014
- videoId
1908
+ function createIframeEngine({
1909
+ emit,
1910
+ getPlayer,
1911
+ getProxy,
1912
+ isDisposed,
1913
+ live,
1914
+ setIsBuffering,
1915
+ setIsFrameReady,
1916
+ setPlayer,
1917
+ setVideoElement,
1918
+ setVideoPlaying,
1919
+ startProgress,
1920
+ state
2015
1921
  }) {
2016
- const videoStreamUrl = getYouTubeStreamUrl(videoId, {
2017
- codec,
2018
- quality,
2019
- stream: "video"
2020
- });
2021
- const audioStreamUrl = getYouTubeStreamUrl(videoId, {
2022
- stream: "audio"
2023
- });
2024
- const resolvedPoster = showPoster ? posterUrl || getYouTubeThumbnailUrl(videoId, true) : null;
1922
+ const restart = (target) => {
1923
+ const restartAt = Math.max(0, live.current.startTime || 0);
1924
+ target?.seekTo?.(restartAt, true);
1925
+ target?.playVideo?.();
1926
+ return restartAt;
1927
+ };
1928
+ const trackProgress = () => {
1929
+ const current = getPlayer();
1930
+ if (!current || typeof current.getCurrentTime !== "function") return;
1931
+ const time = Number(current.getCurrentTime()) || 0;
1932
+ const duration = Number(current.getDuration?.()) || state.duration;
1933
+ state.currentTime = time;
1934
+ if (duration > 0 && duration !== state.duration) {
1935
+ state.duration = duration;
1936
+ emit("durationchange");
1937
+ }
1938
+ const {
1939
+ corp,
1940
+ endTime,
1941
+ isLoop: loops
1942
+ } = live.current;
1943
+ const safetyEnd = resolveIframeSafetyEnd(endTime, corp, duration);
1944
+ if (safetyEnd > 0 && time >= safetyEnd) {
1945
+ if (state.loop || loops) {
1946
+ state.currentTime = restart(current);
1947
+ } else {
1948
+ current.pauseVideo?.();
1949
+ state.paused = true;
1950
+ setVideoPlaying(false);
1951
+ }
1952
+ }
1953
+ emit("timeupdate");
1954
+ };
1955
+ const handleReady = (event) => {
1956
+ if (isDisposed()) return;
1957
+ const target = event.target;
1958
+ setPlayer(target ?? null);
1959
+ state.duration = Number(target?.getDuration?.()) || 0;
1960
+ const {
1961
+ isMuted: muted,
1962
+ isPlaying,
1963
+ playbackRate: rate
1964
+ } = live.current;
1965
+ if (rate !== 1) target?.setPlaybackRate?.(rate);
1966
+ if (muted) {
1967
+ target?.mute?.();
1968
+ } else {
1969
+ target?.unMute?.();
1970
+ target?.setVolume?.(toPlayerVolume(DEFAULT_AUDIBLE_VOLUME));
1971
+ }
1972
+ if (live.current.shouldAutoPlay && isPlaying) {
1973
+ setHighQuality(target);
1974
+ target?.playVideo?.();
1975
+ state.paused = false;
1976
+ setVideoPlaying(true);
1977
+ }
1978
+ const proxy = getProxy();
1979
+ if (proxy) {
1980
+ setVideoElement(proxy);
1981
+ emit("loadedmetadata");
1982
+ emit("durationchange");
1983
+ }
1984
+ startProgress(trackProgress);
1985
+ };
1986
+ const handleStateChange = (event) => {
1987
+ if (isDisposed()) return;
1988
+ switch (event.data) {
1989
+ case PLAYER_STATE.PLAYING:
1990
+ setHighQuality(event.target);
1991
+ state.paused = false;
1992
+ setIsFrameReady(true);
1993
+ setIsBuffering(false);
1994
+ setVideoPlaying(true);
1995
+ emit("play");
1996
+ emit("playing");
1997
+ break;
1998
+ case PLAYER_STATE.BUFFERING:
1999
+ setIsBuffering(true);
2000
+ break;
2001
+ case PLAYER_STATE.PAUSED:
2002
+ state.paused = true;
2003
+ setIsBuffering(false);
2004
+ setVideoPlaying(false);
2005
+ emit("pause");
2006
+ break;
2007
+ case PLAYER_STATE.ENDED:
2008
+ if (state.loop || live.current.isLoop) {
2009
+ restart(getPlayer());
2010
+ } else {
2011
+ state.paused = true;
2012
+ setVideoPlaying(false);
2013
+ emit("ended");
2014
+ }
2015
+ break;
2016
+ }
2017
+ };
2025
2018
  return {
2026
- audioStreamUrl,
2027
- resolvedPoster,
2028
- videoStreamUrl
2019
+ handleReady,
2020
+ handleStateChange
2029
2021
  };
2030
2022
  }
2031
2023
  var AUDIO_SYNC_INTERVAL_MS = 1e3;
2032
- function pauseQuietly(video, audio) {
2024
+ function pauseQuietly2(video, audio) {
2033
2025
  try {
2034
2026
  video.pause();
2035
2027
  audio?.pause();
@@ -2074,13 +2066,13 @@ function useYouTubeVideoSync(t0) {
2074
2066
  const syncTimer = window.setInterval(onSync, AUDIO_SYNC_INTERVAL_MS);
2075
2067
  return () => {
2076
2068
  window.clearInterval(syncTimer);
2077
- retryTimerIds.forEach(_temp);
2069
+ retryTimerIds.forEach(_temp2);
2078
2070
  retryTimerIds.clear();
2079
2071
  for (const event_0 of AUDIO_SYNC_EVENTS) {
2080
2072
  video.removeEventListener(event_0, onSync);
2081
2073
  }
2082
2074
  video.removeEventListener("seeked", onSeeked2);
2083
- pauseQuietly(video, audio);
2075
+ pauseQuietly2(video, audio);
2084
2076
  };
2085
2077
  };
2086
2078
  $[0] = audioRef;
@@ -2164,27 +2156,232 @@ function useYouTubeVideoSync(t0) {
2164
2156
  }
2165
2157
  useEffect(t5, t6);
2166
2158
  }
2167
- function _temp(timerId) {
2159
+ function _temp2(timerId) {
2168
2160
  return window.clearTimeout(timerId);
2169
2161
  }
2170
2162
 
2171
- // src/modules/background/youtube/hooks/use-youtube-background-player-model.ts
2172
- function useYouTubeBackgroundPlayerModel({
2173
- codec = "auto",
2174
- corp = 0,
2175
- endTime = 0,
2176
- forceIframe = false,
2177
- isLoop = false,
2178
- isMuted = true,
2179
- isPlaying = true,
2180
- playbackRate = 1,
2181
- posterUrl = null,
2182
- quality = "1080p",
2183
- setVideoElement,
2184
- setVideoPlaying,
2185
- shouldAutoPlay = true,
2186
- showPoster = false,
2187
- showSpinner = true,
2163
+ // src/modules/background/youtube/video-events.ts
2164
+ var HAVE_CURRENT_DATA = 2;
2165
+ var ERROR_RESUME_RETRY_DELAY_MS = 150;
2166
+ var LOAD_RETRY_DELAY_MS = 200;
2167
+ var AUDIO_RETRY_DELAY_MS = 200;
2168
+ var MAX_VIDEO_LOAD_RETRIES = 1;
2169
+ var MAX_AUDIO_LOAD_RETRIES = 1;
2170
+ function playWithMutedFallback({
2171
+ forceSeek,
2172
+ live,
2173
+ setVideoPlaying,
2174
+ syncCompanionAudio,
2175
+ unlockAudio,
2176
+ video,
2177
+ videoRef
2178
+ }) {
2179
+ const onPlayed = () => {
2180
+ setVideoPlaying(true);
2181
+ syncCompanionAudio(forceSeek);
2182
+ };
2183
+ video.play().then(onPlayed).catch((error) => {
2184
+ if (error?.name !== "NotAllowedError") return;
2185
+ video.muted = true;
2186
+ video.play().then(() => {
2187
+ onPlayed();
2188
+ if (!unlockAudio) return;
2189
+ unlockAudioOnGesture(() => {
2190
+ const current = videoRef.current;
2191
+ if (!live.current.isMuted && current) {
2192
+ setElementMuted(current, false);
2193
+ }
2194
+ });
2195
+ }).catch(() => {
2196
+ });
2197
+ });
2198
+ }
2199
+ function endVideoPlayback(ctx) {
2200
+ const {
2201
+ audioRef,
2202
+ live,
2203
+ setVideoPlaying,
2204
+ syncCompanionAudio,
2205
+ videoRef
2206
+ } = ctx;
2207
+ const video = videoRef.current;
2208
+ const audio = audioRef.current;
2209
+ if (!video) return;
2210
+ if (video.loop || live.current.isLoop) {
2211
+ const resetTime = Math.max(0, live.current.startTime || 0);
2212
+ video.currentTime = resetTime;
2213
+ if (audio && audio.readyState >= HAVE_CURRENT_DATA) {
2214
+ audio.currentTime = resetTime;
2215
+ }
2216
+ video.play().then(() => {
2217
+ setVideoPlaying(true);
2218
+ syncCompanionAudio(true);
2219
+ }).catch(() => {
2220
+ });
2221
+ return;
2222
+ }
2223
+ video.pause();
2224
+ if (audio && !audio.paused) audio.pause();
2225
+ setVideoPlaying(false);
2226
+ }
2227
+ function handleCompanionAudioError(ctx) {
2228
+ const {
2229
+ audioRef,
2230
+ live,
2231
+ scheduleRetry,
2232
+ setUseIframeFallback,
2233
+ videoRef
2234
+ } = ctx;
2235
+ const audio = audioRef.current;
2236
+ if (!audio) return;
2237
+ ctx.audioErrorRetryCountRef.current += 1;
2238
+ if (ctx.audioErrorRetryCountRef.current <= MAX_AUDIO_LOAD_RETRIES) {
2239
+ scheduleRetry(() => {
2240
+ audio.load();
2241
+ if (videoRef.current) {
2242
+ audio.currentTime = videoRef.current.currentTime || 0;
2243
+ }
2244
+ }, AUDIO_RETRY_DELAY_MS);
2245
+ return;
2246
+ }
2247
+ if (!live.current.isMuted) {
2248
+ setUseIframeFallback(true);
2249
+ }
2250
+ }
2251
+ function onTimeUpdate(ctx) {
2252
+ const video = ctx.videoRef.current;
2253
+ if (!video) return;
2254
+ if (video.currentTime > 0 && video.readyState >= HAVE_CURRENT_DATA) {
2255
+ ctx.setIsFrameReady(true);
2256
+ ctx.setIsBuffering(false);
2257
+ }
2258
+ const duration = Number(video.duration) || 0;
2259
+ const {
2260
+ corp,
2261
+ endTime
2262
+ } = ctx.live.current;
2263
+ if (hasPassedEnd(video.currentTime, endTime, corp, duration)) {
2264
+ ctx.handleEnded();
2265
+ }
2266
+ }
2267
+ function onPlay(ctx) {
2268
+ const video = ctx.videoRef.current;
2269
+ ctx.hasLoadedVideoRef.current = true;
2270
+ if (video && !ctx.live.current.isMuted && video.muted) {
2271
+ setElementMuted(video, false);
2272
+ }
2273
+ if (!video || video.readyState < HAVE_CURRENT_DATA) ctx.setIsBuffering(true);
2274
+ ctx.setVideoPlaying(true);
2275
+ ctx.syncCompanionAudio(false);
2276
+ }
2277
+ function onPlaying(ctx) {
2278
+ ctx.hasLoadedVideoRef.current = true;
2279
+ ctx.setIsFrameReady(true);
2280
+ ctx.setIsBuffering(false);
2281
+ ctx.setVideoPlaying(true);
2282
+ ctx.syncCompanionAudio(false);
2283
+ }
2284
+ function onPause(ctx) {
2285
+ const video = ctx.videoRef.current;
2286
+ ctx.syncCompanionAudio(false);
2287
+ ctx.setIsBuffering(false);
2288
+ if (video && !video.seeking && !video.ended && !ctx.live.current.isPlaying) {
2289
+ ctx.setVideoPlaying(false);
2290
+ }
2291
+ }
2292
+ function onSeeked(ctx) {
2293
+ const video = ctx.videoRef.current;
2294
+ if (!video) return;
2295
+ const {
2296
+ isPlaying
2297
+ } = ctx.live.current;
2298
+ ctx.setIsFrameReady(true);
2299
+ if (video.readyState >= HAVE_CURRENT_DATA && (!isPlaying || !video.paused)) {
2300
+ ctx.setIsBuffering(false);
2301
+ }
2302
+ ctx.syncCompanionAudio(true);
2303
+ if (isPlaying && video.paused) {
2304
+ video.play().then(() => {
2305
+ ctx.setVideoPlaying(true);
2306
+ ctx.syncCompanionAudio(true);
2307
+ }).catch(() => {
2308
+ });
2309
+ }
2310
+ }
2311
+ function onCanPlay(ctx) {
2312
+ const video = ctx.videoRef.current;
2313
+ if (!video) return;
2314
+ ctx.hasLoadedVideoRef.current = true;
2315
+ if (!ctx.live.current.isPlaying) {
2316
+ ctx.setIsFrameReady(true);
2317
+ ctx.setIsBuffering(false);
2318
+ } else if (video.paused) {
2319
+ setElementMuted(video, Boolean(ctx.live.current.isMuted));
2320
+ ctx.playWithFallback(video, false, true);
2321
+ }
2322
+ }
2323
+ function onLoadedMetadata(ctx) {
2324
+ const video = ctx.videoRef.current;
2325
+ if (!video) return;
2326
+ ctx.hasLoadedVideoRef.current = true;
2327
+ if (ctx.startTime > 0 && video.currentTime < ctx.startTime) {
2328
+ video.currentTime = ctx.startTime;
2329
+ if (ctx.audioRef.current) ctx.audioRef.current.currentTime = ctx.startTime;
2330
+ }
2331
+ }
2332
+ function onLoadedData(ctx) {
2333
+ const video = ctx.videoRef.current;
2334
+ if (!video) return;
2335
+ ctx.hasLoadedVideoRef.current = true;
2336
+ video.playbackRate = ctx.playbackRate;
2337
+ setElementMuted(video, Boolean(ctx.live.current.isMuted));
2338
+ if (ctx.startTime > 0 && video.currentTime < ctx.startTime) {
2339
+ video.currentTime = ctx.startTime;
2340
+ }
2341
+ if (!ctx.live.current.isPlaying) {
2342
+ ctx.setIsFrameReady(true);
2343
+ ctx.setIsBuffering(false);
2344
+ } else if (video.paused) {
2345
+ ctx.playWithFallback(video, true, false);
2346
+ }
2347
+ }
2348
+ function onError(ctx) {
2349
+ const video = ctx.videoRef.current;
2350
+ if (video && ctx.hasLoadedVideoRef.current) {
2351
+ const resumeTime = video.currentTime || 0;
2352
+ ctx.scheduleRetry(() => {
2353
+ video.load();
2354
+ video.currentTime = resumeTime;
2355
+ if (ctx.live.current.isPlaying) video.play().catch(() => {
2356
+ });
2357
+ }, ERROR_RESUME_RETRY_DELAY_MS);
2358
+ return;
2359
+ }
2360
+ ctx.errorRetryCountRef.current += 1;
2361
+ if (video && ctx.errorRetryCountRef.current <= MAX_VIDEO_LOAD_RETRIES) {
2362
+ ctx.scheduleRetry(() => video.load(), LOAD_RETRY_DELAY_MS);
2363
+ return;
2364
+ }
2365
+ ctx.setUseIframeFallback(true);
2366
+ }
2367
+
2368
+ // src/modules/background/youtube/use-player.ts
2369
+ function useYouTubeBackgroundPlayerModel({
2370
+ codec = "auto",
2371
+ corp = 0,
2372
+ endTime = 0,
2373
+ forceIframe = false,
2374
+ isLoop = false,
2375
+ isMuted = true,
2376
+ isPlaying = true,
2377
+ playbackRate = 1,
2378
+ posterUrl = null,
2379
+ quality = "1080p",
2380
+ setVideoElement,
2381
+ setVideoPlaying,
2382
+ shouldAutoPlay = true,
2383
+ showPoster = false,
2384
+ showSpinner = true,
2188
2385
  startTime = 0,
2189
2386
  videoClasses: _videoClasses,
2190
2387
  videoId,
@@ -2355,6 +2552,28 @@ function useYouTubeBackgroundPlayerModel({
2355
2552
  showSpinnerOverlay
2356
2553
  };
2357
2554
  }
2555
+ function useYouTubeStreamSources({
2556
+ codec,
2557
+ posterUrl,
2558
+ quality,
2559
+ showPoster,
2560
+ videoId
2561
+ }) {
2562
+ const videoStreamUrl = getYouTubeStreamUrl(videoId, {
2563
+ codec,
2564
+ quality,
2565
+ stream: "video"
2566
+ });
2567
+ const audioStreamUrl = getYouTubeStreamUrl(videoId, {
2568
+ stream: "audio"
2569
+ });
2570
+ const resolvedPoster = showPoster ? posterUrl || getYouTubeThumbnailUrl(videoId, true) : null;
2571
+ return {
2572
+ audioStreamUrl,
2573
+ resolvedPoster,
2574
+ videoStreamUrl
2575
+ };
2576
+ }
2358
2577
  function YouTubeBackgroundPlayer(t0) {
2359
2578
  const $ = c(75);
2360
2579
  const {
@@ -2477,7 +2696,7 @@ function YouTubeBackgroundPlayer(t0) {
2477
2696
  }
2478
2697
  let t17;
2479
2698
  if ($[24] !== showSpinner || $[25] !== theme.slots.youtubeSpinnerIcon) {
2480
- t17 = showSpinner ? /* @__PURE__ */ jsx(Spinner, { size: 30, className: theme.slots.youtubeSpinnerIcon }) : null;
2699
+ t17 = showSpinner ? /* @__PURE__ */ jsx(ThemeSpinner, { size: 30, className: theme.slots.youtubeSpinnerIcon }) : null;
2481
2700
  $[24] = showSpinner;
2482
2701
  $[25] = theme.slots.youtubeSpinnerIcon;
2483
2702
  $[26] = t17;
@@ -2550,488 +2769,34 @@ function YouTubeBackgroundPlayer(t0) {
2550
2769
  $[60] = theme.slots.youtubeHost;
2551
2770
  $[61] = theme.slots.youtubeVideo;
2552
2771
  $[62] = useIframeFallback;
2553
- $[63] = videoClasses;
2554
- $[64] = videoRef;
2555
- $[65] = videoStreamUrl;
2556
- $[66] = videoStyle;
2557
- $[67] = t21;
2558
- } else {
2559
- t21 = $[67];
2560
- }
2561
- let t22;
2562
- if ($[68] !== t16 || $[69] !== t18 || $[70] !== t19 || $[71] !== t20 || $[72] !== t21 || $[73] !== theme.slots.youtube) {
2563
- t22 = /* @__PURE__ */ jsxs("div", { className: theme.slots.youtube, children: [
2564
- t16,
2565
- t18,
2566
- t19,
2567
- t20,
2568
- t21
2569
- ] });
2570
- $[68] = t16;
2571
- $[69] = t18;
2572
- $[70] = t19;
2573
- $[71] = t20;
2574
- $[72] = t21;
2575
- $[73] = theme.slots.youtube;
2576
- $[74] = t22;
2577
- } else {
2578
- t22 = $[74];
2579
- }
2580
- return t22;
2581
- }
2582
- function BackgroundGradients(t0) {
2583
- const $ = c(11);
2584
- const {
2585
- count: t1,
2586
- direction,
2587
- color: t2,
2588
- theme
2589
- } = t0;
2590
- const count = t1 === void 0 ? 0 : t1;
2591
- const color = t2 === void 0 ? DEFAULT_COLOR : t2;
2592
- if (!count || count <= 0) {
2593
- return null;
2594
- }
2595
- const opacity = Math.min(1, Math.max(0.2, count * 0.25));
2596
- const t3 = theme.slots.gradient;
2597
- const t4 = theme.styles.gradient;
2598
- let t5;
2599
- if ($[0] !== color || $[1] !== direction) {
2600
- t5 = generateBaseGradient(direction, color);
2601
- $[0] = color;
2602
- $[1] = direction;
2603
- $[2] = t5;
2604
- } else {
2605
- t5 = $[2];
2606
- }
2607
- let t6;
2608
- if ($[3] !== opacity || $[4] !== t5 || $[5] !== theme.styles.gradient) {
2609
- t6 = {
2610
- ...t4,
2611
- opacity,
2612
- background: t5
2613
- };
2614
- $[3] = opacity;
2615
- $[4] = t5;
2616
- $[5] = theme.styles.gradient;
2617
- $[6] = t6;
2618
- } else {
2619
- t6 = $[6];
2620
- }
2621
- let t7;
2622
- if ($[7] !== direction || $[8] !== t6 || $[9] !== theme.slots.gradient) {
2623
- t7 = /* @__PURE__ */ jsx("div", { "data-side": direction, className: t3, style: t6 });
2624
- $[7] = direction;
2625
- $[8] = t6;
2626
- $[9] = theme.slots.gradient;
2627
- $[10] = t7;
2628
- } else {
2629
- t7 = $[10];
2630
- }
2631
- return t7;
2632
- }
2633
- function EdgeGradient(t0) {
2634
- const $ = c(11);
2635
- const {
2636
- direction,
2637
- percent: t1,
2638
- opacity: t2,
2639
- color,
2640
- theme
2641
- } = t0;
2642
- const percent = t1 === void 0 ? 0 : t1;
2643
- const opacity = t2 === void 0 ? 0 : t2;
2644
- if (opacity <= 0) {
2645
- return null;
2646
- }
2647
- const t3 = theme.slots.edge;
2648
- const t4 = `${Math.max(30, percent * 1.15)}%`;
2649
- const t5 = color || DEFAULT_COLOR;
2650
- let t6;
2651
- if ($[0] !== direction || $[1] !== t5) {
2652
- t6 = generateEdgeGradient(direction, t5);
2653
- $[0] = direction;
2654
- $[1] = t5;
2655
- $[2] = t6;
2656
- } else {
2657
- t6 = $[2];
2658
- }
2659
- let t7;
2660
- if ($[3] !== opacity || $[4] !== t4 || $[5] !== t6) {
2661
- t7 = {
2662
- width: t4,
2663
- opacity,
2664
- background: t6
2665
- };
2666
- $[3] = opacity;
2667
- $[4] = t4;
2668
- $[5] = t6;
2669
- $[6] = t7;
2670
- } else {
2671
- t7 = $[6];
2672
- }
2673
- let t8;
2674
- if ($[7] !== direction || $[8] !== t7 || $[9] !== theme.slots.edge) {
2675
- t8 = /* @__PURE__ */ jsx("div", { "data-side": direction, className: t3, style: t7 });
2676
- $[7] = direction;
2677
- $[8] = t7;
2678
- $[9] = theme.slots.edge;
2679
- $[10] = t8;
2680
- } else {
2681
- t8 = $[10];
2682
- }
2683
- return t8;
2684
- }
2685
- function pauseQuietly2(video) {
2686
- try {
2687
- video?.pause();
2688
- } catch {
2689
- }
2690
- }
2691
- function useNativeVideoModel(t0) {
2692
- const $ = c(27);
2693
- const {
2694
- corp,
2695
- isMuted,
2696
- isPlaying,
2697
- playbackRate,
2698
- setVideoElement,
2699
- setVideoPlaying,
2700
- shouldAutoPlay,
2701
- src
2702
- } = t0;
2703
- const videoRef = useRef(null);
2704
- let t1;
2705
- if ($[0] !== setVideoPlaying) {
2706
- t1 = () => {
2707
- const video = videoRef.current;
2708
- if (!video) {
2709
- return;
2710
- }
2711
- if (video.loop) {
2712
- video.currentTime = 0;
2713
- video.play().catch(_temp2);
2714
- return;
2715
- }
2716
- video.pause();
2717
- setVideoPlaying(false);
2718
- };
2719
- $[0] = setVideoPlaying;
2720
- $[1] = t1;
2721
- } else {
2722
- t1 = $[1];
2723
- }
2724
- const handleEnded = t1;
2725
- let t2;
2726
- if ($[2] !== corp || $[3] !== handleEnded) {
2727
- t2 = () => {
2728
- const video_0 = videoRef.current;
2729
- if (video_0 && isWithinCorp(video_0.currentTime, video_0.duration, corp)) {
2730
- handleEnded();
2731
- }
2732
- };
2733
- $[2] = corp;
2734
- $[3] = handleEnded;
2735
- $[4] = t2;
2736
- } else {
2737
- t2 = $[4];
2738
- }
2739
- const handleTimeUpdate = t2;
2740
- let t3;
2741
- if ($[5] !== isMuted || $[6] !== playbackRate || $[7] !== setVideoPlaying || $[8] !== shouldAutoPlay) {
2742
- t3 = () => {
2743
- const video_1 = videoRef.current;
2744
- if (!video_1) {
2745
- return;
2746
- }
2747
- video_1.playbackRate = playbackRate;
2748
- if (!shouldAutoPlay) {
2749
- return;
2750
- }
2751
- if (isMuted) {
2752
- video_1.muted = true;
2753
- }
2754
- video_1.play().then(() => setVideoPlaying(true)).catch((error_0) => {
2755
- report("Background autoplay", error_0, "warn");
2756
- setVideoPlaying(false);
2757
- });
2758
- };
2759
- $[5] = isMuted;
2760
- $[6] = playbackRate;
2761
- $[7] = setVideoPlaying;
2762
- $[8] = shouldAutoPlay;
2763
- $[9] = t3;
2764
- } else {
2765
- t3 = $[9];
2766
- }
2767
- const handleLoadedData = t3;
2768
- let t4;
2769
- if ($[10] !== setVideoElement) {
2770
- t4 = () => {
2771
- const video_2 = videoRef.current;
2772
- setVideoElement(video_2);
2773
- return () => {
2774
- pauseQuietly2(video_2);
2775
- };
2776
- };
2777
- $[10] = setVideoElement;
2778
- $[11] = t4;
2779
- } else {
2780
- t4 = $[11];
2781
- }
2782
- let t5;
2783
- if ($[12] !== setVideoElement || $[13] !== src) {
2784
- t5 = [src, setVideoElement];
2785
- $[12] = setVideoElement;
2786
- $[13] = src;
2787
- $[14] = t5;
2788
- } else {
2789
- t5 = $[14];
2790
- }
2791
- useEffect(t4, t5);
2792
- let t6;
2793
- let t7;
2794
- if ($[15] !== setVideoElement) {
2795
- t6 = () => () => setVideoElement(null);
2796
- t7 = [setVideoElement];
2797
- $[15] = setVideoElement;
2798
- $[16] = t6;
2799
- $[17] = t7;
2800
- } else {
2801
- t6 = $[16];
2802
- t7 = $[17];
2803
- }
2804
- useEffect(t6, t7);
2805
- let t8;
2806
- let t9;
2807
- if ($[18] !== isPlaying || $[19] !== playbackRate || $[20] !== setVideoPlaying) {
2808
- t8 = () => {
2809
- applyVideoPlaybackState({
2810
- isPlaying,
2811
- playbackRate,
2812
- setVideoPlaying,
2813
- videoElement: videoRef.current
2814
- });
2815
- };
2816
- t9 = [isPlaying, playbackRate, setVideoPlaying];
2817
- $[18] = isPlaying;
2818
- $[19] = playbackRate;
2819
- $[20] = setVideoPlaying;
2820
- $[21] = t8;
2821
- $[22] = t9;
2822
- } else {
2823
- t8 = $[21];
2824
- t9 = $[22];
2825
- }
2826
- useEffect(t8, t9);
2827
- let t10;
2828
- if ($[23] !== handleEnded || $[24] !== handleLoadedData || $[25] !== handleTimeUpdate) {
2829
- t10 = {
2830
- videoRef,
2831
- handleEnded,
2832
- handleTimeUpdate,
2833
- handleLoadedData
2834
- };
2835
- $[23] = handleEnded;
2836
- $[24] = handleLoadedData;
2837
- $[25] = handleTimeUpdate;
2838
- $[26] = t10;
2839
- } else {
2840
- t10 = $[26];
2841
- }
2842
- return t10;
2843
- }
2844
- function _temp2(error) {
2845
- return report("Background loop play", error, "warn");
2846
- }
2847
- function NativeVideo(t0) {
2848
- const $ = c(22);
2849
- const {
2850
- corp,
2851
- isLoop,
2852
- isMuted,
2853
- isPlaying,
2854
- playbackRate,
2855
- setVideoElement,
2856
- setVideoPlaying,
2857
- shouldAutoPlay,
2858
- src,
2859
- style,
2860
- className
2861
- } = t0;
2862
- let t1;
2863
- if ($[0] !== className || $[1] !== corp || $[2] !== isLoop || $[3] !== isMuted || $[4] !== isPlaying || $[5] !== playbackRate || $[6] !== setVideoElement || $[7] !== setVideoPlaying || $[8] !== shouldAutoPlay || $[9] !== src || $[10] !== style) {
2864
- t1 = {
2865
- corp,
2866
- isLoop,
2867
- isMuted,
2868
- isPlaying,
2869
- playbackRate,
2870
- setVideoElement,
2871
- setVideoPlaying,
2872
- shouldAutoPlay,
2873
- src,
2874
- style,
2875
- className
2876
- };
2877
- $[0] = className;
2878
- $[1] = corp;
2879
- $[2] = isLoop;
2880
- $[3] = isMuted;
2881
- $[4] = isPlaying;
2882
- $[5] = playbackRate;
2883
- $[6] = setVideoElement;
2884
- $[7] = setVideoPlaying;
2885
- $[8] = shouldAutoPlay;
2886
- $[9] = src;
2887
- $[10] = style;
2888
- $[11] = t1;
2889
- } else {
2890
- t1 = $[11];
2891
- }
2892
- const {
2893
- videoRef,
2894
- handleEnded,
2895
- handleTimeUpdate,
2896
- handleLoadedData
2897
- } = useNativeVideoModel(t1);
2898
- let t2;
2899
- if ($[12] !== className || $[13] !== handleEnded || $[14] !== handleLoadedData || $[15] !== handleTimeUpdate || $[16] !== isLoop || $[17] !== isMuted || $[18] !== src || $[19] !== style || $[20] !== videoRef) {
2900
- t2 = /* @__PURE__ */ jsx("video", { ref: videoRef, src, className, preload: "auto", muted: isMuted, loop: isLoop, playsInline: true, style, onTimeUpdate: handleTimeUpdate, onEnded: handleEnded, onLoadedData: handleLoadedData });
2901
- $[12] = className;
2902
- $[13] = handleEnded;
2903
- $[14] = handleLoadedData;
2904
- $[15] = handleTimeUpdate;
2905
- $[16] = isLoop;
2906
- $[17] = isMuted;
2907
- $[18] = src;
2908
- $[19] = style;
2909
- $[20] = videoRef;
2910
- $[21] = t2;
2911
- } else {
2912
- t2 = $[21];
2913
- }
2914
- return t2;
2915
- }
2916
- function NoiseOverlay(t0) {
2917
- const $ = c(16);
2918
- const {
2919
- opacity,
2920
- blendMode,
2921
- inlineStyle,
2922
- maskImage,
2923
- isFixed,
2924
- theme
2925
- } = t0;
2926
- const t1 = isFixed ? "fixed" : "absolute";
2927
- let t2;
2928
- if ($[0] !== opacity) {
2929
- t2 = typeof opacity === "number" ? {
2930
- opacity
2931
- } : {};
2932
- $[0] = opacity;
2933
- $[1] = t2;
2934
- } else {
2935
- t2 = $[1];
2936
- }
2937
- let t3;
2938
- if ($[2] !== blendMode) {
2939
- t3 = typeof blendMode === "string" && blendMode.trim() ? {
2940
- mixBlendMode: blendMode
2941
- } : {};
2942
- $[2] = blendMode;
2943
- $[3] = t3;
2944
- } else {
2945
- t3 = $[3];
2946
- }
2947
- let t4;
2948
- if ($[4] !== maskImage) {
2949
- t4 = maskImage ? {
2950
- maskImage,
2951
- WebkitMaskImage: maskImage
2952
- } : {};
2953
- $[4] = maskImage;
2954
- $[5] = t4;
2955
- } else {
2956
- t4 = $[5];
2957
- }
2958
- let t5;
2959
- if ($[6] !== inlineStyle || $[7] !== t2 || $[8] !== t3 || $[9] !== t4 || $[10] !== theme.styles.noise) {
2960
- t5 = {
2961
- ...theme.styles.noise,
2962
- ...t2,
2963
- ...t3,
2964
- ...t4,
2965
- ...inlineStyle
2966
- };
2967
- $[6] = inlineStyle;
2968
- $[7] = t2;
2969
- $[8] = t3;
2970
- $[9] = t4;
2971
- $[10] = theme.styles.noise;
2972
- $[11] = t5;
2973
- } else {
2974
- t5 = $[11];
2975
- }
2976
- let t6;
2977
- if ($[12] !== t1 || $[13] !== t5 || $[14] !== theme.slots.noise) {
2978
- t6 = /* @__PURE__ */ jsx("div", { "data-position": t1, className: theme.slots.noise, style: t5 });
2979
- $[12] = t1;
2980
- $[13] = t5;
2981
- $[14] = theme.slots.noise;
2982
- $[15] = t6;
2983
- } else {
2984
- t6 = $[15];
2985
- }
2986
- return t6;
2987
- }
2988
- function SolidOverlay(t0) {
2989
- const $ = c(10);
2990
- const {
2991
- opacity: t1,
2992
- color,
2993
- transitionStyle,
2994
- maskImage,
2995
- theme
2996
- } = t0;
2997
- const opacity = t1 === void 0 ? 0 : t1;
2998
- let t2;
2999
- if ($[0] !== maskImage) {
3000
- t2 = maskImage ? {
3001
- maskImage,
3002
- WebkitMaskImage: maskImage
3003
- } : {};
3004
- $[0] = maskImage;
3005
- $[1] = t2;
3006
- } else {
3007
- t2 = $[1];
3008
- }
3009
- let t3;
3010
- if ($[2] !== color || $[3] !== opacity || $[4] !== t2 || $[5] !== transitionStyle) {
3011
- t3 = {
3012
- opacity,
3013
- backgroundColor: color,
3014
- ...t2,
3015
- ...transitionStyle
3016
- };
3017
- $[2] = color;
3018
- $[3] = opacity;
3019
- $[4] = t2;
3020
- $[5] = transitionStyle;
3021
- $[6] = t3;
2772
+ $[63] = videoClasses;
2773
+ $[64] = videoRef;
2774
+ $[65] = videoStreamUrl;
2775
+ $[66] = videoStyle;
2776
+ $[67] = t21;
3022
2777
  } else {
3023
- t3 = $[6];
2778
+ t21 = $[67];
3024
2779
  }
3025
- let t4;
3026
- if ($[7] !== t3 || $[8] !== theme.slots.solid) {
3027
- t4 = /* @__PURE__ */ jsx("div", { className: theme.slots.solid, style: t3 });
3028
- $[7] = t3;
3029
- $[8] = theme.slots.solid;
3030
- $[9] = t4;
2780
+ let t22;
2781
+ if ($[68] !== t16 || $[69] !== t18 || $[70] !== t19 || $[71] !== t20 || $[72] !== t21 || $[73] !== theme.slots.youtube) {
2782
+ t22 = /* @__PURE__ */ jsxs("div", { className: theme.slots.youtube, children: [
2783
+ t16,
2784
+ t18,
2785
+ t19,
2786
+ t20,
2787
+ t21
2788
+ ] });
2789
+ $[68] = t16;
2790
+ $[69] = t18;
2791
+ $[70] = t19;
2792
+ $[71] = t20;
2793
+ $[72] = t21;
2794
+ $[73] = theme.slots.youtube;
2795
+ $[74] = t22;
3031
2796
  } else {
3032
- t4 = $[9];
2797
+ t22 = $[74];
3033
2798
  }
3034
- return t4;
2799
+ return t22;
3035
2800
  }
3036
2801
  function VideoSource(t0) {
3037
2802
  const $ = c(33);
@@ -3403,6 +3168,229 @@ function BackgroundOverlay() {
3403
3168
  }
3404
3169
  return t1;
3405
3170
  }
3171
+ function BackgroundGradients(t0) {
3172
+ const $ = c(11);
3173
+ const {
3174
+ count: t1,
3175
+ direction,
3176
+ color: t2,
3177
+ theme
3178
+ } = t0;
3179
+ const count = t1 === void 0 ? 0 : t1;
3180
+ const color = t2 === void 0 ? DEFAULT_COLOR : t2;
3181
+ if (!count || count <= 0) {
3182
+ return null;
3183
+ }
3184
+ const opacity = Math.min(1, Math.max(0.2, count * 0.25));
3185
+ const t3 = theme.slots.gradient;
3186
+ const t4 = theme.styles.gradient;
3187
+ let t5;
3188
+ if ($[0] !== color || $[1] !== direction) {
3189
+ t5 = generateBaseGradient(direction, color);
3190
+ $[0] = color;
3191
+ $[1] = direction;
3192
+ $[2] = t5;
3193
+ } else {
3194
+ t5 = $[2];
3195
+ }
3196
+ let t6;
3197
+ if ($[3] !== opacity || $[4] !== t5 || $[5] !== theme.styles.gradient) {
3198
+ t6 = {
3199
+ ...t4,
3200
+ opacity,
3201
+ background: t5
3202
+ };
3203
+ $[3] = opacity;
3204
+ $[4] = t5;
3205
+ $[5] = theme.styles.gradient;
3206
+ $[6] = t6;
3207
+ } else {
3208
+ t6 = $[6];
3209
+ }
3210
+ let t7;
3211
+ if ($[7] !== direction || $[8] !== t6 || $[9] !== theme.slots.gradient) {
3212
+ t7 = /* @__PURE__ */ jsx("div", { "data-side": direction, className: t3, style: t6 });
3213
+ $[7] = direction;
3214
+ $[8] = t6;
3215
+ $[9] = theme.slots.gradient;
3216
+ $[10] = t7;
3217
+ } else {
3218
+ t7 = $[10];
3219
+ }
3220
+ return t7;
3221
+ }
3222
+ function EdgeGradient(t0) {
3223
+ const $ = c(11);
3224
+ const {
3225
+ direction,
3226
+ percent: t1,
3227
+ opacity: t2,
3228
+ color,
3229
+ theme
3230
+ } = t0;
3231
+ const percent = t1 === void 0 ? 0 : t1;
3232
+ const opacity = t2 === void 0 ? 0 : t2;
3233
+ if (opacity <= 0) {
3234
+ return null;
3235
+ }
3236
+ const t3 = theme.slots.edge;
3237
+ const t4 = `${Math.max(30, percent * 1.15)}%`;
3238
+ const t5 = color || DEFAULT_COLOR;
3239
+ let t6;
3240
+ if ($[0] !== direction || $[1] !== t5) {
3241
+ t6 = generateEdgeGradient(direction, t5);
3242
+ $[0] = direction;
3243
+ $[1] = t5;
3244
+ $[2] = t6;
3245
+ } else {
3246
+ t6 = $[2];
3247
+ }
3248
+ let t7;
3249
+ if ($[3] !== opacity || $[4] !== t4 || $[5] !== t6) {
3250
+ t7 = {
3251
+ width: t4,
3252
+ opacity,
3253
+ background: t6
3254
+ };
3255
+ $[3] = opacity;
3256
+ $[4] = t4;
3257
+ $[5] = t6;
3258
+ $[6] = t7;
3259
+ } else {
3260
+ t7 = $[6];
3261
+ }
3262
+ let t8;
3263
+ if ($[7] !== direction || $[8] !== t7 || $[9] !== theme.slots.edge) {
3264
+ t8 = /* @__PURE__ */ jsx("div", { "data-side": direction, className: t3, style: t7 });
3265
+ $[7] = direction;
3266
+ $[8] = t7;
3267
+ $[9] = theme.slots.edge;
3268
+ $[10] = t8;
3269
+ } else {
3270
+ t8 = $[10];
3271
+ }
3272
+ return t8;
3273
+ }
3274
+ function NoiseOverlay(t0) {
3275
+ const $ = c(16);
3276
+ const {
3277
+ opacity,
3278
+ blendMode,
3279
+ inlineStyle,
3280
+ maskImage,
3281
+ isFixed,
3282
+ theme
3283
+ } = t0;
3284
+ const t1 = isFixed ? "fixed" : "absolute";
3285
+ let t2;
3286
+ if ($[0] !== opacity) {
3287
+ t2 = typeof opacity === "number" ? {
3288
+ opacity
3289
+ } : {};
3290
+ $[0] = opacity;
3291
+ $[1] = t2;
3292
+ } else {
3293
+ t2 = $[1];
3294
+ }
3295
+ let t3;
3296
+ if ($[2] !== blendMode) {
3297
+ t3 = typeof blendMode === "string" && blendMode.trim() ? {
3298
+ mixBlendMode: blendMode
3299
+ } : {};
3300
+ $[2] = blendMode;
3301
+ $[3] = t3;
3302
+ } else {
3303
+ t3 = $[3];
3304
+ }
3305
+ let t4;
3306
+ if ($[4] !== maskImage) {
3307
+ t4 = maskImage ? {
3308
+ maskImage,
3309
+ WebkitMaskImage: maskImage
3310
+ } : {};
3311
+ $[4] = maskImage;
3312
+ $[5] = t4;
3313
+ } else {
3314
+ t4 = $[5];
3315
+ }
3316
+ let t5;
3317
+ if ($[6] !== inlineStyle || $[7] !== t2 || $[8] !== t3 || $[9] !== t4 || $[10] !== theme.styles.noise) {
3318
+ t5 = {
3319
+ ...theme.styles.noise,
3320
+ ...t2,
3321
+ ...t3,
3322
+ ...t4,
3323
+ ...inlineStyle
3324
+ };
3325
+ $[6] = inlineStyle;
3326
+ $[7] = t2;
3327
+ $[8] = t3;
3328
+ $[9] = t4;
3329
+ $[10] = theme.styles.noise;
3330
+ $[11] = t5;
3331
+ } else {
3332
+ t5 = $[11];
3333
+ }
3334
+ let t6;
3335
+ if ($[12] !== t1 || $[13] !== t5 || $[14] !== theme.slots.noise) {
3336
+ t6 = /* @__PURE__ */ jsx("div", { "data-position": t1, className: theme.slots.noise, style: t5 });
3337
+ $[12] = t1;
3338
+ $[13] = t5;
3339
+ $[14] = theme.slots.noise;
3340
+ $[15] = t6;
3341
+ } else {
3342
+ t6 = $[15];
3343
+ }
3344
+ return t6;
3345
+ }
3346
+ function SolidOverlay(t0) {
3347
+ const $ = c(10);
3348
+ const {
3349
+ opacity: t1,
3350
+ color,
3351
+ transitionStyle,
3352
+ maskImage,
3353
+ theme
3354
+ } = t0;
3355
+ const opacity = t1 === void 0 ? 0 : t1;
3356
+ let t2;
3357
+ if ($[0] !== maskImage) {
3358
+ t2 = maskImage ? {
3359
+ maskImage,
3360
+ WebkitMaskImage: maskImage
3361
+ } : {};
3362
+ $[0] = maskImage;
3363
+ $[1] = t2;
3364
+ } else {
3365
+ t2 = $[1];
3366
+ }
3367
+ let t3;
3368
+ if ($[2] !== color || $[3] !== opacity || $[4] !== t2 || $[5] !== transitionStyle) {
3369
+ t3 = {
3370
+ opacity,
3371
+ backgroundColor: color,
3372
+ ...t2,
3373
+ ...transitionStyle
3374
+ };
3375
+ $[2] = color;
3376
+ $[3] = opacity;
3377
+ $[4] = t2;
3378
+ $[5] = transitionStyle;
3379
+ $[6] = t3;
3380
+ } else {
3381
+ t3 = $[6];
3382
+ }
3383
+ let t4;
3384
+ if ($[7] !== t3 || $[8] !== theme.slots.solid) {
3385
+ t4 = /* @__PURE__ */ jsx("div", { className: theme.slots.solid, style: t3 });
3386
+ $[7] = t3;
3387
+ $[8] = theme.slots.solid;
3388
+ $[9] = t4;
3389
+ } else {
3390
+ t4 = $[9];
3391
+ }
3392
+ return t4;
3393
+ }
3406
3394
  function selectPageBackground(background) {
3407
3395
  return background ? normalizeBackgroundInput(background) : null;
3408
3396
  }
@@ -3477,5 +3465,5 @@ function defineBackground(definition = {}) {
3477
3465
  }
3478
3466
 
3479
3467
  export { BACKGROUND_MEDIA_ID, BACKGROUND_REGISTRY_KEY, BG_TOKEN_TO_OBJECT_STYLE, BackgroundContext, BackgroundOverlay, BackgroundProvider, DEFAULT_BACKGROUND, DEFAULT_BACKGROUND_COMPUTED, DEFAULT_COLOR, INERT_BACKGROUND_ACTIONS, OBJECT_FITS, YouTubeBackgroundPlayer, applyVideoPlaybackState, backgroundModule, backgroundTheme, computeBackgroundState, defineBackground, extractYouTubeVideoId, generateBaseGradient, generateEdgeGradient, getEdgeFadeMask, getYouTubeStreamUrl, getYouTubeThumbnailUrl, isDirectVideoUrl, isYouTubeUrl, mergeBackgroundState, normalizeBackgroundInput, parseYouTubeUrlConfig, resolveBackgroundState, resolveVideoClassNames, resolveVideoOptions, selectPageBackground, syncVideoLoopDirect, syncVideoMutedDirect, triggerVideoPlaybackDirect, useBackground, useBackgroundActions, useBackgroundRegistration, useBackgroundState, useOptionalBackgroundActions, useOptionalBackgroundState };
3480
- //# sourceMappingURL=chunk-HFR6YROB.js.map
3481
- //# sourceMappingURL=chunk-HFR6YROB.js.map
3468
+ //# sourceMappingURL=chunk-6P3F4JU3.js.map
3469
+ //# sourceMappingURL=chunk-6P3F4JU3.js.map