@mountaya/elements 0.0.0-stage → 0.2.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 (828) hide show
  1. package/CHANGELOG.md +273 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +1510 -2
  5. package/THIRD-PARTY-NOTICES.txt +103 -0
  6. package/dist/agent/index.cjs +1211 -0
  7. package/dist/agent/index.cjs.map +1 -0
  8. package/dist/agent/index.d.cts +1966 -0
  9. package/dist/agent/index.d.ts +1966 -0
  10. package/dist/agent/index.js +1181 -0
  11. package/dist/agent/index.js.map +1 -0
  12. package/dist/camera/index.cjs +2512 -0
  13. package/dist/camera/index.cjs.map +1 -0
  14. package/dist/camera/index.d.cts +1723 -0
  15. package/dist/camera/index.d.ts +1723 -0
  16. package/dist/camera/index.js +2443 -0
  17. package/dist/camera/index.js.map +1 -0
  18. package/dist/chunk-5pTPpv4v.d.cts +897 -0
  19. package/dist/chunk-5pTPpv4v.d.ts +897 -0
  20. package/dist/chunk-6JzFMFHh.d.ts +119 -0
  21. package/dist/chunk-6qyuJVvt.d.ts +513 -0
  22. package/dist/chunk-9fp0lDic.cjs +583 -0
  23. package/dist/chunk-9fp0lDic.cjs.map +1 -0
  24. package/dist/chunk-A48H1rDg.d.cts +73 -0
  25. package/dist/chunk-A48H1rDg.d.ts +73 -0
  26. package/dist/chunk-B-m1AchR.cjs +57 -0
  27. package/dist/chunk-B-m1AchR.cjs.map +1 -0
  28. package/dist/chunk-B-qFTf04.d.ts +216 -0
  29. package/dist/chunk-B0YROiZh.d.cts +1475 -0
  30. package/dist/chunk-B14wgOvH.d.cts +68 -0
  31. package/dist/chunk-B19l3j9r.cjs +150 -0
  32. package/dist/chunk-B19l3j9r.cjs.map +1 -0
  33. package/dist/chunk-B2PtjVKg.cjs +86 -0
  34. package/dist/chunk-B2PtjVKg.cjs.map +1 -0
  35. package/dist/chunk-B56Oyb7W.cjs +70 -0
  36. package/dist/chunk-B56Oyb7W.cjs.map +1 -0
  37. package/dist/chunk-B5WGMQwK.cjs +113 -0
  38. package/dist/chunk-B5WGMQwK.cjs.map +1 -0
  39. package/dist/chunk-B98mKrdu.d.cts +302 -0
  40. package/dist/chunk-BB0PmqIM.d.cts +44 -0
  41. package/dist/chunk-BBikve0Z.cjs +269 -0
  42. package/dist/chunk-BBikve0Z.cjs.map +1 -0
  43. package/dist/chunk-BHeXmM0X.js +37 -0
  44. package/dist/chunk-BHeXmM0X.js.map +1 -0
  45. package/dist/chunk-BI8WZLpU.cjs +281 -0
  46. package/dist/chunk-BI8WZLpU.cjs.map +1 -0
  47. package/dist/chunk-BIEc_SkR.cjs +29 -0
  48. package/dist/chunk-BIEc_SkR.cjs.map +1 -0
  49. package/dist/chunk-BJ6L6_W9.cjs +553 -0
  50. package/dist/chunk-BJ6L6_W9.cjs.map +1 -0
  51. package/dist/chunk-BJ91UCbB.js +11 -0
  52. package/dist/chunk-BJ91UCbB.js.map +1 -0
  53. package/dist/chunk-BJEZWTKj.cjs +166 -0
  54. package/dist/chunk-BJEZWTKj.cjs.map +1 -0
  55. package/dist/chunk-BJz54mfg.cjs +10 -0
  56. package/dist/chunk-BJz54mfg.cjs.map +1 -0
  57. package/dist/chunk-BNX5LAfN.d.cts +912 -0
  58. package/dist/chunk-BP6KgA86.js +35 -0
  59. package/dist/chunk-BP6KgA86.js.map +1 -0
  60. package/dist/chunk-BRnjQq6K.d.cts +157 -0
  61. package/dist/chunk-BSiMEwPS.js +46 -0
  62. package/dist/chunk-BSiMEwPS.js.map +1 -0
  63. package/dist/chunk-BTPjDw_y.cjs +16 -0
  64. package/dist/chunk-BTPjDw_y.cjs.map +1 -0
  65. package/dist/chunk-BTUUABGI.js +17 -0
  66. package/dist/chunk-BTUUABGI.js.map +1 -0
  67. package/dist/chunk-BUeL9y7s.cjs +45 -0
  68. package/dist/chunk-BUeL9y7s.cjs.map +1 -0
  69. package/dist/chunk-BWMuCNc9.cjs +172 -0
  70. package/dist/chunk-BWMuCNc9.cjs.map +1 -0
  71. package/dist/chunk-BWjRfhpF.js +126 -0
  72. package/dist/chunk-BWjRfhpF.js.map +1 -0
  73. package/dist/chunk-BZ5KyZXI.d.ts +302 -0
  74. package/dist/chunk-B_4SVmvh.js +94 -0
  75. package/dist/chunk-B_4SVmvh.js.map +1 -0
  76. package/dist/chunk-BcTUuZQ3.js +95 -0
  77. package/dist/chunk-BcTUuZQ3.js.map +1 -0
  78. package/dist/chunk-BdkqSsJe.cjs +140 -0
  79. package/dist/chunk-BdkqSsJe.cjs.map +1 -0
  80. package/dist/chunk-BfktMVmI.js +70 -0
  81. package/dist/chunk-BfktMVmI.js.map +1 -0
  82. package/dist/chunk-BfzQb0EK.cjs +6 -0
  83. package/dist/chunk-BhWfT-22.d.cts +808 -0
  84. package/dist/chunk-BjJcqX5J.cjs +60 -0
  85. package/dist/chunk-BjJcqX5J.cjs.map +1 -0
  86. package/dist/chunk-Bk0L8g5J.d.cts +77 -0
  87. package/dist/chunk-Bk0L8g5J.d.ts +77 -0
  88. package/dist/chunk-Bl4_uVa6.cjs +11 -0
  89. package/dist/chunk-Bl4_uVa6.cjs.map +1 -0
  90. package/dist/chunk-BlKF4lrp.js +43 -0
  91. package/dist/chunk-BlKF4lrp.js.map +1 -0
  92. package/dist/chunk-Bm1FieGR.js +4 -0
  93. package/dist/chunk-Bm1FieGR.js.map +1 -0
  94. package/dist/chunk-Bn6ZbxkS.cjs +27 -0
  95. package/dist/chunk-BpN3hr6a.cjs +541 -0
  96. package/dist/chunk-BpN3hr6a.cjs.map +1 -0
  97. package/dist/chunk-Bq_WHTfd.d.cts +119 -0
  98. package/dist/chunk-Bqt4LBBz.cjs +648 -0
  99. package/dist/chunk-Bqt4LBBz.cjs.map +1 -0
  100. package/dist/chunk-Bqt97zwf.d.cts +54 -0
  101. package/dist/chunk-Bqt97zwf.d.ts +54 -0
  102. package/dist/chunk-BsBiN4w6.d.cts +245 -0
  103. package/dist/chunk-BvTpOUoC.cjs +207 -0
  104. package/dist/chunk-BvTpOUoC.cjs.map +1 -0
  105. package/dist/chunk-BwK6Hl3q.cjs +446 -0
  106. package/dist/chunk-BwK6Hl3q.cjs.map +1 -0
  107. package/dist/chunk-BxDQZDXR.d.cts +76 -0
  108. package/dist/chunk-BxDQZDXR.d.ts +76 -0
  109. package/dist/chunk-BxUio8kX.js +20 -0
  110. package/dist/chunk-BxUio8kX.js.map +1 -0
  111. package/dist/chunk-BxaocpFi.d.cts +1 -0
  112. package/dist/chunk-Bywi0K1N.js +36 -0
  113. package/dist/chunk-Bywi0K1N.js.map +1 -0
  114. package/dist/chunk-C-IlmkDl.js +59 -0
  115. package/dist/chunk-C-IlmkDl.js.map +1 -0
  116. package/dist/chunk-C5PtVewq.d.ts +389 -0
  117. package/dist/chunk-C5dpC7mQ.js +19 -0
  118. package/dist/chunk-C5dpC7mQ.js.map +1 -0
  119. package/dist/chunk-C5q1sgSa.js +46 -0
  120. package/dist/chunk-C5q1sgSa.js.map +1 -0
  121. package/dist/chunk-C6fU9G5I.cjs +221 -0
  122. package/dist/chunk-C6fU9G5I.cjs.map +1 -0
  123. package/dist/chunk-C71dpWUK.js +5 -0
  124. package/dist/chunk-C71dpWUK.js.map +1 -0
  125. package/dist/chunk-C82N1gQX.d.ts +1831 -0
  126. package/dist/chunk-C8HdaHpu.js +118 -0
  127. package/dist/chunk-C8HdaHpu.js.map +1 -0
  128. package/dist/chunk-C8ZGryck.js +236 -0
  129. package/dist/chunk-C8ZGryck.js.map +1 -0
  130. package/dist/chunk-C95NG0oD.cjs +43 -0
  131. package/dist/chunk-C95NG0oD.cjs.map +1 -0
  132. package/dist/chunk-C9aR8DXb.js +9 -0
  133. package/dist/chunk-C9aR8DXb.js.map +1 -0
  134. package/dist/chunk-CAUZnoCs.d.ts +525 -0
  135. package/dist/chunk-CBXWWuM9.cjs +82 -0
  136. package/dist/chunk-CBXWWuM9.cjs.map +1 -0
  137. package/dist/chunk-CC_Kquu7.d.cts +125 -0
  138. package/dist/chunk-CC_Kquu7.d.ts +125 -0
  139. package/dist/chunk-CCp85vXg.cjs +60 -0
  140. package/dist/chunk-CCp85vXg.cjs.map +1 -0
  141. package/dist/chunk-CEcB1_uK.js +39 -0
  142. package/dist/chunk-CEcB1_uK.js.map +1 -0
  143. package/dist/chunk-CFIo021l.d.cts +216 -0
  144. package/dist/chunk-CH_IZoJE.js +33 -0
  145. package/dist/chunk-CH_IZoJE.js.map +1 -0
  146. package/dist/chunk-CHrasH_g.cjs +25 -0
  147. package/dist/chunk-CHrasH_g.cjs.map +1 -0
  148. package/dist/chunk-CJVoSaAE.cjs +3 -0
  149. package/dist/chunk-CJp8nGcb.js +96 -0
  150. package/dist/chunk-CJp8nGcb.js.map +1 -0
  151. package/dist/chunk-CJwUtkOt.js +112 -0
  152. package/dist/chunk-CJwUtkOt.js.map +1 -0
  153. package/dist/chunk-CKhCOVIf.d.cts +751 -0
  154. package/dist/chunk-CKiVSRYg.js +50 -0
  155. package/dist/chunk-CKiVSRYg.js.map +1 -0
  156. package/dist/chunk-CKtd19eD.cjs +59 -0
  157. package/dist/chunk-CKtd19eD.cjs.map +1 -0
  158. package/dist/chunk-CL92KE3j.d.ts +3188 -0
  159. package/dist/chunk-CLqUlkAe.js +54 -0
  160. package/dist/chunk-CLqUlkAe.js.map +1 -0
  161. package/dist/chunk-CMG5OV0q.cjs +4741 -0
  162. package/dist/chunk-CMG5OV0q.cjs.map +1 -0
  163. package/dist/chunk-CN_TKSgm.js +10 -0
  164. package/dist/chunk-CN_TKSgm.js.map +1 -0
  165. package/dist/chunk-CNe6MtqV.cjs +29 -0
  166. package/dist/chunk-CNe6MtqV.cjs.map +1 -0
  167. package/dist/chunk-COQkDTC5.js +83 -0
  168. package/dist/chunk-COQkDTC5.js.map +1 -0
  169. package/dist/chunk-CPBl6K4M.cjs +168 -0
  170. package/dist/chunk-CPBl6K4M.cjs.map +1 -0
  171. package/dist/chunk-CPx0ZYFB.d.ts +3 -0
  172. package/dist/chunk-CQQhcP_C.d.ts +197 -0
  173. package/dist/chunk-CTNoajFh.d.cts +389 -0
  174. package/dist/chunk-CTd-qgJc.cjs +384 -0
  175. package/dist/chunk-CTd-qgJc.cjs.map +1 -0
  176. package/dist/chunk-CW80YYtU.cjs +1056 -0
  177. package/dist/chunk-CW80YYtU.cjs.map +1 -0
  178. package/dist/chunk-CWpqBgkF.d.cts +24 -0
  179. package/dist/chunk-CWpqBgkF.d.ts +24 -0
  180. package/dist/chunk-CXjRArgy.d.ts +3 -0
  181. package/dist/chunk-CXonfH3-.cjs +14 -0
  182. package/dist/chunk-CXonfH3-.cjs.map +1 -0
  183. package/dist/chunk-CYcouGXN.d.ts +825 -0
  184. package/dist/chunk-CZDAzEBw.cjs +1621 -0
  185. package/dist/chunk-CZDAzEBw.cjs.map +1 -0
  186. package/dist/chunk-C_fQFr70.d.cts +159 -0
  187. package/dist/chunk-C_fQFr70.d.ts +159 -0
  188. package/dist/chunk-CbOtHnnB.cjs +359 -0
  189. package/dist/chunk-CbOtHnnB.cjs.map +1 -0
  190. package/dist/chunk-CdA6ZMGk.d.cts +825 -0
  191. package/dist/chunk-Ce1_thm7.js +146 -0
  192. package/dist/chunk-Ce1_thm7.js.map +1 -0
  193. package/dist/chunk-CeD8Hw0j.d.cts +3188 -0
  194. package/dist/chunk-CeiTuMyt.d.cts +525 -0
  195. package/dist/chunk-Ch1OLzLi.js +1 -0
  196. package/dist/chunk-Cizu_j1N.cjs +87 -0
  197. package/dist/chunk-Cizu_j1N.cjs.map +1 -0
  198. package/dist/chunk-CjDe9z6A.d.cts +427 -0
  199. package/dist/chunk-Cl1etdlu.js +63 -0
  200. package/dist/chunk-Cl1etdlu.js.map +1 -0
  201. package/dist/chunk-CmoVJDoz.js +4 -0
  202. package/dist/chunk-CmoVJDoz.js.map +1 -0
  203. package/dist/chunk-CnLucxjG.cjs +197 -0
  204. package/dist/chunk-CnLucxjG.cjs.map +1 -0
  205. package/dist/chunk-CsWjBmdi.cjs +56 -0
  206. package/dist/chunk-CsWjBmdi.cjs.map +1 -0
  207. package/dist/chunk-CuseO5MZ.d.cts +3 -0
  208. package/dist/chunk-CvMHibbA.d.ts +427 -0
  209. package/dist/chunk-CwDeiN5U.js +870 -0
  210. package/dist/chunk-CwDeiN5U.js.map +1 -0
  211. package/dist/chunk-Cwdmx4tG.js +1 -0
  212. package/dist/chunk-D-4MxHTt.d.cts +105 -0
  213. package/dist/chunk-D-4MxHTt.d.ts +105 -0
  214. package/dist/chunk-D0LF-99V.js +1093 -0
  215. package/dist/chunk-D0LF-99V.js.map +1 -0
  216. package/dist/chunk-D1fe-0c_.js +367 -0
  217. package/dist/chunk-D1fe-0c_.js.map +1 -0
  218. package/dist/chunk-D21fEI6A.d.ts +1926 -0
  219. package/dist/chunk-D39gAxya.cjs +89 -0
  220. package/dist/chunk-D39gAxya.cjs.map +1 -0
  221. package/dist/chunk-D6KdIW5e.cjs +228 -0
  222. package/dist/chunk-D6KdIW5e.cjs.map +1 -0
  223. package/dist/chunk-D6qHYbgW.d.cts +36 -0
  224. package/dist/chunk-D89E-w70.d.ts +44 -0
  225. package/dist/chunk-D8bdTysL.js +552 -0
  226. package/dist/chunk-D8bdTysL.js.map +1 -0
  227. package/dist/chunk-D96QJT24.cjs +109 -0
  228. package/dist/chunk-D96QJT24.cjs.map +1 -0
  229. package/dist/chunk-DAmkQl-i.js +119 -0
  230. package/dist/chunk-DAmkQl-i.js.map +1 -0
  231. package/dist/chunk-DEfsb2lc.cjs +10 -0
  232. package/dist/chunk-DEfsb2lc.cjs.map +1 -0
  233. package/dist/chunk-DIFjT5-V.d.cts +66 -0
  234. package/dist/chunk-DJpUw8TN.d.ts +912 -0
  235. package/dist/chunk-DK6lm2IZ.cjs +11 -0
  236. package/dist/chunk-DK6lm2IZ.cjs.map +1 -0
  237. package/dist/chunk-DKqgr31j.cjs +61 -0
  238. package/dist/chunk-DKqgr31j.cjs.map +1 -0
  239. package/dist/chunk-DLZ0QYm9.js +37 -0
  240. package/dist/chunk-DLZ0QYm9.js.map +1 -0
  241. package/dist/chunk-DLjS0uaC.js +4 -0
  242. package/dist/chunk-DLjS0uaC.js.map +1 -0
  243. package/dist/chunk-DMokwmOV.cjs +49 -0
  244. package/dist/chunk-DMokwmOV.cjs.map +1 -0
  245. package/dist/chunk-DMvWgBZL.d.cts +1831 -0
  246. package/dist/chunk-DNfGfIF3.js +31 -0
  247. package/dist/chunk-DNfGfIF3.js.map +1 -0
  248. package/dist/chunk-DQbSRe8D.d.ts +245 -0
  249. package/dist/chunk-DSGkP8_y.js +45 -0
  250. package/dist/chunk-DSGkP8_y.js.map +1 -0
  251. package/dist/chunk-DTctvfSd.d.cts +197 -0
  252. package/dist/chunk-DWe7igyw.cjs +206 -0
  253. package/dist/chunk-DWe7igyw.cjs.map +1 -0
  254. package/dist/chunk-DWsMP5JR.d.ts +68 -0
  255. package/dist/chunk-DWsm3HIW.d.cts +120 -0
  256. package/dist/chunk-DWsm3HIW.d.ts +120 -0
  257. package/dist/chunk-DXABHjLa.cjs +3 -0
  258. package/dist/chunk-D_BeqSbc.cjs +42 -0
  259. package/dist/chunk-D_BeqSbc.cjs.map +1 -0
  260. package/dist/chunk-D_svQNdW.d.ts +66 -0
  261. package/dist/chunk-Dav4xWrp.js +330 -0
  262. package/dist/chunk-Dav4xWrp.js.map +1 -0
  263. package/dist/chunk-DbCPhepL.js +293 -0
  264. package/dist/chunk-DbCPhepL.js.map +1 -0
  265. package/dist/chunk-DcrTy-y2.cjs +43 -0
  266. package/dist/chunk-DcrTy-y2.cjs.map +1 -0
  267. package/dist/chunk-Ddv484ld.js +487 -0
  268. package/dist/chunk-Ddv484ld.js.map +1 -0
  269. package/dist/chunk-De0bjnhY.cjs +88 -0
  270. package/dist/chunk-De0bjnhY.cjs.map +1 -0
  271. package/dist/chunk-De2FmNPu.cjs +32 -0
  272. package/dist/chunk-De2FmNPu.cjs.map +1 -0
  273. package/dist/chunk-DeSjQXiI.d.ts +157 -0
  274. package/dist/chunk-Den0Ta6C.js +132 -0
  275. package/dist/chunk-Den0Ta6C.js.map +1 -0
  276. package/dist/chunk-DiDKEeEa.js +8 -0
  277. package/dist/chunk-DiDKEeEa.js.map +1 -0
  278. package/dist/chunk-Dj60k5PU.js +197 -0
  279. package/dist/chunk-Dj60k5PU.js.map +1 -0
  280. package/dist/chunk-DjnYQBCN.js +4705 -0
  281. package/dist/chunk-DjnYQBCN.js.map +1 -0
  282. package/dist/chunk-Dk9VKvyq.d.ts +1 -0
  283. package/dist/chunk-Dor1ERI9.cjs +85 -0
  284. package/dist/chunk-Dor1ERI9.cjs.map +1 -0
  285. package/dist/chunk-DpMouOoH.js +451 -0
  286. package/dist/chunk-DpMouOoH.js.map +1 -0
  287. package/dist/chunk-DposgdNL.cjs +52 -0
  288. package/dist/chunk-DposgdNL.cjs.map +1 -0
  289. package/dist/chunk-DqLTG_5Q.d.cts +3 -0
  290. package/dist/chunk-Dr5MCIpS.d.cts +63 -0
  291. package/dist/chunk-Dr5MCIpS.d.ts +63 -0
  292. package/dist/chunk-DrudttCC.cjs +4 -0
  293. package/dist/chunk-DsDYVJQC.js +173 -0
  294. package/dist/chunk-DsDYVJQC.js.map +1 -0
  295. package/dist/chunk-Dw8ur6FJ.js +27 -0
  296. package/dist/chunk-Dw8ur6FJ.js.map +1 -0
  297. package/dist/chunk-DwG6M_0v.js +64 -0
  298. package/dist/chunk-DwG6M_0v.js.map +1 -0
  299. package/dist/chunk-Dy9a5ibO.js +284 -0
  300. package/dist/chunk-Dy9a5ibO.js.map +1 -0
  301. package/dist/chunk-DyayZlQJ.js +157 -0
  302. package/dist/chunk-DyayZlQJ.js.map +1 -0
  303. package/dist/chunk-DyhJZC2i.js +126 -0
  304. package/dist/chunk-DyhJZC2i.js.map +1 -0
  305. package/dist/chunk-F9zBzmmG.cjs +45 -0
  306. package/dist/chunk-F9zBzmmG.cjs.map +1 -0
  307. package/dist/chunk-FyCYofv2.js +116 -0
  308. package/dist/chunk-FyCYofv2.js.map +1 -0
  309. package/dist/chunk-GHJRjAk2.js +1 -0
  310. package/dist/chunk-H14isiSf.d.ts +751 -0
  311. package/dist/chunk-HIJzXoN4.js +7 -0
  312. package/dist/chunk-HIJzXoN4.js.map +1 -0
  313. package/dist/chunk-Id_8kRtu.d.ts +36 -0
  314. package/dist/chunk-KN60yxBQ.js +5 -0
  315. package/dist/chunk-KN60yxBQ.js.map +1 -0
  316. package/dist/chunk-NM5yg6bh.cjs +82 -0
  317. package/dist/chunk-NM5yg6bh.cjs.map +1 -0
  318. package/dist/chunk-OXr3zJfM.cjs +119 -0
  319. package/dist/chunk-OXr3zJfM.cjs.map +1 -0
  320. package/dist/chunk-QGqgNC4z.d.ts +928 -0
  321. package/dist/chunk-QJBtJrZ0.js +36 -0
  322. package/dist/chunk-QJBtJrZ0.js.map +1 -0
  323. package/dist/chunk-QKWhxfPv.d.cts +361 -0
  324. package/dist/chunk-QKWhxfPv.d.ts +361 -0
  325. package/dist/chunk-QXW7b4Ev.d.cts +410 -0
  326. package/dist/chunk-RHZrxUrM.cjs +39 -0
  327. package/dist/chunk-RHZrxUrM.cjs.map +1 -0
  328. package/dist/chunk-RTxe2i66.js +91 -0
  329. package/dist/chunk-RTxe2i66.js.map +1 -0
  330. package/dist/chunk-RrKkJb6P.js +16 -0
  331. package/dist/chunk-RrKkJb6P.js.map +1 -0
  332. package/dist/chunk-VOJqpcnM.cjs +181 -0
  333. package/dist/chunk-VOJqpcnM.cjs.map +1 -0
  334. package/dist/chunk-VljGTrid.js +1 -0
  335. package/dist/chunk-X3UVwUEK.d.cts +513 -0
  336. package/dist/chunk-X9K2WChn.cjs +28 -0
  337. package/dist/chunk-X9K2WChn.cjs.map +1 -0
  338. package/dist/chunk-YrtOx6oy.js +251 -0
  339. package/dist/chunk-YrtOx6oy.js.map +1 -0
  340. package/dist/chunk-bY7ySujI.d.cts +928 -0
  341. package/dist/chunk-bYf1sBz5.d.cts +11 -0
  342. package/dist/chunk-bYf1sBz5.d.ts +11 -0
  343. package/dist/chunk-blfknWoM.d.cts +1926 -0
  344. package/dist/chunk-blqsohAb.js +113 -0
  345. package/dist/chunk-blqsohAb.js.map +1 -0
  346. package/dist/chunk-cDMCjodI.cjs +58 -0
  347. package/dist/chunk-cDMCjodI.cjs.map +1 -0
  348. package/dist/chunk-cWjE3qd6.cjs +10 -0
  349. package/dist/chunk-cWjE3qd6.cjs.map +1 -0
  350. package/dist/chunk-dfOgV3fu.js +26 -0
  351. package/dist/chunk-dfOgV3fu.js.map +1 -0
  352. package/dist/chunk-f9cTwUX1.cjs +125 -0
  353. package/dist/chunk-f9cTwUX1.cjs.map +1 -0
  354. package/dist/chunk-fHVYEZs4.cjs +28 -0
  355. package/dist/chunk-fHVYEZs4.cjs.map +1 -0
  356. package/dist/chunk-fWRUMgRI.js +22 -0
  357. package/dist/chunk-fWRUMgRI.js.map +1 -0
  358. package/dist/chunk-fozLXfHY.d.cts +55 -0
  359. package/dist/chunk-fozLXfHY.d.ts +55 -0
  360. package/dist/chunk-gWmB1l3A.cjs +3122 -0
  361. package/dist/chunk-gWmB1l3A.cjs.map +1 -0
  362. package/dist/chunk-gbj2R-_w.js +58 -0
  363. package/dist/chunk-gbj2R-_w.js.map +1 -0
  364. package/dist/chunk-iIWxsAXd.js +59 -0
  365. package/dist/chunk-iIWxsAXd.js.map +1 -0
  366. package/dist/chunk-lItIuOIS.cjs +137 -0
  367. package/dist/chunk-lItIuOIS.cjs.map +1 -0
  368. package/dist/chunk-m6Rh4PCe.cjs +798 -0
  369. package/dist/chunk-m6Rh4PCe.cjs.map +1 -0
  370. package/dist/chunk-o3IRANDf.cjs +99 -0
  371. package/dist/chunk-o3IRANDf.cjs.map +1 -0
  372. package/dist/chunk-obUcg3Sk.d.ts +808 -0
  373. package/dist/chunk-ohsf-6Rn.js +600 -0
  374. package/dist/chunk-ohsf-6Rn.js.map +1 -0
  375. package/dist/chunk-pBleU6Nv.js +3061 -0
  376. package/dist/chunk-pBleU6Nv.js.map +1 -0
  377. package/dist/chunk-px4e99cy.js +71 -0
  378. package/dist/chunk-px4e99cy.js.map +1 -0
  379. package/dist/chunk-qwYDLeXc.cjs +99 -0
  380. package/dist/chunk-qwYDLeXc.cjs.map +1 -0
  381. package/dist/chunk-rF_859Qk.cjs +101 -0
  382. package/dist/chunk-rF_859Qk.cjs.map +1 -0
  383. package/dist/chunk-rLJkqJ5j.d.ts +1475 -0
  384. package/dist/chunk-twQItIRg.cjs +338 -0
  385. package/dist/chunk-twQItIRg.cjs.map +1 -0
  386. package/dist/chunk-vnPrMVjY.js +10 -0
  387. package/dist/chunk-vnPrMVjY.js.map +1 -0
  388. package/dist/chunk-ws3bVwaS.d.ts +410 -0
  389. package/dist/chunk-xh3UkuVs.cjs +246 -0
  390. package/dist/chunk-xh3UkuVs.cjs.map +1 -0
  391. package/dist/chunk-yMzRr26E.js +153 -0
  392. package/dist/chunk-yMzRr26E.js.map +1 -0
  393. package/dist/collab/index.cjs +831 -0
  394. package/dist/collab/index.cjs.map +1 -0
  395. package/dist/collab/index.d.cts +824 -0
  396. package/dist/collab/index.d.ts +824 -0
  397. package/dist/collab/index.js +819 -0
  398. package/dist/collab/index.js.map +1 -0
  399. package/dist/data/index.cjs +39 -0
  400. package/dist/data/index.d.cts +6 -0
  401. package/dist/data/index.d.ts +6 -0
  402. package/dist/data/index.js +7 -0
  403. package/dist/editor/index.cjs +2713 -0
  404. package/dist/editor/index.cjs.map +1 -0
  405. package/dist/editor/index.d.cts +10 -0
  406. package/dist/editor/index.d.ts +10 -0
  407. package/dist/editor/index.js +2702 -0
  408. package/dist/editor/index.js.map +1 -0
  409. package/dist/errors/index.cjs +11 -0
  410. package/dist/errors/index.d.cts +2 -0
  411. package/dist/errors/index.d.ts +2 -0
  412. package/dist/errors/index.js +1 -0
  413. package/dist/geo/index.cjs +68 -0
  414. package/dist/geo/index.d.cts +6 -0
  415. package/dist/geo/index.d.ts +6 -0
  416. package/dist/geo/index.js +11 -0
  417. package/dist/i18n/fr/index.cjs +333 -0
  418. package/dist/i18n/fr/index.cjs.map +1 -0
  419. package/dist/i18n/fr/index.d.cts +18 -0
  420. package/dist/i18n/fr/index.d.ts +18 -0
  421. package/dist/i18n/fr/index.js +328 -0
  422. package/dist/i18n/fr/index.js.map +1 -0
  423. package/dist/i18n/index.cjs +451 -0
  424. package/dist/i18n/index.cjs.map +1 -0
  425. package/dist/i18n/index.d.cts +268 -0
  426. package/dist/i18n/index.d.ts +268 -0
  427. package/dist/i18n/index.js +430 -0
  428. package/dist/i18n/index.js.map +1 -0
  429. package/dist/icons/index.cjs +37 -0
  430. package/dist/icons/index.d.cts +4 -0
  431. package/dist/icons/index.d.ts +4 -0
  432. package/dist/icons/index.js +8 -0
  433. package/dist/index.cjs +517 -0
  434. package/dist/index.cjs.map +1 -0
  435. package/dist/index.d.cts +174 -0
  436. package/dist/index.d.ts +174 -0
  437. package/dist/index.js +54 -0
  438. package/dist/index.js.map +1 -0
  439. package/dist/layers/index.cjs +83 -0
  440. package/dist/layers/index.d.cts +3 -0
  441. package/dist/layers/index.d.ts +3 -0
  442. package/dist/layers/index.js +5 -0
  443. package/dist/map-client/index.cjs +5 -0
  444. package/dist/map-client/index.d.cts +6 -0
  445. package/dist/map-client/index.d.ts +6 -0
  446. package/dist/map-client/index.js +0 -0
  447. package/dist/maplibre-worker.mjs +12 -0
  448. package/dist/navigation/index.cjs +612 -0
  449. package/dist/navigation/index.cjs.map +1 -0
  450. package/dist/navigation/index.d.cts +551 -0
  451. package/dist/navigation/index.d.ts +551 -0
  452. package/dist/navigation/index.js +599 -0
  453. package/dist/navigation/index.js.map +1 -0
  454. package/dist/profile/index.cjs +177 -0
  455. package/dist/profile/index.d.cts +8 -0
  456. package/dist/profile/index.d.ts +8 -0
  457. package/dist/profile/index.js +10 -0
  458. package/dist/seams/index.cjs +15 -0
  459. package/dist/seams/index.d.cts +4 -0
  460. package/dist/seams/index.d.ts +4 -0
  461. package/dist/seams/index.js +4 -0
  462. package/dist/search/index.cjs +39 -0
  463. package/dist/search/index.d.cts +6 -0
  464. package/dist/search/index.d.ts +6 -0
  465. package/dist/search/index.js +3 -0
  466. package/dist/style/index.cjs +34 -0
  467. package/dist/style/index.d.cts +5 -0
  468. package/dist/style/index.d.ts +5 -0
  469. package/dist/style/index.js +5 -0
  470. package/dist/styles.css +11 -0
  471. package/dist/testing/index.cjs +444 -0
  472. package/dist/testing/index.cjs.map +1 -0
  473. package/dist/testing/index.d.cts +217 -0
  474. package/dist/testing/index.d.ts +217 -0
  475. package/dist/testing/index.js +435 -0
  476. package/dist/testing/index.js.map +1 -0
  477. package/dist/timezone/index.cjs +1953 -0
  478. package/dist/timezone/index.cjs.map +1 -0
  479. package/dist/timezone/index.d.cts +28 -0
  480. package/dist/timezone/index.d.ts +28 -0
  481. package/dist/timezone/index.js +1948 -0
  482. package/dist/timezone/index.js.map +1 -0
  483. package/dist/units/index.cjs +29 -0
  484. package/dist/units/index.d.cts +3 -0
  485. package/dist/units/index.d.ts +3 -0
  486. package/dist/units/index.js +3 -0
  487. package/dist/video/index.cjs +1713 -0
  488. package/dist/video/index.cjs.map +1 -0
  489. package/dist/video/index.d.cts +846 -0
  490. package/dist/video/index.d.ts +846 -0
  491. package/dist/video/index.js +1689 -0
  492. package/dist/video/index.js.map +1 -0
  493. package/dist/view/index.cjs +7 -0
  494. package/dist/view/index.d.cts +3 -0
  495. package/dist/view/index.d.ts +3 -0
  496. package/dist/view/index.js +1 -0
  497. package/package.json +433 -4
  498. package/src/agent/engines/session.ts +2255 -0
  499. package/src/agent/index.ts +109 -0
  500. package/src/agent/rules/agentError.ts +128 -0
  501. package/src/agent/rules/boundedInputJson.ts +53 -0
  502. package/src/agent/rules/conversation.ts +629 -0
  503. package/src/agent/rules/conversationFaults.ts +349 -0
  504. package/src/agent/rules/conversationHost.ts +390 -0
  505. package/src/agent/rules/dispatcher.ts +102 -0
  506. package/src/agent/rules/errorCodes.ts +78 -0
  507. package/src/agent/rules/errorStatus.ts +65 -0
  508. package/src/agent/rules/scriptedTransport.ts +390 -0
  509. package/src/agent/rules/stickToBottom.ts +38 -0
  510. package/src/agent/rules/toolResultPayload.ts +197 -0
  511. package/src/auth/rules/clientHeader.ts +22 -0
  512. package/src/auth/rules/sentCredential.ts +76 -0
  513. package/src/auth/rules/transformRequest.ts +803 -0
  514. package/src/camera/engines/videoFlight.ts +1758 -0
  515. package/src/camera/index.ts +157 -0
  516. package/src/camera/rules/clearance.ts +1099 -0
  517. package/src/camera/rules/fit.ts +132 -0
  518. package/src/camera/rules/modes.ts +1019 -0
  519. package/src/camera/rules/plan.ts +478 -0
  520. package/src/camera/rules/planner.ts +129 -0
  521. package/src/camera/rules/poseRanges.ts +38 -0
  522. package/src/camera/rules/presets.ts +185 -0
  523. package/src/camera/rules/profileSamples.ts +243 -0
  524. package/src/camera/rules/route.ts +596 -0
  525. package/src/camera/rules/routeContent.ts +105 -0
  526. package/src/camera/rules/spline.ts +765 -0
  527. package/src/camera/rules/sweptViewports.ts +39 -0
  528. package/src/camera/rules/track.ts +1412 -0
  529. package/src/camera/rules/vocabulary.ts +130 -0
  530. package/src/camera/rules/zoom.ts +216 -0
  531. package/src/collab/engines/session.ts +1902 -0
  532. package/src/collab/engines/trailingThrottle.ts +151 -0
  533. package/src/collab/index.ts +52 -0
  534. package/src/collab/rules/dispatch.ts +143 -0
  535. package/src/collab/rules/peerNames.ts +51 -0
  536. package/src/collab/rules/scriptedTransport.ts +244 -0
  537. package/src/compose/engines/baseMapSwitch.ts +1136 -0
  538. package/src/compose/engines/events.ts +962 -0
  539. package/src/compose/engines/mountayaMap.ts +5648 -0
  540. package/src/compose/engines/sentCredentials.ts +146 -0
  541. package/src/compose/engines/slotRequests.ts +413 -0
  542. package/src/compose/rules/accessRefusal.ts +109 -0
  543. package/src/compose/rules/accessStanding.ts +75 -0
  544. package/src/compose/rules/analysisKinds.ts +331 -0
  545. package/src/compose/rules/analysisLayers.ts +176 -0
  546. package/src/compose/rules/cameraMoves.ts +38 -0
  547. package/src/compose/rules/carriedLayers.ts +87 -0
  548. package/src/compose/rules/developmentWarnings.ts +167 -0
  549. package/src/compose/rules/fitBox.ts +67 -0
  550. package/src/compose/rules/fitCamera.ts +54 -0
  551. package/src/compose/rules/geoJsonSlot.ts +61 -0
  552. package/src/compose/rules/geometrySlots.ts +155 -0
  553. package/src/compose/rules/glyphNode.ts +62 -0
  554. package/src/compose/rules/layerKeys.ts +92 -0
  555. package/src/compose/rules/layerOrder.ts +85 -0
  556. package/src/compose/rules/layersManifest.ts +26 -0
  557. package/src/compose/rules/mapOptions.ts +300 -0
  558. package/src/compose/rules/maplibreWorkerVersion.gen.ts +8 -0
  559. package/src/compose/rules/markerPin.ts +122 -0
  560. package/src/compose/rules/markerRegistry.ts +85 -0
  561. package/src/compose/rules/markerSprite.ts +382 -0
  562. package/src/compose/rules/maxBounds.ts +120 -0
  563. package/src/compose/rules/overlayLookup.ts +49 -0
  564. package/src/compose/rules/paintDiff.ts +38 -0
  565. package/src/compose/rules/panLock.ts +77 -0
  566. package/src/compose/rules/patch.ts +124 -0
  567. package/src/compose/rules/queriedFeature.ts +55 -0
  568. package/src/compose/rules/queryLayers.ts +46 -0
  569. package/src/compose/rules/searchHighlight.ts +313 -0
  570. package/src/compose/rules/slotNames.ts +19 -0
  571. package/src/compose/rules/stripeImage.ts +253 -0
  572. package/src/compose/rules/swapMarker.ts +66 -0
  573. package/src/compose/rules/terrainVariant.ts +88 -0
  574. package/src/compose/rules/types.ts +559 -0
  575. package/src/compose/rules/urlHash.ts +19 -0
  576. package/src/compose/rules/viewOptions.ts +451 -0
  577. package/src/compose/rules/workerUrl.ts +131 -0
  578. package/src/data/engines/itineraryResource.ts +643 -0
  579. package/src/data/index.ts +78 -0
  580. package/src/data/rules/adapt.ts +473 -0
  581. package/src/data/rules/editModes.ts +51 -0
  582. package/src/data/rules/itinerary.ts +168 -0
  583. package/src/data/rules/nullable.ts +63 -0
  584. package/src/data/rules/roadAccess.ts +169 -0
  585. package/src/data/rules/segmentGroups.ts +309 -0
  586. package/src/data/rules/selectors.ts +95 -0
  587. package/src/data/rules/zones.ts +79 -0
  588. package/src/draw/engines/boundaryEngine.ts +1003 -0
  589. package/src/draw/engines/framedAdapter.ts +198 -0
  590. package/src/draw/engines/pointerCursor.ts +205 -0
  591. package/src/draw/engines/segmentEngine.ts +1405 -0
  592. package/src/draw/engines/snapIndex.ts +254 -0
  593. package/src/draw/engines/waypointEngine.ts +574 -0
  594. package/src/draw/engines/zoneEngine.ts +1137 -0
  595. package/src/draw/rules/drawFrame.ts +123 -0
  596. package/src/draw/rules/insertVertex.ts +226 -0
  597. package/src/draw/rules/screenSpace.ts +62 -0
  598. package/src/draw/rules/seeds.ts +185 -0
  599. package/src/draw/rules/snap.ts +115 -0
  600. package/src/draw/rules/snapCameraKey.ts +50 -0
  601. package/src/draw/rules/terraDrawShared.ts +214 -0
  602. package/src/draw/rules/zoneOutline.ts +213 -0
  603. package/src/editing/engines/cursor.ts +505 -0
  604. package/src/editing/engines/draftMarker.ts +149 -0
  605. package/src/editing/rules/accent.ts +11 -0
  606. package/src/editing/rules/engine.ts +288 -0
  607. package/src/editing/rules/placement.ts +22 -0
  608. package/src/editing/rules/positions.ts +89 -0
  609. package/src/editing/rules/sources.ts +9 -0
  610. package/src/editing/rules/types.ts +457 -0
  611. package/src/editing/rules/vocabulary.ts +10 -0
  612. package/src/editing/rules/waypointCursor.ts +228 -0
  613. package/src/editor/engines/directionArrows.ts +459 -0
  614. package/src/editor/engines/directions.ts +1383 -0
  615. package/src/editor/engines/editorClient.ts +134 -0
  616. package/src/editor/engines/eventScope.ts +59 -0
  617. package/src/editor/engines/frameLoop.ts +159 -0
  618. package/src/editor/engines/itineraryPreview.ts +272 -0
  619. package/src/editor/engines/mapLockGuard.ts +66 -0
  620. package/src/editor/engines/overlayRenderer.ts +2696 -0
  621. package/src/editor/engines/peerDraft.ts +760 -0
  622. package/src/editor/engines/poiPick.ts +305 -0
  623. package/src/editor/engines/pointPick.ts +84 -0
  624. package/src/editor/engines/roadAccessLine.ts +140 -0
  625. package/src/editor/engines/searchHighlight.ts +183 -0
  626. package/src/editor/engines/viewClient.ts +4091 -0
  627. package/src/editor/engines/zoneBadges.ts +503 -0
  628. package/src/editor/index.ts +97 -0
  629. package/src/editor/rules/accentColor.ts +116 -0
  630. package/src/editor/rules/camera.ts +121 -0
  631. package/src/editor/rules/contract.ts +120 -0
  632. package/src/editor/rules/icons.ts +825 -0
  633. package/src/editor/rules/markerElements.ts +244 -0
  634. package/src/editor/rules/style.ts +51 -0
  635. package/src/editor/rules/terrain.ts +98 -0
  636. package/src/editor/rules/tileWarm.ts +191 -0
  637. package/src/editor/rules/tilesReload.ts +158 -0
  638. package/src/editor/rules/zoneBadgePlacement.ts +1832 -0
  639. package/src/editor/rules/zoneTimeStyling.ts +119 -0
  640. package/src/errors/index.ts +25 -0
  641. package/src/errors/rules/errors.ts +158 -0
  642. package/src/errors/rules/print.ts +129 -0
  643. package/src/geo/index.ts +89 -0
  644. package/src/geo/rules/boundaries.ts +105 -0
  645. package/src/geo/rules/camera.ts +496 -0
  646. package/src/geo/rules/corridor.ts +242 -0
  647. package/src/geo/rules/elevationTiles.ts +269 -0
  648. package/src/geo/rules/formatLngLat.ts +63 -0
  649. package/src/geo/rules/geodesy.ts +125 -0
  650. package/src/geo/rules/geometry.ts +362 -0
  651. package/src/geo/rules/lineWalk.ts +77 -0
  652. package/src/geo/rules/longitude.ts +99 -0
  653. package/src/geo/rules/searchLimits.ts +22 -0
  654. package/src/geo/rules/segmentGeometry.ts +80 -0
  655. package/src/geo/rules/terrain.ts +107 -0
  656. package/src/geo/rules/tuples.ts +124 -0
  657. package/src/geo/rules/types.ts +54 -0
  658. package/src/geo/rules/webMercator.ts +57 -0
  659. package/src/i18n/fr/index.ts +17 -0
  660. package/src/i18n/fr/rules/fr.ts +85 -0
  661. package/src/i18n/fr/rules/words.gen.ts +277 -0
  662. package/src/i18n/index.ts +82 -0
  663. package/src/i18n/rules/bundle.ts +378 -0
  664. package/src/i18n/rules/config.ts +71 -0
  665. package/src/i18n/rules/dates.ts +165 -0
  666. package/src/i18n/rules/endonyms.gen.ts +19 -0
  667. package/src/i18n/rules/language.ts +92 -0
  668. package/src/i18n/rules/localizedName.ts +33 -0
  669. package/src/i18n/rules/merge.ts +106 -0
  670. package/src/i18n/rules/scope.ts +127 -0
  671. package/src/i18n/rules/strings.ts +632 -0
  672. package/src/i18n/rules/videoOverlay.ts +121 -0
  673. package/src/i18n/rules/wordForms.ts +95 -0
  674. package/src/i18n/rules/words.gen.ts +277 -0
  675. package/src/icons/index.ts +54 -0
  676. package/src/icons/rules/activities.ts +40 -0
  677. package/src/icons/rules/amenities.ts +250 -0
  678. package/src/icons/rules/artwork.gen.ts +83 -0
  679. package/src/icons/rules/artwork.ts +47 -0
  680. package/src/icons/rules/fallback.ts +21 -0
  681. package/src/icons/rules/lucideMarkers.gen.ts +112 -0
  682. package/src/icons/rules/lucideUi.gen.ts +197 -0
  683. package/src/icons/rules/paint.ts +107 -0
  684. package/src/icons/rules/parse.ts +475 -0
  685. package/src/icons/rules/provider.ts +373 -0
  686. package/src/icons/rules/sprites.ts +54 -0
  687. package/src/icons/rules/ui.ts +348 -0
  688. package/src/icons/rules/waypoints.ts +215 -0
  689. package/src/index.ts +993 -0
  690. package/src/layers/engines/layersSelection.ts +515 -0
  691. package/src/layers/engines/readoutEngine.ts +131 -0
  692. package/src/layers/index.ts +151 -0
  693. package/src/layers/rules/analysis.ts +135 -0
  694. package/src/layers/rules/enrichment.ts +30 -0
  695. package/src/layers/rules/geoJson.ts +270 -0
  696. package/src/layers/rules/hover.ts +67 -0
  697. package/src/layers/rules/itineraries.ts +182 -0
  698. package/src/layers/rules/layersPanel.ts +237 -0
  699. package/src/layers/rules/order.ts +194 -0
  700. package/src/layers/rules/overlayInstant.ts +49 -0
  701. package/src/layers/rules/overlays.ts +52 -0
  702. package/src/layers/rules/poiPanel.ts +119 -0
  703. package/src/layers/rules/pois.ts +114 -0
  704. package/src/layers/rules/readout.ts +340 -0
  705. package/src/layers/rules/streetView.ts +16 -0
  706. package/src/layers/rules/tileTimestamp.ts +146 -0
  707. package/src/layers/rules/timeSlider.ts +192 -0
  708. package/src/layers/rules/timeWindow.ts +123 -0
  709. package/src/layers/rules/zones.ts +43 -0
  710. package/src/layers/rules/zoom.ts +77 -0
  711. package/src/map-client/index.ts +71 -0
  712. package/src/map-client/rules/mapClient.ts +1945 -0
  713. package/src/navigation/engines/navigation.ts +493 -0
  714. package/src/navigation/index.ts +51 -0
  715. package/src/navigation/rules/followedRoute.ts +78 -0
  716. package/src/navigation/rules/instructions.ts +89 -0
  717. package/src/navigation/rules/itineraryRoute.ts +232 -0
  718. package/src/navigation/rules/offRoute.ts +41 -0
  719. package/src/navigation/rules/progress.ts +230 -0
  720. package/src/navigation/rules/prompts.ts +217 -0
  721. package/src/navigation/rules/routeRequest.ts +98 -0
  722. package/src/navigation/rules/status.ts +142 -0
  723. package/src/navigation/rules/steps.ts +234 -0
  724. package/src/navigation/rules/types.ts +83 -0
  725. package/src/profile/index.ts +307 -0
  726. package/src/profile/rules/amenityBadge.ts +35 -0
  727. package/src/profile/rules/amenityFilter.ts +74 -0
  728. package/src/profile/rules/amenityStacks.ts +66 -0
  729. package/src/profile/rules/axis.ts +89 -0
  730. package/src/profile/rules/axisCulling.ts +83 -0
  731. package/src/profile/rules/axisLookup.ts +180 -0
  732. package/src/profile/rules/climbs.ts +292 -0
  733. package/src/profile/rules/cursorMarker.ts +122 -0
  734. package/src/profile/rules/cursorReadout.ts +104 -0
  735. package/src/profile/rules/curvePlacement.ts +216 -0
  736. package/src/profile/rules/dock.ts +293 -0
  737. package/src/profile/rules/elevation.ts +1263 -0
  738. package/src/profile/rules/instant.ts +89 -0
  739. package/src/profile/rules/intl.ts +237 -0
  740. package/src/profile/rules/legEmphasis.ts +53 -0
  741. package/src/profile/rules/profileColors.ts +66 -0
  742. package/src/profile/rules/profileLayout.ts +59 -0
  743. package/src/profile/rules/profileSlices.ts +55 -0
  744. package/src/profile/rules/routeProfile.ts +475 -0
  745. package/src/profile/rules/rowMatch.ts +50 -0
  746. package/src/profile/rules/scale.ts +646 -0
  747. package/src/profile/rules/scaleFrame.ts +171 -0
  748. package/src/profile/rules/sectionChips.ts +83 -0
  749. package/src/profile/rules/sections.ts +923 -0
  750. package/src/profile/rules/slopeRamp.ts +160 -0
  751. package/src/profile/rules/statStrip.ts +103 -0
  752. package/src/profile/rules/steepness.ts +51 -0
  753. package/src/profile/rules/tableCells.ts +269 -0
  754. package/src/profile/rules/tableCursor.ts +87 -0
  755. package/src/profile/rules/unitPatterns.ts +335 -0
  756. package/src/profile/rules/units.ts +1025 -0
  757. package/src/profile/rules/waypointCard.ts +590 -0
  758. package/src/profile/rules/webAddress.ts +130 -0
  759. package/src/profile/rules/windowSpans.ts +65 -0
  760. package/src/rules/asciiFold.ts +17 -0
  761. package/src/rules/inDevelopment.ts +54 -0
  762. package/src/rules/listeners.ts +62 -0
  763. package/src/rules/timers.ts +9 -0
  764. package/src/rules/types.ts +22 -0
  765. package/src/rules/uuid.ts +87 -0
  766. package/src/seams/engines/geolocateControl.ts +286 -0
  767. package/src/seams/index.ts +50 -0
  768. package/src/seams/rules/clock.ts +169 -0
  769. package/src/seams/rules/geolocation.ts +165 -0
  770. package/src/seams/rules/segmentRoute.ts +187 -0
  771. package/src/search/engines/search.ts +1093 -0
  772. package/src/search/index.ts +99 -0
  773. package/src/search/rules/describe.ts +383 -0
  774. package/src/search/rules/filters.ts +195 -0
  775. package/src/search/rules/highlight.ts +270 -0
  776. package/src/search/rules/pick.ts +90 -0
  777. package/src/search/rules/rows.ts +258 -0
  778. package/src/search/rules/searchFocus.ts +27 -0
  779. package/src/search/rules/searchViewport.ts +44 -0
  780. package/src/search/rules/shown.ts +77 -0
  781. package/src/search/rules/types.ts +340 -0
  782. package/src/stream/rules/reconnectSchedule.ts +83 -0
  783. package/src/style/engines/organizationRead.ts +80 -0
  784. package/src/style/index.ts +63 -0
  785. package/src/style/rules/apply.ts +268 -0
  786. package/src/style/rules/attribution.ts +119 -0
  787. package/src/style/rules/itineraryLine.ts +142 -0
  788. package/src/style/rules/language.ts +668 -0
  789. package/src/style/rules/layout.gen.ts +27 -0
  790. package/src/style/rules/organization.ts +96 -0
  791. package/src/style/rules/paint.ts +143 -0
  792. package/src/style/rules/panelLayout.ts +51 -0
  793. package/src/style/rules/roadAccessColors.ts +29 -0
  794. package/src/style/rules/roadAccessLine.ts +267 -0
  795. package/src/style/rules/segmentColors.ts +207 -0
  796. package/src/testing/catalogs.ts +103 -0
  797. package/src/testing/index.ts +30 -0
  798. package/src/testing/mapClient.ts +241 -0
  799. package/src/testing/mountayaMap.ts +741 -0
  800. package/src/timezone/index.ts +14 -0
  801. package/src/timezone/rules/viewport.ts +875 -0
  802. package/src/units/index.ts +55 -0
  803. package/src/units/rules/conversions.ts +620 -0
  804. package/src/units/rules/preferenceChoices.ts +124 -0
  805. package/src/units/rules/preferences.ts +77 -0
  806. package/src/units/rules/rounding.ts +69 -0
  807. package/src/video/engines/videoRun.ts +654 -0
  808. package/src/video/engines/viewClient.ts +6 -0
  809. package/src/video/index.ts +83 -0
  810. package/src/video/profileOverlay/rules/contract.ts +210 -0
  811. package/src/video/profileOverlay/rules/curve.ts +216 -0
  812. package/src/video/profileOverlay/rules/draw.ts +410 -0
  813. package/src/video/profileOverlay/rules/fonts.ts +54 -0
  814. package/src/video/profileOverlay/rules/graphDesign.ts +690 -0
  815. package/src/video/profileOverlay/rules/minimalDesign.ts +144 -0
  816. package/src/video/profileOverlay/rules/registry.ts +23 -0
  817. package/src/video/profileOverlay/rules/staticLayer.ts +582 -0
  818. package/src/video/profileOverlay/rules/stripDesign.ts +327 -0
  819. package/src/video/profileOverlay/rules/types.ts +78 -0
  820. package/src/video/rules/videoConstants.ts +250 -0
  821. package/src/video/rules/videoEncoder.ts +277 -0
  822. package/src/video/rules/videoFrames.ts +99 -0
  823. package/src/video/rules/videoPreview.ts +185 -0
  824. package/src/video/rules/videoRecorder.ts +746 -0
  825. package/src/video/rules/videoWatermark.ts +155 -0
  826. package/src/video/rules/watermarkMark.ts +40 -0
  827. package/src/view/engines/viewClient.ts +6 -0
  828. package/src/view/index.ts +20 -0
