@poadio/app-vue 0.2.1 → 0.3.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 (325) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/app-vue.css +3 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/items.d.ts +1 -0
  8. package/dist/items.d.ts.map +1 -1
  9. package/dist/items.js +79 -0
  10. package/dist/items.js.map +1 -1
  11. package/package.json +11 -2
  12. package/runtime-dist/app.css +3 -0
  13. package/runtime-dist/app.js +2 -2
  14. package/runtime-dist/c-00cvgnxc.js +2 -0
  15. package/runtime-dist/c-09vj399g.js +1 -0
  16. package/runtime-dist/c-0arc0hg5.js +1 -0
  17. package/runtime-dist/{c-1h49vkah.js → c-0x2e39ve.js} +2 -2
  18. package/runtime-dist/{c-7dryrrsk.js → c-0x2jfka0.js} +2 -2
  19. package/runtime-dist/c-170fz4v2.js +2 -0
  20. package/runtime-dist/c-1aa5pzps.js +1 -0
  21. package/runtime-dist/c-1h3k0kb8.js +1 -0
  22. package/runtime-dist/c-1j1xssd8.js +2 -0
  23. package/runtime-dist/c-1n6fcyf0.js +1 -0
  24. package/runtime-dist/{c-eh9ryhw7.js → c-22qerref.js} +2 -2
  25. package/runtime-dist/c-272dwppe.js +1 -0
  26. package/runtime-dist/c-2z768p0x.js +2 -0
  27. package/runtime-dist/c-38nmw75x.js +1 -0
  28. package/runtime-dist/c-3gqmyt95.js +1 -0
  29. package/runtime-dist/c-3yaegh2k.js +1 -0
  30. package/runtime-dist/{c-h8ny4vpa.js → c-4mqnegk0.js} +1 -1
  31. package/runtime-dist/c-4s1xdsjj.js +2 -0
  32. package/runtime-dist/{c-9rx4pqjs.js → c-4w8c01x6.js} +2 -2
  33. package/runtime-dist/c-5ap867xf.js +39 -0
  34. package/runtime-dist/{c-98tbntdq.js → c-5bxybf9g.js} +2 -2
  35. package/runtime-dist/c-5crndmh8.js +1 -0
  36. package/runtime-dist/c-632d3gvm.js +1 -0
  37. package/runtime-dist/c-6nx9xkc1.js +1 -0
  38. package/runtime-dist/c-6pfxp4ca.js +2 -0
  39. package/runtime-dist/c-76450e09.js +1 -0
  40. package/runtime-dist/c-770ysy0b.js +1 -0
  41. package/runtime-dist/c-7eh8g4bg.js +1 -0
  42. package/runtime-dist/c-81nspfex.js +1 -0
  43. package/runtime-dist/c-8cydj5g6.js +3 -0
  44. package/runtime-dist/c-8g74gqn9.js +2 -0
  45. package/runtime-dist/c-8v7c8j85.js +2 -0
  46. package/runtime-dist/c-8xc3fha3.js +2 -0
  47. package/runtime-dist/c-93kndqea.js +2 -0
  48. package/runtime-dist/c-96a9b7ys.js +1 -0
  49. package/runtime-dist/c-9hk02377.js +2 -0
  50. package/runtime-dist/c-9pzq231t.js +1 -0
  51. package/runtime-dist/c-a3jhm7jm.js +1 -0
  52. package/runtime-dist/c-aebecc6a.js +1 -0
  53. package/runtime-dist/c-aenj05yt.js +2 -0
  54. package/runtime-dist/c-aetcxxs5.js +2 -0
  55. package/runtime-dist/c-afjwwspe.js +1 -0
  56. package/runtime-dist/c-ah4kckw8.js +5 -0
  57. package/runtime-dist/c-an1sk7z5.js +2 -0
  58. package/runtime-dist/{c-n8sg12jt.js → c-b9npcc8v.js} +1 -1
  59. package/runtime-dist/{c-er7e0yqs.js → c-bbgsrr8m.js} +1 -1
  60. package/runtime-dist/{c-jxqht9an.js → c-bbqq1fmz.js} +2 -2
  61. package/runtime-dist/c-bemne227.js +1 -0
  62. package/runtime-dist/c-bxfxd3hv.js +1 -0
  63. package/runtime-dist/c-bypwvtv5.js +1 -0
  64. package/runtime-dist/c-bz3efpds.js +1 -0
  65. package/runtime-dist/c-ckkpv1ab.js +1 -0
  66. package/runtime-dist/c-cyvq3zhq.js +1 -0
  67. package/runtime-dist/c-d3jg3nhc.js +1 -0
  68. package/runtime-dist/c-d68hg40s.js +1 -0
  69. package/runtime-dist/c-d8ba6h4e.js +1 -0
  70. package/runtime-dist/{c-57mnqma1.js → c-d9eczdnp.js} +1 -1
  71. package/runtime-dist/c-dzp10g67.js +3 -0
  72. package/runtime-dist/c-e312a464.js +2 -0
  73. package/runtime-dist/c-e5eq2szv.js +2 -0
  74. package/runtime-dist/c-e7rb0mk1.js +1 -0
  75. package/runtime-dist/c-ejgrzqe3.js +1 -0
  76. package/runtime-dist/{c-e45fhawr.js → c-ezj4yg2q.js} +1 -1
  77. package/runtime-dist/c-f23v2025.js +2 -0
  78. package/runtime-dist/c-f4fpjjsk.js +1 -0
  79. package/runtime-dist/c-fps4599a.js +1 -0
  80. package/runtime-dist/c-fq9wga43.js +1 -0
  81. package/runtime-dist/c-g06g8vzv.js +1 -0
  82. package/runtime-dist/c-g0ncg08s.js +7 -0
  83. package/runtime-dist/{c-pk2cv8zh.js → c-g0s6z8fh.js} +1 -1
  84. package/runtime-dist/c-gqaaq5xd.js +2 -0
  85. package/runtime-dist/c-gty08djr.js +2 -0
  86. package/runtime-dist/{c-p3z8t4n5.js → c-hcd75fdn.js} +1 -1
  87. package/runtime-dist/c-hddfmemr.js +2 -0
  88. package/runtime-dist/c-hqtxax0h.js +1 -0
  89. package/runtime-dist/{c-1hzd2pqr.js → c-hwgt6amh.js} +2 -2
  90. package/runtime-dist/c-jhscxp68.js +1 -0
  91. package/runtime-dist/c-jpgfd99h.js +1 -0
  92. package/runtime-dist/c-kt8hnx3r.js +1 -0
  93. package/runtime-dist/{c-pyj696ce.js → c-m4wr50z4.js} +1 -1
  94. package/runtime-dist/{c-rktc0ksd.js → c-mb798tvv.js} +2 -2
  95. package/runtime-dist/c-mpvzhygt.js +1 -0
  96. package/runtime-dist/c-mqwew5y8.js +1 -0
  97. package/runtime-dist/{c-sd570jk7.js → c-n5896ck3.js} +2 -2
  98. package/runtime-dist/{c-d3hafdna.js → c-nacvp4ca.js} +1 -1
  99. package/runtime-dist/c-ncw09fhf.js +1 -0
  100. package/runtime-dist/c-nm6tjep8.js +1 -0
  101. package/runtime-dist/c-p1cbp7e1.js +1 -0
  102. package/runtime-dist/c-pager3te.js +1 -0
  103. package/runtime-dist/c-pca88tas.js +1 -0
  104. package/runtime-dist/c-pp0qxmbz.js +2 -0
  105. package/runtime-dist/{c-mdj990nz.js → c-ppc1a1as.js} +2 -2
  106. package/runtime-dist/c-pttdwpdd.js +1 -0
  107. package/runtime-dist/c-q9h7pf4v.js +2 -0
  108. package/runtime-dist/c-qcz7q5fj.js +2 -0
  109. package/runtime-dist/c-qhv2qby2.js +2 -0
  110. package/runtime-dist/c-r539tr5f.js +1 -0
  111. package/runtime-dist/c-r7qgrz3b.js +2 -0
  112. package/runtime-dist/c-ra7b526a.js +1 -0
  113. package/runtime-dist/c-rm3pkjj7.js +1 -0
  114. package/runtime-dist/c-sgr6dj0y.js +3 -0
  115. package/runtime-dist/c-spzfyqjp.js +2 -0
  116. package/runtime-dist/c-srccgg45.js +2 -0
  117. package/runtime-dist/c-stez1fhk.js +2 -0
  118. package/runtime-dist/{c-b5wfx90n.js → c-t31wwv0j.js} +1 -1
  119. package/runtime-dist/{c-p8wyhrwm.js → c-t8hew4h2.js} +2 -2
  120. package/runtime-dist/c-tc2bxsyc.js +1 -0
  121. package/runtime-dist/c-tjk566f2.js +2 -0
  122. package/runtime-dist/c-tjqjxwfa.js +1 -0
  123. package/runtime-dist/c-tpa4vh9k.js +1 -0
  124. package/runtime-dist/c-v43kzdgm.js +350 -0
  125. package/runtime-dist/c-v73qt5av.js +800 -0
  126. package/runtime-dist/c-w1cb3r8h.js +1 -0
  127. package/runtime-dist/c-wcha6k7x.js +1 -0
  128. package/runtime-dist/c-wrja8cc7.js +2 -0
  129. package/runtime-dist/c-x0evjwqg.js +2 -0
  130. package/runtime-dist/c-x2jj49ts.js +1 -0
  131. package/runtime-dist/c-x4aywmb9.js +2 -0
  132. package/runtime-dist/c-xhyafw4q.js +1 -0
  133. package/runtime-dist/c-xyqqhx8j.js +14 -0
  134. package/runtime-dist/c-y7f2tjg6.js +7 -0
  135. package/runtime-dist/c-yf86vgtz.js +2 -0
  136. package/runtime-dist/c-yhzkcpdp.js +1 -0
  137. package/runtime-dist/{c-rv7cxh2k.js → c-ytpw5gj2.js} +1 -1
  138. package/runtime-dist/c-z00nq4vy.js +2 -0
  139. package/runtime-dist/c-z6dbvc3p.js +2 -0
  140. package/runtime-dist/c-zbts8rvw.js +2 -0
  141. package/runtime-dist/{c-56tgqzdn.js → c-zhvsa0wq.js} +2 -2
  142. package/runtime-dist/c-zhwr1x02.js +1 -0
  143. package/runtime-dist/c-znyeph7c.js +1 -0
  144. package/runtime-dist/maplibre-gl-csp-worker.js +6 -0
  145. package/runtime-dist/monaco/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
  146. package/runtime-dist/monaco/vs/base/worker/workerMain.js +31 -0
  147. package/runtime-dist/monaco/vs/basic-languages/abap/abap.js +10 -0
  148. package/runtime-dist/monaco/vs/basic-languages/apex/apex.js +10 -0
  149. package/runtime-dist/monaco/vs/basic-languages/azcli/azcli.js +10 -0
  150. package/runtime-dist/monaco/vs/basic-languages/bat/bat.js +10 -0
  151. package/runtime-dist/monaco/vs/basic-languages/bicep/bicep.js +11 -0
  152. package/runtime-dist/monaco/vs/basic-languages/cameligo/cameligo.js +10 -0
  153. package/runtime-dist/monaco/vs/basic-languages/clojure/clojure.js +10 -0
  154. package/runtime-dist/monaco/vs/basic-languages/coffee/coffee.js +10 -0
  155. package/runtime-dist/monaco/vs/basic-languages/cpp/cpp.js +10 -0
  156. package/runtime-dist/monaco/vs/basic-languages/csharp/csharp.js +10 -0
  157. package/runtime-dist/monaco/vs/basic-languages/csp/csp.js +10 -0
  158. package/runtime-dist/monaco/vs/basic-languages/css/css.js +12 -0
  159. package/runtime-dist/monaco/vs/basic-languages/cypher/cypher.js +10 -0
  160. package/runtime-dist/monaco/vs/basic-languages/dart/dart.js +10 -0
  161. package/runtime-dist/monaco/vs/basic-languages/dockerfile/dockerfile.js +10 -0
  162. package/runtime-dist/monaco/vs/basic-languages/ecl/ecl.js +10 -0
  163. package/runtime-dist/monaco/vs/basic-languages/elixir/elixir.js +10 -0
  164. package/runtime-dist/monaco/vs/basic-languages/flow9/flow9.js +10 -0
  165. package/runtime-dist/monaco/vs/basic-languages/freemarker2/freemarker2.js +12 -0
  166. package/runtime-dist/monaco/vs/basic-languages/fsharp/fsharp.js +10 -0
  167. package/runtime-dist/monaco/vs/basic-languages/go/go.js +10 -0
  168. package/runtime-dist/monaco/vs/basic-languages/graphql/graphql.js +10 -0
  169. package/runtime-dist/monaco/vs/basic-languages/handlebars/handlebars.js +10 -0
  170. package/runtime-dist/monaco/vs/basic-languages/hcl/hcl.js +10 -0
  171. package/runtime-dist/monaco/vs/basic-languages/html/html.js +10 -0
  172. package/runtime-dist/monaco/vs/basic-languages/ini/ini.js +10 -0
  173. package/runtime-dist/monaco/vs/basic-languages/java/java.js +10 -0
  174. package/runtime-dist/monaco/vs/basic-languages/javascript/javascript.js +10 -0
  175. package/runtime-dist/monaco/vs/basic-languages/julia/julia.js +10 -0
  176. package/runtime-dist/monaco/vs/basic-languages/kotlin/kotlin.js +10 -0
  177. package/runtime-dist/monaco/vs/basic-languages/less/less.js +11 -0
  178. package/runtime-dist/monaco/vs/basic-languages/lexon/lexon.js +10 -0
  179. package/runtime-dist/monaco/vs/basic-languages/liquid/liquid.js +10 -0
  180. package/runtime-dist/monaco/vs/basic-languages/lua/lua.js +10 -0
  181. package/runtime-dist/monaco/vs/basic-languages/m3/m3.js +10 -0
  182. package/runtime-dist/monaco/vs/basic-languages/markdown/markdown.js +10 -0
  183. package/runtime-dist/monaco/vs/basic-languages/mdx/mdx.js +10 -0
  184. package/runtime-dist/monaco/vs/basic-languages/mips/mips.js +10 -0
  185. package/runtime-dist/monaco/vs/basic-languages/msdax/msdax.js +10 -0
  186. package/runtime-dist/monaco/vs/basic-languages/mysql/mysql.js +10 -0
  187. package/runtime-dist/monaco/vs/basic-languages/objective-c/objective-c.js +10 -0
  188. package/runtime-dist/monaco/vs/basic-languages/pascal/pascal.js +10 -0
  189. package/runtime-dist/monaco/vs/basic-languages/pascaligo/pascaligo.js +10 -0
  190. package/runtime-dist/monaco/vs/basic-languages/perl/perl.js +10 -0
  191. package/runtime-dist/monaco/vs/basic-languages/pgsql/pgsql.js +10 -0
  192. package/runtime-dist/monaco/vs/basic-languages/php/php.js +10 -0
  193. package/runtime-dist/monaco/vs/basic-languages/pla/pla.js +10 -0
  194. package/runtime-dist/monaco/vs/basic-languages/postiats/postiats.js +10 -0
  195. package/runtime-dist/monaco/vs/basic-languages/powerquery/powerquery.js +10 -0
  196. package/runtime-dist/monaco/vs/basic-languages/powershell/powershell.js +10 -0
  197. package/runtime-dist/monaco/vs/basic-languages/protobuf/protobuf.js +11 -0
  198. package/runtime-dist/monaco/vs/basic-languages/pug/pug.js +10 -0
  199. package/runtime-dist/monaco/vs/basic-languages/python/python.js +10 -0
  200. package/runtime-dist/monaco/vs/basic-languages/qsharp/qsharp.js +10 -0
  201. package/runtime-dist/monaco/vs/basic-languages/r/r.js +10 -0
  202. package/runtime-dist/monaco/vs/basic-languages/razor/razor.js +10 -0
  203. package/runtime-dist/monaco/vs/basic-languages/redis/redis.js +10 -0
  204. package/runtime-dist/monaco/vs/basic-languages/redshift/redshift.js +10 -0
  205. package/runtime-dist/monaco/vs/basic-languages/restructuredtext/restructuredtext.js +10 -0
  206. package/runtime-dist/monaco/vs/basic-languages/ruby/ruby.js +10 -0
  207. package/runtime-dist/monaco/vs/basic-languages/rust/rust.js +10 -0
  208. package/runtime-dist/monaco/vs/basic-languages/sb/sb.js +10 -0
  209. package/runtime-dist/monaco/vs/basic-languages/scala/scala.js +10 -0
  210. package/runtime-dist/monaco/vs/basic-languages/scheme/scheme.js +10 -0
  211. package/runtime-dist/monaco/vs/basic-languages/scss/scss.js +12 -0
  212. package/runtime-dist/monaco/vs/basic-languages/shell/shell.js +10 -0
  213. package/runtime-dist/monaco/vs/basic-languages/solidity/solidity.js +10 -0
  214. package/runtime-dist/monaco/vs/basic-languages/sophia/sophia.js +10 -0
  215. package/runtime-dist/monaco/vs/basic-languages/sparql/sparql.js +10 -0
  216. package/runtime-dist/monaco/vs/basic-languages/sql/sql.js +10 -0
  217. package/runtime-dist/monaco/vs/basic-languages/st/st.js +10 -0
  218. package/runtime-dist/monaco/vs/basic-languages/swift/swift.js +13 -0
  219. package/runtime-dist/monaco/vs/basic-languages/systemverilog/systemverilog.js +10 -0
  220. package/runtime-dist/monaco/vs/basic-languages/tcl/tcl.js +10 -0
  221. package/runtime-dist/monaco/vs/basic-languages/twig/twig.js +10 -0
  222. package/runtime-dist/monaco/vs/basic-languages/typescript/typescript.js +10 -0
  223. package/runtime-dist/monaco/vs/basic-languages/typespec/typespec.js +10 -0
  224. package/runtime-dist/monaco/vs/basic-languages/vb/vb.js +10 -0
  225. package/runtime-dist/monaco/vs/basic-languages/wgsl/wgsl.js +307 -0
  226. package/runtime-dist/monaco/vs/basic-languages/xml/xml.js +10 -0
  227. package/runtime-dist/monaco/vs/basic-languages/yaml/yaml.js +10 -0
  228. package/runtime-dist/monaco/vs/editor/editor.main.css +8 -0
  229. package/runtime-dist/monaco/vs/editor/editor.main.js +798 -0
  230. package/runtime-dist/monaco/vs/language/css/cssMode.js +13 -0
  231. package/runtime-dist/monaco/vs/language/css/cssWorker.js +77 -0
  232. package/runtime-dist/monaco/vs/language/html/htmlMode.js +13 -0
  233. package/runtime-dist/monaco/vs/language/html/htmlWorker.js +454 -0
  234. package/runtime-dist/monaco/vs/language/json/jsonMode.js +19 -0
  235. package/runtime-dist/monaco/vs/language/json/jsonWorker.js +42 -0
  236. package/runtime-dist/monaco/vs/language/typescript/tsMode.js +20 -0
  237. package/runtime-dist/monaco/vs/language/typescript/tsWorker.js +51328 -0
  238. package/runtime-dist/monaco/vs/loader.js +11 -0
  239. package/runtime-dist/monaco/vs/nls.messages.de.js +21 -0
  240. package/runtime-dist/monaco/vs/nls.messages.es.js +21 -0
  241. package/runtime-dist/monaco/vs/nls.messages.fr.js +19 -0
  242. package/runtime-dist/monaco/vs/nls.messages.it.js +19 -0
  243. package/runtime-dist/monaco/vs/nls.messages.ja.js +21 -0
  244. package/runtime-dist/monaco/vs/nls.messages.ko.js +19 -0
  245. package/runtime-dist/monaco/vs/nls.messages.ru.js +21 -0
  246. package/runtime-dist/monaco/vs/nls.messages.zh-cn.js +21 -0
  247. package/runtime-dist/monaco/vs/nls.messages.zh-tw.js +19 -0
  248. package/runtime-dist/monaco-worker.js +4 -0
  249. package/runtime-dist/ui-maplibre-gl.css +1 -0
  250. package/runtime-dist/version.json +1 -1
  251. package/src/index.ts +1 -1
  252. package/src/items.ts +96 -0
  253. package/runtime-dist/c-031pq7qf.js +0 -2
  254. package/runtime-dist/c-1q9r6ndn.js +0 -1
  255. package/runtime-dist/c-1re10yb3.js +0 -1
  256. package/runtime-dist/c-1v1v69qs.js +0 -1
  257. package/runtime-dist/c-1yjbg3yb.js +0 -1
  258. package/runtime-dist/c-2ag31260.js +0 -2
  259. package/runtime-dist/c-2c88ebgp.js +0 -1
  260. package/runtime-dist/c-30chvm5x.js +0 -1
  261. package/runtime-dist/c-37zx0wkd.js +0 -1
  262. package/runtime-dist/c-4agg4qbw.js +0 -1
  263. package/runtime-dist/c-4g3757ck.js +0 -2
  264. package/runtime-dist/c-4vjd8na5.js +0 -1
  265. package/runtime-dist/c-523qwqen.js +0 -2
  266. package/runtime-dist/c-5gfe19fa.js +0 -1
  267. package/runtime-dist/c-5ma45m2j.js +0 -1
  268. package/runtime-dist/c-74emmp4y.js +0 -1
  269. package/runtime-dist/c-82sqd7as.js +0 -1
  270. package/runtime-dist/c-8ahb2ywd.js +0 -1
  271. package/runtime-dist/c-8cc3yqpn.js +0 -1
  272. package/runtime-dist/c-8h2rwbd8.js +0 -1
  273. package/runtime-dist/c-8nyvd0h0.js +0 -1
  274. package/runtime-dist/c-8r1pgc8w.js +0 -1
  275. package/runtime-dist/c-8x8fdn2b.js +0 -1
  276. package/runtime-dist/c-8xxzrkpg.js +0 -2
  277. package/runtime-dist/c-bhgqqt5x.js +0 -2
  278. package/runtime-dist/c-c60s3ncm.js +0 -2
  279. package/runtime-dist/c-cfrv87cv.js +0 -1
  280. package/runtime-dist/c-d8hfdner.js +0 -2
  281. package/runtime-dist/c-d9rzqgda.js +0 -1
  282. package/runtime-dist/c-dx8zkcbf.js +0 -1
  283. package/runtime-dist/c-e3rddwjq.js +0 -1
  284. package/runtime-dist/c-fbtxac36.js +0 -1
  285. package/runtime-dist/c-g4dt7z6r.js +0 -2
  286. package/runtime-dist/c-g6vc4fyb.js +0 -1
  287. package/runtime-dist/c-g9jhyx8j.js +0 -1
  288. package/runtime-dist/c-gf4wzfng.js +0 -1
  289. package/runtime-dist/c-gfzghvh2.js +0 -1
  290. package/runtime-dist/c-grqtxpm9.js +0 -1
  291. package/runtime-dist/c-hgdk0vqh.js +0 -1
  292. package/runtime-dist/c-hrbpqm8q.js +0 -2
  293. package/runtime-dist/c-j63hz554.js +0 -2
  294. package/runtime-dist/c-jy6yg5r5.js +0 -3
  295. package/runtime-dist/c-k3yb5e72.js +0 -2
  296. package/runtime-dist/c-k624qrhh.js +0 -2
  297. package/runtime-dist/c-kaqzctfm.js +0 -15
  298. package/runtime-dist/c-kbg0cafy.js +0 -2
  299. package/runtime-dist/c-kmx0mv0c.js +0 -2
  300. package/runtime-dist/c-kqsnm92z.js +0 -1
  301. package/runtime-dist/c-mcy4rvac.js +0 -2
  302. package/runtime-dist/c-mhzk96e8.js +0 -1
  303. package/runtime-dist/c-mv93h1f5.js +0 -1
  304. package/runtime-dist/c-mvdn43tv.js +0 -2
  305. package/runtime-dist/c-n27dcy6d.js +0 -2
  306. package/runtime-dist/c-n9cyhrcb.js +0 -2
  307. package/runtime-dist/c-ny0mdx7k.js +0 -2
  308. package/runtime-dist/c-pfc9b97d.js +0 -1
  309. package/runtime-dist/c-pj08sk6j.js +0 -2
  310. package/runtime-dist/c-py0rvzyv.js +0 -1
  311. package/runtime-dist/c-qzar8xvm.js +0 -2
  312. package/runtime-dist/c-rj7c7mwf.js +0 -2
  313. package/runtime-dist/c-rm0av36n.js +0 -1
  314. package/runtime-dist/c-s3vrabx6.js +0 -1
  315. package/runtime-dist/c-sjajadt4.js +0 -2
  316. package/runtime-dist/c-t83mbx7z.js +0 -1
  317. package/runtime-dist/c-tsyjqc1h.js +0 -2
  318. package/runtime-dist/c-vmp3ee81.js +0 -1
  319. package/runtime-dist/c-vztkfwfq.js +0 -1
  320. package/runtime-dist/c-xw7vce7r.js +0 -2
  321. package/runtime-dist/c-y7abh583.js +0 -1
  322. package/runtime-dist/c-ynwn0vws.js +0 -1
  323. package/runtime-dist/c-za724ed4.js +0 -1
  324. package/runtime-dist/c-zt8jhyxz.js +0 -1
  325. package/runtime-dist/c-zv49taf7.js +0 -1
@@ -0,0 +1,800 @@
1
+ import{Dr,hr}from"./c-g0ncg08s.js";var l0=hr(function(_l,a0){(function(W,Xi){typeof _l=="object"&&typeof a0<"u"?Xi(_l):typeof define=="function"&&define.amd?define(["exports"],Xi):Xi((W=typeof globalThis<"u"?globalThis:W||self).maplibregl={})})(_l,function(W){var Xi,sd,ad="5.24.1";function it(t,e,i,r){return new(i||(i=Promise))(function(n,o){function s(l){try{c(r.next(l))}catch(u){o(u)}}function a(l){try{c(r.throw(l))}catch(u){o(u)}}function c(l){var u;l.done?n(l.value):(u=l.value,u instanceof i?u:new i(function(h){h(u)})).then(s,a)}c((r=r.apply(t,e||[])).next())})}function z(t,e){this.x=t,this.y=e}function ld(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}typeof SuppressedError=="function"&&SuppressedError,z.prototype={clone(){return new z(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),i=Math.sin(t),r=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=r,this},_rotateAround(t,e){let i=Math.cos(t),r=Math.sin(t),n=e.y+r*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-r*(this.y-e.y),this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:z},z.convert=function(t){if(t instanceof z)return t;if(Array.isArray(t))return new z(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new z(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};var c0=function(){if(sd)return Xi;function t(e,i,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=n}return sd=1,Xi=t,t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=0.000001),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<i)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<0.000001)break;r-=o/s}var a=0,c=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<i));n++)e>o?a=r:c=r,r=0.5*(c-a)+a;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Xi}(),h0=ld(c0);let gl,Wo;function cd(){return gl!=null||(gl=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),gl}var oe=0.000001,Qt=typeof Float32Array<"u"?Float32Array:Array;function hd(){var t=new Qt(4);return Qt!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function ud(){var t=new Qt(9);return Qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Ci(){var t=new Qt(16);return Qt!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function yl(t){var e=new Qt(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function He(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ho(t,e){var i=e[0],r=e[1],n=e[2],o=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],_=e[14],y=e[15],v=i*a-r*s,g=i*c-n*s,x=i*l-o*s,b=r*c-n*a,w=r*l-o*a,T=n*l-o*c,P=u*m-h*f,S=u*_-p*f,E=u*y-d*f,I=h*_-p*m,C=h*y-d*m,A=p*y-d*_,M=v*A-g*C+x*I+b*E-w*S+T*P;return M?(t[0]=(a*A-c*C+l*I)*(M=1/M),t[1]=(n*C-r*A-o*I)*M,t[2]=(m*T-_*w+y*b)*M,t[3]=(p*w-h*T-d*b)*M,t[4]=(c*E-s*A-l*S)*M,t[5]=(i*A-n*E+o*S)*M,t[6]=(_*x-f*T-y*g)*M,t[7]=(u*T-p*x+d*g)*M,t[8]=(s*C-a*E+l*P)*M,t[9]=(r*E-i*C-o*P)*M,t[10]=(f*w-m*x+y*v)*M,t[11]=(h*x-u*w-d*v)*M,t[12]=(a*S-s*I-c*P)*M,t[13]=(i*I-r*S+n*P)*M,t[14]=(m*g-f*b-_*v)*M,t[15]=(u*b-h*g+p*v)*M,t):null}function Sr(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],_=e[13],y=e[14],v=e[15],g=i[0],x=i[1],b=i[2],w=i[3];return t[0]=g*r+x*a+b*h+w*m,t[1]=g*n+x*c+b*p+w*_,t[2]=g*o+x*l+b*d+w*y,t[3]=g*s+x*u+b*f+w*v,t[4]=(g=i[4])*r+(x=i[5])*a+(b=i[6])*h+(w=i[7])*m,t[5]=g*n+x*c+b*p+w*_,t[6]=g*o+x*l+b*d+w*y,t[7]=g*s+x*u+b*f+w*v,t[8]=(g=i[8])*r+(x=i[9])*a+(b=i[10])*h+(w=i[11])*m,t[9]=g*n+x*c+b*p+w*_,t[10]=g*o+x*l+b*d+w*y,t[11]=g*s+x*u+b*f+w*v,t[12]=(g=i[12])*r+(x=i[13])*a+(b=i[14])*h+(w=i[15])*m,t[13]=g*n+x*c+b*p+w*_,t[14]=g*o+x*l+b*d+w*y,t[15]=g*s+x*u+b*f+w*v,t}function Ot(t,e,i){var r,n,o,s,a,c,l,u,h,p,d,f,m=i[0],_=i[1],y=i[2];return e===t?(t[12]=e[0]*m+e[4]*_+e[8]*y+e[12],t[13]=e[1]*m+e[5]*_+e[9]*y+e[13],t[14]=e[2]*m+e[6]*_+e[10]*y+e[14],t[15]=e[3]*m+e[7]*_+e[11]*y+e[15]):(n=e[1],o=e[2],s=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=r=e[0],t[1]=n,t[2]=o,t[3]=s,t[4]=a,t[5]=c,t[6]=l,t[7]=u,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=r*m+a*_+h*y+e[12],t[13]=n*m+c*_+p*y+e[13],t[14]=o*m+l*_+d*y+e[14],t[15]=s*m+u*_+f*y+e[15]),t}function Wt(t,e,i){var r=i[0],n=i[1],o=i[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function oi(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*n+l*r,t[5]=s*n+u*r,t[6]=a*n+h*r,t[7]=c*n+p*r,t[8]=l*n-o*r,t[9]=u*n-s*r,t[10]=h*n-a*r,t[11]=p*n-c*r,t}function Xo(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],c=e[3],l=e[8],u=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n-l*r,t[1]=s*n-u*r,t[2]=a*n-h*r,t[3]=c*n-p*r,t[8]=o*r+l*n,t[9]=s*r+u*n,t[10]=a*r+h*n,t[11]=c*r+p*n,t}function xi(t,e,i){var r=Math.sin(i),n=Math.cos(i),o=e[0],s=e[1],a=e[2],c=e[3],l=e[4],u=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*n+l*r,t[1]=s*n+u*r,t[2]=a*n+h*r,t[3]=c*n+p*r,t[4]=l*n-o*r,t[5]=u*n-s*r,t[6]=h*n-a*r,t[7]=p*n-c*r,t}var vl=function(t,e,i,r,n){var o=1/Math.tan(e/2);if(t[0]=o/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,n!=null&&n!==1/0){var s=1/(r-n);t[10]=(n+r)*s,t[14]=2*n*r*s}else t[10]=-1,t[14]=-2*r;return t},si=function(t,e,i,r,n,o,s){var a=1/(e-i),c=1/(r-n),l=1/(o-s);return t[0]=-2*a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+i)*a,t[13]=(n+r)*c,t[14]=(s+o)*l,t[15]=1,t};function dd(){var t=new Qt(3);return Qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function xl(t){var e=new Qt(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Yo(t){var e=t[0],i=t[1],r=t[2];return Math.sqrt(e*e+i*i+r*r)}function pd(t,e,i){var r=new Qt(3);return r[0]=t,r[1]=e,r[2]=i,r}function Be(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t}function Zt(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t}function Xe(t,e){var i=e[0],r=e[1],n=e[2],o=i*i+r*r+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function ce(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ai(t,e,i){var r=e[0],n=e[1],o=e[2],s=i[0],a=i[1],c=i[2];return t[0]=n*c-o*a,t[1]=o*s-r*c,t[2]=r*a-n*s,t}function bl(t,e,i){var r=i[0],n=i[1],o=i[2],s=i[3],a=e[0],c=e[1],l=e[2],u=n*l-o*c,h=o*a-r*l,p=r*c-n*a;return t[0]=a+s*(u+=u)+n*(p+=p)-o*(h+=h),t[1]=c+s*h+o*u-r*p,t[2]=l+s*p+r*h-n*u,t}function Ko(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0],o[1]=n[1]*Math.cos(r)-n[2]*Math.sin(r),o[2]=n[1]*Math.sin(r)+n[2]*Math.cos(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function An(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[2]*Math.sin(r)+n[0]*Math.cos(r),o[1]=n[1],o[2]=n[2]*Math.cos(r)-n[0]*Math.sin(r),t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}function wl(t,e,i,r){var n=[],o=[];return n[0]=e[0]-i[0],n[1]=e[1]-i[1],n[2]=e[2]-i[2],o[0]=n[0]*Math.cos(r)-n[1]*Math.sin(r),o[1]=n[0]*Math.sin(r)+n[1]*Math.cos(r),o[2]=n[2],t[0]=o[0]+i[0],t[1]=o[1]+i[1],t[2]=o[2]+i[2],t}var zn,bi=function(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t},Tl=Yo;function Yt(t,e,i){var r=e[0],n=e[1],o=e[2],s=e[3];return t[0]=i[0]*r+i[4]*n+i[8]*o+i[12]*s,t[1]=i[1]*r+i[5]*n+i[9]*o+i[13]*s,t[2]=i[2]*r+i[6]*n+i[10]*o+i[14]*s,t[3]=i[3]*r+i[7]*n+i[11]*o+i[15]*s,t}function fd(){var t=new Qt(4);return Qt!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function md(t,e,i,r){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",o=Math.PI/360;e*=o,r*=o,i*=o;var s=Math.sin(e),a=Math.cos(e),c=Math.sin(i),l=Math.cos(i),u=Math.sin(r),h=Math.cos(r);switch(n){case"xyz":t[0]=s*l*h+a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h-s*c*u;break;case"xzy":t[0]=s*l*h-a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h+s*c*u;break;case"yxz":t[0]=s*l*h+a*c*u,t[1]=a*c*h-s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h+s*c*u;break;case"yzx":t[0]=s*l*h+a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h-s*c*u;break;case"zxy":t[0]=s*l*h-a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u+s*c*h,t[3]=a*l*h-s*c*u;break;case"zyx":t[0]=s*l*h-a*c*u,t[1]=a*c*h+s*l*u,t[2]=a*l*u-s*c*h,t[3]=a*l*h+s*c*u;break;default:throw Error("Unknown angle order "+n)}return t}function Sl(){var t=new Qt(2);return Qt!=Float32Array&&(t[0]=0,t[1]=0),t}function _d(t,e){var i=new Qt(2);return i[0]=t,i[1]=e,i}function gd(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t}function yd(t){var e=t[0],i=t[1];return Math.sqrt(e*e+i*i)}function vd(t){return t[0]=0,t[1]=0,t}dd(),zn=new Qt(4),Qt!=Float32Array&&(zn[0]=0,zn[1]=0,zn[2]=0,zn[3]=0),dd(),pd(1,0,0),pd(0,1,0),fd(),fd(),ud();var u0=function(t){var e=t[0],i=t[1];return e*e+i*i};Sl();let F=8192;function Me(t,e,i){return e*(F/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function me(t){return t instanceof Error?t:Error(typeof t=="string"?t:String(t))}function Dn(){return new Float64Array(4)}function Gt(){return new Float64Array(3)}function Ai(){return new Float64Array(16)}function Pr(){let t=new Float64Array(16);return He(t),t}function xd(){let t=new Float32Array(16);return He(t),t}function zi(t,e,i,r,n=!1){if(!i[0]&&!i[1])return[0,0];let o=n?r==="map"?-t.bearingInRadians:0:r==="viewport"?t.bearingInRadians:0;if(o){let s=Math.sin(o),a=Math.cos(o);i=[i[0]*a-i[1]*s,i[0]*s+i[1]*a]}return[n?i[0]:Me(e,i[0],t.zoom),n?i[1]:Me(e,i[1],t.zoom)]}function Pl(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function Oe(t,e,i){let r=(n=[t[0],t[1],t[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((u=n[8])*(s=n[4])-(a=n[5])*(l=n[7]))+n[1]*(-u*(o=n[3])+a*(c=n[6]))+n[2]*(l*o-s*c);var n,o,s,a,c,l,u;if(r===0)return null;let h=ai([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),p=ai([],[i[0],i[1],i[2]],[t[0],t[1],t[2]]),d=ai([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),f=Zt([],h,-t[3]);return Be(f,f,Zt([],p,-e[3])),Be(f,f,Zt([],d,-i[3])),Zt(f,f,1/r),f}function d0(t,e,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return r===0?null:(-(t[0]*i[0]+t[1]*i[1]+t[2]*i[2])-i[3])/r}function Jo(t,e,i,r){let n=Math.sqrt(t*t+e*e),o=Math.sqrt(i*i+r*r);t/=n,e/=n,i/=o,r/=o;let s=Math.acos(t*i+e*r);return-e*i+t*r>0?s:-s}function Ce(t,e){let i=Ir(t,360),r=Ir(e,360),n=r-i,o=r>i?n-360:n+360;return Math.abs(n)<Math.abs(o)?n:o}function Qo(t,e){let i=Ir(t,2*Math.PI),r=Ir(e,2*Math.PI);return Math.min(Math.abs(i-r),Math.abs(i-r+2*Math.PI),Math.abs(i-r-2*Math.PI))}function Ir(t,e){return(t%e+e)%e}function ts(t,e,i,r,n){return Er(r,n,_t((t-e)/(i-e),0,1))}function Er(t,e,i){return t*(1-i)+e*i}function p0(t){let e=1/0,i=1/0,r=-1/0,n=-1/0;for(let o of t)e=Math.min(e,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),n=Math.max(n,o.y);return[e,i,r,n]}function bd(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,i=e*t;return 4*(t<0.5?i:3*(t-e)+i-0.75)}function Il(t,e,i,r){let n=new h0(t,e,i,r);return(o)=>n.solve(o)}let El=Il(0.25,0.1,0.25,1);function _t(t,e,i){return Math.min(i,Math.max(e,t))}function Ye(t,e,i){let r=i-e,n=((t-e)%r+r)%r+e;return n===e?i:n}function G(t,...e){for(let i of e)for(let r in i)t[r]=i[r];return t}function Rn(t,e){let i={};for(let r of e)r in t&&(i[r]=t[r]);return i}let f0=1;function wd(){return f0++}function _e(t){return Math.pow(2,t)}function he(t){return Math.log(t)/Math.LN2}function Ae(t,e,i){if(e<=0)return t;let r=1/e;return i===void 0||Math.abs(i)<0.0000000001?Math.round(t*r)/r:(i>0?Math.ceil(t*r-0.000000001):Math.floor(t*r+0.0000000001))/r}function Ml(t,e,i){let r={};for(let n in t)r[n]=e.call(this,t[n],n,t);return r}function Td(t,e,i){let r={};for(let n in t)e.call(this,t[n],n,t)&&(r[n]=t[n]);return r}function li(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!li(t[i],e[i]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object")return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!li(t[i],e[i]))return!1;return!0}return t===e}function be(t){return Array.isArray(t)?t.map(be):typeof t=="object"&&t?Ml(t,be):t}let Sd={};function Ct(t){Sd[t]||(typeof console<"u"&&console.warn(t),Sd[t]=!0)}function Di(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function Mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}let Cl=null;function Yi(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}let Pd="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Al(t,e,i,r){return t.addEventListener(e,i,r),{unsubscribe:()=>{t.removeEventListener(e,i,r)}}}function Vt(t){return t*Math.PI/180}function Cr(t){return t/Math.PI*180}function Id(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing}function Ed(t,e,i){let r=_d(e.x-i.x,e.y-i.y),n=_d(t.x-i.x,t.y-i.y);var o,s;return Cr(Math.atan2(r[0]*n[1]-r[1]*n[0],(o=r)[0]*(s=n)[0]+o[1]*s[1]))}function Md(t,e,i){let r=new Float64Array(4);return md(r,t,e-90,i),r}let kn=85.051129,Cd={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Ad={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function m0(t,e){var i;if(!Ad[e])return!1;let r=t==null?void 0:t.target,n=((i=r==null?void 0:r.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return t instanceof n.MouseEvent||t instanceof n.WheelEvent}let zl="AbortError";class Ln extends Error{constructor(t=zl){super(t instanceof Error?t.message:t),this.name=zl,t instanceof Error&&t.stack&&(this.stack=t.stack)}}function Ar(t){return t instanceof Error&&t.name===zl}function zd(t){if(t.aborted)throw new Ln(t.reason)}let es,Dl,Rl,ge={frame(t,e,i,r){let n=r||window,o=n.requestAnimationFrame((a)=>{s(),e(a)}),{unsubscribe:s}=Al(t.signal,"abort",()=>{s(),n.cancelAnimationFrame(o),i(new Ln(t.signal.reason))},!1)},frameAsync(t,e){return new Promise((i,r)=>{this.frame(t,i,r,e)})},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){let e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,i.drawImage(t,0,0,t.width,t.height),i},resolveURL:(t)=>(es||(es=document.createElement("a")),es.href=t,es.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Rl!==void 0?Rl:!!matchMedia&&(Dl!=null||(Dl=matchMedia("(prefers-reduced-motion: reduce)")),Dl.matches)},set prefersReducedMotion(t){Rl=t}},is=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(t){this._frozenAt=t}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function St(){return is.getCurrentTime()}var kl;let _0=new Set(["a","abbr","b","bdi","bdo","br","cite","code","del","div","em","i","img","ins","kbd","li","mark","ol","p","q","s","samp","small","span","strong","sub","sup","time","u","ul","var","wbr"]),g0=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),y0=new Set(["href","src"]),v0=new Set(["http:","https:","mailto:"]),Ll;function Fl(){return Ll!=null||(Ll={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get}),Ll}class N{static create(t,e,i){let r=window.document.createElement(t);return e!==void 0&&(r.className=e),i&&i.appendChild(r),r}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){N.docStyle&&N.selectProp&&(N.userSelect=N.docStyle[N.selectProp],N.docStyle[N.selectProp]="none")}static enableDrag(){N.docStyle&&N.selectProp&&(N.docStyle[N.selectProp]=N.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",N.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",N.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",N.suppressClickInternal,!0)},0)}static getScale(t){let e=t.getBoundingClientRect();return{x:e.width/t.offsetWidth||1,y:e.height/t.offsetHeight||1,boundingClientRect:e}}static getPoint(t,e,i){let r=e.boundingClientRect;return new z((i.clientX-r.left)/e.x-t.clientLeft,(i.clientY-r.top)/e.y-t.clientTop)}static mousePos(t,e){let i=N.getScale(t);return N.getPoint(t,i,e)}static touchPos(t,e){let i=[],r=N.getScale(t);for(let n of e)i.push(N.getPoint(t,r,n));return i}static sanitize(t){let e=new DOMParser().parseFromString(t,"text/html").body,{querySelectorAll:i,remove:r}=Fl();for(let o of Array.from(i.call(e,"*")))N.isAllowedElement(o)?N.removeDisallowedAttributes(o):r.call(o);let n=document.createDocumentFragment();return n.append(...e.childNodes),n}static isAllowedElement(t){let{namespaceURI:e,localName:i}=Fl();return e.call(t)==="http://www.w3.org/1999/xhtml"&&_0.has(i.call(t))}static removeDisallowedAttributes(t){let{getAttributeNames:e,getAttribute:i,removeAttribute:r}=Fl();for(let n of e.call(t))N.isAllowedAttribute(n,i.call(t,n))||r.call(t,n)}static isAllowedAttribute(t,e){if(!g0.has(t)&&!t.startsWith("aria-"))return!1;if(!y0.has(t))return!0;try{return v0.has(new URL(e,"https://maplibre.invalid/").protocol)}catch(i){return!1}}}N.docStyle=typeof window<"u"&&((kl=window.document)===null||kl===void 0?void 0:kl.documentElement.style),N.selectProp=!N.docStyle||"userSelect"in N.docStyle?"userSelect":"webkitUserSelect";let ze={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dd(t){return ze.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}let Bl="global-dispatcher";class zr extends Error{constructor(t,e,i,r){super(`AJAXError: ${e} (${t}): ${i}`),this.status=t,this.statusText=e,this.url=i,this.body=r}}let Ol=()=>{var t;return Mr(self)?(t=self.worker)===null||t===void 0?void 0:t.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href},rs=function(t,e){return it(this,void 0,void 0,function*(){var i,r;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=Dd(t.url);if(n){let o=yield n(t,e);return o.data||t.type!=="arrayBuffer"?o:G(o,{data:new ArrayBuffer(0)})}if(Mr(self)&&((i=self.worker)===null||i===void 0?void 0:i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:Bl},e)}if(!((n)=>{var o;return n.startsWith("file:")||((o=Ol())===null||o===void 0?void 0:o.startsWith("file:"))&&!/^\w+:/.test(n)})(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return function(n,o){return it(this,void 0,void 0,function*(){let s=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,cache:n.cache,referrer:Ol(),referrerPolicy:n.referrerPolicy,signal:o.signal}),a,c;n.type!=="json"||s.headers.has("Accept")||s.headers.set("Accept","application/json");try{a=yield fetch(s)}catch(u){if(Ar(u))throw u;throw new zr(0,me(u).message,n.url,new Blob)}if(!a.ok){let u=yield a.blob();throw new zr(a.status,a.statusText,n.url,u)}c=n.type==="arrayBuffer"||n.type==="image"?a.arrayBuffer():n.type==="json"?a.json():a.text();let l=yield c;return zd(o.signal),{data:l,cacheControl:a.headers.get("Cache-Control"),expires:a.headers.get("Expires"),etag:a.headers.get("ETag")}})}(t,e);if(Mr(self)&&((r=self.worker)===null||r===void 0?void 0:r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Bl},e)}return function(n,o){return new Promise((s,a)=>{var c;let l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type!=="arrayBuffer"&&n.type!=="image"||(l.responseType="arraybuffer");for(let u in n.headers)l.setRequestHeader(u,n.headers[u]);n.type==="json"&&(l.responseType="text",((c=n.headers)===null||c===void 0?void 0:c.Accept)||l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{a(Error(l.statusText))},l.onload=()=>{if(!o.signal.aborted)if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let u=l.response;if(n.type==="json")try{u=JSON.parse(l.response)}catch(h){return void a(h)}s({data:u,cacheControl:l.getResponseHeader("Cache-Control"),expires:l.getResponseHeader("Expires"),etag:l.getResponseHeader("ETag")})}else{let u=new Blob([l.response],{type:l.getResponseHeader("Content-Type")});a(new zr(l.status,l.statusText,n.url,u))}},o.signal.addEventListener("abort",()=>{l.abort(),a(new Ln(o.signal.reason))}),l.send(n.body)})}(t,e)})},ns=(t,e)=>rs(G(t,{type:"json"}),e);function Rd(t){if(!t||t.indexOf("://")<=0||t.startsWith("data:image/")||t.startsWith("blob:"))return!0;let e=new URL(t),i=window.location;return e.protocol===i.protocol&&e.host===i.host}var ci;(function(t){let e,i,r,n;t.resetRequestQueue=()=>{e=[],i=0,r=0,n={}},t.addThrottleControl=(c)=>{let l=r++;return n[l]=c,l},t.removeThrottleControl=(c)=>{delete n[c],s()},t.getImage=(c,l,u=!0)=>new Promise((h,p)=>{c.headers||(c.headers={}),c.headers.accept="image/webp,*/*",G(c,{type:"image"});let d={abortController:l,requestParameters:c,supportImageRefresh:u,state:"queued",onError:(f)=>{p(f)},onSuccess:(f)=>{h(f)}};e.push(d),s()});let o=(c)=>it(this,void 0,void 0,function*(){c.state="running";let{requestParameters:l,supportImageRefresh:u,onError:h,onSuccess:p,abortController:d}=c,f=u===!1&&!Mr(self)&&!Dd(l.url)&&(!l.headers||Object.keys(l.headers).reduce((y,v)=>y&&v==="accept",!0));i++;let m=f?a(l,d):rs(l,d);try{let y=yield m;delete c.abortController,c.state="completed",y.data instanceof HTMLImageElement||Yi(y.data)?p(y):y.data&&p({data:yield(_=y.data,typeof createImageBitmap=="function"?((v)=>it(void 0,void 0,void 0,function*(){if(v.byteLength===0)return createImageBitmap(new ImageData(1,1));let g=new Blob([new Uint8Array(v)],{type:"image/png"});try{return createImageBitmap(g)}catch(x){throw Error(`Could not load image because of ${me(x).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}))(_):((v)=>new Promise((g,x)=>{let b=new Image;b.onload=()=>{g(b),URL.revokeObjectURL(b.src),b.onload=null,window.requestAnimationFrame(()=>b.src=Pd)},b.onerror=()=>x(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let w=new Blob([new Uint8Array(v)],{type:"image/png"});b.src=v.byteLength?URL.createObjectURL(w):Pd}))(_)),cacheControl:y.cacheControl,expires:y.expires})}catch(y){delete c.abortController,h(me(y))}finally{i--,s()}var _}),s=()=>{let c=(()=>{for(let l of Object.keys(n))if(n[l]())return!0;return!1})()?ze.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:ze.MAX_PARALLEL_IMAGE_REQUESTS;for(let l=i;l<c&&e.length>0;l++){let u=e.shift();u.abortController.signal.aborted?l--:o(u)}},a=(c,l)=>new Promise((u,h)=>{let p=new Image,{url:d,credentials:f}=c;f&&f==="include"?p.crossOrigin="use-credentials":(f&&f==="same-origin"||!Rd(d))&&(p.crossOrigin="anonymous"),l.signal.addEventListener("abort",()=>{p.src="",h(new Ln(l.signal.reason))}),p.fetchPriority="high",p.onload=()=>{p.onerror=p.onload=null,u({data:p})},p.onerror=()=>{p.onerror=p.onload=null,l.signal.aborted||h(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},p.src=d})})(ci||(ci={})),ci.resetRequestQueue();class kd{constructor(t){this._transformRequestFn=t!=null?t:null}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function Ld(t,e,i){var r;((r=i[t])===null||r===void 0?void 0:r.includes(e))||(i[t]||(i[t]=[]),i[t].push(e))}function jl(t,e,i){if(i==null?void 0:i[t]){let r=i[t].indexOf(e);r!==-1&&i[t].splice(r,1)}}class R{constructor(t,e={}){G(this,e),this.type=t}}class J extends R{constructor(t,e={}){super("error",G({error:t},e))}}class Ht{on(t,e){return this._listeners||(this._listeners={}),Ld(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return jl(t,e,this._listeners),jl(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),Ld(t,e,this._oneTimeListeners),this):new Promise((i)=>this.once(t,i))}fire(t,e){var i,r;typeof t=="string"&&(t=new R(t,e||{}));let n=t.type;if(this.listens(n)){t.target=this;let o=((i=this._listeners)===null||i===void 0?void 0:i[n])?this._listeners[n].slice():[];for(let c of o)c.call(this,t);let s=((r=this._oneTimeListeners)===null||r===void 0?void 0:r[n])?this._oneTimeListeners[n].slice():[];for(let c of s)jl(n,c,this._oneTimeListeners),c.call(this,t);let a=this._eventedParent;a&&(G(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof J&&console.error(t.error);return this}listens(t){var e,i,r,n,o;return((i=(e=this._listeners)===null||e===void 0?void 0:e[t])===null||i===void 0?void 0:i.length)>0||((n=(r=this._oneTimeListeners)===null||r===void 0?void 0:r[t])===null||n===void 0?void 0:n.length)>0||((o=this._eventedParent)===null||o===void 0?void 0:o.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}var D={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:0.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:0.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}};let x0=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function b0(t,e){let i={};for(let r in t)r!=="ref"&&(i[r]=t[r]);return x0.forEach((r)=>{r in e&&(i[r]=e[r])}),i}function Fd(t){t=t.slice();let e=Object.create(null);for(let i=0;i<t.length;i++)e[t[i].id]=t[i];for(let i=0;i<t.length;i++)"ref"in t[i]&&(t[i]=b0(t[i],e[t[i].ref]));return t}function bt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(!bt(t[i],e[i]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object")return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(let i in t)if(!bt(t[i],e[i]))return!1;return!0}return t===e}function je(t,e){t.push(e)}function Bd(t,e,i){je(i,{command:"addSource",args:[t,e[t]]})}function Od(t,e,i){je(e,{command:"removeSource",args:[t]}),i[t]=!0}function w0(t,e,i,r){Od(t,i,r),Bd(t,e,i)}function T0(t,e,i){let r;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!bt(t[i][r],e[i][r]))return!1;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!bt(t[i][r],e[i][r]))return!1;return!0}function os(t,e,i,r,n,o){t=t||{},e=e||{};for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(bt(t[s],e[s])||i.push({command:o,args:[r,s,e[s],n]}));for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&!Object.prototype.hasOwnProperty.call(t,s)&&(bt(t[s],e[s])||i.push({command:o,args:[r,s,e[s],n]}))}function jd(t){return t.id}function Nd(t,e){return t[e.id]=e,t}class j{constructor(t,e,i,r){this.message=(t?`${t}: `:"")+i,r&&(this.identifier=r),e!=null&&e.__line__&&(this.line=e.__line__)}}function Rr(t,...e){for(let i of e)for(let r in i)t[r]=i[r];return t}class Ke extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class Nl{constructor(t,e=[]){this.parent=t,this.bindings={};for(let[i,r]of e)this.bindings[i]=r}concat(t){return new Nl(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}let Fn={kind:"null"},V={kind:"number"},ot={kind:"string"},ct={kind:"boolean"},Je={kind:"color"},ss={kind:"projectionDefinition"},Ki={kind:"object"},at={kind:"value"},as={kind:"collator"},Bn={kind:"formatted"},ls={kind:"padding"},On={kind:"colorArray"},cs={kind:"numberArray"},jn={kind:"resolvedImage"},hs={kind:"variableAnchorOffsetCollection"};function ye(t,e){return{kind:"array",itemType:t,N:e}}function kt(t){if(t.kind==="array"){let e=kt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}let S0=[Fn,V,ot,ct,Je,ss,Bn,Ki,ye(at),ls,cs,On,jn,hs];function Nn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Nn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let i of S0)if(!Nn(i,e))return null}}return`Expected ${kt(t)} but found ${kt(e)} instead.`}function Vl(t,e){return e.some((i)=>i.kind===t.kind)}function Ji(t,e){return e.some((i)=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}function Ri(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}let Vd=0.96422,Ud=0.82521,$d=0.13793103448275862,kr=0.20689655172413793,Zd=3*kr*kr,P0=kr*kr*kr,I0=Math.PI/180,E0=180/Math.PI;function Gd(t){return(t%=360)<0&&(t+=360),t}function qd([t,e,i,r]){let n,o,s=$l((0.2225045*(t=Ul(t))+0.7168786*(e=Ul(e))+0.0606169*(i=Ul(i)))/1);t===e&&e===i?n=o=s:(n=$l((0.4360747*t+0.3850649*e+0.1430804*i)/Vd),o=$l((0.0139322*t+0.0971045*e+0.7141733*i)/Ud));let a=116*s-16;return[a<0?0:a,500*(n-s),200*(s-o),r]}function Ul(t){return t<=0.04045?t/12.92:Math.pow((t+0.055)/1.055,2.4)}function $l(t){return t>P0?Math.pow(t,0.3333333333333333):t/Zd+$d}function Wd([t,e,i,r]){let n=(t+16)/116,o=isNaN(e)?n:n+e/500,s=isNaN(i)?n:n-i/200;return n=1*Gl(n),o=Vd*Gl(o),s=Ud*Gl(s),[Zl(3.1338561*o-1.6168667*n-0.4906146*s),Zl(-0.9787684*o+1.9161415*n+0.033454*s),Zl(0.0719453*o-0.2289914*n+1.4052427*s),r]}function Zl(t){return(t=t<=0.00304?12.92*t:1.055*Math.pow(t,0.4166666666666667)-0.055)<0?0:t>1?1:t}function Gl(t){return t>kr?t*t*t:Zd*(t-$d)}let M0=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Vn(t,e){return M0(t,e)?t[e]:void 0}function us(t){return parseInt(t.padEnd(2,t),16)/255}function Hd(t,e){return Lr(e?t/100:t,0,1)}function Lr(t,e,i){return Math.min(Math.max(e,t),i)}function Xd(t){return!t.some(Number.isNaN)}let C0={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function ki(t,e,i){return t+i*(e-t)}function Fr(t,e,i){return t.map((r,n)=>ki(r,e[n],i))}class Y{constructor(t,e,i,r=1,n=!0){this.r=t,this.g=e,this.b=i,this.a=r,n||(this.r*=r,this.g*=r,this.b*=r,r||this.overwriteGetter("rgb",[t,e,i,r]))}static parse(t){if(t instanceof Y)return t;if(typeof t!="string")return;let e=function(i){if((i=i.toLowerCase().trim())==="transparent")return[0,0,0,0];let r=Vn(C0,i);if(r){let[o,s,a]=r;return[o/255,s/255,a/255,1]}if(i.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(i)){let o=i.length<6?1:2,s=1;return[us(i.slice(s,s+=o)),us(i.slice(s,s+=o)),us(i.slice(s,s+=o)),us(i.slice(s,s+o)||"ff")]}if(i.startsWith("rgb")){let o=i.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(o){let[s,a,c,l,u,h,p,d,f,m,_,y]=o,v=[l||" ",p||" ",m].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let g=[c,h,f].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let b=[Lr(+a/x,0,1),Lr(+u/x,0,1),Lr(+d/x,0,1),_?Hd(+_,y):1];if(Xd(b))return b}}return}}let n=i.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[o,s,a,c,l,u,h,p,d]=n,f=[a||" ",l||" ",h].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let m=[+s,Lr(+c,0,100),Lr(+u,0,100),p?Hd(+p,d):1];if(Xd(m))return function([_,y,v,g]){function x(b){let w=(b+_/30)%12,T=y*Math.min(v,1-v);return v-T*Math.max(-1,Math.min(w-3,9-w,1))}return _=Gd(_),y/=100,v/=100,[x(0),x(8),x(4),g]}(m)}}}(t);return e?new Y(...e,!1):void 0}get rgb(){let{r:t,g:e,b:i,a:r}=this,n=r||1/0;return this.overwriteGetter("rgb",[t/n,e/n,i/n,r])}get hcl(){return this.overwriteGetter("hcl",function(t){let[e,i,r,n]=qd(t),o=Math.sqrt(i*i+r*r);return[Math.round(1e4*o)?Gd(Math.atan2(r,i)*E0):NaN,o,e,n]}(this.rgb))}get lab(){return this.overwriteGetter("lab",qd(this.rgb))}overwriteGetter(t,e){return Object.defineProperty(this,t,{value:e}),e}toString(){let[t,e,i,r]=this.rgb;return`rgba(${[t,e,i].map((n)=>Math.round(255*n)).join(",")},${r})`}static interpolate(t,e,i,r="rgb"){switch(r){case"rgb":{let[n,o,s,a]=Fr(t.rgb,e.rgb,i);return new Y(n,o,s,a,!1)}case"hcl":{let[n,o,s,a]=t.hcl,[c,l,u,h]=e.hcl,p,d;if(isNaN(n)||isNaN(c))isNaN(n)?isNaN(c)?p=NaN:(p=c,s!==1&&s!==0||(d=l)):(p=n,u!==1&&u!==0||(d=o));else{let v=c-n;c>n&&v>180?v-=360:c<n&&n-c>180&&(v+=360),p=n+i*v}let[f,m,_,y]=function([v,g,x,b]){return v=isNaN(v)?0:v*I0,Wd([x,Math.cos(v)*g,Math.sin(v)*g,b])}([p,d!=null?d:ki(o,l,i),ki(s,u,i),ki(a,h,i)]);return new Y(f,m,_,y,!1)}case"lab":{let[n,o,s,a]=Wd(Fr(t.lab,e.lab,i));return new Y(n,o,s,a,!1)}}}}Y.black=new Y(0,0,0,1),Y.white=new Y(1,1,1,1),Y.transparent=new Y(0,0,0,0),Y.red=new Y(1,0,0,1);class ds{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}let A0=["bottom","center","top"];class ps{constructor(t,e,i,r,n,o){this.text=t,this.image=e,this.scale=i,this.fontStack=r,this.textColor=n,this.verticalAlign=o}}class De{constructor(t){this.sections=t}static fromString(t){return new De([new ps(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t)=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof De?t:De.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t)=>t.text).join("")}}class ve{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ve)return t;if(typeof t=="number")return new ve([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let e of t)if(typeof e!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new ve(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new ve(Fr(t.values,e.values,i))}}class xe{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof xe)return t;if(typeof t=="number")return new xe([t]);if(Array.isArray(t)){for(let e of t)if(typeof e!="number")return;return new xe(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){return new xe(Fr(t.values,e.values,i))}}class se{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof se)return t;if(typeof t=="string"){let i=Y.parse(t);if(!i)return;return new se([i])}if(!Array.isArray(t))return;let e=[];for(let i of t){if(typeof i!="string")return;let r=Y.parse(i);if(!r)return;e.push(r)}return new se(e)}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i,r="rgb"){let n=[];if(t.values.length!=e.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${e.values.length}), cannot interpolate.`);for(let o=0;o<t.values.length;o++)n.push(Y.interpolate(t.values[o],e.values[o],i,r));return new se(n)}}class Lt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}let z0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Ne{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ne)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){let i=t[e],r=t[e+1];if(typeof i!="string"||!z0.has(i))return;if(!Array.isArray(r)||r.length!==2||typeof r[0]!="number"||typeof r[1]!="number")return}return new Ne(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,e,i){let r=t.values,n=e.values;if(r.length!==n.length)throw new Lt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);let o=[];for(let s=0;s<r.length;s+=2){if(r[s]!==n[s])throw new Lt(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${r[s]}, to[${s}]: ${n[s]}`);o.push(r[s]);let[a,c]=r[s+1],[l,u]=n[s+1];o.push([ki(a,l,i),ki(c,u,i)])}return new Ne(o)}}class Ve{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ve({name:t,available:!1}):null}}class Re{constructor(t,e,i){this.from=t,this.to=e,this.transition=i}static interpolate(t,e,i){return new Re(t,e,i)}static parse(t){return t instanceof Re?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Re(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Re(t.from,t.to,t.transition):typeof t=="string"?new Re(t,t,1):void 0}}function Yd(t,e,i,r){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[t,e,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[t,e,i,r]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Un(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Re||t instanceof Y||t instanceof ds||t instanceof De||t instanceof ve||t instanceof xe||t instanceof se||t instanceof Ne||t instanceof Ve)return!0;if(Array.isArray(t)){for(let e of t)if(!Un(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!Un(t[e]))return!1;return!0}return!1}function qt(t){if(t===null)return Fn;if(typeof t=="string")return ot;if(typeof t=="boolean")return ct;if(typeof t=="number")return V;if(t instanceof Y)return Je;if(t instanceof Re)return ss;if(t instanceof ds)return as;if(t instanceof De)return Bn;if(t instanceof ve)return ls;if(t instanceof xe)return cs;if(t instanceof se)return On;if(t instanceof Ne)return hs;if(t instanceof Ve)return jn;if(Array.isArray(t)){let e=t.length,i;for(let r of t){let n=qt(r);if(i){if(i===n)continue;i=at;break}i=n}return ye(i||at,e)}return Ki}function $n(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Y||t instanceof Re||t instanceof De||t instanceof ve||t instanceof xe||t instanceof se||t instanceof Ne||t instanceof Ve?t.toString():JSON.stringify(t)}class Qi{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(t.length!==2)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Un(t[1]))return e.error("invalid value");let i=t[1],r=qt(i),n=e.expectedType;return r.kind!=="array"||r.N!==0||!n||n.kind!=="array"||typeof n.N=="number"&&n.N!==0||(r=n),new Qi(r,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}let fs={string:ot,number:V,boolean:ct,object:Ki};class Qe{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,r=1,n=t[0];if(n==="array"){let s,a;if(t.length>2){let c=t[1];if(typeof c!="string"||!(c in fs)||c==="object")return e.error('The item type argument of "array" must be one of string, number, boolean',1);s=fs[c],r++}else s=at;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],r++}i=ye(s,a)}else{if(!fs[n])throw Error(`Types doesn't contain name = ${n}`);i=fs[n]}let o=[];for(;r<t.length;r++){let s=e.parse(t[r],r,at);if(!s)return null;o.push(s)}return new Qe(i,o)}evaluate(t){for(let e=0;e<this.args.length;e++){let i=this.args[e].evaluate(t);if(!Nn(this.type,qt(i)))return i;if(e===this.args.length-1)throw new Lt(`Expected value to be of type ${kt(this.type)}, but found ${kt(qt(i))} instead.`)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}let Kd={"to-boolean":ct,"to-color":Je,"to-number":V,"to-string":ot};class Li{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=t[0];if(!Kd[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&t.length!==2)return e.error("Expected one argument.");let r=Kd[i],n=[];for(let o=1;o<t.length;o++){let s=e.parse(t[o],o,at);if(!s)return null;n.push(s)}return new Li(r,n)}evaluate(t){switch(this.type.kind){case"boolean":return Boolean(this.args[0].evaluate(t));case"color":{let e,i;for(let r of this.args){if(e=r.evaluate(t),i=null,e instanceof Y)return e;if(typeof e=="string"){let n=t.parseColor(e);if(n)return n}else if(Array.isArray(e)&&(i=e.length<3||e.length>4?`Invalid rgba value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Yd(e[0],e[1],e[2],e[3]),!i))return new Y(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Lt(i||`Could not parse color from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"padding":{let e;for(let i of this.args){e=i.evaluate(t);let r=ve.parse(e);if(r)return r}throw new Lt(`Could not parse padding from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"numberArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=xe.parse(e);if(r)return r}throw new Lt(`Could not parse numberArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"colorArray":{let e;for(let i of this.args){e=i.evaluate(t);let r=se.parse(e);if(r)return r}throw new Lt(`Could not parse colorArray from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"variableAnchorOffsetCollection":{let e;for(let i of this.args){e=i.evaluate(t);let r=Ne.parse(e);if(r)return r}throw new Lt(`Could not parse variableAnchorOffsetCollection from value '${typeof e=="string"?e:JSON.stringify(e)}'`)}case"number":{let e=null;for(let i of this.args){if(e=i.evaluate(t),e===null)return 0;let r=Number(e);if(!isNaN(r))return r}throw new Lt(`Could not convert ${JSON.stringify(e)} to number.`)}case"formatted":return De.fromString($n(this.args[0].evaluate(t)));case"resolvedImage":return Ve.fromString($n(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return $n(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}let D0=["Unknown","Point","LineString","Polygon"];class ql{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?D0[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=Y.parse(t),this._parseColorCache.set(t,e)),e}}class ms{constructor(t,e,i=[],r,n=new Nl,o=[]){this.registry=t,this.path=i,this.key=i.map((s)=>`[${s}]`).join(""),this.scope=n,this.errors=o,this.expectedType=r,this._isConstant=e}parse(t,e,i,r,n={}){return e?this.concat(e,i,r)._parse(t,n):this._parse(t,n)}_parse(t,e){function i(r,n,o){return o==="assert"?new Qe(n,[r]):o==="coerce"?new Li(n,[r]):r}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=t[0];if(typeof r!="string")return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[r];if(n){let o=n.parse(t,this);if(!o)return null;if(this.expectedType){let s=this.expectedType,a=o.type;if(s.kind!=="string"&&s.kind!=="number"&&s.kind!=="boolean"&&s.kind!=="object"&&s.kind!=="array"||a.kind!=="value"){if(s.kind==="projectionDefinition"&&["string","array"].includes(a.kind)||["color","formatted","resolvedImage"].includes(s.kind)&&["value","string"].includes(a.kind)||["padding","numberArray"].includes(s.kind)&&["value","number","array"].includes(a.kind)||s.kind==="colorArray"&&["value","string","array"].includes(a.kind)||s.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(a.kind))o=i(o,s,e.typeAnnotation||"coerce");else if(this.checkSubtype(s,a))return null}else o=i(o,s,e.typeAnnotation||"assert")}if(!(o instanceof Qi)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let s=new ql;try{o=new Qi(o.type,o.evaluate(s))}catch(a){return this.error(a.message),null}}return o}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){let r=typeof t=="number"?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new ms(this.registry,this._isConstant,r,e||null,n,this.errors)}error(t,...e){let i=`${this.key}${e.map((r)=>`[${r}]`).join("")}`;this.errors.push(new Ke(i,t))}checkSubtype(t,e){let i=Nn(t,e);return i&&this.error(i),i}}class _s{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let n=1;n<t.length-1;n+=2){let o=t[n];if(typeof o!="string")return e.error(`Expected string, but found ${typeof o} instead.`,n);if(/[^a-zA-Z0-9_]/.test(o))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);let s=e.parse(t[n+1],n+1);if(!s)return null;i.push([o,s])}let r=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return r?new _s(i,r):null}outputDefined(){return this.result.outputDefined()}}class gs{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(t.length!==2||typeof t[1]!="string")return e.error("'var' expression requires exactly one string literal argument.");let i=t[1];return e.scope.has(i)?new gs(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Wl{constructor(t,e,i){this.type=t,this.index=e,this.input=i}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,V),r=e.parse(t[2],2,ye(e.expectedType||at));return i&&r?new Wl(r.type.itemType,i,r):null}evaluate(t){let e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new Lt(`Array index out of bounds: ${e} < 0.`);if(e>=i.length)throw new Lt(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Lt(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Hl{constructor(t,e){this.type=ct,this.needle=t,this.haystack=e}static parse(t,e){if(t.length!==3)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,at);return i&&r?Vl(i.type,[ct,ot,V,Fn,at])?new Hl(i,r):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(i.type)} instead`):null}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!Ji(e,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${kt(qt(e))} instead.`);if(!Ji(i,["string","array"]))throw new Lt(`Expected second argument to be of type array or string, but found ${kt(qt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class ys{constructor(t,e,i){this.type=V,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,at);if(!i||!r)return null;if(!Vl(i.type,[ct,ot,V,Fn,at]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${kt(i.type)} instead`);if(t.length===4){let n=e.parse(t[3],3,V);return n?new ys(i,r,n):null}return new ys(i,r)}evaluate(t){let e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!Ji(e,["boolean","string","number","null"]))throw new Lt(`Expected first argument to be of type boolean, string, number or null, but found ${kt(qt(e))} instead.`);let r;if(this.fromIndex&&(r=this.fromIndex.evaluate(t)),Ji(i,["string"])){let n=i.indexOf(e,r);return n===-1?-1:[...i.slice(0,n)].length}if(Ji(i,["array"]))return i.indexOf(e,r);throw new Lt(`Expected second argument to be of type array or string, but found ${kt(qt(i))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Xl{constructor(t,e,i,r,n,o){this.inputType=t,this.type=e,this.input=i,this.cases=r,this.outputs=n,this.otherwise=o}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let i,r;e.expectedType&&e.expectedType.kind!=="value"&&(r=e.expectedType);let n={},o=[];for(let c=2;c<t.length-1;c+=2){let l=t[c],u=t[c+1];Array.isArray(l)||(l=[l]);let h=e.concat(c);if(l.length===0)return h.error("Expected at least one branch label.");for(let d of l){if(typeof d!="number"&&typeof d!="string")return h.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof d=="number"&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,qt(d)))return null}else i=qt(d);if(n[String(d)]!==void 0)return h.error("Branch labels must be unique.");n[String(d)]=o.length}let p=e.parse(u,c,r);if(!p)return null;r=r||p.type,o.push(p)}let s=e.parse(t[1],1,at);if(!s)return null;let a=e.parse(t[t.length-1],t.length-1,r);return a?s.type.kind!=="value"&&e.concat(1).checkSubtype(i,s.type)?null:new Xl(i,r,s,n,o,a):null}evaluate(t){let e=this.input.evaluate(t);return(qt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())&&this.otherwise.outputDefined()}}class Yl{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&e.expectedType.kind!=="value"&&(i=e.expectedType);let r=[];for(let o=1;o<t.length-1;o+=2){let s=e.parse(t[o],o,ct);if(!s)return null;let a=e.parse(t[o+1],o+1,i);if(!a)return null;r.push([s,a]),i=i||a.type}let n=e.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw Error("Can't infer output type");return new Yl(i,r,n)}evaluate(t){for(let[e,i]of this.branches)if(e.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[e,i]of this.branches)t(e),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,e])=>e.outputDefined())&&this.otherwise.outputDefined()}}class vs{constructor(t,e,i,r){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=e.parse(t[1],1,at),r=e.parse(t[2],2,V);if(!i||!r)return null;if(!Vl(i.type,[ye(at),ot,at]))return e.error(`Expected first argument to be of type array or string, but found ${kt(i.type)} instead`);if(t.length===4){let n=e.parse(t[3],3,V);return n?new vs(i.type,i,r,n):null}return new vs(i.type,i,r)}evaluate(t){let e=this.input.evaluate(t),i=this.beginIndex.evaluate(t),r;if(this.endIndex&&(r=this.endIndex.evaluate(t)),Ji(e,["string"]))return[...e].slice(i,r).join("");if(Ji(e,["array"]))return e.slice(i,r);throw new Lt(`Expected first argument to be of type array or string, but found ${kt(qt(e))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function xs(t,e){let i=t.length-1,r,n,o=0,s=i,a=0;for(;o<=s;)if(a=Math.floor((o+s)/2),r=t[a],n=t[a+1],r<=e){if(a===i||e<n)return a;o=a+1}else{if(!(r>e))throw new Lt("Input is not a number.");s=a-1}return 0}class Zn{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(let[r,n]of i)this.labels.push(r),this.outputs.push(n)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");let i=e.parse(t[1],1,V);if(!i)return null;let r=[],n=null;e.expectedType&&e.expectedType.kind!=="value"&&(n=e.expectedType);for(let o=1;o<t.length;o+=2){let s=o===1?-1/0:t[o],a=t[o+1],c=o,l=o+1;if(typeof s!="number")return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',c);if(r.length&&r[r.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',c);let u=e.parse(a,l,n);if(!u)return null;n=n||u.type,r.push([s,u])}return new Zn(n,i,r)}evaluate(t){let e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;return r>=e[n-1]?i[n-1].evaluate(t):i[xs(e,r)].evaluate(t)}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}}function R0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Kl,Jd,k0=function(){if(Jd)return Kl;function t(e,i,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(n-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=r,this.p2y=n}return Jd=1,Kl=t,t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=0.000001),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var o=this.sampleCurveX(r)-e;if(Math.abs(o)<i)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<0.000001)break;r-=o/s}var a=0,c=1;for(r=e,n=0;n<20&&(o=this.sampleCurveX(r),!(Math.abs(o-e)<i));n++)e>o?a=r:c=r,r=0.5*(c-a)+a;return r},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},Kl}(),L0=R0(k0);class we{constructor(t,e,i,r,n){this.type=t,this.operator=e,this.interpolation=i,this.input=r,this.labels=[],this.outputs=[];for(let[o,s]of n)this.labels.push(o),this.outputs.push(s)}static interpolationFactor(t,e,i,r){let n=0;if(t.name==="exponential")n=Jl(e,t.base,i,r);else if(t.name==="linear")n=Jl(e,1,i,r);else if(t.name==="cubic-bezier"){let o=t.controlPoints;n=new L0(o[0],o[1],o[2],o[3]).solve(Jl(e,1,i,r))}return n}static parse(t,e){let[i,r,n,...o]=t;if(!Array.isArray(r)||r.length===0)return e.error("Expected an interpolation type expression.",1);if(r[0]==="linear")r={name:"linear"};else if(r[0]==="exponential"){let c=r[1];if(typeof c!="number")return e.error("Exponential interpolation requires a numeric base.",1,1);r={name:"exponential",base:c}}else{if(r[0]!=="cubic-bezier")return e.error(`Unknown interpolation type ${String(r[0])}`,1,0);{let c=r.slice(1);if(c.length!==4||c.some((l)=>typeof l!="number"||l<0||l>1))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:c}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(n=e.parse(n,2,V),!n)return null;let s=[],a=null;i!=="interpolate-hcl"&&i!=="interpolate-lab"||e.expectedType==On?e.expectedType&&e.expectedType.kind!=="value"&&(a=e.expectedType):a=Je;for(let c=0;c<o.length;c+=2){let l=o[c],u=o[c+1],h=c+3,p=c+4;if(typeof l!="number")return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(s.length&&s[s.length-1][0]>=l)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);let d=e.parse(u,p,a);if(!d)return null;a=a||d.type,s.push([l,d])}return Ri(a,V)||Ri(a,ss)||Ri(a,Je)||Ri(a,ls)||Ri(a,cs)||Ri(a,On)||Ri(a,hs)||Ri(a,ye(V))?new we(a,i,r,n,s):e.error(`Type ${kt(a)} is not interpolatable.`)}evaluate(t){let e=this.labels,i=this.outputs;if(e.length===1)return i[0].evaluate(t);let r=this.input.evaluate(t);if(r<=e[0])return i[0].evaluate(t);let n=e.length;if(r>=e[n-1])return i[n-1].evaluate(t);let o=xs(e,r),s=we.interpolationFactor(this.interpolation,r,e[o],e[o+1]),a=i[o].evaluate(t),c=i[o+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return ki(a,c,s);case"color":return Y.interpolate(a,c,s);case"padding":return ve.interpolate(a,c,s);case"colorArray":return se.interpolate(a,c,s);case"numberArray":return xe.interpolate(a,c,s);case"variableAnchorOffsetCollection":return Ne.interpolate(a,c,s);case"array":return Fr(a,c,s);case"projectionDefinition":return Re.interpolate(a,c,s)}case"interpolate-hcl":switch(this.type.kind){case"color":return Y.interpolate(a,c,s,"hcl");case"colorArray":return se.interpolate(a,c,s,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Y.interpolate(a,c,s,"lab");case"colorArray":return se.interpolate(a,c,s,"lab")}}}eachChild(t){t(this.input);for(let e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}}function Jl(t,e,i,r){let n=r-i,o=t-i;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}let Ft={color:Y.interpolate,number:ki,padding:ve.interpolate,numberArray:xe.interpolate,colorArray:se.interpolate,variableAnchorOffsetCollection:Ne.interpolate,array:Fr};class bs{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=null,r=e.expectedType;r&&r.kind!=="value"&&(i=r);let n=[];for(let s of t.slice(1)){let a=e.parse(s,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!a)return null;i=i||a.type,n.push(a)}if(!i)throw Error("No output type");let o=r&&n.some((s)=>Nn(r,s.type));return new bs(o?at:i,n)}evaluate(t){let e,i=null,r=0;for(let n of this.args)if(r++,i=n.evaluate(t),i&&i instanceof Ve&&!i.available&&(e||(e=i.name),i=null,r===this.args.length&&(i=e)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}}function Qd(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function tp(t,e,i,r){return r.compare(e,i)===0}function Br(t,e,i){let r=t!=="=="&&t!=="!=";return class n{constructor(o,s,a){this.type=ct,this.lhs=o,this.rhs=s,this.collator=a,this.hasUntypedArgument=o.type.kind==="value"||s.type.kind==="value"}static parse(o,s){if(o.length!==3&&o.length!==4)return s.error("Expected two or three arguments.");let a=o[0],c=s.parse(o[1],1,at);if(!c)return null;if(!Qd(a,c.type))return s.concat(1).error(`"${a}" comparisons are not supported for type '${kt(c.type)}'.`);let l=s.parse(o[2],2,at);if(!l)return null;if(!Qd(a,l.type))return s.concat(2).error(`"${a}" comparisons are not supported for type '${kt(l.type)}'.`);if(c.type.kind!==l.type.kind&&c.type.kind!=="value"&&l.type.kind!=="value")return s.error(`Cannot compare types '${kt(c.type)}' and '${kt(l.type)}'.`);r&&(c.type.kind==="value"&&l.type.kind!=="value"?c=new Qe(l.type,[c]):c.type.kind!=="value"&&l.type.kind==="value"&&(l=new Qe(c.type,[l])));let u=null;if(o.length===4){if(c.type.kind!=="string"&&l.type.kind!=="string"&&c.type.kind!=="value"&&l.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(u=s.parse(o[3],3,as),!u)return null}return new n(c,l,u)}evaluate(o){let s=this.lhs.evaluate(o),a=this.rhs.evaluate(o);if(r&&this.hasUntypedArgument){let c=qt(s),l=qt(a);if(c.kind!==l.kind||c.kind!=="string"&&c.kind!=="number")throw new Lt(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${c.kind}, ${l.kind}) instead.`)}if(this.collator&&!r&&this.hasUntypedArgument){let c=qt(s),l=qt(a);if(c.kind!=="string"||l.kind!=="string")return e(o,s,a)}return this.collator?i(o,s,a,this.collator.evaluate(o)):e(o,s,a)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}let F0=Br("==",function(t,e,i){return e===i},tp),B0=Br("!=",function(t,e,i){return e!==i},function(t,e,i,r){return!tp(0,e,i,r)}),O0=Br("<",function(t,e,i){return e<i},function(t,e,i,r){return r.compare(e,i)<0}),j0=Br(">",function(t,e,i){return e>i},function(t,e,i,r){return r.compare(e,i)>0}),N0=Br("<=",function(t,e,i){return e<=i},function(t,e,i,r){return r.compare(e,i)<=0}),V0=Br(">=",function(t,e,i){return e>=i},function(t,e,i,r){return r.compare(e,i)>=0});class ws{constructor(t,e,i){this.type=as,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(t.length!==2)return e.error("Expected one argument.");let i=t[1];if(typeof i!="object"||Array.isArray(i))return e.error("Collator options argument must be an object.");let r=e.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,ct);if(!r)return null;let n=e.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,ct);if(!n)return null;let o=null;return i.locale&&(o=e.parse(i.locale,1,ot),!o)?null:new ws(r,n,o)}evaluate(t){return new ds(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ql{constructor(t,e,i,r,n,o){this.type=ot,this.number=t,this.locale=e,this.currency=i,this.unit=r,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(t,e){if(t.length!==3)return e.error("Expected two arguments.");let i=e.parse(t[1],1,V);if(!i)return null;let r=t[2];if(typeof r!="object"||Array.isArray(r))return e.error("NumberFormat options argument must be an object.");let n=null;if(r.locale&&(n=e.parse(r.locale,1,ot),!n))return null;let o=null;if(r.currency&&(o=e.parse(r.currency,1,ot),!o))return null;let s=null;if(r.unit&&(s=e.parse(r.unit,1,ot),!s))return null;if(o&&s)return e.error("NumberFormat options `currency` and `unit` are mutually exclusive");let a=null;if(r["min-fraction-digits"]&&(a=e.parse(r["min-fraction-digits"],1,V),!a))return null;let c=null;return r["max-fraction-digits"]&&(c=e.parse(r["max-fraction-digits"],1,V),!c)?null:new Ql(i,n,o,s,a,c)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Ts{constructor(t){this.type=Bn,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&typeof i=="object")return e.error("First argument must be an image or text section.");let r=[],n=!1;for(let o=1;o<=t.length-1;++o){let s=t[o];if(n&&typeof s=="object"&&!Array.isArray(s)){n=!1;let a=null;if(s["font-scale"]&&(a=e.parse(s["font-scale"],1,V),!a))return null;let c=null;if(s["text-font"]&&(c=e.parse(s["text-font"],1,ye(ot)),!c))return null;let l=null;if(s["text-color"]&&(l=e.parse(s["text-color"],1,Je),!l))return null;let u=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!A0.includes(s["vertical-align"]))return e.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(u=e.parse(s["vertical-align"],1,ot),!u)return null}let h=r[r.length-1];h.scale=a,h.font=c,h.textColor=l,h.verticalAlign=u}else{let a=e.parse(t[o],1,at);if(!a)return null;let c=a.type.kind;if(c!=="string"&&c!=="value"&&c!=="null"&&c!=="resolvedImage")return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,r.push({content:a,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Ts(r)}evaluate(t){return new De(this.sections.map((e)=>{let i=e.content.evaluate(t);return qt(i)===jn?new ps("",i,null,null,null,e.verticalAlign?e.verticalAlign.evaluate(t):null):new ps($n(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null,e.verticalAlign?e.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor),e.verticalAlign&&t(e.verticalAlign)}outputDefined(){return!1}}class tc{constructor(t){this.type=jn,this.input=t}static parse(t,e){if(t.length!==2)return e.error("Expected two arguments.");let i=e.parse(t[1],1,ot);return i?new tc(i):e.error("No image name provided.")}evaluate(t){let e=this.input.evaluate(t),i=Ve.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}}class ec{constructor(t){this.type=V,this.input=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=e.parse(t[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?e.error(`Expected argument of type string or array, but found ${kt(i.type)} instead.`):new ec(i):null}evaluate(t){let e=this.input.evaluate(t);if(typeof e=="string")return[...e].length;if(Array.isArray(e))return e.length;throw new Lt(`Expected value to be of type string or array, but found ${kt(qt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}let hi=8192;function U0(t,e){let i=(180+t[0])/360,r=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,n=Math.pow(2,e.z);return[Math.round(i*n*hi),Math.round(r*n*hi)]}function ic(t,e){let i=Math.pow(2,e.z);return[(n=(t[0]/hi+e.x)/i,360*n-180),(r=(t[1]/hi+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90)];var r,n}function Gn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function qn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function $0(t,e,i){let r=t[0]-e[0],n=t[1]-e[1],o=t[0]-i[0],s=t[1]-i[1];return r*s-o*n==0&&r*o<=0&&n*s<=0}function Ss(t,e,i,r){return(n=[r[0]-i[0],r[1]-i[1]])[0]*(o=[e[0]-t[0],e[1]-t[1]])[1]-n[1]*o[0]!=0&&!(!ip(t,e,i,r)||!ip(i,r,t,e));var n,o}function Z0(t,e,i){for(let r of i)for(let n=0;n<r.length-1;++n)if(Ss(t,e,r[n],r[n+1]))return!0;return!1}function Or(t,e,i=!1){let r=!1;for(let a of e)for(let c=0;c<a.length-1;c++){if($0(t,a[c],a[c+1]))return i;(o=a[c])[1]>(n=t)[1]!=(s=a[c+1])[1]>n[1]&&n[0]<(s[0]-o[0])*(n[1]-o[1])/(s[1]-o[1])+o[0]&&(r=!r)}var n,o,s;return r}function G0(t,e){for(let i of e)if(Or(t,i))return!0;return!1}function ep(t,e){for(let i of t)if(!Or(i,e))return!1;for(let i=0;i<t.length-1;++i)if(Z0(t[i],t[i+1],e))return!1;return!0}function q0(t,e){for(let i of e)if(ep(t,i))return!0;return!1}function ip(t,e,i,r){let n=r[0]-i[0],o=r[1]-i[1],s=(t[0]-i[0])*o-n*(t[1]-i[1]),a=(e[0]-i[0])*o-n*(e[1]-i[1]);return s>0&&a<0||s<0&&a>0}function rc(t,e,i){let r=[];for(let n=0;n<t.length;n++){let o=[];for(let s=0;s<t[n].length;s++){let a=U0(t[n][s],i);Gn(e,a),o.push(a)}r.push(o)}return r}function rp(t,e,i){let r=[];for(let n=0;n<t.length;n++){let o=rc(t[n],e,i);r.push(o)}return r}function np(t,e,i,r){if(t[0]<i[0]||t[0]>i[2]){let n=0.5*r,o=t[0]-i[0]>n?-r:i[0]-t[0]>n?r:0;o===0&&(o=t[0]-i[2]>n?-r:i[2]-t[0]>n?r:0),t[0]+=o}Gn(e,t)}function op(t,e,i,r){let n=Math.pow(2,r.z)*hi,o=[r.x*hi,r.y*hi],s=[];for(let a of t)for(let c of a){let l=[c.x+o[0],c.y+o[1]];np(l,e,i,n),s.push(l)}return s}function sp(t,e,i,r){let n=Math.pow(2,r.z)*hi,o=[r.x*hi,r.y*hi],s=[];for(let c of t){let l=[];for(let u of c){let h=[u.x+o[0],u.y+o[1]];Gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(let c of s)for(let l of c)np(l,e,i,n)}var a;return s}class tr{constructor(t,e){this.type=ct,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Un(t[1])){let i=t[1];if(i.type==="FeatureCollection"){let r=[];for(let n of i.features){let{type:o,coordinates:s}=n.geometry;o==="Polygon"&&r.push(s),o==="MultiPolygon"&&r.push(...s)}if(r.length)return new tr(i,{type:"MultiPolygon",coordinates:r})}else if(i.type==="Feature"){let r=i.geometry.type;if(r==="Polygon"||r==="MultiPolygon")return new tr(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new tr(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,i){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if(i.type==="Polygon"){let s=rc(i.coordinates,n,o),a=op(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!Or(c,s))return!1}if(i.type==="MultiPolygon"){let s=rp(i.coordinates,n,o),a=op(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!G0(c,s))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,i){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=e.canonicalID();if(i.type==="Polygon"){let s=rc(i.coordinates,n,o),a=sp(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!ep(c,s))return!1}if(i.type==="MultiPolygon"){let s=rp(i.coordinates,n,o),a=sp(e.geometry(),r,n,o);if(!qn(r,n))return!1;for(let c of a)if(!q0(c,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}class nc{constructor(t=[],e=(i,r)=>i<r?-1:i>r?1:0){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:i}=this,r=e[t];for(;t>0;){let n=t-1>>1,o=e[n];if(i(r,o)>=0)break;e[t]=o,t=n}e[t]=r}_down(t){let{data:e,compare:i}=this,r=this.length>>1,n=e[t];for(;t<r;){let o=1+(t<<1),s=o+1;if(s<this.length&&i(e[s],e[o])<0&&(o=s),i(e[o],n)>=0)break;e[t]=e[o],t=o}e[t]=n}}function ap(t,e,i=0,r=t.length-1,n=W0){for(;r>i;){if(r-i>600){let c=r-i+1,l=e-i+1,u=Math.log(c),h=0.5*Math.exp(2*u/3),p=0.5*Math.sqrt(u*h*(c-h)/c)*(l-c/2<0?-1:1);ap(t,e,Math.max(i,Math.floor(e-l*h/c+p)),Math.min(r,Math.floor(e+(c-l)*h/c+p)),n)}let o=t[e],s=i,a=r;for(Wn(t,i,e),n(t[r],o)>0&&Wn(t,i,r);s<a;){for(Wn(t,s,a),s++,a--;n(t[s],o)<0;)s++;for(;n(t[a],o)>0;)a--}n(t[i],o)===0?Wn(t,i,a):(a++,Wn(t,a,r)),a<=e&&(i=a+1),e<=a&&(r=a-1)}}function Wn(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function W0(t,e){return t<e?-1:t>e?1:0}function oc(t,e){if(t.length<=1)return[t];let i=[],r,n;for(let o of t){let s=X0(o);s!==0&&(o.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(r&&i.push(r),r=[o]):r.push(o))}if(r&&i.push(r),e>1)for(let o=0;o<i.length;o++)i[o].length<=e||(ap(i[o],e,1,i[o].length-1,H0),i[o]=i[o].slice(0,e));return i}function H0(t,e){return e.area-t.area}function X0(t){let e=0;for(let i,r,n=0,o=t.length,s=o-1;n<o;s=n++)i=t[n],r=t[s],e+=(r.x-i.x)*(i.y+r.y);return e}let lp=0.0033528106647474805,cp=lp*(2-lp),hp=Math.PI/180;class Ps{constructor(t){let e=6378.137*hp*1000,i=Math.cos(t*hp),r=1/(1-cp*(1-i*i)),n=Math.sqrt(r);this.kx=e*n*i,this.ky=e*n*r*(1-cp)}distance(t,e){let i=this.wrap(t[0]-e[0])*this.kx,r=(t[1]-e[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(t,e){let i,r,n,o,s=1/0;for(let a=0;a<t.length-1;a++){let c=t[a][0],l=t[a][1],u=this.wrap(t[a+1][0]-c)*this.kx,h=(t[a+1][1]-l)*this.ky,p=0;u===0&&h===0||(p=(this.wrap(e[0]-c)*this.kx*u+(e[1]-l)*this.ky*h)/(u*u+h*h),p>1?(c=t[a+1][0],l=t[a+1][1]):p>0&&(c+=u/this.kx*p,l+=h/this.ky*p)),u=this.wrap(e[0]-c)*this.kx,h=(e[1]-l)*this.ky;let d=u*u+h*h;d<s&&(s=d,i=c,r=l,n=a,o=p)}return{point:[i,r],index:n,t:Math.max(0,Math.min(1,o))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function up(t,e){return e[0]-t[0]}function Is(t){return t[1]-t[0]+1}function wi(t,e){return t[1]>=t[0]&&t[1]<e}function sc(t,e){if(t[0]>t[1])return[null,null];let i=Is(t);if(e){if(i===2)return[t,null];let n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(i===1)return[t,null];let r=Math.floor(i/2)-1;return[[t[0],t[0]+r],[t[0]+r+1,t[1]]]}function ac(t,e){if(!wi(e,t.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=e[0];r<=e[1];++r)Gn(i,t[r]);return i}function lc(t){let e=[1/0,1/0,-1/0,-1/0];for(let i of t)for(let r of i)Gn(e,r);return e}function dp(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function cc(t,e,i){if(!dp(t)||!dp(e))return NaN;let r=0,n=0;return t[2]<e[0]&&(r=e[0]-t[2]),t[0]>e[2]&&(r=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),i.distance([0,0],[r,n])}function er(t,e,i){let r=i.pointOnLine(e,t);return i.distance(t,r.point)}function hc(t,e,i,r,n){let o=Math.min(er(t,[i,r],n),er(e,[i,r],n)),s=Math.min(er(i,[t,e],n),er(r,[t,e],n));return Math.min(o,s)}function Y0(t,e,i,r,n){if(!wi(e,t.length)||!wi(r,i.length))return 1/0;let o=1/0;for(let s=e[0];s<e[1];++s){let a=t[s],c=t[s+1];for(let l=r[0];l<r[1];++l){let u=i[l],h=i[l+1];if(Ss(a,c,u,h))return 0;o=Math.min(o,hc(a,c,u,h,n))}}return o}function K0(t,e,i,r,n){if(!wi(e,t.length)||!wi(r,i.length))return NaN;let o=1/0;for(let s=e[0];s<=e[1];++s)for(let a=r[0];a<=r[1];++a)if(o=Math.min(o,n.distance(t[s],i[a])),o===0)return o;return o}function J0(t,e,i){if(Or(t,e,!0))return 0;let r=1/0;for(let n of e){let o=n[0],s=n[n.length-1];if(o!==s&&(r=Math.min(r,er(t,[s,o],i)),r===0))return r;let a=i.pointOnLine(n,t);if(r=Math.min(r,i.distance(t,a.point)),r===0)return r}return r}function Q0(t,e,i,r){if(!wi(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Or(t[o],i,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){let s=t[o],a=t[o+1];for(let c of i)for(let l=0,u=c.length,h=u-1;l<u;h=l++){let p=c[h],d=c[l];if(Ss(s,a,p,d))return 0;n=Math.min(n,hc(s,a,p,d,r))}}return n}function pp(t,e){for(let i of t)for(let r of i)if(Or(r,e,!0))return!0;return!1}function tv(t,e,i,r=1/0){let n=lc(t),o=lc(e);if(r!==1/0&&cc(n,o,i)>=r)return r;if(qn(n,o)){if(pp(t,e))return 0}else if(pp(e,t))return 0;let s=1/0;for(let a of t)for(let c=0,l=a.length,u=l-1;c<l;u=c++){let h=a[u],p=a[c];for(let d of e)for(let f=0,m=d.length,_=m-1;f<m;_=f++){let y=d[_],v=d[f];if(Ss(h,p,y,v))return 0;s=Math.min(s,hc(h,p,y,v,i))}}return s}function fp(t,e,i,r,n,o){if(!o)return;let s=cc(ac(r,o),n,i);s<e&&t.push([s,o,[0,0]])}function Es(t,e,i,r,n,o,s){if(!o||!s)return;let a=cc(ac(r,o),ac(n,s),i);a<e&&t.push([a,o,s])}function Ms(t,e,i,r,n=1/0){let o=Math.min(r.distance(t[0],i[0][0]),n);if(o===0)return o;let s=new nc([[0,[0,t.length-1],[0,0]]],up),a=lc(i);for(;s.length>0;){let c=s.pop();if(c[0]>=o)continue;let l=c[1],u=e?50:100;if(Is(l)<=u){if(!wi(l,t.length))return NaN;if(e){let h=Q0(t,l,i,r);if(isNaN(h)||h===0)return h;o=Math.min(o,h)}else for(let h=l[0];h<=l[1];++h){let p=J0(t[h],i,r);if(o=Math.min(o,p),o===0)return 0}}else{let h=sc(l,e);fp(s,o,r,t,a,h[0]),fp(s,o,r,t,a,h[1])}}return o}function Cs(t,e,i,r,n,o=1/0){let s=Math.min(o,n.distance(t[0],i[0]));if(s===0)return s;let a=new nc([[0,[0,t.length-1],[0,i.length-1]]],up);for(;a.length>0;){let c=a.pop();if(c[0]>=s)continue;let l=c[1],u=c[2],h=e?50:100,p=r?50:100;if(Is(l)<=h&&Is(u)<=p){if(!wi(l,t.length)&&wi(u,i.length))return NaN;let d;if(e&&r)d=Y0(t,l,i,u,n),s=Math.min(s,d);else if(e&&!r){let f=t.slice(l[0],l[1]+1);for(let m=u[0];m<=u[1];++m)if(d=er(i[m],f,n),s=Math.min(s,d),s===0)return s}else if(!e&&r){let f=i.slice(u[0],u[1]+1);for(let m=l[0];m<=l[1];++m)if(d=er(t[m],f,n),s=Math.min(s,d),s===0)return s}else d=K0(t,l,i,u,n),s=Math.min(s,d)}else{let d=sc(l,e),f=sc(u,r);Es(a,s,n,t,i,d[0],f[0]),Es(a,s,n,t,i,d[0],f[1]),Es(a,s,n,t,i,d[1],f[0]),Es(a,s,n,t,i,d[1],f[1])}}return s}function uc(t){return t.type==="MultiPolygon"?t.coordinates.map((e)=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map((e)=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map((e)=>({type:"Point",coordinates:e})):[t]}class ir{constructor(t,e){this.type=V,this.geojson=t,this.geometries=e}static parse(t,e){if(t.length!==2)return e.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Un(t[1])){let i=t[1];if(i.type==="FeatureCollection")return new ir(i,i.features.map((r)=>uc(r.geometry)).flat());if(i.type==="Feature")return new ir(i,uc(i.geometry));if("type"in i&&"coordinates"in i)return new ir(i,uc(i))}return e.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(e,i){let r=e.geometry(),n=r.flat().map((a)=>ic([a.x,a.y],e.canonical));if(r.length===0)return NaN;let o=new Ps(n[0][1]),s=1/0;for(let a of i){switch(a.type){case"Point":s=Math.min(s,Cs(n,!1,[a.coordinates],!1,o,s));break;case"LineString":s=Math.min(s,Cs(n,!1,a.coordinates,!0,o,s));break;case"Polygon":s=Math.min(s,Ms(n,!1,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries);if(t.geometryType()==="LineString")return function(e,i){let r=e.geometry(),n=r.flat().map((a)=>ic([a.x,a.y],e.canonical));if(r.length===0)return NaN;let o=new Ps(n[0][1]),s=1/0;for(let a of i){switch(a.type){case"Point":s=Math.min(s,Cs(n,!0,[a.coordinates],!1,o,s));break;case"LineString":s=Math.min(s,Cs(n,!0,a.coordinates,!0,o,s));break;case"Polygon":s=Math.min(s,Ms(n,!0,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries);if(t.geometryType()==="Polygon")return function(e,i){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let n=oc(r,0).map((a)=>a.map((c)=>c.map((l)=>ic([l.x,l.y],e.canonical)))),o=new Ps(n[0][0][0][1]),s=1/0;for(let a of i)for(let c of n){switch(a.type){case"Point":s=Math.min(s,Ms([a.coordinates],!1,c,o,s));break;case"LineString":s=Math.min(s,Ms(a.coordinates,!0,c,o,s));break;case"Polygon":s=Math.min(s,tv(c,a.coordinates,o,s))}if(s===0)return s}return s}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Hn{constructor(t){this.type=at,this.key=t}static parse(t,e){if(t.length!==2)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return i==null?e.error("Global state property must be defined."):typeof i!="string"?e.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Hn(i)}evaluate(t){var e;let i=(e=t.globals)===null||e===void 0?void 0:e.globalState;return i&&Object.keys(i).length!==0?Vn(i,this.key):null}eachChild(){}outputDefined(){return!1}}let jr={"==":F0,"!=":B0,">":j0,"<":O0,">=":V0,"<=":N0,array:Qe,at:Wl,boolean:Qe,case:Yl,coalesce:bs,collator:ws,format:Ts,image:tc,in:Hl,"index-of":ys,interpolate:we,"interpolate-hcl":we,"interpolate-lab":we,length:ec,let:_s,literal:Qi,match:Xl,number:Qe,"number-format":Ql,object:Qe,slice:vs,step:Zn,string:Qe,"to-boolean":Li,"to-color":Li,"to-number":Li,"to-string":Li,var:gs,within:tr,distance:ir,"global-state":Hn};class Ue{constructor(t,e,i,r){this.name=t,this.type=e,this._evaluate=i,this.args=r}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,e){let i=t[0],r=Ue.definitions[i];if(!r)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let n=Array.isArray(r)?r[0]:r.type,o=Array.isArray(r)?[[r[1],r[2]]]:r.overloads,s=o.filter(([c])=>!Array.isArray(c)||c.length===t.length-1),a=null;for(let[c,l]of s){a=new ms(e.registry,As,e.path,null,e.scope);let u=[],h=!1;for(let p=1;p<t.length;p++){let d=t[p],f=Array.isArray(c)?c[p-1]:c.type,m=a.parse(d,1+u.length,f);if(!m){h=!0;break}u.push(m)}if(!h)if(Array.isArray(c)&&c.length!==u.length)a.error(`Expected ${c.length} arguments, but found ${u.length} instead.`);else{for(let p=0;p<u.length;p++){let d=Array.isArray(c)?c[p]:c.type,f=u[p];a.concat(p+1).checkSubtype(d,f.type)}if(a.errors.length===0)return new Ue(i,n,l,u)}}if(s.length===1)e.errors.push(...a.errors);else{let c=(s.length?s:o).map(([u])=>{return h=u,Array.isArray(h)?`(${h.map(kt).join(", ")})`:`(${kt(h.type)}...)`;var h}).join(" | "),l=[];for(let u=1;u<t.length;u++){let h=e.parse(t[u],1+l.length);if(!h)return null;l.push(kt(h.type))}e.error(`Expected arguments of type ${c}, but found (${l.join(", ")}) instead.`)}return null}static register(t,e){Ue.definitions=e;for(let i in e)t[i]=Ue}}function mp(t,[e,i,r,n]){e=e.evaluate(t),i=i.evaluate(t),r=r.evaluate(t);let o=n?n.evaluate(t):1,s=Yd(e,i,r,o);if(s)throw new Lt(s);return new Y(e/255,i/255,r/255,o,!1)}function _p(t,e){return t in e}function dc(t,e){let i=e[t];return i===void 0?null:i}function rr(t){return{type:t}}function As(t){if(t instanceof gs)return As(t.boundExpression);if(t instanceof Ue&&t.name==="error")return!1;if(t instanceof ws)return!1;if(t instanceof tr)return!1;if(t instanceof ir)return!1;if(t instanceof Hn)return!1;let e=t instanceof Li||t instanceof Qe,i=!0;return t.eachChild((r)=>{i=e?i&&As(r):i&&r instanceof Qi}),!!i&&zs(t)&&Ds(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function zs(t){if(t instanceof Ue){if(t.name==="get"&&t.args.length===1)return!1;if(t.name==="feature-state")return!1;if(t.name==="has"&&t.args.length===1)return!1;if(t.name==="properties"||t.name==="geometry-type"||t.name==="id")return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof tr)return!1;if(t instanceof ir)return!1;let e=!0;return t.eachChild((i)=>{e&&!zs(i)&&(e=!1)}),e}function Xn(t){if(t instanceof Ue&&t.name==="feature-state")return!1;let e=!0;return t.eachChild((i)=>{e&&!Xn(i)&&(e=!1)}),e}function Ds(t,e){if(t instanceof Ue&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((r)=>{i&&!Ds(r,e)&&(i=!1)}),i}function gp(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}function Vr(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function yp(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function pc(t){return!!t.expression&&t.expression.interpolated}function ht(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function Rs(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&qt(t)===Ki}function ev(t){return t}function vp(t,e){let i=t.stops&&typeof t.stops[0][0]=="object",r=i||!(i||t.property!==void 0),n=t.type||(pc(e)?"exponential":"interval"),o=function(u){switch(u.type){case"color":return Y.parse;case"padding":return ve.parse;case"numberArray":return xe.parse;case"colorArray":return se.parse;default:return null}}(e);if(o&&((t=Rr({},t)).stops&&(t.stops=t.stops.map((u)=>[u[0],o(u[1])])),t.default=o(t.default?t.default:e.default)),t.colorSpace&&(s=t.colorSpace)!=="rgb"&&s!=="hcl"&&s!=="lab")throw Error(`Unknown color space: "${t.colorSpace}"`);var s;let a=function(u){switch(u){case"exponential":return xp;case"interval":return rv;case"categorical":return iv;case"identity":return nv;default:throw Error(`Unknown function type "${u}"`)}}(n),c,l;if(n==="categorical"){c=Object.create(null);for(let u of t.stops)c[u[0]]=u[1];l=typeof t.stops[0][0]}if(i){let u={},h=[];for(let f=0;f<t.stops.length;f++){let m=t.stops[f],_=m[0].zoom;u[_]===void 0&&(u[_]={zoom:_,type:t.type,property:t.property,default:t.default,stops:[]},h.push(_)),u[_].stops.push([m[0].value,m[1]])}let p=[];for(let f of h)p.push([u[f].zoom,vp(u[f],e)]);let d={name:"linear"};return{kind:"composite",interpolationType:d,interpolationFactor:we.interpolationFactor.bind(void 0,d),zoomStops:p.map((f)=>f[0]),evaluate:({zoom:f},m)=>xp({stops:p,base:t.base},e,f).evaluate(f,m)}}if(r){let u=n==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:u,interpolationFactor:we.interpolationFactor.bind(void 0,u),zoomStops:t.stops.map((h)=>h[0]),evaluate:({zoom:h})=>a(t,e,h,c,l)}}return{kind:"source",evaluate(u,h){let p=h&&h.properties?h.properties[t.property]:void 0;return p===void 0?Yn(t.default,e.default):a(t,e,p,c,l)}}}function Yn(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function iv(t,e,i,r,n){return Yn(typeof i===n?r[i]:void 0,t.default,e.default)}function rv(t,e,i){if(ht(i)!=="number")return Yn(t.default,e.default);let r=t.stops.length;if(r===1)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[r-1][0])return t.stops[r-1][1];let n=xs(t.stops.map((o)=>o[0]),i);return t.stops[n][1]}function xp(t,e,i){let r=t.base!==void 0?t.base:1;if(ht(i)!=="number")return Yn(t.default,e.default);let n=t.stops.length;if(n===1)return t.stops[0][1];if(i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];let o=xs(t.stops.map((u)=>u[0]),i),s=function(u,h,p,d){let f=d-p,m=u-p;return f===0?0:h===1?m/f:(Math.pow(h,m)-1)/(Math.pow(h,f)-1)}(i,r,t.stops[o][0],t.stops[o+1][0]),a=t.stops[o][1],c=t.stops[o+1][1],l=Ft[e.type]||ev;return typeof a.evaluate=="function"?{evaluate(...u){let h=a.evaluate.apply(void 0,u),p=c.evaluate.apply(void 0,u);if(h!==void 0&&p!==void 0)return l(h,p,s,t.colorSpace)}}:l(a,c,s,t.colorSpace)}function nv(t,e,i){switch(e.type){case"color":i=Y.parse(i);break;case"formatted":i=De.fromString(i.toString());break;case"resolvedImage":i=Ve.fromString(i.toString());break;case"padding":i=ve.parse(i);break;case"colorArray":i=se.parse(i);break;case"numberArray":i=xe.parse(i);break;default:ht(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Yn(i,t.default,e.default)}Ue.register(jr,{error:[{kind:"error"},[ot],(t,[e])=>{throw new Lt(e.evaluate(t))}],typeof:[ot,[at],(t,[e])=>kt(qt(e.evaluate(t)))],"to-rgba":[ye(V,4),[Je],(t,[e])=>{let[i,r,n,o]=e.evaluate(t).rgb;return[255*i,255*r,255*n,o]}],rgb:[Je,[V,V,V],mp],rgba:[Je,[V,V,V,V],mp],has:{type:ct,overloads:[[[ot],(t,[e])=>_p(e.evaluate(t),t.properties())],[[ot,Ki],(t,[e,i])=>_p(e.evaluate(t),i.evaluate(t))]]},get:{type:at,overloads:[[[ot],(t,[e])=>dc(e.evaluate(t),t.properties())],[[ot,Ki],(t,[e,i])=>dc(e.evaluate(t),i.evaluate(t))]]},"feature-state":[at,[ot],(t,[e])=>dc(e.evaluate(t),t.featureState||{})],properties:[Ki,[],(t)=>t.properties()],"geometry-type":[ot,[],(t)=>t.geometryType()],id:[at,[],(t)=>t.id()],zoom:[V,[],(t)=>t.globals.zoom],"heatmap-density":[V,[],(t)=>t.globals.heatmapDensity||0],elevation:[V,[],(t)=>t.globals.elevation||0],"line-progress":[V,[],(t)=>t.globals.lineProgress||0],accumulated:[at,[],(t)=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[V,rr(V),(t,e)=>{let i=0;for(let r of e)i+=r.evaluate(t);return i}],"*":[V,rr(V),(t,e)=>{let i=1;for(let r of e)i*=r.evaluate(t);return i}],"-":{type:V,overloads:[[[V,V],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[V],(t,[e])=>-e.evaluate(t)]]},"/":[V,[V,V],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[V,[V,V],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[V,[],()=>Math.LN2],pi:[V,[],()=>Math.PI],e:[V,[],()=>Math.E],"^":[V,[V,V],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[V,[V],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[V,[V],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[V,[V],(t,[e])=>Math.log(e.evaluate(t))],log2:[V,[V],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[V,[V],(t,[e])=>Math.sin(e.evaluate(t))],cos:[V,[V],(t,[e])=>Math.cos(e.evaluate(t))],tan:[V,[V],(t,[e])=>Math.tan(e.evaluate(t))],asin:[V,[V],(t,[e])=>Math.asin(e.evaluate(t))],acos:[V,[V],(t,[e])=>Math.acos(e.evaluate(t))],atan:[V,[V],(t,[e])=>Math.atan(e.evaluate(t))],min:[V,rr(V),(t,e)=>Math.min(...e.map((i)=>i.evaluate(t)))],max:[V,rr(V),(t,e)=>Math.max(...e.map((i)=>i.evaluate(t)))],abs:[V,[V],(t,[e])=>Math.abs(e.evaluate(t))],round:[V,[V],(t,[e])=>{let i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[V,[V],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[V,[V],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ct,[ot,at],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ct,[at],(t,[e])=>t.id()===e.value],"filter-type-==":[ct,[ot],(t,[e])=>t.geometryType()===e.value],"filter-<":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<n}],"filter-id-<":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<r}],"filter->":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>n}],"filter-id->":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>r}],"filter-<=":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r<=n}],"filter-id-<=":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i<=r}],"filter->=":[ct,[ot,at],(t,[e,i])=>{let r=t.properties()[e.value],n=i.value;return typeof r==typeof n&&r>=n}],"filter-id->=":[ct,[at],(t,[e])=>{let i=t.id(),r=e.value;return typeof i==typeof r&&i>=r}],"filter-has":[ct,[at],(t,[e])=>(e.value in t.properties())],"filter-has-id":[ct,[],(t)=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[ct,[ye(ot)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ct,[ye(at)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ct,[ot,ye(at)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ct,[ot,ye(at)],(t,[e,i])=>function(r,n,o,s){for(;o<=s;){let a=o+s>>1;if(n[a]===r)return!0;n[a]>r?s=a-1:o=a+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[rr(ct),(t,e)=>{for(let i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ct,overloads:[[[ct,ct],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[rr(ct),(t,e)=>{for(let i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ct,[ct],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ct,[ot],(t,[e])=>{let i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ot,[ot],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ot,[ot],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ot,rr(at),(t,e)=>e.map((i)=>$n(i.evaluate(t))).join("")],split:[ye(ot),[ot,ot],(t,[e,i])=>e.evaluate(t).split(i.evaluate(t))],join:[ot,[ye(ot),ot],(t,[e,i])=>e.evaluate(t).join(i.evaluate(t))],"resolved-locale":[ot,[as],(t,[e])=>e.evaluate(t).resolvedLocale()]});class ks{constructor(t,e,i){this.expression=t,this._warningHistory={},this._evaluator=new ql,this._defaultValue=e?function(r){if(r.type==="color"&&Rs(r.default))return new Y(0,0,0,0);switch(r.type){case"color":return Y.parse(r.default)||null;case"padding":return ve.parse(r.default)||null;case"numberArray":return xe.parse(r.default)||null;case"colorArray":return se.parse(r.default)||null;case"variableAnchorOffsetCollection":return Ne.parse(r.default)||null;case"projectionDefinition":return Re.parse(r.default)||null;default:return r.default===void 0?null:r.default}}(e):null,this._enumValues=e&&e.type==="enum"?e.values:null,this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,r,n,o){this._globalState&&(t=Ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=o||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!=s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new Lt(`Expected value to be one of ${Object.keys(this._enumValues).map((a)=>JSON.stringify(a)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}}function Ls(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in jr}function Fs(t,e,i){let r=new ms(jr,As,[],e?function(o){let s={color:Je,string:ot,number:V,enum:ot,boolean:ct,formatted:Bn,padding:ls,numberArray:cs,colorArray:On,projectionDefinition:ss,resolvedImage:jn,variableAnchorOffsetCollection:hs};return o.type==="array"?ye(s[o.value]||at,o.length):s[o.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?gp(new ks(n,e,i)):Nr(r.errors)}class Kn{constructor(t,e,i){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!Xn(e.expression),this.globalStateRefs=Jn(e.expression),this._globalState=i}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,o)}}class Bs{constructor(t,e,i,r,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!Xn(e.expression),this.globalStateRefs=Jn(e.expression),this.interpolationType=r,this._globalState=n}evaluateWithoutErrorHandling(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,i,r,n,o)}evaluate(t,e,i,r,n,o){return this._globalState&&(t=Ur(t,this._globalState)),this._styleExpression.evaluate(t,e,i,r,n,o)}interpolationFactor(t,e,i){return this.interpolationType?we.interpolationFactor(this.interpolationType,t,e,i):0}}function bp(t,e,i){let r=Fs(t,e,i);if(r.result==="error")return r;let n=r.value.expression,o=zs(n);if(!o&&!Vr(e))return Nr([new Ke("","data expressions not supported")]);let s=Ds(n,["zoom"]);if(!s&&!yp(e))return Nr([new Ke("","zoom expressions not supported")]);let a=js(n);return a||s?a instanceof Ke?Nr([a]):a instanceof we&&!pc(e)?Nr([new Ke("",'"interpolate" expressions cannot be used with this property')]):gp(a?new Bs(o?"camera":"composite",r.value,a.labels,a instanceof we?a.interpolation:void 0,i):new Kn(o?"constant":"source",r.value,i)):Nr([new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Os{constructor(t,e){this._parameters=t,this._specification=e,Rr(this,vp(this._parameters,this._specification))}static deserialize(t){return new Os(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function js(t){let e=null;if(t instanceof _s)e=js(t.result);else if(t instanceof bs){for(let i of t.args)if(e=js(i),e)break}else(t instanceof Zn||t instanceof we)&&t.input instanceof Ue&&t.input.name==="zoom"&&(e=t);return e instanceof Ke||t.eachChild((i)=>{let r=js(i);r instanceof Ke?e=r:!e&&r?e=new Ke("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&r&&e!==r&&(e=new Ke("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Jn(t,e=new Set){return t instanceof Hn&&e.add(t.key),t.eachChild((i)=>{Jn(i,e)}),e}function Ur(t,e){let{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a}=t!=null?t:{};return{zoom:i,heatmapDensity:r,elevation:n,lineProgress:o,isSupportedScript:s,accumulated:a,globalState:e}}function fc(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(let e of t.slice(1))if(!fc(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}let ov={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Qn(t,e){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};fc(t)||(t=Ns(t));let i=Fs(t,ov,e);if(i.result==="error")throw Error(i.value.map((r)=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,n,o)=>i.value.evaluate(r,n,{},o),needGeometry:wp(t),getGlobalStateRefs:()=>Jn(i.value.expression)}}function sv(t,e){return t<e?-1:t>e?1:0}function wp(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(wp(t[e]))return!0;return!1}function Ns(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?mc(t[1],t[2],"=="):e==="!="?Vs(mc(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?mc(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(Ns))):e==="all"?["all"].concat(t.slice(1).map(Ns)):e==="none"?["all"].concat(t.slice(1).map(Ns).map(Vs)):e==="in"?Tp(t[1],t.slice(2)):e==="!in"?Vs(Tp(t[1],t.slice(2))):e==="has"?Sp(t[1]):e!=="!has"||Vs(Sp(t[1]));var i}function mc(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Tp(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i)=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(sv)]]:["filter-in-small",t,["literal",e]]}}function Sp(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Vs(t){return["!",t]}function Pp(t){let e=t.value;return e?[new j(t.key,e,"constants have been deprecated as of v8")]:[]}function Ut(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function nr(t){if(Array.isArray(t))return t.map(nr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let i in t)e[i]=nr(t[i]);return e}return Ut(t)}function ke(t){let{key:e,value:i}=t,r=t.valueSpec||{},n=t.objectElementValidators||{},{style:o,styleSpec:s,validateSpec:a}=t,c=[],l=ht(i);if(l!=="object")return[new j(e,i,`object expected, ${l} found`)];for(let u in i){let h=u.split(".")[0],p=Vn(r,h)||r["*"],d;if(Vn(n,h))d=n[h];else if(Vn(r,h)){if(i[u]===void 0)continue;d=a}else if(n["*"])d=n["*"];else{if(!r["*"]){c.push(new j(e,i[u],`unknown property "${u}"`));continue}d=a}c=c.concat(d({key:(e?`${e}.`:e)+u,value:i[u],valueSpec:p,style:o,styleSpec:s,object:i,objectKey:u,validateSpec:a},i))}for(let u in r)n[u]||r[u].required&&r[u].default===void 0&&i[u]===void 0&&c.push(new j(e,i,`missing required property "${u}"`));return c}function _c(t){let{value:e,valueSpec:i,style:r,styleSpec:n,key:o}=t,s=t.arrayElementValidator||t.validateSpec;if(ht(e)!=="array")return[new j(o,e,`array expected, ${ht(e)} found`)];if(i.length&&e.length!==i.length)return[new j(o,e,`array length ${i.length} expected, length ${e.length} found`)];let a={type:i.value,values:i.values};n.$version<7&&(a.function=i.function),ht(i.value)==="object"&&(a=i.value);let c=[];for(let l=0;l<e.length;l++)c=c.concat(s({array:e,arrayIndex:l,value:e[l],valueSpec:a,validateSpec:t.validateSpec,style:r,styleSpec:n,key:`${o}[${l}]`}));return c}function Us(t){let{key:e,value:i,valueSpec:r}=t,n=ht(i);return n==="number"&&i!=i&&(n="NaN"),n!=="number"?[new j(e,i,`number expected, ${n} found`)]:("minimum"in r)&&i<r.minimum?[new j(e,i,`${i} is less than the minimum value ${r.minimum}`)]:("maximum"in r)&&i>r.maximum?[new j(e,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]}function Ip(t){let e=t.valueSpec,i=Ut(t.value.type),r,n,o,s={},a=i!=="categorical"&&t.value.property===void 0,c=!a,l=ht(t.value.stops)==="array"&&ht(t.value.stops[0])==="array"&&ht(t.value.stops[0][0])==="object",u=ke({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(d){if(i==="identity")return[new j(d.key,d.value,'identity function may not have a "stops" property')];let f=[],m=d.value;return f=f.concat(_c({key:d.key,value:m,valueSpec:d.valueSpec,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,arrayElementValidator:h})),ht(m)==="array"&&m.length===0&&f.push(new j(d.key,m,"array must have at least one stop")),f},default:function(d){return d.validateSpec({key:d.key,value:d.value,valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec})}}});return i==="identity"&&a&&u.push(new j(t.key,t.value,'missing required property "property"')),i==="identity"||t.value.stops||u.push(new j(t.key,t.value,'missing required property "stops"')),i==="exponential"&&t.valueSpec.expression&&!pc(t.valueSpec)&&u.push(new j(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(c&&!Vr(t.valueSpec)?u.push(new j(t.key,t.value,"property functions not supported")):a&&!yp(t.valueSpec)&&u.push(new j(t.key,t.value,"zoom functions not supported"))),i!=="categorical"&&!l||t.value.property!==void 0||u.push(new j(t.key,t.value,'"property" property is required')),u;function h(d){let f=[],{value:m,key:_}=d;if(ht(m)!=="array")return[new j(_,m,`array expected, ${ht(m)} found`)];if(m.length!==2)return[new j(_,m,`array length 2 expected, length ${m.length} found`)];if(l){if(ht(m[0])!=="object")return[new j(_,m,`object expected, ${ht(m[0])} found`)];if(m[0].zoom===void 0)return[new j(_,m,"object stop key must have zoom")];if(m[0].value===void 0)return[new j(_,m,"object stop key must have value")];if(o&&o>Ut(m[0].zoom))return[new j(_,m[0].zoom,"stop zoom values must appear in ascending order")];Ut(m[0].zoom)!==o&&(o=Ut(m[0].zoom),n=void 0,s={}),f=f.concat(ke({key:`${_}[0]`,value:m[0],valueSpec:{zoom:{}},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{zoom:Us,value:p}}))}else f=f.concat(p({key:`${_}[0]`,value:m[0],validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec},m));return Ls(nr(m[1]))?f.concat([new j(`${_}[1]`,m[1],"expressions are not allowed in function stops.")]):f.concat(d.validateSpec({key:`${_}[1]`,value:m[1],valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec}))}function p(d,f){let m=ht(d.value),_=Ut(d.value),y=d.value!==null?d.value:f;if(r){if(m!==r)return[new j(d.key,y,`${m} stop domain type must match previous stop domain type ${r}`)]}else r=m;if(m!=="number"&&m!=="string"&&m!=="boolean")return[new j(d.key,y,"stop domain value must be a number, string, or boolean")];if(m!=="number"&&i!=="categorical"){let v=`number expected, ${m} found`;return Vr(e)&&i===void 0&&(v+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new j(d.key,y,v)]}return i!=="categorical"||m!=="number"||isFinite(_)&&Math.floor(_)===_?i!=="categorical"&&m==="number"&&n!==void 0&&_<n?[new j(d.key,y,"stop domain values must appear in ascending order")]:(n=_,i==="categorical"&&(_ in s)?[new j(d.key,y,"stop domain values must be unique")]:(s[_]=!0,[])):[new j(d.key,y,`integer expected, found ${_}`)]}}function $r(t){let e=(t.expressionContext==="property"?bp:Fs)(nr(t.value),t.valueSpec);if(e.result==="error")return e.value.map((r)=>new j(`${t.key}${r.key}`,t.value,r.message));let i=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!i.outputDefined())return[new j(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Xn(i))return[new j(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Xn(i))return[new j(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ds(i,["zoom","feature-state"]))return[new j(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!zs(i))return[new j(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gc(t){let{key:e,value:i}=t,r=ht(i);return r!=="string"?[new j(e,i,`color expected, ${r} found`)]:Y.parse(String(i))?[]:[new j(e,i,`color expected, "${i}" found`)]}function to(t){let{key:e,value:i,valueSpec:r}=t,n=[];return Array.isArray(r.values)?r.values.indexOf(Ut(i))===-1&&n.push(new j(e,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(Ut(i))===-1&&n.push(new j(e,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),n}function yc(t){return fc(nr(t.value))?$r(Rr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ep(t)}function Ep(t){let{value:e,key:i}=t;if(ht(e)!=="array")return[new j(i,e,`array expected, ${ht(e)} found`)];let r=t.styleSpec,n,o=[];if(e.length<1)return[new j(i,e,"filter array must have at least 1 element")];switch(o=o.concat(to({key:`${i}[0]`,value:e[0],valueSpec:r.filter_operator,style:t.style,styleSpec:t.styleSpec})),Ut(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Ut(e[1])==="$type"&&o.push(new j(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new j(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=ht(e[1]),n!=="string"&&o.push(new j(`${i}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=ht(e[s]),Ut(e[1])==="$type"?o=o.concat(to({key:`${i}[${s}]`,value:e[s],valueSpec:r.geometry_type,style:t.style,styleSpec:t.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&o.push(new j(`${i}[${s}]`,e[s],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let s=1;s<e.length;s++)o=o.concat(Ep({key:`${i}[${s}]`,value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":n=ht(e[1]),e.length!==2?o.push(new j(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):n!=="string"&&o.push(new j(`${i}[1]`,e[1],`string expected, ${n} found`))}return o}function Mp(t,e){let{key:i,validateSpec:r,style:n,styleSpec:o,value:s,objectKey:a}=t,c=o[`${e}_${t.layerType}`];if(!c)return[];let l=a.match(/^(.*)-transition$/);if(e==="paint"&&l&&c[l[1]]&&c[l[1]].transition)return r({key:i,value:s,valueSpec:o.transition,style:n,styleSpec:o});let u=t.valueSpec||c[a];if(!u)return[new j(i,s,`unknown property "${a}"`)];let h;if(ht(s)==="string"&&Vr(u)&&!u.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new j(i,s,`"${a}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];let p=[];return t.layerType==="symbol"&&a==="text-font"&&Rs(nr(s))&&Ut(s.type)==="identity"&&p.push(new j(i,s,'"text-font" does not support identity functions')),p.concat(r({key:t.key,value:s,valueSpec:u,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:a}))}function Cp(t){return Mp(t,"paint")}function Ap(t){return Mp(t,"layout")}function zp(t){var e,i;let r=[],{value:n,key:o,style:s,styleSpec:a}=t;if(ht(n)!=="object")return[new j(o,n,`object expected, ${ht(n)} found`)];n.type||n.ref||r.push(new j(o,n,'either "type" or "ref" is required'));let c=Ut(n.type),l=Ut(n.ref);if(n.id){let u=Ut(n.id);for(let h=0;h<t.arrayIndex;h++){let p=s.layers[h];Ut(p.id)===u&&r.push(new j(o,n.id,`duplicate layer id "${n.id}", previously used at line ${p.id.__line__}`))}}if("ref"in n){let u;["type","source","source-layer","filter","layout"].forEach((h)=>{h in n&&r.push(new j(o,n[h],`"${h}" is prohibited for ref layers`))}),s.layers.forEach((h)=>{Ut(h.id)===l&&(u=h)}),u?u.ref?r.push(new j(o,n.ref,"ref cannot reference another ref layer")):c=Ut(u.type):r.push(new j(o,n.ref,`ref layer "${l}" not found`))}else if(c!=="background")if(n.source){let u=s.sources&&s.sources[n.source],h=u&&Ut(u.type);u?h==="vector"&&c==="raster"?r.push(new j(o,n.source,`layer "${n.id}" requires a raster source`)):h!=="raster-dem"&&c==="hillshade"||h!=="raster-dem"&&c==="color-relief"?r.push(new j(o,n.source,`layer "${n.id}" requires a raster-dem source`)):h==="raster"&&c!=="raster"?r.push(new j(o,n.source,`layer "${n.id}" requires a vector source`)):h!=="vector"||n["source-layer"]?h==="raster-dem"&&c!=="hillshade"&&c!=="color-relief"?r.push(new j(o,n.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):c!=="line"||!n.paint||!n.paint["line-gradient"]||h==="geojson"&&u.lineMetrics||r.push(new j(o,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new j(o,n,`layer "${n.id}" must specify a "source-layer"`)):r.push(new j(o,n.source,`source "${n.source}" not found`))}else r.push(new j(o,n,'missing required property "source"'));return c==="raster"&&((e=n.paint)===null||e===void 0?void 0:e.resampling)&&((i=n.paint)===null||i===void 0?void 0:i["raster-resampling"])&&r.push(new j(o,n.paint,`layer "${n.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),r=r.concat(ke({key:o,value:n,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*":()=>[],type:()=>t.validateSpec({key:`${o}.type`,value:n.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:n,objectKey:"type"}),filter:yc,layout:(u)=>ke({layer:n,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":(h)=>Ap(Rr({layerType:c},h))}}),paint:(u)=>ke({layer:n,key:u.key,value:u.value,style:u.style,styleSpec:u.styleSpec,validateSpec:u.validateSpec,objectElementValidators:{"*":(h)=>Cp(Rr({layerType:c},h))}})}})),r}function Fi(t){let{value:e,key:i}=t,r=ht(e);return r!=="string"?[new j(i,e,`string expected, ${r} found`)]:[]}let Dp={promoteId:function({key:t,value:e}){if(ht(e)==="string")return Fi({key:t,value:e});{let i=[];for(let r in e)i.push(...Fi({key:`${t}.${r}`,value:e[r]}));return i}}};function Rp(t){let{value:e,key:i,styleSpec:r,style:n,validateSpec:o}=t;if(!e.type)return[new j(i,e,'"type" is required')];let s=Ut(e.type),a;switch(s){case"vector":case"raster":return a=ke({key:i,value:e,valueSpec:r[`source_${s.replace("-","_")}`],style:t.style,styleSpec:r,objectElementValidators:Dp,validateSpec:o}),a;case"raster-dem":return a=function(c){var l;let u=(l=c.sourceName)!==null&&l!==void 0?l:"",{value:h,styleSpec:p}=c,d=p.source_raster_dem,f=c.style,m=[],_=ht(h);if(h===void 0)return m;if(_!=="object")return m.push(new j("source_raster_dem",h,`object expected, ${_} found`)),m;let y=Ut(h.encoding)==="custom",v=["redFactor","greenFactor","blueFactor","baseShift"],g=c.value.encoding?`"${c.value.encoding}"`:"Default";for(let x in h)!y&&v.includes(x)?m.push(new j(x,h[x],`In "${u}": "${x}" is only valid when "encoding" is set to "custom". ${g} encoding found`)):d[x]?m=m.concat(c.validateSpec({key:x,value:h[x],valueSpec:d[x],validateSpec:c.validateSpec,style:f,styleSpec:p})):m.push(new j(x,h[x],`unknown property "${x}"`));return m}({sourceName:i,value:e,style:t.style,styleSpec:r,validateSpec:o}),a;case"geojson":if(a=ke({key:i,value:e,valueSpec:r.source_geojson,style:n,styleSpec:r,validateSpec:o,objectElementValidators:Dp}),e.cluster)for(let c in e.clusterProperties){let[l,u]=e.clusterProperties[c],h=typeof l=="string"?[l,["accumulated"],["get",c]]:l;a.push(...$r({key:`${i}.${c}.map`,value:u,expressionContext:"cluster-map"})),a.push(...$r({key:`${i}.${c}.reduce`,value:h,expressionContext:"cluster-reduce"}))}return a;case"video":return ke({key:i,value:e,valueSpec:r.source_video,style:n,validateSpec:o,styleSpec:r});case"image":return ke({key:i,value:e,valueSpec:r.source_image,style:n,validateSpec:o,styleSpec:r});case"canvas":return[new j(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return to({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function kp(t){let{value:e,styleSpec:i}=t,r=i.light,n=t.style,o=[],s=ht(e);if(e===void 0)return o;if(s!=="object")return o=o.concat([new j("light",e,`object expected, ${s} found`)]),o;for(let a in e){let c=a.match(/^(.*)-transition$/);o=o.concat(c&&r[c[1]]&&r[c[1]].transition?t.validateSpec({key:a,value:e[a],valueSpec:i.transition,validateSpec:t.validateSpec,style:n,styleSpec:i}):r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)])}return o}function Lp(t){let{value:e,styleSpec:i}=t,r=i.sky,n=t.style,o=ht(e);if(e===void 0)return[];if(o!=="object")return[new j("sky",e,`object expected, ${o} found`)];let s=[];for(let a in e)s=s.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)]);return s}function Fp(t){let{value:e,styleSpec:i}=t,r=i.terrain,n=t.style,o=[],s=ht(e);if(e===void 0)return o;if(s!=="object")return o=o.concat([new j("terrain",e,`object expected, ${s} found`)]),o;for(let a in e)o=o.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],validateSpec:t.validateSpec,style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)]);return o}function Bp(t){let e=[],{value:i,key:r}=t;if(Array.isArray(i)){let n=[],o=[];for(let s in i)i[s].id&&n.includes(i[s].id)&&e.push(new j(r,i,`all the sprites' ids must be unique, but ${i[s].id} is duplicated`)),n.push(i[s].id),i[s].url&&o.includes(i[s].url)&&e.push(new j(r,i,`all the sprites' URLs must be unique, but ${i[s].url} is duplicated`)),o.push(i[s].url),e=e.concat(ke({key:`${r}[${s}]`,value:i[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:t.validateSpec}));return e}return Fi({key:r,value:i})}function Op(t){return Boolean(t)&&t.constructor===Object}function jp(t){return Op(t.value)?[]:[new j(t.key,t.value,`object expected, ${ht(t.value)} found`)]}let Np={"*":()=>[],array:_c,boolean:function(t){let{value:e,key:i}=t,r=ht(e);return r!=="boolean"?[new j(i,e,`boolean expected, ${r} found`)]:[]},number:Us,color:gc,constants:Pp,enum:to,filter:yc,function:Ip,layer:zp,object:ke,source:Rp,light:kp,sky:Lp,terrain:Fp,projection:function(t){let{value:e,styleSpec:i}=t,r=i.projection,n=t.style,o=ht(e);if(e===void 0)return[];if(o!=="object")return[new j("projection",e,`object expected, ${o} found`)];let s=[];for(let a in e)s=s.concat(r[a]?t.validateSpec({key:a,value:e[a],valueSpec:r[a],style:n,styleSpec:i}):[new j(a,e[a],`unknown property "${a}"`)]);return s},projectionDefinition:function(t){let{key:e,value:i}=t;i=i instanceof String?i.valueOf():i;let r=ht(i);return r!=="array"||function(n){return Array.isArray(n)&&n.length===3&&typeof n[0]=="string"&&typeof n[1]=="string"&&typeof n[2]=="number"}(i)||function(n){return!!["interpolate","step","literal"].includes(n[0])}(i)?["array","string"].includes(r)?[]:[new j(e,i,`projection expected, invalid type "${r}" found`)]:[new j(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:Fi,formatted:function(t){return Fi(t).length===0?[]:$r(t)},resolvedImage:function(t){return Fi(t).length===0?[]:$r(t)},padding:function(t){let{key:e,value:i}=t;if(ht(i)==="array"){if(i.length<1||i.length>4)return[new j(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},n=[];for(let o=0;o<i.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:r}));return n}return Us({key:e,value:i,valueSpec:{}})},numberArray:function(t){let{key:e,value:i}=t;if(ht(i)==="array"){let r={type:"number"};if(i.length<1)return[new j(e,i,"array length at least 1 expected, length 0 found")];let n=[];for(let o=0;o<i.length;o++)n=n.concat(t.validateSpec({key:`${e}[${o}]`,value:i[o],validateSpec:t.validateSpec,valueSpec:r}));return n}return Us({key:e,value:i,valueSpec:{}})},colorArray:function(t){let{key:e,value:i}=t;if(ht(i)==="array"){if(i.length<1)return[new j(e,i,"array length at least 1 expected, length 0 found")];let r=[];for(let n=0;n<i.length;n++)r=r.concat(gc({key:`${e}[${n}]`,value:i[n]}));return r}return gc({key:e,value:i})},variableAnchorOffsetCollection:function(t){let{key:e,value:i}=t,r=ht(i),n=t.styleSpec;if(r!=="array"||i.length<1||i.length%2!=0)return[new j(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let s=0;s<i.length;s+=2)o=o.concat(to({key:`${e}[${s}]`,value:i[s],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(_c({key:`${e}[${s+1}]`,value:i[s+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return o},sprite:Bp,state:jp,fontFaces:function(t){let{key:e,value:i,validateSpec:r,styleSpec:n,style:o}=t;if(!Op(i))return[new j(e,i,`object expected, ${ht(i)} found`)];let s=[];for(let a in i){let c=i[a],l=ht(c);if(l==="string")s.push(...Fi({key:`${e}.${a}`,value:c}));else if(l==="array"){let u={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[h,p]of c.entries())s.push(...ke({key:`${e}.${a}[${h}]`,value:p,valueSpec:u,styleSpec:n,style:o,validateSpec:r}))}else s.push(new j(`${e}.${a}`,c,`string or array expected, ${l} found`))}return s}};function $s(t){let{value:e,valueSpec:i,styleSpec:r}=t;return t.validateSpec=$s,i.expression&&Rs(Ut(e))?Ip(t):i.expression&&Ls(nr(e))?$r(t):i.type&&Np[i.type]?Np[i.type](t):ke(Rr({},t,{valueSpec:i.type?r[i.type]:i}))}function Vp(t){let{value:e,key:i}=t,r=Fi(t);return r.length||(e.indexOf("{fontstack}")===-1&&r.push(new j(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&r.push(new j(i,e,'"glyphs" url must include a "{range}" token'))),r}function $e(t,e=D){let i=[];return i=i.concat($s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:$s,objectElementValidators:{glyphs:Vp,"*":()=>[]}})),t.constants&&(i=i.concat(Pp({key:"constants",value:t.constants}))),Up(i)}function ti(t){return function(e){return t(Object.assign({},e,{validateSpec:$s}))}}function Up(t){return[].concat(t).sort((e,i)=>e.line-i.line)}function ei(t){return function(...e){return Up(t.apply(this,e))}}$e.source=ei(ti(Rp)),$e.sprite=ei(ti(Bp)),$e.glyphs=ei(ti(Vp)),$e.light=ei(ti(kp)),$e.sky=ei(ti(Lp)),$e.terrain=ei(ti(Fp)),$e.state=ei(ti(jp)),$e.layer=ei(ti(zp)),$e.filter=ei(ti(yc)),$e.paintProperty=ei(ti(Cp)),$e.layoutProperty=ei(ti(Ap));let av={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class $p{constructor(t,e){this._globalState=e,this.setValue(t)}evaluate(){var t;return(t=this._literalValue)!==null&&t!==void 0?t:this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none")return this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let e=Fs(t,av,this._globalState);if(e.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map((i)=>`${i.key}: ${i.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=Jn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}let lv=D,te=$e,{light:cv,sky:hv,paintProperty:uv,layoutProperty:dv}=te;function Zs(t,e){let i=!1;if(e==null?void 0:e.length)for(let r of e)t.fire(new J(Error(r.message))),i=!0;return i}class eo{constructor(t,e,i){let r=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(let a=0;a<this.d*this.d;a++){let c=o[3+a],l=o[3+a+1];r.push(c===l?null:o.subarray(c,l))}let s=o[3+r.length+1];this.keys=o.subarray(o[3+r.length],s),this.bboxes=o.subarray(s),this.insert=this._insertReadonly}else{this.d=e+2*i;for(let o=0;o<this.d*this.d;o++)r.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;let n=i/e*t;this.min=-n,this.max=t+n}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,i,r,n,o){this.cells[n].push(o)}query(t,e,i,r,n){let o=this.min,s=this.max;if(t<=o&&e<=o&&s<=i&&s<=r&&!n)return[...this.keys];{let a=[];return this._forEachCell(t,e,i,r,this._queryCell,a,{},n),a}}_queryCell(t,e,i,r,n,o,s,a){let c=this.cells[n];if(c!==null){let l=this.keys,u=this.bboxes;for(let h of c)if(s[h]===void 0){let p=4*h;(a?a(u[p+0],u[p+1],u[p+2],u[p+3]):t<=u[p+2]&&e<=u[p+3]&&i>=u[p+0]&&r>=u[p+1])?(s[h]=!0,o.push(l[h])):s[h]=!1}}}_forEachCell(t,e,i,r,n,o,s,a){let c=this._convertToCellCoord(t),l=this._convertToCellCoord(e),u=this._convertToCellCoord(i),h=this._convertToCellCoord(r);for(let p=c;p<=u;p++)for(let d=l;d<=h;d++){let f=this.d*d+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&n.call(this,t,e,i,r,f,o,s,a))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,e=3+this.cells.length+1+1,i=0;for(let o of this.cells)i+=o.length;let r=new Int32Array(e+i+this.keys.length+this.bboxes.length);r[0]=this.extent,r[1]=this.n,r[2]=this.padding;let n=e;for(let o=0;o<t.length;o++){let s=t[o];r[3+o]=n,r.set(s,n),n+=s.length}return r[3+t.length]=n,r.set(this.keys,n),n+=this.keys.length,r[3+t.length+1]=n,r.set(this.bboxes,n),n+=this.bboxes.length,r.buffer}static serialize(t,e){let i=t.toArrayBuffer();return e&&e.push(i),{buffer:i}}static deserialize(t){return new eo(t.buffer)}}let Ti={};function U(t,e,i={}){if(Ti[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Ti[t]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}U("Object",Object),U("Set",Set),U("TransferableGridIndex",eo),U("Color",Y),U("Error",Error),U("AJAXError",zr),U("ResolvedImage",Ve),U("StylePropertyFunction",Os),U("StyleExpression",ks,{omit:["_evaluator"]}),U("ZoomDependentExpression",Bs),U("ZoomConstantExpression",Kn),U("CompoundExpression",Ue,{omit:["_evaluate"]});for(let t in jr)jr[t]._classRegistryKey||U(`Expression_${t}`,jr[t]);function Zp(t){var e;return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||((e=t.constructor)===null||e===void 0?void 0:e.name)==="ArrayBuffer")}function vc(t){return t.$name||t.constructor._classRegistryKey}function Gp(t){return!function(e){if(e===null||typeof e!="object")return!1;let i=vc(e);return i&&i!=="Object"}(t)&&(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||Zp(t)||Yi(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function io(t,e){if(Gp(t))return(Zp(t)||Yi(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let o=[];for(let s of t)o.push(io(s,e));return o}if(typeof t!="object")throw Error("can't serialize object of type "+typeof t);let i=vc(t);if(!i)throw Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!Ti[i])throw Error(`${i} is not registered.`);let{klass:r}=Ti[i],n=r.serialize?r.serialize(t,e):{};if(r.serialize){if(n===(e==null?void 0:e[e.length-1]))throw Error("statically serialized object won't survive transfer of $name property")}else{for(let o in t){if(!t.hasOwnProperty(o))continue;if(Ti[i].omit.includes(o))continue;let s=t[o];n[o]=Ti[i].shallow.includes(o)?s:io(s,e)}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}function ro(t){if(Gp(t))return t;if(Array.isArray(t))return t.map(ro);if(typeof t!="object")throw Error("can't deserialize object of type "+typeof t);let e=vc(t)||"Object";if(!Ti[e])throw Error(`can't deserialize unregistered class ${e}`);let{klass:i}=Ti[e];if(!i)throw Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);let r=Object.create(i.prototype);for(let n of Object.keys(t)){if(n==="$name")continue;let o=t[n];r[n]=Ti[e].shallow.includes(n)?o:ro(o)}return r}class Gs{constructor(){this.first=!0}update(t,e){let i=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=i,!0))}}function pv(t){for(let i of t)if(e=i.codePointAt(0),/[\u02EA\u02EB\u1100-\u11FF\u1400-\u167F\u18B0-\u18F5\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303F\u3041-\u3096\u309D-\u30FB\u30FD-\u30FF\u3105-\u312F\u3131-\u318E\u3190-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFE4\uDFF0-\uDFF6]|[\uD81C-\uD822\uD83D\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD30-\uDEFB]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83C[\uDC00-\uDE00\uDF00-\uDFFF]|\uD83E[\uDD00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e)))return!0;var e;return!1}function qp(t){let e=t.map((i)=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch(r){return null}}).filter((i)=>i);return new RegExp(e.join("|"),"u")}qp(["Arab","Dupl","Mong","Ougr","Syrc"]);let fv=qp(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Wp(t){return fv.test(String.fromCodePoint(t))}function mv(t,e){return!(!e&&Wp(t)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(t)))}function _v(t){for(let e of t)if(Wp(e.codePointAt(0)))return!0;return!1}let Zr=new class{constructor(){this.TIMEOUT=5000,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Zr.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,e){return it(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let i=t.pluginURL,r=new Promise((o)=>{this.loadScriptResolve=o});e(i);let n=new Promise((o)=>setTimeout(()=>o(),this.TIMEOUT));if(yield Promise.race([r,n]),this.isParsed()){let o={pluginStatus:"loaded",pluginURL:i};return this.setState(o),o}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)})}};class At{constructor(t,e){this.isSupportedScript=gv,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new Gs,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gs,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),i=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*i}:{fromScale:0.5,toScale:1,t:1-(1-i)*e}}}function gv(t){return function(e,i){for(let r of e)if(!mv(r.codePointAt(0),i))return!1;return!0}(t,Zr.getRTLTextPluginStatus()==="loaded")}let no="-transition";class oo{constructor(t,e,i){this.property=t,this.value=e,this.expression=function(r,n,o){if(Rs(r))return new Os(r,n);if(Ls(r)){let s=bp(r,n,o);if(s.result==="error")throw Error(s.value.map((a)=>`${a.key}: ${a.message}`).join(", "));return s.value}{let s=r;return n.type==="color"&&typeof r=="string"?s=Y.parse(r):n.type!=="padding"||typeof r!="number"&&!Array.isArray(r)?n.type!=="numberArray"||typeof r!="number"&&!Array.isArray(r)?n.type!=="colorArray"||typeof r!="string"&&!Array.isArray(r)?n.type==="variableAnchorOffsetCollection"&&Array.isArray(r)?s=Ne.parse(r):n.type==="projectionDefinition"&&typeof r=="string"&&(s=Re.parse(r)):s=se.parse(r):s=xe.parse(r):s=ve.parse(r),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>s}}}(e===void 0?t.specification.default:e,t.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,i){return this.property.possiblyEvaluate(this,t,e,i)}}class qs{constructor(t,e){this.property=t,this.value=new oo(t,void 0,e)}transitioned(t,e){return new xc(this.property,this.value,e,G({},t.transition,this.transition),t.now)}untransitioned(){return new xc(this.property,this.value,null,{},0)}}class so{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=e}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return be(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new qs(this._values[t].property,this._globalState)),this._values[t].value=new oo(this._values[t].property,e===null?void 0:be(e),this._globalState)}getTransition(t){return be(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new qs(this._values[t].property,this._globalState)),this._values[t].transition=be(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let i=this.getValue(e);i!==void 0&&(t[e]=i);let r=this.getTransition(e);r!==void 0&&(t[`${e}${no}`]=r)}return t}transitioned(t,e){let i=new bc(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(t,e._values[r]);return i}untransitioned(){let t=new bc(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}}class xc{constructor(t,e,i,r,n){this.property=t,this.value=e,this.begin=n+r.delay||0,this.end=this.begin+r.duration||0,t.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(t,e,i){let r=t.now||0,n=this.value.possiblyEvaluate(t,e,i),o=this.prior;if(o){if(r>this.end)return this.prior=null,n;if(this.value.isDataDriven())return this.prior=null,n;if(r<this.begin)return o.possiblyEvaluate(t,e,i);{let s=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(t,e,i),n,bd(s))}}return n}}class bc{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,i){let r=new ao(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Hp{constructor(t,e){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=e}hasValue(t){return this._values[t].value!==void 0}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return be(this._values[t].value)}setValue(t,e){this._values[t]=new oo(this._values[t].property,e===null?void 0:be(e),this._globalState)}serialize(){let t={};for(let e of Object.keys(this._values)){let i=this.getValue(e);i!==void 0&&(t[e]=i)}return t}possiblyEvaluate(t,e,i){let r=new ao(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].possiblyEvaluate(t,e,i);return r}}class ii{constructor(t,e,i){this.property=t,this.value=e,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,e,i,r){return this.property.evaluate(this.value,this.parameters,t,e,i,r)}}class ao{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Z{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,i){let r=Ft[this.specification.type];return r?r(t,e,i):t}}class K{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,i,r){return new ii(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(e,null,{},i,r)}:t.expression,e)}interpolate(t,e,i){if(t.value.kind!=="constant"||e.value.kind!=="constant")return t;if(t.value.value===void 0||e.value.value===void 0)return new ii(this,{kind:"constant",value:void 0},t.parameters);let r=Ft[this.specification.type];if(r){let n=r(t.value.value,e.value.value,i);return new ii(this,{kind:"constant",value:n},t.parameters)}return t}evaluate(t,e,i,r,n,o){return t.kind==="constant"?t.value:t.evaluate(e,i,r,n,o)}}class Gr extends K{possiblyEvaluate(t,e,i,r){if(t.value===void 0)return new ii(this,{kind:"constant",value:void 0},e);if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},i,r),o=t.property.specification.type==="resolvedImage"&&typeof n!="string"?n.name:n,s=this._calculate(o,o,o,e);return new ii(this,{kind:"constant",value:s},e)}if(t.expression.kind==="camera"){let n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new ii(this,{kind:"constant",value:n},e)}return new ii(this,t.expression,e)}evaluate(t,e,i,r,n,o){if(t.kind==="source"){let s=t.evaluate(e,i,r,n,o);return this._calculate(s,s,s,e)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},i,r),t.evaluate({zoom:Math.floor(e.zoom)},i,r),t.evaluate({zoom:Math.floor(e.zoom)+1},i,r),e):t.value}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class wc{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},i,r);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new At(Math.floor(e.zoom-1),e)),t.expression.evaluate(new At(Math.floor(e.zoom),e)),t.expression.evaluate(new At(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:i,to:e}}interpolate(t){return t}}class lo{constructor(t){this.specification=t}possiblyEvaluate(t,e,i,r){return!!t.expression.evaluate(e,null,{},i,r)}interpolate(){return!1}}class ee{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let i=t[e];i.specification.overridable&&this.overridableProperties.push(e);let r=this.defaultPropertyValues[e]=new oo(i,void 0,void 0),n=this.defaultTransitionablePropertyValues[e]=new qs(i,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=r.possiblyEvaluate({})}}}U("DataDrivenProperty",K),U("DataConstantProperty",Z),U("CrossFadedDataDrivenProperty",Gr),U("CrossFadedProperty",wc),U("ColorRampProperty",lo);let Xp=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",Tc=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class Ze extends Ht{constructor(t,e,i){if(super(),this.id=t.id,this.type=t.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(r,n){return new $p(r,n)}(this.visibility,i),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=Qn(t.filter,i)),e.layout&&(this._unevaluatedLayout=new Hp(e.layout,i)),e.paint)){this._transitionablePaint=new so(e.paint,i);for(let r in t.paint)this.setPaintProperty(r,t.paint[r],{validate:!1});for(let r in t.layout)this.setLayoutProperty(r,t.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ao(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=Qn(t,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if(t==="visibility")return this.visibility;if((e=this._transitionablePaint)===null||e===void 0?void 0:e.hasProperty(t))throw Error(t+Xp);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[e];for(let r of i.getGlobalStateRefs())t.add(r)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var t;let e=new globalThis.Map;if(this._transitionablePaint)for(let i in this._transitionablePaint._values){let r=this._transitionablePaint._values[i].value;for(let n of r.getGlobalStateRefs()){let o=(t=e.get(n))!==null&&t!==void 0?t:[];o.push({name:i,value:r.value}),e.set(n,o)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,i={}){var r;if(t==="visibility")return this.visibility=e,this._visibilityExpression.setValue(e),void this.recalculateVisibility();((r=this._transitionablePaint)===null||r===void 0?void 0:r.hasProperty(t))?this.fire(new J(Error(t+Xp))):e!=null&&this._validate(dv,`layers.${this.id}.layout.${t}`,t,e,i)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,i;if(t.endsWith(no)){let r=t.slice(0,-11);if(r==="visibility"||((e=this._unevaluatedLayout)===null||e===void 0?void 0:e.hasProperty(r)))throw Error(t+Tc);return this._transitionablePaint.getTransition(r)}if(t==="visibility"||((i=this._unevaluatedLayout)===null||i===void 0?void 0:i.hasProperty(t)))throw Error(t+Tc);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,i={}){var r;if(t==="visibility"||((r=this._unevaluatedLayout)===null||r===void 0?void 0:r.hasProperty(t)))return this.fire(new J(Error(t+Tc))),!1;if(e!=null&&this._validate(uv,`layers.${this.id}.paint.${t}`,t,e,i))return!1;if(t.endsWith(no))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let n=this._transitionablePaint._values[t],o=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let c=this._transitionablePaint._values[t].value;return c.isDataDriven()||s||o||this._handleOverridablePaintPropertyUpdate(t,a,c)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,i){return!1}isHidden(t=this.minzoom,e=!1){return!!(this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&t>=this.maxzoom)||this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){var t,e;let i={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(t=this._unevaluatedLayout)===null||t===void 0?void 0:t.serialize(),paint:(e=this._transitionablePaint)===null||e===void 0?void 0:e.serialize()};return this.visibility&&(i.layout||(i.layout={}),i.layout.visibility=this.visibility),Td(i,(r,n)=>!(r===void 0||n==="layout"&&!Object.keys(r).length||n==="paint"&&!Object.keys(r).length))}_validate(t,e,i,r,n={}){return(n==null?void 0:n.validate)!==!1&&Zs(this,t.call(te,{key:e,layerType:this.type,objectKey:i,value:r,styleSpec:D,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof ii&&Vr(e.property.specification)&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}}let Yp;var yv={get paint(){return Yp=Yp||new ee({"raster-opacity":new Z(D.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(D.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(D.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(D.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(D.paint_raster["raster-saturation"]),"raster-contrast":new Z(D.paint_raster["raster-contrast"]),resampling:new Z(D.paint_raster.resampling),"raster-resampling":new Z(D.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(D.paint_raster["raster-fade-duration"])})}};let Sc=(t)=>t.type==="raster";class Kp extends Ze{constructor(t,e){super(t,yv,e)}}let vv={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class qr{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Rt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function Bt(t,e=1){let i=0,r=0;return{members:t.map((n)=>{let o=vv[n.type].BYTES_PER_ELEMENT,s=i=Jp(i,Math.max(e,o)),a=n.components||1;return r=Math.max(r,o),i+=o*a,{name:n.name,type:n.type,components:a,offset:s}}),size:Jp(i,Math.max(r,e)),alignment:e}}function Jp(t,e){return Math.ceil(t/e)*e}class Wr extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.int16[r+0]=e,this.int16[r+1]=i,t}}Wr.prototype.bytesPerElement=4,U("StructArrayLayout2i4",Wr);class co extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.int16[n+0]=e,this.int16[n+1]=i,this.int16[n+2]=r,t}}co.prototype.bytesPerElement=6,U("StructArrayLayout3i6",co);class Ws extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){let o=4*t;return this.int16[o+0]=e,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=n,t}}Ws.prototype.bytesPerElement=8,U("StructArrayLayout4i8",Ws);class Hs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,t}}Hs.prototype.bytesPerElement=12,U("StructArrayLayout2i4i12",Hs);class Xs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=4*t,c=8*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=n,this.uint8[c+6]=o,this.uint8[c+7]=s,t}}Xs.prototype.bytesPerElement=8,U("StructArrayLayout2i4ub8",Xs);class Hr extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.float32[r+0]=e,this.float32[r+1]=i,t}}Hr.prototype.bytesPerElement=8,U("StructArrayLayout2f8",Hr);class Ys extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,i,r,n,o,s,a,c,l)}emplace(t,e,i,r,n,o,s,a,c,l,u){let h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=n,this.uint16[h+4]=o,this.uint16[h+5]=s,this.uint16[h+6]=a,this.uint16[h+7]=c,this.uint16[h+8]=l,this.uint16[h+9]=u,t}}Ys.prototype.bytesPerElement=20,U("StructArrayLayout10ui20",Ys);class Ks extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a){let c=this.length;return this.resize(c+1),this.emplace(c,t,e,i,r,n,o,s,a)}emplace(t,e,i,r,n,o,s,a,c){let l=8*t;return this.uint16[l+0]=e,this.uint16[l+1]=i,this.uint16[l+2]=r,this.uint16[l+3]=n,this.uint16[l+4]=o,this.uint16[l+5]=s,this.uint16[l+6]=a,this.uint16[l+7]=c,t}}Ks.prototype.bytesPerElement=16,U("StructArrayLayout8ui16",Ks);class Js extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c,l,u,h){let p=this.length;return this.resize(p+1),this.emplace(p,t,e,i,r,n,o,s,a,c,l,u,h)}emplace(t,e,i,r,n,o,s,a,c,l,u,h,p){let d=12*t;return this.int16[d+0]=e,this.int16[d+1]=i,this.int16[d+2]=r,this.int16[d+3]=n,this.uint16[d+4]=o,this.uint16[d+5]=s,this.uint16[d+6]=a,this.uint16[d+7]=c,this.int16[d+8]=l,this.int16[d+9]=u,this.int16[d+10]=h,this.int16[d+11]=p,t}}Js.prototype.bytesPerElement=24,U("StructArrayLayout4i4ui4i24",Js);class Qs extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.float32[n+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}Qs.prototype.bytesPerElement=12,U("StructArrayLayout3f12",Qs);class ta extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}ta.prototype.bytesPerElement=4,U("StructArrayLayout1ul4",ta);class ea extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,i,r,n,o,s,a,c)}emplace(t,e,i,r,n,o,s,a,c,l){let u=10*t,h=5*t;return this.int16[u+0]=e,this.int16[u+1]=i,this.int16[u+2]=r,this.int16[u+3]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.uint32[h+3]=a,this.uint16[u+8]=c,this.uint16[u+9]=l,t}}ea.prototype.bytesPerElement=20,U("StructArrayLayout6i1ul2ui20",ea);class ia extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=6*t;return this.int16[a+0]=e,this.int16[a+1]=i,this.int16[a+2]=r,this.int16[a+3]=n,this.int16[a+4]=o,this.int16[a+5]=s,t}}ia.prototype.bytesPerElement=12,U("StructArrayLayout2i2i2i12",ia);class ra extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n){let o=this.length;return this.resize(o+1),this.emplace(o,t,e,i,r,n)}emplace(t,e,i,r,n,o){let s=4*t,a=8*t;return this.float32[s+0]=e,this.float32[s+1]=i,this.float32[s+2]=r,this.int16[a+6]=n,this.int16[a+7]=o,t}}ra.prototype.bytesPerElement=16,U("StructArrayLayout2f1f2i16",ra);class na extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,i,r,n,o)}emplace(t,e,i,r,n,o,s){let a=16*t,c=4*t,l=8*t;return this.uint8[a+0]=e,this.uint8[a+1]=i,this.float32[c+1]=r,this.float32[c+2]=n,this.int16[l+6]=o,this.int16[l+7]=s,t}}na.prototype.bytesPerElement=16,U("StructArrayLayout2ub2f2i16",na);class ho extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.uint16[n+0]=e,this.uint16[n+1]=i,this.uint16[n+2]=r,t}}ho.prototype.bytesPerElement=6,U("StructArrayLayout3ui6",ho);class oa extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_){let y=this.length;return this.resize(y+1),this.emplace(y,t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_)}emplace(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y){let v=24*t,g=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=n,this.uint32[g+2]=o,this.uint32[g+3]=s,this.uint32[g+4]=a,this.uint16[v+10]=c,this.uint16[v+11]=l,this.uint16[v+12]=u,this.float32[g+7]=h,this.float32[g+8]=p,this.uint8[x+36]=d,this.uint8[x+37]=f,this.uint8[x+38]=m,this.uint32[g+10]=_,this.int16[v+22]=y,t}}oa.prototype.bytesPerElement=48,U("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",oa);class sa extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P,S,E,I){let C=this.length;return this.resize(C+1),this.emplace(C,t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P,S,E,I)}emplace(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P,S,E,I,C){let A=32*t,M=16*t;return this.int16[A+0]=e,this.int16[A+1]=i,this.int16[A+2]=r,this.int16[A+3]=n,this.int16[A+4]=o,this.int16[A+5]=s,this.int16[A+6]=a,this.int16[A+7]=c,this.uint16[A+8]=l,this.uint16[A+9]=u,this.uint16[A+10]=h,this.uint16[A+11]=p,this.uint16[A+12]=d,this.uint16[A+13]=f,this.uint16[A+14]=m,this.uint16[A+15]=_,this.uint16[A+16]=y,this.uint16[A+17]=v,this.uint16[A+18]=g,this.uint16[A+19]=x,this.uint16[A+20]=b,this.uint16[A+21]=w,this.uint16[A+22]=T,this.uint32[M+12]=P,this.float32[M+13]=S,this.float32[M+14]=E,this.uint16[A+30]=I,this.uint16[A+31]=C,t}}sa.prototype.bytesPerElement=64,U("StructArrayLayout8i15ui1ul2f2ui64",sa);class uo extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}uo.prototype.bytesPerElement=4,U("StructArrayLayout1f4",uo);class aa extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=3*t;return this.uint16[6*t+0]=e,this.float32[n+1]=i,this.float32[n+2]=r,t}}aa.prototype.bytesPerElement=12,U("StructArrayLayout1ui2f12",aa);class la extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,i){let r=this.length;return this.resize(r+1),this.emplace(r,t,e,i)}emplace(t,e,i,r){let n=4*t;return this.uint32[2*t+0]=e,this.uint16[n+2]=i,this.uint16[n+3]=r,t}}la.prototype.bytesPerElement=8,U("StructArrayLayout1ul2ui8",la);class ca extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let i=this.length;return this.resize(i+1),this.emplace(i,t,e)}emplace(t,e,i){let r=2*t;return this.uint16[r+0]=e,this.uint16[r+1]=i,t}}ca.prototype.bytesPerElement=4,U("StructArrayLayout2ui4",ca);class ha extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}ha.prototype.bytesPerElement=2,U("StructArrayLayout1ui2",ha);class ua extends Rt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,i,r){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,i,r)}emplace(t,e,i,r,n){let o=4*t;return this.float32[o+0]=e,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=n,t}}ua.prototype.bytesPerElement=16,U("StructArrayLayout4f16",ua);class Pc extends qr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new z(this.anchorPointX,this.anchorPointY)}}Pc.prototype.size=20;class Ic extends ea{get(t){return new Pc(this,t)}}U("CollisionBoxArray",Ic);class Ec extends qr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Ec.prototype.size=48;class Mc extends oa{get(t){return new Ec(this,t)}}U("PlacedSymbolArray",Mc);class Cc extends qr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Cc.prototype.size=64;class Ac extends sa{get(t){return new Cc(this,t)}}U("SymbolInstanceArray",Ac);class zc extends uo{getoffsetX(t){return this.float32[1*t+0]}}U("GlyphOffsetArray",zc);class Dc extends co{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}U("SymbolLineVertexArray",Dc);class Rc extends qr{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Rc.prototype.size=12;class kc extends aa{get(t){return new Rc(this,t)}}U("TextAnchorOffsetArray",kc);class Lc extends qr{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Lc.prototype.size=8;class Fc extends la{get(t){return new Lc(this,t)}}U("FeatureIndexArray",Fc);class ui extends Wr{}class Qp extends co{}class tf extends Ws{}class ef extends Wr{}class rf extends Wr{}class nf extends Hs{}class of extends Xs{}class sf extends Hr{}class or extends Ys{}class Bc extends Ks{}class af extends Js{}class lf extends Qs{}class cf extends ta{}class Oc extends ia{}class hf extends ra{}class uf extends na{}class df extends ho{}class Ge extends ho{}class da extends ca{}class pf extends ha{}let xv=Bt([{name:"a_pos",components:2,type:"Int16"}],4),{members:bv}=xv;class xt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,e,i,r){let n=this.segments[this.segments.length-1];return t>xt.MAX_VERTEX_ARRAY_LENGTH&&Ct(`Max vertices per segment is ${xt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${xt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>xt.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==r?this.createNewSegment(e,i,r):n}createNewSegment(t,e,i){let r={vertexOffset:t.length,primitiveOffset:e.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(r.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(r),r}getOrCreateLatestSegment(t,e,i){return this.prepareSegment(0,t,e,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,i,r){return new xt([{vertexOffset:t,primitiveOffset:e,vertexLength:i,primitiveLength:r,vaos:{},sortKey:0}])}}function ff(t,e){return 256*(t=_t(Math.floor(t),0,255))+_t(Math.floor(e),0,255)}xt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,U("SegmentVector",xt);let wv=Bt([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),Tv=Bt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var mf,_f,gf,po={exports:{}},yf={exports:{}},vf={exports:{}},Sv=function(){if(gf)return po.exports;gf=1;var t=(mf||(mf=1,function(i){i.exports=function(r,n){var o,s,a,c,l,u,h,p;for(s=r.length-(o=3&r.length),a=n,l=3432918353,u=461845907,p=0;p<s;)h=255&r.charCodeAt(p)|(255&r.charCodeAt(++p))<<8|(255&r.charCodeAt(++p))<<16|(255&r.charCodeAt(++p))<<24,++p,a=27492+(65535&(c=5*(65535&(a=(a^=h=(65535&(h=(h=(65535&h)*l+(((h>>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*u+(((h>>>16)*u&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(c>>>16)&65535)<<16);switch(h=0,o){case 3:h^=(255&r.charCodeAt(p+2))<<16;case 2:h^=(255&r.charCodeAt(p+1))<<8;case 1:a^=h=(65535&(h=(h=(65535&(h^=255&r.charCodeAt(p)))*l+(((h>>>16)*l&65535)<<16)&4294967295)<<15|h>>>17))*u+(((h>>>16)*u&65535)<<16)&4294967295}return a^=r.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}}(yf)),yf.exports),e=(_f||(_f=1,function(i){i.exports=function(r,n){for(var o,s=r.length,a=n^s,c=0;s>=4;)o=1540483477*(65535&(o=255&r.charCodeAt(c)|(255&r.charCodeAt(++c))<<8|(255&r.charCodeAt(++c))<<16|(255&r.charCodeAt(++c))<<24))+((1540483477*(o>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),s-=4,++c;switch(s){case 3:a^=(255&r.charCodeAt(c+2))<<16;case 2:a^=(255&r.charCodeAt(c+1))<<8;case 1:a=1540483477*(65535&(a^=255&r.charCodeAt(c)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}}(vf)),vf.exports);return po.exports=t,po.exports.murmur3=t,po.exports.murmur2=e,po.exports}(),Pv=ld(Sv);class pa{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,i,r){this.ids.push(xf(t)),this.positions.push(e,i,r)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let e=xf(t),i=0,r=this.ids.length-1;for(;i<r;){let o=i+r>>1;this.ids[o]>=e?r=o:i=o+1}let n=[];for(;this.ids[i]===e;)n.push({index:this.positions[3*i],start:this.positions[3*i+1],end:this.positions[3*i+2]}),i++;return n}static serialize(t,e){let i=new Float64Array(t.ids),r=new Uint32Array(t.positions);return jc(i,r,0,i.length-1),e&&e.push(i.buffer,r.buffer),{ids:i,positions:r}}static deserialize(t){let e=new pa;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}}function xf(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Pv(String(t))}function jc(t,e,i,r){for(;i<r;){let n=t[i+r>>1],o=i-1,s=r+1;for(;;){do o++;while(t[o]<n);do s--;while(t[s]>n);if(o>=s)break;fa(t,o,s),fa(e,3*o,3*s),fa(e,3*o+1,3*s+1),fa(e,3*o+2,3*s+2)}s-i<r-s?(jc(t,e,i,s),i=s+1):(jc(t,e,s+1,r),r=s)}}function fa(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}U("FeaturePositionMap",pa);class di{constructor(t,e){this.gl=t.gl,this.location=e}}class tt extends di{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}}class B extends di{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class et extends di{constructor(t,e){super(t,e),this.current=[0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]||(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}}class Te extends di{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]||(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}}class Si extends di{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Pi extends di{constructor(t,e){super(t,e),this.current=Y.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}class Nc extends di{constructor(t,e){super(t,e),this.current=[]}set(t){if(t!=this.current){this.current=t;let e=new Float32Array(4*t.length);for(let i=0;i<t.length;i++)e[4*i]=t[i].r,e[4*i+1]=t[i].g,e[4*i+2]=t[i].b,e[4*i+3]=t[i].a;this.gl.uniform4fv(this.location,e)}}}class Vc extends di{constructor(t,e){super(t,e),this.current=[]}set(t){if(t!=this.current){this.current=t;let e=new Float32Array(t);this.gl.uniform1fv(this.location,e)}}}let Iv=new Float32Array(16);class Se extends di{constructor(t,e){super(t,e),this.current=Iv}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0])return this.current=t,void this.gl.uniformMatrix4fv(this.location,!1,t);for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}}function Uc(t){return[ff(255*t.r,255*t.g),ff(255*t.b,255*t.a)]}class Xr{constructor(t,e,i){this.value=t,this.uniformNames=e.map((r)=>`u_${r}`),this.type=i}setUniform(t,e,i){t.set(i.constantOr(this.value))}getBinding(t,e,i){return this.type==="color"?new Pi(t,e):new B(t,e)}}class Bi{constructor(t,e){this.uniformNames=e.map((i)=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,i,r){let n=null;r==="u_pattern_to"?n=this.patternTo:r==="u_pattern_from"?n=this.patternFrom:r==="u_dasharray_to"?n=this.dashTo:r==="u_dasharray_from"?n=this.dashFrom:r==="u_pixel_ratio_to"?n=this.pixelRatioTo:r==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new Si(t,e):new B(t,e)}}class pi{constructor(t,e,i,r){this.expression=t,this.type=i,this.maxValue=0,this.paintVertexAttributes=e.map((n)=>({name:`a_${n}`,type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(t,e,i){let r=this.paintVertexArray.length,n=this.expression.evaluate(new At(0,i),e,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(r,t,n)}updatePaintArray(t,e,i,r,n){let o=this.expression.evaluate(new At(0,n),i,r);this._setPaintValue(t,e,o)}_setPaintValue(t,e,i){if(this.type==="color"){let r=Uc(i);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r[0],r[1])}else{for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(t){var e,i;((e=this.paintVertexArray)===null||e===void 0?void 0:e.arrayBuffer.byteLength)&&(((i=this.paintVertexBuffer)===null||i===void 0?void 0:i.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class qe{constructor(t,e,i,r,n,o){this.expression=t,this.uniformNames=e.map((s)=>`u_${s}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map((s)=>({name:`a_${s}`,type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(t,e,i){let r=this.expression.evaluate(new At(this.zoom,i),e,{},i.canonical,[],i.formattedSection),n=this.expression.evaluate(new At(this.zoom+1,i),e,{},i.canonical,[],i.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(o,t,r,n)}updatePaintArray(t,e,i,r,n){let o=this.expression.evaluate(new At(this.zoom,n),i,r),s=this.expression.evaluate(new At(this.zoom+1,n),i,r);this._setPaintValue(t,e,o,s)}_setPaintValue(t,e,i,r){if(this.type==="color"){let n=Uc(i),o=Uc(r);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,n[0],n[1],o[0],o[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(t){var e,i;((e=this.paintVertexArray)===null||e===void 0?void 0:e.arrayBuffer.byteLength)&&(((i=this.paintVertexBuffer)===null||i===void 0?void 0:i.buffer)?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let i=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,r=_t(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);t.set(r)}getBinding(t,e,i){return new B(t,e)}}class Ii{constructor(t,e,i,r,n,o){this.expression=t,this.type=e,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(r,t,this.getPositionIds(e),i)}updatePaintArray(t,e,i,r,n){this._setPaintValues(t,e,this.getPositionIds(i),n)}_setPaintValues(t,e,i,r){let n=this.getPositions(r);if(!n||!i)return;let o=n[i.min],s=n[i.mid],a=n[i.max];if(o&&s&&a)for(let c=t;c<e;c++)this.emplace(this.zoomInPaintVertexArray,c,s,o),this.emplace(this.zoomOutPaintVertexArray,c,s,a)}upload(t){var e,i;if(((e=this.zoomInPaintVertexArray)===null||e===void 0?void 0:e.arrayBuffer.byteLength)&&((i=this.zoomOutPaintVertexArray)===null||i===void 0?void 0:i.arrayBuffer.byteLength)){let r=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,r,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,r,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class $c extends Ii{getPositions(t){return t.imagePositions}getPositionIds(t){var e;return(e=t.patterns)===null||e===void 0?void 0:e[this.layerId]}getVertexAttributes(){return wv.members}emplace(t,e,i,r){t.emplace(e,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}}class Zc extends Ii{getPositions(t){return t.dashPositions}getPositionIds(t){var e;return(e=t.dashes)===null||e===void 0?void 0:e[this.layerId]}getVertexAttributes(){return Tv.members}emplace(t,e,i,r){t.emplace(e,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}}class Gc{constructor(t,e,i){this.binders={},this._buffers=[];let r=[];for(let n in t.paint._values){if(!i(n))continue;let o=t.paint.get(n);if(!(o instanceof ii&&Vr(o.property.specification)))continue;let s=Ev(n,t.type),a=o.value,c=o.property.specification.type,l=o.property.useIntegerZoom,u=o.property.specification["property-type"],h=u==="cross-faded"||u==="cross-faded-data-driven";if(a.kind==="constant")this.binders[n]=h?new Bi(a.value,s):new Xr(a.value,s,c),r.push(`/u_${n}`);else if(a.kind==="source"||h){let p=bf(n,c,"source");this.binders[n]=h?n==="line-dasharray"?new Zc(a,c,l,e,p,t.id):new $c(a,c,l,e,p,t.id):new pi(a,s,c,p),r.push(`/a_${n}`)}else{let p=bf(n,c,"composite");this.binders[n]=new qe(a,s,c,l,e,p),r.push(`/z_${n}`)}}this.cacheKey=r.sort().join("")}getMaxValue(t){let e=this.binders[t];return e instanceof pi||e instanceof qe?e.maxValue:0}populatePaintArrays(t,e,i){for(let r in this.binders){let n=this.binders[r];(n instanceof pi||n instanceof qe||n instanceof Ii)&&n.populatePaintArray(t,e,i)}}setConstantPatternPositions(t,e){for(let i in this.binders){let r=this.binders[i];r instanceof Bi&&r.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let i in this.binders){let r=this.binders[i];r instanceof Bi&&r.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,i,r,n){let o=!1;for(let s in t){let a=e.getPositions(s);for(let c of a){let l=i.feature(c.index);for(let u in this.binders){let h=this.binders[u];if((h instanceof pi||h instanceof qe||h instanceof Ii)&&h.expression.isStateDependent===!0){let p=r.paint.get(u);h.expression=p.value,h.updatePaintArray(c.start,c.end,l,t[s],n),o=!0}}}}return o}defines(){let t=[];for(let e in this.binders){let i=this.binders[e];(i instanceof Xr||i instanceof Bi)&&t.push(...i.uniformNames.map((r)=>`#define HAS_UNIFORM_${r}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let i=this.binders[e];if(i instanceof pi||i instanceof qe)for(let r of i.paintVertexAttributes)t.push(r.name);else if(i instanceof Ii){let r=i.getVertexAttributes();for(let n of r)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let i=this.binders[e];if(i instanceof Xr||i instanceof Bi||i instanceof qe)for(let r of i.uniformNames)t.push(r)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let i=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Xr||n instanceof Bi||n instanceof qe){for(let o of n.uniformNames)if(e[o]){let s=n.getBinding(t,e[o],o);i.push({name:o,property:r,binding:s})}}}return i}setUniforms(t,e,i,r){for(let{name:n,property:o,binding:s}of e)this.binders[o].setUniform(s,r,i.get(o),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let i=this.binders[e];if(t&&i instanceof Ii){let r=t.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof pi||i instanceof qe)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(t){for(let e in this.binders){let i=this.binders[e];(i instanceof pi||i instanceof qe||i instanceof Ii)&&i.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof pi||e instanceof qe||e instanceof Ii)&&e.destroy()}}}class Oi{constructor(t,e,i=()=>!0){this.programConfigurations={};for(let r of t)this.programConfigurations[r.id]=new Gc(r,e,i);this.needsUpload=!1,this._featureMap=new pa,this._bufferOffset=0}populatePaintArrays(t,e,i,r){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,r);e.id!==void 0&&this._featureMap.add(e.id,i,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,i,r){for(let n of i)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,r)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Ev(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function bf(t,e,i){let r={color:{source:Hr,composite:ua},number:{source:uo,composite:Hr}},n=function(o){return{"line-pattern":{source:or,composite:or},"fill-pattern":{source:or,composite:or},"fill-extrusion-pattern":{source:or,composite:or},"line-dasharray":{source:Bc,composite:Bc}}[o]}(t);return(n==null?void 0:n[i])||r[e][i]}U("ConstantBinder",Xr),U("CrossFadedConstantBinder",Bi),U("SourceExpressionBinder",pi),U("CrossFadedPatternBinder",$c),U("CrossFadedDasharrayBinder",Zc),U("CompositeExpressionBinder",qe),U("ProgramConfiguration",Gc,{omit:["_buffers"]}),U("ProgramConfigurationSet",Oi);let qc=Math.pow(2,14)-1,wf=-qc-1;function sr(t){let e=F/t.extent,i=t.loadGeometry();for(let r of i)for(let n of r){let o=Math.round(n.x*e),s=Math.round(n.y*e);n.x=_t(o,wf,qc),n.y=_t(s,wf,qc),(o<n.x||o>n.x+1||s<n.y||s>n.y+1)&&Ct("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function ar(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?sr(t):[]}}let Tf=-32768;function Mv(t,e,i,r,n){t.emplaceBack(Tf+8*e+r,Tf+8*i+n)}class ma{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new ef,this.indexArray=new Ge,this.segments=new xt,this.programConfigurations=new Oi(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){let r=this.layers[0],n=[],o=null,s=!1,a=r.type==="heatmap";if(r.type==="circle"){let l=r;o=l.layout.get("circle-sort-key"),s=!o.isConstant(),a||(a=l.paint.get("circle-pitch-alignment")==="map")}let c=a?e.subdivisionGranularity.circle:1;for(let{feature:l,id:u,index:h,sourceLayerIndex:p}of t){let d=this.layers[0]._featureFilter.needGeometry,f=ar(l,d);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),f,i))continue;let m=s?o.evaluate(f,{},i):void 0,_={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:h,geometry:d?f.geometry:sr(l),patterns:{},sortKey:m};n.push(_)}s&&n.sort((l,u)=>l.sortKey-u.sortKey);for(let l of n){let{geometry:u,index:h,sourceLayerIndex:p}=l,d=t[h].feature;this.addFeature(l,u,h,i,c),e.featureIndex.insert(d,u,h,p,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,bv),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,i,r,n=1){let o;switch(n){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=o.length;for(let a of e)for(let c of a){let{x:l,y:u}=c;if(l<0||l>=F||u<0||u>=F)continue;let h=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=h.vertexLength;for(let d=0;d<s;d++)for(let f=0;f<s;f++)Mv(this.layoutVertexArray,l,u,o[f],o[d]);for(let d=0;d<s-1;d++)for(let f=0;f<s-1;f++){let m=p+d*s+f,_=p+(d+1)*s+f;this.indexArray.emplaceBack(m,_+1,m+1),this.indexArray.emplaceBack(m,_,_+1)}h.vertexLength+=s*s,h.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:{},canonical:r})}}function Sf(t,e){for(let i of t)if(Yr(e,i))return!0;for(let i of e)if(Yr(t,i))return!0;return Wc(t,e)}function _a(t,e,i){return!!Yr(t,e)||Hc(e,t,i)}function Pf(t,e){if(t.length===1)return If(e,t[0]);for(let i of e)for(let r of i)if(Yr(t,r))return!0;for(let i of t)if(If(e,i))return!0;for(let i of e)if(Wc(t,i))return!0;return!1}function Cv(t,e,i){if(t.length>1){if(Wc(t,e))return!0;for(let r of e)if(Hc(r,t,i))return!0}for(let r of t)if(Hc(r,e,i))return!0;return!1}function Wc(t,e){if(t.length===0||e.length===0)return!1;for(let i=0;i<t.length-1;i++){let r=t[i],n=t[i+1];for(let o=0;o<e.length-1;o++)if(Av(r,n,e[o],e[o+1]))return!0}return!1}function Av(t,e,i,r){return Di(t,i,r)!==Di(e,i,r)&&Di(t,e,i)!==Di(t,e,r)}function Hc(t,e,i){let r=i*i;if(e.length===1)return t.distSqr(e[0])<r;for(let n=1;n<e.length;n++)if(zv(t,e[n-1],e[n])<r)return!0;return!1}function zv(t,e,i){let r=e.distSqr(i);if(r===0)return t.distSqr(e);let n=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/r;return t.distSqr(n<0?e:n>1?i:i.sub(e)._mult(n)._add(e))}function If(t,e){let i,r,n,o=!1;for(let s of t){i=s;for(let a=0,c=i.length-1;a<i.length;c=a++)r=i[a],n=i[c],r.y>e.y!=n.y>e.y&&e.x<(n.x-r.x)*(e.y-r.y)/(n.y-r.y)+r.x&&(o=!o)}return o}function Yr(t,e){let i=!1;for(let r=0,n=t.length-1;r<t.length;n=r++){let o=t[r],s=t[n];o.y>e.y!=s.y>e.y&&e.x<(s.x-o.x)*(e.y-o.y)/(s.y-o.y)+o.x&&(i=!i)}return i}function Dv(t,e,i){let r=i[0],n=i[2];if(t.x<r.x&&e.x<r.x||t.x>n.x&&e.x>n.x||t.y<r.y&&e.y<r.y||t.y>n.y&&e.y>n.y)return!1;let o=Di(t,e,i[0]);return o!==Di(t,e,i[1])||o!==Di(t,e,i[2])||o!==Di(t,e,i[3])}function Kr(t,e,i){let r=e.paint.get(t).value;return r.kind==="constant"?r.value:i.programConfigurations.get(e.id).getMaxValue(t)}function ga(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ya(t,e,i,r,n){if(!e[0]&&!e[1])return t;let o=z.convert(e)._mult(n);i==="viewport"&&o._rotate(-r);let s=[];for(let a of t)s.push(a.sub(o));return s}function Rv(t){let e=[];for(let i=0;i<t.length;i++){let r=t[i],n=e.at(-1);(i===0||n&&!r.equals(n))&&e.push(r)}return e}function kv({queryGeometry:t,size:e},i){return _a(t,i,e)}function Lv({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},o){return _a(t,o,e*(i.projectTileCoordinates(o.x,o.y,r,n).signedDistanceFromCamera/i.cameraToCenterDistance))}function Fv({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},o){let s=i.projectTileCoordinates(o.x,o.y,r,n).signedDistanceFromCamera,a=e*(i.cameraToCenterDistance/s);return _a(t,Xc(o,i,r,n),a)}function Bv({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n},o){return _a(t,Xc(o,i,r,n),e)}function Ef({queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n,pitchAlignment:o="map",pitchScale:s="map"},a){let c=o==="map"?s==="map"?kv:Lv:s==="map"?Fv:Bv,l={queryGeometry:t,size:e,transform:i,unwrappedTileID:r,getElevation:n};for(let u of a)for(let h of u)if(c(l,h))return!0;return!1}function Xc(t,e,i,r){let n=e.projectTileCoordinates(t.x,t.y,i,r).point;return new z((0.5*n.x+0.5)*e.width,(0.5*-n.y+0.5)*e.height)}let Mf,Cf;U("CircleBucket",ma,{omit:["layers"]});var Ov={get paint(){return Cf=Cf||new ee({"circle-radius":new K(D.paint_circle["circle-radius"]),"circle-color":new K(D.paint_circle["circle-color"]),"circle-blur":new K(D.paint_circle["circle-blur"]),"circle-opacity":new K(D.paint_circle["circle-opacity"]),"circle-translate":new Z(D.paint_circle["circle-translate"]),"circle-translate-anchor":new Z(D.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Z(D.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Z(D.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new K(D.paint_circle["circle-stroke-width"]),"circle-stroke-color":new K(D.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new K(D.paint_circle["circle-stroke-opacity"])})},get layout(){return Mf=Mf||new ee({"circle-sort-key":new K(D.layout_circle["circle-sort-key"])})}};class Af extends Ze{constructor(t,e){super(t,Ov,e)}createBucket(t){return new ma(t)}queryRadius(t){let e=t;return Kr("circle-radius",this,e)+Kr("circle-stroke-width",this,e)+ga(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:a}){let c=ya(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,o),l=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i),u=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment"),p,d;return h==="map"?(p=c,d=l*o):(p=function(f,m,_,y){return f.map((v)=>Xc(v,m,_,y))}(c,n,s,a),d=l),Ef({queryGeometry:p,size:d,transform:n,unwrappedTileID:s,getElevation:a,pitchAlignment:h,pitchScale:u},r)}}class Yc extends ma{}let zf;U("HeatmapBucket",Yc,{omit:["layers"]});var jv={get paint(){return zf=zf||new ee({"heatmap-radius":new K(D.paint_heatmap["heatmap-radius"]),"heatmap-weight":new K(D.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Z(D.paint_heatmap["heatmap-intensity"]),"heatmap-color":new lo(D.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Z(D.paint_heatmap["heatmap-opacity"])})}};function Kc(t,{width:e,height:i},r,n){if(n){if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*i*r)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*i*r}`)}else n=new Uint8Array(e*i*r);return t.width=e,t.height=i,t.data=n,t}function Df(t,{width:e,height:i},r){if(e===t.width&&i===t.height)return;let n=Kc({},{width:e,height:i},r);Jc(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,i)},r),t.width=e,t.height=i,t.data=n.data}function Jc(t,e,i,r,n,o){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||i.x>t.width-n.width||i.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||r.x>e.width-n.width||r.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,a=e.data;if(s===a)throw Error("srcData equals dstData, so image is already copied");for(let c=0;c<n.height;c++){let l=((i.y+c)*t.width+i.x)*o,u=((r.y+c)*e.width+r.x)*o;for(let h=0;h<n.width*o;h++)a[u+h]=s[l+h]}return e}class fo{constructor(t,e){Kc(this,t,1,e)}resize(t){Df(this,t,1)}clone(){return new fo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Jc(t,e,i,r,n,1)}}class It{constructor(t,e){Kc(this,t,4,e)}resize(t){Df(this,t,4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new It({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,i,r,n){Jc(t,e,i,r,n,4)}setPixel(t,e,i){let r=4*(t*this.width+e);this.data[r+0]=Math.round(255*i.r/i.a),this.data[r+1]=Math.round(255*i.g/i.a),this.data[r+2]=Math.round(255*i.b/i.a),this.data[r+3]=Math.round(255*i.a)}}function Rf(t){let e=new Uint8Array(t.length);for(let i=0;i<t.length;i+=4){let r=t[i+3];e[i+0]=Math.round(t[i+0]*r/255),e[i+1]=Math.round(t[i+1]*r/255),e[i+2]=Math.round(t[i+2]*r/255),e[i+3]=r}return e}function kf(t){let e={},i=t.resolution||256,r=t.clips?t.clips.length:1,n=t.image||new It({width:i,height:r});if(Math.log(i)/Math.LN2%1!=0)throw Error(`width is not a power of 2 - ${i}`);let o=(s,a,c)=>{e[t.evaluationKey]=c;let l=t.expression.evaluate(e);n.setPixel(s/4/i,a/4,l)};if(t.clips)for(let s=0,a=0;s<r;++s,a+=4*i)for(let c=0,l=0;c<i;c++,l+=4){let u=c/(i-1),{start:h,end:p}=t.clips[s];o(a,l,h*(1-u)+p*u)}else for(let s=0,a=0;s<i;s++,a+=4)o(0,a,s/(i-1));return n}U("AlphaImage",fo),U("RGBAImage",It);let mo="big-fb";class Lf extends Ze{createBucket(t){return new Yc(t)}constructor(t,e){super(t,jv,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=kf({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(mo)&&this.heatmapFbos.delete(mo)}queryRadius(t){return Kr("heatmap-radius",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,unwrappedTileID:s,getElevation:a}){return Ef({queryGeometry:t,size:this.paint.get("heatmap-radius").evaluate(e,i)*o,transform:n,unwrappedTileID:s,getElevation:a},r)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let Ff;var Nv={get paint(){return Ff=Ff||new ee({"hillshade-illumination-direction":new Z(D.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Z(D.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Z(D.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Z(D.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Z(D.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Z(D.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Z(D.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Z(D.paint_hillshade["hillshade-method"]),resampling:new Z(D.paint_hillshade.resampling)})}};class Bf extends Ze{constructor(t,e){super(t,Nv,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,i.length,r.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1)));let o=e.map(Vt);return{directionRadians:t.map(Vt),altitudeRadians:o,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let Of;var Vv={get paint(){return Of=Of||new ee({"color-relief-opacity":new Z(D["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new lo(D["paint_color-relief"]["color-relief-color"]),resampling:new Z(D["paint_color-relief"].resampling)})}};function jf(t){return"data"in t}class jt{constructor(t,e,i,r){this.context=t,this.format=i,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,r)}update(t,e,i){var r;let{width:n,height:o}=t,s=(((r=this.size)===null||r===void 0?void 0:r[0])!==n||this.size[1]!==o)&&!i,{context:a}=this,{gl:c}=a;this.useMipmap=Boolean(e==null?void 0:e.useMipmap),c.bindTexture(c.TEXTURE_2D,this.texture),a.pixelStoreUnpackFlipY.set(!1),a.pixelStoreUnpack.set(1);let l=this.format===c.RGBA&&(e==null?void 0:e.premultiply)!==!1;if(s)this.size=[n,o],jf(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,n,o,c)):(a.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,c));else{let{x:u,y:h}=i||{x:0,y:0};jf(t)?(a.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,u,h,n,o,c)):(a.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,u,h,c))}this.useMipmap&&this.isSizePowerOfTwo()&&c.generateMipmap(c.TEXTURE_2D),a.pixelStoreUnpackFlipY.setDefault(),a.pixelStoreUnpack.setDefault(),a.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,i,r,n){let{data:o}=t;e&&o&&(o=Rf(o)),n.texImage2D(n.TEXTURE_2D,0,this.format,i,r,0,this.format,n.UNSIGNED_BYTE,o)}_updateDomImage(t,e,i,r){r.texSubImage2D(r.TEXTURE_2D,0,e,i,r.RGBA,r.UNSIGNED_BYTE,t)}_updateRawData(t,e,i,r,n,o,s){let{data:a}=t;e&&a&&(a=Rf(a)),s.texSubImage2D(s.TEXTURE_2D,0,i,r,n,o,s.RGBA,s.UNSIGNED_BYTE,a)}bind(t,e,i){let{context:r}=this,{gl:n}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),i!==n.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(i=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}function Nf(t,e){let i=e[0],r=e[1],n=e[2],o=e[3],s=Math.min(i,r,n),a=Math.round((t+o)/s);return{r:Math.floor(a*s/i)%256,g:Math.floor(a*s/r)%256,b:Math.floor(a*s/n)%256}}U("DEMData",class{constructor(t,e,i,r=1,n=1,o=1,s=0){if(this.uid=t,e.height!==e.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i))return void Ct(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=e.height;let a=this.dim=e.height-2;switch(this.data=new Uint32Array(e.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=0.00390625,this.baseShift=32768;break;case"custom":this.redFactor=r,this.greenFactor=n,this.blueFactor=o,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=0.1,this.baseShift=1e4}for(let c=0;c<a;c++)this.data[this._idx(-1,c)]=this.data[this._idx(0,c)],this.data[this._idx(a,c)]=this.data[this._idx(a-1,c)],this.data[this._idx(c,-1)]=this.data[this._idx(c,0)],this.data[this._idx(c,a)]=this.data[this._idx(c,a-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(a,-1)]=this.data[this._idx(a-1,0)],this.data[this._idx(-1,a)]=this.data[this._idx(0,a-1)],this.data[this._idx(a,a)]=this.data[this._idx(a-1,a-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let c=0;c<a;c++)for(let l=0;l<a;l++){let u=this.get(c,l);u>this.max&&(this.max=u),u<this.min&&(this.min=u)}}get(t,e){let i=new Uint8Array(this.data.buffer),r=4*this._idx(t,e);return this.unpack(i[r],i[r+1],i[r+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${e}, dim: ${this.dim}`);return(e+1)*this.stride+(t+1)}unpack(t,e,i){return t*this.redFactor+e*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return Nf(t,this.getUnpackVector())}getPixels(){return new It({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,i){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let r=e*this.dim,n=e*this.dim+this.dim,o=i*this.dim,s=i*this.dim+this.dim;switch(e){case-1:r=n-1;break;case 1:n=r+1}switch(i){case-1:o=s-1;break;case 1:s=o+1}let a=-e*this.dim,c=-i*this.dim;for(let l=o;l<s;l++)for(let u=r;u<n;u++)this.data[this._idx(u,l)]=t.data[this._idx(u+a,l+c)]}});class Vf extends Ze{constructor(t,e){super(t,Vv,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof Kn&&i._styleExpression.expression instanceof we){this.colorRampExpression=i;let o=i._styleExpression.expression;e.elevationStops=o.labels,e.colorStops=[];for(let s of e.elevationStops)e.colorStops.push(o.evaluate({globals:{elevation:s}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[Y.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;let r={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let o=0;o<e.elevationStops.length-0.5;o+=n)r.elevationStops.push(e.elevationStops[Math.round(o)]),r.colorStops.push(e.colorStops[Math.round(o)]);return Ct(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,e,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(e),n=new It({width:r.colorStops.length,height:1}),o=new It({width:r.colorStops.length,height:1});for(let s=0;s<r.elevationStops.length;s++){let a=Nf(r.elevationStops[s],i);o.setPixel(0,s,new Y(a.r/255,a.g/255,a.b/255,1)),n.setPixel(0,s,r.colorStops[s])}return this.colorRampTextures={elevationTexture:new jt(t,o,t.gl.RGBA),colorTexture:new jt(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}let Uv=Bt([{name:"a_pos",components:2,type:"Int16"}],4),{members:$v}=Uv;function va(t,e,i){let r=i.patternDependencies,n=!1;for(let o of e){let s=o.paint.get(`${t}-pattern`);s.isConstant()||(n=!0);let a=s.constantOr(null);a&&(n=!0,r[a.to]=!0,r[a.from]=!0)}return n}function Qc(t,e,i,r,n){let{zoom:o}=r,s=n.patternDependencies;for(let a of e){let c=a.paint.get(`${t}-pattern`).value;if(c.kind!=="constant"){let l=c.evaluate({zoom:o-1},i,{},n.availableImages),u=c.evaluate({zoom:o},i,{},n.availableImages),h=c.evaluate({zoom:o+1},i,{},n.availableImages);l=(l==null?void 0:l.name)?l.name:l,u=(u==null?void 0:u.name)?u.name:u,h=(h==null?void 0:h.name)?h.name:h,s[l]=!0,s[u]=!0,s[h]=!0,i.patterns[a.id]={min:l,mid:u,max:h}}}return i}function Uf(t,e,i,r,n){let o;if(n===function(s,a,c,l){let u=0;for(let h=a,p=c-l;h<c;h+=l)u+=(s[p]-s[h])*(s[h+1]+s[p+1]),p=h;return u}(t,e,i,r)>0)for(let s=e;s<i;s+=r)o=qf(s/r|0,t[s],t[s+1],o);else for(let s=i-r;s>=e;s-=r)o=qf(s/r|0,t[s],t[s+1],o);return o&&Jr(o,o.next)&&(vo(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let i,r=t;do if(i=!1,r.steiner||!Jr(r,r.next)&&Nt(r.prev,r,r.next)!==0)r=r.next;else{if(vo(r),r=e=r.prev,r===r.next)break;i=!0}while(i||r!==e);return e}function _o(t,e,i,r,n,o,s){if(!t)return;!s&&o&&function(c,l,u,h){let p=c;do p.z===0&&(p.z=th(p.x,p.y,l,u,h)),p.prevZ=p.prev,p.nextZ=p.next,p=p.next;while(p!==c);p.prevZ.nextZ=null,p.prevZ=null,function(d){let f,m=1;do{let _,y=d;d=null;let v=null;for(f=0;y;){f++;let g=y,x=0;for(let w=0;w<m&&(x++,g=g.nextZ,g);w++);let b=m;for(;x>0||b>0&&g;)x!==0&&(b===0||!g||y.z<=g.z)?(_=y,y=y.nextZ,x--):(_=g,g=g.nextZ,b--),v?v.nextZ=_:d=_,_.prevZ=v,v=_;y=g}v.nextZ=null,m*=2}while(f>1)}(p)}(t,r,n,o);let a=t;for(;t.prev!==t.next;){let c=t.prev,l=t.next;if(o?Gv(t,r,n,o):Zv(t))e.push(c.i,t.i,l.i),vo(t),t=l.next,a=l.next;else if((t=l)===a){s?s===1?_o(t=qv(lr(t),e),e,i,r,n,o,2):s===2&&Wv(t,e,i,r,n,o):_o(lr(t),e,i,r,n,o,1);break}}}function Zv(t){let e=t.prev,i=t,r=t.next;if(Nt(e,i,r)>=0)return!1;let n=e.x,o=i.x,s=r.x,a=e.y,c=i.y,l=r.y,u=Math.min(n,o,s),h=Math.min(a,c,l),p=Math.max(n,o,s),d=Math.max(a,c,l),f=r.next;for(;f!==e;){if(f.x>=u&&f.x<=p&&f.y>=h&&f.y<=d&&go(n,a,o,c,s,l,f.x,f.y)&&Nt(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Gv(t,e,i,r){let n=t.prev,o=t,s=t.next;if(Nt(n,o,s)>=0)return!1;let a=n.x,c=o.x,l=s.x,u=n.y,h=o.y,p=s.y,d=Math.min(a,c,l),f=Math.min(u,h,p),m=Math.max(a,c,l),_=Math.max(u,h,p),y=th(d,f,e,i,r),v=th(m,_,e,i,r),{prevZ:g,nextZ:x}=t;for(;g&&g.z>=y&&x&&x.z<=v;){if(g.x>=d&&g.x<=m&&g.y>=f&&g.y<=_&&g!==n&&g!==s&&go(a,u,c,h,l,p,g.x,g.y)&&Nt(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&go(a,u,c,h,l,p,x.x,x.y)&&Nt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;g&&g.z>=y;){if(g.x>=d&&g.x<=m&&g.y>=f&&g.y<=_&&g!==n&&g!==s&&go(a,u,c,h,l,p,g.x,g.y)&&Nt(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;x&&x.z<=v;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=_&&x!==n&&x!==s&&go(a,u,c,h,l,p,x.x,x.y)&&Nt(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function qv(t,e){let i=t;do{let r=i.prev,n=i.next.next;!Jr(r,n)&&Zf(r,i,i.next,n)&&yo(r,n)&&yo(n,r)&&(e.push(r.i,i.i,n.i),vo(i),vo(i.next),i=t=n),i=i.next}while(i!==t);return lr(i)}function Wv(t,e,i,r,n,o){let s=t;do{let a=s.next.next;for(;a!==s.prev;){if(s.i!==a.i&&Jv(s,a)){let c=Gf(s,a);return s=lr(s,s.next),c=lr(c,c.next),_o(s,e,i,r,n,o,0),void _o(c,e,i,r,n,o,0)}a=a.next}s=s.next}while(s!==t)}function Hv(t,e){let i=t.x-e.x;return i===0&&(i=t.y-e.y,i===0)&&(i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function Xv(t,e){let i=function(n,o){let s=o,{x:a,y:c}=n,l,u=-1/0;if(Jr(n,s))return s;do{if(Jr(n,s.next))return s.next;if(c<=s.y&&c>=s.next.y&&s.next.y!==s.y){let m=s.x+(c-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(m<=a&&m>u&&(u=m,l=s.x<s.next.x?s:s.next,m===a))return l}s=s.next}while(s!==o);if(!l)return null;let h=l,p=l.x,d=l.y,f=1/0;s=l;do{if(a>=s.x&&s.x>=p&&a!==s.x&&$f(c<d?a:u,c,p,d,c<d?u:a,c,s.x,s.y)){let m=Math.abs(c-s.y)/(a-s.x);yo(s,n)&&(m<f||m===f&&(s.x>l.x||s.x===l.x&&Yv(l,s)))&&(l=s,f=m)}s=s.next}while(s!==h);return l}(t,e);if(!i)return e;let r=Gf(i,t);return lr(r,r.next),lr(i,i.next)}function Yv(t,e){return Nt(t.prev,t,e.prev)<0&&Nt(e.next,t,t.next)<0}function th(t,e,i,r,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Kv(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function $f(t,e,i,r,n,o,s,a){return(n-s)*(e-a)>=(t-s)*(o-a)&&(t-s)*(r-a)>=(i-s)*(e-a)&&(i-s)*(o-a)>=(n-s)*(r-a)}function go(t,e,i,r,n,o,s,a){return!(t===s&&e===a)&&$f(t,e,i,r,n,o,s,a)}function Jv(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,r){let n=i;do{if(n.i!==i.i&&n.next.i!==i.i&&n.i!==r.i&&n.next.i!==r.i&&Zf(n,n.next,i,r))return!0;n=n.next}while(n!==i);return!1}(t,e)&&(yo(t,e)&&yo(e,t)&&function(i,r){let n=i,o=!1,s=(i.x+r.x)/2,a=(i.y+r.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&s<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(o=!o),n=n.next;while(n!==i);return o}(t,e)&&(Nt(t.prev,t,e.prev)||Nt(t,e.prev,e))||Jr(t,e)&&Nt(t.prev,t,t.next)>0&&Nt(e.prev,e,e.next)>0)}function Nt(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Jr(t,e){return t.x===e.x&&t.y===e.y}function Zf(t,e,i,r){let n=ba(Nt(t,e,i)),o=ba(Nt(t,e,r)),s=ba(Nt(i,r,t)),a=ba(Nt(i,r,e));return n!==o&&s!==a||!(n!==0||!xa(t,i,e))||!(o!==0||!xa(t,r,e))||!(s!==0||!xa(i,t,r))||!(a!==0||!xa(i,e,r))}function xa(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function ba(t){return t>0?1:t<0?-1:0}function yo(t,e){return Nt(t.prev,t,t.next)<0?Nt(t,e,t.next)>=0&&Nt(t,t.prev,e)>=0:Nt(t,e,t.prev)<0||Nt(t,t.next,e)<0}function Gf(t,e){let i=eh(t.i,t.x,t.y),r=eh(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,i.next=n,n.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function qf(t,e,i,r){let n=eh(t,e,i);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function vo(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function eh(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class fi{constructor(t,e){if(e>t)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Qr{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Qr.noSubdivision=new Qr({fill:new fi(0,0),line:new fi(0,0),tile:new fi(0,0),stencil:new fi(0,0),circle:1}),U("SubdivisionGranularityExpression",fi),U("SubdivisionGranularitySetting",Qr);let cr=-32768,tn=32767;class Wf{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=F/t,this._canonical=e}_getKey(t,e){return(t+=32768)<<16|e+32768}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=0|Math.round(t),r=0|Math.round(e),n=this._getKey(i,r);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let o=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,o),this._vertexBuffer.push(i,r),o}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(r,n){let o=[];for(let s=0;s<n.length;s+=3){let a=n[s],c=n[s+1],l=n[s+2],u=r[2*a],h=r[2*a+1];(r[2*c]-u)*(r[2*l+1]-h)-(r[2*c+1]-h)*(r[2*l]-u)>0?(o.push(a),o.push(l),o.push(c)):(o.push(a),o.push(c),o.push(l))}return o}(this._vertexBuffer,t);let e=[],i=t.length;for(let r=0;r<i;r+=3){let n=[t[r+0],t[r+1],t[r+2]],o=[this._vertexBuffer[2*t[r+0]+0],this._vertexBuffer[2*t[r+0]+1],this._vertexBuffer[2*t[r+1]+0],this._vertexBuffer[2*t[r+1]+1],this._vertexBuffer[2*t[r+2]+0],this._vertexBuffer[2*t[r+2]+1]],s=1/0,a=1/0,c=-1/0,l=-1/0;for(let f=0;f<3;f++){let m=o[2*f],_=o[2*f+1];s=Math.min(s,m),c=Math.max(c,m),a=Math.min(a,_),l=Math.max(l,_)}if(s===c||a===l)continue;let u=Math.floor(s/this._granularityCellSize),h=Math.ceil(c/this._granularityCellSize),p=Math.floor(a/this._granularityCellSize),d=Math.ceil(l/this._granularityCellSize);if(u!==h||p!==d)for(let f=p;f<d;f++){let m=this._scanlineGenerateVertexRingForCellRow(f,o,n);Qv(this._vertexBuffer,m,e)}else e.push(...n)}return e}_scanlineGenerateVertexRingForCellRow(t,e,i){let r=t*this._granularityCellSize,n=r+this._granularityCellSize,o=[];for(let s=0;s<3;s++){let a=e[2*s],c=e[2*s+1],l=e[2*(s+1)%6],u=e[(2*(s+1)+1)%6],h=e[2*(s+2)%6],p=e[(2*(s+2)+1)%6],d=l-a,f=u-c,m=d===0,_=f===0,y=(r-c)/f,v=(n-c)/f,g=Math.min(y,v),x=Math.max(y,v);if(!_&&(g>=1||x<=0)||_&&(c<r||c>n)){u>=r&&u<=n&&o.push(i[(s+1)%3]);continue}!_&&g>0&&o.push(this._vertexToIndex(a+d*g,c+f*g));let b=a+d*Math.max(g,0),w=a+d*Math.min(x,1);m||this._generateIntraEdgeVertices(o,a,c,l,u,b,w),!_&&x<1&&o.push(this._vertexToIndex(a+d*x,c+f*x)),(_||u>=r&&u<=n)&&o.push(i[(s+1)%3]),!_&&(u<=r||u>=n)&&this._generateInterEdgeVertices(o,a,c,l,u,h,p,w,r,n)}return o}_generateIntraEdgeVertices(t,e,i,r,n,o,s){let a=r-e,c=n-i,l=c===0,u=l?Math.min(e,r):Math.min(o,s),h=l?Math.max(e,r):Math.max(o,s),p=Math.floor(u/this._granularityCellSize)+1,d=Math.ceil(h/this._granularityCellSize)-1;if(l?e<r:o<s)for(let f=p;f<=d;f++){let m=f*this._granularityCellSize;t.push(this._vertexToIndex(m,i+c*(m-e)/a))}else for(let f=d;f>=p;f--){let m=f*this._granularityCellSize;t.push(this._vertexToIndex(m,i+c*(m-e)/a))}}_generateInterEdgeVertices(t,e,i,r,n,o,s,a,c,l){let u=n-i,h=o-r,p=s-n,d=(c-n)/p,f=(l-n)/p,m=Math.min(d,f),_=Math.max(d,f),y=r+h*m,v=Math.floor(Math.min(y,a)/this._granularityCellSize)+1,g=Math.ceil(Math.max(y,a)/this._granularityCellSize)-1,x=a<y,b=p===0;if(b&&(s===c||s===l))return;if(b||m>=1||_<=0){let T=i-s,P=o+(e-o)*Math.min((c-s)/T,(l-s)/T);v=Math.floor(Math.min(P,a)/this._granularityCellSize)+1,g=Math.ceil(Math.max(P,a)/this._granularityCellSize)-1,x=a<P}let w=u>0?l:c;if(x)for(let T=v;T<=g;T++)t.push(this._vertexToIndex(T*this._granularityCellSize,w));else for(let T=g;T>=v;T--)t.push(this._vertexToIndex(T*this._granularityCellSize,w))}_generateOutline(t){let e=[];for(let i of t){let r=ih(i,this._granularity,!0),n=this._pointArrayToIndices(r),o=[];for(let s=1;s<n.length;s++)o.push(n[s-1]),o.push(n[s]);e.push(o)}return e}_handlePoles(t){let e=!1,i=!1;this._canonical&&(this._canonical.y===0&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(e||i)&&this._fillPoles(t,e,i)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){let i=t[e+1];i===cr&&(t[e+1]=-32767),i===tn&&(t[e+1]=32766)}}_generatePoleQuad(t,e,i,r,n,o){r>n!=(o===cr)?(t.push(e),t.push(i),t.push(this._vertexToIndex(r,o)),t.push(i),t.push(this._vertexToIndex(n,o)),t.push(this._vertexToIndex(r,o))):(t.push(i),t.push(e),t.push(this._vertexToIndex(r,o)),t.push(this._vertexToIndex(n,o)),t.push(i),t.push(this._vertexToIndex(r,o)))}_fillPoles(t,e,i){let r=this._vertexBuffer,n=F,o=t.length;for(let s=2;s<o;s+=3){let a=t[s-2],c=t[s-1],l=t[s],u=r[2*a],h=r[2*a+1],p=r[2*c],d=r[2*c+1],f=r[2*l],m=r[2*l+1];e&&(h===0&&d===0&&this._generatePoleQuad(t,a,c,u,p,cr),d===0&&m===0&&this._generatePoleQuad(t,c,l,p,f,cr),m===0&&h===0&&this._generatePoleQuad(t,l,a,f,u,cr)),i&&(h===n&&d===n&&this._generatePoleQuad(t,a,c,u,p,tn),d===n&&m===n&&this._generatePoleQuad(t,c,l,p,f,tn),m===n&&h===n&&this._generatePoleQuad(t,l,a,f,u,tn))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:r}=function(s){let a=[],c=[];for(let l of s)if(l.length!==0){l!==s[0]&&a.push(c.length/2);for(let u of l)c.push(u.x),c.push(u.y)}return{flattened:c,holeIndices:a}}(t),n;this._initializeVertices(i);try{let s=function(c,l,u=2){let h=l&&l.length,p=h?l[0]*u:c.length,d=Uf(c,0,p,u,!0),f=[];if(!d||d.next===d.prev)return f;let m,_,y;if(h&&(d=function(v,g,x,b){let w=[];for(let T=0,P=g.length;T<P;T++){let S=Uf(v,g[T]*b,T<P-1?g[T+1]*b:v.length,b,!1);S===S.next&&(S.steiner=!0),w.push(Kv(S))}w.sort(Hv);for(let T=0;T<w.length;T++)x=Xv(w[T],x);return x}(c,l,d,u)),c.length>80*u){m=c[0],_=c[1];let v=m,g=_;for(let x=u;x<p;x+=u){let b=c[x],w=c[x+1];b<m&&(m=b),w<_&&(_=w),b>v&&(v=b),w>g&&(g=w)}y=Math.max(v-m,g-_),y=y!==0?32767/y:0}return _o(d,f,u,m,_,y,0),f}(i,r),a=this._convertIndices(i,s);n=this._subdivideTrianglesScanline(a)}catch(s){console.error(s)}let o=[];return e&&(o=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:o}}_convertIndices(t,e){let i=[];for(let r of e)i.push(this._vertexToIndex(t[2*r],t[2*r+1]));return i}_pointArrayToIndices(t){let e=[];for(let i of t)e.push(this._vertexToIndex(i.x,i.y));return e}}function Hf(t,e,i,r=!0){return new Wf(i,e).subdividePolygonInternal(t,r)}function ih(t,e,i=!1){if(!t||t.length<1)return[];if(t.length<2)return[];let r=t[0],n=t[t.length-1],o=i&&(r.x!==n.x||r.y!==n.y);if(e<2)return o?[...t,t[0]]:[...t];let s=Math.floor(F/e),a=[];a.push(new z(t[0].x,t[0].y));let c=t.length,l=o?c:c-1;for(let u=0;u<l;u++){let h=t[u],p=u<c-1?t[u+1]:t[0],{x:d,y:f}=h,{x:m,y:_}=p,y=d!==m,v=f!==_;if(!y&&!v)continue;let g=m-d,x=_-f,b=Math.abs(g),w=Math.abs(x),T=d,P=f;for(;;){let E=g>0?(Math.floor(T/s)+1)*s:(Math.ceil(T/s)-1)*s,I=x>0?(Math.floor(P/s)+1)*s:(Math.ceil(P/s)-1)*s,C=Math.abs(T-E),A=Math.abs(P-I),M=Math.abs(T-m),k=Math.abs(P-_),L=y?C/b:Number.POSITIVE_INFINITY,O=v?A/w:Number.POSITIVE_INFINITY;if((M<=C||!y)&&(k<=A||!v))break;if(L<O&&y||!v){T=E,P+=x*L;let q=new z(T,Math.round(P));a[a.length-1].x===q.x&&a[a.length-1].y===q.y||a.push(q)}else{T+=g*O,P=I;let q=new z(Math.round(T),P);a[a.length-1].x===q.x&&a[a.length-1].y===q.y||a.push(q)}}let S=new z(m,_);a[a.length-1].x===S.x&&a[a.length-1].y===S.y||a.push(S)}return a}function Qv(t,e,i){if(e.length===0)throw Error("Subdivision vertex ring is empty.");let r=0,n=t[2*e[0]];for(let c=1;c<e.length;c++){let l=t[2*e[c]];l<n&&(n=l,r=c)}let o=e.length,s=r,a=(s+1)%o;for(;;){let c=s-1>=0?s-1:o-1,l=(a+1)%o,u=t[2*e[c]],h=t[2*e[l]],p=t[2*e[s]],d=t[2*e[s]+1],f=t[2*e[a]+1],m=!1;if(u<h)m=!0;else if(u>h)m=!1;else{let _=f-d,y=-(t[2*e[a]]-p),v=d<f?1:-1;((u-p)*_+(t[2*e[c]+1]-d)*y)*v>((h-p)*_+(t[2*e[l]+1]-d)*y)*v&&(m=!0)}if(m){let _=e[c],y=e[s],v=e[a];_!==y&&_!==v&&y!==v&&i.push(v,y,_),s--,s<0&&(s=o-1)}else{let _=e[l],y=e[s],v=e[a];_!==y&&_!==v&&y!==v&&i.push(v,y,_),a++,a>=o&&(a=0)}if(c===l)break}}function Xf(t,e,i,r,n,o,s,a,c){let l=n.length/2,u=s&&a&&c;if(l<xt.MAX_VERTEX_ARRAY_LENGTH){let h=e.prepareSegment(l,i,r),p=h.vertexLength;for(let m=0;m<o.length;m+=3)r.emplaceBack(p+o[m],p+o[m+1],p+o[m+2]);let d,f;h.vertexLength+=l,h.primitiveLength+=o.length/3,u&&(f=s.prepareSegment(l,i,a),d=f.vertexLength,f.vertexLength+=l);for(let m=0;m<n.length;m+=2)t(n[m],n[m+1]);if(u)for(let m of c){for(let _=1;_<m.length;_+=2)a.emplaceBack(d+m[_-1],d+m[_]);f.primitiveLength+=m.length/2}}else(function(h,p,d,f,m,_){let y=[];for(let w=0;w<f.length/2;w++)y.push(-1);let v={count:0},g=0,x=h.getOrCreateLatestSegment(p,d),b=x.vertexLength;for(let w=2;w<m.length;w+=3){let T=m[w-2],P=m[w-1],S=m[w],E=y[T]<g,I=y[P]<g,C=y[S]<g;x.vertexLength+((E?1:0)+(I?1:0)+(C?1:0))>xt.MAX_VERTEX_ARRAY_LENGTH&&(x=h.createNewSegment(p,d),g=v.count,E=!0,I=!0,C=!0,b=0);let A=xo(y,f,_,v,T,E,x),M=xo(y,f,_,v,P,I,x),k=xo(y,f,_,v,S,C,x);d.emplaceBack(b+A-g,b+M-g,b+k-g),x.primitiveLength++}})(e,i,r,n,o,t),u&&function(h,p,d,f,m,_){let y=[];for(let w=0;w<f.length/2;w++)y.push(-1);let v={count:0},g=0,x=h.getOrCreateLatestSegment(p,d),b=x.vertexLength;for(let w of m)for(let T=1;T<w.length;T+=2){let P=w[T-1],S=w[T],E=y[P]<g,I=y[S]<g;x.vertexLength+((E?1:0)+(I?1:0))>xt.MAX_VERTEX_ARRAY_LENGTH&&(x=h.createNewSegment(p,d),g=v.count,E=!0,I=!0,b=0);let C=xo(y,f,_,v,P,E,x),A=xo(y,f,_,v,S,I,x);d.emplaceBack(b+C-g,b+A-g),x.primitiveLength++}}(s,i,a,n,c,t),e.forceNewSegmentOnNextPrepare(),s==null||s.forceNewSegmentOnNextPrepare()}function xo(t,e,i,r,n,o,s){if(o){let a=r.count;return i(e[2*n],e[2*n+1]),t[n]=r.count,r.count++,s.vertexLength++,a}return t[n]}class rh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new rf,this.indexArray=new Ge,this.indexArray2=new da,this.programConfigurations=new Oi(t.layers,t.zoom),this.segments=new xt,this.segments2=new xt,this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){this.hasDependencies=va("fill",this.layers,e);let r=this.layers[0].layout.get("fill-sort-key"),n=!r.isConstant(),o=[];for(let{feature:s,id:a,index:c,sourceLayerIndex:l}of t){let u=this.layers[0]._featureFilter.needGeometry,h=ar(s,u);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),h,i))continue;let p=n?r.evaluate(h,{},i,e.availableImages):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:l,index:c,geometry:u?h.geometry:sr(s),patterns:{},sortKey:p};o.push(d)}n&&o.sort((s,a)=>s.sortKey-a.sortKey);for(let s of o){let{geometry:a,index:c,sourceLayerIndex:l}=s;if(this.hasDependencies){let u=Qc("fill",this.layers,s,{zoom:this.zoom},e);this.patternFeatures.push(u)}else this.addFeature(s,a,c,i,{},e.subdivisionGranularity);e.featureIndex.insert(t[c].feature,a,c,l,this.index)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}addFeatures(t,e,i){for(let r of this.patternFeatures)this.addFeature(r,r.geometry,r.index,e,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$v),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,i,r,n,o){for(let s of oc(e,500)){let a=Hf(s,r,o.fill.getGranularityForZoomLevel(r.z)),c=this.layoutVertexArray;Xf((l,u)=>{c.emplaceBack(l,u)},this.segments,this.layoutVertexArray,this.indexArray,a.verticesFlattened,a.indicesTriangles,this.segments2,this.indexArray2,a.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,canonical:r})}}let Yf,Kf;U("FillBucket",rh,{omit:["layers","patternFeatures"]});var tx={get paint(){return Kf=Kf||new ee({"fill-antialias":new Z(D.paint_fill["fill-antialias"]),"fill-opacity":new K(D.paint_fill["fill-opacity"]),"fill-color":new K(D.paint_fill["fill-color"]),"fill-outline-color":new K(D.paint_fill["fill-outline-color"]),"fill-translate":new Z(D.paint_fill["fill-translate"]),"fill-translate-anchor":new Z(D.paint_fill["fill-translate-anchor"]),"fill-pattern":new Gr(D.paint_fill["fill-pattern"])})},get layout(){return Yf=Yf||new ee({"fill-sort-key":new K(D.layout_fill["fill-sort-key"])})}};class Jf extends Ze{constructor(t,e){super(t,tx,e)}recalculate(t,e){super.recalculate(t,e);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new rh(t)}queryRadius(){return ga(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:i,pixelsToTileUnits:r}){return Pf(ya(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),e)}isTileClipped(){return!0}}let ex=Bt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ix=Bt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:rx}=ex;class en{constructor(t,e,i,r,n){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=r,this._values=n,t.readFields(nx,this,e)}loadGeometry(){let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,i=[],r,n=1,o=0,s=0,a=0;for(;t.pos<e;){if(o<=0){let c=t.readVarint();n=7&c,o=c>>3}if(o--,n===1||n===2)s+=t.readSVarint(),a+=t.readSVarint(),n===1&&(r&&i.push(r),r=[]),r&&r.push(new z(s,a));else{if(n!==7)throw Error(`unknown command ${n}`);r&&r.push(r[0].clone())}}return r&&i.push(r),i}bbox(){let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,i=1,r=0,n=0,o=0,s=1/0,a=-1/0,c=1/0,l=-1/0;for(;t.pos<e;){if(r<=0){let u=t.readVarint();i=7&u,r=u>>3}if(r--,i===1||i===2)n+=t.readSVarint(),o+=t.readSVarint(),n<s&&(s=n),n>a&&(a=n),o<c&&(c=o),o>l&&(l=o);else if(i!==7)throw Error(`unknown command ${i}`)}return[s,c,a,l]}toGeoJSON(t,e,i){let r=this.extent*Math.pow(2,i),n=this.extent*t,o=this.extent*e,s=this.loadGeometry();function a(h){return[360*(h.x+n)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(h.y+o)/r)*Math.PI))-90]}function c(h){return h.map(a)}let l;if(this.type===1){let h=[];for(let d of s)h.push(d[0]);let p=c(h);l=h.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let h=s.map(c);l=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h}}else{if(this.type!==3)throw Error("unknown feature type");{let h=Qf(s),p=[];for(let d of h)p.push(d.map(c));l=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}}let u={type:"Feature",geometry:l,properties:this.properties};return this.id!=null&&(u.id=this.id),u}}function nx(t,e,i){t===1?e.id=i.readVarint():t===2?function(r,n){let o=r.readVarint()+r.pos;for(;r.pos<o;){let s=n._keys[r.readVarint()],a=n._values[r.readVarint()];n.properties[s]=a}}(i,e):t===3?e.type=i.readVarint():t===4&&(e._geometry=i.pos)}function Qf(t){let e=t.length;if(e<=1)return[t];let i=[],r,n;for(let o=0;o<e;o++){let s=ox(t[o]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(r&&i.push(r),r=[t[o]]):r&&r.push(t[o]))}return r&&i.push(r),i}function ox(t){let e=0;for(let i,r,n=0,o=t.length,s=o-1;n<o;s=n++)i=t[n],r=t[s],e+=(r.x-i.x)*(i.y+r.y);return e}en.types=["Unknown","Point","LineString","Polygon"];class tm{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(sx,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new en(this._pbf,e,this.extent,this._keys,this._values)}}function sx(t,e,i){t===15?e.version=i.readVarint():t===1?e.name=i.readString():t===5?e.extent=i.readVarint():t===2?e._features.push(i.pos):t===3?e._keys.push(i.readString()):t===4&&e._values.push(function(r){let n=null,o=r.readVarint()+r.pos;for(;r.pos<o;){let s=r.readVarint()>>3;n=s===1?r.readString():s===2?r.readFloat():s===3?r.readDouble():s===4?r.readVarint64():s===5?r.readVarint():s===6?r.readSVarint():s===7?r.readBoolean():null}if(n==null)throw Error("unknown feature value");return n}(i))}class em{constructor(t,e){this.layers=t.readFields(ax,{},e)}}function ax(t,e,i){if(t===3){let r=new tm(i,i.readVarint()+i.pos);r.length&&(e[r.name]=r)}}let nh=Math.pow(2,13);function bo(t,e,i,r,n,o,s,a){t.emplaceBack(e,i,2*Math.floor(r*nh)+s,n*nh*2,o*nh*2,Math.round(a))}class oh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new nf,this.centroidVertexArray=new ui,this.indexArray=new Ge,this.programConfigurations=new Oi(t.layers,t.zoom),this.segments=new xt,this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){this.features=[],this.hasDependencies=va("fill-extrusion",this.layers,e);for(let{feature:r,id:n,index:o,sourceLayerIndex:s}of t){let a=this.layers[0]._featureFilter.needGeometry,c=ar(r,a);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),c,i))continue;let l={id:n,sourceLayerIndex:s,index:o,geometry:a?c.geometry:sr(r),properties:r.properties,type:r.type,patterns:{}};this.hasDependencies?this.features.push(Qc("fill-extrusion",this.layers,l,{zoom:this.zoom},e)):this.addFeature(l,l.geometry,o,i,{},e.subdivisionGranularity),e.featureIndex.insert(r,l.geometry,o,s,this.index,!0)}}addFeatures(t,e,i){for(let r of this.features){let{geometry:n}=r;this.addFeature(r,n,r.index,e,i,t.subdivisionGranularity)}}update(t,e,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,ix.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,i,r,n,o){for(let s of oc(e,500)){let a={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(a,r,t,s,o);let l=this.layoutVertexArray.length-c,u=Math.floor(a.x/a.sampleCount),h=Math.floor(a.y/a.sampleCount);for(let p=0;p<l;p++)this.centroidVertexArray.emplaceBack(u,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,canonical:r})}processPolygon(t,e,i,r,n){if(r.length<1)return;if(im(r[0]))return;for(let u of r)u.length!==0&&lx(t,u);let o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(e.z),a=en.types[i.type]==="Polygon";for(let u of r){if(u.length===0)continue;if(im(u))continue;let h=ih(u,s,a);this._generateSideFaces(h,o)}if(!a)return;let c=Hf(r,e,s,!1),l=this.layoutVertexArray;Xf((u,h)=>{bo(l,u,h,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,c.verticesFlattened,c.indicesTriangles)}_generateSideFaces(t,e){let i=0;for(let r=1;r<t.length;r++){let n=t[r],o=t[r-1];if(cx(n,o))continue;e.segment.vertexLength+4>xt.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(o)._perp()._unit(),a=o.dist(n);i+a>32768&&(i=0),bo(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,i),bo(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,i),i+=a,bo(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,i),bo(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,i);let c=e.segment.vertexLength;this.indexArray.emplaceBack(c,c+2,c+1),this.indexArray.emplaceBack(c+1,c+2,c+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}}function lx(t,e){for(let i=0;i<e.length;i++){let r=e[i];i===e.length-1&&e[0].x===r.x&&e[0].y===r.y||(t.x+=r.x,t.y+=r.y,t.sampleCount++)}}function cx(t,e){return t.x===e.x&&(t.x<0||t.x>F)||t.y===e.y&&(t.y<0||t.y>F)}function im(t){return t.every((e)=>e.x<0)||t.every((e)=>e.x>F)||t.every((e)=>e.y<0)||t.every((e)=>e.y>F)}let rm;U("FillExtrusionBucket",oh,{omit:["layers","features"]});var hx={get paint(){return rm=rm||new ee({"fill-extrusion-opacity":new Z(D["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new K(D["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(D["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(D["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Gr(D["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new K(D["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new K(D["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(D["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class nm extends Ze{constructor(t,e){super(t,hx,e)}createBucket(t){return new oh(t)}queryRadius(){return ga(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o,pixelPosMatrix:s}){let a=ya(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,o),c=this.paint.get("fill-extrusion-height").evaluate(e,i),l=this.paint.get("fill-extrusion-base").evaluate(e,i),u=function(p,d){let f=[];for(let m of p){let _=[m.x,m.y,0,1];Yt(_,_,d),f.push(new z(_[0]/_[3],_[1]/_[3]))}return f}(a,s),h=function(p,d,f,m){let _=[],y=[],v=m[8]*d,g=m[9]*d,x=m[10]*d,b=m[11]*d,w=m[8]*f,T=m[9]*f,P=m[10]*f,S=m[11]*f;for(let E of p){let I=[],C=[];for(let A of E){let{x:M,y:k}=A,L=m[0]*M+m[4]*k+m[12],O=m[1]*M+m[5]*k+m[13],q=m[2]*M+m[6]*k+m[14],Q=m[3]*M+m[7]*k+m[15],rt=q+x,nt=Q+b,lt=L+w,pt=O+T,Pt=q+P,yt=Q+S,Dt=new z((L+v)/nt,(O+g)/nt);Dt.z=rt/nt,I.push(Dt);let H=new z(lt/yt,pt/yt);H.z=Pt/yt,C.push(H)}_.push(I),y.push(C)}return[_,y]}(r,l,c,s);return function(p,d,f){let m=1/0;Pf(f,d)&&(m=om(f,d[0]));for(let _=0;_<d.length;_++){let y=d[_],v=p[_];for(let g=0;g<y.length-1;g++){let x=y[g],b=[x,y[g+1],v[g+1],v[g],x];Sf(f,b)&&(m=Math.min(m,om(f,b)))}}return m!==1/0&&m}(h[0],h[1],u)}}function wo(t,e){return t.x*e.x+t.y*e.y}function om(t,e){if(t.length===1){let i=0,r=e[i++],n;for(;!n||r.equals(n);)if(n=e[i++],!n)return 1/0;for(;i<e.length;i++){let o=e[i],s=t[0],a=n.sub(r),c=o.sub(r),l=s.sub(r),u=wo(a,a),h=wo(a,c),p=wo(c,c),d=wo(l,a),f=wo(l,c),m=u*p-h*h,_=(p*d-h*f)/m,y=(u*f-h*d)/m,v=r.z*(1-_-y)+n.z*_+o.z*y;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let r of e)i=Math.min(i,r.z);return i}}let sm=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class sh{static from(t){if(!(t instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[e,i]=new Uint8Array(t,0,2);if(e!==219)throw Error("Data does not appear to be in a KDBush format.");let r=i>>4;if(r!==1)throw Error(`Got v${r} data when expected v1.`);let n=sm[15&i];if(!n)throw Error("Unrecognized array type.");let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new sh(s,o,n,t)}constructor(t,e=64,i=Float64Array,r){if(isNaN(t)||t<0)throw Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let n=sm.indexOf(this.ArrayType),o=2*t*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-s%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${i}.`);r&&r instanceof ArrayBuffer?(this.data=r,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+o+s+a),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+s+a,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+n]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=e,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return ah(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,i,r){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,a=[0,n.length-1,0],c=[];for(;a.length;){let l=a.pop()||0,u=a.pop()||0,h=a.pop()||0;if(u-h<=s){for(let m=h;m<=u;m++){let _=o[2*m],y=o[2*m+1];_>=t&&_<=i&&y>=e&&y<=r&&c.push(n[m])}continue}let p=h+u>>1,d=o[2*p],f=o[2*p+1];d>=t&&d<=i&&f>=e&&f<=r&&c.push(n[p]),(l===0?t<=d:e<=f)&&(a.push(h),a.push(p-1),a.push(1-l)),(l===0?i>=d:r>=f)&&(a.push(p+1),a.push(u),a.push(1-l))}return c}within(t,e,i){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:r,coords:n,nodeSize:o}=this,s=[0,r.length-1,0],a=[],c=i*i;for(;s.length;){let l=s.pop()||0,u=s.pop()||0,h=s.pop()||0;if(u-h<=o){for(let m=h;m<=u;m++)lm(n[2*m],n[2*m+1],t,e)<=c&&a.push(r[m]);continue}let p=h+u>>1,d=n[2*p],f=n[2*p+1];lm(d,f,t,e)<=c&&a.push(r[p]),(l===0?t-i<=d:e-i<=f)&&(s.push(h),s.push(p-1),s.push(1-l)),(l===0?t+i>=d:e+i>=f)&&(s.push(p+1),s.push(u),s.push(1-l))}return a}}function ah(t,e,i,r,n,o){if(n-r<=i)return;let s=r+n>>1;am(t,e,s,r,n,o),ah(t,e,i,r,s-1,1-o),ah(t,e,i,s+1,n,1-o)}function am(t,e,i,r,n,o){for(;n>r;){if(n-r>600){let l=n-r+1,u=i-r+1,h=Math.log(l),p=0.5*Math.exp(2*h/3),d=0.5*Math.sqrt(h*p*(l-p)/l)*(u-l/2<0?-1:1);am(t,e,i,Math.max(r,Math.floor(i-u*p/l+d)),Math.min(n,Math.floor(i+(l-u)*p/l+d)),o)}let s=e[2*i+o],a=r,c=n;for(To(t,e,r,i),e[2*n+o]>s&&To(t,e,r,n);a<c;){for(To(t,e,a,c),a++,c--;e[2*a+o]<s;)a++;for(;e[2*c+o]>s;)c--}e[2*r+o]===s?To(t,e,r,c):(c++,To(t,e,c,n)),c<=i&&(r=c+1),i<=c&&(n=c-1)}}function To(t,e,i,r){lh(t,i,r),lh(e,2*i,2*r),lh(e,2*i+1,2*r+1)}function lh(t,e,i){let r=t[e];t[e]=t[i],t[i]=r}function lm(t,e,i,r){let n=t-i,o=e-r;return n*n+o*o}var cm;(function(t){t[t.X=0]="X",t[t.Y=1]="Y"})(cm||(cm={}));let hm="geojsonvt_clip_start",um="geojsonvt_clip_end",ux=Bt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:dx}=ux,px=Bt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:fx}=px,mx=Math.cos(Math.PI/180*37.5),dm=Math.pow(2,14)/0.5;class ch{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((e)=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new of,this.layoutVertexArray2=new sf,this.indexArray=new Ge,this.programConfigurations=new Oi(t.layers,t.zoom),this.segments=new xt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e)=>e.isStateDependent()).map((e)=>e.id)}populate(t,e,i){this.hasDependencies=va("line",this.layers,e)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),n=!r.isConstant(),o=[];for(let{feature:s,id:a,index:c,sourceLayerIndex:l}of t){let u=this.layers[0]._featureFilter.needGeometry,h=ar(s,u);if(!this.layers[0]._featureFilter.filter(new At(this.zoom),h,i))continue;let p=n?r.evaluate(h,{},i):void 0,d={id:a,properties:s.properties,type:s.type,sourceLayerIndex:l,index:c,geometry:u?h.geometry:sr(s),patterns:{},dashes:{},sortKey:p};o.push(d)}n&&o.sort((s,a)=>s.sortKey-a.sortKey);for(let s of o){let{geometry:a,index:c,sourceLayerIndex:l}=s;this.hasDependencies?(va("line",this.layers,e)?Qc("line",this.layers,s,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,s,this.zoom,e),this.patternFeatures.push(s)):this.addFeature(s,a,c,i,{},{},e.subdivisionGranularity),e.featureIndex.insert(t[c].feature,a,c,l,this.index)}}update(t,e,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures(t,e,i,r){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,i,r,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,fx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,dx),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,hm)&&Object.hasOwn(t.properties,um))return{start:+t.properties[hm],end:+t.properties[um]}}addFeature(t,e,i,r,n,o,s){let a=this.layers[0].layout,c=a.get("line-join").evaluate(t,{}),l=a.get("line-cap").evaluate(t,{}),u=a.get("line-miter-limit").evaluate(t,{}),h=a.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,c,l,u,h,r,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,i,{imagePositions:n,dashPositions:o,canonical:r})}addLine(t,e,i,r,n,o,s,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=ih(t,s?a.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<t.length-1;v++)this.totalDistance+=t[v].dist(t[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let c=en.types[e.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let u=0;for(;u<l-1&&t[u].equals(t[u+1]);)u++;if(l<(c?3:2))return;i==="bevel"&&(n=1.05);let h=this.overscaling<=16?122880/(512*this.overscaling):0,p=this.segments.prepareSegment(10*l,this.layoutVertexArray,this.indexArray),d,f,m,_,y;this.e1=this.e2=-1,c&&(d=t[l-2],y=t[u].sub(d)._unit()._perp());for(let v=u;v<l;v++){if(m=v===l-1?c?t[u+1]:void 0:t[v+1],m&&t[v].equals(m))continue;y&&(_=y),d&&(f=d),d=t[v],y=m?m.sub(d)._unit()._perp():_,_||(_=y);let g=_.add(y);g.x===0&&g.y===0||g._unit();let x=_.x*y.x+_.y*y.y,b=g.x*y.x+g.y*y.y,w=b!==0?1/b:1/0,T=2*Math.sqrt(2-2*b),P=b<mx&&f&&m,S=_.x*y.y-_.y*y.x>0;if(P&&v>u){let C=d.dist(f);if(C>2*h){let A=d.sub(d.sub(f)._mult(h/C)._round());this.updateDistance(f,A),this.addCurrentVertex(A,_,0,0,p),f=A}}let E=f&&m,I=E?i:c?"butt":r;if(E&&I==="round"&&(w<o?I="miter":w<=2&&(I="fakeround")),I==="miter"&&w>n&&(I="bevel"),I==="bevel"&&(w>2&&(I="flipbevel"),w<n&&(I="miter")),f&&this.updateDistance(f,d),I==="miter")g._mult(w),this.addCurrentVertex(d,g,0,0,p);else if(I==="flipbevel"){if(w>100)g=y.mult(-1);else{let C=w*_.add(y).mag()/_.sub(y).mag();g._perp()._mult(C*(S?-1:1))}this.addCurrentVertex(d,g,0,0,p),this.addCurrentVertex(d,g.mult(-1),0,0,p)}else if(I==="bevel"||I==="fakeround"){let C=-Math.sqrt(w*w-1),A=S?C:0,M=S?0:C;if(f&&this.addCurrentVertex(d,_,A,M,p),I==="fakeround"){let k=Math.round(180*T/Math.PI/20);for(let L=1;L<k;L++){let O=L/k;if(O!==0.5){let Q=O-0.5;O+=O*Q*(O-1)*((1.0904+x*(x*(3.55645-1.43519*x)-3.2452))*Q*Q+(0.848013+x*(0.215638*x-1.06021)))}let q=y.sub(_)._mult(O)._add(_)._unit()._mult(S?-1:1);this.addHalfVertex(d,q.x,q.y,!1,S,0,p)}}m&&this.addCurrentVertex(d,y,-A,-M,p)}else if(I==="butt")this.addCurrentVertex(d,g,0,0,p);else if(I==="square"){let C=f?1:-1;this.addCurrentVertex(d,g,C,C,p)}else I==="round"&&(f&&(this.addCurrentVertex(d,_,0,0,p),this.addCurrentVertex(d,_,1,1,p,!0)),m&&(this.addCurrentVertex(d,y,-1,-1,p,!0),this.addCurrentVertex(d,y,0,0,p)));if(P&&v<l-1){let C=d.dist(m);if(C>2*h){let A=d.add(m.sub(d)._mult(h/C)._round());this.updateDistance(d,A),this.addCurrentVertex(A,y,0,0,p),d=A}}}}addCurrentVertex(t,e,i,r,n,o=!1){let s=e.y*r-e.x,a=-e.y-e.x*r;this.addHalfVertex(t,e.x+e.y*i,e.y-e.x*i,o,!1,i,n),this.addHalfVertex(t,s,a,o,!0,-r,n),this.distance>dm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,i,r,n,o))}addHalfVertex({x:t,y:e},i,r,n,o,s,a){let c=0.5*(this.lineClips?this.scaledDistance*(dm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(n?1:0),(e<<1)+(o?1:0),Math.round(63*i)+128,Math.round(63*r)+128,1+(s===0?0:s<0?-1:1)|(63&c)<<2,c>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);let l=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,l,this.e2),a.primitiveLength++),o?this.e2=l:this.e1=l}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let i=e.paint.get("line-dasharray");if(i&&!i.isConstant())return!0}return!1}addLineDashDependencies(t,e,i,r){for(let n of t){let o=n.paint.get("line-dasharray");if(!o||o.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",a={dasharray:o.value.evaluate({zoom:i-1},e,{}),round:s},c={dasharray:o.value.evaluate({zoom:i},e,{}),round:s},l={dasharray:o.value.evaluate({zoom:i+1},e,{}),round:s},u=`${a.dasharray.join(",")},${a.round}`,h=`${c.dasharray.join(",")},${c.round}`,p=`${l.dasharray.join(",")},${l.round}`;r.dashDependencies[u]=a,r.dashDependencies[h]=c,r.dashDependencies[p]=l,e.dashes[n.id]={min:u,mid:h,max:p}}}}let pm,fm;U("LineBucket",ch,{omit:["layers","patternFeatures"]});var mm={get paint(){return fm=fm||new ee({"line-opacity":new K(D.paint_line["line-opacity"]),"line-color":new K(D.paint_line["line-color"]),"line-translate":new Z(D.paint_line["line-translate"]),"line-translate-anchor":new Z(D.paint_line["line-translate-anchor"]),"line-width":new K(D.paint_line["line-width"]),"line-gap-width":new K(D.paint_line["line-gap-width"]),"line-offset":new K(D.paint_line["line-offset"]),"line-blur":new K(D.paint_line["line-blur"]),"line-dasharray":new Gr(D.paint_line["line-dasharray"]),"line-pattern":new Gr(D.paint_line["line-pattern"]),"line-gradient":new lo(D.paint_line["line-gradient"])})},get layout(){return pm=pm||new ee({"line-cap":new K(D.layout_line["line-cap"]),"line-join":new K(D.layout_line["line-join"]),"line-miter-limit":new K(D.layout_line["line-miter-limit"]),"line-round-limit":new K(D.layout_line["line-round-limit"]),"line-sort-key":new K(D.layout_line["line-sort-key"])})}};class _m extends K{possiblyEvaluate(t,e){return e=new At(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,r){return e=G({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,r)}}let wa;class gm extends Ze{constructor(t,e){super(t,mm,e),this.gradientVersion=0,wa||(wa=new _m(mm.paint.properties["line-width"].specification),wa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=!!function(i){return i._styleExpression!==void 0}(e)&&e._styleExpression.expression instanceof Zn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=wa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ch(t)}queryRadius(t){let e=t,i=ym(Kr("line-width",this,e),Kr("line-gap-width",this,e)),r=Kr("line-offset",this,e);return i/2+Math.abs(r)+ga(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:i,geometry:r,transform:n,pixelsToTileUnits:o}){let s=ya(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,o),a=o/2*ym(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),c=this.paint.get("line-offset").evaluate(e,i);return c&&(r=function(l,u){let h=[];for(let p of l){let d=Rv(p),f=[];for(let m=0;m<d.length;m++){let _=d[m],y=d[m-1],v=d[m+1],g=m===0?new z(0,0):_.sub(y)._unit()._perp(),x=m===d.length-1?new z(0,0):v.sub(_)._unit()._perp(),b=g._add(x)._unit(),w=b.x*x.x+b.y*x.y;w!==0&&b._mult(1/w),f.push(b._mult(u)._add(_))}h.push(f)}return h}(r,c*o)),function(l,u,h){for(let p of u){if(l.length>=3){for(let d of p)if(Yr(l,d))return!0}if(Cv(l,p,h))return!0}return!1}(s,r,a)}isTileClipped(){return!0}}function ym(t,e){return e>0?e+2*t:t}let _x=Bt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),gx=Bt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Bt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let yx=Bt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Bt([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let vm=Bt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),vx=Bt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function xx(t,e,i){let r=e.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?t=t.toLocaleUpperCase():r==="lowercase"&&(t=t.toLocaleLowerCase()),Zr.applyArabicShaping&&(t=Zr.applyArabicShaping(t)),t}function bx(t,e,i){for(let r of t.sections)r.text=xx(r.text,e,i);return t}Bt([{name:"triangle",components:3,type:"Uint16"}]),Bt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Bt([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Bt([{type:"Float32",name:"offsetX"}]),Bt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Bt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);let wx={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},hh=4294967296,xm=1/hh,bm=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class uh{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,i=this.length){for(;this.pos<i;){let r=this.readVarint(),n=r>>3,o=this.pos;this.type=7&r,t(n,e,this),this.pos===o&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*hh;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*hh;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,i,r;return r=e[this.pos++],i=127&r,r<128?i:(r=e[this.pos++],i|=(127&r)<<7,r<128?i:(r=e[this.pos++],i|=(127&r)<<14,r<128?i:(r=e[this.pos++],i|=(127&r)<<21,r<128?i:(r=e[this.pos],i|=(15&r)<<28,function(n,o,s){let a=s.buf,c,l;if(l=a[s.pos++],c=(112&l)>>4,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<3,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<10,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<17,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(127&l)<<24,l<128)return rn(n,c,o);if(l=a[s.pos++],c|=(1&l)<<31,l<128)return rn(n,c,o);throw Error("Expected varint not more than 10 bytes")}(i,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&bm?bm.decode(this.buf.subarray(e,t)):function(i,r,n){let o="",s=r;for(;s<n;){let a=i[s],c,l,u,h=null,p=a>239?4:a>223?3:a>191?2:1;if(s+p>n)break;p===1?a<128&&(h=a):p===2?(c=i[s+1],(192&c)==128&&(h=(31&a)<<6|63&c,h<=127&&(h=null))):p===3?(c=i[s+1],l=i[s+2],(192&c)==128&&(192&l)==128&&(h=(15&a)<<12|(63&c)<<6|63&l,(h<=2047||h>=55296&&h<=57343)&&(h=null))):p===4&&(c=i[s+1],l=i[s+2],u=i[s+3],(192&c)==128&&(192&l)==128&&(192&u)==128&&(h=(15&a)<<18|(63&c)<<12|(63&l)<<6|63&u,(h<=65535||h>=1114112)&&(h=null))),h===null?(h=65533,p=1):h>65535&&(h-=65536,o+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),o+=String.fromCharCode(h),s+=p}return o}(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(t){let e=7&t;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){let i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*xm),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*xm),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(e,i){let r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552000||e<-18446744073709552000)throw Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(o,s,a){a.buf[a.pos++]=127&o|128,o>>>=7,a.buf[a.pos++]=127&o|128,o>>>=7,a.buf[a.pos++]=127&o|128,o>>>=7,a.buf[a.pos++]=127&o|128,a.buf[a.pos]=127&(o>>>=7)}(r,0,i),function(o,s){let a=(7&o)<<4;s.buf[s.pos++]|=a|((o>>>=3)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o|((o>>>=7)?128:0),o&&(s.buf[s.pos++]=127&o)))))}(n,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;let e=this.pos;this.pos=function(r,n,o){for(let s,a,c=0;c<n.length;c++){if(s=n.charCodeAt(c),s>55295&&s<57344){if(!a){s>56319||c+1===n.length?(r[o++]=239,r[o++]=191,r[o++]=189):a=s;continue}if(s<56320){r[o++]=239,r[o++]=191,r[o++]=189,a=s;continue}s=a-55296<<10|s-56320|65536,a=null}else a&&(r[o++]=239,r[o++]=191,r[o++]=189,a=null);s<128?r[o++]=s:(s<2048?r[o++]=s>>6|192:(s<65536?r[o++]=s>>12|224:(r[o++]=s>>18|240,r[o++]=s>>12&63|128),r[o++]=s>>6&63|128),r[o++]=63&s|128)}return o}(this.buf,t,this.pos);let i=this.pos-e;i>=128&&wm(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=t[i]}writeRawMessage(t,e){this.pos++;let i=this.pos;t(e,this);let r=this.pos-i;r>=128&&wm(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(t,e,i){this.writeTag(t,2),this.writeRawMessage(e,i)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Tx,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Sx,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Ex,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Px,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Ix,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Mx,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Cx,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Ax,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,zx,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}}function rn(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function wm(t,e,i){let r=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(r);for(let n=i.pos-1;n>=t;n--)i.buf[n+r]=i.buf[n]}function Tx(t,e){for(let i=0;i<t.length;i++)e.writeVarint(t[i])}function Sx(t,e){for(let i=0;i<t.length;i++)e.writeSVarint(t[i])}function Px(t,e){for(let i=0;i<t.length;i++)e.writeFloat(t[i])}function Ix(t,e){for(let i=0;i<t.length;i++)e.writeDouble(t[i])}function Ex(t,e){for(let i=0;i<t.length;i++)e.writeBoolean(t[i])}function Mx(t,e){for(let i=0;i<t.length;i++)e.writeFixed32(t[i])}function Cx(t,e){for(let i=0;i<t.length;i++)e.writeSFixed32(t[i])}function Ax(t,e){for(let i=0;i<t.length;i++)e.writeFixed64(t[i])}function zx(t,e){for(let i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Dx(t,e,i){t===1&&i.readMessage(Rx,e)}function Rx(t,e,i){if(t===3){let{id:r,bitmap:n,width:o,height:s,left:a,top:c,advance:l}=i.readMessage(kx,{});e.push({id:r,bitmap:new fo({width:o+6,height:s+6},n),metrics:{width:o,height:s,left:a,top:c,advance:l}})}}function kx(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}function Tm(t){let e=0,i=0;for(let s of t)e+=s.w*s.h,i=Math.max(i,s.w);t.sort((s,a)=>a.h-s.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/0.95)),i),h:1/0}],n=0,o=0;for(let s of t)for(let a=r.length-1;a>=0;a--){let c=r[a];if(!(s.w>c.w||s.h>c.h)){if(s.x=c.x,s.y=c.y,o=Math.max(o,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===c.w&&s.h===c.h){let l=r.pop();l&&a<r.length&&(r[a]=l)}else s.h===c.h?(c.x+=s.w,c.w-=s.w):s.w===c.w?(c.y+=s.h,c.h-=s.h):(r.push({x:c.x+s.w,y:c.y,w:c.w-s.w,h:s.h}),c.y+=s.h,c.h-=s.h);break}}return{w:n,h:o,fill:e/(n*o)||0}}class Ta{constructor(t,{pixelRatio:e,version:i,stretchX:r,stretchY:n,content:o,textFitWidth:s,textFitHeight:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=r,this.stretchY=n,this.content=o,this.version=i,this.textFitWidth=s,this.textFitHeight=a}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}var $t;function Sm(t){let e=0.5,i=0.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Pm(t,e){let{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new At(t+1))};if(i.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:n}=i,o=0;for(;o<r.length&&r[o]<=t;)o++;o=Math.max(0,o-1);let s=o;for(;s<r.length&&r[s]<t+1;)s++;s=Math.min(r.length-1,s);let a=r[o],c=r[s];return i.kind==="composite"?{kind:"composite",minZoom:a,maxZoom:c,interpolationType:n}:{kind:"camera",minZoom:a,maxZoom:c,minSize:i.evaluate(new At(a)),maxSize:i.evaluate(new At(c)),interpolationType:n}}}function dh(t,{uSize:e,uSizeT:i},{lowerSize:r,upperSize:n}){return t.kind==="source"?r/128:t.kind==="composite"?Ft.number(r/128,n/128,i):e}function Sa(t,e){let i=0,r=0;if(t.kind==="constant")r=t.layoutSize;else if(t.kind!=="source"){let{interpolationType:n,minZoom:o,maxZoom:s}=t,a=n?_t(we.interpolationFactor(n,e,o,s),0,1):0;t.kind==="camera"?r=Ft.number(t.minSize,t.maxSize,a):i=a}return{uSizeT:i,uSize:r}}function Pa(t,e,i){let r="never",n=t.get(e);return n?r=n:t.get(i)&&(r="always"),r}U("ImagePosition",Ta),U("ImageAtlas",class{constructor(t,e){let i={},r={};this.haveRenderCallbacks=[];let n=[];this.addImages(t,i,n),this.addImages(e,r,n);let{w:o,h:s}=Tm(n),a=new It({width:o||1,height:s||1});for(let c in t){let l=t[c],u=i[c].paddedRect;It.copy(l.data,a,{x:0,y:0},{x:u.x+1,y:u.y+1},l.data)}for(let c in e){let l=e[c],u=r[c].paddedRect,h=u.x+1,p=u.y+1,d=l.data.width,f=l.data.height;It.copy(l.data,a,{x:0,y:0},{x:h,y:p},l.data),It.copy(l.data,a,{x:0,y:f-1},{x:h,y:p-1},{width:d,height:1}),It.copy(l.data,a,{x:0,y:0},{x:h,y:p+f},{width:d,height:1}),It.copy(l.data,a,{x:d-1,y:0},{x:h-1,y:p},{width:1,height:f}),It.copy(l.data,a,{x:0,y:0},{x:h+d,y:p},{width:1,height:f})}this.image=a,this.iconPositions=i,this.patternPositions=r}addImages(t,e,i){for(let r in t){let n=t[r],o={x:0,y:0,w:n.data.width+2,h:n.data.height+2};i.push(o),e[r]=new Ta(o,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in t.updatedImages)this.patchUpdatedImage(this.iconPositions[i],t.getImage(i),e),this.patchUpdatedImage(this.patternPositions[i],t.getImage(i),e)}patchUpdatedImage(t,e,i){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;let[r,n]=t.tl;i.update(e.data,void 0,{x:r,y:n})}}),function(t){t[t.none=0]="none",t[t.horizontal=1]="horizontal",t[t.vertical=2]="vertical",t[t.horizontalOnly=3]="horizontalOnly"}($t||($t={}));let Lx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ia(t,e,i,r,n,o,s,a,c,l,u,h,p){let d=a?Math.min(32640,Math.round(a[0])):0,f=a?Math.min(32640,Math.round(a[1])):0;t.emplaceBack(e,i,Math.round(32*r),Math.round(32*n),o,s,(d<<1)+(c?1:0),f,16*l,16*u,256*h,256*p)}function So(t,e,i){t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i),t.emplaceBack(e.x,e.y,i)}function Fx(t){for(let e of t.sections)if(_v(e.text))return!0;return!1}class Ea{constructor(t){this.layoutVertexArray=new af,this.indexArray=new Ge,this.programConfigurations=t,this.segments=new xt,this.dynamicLayoutVertexArray=new lf,this.opacityVertexArray=new cf,this.hasVisibleVertices=!1,this.placedSymbolArray=new Mc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,_x.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,gx.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Lx,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}U("SymbolBuffers",Ea);class Ma{constructor(t,e,i){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new i,this.segments=new xt,this.collisionVertexArray=new uf}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,yx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}U("CollisionBuffers",Ma);class ur{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((o)=>o.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Pm(this.zoom,e["text-size"]),this.iconSizeData=Pm(this.zoom,e["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),n=i.get("symbol-z-order");this.canOverlap=Pa(i,"text-overlap","text-allow-overlap")!=="never"||Pa(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!r.isConstant(),this.sortFeaturesByY=(n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map((o)=>$t[o])),this.stateDependentLayerIds=this.layers.filter((o)=>o.isStateDependent()).map((o)=>o.id),this.sourceID=t.sourceID}createArrays(){this.text=new Ea(new Oi(this.layers,this.zoom,(t)=>t.startsWith("text"))),this.icon=new Ea(new Oi(this.layers,this.zoom,(t)=>t.startsWith("icon"))),this.glyphOffsetArray=new zc,this.lineVertexArray=new Dc,this.symbolInstances=new Ac,this.textAnchorOffsets=new kc}calculateGlyphDependencies(t,e,i,r,n){for(let o of t)if(e[o.codePointAt(0)]=!0,(i||r)&&n){let s=wx[o];s&&(e[s.codePointAt(0)]=!0)}}populate(t,e,i){var r;let n=this.layers[0],o=n.layout,s=o.get("text-font"),a=o.get("text-field"),c=o.get("icon-image"),l=(a.value.kind!=="constant"||a.value.value instanceof De&&!a.value.value.isEmpty()||a.value.value.toString().length>0)&&(s.value.kind!=="constant"||s.value.value.length>0),u=c.value.kind!=="constant"||!!c.value.value||Object.keys(c.parameters).length>0,h=o.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let{iconDependencies:p,glyphDependencies:d,availableImages:f}=e,m=new At(this.zoom);for(let{feature:_,id:y,index:v,sourceLayerIndex:g}of t){let x=n._featureFilter.needGeometry,b=ar(_,x);if(!n._featureFilter.filter(m,b,i))continue;let w,T;if(x||(b.geometry=sr(_)),l){let S=n.getValueAndResolveTokens("text-field",b,i,f),E=De.factory(S);this.hasRTLText||(this.hasRTLText=Fx(E)),(!this.hasRTLText||Zr.getRTLTextPluginStatus()==="unavailable"||this.hasRTLText&&Zr.isParsed())&&(w=bx(E,n,b))}if(u){let S=n.getValueAndResolveTokens("icon-image",b,i,f);T=S instanceof Ve?S:Ve.fromString(S)}if(!w&&!T)continue;let P=this.sortFeaturesByKey?h.evaluate(b,{},i):void 0;if(this.features.push({id:y,text:w,icon:T,index:v,sourceLayerIndex:g,geometry:b.geometry,properties:_.properties,type:en.types[_.type],sortKey:P}),T&&(p[T.name]=!0),w){let S=s.evaluate(b,{},i).join(","),E=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=(r=this.writingModes)===null||r===void 0?void 0:r.includes($t.vertical);for(let I of w.sections)if(I.image)p[I.image.name]=!0;else{let C=pv(w.toString()),A=I.fontStack||S;d[A]||(d[A]={}),this.calculateGlyphDependencies(I.text,d[A],E,this.allowVerticalPlacement,C)}}}o.get("symbol-placement")==="line"&&(this.features=function(_){let y={},v={},g=[],x=0;function b(S){g.push(_[S]),x++}function w(S,E,I){let C=v[S];return delete v[S],v[E]=C,g[C].geometry[0].pop(),g[C].geometry[0]=g[C].geometry[0].concat(I[0]),C}function T(S,E,I){let C=y[E];return delete y[E],y[S]=C,g[C].geometry[0].shift(),g[C].geometry[0]=I[0].concat(g[C].geometry[0]),C}function P(S,E,I){let C=I?E[0][E[0].length-1]:E[0][0];return`${S}:${C.x}:${C.y}`}for(let S=0;S<_.length;S++){let E=_[S],I=E.geometry,C=E.text?E.text.toString():null;if(!C){b(S);continue}let A=P(C,I),M=P(C,I,!0);if(A in v&&M in y&&v[A]!==y[M]){let k=T(A,M,I),L=w(A,M,g[k].geometry);delete y[A],delete v[M],v[P(C,g[L].geometry,!0)]=L,g[k].geometry=null}else A in v?w(A,M,I):(M in y)?T(A,M,I):(b(S),y[A]=x-1,v[M]=x-1)}return g.filter((S)=>S.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((_,y)=>_.sortKey-y.sortKey)}update(t,e,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:i}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let i=this.lineVertexArray.length;if(t.segment!==void 0){let r=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),o={};for(let s=t.segment+1;s<e.length;s++)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:r},s<e.length-1&&(r+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let a=o[s];this.lineVertexArray.emplaceBack(a.x,a.y,a.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(t,e,i,r,n,o,s,a,c,l,u,h){let{indexArray:p,layoutVertexArray:d}=t,f=t.segments.prepareSegment(4*e.length,d,p,this.canOverlap?o.sortKey:void 0),m=this.glyphOffsetArray.length,_=f.vertexLength,y=this.allowVerticalPlacement&&s===$t.vertical?Math.PI/2:0,v=o.text&&o.text.sections;for(let g=0;g<e.length;g++){let{tl:x,tr:b,bl:w,br:T,tex:P,pixelOffsetTL:S,pixelOffsetBR:E,minFontScaleX:I,minFontScaleY:C,glyphOffset:A,isSDF:M,sectionIndex:k}=e[g],L=f.vertexLength,O=A[1];Ia(d,a.x,a.y,x.x,O+x.y,P.x,P.y,i,M,S.x,S.y,I,C),Ia(d,a.x,a.y,b.x,O+b.y,P.x+P.w,P.y,i,M,E.x,S.y,I,C),Ia(d,a.x,a.y,w.x,O+w.y,P.x,P.y+P.h,i,M,S.x,E.y,I,C),Ia(d,a.x,a.y,T.x,O+T.y,P.x+P.w,P.y+P.h,i,M,E.x,E.y,I,C),So(t.dynamicLayoutVertexArray,a,y),p.emplaceBack(L,L+2,L+1),p.emplaceBack(L+1,L+2,L+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),g!==e.length-1&&k===e[g+1].sectionIndex||t.programConfigurations.populatePaintArrays(d.length,o,o.index,{imagePositions:{},canonical:h,formattedSection:v==null?void 0:v[k]})}t.placedSymbolArray.emplaceBack(a.x,a.y,m,this.glyphOffsetArray.length-m,_,c,l,a.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],s,0,!1,0,u)}_addCollisionDebugVertex(t,e,i,r,n,o){return e.emplaceBack(0,0),t.emplaceBack(i.x,i.y,r,n,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(t,e,i,r,n,o,s){let a=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),c=a.vertexLength,{layoutVertexArray:l,collisionVertexArray:u}=n,{anchorX:h,anchorY:p}=s;this._addCollisionDebugVertex(l,u,o,h,p,new z(t,e)),this._addCollisionDebugVertex(l,u,o,h,p,new z(i,e)),this._addCollisionDebugVertex(l,u,o,h,p,new z(i,r)),this._addCollisionDebugVertex(l,u,o,h,p,new z(t,r)),a.vertexLength+=4;let d=n.indexArray;d.emplaceBack(c,c+1),d.emplaceBack(c+1,c+2),d.emplaceBack(c+2,c+3),d.emplaceBack(c+3,c),a.primitiveLength+=4}addDebugCollisionBoxes(t,e,i,r){for(let n=t;n<e;n++){let o=this.collisionBoxArray.get(n);this.addCollisionDebugVertices(o.x1,o.y1,o.x2,o.y2,r?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ma(Oc,vm.members,da),this.iconCollisionBox=new Ma(Oc,vm.members,da);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,i,r,n,o,s,a,c){let l={};for(let u=e;u<i;u++){let h=t.get(u);l.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.textFeatureIndex=h.featureIndex;break}for(let u=r;u<n;u++){let h=t.get(u);l.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.verticalTextFeatureIndex=h.featureIndex;break}for(let u=o;u<s;u++){let h=t.get(u);l.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.iconFeatureIndex=h.featureIndex;break}for(let u=a;u<c;u++){let h=t.get(u);l.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},l.verticalIconFeatureIndex=h.featureIndex;break}return l}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let i=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let i=t.placedSymbolArray.get(e),r=i.vertexStartIndex+4*i.numGlyphs;for(let n=i.vertexStartIndex;n<r;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),i=Math.cos(t),r=[],n=[],o=[];for(let s=0;s<this.symbolInstances.length;++s){o.push(s);let a=this.symbolInstances.get(s);r.push(0|Math.round(e*a.anchorX+i*a.anchorY)),n.push(a.featureIndex)}return o.sort((s,a)=>r[s]-r[a]||n[a]-n[s]),o}addToSortKeyRanges(t,e){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];(i==null?void 0:i.sortKey)===e?i.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let i=this.symbolInstances.get(e);this.featureSortOrder.push(i.featureIndex);let r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let n=0;n<r.length;n++){let o=r[n];o>=0&&r.indexOf(o)===n&&this.addIndicesForPlacedSymbol(this.text,o)}i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let Im,Em;U("SymbolBucket",ur,{omit:["layers","collisionBoxArray","features","compareText"]}),ur.MAX_GLYPHS=65535,ur.addDynamicAttributes=So;var ph={get paint(){return Em=Em||new ee({"icon-opacity":new K(D.paint_symbol["icon-opacity"]),"icon-color":new K(D.paint_symbol["icon-color"]),"icon-halo-color":new K(D.paint_symbol["icon-halo-color"]),"icon-halo-width":new K(D.paint_symbol["icon-halo-width"]),"icon-halo-blur":new K(D.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(D.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(D.paint_symbol["icon-translate-anchor"]),"text-opacity":new K(D.paint_symbol["text-opacity"]),"text-color":new K(D.paint_symbol["text-color"],{runtimeType:Je,getOverride:(t)=>t.textColor,hasOverride:(t)=>!!t.textColor}),"text-halo-color":new K(D.paint_symbol["text-halo-color"]),"text-halo-width":new K(D.paint_symbol["text-halo-width"]),"text-halo-blur":new K(D.paint_symbol["text-halo-blur"]),"text-translate":new Z(D.paint_symbol["text-translate"]),"text-translate-anchor":new Z(D.paint_symbol["text-translate-anchor"])})},get layout(){return Im=Im||new ee({"symbol-placement":new Z(D.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(D.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(D.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new K(D.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(D.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(D.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Z(D.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Z(D.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(D.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(D.layout_symbol["icon-rotation-alignment"]),"icon-size":new K(D.layout_symbol["icon-size"]),"icon-text-fit":new Z(D.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(D.layout_symbol["icon-text-fit-padding"]),"icon-image":new K(D.layout_symbol["icon-image"]),"icon-rotate":new K(D.layout_symbol["icon-rotate"]),"icon-padding":new K(D.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(D.layout_symbol["icon-keep-upright"]),"icon-offset":new K(D.layout_symbol["icon-offset"]),"icon-anchor":new K(D.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(D.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(D.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(D.layout_symbol["text-rotation-alignment"]),"text-field":new K(D.layout_symbol["text-field"]),"text-font":new K(D.layout_symbol["text-font"]),"text-size":new K(D.layout_symbol["text-size"]),"text-max-width":new K(D.layout_symbol["text-max-width"]),"text-line-height":new Z(D.layout_symbol["text-line-height"]),"text-letter-spacing":new K(D.layout_symbol["text-letter-spacing"]),"text-justify":new K(D.layout_symbol["text-justify"]),"text-radial-offset":new K(D.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(D.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new K(D.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new K(D.layout_symbol["text-anchor"]),"text-max-angle":new Z(D.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(D.layout_symbol["text-writing-mode"]),"text-rotate":new K(D.layout_symbol["text-rotate"]),"text-padding":new Z(D.layout_symbol["text-padding"]),"text-keep-upright":new Z(D.layout_symbol["text-keep-upright"]),"text-transform":new K(D.layout_symbol["text-transform"]),"text-offset":new K(D.layout_symbol["text-offset"]),"text-allow-overlap":new Z(D.layout_symbol["text-allow-overlap"]),"text-overlap":new Z(D.layout_symbol["text-overlap"]),"text-ignore-placement":new Z(D.layout_symbol["text-ignore-placement"]),"text-optional":new Z(D.layout_symbol["text-optional"])})}};class fh{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Fn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e==null?void 0:e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}U("FormatSectionOverride",fh,{omit:["defaultValue"]});let Mm=(t)=>t.type==="symbol";class Ca extends Ze{constructor(t,e){super(t,ph,e)}recalculate(t,e){if(super.recalculate(t,e),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let r=[];for(let n of i)r.includes(n)||r.push(n);this.layout._values["text-writing-mode"]=r}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,e,i,r){let n=this.layout.get(t).evaluate(e,{},i,r),o=this._unevaluatedLayout._values[t];return o.isDataDriven()||Ls(o.value)||!n?n:function(s,a){return a.replace(/{([^{}]+)}/g,(c,l)=>s&&(l in s)?String(s[l]):"")}(e.properties,n)}createBucket(t){return new ur(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of ph.paint.overridableProperties){if(!Ca.hasPaintOverride(this.layout,t))continue;let e=this.paint.get(t),i=new fh(e),r=new ks(i,e.property.specification),n=null;n=e.value.kind==="constant"||e.value.kind==="source"?new Kn("source",r):new Bs("composite",r,e.value.zoomStops),this.paint._values[t]=new ii(e.property,n,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven())&&Ca.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){let i=t.get("text-field"),r=ph.paint.properties[e],n=!1,o=(s)=>{var a;for(let c of s)if((a=r.overrides)===null||a===void 0?void 0:a.hasOverride(c))return void(n=!0)};if(i.value.kind==="constant"&&i.value.value instanceof De)o(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let s=(c)=>{n||(c instanceof Qi&&qt(c.value)===Bn?o(c.value.sections):c instanceof Ts?o(c.sections):c.eachChild(s))},a=i.value;a._styleExpression&&s(a._styleExpression.expression)}return n}}let Cm;var Bx={get paint(){return Cm=Cm||new ee({"background-color":new Z(D.paint_background["background-color"]),"background-pattern":new wc(D.paint_background["background-pattern"]),"background-opacity":new Z(D.paint_background["background-opacity"])})}};class Am extends Ze{constructor(t,e){super(t,Bx,e)}}class zm extends Ze{constructor(t,e){super(t,{},e),this.onAdd=(i)=>{this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)},this.onRemove=(i)=>{this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}}function mh(t,e){if(t.type==="custom")return new zm(t,e);switch(t.type){case"background":return new Am(t,e);case"circle":return new Af(t,e);case"color-relief":return new Vf(t,e);case"fill":return new Jf(t,e);case"fill-extrusion":return new nm(t,e);case"heatmap":return new Lf(t,e);case"hillshade":return new Bf(t,e);case"line":return new gm(t,e);case"raster":return new Kp(t,e);case"symbol":return new Ca(t,e)}}function Aa(t){let e=[];if(typeof t=="string")e.push({id:"default",url:t});else if(t&&t.length>0){let i=[];for(let{id:r,url:n}of t){let o=`${r}${n}`;i.includes(o)||(i.push(o),e.push({id:r,url:n}))}}return e}function Dm(t,e,i){try{let r=new URL(t);return r.pathname+=`${e}${i}`,r.toString()}catch(r){throw Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function Ox(t){let{userImage:e}=t;return!(!(e==null?void 0:e.render)||!e.render()||(t.data.replace(new Uint8Array(e.data.buffer)),0))}class Rm extends Ht{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new It({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(let t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new It({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(let{ids:e,promiseResolve:i}of this.requestors)i(this._getImagesForIds(e));this.requestors=[]}}getImage(t){let e=this.images[t];if(e&&!e.data&&e.spriteData){let i=e.spriteData;e.data=new It({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),e.spriteData=null}return e}addImage(t,e){if(this.images[t])throw Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,e)&&(this.images[t]=e)}_validate(t,e){let i=!0,r=e.data||e.spriteData;return this._validateStretch(e.stretchX,r==null?void 0:r.width)||(this.fire(new J(Error(`Image "${t}" has invalid "stretchX" value`))),i=!1),this._validateStretch(e.stretchY,r==null?void 0:r.height)||(this.fire(new J(Error(`Image "${t}" has invalid "stretchY" value`))),i=!1),this._validateContent(e.content,e)||(this.fire(new J(Error(`Image "${t}" has invalid "content" value`))),i=!1),i}_validateStretch(t,e){if(!t)return!0;let i=0;for(let r of t){if(r[0]<i||r[1]<r[0]||e<r[1])return!1;i=r[1]}return!0}_validateContent(t,e){if(!t)return!0;if(t.length!==4)return!1;let i=e.spriteData,r=(i==null?void 0:i.width)||e.data.width,n=(i==null?void 0:i.height)||e.data.height;return!(t[0]<0||r<t[0]||t[1]<0||n<t[1]||t[2]<0||r<t[2]||t[3]<0||n<t[3]||t[2]<t[0]||!(t[3]>=t[1]))}updateImage(t,e,i=!0){let r=this.getImage(t);if(i&&(r.data.width!==e.data.width||r.data.height!==e.data.height))throw Error(`size mismatch between old image (${r.data.width}x${r.data.height}) and new image (${e.data.width}x${e.data.height}).`);e.version=r.version+1,this.images[t]=e,this.updatedImages[t]=!0}removeImage(t){var e;let i=this.images[t];delete this.images[t],delete this.patterns[t],((e=i.userImage)===null||e===void 0?void 0:e.onRemove)&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise((e,i)=>{let r=!0;if(!this.isLoaded())for(let n of t)this.images[n]||(r=!1);this.isLoaded()||r?e(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:e})})}_getImagesForIds(t){var e;let i={};for(let r of t){let n=this.getImage(r);n||(this.fire(new R("styleimagemissing",{id:r})),n=this.getImage(r)),n?i[r]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,textFitWidth:n.textFitWidth,textFitHeight:n.textFitHeight,hasRenderCallback:Boolean((e=n.userImage)===null||e===void 0?void 0:e.render)}:Ct(`Image "${r}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){let{width:t,height:e}=this.atlasImage;return{width:t,height:e}}getPattern(t){let e=this.patterns[t],i=this.getImage(t);if(!i)return null;if(e&&e.position.version===i.version)return e.position;if(e)e.position.version=i.version;else{let r={w:i.data.width+2,h:i.data.height+2,x:0,y:0},n=new Ta(r,i);this.patterns[t]={bin:r,position:n}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){let e=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new jt(t,this.atlasImage,e.RGBA),this.atlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE)}_updatePatternAtlas(){let t=[];for(let n in this.patterns)t.push(this.patterns[n].bin);let{w:e,h:i}=Tm(t),r=this.atlasImage;r.resize({width:e||1,height:i||1});for(let n in this.patterns){let{bin:o}=this.patterns[n],s=o.x+1,a=o.y+1,c=this.getImage(n).data,{width:l,height:u}=c;It.copy(c,r,{x:0,y:0},{x:s,y:a},{width:l,height:u}),It.copy(c,r,{x:0,y:u-1},{x:s,y:a-1},{width:l,height:1}),It.copy(c,r,{x:0,y:0},{x:s,y:a+u},{width:l,height:1}),It.copy(c,r,{x:l-1,y:0},{x:s-1,y:a},{width:1,height:u}),It.copy(c,r,{x:0,y:0},{x:s+l,y:a},{width:1,height:u})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(let e of t){if(this.callbackDispatchedThisFrame[e])continue;this.callbackDispatchedThisFrame[e]=!0;let i=this.getImage(e);i||Ct(`Image with ID: "${e}" was not found`),Ox(i)&&this.updateImage(e,i)}}cloneImages(){let t={};for(let e in this.images){let i=this.images[e];t[e]=Object.assign(Object.assign({},i),{data:i.data?i.data.clone():null})}return t}}let Po=100000000000000000000,_h=new Float64Array(256);for(let t=0;t<256;t++){let e=0.5-Math.pow(t/255,0.45454545454545453);_h[t]=e*Math.abs(e)}function km(t,e,i,r,n,o,s,a,c){for(let l=e;l<e+r;l++)Lm(t,i*o+l,o,n,s,a,c);for(let l=i;l<i+n;l++)Lm(t,l*o+e,1,r,s,a,c)}function Lm(t,e,i,r,n,o,s){o[0]=0,s[0]=-Po,s[1]=Po,n[0]=t[e];for(let a=1,c=0,l=0;a<r;a++){n[a]=t[e+a*i];let u=a*a;do{let h=o[c];l=(n[a]-n[h]+u-h*h)/(a-h)/2}while(l<=s[c]&&--c>-1);c++,o[c]=a,s[c]=l,s[c+1]=Po}for(let a=0,c=0;a<r;a++){for(;s[c+1]<a;)c++;let l=o[c],u=a-l;t[e+a*i]=n[l]+u*u}}_h[255]=-Po;let jx=lv.layout_symbol["text-font"].default.join(",");class nn{constructor(t,e,i){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={},this.lang=i}setURL(t){this.url=t}getGlyphs(t){return it(this,void 0,void 0,function*(){let e=[];for(let n in t)for(let o of t[n])e.push(this._getAndCacheGlyphsPromise(n,o));let i=yield Promise.all(e),r={};for(let{stack:n,id:o,glyph:s}of i)r[n]||(r[n]={}),r[n][o]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return r})}_getAndCacheGlyphsPromise(t,e){return it(this,void 0,void 0,function*(){var i,r;(i=(r=this.entries)[t])!==null&&i!==void 0||(r[t]={glyphs:{},requests:{},ranges:{}});let n=this.entries[t],o=n.glyphs[e];return o!==void 0?{stack:t,id:e,glyph:o}:!this.url||this._charUsesLocalIdeographFontFamily(e)?(o=n.glyphs[e]=this._drawGlyph(n,t,e),{stack:t,id:e,glyph:o}):yield this._downloadAndCacheRangePromise(t,e)})}_downloadAndCacheRangePromise(t,e){return it(this,void 0,void 0,function*(){var i;let r=this.entries[t],n=Math.floor(e/256);if(r.ranges[n])return{stack:t,id:e,glyph:null};(i=r.requests)[n]||(i[n]=nn.loadGlyphRange(t,n,this.url,this.requestManager));try{let o=yield r.requests[n];for(let s in o)r.glyphs[+s]=o[+s];return r.ranges[n]=!0,{stack:t,id:e,glyph:o[e]||null}}catch(o){let s=r.glyphs[e]=this._drawGlyph(r,t,e);return this._warnOnMissingGlyphRange(s,n,e,me(o)),{stack:t,id:e,glyph:s}}})}_warnOnMissingGlyphRange(t,e,i,r){let n=256*e;Ct(`Unable to load glyph range ${e}, ${n}-${n+255}. Rendering codepoint U+${i.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(t))}_drawGlyph(t,e,i){let r=e===jx&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(i),n=r?"ideographTinySDF":"tinySDF";t[n]||(t[n]=this._createTinySDF(r?this.localIdeographFontFamily:e));let o=t[n].draw(String.fromCodePoint(i)),s=/^\p{gc=Cf}+$/u.test(String.fromCodePoint(i));return{id:i,bitmap:new fo({width:o.width||60,height:o.height||60},o.data),metrics:{width:s?0:o.glyphWidth/2||24,height:o.glyphHeight/2||24,left:o.glyphLeft/2+0.5||0,top:o.glyphTop/2-27.5||-8,advance:s?0:o.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){let e=t?t.split(","):[];e.push("sans-serif");let i=e.map((r)=>/[-\w]+/.test(r)?r:`'${CSS.escape(r)}'`).join(",");return new nn.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:0.25,fontFamily:i,fontWeight:this._fontWeight(e[0]),fontStyle:this._fontStyle(e[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){let e={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},i;for(let[r,n]of Object.entries(e))new RegExp(`\\b${r}\\b`,"i").test(t)&&(i=`${n}`);return i}destroy(){for(let t in this.entries){let e=this.entries[t];e.tinySDF=null,e.ideographTinySDF=null,e.glyphs={},e.requests={},e.ranges={}}this.entries={}}}nn.loadGlyphRange=function(t,e,i,r){return it(this,void 0,void 0,function*(){let n=256*e,o=n+255,s=yield r.transformRequest(i.replace("{fontstack}",t).replace("{range}",`${n}-${o}`),"Glyphs"),a=yield(c=s,l=new AbortController,rs(G(c,{type:"arrayBuffer"}),l));var c,l;if(!(a==null?void 0:a.data))throw Error(`Could not load glyph range. range: ${e}, ${n}-${o}`);let u={};for(let h of new uh(a.data).readFields(Dx,[]))u[h.id]=h;return u})},nn.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:r=0.25,fontFamily:n="sans-serif",fontWeight:o="normal",fontStyle:s="normal",lang:a=null}={}){this.buffer=e,this.radius=i,this.cutoff=r,this.lang=a;let c=this.size=t+4*e,l=this._createCanvas(c),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font=`${s} ${o} ${t}px ${n}`,u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(c*c),this.gridInner=new Float64Array(c*c),this.f=new Float64Array(c),this.z=new Float64Array(c+1),this.v=new Uint16Array(c)}_createCanvas(t){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(t,t);let e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){let{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:n,actualBoundingBoxRight:o}=this.ctx.measureText(t),s=Math.ceil(i),a=Math.floor(n),c=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(o)-a)),l=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(r))),u=c+2*this.buffer,h=l+2*this.buffer,p=Math.max(u*h,0),d=new Uint8ClampedArray(p),f={data:d,width:u,height:h,glyphWidth:c,glyphHeight:l,glyphTop:s,glyphLeft:a,glyphAdvance:e};if(c===0||l===0)return f;let{ctx:m,buffer:_,gridInner:y,gridOuter:v}=this;this.lang&&(m.lang=this.lang),m.clearRect(_,_,c,l),m.fillText(t,_-a,_+s);let g=m.getImageData(_,_,c,l);v.fill(Po,0,p),y.fill(0,0,p);let x=3;for(let T=0;T<l;T++){let P=(T+_)*u+_;for(let S=0;S<c;S++,x+=4,P++){let E=g.data[x];if(E===0)continue;let I=_h[E];v[P]=Math.max(0,I),y[P]=Math.max(0,-I)}}km(v,0,0,u,h,u,this.f,this.v,this.z),km(y,_,_,c,l,u,this.f,this.v,this.z);let b=255/this.radius,w=255*(1-this.cutoff);for(let T=0;T<p;T++){let P=Math.sqrt(v[T])-Math.sqrt(y[T]);d[T]=Math.round(w-b*P)}return f}};class Fm{constructor(){this.specification=D.light.position}possiblyEvaluate(t,e){return function([i,r,n]){return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:i*Math.cos(r)*Math.sin(n),y:i*Math.sin(r)*Math.sin(n),z:i*Math.cos(n)}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:Ft.number(t.x,e.x,i),y:Ft.number(t.y,e.y,i),z:Ft.number(t.z,e.z,i)}}}let gh;class Bm extends Ht{constructor(t){super(),gh||(gh=new ee({anchor:new Z(D.light.anchor),position:new Fm,color:new Z(D.light.color),intensity:new Z(D.light.intensity)})),this._transitionable=new so(gh,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,e={}){if(!this._validate(cv,t,e))for(let i in t){let r=t[i];i.endsWith(no)?this._transitionable.setTransition(i.slice(0,-11),r):this._transitionable.setValue(i,r)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,e,i){return(i==null?void 0:i.validate)!==!1&&Zs(this,t.call(te,{value:e,style:{glyphs:!0,sprite:!0},styleSpec:D}))}}let Nx=new ee({"sky-color":new Z(D.sky["sky-color"]),"horizon-color":new Z(D.sky["horizon-color"]),"fog-color":new Z(D.sky["fog-color"]),"fog-ground-blend":new Z(D.sky["fog-ground-blend"]),"horizon-fog-blend":new Z(D.sky["horizon-fog-blend"]),"sky-horizon-blend":new Z(D.sky["sky-horizon-blend"]),"atmosphere-blend":new Z(D.sky["atmosphere-blend"])});class Om extends Ht{constructor(t){super(),this._transitionable=new so(Nx,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new At(0))}setSky(t,e={}){if(!this._validate(hv,t,e)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(let i in t){let r=t[i];i.endsWith(no)?this._transitionable.setTransition(i.slice(0,-11),r):this._transitionable.setValue(i,r)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,e,i={}){return(i==null?void 0:i.validate)!==!1&&Zs(this,t.call(te,G({value:e,style:{glyphs:!0,sprite:!0},styleSpec:D})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class jm{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){var i;let r=t.join(",")+String(e);return(i=this.dashEntry)[r]||(i[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,i){let r=[],n=t.length%2==1?-t[t.length-1]*i:0,o=t[0]*i,s=!0;r.push({left:n,right:o,isDash:s,zeroLength:t[0]===0});let a=t[0];for(let c=1;c<t.length;c++){s=!s;let l=t[c];n=a*i,a+=l,o=a*i,r.push({left:n,right:o,isDash:s,zeroLength:l===0})}return r}addRoundDash(t,e,i){let r=e/2;for(let n=-i;n<=i;n++){let o=this.width*(this.nextRow+i+n),s=0,a=t[s];for(let c=0;c<this.width;c++){c/a.right>1&&(a=t[++s]);let l=Math.abs(c-a.left),u=Math.abs(c-a.right),h=Math.min(l,u),p,d=n/i*(r+1);if(a.isDash){let f=r-Math.abs(d);p=Math.sqrt(h*h+f*f)}else p=r-Math.sqrt(h*h+d*d);this.data[o+c]=Math.max(0,Math.min(255,p+128))}}}addRegularDash(t){for(let s=t.length-1;s>=0;--s){let a=t[s],c=t[s+1];a.zeroLength?t.splice(s,1):c&&c.isDash===a.isDash&&(c.left=a.left,t.splice(s,1))}let e=t[0],i=t[t.length-1];e.isDash===i.isDash&&(e.left=i.left-this.width,i.right=e.right+this.width);let r=this.width*this.nextRow,n=0,o=t[n];for(let s=0;s<this.width;s++){s/o.right>1&&(o=t[++n]);let a=Math.abs(s-o.left),c=Math.abs(s-o.right),l=Math.min(a,c);this.data[r+s]=Math.max(0,Math.min(255,(o.isDash?l:-l)+128))}}addDash(t,e){let i=e?7:0,r=2*i+1;if(this.nextRow+r>this.height)return Ct("LineAtlas out of space"),null;let n=0;for(let s of t)n+=s;if(n!==0){let s=this.width/n,a=this.getDashRanges(t,this.width,s);e?this.addRoundDash(a,s,i):this.addRegularDash(a)}let o={y:this.nextRow+i,height:2*i,width:n};return this.nextRow+=r,this.dirty=!0,o}bind(t){let e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}}class Nm{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,(t=this._channel)===null||t===void 0||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}let Vx={once:!0};class Vm{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Nm(()=>this.process()),this.subscription=Al(this.target,"message",(i)=>this.receive(i),!1),this.globalScope=Mr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((i,r)=>{let n=Math.round(1000000000000000000*Math.random()).toString(36).substring(0,10),o=e?Al(e.signal,"abort",()=>{o==null||o.unsubscribe(),delete this.resolveRejects[n];let c={id:n,type:"<cancel>",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(c)},Vx):null;this.resolveRejects[n]={resolve:(c)=>{o==null||o.unsubscribe(),i(c)},reject:(c)=>{o==null||o.unsubscribe(),r(c)}};let s=[],a=Object.assign(Object.assign({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:io(t.data,s)});this.target.postMessage(a,{transfer:s})})}receive(t){let e=t.data,i=e.id,r=["file://","resource://android","null"],n=[e.origin,location.origin],o=e.origin===location.origin,s=n.some((a)=>r.includes(a));if((o||s)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];let a=this.abortControllers[i];return delete this.abortControllers[i],void(a&&a.abort())}if(Mr(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){return it(this,void 0,void 0,function*(){if(e.type==="<response>"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;return void(e.error?n.reject(me(ro(e.error))):n.resolve(ro(e.data)))}if(!this.messageHandlers[e.type])return void this.completeTask(t,Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));let i=ro(e.data),r=new AbortController;this.abortControllers[t]=r;try{let n=yield this.messageHandlers[e.type](e.sourceMapId,i,r);this.completeTask(t,null,n)}catch(n){this.completeTask(t,me(n))}})}completeTask(t,e,i){let r=[];delete this.abortControllers[t];let n={id:t,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?io(e):null,data:io(i,r)};this.target.postMessage(n,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}}let yh="maplibre_preloaded_worker_pool";class on{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<on.workerCount;)this.workers.push(new Worker(ze.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){if(delete this.active[t],this.numActive()===0){for(let e of this.workers)e.terminate();this.workers=null}}isPreloaded(){return!!this.active[yh]}numActive(){return Object.keys(this.active).length}}let Ux=Math.floor(ge.hardwareConcurrency/2),Io,za;function vh(){return Io||(Io=new on),Io}on.workerCount=function(t){if(Cl==null){let e=t.navigator?t.navigator.userAgent:null;Cl=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Cl}(globalThis)?Math.max(Math.min(Ux,3),1):1;class xh{constructor(t,e){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=e;let i=this.workerPool.acquire(e);for(let r=0;r<i.length;r++){let n=new Vm(i[r],e);n.name=`Worker ${r}`,this.actors.push(n)}if(!this.actors.length)throw Error("No actors found")}broadcast(t,e){let i=[];for(let r of this.actors)i.push(r.sendAsync({type:t,data:e}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){for(let e of this.actors)e.remove();this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,e){for(let i of this.actors)i.registerMessageHandler(t,e)}unregisterMessageHandler(t){for(let e of this.actors)e.unregisterMessageHandler(t)}}function bh(){return za||(za=new xh(vh(),Bl),za.registerMessageHandler("GR",(t,e,i)=>rs(e,i))),za}function $x(t,e){let i=Ci();return Ot(i,i,[1,1,0]),Wt(i,i,[0.5*t.width,0.5*t.height,1]),t.calculatePosMatrix?Sr(i,i,t.calculatePosMatrix(e.toUnwrapped())):i}function Zx(t,e,i,r,n,o,s){var a;let c=function(p,d,f){if(p)for(let m of p){let _=d[m];if((_==null?void 0:_.source)===f&&_.type==="fill-extrusion")return!0}else for(let m in d){let _=d[m];if(_.source===f&&_.type==="fill-extrusion")return!0}return!1}((a=n==null?void 0:n.layers)!==null&&a!==void 0?a:null,e,t.id),l=o.maxPitchScaleFactor(),u=t.tilesIn(r,l,c);u.sort(Um);let h=[];for(let p of u)h.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,i,t.getState(),p.queryGeometry,p.cameraQueryGeometry,p.scale,n,o,l,$x(o,p.tileID),s?(d,f)=>s(p.tileID,d,f):void 0)});return function(p,d){for(let f in p)for(let m of p[f])$m(m,d);return p}(function(p){let d={},f={};for(let{queryResults:m,wrappedTileID:_}of p){f[_]||(f[_]={});let y=f[_];for(let v in m){let g=m[v];y[v]||(y[v]={});let x=y[v];d[v]||(d[v]=[]);for(let b of g)x[b.featureIndex]||(x[b.featureIndex]=!0,d[v].push(b))}}return d}(h),t)}function Um(t,e){let i=t.tileID,r=e.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function $m(t,e){let i=t.feature,r=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}function Zm(t,e,i,r){return it(this,void 0,void 0,function*(){let n=t;if(t.url?n=(yield ns(yield e.transformRequest(t.url,"Source"),i)).data:yield ge.frameAsync(i,r),!n)return null;let o=Rn(G(n,t),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in n&&n.vector_layers&&(o.vectorLayerIds=n.vector_layers.map((s)=>s.id)),o})}let mi=6371008.8;class X{constructor(t,e){if(isNaN(t)||isNaN(e))throw Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new X(Ye(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let e=Math.PI/180,i=this.lat*e,r=t.lat*e,n=Math.sin(i)*Math.sin(r)+Math.cos(i)*Math.cos(r)*Math.cos((t.lng-this.lng)*e);return mi*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof X)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new X(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new X(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class Kt{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof X?new X(t.lng,t.lat):X.convert(t),this}setSouthWest(t){return this._sw=t instanceof X?new X(t.lng,t.lat):X.convert(t),this}extend(t){let e=this._sw,i=this._ne,r,n;if(t instanceof X)r=t,n=t;else{if(!(t instanceof Kt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(Kt.convert(t)):this.extend(X.convert(t)):t&&(("lng"in t)||("lon"in t))&&("lat"in t)?this.extend(X.convert(t)):this;if(r=t._sw,n=t._ne,!r||!n)return this}return e||i?(e.lng=Math.min(r.lng,e.lng),e.lat=Math.min(r.lat,e.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)):(this._sw=new X(r.lng,r.lat),this._ne=new X(n.lng,n.lat)),this}getCenter(){return new X((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new X(this.getWest(),this.getNorth())}getSouthEast(){return new X(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:e,lat:i}=X.convert(t),r=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(r=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=i&&i<=this._ne.lat&&r}intersects(t){if(!((t=Kt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let e=Math.abs(this.getEast()-this.getWest()),i=Math.abs(t.getEast()-t.getWest());if(e>=360||i>=360)return!0;let r=Ye(this.getWest(),-180,180),n=Ye(this.getEast(),-180,180),o=Ye(t.getWest(),-180,180),s=Ye(t.getEast(),-180,180),a=r>n,c=o>s;return!(!a||!c)||(a?s>=r||o<=n:c?n>=o||r<=s:o<=n&&s>=r)}static convert(t){return t instanceof Kt?t:t?new Kt(t):t}static fromLngLat(t,e=0){let i=360*e/40075017,r=i/Math.cos(Math.PI/180*t.lat);return new Kt(new X(t.lng-r,t.lat-i),new X(t.lng+r,t.lat+i))}adjustAntiMeridian(){let t=new X(this._sw.lng,this._sw.lat),e=new X(this._ne.lng,this._ne.lat);return new Kt(t,t.lng>e.lng?new X(e.lng+360,e.lat):e)}}let Gm=2*Math.PI*mi;function qm(t){return Gm*Math.cos(t*Math.PI/180)}function sn(t){return(180+t)/360}function dr(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ji(t,e){return t/qm(e)}function wh(t){return 360*t-180}function Eo(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Wm(t,e){return t*qm(Eo(e))}class wt{constructor(t,e,i=0){this.x=+t,this.y=+e,this.z=+i}static fromLngLat(t,e=0){let i=X.convert(t);return new wt(sn(i.lng),dr(i.lat),ji(e,i.lat))}toLngLat(){return new X(wh(this.x),Eo(this.y))}toAltitude(){return Wm(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Gm*(t=Eo(this.y),1/Math.cos(t*Math.PI/180));var t}}class Th{constructor(t,e,i){this.bounds=Kt.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=i||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){let e=Math.pow(2,t.z),i=Math.floor(sn(this.bounds.getWest())*e),r=Math.floor(dr(this.bounds.getNorth())*e),n=Math.ceil(sn(this.bounds.getEast())*e),o=Math.ceil(dr(this.bounds.getSouth())*e);return t.x>=i&&t.x<n&&t.y>=r&&t.y<o}}class Sh extends Ht{constructor(t,e,i,r){if(super(),this.id=t,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,G(this,Rn(e,["url","scheme","tileSize","promoteId","encoding"])),this._options=G({type:"vector"},e),this._collectResourceTiming=e.collectResourceTiming,this.tileSize!==512)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}load(){return it(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new R("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Zm(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,e&&(G(this,e),e.bounds&&(this.tileBounds=new Th(e.bounds,this.minzoom,this.maxzoom)),this.fire(new R("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new R("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Ar(e)||this.fire(new J(me(e)))}})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return G({},this._options)}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:yield this.map._requestManager.transformRequest(e,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};i.request.collectResourceTiming=this._collectResourceTiming;let r="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise((n,o)=>{t.reloadPromise={resolve:n,reject:o}})}else t.actor=this.dispatcher.getActor(),r="LT";t.abortController=new AbortController;try{let n=yield t.actor.sendAsync({type:r,data:i},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,n);let o={};return(n==null?void 0:n.etagUnmodified)&&(o.unmodified=!0),o}catch(n){if(delete t.abortController,t.aborted)return;if(n&&n.status!==404)throw n;this._afterTileLoadWorkerResponse(t,null)}})}_getOverzoomParameters(t){return it(this,void 0,void 0,function*(){if(t.tileID.canonical.z<=this.maxzoom)return;if(this.map._zoomLevelsToOverscale===void 0)return;let e=t.tileID.scaledTo(this.maxzoom).canonical,i=e.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:e,overzoomRequest:yield this.map._requestManager.transformRequest(i,"Tile")}})}_afterTileLoadWorkerResponse(t,e){if((e==null?void 0:e.resourceTiming)&&(t.resourceTiming=e.resourceTiming),e&&this.map._refreshExpiredTiles&&t.setExpiryData(e),t.etag=e==null?void 0:e.etag,t.loadVectorData(e,this.map.painter),t.reloadPromise){let i=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(i.resolve).catch(i.reject)}}abortTile(t){return it(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.type,source:this.id}}))})}unloadTile(t){return it(this,void 0,void 0,function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Da extends Ht{constructor(t,e,i,r){super(),this.id=t,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=G({type:"raster"},e),G(this,Rn(e,["url","scheme","tileSize"]))}load(){return it(this,arguments,void 0,function*(t=!1){this._loaded=!1,this.fire(new R("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=yield Zm(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,e&&(G(this,e),e.bounds&&(this.tileBounds=new Th(e.bounds,this.minzoom,this.maxzoom)),this.fire(new R("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new R("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(e){this._tileJSONRequest=null,this._loaded=!0,Ar(e)||this.fire(new J(me(e)))}})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}serialize(){return G({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{let i=yield ci.getImage(yield this.map._requestManager.transformRequest(e,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(i==null?void 0:i.data){this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&t.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let r=this.map.painter.context,n=r.gl,o=i.data;t.texture=this.map.painter.getTileTexture(o.width),t.texture?t.texture.update(o,{useMipmap:!0}):(t.texture=new jt(r,o,n.RGBA,{useMipmap:!0}),t.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(i){if(delete t.abortController,t.aborted)t.state="unloaded";else if(i)throw t.state="errored",i}})}abortTile(t){return it(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)})}unloadTile(t){return it(this,void 0,void 0,function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)})}hasTransition(){return!1}}function Hm(t,e,i){var r=2*Math.PI*6378137/256/Math.pow(2,i);return[t*r-2*Math.PI*6378137/2,e*r-2*Math.PI*6378137/2]}function Xm(t,e){let{x:i,y:r}=wt.fromLngLat(e);return!(t<0||t>25||r<0||r>=1||i<0||i>=1)}class Mo{constructor(t,e,i){if(!function(r,n,o){return!(r<0||r>25||o<0||o>=Math.pow(2,r)||n<0||n>=Math.pow(2,r))}(t,e,i))throw Error(`x=${e}, y=${i}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=e,this.y=i,this.key=an(0,t,t,e,i)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,i){let r=(o=this.y,s=this.z,a=Hm(256*(n=this.x),256*(o=Math.pow(2,s)-o-1),s),c=Hm(256*(n+1),256*(o+1),s),a[0]+","+a[1]+","+c[0]+","+c[1]);var n,o,s,a,c;let l=function(u,h,p){let d="";for(let f=u;f>0;f--){let m=1<<f-1;d+=(h&m?1:0)+(p&m?2:0)}return d}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,l).replace(/{bbox-epsg-3857}/g,r)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=Math.pow(2,this.z);return new z((t.x*e-this.x)*F,(t.y*e-this.y)*F)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Co{constructor(t,e){this.wrap=t,this.canonical=e,this.key=an(t,e.z,e.z,e.x,e.y)}}class Et{constructor(t,e,i,r,n){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=e,this.canonical=new Mo(i,+r,+n),this.key=an(e,t,i,r,n)}clone(){return new Et(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let e=this.canonical.z-t;return t>this.canonical.z?new Et(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Et(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,e){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?an(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):an(this.wrap*+e,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap)return!1;if(this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let e=this.canonical.z-t.canonical.z;return!(e<0)&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Et(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let e=this.canonical.z+1,i=2*this.canonical.x,r=2*this.canonical.y;return[new Et(e,this.wrap,e,i,r),new Et(e,this.wrap,e,i+1,r),new Et(e,this.wrap,e,i,r+1),new Et(e,this.wrap,e,i+1,r+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Et(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Et(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Co(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new wt(t.x-this.wrap,t.y))}normalizeCoordinates(t,e,i=8192){if(t>=0&&t<i&&e>=0&&e<i)return{tileID:this,x:t,y:e};let r=Math.floor(t/i),n=Math.floor(e/i),o=t-r*i,s=e-n*i,a=this.canonical.z,c=1<<a,l=this.canonical.y+n;if(l<0||l>=c)return null;let u=this.canonical.x+r,h=this.wrap;return u<0?(h-=Math.ceil(-u/c),u=(u%c+c)%c):u>=c&&(h+=Math.floor(u/c),u%=c),{tileID:new Et(this.overscaledZ,h,a,u,l),x:o,y:s}}}function an(t,e,i,r,n){(t*=2)<0&&(t=-1*t-1);let o=1<<i;return(o*o*t+o*n+r).toString(36)+i.toString(36)+e.toString(36)}function Ym(t,e){let i=Math.abs(2*t.wrap)-+(t.wrap<0),r=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||r-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}U("CanonicalTileID",Mo),U("OverscaledTileID",Et,{omit:["terrainRttPosMatrix32f"]});class Ph extends Da{constructor(t,e,i,r){super(t,e,i,r),this.type="raster-dem",this.maxzoom=22,this._options=G({type:"raster-dem"},e),this.encoding=e.encoding||"mapbox",this.redFactor=e.redFactor,this.greenFactor=e.greenFactor,this.blueFactor=e.blueFactor,this.baseShift=e.baseShift}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=yield this.map._requestManager.transformRequest(e,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{let r=yield ci.getImage(i,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(r==null?void 0:r.data){let n=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&t.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let o=Yi(n)&&cd()?n:yield this.readImageNow(n),s={type:this.type,uid:t.uid,source:this.id,rawImageData:o,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:s}),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(r){if(delete t.abortController,t.aborted)t.state="unloaded";else if(r)throw t.state="errored",r}})}readImageNow(t){return it(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&function(){if(Wo==null&&(Wo=!1,cd())){let i=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(i){for(let n=0;n<25;n++){let o=4*n;i.fillStyle=`rgb(${o},${o+1},${o+2})`,i.fillRect(n%5,Math.floor(n/5),1,1)}let r=i.getImageData(0,0,5,5).data;for(let n=0;n<100;n++)if(n%4!=3&&r[n]!==n){Wo=!0;break}}}return Wo||!1}()){let e=t.width+2,i=t.height+2;try{return new It({width:e,height:i},yield function(r,n,o,s,a){return it(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let c=new VideoFrame(r,{timestamp:0});try{let l=c==null?void 0:c.format;if(!l||!l.startsWith("BGR")&&!l.startsWith("RGB"))throw Error(`Unrecognized format ${l}`);let u=l.startsWith("BGR"),h=new Uint8ClampedArray(s*a*4);if(yield c.copyTo(h,function(p,d,f,m,_){let y=4*Math.max(1,0),v=(Math.max(0,-1)- -1)*m*4+y,g=4*m,x=Math.max(0,-1),b=Math.max(0,-1);return{rect:{x,y:b,width:Math.min(p.width,-1+m)-x,height:Math.min(p.height,-1+_)-b},layout:[{offset:v,stride:g}]}}(r,0,0,s,a)),u)for(let p=0;p<h.length;p+=4){let d=h[p];h[p]=h[p+2],h[p+2]=d}return h}finally{c.close()}})}(t,0,0,e,i))}catch(r){}}return ge.getImageData(t,1)})}_getNeighboringTiles(t){let e=t.canonical,i=Math.pow(2,e.z),r=(e.x-1+i)%i,n=e.x===0?t.wrap-1:t.wrap,o=(e.x+1+i)%i,s=e.x+1===i?t.wrap+1:t.wrap,a={};return a[new Et(t.overscaledZ,n,e.z,r,e.y).key]={backfilled:!1},a[new Et(t.overscaledZ,s,e.z,o,e.y).key]={backfilled:!1},e.y>0&&(a[new Et(t.overscaledZ,n,e.z,r,e.y-1).key]={backfilled:!1},a[new Et(t.overscaledZ,t.wrap,e.z,e.x,e.y-1).key]={backfilled:!1},a[new Et(t.overscaledZ,s,e.z,o,e.y-1).key]={backfilled:!1}),e.y+1<i&&(a[new Et(t.overscaledZ,n,e.z,r,e.y+1).key]={backfilled:!1},a[new Et(t.overscaledZ,t.wrap,e.z,e.x,e.y+1).key]={backfilled:!1},a[new Et(t.overscaledZ,s,e.z,o,e.y+1).key]={backfilled:!1}),a}unloadTile(t){return it(this,void 0,void 0,function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))})}}function Ih(t,e){return e?t.properties[e]:t.id}function Gx(t,e){let i={id:t.id};if(e.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete e.removeProperties),e.removeProperties)for(let r of e.removeProperties){let n=t.addOrUpdateProperties.findIndex((o)=>o.key===r);n>-1&&t.addOrUpdateProperties.splice(n,1)}return(t.removeAllProperties||e.removeAllProperties)&&(i.removeAllProperties=!0),(t.removeProperties||e.removeProperties)&&(i.removeProperties=[...t.removeProperties||[],...e.removeProperties||[]]),(t.addOrUpdateProperties||e.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...e.addOrUpdateProperties||[]]),(t.newGeometry||e.newGeometry)&&(i.newGeometry=e.newGeometry||t.newGeometry),i}function Km(t){var e,i;if(!t)return{};let r={};return r.removeAll=t.removeAll,r.remove=new Set(t.remove||[]),r.add=new Map((e=t.add)===null||e===void 0?void 0:e.map((n)=>[n.id,n])),r.update=new Map((i=t.update)===null||i===void 0?void 0:i.map((n)=>[n.id,n])),r}function Jm(t){return t&&t.length!==0?typeof t[0]=="number"?[t]:t.flatMap((e)=>Jm(e)):[]}function Ra(t){return t.type==="GeometryCollection"?t.geometries.flatMap((e)=>Ra(e)):Jm(t.coordinates)}function Qm(t){let e=new Kt,i;switch(t.type){case"FeatureCollection":i=t.features.flatMap((r)=>Ra(r.geometry));break;case"Feature":i=Ra(t.geometry);break;default:i=Ra(t)}if(i.length===0)return e;for(let r of i){let[n,o]=r;e.extend([n,o])}return e}class Eh extends Ht{constructor(t,e,i,r){super(),this.id=t,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:e.data},this.actor=i.getActor(),this.setEventedParent(r),this._data=typeof e.data=="string"?{url:e.data}:{geojson:e.data},this._options=G({},e),this._collectResourceTiming=e.collectResourceTiming,e.maxzoom!==void 0&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type),e.attribution&&(this.attribution=e.attribution),this.promoteId=e.promoteId,e.clusterMaxZoom!==void 0&&this.maxzoom<=e.clusterMaxZoom&&Ct(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${e.clusterMaxZoom}".`),this.workerOptions=G({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(e.buffer!==void 0?e.buffer:128),tolerance:this._pixelsToTileUnits(e.tolerance!==void 0?e.tolerance:0.375),extent:F,maxZoom:this.maxzoom,lineMetrics:e.lineMetrics||!1,generateId:e.generateId||!1,promoteId:typeof e.promoteId=="string"?e.promoteId:void 0,cluster:e.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(e.clusterMaxZoom),minPoints:Math.max(2,e.clusterMinPoints||2),extent:F,radius:this._pixelsToTileUnits(e.clusterRadius||50),log:!1,generateId:e.generateId||!1}},clusterProperties:e.clusterProperties,filter:e.filter},e.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(F/this.tileSize)}_getClusterMaxZoom(t){let e=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||Ct(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${e}"`),e}load(){return it(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(t){this.map=t,this.load()}setData(t,e){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};let i=this._updateWorkerData();return e?i:this}updateData(t,e){this._pendingWorkerUpdate.diff=function(r,n){if(!r)return n||{};if(!n)return r||{};let o=Km(r),s=Km(n);(function(l,u){u.removeAll&&(l.add.clear(),l.update.clear(),l.remove.clear(),u.remove.clear());for(let h of u.remove)l.add.delete(h),l.update.delete(h);for(let[h,p]of u.update){let d=l.update.get(h);d&&(u.update.set(h,Gx(d,p)),l.update.delete(h))}})(o,s);let a={};if((o.removeAll||s.removeAll)&&(a.removeAll=!0),a.remove=new Set([...o.remove,...s.remove]),a.add=new Map([...o.add,...s.add]),a.update=new Map([...o.update,...s.update]),a.remove.size&&a.add.size)for(let l of a.add.keys())a.remove.delete(l);return function(l){let u={};return l.removeAll&&(u.removeAll=l.removeAll),l.remove&&(u.remove=Array.from(l.remove)),l.add&&(u.add=Array.from(l.add.values())),l.update&&(u.update=Array.from(l.update.values())),u}(a)}(this._pendingWorkerUpdate.diff,t);let i=this._updateWorkerData();return e?i:this}getData(){return it(this,void 0,void 0,function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}})}getBounds(){return it(this,void 0,void 0,function*(){return Qm(yield this.getData())})}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,e,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:e,offset:i}})}_updateWorkerData(){return it(this,void 0,void 0,function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void Ct(`No pending worker updates for GeoJSONSource ${this.id}.`);let{data:t,diff:e,updateCluster:i}=this._pendingWorkerUpdate,r=this._getLoadGeoJSONParameters(t,e,i);t!==void 0?this._pendingWorkerUpdate.data=void 0:e?this._pendingWorkerUpdate.diff=void 0:i&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(r)})}_getLoadGeoJSONParameters(t,e,i){return it(this,void 0,void 0,function*(){let r=G({type:this.type},this.workerOptions);return typeof t=="string"?(r.request=yield this.map._requestManager.transformRequest(ge.resolveURL(t),"Source"),r.request.collectResourceTiming=this._collectResourceTiming,r):t!==void 0?(r.data=t,r):e?(r.dataDiff=e,r):i?(r.updateCluster=!0,r):void 0})}_dispatchWorkerUpdate(t){return it(this,void 0,void 0,function*(){this._isUpdatingWorker=!0,this.fire(new R("dataloading",{dataType:"source"}));try{let e=yield t,i=yield this.actor.sendAsync({type:"LD",data:e});if(this._isUpdatingWorker=!1,this._removed||i.abandoned)return void this.fire(new R("dataabort",{dataType:"source"}));i.data&&(this._data={geojson:i.data});let r=this._applyDiffToSource(e.dataDiff),n=this._getShouldReloadTileOptions(r),o={dataType:"source"};this._applyResourceTiming(o,i),this.fire(new R("data",Object.assign(Object.assign({},o),{sourceDataType:"metadata"}))),this.fire(new R("data",Object.assign(Object.assign({},o),{sourceDataType:"content",shouldReloadTileOptions:n})))}catch(e){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new R("dataabort",{dataType:"source"}));this.fire(new J(me(e)))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}})}_applyResourceTiming(t,e){var i;if(!this._collectResourceTiming)return;let r=(i=e.resourceTiming)===null||i===void 0?void 0:i[this.id];if(!r)return;let n=r.slice(0);(n==null?void 0:n.length)&&G(t,{resourceTiming:n})}_applyDiffToSource(t){if(!t)return;let e=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let r=function(n,o){let s=new Map;if(n==null)return s;if(n.type==null)return s;if(n.type==="Feature"){let a=Ih(n,o);if(a==null)return;return s.set(a,n),s}if(n.type==="FeatureCollection"){let a=new Set;for(let c of n.features){let l=Ih(c,o);if(l==null)return;if(a.has(l))return;a.add(l),s.set(l,c)}return s}}(this._data.geojson,e);if(!r)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:r}}if(!this._data.updateable)return;let i=function(r,n,o){var s,a;let c=[];if(n.removeAll)r.clear();else if(n.remove)for(let l of n.remove){let u=r.get(l);u&&(c.push(u.geometry),r.delete(l))}if(n.add)for(let l of n.add){let u=Ih(l,o);if(u==null)continue;let h=r.get(u);h&&c.push(h.geometry),c.push(l.geometry),r.set(u,l)}if(n.update)for(let l of n.update){let u=r.get(l.id);if(!u)continue;let h=!!l.newGeometry,p=l.removeAllProperties||((s=l.removeProperties)===null||s===void 0?void 0:s.length)>0||((a=l.addOrUpdateProperties)===null||a===void 0?void 0:a.length)>0;if(!h&&!p)continue;c.push(u.geometry);let d=Object.assign({},u);if(r.set(l.id,d),h&&(c.push(l.newGeometry),d.geometry=l.newGeometry),p){if(d.properties=l.removeAllProperties?{}:Object.assign({},d.properties||{}),l.removeProperties)for(let f of l.removeProperties)delete d.properties[f];if(l.addOrUpdateProperties)for(let{key:f,value:m}of l.addOrUpdateProperties)d.properties[f]=m}}return c}(this._data.updateable,t,e);return t.removeAll||this._options.cluster?void 0:i}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((e)=>Qm(e))}}shouldReloadTile(t,{affectedBounds:e}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;let{buffer:i,extent:r}=this.workerOptions.geojsonVtOptions,n=function({x:o,y:s,z:a},c=0){let l=wh((o-c)/Math.pow(2,a)),u=Eo((s+1+c)/Math.pow(2,a)),h=wh((o+1+c)/Math.pow(2,a)),p=Eo((s-c)/Math.pow(2,a));return new Kt([l,u],[h,p])}(t.tileID.canonical,i/r);for(let o of e)if(n.intersects(o))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return it(this,void 0,void 0,function*(){let e=t.actor?"RT":"LT";t.actor=this.actor;let i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};t.abortController=new AbortController;let r=yield this.actor.sendAsync({type:e,data:i},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(r,this.map.painter,e==="RT")})}abortTile(t){return it(this,void 0,void 0,function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0})}unloadTile(t){return it(this,void 0,void 0,function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return G({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}}class Le{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let e=new Le;return e.extend(t(new z(this.minX,this.minY))),e.extend(t(new z(this.maxX,this.minY))),e.extend(t(new z(this.minX,this.maxY))),e.extend(t(new z(this.maxX,this.maxY))),e}static fromPoints(t){let e=new Le;for(let i of t)e.extend(i);return e}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class pr extends Ht{constructor(t,e,i,r){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=i,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(r),this.options=e}load(t){return it(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new R("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let e=yield ci.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,(e==null?void 0:e.data)&&(this.image=e.data,t&&(this.coordinates=t),this._finishLoading())}catch(e){this._request=null,this._loaded=!0,Ar(e)||this.fire(new J(me(e)))}})}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally(()=>this.texture=null),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new R("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;let e=t.map(wt.fromLngLat);var i;return this.tileID=function(r){let n=Le.fromPoints(r),o=n.width(),s=n.height(),a=Math.max(o,s),c=Math.max(0,Math.floor(-Math.log(a)/Math.LN2)),l=Math.pow(2,c);return new Mo(c,Math.floor((n.minX+n.maxX)/2*l),Math.floor((n.minY+n.maxY)/2*l))}(e),this.terrainTileRanges=this._getOverlappingTileRanges(e),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=e.map((r)=>this.tileID.getTilePoint(r)._round()),this.flippedWindingOrder=((i=this.tileCoords)[1].x-i[0].x)*(i[2].y-i[0].y)-(i[1].y-i[0].y)*(i[2].x-i[0].x)<0,this.fire(new R("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let t=this.map.painter.context,e=t.gl;this.texture||(this.texture=new jt(t,this.image,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new R("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return it(this,void 0,void 0,function*(){var e;((e=this.tileID)===null||e===void 0?void 0:e.equals(t.tileID.canonical))?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){let{minX:e,minY:i,maxX:r,maxY:n}=Le.fromPoints(t),o={};for(let s=0;s<=25;s++){let a=Math.pow(2,s),c=Math.floor(e*a),l=Math.floor(i*a),u=Math.floor(r*a),h=Math.floor(n*a),p=(c%a+a)%a,d=u%a,f=Math.floor(c/a),m=Math.floor(u/a);o[s]={minWrap:f,maxWrap:m,minTileXWrapped:p,maxTileXWrapped:d,minTileY:l,maxTileY:h}}return o}}class Mh extends pr{constructor(t,e,i,r){super(t,e,i,r),this._onPlayingHandler=()=>{var n;(n=this.map)===null||n===void 0||n.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=e}load(){return it(this,void 0,void 0,function*(){this._loaded=!1;let t=this.options;this.urls=[];for(let e of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(e,"Source")).url);try{let e=yield((i)=>{let r=window.document.createElement("video");return r.muted=!0,new Promise((n)=>{r.onloadstart=()=>{n(r)};for(let o of i){let s=window.document.createElement("source");Rd(o)||(r.crossOrigin="Anonymous"),s.src=o,r.appendChild(s)}})})(this.urls);if(this._loaded=!0,!e)return;this.video=e,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(e){this.fire(new J(me(e)))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){let e=this.video.seekable;t<e.start(0)||t>e.end(0)?this.fire(new J(new j(`sources.${this.id}`,null,`Playback for this video can be set only between the ${e.start(0)} and ${e.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let t=this.map.painter.context,e=t.gl;this.texture?this.video.paused||(this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE),e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,this.video)):(this.texture=new jt(t,this.video,e.RGBA),this.texture.bind(e.LINEAR,e.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let n=this.tiles[r];n.state!=="loaded"&&(n.state="loaded",n.texture=this.texture,i=!0)}i&&this.fire(new R("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ch extends pr{constructor(t,e,i,r){super(t,e,i,r),e.coordinates?Array.isArray(e.coordinates)&&e.coordinates.length===4&&!e.coordinates.some((n)=>!Array.isArray(n)||n.length!==2||n.some((o)=>typeof o!="number"))||this.fire(new J(new j(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new J(new j(`sources.${t}`,null,'missing required property "coordinates"'))),e.animate&&typeof e.animate!="boolean"&&this.fire(new J(new j(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),e.canvas?typeof e.canvas=="string"||e.canvas instanceof HTMLCanvasElement||this.fire(new J(new j(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new J(new j(`sources.${t}`,null,'missing required property "canvas"'))),this.options=e,this.animate=e.animate===void 0||e.animate}load(){return it(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new J(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions())return;if(Object.keys(this.tiles).length===0)return;let e=this.map.painter.context,i=e.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new jt(e,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,r=!0)}r&&this.fire(new R("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}let t_={},e_=(t)=>{switch(t){case"geojson":return Eh;case"image":return pr;case"raster":return Da;case"raster-dem":return Ph;case"vector":return Sh;case"video":return Mh;case"canvas":return Ch}return t_[t]};class i_{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let i=t[e];this._stringToNumber[i]=e,this._numberToString[e]=i}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Ah{constructor(t,e,i,r,n){this.type="Feature",this._vectorTileFeature=t,this._x=i,this._y=r,this._z=e,this.properties=t.properties,this.id=n}projectPoint(t,e,i,r){return[360*(t.x+e)/r-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+i)/r)*Math.PI))-90]}projectLine(t,e,i,r){return t.map((n)=>this.projectPoint(n,e,i,r))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*Math.pow(2,this._z),i=t.extent*this._x,r=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let o=[];for(let a of n)o.push(a[0]);let s=this.projectLine(o,i,r,e);this._geometry=o.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let o=n.map((s)=>this.projectLine(s,i,r,e));this._geometry=o.length===1?{type:"LineString",coordinates:o[0]}:{type:"MultiLineString",coordinates:o};break}case 3:{let o=Qf(n),s=[];for(let a of o)s.push(a.map((c)=>this.projectLine(c,i,r,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}}class fr{constructor(t,e,i){this._name=t,this.dataBuffer=e,typeof i=="number"?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}}class Ao extends fr{}class ka extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class La extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class zh extends fr{constructor(t,e,i,r){super(t,e,r),this.delta=i}}class Fa extends zh{constructor(t,e,i,r){super(t,Int32Array.of(e),i,r)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}}class Ba extends fr{constructor(t,e,i,r){super(t,r?Int32Array.of(e):Uint32Array.of(e),i)}getValueFromBuffer(t){return this.dataBuffer[0]}}class r_{constructor(t,e,i,r,n=4096){this._name=t,this._geometryVector=e,this._idVector=i,this._propertyVectors=r,this._extent=n}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this._propertyVectors.map((e)=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let s=this.idVector.getValue(i);r=this.containsMaxSafeIntegerValues(this.idVector)&&s!==null?Number(s):s}let n={coordinates:e[i],type:this.geometryVector.geometryType(i)},o={};for(let s of this.propertyVectors){if(!s)continue;let a=s.name,c=s.getValue(i);c!==null&&(o[a]=c)}t.push({id:r,geometry:n,properties:o})}return t}containsMaxSafeIntegerValues(t){return t instanceof ka||t instanceof Ba||t instanceof Fa||t instanceof La}}class Dh{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}}var ut,Ni;(function(t){t.NONE="NONE",t.DELTA="DELTA",t.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",t.RLE="RLE",t.MORTON="MORTON",t.PDE="PDE"})(ut||(ut={})),function(t){t.NONE="NONE",t.FAST_PFOR="FAST_PFOR",t.VARINT="VARINT",t.ALP="ALP"}(Ni||(Ni={}));let Rh=new Uint32Array(33);Rh[0]=0;for(let t=1;t<=32;t++)Rh[t]=t===32?4294967295:4294967295>>>32-t;let kh=Rh,Ei=256;function Lh(t,e){return t-t%e}function qx(t){let e=t>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}let Fh=function(){if(!Number.isFinite(65536))return 65536;let t=Lh(Math.floor(65536),Ei);return t===0?Ei:t}(),Wx=3*Fh/Ei+Fh|0;function n_(){let t=new Uint8Array(Wx);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Hx(t,e,i,r,n){switch(n){case 1:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0;a[l++]=p>>>0&1,a[l++]=p>>>1&1,a[l++]=p>>>2&1,a[l++]=p>>>3&1,a[l++]=p>>>4&1,a[l++]=p>>>5&1,a[l++]=p>>>6&1,a[l++]=p>>>7&1,a[l++]=p>>>8&1,a[l++]=p>>>9&1,a[l++]=p>>>10&1,a[l++]=p>>>11&1,a[l++]=p>>>12&1,a[l++]=p>>>13&1,a[l++]=p>>>14&1,a[l++]=p>>>15&1,a[l++]=p>>>16&1,a[l++]=p>>>17&1,a[l++]=p>>>18&1,a[l++]=p>>>19&1,a[l++]=p>>>20&1,a[l++]=p>>>21&1,a[l++]=p>>>22&1,a[l++]=p>>>23&1,a[l++]=p>>>24&1,a[l++]=p>>>25&1,a[l++]=p>>>26&1,a[l++]=p>>>27&1,a[l++]=p>>>28&1,a[l++]=p>>>29&1,a[l++]=p>>>30&1,a[l++]=p>>>31&1}})(t,e,i,r);break;case 2:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0;a[l++]=p>>>0&3,a[l++]=p>>>2&3,a[l++]=p>>>4&3,a[l++]=p>>>6&3,a[l++]=p>>>8&3,a[l++]=p>>>10&3,a[l++]=p>>>12&3,a[l++]=p>>>14&3,a[l++]=p>>>16&3,a[l++]=p>>>18&3,a[l++]=p>>>20&3,a[l++]=p>>>22&3,a[l++]=p>>>24&3,a[l++]=p>>>26&3,a[l++]=p>>>28&3,a[l++]=p>>>30&3,a[l++]=d>>>0&3,a[l++]=d>>>2&3,a[l++]=d>>>4&3,a[l++]=d>>>6&3,a[l++]=d>>>8&3,a[l++]=d>>>10&3,a[l++]=d>>>12&3,a[l++]=d>>>14&3,a[l++]=d>>>16&3,a[l++]=d>>>18&3,a[l++]=d>>>20&3,a[l++]=d>>>22&3,a[l++]=d>>>24&3,a[l++]=d>>>26&3,a[l++]=d>>>28&3,a[l++]=d>>>30&3}})(t,e,i,r);break;case 3:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0;a[l++]=p>>>0&7,a[l++]=p>>>3&7,a[l++]=p>>>6&7,a[l++]=p>>>9&7,a[l++]=p>>>12&7,a[l++]=p>>>15&7,a[l++]=p>>>18&7,a[l++]=p>>>21&7,a[l++]=p>>>24&7,a[l++]=p>>>27&7,a[l++]=7&(p>>>30|(1&d)<<2),a[l++]=d>>>1&7,a[l++]=d>>>4&7,a[l++]=d>>>7&7,a[l++]=d>>>10&7,a[l++]=d>>>13&7,a[l++]=d>>>16&7,a[l++]=d>>>19&7,a[l++]=d>>>22&7,a[l++]=d>>>25&7,a[l++]=d>>>28&7,a[l++]=7&(d>>>31|(3&f)<<1),a[l++]=f>>>2&7,a[l++]=f>>>5&7,a[l++]=f>>>8&7,a[l++]=f>>>11&7,a[l++]=f>>>14&7,a[l++]=f>>>17&7,a[l++]=f>>>20&7,a[l++]=f>>>23&7,a[l++]=f>>>26&7,a[l++]=f>>>29&7}})(t,e,i,r);break;case 4:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0;a[l++]=p>>>0&15,a[l++]=p>>>4&15,a[l++]=p>>>8&15,a[l++]=p>>>12&15,a[l++]=p>>>16&15,a[l++]=p>>>20&15,a[l++]=p>>>24&15,a[l++]=p>>>28&15,a[l++]=d>>>0&15,a[l++]=d>>>4&15,a[l++]=d>>>8&15,a[l++]=d>>>12&15,a[l++]=d>>>16&15,a[l++]=d>>>20&15,a[l++]=d>>>24&15,a[l++]=d>>>28&15,a[l++]=f>>>0&15,a[l++]=f>>>4&15,a[l++]=f>>>8&15,a[l++]=f>>>12&15,a[l++]=f>>>16&15,a[l++]=f>>>20&15,a[l++]=f>>>24&15,a[l++]=f>>>28&15,a[l++]=m>>>0&15,a[l++]=m>>>4&15,a[l++]=m>>>8&15,a[l++]=m>>>12&15,a[l++]=m>>>16&15,a[l++]=m>>>20&15,a[l++]=m>>>24&15,a[l++]=m>>>28&15}})(t,e,i,r);break;case 5:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0;a[l++]=p>>>0&31,a[l++]=p>>>5&31,a[l++]=p>>>10&31,a[l++]=p>>>15&31,a[l++]=p>>>20&31,a[l++]=p>>>25&31,a[l++]=31&(p>>>30|(7&d)<<2),a[l++]=d>>>3&31,a[l++]=d>>>8&31,a[l++]=d>>>13&31,a[l++]=d>>>18&31,a[l++]=d>>>23&31,a[l++]=31&(d>>>28|(1&f)<<4),a[l++]=f>>>1&31,a[l++]=f>>>6&31,a[l++]=f>>>11&31,a[l++]=f>>>16&31,a[l++]=f>>>21&31,a[l++]=f>>>26&31,a[l++]=31&(f>>>31|(15&m)<<1),a[l++]=m>>>4&31,a[l++]=m>>>9&31,a[l++]=m>>>14&31,a[l++]=m>>>19&31,a[l++]=m>>>24&31,a[l++]=31&(m>>>29|(3&_)<<3),a[l++]=_>>>2&31,a[l++]=_>>>7&31,a[l++]=_>>>12&31,a[l++]=_>>>17&31,a[l++]=_>>>22&31,a[l++]=_>>>27&31}})(t,e,i,r);break;case 6:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0,y=o[u++]>>>0;a[l++]=p>>>0&63,a[l++]=p>>>6&63,a[l++]=p>>>12&63,a[l++]=p>>>18&63,a[l++]=p>>>24&63,a[l++]=63&(p>>>30|(15&d)<<2),a[l++]=d>>>4&63,a[l++]=d>>>10&63,a[l++]=d>>>16&63,a[l++]=d>>>22&63,a[l++]=63&(d>>>28|(3&f)<<4),a[l++]=f>>>2&63,a[l++]=f>>>8&63,a[l++]=f>>>14&63,a[l++]=f>>>20&63,a[l++]=f>>>26&63,a[l++]=m>>>0&63,a[l++]=m>>>6&63,a[l++]=m>>>12&63,a[l++]=m>>>18&63,a[l++]=m>>>24&63,a[l++]=63&(m>>>30|(15&_)<<2),a[l++]=_>>>4&63,a[l++]=_>>>10&63,a[l++]=_>>>16&63,a[l++]=_>>>22&63,a[l++]=63&(_>>>28|(3&y)<<4),a[l++]=y>>>2&63,a[l++]=y>>>8&63,a[l++]=y>>>14&63,a[l++]=y>>>20&63,a[l++]=y>>>26&63}})(t,e,i,r);break;case 7:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0,y=o[u++]>>>0,v=o[u++]>>>0;a[l++]=p>>>0&127,a[l++]=p>>>7&127,a[l++]=p>>>14&127,a[l++]=p>>>21&127,a[l++]=127&(p>>>28|(7&d)<<4),a[l++]=d>>>3&127,a[l++]=d>>>10&127,a[l++]=d>>>17&127,a[l++]=d>>>24&127,a[l++]=127&(d>>>31|(63&f)<<1),a[l++]=f>>>6&127,a[l++]=f>>>13&127,a[l++]=f>>>20&127,a[l++]=127&(f>>>27|(3&m)<<5),a[l++]=m>>>2&127,a[l++]=m>>>9&127,a[l++]=m>>>16&127,a[l++]=m>>>23&127,a[l++]=127&(m>>>30|(31&_)<<2),a[l++]=_>>>5&127,a[l++]=_>>>12&127,a[l++]=_>>>19&127,a[l++]=127&(_>>>26|(1&y)<<6),a[l++]=y>>>1&127,a[l++]=y>>>8&127,a[l++]=y>>>15&127,a[l++]=y>>>22&127,a[l++]=127&(y>>>29|(15&v)<<3),a[l++]=v>>>4&127,a[l++]=v>>>11&127,a[l++]=v>>>18&127,a[l++]=v>>>25&127}})(t,e,i,r);break;case 8:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<8;h++){let p=o[u++]>>>0,d=o[u++]>>>0,f=o[u++]>>>0,m=o[u++]>>>0,_=o[u++]>>>0,y=o[u++]>>>0,v=o[u++]>>>0,g=o[u++]>>>0;a[l++]=p>>>0&255,a[l++]=p>>>8&255,a[l++]=p>>>16&255,a[l++]=p>>>24&255,a[l++]=d>>>0&255,a[l++]=d>>>8&255,a[l++]=d>>>16&255,a[l++]=d>>>24&255,a[l++]=f>>>0&255,a[l++]=f>>>8&255,a[l++]=f>>>16&255,a[l++]=f>>>24&255,a[l++]=m>>>0&255,a[l++]=m>>>8&255,a[l++]=m>>>16&255,a[l++]=m>>>24&255,a[l++]=_>>>0&255,a[l++]=_>>>8&255,a[l++]=_>>>16&255,a[l++]=_>>>24&255,a[l++]=y>>>0&255,a[l++]=y>>>8&255,a[l++]=y>>>16&255,a[l++]=y>>>24&255,a[l++]=v>>>0&255,a[l++]=v>>>8&255,a[l++]=v>>>16&255,a[l++]=v>>>24&255,a[l++]=g>>>0&255,a[l++]=g>>>8&255,a[l++]=g>>>16&255,a[l++]=g>>>24&255}})(t,e,i,r);break;case 16:(function(o,s,a,c){let l=c,u=s;for(let h=0;h<128;h++){let p=o[u++]>>>0;a[l++]=65535&p,a[l++]=p>>>16&65535}})(t,e,i,r);break;default:(function(o,s,a,c,l){let u=kh[l]>>>0,h=s,p=0,d=o[h]>>>0,f=c;for(let m=0;m<8;m++){for(let _=0;_<32;_++)if(p+l<=32)a[f+_]=d>>>p&u,p+=l,p===32&&(p=0,h++,_!==31&&(d=o[h]>>>0));else{let y=32-p,v=d>>>p;h++,d=o[h]>>>0;let g=l-y;a[f+_]=(v|(d&-1>>>32-g>>>0)<<y)&u,p=g}f+=32,p=0,m<7&&(d=o[h]>>>0)}})(t,e,i,r,n)}return e+(n<<3)|0}function Xx(t,e,i,r){if(i+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);let n=t[i++],o=t[i++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:o,bytePosIn:i}}function Yx(t,e,i,r,n,o,s,a,c){let{maxBits:l,exceptionBitWidth:u,bytePosIn:h}=function(_,y,v,g,x,b){if(v+1>y)throw Error(`FastPFOR decode: exception header underflow at block=${b} (need 1 byte for maxBits, bytePos=${v}, byteSize=${y})`);let w=_[v++];if(w<g||w>32)throw Error(`FastPFOR decode: invalid maxBits=${w} at block=${b} (bitWidth=${g}, expected ${g}..32)`);let T=w-g|0;if(T<1||T>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${T} at block=${b} (bitWidth=${g}, maxBits=${w})`);if(v+x>y)throw Error(`FastPFOR decode: exception positions underflow at block=${b} (need=${x}, have=${y-v})`);return{maxBits:w,exceptionBitWidth:T,bytePosIn:v}}(n,o,s,i,r,c);if(s=h,u===1){let _=1<<i;for(let y=0;y<r;y=y+1|0)t[n[s++]+e|0]|=_;return s}let p=a.dataToBePacked[u];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${u} (bitWidth=${i}, maxBits=${l}) at block ${c}`);let d=a.dataPointers,f=0|d[u],m=0|a.exceptionSizes[u];if(f+r>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${u} (ptr=${f}, need ${r}, size=${m}) at block ${c}`);for(let _=0;_<r;_=_+1|0){let y=n[s++],v=0|p[f++];t[y+e|0]|=v<<i}return d[u]=f,s}function Kx(t,e,i,r,n,o){let s=0|i,a=0|t[s];if(a<=0||s+a>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${a} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let c=s+1|0,l=s+a|0,u=t[l]>>>0,h=u+3>>>2,p=l+1,d=p+h;if(d>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${u} (metaInts=${h}, pageStart=${s}, packedEnd=${l}, byteContainerStart=${p}) causes bitmapPos=${d} out of bounds (encoded.length=${t.length})`);let f=function(y,v,g,x){x.byteContainer.length<g&&(x.byteContainer=new Uint8Array(2*g),x.byteContainerI32=void 0);let b=x.byteContainer,w=g>>>2;if(3&b.byteOffset)for(let P=0;P<w;P=P+1|0){let S=0|y[v+P|0],E=P<<2;b[E]=255&S,b[E+1|0]=S>>>8&255,b[E+2|0]=S>>>16&255,b[E+3|0]=S>>>24&255}else{let P=x.byteContainerI32;(!P||P.buffer!==b.buffer||P.byteOffset!==b.byteOffset||P.length<w)&&(P=x.byteContainerI32=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>>2)),P.set(y.subarray(v,v+w))}let T=3&g;if(T>0){let P=0|y[v+w|0],S=w<<2;for(let E=0;E<T;E=E+1|0)b[S+E|0]=P>>>(E<<3)&255}return b}(t,p,u,o),m=u,_=function(y,v,g){let x=0|y[v++],b=g.dataToBePacked;for(let w=2;w<=32;w=w+1|0){if(!(x>>>w-1&1))continue;if(v>=y.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${w}, streamWordIndex=${v}, needWords=1, availableWords=${y.length-v}, encodedWords=${y.length})`);let T=y[v++]>>>0,P=Lh(T+31,32),S=T*w+31>>>5;if(v+S>y.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${w}, size=${T}, streamWordIndex=${v}, needWords=${S}, availableWords=${y.length-v}, encodedWords=${y.length})`);let E=b[w];(!E||E.length<P)&&(E=b[w]=new Uint32Array(P));let I=0;for(;I<T;I=I+32|0)Jx(y,v,E,I,w),v=v+w|0;v=v-((I-T|0)*w>>>5)|0,g.exceptionSizes[w]=T}return v}(t,d,o);return o.dataPointers.fill(0),function(y,v,g,x,b,w,T,P,S,E){let I=0|g,C=0;for(let A=0;A<T;A=A+1|0){let M=Xx(P,S,C,A);C=M.bytePosIn;let{bitWidth:k,exceptionCount:L}=M,O=w+A*Ei|0;switch(k){case 0:b.fill(0,O,O+Ei);break;case 32:for(let q=0;q<Ei;q=q+1|0)b[O+q|0]=0|y[I+q|0];I=I+Ei|0;break;default:I=Hx(y,I,b,O,k)}L>0&&(C=Yx(b,O,k,L,P,S,C,E,A))}if(I!==x)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${v}, packedStart=${g}, consumedPackedEnd=${I}, expectedPackedEnd=${x}, packedWords=${x-g}, encoded.length=${y.length})`)}(t,s,c,l,e,0|r,n/Ei|0,f,m,o),_}function Jx(t,e,i,r,n){switch(n){case 2:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0;h[d++]=f>>>0&3,h[d++]=f>>>2&3,h[d++]=f>>>4&3,h[d++]=f>>>6&3,h[d++]=f>>>8&3,h[d++]=f>>>10&3,h[d++]=f>>>12&3,h[d++]=f>>>14&3,h[d++]=f>>>16&3,h[d++]=f>>>18&3,h[d++]=f>>>20&3,h[d++]=f>>>22&3,h[d++]=f>>>24&3,h[d++]=f>>>26&3,h[d++]=f>>>28&3,h[d++]=f>>>30&3,h[d++]=m>>>0&3,h[d++]=m>>>2&3,h[d++]=m>>>4&3,h[d++]=m>>>6&3,h[d++]=m>>>8&3,h[d++]=m>>>10&3,h[d++]=m>>>12&3,h[d++]=m>>>14&3,h[d++]=m>>>16&3,h[d++]=m>>>18&3,h[d++]=m>>>20&3,h[d++]=m>>>22&3,h[d++]=m>>>24&3,h[d++]=m>>>26&3,h[d++]=m>>>28&3,h[d]=m>>>30&3}(t,e,i,r);case 3:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0;h[d++]=f>>>0&7,h[d++]=f>>>3&7,h[d++]=f>>>6&7,h[d++]=f>>>9&7,h[d++]=f>>>12&7,h[d++]=f>>>15&7,h[d++]=f>>>18&7,h[d++]=f>>>21&7,h[d++]=f>>>24&7,h[d++]=f>>>27&7,h[d++]=7&(f>>>30|(1&m)<<2),h[d++]=m>>>1&7,h[d++]=m>>>4&7,h[d++]=m>>>7&7,h[d++]=m>>>10&7,h[d++]=m>>>13&7,h[d++]=m>>>16&7,h[d++]=m>>>19&7,h[d++]=m>>>22&7,h[d++]=m>>>25&7,h[d++]=m>>>28&7,h[d++]=7&(m>>>31|(3&_)<<1),h[d++]=_>>>2&7,h[d++]=_>>>5&7,h[d++]=_>>>8&7,h[d++]=_>>>11&7,h[d++]=_>>>14&7,h[d++]=_>>>17&7,h[d++]=_>>>20&7,h[d++]=_>>>23&7,h[d++]=_>>>26&7,h[d]=_>>>29&7}(t,e,i,r);case 4:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0;h[d++]=f>>>0&15,h[d++]=f>>>4&15,h[d++]=f>>>8&15,h[d++]=f>>>12&15,h[d++]=f>>>16&15,h[d++]=f>>>20&15,h[d++]=f>>>24&15,h[d++]=f>>>28&15,h[d++]=m>>>0&15,h[d++]=m>>>4&15,h[d++]=m>>>8&15,h[d++]=m>>>12&15,h[d++]=m>>>16&15,h[d++]=m>>>20&15,h[d++]=m>>>24&15,h[d++]=m>>>28&15,h[d++]=_>>>0&15,h[d++]=_>>>4&15,h[d++]=_>>>8&15,h[d++]=_>>>12&15,h[d++]=_>>>16&15,h[d++]=_>>>20&15,h[d++]=_>>>24&15,h[d++]=_>>>28&15,h[d++]=y>>>0&15,h[d++]=y>>>4&15,h[d++]=y>>>8&15,h[d++]=y>>>12&15,h[d++]=y>>>16&15,h[d++]=y>>>20&15,h[d++]=y>>>24&15,h[d]=y>>>28&15}(t,e,i,r);case 5:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0;h[d++]=f>>>0&31,h[d++]=f>>>5&31,h[d++]=f>>>10&31,h[d++]=f>>>15&31,h[d++]=f>>>20&31,h[d++]=f>>>25&31,h[d++]=31&(f>>>30|(7&m)<<2),h[d++]=m>>>3&31,h[d++]=m>>>8&31,h[d++]=m>>>13&31,h[d++]=m>>>18&31,h[d++]=m>>>23&31,h[d++]=31&(m>>>28|(1&_)<<4),h[d++]=_>>>1&31,h[d++]=_>>>6&31,h[d++]=_>>>11&31,h[d++]=_>>>16&31,h[d++]=_>>>21&31,h[d++]=_>>>26&31,h[d++]=31&(_>>>31|(15&y)<<1),h[d++]=y>>>4&31,h[d++]=y>>>9&31,h[d++]=y>>>14&31,h[d++]=y>>>19&31,h[d++]=y>>>24&31,h[d++]=31&(y>>>29|(3&v)<<3),h[d++]=v>>>2&31,h[d++]=v>>>7&31,h[d++]=v>>>12&31,h[d++]=v>>>17&31,h[d++]=v>>>22&31,h[d]=v>>>27&31}(t,e,i,r);case 6:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0;h[d++]=f>>>0&63,h[d++]=f>>>6&63,h[d++]=f>>>12&63,h[d++]=f>>>18&63,h[d++]=f>>>24&63,h[d++]=63&(f>>>30|(15&m)<<2),h[d++]=m>>>4&63,h[d++]=m>>>10&63,h[d++]=m>>>16&63,h[d++]=m>>>22&63,h[d++]=63&(m>>>28|(3&_)<<4),h[d++]=_>>>2&63,h[d++]=_>>>8&63,h[d++]=_>>>14&63,h[d++]=_>>>20&63,h[d++]=_>>>26&63,h[d++]=y>>>0&63,h[d++]=y>>>6&63,h[d++]=y>>>12&63,h[d++]=y>>>18&63,h[d++]=y>>>24&63,h[d++]=63&(y>>>30|(15&v)<<2),h[d++]=v>>>4&63,h[d++]=v>>>10&63,h[d++]=v>>>16&63,h[d++]=v>>>22&63,h[d++]=63&(v>>>28|(3&g)<<4),h[d++]=g>>>2&63,h[d++]=g>>>8&63,h[d++]=g>>>14&63,h[d++]=g>>>20&63,h[d]=g>>>26&63}(t,e,i,r);case 7:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0;h[d++]=f>>>0&127,h[d++]=f>>>7&127,h[d++]=f>>>14&127,h[d++]=f>>>21&127,h[d++]=127&(f>>>28|(7&m)<<4),h[d++]=m>>>3&127,h[d++]=m>>>10&127,h[d++]=m>>>17&127,h[d++]=m>>>24&127,h[d++]=127&(m>>>31|(63&_)<<1),h[d++]=_>>>6&127,h[d++]=_>>>13&127,h[d++]=_>>>20&127,h[d++]=127&(_>>>27|(3&y)<<5),h[d++]=y>>>2&127,h[d++]=y>>>9&127,h[d++]=y>>>16&127,h[d++]=y>>>23&127,h[d++]=127&(y>>>30|(31&v)<<2),h[d++]=v>>>5&127,h[d++]=v>>>12&127,h[d++]=v>>>19&127,h[d++]=127&(v>>>26|(1&g)<<6),h[d++]=g>>>1&127,h[d++]=g>>>8&127,h[d++]=g>>>15&127,h[d++]=g>>>22&127,h[d++]=127&(g>>>29|(15&x)<<3),h[d++]=x>>>4&127,h[d++]=x>>>11&127,h[d++]=x>>>18&127,h[d]=x>>>25&127}(t,e,i,r);case 8:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0;h[d++]=f>>>0&255,h[d++]=f>>>8&255,h[d++]=f>>>16&255,h[d++]=f>>>24&255,h[d++]=m>>>0&255,h[d++]=m>>>8&255,h[d++]=m>>>16&255,h[d++]=m>>>24&255,h[d++]=_>>>0&255,h[d++]=_>>>8&255,h[d++]=_>>>16&255,h[d++]=_>>>24&255,h[d++]=y>>>0&255,h[d++]=y>>>8&255,h[d++]=y>>>16&255,h[d++]=y>>>24&255,h[d++]=v>>>0&255,h[d++]=v>>>8&255,h[d++]=v>>>16&255,h[d++]=v>>>24&255,h[d++]=g>>>0&255,h[d++]=g>>>8&255,h[d++]=g>>>16&255,h[d++]=g>>>24&255,h[d++]=x>>>0&255,h[d++]=x>>>8&255,h[d++]=x>>>16&255,h[d++]=x>>>24&255,h[d++]=b>>>0&255,h[d++]=b>>>8&255,h[d++]=b>>>16&255,h[d]=b>>>24&255}(t,e,i,r);case 9:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0;h[d++]=f>>>0&511,h[d++]=f>>>9&511,h[d++]=f>>>18&511,h[d++]=511&(f>>>27|(15&m)<<5),h[d++]=m>>>4&511,h[d++]=m>>>13&511,h[d++]=m>>>22&511,h[d++]=511&(m>>>31|(255&_)<<1),h[d++]=_>>>8&511,h[d++]=_>>>17&511,h[d++]=511&(_>>>26|(7&y)<<6),h[d++]=y>>>3&511,h[d++]=y>>>12&511,h[d++]=y>>>21&511,h[d++]=511&(y>>>30|(127&v)<<2),h[d++]=v>>>7&511,h[d++]=v>>>16&511,h[d++]=511&(v>>>25|(3&g)<<7),h[d++]=g>>>2&511,h[d++]=g>>>11&511,h[d++]=g>>>20&511,h[d++]=511&(g>>>29|(63&x)<<3),h[d++]=x>>>6&511,h[d++]=x>>>15&511,h[d++]=511&(x>>>24|(1&b)<<8),h[d++]=b>>>1&511,h[d++]=b>>>10&511,h[d++]=b>>>19&511,h[d++]=511&(b>>>28|(31&w)<<4),h[d++]=w>>>5&511,h[d++]=w>>>14&511,h[d]=w>>>23&511}(t,e,i,r);case 10:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0;h[d++]=f>>>0&1023,h[d++]=f>>>10&1023,h[d++]=f>>>20&1023,h[d++]=1023&(f>>>30|(255&m)<<2),h[d++]=m>>>8&1023,h[d++]=m>>>18&1023,h[d++]=1023&(m>>>28|(63&_)<<4),h[d++]=_>>>6&1023,h[d++]=_>>>16&1023,h[d++]=1023&(_>>>26|(15&y)<<6),h[d++]=y>>>4&1023,h[d++]=y>>>14&1023,h[d++]=1023&(y>>>24|(3&v)<<8),h[d++]=v>>>2&1023,h[d++]=v>>>12&1023,h[d++]=v>>>22&1023,h[d++]=g>>>0&1023,h[d++]=g>>>10&1023,h[d++]=g>>>20&1023,h[d++]=1023&(g>>>30|(255&x)<<2),h[d++]=x>>>8&1023,h[d++]=x>>>18&1023,h[d++]=1023&(x>>>28|(63&b)<<4),h[d++]=b>>>6&1023,h[d++]=b>>>16&1023,h[d++]=1023&(b>>>26|(15&w)<<6),h[d++]=w>>>4&1023,h[d++]=w>>>14&1023,h[d++]=1023&(w>>>24|(3&T)<<8),h[d++]=T>>>2&1023,h[d++]=T>>>12&1023,h[d]=T>>>22&1023}(t,e,i,r);case 11:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0,P=l[u+10]>>>0;h[d++]=f>>>0&2047,h[d++]=f>>>11&2047,h[d++]=2047&(f>>>22|(1&m)<<10),h[d++]=m>>>1&2047,h[d++]=m>>>12&2047,h[d++]=2047&(m>>>23|(3&_)<<9),h[d++]=_>>>2&2047,h[d++]=_>>>13&2047,h[d++]=2047&(_>>>24|(7&y)<<8),h[d++]=y>>>3&2047,h[d++]=y>>>14&2047,h[d++]=2047&(y>>>25|(15&v)<<7),h[d++]=v>>>4&2047,h[d++]=v>>>15&2047,h[d++]=2047&(v>>>26|(31&g)<<6),h[d++]=g>>>5&2047,h[d++]=g>>>16&2047,h[d++]=2047&(g>>>27|(63&x)<<5),h[d++]=x>>>6&2047,h[d++]=x>>>17&2047,h[d++]=2047&(x>>>28|(127&b)<<4),h[d++]=b>>>7&2047,h[d++]=b>>>18&2047,h[d++]=2047&(b>>>29|(255&w)<<3),h[d++]=w>>>8&2047,h[d++]=w>>>19&2047,h[d++]=2047&(w>>>30|(511&T)<<2),h[d++]=T>>>9&2047,h[d++]=T>>>20&2047,h[d++]=2047&(T>>>31|(1023&P)<<1),h[d++]=P>>>10&2047,h[d]=P>>>21&2047}(t,e,i,r);case 12:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0,P=l[u+10]>>>0,S=l[u+11]>>>0;h[d++]=f>>>0&4095,h[d++]=f>>>12&4095,h[d++]=4095&(f>>>24|(15&m)<<8),h[d++]=m>>>4&4095,h[d++]=m>>>16&4095,h[d++]=4095&(m>>>28|(255&_)<<4),h[d++]=_>>>8&4095,h[d++]=_>>>20&4095,h[d++]=y>>>0&4095,h[d++]=y>>>12&4095,h[d++]=4095&(y>>>24|(15&v)<<8),h[d++]=v>>>4&4095,h[d++]=v>>>16&4095,h[d++]=4095&(v>>>28|(255&g)<<4),h[d++]=g>>>8&4095,h[d++]=g>>>20&4095,h[d++]=x>>>0&4095,h[d++]=x>>>12&4095,h[d++]=4095&(x>>>24|(15&b)<<8),h[d++]=b>>>4&4095,h[d++]=b>>>16&4095,h[d++]=4095&(b>>>28|(255&w)<<4),h[d++]=w>>>8&4095,h[d++]=w>>>20&4095,h[d++]=T>>>0&4095,h[d++]=T>>>12&4095,h[d++]=4095&(T>>>24|(15&P)<<8),h[d++]=P>>>4&4095,h[d++]=P>>>16&4095,h[d++]=4095&(P>>>28|(255&S)<<4),h[d++]=S>>>8&4095,h[d]=S>>>20&4095}(t,e,i,r);case 16:return void function(l,u,h,p){let d=p,f=l[u]>>>0,m=l[u+1]>>>0,_=l[u+2]>>>0,y=l[u+3]>>>0,v=l[u+4]>>>0,g=l[u+5]>>>0,x=l[u+6]>>>0,b=l[u+7]>>>0,w=l[u+8]>>>0,T=l[u+9]>>>0,P=l[u+10]>>>0,S=l[u+11]>>>0,E=l[u+12]>>>0,I=l[u+13]>>>0,C=l[u+14]>>>0,A=l[u+15]>>>0;h[d++]=f>>>0&65535,h[d++]=f>>>16&65535,h[d++]=m>>>0&65535,h[d++]=m>>>16&65535,h[d++]=_>>>0&65535,h[d++]=_>>>16&65535,h[d++]=y>>>0&65535,h[d++]=y>>>16&65535,h[d++]=v>>>0&65535,h[d++]=v>>>16&65535,h[d++]=g>>>0&65535,h[d++]=g>>>16&65535,h[d++]=x>>>0&65535,h[d++]=x>>>16&65535,h[d++]=b>>>0&65535,h[d++]=b>>>16&65535,h[d++]=w>>>0&65535,h[d++]=w>>>16&65535,h[d++]=T>>>0&65535,h[d++]=T>>>16&65535,h[d++]=P>>>0&65535,h[d++]=P>>>16&65535,h[d++]=S>>>0&65535,h[d++]=S>>>16&65535,h[d++]=E>>>0&65535,h[d++]=E>>>16&65535,h[d++]=I>>>0&65535,h[d++]=I>>>16&65535,h[d++]=C>>>0&65535,h[d++]=C>>>16&65535,h[d++]=A>>>0&65535,h[d]=A>>>16&65535}(t,e,i,r);case 32:for(let l=0;l<32;l=l+1|0)i[r+l|0]=0|t[e+l|0];return}let o=kh[n]>>>0,s=e,a=0,c=t[s]>>>0;for(let l=0;l<32;l++)if(a+n<=32)i[r+l]=c>>>a&o,a+=n,a===32&&(a=0,s++,l!==31&&(c=t[s]>>>0));else{let u=32-a,h=c>>>a;s++,c=t[s]>>>0,i[r+l]=(h|(c&kh[n-u]>>>0)<<u)&o,a=n-u}}function ae(t,e,i){let r=new Uint32Array(i),n=0,o=e.get();for(let s=0;s<r.length;s++){let a=t[o++],c=127&a;a<128||(a=t[o++],c|=(127&a)<<7,a<128||(a=t[o++],c|=(127&a)<<14,a<128||(a=t[o++],c|=(127&a)<<21,a<128||(a=t[o++],c|=(15&a)<<28)))),r[n++]=c}return e.set(o),r}function ln(t,e,i){let r=new BigUint64Array(i);for(let n=0;n<r.length;n++)r[n]=Qx(t,e);return r}function Qx(t,e){let i=0n,r=0,n=e.get();for(;n<t.length;){let o=t[n++];if(i|=BigInt(127&o)<<BigInt(r),!(128&o))break;if(r+=7,r>=64)throw Error("Varint too long")}return e.set(n),i}function t1(t,e){let i,r;return r=t[e.get()],e.increment(),i=127&r,r<128?i:(r=t[e.get()],e.increment(),i|=(127&r)<<7,r<128?i:(r=t[e.get()],e.increment(),i|=(127&r)<<14,r<128?i:(r=t[e.get()],e.increment(),i|=(127&r)<<21,r<128?i:(r=t[e.get()],i|=(15&r)<<28,function(n,o,s){let a,c;if(c=o[s.get()],s.increment(),a=(112&c)>>4,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<3,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<10,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<17,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(127&c)<<24,c<128)return 4294967296*a+(n>>>0);if(c=o[s.get()],s.increment(),a|=(1&c)<<31,c<128)return 4294967296*a+(n>>>0);throw Error("Expected varint not more than 10 bytes")}(i,t,e)))))}function Tt(t){return t>>>1^-(1&t)}function ue(t){return t>>1n^-(1n&t)}function cn(t){return t%2==1?(t+1)/-2:t/2}function Bh(t,e,i){if(i===void 0){i=0;for(let o=0;o<e;o++)i+=t[o]}let r=new Uint32Array(i),n=0;for(let o=0;o<e;o++){let s=t[o];r.fill(t[o+e],n,n+s),n+=s}return r}function Oh(t,e,i){if(i===void 0){i=0;for(let o=0;o<e;o++)i+=Number(t[o])}let r=new BigUint64Array(i),n=0;for(let o=0;o<e;o++){let s=Number(t[o]);r.fill(t[o+e],n,n+s),n+=s}return r}function o_(t,e,i){let r=new Float64Array(i),n=0;for(let o=0;o<e;o++){let s=t[o];r.fill(t[o+e],n,n+s),n+=s}return r}function s_(t){let e=new Int32Array(t.length);e[0]=Tt(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let n=t[r+1],o=t[r+2],s=t[r+3];e[r]=Tt(t[r])+e[r-1],e[r+1]=Tt(n)+e[r],e[r+2]=Tt(o)+e[r+1],e[r+3]=Tt(s)+e[r+2]}for(;r!==t.length;++r)e[r]=Tt(t[r])+e[r-1];return e}function a_(t){let e=new BigInt64Array(t.length);e[0]=ue(t[0]);let i=t.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let n=t[r+1],o=t[r+2],s=t[r+3];e[r]=ue(t[r])+e[r-1],e[r+1]=ue(n)+e[r],e[r+2]=ue(o)+e[r+1],e[r+3]=ue(s)+e[r+2]}for(;r!==e.length;++r)e[r]=ue(t[r])+e[r-1];return e}function jh(t){let e=t.length/4*4,i=1;if(e>=4)for(let r=t[0];i<e-4;i+=4)r=t[i]+=r,r=t[i+1]+=r,r=t[i+2]+=r,r=t[i+3]+=r;for(;i!==t.length;)t[i]+=t[i-1],++i}var ie,ri,mr,Pe,Mt,Xt,l_,Vi;function de(t,e){let i=function(r,n){let o=r[n.get()],s=Object.values(ie)[o>>4],a=null;switch(s){case ie.DATA:a={dictionaryType:Object.values(ri)[15&o]};break;case ie.OFFSET:a={offsetType:Object.values(mr)[15&o]};break;case ie.LENGTH:a={lengthType:Object.values(Pe)[15&o]}}n.increment();let c=r[n.get()],l=Object.values(ut)[c>>5],u=Object.values(ut)[c>>2&7],h=Object.values(Ni)[3&c];n.increment();let p=ae(r,n,2),d=p[0];return{physicalStreamType:s,logicalStreamType:a,logicalLevelTechnique1:l,logicalLevelTechnique2:u,physicalLevelTechnique:h,numValues:d,byteLength:p[1],decompressedCount:d}}(t,e);return i.logicalLevelTechnique1===ut.MORTON?function(r,n,o){let s=ae(n,o,2);return{physicalStreamType:r.physicalStreamType,logicalStreamType:r.logicalStreamType,logicalLevelTechnique1:r.logicalLevelTechnique1,logicalLevelTechnique2:r.logicalLevelTechnique2,physicalLevelTechnique:r.physicalLevelTechnique,numValues:r.numValues,byteLength:r.byteLength,decompressedCount:r.decompressedCount,numBits:s[0],coordinateShift:s[1]}}(i,t,e):ut.RLE!==i.logicalLevelTechnique1&&ut.RLE!==i.logicalLevelTechnique2||Ni.NONE===i.physicalLevelTechnique?i:function(r,n,o){let s=ae(n,o,2);return{physicalStreamType:r.physicalStreamType,logicalStreamType:r.logicalStreamType,logicalLevelTechnique1:r.logicalLevelTechnique1,logicalLevelTechnique2:r.logicalLevelTechnique2,physicalLevelTechnique:r.physicalLevelTechnique,numValues:r.numValues,byteLength:r.byteLength,decompressedCount:s[1],runs:s[0],numRleValues:s[1]}}(i,t,e)}(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(ie||(ie={})),function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"}(ri||(ri={})),function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"}(mr||(mr={})),function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"}(Pe||(Pe={})),function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"}(Mt||(Mt={}));class We{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8);return(this.values[e]>>t%8&1)==1}set(t,e){let i=Math.floor(t/8);this.values[i]=this.values[i]|(e?1:0)<<t%8}getInt(t){let e=Math.floor(t/8);return this.values[e]>>t%8&1}size(){return this._size}getBuffer(){return this.values}}function hn(t,e,i){if(!e)return t;let r=e.size(),n=new t.constructor(r),o=0;for(let s=0;s<r;s++)n[s]=e.get(s)?t[o++]:i;return n}function Nh(t,e,i,r,n){return function(o,s,a,c){let l;switch(s.logicalLevelTechnique1){case ut.DELTA:if(s.logicalLevelTechnique2===ut.RLE){let u=s;if(!c)return function(h,p,d){let f=new Int32Array(d),m=0,_=0;for(let y=0;y<p;y++){let v=h[y],g=Tt(h[y+p]);for(let x=0;x<v;x++)_+=g,f[m++]=_}return f}(o,u.runs,u.numRleValues);l=s_(o=Bh(o,u.runs,u.numRleValues))}else l=s_(o);break;case ut.RLE:l=function(u,h,p){if(p===void 0){p=0;for(let m=0;m<h;m++)p+=u[m]}let d=new Int32Array(p),f=0;for(let m=0;m<h;m++){let _=u[m],y=u[m+h];y=Tt(y),d.fill(y,f,f+_),f+=_}return d}(o,s.runs,s.numRleValues);break;case ut.MORTON:jh(o),l=new Int32Array(o);break;case ut.COMPONENTWISE_DELTA:l=function(u){if(u.length<2)return new Int32Array(u);let h=new Int32Array(u.length);h[0]=Tt(u[0]),h[1]=Tt(u[1]);let p=u.length/4*4,d=2;if(p>=4)for(;d<p-4;d+=4){let f=u[d+1],m=u[d+2],_=u[d+3];h[d]=Tt(u[d])+h[d-2],h[d+1]=Tt(f)+h[d-1],h[d+2]=Tt(m)+h[d],h[d+3]=Tt(_)+h[d+1]}for(;d!==u.length;d+=2)h[d]=Tt(u[d])+h[d-2],h[d+1]=Tt(u[d+1])+h[d-1];return h}(o);break;case ut.NONE:l=function(u){let h=new Int32Array(u.length);for(let p=0;p<u.length;p++)h[p]=Tt(u[p]);return h}(o);break;default:throw Error(`The specified Logical level technique is not supported: ${s.logicalLevelTechnique1}`)}return c?hn(l,c,0):l}(un(t,e,i),i,0,n)}function Ie(t,e,i,r,n){return function(o,s,a,c){let l;switch(s.logicalLevelTechnique1){case ut.DELTA:l=function(u){let h=new Uint32Array(u.length);h[0]=Tt(u[0])>>>0;for(let p=1;p<u.length;p++)h[p]=h[p-1]+Tt(u[p])>>>0;return h}(s.logicalLevelTechnique2===ut.RLE?Bh(o,s.runs,s.numRleValues):o);break;case ut.RLE:l=Bh(o,s.runs,s.numRleValues);break;case ut.MORTON:jh(o),l=o;break;case ut.COMPONENTWISE_DELTA:l=function(u){if(u.length<2)return new Uint32Array(u);let h=new Uint32Array(u.length);h[0]=Tt(u[0])>>>0,h[1]=Tt(u[1])>>>0;for(let p=2;p<u.length;p+=2)h[p]=h[p-2]+Tt(u[p])>>>0,h[p+1]=h[p-1]+Tt(u[p+1])>>>0;return h}(o);break;case ut.NONE:l=o;break;default:throw Error(`The specified Logical level technique is not supported: ${s.logicalLevelTechnique1}`)}return c?hn(l,c,0):l}(un(t,e,i),i,0,n)}function Ui(t,e,i){return function(r,n){if(n.logicalLevelTechnique1===ut.DELTA&&n.logicalLevelTechnique2===ut.NONE)return function(o){let s=new Int32Array(o.length+1);s[0]=0,s[1]=Tt(o[0]);let a=s[1];for(let c=2;c!==s.length;++c)a+=Tt(o[c-1]),s[c]=s[c-1]+a;return new Uint32Array(s)}(r);if(n.logicalLevelTechnique1===ut.RLE&&n.logicalLevelTechnique2===ut.NONE)return function(o,s,a){let c=new Uint32Array(a+1);c[0]=0;let l=1,u=c[0];for(let h=0;h<s;h++){let p=o[h],d=o[h+s];for(let f=l;f<l+p;f++)c[f]=d+u,u=c[f];l+=p}return c}(r,n.runs,n.numRleValues);if(n.logicalLevelTechnique1===ut.NONE&&n.logicalLevelTechnique2===ut.NONE){(function(s){let a=0;for(let c=0;c<s.length;c++)s[c]+=a,a=s[c]})(r);let o=new Uint32Array(n.numValues+1);return o[0]=0,o.set(r,1),o}if(n.logicalLevelTechnique1===ut.DELTA&&n.logicalLevelTechnique2===ut.RLE){let o=function(s,a,c){let l=new Int32Array(c+1);l[0]=0;let u=1,h=l[0];for(let p=0;p<a;p++){let d=s[p],f=s[p+a];f=Tt(f);for(let m=u;m<u+d;m++)l[m]=f+h,h=l[m];u+=d}return l}(r,n.runs,n.numRleValues);return jh(o),new Uint32Array(o)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(un(t,e,i),i)}function un(t,e,i){let r=i.physicalLevelTechnique;switch(r){case Ni.FAST_PFOR:return function(n,o,s,a){return function(c,l,u,h,p){let d=h.get();if(3&u)throw Error(`FastPFOR: invalid encodedByteLength=${u} at offset=${d} (encodedBytes.length=${c.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let f=u>>>2,m=function(y,v){if(v<=y.encodedWords.length)return y.encodedWords;let g=new Uint32Array(Math.max(16,2*v));return y.encodedWords=g,g}(p,f);(function(y,v,g,x){if(v<0||g<0||v+g>y.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${v}, byteLength=${g}, bytes.length=${y.length})`);let b=Math.floor(g/4),w=g%4!=0,T=w?b+1:b;if(x.length<T)throw RangeError(`decodeBigEndianInt32sInto: out.length=${x.length} < ${T}`);if(b>0){let P=y.byteOffset+v;if(3&P)for(let S=0;S<b;S++){let E=v+4*S;x[S]=y[E]<<24|y[E+1]<<16|y[E+2]<<8|y[E+3]}else{let S=new Uint32Array(y.buffer,P,b);for(let E=0;E<b;E++)x[E]=0|qx(S[E])}}if(w){let P=v+4*b,S=g-4*b,E=0;for(let I=0;I<S;I++)E|=y[P+I]<<24-8*I;x[b]=0|E}})(c,d,u,m);let _=function(y,v,g){let x=0,b=0,w=new Uint32Array(v),T=g??n_();if(y.length>0){let P=0|y[x];if(x=x+1|0,255&P)throw Error(`FastPFOR decode: invalid alignedLength=${P} (expected multiple of 256)`);if(b+P>w.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${b}, alignedLength=${P}, out.length=${w.length})`);x=function(S,E,I,C,A,M){let k=C+Lh(A,Ei),L=C,O=I;for(;L!==k;){let q=Math.min(Fh,k-L);O=Kx(S,E,O,L,q,M),L=L+q|0}return O}(y,w,x,b,P,T),b=b+P|0}return function(P,S,E,I,C,A){if(A===0)return S;let M=0,k=S,L=S+E,O=C,q=C,Q=C+A,rt=0,nt=0;for(;k<L&&q<Q;){let lt=P[k]>>>M&255;if(M+=8,k+=M>>>5,M&=31,rt|=(127&lt)<<nt,128&lt)I[q++]=0|rt,rt=0,nt=0;else if(nt+=7,nt>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${nt}, partial=${rt}, decoded=${q-O}/${A}, inPos=${k}, inEnd=${L})`)}if(q!==Q)throw Error(`FastPFOR VByte: truncated stream (decoded=${q-O}, expected=${A}, consumedWords=${k-S}/${E}, vbyteStart=${S}, vbyteEnd=${L})`)}(y,x,y.length-x|0,w,b,v-b|0),w}(m.subarray(0,f),l,p.decoderWorkspace);return h.add(u),_}(n,o,s,a,function(c=16){if(c<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${c}`);let l=Math.max(16,0|c);return{encodedWords:new Uint32Array(l),decoderWorkspace:n_()}}(s>>>2))}(t,i.numValues,i.byteLength,e);case Ni.VARINT:return ae(t,e,i.numValues);case Ni.NONE:{let n=e.get();e.add(i.byteLength);let o=t.subarray(n,e.get());return new Uint32Array(o)}default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function Vh(t,e,i){let r=un(t,e,i);return r.length===1?r[0]:function(n){return n[1]}(r)}function c_(t,e,i){return function(r){if(r.length===2){let n=Tt(r[1]);return[n,n]}return[Tt(r[2]),Tt(r[3])]}(un(t,e,i))}function h_(t,e,i){return function(r){if(r.length===2){let n=ue(r[1]);return[n,n]}return[ue(r[2]),ue(r[3])]}(ln(t,e,i.numValues))}function u_(t,e,i,r){return function(n,o,s){let a;switch(o.logicalLevelTechnique1){case ut.DELTA:a=function(c){let l=new BigUint64Array(c.length);l[0]=BigInt.asUintN(64,ue(c[0]));for(let u=1;u<c.length;u++)l[u]=BigInt.asUintN(64,l[u-1]+ue(c[u]));return l}(o.logicalLevelTechnique2===ut.RLE?Oh(n,o.runs,o.numRleValues):n);break;case ut.RLE:a=Oh(n,o.runs,o.numRleValues);break;case ut.NONE:a=n;break;default:throw Error(`The specified Logical level technique is not supported: ${o.logicalLevelTechnique1}`)}return s?hn(a,s,0n):a}(ln(t,e,i.numValues),i,r)}function d_(t,e,i){let r=ln(t,e,i.numValues);return r.length===1?r[0]:function(n){return n[1]}(r)}function Oa(t,e,i,r,n="int32"){let o=t.logicalLevelTechnique1;if(o===ut.RLE)return t.runs===1?Mt.CONST:Mt.FLAT;if(o!==ut.DELTA||t.logicalLevelTechnique2!==ut.RLE)return t.numValues===1?Mt.CONST:Mt.FLAT;let s=e instanceof We?e.size():e;if(t.numRleValues!==s)return Mt.FLAT;if(t.runs===1)return Mt.SEQUENCE;if(t.runs!==2)return t.numValues===1?Mt.CONST:Mt.FLAT;let a=r.get();if(t.physicalLevelTechnique===Ni.VARINT)return function(u,h,p){let d=new Dh(h.get());if(p==="int64"){let m=ln(u,d,4);return m[2]===2n&&m[3]===2n}let f=ae(u,d,4);return f[2]===2&&f[3]===2}(i,r,n)?Mt.SEQUENCE:t.numValues===1?Mt.CONST:Mt.FLAT;let c=r.get(),l=new Int32Array(i.buffer,i.byteOffset+c,4);return r.set(a),l[2]===2&&l[3]===2?Mt.SEQUENCE:t.numValues===1?Mt.CONST:Mt.FLAT}class Uh extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class $h extends zh{constructor(t,e,i,r){super(t,BigInt64Array.of(e),i,r)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}}function Zh(t,e,i){return{x:p_(t,e)-i,y:p_(t>>1,e)-i}}function p_(t,e){let i=0;for(let r=0;r<e;r++)i|=(t&1<<2*r)>>r;return i}function dn(t,e,i,r,n,o,s){return t===Vi.MORTON?function(a,c,l,u,h,p){let d=Array(h?u+1:u);for(let f=0;f<u;f++){let m=Zh(a[c[l+f]],p.numBits,p.coordinateShift);d[f]=new z(m.x,m.y)}return h&&(d[d.length-1]=d[0]),d}(e,i,r,n,o,s):function(a,c,l,u,h){let p=Array(h?u+1:u);for(let d=0;d<2*u;d+=2){let f=2*c[l+d/2];p[d/2]=new z(a[f],a[f+1])}return h&&(p[p.length-1]=p[0]),p}(e,i,r,n,o)}function pn(t,e,i,r){let n=Array(r?i+1:i);for(let o=0;o<2*i;o+=2)n[o/2]=new z(t[e+o],t[e+o+1]);return r&&(n[n.length-1]=n[0]),n}(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(Xt||(Xt={})),function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"}(l_||(l_={})),function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"}(Vi||(Vi={}));class Gh{constructor(t,e,i,r,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let i=Zh(this.vertexBuffer[this.vertexOffsets[t]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[i.x,i.y]}let e=this.vertexOffsets?2*this.vertexOffsets[t]:2*t;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return function(t){let e=Array(t.numGeometries),i=1,r=1,n=1,o=0,s=0,a=0,{mortonSettings:c,topologyVector:l}=t,{geometryOffsets:u,partOffsets:h,ringOffsets:p}=l,d=t.vertexOffsets,f=!d||d.length===0,m=t.containsPolygonGeometry(),_=t.vertexBuffer;for(let y=0;y<t.numGeometries;y++)switch(t.geometryType(y)){case Xt.POINT:{let v,g;if(f)v=_[s++],g=_[s++];else if(t.vertexBufferType===Vi.MORTON){let x=Zh(_[d[a++]],c.numBits,c.coordinateShift);v=x.x,g=x.y}else{let x=2*d[a++];v=_[x],g=_[x+1]}e[o++]=[[new z(v,g)]],u&&n++,h&&i++,p&&r++}break;case Xt.MULTIPOINT:{let v=u[n]-u[n-1];n++;let g=Array(v);if(f)for(let x=0;x<v;x++){let b=_[s++],w=_[s++];g[x]=new z(b,w)}else for(let x=0;x<v;x++){let b=2*d[a++];g[x]=new z(_[b],_[b+1])}e[o++]=g.map((x)=>[x]),i+=v,r+=v}break;case Xt.LINESTRING:{let v,g;m?(v=p[r]-p[r-1],r++):v=h[i]-h[i-1],i++,f?(g=pn(_,s,v,!1),s+=2*v):(g=dn(t.vertexBufferType,_,d,a,v,!1,c),a+=v),e[o++]=[g],u&&n++}break;case Xt.POLYGON:{let v=h[i]-h[i-1];i++;let g=Array(v-1),x,b=p[r]-p[r-1];if(r++,f){x=pn(_,s,b,!0),s+=2*b;for(let w=0;w<g.length;w++)b=p[r]-p[r-1],r++,g[w]=pn(_,s,b,!0),s+=2*b}else{x=dn(t.vertexBufferType,_,d,a,b,!0,c),a+=b;for(let w=0;w<g.length;w++)b=p[r]-p[r-1],r++,g[w]=dn(t.vertexBufferType,_,d,a,b,!0,c),a+=b}e[o++]=[x].concat(g),u&&n++}break;case Xt.MULTILINESTRING:{let v=u[n]-u[n-1];n++;let g=Array(v);for(let x=0;x<v;x++){let b;if(m?(b=p[r]-p[r-1],r++):b=h[i]-h[i-1],i++,f)g[x]=pn(_,s,b,!1),s+=2*b;else{let w=dn(t.vertexBufferType,_,d,a,b,!1,c);g[x]=w,a+=b}}e[o++]=g}break;case Xt.MULTIPOLYGON:{let v=u[n]-u[n-1];n++;let g=Array(v);for(let x=0;x<v;x++){let b=h[i]-h[i-1],w;i++;let T=Array(b-1),P=p[r]-p[r-1];r++,f?(w=pn(_,s,P,!0),s+=2*P):(w=dn(t.vertexBufferType,_,d,a,P,!0,c),a+=P);for(let S=0;S<T.length;S++){let E=p[r]-p[r-1];r++,f?(T[S]=pn(_,s,E,!0),s+=2*E):(T[S]=dn(t.vertexBufferType,_,d,a,E,!0,c),a+=E)}g[x]=[w].concat(T)}e[o++]=g.flat()}break;default:throw Error("The specified geometry type is currently not supported.")}return e}(this)}get mortonSettings(){return this._mortonSettings}}class qh extends Gh{constructor(t,e,i,r,n,o,s){super(i,r,n,o,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Xt.POLYGON||this._geometryType===Xt.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class Wh extends Gh{constructor(t,e,i,r,n,o){super(t,i,r,n,o),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===Xt.POLYGON||this.geometryType(t)===Xt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Hh{constructor(t,e,i,r){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let t=Array(this.numGeometries),e=this._topologyVector,{partOffsets:i,ringOffsets:r,geometryOffsets:n}=e,o=0,s=1,a=1,c=1;for(let l=0;l<this.numGeometries;l++)switch(this.geometryType(l)){case Xt.POLYGON:{let u=i[s]-i[s-1];s++;let h=[];for(let p=0;p<u;p++){let d=r[a]-r[a-1];a++;let f=[];for(let m=0;m<d;m++){let _=this._vertexBuffer[o++],y=this._vertexBuffer[o++];f.push(new z(_,y))}f.length>0&&f.push(f[0]),h.push(f)}t[l]=h,n&&c++}break;case Xt.MULTIPOLYGON:{let u=n[c]-n[c-1];c++;let h=[];for(let p=0;p<u;p++){let d=i[s]-i[s-1];s++;for(let f=0;f<d;f++){let m=r[a]-r[a-1];a++;let _=[];for(let y=0;y<m;y++){let v=this._vertexBuffer[o++],g=this._vertexBuffer[o++];_.push(new z(v,g))}_.length>0&&_.push(_[0]),h.push(_)}}t[l]=h}}return t}[Symbol.iterator](){return null}}function f_(t,e,i,r,n,o){return new m_(t,e,i,r,n,o)}class m_ extends Hh{constructor(t,e,i,r,n,o){super(i,r,n,o),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function __(t,e,i,r,n){return new g_(t,e,i,r,n)}class g_ extends Hh{constructor(t,e,i,r,n){super(e,i,r,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function e1(t,e,i,r,n){let o=de(t,i),s,a,c,l;if(Oa(o,r,t,i)===Mt.CONST){let v=Vh(t,i,o),g,x,b,w;for(let T=0;T<e-1;T++){let P=de(t,i);switch(P.physicalStreamType){case ie.LENGTH:switch(P.logicalStreamType.lengthType){case Pe.GEOMETRIES:g=Ui(t,i,P);break;case Pe.PARTS:x=Ui(t,i,P);break;case Pe.RINGS:b=Ui(t,i,P);break;case Pe.TRIANGLES:w=Ui(t,i,P)}break;case ie.OFFSET:switch(P.logicalStreamType.offsetType){case mr.VERTEX:s=Ie(t,i,P);break;case mr.INDEX:l=Ie(t,i,P)}break;case ie.DATA:ri.VERTEX===P.logicalStreamType.dictionaryType?a=Nh(t,i,P):(c={numBits:P.numBits,coordinateShift:P.coordinateShift},a=Ie(t,i,P))}}return l?g!==void 0||x!==void 0?f_(r,v,w,l,a,{geometryOffsets:g,partOffsets:x,ringOffsets:b}):f_(r,v,w,l,a):c===void 0?function(T,P,S,E,I){return new qh(T,P,Vi.VEC_2,S,E,I)}(r,v,{geometryOffsets:g,partOffsets:x,ringOffsets:b},s,a):function(T,P,S,E,I,C){return new qh(T,P,Vi.MORTON,S,E,I,C)}(r,v,{geometryOffsets:g,partOffsets:x,ringOffsets:b},s,a,c)}let u=Ie(t,i,o),h,p,d,f,m,_,y;for(let v=0;v<e-1;v++){let g=de(t,i);switch(g.physicalStreamType){case ie.LENGTH:switch(g.logicalStreamType.lengthType){case Pe.GEOMETRIES:h=Ie(t,i,g);break;case Pe.PARTS:p=Ie(t,i,g);break;case Pe.RINGS:d=Ie(t,i,g);break;case Pe.TRIANGLES:f=Ui(t,i,g)}break;case ie.OFFSET:switch(g.logicalStreamType.offsetType){case mr.VERTEX:s=Ie(t,i,g);break;case mr.INDEX:l=Ie(t,i,g)}break;case ie.DATA:ri.VERTEX===g.logicalStreamType.dictionaryType?a=Nh(t,i,g):(c={numBits:g.numBits,coordinateShift:g.coordinateShift},a=Ie(t,i,g))}}return h?(m=Xh(u,h,2),p&&d?(_=y_(u,m,p,!1),y=function(v,g,x,b){let w=new Uint32Array(x[x.length-1]+1),T=0;w[0]=T;let P=1,S=1,E=0;for(let I=0;I<v.length;I++){let C=v[I],A=g[I+1]-g[I];if(C!==0&&C!==3)for(let M=0;M<A;M++){let k=x[P]-x[P-1];P++;for(let L=0;L<k;L++)T=w[S++]=T+b[E++]}else for(let M=0;M<A;M++)w[S++]=++T,P++}return w}(u,m,_,d)):p&&(_=function(v,g,x){let b=new Uint32Array(g[g.length-1]+1),w=0;b[0]=w;let T=1,P=0;for(let S=0;S<v.length;S++){let E=v[S],I=g[S+1]-g[S];if(E===4||E===1)for(let C=0;C<I;C++)w=b[T++]=w+x[P++];else for(let C=0;C<I;C++)b[T++]=++w}return b}(u,m,p))):p&&d?(_=Xh(u,p,1),y=y_(u,_,d,!0)):p&&(_=Xh(u,p,0)),l&&!_?__(u,f,l,a):l?__(u,f,l,a,{geometryOffsets:m,partOffsets:_,ringOffsets:y}):c===void 0?function(v,g,x,b){return new Wh(Vi.VEC_2,v,g,x,b)}(u,{geometryOffsets:m,partOffsets:_,ringOffsets:y},s,a):function(v,g,x,b,w){return new Wh(Vi.MORTON,v,g,x,b,w)}(u,{geometryOffsets:m,partOffsets:_,ringOffsets:y},s,a,c)}function Xh(t,e,i){let r=new Uint32Array(t.length+1),n=0;r[0]=n;let o=0;for(let s=0;s<t.length;s++)n=r[s+1]=n+(t[s]>i?e[o++]:1);return r}function y_(t,e,i,r){let n=new Uint32Array(e[e.length-1]+1),o=0;n[0]=o;let s=1,a=0;for(let c=0;c<t.length;c++){let l=t[c],u=e[c+1]-e[c];if(l===5||l===2||r&&(l===4||l===1))for(let h=0;h<u;h++)o=n[s++]=o+i[a++];else for(let h=0;h<u;h++)n[s++]=++o}return n}class v_ extends fr{constructor(t,e,i){super(t,e.getBuffer(),i),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}}class x_ extends Ao{getValueFromBuffer(t){return this.dataBuffer[t]}}class Yh extends fr{constructor(t,e,i,r){super(t,r?BigInt64Array.of(e):BigUint64Array.of(e),i)}getValueFromBuffer(t){return this.dataBuffer[0]}}function zo(t,e,i,r,n){let o=function(s,a,c,l){let u=new Uint8Array(a),h=0,p=l.get()+c;for(;h<a&&!(l.get()>=p);){let d=s[l.increment()];if(d<=127){let f=d+3,m=s[l.increment()],_=Math.min(h+f,a);u.fill(m,h,_),h=_}else{let f=256-d;for(let m=0;m<f&&h<a;m++)u[h++]=s[l.increment()]}}return l.set(p),u}(t,Math.ceil(e/8),i,r);return n?function(s,a,c){if(!c)return s;let l=c.size(),u=new We(s,a),h=new We(new Uint8Array(Math.ceil(l/8)),l),p=0;for(let d=0;d<l;d++){let f=!!c.get(d)&&u.get(p++);h.set(d,f)}return h.getBuffer()}(o,e,n):o}let i1=new TextDecoder;function Kh(t,e,i){return i-e>=12?i1.decode(t.subarray(e,i)):function(r,n,o){let s="",a=n;for(;a<o;){let c=r[a],l,u,h,p=null,d=c>239?4:c>223?3:c>191?2:1;if(a+d>o)break;d===1?c<128&&(p=c):d===2?(l=r[a+1],(192&l)==128&&(p=(31&c)<<6|63&l,p<=127&&(p=null))):d===3?(l=r[a+1],u=r[a+2],(192&l)==128&&(192&u)==128&&(p=(15&c)<<12|(63&l)<<6|63&u,(p<=2047||p>=55296&&p<=57343)&&(p=null))):d===4&&(l=r[a+1],u=r[a+2],h=r[a+3],(192&l)==128&&(192&u)==128&&(192&h)==128&&(p=(15&c)<<18|(63&l)<<12|(63&u)<<6|63&h,(p<=65535||p>=1114112)&&(p=null))),p===null?(p=65533,d=1):p>65535&&(p-=65536,s+=String.fromCharCode(p>>>10&1023|55296),p=56320|1023&p),s+=String.fromCharCode(p),a+=d}return s}(t,e,i)}class ja extends fr{constructor(t,e,i,r){super(t,i,r),this.offsetBuffer=e}}class Jh extends ja{constructor(t,e,i,r){super(t,e,i,r??e.length-1)}getValueFromBuffer(t){return Kh(this.dataBuffer,this.offsetBuffer[t],this.offsetBuffer[t+1])}}class _r extends ja{constructor(t,e,i,r,n){super(t,i,r,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t];return Kh(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Qh extends ja{constructor(t,e,i,r,n,o,s){super(t,i,r,s),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=o}getValueFromBuffer(t){this.decodedDictionary==null&&(this.symbolLengthBuffer==null&&(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),this.decodedDictionary=function(i,r,n){let o=[],s=Array(r.length).fill(0);for(let a=1;a<r.length;a++)s[a]=s[a-1]+r[a-1];for(let a=0;a<n.length;a++)if(n[a]===255)o.push(n[++a]);else{let c=r[n[a]],l=s[n[a]];for(let u=0;u<c;u++)o.push(i[l+u])}return new Uint8Array(o)}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));let e=this.indexBuffer[t];return Kh(this.decodedDictionary,this.offsetBuffer[e],this.offsetBuffer[e+1])}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),i=t[0];for(let r=1;r<t.length;r++){let n=t[r];e[r-1]=n-i,i=n}return e}}function r1(t,e,i,r,n,o){return i.type==="scalarType"?function(s,a,c,l,u,h){let p=null;if(s===0)return null;if(h.nullable){let f=de(a,c),m=f.numValues,_=c.get(),y=zo(a,m,f.byteLength,c);c.set(_+f.byteLength),p=new We(y,f.numValues)}let d=p??l;switch(u.physicalType){case 4:case 3:return function(f,m,_,y,v){let g=de(f,m),x=Oa(g,v,f,m),b=y.physicalType===3;if(x===Mt.FLAT){let T=Do(v)?v:void 0,P=b?Nh(f,m,g,0,T):Ie(f,m,g,0,T);return new ka(_.name,P,v)}if(x===Mt.SEQUENCE){let T=c_(f,m,g);return new Fa(_.name,T[0],T[1],g.numRleValues)}let w=b?function(T,P,S){let E=un(T,P,S);return E.length===1?Tt(E[0]):function(I){return Tt(I[1])}(E)}(f,m,g):Vh(f,m,g);return new Ba(_.name,w,v,b)}(a,c,h,u,d);case 9:return function(f,m,_,y,v){let g=null,x=null,b=null,w=null,T=null,P=v??null,S=null,E=null;for(let I=0;I<y;I++){let C=de(m,_);switch(C.physicalStreamType){case ie.PRESENT:{let A=zo(m,C.numValues,C.byteLength,_),M=new We(A,C.numValues);P=v??M;break}case ie.OFFSET:x=Ie(m,_,C,0,P);break;case ie.LENGTH:{let A=Ui(m,_,C);Pe.DICTIONARY===C.logicalStreamType.lengthType?g=A:Pe.SYMBOL===C.logicalStreamType.lengthType?w=A:S=A;break}case ie.DATA:{let A=m.subarray(_.get(),_.get()+C.byteLength);_.add(C.byteLength);let M=C.logicalStreamType.dictionaryType;ri.FSST===M?T=A:ri.SINGLE===M||ri.SHARED===M?b=A:ri.NONE===M&&(E=A);break}}}return function(I,C,A,M,k,L,O){return C?new Qh(I,A,M,k,L,C,O):null}(f,T,x,g,b,w,P)??function(I,C,A,M,k){return C?k?new _r(I,A,M,C,k):new _r(I,A,M,C):null}(f,b,x,g,P)??function(I,C,A,M,k){if(!C||!A)return null;if(M)return k?new _r(I,M,C,A,k):new _r(I,M,C,A);if(k&&k.size()!==C.length-1){let L=new Uint32Array(k.size()),O=0;for(let q=0;q<k.size();q++)L[q]=k.get(q)?O++:0;return new _r(I,L,C,A,k)}return k?new Jh(I,C,A,k):new Jh(I,C,A)}(f,S,E,x,P)}(h.name,a,c,h.nullable?s-1:s,p);case 0:return function(f,m,_,y,v){let g=de(f,m),x=g.numValues,b=m.get(),w=Do(v)?v:void 0,T=zo(f,x,g.byteLength,m,w);m.set(b+g.byteLength);let P=new We(T,x);return new v_(_.name,P,v)}(a,c,h,0,d);case 6:case 5:return function(f,m,_,y,v){let g=de(f,m),x=Oa(g,y,f,m,"int64"),b=v.physicalType===5;if(x===Mt.FLAT){let T=Do(y)?y:void 0,P=b?function(S,E,I,C){return function(A,M,k){let L;switch(M.logicalLevelTechnique1){case ut.DELTA:if(M.logicalLevelTechnique2===ut.RLE){let O=M;if(!k)return function(q,Q,rt){let nt=new BigInt64Array(rt),lt=0,pt=0n;for(let Pt=0;Pt<Q;Pt++){let yt=Number(q[Pt]),Dt=ue(q[Pt+Q]);for(let H=0;H<yt;H++)pt+=Dt,nt[lt++]=pt}return nt}(A,O.runs,O.numRleValues);L=a_(A=Oh(A,O.runs,O.numRleValues))}else L=a_(A);break;case ut.RLE:L=function(O,q,Q){if(Q===void 0){Q=0;for(let lt=0;lt<q;lt++)Q+=Number(O[lt])}let rt=new BigInt64Array(Q),nt=0;for(let lt=0;lt<q;lt++){let pt=Number(O[lt]),Pt=O[lt+q];Pt=ue(Pt),rt.fill(Pt,nt,nt+pt),nt+=pt}return rt}(A,M.runs,M.numRleValues);break;case ut.NONE:L=function(O){let q=new BigInt64Array(O.length);for(let Q=0;Q<O.length;Q++)q[Q]=ue(O[Q]);return q}(A);break;default:throw Error(`The specified Logical level technique is not supported: ${M.logicalLevelTechnique1}`)}return k?hn(L,k,0n):L}(ln(S,E,I.numValues),I,C)}(f,m,g,T):u_(f,m,g,T);return new Uh(_.name,P,y)}if(x===Mt.SEQUENCE){let T=h_(f,m,g);return new $h(_.name,T[0],T[1],g.numRleValues)}let w=b?function(T,P,S){let E=ln(T,P,S.numValues);return E.length===1?ue(E[0]):function(I){return ue(I[1])}(E)}(f,m,g):d_(f,m,g);return new Yh(_.name,w,y,b)}(a,c,h,d,u);case 7:return function(f,m,_,y){let v=de(f,m),g=Do(y)?y:void 0,x=function(b,w,T,P){let S=w.get(),E=S+T*Float32Array.BYTES_PER_ELEMENT,I=new Uint8Array(b.subarray(S,E)).buffer,C=new Float32Array(I);return w.set(E),P?hn(C,P,0):C}(f,m,v.numValues,g);return new x_(_.name,x,y)}(a,c,h,d);case 8:return function(f,m,_,y){let v=de(f,m),g=Do(y)?y:void 0,x=function(b,w,T,P){let S=w.get(),E=S+T*Float64Array.BYTES_PER_ELEMENT,I=new Uint8Array(b.subarray(S,E)).buffer,C=new Float64Array(I);return w.set(E),P?hn(C,P,0):C}(f,m,v.numValues,g);return new La(_.name,x,y)}(a,c,h,d);default:throw Error(`The specified data type for the field is currently not supported: ${u}`)}}(r,t,e,n,i.scalarType,i):r===0?null:function(s,a,c,l){let u=null,h=null,p=null,d=null,f=!1;for(;!f;){let v=de(s,a);switch(v.physicalStreamType){case ie.LENGTH:Pe.DICTIONARY===v.logicalStreamType.lengthType?u=Ui(s,a,v):p=Ui(s,a,v);break;case ie.DATA:ri.SINGLE===v.logicalStreamType.dictionaryType||ri.SHARED===v.logicalStreamType.dictionaryType?(h=s.subarray(a.get(),a.get()+v.byteLength),f=!0):d=s.subarray(a.get(),a.get()+v.byteLength),a.add(v.byteLength)}}let m=c.complexType.children,_=[],y=0;for(let v of m){let g=ae(s,a,1)[0];if(g===0)continue;let x=v.name?`${c.name}${v.name}`:c.name;if(g!==2||v.type!=="scalarField"||v.scalarField.physicalType!==9)throw Error("Currently only optional string fields are implemented for a struct.");let b=de(s,a),w=zo(s,b.numValues,b.byteLength,a),T=de(s,a),P=Ie(s,a,T,0,T.decompressedCount!==l?new We(w,b.numValues):void 0);_[y++]=d?new Qh(x,P,u,h,p,d,new We(w,b.numValues)):new _r(x,P,u,h,new We(w,b.numValues))}return _}(t,e,i,n)}function Do(t){return t instanceof We}function b_(t){switch(t){case 0:case 1:case 2:case 3:{let e={};e.nullable=!!(1&t),e.columnScope=0;let i={type:"logicalType",logicalType:0};return i.longID=!!(2&t),e.scalarType=i,e.type="scalarType",e}case 4:{let e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:0};return e.type="complexType",e.complexType=i,e}case 30:{let e={nullable:!1,columnScope:0},i={type:"physicalType",physicalType:1};return e.type="complexType",e.complexType=i,e}default:return function(e){let i;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}let r={};r.nullable=!!(1&e),r.columnScope=0;let n={type:"physicalType"};return n.physicalType=i,r.type="scalarType",r.scalarType=n,r}(t)}}function w_(t){return t>=10}function T_(t){return t===30}function n1(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function o1(t){return t.type==="complexType"&&t.complexType?.type==="physicalType"&&t.complexType.physicalType===0}let s1=new TextDecoder;function tu(t,e){let i=ae(t,e,1)[0];if(i===0)return"";let r=e.get(),n=t.subarray(r,r+i);return e.add(i),s1.decode(n)}function S_(t,e){let i=ae(t,e,1)[0]>>>0;if(i<10||i>30)throw Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);let r=b_(i);if(w_(i)&&(r.name=tu(t,e)),T_(i)){let n=ae(t,e,1)[0]>>>0;r.complexType.children=Array(n);for(let o=0;o<n;o++)r.complexType.children[o]=S_(t,e)}return function(n){return{name:n.name,nullable:n.nullable,scalarField:n.scalarType,complexField:n.complexType,type:n.type==="scalarType"?"scalarField":"complexField"}}(r)}function a1(t,e){let i=ae(t,e,1)[0]>>>0,r=b_(i);if(!r)throw Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(w_(i)?r.name=tu(t,e):i>=0&&i<=3?r.name="id":i===4&&(r.name="geometry"),T_(i)){let n=ae(t,e,1)[0]>>>0,o=r.complexType;o.children=Array(n);for(let s=0;s<n;s++)o.children[s]=S_(t,e)}return r}function l1(t,e){let i={featureTables:[]},r={};r.name=tu(t,e);let n=ae(t,e,1)[0]>>>0,o=ae(t,e,1)[0]>>>0;r.columns=Array(o);for(let s=0;s<o;s++)r.columns[s]=a1(t,e);return i.featureTables.push(r),[i,n]}function c1(t,e,i,r,n,o,s=!1){let a=e.scalarType;if(!a||a.type!=="logicalType"||a.logicalType!==0)throw Error(`ID column must be a logical ID scalar type: ${r}`);let c=a.longID?6:4,l=typeof o=="number"?void 0:o,u=Oa(n,o,t,i,c===6?"int64":"int32");if(c===4)switch(u){case Mt.FLAT:{let h=Ie(t,i,n,0,l);return new ka(r,h,o)}case Mt.SEQUENCE:{let h=c_(t,i,n);return new Fa(r,h[0],h[1],n.numRleValues)}case Mt.CONST:{let h=Vh(t,i,n);return new Ba(r,h,o,!1)}}switch(u){case Mt.FLAT:{if(s){let p=function(d,f,m){let _=function(y,v,g){let x=new Float64Array(g);for(let b=0;b<g;b++)x[b]=t1(y,v);return x}(d,f,m.numValues);return function(y,v){switch(v.logicalLevelTechnique1){case ut.DELTA:return v.logicalLevelTechnique2===ut.RLE&&(y=o_(y,v.runs,v.numRleValues)),function(g){g[0]=cn(g[0]);let x=g.length/4*4,b=1;if(x>=4)for(;b<x-4;b+=4){let w=g[b+1],T=g[b+2],P=g[b+3];g[b]=cn(g[b])+g[b-1],g[b+1]=cn(w)+g[b],g[b+2]=cn(T)+g[b+1],g[b+3]=cn(P)+g[b+2]}for(;b!==g.length;++b)g[b]=cn(g[b])+g[b-1]}(y),y;case ut.RLE:return function(g,x){return o_(g,x.runs,x.numRleValues)}(y,v);case ut.NONE:return y;default:throw Error(`The specified Logical level technique is not supported: ${v.logicalLevelTechnique1}`)}}(_,m)}(t,i,n);return new La(r,p,o)}let h=u_(t,i,n,l);return new Uh(r,h,o)}case Mt.SEQUENCE:{let h=h_(t,i,n);return new $h(r,h[0],h[1],n.numRleValues)}case Mt.CONST:{let h=d_(t,i,n);return new Yh(r,h,o,!1)}}throw Error("Vector type not supported for id column.")}class P_{constructor(t,e){var i;switch(this._featureData=t,this.properties=this._featureData.properties||{},(i=this._featureData.geometry)===null||i===void 0?void 0:i.type){case Xt.POINT:case Xt.MULTIPOINT:this.type=1;break;case Xt.LINESTRING:case Xt.MULTILINESTRING:this.type=2;break;case Xt.POLYGON:case Xt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let i=[];for(let r of e)i.push(new z(r.x,r.y));t.push(i)}return t}}class I_{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new P_(this.features[t],this.extent)}}class E_{constructor(t){this.layers={};let e=function(i,r,n=!0){let o=new Dh(0),s=[];for(;o.get()<i.length;){let c=ae(i,o,1)[0]>>>0,l=o.get()+c;if(l>i.length)throw Error(`Block overruns tile: ${l} > ${i.length}`);if(ae(i,o,1)[0]>>>0!=1){o.set(l);continue}let[u,h]=l1(i,o),p=u.featureTables[0],d=null,f=null,m=[],_=0;for(let v of p.columns){let g=v.name;if((a=v).type==="scalarType"&&a.scalarType?.type==="logicalType"&&a.scalarType.logicalType===0){let x=null;if(v.nullable){let w=de(i,o),T=o.get(),P=zo(i,w.numValues,w.byteLength,o);o.set(T+w.byteLength),x=new We(P,w.numValues)}let b=de(i,o);_=x?x.size():b.decompressedCount,d=c1(i,v,o,g,b,x??_,n)}else if(o1(v)){let x=ae(i,o,1)[0];if(_===0){let b=o.get();_=de(i,o).decompressedCount,o.set(b)}f=e1(i,x,o,_)}else{let x=n1(v)?ae(i,o,1)[0]:1;if(x===0)continue;let b=r1(i,o,v,x,_);if(b)if(Array.isArray(b))for(let w of b)m.push(w);else m.push(b)}}let y=new r_(p.name,f,d,m,h);s.push(y),o.set(l)}var a;return s}(new Uint8Array(t));this.layers=e.reduce((i,r)=>Object.assign(Object.assign({},i),{[r.name]:new I_(r)}),{})}}let gr="_geojsonTileLayer";function M_(t,e,i,r,n){return Ml(t,(o,s)=>{let a=e instanceof ao?e.get(s):null;return(a==null?void 0:a.evaluate)?a.evaluate(i,r,n):a})}function h1(t,e){return e-t}U("FeatureIndex",class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new eo(F,16,0),this.grid3D=new eo(F,16,0),this.featureIndexArray=new Fc,this.promoteId=e}insert(t,e,i,r,n,o){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,n);let a=o?this.grid3D:this.grid;for(let c of e){let l=[1/0,1/0,-1/0,-1/0];for(let u of c)l[0]=Math.min(l[0],u.x),l[1]=Math.min(l[1],u.y),l[2]=Math.max(l[2],u.x),l[3]=Math.max(l[3],u.y);l[0]<F&&l[1]<F&&l[2]>=0&&l[3]>=0&&a.insert(s,l[0],l[1],l[2],l[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new em(new uh(this.rawTileData)).layers:new E_(this.rawTileData).layers,this.sourceLayerCoder=new i_(this.vtLayers?Object.keys(this.vtLayers).sort():[gr])),this.vtLayers}query(t,e,i,r){this.loadVTLayers();let n=t.params,o=F/t.tileSize/t.scale,s=Qn(n.filter,n.globalState),a=t.queryGeometry,c=t.queryPadding*o,l=Le.fromPoints(a),u=this.grid.query(l.minX-c,l.minY-c,l.maxX+c,l.maxY+c),h=Le.fromPoints(t.cameraQueryGeometry).expandBy(c),p=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(m,_,y,v)=>function(g,x,b,w,T){for(let S of g)if(x<=S.x&&b<=S.y&&w>=S.x&&T>=S.y)return!0;let P=[new z(x,b),new z(x,T),new z(w,T),new z(w,b)];if(g.length>2){for(let S of P)if(Yr(g,S))return!0}for(let S=0;S<g.length-1;S++)if(Dv(g[S],g[S+1],P))return!0;return!1}(t.cameraQueryGeometry,m-c,_-c,y+c,v+c));for(let m of p)u.push(m);u.sort(h1);let d={},f;for(let m of u){if(m===f)continue;f=m;let _=this.featureIndexArray.get(m),y=null;this.loadMatchingFeature(d,_.bucketIndex,_.sourceLayerIndex,_.featureIndex,s,n.layers,n.availableImages,e,i,r,(v,g,x)=>(y||(y=sr(v)),g.queryIntersectsFeature({queryGeometry:a,feature:v,featureState:x,geometry:y,zoom:this.z,transform:t.transform,pixelsToTileUnits:o,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return d}loadMatchingFeature(t,e,i,r,n,o,s,a,c,l,u){let h=this.bucketLayerIDs[e];if(o&&!h.some((m)=>o.has(m)))return;let p=this.sourceLayerCoder.decode(i),d=this.vtLayers[p].feature(r);if(n.needGeometry){let m=ar(d,!0);if(!n.filter(new At(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!n.filter(new At(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let m of h){if(o&&!o.has(m))continue;let _=a[m];if(!_)continue;let y={};f&&l&&(y=l.getState(_.sourceLayer||gr,f));let v=G({},c[m]);v.paint=M_(v.paint,_.paint,d,y,s),v.layout=M_(v.layout,_.layout,d,y,s);let g=!u||u(d,_,y);if(!g)continue;let x=new Ah(d,this.z,this.x,this.y,f);x.layer=v;let b=t[m];b===void 0&&(b=t[m]=[]),b.push({featureIndex:r,feature:x,intersectionZ:g})}}lookupSymbolFeatures(t,e,i,r,n,o,s,a){let c={};this.loadVTLayers();let l=Qn(n.filterSpec,n.globalState);for(let u of t)this.loadMatchingFeature(c,i,r,u,l,o,s,a,e);return c}hasLayer(t){for(let e of this.bucketLayerIDs)for(let i of e)if(t===i)return!0;return!1}getId(t,e){var i;let r=t.id;return this.promoteId&&(r=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[e]],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=t.properties)===null||i===void 0?void 0:i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))),r}},{omit:["rawTileData","sourceLayerCoder"]});let eu="RTLPluginLoaded";class C_ extends Ht{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=bh()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((e)=>{throw this.status="error",e})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return it(this,arguments,void 0,function*(e,i=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ge.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status==="unavailable"){if(!i)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return it(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new R(eu))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let iu=null;function Ro(){return iu||(iu=new C_),iu}var $i,_i;(function(t){t[t.Base=0]="Base",t[t.Parent=1]="Parent"})($i||($i={})),function(t){t[t.Departing=0]="Departing",t[t.Incoming=1]="Incoming"}(_i||(_i={}));class ru{constructor(t,e){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=wd(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:e,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=e,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=St(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,e,i){if((t==null?void 0:t.etagUnmodified)!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(r,n){let o={};if(!n)return o;for(let s of r){let a=s.layerIds.map((c)=>n.getLayer(c)).filter(Boolean);if(a.length!==0){s.layers=a,s.stateDependentLayerIds&&(s.stateDependentLayers=s.stateDependentLayerIds.map((c)=>a.filter((l)=>l.id===c)[0]));for(let c of a)o[c.id]=s}}return o}(t.buckets,e==null?void 0:e.style),this.hasSymbolBuckets=!1;for(let r in this.buckets){let n=this.buckets[r];if(n instanceof ur){if(this.hasSymbolBuckets=!0,!i)break;n.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let n=this.buckets[r];if(n instanceof ur&&n.hasRTLText){this.hasRTLText=!0,Ro().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let n=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(r).queryRadius(n))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new Ic;else this.state="loaded"}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(t)}let e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jt(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jt(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,i,r,n,o,s,a,c,l,u){var h;return((h=this.latestFeatureIndex)===null||h===void 0?void 0:h.rawTileData)?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:n,scale:o,tileSize:this.tileSize,pixelPosMatrix:l,transform:a,params:s,queryPadding:this.queryPadding*c,getElevation:u},t,e,i):{}}querySourceFeatures(t,e){let i=this.latestFeatureIndex;if(!(i==null?void 0:i.rawTileData))return;let r=i.loadVTLayers(),n=(e==null?void 0:e.sourceLayer)?e.sourceLayer:"",o=r[gr]||r[n];if(!o)return;let s=Qn(e==null?void 0:e.filter,e==null?void 0:e.globalState),{z:a,x:c,y:l}=this.tileID.canonical,u={z:a,x:c,y:l};for(let h=0;h<o.length;h++){let p=o.feature(h);if(s.needGeometry){let m=ar(p,!0);if(!s.filter(new At(this.tileID.overscaledZ),m,this.tileID.canonical))continue}else if(!s.filter(new At(this.tileID.overscaledZ),p))continue;let d=i.getId(p,n),f=new Ah(p,a,c,l,d);f.tile=u,t.push(f)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let e=this.expirationTime;if(t.cacheControl){let i=function(r){let n={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(o,s,a,c)=>{let l=a||c;return n[s]=!l||l.toLowerCase(),""}),n["max-age"]){let o=parseInt(n["max-age"],10);isNaN(o)?delete n["max-age"]:n["max-age"]=o}return n}(t.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1000*i["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(e)if(this.expirationTime<e)r=!0;else{let n=this.expirationTime-e;n?this.expirationTime=i+Math.max(n,30000):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1000*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){var i,r,n;if(!((i=this.latestFeatureIndex)===null||i===void 0?void 0:i.rawTileData)||Object.keys(t).length===0)return;let o=this.latestFeatureIndex.loadVTLayers();for(let s in this.buckets){if(!e.style.hasLayer(s))continue;let a=this.buckets[s],c=a.layers[0].sourceLayer||gr,l=o[c],u=t[c];if(!l||!u||Object.keys(u).length===0)continue;a.update(u,l,((r=this.imageAtlas)===null||r===void 0?void 0:r.patternPositions)||{},this.dashPositions||{});let h=(n=e==null?void 0:e.style)===null||n===void 0?void 0:n.getLayer(s);h&&(this.queryPadding=Math.max(this.queryPadding,h.queryRadius(a)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<St()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=St()+t}setDependencies(t,e){let i={};for(let r of e)i[r]=!0;this.dependencies[t]=i}hasDependency(t,e){for(let i of t){let r=this.dependencies[i];if(r){for(let n of e)if(r[n])return!0}}return!1}}class A_{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(let t in this.data)for(let e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,i){let r=t.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let n={value:e,timeout:void 0};if(i!==void 0&&(n.timeout=setTimeout(()=>{this.remove(t,n)},i)),this.data[r].push(n),this.order.push(r),this.order.length>this.max){let o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){let e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;let i=t.wrapped().key,r=e===void 0?0:this.data[i].indexOf(e),n=this.data[i][r];return this.data[i].splice(r,1),n.timeout&&clearTimeout(n.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(n.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(t){let e=[];for(let i in this.data)for(let r of this.data[i])t(r.value)||e.push(r);for(let i of e)this.remove(i.value.tileID,i)}}class z_{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,e,i){var r,n,o,s,a;let c=String(e);if((s=this.stateChanges)[t]||(s[t]={}),(a=this.stateChanges[t])[c]||(a[c]={}),G(this.stateChanges[t][c],i),this.deletedStates[t]===null){this.deletedStates[t]={};for(let l in this.state[t])l!==c&&(this.deletedStates[t][l]=null)}else if(((r=this.deletedStates[t])===null||r===void 0?void 0:r[c])===null){this.deletedStates[t][c]={};for(let l in this.state[t][c])i[l]||(this.deletedStates[t][c][l]=null)}else for(let l in i)((o=(n=this.deletedStates[t])===null||n===void 0?void 0:n[c])===null||o===void 0?void 0:o[l])===null&&delete this.deletedStates[t][c][l]}removeFeatureState(t,e,i){var r,n,o;if(this.deletedStates[t]===null)return;let s=String(e);if((n=this.deletedStates)[t]||(n[t]={}),i&&e!==void 0)this.deletedStates[t][s]!==null&&((o=this.deletedStates[t])[s]||(o[s]={}),this.deletedStates[t][s][i]=null);else if(e!==void 0)if((r=this.stateChanges[t])===null||r===void 0?void 0:r[s])for(i in this.deletedStates[t][s]={},this.stateChanges[t][s])this.deletedStates[t][s][i]=null;else this.deletedStates[t][s]=null;else this.deletedStates[t]=null}getState(t,e){let i=String(e),r=G({},(this.state[t]||{})[i],(this.stateChanges[t]||{})[i]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let n=this.deletedStates[t][e];if(n===null)return{};for(let o in n)delete r[o]}return r}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){var i,r,n;let o={};for(let s in this.stateChanges){(i=this.state)[s]||(i[s]={});let a={};for(let c in this.stateChanges[s])(r=this.state[s])[c]||(r[c]={}),G(this.state[s][c],this.stateChanges[s][c]),a[c]=this.state[s][c];o[s]=a}for(let s in this.deletedStates){(n=this.state)[s]||(n[s]={});let a={};if(this.deletedStates[s]===null)for(let c in this.state[s])a[c]={},this.state[s][c]={};else for(let c in this.deletedStates[s]){if(this.deletedStates[s][c]===null)this.state[s][c]={};else for(let l of Object.keys(this.deletedStates[s][c]))delete this.state[s][c][l];a[c]=this.state[s][c]}o[s]||(o[s]={}),G(o[s],a)}this.stateChanges={},this.deletedStates={},Object.keys(o).length!==0&&(this.revision++,t.setFeatureState(o,e))}}let ko=89.25;function gi(t,e){let i=_t(e.lat,-85.051129,kn);return new z(sn(e.lng)*t,dr(i)*t)}function Lo(t,e){return new wt(e.x/t,e.y/t).toLngLat()}function Fo(t){return t.cameraToCenterDistance*Math.min(0.85*Math.tan(Vt(90-t.pitch)),Math.tan(Vt(ko-t.pitch)))}function nu(t,e){let i=t.canonical,r=e/_e(i.z),n=i.x+Math.pow(2,i.z)*t.wrap,o=He(new Float64Array(16));return Ot(o,o,[n*r,i.y*r,0]),Wt(o,o,[r/F,r/F,1]),o}function D_(t,e,i,r,n){let o=wt.fromLngLat(t,e),s=n*ji(1,t.lat),{x:a,y:c,z:l}=ou(i,r);return new wt(o.x+s*-a,o.y+s*-c,o.z+s*-l)}function ou(t,e){let i=Vt(t),r=Vt(e),n=Math.cos(-i),o=Math.sin(i);return{x:o*Math.sin(r),y:-o*Math.cos(r),z:n}}function u1(t,e,i){let r=e.intersectsFrustum(t);if(!i||r===0)return r;let n=e.intersectsPlane(i);return n===0?0:r===2&&n===2?2:1}function R_(t,e,i){let r=0,n=(i-e)/10;for(let o=0;o<10;o++)r+=n*Math.pow(Math.cos(e+(o+0.5)/10*(i-e)),t);return r}function su(t,e){return function(i,r,n,o,s){let a=2*((t-1)/he(Math.cos(Vt(ko-s))/Math.cos(Vt(ko)))-1),c=Math.acos(n/o),l=2*R_(a-1,0,Vt(s/2)),u=Math.min(Vt(ko),c+Vt(s/2)),h=R_(a-1,Math.min(u,c-Vt(s/2)),u),p=Math.atan(r/n),d=i;return d+=he(o/Math.hypot(r,n)/Math.max(0.5,Math.cos(Vt(s/2)))),d+=a*he(Math.cos(p))/2,d-=he(Math.max(1,h/l/e))/2,d}}let d1=su(9.314,3);function au(t,e){let i=(e.roundZoom?Math.round:Math.floor)(t.zoom+he(t.tileSize/e.tileSize));return Math.max(0,i)}function fn(t,e){let i=t.getCameraFrustum(),r=t.getClippingPlane(),n=t.screenPointToMercatorCoordinate(t.getCameraPoint()),o=wt.fromLngLat(t.center,t.elevation);n.z=o.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;let s=t.getCoveringTilesDetailsProvider(),a=s.allowVariableZoom(t,e),c=au(t,e),l=e.minzoom||0,u=e.maxzoom!==void 0?e.maxzoom:t.maxZoom,h=Math.min(Math.max(0,c),u),p=Math.pow(2,h),d=[p*n.x,p*n.y,0],f=[p*o.x,p*o.y,0],m=Math.hypot(o.x-n.x,o.y-n.y),_=Math.abs(o.z-n.z),y=Math.hypot(m,_),v=(b)=>({zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),g=[],x=[];if(t.renderWorldCopies&&s.allowWorldCopies())for(let b=1;b<=3;b++)g.push(v(-b)),g.push(v(b));for(g.push(v(0));g.length>0;){let b=g.pop(),{x:w,y:T,fullyVisible:P}=b,S={x:w,y:T,z:b.zoom},E=s.getTileBoundingVolume(S,b.wrap,t.elevation,e);if(!P){let M=u1(i,E,r);if(M===0)continue;P=M===2}let I=s.distanceToTile2d(n.x,n.y,S,E),C=c;a&&(C=(e.calculateTileZoom||d1)(t.zoom+he(t.tileSize/e.tileSize),I,_,y,t.fov)),C=(e.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);let A=Math.min(C,u);if(b.wrap=s.getWrap(o,S,b.wrap),b.zoom>=A){if(b.zoom<l)continue;let M=h-b.zoom,k=d[0]-0.5-(w<<M),L=d[1]-0.5-(T<<M),O=e.reparseOverscaled?Math.max(b.zoom,C):b.zoom;x.push({tileID:new Et(b.zoom===u?O:b.zoom,b.wrap,b.zoom,w,T),distanceSq:u0([f[0]-0.5-w,f[1]-0.5-T]),tileDistanceToCamera:Math.sqrt(k*k+L*L)})}else for(let M=0;M<4;M++)g.push({zoom:b.zoom+1,x:(w<<1)+M%2,y:(T<<1)+(M>>1),wrap:b.wrap,fullyVisible:P})}return x.sort((b,w)=>b.distanceSq-w.distanceSq).map((b)=>b.tileID)}let p1=Le.fromPoints([new z(0,0),new z(F,F)]);function k_(t){return t==="raster"||t==="image"||t==="video"}function f1(t,e,i,r,n,o,s){if(!e.hasData())return!1;let{tileID:a,fadingRole:c,fadingDirection:l,fadingParentID:u}=e;if(c===$i.Base&&l===_i.Incoming&&u)return i[u.key]=u,!0;let h=Math.max(a.overscaledZ-n,o);for(let p=a.overscaledZ-1;p>=h;p--){let d=a.scaledTo(p),f=t.getLoadedTile(d);if(f)return e.setCrossFadeLogic({fadingRole:$i.Base,fadingDirection:_i.Incoming,fadingParentID:f.tileID,fadeEndTime:r+s}),f.setCrossFadeLogic({fadingRole:$i.Parent,fadingDirection:_i.Departing,fadeEndTime:r+s}),i[d.key]=d,!0}return!1}function m1(t,e,i,r,n,o){if(!e.hasData())return!1;let s=e.tileID.children(n),a=L_(t,e,s,i,r,n,o);if(a)return!0;for(let c of s)L_(t,e,c.children(n),i,r,n,o)&&(a=!0);return a}function L_(t,e,i,r,n,o,s){if(i[0].overscaledZ>=o)return!1;let a=!1;for(let c of i){let l=t.getLoadedTile(c);if(!l)continue;let{fadingRole:u,fadingDirection:h,fadingParentID:p}=l;u===$i.Base&&h===_i.Departing&&p||(l.setCrossFadeLogic({fadingRole:$i.Base,fadingDirection:_i.Departing,fadingParentID:e.tileID,fadeEndTime:n+s}),e.setCrossFadeLogic({fadingRole:$i.Parent,fadingDirection:_i.Incoming,fadeEndTime:n+s})),r[c.key]=c,a=!0}return a}function _1(t,e,i,r){let n=t.tileID;return!!t.selfFading||!t.hasData()&&!!e.has(n)&&(t.setSelfFadeLogic(i+r),!0)}function F_(t,e){var i;t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0;let r=e.tileID.canonical.x-t.tileID.canonical.x,n=e.tileID.canonical.y-t.tileID.canonical.y,o=Math.pow(2,t.tileID.canonical.z),s=e.tileID.key;r===0&&n===0||Math.abs(n)>1||(Math.abs(r)>1&&(Math.abs(r+o)===1?r+=o:Math.abs(r-o)===1&&(r-=o)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),((i=t.neighboringTiles)===null||i===void 0?void 0:i[s])&&(t.neighboringTiles[s].backfilled=!0)))}class lu{constructor(){this._tiles={}}handleWrapJump(t){let e={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+t),e[r.tileID.key]=r}this._tiles=e}setFeatureState(t,e){for(let i in this._tiles)this._tiles[i].setFeatureState(t,e)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((e)=>e.tileID).sort(Ym).map((e)=>e.key):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,e){this._tiles[t]=e}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){let e=this.getTileById(t.key);return(e==null?void 0:e.hasData())?e:null}isIdRenderable(t,e=!1){var i;return(i=this.getTileById(t))===null||i===void 0?void 0:i.isRenderable(e)}getRenderableIds(t=0,e){let i=[];for(let r of this.getAllIds())this.isIdRenderable(r,e)&&i.push(this.getTileById(r));return e?i.sort((r,n)=>{let o=r.tileID,s=n.tileID,a=new z(o.canonical.x,o.canonical.y)._rotate(-t),c=new z(s.canonical.x,s.canonical.y)._rotate(-t);return o.overscaledZ-s.overscaledZ||c.y-a.y||c.x-a.x}).map((r)=>r.tileID.key):i.map((r)=>r.tileID).sort(Ym).map((r)=>r.key)}}class Zi extends Ht{constructor(t,e,i){super(),this.id=t,this.dispatcher=i,this.on("data",(r)=>{this._dataHandler(r)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((r,n,o,s)=>{let a=new(e_(n.type))(r,n,o,s);if(a.id!==r)throw Error(`Expected Source id to be ${r} instead of ${a.id}`);return a})(t,e,i,this),this._inViewTiles=new lu,this._outOfViewCache=new A_(0,(r)=>this._unloadTile(r)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new z_,this._didEmitContent=!1,this._updated=!1}onAdd(t){var e;this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,((e=this._source)===null||e===void 0?void 0:e.onAdd)&&this._source.onAdd(t)}onRemove(t){var e;for(let i of this._inViewTiles.getAllTiles())i.unloadVectorData();this.clearTiles(),((e=this._source)===null||e===void 0?void 0:e.onRemove)&&this._source.onRemove(t),this._inViewTiles=new lu}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;if(!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,e,i){return it(this,void 0,void 0,function*(){try{let r=yield this._source.loadTile(t);this._tileLoaded(t,e,i,r)}catch(r){t.state="errored",r.status!==404?this._source.fire(new J(me(r),{tile:t})):this.update(this.transform,this.terrain)}})}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new R("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let e of this._inViewTiles.getAllTiles())e.upload(t),e.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var e;return this._inViewTiles.getRenderableIds((e=this.transform)===null||e===void 0?void 0:e.bearingInRadians,t)}hasRenderableParent(t){let e=t.overscaledZ-1;if(e>=this._source.minzoom){let i=this.getLoadedTile(t.scaledTo(e));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(t,e=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);e&&!this._source.shouldReloadTile(r,e)||(t?this._reloadTile(i,"expired"):r.state!=="errored"&&this._reloadTile(i,"reloading"))}}}_reloadTile(t,e){return it(this,void 0,void 0,function*(){let i=this._inViewTiles.getTileById(t);i&&(i.state!=="loading"&&(i.state=e),yield this._loadTile(i,t,e))})}_tileLoaded(t,e,i,r){t.timeAdded=St(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),i==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),(r==null?void 0:r.unmodified)||(this.getSource().type==="raster-dem"&&t.dem&&function(n,o){var s,a,c;let l=o.getRenderableIds();for(let u of l){if(!((s=n.neighboringTiles)===null||s===void 0?void 0:s[u]))continue;let h=o.getTileById(u);n.neighboringTiles[u].backfilled||F_(n,h),((c=(a=h.neighboringTiles)===null||a===void 0?void 0:a[n.tileID.key])===null||c===void 0?void 0:c.backfilled)||F_(h,n)}}(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new R("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,e){let i=this._getLoadedDescendents(e),r=new Set;for(let n of e){let o=i[n.key];if(!(o==null?void 0:o.length)){r.add(n);continue}let s=n.overscaledZ+Zi.maxOverzooming,a=o.filter((u)=>u.tileID.overscaledZ<=s);if(!a.length){r.add(n);continue}let c=Math.min(...a.map((u)=>u.tileID.overscaledZ)),l=a.filter((u)=>u.tileID.overscaledZ===c).map((u)=>u.tileID);for(let u of l)t[u.key]=u;this._areDescendentsComplete(l,c,n.overscaledZ)||r.add(n)}return r}_getLoadedDescendents(t){var e;let i={};for(let r of this._inViewTiles.getAllTiles().filter((n)=>n.hasData()))for(let n of t)r.tileID.isChildOf(n)&&(i[e=n.key]||(i[e]=[]),i[n.key].push(r));return i}_areDescendentsComplete(t,e,i){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===e:Math.pow(4,e-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let e=Math.ceil(t.width/this._source.tileSize)+1,i=Math.ceil(t.height/this._source.tileSize)+1,r=Math.floor(e*i*(this._maxTileCacheZoomLevels===null?ze.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),n=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,r):r;this._outOfViewCache.setMaxSize(n)}handleWrapJump(t){let e=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,e&&(this._inViewTiles.handleWrapJump(e),this._resetTileReloadTimers())}update(t,e){if(!this._sourceLoaded||this._paused)return;let i;this.transform=t,this.terrain=e,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((a)=>new Et(a.canonical.z,a.wrap,a.canonical.z,a.canonical.x,a.canonical.y)):(i=fn(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:e,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter((a)=>this._source.hasTile(a)))):i=[],this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let r=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,r&&this.fire(new R("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let n=au(t,this._source),o=this._updateRetainedTiles(i,n),s=k_(this._source.type);s&&this._rasterFadeDuration>0&&!e&&function(a,c,l,u,h,p,d){let f=St(),m=function(_){if(!_.length)return new Set;let y=Math.max(..._.map((P)=>P.canonical.z)),v=1/0,g=-1/0,x=1/0,b=-1/0,w=[];for(let P of _){let{x:S,y:E,z:I}=P.canonical,C=Math.pow(2,y-I),A=S*C,M=E*C;w.push({id:P,x:A,y:M}),A<v&&(v=A),A>g&&(g=A),M<x&&(x=M),M>b&&(b=M)}let T=new Set;for(let P of w)P.x!==v&&P.x!==g&&P.y!==x&&P.y!==b||T.add(P.id);return T}(c);for(let _ of c){let y=a.getTileById(_.key);y.fadingDirection!==_i.Departing&&y.fadeOpacity!==0||y.resetFadeLogic(),f1(a,y,l,f,u,h,d)||m1(a,y,l,f,p,d)||_1(y,m,f,d)||y.resetFadeLogic()}}(this._inViewTiles,i,o,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),s?this._cleanUpRasterTiles(o):this._cleanUpVectorTiles(o)}_cleanUpRasterTiles(t){for(let e of this._inViewTiles.getAllIds())t[e]||this._removeTile(e)}_cleanUpVectorTiles(t){for(let e of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(e);t[e]?i.clearSymbolFadeHold():i.hasSymbolBuckets?i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(e):i.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(e)}}_addTerrainIdealTiles(t){let e=[];for(let i of t)if(i.canonical.z>this._source.minzoom){let r=i.scaledTo(i.canonical.z-1);e.push(r);let n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));e.push(n)}return t.concat(e)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,e){var i;let r=new Set;for(let c of t)this._addTile(c).hasData()||r.add(c);let n=t.reduce((c,l)=>(c[l.key]=l,c),{}),o=this._retainLoadedChildren(n,r),s={},a=Math.max(e-Zi.maxUnderzooming,this._source.minzoom);for(let c of o){let l=this._inViewTiles.getTileById(c.key),u=l==null?void 0:l.wasRequested();for(let h=c.overscaledZ-1;h>=a;--h){let p=c.scaledTo(h);if(s[p.key])break;if(s[p.key]=!0,l=this.getTile(p),!l&&u&&(l=this._addTile(p)),l){let d=l.hasData();if((d||!((i=this.map)===null||i===void 0?void 0:i.cancelPendingTileRequestsWhileZooming)||u)&&(n[p.key]=p),u=l.wasRequested(),d)break}}}return n}_addTile(t){let e=this._inViewTiles.getTileById(t.key);if(e)return e;e=this._outOfViewCache.getAndRemove(t),e&&(e.resetFadeLogic(),this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null));let i=e;return e||(e=new ru(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(e,t.key,e.state)),e.uses++,this._inViewTiles.setTile(t.key,e),i||this._source.fire(new R("dataloading",{tile:e,coord:e.tileID,dataType:"source"})),e}_setTileReloadTimer(t,e){this._clearTileReloadTimer(t);let i=e.getExpiryTimeout();i&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},i))}_clearTileReloadTimer(t){let e=this._timers[t];e&&(clearTimeout(e),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let e=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,e)}}refreshTiles(t){for(let e of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(e);(this._inViewTiles.isIdRenderable(e)||i.state=="errored")&&t.some((r)=>r.equals(i.tileID.canonical))&&this._reloadTile(e,"expired")}}_removeTile(t){let e=this._inViewTiles.getTileById(t);e&&(e.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),e.uses>0||(e.hasData()&&e.state!=="reloading"?this._outOfViewCache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,e,i){let r=[],n=this.transform;if(!n)return r;let o=n.getCoveringTilesDetailsProvider().allowWorldCopies(),s=i?n.getCameraQueryGeometry(t):t,a=(p)=>n.screenPointToMercatorCoordinate(p,this.terrain),c=this.transformBbox(t,a,!o),l=this.transformBbox(s,a,!o),u=this.getIds(),h=Le.fromPoints(l);for(let p of u){let d=this._inViewTiles.getTileById(p);if(d.holdingForSymbolFade())continue;let f=o?[d.tileID]:[d.tileID.unwrapTo(-1),d.tileID.unwrapTo(0)],m=Math.pow(2,n.zoom-d.tileID.overscaledZ),_=e*d.queryPadding*F/d.tileSize/m;for(let y of f){let v=h.map((g)=>y.getTilePoint(new wt(g.x,g.y)));if(v.expandBy(_),v.intersects(p1)){let g=c.map((b)=>y.getTilePoint(b)),x=l.map((b)=>y.getTilePoint(b));r.push({tile:d,tileID:o?y:y.unwrapTo(0),queryGeometry:g,cameraQueryGeometry:x,scale:m})}}}return r}transformBbox(t,e,i){let r=t.map(e);if(i){let n=Le.fromPoints(t);n.shrinkBy(0.001*Math.min(n.width(),n.height()));let o=n.map(e);Le.fromPoints(r).covers(o)||(r=r.map((s)=>s.x>0.5?new wt(s.x-1,s.y,s.z):s))}return r}getVisibleCoordinates(t){let e=this.getRenderableIds(t).map((i)=>this._inViewTiles.getTileById(i).tileID);return this.transform&&this.transform.populateCache(e),e}hasTransition(){return!!this._source.hasTransition()||k_(this._source.type)&&function(t,e){if(e<=0)return!1;let i=St();for(let r of t.getAllTiles())if(r.fadeEndTime>=i)return!0;return!1}(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,e,i){t||(t=gr),this._state.updateState(t,e,i)}removeFeatureState(t,e,i){t||(t=gr),this._state.removeFeatureState(t,e,i)}getFeatureState(t,e){return t||(t=gr),this._state.getState(t,e)}setDependencies(t,e,i){let r=this._inViewTiles.getTileById(t);r&&r.setDependencies(e,i)}reloadTilesForDependencies(t,e){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,e)&&this._reloadTile(i,"reloading");this._outOfViewCache.filter((i)=>!i.hasDependency(t,e))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}Zi.maxUnderzooming=10,Zi.maxOverzooming=3;class B_{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,0.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=_t(t,0,1);let e=1,i=this._distances[e],r=t*this.paddedLength+this.padding;for(;i<r&&e<this._distances.length;)i=this._distances[++e];let n=e-1,o=this._distances[n],s=i-o,a=s>0?(r-o)/s:0;return this.points[n].mult(1-a).add(this.points[e].mult(a))}}function Na(t,e){let i=!0;return t==="always"||t!=="never"&&e!=="never"||(i=!1),i}class cu{constructor(t,e,i){let r=this.boxCells=[],n=this.circleCells=[];this.xCellCount=Math.ceil(t/i),this.yCellCount=Math.ceil(e/i);for(let o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),n.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,i,r,n){this._forEachCell(e,i,r,n,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(n)}insertCircle(t,e,i,r){this._forEachCell(e-r,i-r,e+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(i),this.circles.push(r)}_insertBoxCell(t,e,i,r,n,o){this.boxCells[n].push(o)}_insertCircleCell(t,e,i,r,n,o){this.circleCells[n].push(o)}_query(t,e,i,r,n,o,s){if(i<0||t>this.width||r<0||e>this.height)return[];let a=[];if(t<=0&&e<=0&&this.width<=i&&this.height<=r){if(n)return[{key:null,x1:t,y1:e,x2:i,y2:r}];for(let c=0;c<this.boxKeys.length;c++)a.push({key:this.boxKeys[c],x1:this.bboxes[4*c],y1:this.bboxes[4*c+1],x2:this.bboxes[4*c+2],y2:this.bboxes[4*c+3]});for(let c=0;c<this.circleKeys.length;c++){let l=this.circles[3*c],u=this.circles[3*c+1],h=this.circles[3*c+2];a.push({key:this.circleKeys[c],x1:l-h,y1:u-h,x2:l+h,y2:u+h})}}else this._forEachCell(t,e,i,r,this._queryCell,a,{hitTest:n,overlapMode:o,seenUids:{box:{},circle:{}}},s);return a}query(t,e,i,r){return this._query(t,e,i,r,!1,null)}hitTest(t,e,i,r,n,o){return this._query(t,e,i,r,!0,n,o).length>0}hitTestCircle(t,e,i,r,n){let o=t-i,s=t+i,a=e-i,c=e+i;if(s<0||o>this.width||c<0||a>this.height)return!1;let l=[];return this._forEachCell(o,a,s,c,this._queryCellCircle,l,{hitTest:!0,overlapMode:r,circle:{x:t,y:e,radius:i},seenUids:{box:{},circle:{}}},n),l.length>0}_queryCell(t,e,i,r,n,o,s,a){let{seenUids:c,hitTest:l,overlapMode:u}=s,h=this.boxCells[n];if(h!==null){let f=this.bboxes;for(let m of h)if(!c.box[m]){c.box[m]=!0;let _=4*m,y=this.boxKeys[m];if(t<=f[_+2]+0.000001&&e<=f[_+3]+0.000001&&i>=f[_+0]-0.000001&&r>=f[_+1]-0.000001&&(!a||a(y))&&(!l||!Na(u,y.overlapMode))&&(o.push({key:y,x1:f[_],y1:f[_+1],x2:f[_+2],y2:f[_+3]}),l))return!0}}let d=this.circleCells[n];if(d!==null){let f=this.circles;for(let m of d)if(!c.circle[m]){c.circle[m]=!0;let _=3*m,y=this.circleKeys[m];if(this._circleAndRectCollide(f[_],f[_+1],f[_+2],t,e,i,r)&&(!a||a(y))&&(!l||!Na(u,y.overlapMode))){let v=f[_],g=f[_+1],x=f[_+2];if(o.push({key:y,x1:v-x,y1:g-x,x2:v+x,y2:g+x}),l)return!0}}}return!1}_queryCellCircle(t,e,i,r,n,o,s,a){let{circle:c,seenUids:l,overlapMode:u}=s,h=this.boxCells[n];if(h!==null){let d=this.bboxes;for(let f of h)if(!l.box[f]){l.box[f]=!0;let m=4*f,_=this.boxKeys[f];if(this._circleAndRectCollide(c.x,c.y,c.radius,d[m+0],d[m+1],d[m+2],d[m+3])&&(!a||a(_))&&!Na(u,_.overlapMode))return o.push(!0),!0}}let p=this.circleCells[n];if(p!==null){let d=this.circles;for(let f of p)if(!l.circle[f]){l.circle[f]=!0;let m=3*f,_=this.circleKeys[f];if(this._circlesCollide(d[m],d[m+1],d[m+2],c.x,c.y,c.radius)&&(!a||a(_))&&!Na(u,_.overlapMode))return o.push(!0),!0}}}_forEachCell(t,e,i,r,n,o,s,a){let c=this._convertToXCellCoord(t),l=this._convertToYCellCoord(e),u=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let p=c;p<=u;p++)for(let d=l;d<=h;d++)if(n.call(this,t,e,i,r,this.xCellCount*d+p,o,s,a))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,i,r,n,o){let s=r-t,a=n-e,c=i+o;return c*c>s*s+a*a}_circleAndRectCollide(t,e,i,r,n,o,s){let a=(o-r)/2,c=Math.abs(t-(r+a));if(c>a+i)return!1;let l=(s-n)/2,u=Math.abs(e-(n+l));if(u>l+i)return!1;if(c<=a||u<=l)return!0;let h=c-a,p=u-l;return h*h+p*p<=i*i}}function g1(t,e){let i=1/(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]),r=1/(e[8]*e[8]+e[9]*e[9]+e[10]*e[10]),n=e[0]*i,o=e[4]*i,s=e[8]*r,a=e[1]*i,c=e[5]*i,l=e[9]*r,u=e[2]*i,h=e[6]*i,p=e[10]*r;t[0]=n,t[1]=o,t[2]=s,t[4]=a,t[5]=c,t[6]=l,t[8]=u,t[9]=h,t[10]=p;let d=e[12],f=e[13],m=e[14];return t[12]=-n*d-a*f-u*m,t[13]=-o*d-c*f-h*m,t[14]=-s*d-l*f-p*m,t[3]=0,t[7]=0,t[11]=0,t[15]=1,t}let y1=Ci();function hu(t,e,i){let r=Ci();if(!t){let{vecSouth:h,vecEast:p}=uu(e),d=hd();d[0]=p[0],d[1]=p[1],d[2]=h[0],d[3]=h[1],n=d,(u=(s=(o=d)[0])*(l=o[3])-(c=o[2])*(a=o[1]))&&(n[0]=l*(u=1/u),n[1]=-a*u,n[2]=-c*u,n[3]=s*u),r[0]=d[0],r[1]=d[1],r[4]=d[2],r[5]=d[3]}var n,o,s,a,c,l,u;return Wt(r,r,[1/i,1/i,1]),r}function v1(t,e,i,r){if(t){let n=Ci();if(!e){let{vecSouth:o,vecEast:s}=uu(i);n[0]=s[0],n[1]=s[1],n[4]=o[0],n[5]=o[1]}return Wt(n,n,[r,r,1]),n}return i.pixelsToClipSpaceMatrix}function uu(t){let e=Math.cos(t.rollInRadians),i=Math.sin(t.rollInRadians),r=Math.cos(t.pitchInRadians),n=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),s=Sl();s[0]=-n*r*i-o*e,s[1]=-o*r*i+n*e;let a=yd(s);a<0.000000001?vd(s):gd(s,s,1/a);let c=Sl();c[0]=n*r*e-o*i,c[1]=o*r*e+n*i;let l=yd(c);return l<0.000000001?vd(c):gd(c,c,1/l),{vecEast:c,vecSouth:s}}function du(t,e,i,r){let n;r?(n=[t,e,r(t,e),1],Yt(n,n,i)):(n=[t,e,0,1],mu(n,n,i));let o=n[3];return{point:new z(n[0]/o,n[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function O_(t,e){return 0.5+t/e*0.5}function x1(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function b1(t,e,i,r,n,o,s,a,c,l,u,h,p){let d=i?t.textSizeData:t.iconSizeData,f=Sa(d,e.transform.zoom),m=[256/e.width*2+1,256/e.height*2+1],_=i?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;_.clear();let y=t.lineVertexArray,v=i?t.text.placedSymbolArray:t.icon.placedSymbolArray,g=e.transform.width/e.transform.height,x=!1;for(let b=0;b<v.length;b++){let w=v.get(b);if(w.hidden||w.writingMode===$t.vertical&&!x){mn(w.numGlyphs,_);continue}x=!1;let T=new z(w.anchorX,w.anchorY),P={getElevation:p,pitchedLabelPlaneMatrix:r,lineVertexArray:y,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:T,unwrappedTileID:c,width:l,height:u,translation:h},S=$_(w.anchorX,w.anchorY,P);if(!x1(S.point,m)){mn(w.numGlyphs,_);continue}let E=O_(e.transform.cameraToCenterDistance,S.signedDistanceFromCamera),I=dh(d,f,w),C=o?I*e.transform.getPitchedTextCorrection(w.anchorX,w.anchorY,c)/E:I*E,A=V_({projectionContext:P,pitchedLabelPlaneMatrixInverse:n,symbol:w,fontSize:C,flip:!1,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:g,rotateToLine:a});x=A.useVertical,(A.notEnoughRoom||x||A.needsFlipping&&V_({projectionContext:P,pitchedLabelPlaneMatrixInverse:n,symbol:w,fontSize:C,flip:!0,keepUpright:s,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:_,aspectRatio:g,rotateToLine:a}).notEnoughRoom)&&mn(w.numGlyphs,_)}i?t.text.dynamicLayoutVertexBuffer.updateData(_):t.icon.dynamicLayoutVertexBuffer.updateData(_)}function j_(t,e,i,r,n,o,s,a){let c=o.glyphStartIndex+o.numGlyphs,l=o.lineStartIndex,u=o.lineStartIndex+o.lineLength,h=e.getoffsetX(o.glyphStartIndex),p=e.getoffsetX(c-1),d=Ua(t*h,i,r,n,o.segment,l,u,a,s);if(!d)return null;let f=Ua(t*p,i,r,n,o.segment,l,u,a,s);return f?a.projectionCache.anyProjectionOccluded?null:{first:d,last:f}:null}function N_(t,e,i,r){return t===$t.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*r?{useVertical:!0}:(t===$t.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function V_(t){let{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:n,flip:o,keepUpright:s,glyphOffsetArray:a,dynamicLayoutVertexArray:c,aspectRatio:l,rotateToLine:u}=t,h=n/24,p=r.lineOffsetX*h,d=r.lineOffsetY*h,f;if(r.numGlyphs>1){let m=r.glyphStartIndex+r.numGlyphs,_=r.lineStartIndex,y=r.lineStartIndex+r.lineLength,v=j_(h,a,p,d,o,r,u,e);if(!v)return{notEnoughRoom:!0};let g=Va(v.first.point.x,v.first.point.y,e,i),x=Va(v.last.point.x,v.last.point.y,e,i);if(s&&!o){let b=N_(r.writingMode,g,x,l);if(b)return b}f=[v.first];for(let b=r.glyphStartIndex+1;b<m-1;b++){let w=Ua(h*a.getoffsetX(b),p,d,o,r.segment,_,y,e,u);if(!w)return{notEnoughRoom:!0};f.push(w)}f.push(v.last)}else{if(s&&!o){let _=yr(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,y=r.lineStartIndex+r.segment+1,v=new z(e.lineVertexArray.getx(y),e.lineVertexArray.gety(y)),g=yr(v.x,v.y,e),x=g.signedDistanceFromCamera>0?g.point:U_(e.tileAnchorPoint,v,_,1,e),b=Va(_.x,_.y,e,i),w=Va(x.x,x.y,e,i),T=N_(r.writingMode,b,w,l);if(T)return T}let m=Ua(h*a.getoffsetX(r.glyphStartIndex),p,d,o,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,e,u);if(!m||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[m]}for(let m of f)So(c,m.point,m.angle);return{}}function U_(t,e,i,r,n){let o=t.add(t.sub(e)._unit()),s=yr(o.x,o.y,n).point,a=i.sub(s);return i.add(a._mult(r/a.mag()))}function pu(t,e,i){let r=e.projectionCache;if(r.projections[t])return r.projections[t];let n=new z(e.lineVertexArray.getx(t),e.lineVertexArray.gety(t)),o=yr(n.x,n.y,e);if(o.signedDistanceFromCamera>0)return r.projections[t]=o.point,r.anyProjectionOccluded||(r.anyProjectionOccluded=o.isOccluded),o.point;let s=t-i.direction;return U_(i.distanceFromAnchor===0?e.tileAnchorPoint:new z(e.lineVertexArray.getx(s),e.lineVertexArray.gety(s)),n,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function yr(t,e,i){let r=t+i.translation[0],n=e+i.translation[1],o;return i.pitchWithMap?(o=du(r,n,i.pitchedLabelPlaneMatrix,i.getElevation),o.isOccluded=!1):(o=i.transform.projectTileCoordinates(r,n,i.unwrappedTileID,i.getElevation),o.point.x=(0.5*o.point.x+0.5)*i.width,o.point.y=(0.5*-o.point.y+0.5)*i.height),o}function Va(t,e,i,r){if(i.pitchWithMap){let n=[t,e,0,1];return Yt(n,n,r),i.transform.projectTileCoordinates(n[0]/n[3],n[1]/n[3],i.unwrappedTileID,i.getElevation).point}return{x:t/i.width*2-1,y:1-e/i.height*2}}function $_(t,e,i){return i.transform.projectTileCoordinates(t,e,i.unwrappedTileID,i.getElevation)}function fu(t,e,i){return t._unit()._perp()._mult(e*i)}function w1(t,e,i,r,n,o,s,a,c){if(a.projectionCache.offsets[t])return a.projectionCache.offsets[t];let l=i.add(e);if(t+c.direction<r||t+c.direction>=n)return a.projectionCache.offsets[t]=l,l;let u=pu(t+c.direction,a,c),h=fu(u.sub(i),s,c.direction),p=i.add(h),d=u.add(h);return a.projectionCache.offsets[t]=function(f,m,_,y){let v=m.y-f.y,g=m.x-f.x,x=y.y-_.y,b=y.x-_.x,w=x*g-b*v;if(w===0)return null;let T=(b*(f.y-_.y)-x*(f.x-_.x))/w;return new z(f.x+T*g,f.y+T*v)}(o,l,p,d)||l,a.projectionCache.offsets[t]}function Ua(t,e,i,r,n,o,s,a,c){let l=r?t-e:t+e,u=l>0?1:-1,h=0;r&&(u*=-1,h=Math.PI),u<0&&(h+=Math.PI);let p,d=u>0?o+n:o+n+1;a.projectionCache.cachedAnchorPoint?p=a.projectionCache.cachedAnchorPoint:(p=yr(a.tileAnchorPoint.x,a.tileAnchorPoint.y,a).point,a.projectionCache.cachedAnchorPoint=p);let f,m,_=p,y=p,v=0,g=0,x=Math.abs(l),b=[],w;for(;v+g<=x;){if(d+=u,d<o||d>=s)return null;v+=g,y=_,m=f;let S={absOffsetX:x,direction:u,distanceFromAnchor:v,previousVertex:y};if(_=pu(d,a,S),i===0)b.push(y),w=_.sub(y);else{let E,I=_.sub(y);E=I.mag()===0?fu(pu(d+u,a,S).sub(_),i,u):fu(I,i,u),m||(m=y.add(E)),f=w1(d,E,_,o,s,m,i,a,S),b.push(m),w=f.sub(m)}g=w.mag()}let T=w._mult((x-v)/g)._add(m||y),P=h+Math.atan2(_.y-y.y,_.x-y.x);return b.push(T),{point:T,angle:c?P:0,path:b}}let T1=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function mn(t,e){for(let i=0;i<t;i++){let r=e.length;e.resize(r+4),e.float32.set(T1,3*r)}}function mu(t,e,i){let r=e[0],n=e[1];return t[0]=i[0]*r+i[4]*n+i[12],t[1]=i[1]*r+i[5]*n+i[13],t[3]=i[3]*r+i[7]*n+i[15],t}let re=100;class Z_{constructor(t,e=new cu(t.width+200,t.height+200,25),i=new cu(t.width+200,t.height+200,25)){this.transform=t,this.grid=e,this.ignoredGrid=i,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+re,this.screenBottomBoundary=t.height+re,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=0.6}placeCollisionBox(t,e,i,r,n,o,s,a,c,l,u,h){let p=this.projectAndGetPerspectiveRatio(t.anchorPointX+a[0],t.anchorPointY+a[1],n,l,h),d=i*p.perspectiveRatio,f;if(o||s)f=this._projectCollisionBox(t,d,r,n,o,s,a,p,l,u,h);else{let b=p.x+(u?u.x*d:0),w=p.y+(u?u.y*d:0);f={allPointsOccluded:!1,box:[b+t.x1*d,w+t.y1*d,b+t.x2*d,w+t.y2*d]}}let[m,_,y,v]=f.box,g=o?f.allPointsOccluded:p.isOccluded,x=g;return x||(x=p.perspectiveRatio<this.perspectiveRatioCutoff),x||(x=!this.isInsideGrid(m,_,y,v)),x||e!=="always"&&this.grid.hitTest(m,_,y,v,e,c)?{box:[m,_,y,v],placeable:!1,offscreen:!1,occluded:g}:{box:[m,_,y,v],placeable:!0,offscreen:this.isOffscreen(m,_,y,v),occluded:g}}placeCollisionCircles(t,e,i,r,n,o,s,a,c,l,u,h,p,d){let f=[],m=new z(e.anchorX,e.anchorY),_=this.getPerspectiveRatio(m.x,m.y,o,d),y=(c?n*this.transform.getPitchedTextCorrection(e.anchorX,e.anchorY,o)/_:n*_)/24,v={getElevation:d,pitchedLabelPlaneMatrix:s,lineVertexArray:i,pitchWithMap:c,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:m,unwrappedTileID:o,width:this.transform.width,height:this.transform.height,translation:p},g=j_(y,r,e.lineOffsetX*y,e.lineOffsetY*y,!1,e,!1,v),x=!1,b=!1,w=!0;if(g){let T=0.5*u*_+h,P=new z(-100,-100),S=new z(this.screenRightBoundary,this.screenBottomBoundary),E=new B_,{first:I,last:C}=g,A=[];for(let L=I.path.length-1;L>=1;L--)A.push(I.path[L]);for(let L=1;L<C.path.length;L++)A.push(C.path[L]);let M=2.5*T;if(c){let L=this.projectPathToScreenSpace(A,v);A=L.some((O)=>O.signedDistanceFromCamera<=0)?[]:L.map((O)=>O.point)}let k=[];if(A.length>0){let L=A[0].clone(),O=A[0].clone();for(let q=1;q<A.length;q++)L.x=Math.min(L.x,A[q].x),L.y=Math.min(L.y,A[q].y),O.x=Math.max(O.x,A[q].x),O.y=Math.max(O.y,A[q].y);k=L.x>=P.x&&O.x<=S.x&&L.y>=P.y&&O.y<=S.y?[A]:O.x<P.x||L.x>S.x||O.y<P.y||L.y>S.y?[]:function(q,Q,rt,nt,lt){let pt=[];for(let Pt of q){let yt;for(let Dt=0;Dt<Pt.length-1;Dt++){let H=Pt[Dt],ft=Pt[Dt+1];H.x<Q&&ft.x<Q||(H.x<Q?H=new z(Q,H.y+(Q-H.x)/(ft.x-H.x)*(ft.y-H.y))._round():ft.x<Q&&(ft=new z(Q,H.y+(Q-H.x)/(ft.x-H.x)*(ft.y-H.y))._round()),H.y<rt&&ft.y<rt||(H.y<rt?H=new z(H.x+(rt-H.y)/(ft.y-H.y)*(ft.x-H.x),rt)._round():ft.y<rt&&(ft=new z(H.x+(rt-H.y)/(ft.y-H.y)*(ft.x-H.x),rt)._round()),H.x>=nt&&ft.x>=nt||(H.x>=nt?H=new z(nt,H.y+(nt-H.x)/(ft.x-H.x)*(ft.y-H.y))._round():ft.x>=nt&&(ft=new z(nt,H.y+(nt-H.x)/(ft.x-H.x)*(ft.y-H.y))._round()),H.y>=lt&&ft.y>=lt||(H.y>=lt?H=new z(H.x+(lt-H.y)/(ft.y-H.y)*(ft.x-H.x),lt)._round():ft.y>=lt&&(ft=new z(H.x+(lt-H.y)/(ft.y-H.y)*(ft.x-H.x),lt)._round()),yt&&H.equals(yt[yt.length-1])||(yt=[H],pt.push(yt)),yt.push(ft)))))}}return pt}([A],P.x,P.y,S.x,S.y)}for(let L of k){E.reset(L,0.25*T);let O=0;O=E.length<=0.5*T?1:Math.ceil(E.paddedLength/M)+1;for(let q=0;q<O;q++){let Q=q/Math.max(O-1,1),rt=E.lerp(Q),nt=rt.x+re,lt=rt.y+re;f.push(nt,lt,T,0);let pt=nt-T,Pt=lt-T,yt=nt+T,Dt=lt+T;if(w&&(w=this.isOffscreen(pt,Pt,yt,Dt)),b||(b=this.isInsideGrid(pt,Pt,yt,Dt)),t!=="always"&&this.grid.hitTestCircle(nt,lt,T,t,l)&&(x=!0,!a))return{circles:[],offscreen:!1,collisionDetected:x}}}}return{circles:!a&&x||!b||_<this.perspectiveRatioCutoff?[]:f,offscreen:w,collisionDetected:x}}projectPathToScreenSpace(t,e){let i=function(r,n){let o=y1;return function(s,a){let c=1/(a[0]*a[5]-a[1]*a[4]);s[0]=a[5]*c,s[1]=-a[1]*c,s[2]=0,s[3]=0,s[4]=-a[4]*c,s[5]=a[0]*c,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1/a[10],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1/a[15]}(o,n.pitchedLabelPlaneMatrix),r.map((s)=>{let a=du(s.x,s.y,o,n.getElevation),c=n.transform.projectTileCoordinates(a.point.x,a.point.y,n.unwrappedTileID,n.getElevation);return c.point.x=(0.5*c.point.x+0.5)*n.width,c.point.y=(0.5*-c.point.y+0.5)*n.height,c})}(t,e);return function(r){let n=0,o=0,s=0,a=0;for(let c=0;c<r.length;c++)r[c].isOccluded?(s=c+1,a=0):(a++,a>o&&(o=a,n=s));return r.slice(n,n+o)}(i)}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let e=[],i=new Le;for(let u of t){let h=new z(u.x+re,u.y+re);i.extend(h),e.push(h)}let{minX:r,minY:n,maxX:o,maxY:s}=i,a=this.grid.query(r,n,o,s).concat(this.ignoredGrid.query(r,n,o,s)),c={},l={};for(let u of a){let h=u.key;c[h.bucketInstanceId]===void 0&&(c[h.bucketInstanceId]={}),c[h.bucketInstanceId][h.featureIndex]||Sf(e,[new z(u.x1,u.y1),new z(u.x2,u.y1),new z(u.x2,u.y2),new z(u.x1,u.y2)])&&(c[h.bucketInstanceId][h.featureIndex]=!0,l[h.bucketInstanceId]===void 0&&(l[h.bucketInstanceId]=[]),l[h.bucketInstanceId].push(h.featureIndex))}return l}insertCollisionBox(t,e,i,r,n,o){(i?this.ignoredGrid:this.grid).insert({bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,i,r,n,o){let s=i?this.ignoredGrid:this.grid,a={bucketInstanceId:r,featureIndex:n,collisionGroupID:o,overlapMode:e};for(let c=0;c<t.length;c+=4)s.insertCircle(a,t[c],t[c+1],t[c+2])}projectAndGetPerspectiveRatio(t,e,i,r,n){if(n){let o;r?(o=[t,e,r(t,e),1],Yt(o,o,n)):(o=[t,e,0,1],mu(o,o,n));let s=o[3];return{x:(o[0]/s+1)/2*this.transform.width+re,y:(-o[1]/s+1)/2*this.transform.height+re,perspectiveRatio:0.5+this.transform.cameraToCenterDistance/s*0.5,isOccluded:!1,signedDistanceFromCamera:s}}{let o=this.transform.projectTileCoordinates(t,e,i,r);return{x:(o.point.x+1)/2*this.transform.width+re,y:(1-o.point.y)/2*this.transform.height+re,perspectiveRatio:0.5+this.transform.cameraToCenterDistance/o.signedDistanceFromCamera*0.5,isOccluded:o.isOccluded,signedDistanceFromCamera:o.signedDistanceFromCamera}}}getPerspectiveRatio(t,e,i,r){let n=this.transform.projectTileCoordinates(t,e,i,r);return 0.5+this.transform.cameraToCenterDistance/n.signedDistanceFromCamera*0.5}isOffscreen(t,e,i,r){return i<re||t>=this.screenRightBoundary||r<re||e>this.screenBottomBoundary}isInsideGrid(t,e,i,r){return i>=0&&t<this.gridRightBoundary&&r>=0&&e<this.gridBottomBoundary}getViewportMatrix(){let t=He([]);return Ot(t,t,[-100,-100,0]),t}_projectCollisionBox(t,e,i,r,n,o,s,a,c,l,u){let h=1,p=0,d=0,f=1,m=t.anchorPointX+s[0],_=t.anchorPointY+s[1];if(o&&!n){let A=this.projectAndGetPerspectiveRatio(m+1,_,r,c,u),M=A.x-a.x,k=Math.atan((A.y-a.y)/M)+(M<0?Math.PI:0),L=Math.sin(k),O=Math.cos(k);h=O,p=L,d=-L,f=O}else if(!o&&n){let A=uu(this.transform);h=A.vecEast[0],p=A.vecEast[1],d=A.vecSouth[0],f=A.vecSouth[1]}let{x:y,y:v}=a,g=e;n&&(y=m,v=_,g=Math.pow(2,-(this.transform.zoom-i.overscaledZ)),g*=this.transform.getPitchedTextCorrection(m,_,r),l||(g*=_t(0.5+a.signedDistanceFromCamera/this.transform.cameraToCenterDistance*0.5,0,4))),l&&(y+=h*l.x*g+d*l.y*g,v+=p*l.x*g+f*l.y*g);let x=t.x1*g,b=t.x2*g,w=(x+b)/2,T=t.y1*g,P=t.y2*g,S=(T+P)/2,E=[{offsetX:x,offsetY:T},{offsetX:w,offsetY:T},{offsetX:b,offsetY:T},{offsetX:b,offsetY:S},{offsetX:b,offsetY:P},{offsetX:w,offsetY:P},{offsetX:x,offsetY:P},{offsetX:x,offsetY:S}],I=[];for(let{offsetX:A,offsetY:M}of E)I.push(new z(y+h*A+d*M,v+p*A+f*M));let C=!1;if(n){let A=I.map((M)=>this.projectAndGetPerspectiveRatio(M.x,M.y,r,c,u));C=A.some((M)=>!M.isOccluded),I=A.map((M)=>new z(M.x,M.y))}else C=!0;return{box:p0(I),allPointsOccluded:!C}}}class _u extends z{constructor(t,e,i,r){super(t,e),this.angle=i,r!==void 0&&(this.segment=r)}clone(){return new _u(this.x,this.y,this.angle,this.segment)}}var $a;U("Anchor",_u),function(t){t[t.center=1]="center",t[t.left=2]="left",t[t.right=3]="right",t[t.top=4]="top",t[t.bottom=5]="bottom",t[t["top-left"]=6]="top-left",t[t["top-right"]=7]="top-right",t[t["bottom-left"]=8]="bottom-left",t[t["bottom-right"]=9]="bottom-right"}($a||($a={}));class gu{constructor(t,e,i,r){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}}class _n{constructor(t,e,i,r,n){this.text=new gu(t?t.text:null,e,i,n),this.icon=new gu(t?t.icon:null,e,r,n)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class yu{constructor(t,e,i){this.text=t,this.icon=e,this.skipFade=i}}class G_{constructor(t,e,i,r,n){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=n}}class q_{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:(i)=>i.collisionGroupID===e}}return this.collisionGroups[t]}}function W_(t,e,i,r,n){let{horizontalAlign:o,verticalAlign:s}=Sm(t);return new z(-(o-0.5)*e+r[0]*n,-(s-0.5)*i+r[1]*n)}class H_{constructor(t,e,i,r,n){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new Z_(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new q_(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){let e=this.terrain;return e?(i,r)=>e.getElevation(t,i,r):null}getBucketParts(t,e,i,r){let n=i.getBucket(e),o=i.latestFeatureIndex;if(!n||!o||e.id!==n.layerIds[0])return;let s=i.collisionBoxArray,a=n.layers[0].layout,c=n.layers[0].paint,l=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),u=i.tileSize/F,h=i.tileID.toUnwrapped(),p=a.get("text-rotation-alignment")==="map",d=Me(i,1,this.transform.zoom),f=zi(this.collisionIndex.transform,i,c.get("text-translate"),c.get("text-translate-anchor")),m=zi(this.collisionIndex.transform,i,c.get("icon-translate"),c.get("icon-translate-anchor")),_=hu(p,this.transform,d);this.retainedQueryData[n.bucketInstanceId]=new G_(n.bucketInstanceId,o,n.sourceLayerIndex,n.index,i.tileID);let y={bucket:n,layout:a,translationText:f,translationIcon:m,unwrappedTileID:h,pitchedLabelPlaneMatrix:_,scale:l,textPixelRatio:u,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:Sa(n.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(n.sourceID)};if(r)for(let v of n.sortKeyRanges){let{sortKey:g,symbolInstanceStart:x,symbolInstanceEnd:b}=v;t.push({sortKey:g,symbolInstanceStart:x,symbolInstanceEnd:b,parameters:y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:n.symbolInstances.length,parameters:y})}attemptAnchorPlacement(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v,g){var x,b,w;let T=$a[t.textAnchor],P=[t.textOffset0,t.textOffset1],S=W_(T,i,r,P,n),E=this.collisionIndex.placeCollisionBox(e,h,a,c,l,s,o,m,u.predicate,v,S,g);if((!y||this.collisionIndex.placeCollisionBox(y,h,a,c,l,s,o,_,u.predicate,v,S,g).placeable)&&E.placeable){let I;if(((x=this.prevPlacement)===null||x===void 0?void 0:x.variableOffsets[p.crossTileID])&&((w=(b=this.prevPlacement)===null||b===void 0?void 0:b.placements[p.crossTileID])===null||w===void 0?void 0:w.text)&&(I=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[p.crossTileID]={textOffset:P,width:i,height:r,anchor:T,textBoxScale:n,prevAnchor:I},this.markUsedJustification(d,T,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:S,placedGlyphBoxes:E}}}placeLayerBucketPart(t,e,i){let{bucket:r,layout:n,translationText:o,translationIcon:s,unwrappedTileID:a,pitchedLabelPlaneMatrix:c,textPixelRatio:l,holdingForFade:u,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:d}=t.parameters,f=n.get("text-optional"),m=n.get("icon-optional"),_=Pa(n,"text-overlap","text-allow-overlap"),y=_==="always",v=Pa(n,"icon-overlap","icon-allow-overlap"),g=v==="always",x=n.get("text-rotation-alignment")==="map",b=n.get("text-pitch-alignment")==="map",w=n.get("icon-text-fit")!=="none",T=n.get("symbol-z-order")==="viewport-y",P=y&&(g||!r.hasIconData()||m),S=g&&(y||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);let E=this.retainedQueryData[r.bucketInstanceId].tileID,I=this._getTerrainElevationFunc(E),C=this.transform.getFastPathSimpleProjectionMatrix(E),A=(M,k,L)=>{var O,q;if(e[M.crossTileID])return;if(u)return void(this.placements[M.crossTileID]=new yu(!1,!1,!1));let Q=!1,rt=!1,nt=!0,lt=null,pt={box:null,placeable:!1,offscreen:null,occluded:!1},Pt={placeable:!1},yt=null,Dt=null,H=null,ft=0,Sn=0,qo=0;k.textFeatureIndex?ft=k.textFeatureIndex:M.useRuntimeCollisionCircles&&(ft=M.featureIndex),k.verticalTextFeatureIndex&&(Sn=k.verticalTextFeatureIndex);let br=k.textBox;if(br){let vi=(le)=>{let fe=$t.horizontal;if(r.allowVerticalPlacement&&!le&&this.prevPlacement){let Fe=this.prevPlacement.placedOrientations[M.crossTileID];Fe&&(this.placedOrientations[M.crossTileID]=Fe,fe=Fe,this.markUsedOrientation(r,fe,M))}return fe},Wi=(le,fe)=>{if(r.allowVerticalPlacement&&M.numVerticalGlyphVertices>0&&k.verticalTextBox){for(let Fe of r.writingModes)if(Fe===$t.vertical?(pt=fe(),Pt=pt):pt=le(),pt==null?void 0:pt.placeable)break}else pt=le()},{textAnchorOffsetStartIndex:Mn,textAnchorOffsetEndIndex:wr}=M;if(wr===Mn){let le=(fe,Fe)=>{let Jt=this.collisionIndex.placeCollisionBox(fe,_,l,E,a,b,x,o,d.predicate,I,void 0,C);return(Jt==null?void 0:Jt.placeable)&&(this.markUsedOrientation(r,Fe,M),this.placedOrientations[M.crossTileID]=Fe),Jt};Wi(()=>le(br,$t.horizontal),()=>{let fe=k.verticalTextBox;return r.allowVerticalPlacement&&M.numVerticalGlyphVertices>0&&fe?le(fe,$t.vertical):{box:null,offscreen:null}}),vi(pt==null?void 0:pt.placeable)}else{let le=$a[(q=(O=this.prevPlacement)===null||O===void 0?void 0:O.variableOffsets[M.crossTileID])===null||q===void 0?void 0:q.anchor],fe=(Jt,Hi,Cn)=>{let td=Jt.x2-Jt.x1,ed=Jt.y2-Jt.y1,id=M.textBoxScale,$b=w&&v==="never"?Hi:null,Tr=null,r0=_==="never"?1:2,n0="never";le&&r0++;for(let o0=0;o0<r0;o0++){for(let rd=Mn;rd<wr;rd++){let s0=r.textAnchorOffsets.get(rd);if(le&&s0.textAnchor!==le)continue;let nd=this.attemptAnchorPlacement(s0,Jt,td,ed,id,x,b,l,E,a,d,n0,M,r,Cn,o,s,$b,I);if(nd&&(Tr=nd.placedGlyphBoxes,Tr==null?void 0:Tr.placeable))return Q=!0,lt=nd.shift,Tr}le?le=null:n0=_}return i&&!Tr&&(Tr={box:this.collisionIndex.placeCollisionBox(br,"always",l,E,a,b,x,o,d.predicate,I,void 0,C).box,offscreen:!1,placeable:!1,occluded:!1}),Tr};Wi(()=>fe(br,k.iconBox,$t.horizontal),()=>{let Jt=k.verticalTextBox;return r.allowVerticalPlacement&&!(pt==null?void 0:pt.placeable)&&M.numVerticalGlyphVertices>0&&Jt?fe(Jt,k.verticalIconBox,$t.vertical):{box:null,occluded:!0,offscreen:null}}),pt&&(Q=pt.placeable,nt=pt.offscreen);let Fe=vi(pt==null?void 0:pt.placeable);if(!Q&&this.prevPlacement){let Jt=this.prevPlacement.variableOffsets[M.crossTileID];Jt&&(this.variableOffsets[M.crossTileID]=Jt,this.markUsedJustification(r,Jt.anchor,M,Fe))}}}if(yt=pt,Q=yt==null?void 0:yt.placeable,nt=yt==null?void 0:yt.offscreen,M.useRuntimeCollisionCircles&&M.centerJustifiedTextSymbolIndex>=0){let vi=r.text.placedSymbolArray.get(M.centerJustifiedTextSymbolIndex),Wi=dh(r.textSizeData,p,vi),Mn=n.get("text-padding");Dt=this.collisionIndex.placeCollisionCircles(_,vi,r.lineVertexArray,r.glyphOffsetArray,Wi,a,c,i,b,d.predicate,M.collisionCircleDiameter,Mn,o,I),Dt.circles.length&&Dt.collisionDetected&&!i&&Ct("Collisions detected, but collision boxes are not shown"),Q=y||Dt.circles.length>0&&!Dt.collisionDetected,nt&&(nt=Dt.offscreen)}if(k.iconFeatureIndex&&(qo=k.iconFeatureIndex),k.iconBox){let vi=(Wi)=>this.collisionIndex.placeCollisionBox(Wi,v,l,E,a,b,x,s,d.predicate,I,w&&lt?lt:void 0,C);Pt&&Pt.placeable&&k.verticalIconBox?(H=vi(k.verticalIconBox),rt=H.placeable):(H=vi(k.iconBox),rt=H.placeable),nt&&(nt=H.offscreen)}let Pn=f||M.numHorizontalGlyphVertices===0&&M.numVerticalGlyphVertices===0,In=m||M.numIconVertices===0;Pn||In?In?Pn||rt&&(rt=Q):Q=rt&&Q:rt=Q=rt&&Q;let En=rt&&H.placeable;if(Q&&yt.placeable&&this.collisionIndex.insertCollisionBox(yt.box,_,n.get("text-ignore-placement"),r.bucketInstanceId,Pt&&Pt.placeable&&Sn?Sn:ft,d.ID),En&&this.collisionIndex.insertCollisionBox(H.box,v,n.get("icon-ignore-placement"),r.bucketInstanceId,qo,d.ID),Dt&&Q&&this.collisionIndex.insertCollisionCircles(Dt.circles,_,n.get("text-ignore-placement"),r.bucketInstanceId,ft,d.ID),i&&this.storeCollisionData(r.bucketInstanceId,L,k,yt,H,Dt),M.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw Error("bucket.bucketInstanceId can't be 0");this.placements[M.crossTileID]=new yu((Q||P)&&!(yt==null?void 0:yt.occluded),(rt||S)&&!(H==null?void 0:H.occluded),nt||r.justReloaded),e[M.crossTileID]=!0};if(T){if(t.symbolInstanceStart!==0)throw Error("bucket.bucketInstanceId should be 0");let M=r.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let k=M.length-1;k>=0;--k){let L=M[k];A(r.symbolInstances.get(L),r.collisionArrays[L],L)}}else for(let M=t.symbolInstanceStart;M<t.symbolInstanceEnd;M++)A(r.symbolInstances.get(M),r.collisionArrays[M],M);r.justReloaded=!1}storeCollisionData(t,e,i,r,n,o){if(i.textBox||i.iconBox){let s,a;this.collisionBoxArrays.has(t)?s=this.collisionBoxArrays.get(t):(s=new Map,this.collisionBoxArrays.set(t,s)),s.has(e)?a=s.get(e):(a={text:null,icon:null},s.set(e,a)),i.textBox&&(a.text=r.box),i.iconBox&&(a.icon=n.box)}if(o){let s=this.collisionCircleArrays[t];s===void 0&&(s=this.collisionCircleArrays[t]=[]);for(let a=0;a<o.circles.length;a+=4)s.push(o.circles[a+0]-re),s.push(o.circles[a+1]-re),s.push(o.circles[a+2]),s.push(o.collisionDetected?1:0)}}markUsedJustification(t,e,i,r){let n;n=r===$t.vertical?i.verticalPlacedTextSymbolIndex:{left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex}[function(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}(e)];let o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let s of o)s>=0&&(t.text.placedSymbolArray.get(s).crossTileID=n>=0&&s!==n?0:i.crossTileID)}markUsedOrientation(t,e,i){let r=e===$t.horizontal||e===$t.horizontalOnly?e:0,n=e===$t.vertical?e:0,o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let s of o)t.text.placedSymbolArray.get(s).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=n)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let e=this.prevPlacement,i=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;let r=e?e.symbolFadeChange(t):1,n=e?e.opacities:{},o=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(let a in this.placements){let c=this.placements[a],l=n[a];l?(this.opacities[a]=new _n(l,r,c.text,c.icon),i||(i=c.text!==l.text.placed),i||(i=c.icon!==l.icon.placed)):(this.opacities[a]=new _n(null,r,c.text,c.icon,c.skipFade),i||(i=c.text||c.icon))}for(let a in n){let c=n[a];if(!this.opacities[a]){let l=new _n(c,r,!1,!1);l.isHidden()||(this.opacities[a]=l,i||(i=c.text.placed),i||(i=c.icon.placed))}}for(let a in o)this.variableOffsets[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.variableOffsets[a]=o[a]);for(let a in s)this.placedOrientations[a]||!this.opacities[a]||this.opacities[a].isHidden()||(this.placedOrientations[a]=s[a]);if(e&&e.lastPlacementChangeTime===void 0)throw Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){let i={};for(let r of e){let n=r.getBucket(t);n&&r.latestFeatureIndex&&t.id===n.layerIds[0]&&this.updateBucketOpacities(n,r.tileID,i,r.collisionBoxArray)}}updateBucketOpacities(t,e,i,r){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let n=t.layers[0],o=n.layout,s=new _n(null,0,!1,!1,!0),a=o.get("text-allow-overlap"),c=o.get("icon-allow-overlap"),l=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),u=o.get("text-rotation-alignment")==="map",h=o.get("text-pitch-alignment")==="map",p=o.get("icon-text-fit")!=="none",d=new _n(null,0,a&&(c||!t.hasIconData()||o.get("icon-optional")),c&&(a||!t.hasTextData()||o.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let f=(_,y,v)=>{for(let g=0;g<y/4;g++)_.opacityVertexArray.emplaceBack(v);_.hasVisibleVertices||(_.hasVisibleVertices=v!==Bo)},m=this.collisionBoxArrays.get(t.bucketInstanceId);for(let _=0;_<t.symbolInstances.length;_++){let y=t.symbolInstances.get(_),{numHorizontalGlyphVertices:v,numVerticalGlyphVertices:g,crossTileID:x}=y,b=this.opacities[x];i[x]?b=s:b||(b=d,this.opacities[x]=b),i[x]=!0;let w=y.numIconVertices>0,T=this.placedOrientations[y.crossTileID],P=T===$t.vertical,S=T===$t.horizontal||T===$t.horizontalOnly;if(v>0||g>0){let I=Y_(b.text);f(t.text,v,P?Bo:I),f(t.text,g,S?Bo:I);let C=b.text.isHidden(),A=[y.rightJustifiedTextSymbolIndex,y.centerJustifiedTextSymbolIndex,y.leftJustifiedTextSymbolIndex];for(let L of A)L>=0&&(t.text.placedSymbolArray.get(L).hidden=C||P?1:0);y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(y.verticalPlacedTextSymbolIndex).hidden=C||S?1:0);let M=this.variableOffsets[y.crossTileID];M&&this.markUsedJustification(t,M.anchor,y,T);let k=this.placedOrientations[y.crossTileID];k&&(this.markUsedJustification(t,"left",y,k),this.markUsedOrientation(t,k,y))}if(w){let I=Y_(b.icon),C=!(p&&y.verticalPlacedIconSymbolIndex&&P);y.placedIconSymbolIndex>=0&&(f(t.icon,y.numIconVertices,C?I:Bo),t.icon.placedSymbolArray.get(y.placedIconSymbolIndex).hidden=b.icon.isHidden()),y.verticalPlacedIconSymbolIndex>=0&&(f(t.icon,y.numVerticalIconVertices,C?Bo:I),t.icon.placedSymbolArray.get(y.verticalPlacedIconSymbolIndex).hidden=b.icon.isHidden())}let E=(m==null?void 0:m.has(_))?m.get(_):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let I=t.collisionArrays[_];if(I){let C=new z(0,0);if(I.textBox||I.verticalTextBox){let A=!0;if(l){let M=this.variableOffsets[x];M?(C=W_(M.anchor,M.width,M.height,M.textOffset,M.textBoxScale),u&&C._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):A=!1}if(I.textBox||I.verticalTextBox){let M;I.textBox&&(M=P),I.verticalTextBox&&(M=S),X_(t.textCollisionBox.collisionVertexArray,b.text.placed,!A||M,E.text,C.x,C.y)}}if(I.iconBox||I.verticalIconBox){let A=Boolean(!S&&I.verticalIconBox),M;I.iconBox&&(M=A),I.verticalIconBox&&(M=!A),X_(t.iconCollisionBox.collisionVertexArray,b.icon.placed,M,E.icon,p?C.x:0,p?C.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){let i=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*i>t}setStale(){this.stale=!0}}function X_(t,e,i,r,n,o){r&&r.length!==0||(r=[0,0,0,0]);let s=r[0]-re,a=r[1]-re,c=r[2]-re,l=r[3]-re;t.emplaceBack(e?1:0,i?1:0,n||0,o||0,s,a),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,c,a),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,c,l),t.emplaceBack(e?1:0,i?1:0,n||0,o||0,s,l)}let S1=Math.pow(2,25),P1=Math.pow(2,24),I1=Math.pow(2,17),E1=Math.pow(2,16),M1=Math.pow(2,9),C1=Math.pow(2,8),A1=Math.pow(2,1);function Y_(t){if(t.opacity===0&&!t.placed)return 0;if(t.opacity===1&&t.placed)return 4294967295;let e=t.placed?1:0,i=Math.floor(127*t.opacity);return i*S1+e*P1+i*I1+e*E1+i*M1+e*C1+i*A1+e}let Bo=0;class K_{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,i,r,n){let o=this._bucketParts;for(;this._currentTileIndex<t.length;)if(e.getBucketParts(o,r,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,n())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((s,a)=>s.sortKey-a.sortKey));this._currentPartIndex<o.length;)if(e.placeLayerBucketPart(o[this._currentPartIndex],this._seenCrossTileIDs,i),this._currentPartIndex++,n())return!0;return!1}}class J_{constructor(t,e,i,r,n,o,s,a){this.placement=new H_(t,e,o,s,a),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=n,this._done=!1}isDone(){return this._done}continuePlacement(t,e,i){let r=St(),n=()=>!this._forceFullPlacement&&St()-r>2;for(;this._currentPlacementIndex>=0;){let o=e[t[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(Mm(o)&&o.layout&&(!o.minzoom||o.minzoom<=s)&&(!o.maxzoom||o.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new K_(o)),this._inProgressLayer.continuePlacement(i[o.source],this.placement,this._showCollisionBoxes,o,n))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}let Oo=0.03125;class Q_{constructor(t,e,i){this.tileID=t,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let n=0;n<e.length;n++){let o=e.get(n),s=o.key,a=r.get(s);a?a.push(o):r.set(s,[o])}for(let[n,o]of r){let s={positions:o.map((a)=>({x:Math.floor(a.anchorX*Oo),y:Math.floor(a.anchorY*Oo)})),crossTileIDs:o.map((a)=>a.crossTileID)};if(s.positions.length>128){let a=new sh(s.positions.length,16,Uint16Array);for(let{x:c,y:l}of s.positions)a.add(c,l);a.finish(),delete s.positions,s.index=a}this._symbolsByKey[n]=s}}getScaledCoordinates(t,e){let{x:i,y:r,z:n}=this.tileID.canonical,{x:o,y:s,z:a}=e.canonical,c=Oo/Math.pow(2,a-n),l=(s*F+t.anchorY)*c,u=r*F*Oo;return{x:Math.floor((o*F+t.anchorX)*c-i*F*Oo),y:Math.floor(l-u)}}findMatches(t,e,i){let r=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let n=0;n<t.length;n++){let o=t.get(n);if(o.crossTileID)continue;let s=this._symbolsByKey[o.key];if(!s)continue;let a=this.getScaledCoordinates(o,e);if(s.index){let c=s.index.range(a.x-r,a.y-r,a.x+r,a.y+r).sort();for(let l of c){let u=s.crossTileIDs[l];if(!i[u]){i[u]=!0,o.crossTileID=u;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let l=s.positions[c],u=s.crossTileIDs[c];if(Math.abs(l.x-a.x)<=r&&Math.abs(l.y-a.y)<=r&&!i[u]){i[u]=!0,o.crossTileID=u;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}}class tg{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class eg{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let e=Math.round((t-this.lng)/360);if(e!==0)for(let i in this.indexes){let r=this.indexes[i],n={};for(let o in r){let s=r[o];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),n[s.tileID.key]=s}this.indexes[i]=n}this.lng=t}addBucket(t,e,i){var r,n,o;if((r=this.indexes[t.overscaledZ])===null||r===void 0?void 0:r[t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let a=0;a<e.symbolInstances.length;a++)e.symbolInstances.get(a).crossTileID=0;(n=this.usedCrossTileIDs)[o=t.overscaledZ]||(n[o]={});let s=this.usedCrossTileIDs[t.overscaledZ];for(let a in this.indexes){let c=this.indexes[a];if(Number(a)>t.overscaledZ)for(let l in c){let u=c[l];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,s)}else{let l=c[t.scaledTo(Number(a)).key];l&&l.findMatches(e.symbolInstances,t,s)}}for(let a=0;a<e.symbolInstances.length;a++){let c=e.symbolInstances.get(a);c.crossTileID||(c.crossTileID=i.generate(),s[c.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Q_(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(let i of e.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[t][r]}removeStaleBuckets(t){let e=!1;for(let i in this.indexes){let r=this.indexes[i];for(let n in r)t[r[n].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[n]),delete r[n],e=!0)}return e}}class vu{constructor(){this.layerIndexes={},this.crossTileIDs=new tg,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,i){let r=this.layerIndexes[t.id];r===void 0&&(r=this.layerIndexes[t.id]=new eg);let n=!1,o={};r.handleWrapJump(i);for(let s of e){let a=s.getBucket(t);t.id===(a==null?void 0:a.layerIds[0])&&(a.bucketInstanceId||(this.maxBucketInstanceId+=1,a.bucketInstanceId=this.maxBucketInstanceId),r.addBucket(s.tileID,a,this.crossTileIDs)&&(n=!0),o[a.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(n=!0),n}pruneUnusedLayers(t){let e={};for(let i of t)e[i]=!0;for(let i in this.layerIndexes)e[i]||delete this.layerIndexes[i]}}var ig="void main() {fragColor=vec4(1.0);}";let yi={prelude:dt(`#ifdef GL_ES
3
+ precision mediump float;
4
+ #else
5
+ #if !defined(lowp)
6
+ #define lowp
7
+ #endif
8
+ #if !defined(mediump)
9
+ #define mediump
10
+ #endif
11
+ #if !defined(highp)
12
+ #define highp
13
+ #endif
14
+ #endif
15
+ out highp vec4 fragColor;`,`#ifdef GL_ES
16
+ precision highp float;
17
+ #else
18
+ #if !defined(lowp)
19
+ #define lowp
20
+ #endif
21
+ #if !defined(mediump)
22
+ #define mediump
23
+ #endif
24
+ #if !defined(highp)
25
+ #define highp
26
+ #endif
27
+ #endif
28
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
29
+ );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
30
+ );}
31
+ #ifdef TERRAIN3D
32
+ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
33
+ #endif
34
+ const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
35
+ #ifdef TERRAIN3D
36
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
37
+ #else
38
+ return 1.0;
39
+ #endif
40
+ }float calculate_visibility(vec4 pos) {
41
+ #ifdef TERRAIN3D
42
+ vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
43
+ #else
44
+ return 1.0;
45
+ #endif
46
+ }float ele(vec2 pos) {
47
+ #ifdef TERRAIN3D
48
+ vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
49
+ #else
50
+ return 0.0;
51
+ #endif
52
+ }float get_elevation(vec2 pos) {
53
+ #ifdef TERRAIN3D
54
+ #ifdef GLOBE
55
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
56
+ #endif
57
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
58
+ #else
59
+ return 0.0;
60
+ #endif
61
+ }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:dt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:dt("",`#define GLOBE_RADIUS 6371008.8
62
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
63
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
64
+ if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
65
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:dt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
66
+ #ifdef OVERDRAW_INSPECTOR
67
+ fragColor=vec4(1.0);
68
+ #endif
69
+ }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:dt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
70
+ #ifdef OVERDRAW_INSPECTOR
71
+ fragColor=vec4(1.0);
72
+ #endif
73
+ }`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:dt(`in vec3 v_data;in float v_visibility;
74
+ #pragma mapbox: define highp vec4 color
75
+ #pragma mapbox: define mediump float radius
76
+ #pragma mapbox: define lowp float blur
77
+ #pragma mapbox: define lowp float opacity
78
+ #pragma mapbox: define highp vec4 stroke_color
79
+ #pragma mapbox: define mediump float stroke_width
80
+ #pragma mapbox: define lowp float stroke_opacity
81
+ void main() {
82
+ #pragma mapbox: initialize highp vec4 color
83
+ #pragma mapbox: initialize mediump float radius
84
+ #pragma mapbox: initialize lowp float blur
85
+ #pragma mapbox: initialize lowp float opacity
86
+ #pragma mapbox: initialize highp vec4 stroke_color
87
+ #pragma mapbox: initialize mediump float stroke_width
88
+ #pragma mapbox: initialize lowp float stroke_opacity
89
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
90
+ #ifdef OVERDRAW_INSPECTOR
91
+ fragColor=vec4(1.0);
92
+ #endif
93
+ }`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
94
+ #pragma mapbox: define highp vec4 color
95
+ #pragma mapbox: define mediump float radius
96
+ #pragma mapbox: define lowp float blur
97
+ #pragma mapbox: define lowp float opacity
98
+ #pragma mapbox: define highp vec4 stroke_color
99
+ #pragma mapbox: define mediump float stroke_width
100
+ #pragma mapbox: define lowp float stroke_opacity
101
+ void main(void) {
102
+ #pragma mapbox: initialize highp vec4 color
103
+ #pragma mapbox: initialize mediump float radius
104
+ #pragma mapbox: initialize lowp float blur
105
+ #pragma mapbox: initialize lowp float opacity
106
+ #pragma mapbox: initialize highp vec4 stroke_color
107
+ #pragma mapbox: initialize mediump float stroke_width
108
+ #pragma mapbox: initialize lowp float stroke_opacity
109
+ vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
110
+ #ifdef GLOBE
111
+ vec3 center_vector=projectToSphere(circle_center);
112
+ #endif
113
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
114
+ #ifdef GLOBE
115
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
116
+ #else
117
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
118
+ #endif
119
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
120
+ #ifdef GLOBE
121
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
122
+ #else
123
+ gl_Position=projectTileWithElevation(corner_position,ele);
124
+ #endif
125
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:dt(ig,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:dt(`uniform highp float u_intensity;in vec2 v_extrude;
126
+ #pragma mapbox: define highp float weight
127
+ #define GAUSS_COEF 0.3989422804014327
128
+ void main() {
129
+ #pragma mapbox: initialize highp float weight
130
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
131
+ #ifdef OVERDRAW_INSPECTOR
132
+ fragColor=vec4(1.0);
133
+ #endif
134
+ }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
135
+ #pragma mapbox: define highp float weight
136
+ #pragma mapbox: define mediump float radius
137
+ const highp float ZERO=1.0/255.0/16.0;
138
+ #define GAUSS_COEF 0.3989422804014327
139
+ void main(void) {
140
+ #pragma mapbox: initialize highp float weight
141
+ #pragma mapbox: initialize mediump float radius
142
+ vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
143
+ #ifdef GLOBE
144
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
145
+ #else
146
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
147
+ #endif
148
+ }`),heatmapTexture:dt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
149
+ #ifdef OVERDRAW_INSPECTOR
150
+ fragColor=vec4(0.0);
151
+ #endif
152
+ }`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:dt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:dt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:dt(`#ifdef GL_ES
153
+ precision highp float;
154
+ #endif
155
+ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
156
+ {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
157
+ #ifdef OVERDRAW_INSPECTOR
158
+ fragColor=vec4(1.0);
159
+ #endif
160
+ }`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:dt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:dt(ig,`in vec2 a_pos;void main() {
161
+ #ifdef GLOBE
162
+ gl_Position=projectTileFor3D(a_pos,0.0);
163
+ #else
164
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
165
+ #endif
166
+ }`),fill:dt(`#pragma mapbox: define highp vec4 color
167
+ #pragma mapbox: define lowp float opacity
168
+ void main() {
169
+ #pragma mapbox: initialize highp vec4 color
170
+ #pragma mapbox: initialize lowp float opacity
171
+ fragColor=color*opacity;
172
+ #ifdef OVERDRAW_INSPECTOR
173
+ fragColor=vec4(1.0);
174
+ #endif
175
+ }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
176
+ #pragma mapbox: define highp vec4 color
177
+ #pragma mapbox: define lowp float opacity
178
+ void main() {
179
+ #pragma mapbox: initialize highp vec4 color
180
+ #pragma mapbox: initialize lowp float opacity
181
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:dt(`in vec2 v_pos;
182
+ #ifdef GLOBE
183
+ in float v_depth;
184
+ #endif
185
+ #pragma mapbox: define highp vec4 outline_color
186
+ #pragma mapbox: define lowp float opacity
187
+ void main() {
188
+ #pragma mapbox: initialize highp vec4 outline_color
189
+ #pragma mapbox: initialize lowp float opacity
190
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
191
+ #ifdef GLOBE
192
+ if (v_depth > 1.0) {discard;}
193
+ #endif
194
+ #ifdef OVERDRAW_INSPECTOR
195
+ fragColor=vec4(1.0);
196
+ #endif
197
+ }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
198
+ #ifdef GLOBE
199
+ out float v_depth;
200
+ #endif
201
+ #pragma mapbox: define highp vec4 outline_color
202
+ #pragma mapbox: define lowp float opacity
203
+ void main() {
204
+ #pragma mapbox: initialize highp vec4 outline_color
205
+ #pragma mapbox: initialize lowp float opacity
206
+ gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
207
+ #ifdef GLOBE
208
+ v_depth=gl_Position.z/gl_Position.w;
209
+ #endif
210
+ }`),fillOutlinePattern:dt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
211
+ #ifdef GLOBE
212
+ in float v_depth;
213
+ #endif
214
+ #pragma mapbox: define lowp float opacity
215
+ #pragma mapbox: define lowp vec4 pattern_from
216
+ #pragma mapbox: define lowp vec4 pattern_to
217
+ void main() {
218
+ #pragma mapbox: initialize lowp float opacity
219
+ #pragma mapbox: initialize mediump vec4 pattern_from
220
+ #pragma mapbox: initialize mediump vec4 pattern_to
221
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
222
+ #ifdef GLOBE
223
+ if (v_depth > 1.0) {discard;}
224
+ #endif
225
+ #ifdef OVERDRAW_INSPECTOR
226
+ fragColor=vec4(1.0);
227
+ #endif
228
+ }`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
229
+ #ifdef GLOBE
230
+ out float v_depth;
231
+ #endif
232
+ #pragma mapbox: define lowp float opacity
233
+ #pragma mapbox: define lowp vec4 pattern_from
234
+ #pragma mapbox: define lowp vec4 pattern_to
235
+ #pragma mapbox: define lowp float pixel_ratio_from
236
+ #pragma mapbox: define lowp float pixel_ratio_to
237
+ void main() {
238
+ #pragma mapbox: initialize lowp float opacity
239
+ #pragma mapbox: initialize mediump vec4 pattern_from
240
+ #pragma mapbox: initialize mediump vec4 pattern_to
241
+ #pragma mapbox: initialize lowp float pixel_ratio_from
242
+ #pragma mapbox: initialize lowp float pixel_ratio_to
243
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
244
+ #ifdef GLOBE
245
+ v_depth=gl_Position.z/gl_Position.w;
246
+ #endif
247
+ }`),fillPattern:dt(`#ifdef GL_ES
248
+ precision highp float;
249
+ #endif
250
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
251
+ #pragma mapbox: define lowp float opacity
252
+ #pragma mapbox: define lowp vec4 pattern_from
253
+ #pragma mapbox: define lowp vec4 pattern_to
254
+ void main() {
255
+ #pragma mapbox: initialize lowp float opacity
256
+ #pragma mapbox: initialize mediump vec4 pattern_from
257
+ #pragma mapbox: initialize mediump vec4 pattern_to
258
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
259
+ #ifdef OVERDRAW_INSPECTOR
260
+ fragColor=vec4(1.0);
261
+ #endif
262
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
263
+ #pragma mapbox: define lowp float opacity
264
+ #pragma mapbox: define lowp vec4 pattern_from
265
+ #pragma mapbox: define lowp vec4 pattern_to
266
+ #pragma mapbox: define lowp float pixel_ratio_from
267
+ #pragma mapbox: define lowp float pixel_ratio_to
268
+ void main() {
269
+ #pragma mapbox: initialize lowp float opacity
270
+ #pragma mapbox: initialize mediump vec4 pattern_from
271
+ #pragma mapbox: initialize mediump vec4 pattern_to
272
+ #pragma mapbox: initialize lowp float pixel_ratio_from
273
+ #pragma mapbox: initialize lowp float pixel_ratio_to
274
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:dt(`in vec4 v_color;void main() {fragColor=v_color;
275
+ #ifdef OVERDRAW_INSPECTOR
276
+ fragColor=vec4(1.0);
277
+ #endif
278
+ }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
279
+ #ifdef TERRAIN3D
280
+ in vec2 a_centroid;
281
+ #endif
282
+ out vec4 v_color;
283
+ #pragma mapbox: define highp float base
284
+ #pragma mapbox: define highp float height
285
+ #pragma mapbox: define highp vec4 color
286
+ void main() {
287
+ #pragma mapbox: initialize highp float base
288
+ #pragma mapbox: initialize highp float height
289
+ #pragma mapbox: initialize highp vec4 color
290
+ vec3 normal=a_normal_ed.xyz;
291
+ #ifdef TERRAIN3D
292
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
293
+ #else
294
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
295
+ #endif
296
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
297
+ #ifdef GLOBE
298
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
299
+ #else
300
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
301
+ #endif
302
+ float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
303
+ #ifdef GLOBE
304
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
305
+ #endif
306
+ directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:dt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
307
+ #pragma mapbox: define lowp float base
308
+ #pragma mapbox: define lowp float height
309
+ #pragma mapbox: define lowp vec4 pattern_from
310
+ #pragma mapbox: define lowp vec4 pattern_to
311
+ #pragma mapbox: define lowp float pixel_ratio_from
312
+ #pragma mapbox: define lowp float pixel_ratio_to
313
+ void main() {
314
+ #pragma mapbox: initialize lowp float base
315
+ #pragma mapbox: initialize lowp float height
316
+ #pragma mapbox: initialize mediump vec4 pattern_from
317
+ #pragma mapbox: initialize mediump vec4 pattern_to
318
+ #pragma mapbox: initialize lowp float pixel_ratio_from
319
+ #pragma mapbox: initialize lowp float pixel_ratio_to
320
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
321
+ #ifdef OVERDRAW_INSPECTOR
322
+ fragColor=vec4(1.0);
323
+ #endif
324
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
325
+ #ifdef TERRAIN3D
326
+ in vec2 a_centroid;
327
+ #endif
328
+ #ifdef GLOBE
329
+ out vec3 v_sphere_pos;
330
+ #endif
331
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
332
+ #pragma mapbox: define lowp float base
333
+ #pragma mapbox: define lowp float height
334
+ #pragma mapbox: define lowp vec4 pattern_from
335
+ #pragma mapbox: define lowp vec4 pattern_to
336
+ #pragma mapbox: define lowp float pixel_ratio_from
337
+ #pragma mapbox: define lowp float pixel_ratio_to
338
+ void main() {
339
+ #pragma mapbox: initialize lowp float base
340
+ #pragma mapbox: initialize lowp float height
341
+ #pragma mapbox: initialize mediump vec4 pattern_from
342
+ #pragma mapbox: initialize mediump vec4 pattern_to
343
+ #pragma mapbox: initialize lowp float pixel_ratio_from
344
+ #pragma mapbox: initialize lowp float pixel_ratio_to
345
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
346
+ #ifdef TERRAIN3D
347
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
348
+ #else
349
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
350
+ #endif
351
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
352
+ #ifdef GLOBE
353
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
354
+ #else
355
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
356
+ #endif
357
+ vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
358
+ ? a_pos
359
+ : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:dt(`#ifdef GL_ES
360
+ precision highp float;
361
+ #endif
362
+ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
363
+ #ifdef OVERDRAW_INSPECTOR
364
+ fragColor=vec4(1.0);
365
+ #endif
366
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:dt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
367
+ #define PI 3.141592653589793
368
+ #define STANDARD 0
369
+ #define COMBINED 1
370
+ #define IGOR 2
371
+ #define MULTIDIRECTIONAL 3
372
+ #define BASIC 4
373
+ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
374
+ {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
375
+ {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
376
+ #ifdef OVERDRAW_INSPECTOR
377
+ fragColor=vec4(1.0);
378
+ #endif
379
+ }`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:dt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
380
+ #ifdef GLOBE
381
+ in float v_depth;
382
+ #endif
383
+ #pragma mapbox: define highp vec4 color
384
+ #pragma mapbox: define lowp float blur
385
+ #pragma mapbox: define lowp float opacity
386
+ void main() {
387
+ #pragma mapbox: initialize highp vec4 color
388
+ #pragma mapbox: initialize lowp float blur
389
+ #pragma mapbox: initialize lowp float opacity
390
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
391
+ #ifdef GLOBE
392
+ if (v_depth > 1.0) {discard;}
393
+ #endif
394
+ #ifdef OVERDRAW_INSPECTOR
395
+ fragColor=vec4(1.0);
396
+ #endif
397
+ }`,`
398
+ #define scale 0.015873016
399
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
400
+ #ifdef GLOBE
401
+ out float v_depth;
402
+ #endif
403
+ #pragma mapbox: define highp vec4 color
404
+ #pragma mapbox: define lowp float blur
405
+ #pragma mapbox: define lowp float opacity
406
+ #pragma mapbox: define mediump float gapwidth
407
+ #pragma mapbox: define lowp float offset
408
+ #pragma mapbox: define mediump float width
409
+ void main() {
410
+ #pragma mapbox: initialize highp vec4 color
411
+ #pragma mapbox: initialize lowp float blur
412
+ #pragma mapbox: initialize lowp float opacity
413
+ #pragma mapbox: initialize mediump float gapwidth
414
+ #pragma mapbox: initialize lowp float offset
415
+ #pragma mapbox: initialize mediump float width
416
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
417
+ #ifdef GLOBE
418
+ v_depth=gl_Position.z/gl_Position.w;
419
+ #endif
420
+ #ifdef TERRAIN3D
421
+ v_gamma_scale=1.0;
422
+ #else
423
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
424
+ #endif
425
+ v_width2=vec2(outset,inset);}`),lineGradient:dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
426
+ #ifdef GLOBE
427
+ in float v_depth;
428
+ #endif
429
+ #pragma mapbox: define lowp float blur
430
+ #pragma mapbox: define lowp float opacity
431
+ void main() {
432
+ #pragma mapbox: initialize lowp float blur
433
+ #pragma mapbox: initialize lowp float opacity
434
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
435
+ #ifdef GLOBE
436
+ if (v_depth > 1.0) {discard;}
437
+ #endif
438
+ #ifdef OVERDRAW_INSPECTOR
439
+ fragColor=vec4(1.0);
440
+ #endif
441
+ }`,`
442
+ #define scale 0.015873016
443
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
444
+ #ifdef GLOBE
445
+ out float v_depth;
446
+ #endif
447
+ #pragma mapbox: define lowp float blur
448
+ #pragma mapbox: define lowp float opacity
449
+ #pragma mapbox: define mediump float gapwidth
450
+ #pragma mapbox: define lowp float offset
451
+ #pragma mapbox: define mediump float width
452
+ void main() {
453
+ #pragma mapbox: initialize lowp float blur
454
+ #pragma mapbox: initialize lowp float opacity
455
+ #pragma mapbox: initialize mediump float gapwidth
456
+ #pragma mapbox: initialize lowp float offset
457
+ #pragma mapbox: initialize mediump float width
458
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
459
+ #ifdef GLOBE
460
+ v_depth=gl_Position.z/gl_Position.w;
461
+ #endif
462
+ #ifdef TERRAIN3D
463
+ v_gamma_scale=1.0;
464
+ #else
465
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
466
+ #endif
467
+ v_width2=vec2(outset,inset);}`),linePattern:dt(`#ifdef GL_ES
468
+ precision highp float;
469
+ #endif
470
+ uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
471
+ #ifdef GLOBE
472
+ in float v_depth;
473
+ #endif
474
+ #pragma mapbox: define lowp vec4 pattern_from
475
+ #pragma mapbox: define lowp vec4 pattern_to
476
+ #pragma mapbox: define lowp float pixel_ratio_from
477
+ #pragma mapbox: define lowp float pixel_ratio_to
478
+ #pragma mapbox: define lowp float blur
479
+ #pragma mapbox: define lowp float opacity
480
+ void main() {
481
+ #pragma mapbox: initialize mediump vec4 pattern_from
482
+ #pragma mapbox: initialize mediump vec4 pattern_to
483
+ #pragma mapbox: initialize lowp float pixel_ratio_from
484
+ #pragma mapbox: initialize lowp float pixel_ratio_to
485
+ #pragma mapbox: initialize lowp float blur
486
+ #pragma mapbox: initialize lowp float opacity
487
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
488
+ #ifdef GLOBE
489
+ if (v_depth > 1.0) {discard;}
490
+ #endif
491
+ #ifdef OVERDRAW_INSPECTOR
492
+ fragColor=vec4(1.0);
493
+ #endif
494
+ }`,`
495
+ #define scale 0.015873016
496
+ #define LINE_DISTANCE_SCALE 2.0
497
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
498
+ #ifdef GLOBE
499
+ out float v_depth;
500
+ #endif
501
+ #pragma mapbox: define lowp float blur
502
+ #pragma mapbox: define lowp float opacity
503
+ #pragma mapbox: define lowp float offset
504
+ #pragma mapbox: define mediump float gapwidth
505
+ #pragma mapbox: define mediump float width
506
+ #pragma mapbox: define lowp float floorwidth
507
+ #pragma mapbox: define lowp vec4 pattern_from
508
+ #pragma mapbox: define lowp vec4 pattern_to
509
+ #pragma mapbox: define lowp float pixel_ratio_from
510
+ #pragma mapbox: define lowp float pixel_ratio_to
511
+ void main() {
512
+ #pragma mapbox: initialize lowp float blur
513
+ #pragma mapbox: initialize lowp float opacity
514
+ #pragma mapbox: initialize lowp float offset
515
+ #pragma mapbox: initialize mediump float gapwidth
516
+ #pragma mapbox: initialize mediump float width
517
+ #pragma mapbox: initialize lowp float floorwidth
518
+ #pragma mapbox: initialize mediump vec4 pattern_from
519
+ #pragma mapbox: initialize mediump vec4 pattern_to
520
+ #pragma mapbox: initialize lowp float pixel_ratio_from
521
+ #pragma mapbox: initialize lowp float pixel_ratio_to
522
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
523
+ #ifdef GLOBE
524
+ v_depth=gl_Position.z/gl_Position.w;
525
+ #endif
526
+ #ifdef TERRAIN3D
527
+ v_gamma_scale=1.0;
528
+ #else
529
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
530
+ #endif
531
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:dt(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
532
+ #ifdef GLOBE
533
+ in float v_depth;
534
+ #endif
535
+ #pragma mapbox: define highp vec4 color
536
+ #pragma mapbox: define lowp float blur
537
+ #pragma mapbox: define lowp float opacity
538
+ #pragma mapbox: define mediump float width
539
+ #pragma mapbox: define lowp float floorwidth
540
+ #pragma mapbox: define mediump vec4 dasharray_from
541
+ #pragma mapbox: define mediump vec4 dasharray_to
542
+ void main() {
543
+ #pragma mapbox: initialize highp vec4 color
544
+ #pragma mapbox: initialize lowp float blur
545
+ #pragma mapbox: initialize lowp float opacity
546
+ #pragma mapbox: initialize mediump float width
547
+ #pragma mapbox: initialize lowp float floorwidth
548
+ #pragma mapbox: initialize mediump vec4 dasharray_from
549
+ #pragma mapbox: initialize mediump vec4 dasharray_to
550
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
551
+ #ifdef GLOBE
552
+ if (v_depth > 1.0) {discard;}
553
+ #endif
554
+ #ifdef OVERDRAW_INSPECTOR
555
+ fragColor=vec4(1.0);
556
+ #endif
557
+ }`,`
558
+ #define scale 0.015873016
559
+ #define LINE_DISTANCE_SCALE 2.0
560
+ in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
561
+ #ifdef GLOBE
562
+ out float v_depth;
563
+ #endif
564
+ #pragma mapbox: define highp vec4 color
565
+ #pragma mapbox: define lowp float blur
566
+ #pragma mapbox: define lowp float opacity
567
+ #pragma mapbox: define mediump float gapwidth
568
+ #pragma mapbox: define lowp float offset
569
+ #pragma mapbox: define mediump float width
570
+ #pragma mapbox: define lowp float floorwidth
571
+ #pragma mapbox: define mediump vec4 dasharray_from
572
+ #pragma mapbox: define mediump vec4 dasharray_to
573
+ void main() {
574
+ #pragma mapbox: initialize highp vec4 color
575
+ #pragma mapbox: initialize lowp float blur
576
+ #pragma mapbox: initialize lowp float opacity
577
+ #pragma mapbox: initialize mediump float gapwidth
578
+ #pragma mapbox: initialize lowp float offset
579
+ #pragma mapbox: initialize mediump float width
580
+ #pragma mapbox: initialize lowp float floorwidth
581
+ #pragma mapbox: initialize mediump vec4 dasharray_from
582
+ #pragma mapbox: initialize mediump vec4 dasharray_to
583
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
584
+ #ifdef GLOBE
585
+ v_depth=gl_Position.z/gl_Position.w;
586
+ #endif
587
+ #ifdef TERRAIN3D
588
+ v_gamma_scale=1.0;
589
+ #else
590
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
591
+ #endif
592
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:dt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
593
+ #ifdef GLOBE
594
+ in float v_depth;
595
+ #endif
596
+ #pragma mapbox: define lowp float blur
597
+ #pragma mapbox: define lowp float opacity
598
+ #pragma mapbox: define mediump float width
599
+ #pragma mapbox: define lowp float floorwidth
600
+ #pragma mapbox: define mediump vec4 dasharray_from
601
+ #pragma mapbox: define mediump vec4 dasharray_to
602
+ void main() {
603
+ #pragma mapbox: initialize lowp float blur
604
+ #pragma mapbox: initialize lowp float opacity
605
+ #pragma mapbox: initialize mediump float width
606
+ #pragma mapbox: initialize lowp float floorwidth
607
+ #pragma mapbox: initialize mediump vec4 dasharray_from
608
+ #pragma mapbox: initialize mediump vec4 dasharray_to
609
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
610
+ #ifdef GLOBE
611
+ if (v_depth > 1.0) {discard;}
612
+ #endif
613
+ #ifdef OVERDRAW_INSPECTOR
614
+ fragColor=vec4(1.0);
615
+ #endif
616
+ }`,`
617
+ #define scale 0.015873016
618
+ #define LINE_DISTANCE_SCALE 2.0
619
+ in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
620
+ #ifdef GLOBE
621
+ out float v_depth;
622
+ #endif
623
+ #pragma mapbox: define lowp float blur
624
+ #pragma mapbox: define lowp float opacity
625
+ #pragma mapbox: define mediump float gapwidth
626
+ #pragma mapbox: define lowp float offset
627
+ #pragma mapbox: define mediump float width
628
+ #pragma mapbox: define lowp float floorwidth
629
+ #pragma mapbox: define mediump vec4 dasharray_from
630
+ #pragma mapbox: define mediump vec4 dasharray_to
631
+ void main() {
632
+ #pragma mapbox: initialize lowp float blur
633
+ #pragma mapbox: initialize lowp float opacity
634
+ #pragma mapbox: initialize mediump float gapwidth
635
+ #pragma mapbox: initialize lowp float offset
636
+ #pragma mapbox: initialize mediump float width
637
+ #pragma mapbox: initialize lowp float floorwidth
638
+ #pragma mapbox: initialize mediump vec4 dasharray_from
639
+ #pragma mapbox: initialize mediump vec4 dasharray_to
640
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
641
+ #ifdef GLOBE
642
+ v_depth=gl_Position.z/gl_Position.w;
643
+ #endif
644
+ #ifdef TERRAIN3D
645
+ v_gamma_scale=1.0;
646
+ #else
647
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
648
+ #endif
649
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),raster:dt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
650
+ #ifdef OVERDRAW_INSPECTOR
651
+ fragColor=vec4(1.0);
652
+ #endif
653
+ }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
654
+ #ifdef GLOBE
655
+ if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
656
+ #endif
657
+ v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:dt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
658
+ #ifdef OVERDRAW_INSPECTOR
659
+ fragColor=vec4(1.0);
660
+ #endif
661
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_total_opacity;
662
+ #pragma mapbox: define lowp float opacity
663
+ void main() {
664
+ #pragma mapbox: initialize lowp float opacity
665
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
666
+ camera_to_anchor_distance/u_camera_to_center_distance :
667
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
668
+ #ifdef GLOBE
669
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
670
+ #endif
671
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:dt(`#define SDF_PX 8.0
672
+ uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
673
+ #pragma mapbox: define highp vec4 fill_color
674
+ #pragma mapbox: define highp vec4 halo_color
675
+ #pragma mapbox: define lowp float halo_width
676
+ #pragma mapbox: define lowp float halo_blur
677
+ void main() {
678
+ #pragma mapbox: initialize highp vec4 fill_color
679
+ #pragma mapbox: initialize highp vec4 halo_color
680
+ #pragma mapbox: initialize lowp float halo_width
681
+ #pragma mapbox: initialize lowp float halo_blur
682
+ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
683
+ #ifdef OVERDRAW_INSPECTOR
684
+ fragColor=vec4(1.0);
685
+ #endif
686
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
687
+ #pragma mapbox: define highp vec4 fill_color
688
+ #pragma mapbox: define highp vec4 halo_color
689
+ #pragma mapbox: define lowp float opacity
690
+ #pragma mapbox: define lowp float halo_width
691
+ #pragma mapbox: define lowp float halo_blur
692
+ void main() {
693
+ #pragma mapbox: initialize highp vec4 fill_color
694
+ #pragma mapbox: initialize highp vec4 halo_color
695
+ #pragma mapbox: initialize lowp float opacity
696
+ #pragma mapbox: initialize lowp float halo_width
697
+ #pragma mapbox: initialize lowp float halo_blur
698
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
699
+ camera_to_anchor_distance/u_camera_to_center_distance :
700
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
701
+ #ifdef GLOBE
702
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
703
+ #endif
704
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:dt(`#define SDF_PX 8.0
705
+ #define SDF 1.0
706
+ #define ICON 0.0
707
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
708
+ #pragma mapbox: define highp vec4 fill_color
709
+ #pragma mapbox: define highp vec4 halo_color
710
+ #pragma mapbox: define lowp float halo_width
711
+ #pragma mapbox: define lowp float halo_blur
712
+ void main() {
713
+ #pragma mapbox: initialize highp vec4 fill_color
714
+ #pragma mapbox: initialize highp vec4 halo_color
715
+ #pragma mapbox: initialize lowp float halo_width
716
+ #pragma mapbox: initialize lowp float halo_blur
717
+ float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
718
+ #ifdef OVERDRAW_INSPECTOR
719
+ fragColor=vec4(1.0);
720
+ #endif
721
+ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
722
+ #ifdef OVERDRAW_INSPECTOR
723
+ fragColor=vec4(1.0);
724
+ #endif
725
+ }`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
726
+ #pragma mapbox: define highp vec4 fill_color
727
+ #pragma mapbox: define highp vec4 halo_color
728
+ #pragma mapbox: define lowp float opacity
729
+ #pragma mapbox: define lowp float halo_width
730
+ #pragma mapbox: define lowp float halo_blur
731
+ void main() {
732
+ #pragma mapbox: initialize highp vec4 fill_color
733
+ #pragma mapbox: initialize highp vec4 halo_color
734
+ #pragma mapbox: initialize lowp float opacity
735
+ #pragma mapbox: initialize lowp float halo_width
736
+ #pragma mapbox: initialize lowp float halo_blur
737
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
738
+ camera_to_anchor_distance/u_camera_to_center_distance :
739
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
740
+ #ifdef GLOBE
741
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
742
+ #endif
743
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:dt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:dt("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:dt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:dt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:dt(`#ifdef GL_ES
744
+ precision highp float;
745
+ #endif
746
+ in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
747
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:dt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function dt(t,e){let i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=e.match(/in ([\w]+) ([\w]+)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=o?o.concat(n):n,a={};return{fragmentSource:t=t.replace(i,(c,l,u,h,p)=>(a[p]=!0,l==="define"?`
748
+ #ifndef HAS_UNIFORM_u_${p}
749
+ in ${u} ${h} ${p};
750
+ #else
751
+ uniform ${u} ${h} u_${p};
752
+ #endif
753
+ `:`
754
+ #ifdef HAS_UNIFORM_u_${p}
755
+ ${u} ${h} ${p} = u_${p};
756
+ #endif
757
+ `)),vertexSource:e=e.replace(i,(c,l,u,h,p)=>{let d=h==="float"?"vec2":"vec4",f=p.match(/color/)?"color":d;return a[p]?l==="define"?`
758
+ #ifndef HAS_UNIFORM_u_${p}
759
+ uniform lowp float u_${p}_t;
760
+ in ${u} ${d} a_${p};
761
+ out ${u} ${h} ${p};
762
+ #else
763
+ uniform ${u} ${h} u_${p};
764
+ #endif
765
+ `:f==="vec4"?`
766
+ #ifndef HAS_UNIFORM_u_${p}
767
+ ${p} = a_${p};
768
+ #else
769
+ ${u} ${h} ${p} = u_${p};
770
+ #endif
771
+ `:`
772
+ #ifndef HAS_UNIFORM_u_${p}
773
+ ${p} = unpack_mix_${f}(a_${p}, u_${p}_t);
774
+ #else
775
+ ${u} ${h} ${p} = u_${p};
776
+ #endif
777
+ `:l==="define"?`
778
+ #ifndef HAS_UNIFORM_u_${p}
779
+ uniform lowp float u_${p}_t;
780
+ in ${u} ${d} a_${p};
781
+ #else
782
+ uniform ${u} ${h} u_${p};
783
+ #endif
784
+ `:f==="vec4"?`
785
+ #ifndef HAS_UNIFORM_u_${p}
786
+ ${u} ${h} ${p} = a_${p};
787
+ #else
788
+ ${u} ${h} ${p} = u_${p};
789
+ #endif
790
+ `:`
791
+ #ifndef HAS_UNIFORM_u_${p}
792
+ ${u} ${h} ${p} = unpack_mix_${f}(a_${p}, u_${p}_t);
793
+ #else
794
+ ${u} ${h} ${p} = u_${p};
795
+ #endif
796
+ `}),staticAttributes:r,staticUniforms:s}}class vr{constructor(t,e,i){this.vertexBuffer=t,this.indexBuffer=e,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Gi=Bt([{name:"a_pos",type:"Int16",components:2}]);let rg="#define PROJECTION_MERCATOR",ng="mercator";class Za{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return ng}get shaderDefine(){return rg}get shaderPreludeCode(){return yi.projectionMercator}get vertexShaderPreludeCode(){return yi.projectionMercator.vertexSource}get subdivisionGranularity(){return Qr.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,e,i,r,n){if(this._cachedMesh)return this._cachedMesh;let o=new ui;o.emplaceBack(0,0),o.emplaceBack(F,0),o.emplaceBack(0,F),o.emplaceBack(F,F);let s=t.createVertexBuffer(o,Gi.members),a=xt.simpleSegment(0,0,4,2),c=new Ge;c.emplaceBack(1,0,2),c.emplaceBack(1,2,3);let l=t.createIndexBuffer(c);return this._cachedMesh=new vr(s,l,a),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class jo{constructor(t=0,e=0,i=0,r=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(i)||i<0||isNaN(r)||r<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=i,this.right=r}interpolate(t,e,i){return e.top!=null&&t.top!=null&&(this.top=Ft.number(t.top,e.top,i)),e.bottom!=null&&t.bottom!=null&&(this.bottom=Ft.number(t.bottom,e.bottom,i)),e.left!=null&&t.left!=null&&(this.left=Ft.number(t.left,e.left,i)),e.right!=null&&t.right!=null&&(this.right=Ft.number(t.right,e.right,i)),this}getCenter(t,e){return new z(_t((this.left+t-this.right)/2,0,t),_t((this.top+e-this.bottom)/2,0,e))}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new jo(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Ga(t,e){if(!t.renderWorldCopies||t.lngRange)return;let i=e.lng-t.center.lng;e.lng+=i>180?-360:i<-180?360:0}function og(t){return Math.max(0,Math.floor(t))}class qa{constructor(t,e){var i;this.applyConstrain=(r,n)=>this._constrainOverride!==null?this._constrainOverride(r,n):this._callbacks.defaultConstrain(r,n),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=(e==null?void 0:e.renderWorldCopies)===void 0||!!(e==null?void 0:e.renderWorldCopies),this._minZoom=(e==null?void 0:e.minZoom)||0,this._maxZoom=(e==null?void 0:e.maxZoom)||22,this._minPitch=(e==null?void 0:e.minPitch)==null?0:e==null?void 0:e.minPitch,this._maxPitch=(e==null?void 0:e.maxPitch)==null?60:e==null?void 0:e.maxPitch,this._constrainOverride=(i=e==null?void 0:e.constrainOverride)!==null&&i!==void 0?i:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new X(0,0),this._elevation=0,this._zoom=0,this._tileZoom=og(this._zoom),this._scale=_e(this._zoom),this._bearingInRadians=0,this._fovInRadians=0.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new jo,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,e,i){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=og(this._zoom),this._scale=_e(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new jo(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!i&&t.autoCalculateNearFarZ,e&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new z(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){let e=Ye(t,-180,180)*Math.PI/180;var i,r,n,o,s,a,c,l,u;this._bearingInRadians!==e&&(this._unmodified=!1,this._bearingInRadians=e,this._calcMatrices(),this._rotationMatrix=hd(),i=this._rotationMatrix,n=-this._bearingInRadians,o=(r=this._rotationMatrix)[0],s=r[1],a=r[2],c=r[3],l=Math.sin(n),u=Math.cos(n),i[0]=o*u+a*l,i[1]=s*u+c*l,i[2]=o*-l+a*u,i[3]=s*-l+c*u)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let e=_t(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==e&&(this._unmodified=!1,this._pitchInRadians=e,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let e=t/180*Math.PI;this._rollInRadians!==e&&(this._unmodified=!1,this._rollInRadians=e,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Cr(this._fovInRadians)}setFov(t){t=_t(t,0.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=Vt(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let e=this.applyConstrain(this._center,t).zoom;this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this._tileZoom=Math.max(0,Math.floor(e)),this._scale=_e(e),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,e){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=e,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,i){this._unmodified=!1,this._edgeInsets.interpolate(t,e,i),this.constrainInternal(),this._calcMatrices()}resize(t,e,i=!0){this._width=t,this._height=e,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,e;return((t=this._latRange)===null||t===void 0?void 0:t.length)!==2||((e=this._lngRange)===null||e===void 0?void 0:e.length)!==2?null:new Kt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-85.051129,kn])}getCameraQueryGeometry(t,e){if(e.length===1)return[e[0],t];{let{minX:i,minY:r,maxX:n,maxY:o}=Le.fromPoints(e).extend(t);return[new z(i,r),new z(n,r),new z(n,o),new z(i,o),new z(i,r)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:e,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(e),this.setZoom(i),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=He(new Float64Array(16));Wt(t,t,[this._width/2,-this._height/2,1]),Ot(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=He(new Float64Array(16)),Wt(t,t,[1,-1,1]),Ot(t,t,[-1,-1,0]),Wt(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=0.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,e,i,r){let n=i!==void 0?i:this.bearing,o=r=r!==void 0?r:this.pitch,{distanceToCenter:s,clampedElevation:a}=this._distanceToCenterFromAltElevationPitch(e,this.elevation,o),{x:c,y:l}=ou(o,n),u=wt.fromLngLat(t,e),h,p,d=Wm(1,u.y),f=0;do{if(f+=1,f>10)break;p=s/d,h=new wt(u.x+c*p,u.y+l*p),d=1/h.meterInMercatorCoordinateUnits()}while(Math.abs(s-p*d)>0.000000000001);return{center:h.toLngLat(),elevation:a,zoom:he(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let e=1/this.worldSize,i=ji(1,this.center.lat)*this.worldSize,r=wt.fromLngLat(this.center,this.elevation),n=r.x/e,o=r.y/e,s=r.z/e,a=this.pitch,c=this.bearing,{x:l,y:u,z:h}=ou(a,c),p=this.cameraToCenterDistance,d=n+p*-l,f=o+p*-u,m=s+p*h,{distanceToCenter:_,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(m/i,t,a),v=_*i,g=new wt((d+l*v)*e,(f+u*v)*e,0).toLngLat(),x=ji(1,g.lat),b=he(this.height/2/Math.tan(this.fovInRadians/2)/_/x/this.tileSize);this._elevation=y,this._center=g,this.setZoom(b)}_distanceToCenterFromAltElevationPitch(t,e,i){let r=-Math.cos(Vt(i)),n=t-e,o,s=e;return r*n>=0||Math.abs(r)<0.1?(o=1e4,s=t+o*r):o=-n/r,{distanceToCenter:o,clampedElevation:s}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new z(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let t=ji(1,this.center.lat)*this.worldSize;return D_(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let e=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/e,t.canonical.y/e,1/e/F,1/e/F]}}class Wa{constructor(t,e){this.min=t,this.max=e,this.center=Zt([],Be([],this.min,this.max),0.5)}quadrant(t){let e=[t%2==0,t<2],i=xl(this.min),r=xl(this.max);for(let n=0;n<e.length;n++)i[n]=e[n]?this.min[n]:this.center[n],r[n]=e[n]?this.center[n]:this.max[n];return r[2]=this.max[2],new Wa(i,r)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let e=!0;for(let i of t.planes){let r=this.intersectsPlane(i);if(r===0)return 0;r===1&&(e=!1)}return e?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let e=t[3],i=t[3];for(let r=0;r<3;r++)t[r]>0?(e+=t[r]*this.min[r],i+=t[r]*this.max[r]):(i+=t[r]*this.min[r],e+=t[r]*this.max[r]);return e>=0?2:i<0?0:1}}class sg{distanceToTile2d(t,e,i,r){let n=r,o=n.distanceX([t,e]),s=n.distanceY([t,e]);return Math.hypot(o,s)}getWrap(t,e,i){return i}getTileBoundingVolume(t,e,i,r){var n,o;let s=0,a=0;if(r==null?void 0:r.terrain){let l=new Et(t.z,e,t.z,t.x,t.y),u=r.terrain.getMinMaxElevation(l);s=(n=u.minElevation)!==null&&n!==void 0?n:Math.min(0,i),a=(o=u.maxElevation)!==null&&o!==void 0?o:Math.max(0,i)}let c=1<<t.z;return new Wa([e+t.x/c,t.y/c,s],[e+(t.x+1)/c,(t.y+1)/c,a])}allowVariableZoom(t,e){let i=_t(78.5-t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height/2,0,60);return!!e.terrain||t.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}}class Ha{constructor(t,e,i){this.points=t,this.planes=e,this.aabb=i}static fromInvProjectionMatrix(t,e=1,i=0,r,n){let o=n?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=Math.pow(2,i),a=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((h)=>function(p,d,f,m){let _=Yt([],p,d),y=1/_[3]/f*m;return function(v,g,x){return v[0]=g[0]*x[0],v[1]=g[1]*x[1],v[2]=g[2]*x[2],v[3]=g[3]*x[3],v}(_,_,[y,y,1/_[3],y])}(h,t,e,s));r&&function(h,p,d,f){let m=f?4:0,_=f?0:4,y=0,v=[],g=[];for(let w=0;w<4;w++){let T=bi([],h[w+_],h[w+m]),P=Yo(T);Zt(T,T,1/P),v.push(P),g.push(T)}for(let w=0;w<4;w++){let T=d0(h[w+m],g[w],d);y=T!==null&&T>=0?Math.max(y,T):Math.max(y,v[w])}let x=function(w,T){let P=[0,0,0,0];return Xe(P,ai([],bi([],w[T[0]],w[T[1]]),bi([],w[T[2]],w[T[1]]))),P[3]=-ce(P,w[T[0]]),P}(h,p),b=function(w,T){let P=Tl(w),S=((C=[])[0]=(A=w)[0]*(M=1/P),C[1]=A[1]*M,C[2]=A[2]*M,C[3]=A[3]*M,C),E=bi([],T,Zt([],S,ce(T,S))),I=Tl(E);var C,A,M;if(I>0){let k=Math.sqrt(1-S[3]*S[3]);return Pl(T,Be([],Zt([],S,-S[3]),Zt([],E,k/I)))}return null}(d,x);if(b!==null){let w=b/ce(g[0],x);y=Math.min(y,w)}for(let w=0;w<4;w++){let T=Math.min(y,v[w]);h[w+_]=[h[w+m][0]+g[w][0]*T,h[w+m][1]+g[w][1]*T,h[w+m][2]+g[w][2]*T,1]}}(a,o[0],r,n);let c=o.map((h)=>{let p=Xe([],ai([],bi([],a[h[0]],a[h[1]]),bi([],a[h[2]],a[h[1]]))),d=-ce(p,a[h[1]]);return p.concat(d)}),l=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],u=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let h of a)for(let p=0;p<3;p++)l[p]=Math.min(l[p],h[p]),u[p]=Math.max(u[p],h[p]);return new Ha(a,c,new Wa(l,u))}}class gn{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t,e){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(e,i)=>{i=_t(+i,this.minZoom,this.maxZoom);let r={center:new X(e.lng,e.lat),zoom:i},n=this._helper._lngRange;if(!this._helper._renderWorldCopies&&n===null)n=[-179.9999999999,179.9999999999];let o=this.tileSize*_e(r.zoom),s=0,a=o,c=0,l=o,u=0,h=0,{x:p,y:d}=this.size;if(this._helper._latRange){let g=this._helper._latRange;s=dr(g[1])*o,a=dr(g[0])*o,a-s<d&&(u=d/(a-s))}n&&(c=Ye(sn(n[0])*o,0,o),l=Ye(sn(n[1])*o,0,o),l<c&&(l+=o),l-c<p&&(h=p/(l-c)));let{x:f,y:m}=gi(o,e),_,y,v=Math.max(h||0,u||0);if(v){let g=new z(h?(l+c)/2:f,u?(a+s)/2:m);return r.center=Lo(o,g).wrap(),r.zoom+=he(v),r}if(this._helper._latRange){let g=d/2;m-g<s&&(y=s+g),m+g>a&&(y=a-g)}if(n){let g=(c+l)/2,x=f;this._helper._renderWorldCopies&&(x=Ye(f,g-o/2,g+o/2));let b=p/2;x-b<c&&(_=c+b),x+b>l&&(_=l-b)}if(_!==void 0||y!==void 0){let g=new z(_!=null?_:f,y!=null?y:m);r.center=Lo(o,g).wrap()}return r},this.applyConstrain=(e,i)=>this._helper.applyConstrain(e,i),this._helper=new qa({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,i)=>this.defaultConstrain(e,i)},t),this._coveringTilesDetailsProvider=new sg}clone(){let t=new gn;return t.apply(this,!1),t}apply(t,e,i){this._helper.apply(t,e,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let e=[new Co(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new z(0,0)),r=this.screenPointToMercatorCoordinate(new z(this._helper._width,0)),n=this.screenPointToMercatorCoordinate(new z(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new z(0,this._helper._height)),s=Math.floor(Math.min(i.x,r.x,n.x,o.x)),a=Math.floor(Math.max(i.x,r.x,n.x,o.x));for(let l=s-1;l<=a+1;l++)l!==0&&e.push(new Co(l,t))}return e}getCameraFrustum(){return Ha.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let e=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLatZoom(e,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,e){let i=ji(this.elevation,this.center.lat),r=this.screenPointToMercatorCoordinateAtZ(e,i),n=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,i),o=wt.fromLngLat(t),s=new wt(o.x-(r.x-n.x),o.y-(r.y-n.y));this.setCenter(s==null?void 0:s.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,e){return e?this.coordinatePoint(wt.fromLngLat(t),e.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(wt.fromLngLat(t))}screenPointToLocation(t,e){var i;return(i=this.screenPointToMercatorCoordinate(t,e))===null||i===void 0?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,e){if(e){let i=e.pointCoordinate(t);if(i!=null)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,e){let i=e||0,r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];Yt(r,r,this._pixelMatrixInverse),Yt(n,n,this._pixelMatrixInverse);let o=r[3],s=n[3],a=r[1]/o,c=n[1]/s,l=r[2]/o,u=n[2]/s,h=l===u?0:(i-l)/(u-l);return new wt(Ft.number(r[0]/o,n[0]/s,h)/this.worldSize,Ft.number(a,c,h)/this.worldSize,i)}coordinatePoint(t,e=0,i=this._pixelMatrix){let r=[t.x*this.worldSize,t.y*this.worldSize,e,1];return Yt(r,r,i),new z(r[0]/r[3],r[1]/r[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Fo(this));return new Kt().extend(this.screenPointToLocation(new z(0,t))).extend(this.screenPointToLocation(new z(this._helper._width,t))).extend(this.screenPointToLocation(new z(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new z(0,this._helper._height)))}isPointOnMapSurface(t,e){return e?e.pointCoordinate(t)!=null:t.y>this.height/2-Fo(this)}calculatePosMatrix(t,e=!1,i){var r;let n=(r=t.key)!==null&&r!==void 0?r:an(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=e?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(n)){let c=o.get(n);return i?c.f32:c.f64}let s=nu(t,this.worldSize);Sr(s,e?this._alignedProjMatrix:this._viewProjMatrix,s);let a={f64:s,f32:new Float32Array(s)};return o.set(n,a),i?a.f32:a.f64}calculateFogMatrix(t){let e=t.key,i=this._fogMatrixCacheF32;if(i.has(e))return i.get(e);let r=nu(t,this.worldSize);return Sr(r,this._fogMatrix,r),i.set(e,new Float32Array(r)),i.get(e)}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}_calculateNearFarZIfNeeded(t,e,i){if(!this._helper.autoCalculateNearFarZ)return;let r=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),n=t-r*this._helper._pixelPerMeter/Math.cos(e),o=r<0?n:t,s=Math.PI/2+this.pitchInRadians,a=Vt(this.fov)*(Math.abs(Math.cos(Vt(this.roll)))*this.height+Math.abs(Math.sin(Vt(this.roll)))*this.width)/this.height*(0.5+i.y/this.height),c=Math.sin(a)*o/Math.sin(_t(Math.PI-s-a,0.01,Math.PI-0.01)),l=Fo(this),u=Math.atan(l/this._helper.cameraToCenterDistance),h=Vt(0.75),p=u>h?2*u*(0.5+i.y/(2*l)):h,d=Math.sin(p)*o/Math.sin(_t(Math.PI-s-p,0.01,Math.PI-0.01)),f=Math.min(c,d);this._helper._farZ=1.01*(Math.cos(Math.PI/2-e)*f+o),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,e=gi(this.worldSize,this.center),{x:i,y:r}=e;this._helper._pixelPerMeter=ji(1,this.center.lat)*this.worldSize;let n=Vt(Math.min(this.pitch,ko)),o=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(n)),s;var a,c;this._calculateNearFarZIfNeeded(o,n,t),s=new Float64Array(16),vl(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),(a=this._invProjMatrix)[0]=1/(c=s)[0],a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1/c[5],a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=0,a[11]=1/c[14],a[12]=0,a[13]=0,a[14]=-1,a[15]=c[10]/c[14],s[8]=2*-t.x/this._helper._width,s[9]=2*t.y/this._helper._height,this._projectionMatrix=yl(s),Wt(s,s,[1,-1,1]),Ot(s,s,[0,0,-this._helper.cameraToCenterDistance]),xi(s,s,-this.rollInRadians),oi(s,s,this.pitchInRadians),xi(s,s,-this.bearingInRadians),Ot(s,s,[-i,-r,0]),this._mercatorMatrix=Wt([],s,[this.worldSize,this.worldSize,this.worldSize]),Wt(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=Sr(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),Ot(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=Ho([],s);let l=[0,0,-1,1];Yt(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),vl(this._fogMatrix,this.fovInRadians,this.width/this.height,o,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,Wt(this._fogMatrix,this._fogMatrix,[1,-1,1]),Ot(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),xi(this._fogMatrix,this._fogMatrix,-this.rollInRadians),oi(this._fogMatrix,this._fogMatrix,this.pitchInRadians),xi(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),Ot(this._fogMatrix,this._fogMatrix,[-i,-r,0]),Wt(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),Ot(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=Sr(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,h=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),d=Math.sin(-this.bearingInRadians),f=i-Math.round(i)+p*u+d*h,m=r-Math.round(r)+p*h+d*u,_=new Float64Array(s);if(Ot(_,_,[f>0.5?f-1:f,m>0.5?m-1:m,0]),this._alignedProjMatrix=_,s=Ho(new Float64Array(16),this._pixelMatrix),!s)throw Error("failed to invert matrix");this._pixelMatrixInverse=s,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new z(0,0)),e=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Yt(e,e,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=ji(1,this.center.lat)*this.worldSize;return D_(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,e){let i=wt.fromLngLat(t),r=[i.x*this.worldSize,i.y*this.worldSize,e,1];return Yt(r,r,this._viewProjMatrix),r[2]/r[3]}getProjectionData(t){let{overscaledTileID:e,aligned:i,applyTerrainMatrix:r}=t,n=this._helper.getMercatorTileCoordinates(e),o=e?this.calculatePosMatrix(e,i,!0):null,s;return s=(e==null?void 0:e.terrainRttPosMatrix32f)&&r?e.terrainRttPosMatrix32f:o||xd(),{mainMatrix:s,tileMercatorCoords:n,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,e,i){return 1}transformLightDirection(t){return xl(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,e,i,r){let n=this.calculatePosMatrix(i),o;r?(o=[t,e,r(t,e),1],Yt(o,o,n)):(o=[t,e,0,1],mu(o,o,n));let s=o[3];return{point:new z(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let e of t)this.calculatePosMatrix(e)}getMatrixForModel(t,e){let i=wt.fromLngLat(t,e),r=i.meterInMercatorCoordinateUnits(),n=Pr();return Ot(n,n,[i.x,i.y,i.z]),xi(n,n,Math.PI),oi(n,n,Math.PI/2),Wt(n,n,[-r,r,r]),n}getProjectionDataForCustomLayer(t=!0){let e=new Et(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:e,applyGlobeMatrix:t}),r=nu(e,this.worldSize);Sr(r,this._viewProjMatrix,r),i.tileMercatorCoords=[0,0,1,1];let n=[F,F,this.worldSize/this._helper.pixelsPerMeter],o=Ai();return Wt(o,r,n),i.fallbackMatrix=o,i.mainMatrix=o,i}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function ag(){Ct("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function lg(t){if(t.useSlerp)if(t.k<1){let e=Md(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),i=Md(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),r=new Float64Array(4);(function(o,s,a,c){var l,u,h,p,d,f=s[0],m=s[1],_=s[2],y=s[3],v=a[0],g=a[1],x=a[2],b=a[3];(u=f*v+m*g+_*x+y*b)<0&&(u=-u,v=-v,g=-g,x=-x,b=-b),1-u>oe?(l=Math.acos(u),h=Math.sin(l),p=Math.sin((1-c)*l)/h,d=Math.sin(c*l)/h):(p=1-c,d=c),o[0]=p*f+d*v,o[1]=p*m+d*g,o[2]=p*_+d*x,o[3]=p*y+d*b})(r,e,i,t.k);let n=function(o){let s=new Float64Array(9);var a,c,l,u,h,p,d,f,m,_,y,v,g,x,b,w,T,P;_=(l=(c=o)[0])*(d=l+l),y=(u=c[1])*d,g=(h=c[2])*d,x=h*(f=u+u),w=(p=c[3])*d,T=p*f,P=p*(m=h+h),(a=s)[0]=1-(v=u*f)-(b=h*m),a[3]=y-P,a[6]=g+T,a[1]=y+P,a[4]=1-_-b,a[7]=x-w,a[2]=g-T,a[5]=x+w,a[8]=1-_-v;let S=Cr(-Math.asin(_t(s[2],-1,1))),E,I;return Math.hypot(s[5],s[8])<0.001?(E=0,I=-Cr(Math.atan2(s[3],s[4]))):(E=Cr(s[5]===0&&s[8]===0?0:Math.atan2(s[5],s[8])),I=Cr(s[1]===0&&s[0]===0?0:Math.atan2(s[1],s[0]))),{roll:E,pitch:S+90,bearing:I}}(r);t.tr.setRoll(n.roll),t.tr.setPitch(n.pitch),t.tr.setBearing(n.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(Ft.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(Ft.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(Ft.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function cg(t,e,i,r,n){let o=n.padding,s=gi(n.worldSize,i.getNorthWest()),a=gi(n.worldSize,i.getNorthEast()),c=gi(n.worldSize,i.getSouthEast()),l=gi(n.worldSize,i.getSouthWest()),u=Vt(-r),h=s.rotate(u),p=a.rotate(u),d=c.rotate(u),f=l.rotate(u),m=new z(Math.max(h.x,p.x,f.x,d.x),Math.max(h.y,p.y,f.y,d.y)),_=new z(Math.min(h.x,p.x,f.x,d.x),Math.min(h.y,p.y,f.y,d.y)),y=m.sub(_),v=(n.width-(o.left+o.right+e.left+e.right))/y.x,g=(n.height-(o.top+o.bottom+e.top+e.bottom))/y.y;if(g<0||v<0)return void ag();let x=Math.min(he(n.scale*Math.min(v,g)),t.maxZoom),b=z.convert(t.offset),w=new z((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(Vt(r)),T=b.add(w).mult(n.scale/_e(x));return{center:Lo(n.worldSize,s.add(c).div(2).sub(T)),zoom:x,bearing:r}}class No{get useGlobeControls(){return!1}handlePanInertia(t,e){let i=t.mag(),r=Math.abs(Fo(e));return{easingOffset:t.mult(Math.min(0.75*r/i,1)),easingCenter:e.center}}handleMapControlsRollPitchBearingZoom(t,e){t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta),t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta)}handleMapControlsPan(t,e,i){t.around.distSqr(e.centerPoint)<0.01||e.setLocationAtPoint(i,t.around)}cameraForBoxAndBearing(t,e,i,r,n){return cg(t,e,i,r,n)}handleJumpToCenterZoom(t,e){t.zoom!==(e.zoom!==void 0?+e.zoom:t.zoom)&&t.setZoom(+e.zoom),e.center!==void 0&&t.setCenter(X.convert(e.center))}handleEaseTo(t,e){let{zoom:i,padding:r}=t,n={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:e.roll===void 0?t.roll:e.roll,pitch:e.pitch===void 0?t.pitch:e.pitch,bearing:e.bearing===void 0?t.bearing:e.bearing},s=e.zoom!==void 0,a=!t.isPaddingEqual(e.padding),c=!1,l=s?+e.zoom:t.zoom,u=t.centerPoint.add(e.offsetAsPoint),h=t.screenPointToLocation(u),{center:p,zoom:d}=t.applyConstrain(X.convert(e.center||h),l!=null?l:i);Ga(t,p);let f=gi(t.worldSize,h),m=gi(t.worldSize,p).sub(f),_=_e(d-i);return c=d!==i,{easeFunc:(y)=>{if(c&&t.setZoom(Ft.number(i,d,y)),Id(n,o)||lg({startEulerAngles:n,endEulerAngles:o,tr:t,k:y,useSlerp:n.roll!=o.roll}),a&&(t.interpolatePadding(r,e.padding,y),u=t.centerPoint.add(e.offsetAsPoint)),e.around)t.setLocationAtPoint(e.around,e.aroundPoint);else{let v=_e(t.zoom-i),g=d>i?Math.min(2,_):Math.max(0.5,_),x=Math.pow(g,1-y),b=Lo(t.worldSize,f.add(m.mult(y*x)).mult(v));t.setLocationAtPoint(t.renderWorldCopies?b.wrap():b,u)}},isZooming:c,elevationCenter:p}}handleFlyTo(t,e){let i=e.zoom!==void 0,r=t.zoom,n=t.applyConstrain(X.convert(e.center||e.locationAtOffset),i?+e.zoom:r),{center:o,zoom:s}=n;Ga(t,o);let a=gi(t.worldSize,e.locationAtOffset),c=gi(t.worldSize,o).sub(a),l=c.mag(),u=_e(s-r),h;if(e.minZoom!==void 0){let p=Math.min(+e.minZoom,r,s);h=_e(t.applyConstrain(o,p).zoom-r)}return{easeFunc:(p,d,f,m)=>{t.setZoom(p===1?s:r+he(d));let _=p===1?o:Lo(t.worldSize,a.add(c.mult(f)).mult(d));t.setLocationAtPoint(t.renderWorldCopies?_.wrap():_,m)},scaleOfZoom:u,targetCenter:o,scaleOfMinZoom:h,pixelPathLength:l}}}class zt{constructor(t,e,i){this.blendFunction=t,this.blendColor=e,this.mask=i}}zt.Replace=[1,0],zt.disabled=new zt(zt.Replace,Y.transparent,[!1,!1,!1,!1]),zt.unblended=new zt(zt.Replace,Y.transparent,[!0,!0,!0,!0]),zt.alphaBlended=new zt([1,771],Y.transparent,[!0,!0,!0,!0]);let xu=2305;class mt{constructor(t,e,i){this.enable=t,this.mode=e,this.frontFace=i}}mt.disabled=new mt(!1,1029,xu),mt.backCCW=new mt(!0,1029,xu),mt.frontCCW=new mt(!0,1028,xu);class st{constructor(t,e,i){this.func=t,this.mask=e,this.range=i}}st.ReadOnly=!1,st.ReadWrite=!0,st.disabled=new st(519,st.ReadOnly,[0,1]);let bu=7680;class gt{constructor(t,e,i,r,n,o){this.test=t,this.ref=e,this.mask=i,this.fail=r,this.depthFail=n,this.pass=o}}function Mi(t){return typeof WebGL2RenderingContext<"u"&&t instanceof WebGL2RenderingContext}gt.disabled=new gt({func:519,mask:0},0,0,bu,bu,bu);class wu{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1000,this._readbackQueue=null,this._cachedRenderContext=t;let e=t.context,i=e.gl;this._texFormat=i.RGBA,this._texType=i.UNSIGNED_BYTE;let r=new ui;r.emplaceBack(-1,-1),r.emplaceBack(2,-1),r.emplaceBack(-1,2);let n=new Ge;n.emplaceBack(0,1,2),this._fullscreenTriangle=new vr(e.createVertexBuffer(r,Gi.members),e.createIndexBuffer(n),xt.simpleSegment(0,0,r.length,n.length)),this._resultBuffer=new Uint8Array(4),e.activeTexture.set(i.TEXTURE1);let o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.NEAREST),i.texImage2D(i.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=e.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(o),Mi(i)&&(this._pbo=i.createBuffer(),i.bindBuffer(i.PIXEL_PACK_BUFFER,this._pbo),i.bufferData(i.PIXEL_PACK_BUFFER,4,i.STREAM_READ),i.bindBuffer(i.PIXEL_PACK_BUFFER,null))}destroy(){let t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,e){let i=this._updateCount;return this._readbackQueue?i>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():i>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,e),this._updateCount++,this._measuredError}_bindFramebuffer(){let t=this._cachedRenderContext.context,e=t.gl;t.activeTexture.set(e.TEXTURE1),e.bindTexture(e.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,e){let i=this._cachedRenderContext.context,r=i.gl;if(this._bindFramebuffer(),i.viewport.set([0,0,this._texWidth,this._texHeight]),i.clear({color:Y.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(i,r.TRIANGLES,st.disabled,gt.disabled,zt.unblended,mt.disabled,((n,o)=>({u_input:n,u_output_expected:o}))(t,e),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Mi(r)){r.bindBuffer(r.PIXEL_PACK_BUFFER,this._pbo),r.readBuffer(r.COLOR_ATTACHMENT0),r.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),r.bindBuffer(r.PIXEL_PACK_BUFFER,null);let n=r.fenceSync(r.SYNC_GPU_COMMANDS_COMPLETE,0);r.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:n}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){let t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Mi(t)){let e=t.clientWaitSync(this._readbackQueue.sync,0,0);if(e===t.WAIT_FAILED)return Ct("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(e===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=wu._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let e=0;return e+=t[0]/256,e+=t[1]/65536,e+=t[2]/16777216,t[3]<127&&(e=-e),e/128}}function hg(t,e){let i=t.granularity!==void 0?Math.max(t.granularity,1):1,r=i+(t.generateBorders?2:0),n=i+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),o=r+1,s=n+1,a=t.generateBorders?-1:0,c=t.generateBorders||t.extendToNorthPole?-1:0,l=i+(t.generateBorders?1:0),u=i+(t.generateBorders||t.extendToSouthPole?1:0),h=o*s,p=r*n*6,d=o*s>65536;if(d&&e==="16bit")throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=d||e==="32bit",m=new Int16Array(2*h),_=0;for(let g=c;g<=u;g++)for(let x=a;x<=l;x++){let b=x/i*F;x===-1&&(b=-64),x===i+1&&(b=8256);let w=g/i*F;g===-1&&(w=t.extendToNorthPole?cr:-64),g===i+1&&(w=t.extendToSouthPole?tn:8256),m[_++]=b,m[_++]=w}let y=f?new Uint32Array(p):new Uint16Array(p),v=0;for(let g=0;g<n;g++)for(let x=0;x<r;x++){let b=x+1+g*o,w=x+(g+1)*o,T=x+1+(g+1)*o;y[v++]=x+g*o,y[v++]=w,y[v++]=b,y[v++]=b,y[v++]=w,y[v++]=T}return{vertices:m.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:f}}let Tu=new Qr({fill:new fi(128,2),line:new fi(512,0),tile:new fi(128,32),stencil:new fi(128,1),circle:3});class Su{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1000}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return yi.projectionGlobe}get vertexShaderPreludeCode(){return yi.projectionMercator.vertexSource}get subdivisionGranularity(){return Tu}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new wu(t));let e=dr(this._errorQueryLatitudeDegrees),i=2*Math.atan(Math.exp(Math.PI-e*Math.PI*2))-0.5*Math.PI,r=this._errorMeasurement.updateErrorLoop(e,i),n=St();r!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=r,this._errorMeasurementLastChangeTime=n);let o=Math.min(Math.max((n-this._errorMeasurementLastChangeTime)/1000/0.5,0),1);this._errorCorrectionUsable=Er(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,bd(o))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,e,i,r,n){let o=(n==="stencil"?Tu.stencil:Tu.tile).getGranularityForZoomLevel(e.z);return this._getMesh(t,{granularity:o,generateBorders:i,extendToNorthPole:e.y===0&&r,extendToSouthPole:e.y===(1<<e.z)-1&&r})}_getMesh(t,e){let i=this._getMeshKey(e);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=function(n,o){let s=hg(o,"16bit"),a=ui.deserialize({arrayBuffer:s.vertices,length:s.vertices.byteLength/2/2}),c=Ge.deserialize({arrayBuffer:s.indices,length:s.indices.byteLength/2/3});return new vr(n.createVertexBuffer(a,Gi.members),n.createIndexBuffer(c),xt.simpleSegment(0,0,a.length,c.length))}(t,e);return this._tileMeshCache[i]=r,r}recalculate(t){}hasTransition(){var t;let e=St(),i=!1;return i||(i=(e-this._errorMeasurementLastChangeTime)/1000<0.7),i||(i=(t=this._errorMeasurement)===null||t===void 0?void 0:t.awaitingQuery),i}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}let z1=new ee({type:new Z(D.projection.type)});class Pu extends Ht{constructor(t){super(),this._transitionable=new so(z1,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new At(0)),this._mercatorProjection=new Za,this._verticalPerspectiveProjection=new Su}get transitionState(){let t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof Re){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,e,i,r,n){return this.currentProjection.getMeshFromTileID(t,e,i,r,n)}setProjection(t){this._transitionable.setValue("type",(t==null?void 0:t.type)||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function ug(t){let e=Xa(t.worldSize,t.center.lat);return 2*Math.PI*e}function qi(t,e,i,r,n){let o=1/(1<<n),s=e/F*o+r*o,a=Ir((t/F*o+i*o)*Math.PI*2+Math.PI,2*Math.PI),c=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-0.5*Math.PI,l=Math.cos(c),u=new Float64Array(3);return u[0]=Math.sin(a)*l,u[1]=Math.sin(c),u[2]=Math.cos(a)*l,u}function pe(t){return function(e,i){let r=Math.cos(i),n=new Float64Array(3);return n[0]=Math.sin(e)*r,n[1]=Math.sin(i),n[2]=Math.cos(e)*r,n}(t.lng*Math.PI/180,t.lat*Math.PI/180)}function Xa(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function dg(t){let e=Math.asin(t[1])/Math.PI*180,i=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(i>0.000001){let r=t[0]/i,n=Math.acos(t[2]/i),o=(r>0?n:-n)/Math.PI*180;return new X(Ye(o,-180,180),e)}return new X(0,e)}function Ya(t){return Math.cos(t*Math.PI/180)}function ne(t,e){let i=Ya(t);return he(Ya(e)/i)}function pg(t,e){let i=t.rotate(e.bearingInRadians),r=e.zoom+ne(e.center.lat,0),n=Er(1/Ya(e.center.lat),1/Ya(Math.min(Math.abs(e.center.lat),60)),ts(r,7,3,0,1)),o=360/ug({worldSize:e.worldSize,center:{lat:e.center.lat}});return new X(e.center.lng-i.x*o*n,_t(e.center.lat+i.y*o,-85.051129,kn))}function Iu(t){let e=0.5*t,i=Math.sin(e),r=Math.cos(e);return Math.log(i+r)-Math.log(r-i)}function fg(t,e,i,r){let n=t.lat+i*r;if(Math.abs(i)>1){let o=(Math.sign(t.lat+i)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,s=Math.abs(t.lat+i)*Math.PI/180,a=Iu(o+r*(s-o)),c=Iu(o),l=Iu(s);return new X(t.lng+e*((a-c)/(l-c)),n)}return new X(t.lng+e*r,n)}class mg{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,e,i,r){let n=`${t.z}_${t.x}_${t.y}_${(r==null?void 0:r.terrain)?"t":""}`,o=this._cache.get(n);if(o)return o;let s=this._cachePrevious.get(n);if(s)return this._cache.set(n,s),s;let a=this._boundingVolumeFactory(t,e,i,r);return this._cache.set(n,a),this._hadAnyChanges=!0,a}}class yn{constructor(t,e,i,r){this.min=i,this.max=r,this.points=t,this.planes=e}static fromAabb(t,e){let i=[];for(let r=0;r<8;r++)i.push([1&~r?t[0]:e[0],(r>>1&1)==1?e[1]:t[1],(r>>2&1)==1?e[2]:t[2]]);return new yn(i,[[-1,0,0,e[0]],[1,0,0,-t[0]],[0,-1,0,e[1]],[0,1,0,-t[1]],[0,0,-1,e[2]],[0,0,1,-t[2]]],t,e)}static fromCenterSizeAngles(t,e,i){let r=md([],i[0],i[1],i[2]),n=bl([],[e[0],0,0],r),o=bl([],[0,e[1],0],r),s=bl([],[0,0,e[2]],r),a=[...t],c=[...t];for(let u=0;u<8;u++)for(let h=0;h<3;h++){let p=t[h]+n[h]*(1&~u?-1:1)+o[h]*((u>>1&1)==1?1:-1)+s[h]*((u>>2&1)==1?1:-1);a[h]=Math.min(a[h],p),c[h]=Math.max(c[h],p)}let l=[];for(let u=0;u<8;u++){let h=[...t];Be(h,h,Zt([],n,1&~u?-1:1)),Be(h,h,Zt([],o,(u>>1&1)==1?1:-1)),Be(h,h,Zt([],s,(u>>2&1)==1?1:-1)),l.push(h)}return new yn(l,[[...n,-ce(n,l[0])],[...o,-ce(o,l[0])],[...s,-ce(s,l[0])],[-n[0],-n[1],-n[2],-ce(n,l[7])],[-o[0],-o[1],-o[2],-ce(o,l[7])],[-s[0],-s[1],-s[2],-ce(s,l[7])]],a,c)}intersectsFrustum(t){let e=!0,i=this.points.length,r=this.planes.length,n=t.planes.length,o=t.points.length;for(let s=0;s<n;s++){let a=t.planes[s],c=0;for(let l=0;l<i;l++){let u=this.points[l];a[0]*u[0]+a[1]*u[1]+a[2]*u[2]+a[3]>=0&&c++}if(c===0)return 0;c<i&&(e=!1)}if(e)return 2;for(let s=0;s<r;s++){let a=this.planes[s],c=0;for(let l=0;l<o;l++){let u=t.points[l];a[0]*u[0]+a[1]*u[1]+a[2]*u[2]+a[3]>=0&&c++}if(c===0)return 0}return 1}intersectsPlane(t){let e=this.points.length,i=0;for(let r=0;r<e;r++){let n=this.points[r];t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]>=0&&i++}return i===e?2:i===0?0:1}}function Ka(t,e,i){let r=t-e;return r<0?-r:Math.max(0,r-i)}function Eu(t,e,i,r,n){let o=t-i,s;return s=o<0?Math.min(-o,1+o-n):o>n?Math.min(Math.max(o-n,0),1-o):0,Math.max(s,Ka(e,r,n))}class _g{constructor(){this._boundingVolumeCache=new mg(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,e,i,r){let n=1<<i.z,o=1/n,s=i.x/n,a=i.y/n,c=2;return c=Math.min(c,Eu(t,e,s,a,o)),c=Math.min(c,Eu(t,e,s+0.5,-a-o,o)),c=Math.min(c,Eu(t,e,s+0.5,2-a-o,o)),c}getWrap(t,e,i){let r=1<<e.z,n=1/r,o=e.x/r,s=Ka(t.x,o,n),a=Ka(t.x,o-1,n),c=Ka(t.x,o+1,n),l=Math.min(s,a,c);return l===c?1:l===a?-1:0}allowVariableZoom(t,e){return au(t,e)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,e,i,r){return this._boundingVolumeCache.getTileBoundingVolume(t,e,i,r)}_computeTileBoundingVolume(t,e,i,r){var n,o;let s=0,a=0;if(r==null?void 0:r.terrain){let c=new Et(t.z,e,t.z,t.x,t.y),l=r.terrain.getMinMaxElevation(c);s=(n=l.minElevation)!==null&&n!==void 0?n:Math.min(0,i),a=(o=l.maxElevation)!==null&&o!==void 0?o:Math.max(0,i)}if(s/=mi,a/=mi,s+=1,a+=1,t.z<=0)return yn.fromAabb([-a,-a,-a],[a,a,a]);if(t.z===1)return yn.fromAabb([t.x===0?-a:0,t.y===0?0:-a,-a],[t.x===0?0:a,t.y===0?a:0,a]);{let c=[qi(0,0,t.x,t.y,t.z),qi(F,0,t.x,t.y,t.z),qi(F,F,t.x,t.y,t.z),qi(0,F,t.x,t.y,t.z)],l=[];for(let E of c)l.push(Zt([],E,a));if(a!==s)for(let E of c)l.push(Zt([],E,s));t.y===0&&l.push([0,1,0]),t.y===(1<<t.z)-1&&l.push([0,-1,0]);let u=[1,1,1],h=[-1,-1,-1];for(let E of l)for(let I=0;I<3;I++)u[I]=Math.min(u[I],E[I]),h[I]=Math.max(h[I],E[I]);let p=qi(4096,4096,t.x,t.y,t.z),d=ai([],[0,1,0],p);Xe(d,d);let f=ai([],p,d);Xe(f,f);let m=ai([],c[2],c[1]);Xe(m,m);let _=ai([],c[0],c[3]);Xe(_,_),l.push(Zt([],p,a)),t.y>=(1<<t.z)/2&&l.push(Zt([],qi(4096,0,t.x,t.y,t.z),a)),t.y<(1<<t.z)/2&&l.push(Zt([],qi(4096,F,t.x,t.y,t.z),a));let y=gg(p,l),v=gg(f,l),g=[-p[0],-p[1],-p[2],y.max],x=[p[0],p[1],p[2],-y.min],b=[-f[0],-f[1],-f[2],v.max],w=[f[0],f[1],f[2],-v.min],T=[...m,0],P=[..._,0],S=[];return t.y===0?S.push(Oe(P,T,g),Oe(P,T,x)):S.push(Oe(b,T,g),Oe(b,T,x),Oe(b,P,g),Oe(b,P,x)),t.y===(1<<t.z)-1?S.push(Oe(P,T,g),Oe(P,T,x)):S.push(Oe(w,T,g),Oe(w,T,x),Oe(w,P,g),Oe(w,P,x)),new yn(S,[g,x,b,w,T,P],u,h)}}}function gg(t,e){let i=1/0,r=-1/0;for(let n of e){let o=ce(t,n);i=Math.min(i,o),r=Math.max(r,o)}return{min:i,max:r}}class Ja{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e){this._helper.resize(t,e)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}constructor(t){this._cachedClippingPlane=Dn(),this._projectionMatrix=Pr(),this._globeViewProjMatrix32f=xd(),this._globeViewProjMatrixNoCorrection=Pr(),this._globeViewProjMatrixNoCorrectionInverted=Pr(),this._globeProjMatrixInverted=Pr(),this._cameraPosition=Gt(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(e,i)=>{let r=_t(e.lat,-85.051129,kn),n=_t(+i,this.minZoom+ne(0,r),this.maxZoom);return{center:new X(e.lng,r),zoom:n}},this.applyConstrain=(e,i)=>this._helper.applyConstrain(e,i),this._helper=new qa({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,i)=>this.defaultConstrain(e,i)},t),this._coveringTilesDetailsProvider=new _g}clone(){let t=new Ja;return t.apply(this,!1),t}apply(t,e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(t,e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=Gt();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:e,applyGlobeMatrix:i}=t,r=this._helper.getMercatorTileCoordinates(e);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:r,clippingPlane:this._cachedClippingPlane,projectionTransition:i?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){let e=this.pitchInRadians,i=this.cameraToCenterDistance/t,r=Math.sin(e)*i,n=Math.cos(e)*i+1,o=1/Math.sqrt(r*r+n*n)*1,s=-r,a=n,c=Math.sqrt(s*s+a*a);s/=c,a/=c;let l=[0,s,a];wl(l,l,[0,0,0],-this.bearingInRadians),Ko(l,l,[0,0,0],-1*this.center.lat*Math.PI/180),An(l,l,[0,0,0],this.center.lng*Math.PI/180);let u=1/Yo(l);return Zt(l,l,u),[...l,-o*u]}isLocationOccluded(t){return!this.isSurfacePointVisible(pe(t))}transformLightDirection(t){let e=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,r=Math.cos(i),n=[Math.sin(e)*r,Math.sin(i),Math.cos(e)*r],o=[n[2],0,-n[0]],s=[0,0,0];ai(s,o,n),Xe(o,o),Xe(s,s);let a=[0,0,0];return Xe(a,[o[0]*t[0]+s[0]*t[1]+n[0]*t[2],o[1]*t[0]+s[1]*t[1]+n[1]*t[2],o[2]*t[0]+s[2]*t[1]+n[2]*t[2]]),a}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,e,i){let r=function(s,a,c){let l=1/(1<<c.z);return new wt(s/F*l+c.x*l,a/F*l+c.y*l)}(t,e,i.canonical),n=(o=r.y,[Ir(r.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-0.5*Math.PI]);var o;return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(t,e,i,r){let n=i.canonical,o=qi(t,e,n.x,n.y,n.z),s=1+(r?r(t,e):0)/mi,a=[o[0]*s,o[1]*s,o[2]*s,1];Yt(a,a,this._globeViewProjMatrixNoCorrection);let c=this._cachedClippingPlane,l=c[0]*o[0]+c[1]*o[1]+c[2]*o[2]+c[3]<0;return{point:new z(a[0]/a[3],a[1]/a[3]),signedDistanceFromCamera:a[3],isOccluded:l}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=Xa(this.worldSize,this.center.lat),e=Ai(),i=Ai();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=0.5,this._helper._farZ=this.cameraToCenterDistance+2*t),vl(e,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let r=this.centerOffset;e[8]=2*-r.x/this._helper._width,e[9]=2*r.y/this._helper._height,this._projectionMatrix=yl(e),this._globeProjMatrixInverted=Ai(),Ho(this._globeProjMatrixInverted,e),Ot(e,e,[0,0,-this.cameraToCenterDistance]),xi(e,e,this.rollInRadians),oi(e,e,-this.pitchInRadians),xi(e,e,this.bearingInRadians),Ot(e,e,[0,0,-t]);let n=Gt();n[0]=t,n[1]=t,n[2]=t,oi(i,e,this.center.lat*Math.PI/180),Xo(i,i,-this.center.lng*Math.PI/180),Wt(i,i,n),this._globeViewProjMatrixNoCorrection=i,oi(e,e,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),Xo(e,e,-this.center.lng*Math.PI/180),Wt(e,e,n),this._globeViewProjMatrix32f=new Float32Array(e),this._globeViewProjMatrixNoCorrectionInverted=Ai(),Ho(this._globeViewProjMatrixNoCorrectionInverted,i);let o=Gt();this._cameraPosition=Gt(),this._cameraPosition[2]=this.cameraToCenterDistance/t,wl(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),Ko(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),wl(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),Be(this._cameraPosition,this._cameraPosition,[0,0,1]),Ko(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),An(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=yl(this._globeViewProjMatrixNoCorrectionInverted);Wt(s,s,[1,1,-1]),this._cachedFrustum=Ha.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){Ct("calculateFogMatrix is not supported on globe projection.");let e=Ai();return He(e),e}getVisibleUnwrappedCoordinates(t){return[new Co(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&Ct("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){if(!this._globeViewProjMatrixNoCorrection)return 1;let i=pe(t);Zt(i,i,1+e/mi);let r=Dn();return Yt(r,[i[0],i[1],i[2],1],this._globeViewProjMatrixNoCorrection),r[2]/r[3]}populateCache(t){}getBounds(){let t=0.5*this.width,e=0.5*this.height,i=[new z(0,0),new z(t,0),new z(this.width,0),new z(this.width,e),new z(this.width,this.height),new z(t,this.height),new z(0,this.height),new z(0,e)],r=[];for(let u of i)r.push(this.unprojectScreenPoint(u));let n=0,o=0,s=0,a=0,c=this.center;for(let u of r){let h=Ce(c.lng,u.lng),p=Ce(c.lat,u.lat);h<o&&(o=h),h>n&&(n=h),p<a&&(a=p),p>s&&(s=p)}let l=[c.lng+o,c.lat+a,c.lng+n,c.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(l[3]=90,l[0]=-180,l[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(l[1]=-90,l[0]=-180,l[2]=180),new Kt(l)}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}setLocationAtPoint(t,e){let i=pe(this.unprojectScreenPoint(e)),r=pe(t),n=Gt();var o;(o=n)[0]=0,o[1]=0,o[2]=0;let s=Gt();An(s,i,n,-this.center.lng*Math.PI/180),Ko(s,s,n,this.center.lat*Math.PI/180);let a=r[0]*r[0]+r[2]*r[2],c=s[0]*s[0];if(a<c)return;let l=Math.sqrt(a-c),u=-l,h=Jo(r[0],r[2],s[0],l),p=Jo(r[0],r[2],s[0],u),d=Gt();An(d,r,n,-h);let f=Jo(d[1],d[2],s[1],s[2]),m=Gt();An(m,r,n,-p);let _=Jo(m[1],m[2],s[1],s[2]),y=0.5*Math.PI,v=f>=-y&&f<=y,g=_>=-y&&_<=y,x,b;if(v&&g){let S=this.center.lng*Math.PI/180,E=this.center.lat*Math.PI/180;Qo(h,S)+Qo(f,E)<Qo(p,S)+Qo(_,E)?(x=h,b=f):(x=p,b=_)}else if(v)x=h,b=f;else{if(!g)return;x=p,b=_}let w=x/Math.PI*180,T=b/Math.PI*180,P=this.center.lat;this.setCenter(new X(w,_t(T,-90,90))),this.setZoom(this.zoom+ne(P,this.center.lat))}locationToScreenPoint(t,e){let i=pe(t);return e&&Zt(i,i,1+e.getElevationForLngLatZoom(t,this._helper._tileZoom)/mi),this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){let e=Dn();return Yt(e,[...t,1],this._globeViewProjMatrixNoCorrection),e[0]/=e[3],e[1]/=e[3],new z((0.5*e[0]+0.5)*this.width,(0.5*-e[1]+0.5)*this.height)}screenPointToMercatorCoordinate(t,e){if(e){let i=e.pointCoordinate(t);if(i)return i}return wt.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,e){var i;return(i=this.screenPointToMercatorCoordinate(t,e))===null||i===void 0?void 0:i.toLngLat()}isPointOnMapSurface(t,e){let i=this._cameraPosition,r=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(i,r)}getRayDirectionFromPixel(t){let e=Dn();e[0]=t.x/this.width*2-1,e[1]=-1*(t.y/this.height*2-1),e[2]=1,e[3]=1,Yt(e,e,this._globeViewProjMatrixNoCorrectionInverted),e[0]/=e[3],e[1]/=e[3],e[2]/=e[3];let i=Gt();i[0]=e[0]-this._cameraPosition[0],i[1]=e[1]-this._cameraPosition[1],i[2]=e[2]-this._cameraPosition[2];let r=Gt();return Xe(r,i),r}isSurfacePointVisible(t){let e=this._cachedClippingPlane;return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let e=Dn();return Yt(e,[...t,1],this._globeViewProjMatrixNoCorrection),e[0]/=e[3],e[1]/=e[3],e[2]/=e[3],e[0]>-1&&e[0]<1&&e[1]>-1&&e[1]<1&&e[2]>-1&&e[2]<1}rayPlanetIntersection(t,e){let i=ce(t,e),r=Gt(),n=Gt();Zt(n,e,i),bi(r,t,n);let o=1-ce(r,r);if(o<0)return null;let s=ce(t,t)-1,a=-i+(i<0?1:-1)*Math.sqrt(o),c=s/a,l=a;return{tMin:Math.min(c,l),tMax:Math.max(c,l)}}unprojectScreenPoint(t){let e=this._cameraPosition,i=this.getRayDirectionFromPixel(t),r=this.rayPlanetIntersection(e,i);if(r){let u=Gt();Be(u,e,[i[0]*r.tMin,i[1]*r.tMin,i[2]*r.tMin]);let h=Gt();return Xe(h,u),dg(h)}let n=this._cachedClippingPlane,o=n[0]*i[0]+n[1]*i[1]+n[2]*i[2],s=-Pl(n,e)/o,a=Gt();if(s>0)Be(a,e,[i[0]*s,i[1]*s,i[2]*s]);else{let u=Gt();Be(u,e,[2*i[0],2*i[1],2*i[2]]);let h=Pl(this._cachedClippingPlane,u);bi(a,u,[this._cachedClippingPlane[0]*h,this._cachedClippingPlane[1]*h,this._cachedClippingPlane[2]*h])}let c=function(u){let h=Gt();return h[0]=u[0]*-u[3],h[1]=u[1]*-u[3],h[2]=u[2]*-u[3],{center:h,radius:Math.sqrt(1-u[3]*u[3])}}(n),l=function(u,h,p){let d=Gt();bi(d,p,u);let f=Gt();return function(m,_,y,v){m[0]=_[0]+y[0]*v,m[1]=_[1]+y[1]*v,m[2]=_[2]+y[2]*v}(f,u,d,h/Tl(d)),f}(c.center,c.radius,a);return dg(l)}getMatrixForModel(t,e){let i=X.convert(t),r=1/mi,n=Pr();return Xo(n,n,i.lng/180*Math.PI),oi(n,n,-i.lat/180*Math.PI),Ot(n,n,[0,0,1+e/mi]),oi(n,n,0.5*Math.PI),Wt(n,n,[r,r,r]),n}getProjectionDataForCustomLayer(t=!0){let e=this.getProjectionData({overscaledTileID:new Et(0,0,0,0,0),applyGlobeMatrix:t});return e.tileMercatorCoords=[0,0,1,1],e}getFastPathSimpleProjectionMatrix(t){}}class Qa{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,e,i){this._helper.interpolatePadding(t,e,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,e,i=!0){this._helper.resize(t,e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,e){this._helper.overrideNearFarZ(t,e)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t,e){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=e,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(e,i)=>this.currentTransform.defaultConstrain(e,i),this.applyConstrain=(e,i)=>this._helper.applyConstrain(e,i),this._helper=new qa({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(e,i)=>this.defaultConstrain(e,i)},t),this._globeness=1,this._mercatorTransform=new gn,this._verticalPerspectiveTransform=new Ja}clone(){let t=new Qa;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,e){this._helper.apply(t,e),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let e=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:e.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:e.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return Er(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Er(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,e,i){return Er(this._mercatorTransform.getPitchedTextCorrection(t,e,i),this._verticalPerspectiveTransform.getPitchedTextCorrection(t,e,i),this._globeness)}projectTileCoordinates(t,e,i,r){return this.currentTransform.projectTileCoordinates(t,e,i,r)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,e){return this.currentTransform.lngLatToCameraDepth(t,e)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,e,i,r){return this._helper.calculateCenterFromCameraLngLatAlt(t,e,i,r)}setLocationAtPoint(t,e){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,e),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,e),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,e){return this.currentTransform.locationToScreenPoint(t,e)}screenPointToMercatorCoordinate(t,e){return this.currentTransform.screenPointToMercatorCoordinate(t,e)}screenPointToLocation(t,e){return this.currentTransform.screenPointToLocation(t,e)}isPointOnMapSurface(t,e){return this.currentTransform.isPointOnMapSurface(t,e)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,e){return this.currentTransform.getMatrixForModel(t,e)}getProjectionDataForCustomLayer(t=!0){let e=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return e;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=e.mainMatrix,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class ni{get useGlobeControls(){return!0}handlePanInertia(t,e){let i=pg(t,e);return Math.abs(i.lng-e.center.lng)>180&&(i.lng=e.center.lng+179.5*Math.sign(i.lng-e.center.lng)),{easingCenter:i,easingOffset:new z(0,0)}}handleMapControlsRollPitchBearingZoom(t,e){let i=t.around,r=e.screenPointToLocation(i);t.bearingDelta&&e.setBearing(e.bearing+t.bearingDelta),t.pitchDelta&&e.setPitch(e.pitch+t.pitchDelta),t.rollDelta&&e.setRoll(e.roll+t.rollDelta);let n=e.zoom;t.zoomDelta&&e.setZoom(e.zoom+t.zoomDelta);let o=e.zoom-n;if(o===0)return;let s=Ce(e.center.lng,r.lng),a=s/(Math.abs(s/180)+1),c=Ce(e.center.lat,r.lat),l=e.getRayDirectionFromPixel(i),u=e.cameraPosition,h=-1*ce(u,l),p=Gt();Be(p,u,[l[0]*h,l[1]*h,l[2]*h]);let d=Yo(p)-1,f=Math.exp(0.5*-Math.max(d-0.3,0)),m=Xa(e.worldSize,e.center.lat)/Math.min(e.width,e.height),_=ts(m,0.9,0.5,1,0.25),y=(1-_e(-o))*Math.min(f,_),v=e.center.lat,g=e.zoom,x=new X(e.center.lng+a*y,_t(e.center.lat+c*y,-85.051129,kn));e.setLocationAtPoint(r,i);let b=e.center,w=ts(Math.abs(s),45,85,0,1),T=ts(m,0.75,0.35,0,1),P=Math.pow(Math.max(w,T),0.25),S=Ce(b.lng,x.lng),E=Ce(b.lat,x.lat);e.setCenter(new X(b.lng+S*P,b.lat+E*P).wrap()),e.setZoom(g+ne(v,e.center.lat))}handleMapControlsPan(t,e,i){if(!t.panDelta)return;let r=e.center.lat,n=e.zoom;e.setCenter(pg(t.panDelta,e).wrap()),e.setZoom(n+ne(r,e.center.lat))}cameraForBoxAndBearing(t,e,i,r,n){let o=cg(t,e,i,r,n),s=e.left/n.width*2-1,a=(n.width-e.right)/n.width*2-1,c=e.top/n.height*-2+1,l=(n.height-e.bottom)/n.height*-2+1,u=Ce(i.getWest(),i.getEast())<0,h=u?i.getEast():i.getWest(),p=u?i.getWest():i.getEast(),d=Math.max(i.getNorth(),i.getSouth()),f=Math.min(i.getNorth(),i.getSouth()),m=h+0.5*Ce(h,p),_=d+0.5*Ce(d,f),y=n.clone();y.setCenter(o.center),y.setBearing(o.bearing),y.setPitch(0),y.setRoll(0),y.setZoom(o.zoom);let v=y.modelViewProjectionMatrix,g=[pe(i.getNorthWest()),pe(i.getNorthEast()),pe(i.getSouthWest()),pe(i.getSouthEast()),pe(new X(p,_)),pe(new X(h,_)),pe(new X(m,d)),pe(new X(m,f))],x=pe(o.center),b=Number.POSITIVE_INFINITY;for(let w of g)s<0&&(b=ni.getLesserNonNegativeNonNull(b,ni.solveVectorScale(w,x,v,"x",s))),a>0&&(b=ni.getLesserNonNegativeNonNull(b,ni.solveVectorScale(w,x,v,"x",a))),c>0&&(b=ni.getLesserNonNegativeNonNull(b,ni.solveVectorScale(w,x,v,"y",c))),l<0&&(b=ni.getLesserNonNegativeNonNull(b,ni.solveVectorScale(w,x,v,"y",l)));if(Number.isFinite(b)&&b!==0)return o.zoom=Math.min(y.zoom+he(b),t.maxZoom),o;ag()}handleJumpToCenterZoom(t,e){let i=t.center.lat,r=t.applyConstrain(e.center?X.convert(e.center):t.center,t.zoom).center;t.setCenter(r.wrap());let n=e.zoom!==void 0?+e.zoom:t.zoom+ne(i,r.lat);t.zoom!==n&&t.setZoom(n)}handleEaseTo(t,e){let{zoom:i,center:r,padding:n}=t,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:e.roll===void 0?t.roll:e.roll,pitch:e.pitch===void 0?t.pitch:e.pitch,bearing:e.bearing===void 0?t.bearing:e.bearing},a=e.zoom!==void 0,c=!t.isPaddingEqual(e.padding),l=!1,u=e.center?X.convert(e.center):r,h=t.applyConstrain(u,i).center;Ga(t,h);let p=t.clone();p.setCenter(h),p.setZoom(a?+e.zoom:i+ne(r.lat,u.lat)),p.setBearing(e.bearing);let d=new z(_t(t.centerPoint.x+e.offsetAsPoint.x,0,t.width),_t(t.centerPoint.y+e.offsetAsPoint.y,0,t.height));p.setLocationAtPoint(h,d);let f=(e.offset&&e.offsetAsPoint.mag())>0?p.center:h,m=a?+e.zoom:i+ne(r.lat,f.lat),_=i+ne(r.lat,0),y=m+ne(f.lat,0),v=Ce(r.lng,f.lng),g=Ce(r.lat,f.lat),x=_e(y-_);return l=m!==i,{easeFunc:(b)=>{if(Id(o,s)||lg({startEulerAngles:o,endEulerAngles:s,tr:t,k:b,useSlerp:o.roll!=s.roll}),c&&t.interpolatePadding(n,e.padding,b),e.around)Ct("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(e.around,e.aroundPoint);else{let w=y>_?Math.min(2,x):Math.max(0.5,x),T=Math.pow(w,1-b),P=fg(r,v,g,b*T);t.setCenter(P.wrap())}if(l){let w=Ft.number(_,y,b)+ne(0,t.center.lat);t.setZoom(w)}},isZooming:l,elevationCenter:f}}handleFlyTo(t,e){let i=e.zoom!==void 0,{center:r,zoom:n,padding:o}=t,s=!t.isPaddingEqual(e.padding),a=t.applyConstrain(X.convert(e.center||e.locationAtOffset),n).center,c=i?+e.zoom:t.zoom+ne(t.center.lat,a.lat),l=t.clone();l.setCenter(a),l.setZoom(c),l.setBearing(e.bearing);let u=new z(_t(t.centerPoint.x+e.offsetAsPoint.x,0,t.width),_t(t.centerPoint.y+e.offsetAsPoint.y,0,t.height));l.setLocationAtPoint(a,u);let h=l.center;Ga(t,h);let p=function(g,x,b){let w=ce(pe(x),pe(b)),T=Math.acos(w),P=ug(g);return T/(2*Math.PI)*P}(t,r,h),d=n+ne(r.lat,0),f=c+ne(h.lat,0),m=_e(f-d),_;if(typeof e.minZoom=="number"){let g=+e.minZoom+ne(h.lat,0),x=Math.min(g,d,f)+ne(0,h.lat);_=_e(t.applyConstrain(h,x).zoom+ne(h.lat,0)-d)}let y=Ce(r.lng,h.lng),v=Ce(r.lat,h.lat);return{easeFunc:(g,x,b,w)=>{let T=fg(r,y,v,b);s&&t.interpolatePadding(o,e.padding,g);let P=g===1?h:T;t.setCenter(P.wrap());let S=d+he(x);t.setZoom(g===1?c:S+ne(0,P.lat))},scaleOfZoom:m,targetCenter:h,scaleOfMinZoom:_,pixelPathLength:p}}static solveVectorScale(t,e,i,r,n){let o=r==="x"?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],a=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],c=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],l=e[0]*o[0]+e[1]*o[1]+e[2]*o[2],u=e[0]*s[0]+e[1]*s[1]+e[2]*s[2];return l+n*c===a+n*u||s[3]*(a-l)+o[3]*(u-c)+a*u==l*c?null:(l+o[3]-n*u-n*s[3])/(l-a-n*u+n*c)}static getLesserNonNegativeNonNull(t,e){return e!==null&&e>=0&&e<t?e:t}}class Mu{constructor(t){this._globe=t,this._mercatorCameraHelper=new No,this._verticalPerspectiveCameraHelper=new ni}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,e){return this.currentHelper.handlePanInertia(t,e)}handleMapControlsRollPitchBearingZoom(t,e){this.currentHelper.handleMapControlsRollPitchBearingZoom(t,e)}handleMapControlsPan(t,e,i){this.currentHelper.handleMapControlsPan(t,e,i)}cameraForBoxAndBearing(t,e,i,r,n){return this.currentHelper.cameraForBoxAndBearing(t,e,i,r,n)}handleJumpToCenterZoom(t,e){this.currentHelper.handleJumpToCenterZoom(t,e)}handleEaseTo(t,e){return this.currentHelper.handleEaseTo(t,e)}handleFlyTo(t,e){return this.currentHelper.handleFlyTo(t,e)}}let tl=(t,e)=>Zs(t,e==null?void 0:e.filter((i)=>i.identifier!=="source.canvas")),D1=function(){let t={},e=D.$version;for(let i in D.$root){let r=D.$root[i];if(r.required){let n=null;n=i==="version"?e:r.type==="array"?[]:{},n!=null&&(t[i]=n)}}return t}();class el extends Ht{constructor(t,e={}){var i,r;super(),this._rtlPluginLoaded=()=>{for(let o in this.tileManagers){let s=this.tileManagers[o].getSource().type;s!=="vector"&&s!=="geojson"||this.tileManagers[o].reload()}},this.map=t,this.dispatcher=new xh(vh(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(o,s)=>this.getGlyphs(o,s)),this.dispatcher.registerMessageHandler("GI",(o,s)=>this.getImages(o,s)),this.dispatcher.registerMessageHandler("GDA",(o,s)=>this.getDashes(o,s)),this.imageManager=new Rm,this.imageManager.setEventedParent(this);let n=((i=t._container)===null||i===void 0?void 0:i.lang)||typeof document<"u"&&((r=document.documentElement)===null||r===void 0?void 0:r.lang)||void 0;this.glyphManager=new nn(t._requestManager,e.localIdeographFontFamily,n),this.lineAtlas=new jm(256,512),this.crossTileSymbolIndex=new vu,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",Ol()),Ro().on(eu,this._rtlPluginLoaded),this.on("data",(o)=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;let s=this.tileManagers[o.sourceId];if(!s)return;let a=s.getSource();if(a==null?void 0:a.vectorLayerIds)for(let c in this._layers){let l=this._layers[c];l.source===a.id&&this._validateLayer(l)}})}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Gs,this._availableImages=[],this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,e){var i,r,n;this._checkLoaded();let o=e===null?(n=(r=(i=this.stylesheet.state)===null||i===void 0?void 0:i[t])===null||r===void 0?void 0:r.default)!==null&&n!==void 0?n:null:e;if(li(o,this._globalState[t]))return this;this._globalState[t]=o,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let e=[];for(let i in t)!li(this._globalState[i],t[i].default)&&(e.push(i),this._globalState[i]=t[i].default);this._applyGlobalStateChanges(e)}_applyGlobalStateChanges(t){if(t.length===0)return;let e=new Set,i={};for(let r of t){i[r]=this._globalState[r];for(let n in this._layers){let o=this._layers[n],s=o.getLayoutAffectingGlobalStateRefs(),a=o.getPaintAffectingGlobalStateRefs(),c=o.getVisibilityAffectingGlobalStateRefs();if(s.has(r)&&e.add(o.source),a.has(r))for(let{name:l,value:u}of a.get(r))this._updatePaintProperty(o,l,u);(c==null?void 0:c.has(r))&&(o.recalculateVisibility(),this._updateLayer(o))}}this.dispatcher.broadcast("UGS",i);for(let r in this.tileManagers)e.has(r)&&(this._reloadSource(r),this._changed=!0)}loadURL(t){return it(this,arguments,void 0,function*(e,i={},r){this.fire(new R("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let o=yield this.map._requestManager.transformRequest(e,"Style");zd(n.signal);let s=yield ns(o,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(s.data,i,r)}catch(o){this._loadStyleRequest===n&&(this._loadStyleRequest=null),o&&!n.signal.aborted&&this.fire(new J(me(o)))}})}loadJSON(t,e={},i){this.fire(new R("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ge.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,e.validate=e.validate!==!1,this._load(t,e,i)}).catch(()=>{})}loadEmpty(){this.fire(new R("dataloading",{dataType:"style"})),this._load(D1,{validate:!1})}_load(t,e,i){var r,n;let o=e.transformStyle?e.transformStyle(i,t):t;if(!e.validate||!tl(this,te(o))){o=Object.assign({},o),this._loaded=!0,this.stylesheet=o;for(let s in o.sources)this.addSource(s,o.sources[s],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new Bm(this.stylesheet.light),this._setProjectionInternal(((r=this.stylesheet.projection)===null||r===void 0?void 0:r.type)||"mercator"),this.sky=new Om(this.stylesheet.sky),this.map.setTerrain((n=this.stylesheet.terrain)!==null&&n!==void 0?n:null),this.fire(new R("data",{dataType:"style"})),this.fire(new R("style.load"))}}_createLayers(){var t,e,i;let r=Fd(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",r),this._order=r.map((n)=>n.id),this._layers={},this._serializedLayers=null;for(let n of r){let o=mh(n,this._globalState);if(o.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=o,Sc(o)&&this.tileManagers[o.source]){let s=(i=(e=n.paint)===null||e===void 0?void 0:e["raster-fade-duration"])!==null&&i!==void 0?i:o.paint.get("raster-fade-duration");this.tileManagers[o.source].setRasterFadeDuration(s)}}}_loadSprite(t,e=!1,i=void 0){this.imageManager.setLoaded(!1);let r=new AbortController,n;this._spriteRequest=r,function(o,s,a,c){return it(this,void 0,void 0,function*(){let l=Aa(o),u=a>1?"@2x":"",h={},p={};for(let{id:d,url:f}of l){let m=yield s.transformRequest(Dm(f,u,".json"),"SpriteJSON");h[d]=ns(m,c);let _=yield s.transformRequest(Dm(f,u,".png"),"SpriteImage");p[d]=ci.getImage(_,c)}return yield Promise.all([...Object.values(h),...Object.values(p)]),function(d,f){return it(this,void 0,void 0,function*(){let m={};for(let _ in d){m[_]={};let y=ge.getImageCanvasContext((yield f[_]).data),v=(yield d[_]).data;for(let g in v){let{width:x,height:b,x:w,y:T,sdf:P,pixelRatio:S,stretchX:E,stretchY:I,content:C,textFitWidth:A,textFitHeight:M}=v[g];m[_][g]={data:null,pixelRatio:S,sdf:P,stretchX:E,stretchY:I,content:C,textFitWidth:A,textFitHeight:M,spriteData:{width:x,height:b,x:w,y:T,context:y}}}}return m})}(h,p)})}(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((o)=>{if(this._spriteRequest=null,o)for(let s in o){this._spritesImagesIds[s]=[];let a=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter((c)=>!(c in o)):[];for(let c of a)this.imageManager.removeImage(c),this._changedImages[c]=!0;for(let c in o[s]){let l=s==="default"?c:`${s}:${c}`;this._spritesImagesIds[s].push(l),l in this.imageManager.images?this.imageManager.updateImage(l,o[s][c],!1):this.imageManager.addImage(l,o[s][c]),e&&(this._changedImages[l]=!0)}}}).catch((o)=>{this._spriteRequest=null,n=o,r.signal.aborted||this.fire(new J(n))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),e&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new R("data",{dataType:"style"})),i&&i(n)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new R("data",{dataType:"style"}))}_validateLayer(t){let e=this.tileManagers[t.source];if(!e)return;let i=t.sourceLayer;if(!i)return;let r=e.getSource();(r.type==="geojson"||r.vectorLayerIds&&!r.vectorLayerIds.includes(i))&&this.fire(new J(Error(`Source layer "${i}" does not exist on source "${r.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,e=!1){let i=this._serializedAllLayers();if(!t||t.length===0)return Object.values(e?be(i):i);let r=[];for(let n of t)if(i[n]){let o=e?be(i[n]):i[n];r.push(o)}return r}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let e=Object.keys(this._layers);for(let i of e){let r=this._layers[i];r.type!=="custom"&&(t[i]=r.serialize())}return t}hasTransitions(){var t,e,i;if((t=this.light)===null||t===void 0?void 0:t.hasTransition())return!0;if((e=this.sky)===null||e===void 0?void 0:e.hasTransition())return!0;if((i=this.projection)===null||i===void 0?void 0:i.hasTransition())return!0;for(let r in this.tileManagers)if(this.tileManagers[r].hasTransition())return!0;for(let r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let e=this._changed;if(e){let r=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(r.length||n.length)&&this._updateWorkerLayers(r,n);for(let o in this._updatedSources){let s=this._updatedSources[o];if(s==="reload")this._reloadSource(o);else{if(s!=="clear")throw Error(`Invalid action ${s}`);this._clearSource(o)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let o in this._updatedPaintProps)this._layers[o].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}let i={};for(let r in this.tileManagers){let n=this.tileManagers[r];i[r]=n.used,n.used=!1}for(let r of this._order){let n=this._layers[r];n.recalculate(t,this._availableImages),!n.isHidden(t.zoom)&&n.source&&(this.tileManagers[n.source].used=!0)}for(let r in i){let n=this.tileManagers[r];!!i[r]!=!!n.used&&n.fire(new R("data",{sourceDataType:"visibility",dataType:"source",sourceId:r}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,e&&this.fire(new R("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,e){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:e})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,e={}){var i;this._checkLoaded();let r=this.serialize();if(t=e.transformStyle?e.transformStyle(r,t):t,((i=e.validate)===null||i===void 0||i)&&tl(this,te(t)))return!1;(t=be(t)).layers=Fd(t.layers);let n=function(s,a){if(!s)return[{command:"setStyle",args:[a]}];let c=[];try{if(!bt(s.version,a.version))return[{command:"setStyle",args:[a]}];bt(s.center,a.center)||c.push({command:"setCenter",args:[a.center]}),bt(s.state,a.state)||c.push({command:"setGlobalState",args:[a.state]}),bt(s.centerAltitude,a.centerAltitude)||c.push({command:"setCenterAltitude",args:[a.centerAltitude]}),bt(s.zoom,a.zoom)||c.push({command:"setZoom",args:[a.zoom]}),bt(s.bearing,a.bearing)||c.push({command:"setBearing",args:[a.bearing]}),bt(s.pitch,a.pitch)||c.push({command:"setPitch",args:[a.pitch]}),bt(s.roll,a.roll)||c.push({command:"setRoll",args:[a.roll]}),bt(s.sprite,a.sprite)||c.push({command:"setSprite",args:[a.sprite]}),bt(s.glyphs,a.glyphs)||c.push({command:"setGlyphs",args:[a.glyphs]}),bt(s.transition,a.transition)||c.push({command:"setTransition",args:[a.transition]}),bt(s.light,a.light)||c.push({command:"setLight",args:[a.light]}),bt(s.terrain,a.terrain)||c.push({command:"setTerrain",args:[a.terrain]}),bt(s.sky,a.sky)||c.push({command:"setSky",args:[a.sky]}),bt(s.projection,a.projection)||c.push({command:"setProjection",args:[a.projection]});let l={},u=[];(function(p,d,f,m){let _;for(_ in d=d||{},p=p||{})Object.prototype.hasOwnProperty.call(p,_)&&(Object.prototype.hasOwnProperty.call(d,_)||Od(_,f,m));for(_ in d)Object.prototype.hasOwnProperty.call(d,_)&&(Object.prototype.hasOwnProperty.call(p,_)?bt(p[_],d[_])||(p[_].type==="geojson"&&d[_].type==="geojson"&&T0(p,d,_)?je(f,{command:"setGeoJSONSourceData",args:[_,d[_].data]}):w0(_,d,f,m)):Bd(_,d,f))})(s.sources,a.sources,u,l);let h=[];s.layers&&s.layers.forEach((p)=>{"source"in p&&l[p.source]?c.push({command:"removeLayer",args:[p.id]}):h.push(p)}),c=c.concat(u),function(p,d,f){d=d||[];let m=(p=p||[]).map(jd),_=d.map(jd),y=p.reduce(Nd,{}),v=d.reduce(Nd,{}),g=m.slice(),x=Object.create(null),b,w,T,P,S;for(let E=0,I=0;E<m.length;E++)b=m[E],Object.prototype.hasOwnProperty.call(v,b)?I++:(je(f,{command:"removeLayer",args:[b]}),g.splice(g.indexOf(b,I),1));for(let E=0,I=0;E<_.length;E++)b=_[_.length-1-E],g[g.length-1-E]!==b&&(Object.prototype.hasOwnProperty.call(y,b)?(je(f,{command:"removeLayer",args:[b]}),g.splice(g.lastIndexOf(b,g.length-I),1)):I++,P=g[g.length-E],je(f,{command:"addLayer",args:[v[b],P]}),g.splice(g.length-E,0,b),x[b]=!0);for(let E=0;E<_.length;E++)if(b=_[E],w=y[b],T=v[b],!x[b]&&!bt(w,T))if(bt(w.source,T.source)&&bt(w["source-layer"],T["source-layer"])&&bt(w.type,T.type)){for(S in os(w.layout,T.layout,f,b,null,"setLayoutProperty"),os(w.paint,T.paint,f,b,null,"setPaintProperty"),bt(w.filter,T.filter)||je(f,{command:"setFilter",args:[b,T.filter]}),bt(w.minzoom,T.minzoom)&&bt(w.maxzoom,T.maxzoom)||je(f,{command:"setLayerZoomRange",args:[b,T.minzoom,T.maxzoom]}),w)Object.prototype.hasOwnProperty.call(w,S)&&S!=="layout"&&S!=="paint"&&S!=="filter"&&S!=="metadata"&&S!=="minzoom"&&S!=="maxzoom"&&(S.indexOf("paint.")===0?os(w[S],T[S],f,b,S.slice(6),"setPaintProperty"):bt(w[S],T[S])||je(f,{command:"setLayerProperty",args:[b,S,T[S]]}));for(S in T)Object.prototype.hasOwnProperty.call(T,S)&&!Object.prototype.hasOwnProperty.call(w,S)&&S!=="layout"&&S!=="paint"&&S!=="filter"&&S!=="metadata"&&S!=="minzoom"&&S!=="maxzoom"&&(S.indexOf("paint.")===0?os(w[S],T[S],f,b,S.slice(6),"setPaintProperty"):bt(w[S],T[S])||je(f,{command:"setLayerProperty",args:[b,S,T[S]]}))}else je(f,{command:"removeLayer",args:[b]}),P=g[g.lastIndexOf(b)+1],je(f,{command:"addLayer",args:[T,P]})}(h,a.layers,c)}catch(l){console.warn("Unable to compute style diff:",l),c=[{command:"setStyle",args:[a]}]}return c}(r,t),o=this._getOperationsToPerform(n);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(o.operations.length===0)return!1;for(let s of o.operations)s();return this.stylesheet=t,this._serializedLayers=null,this.fire(new R("style.load",{style:this})),!0}_getOperationsToPerform(t){let e=[],i=[];for(let r of t)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":e.push(()=>this.addLayer.apply(this,r.args));break;case"removeLayer":e.push(()=>this.removeLayer.apply(this,r.args));break;case"setPaintProperty":e.push(()=>this.setPaintProperty.apply(this,r.args));break;case"setLayoutProperty":e.push(()=>this.setLayoutProperty.apply(this,r.args));break;case"setFilter":e.push(()=>this.setFilter.apply(this,r.args));break;case"addSource":e.push(()=>this.addSource.apply(this,r.args));break;case"removeSource":e.push(()=>this.removeSource.apply(this,r.args));break;case"setLayerZoomRange":e.push(()=>this.setLayerZoomRange.apply(this,r.args));break;case"setLight":e.push(()=>this.setLight.apply(this,r.args));break;case"setGeoJSONSourceData":e.push(()=>this.setGeoJSONSourceData.apply(this,r.args));break;case"setGlyphs":e.push(()=>this.setGlyphs.apply(this,r.args));break;case"setSprite":e.push(()=>this.setSprite.apply(this,r.args));break;case"setTerrain":e.push(()=>this.map.setTerrain.apply(this,r.args));break;case"setSky":e.push(()=>this.setSky.apply(this,r.args));break;case"setProjection":this.setProjection.apply(this,r.args);break;case"setGlobalState":e.push(()=>this.setGlobalState.apply(this,r.args));break;case"setTransition":e.push(()=>{});break;default:i.push(r.command)}return{operations:e,unimplemented:i}}addImage(t,e){if(this.getImage(t))return this.fire(new J(Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,e),this._afterImageUpdated(t)}updateImage(t,e){this.imageManager.updateImage(t,e)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new J(Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new R("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,e,i={}){var r;if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw Error(`Source "${t}" already exists.`);if(!e.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(e).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(e.type)&&this._validate(te.source,`sources.${t}`,e,null,i))return;((r=this.map)===null||r===void 0?void 0:r._collectResourceTiming)&&(e.collectResourceTiming=!0);let n=this.tileManagers[t]=new Zi(t,e,this.dispatcher);n.style=this,n.setEventedParent(this,()=>({isSourceLoaded:n.loaded(),source:n.serialize(),sourceId:t})),n.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw Error(`There is no source with this ID=${t}`);for(let i in this._layers)if(this._layers[i].source===t)return this.fire(new J(Error(`Source "${t}" cannot be removed while layer "${i}" is using it.`)));let e=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],e.fire(new R("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),e.setEventedParent(null),e.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,e){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw Error(`There is no source with this ID=${t}`);let i=this.tileManagers[t].getSource();if(i.type!=="geojson")throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(e),this._changed=!0}getSource(t){var e;return(e=this.tileManagers[t])===null||e===void 0?void 0:e.getSource()}addLayer(t,e,i={}){this._checkLoaded();let r=t.id;if(this.getLayer(r))return void this.fire(new J(Error(`Layer "${r}" already exists on this map.`)));let n;if(t.type==="custom"){if(tl(this,function(s){let a=[],c=s.id;return c===void 0&&a.push({message:`layers.${c}: missing required property "id"`}),s.render===void 0&&a.push({message:`layers.${c}: missing required method "render"`}),s.renderingMode&&s.renderingMode!=="2d"&&s.renderingMode!=="3d"&&a.push({message:`layers.${c}: property "renderingMode" must be either "2d" or "3d"`}),a}(t)))return;n=mh(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(r,t.source),t=G(t=be(t),{source:r})),this._validate(te.layer,`layers.${r}`,t,{arrayIndex:-1},i))return;n=mh(t,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:r}})}let o=e?this._order.indexOf(e):this._order.length;if(e&&o===-1)this.fire(new J(Error(`Cannot add layer "${r}" before non-existing layer "${e}".`)));else{if(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._layers[r]=n,this._removedLayers[r]&&n.source&&n.type!=="custom"){let s=this._removedLayers[r];delete this._removedLayers[r],s.type!==n.type?this._updatedSources[n.source]="clear":(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause())}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}}moveLayer(t,e){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new J(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===e)return;let i=this._order.indexOf(t);this._order.splice(i,1);let r=e?this._order.indexOf(e):this._order.length;e&&r===-1?this.fire(new J(Error(`Cannot move layer "${t}" before non-existing layer "${e}".`))):(this._order.splice(r,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();let e=this._layers[t];if(!e)return void this.fire(new J(Error(`Cannot remove non-existing layer "${t}".`)));e.setEventedParent(null);let i=this._order.indexOf(t);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=e,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],e.onRemove&&e.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,e,i){this._checkLoaded();let r=this.getLayer(t);r?r.minzoom===e&&r.maxzoom===i||(e!=null&&(r.minzoom=e),i!=null&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new J(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,e,i={}){this._checkLoaded();let r=this.getLayer(t);if(r){if(!li(r.filter,e))return e==null?(r.setFilter(void 0),void this._updateLayer(r)):void(this._validate(te.filter,`layers.${r.id}.filter`,e,null,i)||(r.setFilter(be(e)),this._updateLayer(r)))}else this.fire(new J(Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return be(this.getLayer(t).filter)}setLayoutProperty(t,e,i,r={}){this._checkLoaded();let n=this.getLayer(t);n?li(n.getLayoutProperty(e),i)||(n.setLayoutProperty(e,i,r),this._updateLayer(n)):this.fire(new J(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,e){let i=this.getLayer(t);if(i)return i.getLayoutProperty(e);this.fire(new J(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,e,i,r={}){this._checkLoaded();let n=this.getLayer(t);n?li(n.getPaintProperty(e),i)||this._updatePaintProperty(n,e,i,r):this.fire(new J(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,e,i,r={}){t.setPaintProperty(e,i,r)&&this._updateLayer(t),Sc(t)&&e==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,e){return this.getLayer(t).getPaintProperty(e)}setFeatureState(t,e){this._checkLoaded();let{source:i,sourceLayer:r}=t,n=this.tileManagers[i];if(n===void 0)return void this.fire(new J(Error(`The source '${i}' does not exist in the map's style.`)));let o=n.getSource().type;o==="geojson"&&r?this.fire(new J(Error("GeoJSON sources cannot have a sourceLayer parameter."))):o!=="vector"||r?(t.id===void 0&&this.fire(new J(Error("The feature id parameter must be provided."))),n.setFeatureState(r,t.id,e)):this.fire(new J(Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,e){this._checkLoaded();let i=t.source,r=this.tileManagers[i];if(r===void 0)return void this.fire(new J(Error(`The source '${i}' does not exist in the map's style.`)));let n=r.getSource().type,o=n==="vector"?t.sourceLayer:void 0;n!=="vector"||o?e&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new J(Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(o,t.id,e):this.fire(new J(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let{source:e,sourceLayer:i}=t,r=this.tileManagers[e];if(r!==void 0)return r.getSource().type!=="vector"||i?(t.id===void 0&&this.fire(new J(Error("The feature id parameter must be provided."))),r.getFeatureState(i,t.id)):void this.fire(new J(Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new J(Error(`The source '${e}' does not exist in the map's style.`)))}getTransition(){var t;return G({duration:300,delay:0},(t=this.stylesheet)===null||t===void 0?void 0:t.transition)}serialize(){if(!this._loaded)return;let t=Ml(this.tileManagers,(n)=>n.serialize()),e=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return Td({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,projection:r.projection,sources:t,layers:e,terrain:i},(n)=>n!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let e=(o)=>this._layers[o].type==="fill-extrusion",i={},r=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(e(s)){i[s]=o;for(let a of t){let c=a[s];if(c)for(let l of c)r.push(l)}}}r.sort((o,s)=>s.intersectionZ-o.intersectionZ);let n=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(e(s))for(let a=r.length-1;a>=0;a--){let c=r[a].feature;if(i[c.layer.id]<o)break;n.push(c),r.pop()}else for(let a of t){let c=a[s];if(c)for(let l of c)n.push(l.feature)}}return n}queryRenderedFeatures(t,e,i){(e==null?void 0:e.filter)&&this._validate(te.filter,"queryRenderedFeatures.filter",e.filter,null,e);let r={};if(e==null?void 0:e.layers){if(!(Array.isArray(e.layers)||e.layers instanceof Set))return this.fire(new J(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let c of e.layers){let l=this._layers[c];if(!l)return this.fire(new J(Error(`The layer '${c}' does not exist in the map's style and cannot be queried for features.`))),[];r[l.source]=!0}}let n=[];e.availableImages=this._availableImages;let o=this._serializedAllLayers(),s=e.layers instanceof Set?e.layers:Array.isArray(e.layers)?new Set(e.layers):null,a=Object.assign(Object.assign({},e),{layers:s,globalState:this._globalState});for(let c in this.tileManagers)e.layers&&!r[c]||n.push(Zx(this.tileManagers[c],this._layers,o,t,a,i,this.map.terrain?(l,u,h)=>this.map.terrain.getElevation(l,u,h):void 0));return this.placement&&n.push(function(c,l,u,h,p,d,f){let m={},_=d.queryRenderedSymbols(h),y=[];for(let v of Object.keys(_).map(Number))y.push(f[v]);y.sort(Um);for(let v of y){let g=v.featureIndex.lookupSymbolFeatures(_[v.bucketInstanceId],l,v.bucketIndex,v.sourceLayerIndex,{filterSpec:p.filter,globalState:p.globalState},p.layers,p.availableImages,c);for(let x in g){m[x]||(m[x]=[]);let b=g[x];b.sort((w,T)=>{let P=v.featureSortOrder;if(P){let S=P.indexOf(w.featureIndex);return P.indexOf(T.featureIndex)-S}return T.featureIndex-w.featureIndex});for(let w of b)m[x].push(w)}}return function(v,g,x){for(let b in v)for(let w of v[b])$m(w,x[g[b].source]);return v}(m,c,u)}(this._layers,o,this.tileManagers,t,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(n)}querySourceFeatures(t,e){(e==null?void 0:e.filter)&&this._validate(te.filter,"querySourceFeatures.filter",e.filter,null,e);let i=this.tileManagers[t];return i?function(r,n){let o=r.getRenderableIds().map((c)=>r.getTileByID(c)),s=[],a={};for(let c of o){let l=c.tileID.canonical.key;a[l]||(a[l]=!0,c.querySourceFeatures(s,n))}return s}(i,e?Object.assign(Object.assign({},e),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,e={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let o in t)if(!li(t[o],i[o])){r=!0;break}if(!r)return;let n={now:St(),transition:G({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,e),this.light.updateTransitions(n)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){this._checkLoaded();let e=t!=null?t:{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(e.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,e={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!t&&!i)return;if(t&&!i)r=!0;else if(!t&&i)r=!0;else for(let o in t)if(!li(t[o],i[o])){r=!0;break}if(!r)return;let n={now:St(),transition:G({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,e),this.sky.updateTransitions(n)}_setProjectionInternal(t){let e=function(i,r){let n={constrainOverride:r};if(Array.isArray(i)){let o=new Pu({type:i});return{projection:o,transform:new Qa(n),cameraHelper:new Mu(o)}}switch(i){case"mercator":return{projection:new Za,transform:new gn(n),cameraHelper:new No};case"globe":{let o=new Pu({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:o,transform:new Qa(n),cameraHelper:new Mu(o)}}case"vertical-perspective":return{projection:new Su,transform:new Ja(n),cameraHelper:new ni};default:return Ct(`Unknown projection name: ${i}. Falling back to mercator projection.`),{projection:new Za,transform:new gn(n),cameraHelper:new No}}}(t,this.map.transformConstrain);this.projection=e.projection,this.map.migrateProjection(e.transform,e.cameraHelper);for(let i in this.tileManagers)this.tileManagers[i].reload()}_validate(t,e,i,r,n={}){return(n==null?void 0:n.validate)!==!1&&tl(this,t.call(te,G({key:e,style:this.serialize(),value:i,styleSpec:D},r)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),Ro().off(eu,this._rtlPluginLoaded);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.tileManagers){let i=this.tileManagers[e];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let e in this.tileManagers)this.tileManagers[e].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,e,i,r,n=!1){let o=!1,s=!1,a={};for(let c of this._order){let l=this._layers[c];if(l.type!=="symbol")continue;if(!a[l.source]){let h=this.tileManagers[l.source];a[l.source]=h.getRenderableIds(!0).map((p)=>h.getTileByID(p)).sort((p,d)=>d.tileID.overscaledZ-p.tileID.overscaledZ||(p.tileID.isLessThan(d.tileID)?-1:1))}let u=this.crossTileSymbolIndex.addLayer(l,a[l.source],t.center.lng);o||(o=u)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),n||(n=this._layerOrderChanged||i===0),(n||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(St(),t.zoom))&&(this.pauseablePlacement=new J_(t,this.map.terrain,this._order,n,e,i,r,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,a),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(St()),s=!0),o&&this.pauseablePlacement.placement.setStale()),s||o)for(let c of this._order){let l=this._layers[c];l.type==="symbol"&&this.placement.updateLayerOpacities(l,a[l.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(St())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,e){return it(this,void 0,void 0,function*(){let i=yield this.imageManager.getImages(e.icons);this._updateTilesForChangedImages();let r=this.tileManagers[e.source];return r&&r.setDependencies(e.tileID.key,e.type,e.icons),i})}getGlyphs(t,e){return it(this,void 0,void 0,function*(){let i=yield this.glyphManager.getGlyphs(e.stacks),r=this.tileManagers[e.source];return r&&r.setDependencies(e.tileID.key,e.type,[""]),i})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,e={}){this._checkLoaded(),t&&this._validate(te.glyphs,"glyphs",t,null,e)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,e){return it(this,void 0,void 0,function*(){let i={};for(let[r,n]of Object.entries(e.dashes))i[r]=this.lineAtlas.getDash(n.dasharray,n.round);return i})}addSprite(t,e,i={},r){this._checkLoaded();let n=[{id:t,url:e}],o=[...Aa(this.stylesheet.sprite),...n];this._validate(te.sprite,"sprite",o,null,i)||(this.stylesheet.sprite=o,this._loadSprite(n,!0,r))}removeSprite(t){this._checkLoaded();let e=Aa(this.stylesheet.sprite);if(e.find((i)=>i.id===t)){if(this._spritesImagesIds[t])for(let i of this._spritesImagesIds[t])this.imageManager.removeImage(i),this._changedImages[i]=!0;e.splice(e.findIndex((i)=>i.id===t),1),this.stylesheet.sprite=e.length>0?e:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new R("data",{dataType:"style"}))}else this.fire(new J(Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return Aa(this.stylesheet.sprite)}setSprite(t,e={},i){this._checkLoaded(),t&&this._validate(te.sprite,"sprite",t,null,e)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(let t in this.tileManagers){let e=this.tileManagers[t];e.setEventedParent(null),e.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(let t in this._layers){let e=this._layers[t];e.setEventedParent(null),e.onRemove&&e.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}}var R1=Bt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class yg{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,i,r,n,o,s,a,c){this.context=t;let l=this.boundPaintVertexBuffers.length!==r.length;for(let u=0;!l&&u<r.length;u++)this.boundPaintVertexBuffers[u]!==r[u]&&(l=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==i||l||this.boundIndexBuffer!==n||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==a||this.boundDynamicVertexBuffer3!==c?this.freshBind(e,i,r,n,o,s,a,c):(t.bindVertexArray.set(this.vao),s&&s.bind(),(n==null?void 0:n.dynamicDraw)&&n.bind(),a&&a.bind(),c&&c.bind())}freshBind(t,e,i,r,n,o,s,a){let c=t.numAttributes,l=this.context,u=l.gl;this.vao&&this.destroy(),this.vao=l.createVertexArray(),l.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=n,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=a,e.enableAttributes(u,t);for(let h of i)h.enableAttributes(u,t);o&&o.enableAttributes(u,t),s&&s.enableAttributes(u,t),a&&a.enableAttributes(u,t),e.bind(),e.setVertexAttribPointers(u,t,n);for(let h of i)h.bind(),h.setVertexAttribPointers(u,t,n);o&&(o.bind(),o.setVertexAttribPointers(u,t,n)),r&&r.bind(),s&&(s.bind(),s.setVertexAttribPointers(u,t,n)),a&&(a.bind(),a.setVertexAttribPointers(u,t,n)),l.currentNumAttributes=c}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}let k1=(t,e,i,r,n)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):Y.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:n?0:i?i.calculateFogBlendOpacity(r):0,u_horizon_color:i?i.properties.get("horizon-color"):Y.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:n?1:0}),L1={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function il(t){let e=[];for(let i of t){if(i===null)continue;let r=i.split(" ");e.push(r.pop())}return e}class vg{constructor(t,e,i,r,n,o,s,a,c=[]){let l=t.gl;this.program=l.createProgram();let u=il(e.staticAttributes),h=i?i.getBinderAttributes():[],p=u.concat(h),d=yi.prelude.staticUniforms?il(yi.prelude.staticUniforms):[],f=s.staticUniforms?il(s.staticUniforms):[],m=e.staticUniforms?il(e.staticUniforms):[],_=i?i.getBinderUniforms():[],y=d.concat(f).concat(m).concat(_),v=[];for(let S of y)v.includes(S)||v.push(S);let g=i?i.defines():[];Mi(l)&&g.unshift("#version 300 es"),n&&g.push("#define OVERDRAW_INSPECTOR;"),o&&g.push("#define TERRAIN3D;"),a&&g.push(a),c&&g.push(...c);let x=g.concat(yi.prelude.fragmentSource,s.fragmentSource,e.fragmentSource).join(`
797
+ `),b=g.concat(yi.prelude.vertexSource,s.vertexSource,e.vertexSource).join(`
798
+ `);Mi(l)||(x=function(S){return S.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(x),b=function(S){return S.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(b));let w=l.createShader(l.FRAGMENT_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);if(l.shaderSource(w,x),l.compileShader(w),!l.getShaderParameter(w,l.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${l.getShaderInfoLog(w)}`);l.attachShader(this.program,w);let T=l.createShader(l.VERTEX_SHADER);if(l.isContextLost())return void(this.failedToCreate=!0);if(l.shaderSource(T,b),l.compileShader(T),!l.getShaderParameter(T,l.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${l.getShaderInfoLog(T)}`);l.attachShader(this.program,T),this.attributes={};let P={};this.numAttributes=p.length;for(let S=0;S<this.numAttributes;S++)p[S]&&(l.bindAttribLocation(this.program,S,p[S]),this.attributes[p[S]]=S);if(l.linkProgram(this.program),!l.getProgramParameter(this.program,l.LINK_STATUS))throw Error(`Program failed to link: ${l.getProgramInfoLog(this.program)}`);l.deleteShader(T),l.deleteShader(w);for(let S of v)if(S&&!P[S]){let E=l.getUniformLocation(this.program,S);E&&(P[S]=E)}this.fixedUniforms=r(t,P),this.terrainUniforms=((S,E)=>({u_depth:new tt(S,E.u_depth),u_terrain:new tt(S,E.u_terrain),u_terrain_dim:new B(S,E.u_terrain_dim),u_terrain_matrix:new Se(S,E.u_terrain_matrix),u_terrain_unpack:new Si(S,E.u_terrain_unpack),u_terrain_exaggeration:new B(S,E.u_terrain_exaggeration)}))(t,P),this.projectionUniforms=((S,E)=>({u_projection_matrix:new Se(S,E.u_projection_matrix),u_projection_tile_mercator_coords:new Si(S,E.u_projection_tile_mercator_coords),u_projection_clipping_plane:new Si(S,E.u_projection_clipping_plane),u_projection_transition:new B(S,E.u_projection_transition),u_projection_fallback_matrix:new Se(S,E.u_projection_fallback_matrix)}))(t,P),this.binderUniforms=i?i.getUniforms(t,P):[]}draw(t,e,i,r,n,o,s,a,c,l,u,h,p,d,f,m,_,y,v){var g;let x=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(r),t.setColorMode(n),t.setCullFace(o),a){t.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,a.depthTexture),t.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,a.texture);for(let w in this.terrainUniforms)this.terrainUniforms[w].set(a[w])}if(c)for(let w in c)this.projectionUniforms[L1[w]].set(c[w]);if(s)for(let w in this.fixedUniforms)this.fixedUniforms[w].set(s[w]);m&&m.setUniforms(t,this.binderUniforms,d,{zoom:f});let b=0;switch(e){case x.LINES:b=2;break;case x.TRIANGLES:b=3;break;case x.LINE_STRIP:b=1}for(let w of p.get())w.vaos||(w.vaos={}),(g=w.vaos)[l]||(g[l]=new yg),w.vaos[l].bind(t,this,u,m?m.getPaintVertexBuffers():[],h,w.vertexOffset,_,y,v),x.drawElements(e,w.primitiveLength*b,x.UNSIGNED_SHORT,w.primitiveOffset*b*2)}}function xg(t,e,i){let r=1/Me(i,1,e.transform.tileZoom),n=Math.pow(2,i.tileID.overscaledZ),o=i.tileSize*Math.pow(2,e.transform.tileZoom)/n,s=o*(i.tileID.canonical.x+i.tileID.wrap*n),a=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[s>>16,a>>16],u_pixel_coord_lower:[65535&s,65535&a]}}let bg=(t,e,i,r)=>{let n=t.style.light,o=n.properties.get("position"),s=[o.x,o.y,o.z],a=ud();var c,l,u,h;n.properties.get("anchor")==="viewport"&&(c=a,l=t.transform.bearingInRadians,u=Math.sin(l),h=Math.cos(l),c[0]=h,c[1]=u,c[2]=0,c[3]=-u,c[4]=h,c[5]=0,c[6]=0,c[7]=0,c[8]=1),function(f,m,_){var y=m[0],v=m[1],g=m[2];f[0]=y*_[0]+v*_[3]+g*_[6],f[1]=y*_[1]+v*_[4]+g*_[7],f[2]=y*_[2]+v*_[5]+g*_[8]}(s,s,a);let p=t.transform.transformLightDirection(s),d=n.properties.get("color");return{u_lightpos:s,u_lightpos_globe:p,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[d.r,d.g,d.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:r}},F1=(t,e,i,r,n,o,s)=>G(bg(t,e,i,r),xg(o,t,s),{u_height_factor:-Math.pow(2,n.overscaledZ)/s.tileSize/8}),wg=(t,e,i,r)=>G(xg(e,t,i),{u_fill_translate:r}),B1=(t)=>({u_fill_translate:t}),O1=(t,e)=>({u_world:t,u_fill_translate:e}),j1=(t,e,i,r,n)=>G(wg(t,e,i,n),{u_world:r}),N1=(t,e,i,r,n)=>{let o=t.transform,s,a,c=0;if(i.paint.get("circle-pitch-alignment")==="map"){let l=Me(e,1,o.zoom);s=!0,a=[l,l],c=l/(F*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*n}else s=!1,a=o.pixelsToGLUnits;return{u_camera_to_center_distance:o.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+s,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:a,u_globe_extrude_scale:c,u_translate:r}},V1=(t)=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),U1=(t)=>({u_viewport_size:[t.width,t.height]}),Tg=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e}),Sg=(t,e,i,r)=>{let n=Me(t,1,e)/(F*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*r;return{u_extrude_scale:Me(t,1,e),u_intensity:i,u_globe_extrude_scale:n}},Pg=(t,e,i,r)=>{let n=Ci();si(n,0,t.width,t.height,0,0,1);let o=t.context.gl;return{u_matrix:n,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:i,u_color_ramp:r,u_opacity:e.paint.get("heatmap-opacity")}},$1=(t,e,i)=>{let r=i.paint.get("hillshade-accent-color"),n;switch(i.paint.get("hillshade-method")){case"basic":n=4;break;case"combined":n=1;break;case"igor":n=2;break;case"multidirectional":n=3;break;default:n=0}let o=i.getIlluminationProperties();for(let s=0;s<o.directionRadians.length;s++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(o.directionRadians[s]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:G1(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:o.altitudeRadians,u_azimuths:o.directionRadians,u_accent:r,u_method:n,u_highlights:o.highlightColor,u_shadows:o.shadowColor}},Z1=(t,e)=>{let i=e.stride,r=Ci();return si(r,0,F,-8192,0,0,1),Ot(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:e.getUnpackVector()}};function G1(t,e){let i=Math.pow(2,e.canonical.z),r=e.canonical.y;return[new wt(0,r/i).toLngLat().lat,new wt(0,(r+1)/i).toLngLat().lat]}let q1=(t,e,i=0)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:t.paint.get("color-relief-opacity")}),rl=(t,e,i,r)=>{let n=t.transform;return{u_translation:Ig(t,e,i),u_ratio:r/Me(e,1,n.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},W1=(t,e,i,r,n)=>G(rl(t,e,i,r),{u_image:0,u_image_height:n}),H1=(t,e,i,r,n)=>{let o=t.transform,s=Cu(e,o);return{u_translation:Ig(t,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:r/Me(e,1,o.zoom),u_device_pixel_ratio:t.pixelRatio,u_image:0,u_scale:[s,n.fromScale,n.toScale],u_fade:n.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},X1=(t,e,i,r,n)=>{let o=Cu(e,t.transform);return G(rl(t,e,i,r),{u_tileratio:o,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image:0,u_mix:n.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},Y1=(t,e,i,r,n,o)=>{let s=Cu(e,t.transform);return G(rl(t,e,i,r),{u_image:0,u_image_height:o,u_tileratio:s,u_crossfade_from:n.fromScale,u_crossfade_to:n.toScale,u_image_dash:1,u_mix:n.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})};function Cu(t,e){return 1/Me(t,1,e.tileZoom)}function Ig(t,e,i){return zi(t.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}let K1=(t,e,i,r,n)=>{return{u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:(s=r.paint.get("raster-saturation"),s>0?1-1/(1.001-s):-s),u_contrast_factor:(o=r.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:J1(r.paint.get("raster-hue-rotate")),u_coords_top:[n[0].x,n[0].y,n[1].x,n[1].y],u_coords_bottom:[n[3].x,n[3].y,n[2].x,n[2].y]};var o,s};function J1(t){t*=Math.PI/180;let e=Math.sin(t),i=Math.cos(t);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}let Eg=(t,e,i,r,n,o,s,a,c,l,u,h,p)=>{let d=s.transform;return{u_is_size_zoom_constant:+(t==="constant"||t==="source"),u_is_size_feature_constant:+(t==="constant"||t==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:d.cameraToCenterDistance,u_pitch:d.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:d.width/d.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:a,u_coord_matrix:c,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:n,u_is_variable_anchor:o,u_texsize:h,u_texture:0,u_translation:l,u_pitched_scale:p}},Mg=(t,e,i,r,n,o,s,a,c,l,u,h,p,d)=>{let f=s.transform;return G(Eg(t,e,i,r,n,o,s,a,c,l,u,h,d),{u_gamma_scale:r?Math.cos(f.pitch*Math.PI/180)*f.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:p?1:0,u_is_plain:1})},Q1=(t,e,i,r,n,o,s,a,c,l,u,h,p)=>G(Mg(t,e,i,r,n,o,s,a,c,l,!0,u,!0,p),{u_texsize_icon:h,u_texture_icon:1}),tb=(t,e)=>({u_opacity:t,u_color:e}),eb=(t,e,i,r,n)=>G(function(o,s,a,c){let l=a.imageManager.getPattern(o.from.toString()),u=a.imageManager.getPattern(o.to.toString()),{width:h,height:p}=a.imageManager.getPixelSize(),d=Math.pow(2,c.tileID.overscaledZ),f=c.tileSize*Math.pow(2,a.transform.tileZoom)/d,m=f*(c.tileID.canonical.x+c.tileID.wrap*d),_=f*c.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:l.tl,u_pattern_br_a:l.br,u_pattern_tl_b:u.tl,u_pattern_br_b:u.br,u_texsize:[h,p],u_mix:s.t,u_pattern_size_a:l.displaySize,u_pattern_size_b:u.displaySize,u_scale_a:s.fromScale,u_scale_b:s.toScale,u_tile_units_to_pixels:1/Me(c,1,a.transform.tileZoom),u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_]}}(i,n,e,r),{u_opacity:t}),Cg=(t,e)=>{},ib={fillExtrusion:(t,e)=>({u_lightpos:new Te(t,e.u_lightpos),u_lightpos_globe:new Te(t,e.u_lightpos_globe),u_lightintensity:new B(t,e.u_lightintensity),u_lightcolor:new Te(t,e.u_lightcolor),u_vertical_gradient:new B(t,e.u_vertical_gradient),u_opacity:new B(t,e.u_opacity),u_fill_translate:new et(t,e.u_fill_translate)}),fillExtrusionPattern:(t,e)=>({u_lightpos:new Te(t,e.u_lightpos),u_lightpos_globe:new Te(t,e.u_lightpos_globe),u_lightintensity:new B(t,e.u_lightintensity),u_lightcolor:new Te(t,e.u_lightcolor),u_vertical_gradient:new B(t,e.u_vertical_gradient),u_height_factor:new B(t,e.u_height_factor),u_opacity:new B(t,e.u_opacity),u_fill_translate:new et(t,e.u_fill_translate),u_image:new tt(t,e.u_image),u_texsize:new et(t,e.u_texsize),u_pixel_coord_upper:new et(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new et(t,e.u_pixel_coord_lower),u_scale:new Te(t,e.u_scale),u_fade:new B(t,e.u_fade)}),fill:(t,e)=>({u_fill_translate:new et(t,e.u_fill_translate)}),fillPattern:(t,e)=>({u_image:new tt(t,e.u_image),u_texsize:new et(t,e.u_texsize),u_pixel_coord_upper:new et(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new et(t,e.u_pixel_coord_lower),u_scale:new Te(t,e.u_scale),u_fade:new B(t,e.u_fade),u_fill_translate:new et(t,e.u_fill_translate)}),fillOutline:(t,e)=>({u_world:new et(t,e.u_world),u_fill_translate:new et(t,e.u_fill_translate)}),fillOutlinePattern:(t,e)=>({u_world:new et(t,e.u_world),u_image:new tt(t,e.u_image),u_texsize:new et(t,e.u_texsize),u_pixel_coord_upper:new et(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new et(t,e.u_pixel_coord_lower),u_scale:new Te(t,e.u_scale),u_fade:new B(t,e.u_fade),u_fill_translate:new et(t,e.u_fill_translate)}),circle:(t,e)=>({u_camera_to_center_distance:new B(t,e.u_camera_to_center_distance),u_scale_with_map:new tt(t,e.u_scale_with_map),u_pitch_with_map:new tt(t,e.u_pitch_with_map),u_extrude_scale:new et(t,e.u_extrude_scale),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_globe_extrude_scale:new B(t,e.u_globe_extrude_scale),u_translate:new et(t,e.u_translate)}),collisionBox:(t,e)=>({u_pixel_extrude_scale:new et(t,e.u_pixel_extrude_scale)}),collisionCircle:(t,e)=>({u_viewport_size:new et(t,e.u_viewport_size)}),debug:(t,e)=>({u_color:new Pi(t,e.u_color),u_overlay:new tt(t,e.u_overlay),u_overlay_scale:new B(t,e.u_overlay_scale)}),depth:Cg,clippingMask:Cg,heatmap:(t,e)=>({u_extrude_scale:new B(t,e.u_extrude_scale),u_intensity:new B(t,e.u_intensity),u_globe_extrude_scale:new B(t,e.u_globe_extrude_scale)}),heatmapTexture:(t,e)=>({u_matrix:new Se(t,e.u_matrix),u_world:new et(t,e.u_world),u_image:new tt(t,e.u_image),u_color_ramp:new tt(t,e.u_color_ramp),u_opacity:new B(t,e.u_opacity)}),hillshade:(t,e)=>({u_image:new tt(t,e.u_image),u_latrange:new et(t,e.u_latrange),u_exaggeration:new B(t,e.u_exaggeration),u_altitudes:new Vc(t,e.u_altitudes),u_azimuths:new Vc(t,e.u_azimuths),u_accent:new Pi(t,e.u_accent),u_method:new tt(t,e.u_method),u_shadows:new Nc(t,e.u_shadows),u_highlights:new Nc(t,e.u_highlights)}),hillshadePrepare:(t,e)=>({u_matrix:new Se(t,e.u_matrix),u_image:new tt(t,e.u_image),u_dimension:new et(t,e.u_dimension),u_zoom:new B(t,e.u_zoom),u_unpack:new Si(t,e.u_unpack)}),colorRelief:(t,e)=>({u_image:new tt(t,e.u_image),u_unpack:new Si(t,e.u_unpack),u_dimension:new et(t,e.u_dimension),u_elevation_stops:new tt(t,e.u_elevation_stops),u_color_stops:new tt(t,e.u_color_stops),u_color_ramp_size:new tt(t,e.u_color_ramp_size),u_opacity:new B(t,e.u_opacity)}),line:(t,e)=>({u_translation:new et(t,e.u_translation),u_ratio:new B(t,e.u_ratio),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_units_to_pixels:new et(t,e.u_units_to_pixels)}),lineGradient:(t,e)=>({u_translation:new et(t,e.u_translation),u_ratio:new B(t,e.u_ratio),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_units_to_pixels:new et(t,e.u_units_to_pixels),u_image:new tt(t,e.u_image),u_image_height:new B(t,e.u_image_height)}),linePattern:(t,e)=>({u_translation:new et(t,e.u_translation),u_texsize:new et(t,e.u_texsize),u_ratio:new B(t,e.u_ratio),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_image:new tt(t,e.u_image),u_units_to_pixels:new et(t,e.u_units_to_pixels),u_scale:new Te(t,e.u_scale),u_fade:new B(t,e.u_fade)}),lineSDF:(t,e)=>({u_translation:new et(t,e.u_translation),u_ratio:new B(t,e.u_ratio),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_units_to_pixels:new et(t,e.u_units_to_pixels),u_image:new tt(t,e.u_image),u_mix:new B(t,e.u_mix),u_tileratio:new B(t,e.u_tileratio),u_crossfade_from:new B(t,e.u_crossfade_from),u_crossfade_to:new B(t,e.u_crossfade_to),u_lineatlas_width:new B(t,e.u_lineatlas_width),u_lineatlas_height:new B(t,e.u_lineatlas_height)}),lineGradientSDF:(t,e)=>({u_translation:new et(t,e.u_translation),u_ratio:new B(t,e.u_ratio),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_units_to_pixels:new et(t,e.u_units_to_pixels),u_image:new tt(t,e.u_image),u_image_height:new B(t,e.u_image_height),u_tileratio:new B(t,e.u_tileratio),u_crossfade_from:new B(t,e.u_crossfade_from),u_crossfade_to:new B(t,e.u_crossfade_to),u_image_dash:new tt(t,e.u_image_dash),u_mix:new B(t,e.u_mix),u_lineatlas_width:new B(t,e.u_lineatlas_width),u_lineatlas_height:new B(t,e.u_lineatlas_height)}),raster:(t,e)=>({u_tl_parent:new et(t,e.u_tl_parent),u_scale_parent:new B(t,e.u_scale_parent),u_buffer_scale:new B(t,e.u_buffer_scale),u_fade_t:new B(t,e.u_fade_t),u_opacity:new B(t,e.u_opacity),u_image0:new tt(t,e.u_image0),u_image1:new tt(t,e.u_image1),u_brightness_low:new B(t,e.u_brightness_low),u_brightness_high:new B(t,e.u_brightness_high),u_saturation_factor:new B(t,e.u_saturation_factor),u_contrast_factor:new B(t,e.u_contrast_factor),u_spin_weights:new Te(t,e.u_spin_weights),u_coords_top:new Si(t,e.u_coords_top),u_coords_bottom:new Si(t,e.u_coords_bottom)}),symbolIcon:(t,e)=>({u_is_size_zoom_constant:new tt(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new tt(t,e.u_is_size_feature_constant),u_size_t:new B(t,e.u_size_t),u_size:new B(t,e.u_size),u_camera_to_center_distance:new B(t,e.u_camera_to_center_distance),u_pitch:new B(t,e.u_pitch),u_rotate_symbol:new tt(t,e.u_rotate_symbol),u_aspect_ratio:new B(t,e.u_aspect_ratio),u_fade_change:new B(t,e.u_fade_change),u_label_plane_matrix:new Se(t,e.u_label_plane_matrix),u_coord_matrix:new Se(t,e.u_coord_matrix),u_is_text:new tt(t,e.u_is_text),u_pitch_with_map:new tt(t,e.u_pitch_with_map),u_is_along_line:new tt(t,e.u_is_along_line),u_is_variable_anchor:new tt(t,e.u_is_variable_anchor),u_texsize:new et(t,e.u_texsize),u_texture:new tt(t,e.u_texture),u_translation:new et(t,e.u_translation),u_pitched_scale:new B(t,e.u_pitched_scale)}),symbolSDF:(t,e)=>({u_is_size_zoom_constant:new tt(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new tt(t,e.u_is_size_feature_constant),u_size_t:new B(t,e.u_size_t),u_size:new B(t,e.u_size),u_camera_to_center_distance:new B(t,e.u_camera_to_center_distance),u_pitch:new B(t,e.u_pitch),u_rotate_symbol:new tt(t,e.u_rotate_symbol),u_aspect_ratio:new B(t,e.u_aspect_ratio),u_fade_change:new B(t,e.u_fade_change),u_label_plane_matrix:new Se(t,e.u_label_plane_matrix),u_coord_matrix:new Se(t,e.u_coord_matrix),u_is_text:new tt(t,e.u_is_text),u_pitch_with_map:new tt(t,e.u_pitch_with_map),u_is_along_line:new tt(t,e.u_is_along_line),u_is_variable_anchor:new tt(t,e.u_is_variable_anchor),u_texsize:new et(t,e.u_texsize),u_texture:new tt(t,e.u_texture),u_gamma_scale:new B(t,e.u_gamma_scale),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_is_halo:new tt(t,e.u_is_halo),u_is_plain:new tt(t,e.u_is_plain),u_translation:new et(t,e.u_translation),u_pitched_scale:new B(t,e.u_pitched_scale)}),symbolTextAndIcon:(t,e)=>({u_is_size_zoom_constant:new tt(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new tt(t,e.u_is_size_feature_constant),u_size_t:new B(t,e.u_size_t),u_size:new B(t,e.u_size),u_camera_to_center_distance:new B(t,e.u_camera_to_center_distance),u_pitch:new B(t,e.u_pitch),u_rotate_symbol:new tt(t,e.u_rotate_symbol),u_aspect_ratio:new B(t,e.u_aspect_ratio),u_fade_change:new B(t,e.u_fade_change),u_label_plane_matrix:new Se(t,e.u_label_plane_matrix),u_coord_matrix:new Se(t,e.u_coord_matrix),u_is_text:new tt(t,e.u_is_text),u_pitch_with_map:new tt(t,e.u_pitch_with_map),u_is_along_line:new tt(t,e.u_is_along_line),u_is_variable_anchor:new tt(t,e.u_is_variable_anchor),u_texsize:new et(t,e.u_texsize),u_texsize_icon:new et(t,e.u_texsize_icon),u_texture:new tt(t,e.u_texture),u_texture_icon:new tt(t,e.u_texture_icon),u_gamma_scale:new B(t,e.u_gamma_scale),u_device_pixel_ratio:new B(t,e.u_device_pixel_ratio),u_is_halo:new tt(t,e.u_is_halo),u_translation:new et(t,e.u_translation),u_pitched_scale:new B(t,e.u_pitched_scale)}),background:(t,e)=>({u_opacity:new B(t,e.u_opacity),u_color:new Pi(t,e.u_color)}),backgroundPattern:(t,e)=>({u_opacity:new B(t,e.u_opacity),u_image:new tt(t,e.u_image),u_pattern_tl_a:new et(t,e.u_pattern_tl_a),u_pattern_br_a:new et(t,e.u_pattern_br_a),u_pattern_tl_b:new et(t,e.u_pattern_tl_b),u_pattern_br_b:new et(t,e.u_pattern_br_b),u_texsize:new et(t,e.u_texsize),u_mix:new B(t,e.u_mix),u_pattern_size_a:new et(t,e.u_pattern_size_a),u_pattern_size_b:new et(t,e.u_pattern_size_b),u_scale_a:new B(t,e.u_scale_a),u_scale_b:new B(t,e.u_scale_b),u_pixel_coord_upper:new et(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new et(t,e.u_pixel_coord_lower),u_tile_units_to_pixels:new B(t,e.u_tile_units_to_pixels)}),terrain:(t,e)=>({u_texture:new tt(t,e.u_texture),u_ele_delta:new B(t,e.u_ele_delta),u_fog_matrix:new Se(t,e.u_fog_matrix),u_fog_color:new Pi(t,e.u_fog_color),u_fog_ground_blend:new B(t,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new B(t,e.u_fog_ground_blend_opacity),u_horizon_color:new Pi(t,e.u_horizon_color),u_horizon_fog_blend:new B(t,e.u_horizon_fog_blend),u_is_globe_mode:new B(t,e.u_is_globe_mode)}),terrainDepth:(t,e)=>({u_ele_delta:new B(t,e.u_ele_delta)}),terrainCoords:(t,e)=>({u_texture:new tt(t,e.u_texture),u_terrain_coords_id:new B(t,e.u_terrain_coords_id),u_ele_delta:new B(t,e.u_ele_delta)}),projectionErrorMeasurement:(t,e)=>({u_input:new B(t,e.u_input),u_output_expected:new B(t,e.u_output_expected)}),atmosphere:(t,e)=>({u_sun_pos:new Te(t,e.u_sun_pos),u_atmosphere_blend:new B(t,e.u_atmosphere_blend),u_globe_position:new Te(t,e.u_globe_position),u_globe_radius:new B(t,e.u_globe_radius),u_inv_proj_matrix:new Se(t,e.u_inv_proj_matrix)}),sky:(t,e)=>({u_sky_color:new Pi(t,e.u_sky_color),u_horizon_color:new Pi(t,e.u_horizon_color),u_horizon:new et(t,e.u_horizon),u_horizon_normal:new et(t,e.u_horizon_normal),u_sky_horizon_blend:new B(t,e.u_sky_horizon_blend),u_sky_blend:new B(t,e.u_sky_blend)})};class Ag{constructor(t,e,i){this.context=t;let r=t.gl;this.buffer=r.createBuffer(),this.dynamicDraw=Boolean(i),this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||e.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let e=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}let rb={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class zg{constructor(t,e,i,r){this.length=e.length,this.attributes=i,this.itemSize=e.bytesPerElement,this.dynamicDraw=r,this.context=t;let n=t.gl;this.buffer=n.createBuffer(),t.bindVertexBuffer.set(this.buffer),n.bufferData(n.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||e.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let i of this.attributes){let r=e.attributes[i.name];r!==void 0&&t.enableVertexAttribArray(r)}}setVertexAttribPointers(t,e,i){for(let r of this.attributes){let n=e.attributes[r.name];n!==void 0&&t.vertexAttribPointer(n,r.components,t[rb[r.type]],!1,this.itemSize,r.offset+this.itemSize*(i||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class vt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Dg extends vt{getDefault(){return Y.transparent}set(t){let e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Rg extends vt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class kg extends vt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Lg extends vt{getDefault(){return[!0,!0,!0,!0]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Fg extends vt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class Bg extends vt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Og extends vt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let e=this.current;(t.func!==e.func||t.ref!==e.ref||t.mask!==e.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class jg extends vt{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Ng extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}}class Vg extends vt{getDefault(){return[0,1]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class Ug extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}}class $g extends vt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Zg extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}}class Gg extends vt{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class qg extends vt{getDefault(){return Y.transparent}set(t){let e=this.current;(t.r!==e.r||t.g!==e.g||t.b!==e.b||t.a!==e.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Wg extends vt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Hg extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}}class Xg extends vt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Yg extends vt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class Kg extends vt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Jg extends vt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Qg extends vt{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let e=this.current;(t[0]!==e[0]||t[1]!==e[1]||t[2]!==e[2]||t[3]!==e[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ty extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class ey extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class iy extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ry extends vt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ny extends vt{getDefault(){return null}set(t){let e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class oy extends vt{getDefault(){return null}set(t){var e;if(t===this.current&&!this.dirty)return;let i=this.gl;Mi(i)?i.bindVertexArray(t):(e=i.getExtension("OES_vertex_array_object"))===null||e===void 0||e.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class sy extends vt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ay extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class ly extends vt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class nl extends vt{constructor(t,e){super(t),this.context=t,this.parent=e}getDefault(){return null}}class cy extends nl{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class hy extends nl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class uy extends nl{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}}let dy="Framebuffer is not complete";class py{constructor(t,e,i,r,n){this.context=t,this.width=e,this.height=i;let o=t.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new cy(t,s),r)this.depthAttachment=n?new uy(t,s):new hy(t,s);else if(n)throw Error("Stencil cannot be set without depth");if(o.checkFramebufferStatus(o.FRAMEBUFFER)!==o.FRAMEBUFFER_COMPLETE)throw Error(dy)}destroy(){let t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){let i=this.depthAttachment.get();i&&t.deleteRenderbuffer(i)}t.deleteFramebuffer(this.framebuffer)}}class fy{constructor(t){var e,i;if(this.gl=t,this.clearColor=new Dg(this),this.clearDepth=new Rg(this),this.clearStencil=new kg(this),this.colorMask=new Lg(this),this.depthMask=new Fg(this),this.stencilMask=new Bg(this),this.stencilFunc=new Og(this),this.stencilOp=new jg(this),this.stencilTest=new Ng(this),this.depthRange=new Vg(this),this.depthTest=new Ug(this),this.depthFunc=new $g(this),this.blend=new Zg(this),this.blendFunc=new Gg(this),this.blendColor=new qg(this),this.blendEquation=new Wg(this),this.cullFace=new Hg(this),this.cullFaceSide=new Xg(this),this.frontFace=new Yg(this),this.program=new Kg(this),this.activeTexture=new Jg(this),this.viewport=new Qg(this),this.bindFramebuffer=new ty(this),this.bindRenderbuffer=new ey(this),this.bindTexture=new iy(this),this.bindVertexBuffer=new ry(this),this.bindElementBuffer=new ny(this),this.bindVertexArray=new oy(this),this.pixelStoreUnpack=new sy(this),this.pixelStoreUnpackPremultiplyAlpha=new ay(this),this.pixelStoreUnpackFlipY=new ly(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),Mi(t)){this.HALF_FLOAT=t.HALF_FLOAT;let r=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(e=t.RGBA16F)!==null&&e!==void 0?e:r==null?void 0:r.RGBA16F_EXT,this.RGB16F=(i=t.RGB16F)!==null&&i!==void 0?i:r==null?void 0:r.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");let r=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=r==null?void 0:r.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new Ag(this,t,e)}createVertexBuffer(t,e,i){return new zg(this,t,e,i)}createRenderbuffer(t,e,i){let r=this.gl,n=r.createRenderbuffer();return this.bindRenderbuffer.set(n),r.renderbufferStorage(r.RENDERBUFFER,t,e,i),this.bindRenderbuffer.set(null),n}createFramebuffer(t,e,i,r){return new py(this,t,e,i,r)}clear({color:t,depth:e,stencil:i}){let r=this.gl,n=0;t&&(n|=r.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),e!==void 0&&(n|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),i!==void 0&&(n|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(n)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){li(t.blendFunction,zt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return Mi(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;Mi(this.gl)?this.gl.deleteVertexArray(t):(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0||e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let ol;function my(t,e,i,r,n){var o,s;let{context:a,transform:c}=t,l=a.gl,u=t.useProgram("collisionBox"),h=[],p=0,d=0;for(let g of r){let x=e.getTile(g).getBucket(i);if(!x)continue;let b=n?x.textCollisionBox:x.iconCollisionBox,w=x.collisionCircleArray;w.length>0&&(h.push({circleArray:w,circleOffset:d,coord:g}),p+=w.length/4,d=p),b&&u.draw(a,l.LINES,st.disabled,gt.disabled,t.colorModeForRenderPass(),mt.disabled,V1(t.transform),(o=t.style.map.terrain)===null||o===void 0?void 0:o.getTerrainData(g),c.getProjectionData({overscaledTileID:g,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,null,t.transform.zoom,null,null,b.collisionVertexBuffer)}if(!n||!h.length)return;let f=t.useProgram("collisionCircle"),m=new hf;m.resize(4*p),m._trim();let _=0;for(let g of h)for(let x=0;x<g.circleArray.length/4;x++){let b=4*x,w=g.circleArray[b+0],T=g.circleArray[b+1],P=g.circleArray[b+2],S=g.circleArray[b+3];m.emplace(_++,w,T,P,S,0),m.emplace(_++,w,T,P,S,1),m.emplace(_++,w,T,P,S,2),m.emplace(_++,w,T,P,S,3)}(!ol||ol.length<2*p)&&(ol=function(g){let x=2*g,b=new df;b.resize(x),b._trim();for(let w=0;w<x;w++){let T=6*w;b.uint16[T+0]=4*w+0,b.uint16[T+1]=4*w+1,b.uint16[T+2]=4*w+2,b.uint16[T+3]=4*w+2,b.uint16[T+4]=4*w+3,b.uint16[T+5]=4*w+0}return b}(p));let y=a.createIndexBuffer(ol,!0),v=a.createVertexBuffer(m,vx.members,!0);for(let g of h){let x=U1(t.transform);f.draw(a,l.TRIANGLES,st.disabled,gt.disabled,t.colorModeForRenderPass(),mt.disabled,x,(s=t.style.map.terrain)===null||s===void 0?void 0:s.getTerrainData(g.coord),null,i.id,v,y,xt.simpleSegment(0,2*g.circleOffset,g.circleArray.length,g.circleArray.length/2),null,t.transform.zoom,null,null,null)}v.destroy(),y.destroy()}let nb=He(new Float32Array(16));function ob(t,e,i,r,n,o){let{horizontalAlign:s,verticalAlign:a}=Sm(t);return new z((-(s-0.5)*e/n+r[0])*o,(-(a-0.5)*i/n+r[1])*o)}function sb(t,e,i,r,n,o){let s=e.tileAnchorPoint.add(new z(e.translation[0],e.translation[1]));if(e.pitchWithMap){let a=r.mult(o);i||(a=a.rotate(-n));let c=s.add(a);return du(c.x,c.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){let a=yr(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(t),c=Math.atan(a.y/a.x)+(a.x<0?Math.PI:0);return t.add(r.rotate(c))}return t.add(r)}function ab(t,e,i,r,n,o,s,a,c,l,u,h){let p=t.text.placedSymbolArray,d=t.text.dynamicLayoutVertexArray,f=t.icon.dynamicLayoutVertexArray,m={};d.clear();for(let _=0;_<p.length;_++){let y=p.get(_),v=y.hidden||!y.crossTileID||t.allowVerticalPlacement&&!y.placedOrientation?null:r[y.crossTileID];if(v){let g=new z(y.anchorX,y.anchorY),x={getElevation:h,width:n.width,height:n.height,pitchedLabelPlaneMatrix:o,pitchWithMap:i,transform:n,tileAnchorPoint:g,translation:l,unwrappedTileID:u},b=i?$_(g.x,g.y,x):yr(g.x,g.y,x),w=O_(n.cameraToCenterDistance,b.signedDistanceFromCamera),T=dh(t.textSizeData,a,y)*w/24;i&&(T*=t.tilePixelRatio/s);let{width:P,height:S,anchor:E,textOffset:I,textBoxScale:C}=v,A=ob(E,P,S,I,C,T),M=n.getPitchedTextCorrection(g.x+l[0],g.y+l[1],u),k=sb(b.point,x,e,A,-n.bearingInRadians,M),L=t.allowVerticalPlacement&&y.placedOrientation===$t.vertical?Math.PI/2:0;for(let O=0;O<y.numGlyphs;O++)So(d,k,L);c&&y.associatedIconIndex>=0&&(m[y.associatedIconIndex]={shiftedAnchor:k,angle:L})}else mn(y.numGlyphs,d)}if(c){f.clear();let _=t.icon.placedSymbolArray;for(let y=0;y<_.length;y++){let v=_.get(y);if(v.hidden)mn(v.numGlyphs,f);else{let g=m[y];if(g)for(let x=0;x<v.numGlyphs;x++)So(f,g.shiftedAnchor,g.angle);else mn(v.numGlyphs,f)}}t.icon.dynamicLayoutVertexBuffer.updateData(f)}t.text.dynamicLayoutVertexBuffer.updateData(d)}function lb(t,e,i){return i.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function _y(t,e,i,r,n,o,s,a,c,l,u,h,p){var d,f;let m=t.context,_=m.gl,y=t.transform,v=a==="map",g=c==="map",x=a!=="viewport"&&i.layout.get("symbol-placement")!=="point",b=v&&!g&&!x,w=!i.layout.get("symbol-sort-key").isConstant(),T=!1,P=t.getDepthModeForSublayer(0,st.ReadOnly),S=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],I=y.getCircleRadiusCorrection();for(let M of r){let k=e.getTile(M),L=k.getBucket(i);if(!L)continue;let O=n?L.text:L.icon;if(!(O==null?void 0:O.segments.get().length)||!O.hasVisibleVertices)continue;let q=O.programConfigurations.get(i.id),Q=n||L.sdfIcons,rt=n?L.textSizeData:L.iconSizeData,nt=g||y.pitch!==0,lt=t.useProgram(lb(Q,n,L),q),pt=Sa(rt,y.zoom),Pt=(d=t.style.map.terrain)===null||d===void 0?void 0:d.getTerrainData(M),yt,Dt,H,ft,Sn=[0,0],qo=null;if(n)Dt=k.glyphAtlasTexture,H=_.LINEAR,yt=k.glyphAtlasTexture.size,L.iconsInText&&(Sn=k.imageAtlasTexture.size,qo=k.imageAtlasTexture,ft=nt||t.options.rotating||t.options.zooming||rt.kind==="composite"||rt.kind==="camera"?_.LINEAR:_.NEAREST);else{let Hi=i.layout.get("icon-size").constantOr(0)!==1||L.iconsNeedLinear;Dt=k.imageAtlasTexture,H=Q||t.options.rotating||t.options.zooming||Hi||nt?_.LINEAR:_.NEAREST,yt=k.imageAtlasTexture.size}let br=Me(k,1,t.transform.zoom),Pn=hu(v,t.transform,br),In=v1(g,v,t.transform,br),En=zi(y,k,o,s),vi=y.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),Wi=S&&L.hasTextData(),Mn=i.layout.get("icon-text-fit")!=="none"&&Wi&&L.hasIconData();if(x){let Hi=Ci();g1(Hi,Pn);let Cn=t.style.map.terrain?(ed,id)=>t.style.map.terrain.getElevation(M,ed,id):null,td=i.layout.get("text-rotation-alignment")==="map";b1(L,t,n,Pn,Hi,g,l,td,M.toUnwrapped(),y.width,y.height,En,Cn)}let wr=n&&S||Mn,le=x||wr?nb:g?Pn:t.transform.clipSpaceToPixelsMatrix,fe=Q&&i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Fe;Fe=Q?L.iconsInText?Q1(rt.kind,pt,b,g,x,wr,t,le,In,En,yt,Sn,I):Mg(rt.kind,pt,b,g,x,wr,t,le,In,En,n,yt,fe,I):Eg(rt.kind,pt,b,g,x,wr,t,le,In,En,n,yt,I);let Jt={program:lt,buffers:O,uniformValues:Fe,projectionData:vi,atlasTexture:Dt,atlasTextureIcon:qo,atlasInterpolation:H,atlasInterpolationIcon:ft,isSDF:Q,hasHalo:fe};if(w&&L.canOverlap){T=!0;let Hi=O.segments.get();for(let Cn of Hi)E.push({segments:new xt([Cn]),sortKey:Cn.sortKey,state:Jt,terrainData:Pt})}else E.push({segments:O.segments,sortKey:0,state:Jt,terrainData:Pt})}T&&E.sort((M,k)=>M.sortKey-k.sortKey);let C=(f=i.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(null))!==null&&f!==void 0?f:1/0,A=24*i.layout.get("text-letter-spacing").constantOr(0)<0||C>1;for(let M of E){let k=M.state;m.activeTexture.set(_.TEXTURE0),k.atlasTexture.bind(k.atlasInterpolation,_.CLAMP_TO_EDGE),k.atlasTextureIcon&&(m.activeTexture.set(_.TEXTURE1),k.atlasTextureIcon&&k.atlasTextureIcon.bind(k.atlasInterpolationIcon,_.CLAMP_TO_EDGE));let L=k.isSDF&&k.hasHalo;if(L){let O=k.uniformValues;O.u_is_halo=1,A&&(O.u_is_plain=0,gy(k.buffers,M.segments,i,t,k.program,P,u,h,O,k.projectionData,M.terrainData),O.u_is_halo=0,O.u_is_plain=1)}gy(k.buffers,M.segments,i,t,k.program,P,u,h,k.uniformValues,k.projectionData,M.terrainData),L&&!A&&(k.uniformValues.u_is_halo=0)}}function gy(t,e,i,r,n,o,s,a,c,l,u){let h=r.context;n.draw(h,h.gl.TRIANGLES,o,s,a,mt.backCCW,c,u,l,i.id,t.layoutVertexBuffer,t.indexBuffer,e,i.paint,r.transform.zoom,t.programConfigurations.get(i.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}function cb(t,e,i,r,n){let o=t.context,s=o.gl,a=gt.disabled,c=new zt([s.ONE,s.ONE],Y.transparent,[!0,!0,!0,!0]),l=e.getBucket(i);if(!l)return;let u=r.key,h=i.heatmapFbos.get(u);h||(h=yy(o,e.tileSize,e.tileSize),i.heatmapFbos.set(u,h)),o.bindFramebuffer.set(h.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:Y.transparent});let p=l.programConfigurations.get(i.id),d=t.useProgram("heatmap",p,!n),f=t.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=t.style.map.terrain.getTerrainData(r);d.draw(o,s.TRIANGLES,st.disabled,a,c,mt.disabled,Sg(e,t.transform.zoom,i.paint.get("heatmap-intensity"),1),m,f,i.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,i.paint,t.transform.zoom,p)}function hb(t,e,i,r,n){let o=t.context,s=o.gl,a=t.transform;o.setColorMode(t.colorModeForRenderPass());let c=vy(o,e),l=i.key,u=e.heatmapFbos.get(l);if(!u)return;o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u.colorAttachment.get()),o.activeTexture.set(s.TEXTURE1),c.bind(s.LINEAR,s.CLAMP_TO_EDGE);let h=a.getProjectionData({overscaledTileID:i,applyTerrainMatrix:n,applyGlobeMatrix:!r});t.useProgram("heatmapTexture").draw(o,s.TRIANGLES,st.disabled,gt.disabled,t.colorModeForRenderPass(),mt.disabled,Pg(t,e,0,1),null,h,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,a.zoom),u.destroy(),e.heatmapFbos.delete(l)}function yy(t,e,i){var r,n;let o=t.gl,s=o.createTexture();o.bindTexture(o.TEXTURE_2D,s),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,o.LINEAR);let a=(r=t.HALF_FLOAT)!==null&&r!==void 0?r:o.UNSIGNED_BYTE,c=(n=t.RGBA16F)!==null&&n!==void 0?n:o.RGBA;o.texImage2D(o.TEXTURE_2D,0,c,e,i,0,o.RGBA,a,null);let l=t.createFramebuffer(e,i,!1,!1);return l.colorAttachment.set(s),l}function vy(t,e){return e.colorRampTexture||(e.colorRampTexture=new jt(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}function xy(t,e,i,r,n,o,s,a){let c=256;if(n.stepInterpolant){let u=e.getSource().maxzoom,h=s.canonical.z===u?Math.ceil(1<<t.transform.maxZoom-s.canonical.z):1;c=_t((l=o.maxLineLength/F*1024*h)<=1?1:Math.pow(2,Math.ceil(Math.log(l)/Math.LN2)),256,i.maxTextureSize)}var l;return a.gradient=kf({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:c,image:a.gradient||void 0,clips:o.lineClipsArray}),a.texture?a.texture.update(a.gradient):a.texture=new jt(i,a.gradient,r.RGBA),a.version=n.gradientVersion,a.texture}function ub(t,e,i,r,n){t.activeTexture.set(e.TEXTURE0),i.imageAtlasTexture.bind(e.LINEAR,e.CLAMP_TO_EDGE),r.updatePaintBuffers(n)}function db(t,e,i,r,n,o){(n||t.lineAtlas.dirty)&&(e.activeTexture.set(i.TEXTURE0),t.lineAtlas.bind(e)),r.updatePaintBuffers(o)}function pb(t,e,i,r,n,o,s){let a=o.gradients[n.id],c=a.texture;n.gradientVersion!==a.version&&(c=xy(t,e,i,r,n,o,s,a)),i.activeTexture.set(r.TEXTURE0),c.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE)}function fb(t,e,i,r,n,o,s,a,c){let l=o.gradients[n.id],u=l.texture;n.gradientVersion!==l.version&&(u=xy(t,e,i,r,n,o,s,l)),i.activeTexture.set(r.TEXTURE0),u.bind(n.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),t.lineAtlas.bind(i),a.updatePaintBuffers(c)}function by(t,e,i,r,n){if(!i||!(r==null?void 0:r.imageAtlas))return;let o=r.imageAtlas.patternPositions,s=o[i.to.toString()],a=o[i.from.toString()];if(!s&&a&&(s=a),!a&&s&&(a=s),!s||!a){let c=n.getPaintProperty(e);s=o[c],a=o[c]}s&&a&&t.setConstantPatternPositions(s,a)}function wy(t,e,i,r,n,o,s,a){var c;let l=t.context.gl,u="fill-pattern",h=i.paint.get("fill-pattern"),p=h==null?void 0:h.constantOr(1),d=i.getCrossfadeParameters(),f,m,_,y,v,g=t.transform,x=i.paint.get("fill-translate"),b=i.paint.get("fill-translate-anchor");s?(m=p&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=l.LINES):(m=p?"fillPattern":"fill",f=l.TRIANGLES);let w=h.constantOr(null);for(let T of r){let P=e.getTile(T);if(p&&!P.patternsLoaded())continue;let S=P.getBucket(i);if(!S)continue;let E=S.programConfigurations.get(i.id),I=t.useProgram(m,E),C=(c=t.style.map.terrain)===null||c===void 0?void 0:c.getTerrainData(T);p&&(t.context.activeTexture.set(l.TEXTURE0),P.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),E.updatePaintBuffers(d)),by(E,"fill-pattern",w,P,i);let A=g.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!a,applyTerrainMatrix:!0}),M=zi(g,P,x,b);if(s){y=S.indexBuffer2,v=S.segments2;let L=[l.drawingBufferWidth,l.drawingBufferHeight];_=m==="fillOutlinePattern"&&p?j1(t,d,P,L,M):O1(L,M)}else y=S.indexBuffer,v=S.segments,_=p?wg(t,d,P,M):B1(M);let k=t.stencilModeForClipping(T);I.draw(t.context,f,n,k,o,mt.backCCW,_,C,A,i.id,S.layoutVertexBuffer,y,v,i.paint,t.transform.zoom,E)}}function Au(t,e,i,r,n,o,s,a){var c;let l=t.context,u=l.gl,h="fill-extrusion-pattern",p=i.paint.get("fill-extrusion-pattern"),d=p.constantOr(1),f=i.getCrossfadeParameters(),m=i.paint.get("fill-extrusion-opacity"),_=p.constantOr(null),y=t.transform;for(let v of r){let g=e.getTile(v),x=g.getBucket(i);if(!x)continue;let b=(c=t.style.map.terrain)===null||c===void 0?void 0:c.getTerrainData(v),w=x.programConfigurations.get(i.id),T=t.useProgram(d?"fillExtrusionPattern":"fillExtrusion",w);d&&(t.context.activeTexture.set(u.TEXTURE0),g.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),w.updatePaintBuffers(f));let P=y.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!a,applyTerrainMatrix:!0});by(w,"fill-extrusion-pattern",_,g,i);let S=zi(y,g,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),E=i.paint.get("fill-extrusion-vertical-gradient"),I=d?F1(t,E,m,S,v,f,g):bg(t,E,m,S);T.draw(l,l.gl.TRIANGLES,n,o,s,mt.backCCW,I,b,P,i.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,i.paint,t.transform.zoom,w,t.style.map.terrain&&x.centroidVertexBuffer)}}function zu(t,e,i,r,n,o,s,a,c){var l;let u=t.style.projection,{context:h,transform:p}=t,d=h.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],m=t.useProgram("hillshade",null,!1,f),_=!t.options.moving;for(let y of r){let v=e.getTile(y),g=v.fbo;if(!g)continue;let x=u.getMeshFromTileID(h,y.canonical,a,!0,"raster"),b=(l=t.style.map.terrain)===null||l===void 0?void 0:l.getTerrainData(y);h.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,g.colorAttachment.get());let w=p.getProjectionData({overscaledTileID:y,aligned:_,applyGlobeMatrix:!c,applyTerrainMatrix:!0});m.draw(h,d.TRIANGLES,o,n[y.overscaledZ],s,mt.backCCW,$1(t,v,i),b,w,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}let Du=0;function Ru(t,e,i,r,n,o,s,a,c){var l;let u=t.style.projection,{context:h,transform:p}=t,d=h.gl,f=t.useProgram("colorRelief"),m=!t.options.moving,_=i.paint.get("resampling")==="nearest"?d.NEAREST:d.LINEAR,y=!0,v=0;for(let g of r){let x=e.getTile(g),b=x.dem;if(y){Du||(Du=d.getParameter(d.MAX_TEXTURE_SIZE));let I=Du,{elevationTexture:C,colorTexture:A}=i.getColorRampTextures(h,I,b.getUnpackVector());h.activeTexture.set(d.TEXTURE1),C.bind(d.NEAREST,d.CLAMP_TO_EDGE),h.activeTexture.set(d.TEXTURE4),A.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=!1,v=C.size[0]}if(!(b==null?void 0:b.data))continue;let w=b.stride,T=b.getPixels();if(h.activeTexture.set(d.TEXTURE0),h.pixelStoreUnpackPremultiplyAlpha.set(!1),x.demTexture||(x.demTexture=t.getTileTexture(w)),x.demTexture){let I=x.demTexture;I.update(T,{premultiply:!1}),I.bind(_,d.CLAMP_TO_EDGE)}else x.demTexture=new jt(h,T,d.RGBA,{premultiply:!1}),x.demTexture.bind(_,d.CLAMP_TO_EDGE);let P=u.getMeshFromTileID(h,g.canonical,a,!0,"raster"),S=(l=t.style.map.terrain)===null||l===void 0?void 0:l.getTerrainData(g),E=p.getProjectionData({overscaledTileID:g,aligned:m,applyGlobeMatrix:!c,applyTerrainMatrix:!0});f.draw(h,d.TRIANGLES,o,n[g.overscaledZ],s,mt.backCCW,q1(i,x.dem,v),S,E,i.id,P.vertexBuffer,P.indexBuffer,P.segments)}}let ku=[new z(0,0),new z(F,0),new z(F,F),new z(0,F)];function sl(t,e,i,r,n,o,s,a,c=!1,l=!1){var u;let h=r[r.length-1].overscaledZ,p=t.context,d=p.gl,f=t.useProgram("raster"),m=t.transform,_=t.style.projection,y=t.colorModeForRenderPass(),v=!t.options.moving,g=i.paint.get("raster-opacity"),x=i.paint.get("resampling")==="nearest"||i.paint.get("raster-resampling")==="nearest"?d.NEAREST:d.LINEAR,b=i.paint.get("raster-fade-duration"),w=!!t.style.map.terrain;for(let T of r){let P=t.getDepthModeForSublayer(T.overscaledZ-h,g===1?st.ReadWrite:st.ReadOnly,d.LESS),S=e.getTile(T);p.activeTexture.set(d.TEXTURE0),S.texture.bind(x,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(d.TEXTURE1);let{parentTile:E,parentScaleBy:I,parentTopLeft:C,fadeValues:A}=mb(S,e,b,w);S.fadeOpacity=A.tileOpacity,E?(E.fadeOpacity=A.parentTileOpacity,E.texture.bind(x,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST)):S.texture.bind(x,d.CLAMP_TO_EDGE,d.LINEAR_MIPMAP_NEAREST),S.texture.useMipmap&&p.extTextureFilterAnisotropic&&t.transform.pitch>t.options.anisotropicFilterPitch&&d.texParameterf(d.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let M=(u=t.style.map.terrain)===null||u===void 0?void 0:u.getTerrainData(T),k=m.getProjectionData({overscaledTileID:T,aligned:v,applyGlobeMatrix:!l,applyTerrainMatrix:!0}),L=K1(C,I,A.fadeMix,i,a),O=_.getMeshFromTileID(p,T.canonical,o,s,"raster");f.draw(p,d.TRIANGLES,P,n?n[T.overscaledZ]:gt.disabled,y,c?mt.frontCCW:mt.backCCW,L,M,k,i.id,O.vertexBuffer,O.indexBuffer,O.segments)}}function mb(t,e,i,r){let n={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(i===0||r)return n;if(t.fadingParentID){let o=e.getLoadedTile(t.fadingParentID);if(!o)return n;let s=Math.pow(2,o.tileID.overscaledZ-t.tileID.overscaledZ),a=[t.tileID.canonical.x*s%1,t.tileID.canonical.y*s%1],c=function(l,u,h){let p=St(),d=(p-u.timeAdded)/h,f=l.fadingDirection===_i.Incoming,m=_t((p-l.timeAdded)/h,0,1),_=_t(1-d,0,1),y=f?m:_;return{tileOpacity:y,parentTileOpacity:f?_:m,fadeMix:{opacity:1,mix:1-y}}}(t,o,i);return{parentTile:o,parentScaleBy:s,parentTopLeft:a,fadeValues:c}}if(t.selfFading){let o=function(s,a){let c=_t((St()-s.timeAdded)/a,0,1);return{tileOpacity:c,fadeMix:{opacity:c,mix:0}}}(t,i);return{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:o}}return n}let _b=new Y(1,0,0,1),gb=new Y(0,1,0,1),yb=new Y(0,0,1,1),vb=new Y(1,0,1,1),xb=new Y(0,1,1,1);function Ty(t,e,i,r){al(t,0,e+i/2,t.transform.width,i,r)}function Sy(t,e,i,r){al(t,e-i/2,0,i,t.transform.height,r)}function al(t,e,i,r,n,o){let s=t.context,a=s.gl;a.enable(a.SCISSOR_TEST),a.scissor(e*t.pixelRatio,i*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio),s.clear({color:o}),a.disable(a.SCISSOR_TEST)}function bb(t,e,i){var r;let n=t.context,o=n.gl,s=t.useProgram("debug"),a=st.disabled,c=gt.disabled,l=t.colorModeForRenderPass(),u="$debug",h=(r=t.style.map.terrain)===null||r===void 0?void 0:r.getTerrainData(i);n.activeTexture.set(o.TEXTURE0);let p=e.getTileByID(i.key).latestRawTileData,d=Math.floor(((p==null?void 0:p.byteLength)||0)/1024),f=e.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/t.transform.zoom)*0.5,_=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(_+=` => ${i.overscaledZ}`),function(v,g){v.initDebugOverlayCanvas();let x=v.debugOverlayCanvas,b=v.context.gl,w=v.debugOverlayCanvas.getContext("2d");w.clearRect(0,0,x.width,x.height),w.shadowColor="white",w.shadowBlur=2,w.lineWidth=1.5,w.strokeStyle="white",w.textBaseline="top",w.font="bold 36px Open Sans, sans-serif",w.fillText(g,5,5),w.strokeText(g,5,5),v.debugOverlayTexture.update(x),v.debugOverlayTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE)}(t,`${_} ${d}kB`);let y=t.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});s.draw(n,o.TRIANGLES,a,c,zt.alphaBlended,mt.disabled,Tg(Y.transparent,m),null,y,"$debug",t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),s.draw(n,o.LINE_STRIP,a,c,l,mt.disabled,Tg(Y.red),h,y,"$debug",t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function Py(t,e,i,r){let{isRenderingGlobe:n}=r,o=t.context,s=o.gl,a=t.transform,c=t.colorModeForRenderPass(),l=t.getDepthModeFor3D(),u=t.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);for(let h of i){let p=e.getTerrainMesh(h.tileID),d=t.renderToTexture.getTexture(h),f=e.getTerrainData(h.tileID);o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,d.texture);let m=e.getMeshFrameDelta(a.zoom),_=a.calculateFogMatrix(h.tileID.toUnwrapped()),y=k1(m,_,t.style.sky,a.pitch,n),v=a.getProjectionData({overscaledTileID:h.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(o,s.TRIANGLES,l,gt.disabled,c,mt.backCCW,y,f,v,"terrain",p.vertexBuffer,p.indexBuffer,p.segments)}}function Iy(t,e){if(!e.mesh){let i=new ui;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);let r=new Ge;r.emplaceBack(0,1,2),r.emplaceBack(0,2,3),e.mesh=new vr(t.createVertexBuffer(i,Gi.members),t.createIndexBuffer(r),xt.simpleSegment(0,0,i.length,r.length))}return e.mesh}let wb={symbol:function(t,e,i,r,n,o){if(t.renderPass!=="translucent")return;let{isRenderingToTexture:s}=o,a=gt.disabled,c=t.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(l,u,h,p,d,f,m,_,y){var v;let g=u.transform,x=u.style.map.terrain,b=d==="map",w=f==="map";for(let T of l){let P=p.getTile(T),S=P.getBucket(h);if(!((v=S==null?void 0:S.text)===null||v===void 0?void 0:v.segments.get().length))continue;let E=Sa(S.textSizeData,g.zoom),I=Me(P,1,u.transform.zoom),C=hu(b,u.transform,I),A=h.layout.get("icon-text-fit")!=="none"&&S.hasIconData();if(E){let M=Math.pow(2,g.zoom-P.tileID.overscaledZ),k=x?(L,O)=>x.getElevation(T,L,O):null;ab(S,b,w,y,g,C,M,E,A,zi(g,P,m,_),T.toUnwrapped(),k)}}}(r,t,i,e,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),n),i.paint.get("icon-opacity").constantOr(1)!==0&&_y(t,e,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),a,c,s),i.paint.get("text-opacity").constantOr(1)!==0&&_y(t,e,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),a,c,s),e.map.showCollisionBoxes&&(my(t,e,i,r,!0),my(t,e,i,r,!1))},circle:function(t,e,i,r,n){var o;if(t.renderPass!=="translucent")return;let{isRenderingToTexture:s}=n,a=i.paint.get("circle-opacity"),c=i.paint.get("circle-stroke-width"),l=i.paint.get("circle-stroke-opacity"),u=!i.layout.get("circle-sort-key").isConstant();if(a.constantOr(1)===0&&(c.constantOr(1)===0||l.constantOr(1)===0))return;let h=t.context,p=h.gl,d=t.transform,f=t.getDepthModeForSublayer(0,st.ReadOnly),m=gt.disabled,_=t.colorModeForRenderPass(),y=[],v=d.getCircleRadiusCorrection();for(let g of r){let x=e.getTile(g),b=x.getBucket(i);if(!b)continue;let w=zi(d,x,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),T=b.programConfigurations.get(i.id),P=t.useProgram("circle",T),{layoutVertexBuffer:S,indexBuffer:E}=b,I=(o=t.style.map.terrain)===null||o===void 0?void 0:o.getTerrainData(g),C={programConfiguration:T,program:P,layoutVertexBuffer:S,indexBuffer:E,uniformValues:N1(t,x,i,w,v),terrainData:I,projectionData:d.getProjectionData({overscaledTileID:g,applyGlobeMatrix:!s,applyTerrainMatrix:!0})};if(u){let A=b.segments.get();for(let M of A)y.push({segments:new xt([M]),sortKey:M.sortKey,state:C})}else y.push({segments:b.segments,sortKey:0,state:C})}u&&y.sort((g,x)=>g.sortKey-x.sortKey);for(let g of y){let{programConfiguration:x,program:b,layoutVertexBuffer:w,indexBuffer:T,uniformValues:P,terrainData:S,projectionData:E}=g.state;b.draw(h,p.TRIANGLES,f,m,_,mt.backCCW,P,S,E,i.id,w,T,g.segments,i.paint,t.transform.zoom,x)}},heatmap:function(t,e,i,r,n){if(i.paint.get("heatmap-opacity")===0)return;let o=t.context,{isRenderingToTexture:s,isRenderingGlobe:a}=n;if(t.style.map.terrain){for(let c of r){let l=e.getTile(c);e.hasRenderableParent(c)||(t.renderPass==="offscreen"?cb(t,l,i,c,a):t.renderPass==="translucent"&&hb(t,i,c,s,a))}o.viewport.set([0,0,t.width,t.height])}else t.renderPass==="offscreen"?function(c,l,u,h){let p=c.context,d=p.gl,f=c.transform,m=gt.disabled,_=new zt([d.ONE,d.ONE],Y.transparent,[!0,!0,!0,!0]);(function(y,v,g){let x=y.gl;y.activeTexture.set(x.TEXTURE1),y.viewport.set([0,0,v.width/4,v.height/4]);let b=g.heatmapFbos.get(mo);b?(x.bindTexture(x.TEXTURE_2D,b.colorAttachment.get()),y.bindFramebuffer.set(b.framebuffer)):(b=yy(y,v.width/4,v.height/4),g.heatmapFbos.set(mo,b))})(p,c,u),p.clear({color:Y.transparent});for(let y of h){if(l.hasRenderableParent(y))continue;let v=l.getTile(y),g=v.getBucket(u);if(!g)continue;let x=g.programConfigurations.get(u.id),b=c.useProgram("heatmap",x),w=f.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),T=f.getCircleRadiusCorrection();b.draw(p,d.TRIANGLES,st.disabled,m,_,mt.backCCW,Sg(v,f.zoom,u.paint.get("heatmap-intensity"),T),null,w,u.id,g.layoutVertexBuffer,g.indexBuffer,g.segments,u.paint,f.zoom,x)}p.viewport.set([0,0,c.width,c.height])}(t,e,i,r):t.renderPass==="translucent"&&function(c,l){let u=c.context,h=u.gl;u.setColorMode(c.colorModeForRenderPass());let p=l.heatmapFbos.get(mo);p&&(u.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,p.colorAttachment.get()),u.activeTexture.set(h.TEXTURE1),vy(u,l).bind(h.LINEAR,h.CLAMP_TO_EDGE),c.useProgram("heatmapTexture").draw(u,h.TRIANGLES,st.disabled,gt.disabled,c.colorModeForRenderPass(),mt.disabled,Pg(c,l,0,1),null,null,l.id,c.viewportBuffer,c.quadTriangleIndexBuffer,c.viewportSegments,l.paint,c.transform.zoom))}(t,i)},line:function(t,e,i,r,n){var o;if(t.renderPass!=="translucent")return;let{isRenderingToTexture:s}=n,a=i.paint.get("line-opacity"),c=i.paint.get("line-width");if(a.constantOr(1)===0||c.constantOr(1)===0)return;let l=t.getDepthModeForSublayer(0,st.ReadOnly),u=t.colorModeForRenderPass(),h=i.paint.get("line-dasharray"),p=h.constantOr(1),d=i.paint.get("line-pattern"),f=d.constantOr(1),m=i.paint.get("line-gradient"),_=i.getCrossfadeParameters(),y;y=f?"linePattern":p&&m?"lineGradientSDF":p?"lineSDF":m?"lineGradient":"line";let v=t.context,g=v.gl,x=t.transform,b=!0;for(let w of r){let T=e.getTile(w);if(f&&!T.patternsLoaded())continue;let P=T.getBucket(i);if(!P)continue;let S=P.programConfigurations.get(i.id),E=t.context.program.get(),I=t.useProgram(y,S),C=b||I.program!==E,A=(o=t.style.map.terrain)===null||o===void 0?void 0:o.getTerrainData(w),M=d.constantOr(null),k=h==null?void 0:h.constantOr(null);if(M&&T.imageAtlas){let rt=T.imageAtlas,nt=rt.patternPositions[M.to.toString()],lt=rt.patternPositions[M.from.toString()];nt&&lt&&S.setConstantPatternPositions(nt,lt)}else if(k){let rt=i.layout.get("line-cap").constantOr(null)==="round",nt=t.lineAtlas.getDash(k.to,rt),lt=t.lineAtlas.getDash(k.from,rt);S.setConstantDashPositions(nt,lt)}let L=x.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),O=x.getPixelScale(),q;f?(q=H1(t,T,i,O,_),ub(v,g,T,S,_)):p&&m?(q=Y1(t,T,i,O,_,P.lineClipsArray.length),fb(t,e,v,g,i,P,w,S,_)):p?(q=X1(t,T,i,O,_),db(t,v,g,S,C,_)):m?(q=W1(t,T,i,O,P.lineClipsArray.length),pb(t,e,v,g,i,P,w)):q=rl(t,T,i,O);let Q=t.stencilModeForClipping(w);I.draw(v,g.TRIANGLES,l,Q,u,mt.disabled,q,A,L,i.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,i.paint,t.transform.zoom,S,P.layoutVertexBuffer2),b=!1}},fill:function(t,e,i,r,n){let o=i.paint.get("fill-color"),s=i.paint.get("fill-opacity");if(s.constantOr(1)===0)return;let{isRenderingToTexture:a}=n,c=t.colorModeForRenderPass(),l=i.paint.get("fill-pattern"),u=t.opaquePassEnabledForLayer()&&!l.constantOr(1)&&o.constantOr(Y.transparent).a===1&&s.constantOr(0)===1?"opaque":"translucent";if(t.renderPass===u){let h=t.getDepthModeForSublayer(1,t.renderPass==="opaque"?st.ReadWrite:st.ReadOnly);wy(t,e,i,r,h,c,!1,a)}if(t.renderPass==="translucent"&&i.paint.get("fill-antialias")){let h=t.getDepthModeForSublayer(i.getPaintProperty("fill-outline-color")?2:0,st.ReadOnly);wy(t,e,i,r,h,c,!0,a)}},fillExtrusion:function(t,e,i,r,n){let o=i.paint.get("fill-extrusion-opacity");if(o===0)return;let{isRenderingToTexture:s}=n;if(t.renderPass==="translucent"){let a=new st(t.context.gl.LEQUAL,st.ReadWrite,t.depthRangeFor3D);if(o!==1||i.paint.get("fill-extrusion-pattern").constantOr(1))Au(t,e,i,r,a,gt.disabled,zt.disabled,s),Au(t,e,i,r,a,t.stencilModeFor3D(),t.colorModeForRenderPass(),s);else{let c=t.colorModeForRenderPass();Au(t,e,i,r,a,gt.disabled,c,s)}}},hillshade:function(t,e,i,r,n){if(t.renderPass!=="offscreen"&&t.renderPass!=="translucent")return;let{isRenderingToTexture:o}=n,s=t.context,a=t.style.projection.useSubdivision,c=t.getDepthModeForSublayer(0,st.ReadOnly),l=t.colorModeForRenderPass();if(t.renderPass==="offscreen")(function(u,h,p,d,f,m,_){let y=u.context,v=y.gl,g=d.paint.get("resampling")==="nearest"?v.NEAREST:v.LINEAR;for(let x of p){let b=h.getTile(x),w=b.dem;if(!(w==null?void 0:w.data))continue;if(!b.needsHillshadePrepare)continue;let{dim:T,stride:P}=w,S=w.getPixels();if(y.activeTexture.set(v.TEXTURE1),y.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture||(b.demTexture=u.getTileTexture(P)),b.demTexture){let I=b.demTexture;I.update(S,{premultiply:!1}),I.bind(v.NEAREST,v.CLAMP_TO_EDGE)}else b.demTexture=new jt(y,S,v.RGBA,{premultiply:!1}),b.demTexture.bind(v.NEAREST,v.CLAMP_TO_EDGE);y.activeTexture.set(v.TEXTURE0);let E=b.fbo;if(!E){let I=new jt(y,{width:T,height:T,data:null},v.RGBA);I.bind(g,v.CLAMP_TO_EDGE),E=b.fbo=y.createFramebuffer(T,T,!0,!1),E.colorAttachment.set(I.texture)}y.bindFramebuffer.set(E.framebuffer),y.viewport.set([0,0,T,T]),u.useProgram("hillshadePrepare").draw(y,v.TRIANGLES,f,m,_,mt.disabled,Z1(b.tileID,w),null,null,d.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments),b.needsHillshadePrepare=!1}})(t,e,r,i,c,gt.disabled,l),s.viewport.set([0,0,t.width,t.height]);else if(t.renderPass==="translucent")if(a){let[u,h,p]=t.stencilConfigForOverlapTwoPass(r);zu(t,e,i,p,u,c,l,!1,o),zu(t,e,i,p,h,c,l,!0,o)}else{let[u,h]=t.getStencilConfigForOverlapAndUpdateStencilID(r);zu(t,e,i,h,u,c,l,!1,o)}},colorRelief:function(t,e,i,r,n){if(t.renderPass!=="translucent")return;if(!r.length)return;let{isRenderingToTexture:o}=n,s=t.style.projection.useSubdivision,a=t.getDepthModeForSublayer(0,st.ReadOnly),c=t.colorModeForRenderPass();if(s){let[l,u,h]=t.stencilConfigForOverlapTwoPass(r);Ru(t,e,i,h,l,a,c,!1,o),Ru(t,e,i,h,u,a,c,!0,o)}else{let[l,u]=t.getStencilConfigForOverlapAndUpdateStencilID(r);Ru(t,e,i,u,l,a,c,!1,o)}},raster:function(t,e,i,r,n){if(t.renderPass!=="translucent")return;if(i.paint.get("raster-opacity")===0)return;if(!r.length)return;let{isRenderingToTexture:o}=n,s=e.getSource(),a=t.style.projection.useSubdivision;if(s instanceof pr)sl(t,e,i,r,null,!1,!1,s.tileCoords,s.flippedWindingOrder,o);else if(a){let[c,l,u]=t.stencilConfigForOverlapTwoPass(r);sl(t,e,i,u,c,!1,!0,ku,!1,o),sl(t,e,i,u,l,!0,!0,ku,!1,o)}else{let[c,l]=t.getStencilConfigForOverlapAndUpdateStencilID(r);sl(t,e,i,l,c,!1,!0,ku,!1,o)}},background:function(t,e,i,r,n){var o;let s=i.paint.get("background-color"),a=i.paint.get("background-opacity");if(a===0)return;let{isRenderingToTexture:c}=n,l=t.context,u=l.gl,h=t.style.projection,p=t.transform,d=p.tileSize,f=i.paint.get("background-pattern");if(t.isPatternMissing(f))return;let m=!f&&s.a===1&&a===1&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==m)return;let _=gt.disabled,y=t.getDepthModeForSublayer(0,m==="opaque"?st.ReadWrite:st.ReadOnly),v=t.colorModeForRenderPass(),g=t.useProgram(f?"backgroundPattern":"background"),x=r||fn(p,{tileSize:d,terrain:t.style.map.terrain});f&&(l.activeTexture.set(u.TEXTURE0),t.imageManager.bind(t.context));let b=i.getCrossfadeParameters();for(let w of x){let T=p.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!c,applyTerrainMatrix:!0}),P=f?eb(a,t,f,{tileID:w,tileSize:d},b):tb(a,s),S=(o=t.style.map.terrain)===null||o===void 0?void 0:o.getTerrainData(w),E=h.getMeshFromTileID(l,w.canonical,!1,!0,"raster");g.draw(l,u.TRIANGLES,y,_,v,mt.backCCW,P,S,T,i.id,E.vertexBuffer,E.indexBuffer,E.segments)}},sky:function(t,e){let i=t.context,r=i.gl,n=((u,h,p)=>{let d=Math.cos(h.rollInRadians),f=Math.sin(h.rollInRadians),m=Fo(h),_=h.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:u.properties.get("sky-color"),u_horizon_color:u.properties.get("horizon-color"),u_horizon:[(h.width/2-m*f)*p,(h.height/2+m*d)*p],u_horizon_normal:[-f,d],u_sky_horizon_blend:u.properties.get("sky-horizon-blend")*h.height/2*p,u_sky_blend:_}})(e,t.style.map.transform,t.pixelRatio),o=new st(r.LEQUAL,st.ReadWrite,[0,1]),s=gt.disabled,a=t.colorModeForRenderPass(),c=t.useProgram("sky"),l=Iy(i,e);c.draw(i,r.TRIANGLES,o,s,a,mt.disabled,n,null,void 0,"sky",l.vertexBuffer,l.indexBuffer,l.segments)},atmosphere:function(t,e,i){let r=t.context,n=r.gl,o=t.useProgram("atmosphere"),s=new st(n.LEQUAL,st.ReadOnly,[0,1]),a=t.transform,c=function(_,y){let v=_.properties.get("position"),g=[-v.x,-v.y,-v.z],x=He(new Float64Array(16));var b,w,T,P,S,E,I;return _.properties.get("anchor")==="map"&&(xi(x,x,y.rollInRadians),oi(x,x,-y.pitchInRadians),xi(x,x,y.bearingInRadians),oi(x,x,y.center.lat*Math.PI/180),Xo(x,x,-y.center.lng*Math.PI/180)),(b=g)[0]=((T=x)[0]*(P=(w=g)[0])+T[4]*(S=w[1])+T[8]*(E=w[2])+T[12])/(I=(I=T[3]*P+T[7]*S+T[11]*E+T[15])||1),b[1]=(T[1]*P+T[5]*S+T[9]*E+T[13])/I,b[2]=(T[2]*P+T[6]*S+T[10]*E+T[14])/I,g}(i,t.transform),l=a.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),u=e.properties.get("atmosphere-blend")*l.projectionTransition;if(u===0)return;let h=Xa(a.worldSize,a.center.lat),p=a.inverseProjectionMatrix,d=new Float64Array(4);d[3]=1,Yt(d,d,a.modelViewProjectionMatrix),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1,Yt(d,d,p),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1;let f=((_,y,v,g,x)=>({u_sun_pos:_,u_atmosphere_blend:y,u_globe_position:v,u_globe_radius:g,u_inv_proj_matrix:x}))(c,u,[d[0],d[1],d[2]],h,p),m=Iy(r,e);o.draw(r,n.TRIANGLES,s,gt.disabled,zt.alphaBlended,mt.disabled,f,null,null,"atmosphere",m.vertexBuffer,m.indexBuffer,m.segments)},custom:function(t,e,i,r){let{isRenderingGlobe:n}=r,o=t.context,s=i.implementation,a=t.style.projection,c=t.transform,l=c.getProjectionDataForCustomLayer(n),u={farZ:c.farZ,nearZ:c.nearZ,fov:c.fov*Math.PI/180,modelViewProjectionMatrix:c.modelViewProjectionMatrix,projectionMatrix:c.projectionMatrix,shaderData:{variantName:a.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
799
+ uniform mat4 u_projection_matrix;
800
+ ${a.shaderPreludeCode.vertexSource}`,define:a.shaderDefine},defaultProjectionData:l},h=s.renderingMode?s.renderingMode:"2d";if(t.renderPass==="offscreen"){let p=s.prerender;p&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),p.call(s,o.gl,u),o.setDirty(),t.setBaseState())}else if(t.renderPass==="translucent"){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(gt.disabled);let p=h==="3d"?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,st.ReadOnly);o.setDepthMode(p),s.render(o.gl,u),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}},debug:function(t,e,i){for(let r of i)bb(t,e,r)},debugPadding:function(t){let e=t.transform.padding;Ty(t,t.transform.height-(e.top||0),3,_b),Ty(t,e.bottom||0,3,gb),Sy(t,e.left||0,3,yb),Sy(t,t.transform.width-(e.right||0),3,vb);let i=t.transform.centerPoint;(function(r,n,o,s){al(r,n-1,o-10,2,20,s),al(r,n-10,o-1,20,2,s)})(t,i.x,t.transform.height-i.y,xb)},terrainDepth:function(t,e){let i=t.context,r=i.gl,n=t.transform,o=zt.unblended,s=new st(r.LEQUAL,st.ReadWrite,[0,1]),a=e.tileManager.getRenderableTiles(),c=t.useProgram("terrainDepth");i.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:Y.transparent,depth:1});for(let l of a){let u=e.getTerrainMesh(l.tileID),h=e.getTerrainData(l.tileID),p=n.getProjectionData({overscaledTileID:l.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d={u_ele_delta:e.getMeshFrameDelta(n.zoom)};c.draw(i,r.TRIANGLES,s,gt.disabled,o,mt.backCCW,d,h,p,"terrain",u.vertexBuffer,u.indexBuffer,u.segments)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])},terrainCoords:function(t,e){let i=t.context,r=i.gl,n=t.transform,o=zt.unblended,s=new st(r.LEQUAL,st.ReadWrite,[0,1]),a=e.getCoordsTexture(),c=e.tileManager.getRenderableTiles(),l=t.useProgram("terrainCoords");i.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),i.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),i.clear({color:Y.transparent,depth:1}),e.coordsIndex=[];for(let u of c){let h=e.getTerrainMesh(u.tileID),p=e.getTerrainData(u.tileID);i.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,a.texture);let d={u_terrain_coords_id:(255-e.coordsIndex.length)/255,u_texture:0,u_ele_delta:e.getMeshFrameDelta(n.zoom)},f=n.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});l.draw(i,r.TRIANGLES,s,gt.disabled,o,mt.backCCW,d,p,f,"terrain",h.vertexBuffer,h.indexBuffer,h.segments),e.coordsIndex.push(u.tileID.key)}i.bindFramebuffer.set(null),i.viewport.set([0,0,t.width,t.height])}};class ll{constructor(t,e){this.drawFunctions=wb,this.context=new fy(t),this.transform=e,this._tileTextures={},this.terrainFacilitator={depthDirty:!0,coordsDirty:!1,matrix:He(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Zi.maxOverzooming+Zi.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new vu}resize(t,e,i){if(this.width=Math.floor(t*i),this.height=Math.floor(e*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let r of this.style._order)this.style._layers[r].resize()}setup(){let t=this.context,e=new ui;e.emplaceBack(0,0),e.emplaceBack(F,0),e.emplaceBack(0,F),e.emplaceBack(F,F),this.tileExtentBuffer=t.createVertexBuffer(e,Gi.members),this.tileExtentSegments=xt.simpleSegment(0,0,4,2);let i=new ui;i.emplaceBack(0,0),i.emplaceBack(F,0),i.emplaceBack(0,F),i.emplaceBack(F,F),this.debugBuffer=t.createVertexBuffer(i,Gi.members),this.debugSegments=xt.simpleSegment(0,0,4,5);let r=new tf;r.emplaceBack(0,0,0,0),r.emplaceBack(F,0,F,0),r.emplaceBack(0,F,0,F),r.emplaceBack(F,F,F,F),this.rasterBoundsBuffer=t.createVertexBuffer(r,R1.members),this.rasterBoundsSegments=xt.simpleSegment(0,0,4,2);let n=new ui;n.emplaceBack(0,0),n.emplaceBack(F,0),n.emplaceBack(0,F),n.emplaceBack(F,F),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(n,Gi.members),this.rasterBoundsSegmentsPosOnly=xt.simpleSegment(0,0,4,5);let o=new ui;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,Gi.members),this.viewportSegments=xt.simpleSegment(0,0,4,2);let s=new pf;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);let a=new Ge;a.emplaceBack(1,0,2),a.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(a);let c=this.context.gl;this.stencilClearMode=new gt({func:c.ALWAYS,mask:0},0,255,c.ZERO,c.ZERO,c.ZERO),this.tileExtentMesh=new vr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,e=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Ci();si(i,0,this.width,this.height,0,0,1),Wt(i,i,[e.drawingBufferWidth,e.drawingBufferHeight,0]);let r={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i};this.useProgram("clippingMask",null,!0).draw(t,e.TRIANGLES,st.disabled,this.stencilClearMode,zt.disabled,mt.disabled,null,null,r,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!(e==null?void 0:e.length))return;this.currentStencilSource=t.source,this.nextStencilID+e.length>256&&this.clearStencil();let r=this.context;r.setColorMode(zt.disabled),r.setDepthMode(st.disabled);let n={};for(let o of e)n[o.key]=this.nextStencilID++;this._renderTileMasks(n,e,i,!0),this._renderTileMasks(n,e,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,e,i,r){var n;let o=this.context,s=o.gl,a=this.style.projection,c=this.transform,l=this.useProgram("clippingMask");for(let u of e){let h=t[u.key],p=(n=this.style.map.terrain)===null||n===void 0?void 0:n.getTerrainData(u),d=a.getMeshFromTileID(this.context,u.canonical,r,!0,"stencil"),f=c.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!i,applyTerrainMatrix:!0});l.draw(o,s.TRIANGLES,st.disabled,new gt({func:s.ALWAYS,mask:0},h,255,s.KEEP,s.KEEP,s.REPLACE),zt.disabled,i?mt.disabled:mt.backCCW,null,p,f,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}_renderTilesDepthBuffer(){var t;let e=this.context,i=e.gl,r=this.style.projection,n=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D(),a=fn(n,{tileSize:n.tileSize});for(let c of a){let l=(t=this.style.map.terrain)===null||t===void 0?void 0:t.getTerrainData(c),u=r.getMeshFromTileID(this.context,c.canonical,!0,!0,"raster"),h=n.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(e,i.TRIANGLES,s,gt.disabled,zt.disabled,mt.backCCW,null,l,h,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,e=this.context.gl;return new gt({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){let e=this.context.gl;return new gt({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let e=this.context.gl,i=t.sort((o,s)=>s.overscaledZ-o.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let o={};for(let s=0;s<n;s++)o[s+r]=new gt({func:e.GEQUAL,mask:255},s+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=n,[o,i]}return[{[r]:gt.disabled},i]}stencilConfigForOverlapTwoPass(t){let e=this.context.gl,i=t.sort((o,s)=>s.overscaledZ-o.overscaledZ),r=i[i.length-1].overscaledZ,n=i[0].overscaledZ-r+1;if(this.clearStencil(),n>1){let o={},s={};for(let a=0;a<n;a++)o[a+r]=new gt({func:e.GREATER,mask:255},n+1+a,255,e.KEEP,e.KEEP,e.REPLACE),s[a+r]=new gt({func:e.GREATER,mask:255},1+a,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID=2*n+1,[o,s,i]}return this.nextStencilID=3,[{[r]:new gt({func:e.GREATER,mask:255},2,255,e.KEEP,e.KEEP,e.REPLACE)},{[r]:new gt({func:e.GREATER,mask:255},1,255,e.KEEP,e.KEEP,e.REPLACE)},i]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector)return new zt([t.CONSTANT_COLOR,t.ONE],new Y(0.125,0.125,0.125,0),[!0,!0,!0,!0]);return this.renderPass==="opaque"?zt.unblended:zt.alphaBlended}getDepthModeForSublayer(t,e,i){if(!this.opaquePassEnabledForLayer())return st.disabled;let r=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new st(i||this.context.gl.LEQUAL,e,[r,r])}getDepthModeFor3D(){return new st(this.context.gl.LEQUAL,st.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,e){var i,r,n;this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(St()),this.imageManager.beginFrame();let o=this.style._order,s=this.style.tileManagers,a={},c={},l={},u={isRenderingToTexture:!1,isRenderingGlobe:((i=t.projection)===null||i===void 0?void 0:i.transitionState)>0};for(let p in s){let d=s[p];d.used&&d.prepare(this.context),a[p]=d.getVisibleCoordinates(!1),c[p]=a[p].slice().reverse(),l[p]=d.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let p=0;p<o.length;p++)if(this.style._layers[o[p]].is3D()){this.opaquePassCutoff=p;break}this.maybeDrawDepth(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let p of o){let d=this.style._layers[p];if(!d.hasOffscreenPass()||d.isHidden(this.transform.zoom))continue;let f=c[d.source];(d.type==="custom"||f.length)&&this.renderLayer(this,s[d.source],d,f,u)}if((r=this.style.projection)===null||r===void 0||r.updateGPUdependent({context:this.context,useProgram:(p)=>this.useProgram(p)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:e.showOverdrawInspector?Y.black:Y.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=e.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=o.length-1;this.currentLayer>=0;this.currentLayer--){let p=this.style._layers[o[this.currentLayer]],d=s[p.source],f=a[p.source];this._renderTileClippingMasks(p,f,!1),this.renderLayer(this,d,p,f,u)}this.renderPass="translucent";let h=!1;for(this.currentLayer=0;this.currentLayer<o.length;this.currentLayer++){let p=this.style._layers[o[this.currentLayer]],d=s[p.source];if((n=this.renderToTexture)===null||n===void 0?void 0:n.renderLayer(p,u))continue;this.opaquePassEnabledForLayer()||h||(h=!0,u.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let f=(p.type==="symbol"?l:c)[p.source];this._renderTileClippingMasks(p,a[p.source],!!this.renderToTexture),this.renderLayer(this,d,p,f,u)}if(u.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let p=function(d,f){let m=null,_=Object.values(d._layers).flatMap((x)=>x.source&&!x.isHidden(f)?[d.tileManagers[x.source]]:[]),y=_.filter((x)=>x.getSource().type==="vector"),v=_.filter((x)=>x.getSource().type!=="vector"),g=(x)=>{(!m||m.getSource().maxzoom<x.getSource().maxzoom)&&(m=x)};for(let x of y)g(x);if(!m)for(let x of v)g(x);return m}(this.style,this.transform.zoom);p&&this.drawFunctions.debug(this,p,p.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(t){var e,i;if(!((i=(e=this.style)===null||e===void 0?void 0:e.map)===null||i===void 0?void 0:i.terrain))return;let r=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix,o=this.terrainFacilitator.depthDirty;var s,a;o||(o=t?!((s=r)[0]===(a=n)[0]&&s[1]===a[1]&&s[2]===a[2]&&s[3]===a[3]&&s[4]===a[4]&&s[5]===a[5]&&s[6]===a[6]&&s[7]===a[7]&&s[8]===a[8]&&s[9]===a[9]&&s[10]===a[10]&&s[11]===a[11]&&s[12]===a[12]&&s[13]===a[13]&&s[14]===a[14]&&s[15]===a[15]):!function(c,l){var u=c[0],h=c[1],p=c[2],d=c[3],f=c[4],m=c[5],_=c[6],y=c[7],v=c[8],g=c[9],x=c[10],b=c[11],w=c[12],T=c[13],P=c[14],S=c[15],E=l[0],I=l[1],C=l[2],A=l[3],M=l[4],k=l[5],L=l[6],O=l[7],q=l[8],Q=l[9],rt=l[10],nt=l[11],lt=l[12],pt=l[13],Pt=l[14],yt=l[15];return Math.abs(u-E)<=oe*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(h-I)<=oe*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(p-C)<=oe*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(d-A)<=oe*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(f-M)<=oe*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(m-k)<=oe*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(_-L)<=oe*Math.max(1,Math.abs(_),Math.abs(L))&&Math.abs(y-O)<=oe*Math.max(1,Math.abs(y),Math.abs(O))&&Math.abs(v-q)<=oe*Math.max(1,Math.abs(v),Math.abs(q))&&Math.abs(g-Q)<=oe*Math.max(1,Math.abs(g),Math.abs(Q))&&Math.abs(x-rt)<=oe*Math.max(1,Math.abs(x),Math.abs(rt))&&Math.abs(b-nt)<=oe*Math.max(1,Math.abs(b),Math.abs(nt))&&Math.abs(w-lt)<=oe*Math.max(1,Math.abs(w),Math.abs(lt))&&Math.abs(T-pt)<=oe*Math.max(1,Math.abs(T),Math.abs(pt))&&Math.abs(P-Pt)<=oe*Math.max(1,Math.abs(P),Math.abs(Pt))&&Math.abs(S-yt)<=oe*Math.max(1,Math.abs(S),Math.abs(yt))}(r,n)),o||(o=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),o&&(function(c,l){c[0]=l[0],c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=l[6],c[7]=l[7],c[8]=l[8],c[9]=l[9],c[10]=l[10],c[11]=l[11],c[12]=l[12],c[13]=l[13],c[14]=l[14],c[15]=l[15]}(r,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.depthDirty=!1,this.terrainFacilitator.coordsDirty=!0,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}maybeDrawCoords(){var t,e;((e=(t=this.style)===null||t===void 0?void 0:t.map)===null||e===void 0?void 0:e.terrain)&&this.terrainFacilitator.coordsDirty&&(this.terrainFacilitator.coordsDirty=!1,this.drawFunctions.terrainCoords(this,this.style.map.terrain))}renderLayer(t,e,i,r,n){if(i.isHidden(this.transform.zoom))return;if(i.type!=="background"&&i.type!=="custom"&&!(r||[]).length)return;this.id=i.id;let o=this.drawFunctions;Mm(i)?o.symbol(t,e,i,r,this.style.placement.variableOffsets,n):((s)=>s.type==="circle")(i)?o.circle(t,e,i,r,n):((s)=>s.type==="heatmap")(i)?o.heatmap(t,e,i,r,n):((s)=>s.type==="line")(i)?o.line(t,e,i,r,n):((s)=>s.type==="fill")(i)?o.fill(t,e,i,r,n):((s)=>s.type==="fill-extrusion")(i)?o.fillExtrusion(t,e,i,r,n):((s)=>s.type==="hillshade")(i)?o.hillshade(t,e,i,r,n):((s)=>s.type==="color-relief")(i)?o.colorRelief(t,e,i,r,n):Sc(i)?o.raster(t,e,i,r,n):((s)=>s.type==="background")(i)?o.background(t,e,i,r,n):((s)=>s.type==="custom")(i)&&o.custom(t,e,i,n)}saveTileTexture(t){let e=this._tileTextures[t.size[0]];e?e.length<ll.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?e.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let e=this.imageManager.getPattern(t.from.toString()),i=this.imageManager.getPattern(t.to.toString());return!e||!i}useProgram(t,e,i=!1,r=[]){var n;this.cache||(this.cache={});let o=!!this.style.map.terrain,s=this.style.projection,a=i?yi.projectionMercator:s.shaderPreludeCode,c=i?rg:s.shaderDefine,l=t+(e?e.cacheKey:"")+`/${i?ng:s.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"")+(r?`/${r.join("/")}`:"");return(n=this.cache)[l]||(n[l]=new vg(this.context,yi[t],e,ib[t],this._showOverdrawInspector,o,a,c,r)),this.cache[l]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new jt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,e;if(this._tileTextures){for(let i in this._tileTextures){let r=this._tileTextures[i];if(r)for(let n of r)n.destroy()}this._tileTextures={}}if(this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((e=this.tileExtentMesh.indexBuffer)===null||e===void 0||e.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let i in this.cache){let r=this.cache[i];(r==null?void 0:r.program)&&this.context.gl.deleteProgram(r.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}}function Ey(t,e){let i,r=!1,n=null,o=()=>{n=null,r&&(t(...i),n=setTimeout(o,e),r=!1)};return(...s)=>(r=!0,i=s,n||o(),n)}ll.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class Lu{constructor(t){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let i,r=e.split("&").map((n)=>n.split("="));for(let n of r)n[0]===this._hashName&&(i=n);return(i&&i[1]||"").split("/")}return e.split("/")},this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:i,pitch:+(e[4]||0)}),!0},this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)},this._removeHash=()=>{let e=this._getCurrentHash();if(e.length===0)return;let i=e.join("/"),r=i;r.split("&").length>0&&(r=r.split("&")[0]),this._hashName&&(r=`${this._hashName}=${i}`);let n=window.location.hash.replace(r,"");n.startsWith("#&")?n=n.slice(0,1)+n.slice(2):n==="#"&&(n="");let o=window.location.href.replace(/(#.+)?$/,n);o=o.replace("&&","&"),window.history.replaceState(window.history.state,null,o)},this._updateHash=Ey(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let e=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,r=Math.ceil((i*Math.LN2+Math.log(2.8444444444444446))/Math.LN10),n=Math.pow(10,r),o=Math.round(e.lng*n)/n,s=Math.round(e.lat*n)/n,a=this._map.getBearing(),c=this._map.getPitch(),l="";if(l+=t?`/${o}/${s}/${i}`:`${i}/${s}/${o}`,(a||c)&&(l+="/"+Math.round(10*a)/10),c&&(l+=`/${Math.round(c)}`),this._hashName){let u=this._hashName,h=!1,p=window.location.hash.slice(1).split("&").map((d)=>{let f=d.split("=")[0];return f===u?(h=!0,`${f}=${l}`):d}).filter((d)=>d);return h||p.push(`${u}=${l}`),`#${p.join("&")}`}return`#${l}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new X(+t[2],+t[1])}catch(n){return!1}let e=+t[0],i=+(t[3]||0),r=+(t[4]||0);return e>=this._map.getMinZoom()&&e<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}}let Vo={linearity:0.3,easing:Il(0,0,0.3,1)},Tb=G({deceleration:2500,maxSpeed:1400},Vo),Sb=G({deceleration:20,maxSpeed:1400},Vo),Pb=G({deceleration:1000,maxSpeed:360},Vo),Ib=G({deceleration:1000,maxSpeed:90},Vo),Eb=G({deceleration:1000,maxSpeed:360},Vo);class My{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:St(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,e=St();for(;t.length>0&&e-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let e={zoom:0,bearing:0,pitch:0,roll:0,pan:new z(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of this._inertiaBuffer)e.zoom+=n.zoomDelta||0,e.bearing+=n.bearingDelta||0,e.pitch+=n.pitchDelta||0,e.roll+=n.rollDelta||0,n.panDelta&&e.pan._add(n.panDelta),n.around&&(e.around=n.around),n.pinchAround&&(e.pinchAround=n.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,r={};if(e.pan.mag()){let n=$o(e.pan.mag(),i,G({},Tb,t||{})),o=e.pan.mult(n.amount/e.pan.mag()),s=this._map.cameraHelper.handlePanInertia(o,this._map.transform);r.center=s.easingCenter,r.offset=s.easingOffset,Uo(r,n)}if(e.zoom){let n=$o(e.zoom,i,Sb);r.zoom=Ae(this._map.transform.zoom+n.amount,this._map.getZoomSnap(),n.amount),Uo(r,n)}if(e.bearing){let n=$o(e.bearing,i,Pb);r.bearing=this._map.transform.bearing+_t(n.amount,-179,179),Uo(r,n)}if(e.pitch){let n=$o(e.pitch,i,Ib);r.pitch=this._map.transform.pitch+n.amount,Uo(r,n)}if(e.roll){let n=$o(e.roll,i,Eb);r.roll=this._map.transform.roll+_t(n.amount,-179,179),Uo(r,n)}if(r.zoom||r.bearing){let n=e.pinchAround===void 0?e.around:e.pinchAround;r.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),G(r,{noMoveStart:!0})}}function Uo(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function $o(t,e,i){let{maxSpeed:r,linearity:n,deceleration:o}=i,s=_t(t*n/(e/1000),-r,r),a=Math.abs(s)/(o*n);return{easing:i.easing,duration:1000*a,amount:s*(a/2)}}class Ee extends R{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(t,i);let n=N.mousePos(e.getCanvas(),i);super(t,G({point:n,lngLat:e.unproject(n),originalEvent:i},r)),this._defaultPrevented=!1,this.target=e}}class vn extends R{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){let r=t==="touchend"?i.changedTouches:i.touches,n=N.touchPos(e.getCanvasContainer(),r),o=n.map((a)=>e.unproject(a)),s=n.reduce((a,c,l,u)=>a.add(c.div(u.length)),new z(0,0));super(t,{points:n,point:s,lngLats:o,lngLat:e.unproject(s),originalEvent:i}),this._defaultPrevented=!1}}class Fu extends R{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,e,i){super(t,{originalEvent:i}),this._defaultPrevented=!1}}class Cy{constructor(t,e){this._map=t,this._clickTolerance=e.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new Fu(t.type,this._map,t))}mousedown(t,e){return this._mousedownPos=e,this._firePreventable(new Ee(t.type,this._map,t))}mouseup(t){this._map.fire(new Ee(t.type,this._map,t))}click(t,e){this._mousedownPos&&this._mousedownPos.dist(e)>=this._clickTolerance||this._map.fire(new Ee(t.type,this._map,t))}dblclick(t){return this._firePreventable(new Ee(t.type,this._map,t))}mouseover(t){this._map.fire(new Ee(t.type,this._map,t))}mouseout(t){this._map.fire(new Ee(t.type,this._map,t))}touchstart(t){return this._firePreventable(new vn(t.type,this._map,t))}touchmove(t){this._map.fire(new vn(t.type,this._map,t))}touchend(t){this._map.fire(new vn(t.type,this._map,t))}touchcancel(t){this._map.fire(new vn(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ay{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new Ee(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ee("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new Ee(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xn{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(z.convert(t),this._map.terrain)}}class Bu{constructor(t,e){this._map=t,this._tr=new xn(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1,e.boxZoom&&typeof e.boxZoom=="object"&&(this._boxZoomEnd=e.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,e){this.isEnabled()&&t.shiftKey&&t.button===0&&(N.disableDrag(),this._startPos=this._lastPos=e,this._active=!0)}mousemoveWindow(t,e){if(!this._active)return;let i=e;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let r=this._startPos;this._lastPos=i,this._box||(this._box=N.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));let n=Math.min(r.x,i.x),o=Math.max(r.x,i.x),s=Math.min(r.y,i.y),a=Math.max(r.y,i.y);this._box.style.transform=`translate(${n}px,${s}px)`,this._box.style.width=o-n+"px",this._box.style.height=a-s+"px"}mouseupWindow(t,e){if(!this._active)return;if(t.button!==0)return;let i=this._startPos,r=e;if(this.reset(),N.suppressClick(),i.x!==r.x||i.y!==r.y)return this._map.fire(new R("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,i,r,t):{cameraAnimation:(n)=>n.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),N.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,e){return this._map.fire(new R(t,{originalEvent:e}))}}function Ou(t,e){if(t.length!==e.length)throw Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);let i={};for(let r=0;r<t.length;r++)i[t[r].identifier]=e[r];return i}class zy{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,e,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(r){let n=new z(0,0);for(let o of r)n._add(o);return n.div(r.length)}(e),this.touches=Ou(i,e)))}touchmove(t,e,i){if(this.aborted||!this.centroid)return;let r=Ou(i,e);for(let n in this.touches){let o=r[n];(!o||o.dist(this.touches[n])>30)&&(this.aborted=!0)}}touchend(t,e,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}}class cl{constructor(t){this.singleTap=new zy(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,e,i){this.singleTap.touchstart(t,e,i)}touchmove(t,e,i){this.singleTap.touchmove(t,e,i)}touchend(t,e,i){let r=this.singleTap.touchend(t,e,i);if(r){let n=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(r)<30;if(n&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}}class Dy{constructor(t){this._tr=new xn(t),this._zoomIn=new cl({numTouches:1,numTaps:2}),this._zoomOut=new cl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,e,i){this._zoomIn.touchstart(t,e,i),this._zoomOut.touchstart(t,e,i)}touchmove(t,e,i){this._zoomIn.touchmove(t,e,i),this._zoomOut.touchmove(t,e,i)}touchend(t,e,i){let r=this._zoomIn.touchend(t,e,i),n=this._zoomOut.touchend(t,e,i),o=this._tr;return r?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:(s)=>s.easeTo({duration:300,zoom:Ae(o.zoom+1,s.getZoomSnap()),around:o.unproject(r)},{originalEvent:t})}):n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:(s)=>s.easeTo({duration:300,zoom:Ae(o.zoom-1,s.getZoomSnap()),around:o.unproject(n)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class bn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.rollDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(e)?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let r=Array.isArray(e)?e[0]:e;return!this._moved&&r.dist(i)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=r,this._move(i,r))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&N.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}let Mb=0,Cb=2,Ab={[Mb]:1,[Cb]:2};class wn{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!function(e,i){let r=Ab[i];return e.buttons===void 0||(e.buttons&r)!==r}(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class Ry{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class ky{constructor(t=new wn({checkCorrectEvent:()=>!0}),e=new Ry){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=e}_executeRelevantHandler(t,e,i){return t instanceof MouseEvent?e(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?i(t):void 0}startMove(t){this._executeRelevantHandler(t,(e)=>{this.mouseMoveStateManager.startMove(e)},(e)=>{this.oneFingerTouchMoveStateManager.startMove(e)})}endMove(t){this._executeRelevantHandler(t,(e)=>{this.mouseMoveStateManager.endMove(e)},(e)=>{this.oneFingerTouchMoveStateManager.endMove(e)})}isValidStartEvent(t){return this._executeRelevantHandler(t,(e)=>this.mouseMoveStateManager.isValidStartEvent(e),(e)=>this.oneFingerTouchMoveStateManager.isValidStartEvent(e))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(e)=>this.mouseMoveStateManager.isValidMoveEvent(e),(e)=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(e))}isValidEndEvent(t){return this._executeRelevantHandler(t,(e)=>this.mouseMoveStateManager.isValidEndEvent(e),(e)=>this.oneFingerTouchMoveStateManager.isValidEndEvent(e))}}let hl=(t)=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=(e)=>{e.preventDefault()}};class Ly{constructor(t,e){this._clickTolerance=t.clickTolerance||1,this._map=e,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new z(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,e,i){return this._calculateTransform(t,e,i)}touchmove(t,e,i){if(this._active){if(!this._shouldBePrevented(i.length))return t.preventDefault(),this._calculateTransform(t,e,i);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,e,i){this._calculateTransform(t,e,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,e,i){i.length>0&&(this._active=!0);let r=Ou(i,e),n=new z(0,0),o=new z(0,0),s=0;for(let c in r){let l=r[c],u=this._touches[c];u&&(n._add(l),o._add(l.sub(u)),s++,r[c]=l)}if(this._touches=r,this._shouldBePrevented(s)||!o.mag())return;let a=o.div(s);return this._sum._add(a),this._sum.mag()<this._clickTolerance?void 0:{around:n.div(s),panDelta:a}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ul{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,e,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([e[0],e[1]]))}touchmove(t,e,i){if(!this._firstTwoTouches)return;t.preventDefault();let[r,n]=this._firstTwoTouches,o=dl(i,e,r),s=dl(i,e,n);if(!o||!s)return;let a=this._aroundCenter?null:o.add(s).div(2);return this._move([o,s],a,t)}touchend(t,e,i){if(!this._firstTwoTouches)return;let[r,n]=this._firstTwoTouches,o=dl(i,e,r),s=dl(i,e,n);o&&s||(this._active&&N.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function dl(t,e,i){for(let r=0;r<t.length;r++)if(t[r].identifier===i)return e[r]}function Fy(t,e){return Math.log(t/e)/Math.LN2}class ju extends ul{constructor(){super(),this._zoomRate=1,this._zoomThreshold=0.1}setZoomRate(t){this._zoomRate=t!=null?t:1}setZoomThreshold(t){this._zoomThreshold=t!=null?t:0.1}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,e){let i=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Fy(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:Fy(this._distance,i)*this._zoomRate,pinchAround:e}}}function By(t,e){return 180*t.angleWith(e)/Math.PI}class Nu extends ul{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,e,i){let r=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:By(this._vector,r),pinchAround:e}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());let e=25/(Math.PI*this._minDiameter)*360,i=By(t,this._startVector);return Math.abs(i)<e}}function Vu(t){return Math.abs(t.y)>Math.abs(t.x)}class Uu extends ul{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,e,i){super.touchstart(t,e,i),this._currentTouchCount=i.length}_start(t){this._lastPoints=t,Vu(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,e,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=t[0].sub(this._lastPoints[0]),n=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(r,n,i.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(r.y+n.y)/2*-0.5}):void 0}gestureBeginsVertically(t,e,i){if(this._valid!==void 0)return this._valid;let r=t.mag()>=2,n=e.mag()>=2;if(!r&&!n)return;if(!r||!n)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<100&&void 0;let o=t.y>0==e.y>0;return Vu(t)&&Vu(e)&&o}}let zb={panStep:100,bearingStep:15,pitchStep:10};class $u{constructor(t){this._tr=new xn(t);let e=zb;this._panStep=e.panStep,this._bearingStep=e.bearingStep,this._pitchStep=e.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let e=0,i=0,r=0,n=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),n=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),n=1);break;case 38:t.shiftKey?r=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?r=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,r=0),{cameraAnimation:(s)=>{let a=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:Db,zoom:e?Ae(a.zoom+e*(t.shiftKey?2:1),s.getZoomSnap()):a.zoom,bearing:a.bearing+i*this._bearingStep,pitch:a.pitch+r*this._pitchStep,offset:[-n*this._panStep,-o*this._panStep],center:a.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Db(t){return t*(2-t)}let Oy=4.000244140625,Rb=0.0022222222222222222;class Zu{constructor(t,e){this._onTimeout=(i)=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=t,this._tr=new xn(t),this._triggerRenderFrame=e,this._delta=0,this._defaultZoomRate=0.01,this._wheelZoomRate=Rb}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let e=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,i=St(),r=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,e!==0&&e%Oy==0?this._type="wheel":e!==0&&Math.abs(e)<4?this._type="trackpad":r>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(r*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&(this._lastWheelEvent=t,this._delta-=e,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let e=N.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(X.convert(i.center)):e,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender)return;if(this._needsRerender=!1,!this.isActive())return;let t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>Oy?this._wheelZoomRate:this._defaultZoomRate,a=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&a!==0&&(a=1/a);let c=typeof this._targetZoom!="number"?t.scale:_e(this._targetZoom),l=t.applyConstrain(t.getCameraLngLat(),he(c*a)).zoom,u=this._map.getZoomSnap();if(this._type==="wheel"&&u>0){let h=Ae(t.zoom,u);this._targetZoom=Ae(l,u,l-h)}else this._targetZoom=l;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let e=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,i=this._startZoom,r=this._easing,n,o=!1;if(this._type==="wheel"&&i&&r){let s=St()-this._lastWheelEventTime,a=Math.min((s+5)/200,1),c=r(a);n=Ft.number(i,e,c),a<1?this._needsRerender=!0:o=!0}else n=e,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=n,{noInertia:!0,needsRenderFrame:!o,zoomDelta:n-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let e=El;if(this._prevEase){let i=this._prevEase,r=(St()-i.start)/i.duration,n=i.easing(r+0.01)-i.easing(r),o=0.27/Math.sqrt(n*n+0.0001)*0.01;e=Il(o,Math.sqrt(0.0729-o*o),0.25,1)}return this._prevEase={start:St(),duration:t,easing:e},e}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Gu{constructor(t,e){this._clickZoom=t,this._tapZoom=e}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class jy{constructor(t){this._tr=new xn(t),this.reset()}reset(){this._active=!1}dblclick(t,e){return t.preventDefault(),{cameraAnimation:(i)=>{i.easeTo({duration:300,zoom:Ae(this._tr.zoom+(t.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(e)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ny{constructor(){this._tap=new cl({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t!=null?t:1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,e,i){if(!this._swipePoint)if(this._tapTime){let r=e[0],n=t.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;n&&o?i.length>0&&(this._swipePoint=r,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,e,i)}touchmove(t,e,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let r=e[0],n=r.y-this._swipePoint.y;return this._swipePoint=r,t.preventDefault(),this._active=!0,{zoomDelta:n/128*this._zoomRate}}}else this._tap.touchmove(t,e,i)}touchend(t,e,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(t,e,i);r&&(this._tapTime=t.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qu{constructor(t,e,i){this._el=t,this._mousePan=e,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Wu{constructor(t,e,i,r){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=e,this._mousePitch=i,this._mouseRoll=r}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class Hu{constructor(t,e,i,r){this._el=t,this._touchZoom=e,this._touchRotate=i,this._tapDragZoom=r,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class Xu{constructor(t,e){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=e,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=N.create("div","maplibregl-cooperative-gesture-screen",t);let e=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(e=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=e,this._container.appendChild(r);let n=document.createElement("div");n.className="maplibregl-mobile-message",n.textContent=i,this._container.appendChild(n),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,e){this._enabled&&(this._map.fire(new R("cooperativegestureprevented",{gestureType:t,originalEvent:e})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}let pl=(t)=>t.zoom||t.drag||t.roll||t.pitch||t.rotate;class Vy extends R{}function Yu(t){var e;return((e=t.panDelta)===null||e===void 0?void 0:e.mag())||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}class Uy{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,e;return((e=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView)||window}constructor(t,e){this.handleWindowEvent=(r)=>{this.handleEvent(r,`${r.type}Window`)},this.handleEvent=(r,n)=>{if(r.type==="blur")return void this.stop(!0);this._updatingCamera=!0;let o=r.type==="renderFrame"?void 0:r,s={needsRenderFrame:!1},a={},c={};for(let{handlerName:p,handler:d,allowed:f}of this._handlers){if(!d.isEnabled())continue;let m;if(this._blockedByActive(c,f,p))d.reset();else if(d[n||r.type]){if(m0(r,n||r.type)){let _=N.mousePos(this._map.getCanvas(),r);m=d[n||r.type](r,_)}else if(Cd[n||r.type]&&"touches"in r){let _=this._getMapTouches(r.touches),y=N.touchPos(this._map.getCanvas(),_);m=d[n||r.type](r,y,_)}else Cd[l=n||r.type]||Ad[l]||(m=d[n||r.type](r));this.mergeHandlerResult(s,a,m,p,o),(m==null?void 0:m.needsRenderFrame)&&this._triggerRenderFrame()}(m||d.isActive())&&(c[p]=d)}var l;let u={};for(let p in this._previousActiveHandlers)c[p]||(u[p]=o);this._previousActiveHandlers=c,(Object.keys(u).length||Yu(s))&&(this._changes.push([s,a,u]),this._triggerRenderFrame()),(Object.keys(c).length||Yu(s))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:h}=s;h&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],h(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new My(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(e);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[r,n,o]of this._listeners)r.addEventListener(n,r===this._ownerDocument?this.handleWindowEvent:this.handleEvent,o)}destroy(){for(let[t,e,i]of this._listeners)t.removeEventListener(e,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){let e=this._map,i=e.getCanvasContainer();this._add("mapEvent",new Cy(e,t));let r=e.boxZoom=new Bu(e,t);this._add("boxZoom",r),t.interactive&&t.boxZoom&&r.enable();let n=e.cooperativeGestures=new Xu(e,t.cooperativeGestures);this._add("cooperativeGestures",n),t.cooperativeGestures&&n.enable();let o=new Dy(e),s=new jy(e);e.doubleClickZoom=new Gu(s,o),this._add("tapZoom",o),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&e.doubleClickZoom.enable();let a=new Ny;this._add("tapDragZoom",a);let c=e.touchPitch=new Uu(e);this._add("touchPitch",c),t.interactive&&t.touchPitch&&e.touchPitch.enable(t.touchPitch);let l=()=>e.project(e.getCenter()),u=function({enable:g,clickTolerance:x,aroundCenter:b=!0,minPixelCenterThreshold:w=100,rotateDegreesPerPixelMoved:T=0.8},P){let S=new wn({checkCorrectEvent:(E)=>E.button===0&&E.ctrlKey||E.button===2&&!E.ctrlKey});return new bn({clickTolerance:x,move:(E,I)=>{let C=P();if(b&&Math.abs(C.y-E.y)>w)return{bearingDelta:Ed(new z(E.x,I.y),I,C)};let A=(I.x-E.x)*T;return b&&I.y<C.y&&(A=-A),{bearingDelta:A}},moveStateManager:S,enable:g,assignEvents:hl})}(t,l),h=function({enable:g,clickTolerance:x,pitchDegreesPerPixelMoved:b=-0.5}){let w=new wn({checkCorrectEvent:(T)=>T.button===0&&T.ctrlKey||T.button===2});return new bn({clickTolerance:x,move:(T,P)=>({pitchDelta:(P.y-T.y)*b}),moveStateManager:w,enable:g,assignEvents:hl})}(t),p=function({enable:g,clickTolerance:x,rollDegreesPerPixelMoved:b=0.3},w){let T=new wn({checkCorrectEvent:(P)=>P.button===2&&P.ctrlKey});return new bn({clickTolerance:x,move:(P,S)=>{let E=w(),I=(S.x-P.x)*b;return S.y<E.y&&(I=-I),{rollDelta:I}},moveStateManager:T,enable:g,assignEvents:hl})}(t,l);e.dragRotate=new Wu(t,u,h,p),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",p,["mousePitch"]),t.interactive&&t.dragRotate&&e.dragRotate.enable();let d=function({enable:g,clickTolerance:x}){let b=new wn({checkCorrectEvent:(w)=>w.button===0&&!w.ctrlKey});return new bn({clickTolerance:x,move:(w,T)=>({around:T,panDelta:T.sub(w)}),activateOnStart:!0,moveStateManager:b,enable:g,assignEvents:hl})}(t),f=new Ly(t,e);e.dragPan=new qu(i,d,f),this._add("mousePan",d),this._add("touchPan",f,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&e.dragPan.enable(t.dragPan);let m=new Nu,_=new ju;e.touchZoomRotate=new Hu(i,_,m,a),this._add("touchRotate",m,["touchPan","touchZoom"]),this._add("touchZoom",_,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&e.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new Ay(e));let y=e.scrollZoom=new Zu(e,()=>this._triggerRenderFrame());this._add("scrollZoom",y,["mousePan"]),t.interactive&&t.scrollZoom&&e.scrollZoom.enable(t.scrollZoom);let v=e.keyboard=new $u(e);this._add("keyboard",v),t.interactive&&t.keyboard&&e.keyboard.enable()}_add(t,e,i){this._handlers.push({handlerName:t,handler:e,allowed:i}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return Boolean(pl(this._eventsInProgress))||this.isZooming()}_blockedByActive(t,e,i){for(let r in t)if(r!==i&&!(e==null?void 0:e.includes(r)))return!0;return!1}_getMapTouches(t){let e=[];for(let i of t)this._el.contains(i.target)&&e.push(i);return e}mergeHandlerResult(t,e,i,r,n){if(!i)return;G(t,i);let o={handlerName:r,originalEvent:i.originalEvent||n};i.zoomDelta!==void 0&&(e.zoom=o),i.panDelta!==void 0&&(e.drag=o),i.rollDelta!==void 0&&(e.roll=o),i.pitchDelta!==void 0&&(e.pitch=o),i.bearingDelta!==void 0&&(e.rotate=o)}_applyChanges(){let t={},e={},i={};for(let[r,n,o]of this._changes)r.panDelta&&(t.panDelta=(t.panDelta||new z(0,0))._add(r.panDelta)),r.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(t.rollDelta=(t.rollDelta||0)+r.rollDelta),r.around!==void 0&&(t.around=r.around),r.pinchAround!==void 0&&(t.pinchAround=r.pinchAround),r.noInertia&&(t.noInertia=r.noInertia),G(e,n),G(i,o);this._updateMapTransform(t,e,i),this._changes=[]}_updateMapTransform(t,e,i){let r=this._map,n=r._getTransformForUpdate(),o=r.terrain;if(!(Yu(t)||o&&this._terrainMovement))return void this._fireEvents(e,i,!0);r._stop(!0);let{panDelta:s,zoomDelta:a,bearingDelta:c,pitchDelta:l,rollDelta:u,around:h,pinchAround:p}=t;p!==void 0&&(h=p),h||(h=r.transform.centerPoint),o&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);let d={panDelta:s,zoomDelta:a,rollDelta:u,pitchDelta:l,bearingDelta:c,around:h};this._map.cameraHelper.useGlobeControls&&!n.isPointOnMapSurface(h)&&(h=n.centerPoint);let f=h.distSqr(n.centerPoint)<0.01?n.center:n.screenPointToLocation(s?h.sub(s):h);this._handleMapControls({terrain:o,tr:n,deltasForHelper:d,preZoomAroundLoc:f,combinedEventsInProgress:e,panDelta:s}),r._applyUpdatedTransform(n),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,i,!0)}_handleMapControls({terrain:t,tr:e,deltasForHelper:i,preZoomAroundLoc:r,combinedEventsInProgress:n,panDelta:o}){let s=this._map.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,e),t)return s.useGlobeControls?(this._terrainMovement||!n.drag&&!n.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void s.handleMapControlsPan(i,e,r)):this._terrainMovement||!n.drag&&!n.zoom?void(n.drag&&this._terrainMovement&&o?e.setCenter(e.screenPointToLocation(e.centerPoint.sub(o))):s.handleMapControlsPan(i,e,r)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void s.handleMapControlsPan(i,e,r));s.handleMapControlsPan(i,e,r)}_fireEvents(t,e,i){let r=pl(this._eventsInProgress),n=pl(t),o={};for(let u in t){let{originalEvent:h}=t[u];this._eventsInProgress[u]||(o[`${u}start`]=h),this._eventsInProgress[u]=t[u]}!r&&n&&this._fireEvent("movestart",n.originalEvent);for(let u in o)this._fireEvent(u,o[u]);n&&this._fireEvent("move",n.originalEvent);for(let u in t){let{originalEvent:h}=t[u];this._fireEvent(u,h)}let s={},a;for(let u in this._eventsInProgress){let{handlerName:h,originalEvent:p}=this._eventsInProgress[u];this._handlersById[h].isActive()||(delete this._eventsInProgress[u],a=e[h]||p,s[`${u}end`]=a)}for(let u in s)this._fireEvent(u,s[u]);let c=pl(this._eventsInProgress),l=(r||n)&&!c;if(l&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let u=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&u.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(u)}if(i&&l){this._updatingCamera=!0;let u=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),h=(p)=>p!==0&&-this._bearingSnap<p&&p<this._bearingSnap;!u||!u.essential&&ge.prefersReducedMotion?(this._map.fire(new R("moveend",{originalEvent:a})),h(this._map.getBearing())&&this._map.resetNorth()):(h(u.bearing||this._map.getBearing())&&(u.bearing=0),u.freezeElevation=!0,this._map.easeTo(u,{originalEvent:a})),this._updatingCamera=!1}}_fireEvent(t,e){this._map.fire(new R(t,e?{originalEvent:e}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t)=>{delete this._frameId,this.handleEvent(new Vy("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class $y extends Ht{constructor(t,e,i){super(),this._renderFrameCallback=()=>{let r=Math.min((St()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this._zoomSnap=i.zoomSnap,this.cameraHelper=e,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,e){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=e}getCenter(){return new X(this.transform.center.lng,this.transform.center.lat)}setCenter(t,e){return this.jumpTo({center:t},e)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,e){return this.jumpTo({elevation:t},e),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,e,i){return t=z.convert(t).mult(-1),this.panTo(this.transform.center,G({offset:t},e),i)}panTo(t,e,i){return this.easeTo(G({center:t},e),i)}getZoom(){return this.transform.zoom}setZoom(t,e){return this.jumpTo({zoom:t},e),this}zoomTo(t,e,i){return this.easeTo(G({zoom:t},e),i)}zoomIn(t,e){return this.zoomTo(Ae(this.getZoom()+1,this._zoomSnap),t,e),this}zoomOut(t,e){return this.zoomTo(Ae(this.getZoom()-1,this._zoomSnap),t,e),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,e){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new R("movestart",e)).fire(new R("move",e)).fire(new R("moveend",e))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,e){return this.jumpTo({bearing:t},e),this}getPadding(){return this.transform.padding}setPadding(t,e){return this.jumpTo({padding:t},e),this}rotateTo(t,e,i){return this.easeTo(G({bearing:t},e),i)}resetNorth(t,e){return this.rotateTo(0,G({duration:1000},t),e),this}resetNorthPitch(t,e){return this.easeTo(G({bearing:0,pitch:0,roll:0,duration:1000},t),e),this}snapToNorth(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this}getPitch(){return this.transform.pitch}setPitch(t,e){return this.jumpTo({pitch:t},e),this}getRoll(){return this.transform.roll}setRoll(t,e){return this.jumpTo({roll:t},e),this}cameraForBounds(t,e){t=Kt.convert(t).adjustAntiMeridian();let i=(e==null?void 0:e.bearing)||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),i,e)}_cameraForBoxAndBearing(t,e,i,r){let n={top:0,bottom:0,right:0,left:0};if(typeof(r=G({padding:n,offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding=="number"){let l=r.padding;r.padding={top:l,bottom:l,right:l,left:l}}let o=G(n,r.padding);r.padding=o;let s=this.transform,a=new Kt(t,e),c=this.cameraHelper.cameraForBoxAndBearing(r,o,a,i,s);return c&&this._zoomSnap&&(c.zoom=Ae(c.zoom,this._zoomSnap,-1)),c}fitBounds(t,e,i){return this._fitInternal(this.cameraForBounds(t,e),e,i)}fitScreenCoordinates(t,e,i,r,n){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(z.convert(t)),this.transform.screenPointToLocation(z.convert(e)),i,r),r,n)}_fitInternal(t,e,i){return t?(delete(e=G(t,e)).padding,e.linear?this.easeTo(e,i):this.flyTo(e,i)):this}jumpTo(t,e){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=Ae(t.zoom,this._zoomSnap));let i=this._getTransformForUpdate(),r=!1,n=!1,o=!1,s=i.zoom;this.terrain&&i.setElevation(this.terrain.getElevationForLngLatZoom(t.center?X.convert(t.center):i.center,t.zoom||i.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(i,t);let a=i.zoom!==s;return"elevation"in t&&i.elevation!==+t.elevation&&i.setElevation(+t.elevation),"bearing"in t&&i.bearing!==+t.bearing&&(r=!0,i.setBearing(+t.bearing)),"pitch"in t&&i.pitch!==+t.pitch&&(n=!0,i.setPitch(+t.pitch)),"roll"in t&&i.roll!==+t.roll&&(o=!0,i.setRoll(+t.roll)),t.padding==null||i.isPaddingEqual(t.padding)||i.setPadding(t.padding),this._applyUpdatedTransform(i),this.fire(new R("movestart",e)).fire(new R("move",e)),a&&this.fire(new R("zoomstart",e)).fire(new R("zoom",e)).fire(new R("zoomend",e)),r&&this.fire(new R("rotatestart",e)).fire(new R("rotate",e)).fire(new R("rotateend",e)),n&&this.fire(new R("pitchstart",e)).fire(new R("pitch",e)).fire(new R("pitchend",e)),o&&this.fire(new R("rollstart",e)).fire(new R("roll",e)).fire(new R("rollend",e)),this.fire(new R("moveend",e))}calculateCameraOptionsFromTo(t,e,i,r=0){let n=wt.fromLngLat(t,e),o=wt.fromLngLat(i,r),s=o.x-n.x,a=o.y-n.y,c=o.z-n.z,l=Math.hypot(s,a,c);if(l===0)throw Error("Can't calculate camera options with same From and To");let u=Math.hypot(s,a),h=he(this.transform.cameraToCenterDistance/l/this.transform.tileSize),p=180*Math.atan2(s,-a)/Math.PI,d=180*Math.acos(u/l)/Math.PI;return d=c<0?90-d:90+d,{center:o.toLngLat(),elevation:r,zoom:h,pitch:d,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(t,e,i,r,n){let o=this.transform.calculateCenterFromCameraLngLatAlt(t,e,i,r);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:r,roll:n}}easeTo(t,e){this._stop(!1,t.easeId),"zoom"in(t=G({offset:[0,0],duration:500,easing:El},t))&&this._zoomSnap&&(t.zoom=Ae(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&ge.prefersReducedMotion)&&(t.duration=0);let i=this._getTransformForUpdate(),r=this.getBearing(),{pitch:n,roll:o}=i,s="bearing"in t?this._normalizeBearing(t.bearing,r):r,a="pitch"in t?+t.pitch:n,c="roll"in t?this._normalizeBearing(t.roll,o):o,l="padding"in t?t.padding:i.padding,u=z.convert(t.offset),h,p;t.around&&(h=X.convert(t.around),p=i.locationToScreenPoint(h));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(i,{bearing:s,pitch:a,roll:c,padding:l,around:h,aroundPoint:p,offsetAsPoint:u,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating||(this._rotating=r!==s),this._pitching||(this._pitching=a!==n),this._rolling||(this._rolling=c!==o),this._padding=!i.isPaddingEqual(l),this._zooming||(this._zooming=f.isZooming),this._easeId=t.easeId,this._prepareEase(e,t.noMoveStart,d),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease((m)=>{f.easeFunc(m),this.terrain&&!t.freezeElevation&&this._updateElevation(m),this._applyUpdatedTransform(i),this._fireMoveEvents(e)},(m)=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(e,m)},t),this}_prepareEase(t,e,i={}){this._moving=!0,e||i.moving||this.fire(new R("movestart",t)),this._zooming&&!i.zooming&&this.fire(new R("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new R("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new R("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new R("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let e=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&e!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(i-(e-(i*t+this._elevationStart))/(1-t)),this._elevationTarget=e}this.transform.setElevation(Ft.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let e=t.getCameraLngLat(),i=t.getCameraAltitude(),r=this.terrain?this.terrain.getElevationForLngLatZoom(e,t.zoom):0;if(i<r){let n=this.calculateCameraOptionsFromTo(e,r,t.center,t.elevation);return{pitch:n.pitch,zoom:n.zoom}}return{}}_applyUpdatedTransform(t){let e=[];if(e.push((r)=>this._elevateCameraIfInsideTerrain(r)),this.transformCameraUpdate&&e.push((r)=>this.transformCameraUpdate(r)),!e.length)return;let i=t.clone();for(let r of e){let n=i.clone(),{center:o,zoom:s,roll:a,pitch:c,bearing:l,elevation:u}=r(n);o&&n.setCenter(o),u!==void 0&&n.setElevation(u),s!==void 0&&n.setZoom(s),a!==void 0&&n.setRoll(a),c!==void 0&&n.setPitch(c),l!==void 0&&n.setBearing(l),i.apply(n,!1)}this.transform.apply(i,!1)}_fireMoveEvents(t){this.fire(new R("move",t)),this._zooming&&this.fire(new R("zoom",t)),this._rotating&&this.fire(new R("rotate",t)),this._pitching&&this.fire(new R("pitch",t)),this._rolling&&this.fire(new R("roll",t))}_afterEase(t,e){if(this._easeId&&e&&this._easeId===e)return;delete this._easeId;let i=this._zooming,r=this._rotating,n=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new R("zoomend",t)),r&&this.fire(new R("rotateend",t)),n&&this.fire(new R("pitchend",t)),o&&this.fire(new R("rollend",t)),this.fire(new R("moveend",t))}flyTo(t,e){if(!t.essential&&ge.prefersReducedMotion){let I=Rn(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(I,e)}this.stop(),"zoom"in(t=G({offset:[0,0],speed:1.2,curve:1.42,easing:El},t))&&this._zoomSnap&&(t.zoom=Ae(t.zoom,this._zoomSnap));let i=this._getTransformForUpdate(),{bearing:r,pitch:n,roll:o,padding:s}=i,a="bearing"in t?this._normalizeBearing(t.bearing,r):r,c="pitch"in t?+t.pitch:n,l="roll"in t?this._normalizeBearing(t.roll,o):o,u="padding"in t?t.padding:i.padding,h=z.convert(t.offset),p=i.centerPoint.add(h),d=i.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(i,{bearing:a,pitch:c,roll:l,padding:u,locationAtOffset:d,offsetAsPoint:h,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),m=t.curve,_=Math.max(i.width,i.height),y=_/f.scaleOfZoom,v=f.pixelPathLength;typeof f.scaleOfMinZoom=="number"&&(m=Math.sqrt(_/f.scaleOfMinZoom/v*2));let g=m*m;function x(I){let C=(y*y-_*_+(I?-1:1)*g*g*v*v)/(2*(I?y:_)*g*v);return Math.log(Math.sqrt(C*C+1)-C)}function b(I){return(Math.exp(I)-Math.exp(-I))/2}function w(I){return(Math.exp(I)+Math.exp(-I))/2}let T=x(!1),P=function(I){return w(T)/w(T+m*I)},S=function(I){return _*((w(T)*(b(C=T+m*I)/w(C))-b(T))/g)/v;var C},E=(x(!0)-T)/m;if(Math.abs(v)<0.000002||!isFinite(E)){if(Math.abs(_-y)<0.000001)return this.easeTo(t,e);let I=y<_?-1:1;E=Math.abs(Math.log(y/_))/m,S=()=>0,P=(C)=>Math.exp(I*m*C)}return t.duration="duration"in t?+t.duration:1000*E/("screenSpeed"in t?+t.screenSpeed/m:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=r!==a,this._pitching=c!==n,this._rolling=l!==o,this._padding=!i.isPaddingEqual(u),this._prepareEase(e,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease((I)=>{let C=I*E,A=1/P(C),M=S(C);this._rotating&&i.setBearing(Ft.number(r,a,I)),this._pitching&&i.setPitch(Ft.number(n,c,I)),this._rolling&&i.setRoll(Ft.number(o,l,I)),this._padding&&(i.interpolatePadding(s,u,I),p=i.centerPoint.add(h)),f.easeFunc(I,A,M,p),this.terrain&&!t.freezeElevation&&this._updateElevation(I),this._applyUpdatedTransform(i),this._fireMoveEvents(e)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(e)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,e){var i;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}return t||(i=this.handlers)===null||i===void 0||i.stop(!1),this}_ease(t,e,i){i.animate===!1||i.duration===0?(t(1),e()):(this._easeStart=St(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=e,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,e){t=Ye(t,-180,180);let i=Math.abs(t-e);return Math.abs(t-360-e)<i&&(t-=360),Math.abs(t+360-e)<i&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(X.convert(t),this.transform):null}}let Zy={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Ku{constructor(t=Zy){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=(e)=>{!e||e.sourceDataType!=="metadata"&&e.sourceDataType!=="visibility"&&e.dataType!=="style"&&e.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=N.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=N.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=N.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){let i=this._map._getUIString(`AttributionControl.${e}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((r)=>typeof r!="string"?"":r)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let e=this._map.style.tileManagers;for(let r in e){let n=e[r];if(n.used||n.usedForTerrain){let o=n.getSource();o.attribution&&!t.includes(o.attribution)&&t.push(o.attribution)}}t=t.filter((r)=>String(r).trim()),t.sort((r,n)=>r.length-n.length),t=t.filter((r,n)=>{for(let o=n+1;o<t.length;o++)if(t[o].includes(r))return!1;return!0});let i=t.join(" | ");if(i!==this._attribHTML){if(this._attribHTML=i,t.length){let r=document.createDocumentFragment(),n=!0;for(let o of t){let s=N.sanitize(o);s.hasChildNodes()&&(n||r.append(" | "),r.append(s),n=!1)}this._innerContainer.replaceChildren(r),this._container.classList.remove("maplibregl-attrib-empty")}else this._container.classList.add("maplibregl-attrib-empty");this._updateCompact(),this._editLink=null}}}class Ju{constructor(t={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let i=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var e;this._map=t,this._compact=(e=this.options)===null||e===void 0?void 0:e.compact,this._container=N.create("div","maplibregl-ctrl");let i=N.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class Gy{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){let e=this._currentlyRunning,i=e?this._queue.concat(e):this._queue;for(let r of i)if(r.id===t)return void(r.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let e=this._currentlyRunning=this._queue;this._queue=[];for(let i of e)if(!i.cancelled&&(i.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var kb=Bt([{name:"a_pos3d",type:"Int16",components:3}]);class qy extends Ht{constructor(t){super(),this._lastTilesetChange=St(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,e){this.tileManager.update(t,e),this._renderableTilesKeys=[];let i={};for(let r of fn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:e,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[r.key]=!0,this._renderableTilesKeys.push(r.key),this._tiles[r.key]||(r.terrainRttPosMatrix32f=new Float64Array(16),si(r.terrainRttPosMatrix32f,0,F,F,0,0,1),this._tiles[r.key]=new ru(r,this.tileSize),this._lastTilesetChange=St());for(let r in this._tiles)i[r]||delete this._tiles[r]}freeRtt(t){for(let e in this._tiles){let i=this._tiles[e];(!t||i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t)=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,e){return e?this._getTerrainCoordsForTileRanges(t,e):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let e={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,n=t.clone(),o=Ai();if(r.canonical.equals(t.canonical))si(o,0,F,F,0,0,1);else if(r.canonical.isChildOf(t.canonical)){let s=r.canonical.z-t.canonical.z,a=r.canonical.x-(r.canonical.x>>s<<s),c=r.canonical.y-(r.canonical.y>>s<<s),l=F>>s;si(o,0,l,l,0,0,1),Ot(o,o,[-a*l,-c*l,0])}else{if(!t.canonical.isChildOf(r.canonical))continue;{let s=t.canonical.z-r.canonical.z,a=t.canonical.x-(t.canonical.x>>s<<s),c=t.canonical.y-(t.canonical.y>>s<<s),l=F>>s;si(o,0,F,F,0,0,1),Ot(o,o,[a*l,c*l,0]),Wt(o,o,[1/2**s,1/2**s,0])}}n.terrainRttPosMatrix32f=new Float32Array(o),e[i]=n}return e}_getTerrainCoordsForTileRanges(t,e){let i={};for(let r of this._renderableTilesKeys){let n=this._tiles[r].tileID;if(!this._isWithinTileRanges(n,e))continue;let o=t.clone(),s=Ai();if(n.canonical.z===t.canonical.z){let a=t.canonical.x-n.canonical.x+t.wrap*(1<<t.canonical.z),c=t.canonical.y-n.canonical.y;si(s,0,F,F,0,0,1),Ot(s,s,[a*F,c*F,0])}else if(n.canonical.z>t.canonical.z){let a=n.canonical.z-t.canonical.z,c=n.canonical.x-(n.canonical.x>>a<<a)+t.wrap*(1<<n.canonical.z),l=n.canonical.y-(n.canonical.y>>a<<a),u=t.canonical.x-(n.canonical.x>>a),h=t.canonical.y-(n.canonical.y>>a),p=F>>a;si(s,0,p,p,0,0,1),Ot(s,s,[-c*p+u*F,-l*p+h*F,0])}else{let a=t.canonical.z-n.canonical.z,c=t.canonical.x-(t.canonical.x>>a<<a)+t.wrap*(1<<t.canonical.z),l=t.canonical.y-(t.canonical.y>>a<<a),u=(t.canonical.x>>a)-n.canonical.x,h=(t.canonical.y>>a)-n.canonical.y,p=F<<a;si(s,0,p,p,0,0,1),Ot(s,s,[c*F+u*p,l*F+h*p,0])}o.terrainRttPosMatrix32f=new Float32Array(s),i[r]=o}return i}getSourceTile(t,e){var i,r;let n=this.tileManager._source,o=t.overscaledZ-this.deltaZoom;if(o>n.maxzoom&&(o=n.maxzoom),o<n.minzoom)return;(i=this._sourceTileCache)[r=t.key]||(i[r]=t.scaledTo(o).key);let s=this.findTileInCaches(this._sourceTileCache[t.key]);if(!(s==null?void 0:s.dem)&&e)for(;o>=n.minzoom&&!(s==null?void 0:s.dem);)s=this.findTileInCaches(t.scaledTo(o--).key);return s}findTileInCaches(t){let e=this.tileManager.getTileByID(t);return e||(e=this.tileManager._outOfViewCache.getByKey(t),e)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,e){let i=e[t.canonical.z];return!!i&&(t.wrap>i.minWrap||t.wrap<i.maxWrap||t.canonical.x>=i.minTileXWrapped&&t.canonical.x<=i.maxTileXWrapped&&t.canonical.y>=i.minTileY&&t.canonical.y<=i.maxTileY)}}class Wy{constructor(t,e,i){this._meshCache={},this.painter=t,this.tileManager=new qy(e),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(let t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,e,i,r=8192){var n;let o=t.normalizeCoordinates(e,i,r);if(!o)return 0;let s=this.getTerrainData(o.tileID),a=(n=s.tile)===null||n===void 0?void 0:n.dem;if(!a)return 0;let c=function(f,m,_){var y=m[0],v=m[1];return f[0]=_[0]*y+_[4]*v+_[12],f[1]=_[1]*y+_[5]*v+_[13],f}([],[o.x/r*F,o.y/r*F],s.u_terrain_matrix),l=[c[0]*a.dim,c[1]*a.dim],u=Math.floor(l[0]),h=Math.floor(l[1]),p=l[0]-u,d=l[1]-h;return a.get(u,h)*(1-p)*(1-d)+a.get(u+1,h)*p*(1-d)+a.get(u,h+1)*(1-p)*d+a.get(u+1,h+1)*p*d}getElevationForLngLatZoom(t,e){if(!Xm(e,t.wrap()))return 0;let{tileID:i,mercatorX:r,mercatorY:n}=this._getOverscaledTileIDFromLngLatZoom(t,e);return this.getElevation(i,r%F,n%F,F)}getElevationForLngLat(t,e){let i=fn(e,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),r=0;for(let n of i)n.canonical.z>r&&(r=Math.min(n.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,r)}getElevation(t,e,i,r=8192){return this.getDEMElevation(t,e,i,r)*this.exaggeration}getTerrainData(t){var e,i;if(!this._emptyDemTexture){let a=this.painter.context,c=new It({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new jt(a,c,a.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(a,new It({width:1,height:1}),a.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=He([])}let r=this.tileManager.getSourceTile(t,!0);if((r==null?void 0:r.dem)&&(!r.demTexture||r.needsTerrainPrepare)){let a=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new jt(a,r.dem.getPixels(),a.gl.RGBA,{premultiply:!1}),r.demTexture.bind(a.gl.NEAREST,a.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}let n=r&&r.toString()+r.tileID.key+t.key;if(n&&!this._demMatrixCache[n]){let a=this.tileManager.getSource().maxzoom,c=t.canonical.z-r.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=a?c=t.canonical.z-a:Ct("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let l=t.canonical.x-(t.canonical.x>>c<<c),u=t.canonical.y-(t.canonical.y>>c<<c),h=((o=new Float64Array(16))[0]=(s=[1/(F<<c),1/(F<<c),0])[0],o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=s[1],o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=s[2],o[11]=0,o[12]=0,o[13]=0,o[14]=0,o[15]=1,o);Ot(h,h,[l*F,u*F,0]),this._demMatrixCache[n]={matrix:h,coord:t}}var o,s;return{u_depth:2,u_terrain:3,u_terrain_dim:((e=r==null?void 0:r.dem)===null||e===void 0?void 0:e.dim)||1,u_terrain_matrix:n?this._demMatrixCache[n].matrix:this._emptyDemMatrix,u_terrain_unpack:((i=r==null?void 0:r.dem)===null||i===void 0?void 0:i.getUnpackVector())||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:((r==null?void 0:r.demTexture)||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(t){let e=this.painter,i=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return!this._fbo||this._fbo.width===i&&this._fbo.height===r||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new jt(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new jt(e.context,{width:i,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(i,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,i,r))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let e=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let n=0,o=0;n<this._coordsTextureSize;n++)for(let s=0;s<this._coordsTextureSize;s++,o+=4)e[o+0]=255&s,e[o+1]=255&n,e[o+2]=s>>8<<4|n>>8,e[o+3]=0;let i=new It({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(e.buffer)),r=new jt(t,i,t.gl.RGBA,{premultiply:!1});return r.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=r,r}pointCoordinate(t){this.painter.maybeDrawDepth(!0),this.painter.maybeDrawCoords();let e=new Uint8Array(4),i=this.painter.context,r=i.gl,n=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),o=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),r.readPixels(n,s-o-1,1,1,r.RGBA,r.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null);let a=e[0]+(e[2]>>4<<8),c=e[1]+((15&e[2])<<8),l=this.coordsIndex[255-e[3]],u=l&&this.tileManager.getTileByID(l);if(!u)return null;let h=this._coordsTextureSize,p=(1<<u.tileID.canonical.z)*h;return new wt((u.tileID.canonical.x*h+a)/p+u.tileID.wrap,(u.tileID.canonical.y*h+c)/p,this.getElevation(u.tileID,a,c,h))}depthAtPoint(t){let e=new Uint8Array(4),i=this.painter.context,r=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),r.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,r.RGBA,r.UNSIGNED_BYTE,e),i.bindFramebuffer.set(null),(e[0]/16777216+e[1]/65536+e[2]/256+e[3])/256}getTerrainMesh(t){var e;let i=((e=this.painter.style.projection)===null||e===void 0?void 0:e.transitionState)>0,r=i&&t.canonical.y===0,n=i&&t.canonical.y===(1<<t.canonical.z)-1,o=`m_${r?"n":""}_${n?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let s=this.painter.context,a=new Qp,c=new Ge,l=this.meshSize,u=F/l,h=l*l;for(let w=0;w<=l;w++)for(let T=0;T<=l;T++)a.emplaceBack(T*u,w*u,0);for(let w=0;w<h;w+=l+1)for(let T=0;T<l;T++)c.emplaceBack(T+w,l+T+w+1,l+T+w+2),c.emplaceBack(T+w,l+T+w+2,T+w+1);let p=a.length,d=p+(l+1),f=(l+1)*l,m=r?cr:0,_=r?0:1,y=n?tn:F,v=n?0:1;for(let w=0;w<=l;w++)a.emplaceBack(w*u,m,_);for(let w=0;w<=l;w++)a.emplaceBack(w*u,y,v);for(let w=0;w<l;w++)c.emplaceBack(f+w,d+w,d+w+1),c.emplaceBack(f+w,d+w+1,f+w+1),c.emplaceBack(0+w,p+w+1,p+w),c.emplaceBack(0+w,0+w+1,p+w+1);let g=a.length,x=g+2*(l+1);for(let w of[0,1])for(let T=0;T<=l;T++)for(let P of[0,1])a.emplaceBack(w*F,T*u,P);for(let w=0;w<2*l;w+=2)c.emplaceBack(g+w,g+w+1,g+w+3),c.emplaceBack(g+w,g+w+3,g+w+2),c.emplaceBack(x+w,x+w+3,x+w+1),c.emplaceBack(x+w,x+w+2,x+w+3);let b=new vr(s.createVertexBuffer(a,kb.members),s.createIndexBuffer(c),xt.simpleSegment(0,0,a.length,c.length));return this._meshCache[o]=b,b}getMeshFrameDelta(t){return 2*Math.PI*mi/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,e){var i;if(!Xm(e,t.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(t,e);return(i=this.getMinMaxElevation(r).minElevation)!==null&&i!==void 0?i:0}getMinMaxElevation(t){let e=this.getTerrainData(t).tile,i={minElevation:null,maxElevation:null};return(e==null?void 0:e.dem)&&(i.minElevation=e.dem.min*this.exaggeration,i.maxElevation=e.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(t,e){let i=wt.fromLngLat(t.wrap()),r=(1<<e)*F,n=i.x*r,o=i.y*r,s=Math.floor(n/F),a=Math.floor(o/F);return{tileID:new Et(e,0,e,s,a),mercatorX:n,mercatorY:o}}}class Hy{constructor(t,e,i){this._context=t,this._size=e,this._tileSize=i,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),i=new jt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(i.texture),{id:t,fbo:e,texture:i,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((e)=>t.id!==e),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t)=>!t.inUse)===!1}}let Tn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Xy{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Hy(t.context,30,e.tileManager.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){var i,r,n;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((o)=>!t._layers[o].isHidden(e)),this._coordsAscending={};for(let o in t.tileManagers){this._coordsAscending[o]={};let s=t.tileManagers[o].getVisibleCoordinates(),a=t.tileManagers[o].getSource(),c=a instanceof pr?a.terrainTileRanges:null;for(let l of s){let u=this.terrain.tileManager.getTerrainCoords(l,c);for(let h in u)(n=this._coordsAscending[o])[h]||(n[h]=[]),this._coordsAscending[o][h].push(u[h])}}this._rttFingerprints={};for(let o of t._order){let s=t._layers[o],a=s.source;if(Tn[s.type]&&!this._rttFingerprints[a]){this._rttFingerprints[a]={};let c=(r=(i=t.tileManagers[a])===null||i===void 0?void 0:i.getState().revision)!==null&&r!==void 0?r:0;for(let l in this._coordsAscending[a])this._rttFingerprints[a][l]=`${this._coordsAscending[a][l].map((u)=>u.key).sort().join()}#${c}`}}for(let o of this._renderableTiles)for(let s in this._rttFingerprints){let a=this._rttFingerprints[s][o.tileID.key];a&&a!==o.rttFingerprint[s]&&(o.rtt=[])}}renderLayer(t,e){if(t.isHidden(this.painter.transform.zoom))return!1;let i=Object.assign(Object.assign({},e),{isRenderingToTexture:!0}),r=t.type,n=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Tn[r]&&(this._prevType&&Tn[this._prevType]||this._stacks.push([]),this._prevType=r,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(Tn[this._prevType]||Tn[r]&&o){this._prevType=r;let s=this._stacks.length-1,a=this._stacks[s]||[];for(let c of this._renderableTiles){if(this.pool.isFull()&&(Py(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(c),c.rtt[s]){let u=this.pool.getObjectForId(c.rtt[s].id);if(u.stamp===c.rtt[s].stamp){this.pool.useObject(u);continue}}let l=this.pool.getOrCreateFreeObject();this.pool.useObject(l),this.pool.stampObject(l),c.rtt[s]={id:l.id,stamp:l.stamp},n.context.bindFramebuffer.set(l.fbo.framebuffer),n.context.clear({color:Y.transparent,stencil:0}),n.currentStencilSource=void 0;for(let u of a){let h=n.style._layers[u],p=h.source?this._coordsAscending[h.source][c.tileID.key]:[c.tileID];n.context.viewport.set([0,0,l.fbo.width,l.fbo.height]),n._renderTileClippingMasks(h,p,!0),n.renderLayer(n,n.style.tileManagers[h.source],h,p,i),h.source&&(c.rttFingerprint[h.source]=this._rttFingerprints[h.source][c.tileID.key])}}return Py(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],this.pool.freeAllObjects(),Tn[r]}return!1}}let Lb={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},Fb=ad,Yy={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Zy,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:ze.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20},Ky=class extends $y{get _ownerWindow(){var t,e;return((e=(t=this._container)===null||t===void 0?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView)||window}constructor(t){var e,i,r;let n=Object.assign(Object.assign(Object.assign({},Yy),t),{canvasContextAttributes:Object.assign(Object.assign({},Yy.canvasContextAttributes),t.canvasContextAttributes)});if(n.minZoom!=null&&n.maxZoom!=null&&n.minZoom>n.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(n.minPitch!=null&&n.maxPitch!=null&&n.minPitch>n.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(n.minPitch!=null&&n.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(n.maxPitch!=null&&n.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");let o=new gn,s=new No;n.minZoom!==void 0&&o.setMinZoom(n.minZoom),n.maxZoom!==void 0&&o.setMaxZoom(n.maxZoom),n.minPitch!==void 0&&o.setMinPitch(n.minPitch),n.maxPitch!==void 0&&o.setMaxPitch(n.maxPitch),n.renderWorldCopies!==void 0&&o.setRenderWorldCopies(n.renderWorldCopies),n.transformConstrain!==null&&o.setConstrainOverride(n.transformConstrain),super(o,s,{bearingSnap:n.bearingSnap,zoomSnap:n.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new Gy,this._controls=[],this._mapId=wd(),this._lostContextStyle={style:null,images:null},this._contextLost=(c)=>{if(c.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(let l of Object.values(this.style._layers))if(l.type==="custom"&&console.warn(`Custom layer with id '${l.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),l._listeners)for(let[u]of Object.entries(l._listeners))console.warn(`Custom layer with id '${l.id}' had event listeners for event '${u}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new R("webglcontextlost",{originalEvent:c}))}else this.fire(new R("webglcontextlost",{originalEvent:c}))},this._contextRestored=(c)=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new R("webglcontextrestored",{originalEvent:c}))},this._onMapScroll=(c)=>{if(c.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},n.canvasContextAttributes),this._trackResize=n.trackResize===!0,this._bearingSnap=n.bearingSnap,this._zoomSnap=n.zoomSnap,this._centerClampedToGround=n.centerClampedToGround,this._refreshExpiredTiles=n.refreshExpiredTiles===!0,this._fadeDuration=n.fadeDuration,this._crossSourceCollisions=n.crossSourceCollisions===!0,this._collectResourceTiming=n.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Lb),n.locale),this._clickTolerance=n.clickTolerance,this._overridePixelRatio=n.pixelRatio,this._maxCanvasSize=n.maxCanvasSize,this._zoomLevelsToOverscale=n.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=n.transformCameraUpdate,this.transformConstrain=n.transformConstrain,this.cancelPendingTileRequestsWhileZooming=n.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(n.anisotropicFilterPitch),n.reduceMotion!==void 0&&(ge.prefersReducedMotion=n.reduceMotion),this._imageQueueHandle=ci.addThrottleControl(()=>this.isMoving()),this._requestManager=new kd(n.transformRequest),this._container=this._resolveContainer(n.container),n.maxBounds&&this.setMaxBounds(n.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new Uy(this,n),this._hash=n.hash?new Lu(typeof n.hash=="string"&&n.hash||void 0).addTo(this):void 0,((e=this._hash)===null||e===void 0?void 0:e._onHashChange())||(this.jumpTo({center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,roll:n.roll}),n.bounds&&(this.resize(),this.fitBounds(n.bounds,G({},n.fitBoundsOptions,{duration:0}))));let a=typeof n.style=="string"||((r=(i=n.style)===null||i===void 0?void 0:i.projection)===null||r===void 0?void 0:r.type)!=="globe";this.resize(null,a),this._localIdeographFontFamily=n.localIdeographFontFamily,this._validateStyle=n.validateStyle,n.style&&this.setStyle(n.style,{localIdeographFontFamily:n.localIdeographFontFamily}),n.attributionControl&&this.addControl(new Ku(typeof n.attributionControl=="boolean"?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Ju,n.logoPosition),this.on("style.load",()=>{if(a||this._resizeTransform(),this.transform.unmodified){let c=Rn(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(c)}}),this.on("data",(c)=>{this._update(c.dataType==="style"),this.fire(new R(`${c.dataType}data`,c))}),this.on("dataloading",(c)=>{this.fire(new R(`${c.dataType}dataloading`,c))}),this.on("dataabort",(c)=>{this.fire(new R("sourcedataabort",c))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,e){return this.style.setGlobalStateProperty(t,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,e){if(e===void 0&&(e=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!(t==null?void 0:t.onAdd))return this.fire(new J(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let r=this._controlPositions[e];return e.includes("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(t){if(!(t==null?void 0:t.onRemove))return this.fire(new J(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let e=this._controls.indexOf(t);return e>-1&&this._controls.splice(e,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return fn(this.transform,t)}calculateCameraOptionsFromTo(t,e,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this.transform)),super.calculateCameraOptionsFromTo(t,e,i,r)}resize(t,e=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(e);let i=!this._moving;return i&&(this.stop(),this.fire(new R("movestart",t)).fire(new R("move",t))),this.fire(new R("resize",t)),i&&this.fire(new R("moveend",t)),this}_resizeInternal(t=!0){let[e,i]=this._containerDimensions(),r=this._getClampedPixelRatio(e,i);if(this._resizeCanvas(e,i,r),this.painter.resize(e,i,r),this.painter.overLimit()){let n=this.painter.context.gl;this._maxCanvasSize=[n.drawingBufferWidth,n.drawingBufferHeight];let o=this._getClampedPixelRatio(e,i);this._resizeCanvas(e,i,o),this.painter.resize(e,i,o)}this._resizeTransform(t)}_resizeTransform(t=!0){var e;let[i,r]=this._containerDimensions();this.transform.resize(i,r,t),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,r,t)}_getClampedPixelRatio(t,e){let{0:i,1:r}=this._maxCanvasSize,n=this.getPixelRatio(),o=t*n,s=e*n;return Math.min(o>i?i/o:1,s>r?r/s:1)*n}getPixelRatio(){var t;return(t=this._overridePixelRatio)!==null&&t!==void 0?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(Kt.convert(t)),this._update()}setMinZoom(t){if((t=t==null?-2:t)>=-2&&t<=this.transform.maxZoom){let e=this.transform.zoom,i=this._getTransformForUpdate();return i.setMinZoom(t),this._applyUpdatedTransform(i),this._update(),e!==this.transform.zoom&&this.fire(new R("zoomstart")).fire(new R("zoom")).fire(new R("zoomend")).fire(new R("movestart")).fire(new R("move")).fire(new R("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if((t=t==null?22:t)>=this.transform.minZoom){let e=this.transform.zoom,i=this._getTransformForUpdate();return i.setMaxZoom(t),this._applyUpdatedTransform(i),this._update(),e!==this.transform.zoom&&this.fire(new R("zoomstart")).fire(new R("zoom")).fire(new R("zoomend")).fire(new R("movestart")).fire(new R("move")).fire(new R("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if((t=t==null?0:t)<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch){let e=this.transform.pitch,i=this._getTransformForUpdate();return i.setMinPitch(t),this._applyUpdatedTransform(i),this._update(),e!==this.transform.pitch&&this.fire(new R("pitchstart")).fire(new R("pitch")).fire(new R("pitchend")).fire(new R("movestart")).fire(new R("move")).fire(new R("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if((t=t==null?60:t)>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this.transform.minPitch){let e=this.transform.pitch,i=this._getTransformForUpdate();return i.setMaxPitch(t),this._applyUpdatedTransform(i),this._update(),e!==this.transform.pitch&&this.fire(new R("pitchstart")).fire(new R("pitch")).fire(new R("pitchend")).fire(new R("movestart")).fire(new R("move")).fire(new R("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if((t=t==null?20:t)>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this.transform.setConstrainOverride(t),this._update()}project(t){return this.transform.locationToScreenPoint(X.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.screenPointToLocation(z.convert(t),this.terrain)}isMoving(){var t;return this._moving||((t=this.handlers)===null||t===void 0?void 0:t.isMoving())}isZooming(){var t;return this._zooming||((t=this.handlers)===null||t===void 0?void 0:t.isZooming())}isRotating(){var t;return this._rotating||((t=this.handlers)===null||t===void 0?void 0:t.isRotating())}_createDelegatedListener(t,e,i){if(t==="mouseenter"||t==="mouseover"){let r=!1;return{layers:e,listener:i,delegates:{mousemove:(o)=>{let s=e.filter((c)=>this.getLayer(c)),a=s.length!==0?this.queryRenderedFeatures(o.point,{layers:s}):[];a.length?r||(r=!0,i.call(this,new Ee(t,this,o.originalEvent,{features:a}))):r=!1},mouseout:()=>{r=!1}}}}if(t==="mouseleave"||t==="mouseout"){let r=!1;return{layers:e,listener:i,delegates:{mousemove:(s)=>{let a=e.filter((c)=>this.getLayer(c));(a.length!==0?this.queryRenderedFeatures(s.point,{layers:a}):[]).length?r=!0:r&&(r=!1,i.call(this,new Ee(t,this,s.originalEvent)))},mouseout:(s)=>{r&&(r=!1,i.call(this,new Ee(t,this,s.originalEvent)))}}}}{let r=(n)=>{let o=e.filter((a)=>this.getLayer(a)),s=o.length!==0?this.queryRenderedFeatures(n.point,{layers:o}):[];s.length&&(n.features=s,i.call(this,n),delete n.features)};return{layers:e,listener:i,delegates:{[t]:r}}}}_saveDelegatedListener(t,e){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[t]||(i[t]=[]),this._delegatedListeners[t].push(e)}_removeDelegatedListener(t,e,i){var r;if(!((r=this._delegatedListeners)===null||r===void 0?void 0:r[t]))return;let n=this._delegatedListeners[t];for(let o=0;o<n.length;o++){let s=n[o];if(s.listener===i&&s.layers.length===e.length&&s.layers.every((a)=>e.includes(a))){for(let a in s.delegates)this.off(a,s.delegates[a]);return void n.splice(o,1)}}}on(t,e,i){if(i===void 0)return super.on(t,e);let r=typeof e=="string"?[e]:e,n=this._createDelegatedListener(t,r,i);this._saveDelegatedListener(t,n);for(let o in n.delegates)this.on(o,n.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(t,r,i)}}}once(t,e,i){if(i===void 0)return super.once(t,e);let r=typeof e=="string"?[e]:e,n=this._createDelegatedListener(t,r,i);for(let o in n.delegates){let s=n.delegates[o];n.delegates[o]=(...a)=>{this._removeDelegatedListener(t,r,i),s(...a)}}this._saveDelegatedListener(t,n);for(let o in n.delegates)this.once(o,n.delegates[o]);return this}off(t,e,i){return i===void 0?super.off(t,e):(this._removeDelegatedListener(t,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(t,e){if(!this.style)return[];let i,r=t instanceof z||Array.isArray(t),n=r?t:[[0,0],[this.transform.width,this.transform.height]];if(e||(e=(r?{}:t)||{}),n instanceof z||typeof n[0]=="number")i=[z.convert(n)];else{let o=z.convert(n[0]),s=z.convert(n[1]);i=[o,new z(s.x,o.y),s,new z(o.x,s.y),o]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(t,e){return this.style.querySourceFeatures(t,e)}setStyle(t,e){return(e=G({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(t,e))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let e=this._locale[t];if(e==null)throw Error(`Missing UI string '${t}'`);return e}_updateStyle(t,e){var i,r,n;if((i=this._diffStyleRequest)===null||i===void 0||i.abort(),this._diffStyleRequest=null,e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,e));let o=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t?(this.style=new el(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof t=="string"?this.style.loadURL(t,e,o):this.style.loadJSON(t,e,o),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(n=(r=this.style)===null||r===void 0?void 0:r.projection)===null||n===void 0||n.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new el(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,e){return it(this,void 0,void 0,function*(){var i;if((i=this._diffStyleRequest)===null||i===void 0||i.abort(),typeof t=="string"){let r=t;this._diffStyleRequest=new AbortController;let n=this._diffStyleRequest;try{let o=yield this._requestManager.transformRequest(r,"Style");if(n.signal.aborted)return void(this._diffStyleRequest=null);let s=yield ns(o,n);this._diffStyleRequest=null,this._updateDiff(s.data,e)}catch(o){this._diffStyleRequest=null,Ar(o)||this.fire(new J(me(o)))}}else typeof t=="object"&&(this._diffStyleRequest=null,this._updateDiff(t,e))})}_updateDiff(t,e){try{this.style.setState(t,e)&&this._update(!0)}catch(i){Ct(`Unable to perform style diff: ${me(i).message}. Rebuilding the style from scratch.`),this._updateStyle(t,e)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(this.style)return this.style.loaded();Ct("There is no style added to the map.")}addSource(t,e){return this._lazyInitEmptyStyle(),this.style.addSource(t,e),this._update(!0)}isSourceLoaded(t){var e;let i=(e=this.style)===null||e===void 0?void 0:e.tileManagers[t];if(i!==void 0)return i.loaded();this.fire(new J(Error(`There is no tile manager with ID '${t}'`)))}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let e=this.style.tileManagers[t.source];if(!e)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain===null&&e.reload();for(let i in this.style._layers){let r=this.style._layers[i];r.type==="hillshade"&&r.source===t.source&&Ct("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),r.type==="color-relief"&&r.source===t.source&&Ct("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Wy(this.painter,e,t),this.painter.renderToTexture=new Xy(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=(i)=>{var r;i.dataType==="style"?this.terrain.tileManager.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==t.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((r=i.source)===null||r===void 0?void 0:r.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new R("terrain",{terrain:t})),this}getTerrain(){var t,e;return(e=(t=this.terrain)===null||t===void 0?void 0:t.options)!==null&&e!==void 0?e:null}areTilesLoaded(){var t;let e=(t=this.style)===null||t===void 0?void 0:t.tileManagers;for(let i of Object.values(e))if(!i.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}setSourceTileLodParams(t,e,i){if(i){let r=this.getSource(i);if(!r)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=su(Math.max(1,t),Math.max(1,e))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=su(Math.max(1,t),Math.max(1,e));return this._update(!0),this}refreshTiles(t,e){let i=this.style.tileManagers[t];if(!i)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);e===void 0?i.reload(!0):i.refreshTiles(e.map((r)=>new Mo(r.z,r.x,r.y)))}addImage(t,e,i={}){let{pixelRatio:r=1,sdf:n=!1,stretchX:o,stretchY:s,content:a,textFitWidth:c,textFitHeight:l}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||Yi(e))){if(e.width===void 0||e.height===void 0)return this.fire(new J(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{let{width:u,height:h,data:p}=e,d=e;return this.style.addImage(t,{data:new It({width:u,height:h},new Uint8Array(p)),pixelRatio:r,stretchX:o,stretchY:s,content:a,textFitWidth:c,textFitHeight:l,sdf:n,version:0,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}{let{width:u,height:h,data:p}=ge.getImageData(e);this.style.addImage(t,{data:new It({width:u,height:h},p),pixelRatio:r,stretchX:o,stretchY:s,content:a,textFitWidth:c,textFitHeight:l,sdf:n,version:0})}}updateImage(t,e){let i=this.style.getImage(t);if(!i)return this.fire(new J(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let r=e instanceof HTMLImageElement||Yi(e)?ge.getImageData(e):e,{width:n,height:o,data:s}=r;if(n===void 0||o===void 0)return this.fire(new J(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||o!==i.data.height)return this.fire(new J(Error("The width and height of the updated image must be that same as the previous version of the image")));let a=!(e instanceof HTMLImageElement||Yi(e));return i.data.replace(s,a),this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new J(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return it(this,void 0,void 0,function*(){return ci.getImage(yield this._requestManager.transformRequest(t,"Image"),new AbortController)})}listImages(){return this.style.listImages()}addLayer(t,e){return this._lazyInitEmptyStyle(),this.style.addLayer(t,e),this._update(!0)}moveLayer(t,e){return this.style.moveLayer(t,e),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,e,i){return this.style.setLayerZoomRange(t,e,i),this._update(!0)}setFilter(t,e,i={}){return this.style.setFilter(t,e,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,e,i,r={}){return this.style.setPaintProperty(t,e,i,r),this._update(!0)}getPaintProperty(t,e){return this.style.getPaintProperty(t,e)}setLayoutProperty(t,e,i,r={}){return this.style.setLayoutProperty(t,e,i,r),this._update(!0)}getLayoutProperty(t,e){return this.style.getLayoutProperty(t,e)}setGlyphs(t,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,e,i,(r)=>{r||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,e,(i)=>{i||this._update(!0)}),this}setLight(t,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,e){return this.style.setFeatureState(t,e),this._update()}removeFeatureState(t,e){return this.style.removeFeatureState(t,e),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,e=0;return this._container&&(t=this._container.clientWidth||400,e=this._container.clientHeight||300),[t,e]}_setupResizeObserver(){var t;let e=!1,i=Ey((n)=>{this._trackResize&&!this._removed&&(this.resize(n),this.redraw())},50),r=(t=this._ownerWindow.ResizeObserver)!==null&&t!==void 0?t:ResizeObserver;this._resizeObserver=new r((n)=>{e?i(n):e=!0}),this._resizeObserver.observe(this._container)}_resolveContainer(t){if(typeof t=="string"){let e=document.getElementById(t);if(!e)throw Error(`Container '${t}' not found.`);return e}if(t instanceof HTMLElement)return t;if(t&&typeof t=="object"&&t.nodeType===1)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let e=this._canvasContainer=N.create("div","maplibregl-canvas-container",t);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=N.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),r=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],r);let n=this._controlContainer=N.create("div","maplibregl-control-container",t),o=this._controlPositions={};for(let s of["top-left","top-right","bottom-left","bottom-right"])o[s]=N.create("div",`maplibregl-ctrl-${s} `,n);this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(t,e,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${e}px`}_setupPainter(){let t=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),e=null;this._canvas.addEventListener("webglcontextcreationerror",(r)=>{e={requestedAttributes:t},r&&(e.statusMessage=r.statusMessage,e.type=r.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,t):this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t),!i)throw e?(e.message="Failed to initialize WebGL",Error(JSON.stringify(e))):Error("Failed to initialize WebGL");this.painter=new ll(i,this.transform)}migrateProjection(t,e){super.migrateProjection(t,e),this.painter.transform=t,this.fire(new R("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){var e;return((e=this.style)===null||e===void 0?void 0:e._loaded)?(this._styleDirty||(this._styleDirty=t),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var e,i,r,n,o,s;let a=this._idleTriggered?this._fadeDuration:0,c=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let l=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let p=this.transform.zoom,d=St();this.style.zoomHistory.update(p,d);let f=new At(p,{now:d,fadeDuration:a,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),m=f.crossFadingFactor();m===1&&m===this._crossFadingFactor||(l=!0,this._crossFadingFactor=m),this.style.update(f)}let u=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==c;(r=this.style.projection)===null||r===void 0||r.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((n=this.style.projection)===null||n===void 0?void 0:n.transitionState,(o=this.style.projection)===null||o===void 0?void 0:o.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=(s=this.style)===null||s===void 0?void 0:s._updatePlacement(this.transform,this.showCollisionBoxes,a,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:a,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new R("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new R("load"))),this.style&&(this.style.hasTransitions()||l)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let h=this._sourcesDirty||this._styleDirty||this._placementDirty;return h||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new R("idle")),!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var t,e;this._hash&&this._hash.remove();for(let r of this._controls)r.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(t=this._diffStyleRequest)===null||t===void 0||t.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),ci.removeThrottleControl(this._imageQueueHandle),(e=this._resizeObserver)===null||e===void 0||e.disconnect();let i=this.painter.context.gl.getExtension("WEBGL_lose_context");(i==null?void 0:i.loseContext)&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),this._removed=!0,this.fire(new R("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ge.frame(this._frameRequest,(t)=>{this._frameRequest=null;try{this._render(t)}catch(e){if(!Ar(e)&&!function(i){return i.message===dy}(e))throw e}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return Fb}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},Bb={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Jy{constructor(t,e,i=!1){this.mousedown=(n)=>{this.startMove(n,N.mousePos(this.element,n)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=(n)=>{this.move(n,N.mousePos(this.element,n))},this.mouseup=(n)=>{this._rotatePitchHandler.dragEnd(n),this.offTemp()},this.touchstart=(n)=>{n.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=N.touchPos(this.element,n.targetTouches)[0],this.startMove(n,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=(n)=>{n.targetTouches.length!==1?this.reset():(this._lastPos=N.touchPos(this.element,n.targetTouches)[0],this.move(n,this._lastPos))},this.touchend=(n)=>{n.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=e;let r=new ky;this._rotatePitchHandler=new bn({clickTolerance:3,move:(n,o)=>{let s=e.getBoundingClientRect(),a=new z((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:Ed(new z(n.x,o.y),o,a),pitchDelta:i?-0.5*(o.y-n.y):void 0}},moveStateManager:r,enable:!0,assignEvents:()=>{}}),this.map=t,e.addEventListener("mousedown",this.mousedown),e.addEventListener("touchstart",this.touchstart,{passive:!1}),e.addEventListener("touchcancel",this.reset)}startMove(t,e){this._rotatePitchHandler.dragStart(t,e),N.disableDrag()}move(t,e){let i=this.map,{bearingDelta:r,pitchDelta:n}=this._rotatePitchHandler.dragMove(t,e)||{};r&&i.setBearing(i.getBearing()+r),n&&i.setPitch(i.getPitch()+n)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){N.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let xr;function Qy(t,e,i,r=!1){if(r||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return t==null?void 0:t.wrap();let n=new X(t.lng,t.lat);if(t=new X(t.lng,t.lat),e){let o=new X(t.lng-360,t.lat),s=new X(t.lng+360,t.lat),a=i.locationToScreenPoint(t).distSqr(e);i.locationToScreenPoint(o).distSqr(e)<a?t=o:i.locationToScreenPoint(s).distSqr(e)<a&&(t=s)}for(;Math.abs(t.lng-i.center.lng)>180;){let o=i.locationToScreenPoint(t);if(o.x>=0&&o.y>=0&&o.x<=i.width&&o.y<=i.height)break;t.lng>i.center.lng?t.lng-=360:t.lng+=360}return t.lng!==n.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(t))?t:n}let Qu={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function t0(t,e,i){let r=t.classList;for(let n in Qu)r.remove(`maplibregl-${i}-anchor-${n}`);r.add(`maplibregl-${i}-anchor-${e}`)}class fl extends Ht{constructor(t){if(super(),this._onClick=(e)=>{this.fire(new R("click",{originalEvent:e}))},this._onKeyPress=(e)=>{e.code!=="Space"&&e.code!=="Enter"||this.togglePopup()},this._onMapClick=(e)=>{let i=e.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._update=(e)=>{if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();((e==null?void 0:e.type)==="terrain"||(e==null?void 0:e.type)==="render"&&!i)&&this._map.once("render",this._update),this._lngLat=Qy(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let r="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?r=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(r=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?n="rotateX(0deg)":this._pitchAlignment==="map"&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||e&&e.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${Qu[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${r}`,ge.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity((e==null?void 0:e.type)==="moveend")}).catch(()=>{})},this._onMove=(e)=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new R("dragstart"))),this.fire(new R("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new R("dragend")),this._state="inactive"},this._addDragHandler=(e)=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=(t==null?void 0:t.anchor)||"center",this._color=(t==null?void 0:t.color)||"#3FB1CE",this._scale=(t==null?void 0:t.scale)||1,this._draggable=(t==null?void 0:t.draggable)||!1,this._clickTolerance=(t==null?void 0:t.clickTolerance)||0,this._subpixelPositioning=(t==null?void 0:t.subpixelPositioning)||!1,this._isDragging=!1,this._state="inactive",this._rotation=(t==null?void 0:t.rotation)||0,this._rotationAlignment=(t==null?void 0:t.rotationAlignment)||"auto",this._pitchAlignment=(t==null?void 0:t.pitchAlignment)&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t==null?void 0:t.opacity,t==null?void 0:t.opacityWhenCovered),t==null?void 0:t.element)this._element=t.element,this._offset=z.convert((t==null?void 0:t.offset)||[0,0]);else{this._defaultMarker=!0,this._element=N.create("div");let e=N.createNS("http://www.w3.org/2000/svg","svg"),i=41,r=27;e.setAttributeNS(null,"display","block"),e.setAttributeNS(null,"height",`${i}px`),e.setAttributeNS(null,"width",`${r}px`),e.setAttributeNS(null,"viewBox",`0 0 ${r} ${i}`);let n=N.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"stroke","none"),n.setAttributeNS(null,"stroke-width","1"),n.setAttributeNS(null,"fill","none"),n.setAttributeNS(null,"fill-rule","evenodd");let o=N.createNS("http://www.w3.org/2000/svg","g");o.setAttributeNS(null,"fill-rule","nonzero");let s=N.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");let a=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let _ of a){let y=N.createNS("http://www.w3.org/2000/svg","ellipse");y.setAttributeNS(null,"opacity","0.04"),y.setAttributeNS(null,"cx","10.5"),y.setAttributeNS(null,"cy","5.80029008"),y.setAttributeNS(null,"rx",_.rx),y.setAttributeNS(null,"ry",_.ry),s.appendChild(y)}let c=N.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);let l=N.createNS("http://www.w3.org/2000/svg","path");l.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),c.appendChild(l);let u=N.createNS("http://www.w3.org/2000/svg","g");u.setAttributeNS(null,"opacity","0.25"),u.setAttributeNS(null,"fill","#000000");let h=N.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),u.appendChild(h);let p=N.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");let d=N.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(8.0, 8.0)");let f=N.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");let m=N.createNS("http://www.w3.org/2000/svg","circle");m.setAttributeNS(null,"fill","#FFFFFF"),m.setAttributeNS(null,"cx","5.5"),m.setAttributeNS(null,"cy","5.5"),m.setAttributeNS(null,"r","5.4999962"),d.appendChild(f),d.appendChild(m),o.appendChild(s),o.appendChild(c),o.appendChild(u),o.appendChild(p),o.appendChild(d),e.appendChild(o),e.setAttributeNS(null,"height",i*this._scale+"px"),e.setAttributeNS(null,"width",r*this._scale+"px"),this._element.appendChild(e),this._offset=z.convert((t==null?void 0:t.offset)||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e)=>{e.preventDefault()}),this._element.addEventListener("mousedown",(e)=>{e.preventDefault()}),t0(this._element,this._anchor,"marker"),t==null?void 0:t.className)for(let e of t.className.split(" "))this._element.classList.add(e);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=X.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let r=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var e,i;let r=(e=this._map)===null||e===void 0?void 0:e.terrain,n=this._map.transform.isLocationOccluded(this._lngLat);if(!r||n){let p=n?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==p&&(this._element.style.opacity=p,this._element.classList.toggle("maplibregl-marker-covered",n)))}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,s=o.terrain.depthAtPoint(this._pos),a=o.terrain.getElevationForLngLat(this._lngLat,o.transform);if(o.transform.lngLatToCameraDepth(this._lngLat,a)-s<0.006)return this._element.style.opacity=this._opacity,void this._element.classList.remove("maplibregl-marker-covered");let c=-this._offset.y/o.transform.pixelsPerMeter,l=Math.sin(o.getPitch()*Math.PI/180)*c,u=o.terrain.depthAtPoint(new z(this._pos.x,this._pos.y-this._offset.y)),h=o.transform.lngLatToCameraDepth(this._lngLat,a+l)-u>0.006;((i=this._popup)===null||i===void 0?void 0:i.isOpen())&&h&&this._popup.remove(),this._element.style.opacity=h?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",h)}getOffset(){return this._offset}setOffset(t){return this._offset=z.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,e){return(this._opacity===void 0||t===void 0&&e===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=String(t)),e!==void 0&&(this._opacityWhenCovered=String(e)),this._map&&this._updateOpacity(!0),this}}let Ob={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6000},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ml=0,Zo=!1,jb={maxWidth:100,unit:"metric"};function e0(t,e,i){let r=(i==null?void 0:i.maxWidth)||100,n=t._container.clientHeight/2,o=t._container.clientWidth/2,s=t.unproject([o-r/2,n]),a=t.unproject([o+r/2,n]),c=Math.round(t.project(a).x-t.project(s).x),l=Math.min(r,c,t._container.clientWidth),u=s.distanceTo(a);if((i==null?void 0:i.unit)==="imperial"){let h=3.2808*u;h>5280?Go(e,l,h/5280,t._getUIString("ScaleControl.Miles")):Go(e,l,h,t._getUIString("ScaleControl.Feet"))}else(i==null?void 0:i.unit)==="nautical"?Go(e,l,u/1852,t._getUIString("ScaleControl.NauticalMiles")):u>=1000?Go(e,l,u/1000,t._getUIString("ScaleControl.Kilometers")):Go(e,l,u,t._getUIString("ScaleControl.Meters"))}function Go(t,e,i,r){let n=function(o){let s=Math.pow(10,`${Math.floor(o)}`.length-1),a=o/s;return a=a>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(c){let l=Math.pow(10,Math.ceil(-Math.log(c)/Math.LN10));return Math.round(c*l)/l}(a),s*a}(i);t.style.width=e*(n/i)+"px",t.innerHTML=`${n}&nbsp;${r}`}let Nb={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Vb=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function i0(t){if(t){if(typeof t=="number"){let e=Math.round(Math.abs(t)/Math.SQRT2);return{center:new z(0,0),top:new z(0,t),"top-left":new z(e,e),"top-right":new z(-e,e),bottom:new z(0,-t),"bottom-left":new z(e,-e),"bottom-right":new z(-e,-e),left:new z(t,0),right:new z(-t,0)}}if(t instanceof z||Array.isArray(t)){let e=z.convert(t);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:z.convert(t.center||[0,0]),top:z.convert(t.top||[0,0]),"top-left":z.convert(t["top-left"]||[0,0]),"top-right":z.convert(t["top-right"]||[0,0]),bottom:z.convert(t.bottom||[0,0]),"bottom-left":z.convert(t["bottom-left"]||[0,0]),"bottom-right":z.convert(t["bottom-right"]||[0,0]),left:z.convert(t.left||[0,0]),right:z.convert(t.right||[0,0])}}return i0(new z(0,0))}let Ub=ad;W.AJAXError=zr,W.AttributionControl=Ku,W.BoxZoomHandler=Bu,W.CanvasSource=Ch,W.CooperativeGesturesHandler=Xu,W.DoubleClickZoomHandler=Gu,W.DragPanHandler=qu,W.DragRotateHandler=Wu,W.EXTENT=F,W.EdgeInsets=jo,W.Event=R,W.Evented=Ht,W.FullscreenControl=class extends Ht{constructor(t={}){var e;super(),this._onFullscreenChange=()=>{var i;let r=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;(i=r==null?void 0:r.shadowRoot)===null||i===void 0?void 0:i.fullscreenElement;)r=r.shadowRoot.fullscreenElement;r===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(e=t.pseudo)!==null&&e!==void 0&&e,(t==null?void 0:t.container)&&(t.container instanceof HTMLElement?this._container=t.container:Ct("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":("onmozfullscreenchange"in document)?this._fullscreenchange="mozfullscreenchange":("onwebkitfullscreenchange"in document)?this._fullscreenchange="webkitfullscreenchange":("onmsfullscreenchange"in document)&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=N.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);N.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new R("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new R("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},W.GeoJSONSource=Eh,W.GeolocateControl=class extends Ht{constructor(t){super(),this._onSuccess=(e)=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new R("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new R("geolocate",e)),this._finish()}},this._updateCamera=(e)=>{let i=new X(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,n=G({bearing:this._map.getBearing()},this.options.fitBoundsOptions),o=Kt.fromLngLat(i,r);this._map.fitBounds(o,n,{geolocateSource:!0})},this._updateMarker=(e)=>{if(e){let i=new X(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=(e)=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Zo)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new R("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=(e)=>{if(!this._map)return;let i=(e==null?void 0:e[0])instanceof ResizeObserverEntry;e.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new R("trackuserlocationend")),this.fire(new R("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(e)=>{e.preventDefault()}),this._geolocateButton=N.create("button","maplibregl-ctrl-geolocate",this._container),N.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=(e)=>{if(this._map){if(e===!1){Ct("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=N.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new fl({element:this._dotElement}),this._circleElement=N.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new fl({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=G({},Ob,t)}onAdd(t){return this._map=t,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return it(this,arguments,void 0,function*(e=!1){if(xr!==void 0&&!e)return xr;if(window.navigator.permissions===void 0)return xr=!!window.navigator.geolocation,xr;try{xr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch(i){xr=!!window.navigator.geolocation}return xr})}().then((e)=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,ml=0,Zo=!1}_isOutOfMapMaxBounds(t){let e=this._map.getMaxBounds(),i=t.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let t=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&t))return;let e=this._map.project(t),i=this._map.unproject([e.x+100,e.y]),r=t.distanceTo(i)/100,n=2*this._accuracy/r;this._circleElement.style.width=`${n.toFixed(2)}px`,this._circleElement.style.height=`${n.toFixed(2)}px`}trigger(){if(!this._setup)return Ct("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new R("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ml--,Zo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new R("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new R("trackuserlocationstart")),this.fire(new R("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ml++,ml>1?(t={maximumAge:600000,timeout:0},Zo=!0):(t=this.options.positionOptions,Zo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},W.GlobeControl=class{constructor(){this._toggleProjection=()=>{var t;let e=(t=this._map.getProjection())===null||t===void 0?void 0:t.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((t=this._map.getProjection())===null||t===void 0?void 0:t.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=N.create("button","maplibregl-ctrl-globe",this._container),N.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},W.Hash=Lu,W.ImageSource=pr,W.KeyboardHandler=$u,W.LngLat=X,W.LngLatBounds=Kt,W.LogoControl=Ju,W.Map=Ky,W.MapLibreMap=Ky,W.MapMouseEvent=Ee,W.MapTouchEvent=vn,W.MapWheelEvent=Fu,W.Marker=fl,W.MercatorCoordinate=wt,W.NavigationControl=class{constructor(t){this._updateZoomButtons=()=>{let e=this._map.getZoom(),i=e===this._map.getMaxZoom(),r=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),0.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),0.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{let r=this._map._getUIString(`NavigationControl.${i}`);e.title=r,e.setAttribute("aria-label",r)},this.options=G({},Bb,t),this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e)=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e)=>this._map.zoomIn({},{originalEvent:e})),N.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e)=>this._map.zoomOut({},{originalEvent:e})),N.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e)=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=N.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Jy(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){let i=N.create("button",t,this._container);return i.type="button",i.addEventListener("click",e),i}},W.Point=z,W.Popup=class extends Ht{constructor(t){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new R("close"))),this),this._update=(e)=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=N.create("div","maplibregl-popup",this._map.getContainer()),this._tip=N.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let a of this.options.className.split(" "))this._container.classList.add(a);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let i;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Qy(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),e&&"point"in e&&e.point&&(i=e.point),this._trackPointer&&!i)return;let r=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map.transform.locationToScreenPoint(this._lngLat));let n=this.options.anchor,o=i0(this.options.offset);if(!n){let a=this._container.offsetWidth,c=this._container.offsetHeight,l=function(h){var p,d,f,m;return h?{top:(p=h.top)!==null&&p!==void 0?p:0,right:(d=h.right)!==null&&d!==void 0?d:0,bottom:(f=h.bottom)!==null&&f!==void 0?f:0,left:(m=h.left)!==null&&m!==void 0?m:0}:{top:0,right:0,bottom:0,left:0}}(this.options.padding),u;u=r.y+o.bottom.y<c+l.top?["top"]:r.y>this._map.transform.height-c-l.bottom?["bottom"]:[],r.x<a/2+l.left?u.push("left"):r.x>this._map.transform.width-a/2-l.right&&u.push("right"),n=u.length===0?"bottom":u.join("-")}let s=r.add(o[n]);this.options.subpixelPositioning||(s=s.round()),this._container.style.transform=`${Qu[n]} translate(${s.x}px,${s.y}px)`,t0(this._container,n,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=G(Object.create(Nb),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new R("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=X.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let e=document.createDocumentFragment(),i=document.createElement("body"),r;for(i.innerHTML=t;r=i.firstChild,r;)e.appendChild(r);return this.setDOMContent(e)}getMaxWidth(){var t;return(t=this._container)===null||t===void 0?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=N.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=N.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector(Vb);t&&t.focus()}},W.RasterDEMTileSource=Ph,W.RasterTileSource=Da,W.ScaleControl=class{constructor(t){this._onMove=()=>{e0(this._map,this._container,this.options)},this.setUnit=(e)=>{this.options.unit=e,e0(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},jb),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},W.ScrollZoomHandler=Zu,W.Style=el,W.TerrainControl=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=t}onAdd(t){return this._map=t,this._container=N.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=N.create("button","maplibregl-ctrl-terrain",this._container),N.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},W.TwoFingersTouchPitchHandler=Uu,W.TwoFingersTouchRotateHandler=Nu,W.TwoFingersTouchZoomHandler=ju,W.TwoFingersTouchZoomRotateHandler=Hu,W.VectorTileSource=Sh,W.VideoSource=Mh,W.addProtocol=function(t,e){ze.REGISTERED_PROTOCOLS[t]=e},W.addSourceType=(t,e)=>it(void 0,void 0,void 0,function*(){if(e_(t))throw Error(`A source type called "${t}" already exists.`);((i,r)=>{t_[i]=r})(t,e)}),W.clearPrewarmedResources=function(){let t=Io;t&&(t.isPreloaded()&&t.numActive()===1?(t.release(yh),Io=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},W.config=ze,W.createTileMesh=hg,W.getGlobalDispatcher=bh,W.getMaxParallelImageRequests=function(){return ze.MAX_PARALLEL_IMAGE_REQUESTS},W.getRTLTextPluginStatus=function(){return Ro().getRTLTextPluginStatus()},W.getVersion=function(){return Ub},W.getWorkerCount=function(){return on.workerCount},W.getWorkerUrl=function(){return ze.WORKER_URL},W.importScriptInWorkers=function(t){return bh().broadcast("IS",t)},W.isTimeFrozen=function(){return is.isFrozen()},W.now=St,W.prewarm=function(){vh().acquire(yh)},W.removeProtocol=function(t){delete ze.REGISTERED_PROTOCOLS[t]},W.restoreNow=function(){is.restoreNow()},W.setMaxParallelImageRequests=function(t){ze.MAX_PARALLEL_IMAGE_REQUESTS=t},W.setNow=function(t){is.setNow(t)},W.setRTLTextPlugin=function(t,e){return Ro().setRTLTextPlugin(t,e)},W.setWorkerCount=function(t){on.workerCount=t},W.setWorkerUrl=function(t){ze.WORKER_URL=t}})});var od=Dr(l0());od.default.setWorkerUrl("/_poad/runtime/maplibre-gl-csp-worker.js");var ow=od.default;export{ow as default};