@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,2512 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_errors = require("../chunk-o3IRANDf.cjs");
7
+ const require_listeners = require("../chunk-BIEc_SkR.cjs");
8
+ const require_vocabulary = require("../chunk-OXr3zJfM.cjs");
9
+ const require_axisLookup = require("../chunk-CKtd19eD.cjs");
10
+ const require_climbs = require("../chunk-B19l3j9r.cjs");
11
+ const require_conversions = require("../chunk-BBikve0Z.cjs");
12
+ const require_geodesy = require("../chunk-Dor1ERI9.cjs");
13
+ const require_selectors = require("../chunk-CsWjBmdi.cjs");
14
+ const require_geometry = require("../chunk-BWMuCNc9.cjs");
15
+ const require_longitude = require("../chunk-RHZrxUrM.cjs");
16
+ const require_webMercator = require("../chunk-fHVYEZs4.cjs");
17
+ const require_zoom = require("../chunk-Cizu_j1N.cjs");
18
+ const require_fit = require("../chunk-D_BeqSbc.cjs");
19
+ const require_presets = require("../chunk-BJEZWTKj.cjs");
20
+ const insertShotSorted = (shots, shot) => {
21
+ const next = [...shots];
22
+ let index = next.length;
23
+ while (index > 0) {
24
+ const previous = next[index - 1];
25
+ if (previous && previous.at <= shot.at) break;
26
+ index -= 1;
27
+ }
28
+ next.splice(index, 0, shot);
29
+ return next;
30
+ };
31
+ const defaultCameraShot = {
32
+ bearingMode: "follow",
33
+ holdMs: 0,
34
+ speedScale: 1
35
+ };
36
+ const defaultCameraOutput = {
37
+ aspect: "9:16",
38
+ format: "mp4",
39
+ fps: 30,
40
+ preset: "vertical",
41
+ quality: "high",
42
+ resolution: "1080p"
43
+ };
44
+ const DEFAULT_TARGET_DURATION_MS = 2e4;
45
+ const refuseUnplannableShot = (shot, index, refuse) => {
46
+ const member = (name) => `shots[${index}].${name}`;
47
+ if (!Number.isFinite(shot.at)) refuse(member("at"), shot.at, "a finite progress along the route, from 0 to 1");
48
+ if (!Number.isFinite(shot.holdMs) || shot.holdMs < 0) refuse(member("holdMs"), shot.holdMs, "a finite number of milliseconds, 0 or more");
49
+ if (!Number.isFinite(shot.speedScale) || shot.speedScale <= 0) refuse(member("speedScale"), shot.speedScale, "a finite number above 0");
50
+ if (!Number.isFinite(shot.pitchDeg)) refuse(member("pitchDeg"), shot.pitchDeg, "a finite number of degrees");
51
+ if (!Number.isFinite(shot.zoom)) refuse(member("zoom"), shot.zoom, "a finite zoom level");
52
+ if (shot.bearingDeg !== void 0 && !Number.isFinite(shot.bearingDeg)) refuse(member("bearingDeg"), shot.bearingDeg, "a finite number of degrees, or omit it");
53
+ };
54
+ const refuseUnplannablePlan = (operation, plan, parameter) => {
55
+ const whole = plan;
56
+ if (typeof whole !== "object" || whole === null || Array.isArray(whole)) throw new require_errors.MountayaElementsError(`${operation}: ${parameter ?? "plan"} is ${Array.isArray(whole) ? "a list" : String(whole)}; pass a plan, as createCameraPlan builds one.`);
57
+ const path = parameter === void 0 ? "" : `${parameter}.`;
58
+ const builds = parameter === void 0;
59
+ const refuse = (member, value, expected) => {
60
+ throw new require_errors.MountayaElementsError(`${operation}: ${path}${member} is ${String(value)}; pass ${expected}.`);
61
+ };
62
+ const output = plan.output;
63
+ const shots = plan.shots;
64
+ if (typeof output !== "object" || output === null) refuse("output", output, builds ? "the output a plan records to as an object, or omit it for the default output" : "the output a plan records to, as createCameraPlan builds one");
65
+ if (!Array.isArray(shots)) refuse("shots", shots, builds ? "the plan's shots as an array, or omit it for no shots" : "the plan's shots as an array, as createCameraPlan builds one");
66
+ const version = plan.version;
67
+ if (version !== 1) refuse("version", version, "a version 1 plan, as createCameraPlan builds one");
68
+ const { targetDurationMs } = plan;
69
+ if (!Number.isFinite(targetDurationMs) || targetDurationMs <= 0) refuse("targetDurationMs", targetDurationMs, builds ? `a finite number of milliseconds above 0, or omit it for ${DEFAULT_TARGET_DURATION_MS}` : "a finite number of milliseconds above 0");
70
+ const fps = plan.output.fps;
71
+ if (!require_vocabulary.CAMERA_FPS.some((rate) => rate === fps)) refuse("output.fps", fps, `one of ${require_vocabulary.CAMERA_FPS.join(", ")}`);
72
+ const { bitrateMbps } = plan.output;
73
+ if (bitrateMbps !== void 0 && (!Number.isFinite(bitrateMbps) || bitrateMbps <= 0)) refuse("output.bitrateMbps", bitrateMbps, "a finite number of megabits per second above 0, or omit it for the resolution's default");
74
+ for (const [index, shot] of plan.shots.entries()) {
75
+ const entry = shot;
76
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) refuse(`shots[${index}]`, entry, "a shot, an object that states at, pitchDeg and zoom over defaultCameraShot");
77
+ refuseUnplannableShot(shot, index, refuse);
78
+ }
79
+ };
80
+ const refuseUnplannableRoute = (operation, route) => {
81
+ for (let index = 0; index < route.line.length; index += 1) {
82
+ const vertex = route.line[index];
83
+ if (vertex !== void 0 && !(Number.isFinite(vertex[0]) && Number.isFinite(vertex[1]))) throw new require_errors.MountayaElementsError(`${operation}: itinerary.line[${index}] is [${String(vertex[0])}, ${String(vertex[1])}]; pass a finite longitude and latitude for every vertex, or build the route with itineraryToRouteGeometry, which leaves out a vertex that names no place.`);
84
+ }
85
+ };
86
+ const createCameraPlan = (plan) => {
87
+ const built = {
88
+ mode: plan.mode,
89
+ output: plan.output ?? { ...defaultCameraOutput },
90
+ shots: plan.shots ?? [],
91
+ targetDurationMs: plan.targetDurationMs ?? 2e4,
92
+ version: 1
93
+ };
94
+ refuseUnplannablePlan("createCameraPlan", built);
95
+ return built;
96
+ };
97
+ const continuousLine = (line) => {
98
+ const out = [];
99
+ let turns = 0;
100
+ let previous;
101
+ for (const [lng, lat] of line) {
102
+ if (!Number.isFinite(lng)) {
103
+ out.push([lng, lat]);
104
+ continue;
105
+ }
106
+ if (previous !== void 0) {
107
+ const step = lng - previous;
108
+ if (Math.abs(step) > 180) turns -= Math.round(step / 360);
109
+ }
110
+ previous = lng;
111
+ out.push([turns === 0 ? lng : lng + turns * 360, lat]);
112
+ }
113
+ return out;
114
+ };
115
+ const findVertexIndex = (cumulative, targetMeters) => {
116
+ const length = cumulative.length;
117
+ if (length === 0) return 0;
118
+ const first = cumulative[0];
119
+ const last = cumulative[length - 1];
120
+ if (first === void 0 || last === void 0) return 0;
121
+ if (targetMeters <= first) return 0;
122
+ if (targetMeters >= last) return length - 1;
123
+ let lo = 0;
124
+ let hi = length - 1;
125
+ while (lo < hi - 1) {
126
+ const mid = lo + hi >> 1;
127
+ const value = cumulative[mid];
128
+ if (value === void 0) break;
129
+ if (value <= targetMeters) lo = mid;
130
+ else hi = mid;
131
+ }
132
+ return lo;
133
+ };
134
+ const placedFrom = (line, index, step) => {
135
+ for (let at = index; at >= 0 && at < line.length; at += step) {
136
+ const vertex = line[at];
137
+ if (require_geodesy.namesPlace(vertex)) return [vertex[0], vertex[1]];
138
+ }
139
+ return [NaN, NaN];
140
+ };
141
+ const pointAtMeters = (line, targetMeters, cumulative = require_geodesy.cumulativeMeters(line)) => {
142
+ if (line.length === 0) return [0, 0];
143
+ if (Number.isNaN(targetMeters)) return [NaN, NaN];
144
+ const total = cumulative[cumulative.length - 1] ?? 0;
145
+ if (targetMeters <= 0 || total === 0) return placedFrom(line, 0, 1);
146
+ if (targetMeters >= total) return placedFrom(line, line.length - 1, -1);
147
+ const lo = findVertexIndex(cumulative, targetMeters);
148
+ const a = placedFrom(line, lo, -1);
149
+ const b = line[lo + 1];
150
+ const aMeters = cumulative[lo];
151
+ const bMeters = cumulative[lo + 1];
152
+ if (!require_geodesy.namesPlace(a) || !require_geodesy.namesPlace(b) || aMeters === void 0 || bMeters === void 0) return placedFrom(line, 0, 1);
153
+ const span = bMeters - aMeters;
154
+ const ratio = span === 0 ? 0 : (targetMeters - aMeters) / span;
155
+ return [a[0] + require_longitude.longitudeDelta(a[0], b[0]) * ratio, a[1] + (b[1] - a[1]) * ratio];
156
+ };
157
+ const bearingDegBetween = (a, b) => {
158
+ if (a[0] === b[0] && a[1] === b[1]) return 0;
159
+ const lat1 = a[1] * require_conversions.DEGREES_TO_RADIANS;
160
+ const lat2 = b[1] * require_conversions.DEGREES_TO_RADIANS;
161
+ const dLng = (b[0] - a[0]) * require_conversions.DEGREES_TO_RADIANS;
162
+ const y = Math.sin(dLng) * Math.cos(lat2);
163
+ const x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLng);
164
+ return (Math.atan2(y, x) * require_conversions.RADIANS_TO_DEGREES + 360) % 360;
165
+ };
166
+ const tangentBearingAtMeters = (line, targetMeters, lookaheadMeters, cumulative = require_geodesy.cumulativeMeters(line)) => {
167
+ const total = cumulative[cumulative.length - 1] ?? 0;
168
+ const here = pointAtMeters(line, targetMeters, cumulative);
169
+ const aheadMeters = Math.min(targetMeters + Math.max(0, lookaheadMeters), total);
170
+ const ahead = pointAtMeters(line, aheadMeters, cumulative);
171
+ if (here[0] !== ahead[0] || here[1] !== ahead[1]) return bearingDegBetween(here, ahead);
172
+ const index = findVertexIndex(cumulative, targetMeters);
173
+ for (let start = Math.min(index, line.length - 2); start >= 0; start -= 1) {
174
+ const heading = legBearingDeg(line, start);
175
+ if (heading !== null) return heading;
176
+ }
177
+ for (let start = index + 1; start < line.length - 1; start += 1) {
178
+ const heading = legBearingDeg(line, start);
179
+ if (heading !== null) return heading;
180
+ }
181
+ return 0;
182
+ };
183
+ const routeHeadingDeg = (line, cumulative = require_geodesy.cumulativeMeters(line)) => tangentBearingAtMeters(line, 0, cumulative[cumulative.length - 1] ?? 0, cumulative);
184
+ const legBearingDeg = (line, start) => {
185
+ const from = line[start];
186
+ const to = line[start + 1];
187
+ if (!from || !to || from[0] === to[0] && from[1] === to[1]) return null;
188
+ return bearingDegBetween(from, to);
189
+ };
190
+ const cursorAtFraction = (line, fraction, lookaheadMeters, cumulative = require_geodesy.cumulativeMeters(line)) => {
191
+ const total = cumulative[cumulative.length - 1] ?? 0;
192
+ const targetMeters = Math.min(1, Math.max(0, fraction)) * total;
193
+ return {
194
+ bearingDeg: tangentBearingAtMeters(line, targetMeters, lookaheadMeters, cumulative),
195
+ index: findVertexIndex(cumulative, targetMeters),
196
+ point: pointAtMeters(line, targetMeters, cumulative)
197
+ };
198
+ };
199
+ const itineraryToRouteGeometry = (itinerary, segmentId = null) => {
200
+ const segments = require_selectors.segmentsForSelection(itinerary, segmentId);
201
+ const line = [];
202
+ const elevations = [];
203
+ const jumps = [];
204
+ let everyVertexHasElevation = true;
205
+ for (const segment of segments) for (const { coordinates } of require_geometry.extractLines(segment.geojson)) {
206
+ let opensLine = true;
207
+ for (const coordinate of coordinates) {
208
+ if (!require_geodesy.namesPlace(coordinate)) continue;
209
+ if (opensLine && line.length > 0) jumps.push(line.length);
210
+ opensLine = false;
211
+ const [lng = 0, lat = 0, elevation] = coordinate;
212
+ line.push([lng, lat]);
213
+ if (elevation === void 0 || !Number.isFinite(elevation)) everyVertexHasElevation = false;
214
+ else elevations.push(elevation);
215
+ }
216
+ }
217
+ if (line.length < 2) return null;
218
+ return {
219
+ ...everyVertexHasElevation && elevations.length === line.length ? { elevations } : {},
220
+ ...jumps.length > 0 ? { jumps } : {},
221
+ line
222
+ };
223
+ };
224
+ const routeGroundMeters = (route, cumulative = require_geodesy.cumulativeMeters(route.line)) => {
225
+ const jumps = new Set(route.jumps);
226
+ const ground = new Array(cumulative.length);
227
+ let jumped = 0;
228
+ for (let index = 0; index < cumulative.length; index += 1) {
229
+ const here = cumulative[index] ?? 0;
230
+ if (index > 0 && jumps.has(index)) jumped += here - (cumulative[index - 1] ?? here);
231
+ ground[index] = here - jumped;
232
+ }
233
+ return ground;
234
+ };
235
+ const groundMetersAt = (cumulative, ground, flightMeters) => {
236
+ const lo = findVertexIndex(cumulative, flightMeters);
237
+ const from = ground[lo];
238
+ if (from === void 0) return 0;
239
+ const to = ground[lo + 1];
240
+ const fromMeters = cumulative[lo];
241
+ const toMeters = cumulative[lo + 1];
242
+ if (to === void 0 || fromMeters === void 0 || toMeters === void 0) return from;
243
+ const span = toMeters - fromMeters;
244
+ if (span <= 0) return from;
245
+ const ratio = Math.min(1, Math.max(0, (flightMeters - fromMeters) / span));
246
+ return from + (to - from) * ratio;
247
+ };
248
+ const elevationAtFraction = (itinerary, fraction, cumulative = require_geodesy.cumulativeMeters(itinerary.line)) => {
249
+ const elevations = itinerary.elevations;
250
+ const line = itinerary.line;
251
+ if (!elevations || elevations.length !== line.length || elevations.length === 0) return null;
252
+ const total = cumulative[cumulative.length - 1] ?? 0;
253
+ const targetMeters = Math.min(1, Math.max(0, fraction)) * total;
254
+ const lo = findVertexIndex(cumulative, targetMeters);
255
+ const aElev = elevations[lo];
256
+ const bElev = elevations[lo + 1];
257
+ const aMeters = cumulative[lo];
258
+ const bMeters = cumulative[lo + 1];
259
+ if (aElev === void 0) return null;
260
+ if (bElev === void 0 || aMeters === void 0 || bMeters === void 0) return aElev;
261
+ const span = bMeters - aMeters;
262
+ if (span <= 0) return aElev;
263
+ const ratio = Math.min(1, Math.max(0, (targetMeters - aMeters) / span));
264
+ return aElev + (bElev - aElev) * ratio;
265
+ };
266
+ const slopeDegAtFraction = (itinerary, fraction, lookaheadMeters) => {
267
+ const cumulative = require_geodesy.cumulativeMeters(itinerary.line);
268
+ if (elevationAtFraction(itinerary, fraction, cumulative) === null) return 0;
269
+ const total = cumulative[cumulative.length - 1] ?? 0;
270
+ if (!(total > 0)) return 0;
271
+ const run = Math.min(Number.isFinite(lookaheadMeters) ? Math.max(1, lookaheadMeters) : 1, total);
272
+ const startMeters = Math.min(Math.min(1, Math.max(0, fraction)) * total, total - run);
273
+ const here = elevationAtFraction(itinerary, startMeters / total, cumulative);
274
+ const ahead = elevationAtFraction(itinerary, (startMeters + run) / total, cumulative);
275
+ if (here === null || ahead === null) return 0;
276
+ const slopeDeg = require_conversions.convertSlope((ahead - here) / run, "ratio", "degrees");
277
+ return Number.isFinite(slopeDeg) ? slopeDeg : 0;
278
+ };
279
+ const PITCH_DEG_MAX = 85;
280
+ const ZOOM_MAX = 22;
281
+ const NEUTRAL_PITCH_DEG = 60;
282
+ const NEUTRAL_ZOOM = 14;
283
+ const clampPitch = (value) => Math.max(0, Math.min(PITCH_DEG_MAX, Number.isFinite(value) ? value : NEUTRAL_PITCH_DEG));
284
+ const clampZoom = (value) => Math.max(0, Math.min(ZOOM_MAX, Number.isFinite(value) ? value : NEUTRAL_ZOOM));
285
+ const modeSmoothingSigmas = {
286
+ chase: {
287
+ bearing: 40,
288
+ center: 100,
289
+ pitchZoom: 70
290
+ },
291
+ cinematic: {
292
+ bearing: 50,
293
+ center: 120,
294
+ pitchZoom: 80
295
+ },
296
+ director: {
297
+ bearing: 50,
298
+ center: 120,
299
+ pitchZoom: 80
300
+ },
301
+ drone: {
302
+ bearing: 220,
303
+ center: 350,
304
+ pitchZoom: 280
305
+ },
306
+ helicopter: {
307
+ bearing: 200,
308
+ center: 300,
309
+ pitchZoom: 240
310
+ },
311
+ overview: {
312
+ bearing: 140,
313
+ center: 260,
314
+ pitchZoom: 200
315
+ },
316
+ smart: {
317
+ bearing: 110,
318
+ center: 200,
319
+ pitchZoom: 150
320
+ }
321
+ };
322
+ const SIGMA_FRAMES_MIN = 2;
323
+ const SIGMA_FRAMES_FALLBACK_DIVISOR = 3;
324
+ const sigmaFramesForMeters = (sigmaMeters, frameCount, routeLengthMeters) => {
325
+ const ceil = Math.max(SIGMA_FRAMES_MIN, frameCount / SIGMA_FRAMES_FALLBACK_DIVISOR);
326
+ if (!Number.isFinite(routeLengthMeters) || routeLengthMeters <= 0) return ceil;
327
+ const frames = sigmaMeters * frameCount / routeLengthMeters;
328
+ return Math.min(ceil, Math.max(SIGMA_FRAMES_MIN, frames));
329
+ };
330
+ const uniformCatmullRom = (knots, values, target) => {
331
+ const n = knots.length;
332
+ if (n === 0) return 0;
333
+ if (n === 1) return values[0] ?? 0;
334
+ const firstKnot = knots[0] ?? 0;
335
+ const lastKnot = knots[n - 1] ?? 0;
336
+ if (target <= firstKnot) return values[0] ?? 0;
337
+ if (target >= lastKnot) return values[n - 1] ?? 0;
338
+ const i1 = segmentIndex(knots, target);
339
+ if (n < 4) {
340
+ const t0 = knots[i1] ?? 0;
341
+ const t1 = knots[i1 + 1] ?? t0;
342
+ const v0 = values[i1] ?? 0;
343
+ const v1 = values[i1 + 1] ?? v0;
344
+ const span = t1 - t0;
345
+ const u = span > 0 ? (target - t0) / span : 0;
346
+ return v0 + (v1 - v0) * u;
347
+ }
348
+ const i0 = Math.max(0, i1 - 1);
349
+ const i2 = Math.min(n - 1, i1 + 1);
350
+ const i3 = Math.min(n - 1, i1 + 2);
351
+ const t0 = knots[i0] ?? 0;
352
+ const t1 = knots[i1] ?? 0;
353
+ const t2 = knots[i2] ?? 0;
354
+ const t3 = knots[i3] ?? 0;
355
+ const p0 = values[i0] ?? 0;
356
+ const p1 = values[i1] ?? 0;
357
+ const p2 = values[i2] ?? 0;
358
+ const p3 = values[i3] ?? 0;
359
+ const eps = 1e-6;
360
+ const u = target;
361
+ const a1 = t1 - t0 > eps ? ((t1 - u) * p0 + (u - t0) * p1) / (t1 - t0) : p1;
362
+ const a2 = t2 - t1 > eps ? ((t2 - u) * p1 + (u - t1) * p2) / (t2 - t1) : p1;
363
+ const a3 = t3 - t2 > eps ? ((t3 - u) * p2 + (u - t2) * p3) / (t3 - t2) : p2;
364
+ const b1 = t2 - t0 > eps ? ((t2 - u) * a1 + (u - t0) * a2) / (t2 - t0) : a2;
365
+ const b2 = t3 - t1 > eps ? ((t3 - u) * a2 + (u - t1) * a3) / (t3 - t1) : a2;
366
+ return t2 - t1 > eps ? ((t2 - u) * b1 + (u - t1) * b2) / (t2 - t1) : b1;
367
+ };
368
+ const unwrapBearings = (bearings) => {
369
+ const length = bearings.length;
370
+ if (length === 0) return [];
371
+ const out = new Array(length);
372
+ let running = bearings[0] ?? 0;
373
+ out[0] = running;
374
+ for (let i = 1; i < length; i += 1) {
375
+ const previous = bearings[i - 1] ?? 0;
376
+ const current = bearings[i] ?? previous;
377
+ running += shortestArcDelta(previous, current);
378
+ out[i] = running;
379
+ }
380
+ return out;
381
+ };
382
+ const shortestArcDelta = (from, to) => {
383
+ const raw = ((to - from) % 360 + 360) % 360;
384
+ return raw > 180 ? raw - 360 : raw;
385
+ };
386
+ const lowPass = (values, sigmaSamples, continued) => {
387
+ const length = values.length;
388
+ const lastIndex = length - 1;
389
+ const sigma = Math.max(.001, sigmaSamples);
390
+ const halfWidth = Math.max(1, Math.ceil(sigma * 3));
391
+ const denom = 2 * sigma * sigma;
392
+ const out = new Array(length);
393
+ for (let i = 0; i < length; i += 1) {
394
+ const from = continued === void 0 ? Math.max(0, i - halfWidth) : i - halfWidth;
395
+ const to = continued === void 0 ? Math.min(lastIndex, i + halfWidth) : i + halfWidth;
396
+ let weighted = 0;
397
+ let weightSum = 0;
398
+ for (let j = from; j <= to; j += 1) {
399
+ const value = j >= 0 && j <= lastIndex ? values[j] : continued?.(j);
400
+ if (value === void 0 || !Number.isFinite(value)) continue;
401
+ const d = j - i;
402
+ const weight = Math.exp(-(d * d) / denom);
403
+ weighted += value * weight;
404
+ weightSum += weight;
405
+ }
406
+ out[i] = weightSum > 0 ? weighted / weightSum : values[i] ?? 0;
407
+ }
408
+ return out;
409
+ };
410
+ const smoothSeries = (values, sigmaSamples) => lowPass(values, sigmaSamples);
411
+ const smoothPositionSeries = (values, sigmaSamples) => {
412
+ const length = values.length;
413
+ if (length < 2) return [...values];
414
+ const lastIndex = length - 1;
415
+ const first = values[0];
416
+ const last = values[lastIndex];
417
+ const turn = 2 * lastIndex;
418
+ const gain = first === void 0 || last === void 0 ? NaN : 2 * (last - first);
419
+ const reflected = (index) => {
420
+ if (index < 0) {
421
+ const inside = values[-index];
422
+ return first === void 0 || inside === void 0 ? void 0 : 2 * first - inside;
423
+ }
424
+ if (index > lastIndex) {
425
+ const inside = values[turn - index];
426
+ return last === void 0 || inside === void 0 ? void 0 : 2 * last - inside;
427
+ }
428
+ return values[index];
429
+ };
430
+ const valueAt = (index) => {
431
+ if (index >= -lastIndex && index <= turn) return reflected(index);
432
+ const turns = Math.floor(index / turn);
433
+ const within = reflected(index - turns * turn);
434
+ return within === void 0 ? void 0 : within + turns * gain;
435
+ };
436
+ const smoothed = lowPass(values, Math.min(sigmaSamples, length), valueAt);
437
+ if (first !== void 0 && Number.isFinite(first)) smoothed[0] = first;
438
+ if (last !== void 0 && Number.isFinite(last)) smoothed[lastIndex] = last;
439
+ return smoothed;
440
+ };
441
+ const buildCameraSpline = (shots, itinerary, mode = "smart") => {
442
+ const line = continuousLine(itinerary.line);
443
+ const cumulative = require_geodesy.cumulativeMeters(line);
444
+ const lookaheadMeters = lookaheadForMode(mode);
445
+ const overallHeading = routeHeadingDeg(line, cumulative);
446
+ const fractions = [];
447
+ const pitches = [];
448
+ const zooms = [];
449
+ const bearings = [];
450
+ const modes = [];
451
+ let heldHeading = overallHeading;
452
+ for (const shot of shots) {
453
+ heldHeading = resolveShotBearing(shot, line, cumulative, lookaheadMeters, heldHeading);
454
+ fractions.push(shot.at);
455
+ pitches.push(shot.pitchDeg);
456
+ zooms.push(shot.zoom);
457
+ bearings.push(heldHeading);
458
+ modes.push(shot.bearingMode);
459
+ }
460
+ return {
461
+ bearings,
462
+ cumulative,
463
+ fractions,
464
+ line,
465
+ lookaheadMeters,
466
+ modes,
467
+ pitches,
468
+ zooms
469
+ };
470
+ };
471
+ const evalSpline = (spline, tNorm) => {
472
+ const clamped = Math.min(1, Math.max(0, tNorm));
473
+ const cursor = cursorAtFraction(spline.line, clamped, spline.lookaheadMeters, spline.cumulative);
474
+ if (spline.fractions.length === 0) return {
475
+ bearing: cursor.bearingDeg,
476
+ center: cursor.point,
477
+ followWeight: 1,
478
+ pitch: 60,
479
+ zoom: 14
480
+ };
481
+ const pitch = clampPitch(uniformCatmullRom(spline.fractions, spline.pitches, clamped));
482
+ const zoom = clampZoom(uniformCatmullRom(spline.fractions, spline.zooms, clamped));
483
+ const { bearing, followWeight } = resolveEvalBearing(spline, clamped, cursor.bearingDeg);
484
+ return {
485
+ bearing,
486
+ center: cursor.point,
487
+ followWeight,
488
+ pitch,
489
+ zoom
490
+ };
491
+ };
492
+ const resolveEvalBearing = (spline, clamped, tangentDeg) => {
493
+ const keyframeBearing = (uniformCatmullRom(spline.fractions, unwrapBearings(spline.bearings), clamped) % 360 + 360) % 360;
494
+ const segment = bearingSegment(spline.fractions, clamped);
495
+ const fromMode = spline.modes[segment.fromIndex] ?? "follow";
496
+ const toMode = spline.modes[segment.toIndex] ?? fromMode;
497
+ const fromFollows = fromMode === "follow";
498
+ const toFollows = toMode === "follow";
499
+ if (fromFollows && toFollows) return {
500
+ bearing: tangentDeg,
501
+ followWeight: 1
502
+ };
503
+ if (!fromFollows && !toFollows) return {
504
+ bearing: keyframeBearing,
505
+ followWeight: 0
506
+ };
507
+ const weight = toFollows ? smoothstep(segment.u) : smoothstep(1 - segment.u);
508
+ return {
509
+ bearing: blendBearing(keyframeBearing, tangentDeg, weight),
510
+ followWeight: weight
511
+ };
512
+ };
513
+ const bearingSegment = (fractions, clamped) => {
514
+ const lastIndex = fractions.length - 1;
515
+ const first = fractions[0] ?? 0;
516
+ const last = fractions[lastIndex] ?? 0;
517
+ if (clamped <= first) return {
518
+ fromIndex: 0,
519
+ toIndex: 0,
520
+ u: 0
521
+ };
522
+ if (clamped >= last) return {
523
+ fromIndex: lastIndex,
524
+ toIndex: lastIndex,
525
+ u: 1
526
+ };
527
+ const fromIndex = segmentIndex(fractions, clamped);
528
+ const toIndex = Math.min(lastIndex, fromIndex + 1);
529
+ const fromFraction = fractions[fromIndex] ?? 0;
530
+ const span = (fractions[toIndex] ?? fromFraction) - fromFraction;
531
+ return {
532
+ fromIndex,
533
+ toIndex,
534
+ u: span > 0 ? (clamped - fromFraction) / span : 0
535
+ };
536
+ };
537
+ const blendBearing = (a, b, w) => {
538
+ return ((a + shortestArcDelta(a, b) * w) % 360 + 360) % 360;
539
+ };
540
+ const smoothstep = (t) => {
541
+ const x = Math.min(1, Math.max(0, t));
542
+ return x * x * (3 - 2 * x);
543
+ };
544
+ const planDurationMs = (plan) => {
545
+ let holds = 0;
546
+ for (const shot of plan.shots) holds += shot.holdMs;
547
+ return plan.targetDurationMs + holds;
548
+ };
549
+ const lookaheadForMode = (mode) => {
550
+ switch (mode) {
551
+ case "drone": return 340;
552
+ case "helicopter": return 200;
553
+ case "overview": return 150;
554
+ case "cinematic": return 70;
555
+ case "chase": return 45;
556
+ default: return 120;
557
+ }
558
+ };
559
+ const resolveShotBearing = (shot, line, cumulative, lookaheadMeters, heldHeading) => {
560
+ if (shot.bearingMode === "value") return shot.bearingDeg ?? 0;
561
+ if (shot.bearingMode === "locked") return heldHeading;
562
+ return cursorAtFraction(line, shot.at, lookaheadMeters, cumulative).bearingDeg;
563
+ };
564
+ const segmentIndex = (knots, target) => {
565
+ let lo = 0;
566
+ let hi = knots.length - 1;
567
+ while (lo < hi - 1) {
568
+ const mid = lo + hi >> 1;
569
+ const value = knots[mid];
570
+ if (value === void 0) break;
571
+ if (value <= target) lo = mid;
572
+ else hi = mid;
573
+ }
574
+ return lo;
575
+ };
576
+ const EYE_CLEARANCE_MARGIN = 120;
577
+ const modeEyeClearanceScale = {
578
+ chase: 1,
579
+ cinematic: 1.1,
580
+ director: 1,
581
+ drone: 1.4,
582
+ helicopter: 1.3,
583
+ overview: 1.15,
584
+ smart: 1
585
+ };
586
+ const RAY_CLEARANCE_MARGIN = 90;
587
+ const SIGHTLINE_SAMPLES = 8;
588
+ const FORWARD_FAN_SAMPLES = 4;
589
+ const FORWARD_STEP_SPAN_FRACTION = .4;
590
+ const LATERAL_OFFSET_SPAN_FRACTION = .25;
591
+ const PITCH_SEARCH_STEP_DEG = 5;
592
+ const ZOOM_FLOOR = 0;
593
+ const ZOOM_CEIL = 22;
594
+ const MAX_CLEARANCE_WIDEN = 5;
595
+ const PITCH_FLOOR = 20;
596
+ const PITCH_CEIL = 85;
597
+ const MIN_COS_PITCH = .05;
598
+ const NULL_DEM_HAZARD_MARGIN = 150;
599
+ const modeAnticipationMeters = {
600
+ chase: 200,
601
+ cinematic: 220,
602
+ director: 300,
603
+ drone: 480,
604
+ helicopter: 420,
605
+ overview: 380,
606
+ smart: 300
607
+ };
608
+ const MIN_CLEARANCE_SAMPLES_PER_WINDOW = 6;
609
+ const MAX_CLEARANCE_SOLVES = 300;
610
+ const clearanceSampleStride = (count, routeLengthMeters, options) => {
611
+ const anticipationMeters = options.anticipationMeters ?? modeAnticipationMeters[options.mode ?? "smart"];
612
+ const windowFrames = Math.max(1, Math.round(sigmaFramesForMeters(anticipationMeters, count, routeLengthMeters)));
613
+ return Math.min(windowFrames, Math.max(1, Math.floor(windowFrames / MIN_CLEARANCE_SAMPLES_PER_WINDOW), Math.ceil(count / MAX_CLEARANCE_SOLVES)));
614
+ };
615
+ const resolveClearanceAdjustments = (frames, itinerary, sampler, options) => {
616
+ const count = frames.length;
617
+ if (count === 0) return {
618
+ pitch: [],
619
+ zoom: []
620
+ };
621
+ const terrain = (lngLat) => {
622
+ const longitude = require_longitude.wrapLongitudePastRange(lngLat[0]);
623
+ const height = sampler(longitude === lngLat[0] ? lngLat : [longitude, lngLat[1]]);
624
+ return height !== null && Number.isFinite(height) ? height : null;
625
+ };
626
+ const viewportHeightPx = options.viewportHeightPx;
627
+ const modeScale = modeEyeClearanceScale[options.mode ?? "smart"] ?? 1;
628
+ const cumulative = require_geodesy.cumulativeMeters(itinerary.line);
629
+ const rawZoom = new Array(count);
630
+ const rawPitch = new Array(count);
631
+ let constrained = false;
632
+ const inputZooms = new Array(count);
633
+ const inputPitches = new Array(count);
634
+ for (let frame = 0; frame < count; frame += 1) {
635
+ const channel = frames[frame];
636
+ if (!channel) {
637
+ inputZooms[frame] = ZOOM_CEIL;
638
+ inputPitches[frame] = PITCH_CEIL;
639
+ continue;
640
+ }
641
+ inputZooms[frame] = channel.zoom;
642
+ inputPitches[frame] = channel.pitch;
643
+ }
644
+ const stride = Math.max(1, Math.floor(options.sampleStride ?? 1));
645
+ const sampleIndices = strideSampleIndices(count, stride);
646
+ const sampledZoom = new Array(sampleIndices.length);
647
+ const sampledPitch = new Array(sampleIndices.length);
648
+ for (let sample = 0; sample < sampleIndices.length; sample += 1) {
649
+ const channel = frames[sampleIndices[sample] ?? 0];
650
+ if (!channel) {
651
+ sampledZoom[sample] = ZOOM_CEIL;
652
+ sampledPitch[sample] = PITCH_CEIL;
653
+ continue;
654
+ }
655
+ const adjustment = frameClearanceAdjustment(channel, itinerary, cumulative, terrain, viewportHeightPx, modeScale);
656
+ sampledZoom[sample] = adjustment.zoom;
657
+ sampledPitch[sample] = adjustment.pitch;
658
+ if (adjustment.zoom < channel.zoom || adjustment.pitch < channel.pitch) constrained = true;
659
+ }
660
+ if (!constrained) return {
661
+ pitch: inputPitches,
662
+ zoom: inputZooms
663
+ };
664
+ interpolateAcrossSamples(rawZoom, sampleIndices, sampledZoom);
665
+ interpolateAcrossSamples(rawPitch, sampleIndices, sampledPitch);
666
+ const anticipationMeters = options.anticipationMeters ?? modeAnticipationMeters[options.mode ?? "smart"];
667
+ const windowFrames = Math.max(1, Math.round(sigmaFramesForMeters(anticipationMeters, count, cumulative[cumulative.length - 1] ?? 0)));
668
+ const dilatedZoom = windowedMinimum(rawZoom, windowFrames);
669
+ const dilatedPitch = windowedMinimum(rawPitch, windowFrames);
670
+ return {
671
+ pitch: atMostInput(smoothSeries(dilatedPitch, windowFrames / 2), inputPitches),
672
+ zoom: atMostInput(smoothSeries(dilatedZoom, windowFrames / 2), inputZooms)
673
+ };
674
+ };
675
+ const atMostInput = (resolved, inputs) => resolved.map((value, frame) => Math.min(value, inputs[frame] ?? value));
676
+ const S_BACKSOLVE_MAX = .95;
677
+ const scaleLift = (requiredEye, centerGround, modeScale) => {
678
+ if (requiredEye === null) return null;
679
+ return centerGround + (requiredEye - centerGround) * modeScale;
680
+ };
681
+ const frameClearanceAdjustment = (channel, itinerary, cumulative, sampler, viewportHeightPx, modeScale) => {
682
+ const [, lat] = channel.center;
683
+ const altitude = require_zoom.zoomToAltitude(channel.zoom, lat, viewportHeightPx);
684
+ const routeFloor = elevationAtFraction(itinerary, channel.fraction, cumulative);
685
+ const centerSample = sampler(channel.center);
686
+ const centerGround = centerSample ?? routeFloor ?? 0;
687
+ const { eye, pitch: clearancePitch, requiredEye } = pitchClearingFrustum(channel, altitude, centerGround, routeFloor, centerSample, modeScale, sampler, viewportHeightPx);
688
+ let clearanceZoom = channel.zoom;
689
+ if (requiredEye !== null && requiredEye > eye.aslHeight) clearanceZoom = Math.min(clearanceZoom, zoomForEyeHeight(requiredEye, centerGround, eye.cosPitch, lat, viewportHeightPx));
690
+ const cappedZoom = Math.max(channel.zoom - MAX_CLEARANCE_WIDEN, clearanceZoom);
691
+ return {
692
+ pitch: Math.max(PITCH_FLOOR, Math.min(PITCH_CEIL, clearancePitch)),
693
+ zoom: Math.max(ZOOM_FLOOR, Math.min(ZOOM_CEIL, cappedZoom))
694
+ };
695
+ };
696
+ const eyeGeometry = (channel, pitch, altitude, centerGround) => {
697
+ const pitchRad = pitch * require_conversions.DEGREES_TO_RADIANS;
698
+ const cosPitch = Math.max(MIN_COS_PITCH, Math.cos(pitchRad));
699
+ const sinPitch = Math.max(0, Math.sin(pitchRad));
700
+ return {
701
+ aslHeight: centerGround + altitude * cosPitch,
702
+ cosPitch,
703
+ lngLat: movePoint(channel.center, channel.bearing + 180, altitude * sinPitch)
704
+ };
705
+ };
706
+ const frustumSamples = (channel, eye, eyeMargin, viewportHeightPx) => {
707
+ const [, lat] = channel.center;
708
+ const span = require_zoom.viewportGroundSpanMeters(channel.zoom, lat, viewportHeightPx);
709
+ const forwardStep = FORWARD_STEP_SPAN_FRACTION * span;
710
+ const lateralOffset = LATERAL_OFFSET_SPAN_FRACTION * span;
711
+ const samples = [];
712
+ samples.push({
713
+ lngLat: eye.lngLat,
714
+ margin: eyeMargin,
715
+ s: 0
716
+ });
717
+ for (let step = 1; step <= SIGHTLINE_SAMPLES; step += 1) {
718
+ const s = step / 9;
719
+ samples.push({
720
+ lngLat: pointAlongRay(eye.lngLat, channel.center, s),
721
+ margin: RAY_CLEARANCE_MARGIN,
722
+ s
723
+ });
724
+ }
725
+ const firstRayS = 1 / 9;
726
+ for (const frac of [.33, .66]) {
727
+ const s = firstRayS * frac;
728
+ samples.push({
729
+ lngLat: pointAlongRay(eye.lngLat, channel.center, s),
730
+ margin: RAY_CLEARANCE_MARGIN,
731
+ s
732
+ });
733
+ }
734
+ for (let step = 1; step <= FORWARD_FAN_SAMPLES; step += 1) {
735
+ const distance = step / 2 * forwardStep;
736
+ const point = movePoint(channel.center, channel.bearing, distance);
737
+ samples.push({
738
+ lngLat: point,
739
+ margin: RAY_CLEARANCE_MARGIN,
740
+ s: axisParameter(eye, channel.center, point)
741
+ });
742
+ }
743
+ for (const along of [1, 2 / 3]) {
744
+ const base = along >= 1 ? channel.center : pointAlongRay(eye.lngLat, channel.center, along);
745
+ for (const side of [90, -90]) {
746
+ const point = movePoint(base, channel.bearing + side, lateralOffset);
747
+ samples.push({
748
+ lngLat: point,
749
+ margin: RAY_CLEARANCE_MARGIN,
750
+ s: axisParameter(eye, channel.center, point)
751
+ });
752
+ }
753
+ }
754
+ return samples;
755
+ };
756
+ const pointAlongRay = (from, to, s) => [from[0] + (to[0] - from[0]) * s, from[1] + (to[1] - from[1]) * s];
757
+ const axisParameter = (eye, center, point) => {
758
+ const lat = center[1];
759
+ const metersPerDegLng = require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR * Math.cos(lat * require_conversions.DEGREES_TO_RADIANS);
760
+ const axisEast = (center[0] - eye.lngLat[0]) * metersPerDegLng;
761
+ const axisNorth = (center[1] - eye.lngLat[1]) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR;
762
+ const axisLengthSquared = axisEast * axisEast + axisNorth * axisNorth;
763
+ if (axisLengthSquared <= 0) return 1;
764
+ const pointEast = (point[0] - eye.lngLat[0]) * metersPerDegLng;
765
+ const pointNorth = (point[1] - eye.lngLat[1]) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR;
766
+ return (pointEast * axisEast + pointNorth * axisNorth) / axisLengthSquared;
767
+ };
768
+ const pitchClearingFrustum = (channel, altitude, centerGround, routeFloor, nearbyKnownGround, modeScale, sampler, viewportHeightPx) => {
769
+ const solveAt = (pitch) => {
770
+ const eye = eyeGeometry(channel, pitch, altitude, centerGround);
771
+ const samples = frustumSamples(channel, eye, EYE_CLEARANCE_MARGIN, viewportHeightPx);
772
+ return {
773
+ eye,
774
+ pitch,
775
+ requiredEye: scaleLift(frustumRequiredEyeHeight(samples, eye, centerGround, routeFloor, nearbyKnownGround, sampler), centerGround, modeScale)
776
+ };
777
+ };
778
+ const startPitch = Math.min(PITCH_CEIL, Math.max(0, channel.pitch));
779
+ let solved = solveAt(startPitch);
780
+ if (startPitch <= PITCH_FLOOR) return solved;
781
+ const steps = Math.max(1, Math.ceil((startPitch - PITCH_FLOOR) / PITCH_SEARCH_STEP_DEG));
782
+ for (let step = 1; step <= steps; step += 1) {
783
+ if (solved.requiredEye === null || solved.requiredEye <= solved.eye.aslHeight) return solved;
784
+ solved = solveAt(Math.max(PITCH_FLOOR, startPitch - step * PITCH_SEARCH_STEP_DEG));
785
+ }
786
+ return solved;
787
+ };
788
+ const frustumRequiredEyeHeight = (samples, eye, centerGround, routeFloor, nearbyKnownGround, sampler) => {
789
+ let required = null;
790
+ for (const sample of samples) {
791
+ const ground = sampleGround(sample.lngLat, routeFloor, nearbyKnownGround, sampler);
792
+ if (ground === null) continue;
793
+ const s = Math.min(S_BACKSOLVE_MAX, Math.max(0, sample.s));
794
+ if (ground <= eye.aslHeight + (centerGround - eye.aslHeight) * s - sample.margin * (1 - s)) continue;
795
+ const neededEye = (ground - centerGround * s) / (1 - s) + sample.margin;
796
+ required = required === null ? neededEye : Math.max(required, neededEye);
797
+ }
798
+ return required;
799
+ };
800
+ const sampleGround = (lngLat, routeFloor, nearbyKnownGround, sampler) => {
801
+ const sampled = sampler(lngLat);
802
+ if (sampled !== null) return sampled;
803
+ if (routeFloor === null && nearbyKnownGround === null) return null;
804
+ return Math.max(routeFloor ?? Number.NEGATIVE_INFINITY, nearbyKnownGround ?? Number.NEGATIVE_INFINITY) + NULL_DEM_HAZARD_MARGIN;
805
+ };
806
+ const zoomForEyeHeight = (eyeHeight, centerGround, cosPitch, latitude, viewportHeightPx) => {
807
+ const altitude = (eyeHeight - centerGround) / cosPitch;
808
+ if (!Number.isFinite(altitude) || altitude <= 0) return ZOOM_FLOOR;
809
+ return require_zoom.altitudeToZoom(altitude, latitude, viewportHeightPx);
810
+ };
811
+ const movePoint = (origin, bearing, meters) => {
812
+ if (meters === 0) return origin;
813
+ const bearingRad = bearing * require_conversions.DEGREES_TO_RADIANS;
814
+ const dNorth = Math.cos(bearingRad) * meters;
815
+ const dEast = Math.sin(bearingRad) * meters;
816
+ const metersPerDegreeLng = require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR * Math.cos(origin[1] * require_conversions.DEGREES_TO_RADIANS);
817
+ const dLat = dNorth / require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR;
818
+ const dLng = metersPerDegreeLng > 0 ? dEast / metersPerDegreeLng : 0;
819
+ return [origin[0] + dLng, origin[1] + dLat];
820
+ };
821
+ const windowedMinimum = (values, radius) => {
822
+ const length = values.length;
823
+ const out = new Array(length);
824
+ for (let i = 0; i < length; i += 1) {
825
+ const from = Math.max(0, i - radius);
826
+ const to = Math.min(length - 1, i + radius);
827
+ let min = Number.POSITIVE_INFINITY;
828
+ for (let j = from; j <= to; j += 1) {
829
+ const value = values[j];
830
+ if (value !== void 0 && value < min) min = value;
831
+ }
832
+ out[i] = Number.isFinite(min) ? min : values[i] ?? ZOOM_CEIL;
833
+ }
834
+ return out;
835
+ };
836
+ const strideSampleIndices = (count, stride) => {
837
+ const indices = [];
838
+ for (let frame = 0; frame < count; frame += stride) indices.push(frame);
839
+ const last = count - 1;
840
+ if (last >= 0 && indices[indices.length - 1] !== last) indices.push(last);
841
+ return indices;
842
+ };
843
+ const interpolateAcrossSamples = (out, indices, values) => {
844
+ for (let sample = 0; sample < indices.length; sample += 1) out[indices[sample] ?? 0] = values[sample] ?? 0;
845
+ for (let sample = 0; sample < indices.length - 1; sample += 1) {
846
+ const fromIndex = indices[sample] ?? 0;
847
+ const toIndex = indices[sample + 1] ?? fromIndex;
848
+ const fromValue = values[sample] ?? 0;
849
+ const toValue = values[sample + 1] ?? fromValue;
850
+ const span = toIndex - fromIndex;
851
+ for (let frame = fromIndex + 1; frame < toIndex; frame += 1) {
852
+ const t = span > 0 ? (frame - fromIndex) / span : 0;
853
+ out[frame] = fromValue + (toValue - fromValue) * t;
854
+ }
855
+ }
856
+ };
857
+ const frameCountFor = (plan) => Math.max(1, Math.ceil(planDurationMs(plan) / require_conversions.MILLISECONDS_PER_SECOND * plan.output.fps));
858
+ const modeLeadScreenFractions = {
859
+ chase: .26,
860
+ cinematic: .24,
861
+ director: .16,
862
+ drone: .08,
863
+ helicopter: 0,
864
+ overview: .12,
865
+ smart: .16
866
+ };
867
+ const LEAD_MAX_METERS = 400;
868
+ const MAX_MARKER_OFFCENTER_FRACTION = .32;
869
+ const modeBearingMinSmoothSeconds = {
870
+ chase: .3,
871
+ cinematic: .35,
872
+ director: .35,
873
+ drone: .9,
874
+ helicopter: .8,
875
+ overview: .6,
876
+ smart: .45
877
+ };
878
+ const modeHoldRevealZoom = {
879
+ chase: .5,
880
+ cinematic: .66,
881
+ director: .4,
882
+ drone: .9,
883
+ helicopter: .8,
884
+ overview: 1.1,
885
+ smart: .42
886
+ };
887
+ const modeHoldSettleZoom = {
888
+ chase: .35,
889
+ cinematic: .42,
890
+ director: .3,
891
+ drone: .6,
892
+ helicopter: .55,
893
+ overview: .9,
894
+ smart: .3
895
+ };
896
+ const BUDGET_KNEE_FRACTION = .8;
897
+ const BUDGET_KNEE_SPAN = .2;
898
+ const EDGE_EASE_SUBNODES = 8;
899
+ const EDGE_EASE_WINDOW_FRACTION = .3;
900
+ const REPRESENTATIVE_TRAVEL_FRACTION = .2;
901
+ const resolveFrameProgressions = (plan) => {
902
+ const shots = plan.shots.length > 0 ? plan.shots : fullRouteFollowShots(plan);
903
+ const timeline = buildTimeline(shots, plan.targetDurationMs);
904
+ const totalMs = planDurationMs(plan);
905
+ const frameCount = frameCountFor(plan);
906
+ const lastFrame = frameCount - 1;
907
+ const fractions = new Array(frameCount);
908
+ for (let frame = 0; frame < frameCount; frame += 1) {
909
+ const timeMs = lastFrame === 0 ? 0 : frame / lastFrame * totalMs;
910
+ fractions[frame] = progressAtTime(timeline, timeMs);
911
+ }
912
+ return fractions;
913
+ };
914
+ const resolveCameraTrack = (plan, itinerary, sampler, clearanceStride) => {
915
+ if (sampler === void 0) {
916
+ const bySignature = cameraTracks.get(itinerary) ?? /* @__PURE__ */ new Map();
917
+ const signature = posePlanSignature(plan);
918
+ const memoized = bySignature.get(signature);
919
+ if (memoized !== void 0) return memoized;
920
+ const resolved = walkCameraTrack(plan, itinerary, void 0, clearanceStride);
921
+ bySignature.delete(signature);
922
+ bySignature.set(signature, resolved);
923
+ if (bySignature.size > 8) {
924
+ const oldest = bySignature.keys().next().value;
925
+ if (oldest !== void 0) bySignature.delete(oldest);
926
+ }
927
+ cameraTracks.set(itinerary, bySignature);
928
+ return resolved;
929
+ }
930
+ return walkCameraTrack(plan, itinerary, sampler, clearanceStride);
931
+ };
932
+ const cameraTracks = /* @__PURE__ */ new WeakMap();
933
+ const walkCameraTrack = (plan, itinerary, sampler, clearanceStride) => {
934
+ refuseUnplannableRoute("resolveCameraTrack", itinerary);
935
+ const shots = plan.shots.length > 0 ? plan.shots : fullRouteFollowShots(plan);
936
+ const spline = buildCameraSpline(shots, itinerary, plan.mode);
937
+ const timeline = buildTimeline(shots, plan.targetDurationMs);
938
+ const totalMs = planDurationMs(plan);
939
+ const fps = plan.output.fps;
940
+ const line = continuousLine(itinerary.line);
941
+ const cumulative = require_geodesy.cumulativeMeters(line);
942
+ const routeMeters = cumulative[cumulative.length - 1] ?? 0;
943
+ const fractions = resolveFrameProgressions(plan);
944
+ const frameCount = fractions.length;
945
+ const lastFrame = frameCount - 1;
946
+ const positions = fractions.map((fraction) => fraction * lastFrame);
947
+ const raw = sampleRawChannels(spline, line, cumulative, plan.mode, frameCount);
948
+ const smoothed = smoothTrackChannels(raw, plan.mode, routeMeters, fps);
949
+ const centerLngs = sampleSeriesAt(smoothed.centerLngs, positions);
950
+ const centerLats = sampleSeriesAt(smoothed.centerLats, positions);
951
+ const pitches = sampleSeriesAt(smoothed.pitches, positions);
952
+ const zooms = sampleSeriesAt(smoothed.zooms, positions);
953
+ const bearings = sampleCircularSeriesAt(smoothed.bearings, positions);
954
+ applyHoldZoomShaping(zooms, shots, plan.mode, totalMs, lastFrame);
955
+ const markers = resolveMarkerSeries(plan, itinerary);
956
+ clampCenterToMarkerBudget(centerLngs, centerLats, markers, zooms);
957
+ const clearance = sampler ? resolveClearanceAdjustments(buildClearanceFrames(frameCount, timeline, totalMs, centerLngs, centerLats, pitches, zooms, bearings), itinerary, sampler, {
958
+ mode: plan.mode,
959
+ sampleStride: clearanceStride
960
+ }) : null;
961
+ const poses = new Array(frameCount);
962
+ for (let frame = 0; frame < frameCount; frame += 1) {
963
+ const frameZoom = clampZoom(zooms[frame] ?? raw.zooms[frame] ?? 0);
964
+ const framePitch = pitches[frame] ?? raw.pitches[frame] ?? 0;
965
+ const clearanceZoom = clearance?.zoom[frame];
966
+ const clearancePitch = clearance?.pitch[frame];
967
+ poses[frame] = {
968
+ bearing: bearings[frame] ?? raw.bearings[frame] ?? 0,
969
+ center: [centerLngs[frame] ?? raw.baseLngs[frame] ?? 0, centerLats[frame] ?? raw.baseLats[frame] ?? 0],
970
+ pitch: clearancePitch === void 0 ? framePitch : Math.min(framePitch, clearancePitch),
971
+ zoom: clearanceZoom === void 0 ? frameZoom : Math.min(frameZoom, clearanceZoom)
972
+ };
973
+ }
974
+ return poses;
975
+ };
976
+ const sampleRawChannels = (spline, line, cumulative, mode, frameCount) => {
977
+ const lastFrame = frameCount - 1;
978
+ const routeMeters = cumulative[cumulative.length - 1] ?? 0;
979
+ const leadFraction = modeLeadScreenFractions[mode];
980
+ const rawBaseLngs = new Array(frameCount);
981
+ const rawBaseLats = new Array(frameCount);
982
+ const rawLeadLngs = new Array(frameCount);
983
+ const rawLeadLats = new Array(frameCount);
984
+ const rawPitches = new Array(frameCount);
985
+ const rawZooms = new Array(frameCount);
986
+ const rawBearings = new Array(frameCount);
987
+ for (let k = 0; k < frameCount; k += 1) {
988
+ const progress = lastFrame === 0 ? 0 : k / lastFrame;
989
+ const pose = evalSpline(spline, progress);
990
+ const lat = pose.center[1];
991
+ const metersFromStart = progress * routeMeters;
992
+ const base = pointAtMeters(line, metersFromStart, cumulative);
993
+ const leadM = Math.min(LEAD_MAX_METERS, metersFromStart, pose.followWeight * leadFraction * require_zoom.viewportGroundSpanMeters(pose.zoom, lat));
994
+ const led = pointAtMeters(line, metersFromStart + leadM, cumulative);
995
+ rawBaseLngs[k] = base[0];
996
+ rawBaseLats[k] = base[1];
997
+ rawLeadLngs[k] = led[0] - base[0];
998
+ rawLeadLats[k] = led[1] - base[1];
999
+ rawPitches[k] = pose.pitch;
1000
+ rawZooms[k] = pose.zoom;
1001
+ rawBearings[k] = pose.bearing;
1002
+ }
1003
+ return {
1004
+ baseLats: rawBaseLats,
1005
+ baseLngs: rawBaseLngs,
1006
+ bearings: rawBearings,
1007
+ leadLats: rawLeadLats,
1008
+ leadLngs: rawLeadLngs,
1009
+ pitches: rawPitches,
1010
+ zooms: rawZooms
1011
+ };
1012
+ };
1013
+ const smoothTrackChannels = (raw, mode, routeMeters, fps) => {
1014
+ const frameCount = raw.pitches.length;
1015
+ const sigmas = modeSmoothingSigmas[mode];
1016
+ const centerSigmaFrames = sigmaFramesForMeters(sigmas.center, frameCount, routeMeters);
1017
+ const pitchZoomSigmaFrames = sigmaFramesForMeters(sigmas.pitchZoom, frameCount, routeMeters);
1018
+ const bearingSigmaFrames = bearingSigmaFramesFor(mode, frameCount, routeMeters, fps);
1019
+ const leadTaper = endpointTaper(frameCount, Math.ceil(centerSigmaFrames * 3));
1020
+ const smoothedCenterLngs = addSeries(smoothPositionSeries(raw.baseLngs, centerSigmaFrames), multiplySeries(smoothSeries(raw.leadLngs, centerSigmaFrames), leadTaper));
1021
+ const smoothedCenterLats = addSeries(smoothPositionSeries(raw.baseLats, centerSigmaFrames), multiplySeries(smoothSeries(raw.leadLats, centerSigmaFrames), leadTaper));
1022
+ const smoothedPitches = smoothSeries(raw.pitches, pitchZoomSigmaFrames);
1023
+ const smoothedZooms = smoothSeries(raw.zooms, pitchZoomSigmaFrames);
1024
+ return {
1025
+ bearings: smoothSeries(unwrapBearings(raw.bearings), bearingSigmaFrames).map((value) => (value % 360 + 360) % 360),
1026
+ centerLats: smoothedCenterLats,
1027
+ centerLngs: smoothedCenterLngs,
1028
+ pitches: smoothedPitches,
1029
+ zooms: smoothedZooms
1030
+ };
1031
+ };
1032
+ const resolveMarkerSeries = (plan, itinerary) => {
1033
+ const line = continuousLine(itinerary.line);
1034
+ const cumulative = require_geodesy.cumulativeMeters(line);
1035
+ const routeMeters = cumulative[cumulative.length - 1] ?? 0;
1036
+ const fractions = resolveFrameProgressions(plan);
1037
+ const frameCount = fractions.length;
1038
+ const markers = new Array(frameCount);
1039
+ for (let frame = 0; frame < frameCount; frame += 1) markers[frame] = pointAtMeters(line, (fractions[frame] ?? 0) * routeMeters, cumulative);
1040
+ return markers;
1041
+ };
1042
+ const resolveRouteMarkers = (plan, itinerary) => {
1043
+ refuseUnplannableRoute("resolveRouteMarkers", itinerary);
1044
+ return resolveMarkerSeries(plan, itinerary);
1045
+ };
1046
+ const clearanceStrideFor = (plan, itinerary) => clearanceSampleStride(frameCountFor(plan), require_geodesy.routeLengthMeters(itinerary.line), { mode: plan.mode });
1047
+ const posePlanSignature = (plan) => {
1048
+ const shots = plan.shots.map((shot) => `${shot.at},${shot.bearingDeg ?? ""},${shot.bearingMode},${shot.holdMs},${shot.pitchDeg},${shot.speedScale},${shot.zoom}`).join(";");
1049
+ return `${plan.mode}|${plan.targetDurationMs}|${plan.output.fps}|${shots}`;
1050
+ };
1051
+ const representativeStillFraction = (plan) => {
1052
+ if (plan.mode === "director" || plan.shots.length === 0) return 0;
1053
+ const total = planDurationMs(plan);
1054
+ if (total <= 0) return 0;
1055
+ const introHoldMs = [...plan.shots].sort((a, b) => a.at - b.at)[0]?.holdMs ?? 0;
1056
+ const introEnd = Math.min(1, introHoldMs / total);
1057
+ return Math.min(1, introEnd + (1 - introEnd) * REPRESENTATIVE_TRAVEL_FRACTION);
1058
+ };
1059
+ const bearingSigmaFramesFor = (mode, frameCount, routeMeters, fps) => {
1060
+ const distanceFrames = sigmaFramesForMeters(modeSmoothingSigmas[mode].bearing, frameCount, routeMeters);
1061
+ const timeFloorFrames = modeBearingMinSmoothSeconds[mode] * fps;
1062
+ return Math.min(frameCount / 3, Math.max(distanceFrames, timeFloorFrames));
1063
+ };
1064
+ const sampleSeriesAt = (series, positions) => {
1065
+ const length = series.length;
1066
+ return positions.map((position) => {
1067
+ if (length === 0) return 0;
1068
+ const clamped = Math.min(length - 1, Math.max(0, position));
1069
+ const lo = Math.floor(clamped);
1070
+ const hi = Math.min(length - 1, lo + 1);
1071
+ const frac = clamped - lo;
1072
+ const a = series[lo] ?? 0;
1073
+ return a + ((series[hi] ?? a) - a) * frac;
1074
+ });
1075
+ };
1076
+ const sampleCircularSeriesAt = (series, positions) => {
1077
+ const length = series.length;
1078
+ return positions.map((position) => {
1079
+ if (length === 0) return 0;
1080
+ const clamped = Math.min(length - 1, Math.max(0, position));
1081
+ const lo = Math.floor(clamped);
1082
+ const hi = Math.min(length - 1, lo + 1);
1083
+ const frac = clamped - lo;
1084
+ const a = series[lo] ?? 0;
1085
+ const delta = (((series[hi] ?? a) - a) % 360 + 360) % 360;
1086
+ return ((a + (delta > 180 ? delta - 360 : delta) * frac) % 360 + 360) % 360;
1087
+ });
1088
+ };
1089
+ const addSeries = (a, b) => a.map((value, index) => value + (b[index] ?? 0));
1090
+ const multiplySeries = (values, weights) => values.map((value, index) => value * (weights[index] ?? 1));
1091
+ const endpointTaper = (frameCount, rampFrames) => {
1092
+ const lastFrame = frameCount - 1;
1093
+ const ramp = Math.max(1, rampFrames);
1094
+ const out = new Array(frameCount);
1095
+ for (let i = 0; i < frameCount; i += 1) {
1096
+ const rise = smoothstep(i / ramp);
1097
+ const fall = smoothstep((lastFrame - i) / ramp);
1098
+ out[i] = rise * fall;
1099
+ }
1100
+ return out;
1101
+ };
1102
+ const recoverHoldWindows = (shots, targetDurationMs) => {
1103
+ const sorted = [...shots].sort((a, b) => a.at - b.at);
1104
+ const first = sorted[0];
1105
+ if (!first) return [];
1106
+ const lastIndex = sorted.length - 1;
1107
+ let weightTotal = 0;
1108
+ const legWeights = [];
1109
+ for (let index = 1; index < sorted.length; index += 1) {
1110
+ const from = sorted[index - 1];
1111
+ const to = sorted[index];
1112
+ if (!from || !to) {
1113
+ legWeights.push(0);
1114
+ continue;
1115
+ }
1116
+ const weight = Math.max(0, to.at - from.at) / Math.max(.1, to.speedScale);
1117
+ legWeights.push(weight);
1118
+ weightTotal += weight;
1119
+ }
1120
+ const windows = [];
1121
+ let timeMs = 0;
1122
+ if (first.holdMs > 0) {
1123
+ windows.push({
1124
+ enterMs: timeMs,
1125
+ exitMs: timeMs + first.holdMs,
1126
+ position: "intro",
1127
+ shot: first
1128
+ });
1129
+ timeMs += first.holdMs;
1130
+ }
1131
+ for (let index = 1; index < sorted.length; index += 1) {
1132
+ const to = sorted[index];
1133
+ if (!to) continue;
1134
+ const weight = legWeights[index - 1] ?? 0;
1135
+ const legMs = weightTotal > 0 ? weight / weightTotal * targetDurationMs : 0;
1136
+ timeMs += legMs;
1137
+ if (to.holdMs > 0) {
1138
+ windows.push({
1139
+ enterMs: timeMs,
1140
+ exitMs: timeMs + to.holdMs,
1141
+ position: index === lastIndex ? "outro" : "mid",
1142
+ shot: to
1143
+ });
1144
+ timeMs += to.holdMs;
1145
+ }
1146
+ }
1147
+ return windows;
1148
+ };
1149
+ const applyHoldZoomShaping = (zooms, shots, mode, totalMs, lastFrame) => {
1150
+ if (totalMs <= 0 || lastFrame <= 0) return;
1151
+ const reveal = modeHoldRevealZoom[mode];
1152
+ const settle = modeHoldSettleZoom[mode];
1153
+ for (const window of recoverHoldWindows(shots, totalMs - sumHolds(shots))) {
1154
+ if (mode === "director" && window.shot.bearingMode !== "follow") continue;
1155
+ const dwellMs = window.exitMs - window.enterMs;
1156
+ if (dwellMs <= 0) continue;
1157
+ const fromFrame = Math.max(0, Math.ceil(window.enterMs / totalMs * lastFrame));
1158
+ const toFrame = Math.min(lastFrame, Math.floor(window.exitMs / totalMs * lastFrame));
1159
+ for (let frame = fromFrame; frame <= toFrame; frame += 1) {
1160
+ const timeMs = frame / lastFrame * totalMs;
1161
+ const u = Math.min(1, Math.max(0, (timeMs - window.enterMs) / dwellMs));
1162
+ const offset = holdZoomOffset(window.position, u, reveal, settle);
1163
+ zooms[frame] = (zooms[frame] ?? 0) + offset;
1164
+ }
1165
+ }
1166
+ };
1167
+ const holdZoomOffset = (position, u, reveal, settle) => {
1168
+ if (position === "intro") return -reveal * (1 - easeInOutCubic(u));
1169
+ if (position === "outro") return -settle * easeInOutCubic(u);
1170
+ const s = Math.sin(Math.PI * u);
1171
+ return -.2 * s * s;
1172
+ };
1173
+ const clampCenterToMarkerBudget = (centerLngs, centerLats, markers, zooms) => {
1174
+ for (let frame = 0; frame < centerLngs.length; frame += 1) {
1175
+ const marker = markers[frame];
1176
+ const centerLng = centerLngs[frame];
1177
+ const centerLat = centerLats[frame];
1178
+ if (!marker || centerLng === void 0 || centerLat === void 0) continue;
1179
+ const budget = MAX_MARKER_OFFCENTER_FRACTION * require_zoom.viewportGroundSpanMeters(zooms[frame] ?? 0, centerLat);
1180
+ if (budget <= 0) continue;
1181
+ const metersPerDegLng = require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR * Math.cos(centerLat * require_conversions.DEGREES_TO_RADIANS);
1182
+ const dEast = (centerLng - marker[0]) * metersPerDegLng;
1183
+ const dNorth = (centerLat - marker[1]) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR;
1184
+ const offset = Math.hypot(dEast, dNorth);
1185
+ if (offset <= BUDGET_KNEE_FRACTION * budget || offset <= 0) continue;
1186
+ const scale = budget * (BUDGET_KNEE_FRACTION + BUDGET_KNEE_SPAN * Math.tanh((offset / budget - BUDGET_KNEE_FRACTION) / BUDGET_KNEE_SPAN)) / offset;
1187
+ centerLngs[frame] = marker[0] + (centerLng - marker[0]) * scale;
1188
+ centerLats[frame] = marker[1] + (centerLat - marker[1]) * scale;
1189
+ }
1190
+ };
1191
+ const easeInOutCubic = (t) => {
1192
+ const x = Math.min(1, Math.max(0, t));
1193
+ return x < .5 ? 4 * x * x * x : 1 - (-2 * x + 2) ** 3 / 2;
1194
+ };
1195
+ const sumHolds = (shots) => {
1196
+ let holds = 0;
1197
+ for (const shot of shots) holds += shot.holdMs;
1198
+ return holds;
1199
+ };
1200
+ const buildClearanceFrames = (frameCount, timeline, totalMs, centerLngs, centerLats, pitches, zooms, bearings) => {
1201
+ const lastFrame = frameCount - 1;
1202
+ const frames = new Array(frameCount);
1203
+ for (let frame = 0; frame < frameCount; frame += 1) {
1204
+ const timeMs = lastFrame === 0 ? 0 : frame / lastFrame * totalMs;
1205
+ frames[frame] = {
1206
+ bearing: bearings[frame] ?? 0,
1207
+ center: [centerLngs[frame] ?? 0, centerLats[frame] ?? 0],
1208
+ fraction: progressAtTime(timeline, timeMs),
1209
+ pitch: pitches[frame] ?? 0,
1210
+ zoom: zooms[frame] ?? 0
1211
+ };
1212
+ }
1213
+ return frames;
1214
+ };
1215
+ const buildTimeline = (shots, targetDurationMs) => {
1216
+ const sorted = [...shots].sort((a, b) => a.at - b.at);
1217
+ const first = sorted[0];
1218
+ if (!first) return [{
1219
+ fraction: 0,
1220
+ timeMs: 0
1221
+ }];
1222
+ let weightTotal = 0;
1223
+ const legWeights = [];
1224
+ for (let index = 1; index < sorted.length; index += 1) {
1225
+ const from = sorted[index - 1];
1226
+ const to = sorted[index];
1227
+ if (!from || !to) {
1228
+ legWeights.push(0);
1229
+ continue;
1230
+ }
1231
+ const weight = Math.max(0, to.at - from.at) / Math.max(.1, to.speedScale);
1232
+ legWeights.push(weight);
1233
+ weightTotal += weight;
1234
+ }
1235
+ const nodes = [];
1236
+ let timeMs = 0;
1237
+ nodes.push({
1238
+ fraction: first.at,
1239
+ timeMs
1240
+ });
1241
+ if (first.holdMs > 0) {
1242
+ timeMs += first.holdMs;
1243
+ nodes.push({
1244
+ fraction: first.at,
1245
+ timeMs
1246
+ });
1247
+ }
1248
+ const lastLegIndex = sorted.length - 1;
1249
+ for (let index = 1; index < sorted.length; index += 1) {
1250
+ const from = sorted[index - 1];
1251
+ const to = sorted[index];
1252
+ if (!from || !to) continue;
1253
+ const weight = legWeights[index - 1] ?? 0;
1254
+ const legMs = weightTotal > 0 ? weight / weightTotal * targetDurationMs : 0;
1255
+ const ease = edgeEaseFor(index, lastLegIndex);
1256
+ if (ease && legMs > 0 && to.at !== from.at) for (let sub = 1; sub <= EDGE_EASE_SUBNODES; sub += 1) {
1257
+ const u = sub / 9;
1258
+ nodes.push({
1259
+ fraction: from.at + (to.at - from.at) * ease(u),
1260
+ timeMs: timeMs + legMs * u
1261
+ });
1262
+ }
1263
+ timeMs += legMs;
1264
+ nodes.push({
1265
+ fraction: to.at,
1266
+ timeMs
1267
+ });
1268
+ if (to.holdMs > 0) {
1269
+ timeMs += to.holdMs;
1270
+ nodes.push({
1271
+ fraction: to.at,
1272
+ timeMs
1273
+ });
1274
+ }
1275
+ }
1276
+ return nodes;
1277
+ };
1278
+ const edgeEaseFor = (legIndex, lastLegIndex) => {
1279
+ const isFirst = legIndex === 1;
1280
+ const isLast = legIndex === lastLegIndex;
1281
+ if (isFirst && isLast) return (u) => accelerateDecelerateProfile(u, EDGE_EASE_WINDOW_FRACTION);
1282
+ if (isFirst) return (u) => accelerateProfile(u, EDGE_EASE_WINDOW_FRACTION);
1283
+ if (isLast) return (u) => decelerateProfile(u, EDGE_EASE_WINDOW_FRACTION);
1284
+ return null;
1285
+ };
1286
+ const accelerateProfile = (u, a) => {
1287
+ const cruise = 1 / (1 - a / 2);
1288
+ return u <= a ? cruise * u * u / (2 * a) : cruise * (u - a / 2);
1289
+ };
1290
+ const decelerateProfile = (u, a) => {
1291
+ const cruise = 1 / (1 - a / 2);
1292
+ return u >= 1 - a ? 1 - cruise * (1 - u) * (1 - u) / (2 * a) : cruise * u;
1293
+ };
1294
+ const accelerateDecelerateProfile = (u, a) => {
1295
+ const cruise = 1 / (1 - a);
1296
+ if (u <= a) return cruise * u * u / (2 * a);
1297
+ if (u >= 1 - a) return 1 - cruise * (1 - u) * (1 - u) / (2 * a);
1298
+ return cruise * (u - a / 2);
1299
+ };
1300
+ const progressAtTime = (nodes, timeMs) => {
1301
+ const first = nodes[0];
1302
+ const last = nodes[nodes.length - 1];
1303
+ if (!first || !last) return 0;
1304
+ if (timeMs <= first.timeMs) return first.fraction;
1305
+ if (timeMs >= last.timeMs) return last.fraction;
1306
+ for (let index = 1; index < nodes.length; index += 1) {
1307
+ const from = nodes[index - 1];
1308
+ const to = nodes[index];
1309
+ if (!from || !to) continue;
1310
+ if (timeMs <= to.timeMs) {
1311
+ const span = to.timeMs - from.timeMs;
1312
+ if (span <= 0) return to.fraction;
1313
+ const ratio = (timeMs - from.timeMs) / span;
1314
+ return from.fraction + (to.fraction - from.fraction) * ratio;
1315
+ }
1316
+ }
1317
+ return last.fraction;
1318
+ };
1319
+ const fullRouteFollowShots = (plan) => [{
1320
+ at: 0,
1321
+ bearingMode: "follow",
1322
+ holdMs: 0,
1323
+ id: `${plan.mode}-full-itinerary-start`,
1324
+ pitchDeg: 60,
1325
+ speedScale: 1,
1326
+ zoom: 14
1327
+ }, {
1328
+ at: 1,
1329
+ bearingMode: "follow",
1330
+ holdMs: 0,
1331
+ id: `${plan.mode}-full-itinerary-end`,
1332
+ pitchDeg: 60,
1333
+ speedScale: 1,
1334
+ zoom: 14
1335
+ }];
1336
+ const buildAscentPrefix = (points) => {
1337
+ const prefix = new Array(points.length);
1338
+ let total = 0;
1339
+ for (let index = 0; index < points.length; index += 1) {
1340
+ if (index > 0) {
1341
+ const delta = (points[index]?.elevation ?? 0) - (points[index - 1]?.elevation ?? 0);
1342
+ if (delta > 0) total += delta;
1343
+ }
1344
+ prefix[index] = total;
1345
+ }
1346
+ return prefix;
1347
+ };
1348
+ const resolveProfileSamples = (plan, itinerary, source) => {
1349
+ const bySource = profileSamples.get(itinerary) ?? /* @__PURE__ */ new WeakMap();
1350
+ const bySignature = bySource.get(source) ?? /* @__PURE__ */ new Map();
1351
+ const signature = posePlanSignature(plan);
1352
+ const memoized = bySignature.get(signature);
1353
+ if (memoized !== void 0) return memoized;
1354
+ const samples = walkProfileSamples(plan, itinerary, source);
1355
+ bySignature.set(signature, samples);
1356
+ if (bySignature.size > 8) {
1357
+ const oldest = bySignature.keys().next().value;
1358
+ if (oldest !== void 0) bySignature.delete(oldest);
1359
+ }
1360
+ bySource.set(source, bySignature);
1361
+ profileSamples.set(itinerary, bySource);
1362
+ return samples;
1363
+ };
1364
+ const profileSamples = /* @__PURE__ */ new WeakMap();
1365
+ const walkProfileSamples = (plan, itinerary, source) => {
1366
+ refuseUnplannableRoute("resolveProfileSamples", itinerary);
1367
+ const fractions = resolveFrameProgressions(plan);
1368
+ const cumulative = require_geodesy.cumulativeMeters(itinerary.line);
1369
+ const ground = routeGroundMeters(itinerary, cumulative);
1370
+ const flightMeters = cumulative[cumulative.length - 1] ?? 0;
1371
+ const points = source.elevationPoints;
1372
+ const ascentPrefix = buildAscentPrefix(points);
1373
+ const climbs = require_climbs.detectClimbs(points);
1374
+ return fractions.map((fraction) => {
1375
+ const distanceKm = groundMetersAt(cumulative, ground, fraction * flightMeters) / require_conversions.METERS_PER_KILOMETER;
1376
+ const index = require_axisLookup.nearestRoutePointIndexAt(points, distanceKm);
1377
+ const span = require_axisLookup.stretchAt(source.segmentSpans, distanceKm);
1378
+ const climb = require_climbs.climbAt(climbs, distanceKm);
1379
+ return {
1380
+ ascentM: index < 0 ? null : ascentPrefix[index] ?? null,
1381
+ climbAvgGradePercent: climb?.avgGradePercent ?? null,
1382
+ climbCategory: climb?.category ?? null,
1383
+ climbEndKm: climb?.endKm ?? null,
1384
+ distanceKm,
1385
+ elevation: index < 0 ? null : points[index]?.elevation ?? null,
1386
+ progress: fraction,
1387
+ segmentName: span?.name ?? null,
1388
+ slopeDeg: require_axisLookup.bandValueAt(source.slopeBands, distanceKm),
1389
+ speed: span?.speed ?? null,
1390
+ surface: require_axisLookup.bandValueAt(source.surfaceBands, distanceKm),
1391
+ waytype: require_axisLookup.bandValueAt(source.waytypeBands, distanceKm)
1392
+ };
1393
+ });
1394
+ };
1395
+ const synchronousCameraPlanner = () => ({
1396
+ resolveSamples: resolveProfileSamples,
1397
+ resolveTrack: resolveCameraTrack
1398
+ });
1399
+ const measureNames = {
1400
+ resolveSamples: "mountaya.camera.resolveSamples",
1401
+ resolveTrack: "mountaya.camera.resolveTrack"
1402
+ };
1403
+ const measuredCameraPlanner = (planner, onMeasure) => {
1404
+ const measure = (name, resolve) => {
1405
+ const started = performance.now();
1406
+ const result = resolve();
1407
+ const durationMs = performance.now() - started;
1408
+ performance.measure?.(name, {
1409
+ duration: durationMs,
1410
+ start: started
1411
+ });
1412
+ onMeasure?.(name, durationMs);
1413
+ return result;
1414
+ };
1415
+ return {
1416
+ resolveSamples: (plan, itinerary, source) => measure(measureNames.resolveSamples, () => planner.resolveSamples(plan, itinerary, source)),
1417
+ resolveTrack: (plan, itinerary, sampler, clearanceStride) => measure(measureNames.resolveTrack, () => planner.resolveTrack(plan, itinerary, sampler, clearanceStride))
1418
+ };
1419
+ };
1420
+ const routeContentOf = (route) => {
1421
+ const line = [];
1422
+ for (let index = 0; index < route.line.length; index += 1) {
1423
+ const vertex = route.line[index];
1424
+ line.push(vertex?.[0], vertex?.[1]);
1425
+ }
1426
+ return {
1427
+ elevations: [...route.elevations ?? []],
1428
+ jumps: [...route.jumps ?? []],
1429
+ line
1430
+ };
1431
+ };
1432
+ const holdsRouteContent = (route, content) => {
1433
+ const elevations = route.elevations ?? [];
1434
+ const jumps = route.jumps ?? [];
1435
+ if (route.line.length * 2 !== content.line.length || elevations.length !== content.elevations.length || jumps.length !== content.jumps.length) return false;
1436
+ for (let index = 0; index < jumps.length; index += 1) if (!Object.is(jumps[index], content.jumps[index])) return false;
1437
+ for (let index = 0; index < route.line.length; index += 1) {
1438
+ const vertex = route.line[index];
1439
+ if (!Object.is(vertex?.[0], content.line[index * 2]) || !Object.is(vertex?.[1], content.line[index * 2 + 1])) return false;
1440
+ }
1441
+ for (let index = 0; index < elevations.length; index += 1) if (!Object.is(elevations[index], content.elevations[index])) return false;
1442
+ return true;
1443
+ };
1444
+ const sameRouteContent = (a, b) => holdsRouteContent(a, routeContentOf(b));
1445
+ const capturesSweptViewports = (swept, captured) => {
1446
+ if (swept.length !== captured.length) return false;
1447
+ return swept.every((pose, index) => {
1448
+ const frame = captured[index];
1449
+ return frame !== void 0 && frame.zoom === pose.zoom && frame.pitch === pose.pitch && frame.bearing === pose.bearing && frame.center[0] === pose.center[0] && frame.center[1] === pose.center[1];
1450
+ });
1451
+ };
1452
+ const defaultVideoFlightProfile = {
1453
+ design: "graph",
1454
+ enabled: false,
1455
+ language: "en",
1456
+ length: "metric",
1457
+ pace: "per-time",
1458
+ slope: "degrees"
1459
+ };
1460
+ const DEFAULT_POSE_CACHE_SIZE = 4;
1461
+ const ROUTE_VERTICES_MIN = 2;
1462
+ const routeBounds = (route) => {
1463
+ let west = Number.POSITIVE_INFINITY;
1464
+ let south = Number.POSITIVE_INFINITY;
1465
+ let east = Number.NEGATIVE_INFINITY;
1466
+ let north = Number.NEGATIVE_INFINITY;
1467
+ for (const [lng, lat] of continuousLine(route.line)) {
1468
+ if (lng === void 0 || lat === void 0) continue;
1469
+ west = Math.min(west, lng);
1470
+ south = Math.min(south, lat);
1471
+ east = Math.max(east, lng);
1472
+ north = Math.max(north, lat);
1473
+ }
1474
+ return Number.isFinite(west) ? [
1475
+ west,
1476
+ south,
1477
+ east,
1478
+ north
1479
+ ] : null;
1480
+ };
1481
+ const flightError = (flight, cause) => require_errors.errorFrom(cause, `${flight} failed.`);
1482
+ const poseCacheSizeFrom = (size) => {
1483
+ if (size === void 0) return DEFAULT_POSE_CACHE_SIZE;
1484
+ if (!Number.isInteger(size) || size < 0) throw new require_errors.MountayaElementsError(`VideoFlightEngine: poseCacheSize is ${String(size)}; pass a whole number of flights, 0 or more, or omit it for ${DEFAULT_POSE_CACHE_SIZE}.`);
1485
+ return size;
1486
+ };
1487
+ const planFrom = (plan) => {
1488
+ refuseUnplannablePlan("VideoFlightEngine", plan, "plan");
1489
+ return plan;
1490
+ };
1491
+ const couldNotStart = (result) => result.reason === "unavailable";
1492
+ var VideoFlightEngine = class {
1493
+ flight;
1494
+ listeners = /* @__PURE__ */ new Set();
1495
+ map;
1496
+ planner;
1497
+ poseCacheSize;
1498
+ run = null;
1499
+ pausedAt = null;
1500
+ poseCache = /* @__PURE__ */ new Map();
1501
+ demEpoch = 0;
1502
+ routeRevision = 0;
1503
+ routeContent = null;
1504
+ terrainWarmedRevision = null;
1505
+ flightWarmedRevision = null;
1506
+ terrainWarm = null;
1507
+ flightWarm = null;
1508
+ recordWarm = null;
1509
+ landings = /* @__PURE__ */ new Set();
1510
+ seekStoppedFlight = false;
1511
+ lastRecording = null;
1512
+ disposal = new AbortController();
1513
+ get disposed() {
1514
+ return this.disposal.signal.aborted;
1515
+ }
1516
+ flightSequence = 0;
1517
+ constructor(options) {
1518
+ this.map = options.map ?? null;
1519
+ this.planner = options.planner ?? synchronousCameraPlanner();
1520
+ this.poseCacheSize = poseCacheSizeFrom(options.poseCacheSize);
1521
+ this.flight = {
1522
+ activityGlyphUrl: null,
1523
+ plan: planFrom(options.plan),
1524
+ profile: defaultVideoFlightProfile,
1525
+ profileSource: null,
1526
+ route: null,
1527
+ status: { kind: "idle" }
1528
+ };
1529
+ }
1530
+ getSnapshot() {
1531
+ return this.flight;
1532
+ }
1533
+ subscribe(listener) {
1534
+ this.listeners.add(listener);
1535
+ return () => {
1536
+ this.listeners.delete(listener);
1537
+ };
1538
+ }
1539
+ get recording() {
1540
+ return this.lastRecording;
1541
+ }
1542
+ setPlan(plan) {
1543
+ this.commit({ plan: planFrom(plan) });
1544
+ }
1545
+ setRoute(route) {
1546
+ const content = this.routeContent;
1547
+ if (!(route === null || content === null ? route === null !== (content === null) : !holdsRouteContent(route, content))) {
1548
+ this.commit({ route });
1549
+ return;
1550
+ }
1551
+ this.routeChanged(route);
1552
+ const status = this.flight.status.kind;
1553
+ if (status !== "previewing" && status !== "parked") {
1554
+ this.commit({ route });
1555
+ return;
1556
+ }
1557
+ if (status === "previewing" && this.run?.kind === "preview" && this.run.flying) {
1558
+ this.run.controller.abort();
1559
+ this.run = null;
1560
+ }
1561
+ this.commit({
1562
+ route,
1563
+ status: { kind: "idle" }
1564
+ });
1565
+ }
1566
+ setProfile(profile) {
1567
+ this.commit({ profile: {
1568
+ ...this.flight.profile,
1569
+ ...profile
1570
+ } });
1571
+ }
1572
+ setProfileSource(profileSource) {
1573
+ this.commit({ profileSource });
1574
+ }
1575
+ setActivityGlyph(activityGlyphUrl) {
1576
+ this.commit({ activityGlyphUrl });
1577
+ }
1578
+ preview() {
1579
+ return this.startPreview(false);
1580
+ }
1581
+ play() {
1582
+ return this.startPreview(true);
1583
+ }
1584
+ async startPreview(resume) {
1585
+ const map = this.map;
1586
+ if (!map) return {
1587
+ ok: false,
1588
+ reason: "no-map"
1589
+ };
1590
+ const run = this.beginRun("preview");
1591
+ if (run.signal.aborted) return {
1592
+ ok: false,
1593
+ reason: "aborted"
1594
+ };
1595
+ this.readRoute();
1596
+ const status = this.flight.status;
1597
+ if (!resume) this.pausedAt = null;
1598
+ else if (this.pausedAt === null && status.kind === "parked") this.pausedAt = status.fraction;
1599
+ let outcome;
1600
+ try {
1601
+ outcome = await this.flyPreview(map, run);
1602
+ } catch (cause) {
1603
+ outcome = run.signal.aborted ? {
1604
+ ok: false,
1605
+ reason: "aborted"
1606
+ } : {
1607
+ error: flightError("Preview", cause),
1608
+ ok: false,
1609
+ reason: "failed"
1610
+ };
1611
+ }
1612
+ return this.endRun(run, outcome);
1613
+ }
1614
+ async flyPreview(map, run) {
1615
+ await this.warmRoute(() => run.signal.aborted);
1616
+ if (run.signal.aborted) return {
1617
+ ok: false,
1618
+ reason: "aborted"
1619
+ };
1620
+ const resolved = await this.resolve({
1621
+ pass: "preview",
1622
+ signal: run.signal
1623
+ });
1624
+ if (run.signal.aborted) return {
1625
+ ok: false,
1626
+ reason: "aborted"
1627
+ };
1628
+ if (!resolved) return {
1629
+ ok: false,
1630
+ reason: "no-route"
1631
+ };
1632
+ const lastIndex = Math.max(0, resolved.poses.length - 1);
1633
+ const resumeAt = Math.min(lastIndex, Math.round((this.pausedAt ?? 0) * lastIndex));
1634
+ const from = resumeAt === lastIndex ? 0 : resumeAt;
1635
+ const startFraction = lastIndex === 0 ? 0 : from / lastIndex;
1636
+ this.pausedAt = null;
1637
+ run.flying = true;
1638
+ this.commit({ status: {
1639
+ fraction: startFraction,
1640
+ kind: "previewing"
1641
+ } });
1642
+ await this.fly(map.previewPoses(from === 0 ? resolved.poses : resolved.poses.slice(from), {
1643
+ ...this.flight.activityGlyphUrl === null ? {} : { focusGlyphUrl: this.flight.activityGlyphUrl },
1644
+ markers: from === 0 ? resolved.markers : resolved.markers.slice(from),
1645
+ onProgress: (progress) => {
1646
+ if (this.run === run) this.commit({ status: {
1647
+ fraction: startFraction + progress.fraction * (1 - startFraction),
1648
+ kind: "previewing"
1649
+ } });
1650
+ },
1651
+ planDurationMs: resolved.planDurationMs * (1 - startFraction),
1652
+ signal: run.signal
1653
+ }));
1654
+ return run.signal.aborted ? {
1655
+ ok: false,
1656
+ reason: "aborted"
1657
+ } : { ok: true };
1658
+ }
1659
+ async record() {
1660
+ const map = this.map;
1661
+ if (!map) return {
1662
+ ok: false,
1663
+ reason: "no-map"
1664
+ };
1665
+ const run = this.beginRun("record");
1666
+ if (run.signal.aborted) return {
1667
+ ok: false,
1668
+ reason: "aborted"
1669
+ };
1670
+ this.readRoute();
1671
+ this.endFlightWarm();
1672
+ if (this.flyableRoute()) this.commit({ status: {
1673
+ fraction: 0,
1674
+ kind: "recording",
1675
+ phase: "preparing"
1676
+ } });
1677
+ let outcome;
1678
+ try {
1679
+ outcome = await this.flyRecording(map, run);
1680
+ } catch (cause) {
1681
+ outcome = run.signal.aborted ? {
1682
+ ok: false,
1683
+ reason: "aborted"
1684
+ } : {
1685
+ error: flightError("Recording", cause),
1686
+ ok: false,
1687
+ reason: "failed"
1688
+ };
1689
+ }
1690
+ return this.endRun(run, outcome);
1691
+ }
1692
+ async flyRecording(map, run) {
1693
+ if (run.signal.aborted) return {
1694
+ ok: false,
1695
+ reason: "aborted"
1696
+ };
1697
+ await this.prewarmRoute();
1698
+ if (run.signal.aborted) return {
1699
+ ok: false,
1700
+ reason: "aborted"
1701
+ };
1702
+ let swept = false;
1703
+ const resolved = await this.resolve({
1704
+ onSwept: () => {
1705
+ swept = true;
1706
+ },
1707
+ pass: "record",
1708
+ signal: run.signal
1709
+ });
1710
+ if (run.signal.aborted) return {
1711
+ ok: false,
1712
+ reason: "aborted"
1713
+ };
1714
+ if (!resolved) return {
1715
+ ok: false,
1716
+ reason: "no-route"
1717
+ };
1718
+ const profile = this.recordProfile(resolved);
1719
+ const result = await this.fly(map.recordPoses(resolved.poses, resolved.plan.output, {
1720
+ ...this.flight.activityGlyphUrl === null ? {} : { focusGlyphUrl: this.flight.activityGlyphUrl },
1721
+ markers: resolved.markers,
1722
+ onProgress: (progress) => {
1723
+ if (this.run === run) this.commit({ status: {
1724
+ fraction: progress.fraction,
1725
+ kind: "recording",
1726
+ phase: progress.phase
1727
+ } });
1728
+ },
1729
+ ...profile === void 0 ? {} : { profile },
1730
+ signal: run.signal,
1731
+ ...swept ? { warmed: true } : {}
1732
+ }));
1733
+ if (run.signal.aborted) return {
1734
+ ok: false,
1735
+ reason: "aborted"
1736
+ };
1737
+ if (result.error !== void 0) return {
1738
+ error: result.error,
1739
+ ok: false,
1740
+ reason: "failed"
1741
+ };
1742
+ if (couldNotStart(result)) return {
1743
+ ok: false,
1744
+ reason: "unavailable"
1745
+ };
1746
+ if (result.cancelled) return {
1747
+ ok: false,
1748
+ reason: "aborted"
1749
+ };
1750
+ if (!result.blob) return {
1751
+ ok: false,
1752
+ reason: "no-frames"
1753
+ };
1754
+ this.lastRecording = {
1755
+ blob: result.blob,
1756
+ extension: result.extension
1757
+ };
1758
+ return {
1759
+ blob: result.blob,
1760
+ extension: result.extension,
1761
+ ok: true
1762
+ };
1763
+ }
1764
+ async seek(fraction) {
1765
+ const map = this.map;
1766
+ if (!map) return {
1767
+ ok: false,
1768
+ reason: "no-map"
1769
+ };
1770
+ if (this.disposed) return {
1771
+ ok: false,
1772
+ reason: "aborted"
1773
+ };
1774
+ if (typeof fraction !== "number" || Number.isNaN(fraction)) return {
1775
+ error: new require_errors.MountayaElementsError(`VideoFlightEngine: seek's fraction is ${String(fraction)}; pass a number, which is held between 0 and 1.`),
1776
+ ok: false,
1777
+ reason: "failed"
1778
+ };
1779
+ this.readRoute();
1780
+ this.flightSequence += 1;
1781
+ const sequence = this.flightSequence;
1782
+ const overtaken = () => this.disposed || this.flightSequence !== sequence;
1783
+ let outcome;
1784
+ try {
1785
+ outcome = await this.park(map, fraction, overtaken);
1786
+ } catch (cause) {
1787
+ outcome = overtaken() ? {
1788
+ ok: false,
1789
+ reason: "aborted"
1790
+ } : {
1791
+ error: flightError("Seek", cause),
1792
+ ok: false,
1793
+ reason: "failed"
1794
+ };
1795
+ }
1796
+ if (outcome.ok || overtaken() || !this.seekStoppedFlight) return outcome;
1797
+ return this.land(outcome);
1798
+ }
1799
+ async park(map, fraction, overtaken) {
1800
+ for (;;) {
1801
+ await this.warmRoute(overtaken);
1802
+ if (overtaken()) return {
1803
+ ok: false,
1804
+ reason: "aborted"
1805
+ };
1806
+ const plan = this.flight.plan;
1807
+ const revision = this.routeRevision;
1808
+ const resolved = await this.resolve({
1809
+ pass: "preview",
1810
+ signal: this.disposal.signal
1811
+ });
1812
+ if (overtaken()) return {
1813
+ ok: false,
1814
+ reason: "aborted"
1815
+ };
1816
+ if (!resolved) return {
1817
+ ok: false,
1818
+ reason: "no-route"
1819
+ };
1820
+ if (this.run) {
1821
+ this.run.controller.abort();
1822
+ this.run = null;
1823
+ this.seekStoppedFlight ||= this.flight.status.kind !== "idle";
1824
+ }
1825
+ this.pausedAt = null;
1826
+ if (this.landings.size > 0) {
1827
+ await Promise.all(this.landings);
1828
+ if (overtaken()) return {
1829
+ ok: false,
1830
+ reason: "aborted"
1831
+ };
1832
+ }
1833
+ this.readRoute();
1834
+ if (plan !== this.flight.plan || revision !== this.routeRevision) continue;
1835
+ const at = Math.min(1, Math.max(0, fraction));
1836
+ const pose = resolved.poses[Math.round(at * Math.max(0, resolved.poses.length - 1))];
1837
+ if (pose) map.jumpToPose(pose);
1838
+ this.commit({ status: {
1839
+ fraction: at,
1840
+ kind: "parked"
1841
+ } });
1842
+ return { ok: true };
1843
+ }
1844
+ }
1845
+ invalidatePoses() {
1846
+ this.poseCache.clear();
1847
+ }
1848
+ reset() {
1849
+ this.abort();
1850
+ this.poseCache.clear();
1851
+ this.terrainWarmedRevision = null;
1852
+ this.flightWarmedRevision = null;
1853
+ this.demEpoch = 0;
1854
+ this.lastRecording = null;
1855
+ }
1856
+ pause() {
1857
+ const status = this.flight.status;
1858
+ if (this.run?.kind === "preview" && this.run.flying && status.kind === "previewing" && Number.isFinite(status.fraction)) this.pausedAt = Math.min(1, Math.max(0, status.fraction));
1859
+ this.stopRun();
1860
+ }
1861
+ stop() {
1862
+ const stopped = this.run?.kind ?? null;
1863
+ this.pausedAt = null;
1864
+ this.stopRun();
1865
+ return stopped;
1866
+ }
1867
+ abort() {
1868
+ this.flightSequence += 1;
1869
+ this.endFlightWarm();
1870
+ this.pausedAt = null;
1871
+ if (this.run) {
1872
+ this.run.controller.abort();
1873
+ this.run = null;
1874
+ }
1875
+ if (this.flight.status.kind !== "idle") this.commit({ status: { kind: "idle" } });
1876
+ }
1877
+ dispose() {
1878
+ if (this.disposed) return;
1879
+ this.disposal.abort();
1880
+ this.abort();
1881
+ this.listeners.clear();
1882
+ this.poseCache.clear();
1883
+ this.lastRecording = null;
1884
+ }
1885
+ commit(patch) {
1886
+ if (this.disposed) return;
1887
+ this.flight = {
1888
+ ...this.flight,
1889
+ ...patch
1890
+ };
1891
+ if (patch.status !== void 0) this.seekStoppedFlight = false;
1892
+ require_listeners.notifyListeners(this.listeners);
1893
+ }
1894
+ beginRun(kind) {
1895
+ const controller = new AbortController();
1896
+ const run = {
1897
+ controller,
1898
+ flying: false,
1899
+ kind,
1900
+ signal: controller.signal
1901
+ };
1902
+ if (this.disposed) {
1903
+ controller.abort();
1904
+ return run;
1905
+ }
1906
+ this.flightSequence += 1;
1907
+ this.run?.controller.abort();
1908
+ this.run = run;
1909
+ return run;
1910
+ }
1911
+ stopRun() {
1912
+ if (this.run) {
1913
+ this.run.controller.abort();
1914
+ this.run = null;
1915
+ }
1916
+ const warm = this.flightWarm;
1917
+ if (warm && [...warm.waiters].every((stopped) => stopped())) this.endFlightWarm();
1918
+ if (this.flight.status.kind !== "idle") this.commit({ status: { kind: "idle" } });
1919
+ }
1920
+ endRun(run, outcome) {
1921
+ if (this.run !== run) return outcome;
1922
+ this.run = null;
1923
+ return this.land(outcome);
1924
+ }
1925
+ land(outcome) {
1926
+ this.commit({ status: { kind: "idle" } });
1927
+ return outcome;
1928
+ }
1929
+ routeChanged(route) {
1930
+ this.routeContent = route === null ? null : routeContentOf(route);
1931
+ this.routeRevision += 1;
1932
+ this.endFlightWarm();
1933
+ this.poseCache.clear();
1934
+ this.pausedAt = null;
1935
+ }
1936
+ readRoute() {
1937
+ const route = this.flight.route;
1938
+ if (route !== null && this.routeContent !== null && !holdsRouteContent(route, this.routeContent)) this.routeChanged(route);
1939
+ }
1940
+ endFlightWarm() {
1941
+ this.flightWarm?.controller.abort();
1942
+ this.flightWarm = null;
1943
+ }
1944
+ async fly(flight) {
1945
+ const landing = flight.then(() => void 0, () => void 0);
1946
+ this.landings.add(landing);
1947
+ try {
1948
+ return await flight;
1949
+ } finally {
1950
+ this.landings.delete(landing);
1951
+ }
1952
+ }
1953
+ flyableRoute() {
1954
+ const route = this.flight.route;
1955
+ return route && route.line.length >= ROUTE_VERTICES_MIN ? route : null;
1956
+ }
1957
+ prewarmRoute() {
1958
+ const map = this.map;
1959
+ const route = this.flyableRoute();
1960
+ const revision = this.routeRevision;
1961
+ if (!map || !route || this.terrainWarmedRevision === revision) return Promise.resolve();
1962
+ if (this.terrainWarm?.revision === revision) return this.terrainWarm.settled;
1963
+ const bounds = routeBounds(route);
1964
+ if (!bounds) return Promise.resolve();
1965
+ const warm = {
1966
+ revision,
1967
+ settled: Promise.resolve()
1968
+ };
1969
+ this.terrainWarm = warm;
1970
+ warm.settled = (async () => {
1971
+ try {
1972
+ await map.prewarmTerrain(bounds);
1973
+ if (this.routeRevision === revision) this.terrainWarmedRevision = revision;
1974
+ } finally {
1975
+ if (this.terrainWarm === warm) this.terrainWarm = null;
1976
+ }
1977
+ })();
1978
+ return warm.settled;
1979
+ }
1980
+ async warmRoute(stopped) {
1981
+ for (;;) {
1982
+ this.readRoute();
1983
+ const revision = this.routeRevision;
1984
+ await this.prewarmRoute();
1985
+ this.readRoute();
1986
+ if (stopped()) return;
1987
+ if (revision !== this.routeRevision) continue;
1988
+ await this.warmFlight(stopped);
1989
+ this.readRoute();
1990
+ if (stopped() || revision === this.routeRevision) return;
1991
+ }
1992
+ }
1993
+ async warmFlight(stopped) {
1994
+ const map = this.map;
1995
+ const route = this.flyableRoute();
1996
+ const revision = this.routeRevision;
1997
+ if (!map || !route || this.flightWarmedRevision === revision) return;
1998
+ const recording = this.recordWarm;
1999
+ if (this.flightWarm?.revision !== revision && recording?.revision === revision) {
2000
+ if (!recording.signal.aborted) {
2001
+ await recording.settled;
2002
+ return;
2003
+ }
2004
+ }
2005
+ let warm = this.flightWarm;
2006
+ if (warm?.revision !== revision) {
2007
+ const controller = new AbortController();
2008
+ const begun = {
2009
+ controller,
2010
+ revision,
2011
+ settled: Promise.resolve(),
2012
+ waiters: /* @__PURE__ */ new Set()
2013
+ };
2014
+ this.flightWarm = begun;
2015
+ begun.settled = (async () => {
2016
+ try {
2017
+ await map.warmPoses(this.planner.resolveTrack(this.flight.plan, route), controller.signal);
2018
+ if (!controller.signal.aborted) {
2019
+ this.flightWarmedRevision = revision;
2020
+ this.demEpoch += 1;
2021
+ }
2022
+ } finally {
2023
+ if (this.flightWarm === begun) this.flightWarm = null;
2024
+ }
2025
+ })();
2026
+ warm = begun;
2027
+ }
2028
+ warm.waiters.add(stopped);
2029
+ try {
2030
+ await warm.settled;
2031
+ } finally {
2032
+ warm.waiters.delete(stopped);
2033
+ }
2034
+ }
2035
+ sweepForRecord(track, revision, signal) {
2036
+ const map = this.map;
2037
+ if (!map) return Promise.resolve();
2038
+ const warm = {
2039
+ revision,
2040
+ settled: Promise.resolve(),
2041
+ signal
2042
+ };
2043
+ this.recordWarm = warm;
2044
+ warm.settled = (async () => {
2045
+ try {
2046
+ await map.warmPoses(track, signal);
2047
+ if (!signal.aborted && this.routeRevision === revision) {
2048
+ this.flightWarmedRevision = revision;
2049
+ this.demEpoch += 1;
2050
+ }
2051
+ } finally {
2052
+ if (this.recordWarm === warm) this.recordWarm = null;
2053
+ }
2054
+ })();
2055
+ return warm.settled;
2056
+ }
2057
+ async resolve(options) {
2058
+ const route = this.flyableRoute();
2059
+ if (!route) return null;
2060
+ const plan = this.flight.plan;
2061
+ const revision = this.routeRevision;
2062
+ const key = () => [
2063
+ posePlanSignature(plan),
2064
+ revision,
2065
+ options.pass,
2066
+ this.demEpoch
2067
+ ].join("|");
2068
+ const cached = this.poseCache.get(key());
2069
+ if (cached) {
2070
+ this.poseCache.delete(key());
2071
+ this.poseCache.set(key(), cached);
2072
+ return cached;
2073
+ }
2074
+ let swept = null;
2075
+ if (options.pass === "record") {
2076
+ if (options.signal.aborted) return null;
2077
+ swept = this.planner.resolveTrack(plan, route);
2078
+ await this.sweepForRecord(swept, revision, options.signal);
2079
+ if (options.signal.aborted) return null;
2080
+ }
2081
+ const resolved = {
2082
+ markers: resolveRouteMarkers(plan, route),
2083
+ plan,
2084
+ planDurationMs: planDurationMs(plan),
2085
+ poses: [...this.planner.resolveTrack(plan, route, (lngLat) => this.map?.sampleTerrainElevation(lngLat) ?? null, options.pass === "record" ? 1 : clearanceStrideFor(plan, route))],
2086
+ route
2087
+ };
2088
+ if (swept !== null && capturesSweptViewports(swept, resolved.poses)) options.onSwept?.();
2089
+ if (revision !== this.routeRevision) return resolved;
2090
+ this.poseCache.set(key(), resolved);
2091
+ if (this.poseCache.size > this.poseCacheSize) {
2092
+ const oldest = this.poseCache.keys().next().value;
2093
+ if (oldest !== void 0) this.poseCache.delete(oldest);
2094
+ }
2095
+ return resolved;
2096
+ }
2097
+ recordProfile(resolved) {
2098
+ const { profile, profileSource } = this.flight;
2099
+ if (!profile.enabled || !profileSource) return;
2100
+ return {
2101
+ design: profile.design,
2102
+ format: {
2103
+ language: profile.language,
2104
+ length: profile.length,
2105
+ pace: profile.pace,
2106
+ slope: profile.slope,
2107
+ temperature: "celsius"
2108
+ },
2109
+ samples: this.planner.resolveSamples(resolved.plan, resolved.route, profileSource)
2110
+ };
2111
+ }
2112
+ };
2113
+ const KEYFRAME_COUNT = 9;
2114
+ const modeFramings = {
2115
+ chase: {
2116
+ basePitch: 77,
2117
+ introHoldMs: 1e3,
2118
+ introPitchDelta: -10,
2119
+ outroHoldMs: 1100,
2120
+ outroPitchDelta: -6,
2121
+ zoomBias: 1.7
2122
+ },
2123
+ cinematic: {
2124
+ basePitch: 68,
2125
+ introHoldMs: 1600,
2126
+ introPitchDelta: 8,
2127
+ outroHoldMs: 1400,
2128
+ outroPitchDelta: -4,
2129
+ zoomBias: .8
2130
+ },
2131
+ drone: {
2132
+ basePitch: 75,
2133
+ introHoldMs: 1500,
2134
+ introPitchDelta: 10,
2135
+ outroHoldMs: 1300,
2136
+ outroPitchDelta: 6,
2137
+ zoomBias: -.6
2138
+ },
2139
+ helicopter: {
2140
+ basePitch: 56,
2141
+ introHoldMs: 1500,
2142
+ introPitchDelta: -8,
2143
+ outroHoldMs: 1400,
2144
+ outroPitchDelta: -6,
2145
+ zoomBias: -.9
2146
+ },
2147
+ overview: {
2148
+ basePitch: 58,
2149
+ introHoldMs: 1800,
2150
+ introPitchDelta: 0,
2151
+ outroHoldMs: 1600,
2152
+ outroPitchDelta: 0,
2153
+ zoomBias: -.4
2154
+ },
2155
+ smart: {
2156
+ basePitch: 62,
2157
+ introHoldMs: 1100,
2158
+ introPitchDelta: 6,
2159
+ outroHoldMs: 1e3,
2160
+ outroPitchDelta: 3,
2161
+ zoomBias: 0
2162
+ }
2163
+ };
2164
+ const modeEyeHeightMeters = {
2165
+ chase: 170,
2166
+ cinematic: 260,
2167
+ drone: 650,
2168
+ helicopter: 500,
2169
+ overview: 350,
2170
+ smart: 300
2171
+ };
2172
+ const SMART_MAX_SLOPE_TRIM = 28;
2173
+ const SMART_LOOKAHEAD_METERS = 800;
2174
+ const SMART_MAX_PITCH_STEP = 8;
2175
+ const SMART_STEEP_SLOWDOWN_MAX = .3;
2176
+ const SMART_SLOWDOWN_FULL_SLOPE_DEG = 20;
2177
+ const SMART_STEEP_WIDEN_ZOOM = .6;
2178
+ const CINEMATIC_HIGHLIGHT_MIN_SLOPE_DEG = 6;
2179
+ const CINEMATIC_HIGHLIGHT_LOOKAHEAD_METERS = 400;
2180
+ const CINEMATIC_HIGHLIGHT_HOLD_MS = 900;
2181
+ const CINEMATIC_HIGHLIGHT_APPROACH_SPEED = .85;
2182
+ const CINEMATIC_HIGHLIGHT_PITCH_TRIM = 6;
2183
+ const CHASE_SLOPE_LOOKAHEAD_METERS = 400;
2184
+ const CHASE_MAX_SLOPE_TRIM = 12;
2185
+ const CHASE_SLOPE_TRIM_FACTOR = .5;
2186
+ const CHASE_DESCENT_SPEEDUP_MAX = .5;
2187
+ const CHASE_DESCENT_FULL_SLOPE_DEG = 15;
2188
+ const HELICOPTER_TANGENT_LOOKAHEAD_METERS = 500;
2189
+ const HELICOPTER_SIDE_OFFSET_DEG = 90;
2190
+ const OVERVIEW_ENDPOINT_PITCH = 12;
2191
+ const OVERVIEW_FRAME_FACTOR = 1.6;
2192
+ const generateSmartPlan = (itinerary, params) => {
2193
+ refuseUnplannableRoute("generateSmartPlan", itinerary);
2194
+ const framing = modeFramings.smart;
2195
+ const line = toLine(itinerary);
2196
+ const cumulative = require_geodesy.cumulativeMeters(line);
2197
+ const lengthMeters = require_geodesy.routeLengthMeters(line);
2198
+ const fractions = keyframeFractions();
2199
+ const slopes = fractions.map((fraction) => slopeDegAtFraction(itinerary, fraction, SMART_LOOKAHEAD_METERS));
2200
+ const smoothedSlopes = smoothTriTap(slopes);
2201
+ const travelPitches = limitInteriorPitchSteps(smoothedSlopes.map((slopeDeg) => slopePitch(framing.basePitch, slopeDeg)));
2202
+ const fitZoom = routeFitZoom(line);
2203
+ const shots = fractions.map((fraction, index) => {
2204
+ const cursor = cursorAtFraction(line, fraction, SMART_LOOKAHEAD_METERS, cumulative);
2205
+ const interior = !(isIntro(index) || isOutro(index));
2206
+ const steepness = Math.min(1, Math.abs(smoothedSlopes[index] ?? 0) / SMART_SLOWDOWN_FULL_SLOPE_DEG);
2207
+ const steepWiden = interior ? SMART_STEEP_WIDEN_ZOOM * steepness : 0;
2208
+ return {
2209
+ at: fraction,
2210
+ bearingMode: "follow",
2211
+ holdMs: holdForKeyframe(framing, index),
2212
+ id: shotId("smart", index),
2213
+ pitchDeg: pitchForKeyframe(framing, index, travelPitches[index] ?? framing.basePitch),
2214
+ speedScale: interior ? 1 - SMART_STEEP_SLOWDOWN_MAX * steepness : 1,
2215
+ zoom: interior ? zoomFor(itinerary, fraction, cursor.point[1], lengthMeters, framing.zoomBias - steepWiden, modeEyeHeightMeters.smart) : fitZoom
2216
+ };
2217
+ });
2218
+ return parsePlan("smart", shots, params);
2219
+ };
2220
+ const slopePitch = (basePitch, slopeDeg) => clampPitch(basePitch - Math.min(SMART_MAX_SLOPE_TRIM, Math.abs(slopeDeg)));
2221
+ const smoothTriTap = (values) => {
2222
+ const length = values.length;
2223
+ if (length < 3) return [...values];
2224
+ const out = new Array(length);
2225
+ for (let i = 0; i < length; i += 1) {
2226
+ const previous = values[Math.max(0, i - 1)] ?? 0;
2227
+ const current = values[i] ?? 0;
2228
+ const next = values[Math.min(length - 1, i + 1)] ?? 0;
2229
+ out[i] = previous * .25 + current * .5 + next * .25;
2230
+ }
2231
+ return out;
2232
+ };
2233
+ const limitInteriorPitchSteps = (pitches) => {
2234
+ const out = [...pitches];
2235
+ for (let index = 2; index < out.length - 1; index += 1) {
2236
+ const previous = out[index - 1] ?? 0;
2237
+ const delta = (out[index] ?? previous) - previous;
2238
+ if (delta > SMART_MAX_PITCH_STEP) out[index] = previous + SMART_MAX_PITCH_STEP;
2239
+ else if (delta < -8) out[index] = previous - SMART_MAX_PITCH_STEP;
2240
+ }
2241
+ return out;
2242
+ };
2243
+ const generateCinematicPlan = (itinerary, params) => {
2244
+ refuseUnplannableRoute("generateCinematicPlan", itinerary);
2245
+ const framing = modeFramings.cinematic;
2246
+ const line = toLine(itinerary);
2247
+ const lengthMeters = require_geodesy.routeLengthMeters(line);
2248
+ const fractions = keyframeFractions();
2249
+ const fitZoom = routeFitZoom(line);
2250
+ const shots = fractions.map((fraction, index) => ({
2251
+ at: fraction,
2252
+ bearingMode: "follow",
2253
+ holdMs: holdForKeyframe(framing, index),
2254
+ id: shotId("cinematic", index),
2255
+ pitchDeg: pitchForKeyframe(framing, index, framing.basePitch),
2256
+ speedScale: 1,
2257
+ zoom: isIntro(index) || isOutro(index) ? fitZoom : zoomFor(itinerary, fraction, latAtFraction(line, fraction), lengthMeters, framing.zoomBias, modeEyeHeightMeters.cinematic)
2258
+ }));
2259
+ let highlightIndex = -1;
2260
+ let highlightSlope = 0;
2261
+ for (let index = 2; index <= 6; index += 1) {
2262
+ const slope = Math.abs(slopeDegAtFraction(itinerary, fractions[index] ?? 0, CINEMATIC_HIGHLIGHT_LOOKAHEAD_METERS));
2263
+ if (slope >= CINEMATIC_HIGHLIGHT_MIN_SLOPE_DEG && slope > highlightSlope) {
2264
+ highlightIndex = index;
2265
+ highlightSlope = slope;
2266
+ }
2267
+ }
2268
+ const highlight = shots[highlightIndex];
2269
+ if (highlight) shots[highlightIndex] = {
2270
+ ...highlight,
2271
+ holdMs: CINEMATIC_HIGHLIGHT_HOLD_MS,
2272
+ pitchDeg: clampPitch(framing.basePitch - CINEMATIC_HIGHLIGHT_PITCH_TRIM),
2273
+ speedScale: CINEMATIC_HIGHLIGHT_APPROACH_SPEED
2274
+ };
2275
+ return parsePlan("cinematic", shots, params);
2276
+ };
2277
+ const generateDronePlan = (itinerary, params) => {
2278
+ refuseUnplannableRoute("generateDronePlan", itinerary);
2279
+ const framing = modeFramings.drone;
2280
+ const line = toLine(itinerary);
2281
+ const lengthMeters = require_geodesy.routeLengthMeters(line);
2282
+ const fitZoom = routeFitZoom(line);
2283
+ const shots = keyframeFractions().map((fraction, index) => ({
2284
+ at: fraction,
2285
+ bearingMode: "follow",
2286
+ holdMs: holdForKeyframe(framing, index),
2287
+ id: shotId("drone", index),
2288
+ pitchDeg: pitchForKeyframe(framing, index, framing.basePitch),
2289
+ speedScale: 1,
2290
+ zoom: isIntro(index) || isOutro(index) ? fitZoom : zoomFor(itinerary, fraction, latAtFraction(line, fraction), lengthMeters, framing.zoomBias, modeEyeHeightMeters.drone)
2291
+ }));
2292
+ return parsePlan("drone", shots, params);
2293
+ };
2294
+ const generateHelicopterPlan = (itinerary, params) => {
2295
+ refuseUnplannableRoute("generateHelicopterPlan", itinerary);
2296
+ const framing = modeFramings.helicopter;
2297
+ const line = toLine(itinerary);
2298
+ const cumulative = require_geodesy.cumulativeMeters(line);
2299
+ const lengthMeters = require_geodesy.routeLengthMeters(line);
2300
+ const fitZoom = routeFitZoom(line);
2301
+ const shots = keyframeFractions().map((fraction, index) => {
2302
+ const cursor = cursorAtFraction(line, fraction, HELICOPTER_TANGENT_LOOKAHEAD_METERS, cumulative);
2303
+ return {
2304
+ at: fraction,
2305
+ bearingDeg: normalizeBearing(cursor.bearingDeg + HELICOPTER_SIDE_OFFSET_DEG),
2306
+ bearingMode: "value",
2307
+ holdMs: holdForKeyframe(framing, index),
2308
+ id: shotId("helicopter", index),
2309
+ pitchDeg: pitchForKeyframe(framing, index, framing.basePitch),
2310
+ speedScale: 1,
2311
+ zoom: isIntro(index) || isOutro(index) ? fitZoom : zoomFor(itinerary, fraction, cursor.point[1], lengthMeters, framing.zoomBias, modeEyeHeightMeters.helicopter)
2312
+ };
2313
+ });
2314
+ return parsePlan("helicopter", shots, params);
2315
+ };
2316
+ const generateChasePlan = (itinerary, params) => {
2317
+ refuseUnplannableRoute("generateChasePlan", itinerary);
2318
+ const framing = modeFramings.chase;
2319
+ const line = toLine(itinerary);
2320
+ const lengthMeters = require_geodesy.routeLengthMeters(line);
2321
+ const fractions = keyframeFractions();
2322
+ const slopes = fractions.map((fraction) => slopeDegAtFraction(itinerary, fraction, CHASE_SLOPE_LOOKAHEAD_METERS));
2323
+ const smoothedSlopes = smoothTriTap(slopes);
2324
+ const travelPitches = limitInteriorPitchSteps(smoothedSlopes.map((slopeDeg) => clampPitch(framing.basePitch - Math.min(CHASE_MAX_SLOPE_TRIM, Math.abs(slopeDeg) * CHASE_SLOPE_TRIM_FACTOR))));
2325
+ const fitZoom = routeFitZoom(line);
2326
+ const shots = fractions.map((fraction, index) => {
2327
+ const interior = !(isIntro(index) || isOutro(index));
2328
+ return {
2329
+ at: fraction,
2330
+ bearingMode: "follow",
2331
+ holdMs: holdForKeyframe(framing, index),
2332
+ id: shotId("chase", index),
2333
+ pitchDeg: pitchForKeyframe(framing, index, travelPitches[index] ?? framing.basePitch),
2334
+ speedScale: interior ? chaseDescentSpeedScale(smoothedSlopes[index] ?? 0) : 1,
2335
+ zoom: interior ? zoomFor(itinerary, fraction, latAtFraction(line, fraction), lengthMeters, framing.zoomBias, modeEyeHeightMeters.chase) : fitZoom
2336
+ };
2337
+ });
2338
+ return parsePlan("chase", shots, params);
2339
+ };
2340
+ const chaseDescentSpeedScale = (slopeDeg) => {
2341
+ const descent = Math.min(1, Math.max(0, -slopeDeg) / CHASE_DESCENT_FULL_SLOPE_DEG);
2342
+ return 1 + CHASE_DESCENT_SPEEDUP_MAX * descent;
2343
+ };
2344
+ const generateOverviewPlan = (itinerary, params) => {
2345
+ refuseUnplannableRoute("generateOverviewPlan", itinerary);
2346
+ const framing = modeFramings.overview;
2347
+ const line = toLine(itinerary);
2348
+ const lengthMeters = require_geodesy.routeLengthMeters(line);
2349
+ const introRadiusMeters = farthestVertexMeters(line, line[0]);
2350
+ const outroRadiusMeters = farthestVertexMeters(line, line[line.length - 1]);
2351
+ const overallHeading = normalizeBearing(routeHeadingDeg(line));
2352
+ const shots = keyframeFractions().map((fraction, index) => {
2353
+ const endpoint = isIntro(index) || isOutro(index);
2354
+ const latitude = latAtFraction(line, fraction);
2355
+ return {
2356
+ at: fraction,
2357
+ ...isOutro(index) ? { bearingDeg: overallHeading } : {},
2358
+ bearingMode: isIntro(index) ? "locked" : isOutro(index) ? "value" : "follow",
2359
+ holdMs: holdForKeyframe(framing, index),
2360
+ id: shotId("overview", index),
2361
+ pitchDeg: endpoint ? OVERVIEW_ENDPOINT_PITCH : clampPitch(framing.basePitch),
2362
+ speedScale: 1,
2363
+ zoom: endpoint ? distanceZoom((isIntro(index) ? introRadiusMeters : outroRadiusMeters) * OVERVIEW_FRAME_FACTOR, latitude) : zoomFor(itinerary, fraction, latitude, lengthMeters, framing.zoomBias, modeEyeHeightMeters.overview)
2364
+ };
2365
+ });
2366
+ return parsePlan("overview", shots, params);
2367
+ };
2368
+ const neutralDirectorPlan = (params) => createCameraPlan({
2369
+ mode: "director",
2370
+ shots: [],
2371
+ targetDurationMs: params.targetDurationMs
2372
+ });
2373
+ const cameraPlanGenerators = {
2374
+ chase: generateChasePlan,
2375
+ cinematic: generateCinematicPlan,
2376
+ drone: generateDronePlan,
2377
+ helicopter: generateHelicopterPlan,
2378
+ overview: generateOverviewPlan,
2379
+ smart: generateSmartPlan
2380
+ };
2381
+ const SHORT_ROUTE_METERS = 200;
2382
+ const isIntro = (index) => index === 0;
2383
+ const isOutro = (index) => index === 8;
2384
+ const keyframeFractions = () => {
2385
+ const last = 8;
2386
+ return Array.from({ length: KEYFRAME_COUNT }, (_unused, index) => index / last);
2387
+ };
2388
+ const holdForKeyframe = (framing, index) => {
2389
+ if (isIntro(index)) return framing.introHoldMs;
2390
+ if (isOutro(index)) return framing.outroHoldMs;
2391
+ return 0;
2392
+ };
2393
+ const pitchForKeyframe = (framing, index, travelPitch) => {
2394
+ if (isIntro(index)) return clampPitch(framing.basePitch + framing.introPitchDelta);
2395
+ if (isOutro(index)) return clampPitch(framing.basePitch + framing.outroPitchDelta);
2396
+ return clampPitch(travelPitch);
2397
+ };
2398
+ const routeFitZoom = (line) => {
2399
+ let west = Number.POSITIVE_INFINITY;
2400
+ let east = Number.NEGATIVE_INFINITY;
2401
+ let south = Number.POSITIVE_INFINITY;
2402
+ let north = Number.NEGATIVE_INFINITY;
2403
+ for (const [lng, lat] of line) {
2404
+ west = Math.min(west, lng);
2405
+ east = Math.max(east, lng);
2406
+ south = Math.min(south, lat);
2407
+ north = Math.max(north, lat);
2408
+ }
2409
+ if (!Number.isFinite(west) || !Number.isFinite(south)) return distanceZoom(0, 0);
2410
+ const midLatitude = (south + north) / 2;
2411
+ const latSpanMeters = (north - south) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR;
2412
+ const lngSpanMeters = (east - west) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR * Math.cos(midLatitude * require_conversions.DEGREES_TO_RADIANS);
2413
+ return distanceZoom(Math.max(latSpanMeters, lngSpanMeters), midLatitude);
2414
+ };
2415
+ const farthestVertexMeters = (line, origin) => {
2416
+ if (!origin) return 0;
2417
+ let radius = 0;
2418
+ for (const [lng, lat] of line) {
2419
+ const midLatitude = (lat + origin[1]) / 2 * require_conversions.DEGREES_TO_RADIANS;
2420
+ const dLat = (lat - origin[1]) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR;
2421
+ const dLng = (lng - origin[0]) * require_webMercator.METERS_PER_DEGREE_WEB_MERCATOR * Math.cos(midLatitude);
2422
+ radius = Math.max(radius, Math.hypot(dLat, dLng));
2423
+ }
2424
+ return radius;
2425
+ };
2426
+ const shotId = (mode, index) => `${mode}-${index}`;
2427
+ const toLine = (itinerary) => continuousLine(itinerary.line);
2428
+ const latAtFraction = (line, fraction) => cursorAtFraction(line, fraction, 0).point[1];
2429
+ const normalizeBearing = (bearingDeg) => (bearingDeg % 360 + 360) % 360;
2430
+ const zoomFor = (itinerary, fraction, latitude, lengthMeters, zoomBias, eyeHeightMeters) => {
2431
+ const surface = elevationAtFraction(itinerary, fraction);
2432
+ if (surface !== null && lengthMeters >= SHORT_ROUTE_METERS) return clampZoom(require_zoom.altitudeToZoom(surface + eyeHeightMeters, latitude) + zoomBias);
2433
+ return clampZoom(distanceZoom(lengthMeters, latitude) + zoomBias);
2434
+ };
2435
+ const ROUTE_FRAME_PX = 768;
2436
+ const distanceZoom = (lengthMeters, latitude) => {
2437
+ const span = Math.max(lengthMeters, 50);
2438
+ const z = Math.log2(require_webMercator.groundMetersPerPixel(0, latitude) * ROUTE_FRAME_PX / span);
2439
+ return clampZoom(z);
2440
+ };
2441
+ const parsePlan = (mode, shots, params) => createCameraPlan({
2442
+ mode,
2443
+ shots: [...shots],
2444
+ targetDurationMs: params.targetDurationMs
2445
+ });
2446
+ exports.BITRATE_MBPS_MAX = require_presets.BITRATE_MBPS_MAX;
2447
+ exports.BITRATE_MBPS_MIN = require_presets.BITRATE_MBPS_MIN;
2448
+ exports.CAMERA_ASPECTS = require_vocabulary.CAMERA_ASPECTS;
2449
+ exports.CAMERA_BEARING_MODES = require_vocabulary.CAMERA_BEARING_MODES;
2450
+ exports.CAMERA_FPS = require_vocabulary.CAMERA_FPS;
2451
+ exports.CAMERA_MODES = require_vocabulary.CAMERA_MODES;
2452
+ exports.CAMERA_OUTPUT_FORMATS = require_vocabulary.CAMERA_OUTPUT_FORMATS;
2453
+ exports.CAMERA_RESOLUTIONS = require_vocabulary.CAMERA_RESOLUTIONS;
2454
+ exports.CINEMATIC_EYE_HEIGHT_METERS = require_zoom.CINEMATIC_EYE_HEIGHT_METERS;
2455
+ exports.DEFAULT_TARGET_DURATION_MS = DEFAULT_TARGET_DURATION_MS;
2456
+ exports.DEFAULT_VIEWPORT_HEIGHT_PX = require_zoom.DEFAULT_VIEWPORT_HEIGHT_PX;
2457
+ exports.POINT_ZOOM = require_zoom.POINT_ZOOM;
2458
+ exports.PROFILE_DESIGNS = require_vocabulary.PROFILE_DESIGNS;
2459
+ exports.QUALITY_TIERS = require_vocabulary.QUALITY_TIERS;
2460
+ exports.VIDEO_PRESETS_AVAILABLE = require_vocabulary.VIDEO_PRESETS_AVAILABLE;
2461
+ exports.VIDEO_RECORDING_PHASES = require_vocabulary.VIDEO_RECORDING_PHASES;
2462
+ exports.VideoFlightEngine = VideoFlightEngine;
2463
+ exports.altitudeToZoom = require_zoom.altitudeToZoom;
2464
+ exports.aspectRatio = require_presets.aspectRatio;
2465
+ exports.bearingDegBetween = bearingDegBetween;
2466
+ exports.bitrateForOutput = require_presets.bitrateForOutput;
2467
+ exports.cameraForBounds = require_fit.cameraForBounds;
2468
+ exports.cameraPlanGenerators = cameraPlanGenerators;
2469
+ exports.capturesSweptViewports = capturesSweptViewports;
2470
+ exports.clearanceStrideFor = clearanceStrideFor;
2471
+ exports.createCameraPlan = createCameraPlan;
2472
+ exports.cumulativeMeters = require_geodesy.cumulativeMeters;
2473
+ exports.cursorAtFraction = cursorAtFraction;
2474
+ exports.defaultCameraOutput = defaultCameraOutput;
2475
+ exports.defaultCameraShot = defaultCameraShot;
2476
+ exports.defaultVideoFlightProfile = defaultVideoFlightProfile;
2477
+ exports.elevationAtFraction = elevationAtFraction;
2478
+ exports.estimatedVideoSizeMb = require_presets.estimatedVideoSizeMb;
2479
+ exports.generateChasePlan = generateChasePlan;
2480
+ exports.generateCinematicPlan = generateCinematicPlan;
2481
+ exports.generateDronePlan = generateDronePlan;
2482
+ exports.generateHelicopterPlan = generateHelicopterPlan;
2483
+ exports.generateOverviewPlan = generateOverviewPlan;
2484
+ exports.generateSmartPlan = generateSmartPlan;
2485
+ exports.groundMetersPerPixel = require_webMercator.groundMetersPerPixel;
2486
+ exports.insertShotSorted = insertShotSorted;
2487
+ exports.itineraryToRouteGeometry = itineraryToRouteGeometry;
2488
+ exports.measuredCameraPlanner = measuredCameraPlanner;
2489
+ exports.modeEyeHeightMeters = modeEyeHeightMeters;
2490
+ exports.neutralDirectorPlan = neutralDirectorPlan;
2491
+ exports.planDurationMs = planDurationMs;
2492
+ exports.pointAtMeters = pointAtMeters;
2493
+ exports.posePlanSignature = posePlanSignature;
2494
+ exports.representativeStillFraction = representativeStillFraction;
2495
+ exports.resolveCameraTrack = resolveCameraTrack;
2496
+ exports.resolveClearanceAdjustments = resolveClearanceAdjustments;
2497
+ exports.resolveFrameProgressions = resolveFrameProgressions;
2498
+ exports.resolveProfileSamples = resolveProfileSamples;
2499
+ exports.resolveRouteMarkers = resolveRouteMarkers;
2500
+ exports.routeLengthMeters = require_geodesy.routeLengthMeters;
2501
+ exports.sameRouteContent = sameRouteContent;
2502
+ exports.slopeDegAtFraction = slopeDegAtFraction;
2503
+ exports.suggestVideoLengthMs = require_presets.suggestVideoLengthMs;
2504
+ exports.synchronousCameraPlanner = synchronousCameraPlanner;
2505
+ exports.tangentBearingAtMeters = tangentBearingAtMeters;
2506
+ exports.videoPresets = require_presets.videoPresets;
2507
+ exports.viewportGroundSpanMeters = require_zoom.viewportGroundSpanMeters;
2508
+ exports.zoomControlsDisabled = require_zoom.zoomControlsDisabled;
2509
+ exports.zoomLimitReached = require_zoom.zoomLimitReached;
2510
+ exports.zoomToAltitude = require_zoom.zoomToAltitude;
2511
+
2512
+ //# sourceMappingURL=index.cjs.map