@@ -0,0 +1,1412 @@
1
+ import { METERS_PER_DEGREE_WEB_MERCATOR } from "../../geo/rules/webMercator.js";
2
+ import {
3
+ DEGREES_PER_TURN,
4
+ DEGREES_TO_RADIANS,
5
+ MILLISECONDS_PER_SECOND,
6
+ } from "../../units/rules/conversions.js";
7
+ import {
8
+ type ClearanceFrame,
9
+ clearanceSampleStride,
10
+ resolveClearanceAdjustments,
11
+ type TerrainSampler,
12
+ } from "./clearance.js";
13
+ import {
14
+ type CameraPlan,
15
+ type CameraShot,
16
+ type RouteGeometry,
17
+ refuseUnplannableRoute,
18
+ type ShotCamera,
19
+ } from "./plan.js";
20
+ import { clampZoom } from "./poseRanges.js";
21
+ import {
22
+ continuousLine,
23
+ cumulativeMeters,
24
+ type LngLat,
25
+ pointAtMeters,
26
+ routeLengthMeters,
27
+ } from "./route.js";
28
+ import {
29
+ buildCameraSpline,
30
+ type CameraSpline,
31
+ evalSpline,
32
+ modeSmoothingSigmas,
33
+ planDurationMs,
34
+ sigmaFramesForMeters,
35
+ smoothPositionSeries,
36
+ smoothSeries,
37
+ smoothstep,
38
+ unwrapBearings,
39
+ } from "./spline.js";
40
+ import type { CameraMode } from "./vocabulary.js";
41
+ import { viewportGroundSpanMeters } from "./zoom.js";
42
+
43
+ /**
44
+ * frameCountFor is the per-frame grid size both resolveCameraTrack and
45
+ * resolveRouteMarkers derive from a plan: `ceil(planDurationMs / 1000 * fps)`,
46
+ * floored at one. The count keys off the plan's full wall-clock (the target
47
+ * duration plus every shot's hold) because the encoder stamps each frame at a
48
+ * fixed 1/fps: only a grid sized to the whole flight makes the exported file
49
+ * last as long as the preview rehearsal and dwell on holds for their real
50
+ * duration. Held as one helper so the pose array and the itinerary-marker array are
51
+ * always the same length and align frame-for-frame.
52
+ */
53
+ const frameCountFor = (plan: CameraPlan): number =>
54
+ Math.max(1, Math.ceil((planDurationMs(plan) / MILLISECONDS_PER_SECOND) * plan.output.fps));
55
+
56
+ /**
57
+ * modeLeadScreenFractions is the per-mode athlete lead expressed as a fraction
58
+ * of the viewport's ground span: on a following frame the camera looks this far
59
+ * along the itinerary ahead of the athlete, so the trail the rider is about to take
60
+ * opens in frame (on a hairpin the camera looks toward the upcoming switchback)
61
+ * and the athlete rides the lower third rather than dead centre. `chase` leads
62
+ * the most (the athlete pinned low, the most road ahead: the follow-cam
63
+ * grammar), `cinematic` close behind, `drone` the least of the followers (a wide
64
+ * aerial already shows the trail), `helicopter` none at all (its value-bearing
65
+ * lateral track wants the athlete dead-centre; the lead is follow-gated anyway),
66
+ * `overview` light, `smart`/`director` between. The lead ramps in from the itinerary
67
+ * start and collapses at the finish so the endpoints stay pinned. Held as a
68
+ * constant table so a mode's framing is one literal to tune.
69
+ */
70
+ const modeLeadScreenFractions: Record<CameraMode, number> = {
71
+ chase: 0.26,
72
+ cinematic: 0.24,
73
+ director: 0.16,
74
+ drone: 0.08,
75
+ helicopter: 0,
76
+ overview: 0.12,
77
+ smart: 0.16,
78
+ };
79
+
80
+ /**
81
+ * LEAD_MAX_METERS caps the along-itinerary athlete lead regardless of zoom. A very
82
+ * wide frame (low zoom) would otherwise lead hundreds of meters ahead and lose the
83
+ * athlete off the back of the frame; ~400 m keeps the lead readable as "looking up
84
+ * the trail" rather than abandoning the rider.
85
+ */
86
+ const LEAD_MAX_METERS = 400;
87
+
88
+ /**
89
+ * MAX_MARKER_OFFCENTER_FRACTION is the largest fraction of the viewport's ground
90
+ * span the athlete may sit off the look-at centre before the divergence budget
91
+ * pulls the centre back. ~0.32 keeps the rider comfortably inside the frame (the
92
+ * lead already rides them low) and bounds a high-zoom director shot, whose tight
93
+ * framing would otherwise let the centre and the marker drift far apart on a turn.
94
+ */
95
+ const MAX_MARKER_OFFCENTER_FRACTION = 0.32;
96
+
97
+ /**
98
+ * modeBearingMinSmoothSeconds is a per-mode time-domain floor (in seconds) on
99
+ * the heading smoothing window, applied alongside the distance-domain σ. The
100
+ * distance σ keeps the smoothing duration-invariant, but on a switchback the
101
+ * heading can swing 180° within a very short stretch of trail, which the
102
+ * distance σ alone would barely smooth; a seconds floor guarantees the heading
103
+ * still takes at least this long to swing no matter how compressed the turn is in
104
+ * itinerary-distance. `drone` floors the longest (the floatiest heading), then
105
+ * `helicopter` (a heavy broadcast gimbal on switchbacks) and `overview`;
106
+ * `chase` floors the shortest (the hard action-cam bank), just under
107
+ * `cinematic`/`director`; `smart` between.
108
+ */
109
+ const modeBearingMinSmoothSeconds: Record<CameraMode, number> = {
110
+ chase: 0.3,
111
+ cinematic: 0.35,
112
+ director: 0.35,
113
+ drone: 0.9,
114
+ helicopter: 0.8,
115
+ overview: 0.6,
116
+ smart: 0.45,
117
+ };
118
+
119
+ /**
120
+ * modeHoldRevealZoom is how many zoom levels wider than the establishing
121
+ * keyframe a mode's intro hold opens on before pushing in to land exactly on the
122
+ * keyframe at the hold's end. It is the deliberate opening push-in: `overview`
123
+ * opens the widest (the grand map reveal), `drone` a grand aerial, `helicopter`
124
+ * a broadcast pass, `cinematic` wide, `chase` moderate, `smart`/`director` a
125
+ * gentle settle. Applied as a negative (wider) zoom offset only, so the clearance
126
+ * pass that runs after it (and only lowers zoom) never fights it.
127
+ */
128
+ const modeHoldRevealZoom: Record<CameraMode, number> = {
129
+ chase: 0.5,
130
+ cinematic: 0.66,
131
+ director: 0.4,
132
+ drone: 0.9,
133
+ helicopter: 0.8,
134
+ overview: 1.1,
135
+ smart: 0.42,
136
+ };
137
+
138
+ /**
139
+ * modeHoldSettleZoom is how many zoom levels wider than the travel framing a
140
+ * mode's outro hold settles out to by the final frame: the flight eases off the
141
+ * athlete into a closing wide shot. `overview` settles the widest (back out to
142
+ * the map), `drone` and `helicopter` wide, `cinematic` moderate, `chase` and
143
+ * `smart`/`director` a touch. A negative (wider) zoom offset only, same as the
144
+ * intro reveal.
145
+ */
146
+ const modeHoldSettleZoom: Record<CameraMode, number> = {
147
+ chase: 0.35,
148
+ cinematic: 0.42,
149
+ director: 0.3,
150
+ drone: 0.6,
151
+ helicopter: 0.55,
152
+ overview: 0.9,
153
+ smart: 0.3,
154
+ };
155
+
156
+ /**
157
+ * MID_HOLD_REVEAL_ZOOM is the gentle widen a user-placed mid-itinerary hold breathes
158
+ * out and back to over its dwell (a `-sin²(πu)` arc, zero at both edges so it
159
+ * joins the travel framing seamlessly on either side). Far subtler than the
160
+ * intro/outro beats: a mid-flight pause should feel like the camera lingering,
161
+ * not a dramatic re-frame.
162
+ */
163
+ const MID_HOLD_REVEAL_ZOOM = 0.2;
164
+
165
+ /**
166
+ * BUDGET_KNEE_FRACTION is where the divergence soft-knee begins, as a fraction of
167
+ * the budget: below it the centre→marker offset passes through untouched, above it
168
+ * the knee compresses. BUDGET_KNEE_SPAN sets both the tanh width and the residual
169
+ * headroom to the 1.0·budget asymptote, so the offset eases from 0.8·budget toward
170
+ * the budget rather than clipping at a hard edge.
171
+ */
172
+ const BUDGET_KNEE_FRACTION = 0.8;
173
+ const BUDGET_KNEE_SPAN = 0.2;
174
+
175
+ /**
176
+ * EDGE_EASE_SUBNODES is how many intermediate timeline nodes the first and last
177
+ * travel legs are subdivided into so their progress can accelerate out of the
178
+ * start and decelerate into the finish. A linear leg would leave the intro hold
179
+ * (and arrive at the outro) at full travel speed, with the camera, the marker, and
180
+ * every overlay number stopping dead on the final frame: the single most
181
+ * "screen recording, not film" tell. Eight sub-nodes make the trapezoidal
182
+ * profile visually exact under progressAtTime's linear interpolation; the leg's
183
+ * total wall-clock is untouched, so holds land at the same time and
184
+ * planDurationMs is invariant.
185
+ */
186
+ const EDGE_EASE_SUBNODES = 8;
187
+
188
+ /**
189
+ * EDGE_EASE_WINDOW_FRACTION is the share of an edge travel leg spent
190
+ * accelerating from standstill (first leg) or decelerating into it (last leg):
191
+ * a trapezoidal velocity profile, the shape of a professional camera move. The
192
+ * cruise velocity compensates the ramp so the leg still covers its span in its
193
+ * unchanged wall-clock window (`1 / (1 − a/2)` ≈ 1.18×), deliberately gentle: a
194
+ * full-leg quadratic would peak the per-frame sampling stride at 2× and push a
195
+ * hairpin's smoothed heading shoulder past the per-mode whip budget, whereas the
196
+ * trapezoid's bounded cruise keeps every downstream per-frame delta within the
197
+ * budgets the stability suite pins.
198
+ */
199
+ const EDGE_EASE_WINDOW_FRACTION = 0.3;
200
+
201
+ /**
202
+ * REPRESENTATIVE_TRAVEL_FRACTION is how far into the travelling portion of a flight
203
+ * (past the intro establishing beat) a parked preview sits, as a fraction of the
204
+ * flight remaining after that beat. A fifth of the way in is comfortably clear of the
205
+ * intro hold and the edge-ease ramp, so the parked frame shows the mode's settled
206
+ * travelling framing, the whole point of parking past the reveal rather than on
207
+ * frame 0.
208
+ */
209
+ const REPRESENTATIVE_TRAVEL_FRACTION = 0.2;
210
+
211
+ /**
212
+ * resolveFrameProgressions is the per-frame itinerary-progress fraction sequence both
213
+ * resolveCameraTrack and resolveRouteMarkers walk: for each of the
214
+ * `frameCountFor(plan)` frames it maps the frame's wall-clock time
215
+ * (`(frame / lastFrame) * planDurationMs`, honouring every shot's hold and speedScale
216
+ * through buildTimeline and progressAtTime) to the itinerary fraction at that instant.
217
+ * Held as one helper so every per-frame array a plan resolves (the pose track, the
218
+ * moving marker, the profile samples) is the same length and aligns
219
+ * frame-for-frame: `fractions[i]` is the progress the camera, the marker, and the
220
+ * overlay all read at frame i. An empty-shots plan resolves through the same
221
+ * full-itinerary follow shots, so the sequence sweeps 0→1 even on a freshly-seeded
222
+ * director plan.
223
+ */
224
+ export const resolveFrameProgressions = (plan: CameraPlan): number[] => {
225
+ const shots = plan.shots.length > 0 ? plan.shots : fullRouteFollowShots(plan);
226
+ const timeline = buildTimeline(shots, plan.targetDurationMs);
227
+ const totalMs = planDurationMs(plan);
228
+
229
+ const frameCount = frameCountFor(plan);
230
+ const lastFrame = frameCount - 1;
231
+
232
+ const fractions = new Array<number>(frameCount);
233
+ for (let frame = 0; frame < frameCount; frame += 1) {
234
+ const timeMs = lastFrame === 0 ? 0 : (frame / lastFrame) * totalMs;
235
+ fractions[frame] = progressAtTime(timeline, timeMs);
236
+ }
237
+
238
+ return fractions;
239
+ };
240
+
241
+ /**
242
+ * resolveCameraTrack turns a camera plan and its itinerary into the render-free
243
+ * per-frame pose array the map flies and records. The frame count is
244
+ * `ceil(planDurationMs / 1000 * fps)` (the holds extend the count along with the
245
+ * wall-clock), so an encoder stamping one frame per 1/fps reproduces the plan's
246
+ * full duration: the exported file lasts exactly as long as the preview
247
+ * rehearsal, holds dwelt at their real length. Each frame's wall-clock time
248
+ * is mapped to an itinerary-progress fraction by a timeline that honours every shot's
249
+ * `holdMs` (progress freezes at the shot while the camera dwells) and `speedScale`
250
+ * (a leg's share of the travelling time scales inversely, so a >1 scale spends
251
+ * that leg faster); the pose at that progress comes from the smoothed spline. An
252
+ * empty-shots plan (a freshly-seeded `director` plan) resolves to a single
253
+ * full-itinerary follow flight so a preview is never blank.
254
+ *
255
+ * Smoothing is distance-domain: each mode's σ is an itinerary DISTANCE (meters),
256
+ * converted to frame samples per itinerary via sigmaFramesForMeters, so the window
257
+ * covers the same fraction of the trail no matter the duration: a 10 s and a 60 s
258
+ * flight over the same itinerary smooth the same itinerary distance and are equally
259
+ * accurate, rather than a fixed-seconds window over-smoothing the short one.
260
+ *
261
+ * When a `sampler` is supplied (the tool layer injects the map's DEM readout), a
262
+ * clearance pass runs over the smoothed framing channels: it derives the camera eye
263
+ * per frame and, where the eye would sink into the terrain or the sightline to the
264
+ * trail would clip a ridge, repositions the camera to clear it, tilting toward
265
+ * top-down (lowering pitch, which slides the eye over the target) to clear an
266
+ * occluder, and widening the view (lowering zoom) where a tilt alone cannot. It
267
+ * returns a per-frame zoom AND pitch adjustment, each only ever lowering its
268
+ * channel; the final framing is the min of the mode-smoothed value and the
269
+ * clearance value on both channels. Both clearance channels are smoothed with the
270
+ * same anticipation window, so the reframing leads the peak and never jolts the
271
+ * motion. Without a sampler (a render-free test, no map, the embed) the output is
272
+ * identical to the un-cleared track on every channel.
273
+ *
274
+ * `clearanceStride` decimates the clearance pass's per-frame frustum solve (see
275
+ * ClearanceOptions.sampleStride): a preview passes a coarse stride so a long flight
276
+ * resolves without stalling, while a record passes 1 (or omits it) to solve every
277
+ * frame so the exported artifact is byte-unchanged. Omitted, the clearance runs at
278
+ * full density.
279
+ *
280
+ * A route that crosses the antimeridian is flown along it. The route is read with its
281
+ * longitudes continuous ({@link continuousLine}), so each centre runs on from the one before
282
+ * it and is answered past 180, or below -180, on the far side of the line: a renderer reads a
283
+ * longitude a turn away as the same place, and a consumer that needs the wire's range wraps it.
284
+ *
285
+ * **The sampler-free call is memoized**, and only that one. Without a sampler the result is a
286
+ * pure function of the plan and the itinerary (the clearance pass is the only thing either
287
+ * remaining parameter reaches, and it does not run), so the same pair can answer from a cache.
288
+ * With a sampler it cannot: the DEM the sampler reads is whatever tiles happen to be loaded,
289
+ * which changes under the same arguments and is the whole reason the record path resolves a
290
+ * second time after warming.
291
+ *
292
+ * The memoized call is the one made for TILE WARMING, and it is made twice on the record path
293
+ * for one flight: once to warm and once again before the prewarm. Each resolves a spline, a
294
+ * timeline and a Gaussian over every frame of the flight (thousands of frames for a minute at
295
+ * 60 fps) to produce poses nobody looks at, only flies over to load tiles.
296
+ *
297
+ * **The memoized array is SHARED with the next caller, so it is typed read-only.** Copying it
298
+ * per call would allocate a pose object per frame and give back most of what the memo saves. A
299
+ * caller flies a resolved pose, warms against it, or reads a frame out of it, and
300
+ * `resolveCameraTrack` is where a pose is made, not where one is edited.
301
+ *
302
+ * @throws {MountayaElementsError} When the route holds a vertex whose longitude or latitude is
303
+ * no finite number, naming it as `itinerary.line[index]`: such a vertex would turn every pose
304
+ * of the flight into `NaN`.
305
+ */
306
+ export const resolveCameraTrack = (
307
+ plan: CameraPlan,
308
+ itinerary: RouteGeometry,
309
+ sampler?: TerrainSampler,
310
+ clearanceStride?: number,
311
+ ): readonly ShotCamera[] => {
312
+ if (sampler === undefined) {
313
+ const bySignature = cameraTracks.get(itinerary) ?? new Map<string, readonly ShotCamera[]>();
314
+ const signature = posePlanSignature(plan);
315
+ const memoized = bySignature.get(signature);
316
+ if (memoized !== undefined) {
317
+ return memoized;
318
+ }
319
+
320
+ const resolved = walkCameraTrack(plan, itinerary, undefined, clearanceStride);
321
+
322
+ // Re-inserted rather than only set, so the entry moves to the end of the Map's insertion
323
+ // order and the eviction below drops the least recently RESOLVED plan.
324
+ bySignature.delete(signature);
325
+ bySignature.set(signature, resolved);
326
+ if (bySignature.size > CAMERA_TRACK_CAP) {
327
+ const oldest = bySignature.keys().next().value;
328
+ if (oldest !== undefined) {
329
+ bySignature.delete(oldest);
330
+ }
331
+ }
332
+
333
+ cameraTracks.set(itinerary, bySignature);
334
+
335
+ return resolved;
336
+ }
337
+
338
+ return walkCameraTrack(plan, itinerary, sampler, clearanceStride);
339
+ };
340
+
341
+ /**
342
+ * How many distinct plans one itinerary keeps a resolved sampler-free track for, and one
343
+ * overlay source a set of profile samples for (`resolveProfileSamples` reads it).
344
+ *
345
+ * Small on purpose. The signature ignores every encoder-only field, so a session of authoring
346
+ * settles on a handful of framings and cycles between them, and a track is an array of one
347
+ * pose object per frame, which is the largest thing in this module. The bound is what keeps an
348
+ * afternoon of nudging a shot from holding every intermediate flight it ever resolved.
349
+ */
350
+ export const CAMERA_TRACK_CAP = 8;
351
+
352
+ /**
353
+ * Resolved sampler-free tracks, by the itinerary they fly and then by the plan's pose
354
+ * signature.
355
+ *
356
+ * Weak on the ITINERARY, which is the object a caller holds in a store or a query cache, so a
357
+ * route that goes out of scope takes every track resolved over it along. The signature is the
358
+ * inner key because it is already the package's answer to "which plan fields move a pose":
359
+ * `posePlanSignature` excludes resolution, aspect, bitrate and preset, so changing an export
360
+ * format reuses the flight instead of re-resolving an identical one.
361
+ */
362
+ const cameraTracks = new WeakMap<RouteGeometry, Map<string, readonly ShotCamera[]>>();
363
+
364
+ /** The resolve itself, which {@link resolveCameraTrack} memoizes on its sampler-free path. */
365
+ const walkCameraTrack = (
366
+ plan: CameraPlan,
367
+ itinerary: RouteGeometry,
368
+ sampler: TerrainSampler | undefined,
369
+ clearanceStride: number | undefined,
370
+ ): readonly ShotCamera[] => {
371
+ refuseUnplannableRoute("resolveCameraTrack", itinerary);
372
+
373
+ const shots = plan.shots.length > 0 ? plan.shots : fullRouteFollowShots(plan);
374
+ const spline = buildCameraSpline(shots, itinerary, plan.mode);
375
+ const timeline = buildTimeline(shots, plan.targetDurationMs);
376
+ const totalMs = planDurationMs(plan);
377
+
378
+ const fps = plan.output.fps;
379
+ // Continuous longitudes: the centre channel is low-passed as a plain series, and a route that
380
+ // crosses the antimeridian as written would be averaged across a jump of a whole turn.
381
+ const line = continuousLine(itinerary.line);
382
+ const cumulative = cumulativeMeters(line);
383
+ const routeMeters = cumulative[cumulative.length - 1] ?? 0;
384
+
385
+ const fractions = resolveFrameProgressions(plan);
386
+ const frameCount = fractions.length;
387
+ const lastFrame = frameCount - 1;
388
+ // Each output frame maps to the smoothed u-grid series at the fractional sample
389
+ // `fraction * lastFrame`: a travelling frame lands between two u-samples, a held
390
+ // frame (a shared fraction) lands on the same sample as its neighbours and so
391
+ // reads one constant smoothed value. On a hold-free, speedScale-1 plan the
392
+ // interior legs are the identity (positions[i] === i); the first and last legs
393
+ // land between samples because their progress is edge-eased (accelerating out of
394
+ // the start, decelerating into the finish), which this mapping carries into
395
+ // every per-frame array at once.
396
+ const positions = fractions.map((fraction) => fraction * lastFrame);
397
+
398
+ const raw = sampleRawChannels(spline, line, cumulative, plan.mode, frameCount);
399
+ const smoothed = smoothTrackChannels(raw, plan.mode, routeMeters, fps);
400
+
401
+ // Map the smoothed u-grid series down to the per-frame grid: a travelling frame
402
+ // interpolates between two u-samples, a held frame reads its single constant
403
+ // sample. Bearing is sampled circularly so the interpolation crosses 0/360 the
404
+ // short way.
405
+ const centerLngs = sampleSeriesAt(smoothed.centerLngs, positions);
406
+ const centerLats = sampleSeriesAt(smoothed.centerLats, positions);
407
+ const pitches = sampleSeriesAt(smoothed.pitches, positions);
408
+ const zooms = sampleSeriesAt(smoothed.zooms, positions);
409
+ const bearings = sampleCircularSeriesAt(smoothed.bearings, positions);
410
+
411
+ // Hold shaping (zoom only): on the now-constant hold windows, add a deliberate
412
+ // eased push-in (intro) / settle-out (outro) / breathe (mid) so a dwell reads as
413
+ // a directed beat rather than a frozen frame. Offsets are negative (wider) only,
414
+ // so the clearance pass that follows, which only lowers zoom, never fights them.
415
+ applyHoldZoomShaping(zooms, shots, plan.mode, totalMs, lastFrame);
416
+
417
+ // Budget clamp (centre only): pull the look-at point back toward the athlete with
418
+ // a C1 soft-knee whenever the planar offset exceeds the per-frame budget, so the
419
+ // rider never drifts past MAX_MARKER_OFFCENTER_FRACTION of the frame (bounding a
420
+ // high-zoom director shot and an extreme hairpin). Inputs are already smooth and
421
+ // the knee is C1, so no re-smoothing is needed. The markers ride the same u-grid,
422
+ // so the dot freezes through a hold exactly as the centre does.
423
+ const markers = resolveMarkerSeries(plan, itinerary);
424
+ clampCenterToMarkerBudget(centerLngs, centerLats, markers, zooms);
425
+
426
+ // Run the DEM clearance pass over the shaped and clamped channels when a sampler is
427
+ // wired: it reads the eye geometry from the final framing and returns a per-frame
428
+ // zoom AND pitch that each only lower (the zoom widening the eye, the pitch
429
+ // tilting it toward top-down) where the terrain would be flown into or occlude the
430
+ // trail. The final framing mins the mode value with the clearance value on both
431
+ // channels. Absent a sampler this is skipped and the framing is unchanged.
432
+ const clearance = sampler
433
+ ? resolveClearanceAdjustments(
434
+ buildClearanceFrames(
435
+ frameCount,
436
+ timeline,
437
+ totalMs,
438
+ centerLngs,
439
+ centerLats,
440
+ pitches,
441
+ zooms,
442
+ bearings,
443
+ ),
444
+ itinerary,
445
+ sampler,
446
+ { mode: plan.mode, sampleStride: clearanceStride },
447
+ )
448
+ : null;
449
+
450
+ const poses = new Array<ShotCamera>(frameCount);
451
+ for (let frame = 0; frame < frameCount; frame += 1) {
452
+ const frameZoom = clampZoom(zooms[frame] ?? raw.zooms[frame] ?? 0);
453
+ const framePitch = pitches[frame] ?? raw.pitches[frame] ?? 0;
454
+ const clearanceZoom = clearance?.zoom[frame];
455
+ const clearancePitch = clearance?.pitch[frame];
456
+ poses[frame] = {
457
+ bearing: bearings[frame] ?? raw.bearings[frame] ?? 0,
458
+ center: [
459
+ centerLngs[frame] ?? raw.baseLngs[frame] ?? 0,
460
+ centerLats[frame] ?? raw.baseLats[frame] ?? 0,
461
+ ],
462
+ pitch: clearancePitch === undefined ? framePitch : Math.min(framePitch, clearancePitch),
463
+ zoom: clearanceZoom === undefined ? frameZoom : Math.min(frameZoom, clearanceZoom),
464
+ };
465
+ }
466
+
467
+ return poses;
468
+ };
469
+
470
+ /**
471
+ * RawTrackChannels is what a flight's spline and its route answer on the uniform progress grid,
472
+ * before any smoothing: one series per channel a pose is made of, each one sample per frame.
473
+ */
474
+ interface RawTrackChannels {
475
+ /** The route point under the athlete: its longitudes, continuous across the antimeridian. */
476
+ readonly baseLngs: number[];
477
+ /** The route point under the athlete: its latitudes. */
478
+ readonly baseLats: number[];
479
+ /** The athlete lead as a displacement off the base point, in degrees of longitude. */
480
+ readonly leadLngs: number[];
481
+ /** The athlete lead as a displacement off the base point, in degrees of latitude. */
482
+ readonly leadLats: number[];
483
+ /** The spline's pitch, in degrees. */
484
+ readonly pitches: number[];
485
+ /** The spline's zoom. */
486
+ readonly zooms: number[];
487
+ /** The spline's bearing, in degrees within [0, 360). */
488
+ readonly bearings: number[];
489
+ }
490
+
491
+ /**
492
+ * sampleRawChannels reads a plan's spline and its route on the uniform progress grid, the first
493
+ * stage of {@link walkCameraTrack}.
494
+ *
495
+ * @param spline The plan's keyframe spline.
496
+ * @param line The route's line, its longitudes continuous.
497
+ * @param cumulative The line's {@link cumulativeMeters}.
498
+ * @param mode The plan's mode, which sets how far the centre leads the athlete.
499
+ * @param frameCount The number of grid samples, which is the flight's frame count.
500
+ * @returns One sample per grid position for each channel.
501
+ */
502
+ const sampleRawChannels = (
503
+ spline: CameraSpline,
504
+ line: readonly LngLat[],
505
+ cumulative: readonly number[],
506
+ mode: CameraMode,
507
+ frameCount: number,
508
+ ): RawTrackChannels => {
509
+ const lastFrame = frameCount - 1;
510
+ const routeMeters = cumulative[cumulative.length - 1] ?? 0;
511
+
512
+ // Sample the raw channels on a UNIFORM progress grid `u_k = k / lastFrame` rather
513
+ // than on the (hold-warped) per-frame fractions. The Gaussian below then runs on a
514
+ // grid whose samples are evenly spaced in itinerary progress, which is exactly the
515
+ // assumption sigmaFramesForMeters encodes (frameCount samples across the itinerary),
516
+ // so the smoothing window spans the itinerary distance it claims to, and hold frames
517
+ // cannot bleed travel motion into the dwell. The athlete lead is applied here, at
518
+ // the raw-centre stage, so the mode's centre σ smooths the lead as one motion with
519
+ // the rest of the path.
520
+ const leadFraction = modeLeadScreenFractions[mode];
521
+ const rawBaseLngs = new Array<number>(frameCount);
522
+ const rawBaseLats = new Array<number>(frameCount);
523
+ const rawLeadLngs = new Array<number>(frameCount);
524
+ const rawLeadLats = new Array<number>(frameCount);
525
+ const rawPitches = new Array<number>(frameCount);
526
+ const rawZooms = new Array<number>(frameCount);
527
+ const rawBearings = new Array<number>(frameCount);
528
+ for (let k = 0; k < frameCount; k += 1) {
529
+ const progress = lastFrame === 0 ? 0 : k / lastFrame;
530
+ const pose = evalSpline(spline, progress);
531
+ const lat = pose.center[1];
532
+ const metersFromStart = progress * routeMeters;
533
+ const base = pointAtMeters(line, metersFromStart, cumulative);
534
+ // Lead the camera along the itinerary ahead of the athlete by a fraction of the
535
+ // viewport's ground span, gated by the follow weight (no lead on a locked or
536
+ // value shot), capped in meters, and ramped in from the start so the lead is 0
537
+ // at the itinerary start. pointAtMeters clamps past the itinerary end, so the lead
538
+ // collapses to 0 as the flight reaches the finish. The lead is held as a
539
+ // displacement off the base itinerary point (0 at both ends by construction) so the
540
+ // centre smoothing can endpoint-pin the base path and Gaussian-smooth the lead
541
+ // without the pin eating the lead plateau.
542
+ const leadM = Math.min(
543
+ LEAD_MAX_METERS,
544
+ metersFromStart,
545
+ pose.followWeight * leadFraction * viewportGroundSpanMeters(pose.zoom, lat),
546
+ );
547
+ const led = pointAtMeters(line, metersFromStart + leadM, cumulative);
548
+ rawBaseLngs[k] = base[0];
549
+ rawBaseLats[k] = base[1];
550
+ rawLeadLngs[k] = led[0] - base[0];
551
+ rawLeadLats[k] = led[1] - base[1];
552
+ rawPitches[k] = pose.pitch;
553
+ rawZooms[k] = pose.zoom;
554
+ rawBearings[k] = pose.bearing;
555
+ }
556
+
557
+ return {
558
+ baseLats: rawBaseLats,
559
+ baseLngs: rawBaseLngs,
560
+ bearings: rawBearings,
561
+ leadLats: rawLeadLats,
562
+ leadLngs: rawLeadLngs,
563
+ pitches: rawPitches,
564
+ zooms: rawZooms,
565
+ };
566
+ };
567
+
568
+ /**
569
+ * SmoothedTrackChannels is a flight's framing on the uniform progress grid after the mode's
570
+ * smoothing: the look-at centre with its lead folded in, the pitch, the zoom and the bearing.
571
+ */
572
+ interface SmoothedTrackChannels {
573
+ /** The look-at centre's longitudes, continuous across the antimeridian. */
574
+ readonly centerLngs: number[];
575
+ /** The look-at centre's latitudes. */
576
+ readonly centerLats: number[];
577
+ /** The pitch, in degrees. */
578
+ readonly pitches: number[];
579
+ /** The zoom. */
580
+ readonly zooms: number[];
581
+ /** The bearing, in degrees within [0, 360). */
582
+ readonly bearings: number[];
583
+ }
584
+
585
+ /**
586
+ * smoothTrackChannels low-passes a flight's raw channels with the mode's windows, the second
587
+ * stage of {@link walkCameraTrack}.
588
+ *
589
+ * @param raw The channels {@link sampleRawChannels} answers.
590
+ * @param mode The plan's mode, which sets each channel's window.
591
+ * @param routeMeters The route's length, which turns a window in meters into grid samples.
592
+ * @param fps The plan's frame rate, which the bearing's floor in seconds is counted in.
593
+ * @returns The smoothed channels, sample for sample with the raw ones.
594
+ */
595
+ const smoothTrackChannels = (
596
+ raw: RawTrackChannels,
597
+ mode: CameraMode,
598
+ routeMeters: number,
599
+ fps: number,
600
+ ): SmoothedTrackChannels => {
601
+ const frameCount = raw.pitches.length;
602
+
603
+ // Smooth the framing channels over the uniform progress grid with the mode's σ
604
+ // (in itinerary meters) converted to frame samples for THIS itinerary and frame count, so
605
+ // the window spans a fixed itinerary distance whether the flight is short or long. The
606
+ // heading additionally takes a time-domain floor: on a switchback the bearing can
607
+ // swing 180° within a few meters of trail, which the distance σ alone barely
608
+ // smooths, so the window is floored to at least modeBearingMinSmoothSeconds of
609
+ // frames (and re-capped at a third of the grid). The centre channel, which the
610
+ // duration-invariance test measures, keeps the pure distance σ.
611
+ const sigmas = modeSmoothingSigmas[mode];
612
+ const centerSigmaFrames = sigmaFramesForMeters(sigmas.center, frameCount, routeMeters);
613
+ const pitchZoomSigmaFrames = sigmaFramesForMeters(sigmas.pitchZoom, frameCount, routeMeters);
614
+ const bearingSigmaFrames = bearingSigmaFramesFor(mode, frameCount, routeMeters, fps);
615
+ // The base path is endpoint-pinned (frame 0 = itinerary start, last = finish) and
616
+ // glides over high-frequency wiggle; the lead displacement is Gaussian-smoothed
617
+ // (so its direction eases through turns) then multiplied by an endpoint taper that
618
+ // forces it to exactly 0 at the first and last frames without a subtractive chord
619
+ // that would halve the interior lead. The taper ramps over the centre window, so
620
+ // the look-at point leads the athlete across the interior while the endpoints stay
621
+ // pinned to the itinerary. Both channels use the centre σ, so the lead is smoothed as
622
+ // one motion with the path.
623
+ const leadTaper = endpointTaper(frameCount, Math.ceil(centerSigmaFrames * 3));
624
+ const smoothedCenterLngs = addSeries(
625
+ smoothPositionSeries(raw.baseLngs, centerSigmaFrames),
626
+ multiplySeries(smoothSeries(raw.leadLngs, centerSigmaFrames), leadTaper),
627
+ );
628
+ const smoothedCenterLats = addSeries(
629
+ smoothPositionSeries(raw.baseLats, centerSigmaFrames),
630
+ multiplySeries(smoothSeries(raw.leadLats, centerSigmaFrames), leadTaper),
631
+ );
632
+ const smoothedPitches = smoothSeries(raw.pitches, pitchZoomSigmaFrames);
633
+ const smoothedZooms = smoothSeries(raw.zooms, pitchZoomSigmaFrames);
634
+ // Smooth the heading in the UNWRAPPED angle domain rather than by a circular
635
+ // (cos/sin) mean: across a switchback the raw tangent reverses ~180°, and a
636
+ // circular mean over a window straddling that reversal cancels to an unstable
637
+ // direction that actually whips the smoothed heading. Unwrapping accumulates the
638
+ // shortest signed arc into a continuous series the Gaussian genuinely low-passes,
639
+ // then the result is folded back into 0..360: the same unwrap the keyframe
640
+ // bearing spline uses, so a reversal is damped instead of snapped.
641
+ const smoothedBearings = smoothSeries(unwrapBearings(raw.bearings), bearingSigmaFrames).map(
642
+ (value) => ((value % DEGREES_PER_TURN) + DEGREES_PER_TURN) % DEGREES_PER_TURN,
643
+ );
644
+
645
+ return {
646
+ bearings: smoothedBearings,
647
+ centerLats: smoothedCenterLats,
648
+ centerLngs: smoothedCenterLngs,
649
+ pitches: smoothedPitches,
650
+ zooms: smoothedZooms,
651
+ };
652
+ };
653
+
654
+ /**
655
+ * resolveMarkerSeries returns the per-frame position the moving "you are here"
656
+ * marker sits at: one [lng, lat] per frame, sampled exactly on the itinerary polyline
657
+ * rather than at the smoothed camera centre resolveCameraTrack flies. Each frame's
658
+ * marker is the itinerary point at the frame's hold-warped progress fraction, taken via
659
+ * pointAtMeters(line, fraction * routeMeters, cumulative), which linearly
660
+ * interpolates between the two vertices bracketing that arc-length, so the point
661
+ * lies exactly on the segment between them. The marker is deliberately NOT smoothed:
662
+ * a Gaussian low-pass on the lng/lat channels pulls the dot perpendicular off the
663
+ * polyline on bends and hairpins, and the dot reads as "on the trail" only if it is
664
+ * literally on it. Endpoints are pinned for free (the exact samples at fraction 0
665
+ * and 1 are the itinerary start and finish), and a held frame (a fraction shared with
666
+ * its neighbours) reads the same point, so the dot freezes through the dwell exactly
667
+ * as the centre does. The frame count is the same
668
+ * `ceil(planDurationMs / 1000 * fps)` the track uses (markers share
669
+ * resolveFrameProgressions with the poses and the profile samples), so markers[i]
670
+ * aligns with the pose at frame i for the map to set per frame and for the
671
+ * divergence budget to measure against. An empty-shots plan resolves through the
672
+ * same full-itinerary follow shots, so the marker sweeps the whole itinerary start-to-end
673
+ * even on a freshly-seeded director plan. Shared by resolveCameraTrack (its budget
674
+ * clamp) and the public resolveRouteMarkers.
675
+ */
676
+ const resolveMarkerSeries = (plan: CameraPlan, itinerary: RouteGeometry): LngLat[] => {
677
+ // The line the poses are resolved over, so a marker and the centre beside it are written in
678
+ // one run of longitudes and the budget between them is a plain difference.
679
+ const line = continuousLine(itinerary.line);
680
+ const cumulative = cumulativeMeters(line);
681
+ const routeMeters = cumulative[cumulative.length - 1] ?? 0;
682
+
683
+ const fractions = resolveFrameProgressions(plan);
684
+ const frameCount = fractions.length;
685
+
686
+ // Sample the marker exactly on the polyline at each frame's hold-warped progress
687
+ // fraction. pointAtMeters interpolates linearly between the bracketing vertices,
688
+ // so the result lies on the segment between them; no smoothing is applied, which
689
+ // is what keeps the dot from drifting perpendicular off the itinerary on a bend or
690
+ // hairpin. Fraction 0 and 1 resolve to the itinerary start and finish, so the
691
+ // endpoints stay pinned without an explicit re-pin pass.
692
+ const markers = new Array<LngLat>(frameCount);
693
+ for (let frame = 0; frame < frameCount; frame += 1) {
694
+ markers[frame] = pointAtMeters(line, (fractions[frame] ?? 0) * routeMeters, cumulative);
695
+ }
696
+
697
+ return markers;
698
+ };
699
+
700
+ /**
701
+ * resolveRouteMarkers is the public per-frame moving-marker path, a thin wrapper
702
+ * over resolveMarkerSeries. Every returned point lies exactly on the itinerary polyline
703
+ * (the marker is sampled, not smoothed), so the map's "you are here" dot sits on the
704
+ * trail on every frame including bends and hairpins. It is a function of its own so
705
+ * resolveCameraTrack answers ShotCamera[] alone, and the map reads the dot positions
706
+ * through one stable seam.
707
+ *
708
+ * The markers are written in the same run of longitudes as the poses: continuous along the
709
+ * route, so past 180 or below -180 on the far side of an antimeridian crossing.
710
+ *
711
+ * @throws {MountayaElementsError} When the route holds a vertex whose longitude or latitude is
712
+ * no finite number, naming it as `itinerary.line[index]`, as {@link resolveCameraTrack} does.
713
+ */
714
+ export const resolveRouteMarkers = (plan: CameraPlan, itinerary: RouteGeometry): LngLat[] => {
715
+ refuseUnplannableRoute("resolveRouteMarkers", itinerary);
716
+
717
+ return resolveMarkerSeries(plan, itinerary);
718
+ };
719
+
720
+ /**
721
+ * clearanceStrideFor is the plan-level convenience the preview resolve uses to pick
722
+ * the clearance sample stride, mirroring resolveFrameProgressions in taking a whole
723
+ * (plan, itinerary) and deriving the per-frame quantity from it. It forwards the plan's
724
+ * frame count, the itinerary length, and the mode (which sizes the anticipation
725
+ * window) to clearanceSampleStride, so a preview resolves the clearance at the coarse
726
+ * stride that keeps the solve a sub-100 ms task while a record passes 1 for full
727
+ * density and a byte-unchanged artifact.
728
+ */
729
+ export const clearanceStrideFor = (plan: CameraPlan, itinerary: RouteGeometry): number =>
730
+ clearanceSampleStride(frameCountFor(plan), routeLengthMeters(itinerary.line), {
731
+ mode: plan.mode,
732
+ });
733
+
734
+ /**
735
+ * posePlanSignature is a compact, stable string of ONLY the plan fields that change
736
+ * the resolved poses: the `mode`, the whole-flight `targetDurationMs`, and the output
737
+ * `fps` (all three size or shape the per-frame grid), plus each shot's pose-affecting
738
+ * fields (`at`, `bearingDeg`, `bearingMode`, `holdMs`, `pitchDeg`, `speedScale`,
739
+ * `zoom`). It deliberately EXCLUDES the encoder-only output fields
740
+ * (`resolution`/`aspect`/`bitrateMbps`/`quality`/`format`/`preset`) and the shot `id`,
741
+ * so a format-only edit produces the SAME signature: the memo key the tool layer
742
+ * caches resolved poses under, which is what lets a preset or resolution change reuse
743
+ * the cached flight instead of re-resolving it. Shot order is the plan's own
744
+ * sorted-by-`at` order, so two plans with identical framing hash identically.
745
+ */
746
+ export const posePlanSignature = (plan: CameraPlan): string => {
747
+ const shots = plan.shots
748
+ .map(
749
+ (shot) =>
750
+ `${shot.at},${shot.bearingDeg ?? ""},${shot.bearingMode},${shot.holdMs},${shot.pitchDeg},${shot.speedScale},${shot.zoom}`,
751
+ )
752
+ .join(";");
753
+
754
+ return `${plan.mode}|${plan.targetDurationMs}|${plan.output.fps}|${shots}`;
755
+ };
756
+
757
+ /**
758
+ * representativeStillFraction is the flight-fraction (0..1 over the frame grid) a
759
+ * parked preview should sit at so it shows the mode's TRAVELLING framing immediately
760
+ * rather than the wide establishing reveal of the intro hold. It parks just past the
761
+ * intro establishing beat (the first shot's hold, as its share of the wall-clock)
762
+ * plus a fraction of the flight remaining after it, so the framing is engaged in
763
+ * travel whatever the intro dwell. A director or empty-shots plan has no preset style
764
+ * to show and is still being authored, so it parks at the start (0). previewSeek maps
765
+ * this fraction to the pose at `round(fraction * lastFrame)`, so on a hold-warped grid
766
+ * it still lands past the frozen intro frames.
767
+ */
768
+ export const representativeStillFraction = (plan: CameraPlan): number => {
769
+ // A director plan is parked on its first authored shot, with or without shots, and a plan
770
+ // with no shots has no establishing beat to park past.
771
+ if (plan.mode === "director" || plan.shots.length === 0) {
772
+ return 0;
773
+ }
774
+
775
+ const total = planDurationMs(plan);
776
+ if (total <= 0) {
777
+ return 0;
778
+ }
779
+
780
+ const introHoldMs = [...plan.shots].sort((a, b) => a.at - b.at)[0]?.holdMs ?? 0;
781
+ const introEnd = Math.min(1, introHoldMs / total);
782
+
783
+ return Math.min(1, introEnd + (1 - introEnd) * REPRESENTATIVE_TRAVEL_FRACTION);
784
+ };
785
+
786
+ /**
787
+ * bearingSigmaFramesFor returns the heading-smoothing σ in frame samples: the
788
+ * distance-domain σ for the mode (so the smoothing stays duration-invariant),
789
+ * floored to at least modeBearingMinSmoothSeconds of frames (so a switchback
790
+ * whose heading swings 180° within a few meters of trail is still smoothed in
791
+ * time), and re-capped at a third of the frame grid so the window never swallows
792
+ * the whole flight. Only the heading takes the time floor; the framing and centre
793
+ * channels keep the pure distance σ.
794
+ */
795
+ const bearingSigmaFramesFor = (
796
+ mode: CameraMode,
797
+ frameCount: number,
798
+ routeMeters: number,
799
+ fps: number,
800
+ ): number => {
801
+ const distanceFrames = sigmaFramesForMeters(
802
+ modeSmoothingSigmas[mode].bearing,
803
+ frameCount,
804
+ routeMeters,
805
+ );
806
+ const timeFloorFrames = modeBearingMinSmoothSeconds[mode] * fps;
807
+
808
+ return Math.min(frameCount / 3, Math.max(distanceFrames, timeFloorFrames));
809
+ };
810
+
811
+ /**
812
+ * sampleSeriesAt maps a smoothed series sampled on the uniform progress grid down
813
+ * to the per-frame grid by linear interpolation at fractional sample positions:
814
+ * `positions[i]` is the (possibly fractional) index into `series` frame i reads.
815
+ * An integer position returns that sample exactly (the identity that keeps a
816
+ * hold-free, speedScale-1 plan bit-identical); a fractional one lerps the two
817
+ * bracketing samples; a position is clamped to the series bounds. An empty series
818
+ * returns a same-length array of zeros.
819
+ */
820
+ const sampleSeriesAt = (series: readonly number[], positions: readonly number[]): number[] => {
821
+ const length = series.length;
822
+ return positions.map((position) => {
823
+ if (length === 0) {
824
+ return 0;
825
+ }
826
+
827
+ const clamped = Math.min(length - 1, Math.max(0, position));
828
+ const lo = Math.floor(clamped);
829
+ const hi = Math.min(length - 1, lo + 1);
830
+ const frac = clamped - lo;
831
+ const a = series[lo] ?? 0;
832
+ const b = series[hi] ?? a;
833
+
834
+ return a + (b - a) * frac;
835
+ });
836
+ };
837
+
838
+ /**
839
+ * sampleCircularSeriesAt is sampleSeriesAt for a heading series: it interpolates
840
+ * the two bracketing samples the short way around the circle (adding `frac` of the
841
+ * shortest signed arc) so the per-frame mapping crosses 0/360 without a 360°
842
+ * plunge, and returns each result in 0..360. An empty series returns a same-length
843
+ * array of zeros.
844
+ */
845
+ const sampleCircularSeriesAt = (
846
+ series: readonly number[],
847
+ positions: readonly number[],
848
+ ): number[] => {
849
+ const length = series.length;
850
+ return positions.map((position) => {
851
+ if (length === 0) {
852
+ return 0;
853
+ }
854
+
855
+ const clamped = Math.min(length - 1, Math.max(0, position));
856
+ const lo = Math.floor(clamped);
857
+ const hi = Math.min(length - 1, lo + 1);
858
+ const frac = clamped - lo;
859
+ const a = series[lo] ?? 0;
860
+ const b = series[hi] ?? a;
861
+ const delta = (((b - a) % DEGREES_PER_TURN) + DEGREES_PER_TURN) % DEGREES_PER_TURN;
862
+ const shortest = delta > DEGREES_PER_TURN / 2 ? delta - DEGREES_PER_TURN : delta;
863
+ const result = a + shortest * frac;
864
+
865
+ return ((result % DEGREES_PER_TURN) + DEGREES_PER_TURN) % DEGREES_PER_TURN;
866
+ });
867
+ };
868
+
869
+ /**
870
+ * addSeries returns the element-wise sum of two equal-length series. It recombines
871
+ * the endpoint-pinned base path with the separately-smoothed lead displacement into
872
+ * the final centre channel; a missing entry on either side contributes 0.
873
+ */
874
+ const addSeries = (a: readonly number[], b: readonly number[]): number[] =>
875
+ a.map((value, index) => value + (b[index] ?? 0));
876
+
877
+ /**
878
+ * multiplySeries returns the element-wise product of a series and a per-frame
879
+ * weight series (the lead × its endpoint taper); a missing weight contributes 1
880
+ * (no attenuation).
881
+ */
882
+ const multiplySeries = (values: readonly number[], weights: readonly number[]): number[] =>
883
+ values.map((value, index) => value * (weights[index] ?? 1));
884
+
885
+ /**
886
+ * endpointTaper builds a per-frame 0..1 envelope that is 0 at the first and last
887
+ * frame and ramps with a smoothstep to 1 over `rampFrames` at each end, holding 1
888
+ * across the interior. Multiplying the smoothed lead by it forces the look-at point
889
+ * back onto the itinerary endpoints without a subtractive chord (which would halve the
890
+ * interior lead); the ramp spans the centre smoothing window, so the lead eases in
891
+ * and out rather than snapping. When the frame grid is too short for two ramps the
892
+ * envelope is the product of both smoothsteps, which still pins both ends.
893
+ */
894
+ const endpointTaper = (frameCount: number, rampFrames: number): number[] => {
895
+ const lastFrame = frameCount - 1;
896
+ const ramp = Math.max(1, rampFrames);
897
+ const out = new Array<number>(frameCount);
898
+ for (let i = 0; i < frameCount; i += 1) {
899
+ const rise = smoothstep(i / ramp);
900
+ const fall = smoothstep((lastFrame - i) / ramp);
901
+ out[i] = rise * fall;
902
+ }
903
+
904
+ return out;
905
+ };
906
+
907
+ /**
908
+ * HoldWindow is one dwell recovered from the timeline: the held `shot`, the
909
+ * wall-clock span `[enterMs, exitMs]` it occupies (on the same `[0, totalMs]`
910
+ * timeline the per-frame mapping reads), and its `position` in the flight (the
911
+ * opening `intro` beat, the closing `outro` beat, or a user-placed `mid` hold).
912
+ * The zoom shaping reads the position to pick the eased push-in / settle / breathe
913
+ * and the shot's bearingMode to gate the shaping to following holds only.
914
+ */
915
+ interface HoldWindow {
916
+ enterMs: number;
917
+ exitMs: number;
918
+ position: "intro" | "mid" | "outro";
919
+ shot: CameraShot;
920
+ }
921
+
922
+ /**
923
+ * recoverHoldWindows replays the timeline's wall-clock accumulation (the same leg
924
+ * weighting buildTimeline uses) to recover each shot's dwell as an absolute
925
+ * `[enterMs, exitMs]` span, classifying the first sorted shot's hold as the intro
926
+ * beat (also where it is the plan's only shot), the last sorted shot's as the outro,
927
+ * and any interior held shot as a mid hold. Only shots with a positive holdMs contribute a window. It is a parallel
928
+ * pass to buildTimeline so the shaping reads the dwell with the shot in hand rather
929
+ * than matching node fractions back to shots.
930
+ */
931
+ const recoverHoldWindows = (
932
+ shots: readonly CameraShot[],
933
+ targetDurationMs: number,
934
+ ): HoldWindow[] => {
935
+ const sorted = [...shots].sort((a, b) => a.at - b.at);
936
+ const first = sorted[0];
937
+ if (!first) {
938
+ return [];
939
+ }
940
+
941
+ const lastIndex = sorted.length - 1;
942
+ let weightTotal = 0;
943
+ const legWeights: number[] = [];
944
+ for (let index = 1; index < sorted.length; index += 1) {
945
+ const from = sorted[index - 1];
946
+ const to = sorted[index];
947
+ if (!from || !to) {
948
+ legWeights.push(0);
949
+
950
+ continue;
951
+ }
952
+
953
+ const span = Math.max(0, to.at - from.at);
954
+ const weight = span / Math.max(0.1, to.speedScale);
955
+ legWeights.push(weight);
956
+ weightTotal += weight;
957
+ }
958
+
959
+ const windows: HoldWindow[] = [];
960
+ let timeMs = 0;
961
+ if (first.holdMs > 0) {
962
+ // The first shot's hold opens the flight whatever follows it, a plan of one shot included:
963
+ // the rest of the flight still runs after it, so it is never the closing beat.
964
+ windows.push({
965
+ enterMs: timeMs,
966
+ exitMs: timeMs + first.holdMs,
967
+ position: "intro",
968
+ shot: first,
969
+ });
970
+ timeMs += first.holdMs;
971
+ }
972
+
973
+ for (let index = 1; index < sorted.length; index += 1) {
974
+ const to = sorted[index];
975
+ if (!to) {
976
+ continue;
977
+ }
978
+
979
+ const weight = legWeights[index - 1] ?? 0;
980
+ const legMs = weightTotal > 0 ? (weight / weightTotal) * targetDurationMs : 0;
981
+ timeMs += legMs;
982
+ if (to.holdMs > 0) {
983
+ windows.push({
984
+ enterMs: timeMs,
985
+ exitMs: timeMs + to.holdMs,
986
+ position: index === lastIndex ? "outro" : "mid",
987
+ shot: to,
988
+ });
989
+ timeMs += to.holdMs;
990
+ }
991
+ }
992
+
993
+ return windows;
994
+ };
995
+
996
+ /**
997
+ * applyHoldZoomShaping adds the deliberate, eased zoom-only motion to each hold
998
+ * window in place. Only a hand-authored non-follow dwell is exempt (a director's
999
+ * locked or value shot stays exactly as authored); a PRESET's non-follow hold
1000
+ * (helicopter's value-bearing beats, overview's map frames) still gets its
1001
+ * shaping, which is part of the preset's character rather than an override of an
1002
+ * author's intent. On the intro beat the zoom opens modeHoldRevealZoom
1003
+ * wider and pushes in to land on the establishing keyframe at the hold's end; on
1004
+ * the outro it settles modeHoldSettleZoom wider by the final frame; a mid hold
1005
+ * breathes out and back by MID_HOLD_REVEAL_ZOOM (zero at both edges so it joins the
1006
+ * travel framing). Every offset is negative (wider) so the clearance pass that runs
1007
+ * after, which only lowers zoom, never fights the shaping. Marker, pitch, and
1008
+ * bearing are left frozen across the dwell.
1009
+ */
1010
+ const applyHoldZoomShaping = (
1011
+ zooms: number[],
1012
+ shots: readonly CameraShot[],
1013
+ mode: CameraMode,
1014
+ totalMs: number,
1015
+ lastFrame: number,
1016
+ ): void => {
1017
+ if (totalMs <= 0 || lastFrame <= 0) {
1018
+ return;
1019
+ }
1020
+
1021
+ const reveal = modeHoldRevealZoom[mode];
1022
+ const settle = modeHoldSettleZoom[mode];
1023
+ for (const window of recoverHoldWindows(shots, totalMs - sumHolds(shots))) {
1024
+ if (mode === "director" && window.shot.bearingMode !== "follow") {
1025
+ continue;
1026
+ }
1027
+
1028
+ const dwellMs = window.exitMs - window.enterMs;
1029
+ if (dwellMs <= 0) {
1030
+ continue;
1031
+ }
1032
+
1033
+ const fromFrame = Math.max(0, Math.ceil((window.enterMs / totalMs) * lastFrame));
1034
+ const toFrame = Math.min(lastFrame, Math.floor((window.exitMs / totalMs) * lastFrame));
1035
+ for (let frame = fromFrame; frame <= toFrame; frame += 1) {
1036
+ const timeMs = (frame / lastFrame) * totalMs;
1037
+ const u = Math.min(1, Math.max(0, (timeMs - window.enterMs) / dwellMs));
1038
+ const offset = holdZoomOffset(window.position, u, reveal, settle);
1039
+ zooms[frame] = (zooms[frame] ?? 0) + offset;
1040
+ }
1041
+ }
1042
+ };
1043
+
1044
+ /**
1045
+ * holdZoomOffset returns the negative (wider) zoom delta a hold frame at eased
1046
+ * progress `u` (0 at the dwell start, 1 at its end) takes for its position: the
1047
+ * intro opens `reveal` wider and lands on 0 at the end (`-reveal * (1 - ease)`), the
1048
+ * outro starts at 0 and settles `settle` wider (`-settle * ease`), and a mid hold
1049
+ * breathes `-MID_HOLD_REVEAL_ZOOM * sin²(πu)` (zero at both edges). The ease is
1050
+ * easeInOutCubic so the motion has no velocity kink at the dwell boundaries.
1051
+ */
1052
+ const holdZoomOffset = (
1053
+ position: HoldWindow["position"],
1054
+ u: number,
1055
+ reveal: number,
1056
+ settle: number,
1057
+ ): number => {
1058
+ if (position === "intro") {
1059
+ return -reveal * (1 - easeInOutCubic(u));
1060
+ }
1061
+
1062
+ if (position === "outro") {
1063
+ return -settle * easeInOutCubic(u);
1064
+ }
1065
+
1066
+ const s = Math.sin(Math.PI * u);
1067
+
1068
+ return -MID_HOLD_REVEAL_ZOOM * s * s;
1069
+ };
1070
+
1071
+ /**
1072
+ * clampCenterToMarkerBudget pulls the look-at centre back toward the athlete in
1073
+ * place wherever the planar centre→marker offset exceeds the per-frame divergence
1074
+ * budget. The budget is MAX_MARKER_OFFCENTER_FRACTION of the viewport's ground span
1075
+ * at the frame's zoom; below 0.8 of it the offset is left identical, and above it a
1076
+ * C1 radial soft-knee (`b · (0.8 + 0.2·tanh((m/b − 0.8) / 0.2))`) compresses the
1077
+ * offset toward a 1.0·budget asymptote, so the rider never leaves the frame yet the
1078
+ * clamp introduces no slope discontinuity that would need re-smoothing. The offset
1079
+ * is measured in local equirectangular meters and the same scale factor is applied
1080
+ * to the lng/lat deltas, which is exact for the small offsets in play.
1081
+ */
1082
+ const clampCenterToMarkerBudget = (
1083
+ centerLngs: number[],
1084
+ centerLats: number[],
1085
+ markers: readonly LngLat[],
1086
+ zooms: readonly number[],
1087
+ ): void => {
1088
+ for (let frame = 0; frame < centerLngs.length; frame += 1) {
1089
+ const marker = markers[frame];
1090
+ const centerLng = centerLngs[frame];
1091
+ const centerLat = centerLats[frame];
1092
+ if (!marker || centerLng === undefined || centerLat === undefined) {
1093
+ continue;
1094
+ }
1095
+
1096
+ const budget =
1097
+ MAX_MARKER_OFFCENTER_FRACTION * viewportGroundSpanMeters(zooms[frame] ?? 0, centerLat);
1098
+ if (budget <= 0) {
1099
+ continue;
1100
+ }
1101
+
1102
+ const metersPerDegLng =
1103
+ METERS_PER_DEGREE_WEB_MERCATOR * Math.cos(centerLat * DEGREES_TO_RADIANS);
1104
+ const dEast = (centerLng - marker[0]) * metersPerDegLng;
1105
+ const dNorth = (centerLat - marker[1]) * METERS_PER_DEGREE_WEB_MERCATOR;
1106
+ const offset = Math.hypot(dEast, dNorth);
1107
+ const knee = BUDGET_KNEE_FRACTION * budget;
1108
+ if (offset <= knee || offset <= 0) {
1109
+ continue;
1110
+ }
1111
+
1112
+ const clampedOffset =
1113
+ budget *
1114
+ (BUDGET_KNEE_FRACTION +
1115
+ BUDGET_KNEE_SPAN * Math.tanh((offset / budget - BUDGET_KNEE_FRACTION) / BUDGET_KNEE_SPAN));
1116
+ const scale = clampedOffset / offset;
1117
+ centerLngs[frame] = marker[0] + (centerLng - marker[0]) * scale;
1118
+ centerLats[frame] = marker[1] + (centerLat - marker[1]) * scale;
1119
+ }
1120
+ };
1121
+
1122
+ /**
1123
+ * easeInOutCubic is the C¹ ease `4t³` below the midpoint and `1 − (−2t + 2)³ / 2`
1124
+ * above it, clamped to [0, 1]: a smooth 0→1 ramp that accelerates out of the start
1125
+ * and decelerates into the end with zero slope at both, used to shape the hold
1126
+ * push-in / settle without a velocity kink at the dwell boundary.
1127
+ */
1128
+ const easeInOutCubic = (t: number): number => {
1129
+ const x = Math.min(1, Math.max(0, t));
1130
+
1131
+ return x < 0.5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
1132
+ };
1133
+
1134
+ /** sumHolds totals every shot's holdMs: the wall-clock the dwells add over travel. */
1135
+ const sumHolds = (shots: readonly CameraShot[]): number => {
1136
+ let holds = 0;
1137
+ for (const shot of shots) {
1138
+ holds += shot.holdMs;
1139
+ }
1140
+
1141
+ return holds;
1142
+ };
1143
+
1144
+ /**
1145
+ * buildClearanceFrames assembles the per-frame channel slices the clearance pass
1146
+ * reads from the smoothed series: each frame's centre, pitch, zoom, bearing, and
1147
+ * the itinerary-progress fraction its wall-clock time maps to (so a missing terrain
1148
+ * sample under the centre can fall back to the itinerary's surface elevation). It is
1149
+ * the same time→progress mapping the raw sampling loop uses, recomputed here so
1150
+ * the clearance reads the fraction without the loop having stored it.
1151
+ */
1152
+ const buildClearanceFrames = (
1153
+ frameCount: number,
1154
+ timeline: readonly TimelineNode[],
1155
+ totalMs: number,
1156
+ centerLngs: readonly number[],
1157
+ centerLats: readonly number[],
1158
+ pitches: readonly number[],
1159
+ zooms: readonly number[],
1160
+ bearings: readonly number[],
1161
+ ): ClearanceFrame[] => {
1162
+ const lastFrame = frameCount - 1;
1163
+ const frames = new Array<ClearanceFrame>(frameCount);
1164
+ for (let frame = 0; frame < frameCount; frame += 1) {
1165
+ const timeMs = lastFrame === 0 ? 0 : (frame / lastFrame) * totalMs;
1166
+ frames[frame] = {
1167
+ bearing: bearings[frame] ?? 0,
1168
+ center: [centerLngs[frame] ?? 0, centerLats[frame] ?? 0],
1169
+ fraction: progressAtTime(timeline, timeMs),
1170
+ pitch: pitches[frame] ?? 0,
1171
+ zoom: zooms[frame] ?? 0,
1172
+ };
1173
+ }
1174
+
1175
+ return frames;
1176
+ };
1177
+
1178
+ /**
1179
+ * TimelineNode is one entry in the wall-clock → progress map: at `timeMs` the
1180
+ * flight is at itinerary progress `fraction`. The nodes are ascending in both fields
1181
+ * for travel legs; a hold contributes two nodes at the same `fraction` and
1182
+ * different `timeMs` (the dwell), so progressAtTime returns the frozen fraction
1183
+ * across the hold window.
1184
+ */
1185
+ interface TimelineNode {
1186
+ fraction: number;
1187
+ timeMs: number;
1188
+ }
1189
+
1190
+ /**
1191
+ * buildTimeline maps wall-clock milliseconds to itinerary progress for a shot list.
1192
+ * The travelling time (`targetDurationMs`) is split across the legs between
1193
+ * consecutive shots, each leg weighted by its progress span divided by the
1194
+ * leg's `speedScale` (a faster leg consumes less of the travel budget for the
1195
+ * same distance); each shot then inserts a hold of its `holdMs` at its own
1196
+ * progress. The FIRST travel leg accelerates out of the start and the LAST
1197
+ * decelerates into the finish (a single-leg plan does both) on a trapezoidal
1198
+ * velocity profile carried by EDGE_EASE_SUBNODES sub-nodes, so the flight never
1199
+ * leaves the intro hold or hits the outro at full travel speed; the legs'
1200
+ * wall-clock boundaries are unchanged, so holds land at the same time and the
1201
+ * total duration is invariant. The result is an ascending node list
1202
+ * progressAtTime interpolates within. A single shot yields a hold-only timeline
1203
+ * at that shot's progress.
1204
+ */
1205
+ const buildTimeline = (shots: readonly CameraShot[], targetDurationMs: number): TimelineNode[] => {
1206
+ const sorted = [...shots].sort((a, b) => a.at - b.at);
1207
+ const first = sorted[0];
1208
+ if (!first) {
1209
+ return [{ fraction: 0, timeMs: 0 }];
1210
+ }
1211
+
1212
+ // Weight each leg by its span / speedScale so the travel budget is distributed
1213
+ // by how long each leg should take, not just its length. The leg's speedScale
1214
+ // is taken from the shot it travels toward (the scale applies to the approach).
1215
+ let weightTotal = 0;
1216
+ const legWeights: number[] = [];
1217
+ for (let index = 1; index < sorted.length; index += 1) {
1218
+ const from = sorted[index - 1];
1219
+ const to = sorted[index];
1220
+ if (!from || !to) {
1221
+ legWeights.push(0);
1222
+
1223
+ continue;
1224
+ }
1225
+
1226
+ const span = Math.max(0, to.at - from.at);
1227
+ const weight = span / Math.max(0.1, to.speedScale);
1228
+ legWeights.push(weight);
1229
+ weightTotal += weight;
1230
+ }
1231
+
1232
+ const nodes: TimelineNode[] = [];
1233
+ let timeMs = 0;
1234
+ // Open with the first shot's hold so an intro beat dwells before travel.
1235
+ nodes.push({ fraction: first.at, timeMs });
1236
+ if (first.holdMs > 0) {
1237
+ timeMs += first.holdMs;
1238
+ nodes.push({ fraction: first.at, timeMs });
1239
+ }
1240
+
1241
+ const lastLegIndex = sorted.length - 1;
1242
+ for (let index = 1; index < sorted.length; index += 1) {
1243
+ const from = sorted[index - 1];
1244
+ const to = sorted[index];
1245
+ if (!from || !to) {
1246
+ continue;
1247
+ }
1248
+
1249
+ const weight = legWeights[index - 1] ?? 0;
1250
+ const legMs = weightTotal > 0 ? (weight / weightTotal) * targetDurationMs : 0;
1251
+ // Shape the edge legs: the first accelerates away from standstill, the last
1252
+ // decelerates into the finish, a lone leg does both. Sub-nodes carry the
1253
+ // quadratic within the leg's unchanged wall-clock window; interior legs stay
1254
+ // linear (their pacing is the shots' speedScale, not an edge ease).
1255
+ const ease = edgeEaseFor(index, lastLegIndex);
1256
+ if (ease && legMs > 0 && to.at !== from.at) {
1257
+ for (let sub = 1; sub <= EDGE_EASE_SUBNODES; sub += 1) {
1258
+ const u = sub / (EDGE_EASE_SUBNODES + 1);
1259
+ nodes.push({
1260
+ fraction: from.at + (to.at - from.at) * ease(u),
1261
+ timeMs: timeMs + legMs * u,
1262
+ });
1263
+ }
1264
+ }
1265
+
1266
+ timeMs += legMs;
1267
+ nodes.push({ fraction: to.at, timeMs });
1268
+ if (to.holdMs > 0) {
1269
+ timeMs += to.holdMs;
1270
+ nodes.push({ fraction: to.at, timeMs });
1271
+ }
1272
+ }
1273
+
1274
+ return nodes;
1275
+ };
1276
+
1277
+ /**
1278
+ * edgeEaseFor picks the progress shaping for a travel leg: the first leg
1279
+ * accelerates out of the start, the last decelerates into the finish, a leg
1280
+ * that is both (a two-shot plan, including the empty-plan full-itinerary fallback)
1281
+ * does both, and an interior leg is unshaped (null, linear). Every profile is a
1282
+ * trapezoid over EDGE_EASE_WINDOW_FRACTION of the leg.
1283
+ */
1284
+ const edgeEaseFor = (legIndex: number, lastLegIndex: number): ((u: number) => number) | null => {
1285
+ const isFirst = legIndex === 1;
1286
+ const isLast = legIndex === lastLegIndex;
1287
+ if (isFirst && isLast) {
1288
+ return (u) => accelerateDecelerateProfile(u, EDGE_EASE_WINDOW_FRACTION);
1289
+ }
1290
+
1291
+ if (isFirst) {
1292
+ return (u) => accelerateProfile(u, EDGE_EASE_WINDOW_FRACTION);
1293
+ }
1294
+
1295
+ if (isLast) {
1296
+ return (u) => decelerateProfile(u, EDGE_EASE_WINDOW_FRACTION);
1297
+ }
1298
+
1299
+ return null;
1300
+ };
1301
+
1302
+ /**
1303
+ * accelerateProfile is the first-leg trapezoid: velocity ramps linearly from 0
1304
+ * over the window `a` (progress `v·u²/(2a)`, the quadratic ramp) then cruises at
1305
+ * `v = 1 / (1 − a/2)` so the leg still lands exactly on 1 at u = 1.
1306
+ */
1307
+ const accelerateProfile = (u: number, a: number): number => {
1308
+ const cruise = 1 / (1 - a / 2);
1309
+
1310
+ return u <= a ? (cruise * u * u) / (2 * a) : cruise * (u - a / 2);
1311
+ };
1312
+
1313
+ /**
1314
+ * decelerateProfile is the last-leg trapezoid: cruise at `v = 1 / (1 − a/2)`
1315
+ * from the start, then velocity ramps linearly to 0 over the final window `a`
1316
+ * (progress `1 − v·(1 − u)²/(2a)`), landing exactly on 1 with zero velocity.
1317
+ */
1318
+ const decelerateProfile = (u: number, a: number): number => {
1319
+ const cruise = 1 / (1 - a / 2);
1320
+
1321
+ return u >= 1 - a ? 1 - (cruise * (1 - u) * (1 - u)) / (2 * a) : cruise * u;
1322
+ };
1323
+
1324
+ /**
1325
+ * accelerateDecelerateProfile is the lone-leg trapezoid: ramp up over `a`,
1326
+ * cruise at `v = 1 / (1 − a)`, ramp down over the final `a`, so a two-shot
1327
+ * flight still eases out of the start and into the finish within one leg.
1328
+ */
1329
+ const accelerateDecelerateProfile = (u: number, a: number): number => {
1330
+ const cruise = 1 / (1 - a);
1331
+ if (u <= a) {
1332
+ return (cruise * u * u) / (2 * a);
1333
+ }
1334
+
1335
+ if (u >= 1 - a) {
1336
+ return 1 - (cruise * (1 - u) * (1 - u)) / (2 * a);
1337
+ }
1338
+
1339
+ return cruise * (u - a / 2);
1340
+ };
1341
+
1342
+ /**
1343
+ * progressAtTime returns the itinerary progress at a wall-clock time by linear
1344
+ * interpolation between the bracketing timeline nodes. A time at or before the
1345
+ * first node yields its fraction; at or past the last node, the last fraction; a
1346
+ * time inside a hold (two nodes sharing a fraction) returns that frozen fraction.
1347
+ */
1348
+ const progressAtTime = (nodes: readonly TimelineNode[], timeMs: number): number => {
1349
+ const first = nodes[0];
1350
+ const last = nodes[nodes.length - 1];
1351
+ if (!first || !last) {
1352
+ return 0;
1353
+ }
1354
+
1355
+ if (timeMs <= first.timeMs) {
1356
+ return first.fraction;
1357
+ }
1358
+
1359
+ if (timeMs >= last.timeMs) {
1360
+ return last.fraction;
1361
+ }
1362
+
1363
+ for (let index = 1; index < nodes.length; index += 1) {
1364
+ const from = nodes[index - 1];
1365
+ const to = nodes[index];
1366
+ if (!from || !to) {
1367
+ continue;
1368
+ }
1369
+
1370
+ if (timeMs <= to.timeMs) {
1371
+ const span = to.timeMs - from.timeMs;
1372
+ if (span <= 0) {
1373
+ return to.fraction;
1374
+ }
1375
+
1376
+ const ratio = (timeMs - from.timeMs) / span;
1377
+
1378
+ return from.fraction + (to.fraction - from.fraction) * ratio;
1379
+ }
1380
+ }
1381
+
1382
+ return last.fraction;
1383
+ };
1384
+
1385
+ /**
1386
+ * fullRouteFollowShots are the implicit keyframes an empty-shots plan resolves
1387
+ * through: a `follow` shot at the itinerary start and one at the end, both with a
1388
+ * neutral cinematic pitch and a mid zoom, so a director plan with no shots yet
1389
+ * still yields a usable full-itinerary flight for the preview. Two shots (rather than
1390
+ * one) give the timeline a leg to travel along, so the camera sweeps the whole
1391
+ * itinerary from start to finish instead of holding at the start.
1392
+ */
1393
+ const fullRouteFollowShots = (plan: CameraPlan): CameraShot[] => [
1394
+ {
1395
+ at: 0,
1396
+ bearingMode: "follow",
1397
+ holdMs: 0,
1398
+ id: `${plan.mode}-full-itinerary-start`,
1399
+ pitchDeg: 60,
1400
+ speedScale: 1,
1401
+ zoom: 14,
1402
+ },
1403
+ {
1404
+ at: 1,
1405
+ bearingMode: "follow",
1406
+ holdMs: 0,
1407
+ id: `${plan.mode}-full-itinerary-end`,
1408
+ pitchDeg: 60,
1409
+ speedScale: 1,
1410
+ zoom: 14,
1411
+ },
1412
+ ];